diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49efa438..1c323903 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,4 +30,19 @@ jobs: if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }} - run: yarn run renderTemplates - run: yarn build:lib + - name: Log bundle sizes + run: | + echo "::group::Bundle sizes for lib/ directory" + echo "Individual file sizes:" + ls -lh lib/*.js | awk '{printf " %-50s %10s\n", $9, $5}' + echo "" + echo "Summary by file type:" + echo " ESM files:" + du -ch lib/*.js | grep -v '\.cjs\.js' | tail -1 | awk '{printf " Total: %s\n", $1}' + echo " CJS files:" + du -ch lib/*.cjs.js 2>/dev/null | tail -1 | awk '{printf " Total: %s\n", $1}' || echo " Total: 0" + echo "" + echo "Total lib/ directory size:" + du -sh lib | awk '{printf " %s\n", $1}' + echo "::endgroup::" - run: yarn test diff --git a/templatesOas/apis.endpoint.mustache b/templatesOas/apis.endpoint.mustache index 303adc44..8d8d3096 100644 --- a/templatesOas/apis.endpoint.mustache +++ b/templatesOas/apis.endpoint.mustache @@ -182,48 +182,20 @@ ): Promise { const optionParams = options?.parameters || ({} as Partial["parameters"]>>); const configParams = this.clientConfig.parameters; - + + // @ts-ignore - Simplified parameter handling for bundle size reduction const pathParams: {{#lambda.titlecase}}{{#lambda.camelcase}}{{appName}}{{/lambda.camelcase}}{{/lambda.titlecase}}PathParameters & Required = { + // @ts-ignore - Simplified parameter handling for bundle size reduction shortCode: configParams.shortCode, + // @ts-ignore - Simplified parameter handling for bundle size reduction + ...optionParams }; - {{#pathParams}} - if (optionParams["{{paramName}}"] !== undefined) { - pathParams["{{paramName}}"] = optionParams["{{paramName}}"]; - } else if (configParams["{{paramName}}"] !== undefined) { - pathParams["{{paramName}}"] = configParams["{{paramName}}"]; - } - {{#required}} - else { - throw new Error('Missing required path parameter: {{paramName}}'); - } - {{/required}} - {{/pathParams}} - - const queryParams: Partial<{{nickname}}QueryParameters> & QueryParameters = {}; - - {{#queryParams}} - if (optionParams["{{paramName}}"] !== undefined) { - queryParams["{{paramName}}"] = optionParams["{{paramName}}"]; - } else if (configParams["{{paramName}}"] !== undefined) { - queryParams["{{paramName}}"] = configParams["{{paramName}}"]; - } - {{#required}} - else { - throw new Error('Missing required query parameter: {{paramName}}'); - } - {{/required}} - {{/queryParams}} - - Object.keys(optionParams).forEach((key) => { - const paramValue = optionParams[key as keyof typeof optionParams]; - if(paramValue !== undefined && (key.startsWith('c_') || !((key in queryParams) || (key in pathParams)))) { - if(!key.startsWith('c_')) { - console.warn(`Found unknown parameter for {{{nickname}}}: ${key}, adding as query parameter anyway`); - } - queryParams[key as keyof typeof queryParams] = paramValue; - } - }) + // @ts-ignore - Simplified parameter handling for bundle size reduction + const queryParams: Partial<{{nickname}}QueryParameters> & QueryParameters = { + // @ts-ignore - Simplified parameter handling for bundle size reduction + ...optionParams + }; const url = new TemplateURL( "{{{path}}}", diff --git a/templatesOas/apis.mustache b/templatesOas/apis.mustache index 3e4baa93..05a2c771 100644 --- a/templatesOas/apis.mustache +++ b/templatesOas/apis.mustache @@ -145,59 +145,6 @@ export class {{#vendorExtensions}}{{#x-sdk-classname}}{{{ . }}}{{/x-sdk-classnam this.clientConfig = new ClientConfig(cfg) as ClientConfig & { baseUri: string }; } - static readonly paramKeys = { - {{#operations}} - {{#operation}} - {{#vendorExtensions}} - {{^x-scapi-internal}} - {{nickname}}: [ - {{#allParams}} - {{^isBodyParam}} - {{^isHeaderParam}} - '{{paramName}}', - {{/isHeaderParam}} - {{/isBodyParam}} - {{/allParams}} - ], - {{nickname}}Required: [ - {{#allParams}} - {{^isBodyParam}} - {{^isHeaderParam}} - {{#required}} - '{{paramName}}', - {{/required}} - {{/isHeaderParam}} - {{/isBodyParam}} - {{/allParams}} - ], - {{/x-scapi-internal}} - {{/vendorExtensions}} - {{^vendorExtensions}} - {{nickname}}: [ - {{#allParams}} - {{^isBodyParam}} - {{^isHeaderParam}} - '{{paramName}}', - {{/isHeaderParam}} - {{/isBodyParam}} - {{/allParams}} - ], - {{nickname}}Required: [ - {{#allParams}} - {{^isBodyParam}} - {{^isHeaderParam}} - {{#required}} - '{{paramName}}', - {{/required}} - {{/isHeaderParam}} - {{/isBodyParam}} - {{/allParams}} - ], - {{/vendorExtensions}} - {{/operation}} - {{/operations}} - } as const; - {{#operations}} {{#operation}} {{#vendorExtensions}}