|
| 1 | +import * as Handlebars from 'handlebars'; |
| 2 | +import { resolveHandlebarTemplate } from './resolveHandlebarTemplate'; |
| 3 | + |
| 4 | +export const registerHandlebarPartials = () => { |
| 5 | + // Partials for the generations of the models, services, etc. |
| 6 | + Handlebars.registerPartial('exportEnum', resolveHandlebarTemplate('partials/exportEnum')); |
| 7 | + Handlebars.registerPartial('exportInterface', resolveHandlebarTemplate('partials/exportInterface')); |
| 8 | + Handlebars.registerPartial('exportType', resolveHandlebarTemplate('partials/exportType')); |
| 9 | + Handlebars.registerPartial('extends', resolveHandlebarTemplate('partials/extends')); |
| 10 | + Handlebars.registerPartial('header', resolveHandlebarTemplate('partials/header')); |
| 11 | + Handlebars.registerPartial('isNullable', resolveHandlebarTemplate('partials/isNullable')); |
| 12 | + Handlebars.registerPartial('isReadOnly', resolveHandlebarTemplate('partials/isReadOnly')); |
| 13 | + Handlebars.registerPartial('isRequired', resolveHandlebarTemplate('partials/isRequired')); |
| 14 | + Handlebars.registerPartial('parameters', resolveHandlebarTemplate('partials/parameters')); |
| 15 | + Handlebars.registerPartial('result', resolveHandlebarTemplate('partials/result')); |
| 16 | + Handlebars.registerPartial('schema', resolveHandlebarTemplate('partials/schema')); |
| 17 | + Handlebars.registerPartial('schemaArray', resolveHandlebarTemplate('partials/schemaArray')); |
| 18 | + Handlebars.registerPartial('schemaDictionary', resolveHandlebarTemplate('partials/schemaDictionary')); |
| 19 | + Handlebars.registerPartial('schemaEnum', resolveHandlebarTemplate('partials/schemaEnum')); |
| 20 | + Handlebars.registerPartial('schemaGeneric', resolveHandlebarTemplate('partials/schemaGeneric')); |
| 21 | + Handlebars.registerPartial('schemaInterface', resolveHandlebarTemplate('partials/schemaInterface')); |
| 22 | + Handlebars.registerPartial('type', resolveHandlebarTemplate('partials/type')); |
| 23 | + Handlebars.registerPartial('typeArray', resolveHandlebarTemplate('partials/typeArray')); |
| 24 | + Handlebars.registerPartial('typeDictionary', resolveHandlebarTemplate('partials/typeDictionary')); |
| 25 | + Handlebars.registerPartial('typeEnum', resolveHandlebarTemplate('partials/typeEnum')); |
| 26 | + Handlebars.registerPartial('typeGeneric', resolveHandlebarTemplate('partials/typeGeneric')); |
| 27 | + Handlebars.registerPartial('typeInterface', resolveHandlebarTemplate('partials/typeInterface')); |
| 28 | + Handlebars.registerPartial('typeReference', resolveHandlebarTemplate('partials/typeReference')); |
| 29 | + Handlebars.registerPartial('base', resolveHandlebarTemplate('partials/base')); |
| 30 | + |
| 31 | + // Generic functions used in 'request' file @see src/templates/core/request.hbs for more info |
| 32 | + Handlebars.registerPartial('functions/catchErrors', resolveHandlebarTemplate('core/functions/catchErrors')); |
| 33 | + Handlebars.registerPartial('functions/getFormData', resolveHandlebarTemplate('core/functions/getFormData')); |
| 34 | + Handlebars.registerPartial('functions/getToken', resolveHandlebarTemplate('core/functions/getToken')); |
| 35 | + Handlebars.registerPartial('functions/getQueryString', resolveHandlebarTemplate('core/functions/getQueryString')); |
| 36 | + Handlebars.registerPartial('functions/getUrl', resolveHandlebarTemplate('core/functions/getUrl')); |
| 37 | + Handlebars.registerPartial('functions/isBinary', resolveHandlebarTemplate('core/functions/isBinary')); |
| 38 | + Handlebars.registerPartial('functions/isBlob', resolveHandlebarTemplate('core/functions/isBlob')); |
| 39 | + Handlebars.registerPartial('functions/isDefined', resolveHandlebarTemplate('core/functions/isDefined')); |
| 40 | + Handlebars.registerPartial('functions/isString', resolveHandlebarTemplate('core/functions/isString')); |
| 41 | + Handlebars.registerPartial('functions/isSuccess', resolveHandlebarTemplate('core/functions/isSuccess')); |
| 42 | + |
| 43 | + // Specific files for the fetch client implementation |
| 44 | + Handlebars.registerPartial('fetch/getHeaders', resolveHandlebarTemplate('core/fetch/getHeaders')); |
| 45 | + Handlebars.registerPartial('fetch/getRequestBody', resolveHandlebarTemplate('core/fetch/getRequestBody')); |
| 46 | + Handlebars.registerPartial('fetch/getResponseBody', resolveHandlebarTemplate('core/fetch/getResponseBody')); |
| 47 | + Handlebars.registerPartial('fetch/getResponseHeader', resolveHandlebarTemplate('core/fetch/getResponseHeader')); |
| 48 | + Handlebars.registerPartial('fetch/sendRequest', resolveHandlebarTemplate('core/fetch/sendRequest')); |
| 49 | + Handlebars.registerPartial('fetch/request', resolveHandlebarTemplate('core/fetch/request')); |
| 50 | + |
| 51 | + // Specific files for the xhr client implementation |
| 52 | + Handlebars.registerPartial('xhr/getHeaders', resolveHandlebarTemplate('core/xhr/getHeaders')); |
| 53 | + Handlebars.registerPartial('xhr/getRequestBody', resolveHandlebarTemplate('core/xhr/getRequestBody')); |
| 54 | + Handlebars.registerPartial('xhr/getResponseBody', resolveHandlebarTemplate('core/xhr/getResponseBody')); |
| 55 | + Handlebars.registerPartial('xhr/getResponseHeader', resolveHandlebarTemplate('core/xhr/getResponseHeader')); |
| 56 | + Handlebars.registerPartial('xhr/sendRequest', resolveHandlebarTemplate('core/xhr/sendRequest')); |
| 57 | + Handlebars.registerPartial('xhr/request', resolveHandlebarTemplate('core/xhr/request')); |
| 58 | + |
| 59 | + // Specific files for the node client implementation |
| 60 | + Handlebars.registerPartial('node/getHeaders', resolveHandlebarTemplate('core/node/getHeaders')); |
| 61 | + Handlebars.registerPartial('node/getRequestBody', resolveHandlebarTemplate('core/node/getRequestBody')); |
| 62 | + Handlebars.registerPartial('node/getResponseBody', resolveHandlebarTemplate('core/node/getResponseBody')); |
| 63 | + Handlebars.registerPartial('node/getResponseHeader', resolveHandlebarTemplate('core/node/getResponseHeader')); |
| 64 | + Handlebars.registerPartial('node/sendRequest', resolveHandlebarTemplate('core/node/sendRequest')); |
| 65 | + Handlebars.registerPartial('node/request', resolveHandlebarTemplate('core/node/request')); |
| 66 | +}; |
0 commit comments