diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 9048cfb0a..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Release - -on: - push: - branches: - - '**' - -jobs: - release: - if: "!contains(github.repository, 'package-seed')" - uses: paytweed/ci-cd/.github/workflows/release.yml@main - secrets: - PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} diff --git a/src/client/interfaces/OperationParameter.d.ts b/src/client/interfaces/OperationParameter.d.ts index 77c0da771..c9074f5f1 100644 --- a/src/client/interfaces/OperationParameter.d.ts +++ b/src/client/interfaces/OperationParameter.d.ts @@ -1,7 +1,7 @@ import type { Model } from './Model'; export interface OperationParameter extends Model { - in: 'path' | 'query' | 'header' | 'formData' | 'body' | 'cookie'; + in: 'path' | 'query' | 'header' | 'formData' | 'body' | 'cookie' | 'param'; prop: string; mediaType: string | null; } diff --git a/src/openApi/v2/parser/getOperation.ts b/src/openApi/v2/parser/getOperation.ts index 9aa157460..26262181c 100644 --- a/src/openApi/v2/parser/getOperation.ts +++ b/src/openApi/v2/parser/getOperation.ts @@ -70,6 +70,27 @@ export const getOperation = ( }); } + operation.parameters.push({ + name: 'context', + type: 'TweedBaseContext', + in: 'param', + base: 'TweedBaseContext', + description: 'Tweed context for context propagation', + export: 'generic', + isDefinition: false, + isNullable: false, + isReadOnly: false, + isRequired: true, + link: null, + mediaType: null, + prop: '', + properties: [], + enum: [], + enums: [], + imports: [], + template: null, + }); + operation.parameters = operation.parameters.sort(sortByRequired); return operation; diff --git a/src/openApi/v3/parser/getOperation.ts b/src/openApi/v3/parser/getOperation.ts index aee4bd0c2..8b9e6e63e 100644 --- a/src/openApi/v3/parser/getOperation.ts +++ b/src/openApi/v3/parser/getOperation.ts @@ -82,6 +82,26 @@ export const getOperation = ( } operation.parameters = operation.parameters.sort(sortByRequired); + operation.parameters.push({ + name: 'context', + type: 'TweedBaseContext', + in: 'param', + base: 'TweedBaseContext', + description: 'Tweed context for context propagation', + export: 'generic', + isDefinition: false, + isNullable: false, + isReadOnly: false, + isRequired: true, + link: null, + mediaType: null, + prop: '', + properties: [], + enum: [], + enums: [], + imports: [], + template: null, + }); return operation; }; diff --git a/src/templates/core/ApiRequestOptions.hbs b/src/templates/core/ApiRequestOptions.hbs index e19de1499..65ea9079c 100644 --- a/src/templates/core/ApiRequestOptions.hbs +++ b/src/templates/core/ApiRequestOptions.hbs @@ -1,10 +1,12 @@ {{>header}} -import { TweedBaseContext } from "@paytweed/context"; + + +import { TweedBaseContext } from '@paytweed/context'; export type ApiRequestOptions = { readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; readonly url: string; - readonly context: TweedContext + readonly context: TweedBaseContext readonly path?: Record; readonly cookies?: Record; readonly headers?: Record; diff --git a/src/templates/core/BaseHttpRequest.hbs b/src/templates/core/BaseHttpRequest.hbs index 43ff79cbb..ce96a7fba 100644 --- a/src/templates/core/BaseHttpRequest.hbs +++ b/src/templates/core/BaseHttpRequest.hbs @@ -8,7 +8,7 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { OpenAPIConfig } from './OpenAPI'; {{else}} import type { ApiRequestOptions } from './ApiRequestOptions'; -import type { CancelablePromise } from './CancelablePromise'; +import { AxiosResponse } from '@paytweed/http-client'; import type { OpenAPIConfig } from './OpenAPI'; {{/equals}} @@ -26,6 +26,6 @@ export abstract class BaseHttpRequest { {{#equals @root.httpClient 'angular'}} public abstract request(options: ApiRequestOptions): Observable; {{else}} - public abstract request(options: ApiRequestOptions): CancelablePromise; + public abstract request(options: ApiRequestOptions): Promise>; {{/equals}} } diff --git a/src/templates/exportService.hbs b/src/templates/exportService.hbs index d6bccbbeb..79726b5bd 100644 --- a/src/templates/exportService.hbs +++ b/src/templates/exportService.hbs @@ -18,7 +18,8 @@ import type { {{{this}}} } from '../models/{{{this}}}'; {{/if}} {{#notEquals @root.httpClient 'angular'}} -import type { CancelablePromise } from '../core/CancelablePromise'; +import { AxiosResponse } from '@paytweed/http-client'; +import { TweedBaseContext } from '@paytweed/context'; {{/notEquals}} {{#if @root.exportClient}} {{#equals @root.httpClient 'angular'}} @@ -75,7 +76,7 @@ export class {{{name}}}{{{@root.postfix}}} { public {{{name}}}({{>parameters}}): Observable<{{>result}}> { return this.httpRequest.request({ {{else}} - public {{{name}}}({{>parameters}}): CancelablePromise<{{>result}}> { + public {{{name}}}({{>parameters}}): Promiseresult}}>> { return this.httpRequest.request({ {{/equals}} {{else}} @@ -83,12 +84,13 @@ export class {{{name}}}{{{@root.postfix}}} { public {{{name}}}({{>parameters}}): Observable<{{>result}}> { return __request(OpenAPI, this.http, { {{else}} - public static {{{name}}}({{>parameters}}): CancelablePromise<{{>result}}> { + public static {{{name}}}({{>parameters}}): Promiseresult}}>> { return __request(OpenAPI, { {{/equals}} {{/if}} method: '{{{method}}}', url: '{{{path}}}', + context, {{#if parametersPath}} path: { {{#each parametersPath}}