@contractspec/lib.contracts-transformers 1.56.1 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/common/index.js +86 -0
- package/dist/browser/index.js +2414 -0
- package/dist/browser/openapi/index.js +2404 -0
- package/dist/common/index.d.ts +6 -3
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +87 -3
- package/dist/common/types.d.ts +119 -121
- package/dist/common/types.d.ts.map +1 -1
- package/dist/common/utils.d.ts +11 -14
- package/dist/common/utils.d.ts.map +1 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2415 -18
- package/dist/node/common/index.js +86 -0
- package/dist/node/index.js +2414 -0
- package/dist/node/openapi/index.js +2404 -0
- package/dist/openapi/differ.d.ts +21 -22
- package/dist/openapi/differ.d.ts.map +1 -1
- package/dist/openapi/exporter/data-views.d.ts +24 -26
- package/dist/openapi/exporter/data-views.d.ts.map +1 -1
- package/dist/openapi/exporter/events.d.ts +15 -16
- package/dist/openapi/exporter/events.d.ts.map +1 -1
- package/dist/openapi/exporter/features.d.ts +23 -25
- package/dist/openapi/exporter/features.d.ts.map +1 -1
- package/dist/openapi/exporter/forms.d.ts +17 -18
- package/dist/openapi/exporter/forms.d.ts.map +1 -1
- package/dist/openapi/exporter/index.d.ts +12 -0
- package/dist/openapi/exporter/index.d.ts.map +1 -0
- package/dist/openapi/exporter/operations.d.ts +29 -30
- package/dist/openapi/exporter/operations.d.ts.map +1 -1
- package/dist/openapi/exporter/presentations.d.ts +16 -18
- package/dist/openapi/exporter/presentations.d.ts.map +1 -1
- package/dist/openapi/exporter/registries.d.ts +13 -15
- package/dist/openapi/exporter/registries.d.ts.map +1 -1
- package/dist/openapi/exporter/workflows.d.ts +23 -25
- package/dist/openapi/exporter/workflows.d.ts.map +1 -1
- package/dist/openapi/exporter.d.ts +24 -24
- package/dist/openapi/exporter.d.ts.map +1 -1
- package/dist/openapi/exporter.test.d.ts +2 -0
- package/dist/openapi/exporter.test.d.ts.map +1 -0
- package/dist/openapi/importer/analyzer.d.ts +14 -0
- package/dist/openapi/importer/analyzer.d.ts.map +1 -0
- package/dist/openapi/importer/events.d.ts +7 -0
- package/dist/openapi/importer/events.d.ts.map +1 -0
- package/dist/openapi/importer/generator.d.ts +8 -0
- package/dist/openapi/importer/generator.d.ts.map +1 -0
- package/dist/openapi/importer/grouping.d.ts +27 -0
- package/dist/openapi/importer/grouping.d.ts.map +1 -0
- package/dist/openapi/importer/index.d.ts +11 -10
- package/dist/openapi/importer/index.d.ts.map +1 -1
- package/dist/openapi/importer/models.d.ts +7 -0
- package/dist/openapi/importer/models.d.ts.map +1 -0
- package/dist/openapi/importer/schemas.d.ts +15 -0
- package/dist/openapi/importer/schemas.d.ts.map +1 -0
- package/dist/openapi/importer.d.ts +6 -0
- package/dist/openapi/importer.d.ts.map +1 -0
- package/dist/openapi/index.d.ts +12 -16
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +2405 -18
- package/dist/openapi/parser/document.d.ts +5 -10
- package/dist/openapi/parser/document.d.ts.map +1 -1
- package/dist/openapi/parser/index.d.ts +6 -0
- package/dist/openapi/parser/index.d.ts.map +1 -0
- package/dist/openapi/parser/operation.d.ts +7 -0
- package/dist/openapi/parser/operation.d.ts.map +1 -0
- package/dist/openapi/parser/parameters.d.ts +11 -0
- package/dist/openapi/parser/parameters.d.ts.map +1 -0
- package/dist/openapi/parser/resolvers.d.ts +21 -0
- package/dist/openapi/parser/resolvers.d.ts.map +1 -0
- package/dist/openapi/parser/utils.d.ts +9 -9
- package/dist/openapi/parser/utils.d.ts.map +1 -1
- package/dist/openapi/parser.d.ts +6 -0
- package/dist/openapi/parser.d.ts.map +1 -0
- package/dist/openapi/schema-converter.d.ts +45 -46
- package/dist/openapi/schema-converter.d.ts.map +1 -1
- package/dist/openapi/schema-generators/index.d.ts +115 -0
- package/dist/openapi/schema-generators/index.d.ts.map +1 -0
- package/dist/openapi/schema-generators.test.d.ts +2 -0
- package/dist/openapi/schema-generators.test.d.ts.map +1 -0
- package/dist/openapi/types.d.ts +198 -200
- package/dist/openapi/types.d.ts.map +1 -1
- package/package.json +53 -20
- package/dist/common/utils.js +0 -103
- package/dist/common/utils.js.map +0 -1
- package/dist/openapi/differ.js +0 -222
- package/dist/openapi/differ.js.map +0 -1
- package/dist/openapi/exporter/data-views.js +0 -47
- package/dist/openapi/exporter/data-views.js.map +0 -1
- package/dist/openapi/exporter/events.js +0 -39
- package/dist/openapi/exporter/events.js.map +0 -1
- package/dist/openapi/exporter/features.js +0 -46
- package/dist/openapi/exporter/features.js.map +0 -1
- package/dist/openapi/exporter/forms.js +0 -49
- package/dist/openapi/exporter/forms.js.map +0 -1
- package/dist/openapi/exporter/index.js +0 -8
- package/dist/openapi/exporter/operations.js +0 -143
- package/dist/openapi/exporter/operations.js.map +0 -1
- package/dist/openapi/exporter/presentations.js +0 -60
- package/dist/openapi/exporter/presentations.js.map +0 -1
- package/dist/openapi/exporter/registries.js +0 -29
- package/dist/openapi/exporter/registries.js.map +0 -1
- package/dist/openapi/exporter/workflows.js +0 -54
- package/dist/openapi/exporter/workflows.js.map +0 -1
- package/dist/openapi/exporter.js +0 -122
- package/dist/openapi/exporter.js.map +0 -1
- package/dist/openapi/importer/analyzer.js +0 -28
- package/dist/openapi/importer/analyzer.js.map +0 -1
- package/dist/openapi/importer/events.js +0 -40
- package/dist/openapi/importer/events.js.map +0 -1
- package/dist/openapi/importer/generator.js +0 -105
- package/dist/openapi/importer/generator.js.map +0 -1
- package/dist/openapi/importer/grouping.js +0 -73
- package/dist/openapi/importer/grouping.js.map +0 -1
- package/dist/openapi/importer/index.js +0 -175
- package/dist/openapi/importer/index.js.map +0 -1
- package/dist/openapi/importer/models.js +0 -22
- package/dist/openapi/importer/models.js.map +0 -1
- package/dist/openapi/importer/schemas.js +0 -60
- package/dist/openapi/importer/schemas.js.map +0 -1
- package/dist/openapi/parser/document.js +0 -95
- package/dist/openapi/parser/document.js.map +0 -1
- package/dist/openapi/parser/index.js +0 -5
- package/dist/openapi/parser/operation.js +0 -59
- package/dist/openapi/parser/operation.js.map +0 -1
- package/dist/openapi/parser/parameters.js +0 -37
- package/dist/openapi/parser/parameters.js.map +0 -1
- package/dist/openapi/parser/resolvers.js +0 -63
- package/dist/openapi/parser/resolvers.js.map +0 -1
- package/dist/openapi/parser/utils.js +0 -48
- package/dist/openapi/parser/utils.js.map +0 -1
- package/dist/openapi/parser.js +0 -6
- package/dist/openapi/schema-converter.js +0 -161
- package/dist/openapi/schema-converter.js.map +0 -1
- package/dist/openapi/schema-generators/index.js +0 -462
- package/dist/openapi/schema-generators/index.js.map +0 -1
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Export ContractSpec specs to OpenAPI 3.1 format.
|
|
3
|
+
* Refactored to use modular exporters for all surfaces.
|
|
4
|
+
*/
|
|
5
|
+
import type { OperationSpecRegistry, FeatureRegistry, PresentationRegistry, FormRegistry, DataViewRegistry, WorkflowRegistry, EventSpec, PresentationSpec } from '@contractspec/lib.contracts';
|
|
6
|
+
import type { AnySchemaModel } from '@contractspec/lib.schema';
|
|
7
|
+
import type { ContractSpecOpenApiDocument, OpenApiExportOptions, ContractSpecExportOptions, ContractSpecExportResult } from './types';
|
|
8
|
+
import { defaultRestPath as defaultRestPathFn } from './exporter/operations';
|
|
8
9
|
/**
|
|
9
10
|
* Input registries for unified export.
|
|
10
11
|
*/
|
|
11
|
-
interface ContractSpecRegistries {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
export interface ContractSpecRegistries {
|
|
13
|
+
operations?: OperationSpecRegistry;
|
|
14
|
+
events?: EventSpec<AnySchemaModel>[];
|
|
15
|
+
features?: FeatureRegistry;
|
|
16
|
+
presentations?: PresentationRegistry;
|
|
17
|
+
presentationsArray?: PresentationSpec[];
|
|
18
|
+
forms?: FormRegistry;
|
|
19
|
+
dataViews?: DataViewRegistry;
|
|
20
|
+
workflows?: WorkflowRegistry;
|
|
20
21
|
}
|
|
22
|
+
export { defaultRestPathFn as defaultRestPath };
|
|
21
23
|
/**
|
|
22
24
|
* Export a OperationSpecRegistry to an OpenAPI 3.1 document.
|
|
23
25
|
* @deprecated Use exportContractSpec for full surface support.
|
|
24
26
|
*/
|
|
25
|
-
declare function openApiForRegistry(registry: OperationSpecRegistry, options?: OpenApiExportOptions): ContractSpecOpenApiDocument;
|
|
27
|
+
export declare function openApiForRegistry(registry: OperationSpecRegistry, options?: OpenApiExportOptions): ContractSpecOpenApiDocument;
|
|
26
28
|
/**
|
|
27
29
|
* Export all ContractSpec surfaces to OpenAPI document with extensions.
|
|
28
30
|
*/
|
|
29
|
-
declare function exportContractSpec(registries: ContractSpecRegistries, options?: ContractSpecExportOptions): ContractSpecExportResult;
|
|
31
|
+
export declare function exportContractSpec(registries: ContractSpecRegistries, options?: ContractSpecExportOptions): ContractSpecExportResult;
|
|
30
32
|
/**
|
|
31
33
|
* Export a OperationSpecRegistry to OpenAPI JSON string.
|
|
32
34
|
*/
|
|
33
|
-
declare function openApiToJson(registry: OperationSpecRegistry, options?: OpenApiExportOptions): string;
|
|
35
|
+
export declare function openApiToJson(registry: OperationSpecRegistry, options?: OpenApiExportOptions): string;
|
|
34
36
|
/**
|
|
35
37
|
* Export a OperationSpecRegistry to OpenAPI YAML string.
|
|
36
38
|
*/
|
|
37
|
-
declare function openApiToYaml(registry: OperationSpecRegistry, options?: OpenApiExportOptions): string;
|
|
39
|
+
export declare function openApiToYaml(registry: OperationSpecRegistry, options?: OpenApiExportOptions): string;
|
|
38
40
|
/**
|
|
39
41
|
* Export ContractSpec to JSON string (all surfaces).
|
|
40
42
|
*/
|
|
41
|
-
declare function contractSpecToJson(registries: ContractSpecRegistries, options?: ContractSpecExportOptions): string;
|
|
43
|
+
export declare function contractSpecToJson(registries: ContractSpecRegistries, options?: ContractSpecExportOptions): string;
|
|
42
44
|
/**
|
|
43
45
|
* Export ContractSpec to YAML string (all surfaces).
|
|
44
46
|
*/
|
|
45
|
-
declare function contractSpecToYaml(registries: ContractSpecRegistries, options?: ContractSpecExportOptions): string;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { ContractSpecRegistries, contractSpecToJson, contractSpecToYaml, exportContractSpec, openApiForRegistry, openApiToJson, openApiToYaml };
|
|
47
|
+
export declare function contractSpecToYaml(registries: ContractSpecRegistries, options?: ContractSpecExportOptions): string;
|
|
48
48
|
//# sourceMappingURL=exporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.d.ts","
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../src/openapi/exporter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAGL,eAAe,IAAI,iBAAiB,EACrC,MAAM,uBAAuB,CAAC;AAkB/B;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,MAAM,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACxC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAGD,OAAO,EAAE,iBAAiB,IAAI,eAAe,EAAE,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,GAAE,oBAAyB,GACjC,2BAA2B,CAc7B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,sBAAsB,EAClC,OAAO,GAAE,yBAA8B,GACtC,wBAAwB,CAyH1B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,sBAAsB,EAClC,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,sBAAsB,EAClC,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAGR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter.test.d.ts","sourceRoot":"","sources":["../../src/openapi/exporter.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ParsedOperation } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* HTTP methods that typically indicate a command (state-changing).
|
|
4
|
+
*/
|
|
5
|
+
export declare const COMMAND_METHODS: string[];
|
|
6
|
+
/**
|
|
7
|
+
* Determine if an operation is a command or query based on HTTP method.
|
|
8
|
+
*/
|
|
9
|
+
export declare function inferOpKind(method: string): 'command' | 'query';
|
|
10
|
+
/**
|
|
11
|
+
* Determine auth level based on security requirements.
|
|
12
|
+
*/
|
|
13
|
+
export declare function inferAuthLevel(operation: ParsedOperation, defaultAuth: 'anonymous' | 'user' | 'admin'): 'anonymous' | 'user' | 'admin';
|
|
14
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../../src/openapi/importer/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,eAAe,UAAqC,CAAC;AAElE;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,eAAe,EAC1B,WAAW,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,GAC1C,WAAW,GAAG,MAAM,GAAG,OAAO,CAchC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ParsedEvent } from '../types';
|
|
2
|
+
import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Generate code for an event.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateEventCode(event: ParsedEvent, options: ResolvedContractsrcConfig): string;
|
|
7
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/openapi/importer/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7E;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,yBAAyB,GACjC,MAAM,CAyDR"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ParsedOperation } from '../types';
|
|
2
|
+
import { type GeneratedModel } from '../schema-converter';
|
|
3
|
+
import type { ResolvedContractsrcConfig, OpenApiSourceConfig } from '@contractspec/lib.contracts';
|
|
4
|
+
/**
|
|
5
|
+
* Generate ContractSpec TypeScript code for an operation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateSpecCode(operation: ParsedOperation, contractspecConfig: ResolvedContractsrcConfig, options: Partial<OpenApiSourceConfig> | undefined, inputModel: GeneratedModel | null, outputModel: GeneratedModel | null, queryModel?: GeneratedModel | null, paramsModel?: GeneratedModel | null, headersModel?: GeneratedModel | null): string;
|
|
8
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/openapi/importer/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AAE3E,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,eAAe,EAC1B,kBAAkB,EAAE,yBAAyB,EAC7C,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,YAAK,EAC1C,UAAU,EAAE,cAAc,GAAG,IAAI,EACjC,WAAW,EAAE,cAAc,GAAG,IAAI,EAClC,UAAU,GAAE,cAAc,GAAG,IAAW,EACxC,WAAW,GAAE,cAAc,GAAG,IAAW,EACzC,YAAY,GAAE,cAAc,GAAG,IAAW,GACzC,MAAM,CA0IR"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grouping utilities for OpenAPI import/export.
|
|
3
|
+
* Determines output folder structure based on configuration.
|
|
4
|
+
*/
|
|
5
|
+
import type { FolderConventions } from '@contractspec/lib.contracts';
|
|
6
|
+
import type { ParsedOperation } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the group folder for an operation based on grouping config.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveOperationGroupFolder(operation: ParsedOperation, conventions: FolderConventions): string;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the group folder for a model based on grouping config.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveModelGroupFolder(modelName: string, conventions: FolderConventions, relatedPath?: string, relatedTags?: string[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the group folder for an event based on grouping config.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveEventGroupFolder(eventName: string, conventions: FolderConventions, relatedTags?: string[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Build full output path including group folder.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildOutputPath(baseDir: string, surfaceDir: string, groupFolder: string, fileName: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Determine if feature-based grouping should be applied.
|
|
25
|
+
*/
|
|
26
|
+
export declare function shouldGroupByFeature(conventions: FolderConventions): boolean;
|
|
27
|
+
//# sourceMappingURL=grouping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grouping.d.ts","sourceRoot":"","sources":["../../../src/openapi/importer/grouping.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAuBhD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,eAAe,EAC1B,WAAW,EAAE,iBAAiB,GAC7B,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,iBAAiB,EAC9B,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,iBAAiB,EAC9B,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,MAAM,CAWR;AAwED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAE5E"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { ParsedOperation, ParseResult } from '../types';
|
|
2
|
+
import type { ImportResult } from '../../common/types';
|
|
3
|
+
import type { ResolvedContractsrcConfig, OpenApiSourceConfig } from '@contractspec/lib.contracts';
|
|
4
|
+
export * from './analyzer';
|
|
5
|
+
export * from './schemas';
|
|
6
|
+
export * from './generator';
|
|
7
|
+
export * from './models';
|
|
8
|
+
export * from './events';
|
|
9
|
+
export * from './grouping';
|
|
7
10
|
/**
|
|
8
11
|
* Import operations from a parsed OpenAPI document.
|
|
9
12
|
*/
|
|
10
|
-
declare const importFromOpenApi: (parseResult: ParseResult, contractspecOptions: ResolvedContractsrcConfig, importOptions?: Partial<OpenApiSourceConfig>) => ImportResult;
|
|
13
|
+
export declare const importFromOpenApi: (parseResult: ParseResult, contractspecOptions: ResolvedContractsrcConfig, importOptions?: Partial<OpenApiSourceConfig>) => ImportResult;
|
|
11
14
|
/**
|
|
12
15
|
* Import a single operation to ContractSpec code.
|
|
13
16
|
*/
|
|
14
|
-
declare function importOperation(operation: ParsedOperation, options: Partial<OpenApiSourceConfig> | undefined, contractspecOptions: ResolvedContractsrcConfig): string;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { importFromOpenApi, importOperation };
|
|
17
|
+
export declare function importOperation(operation: ParsedOperation, options: Partial<OpenApiSourceConfig> | undefined, contractspecOptions: ResolvedContractsrcConfig): string;
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openapi/importer/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,eAAe,EACf,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAyB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAY9E,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAErC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,aAAa,WAAW,EACxB,qBAAqB,yBAAyB,EAC9C,gBAAe,OAAO,CAAC,mBAAmB,CAAM,KAC/C,YAsQF,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,YAAK,EAC1C,mBAAmB,EAAE,yBAAyB,GAC7C,MAAM,CA+DR"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OpenApiSchema } from '../types';
|
|
2
|
+
import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Generate code for a standalone model.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateModelCode(name: string, schema: OpenApiSchema, options: ResolvedContractsrcConfig): string;
|
|
7
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/openapi/importer/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7E;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,yBAAyB,GACjC,MAAM,CAuBR"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OpenApiSchema, ParsedOperation } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Build separate input schemas for each parameter source.
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildInputSchemas(operation: ParsedOperation): {
|
|
6
|
+
body?: OpenApiSchema;
|
|
7
|
+
query?: OpenApiSchema;
|
|
8
|
+
params?: OpenApiSchema;
|
|
9
|
+
headers?: OpenApiSchema;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Get the output schema from the operation responses.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getOutputSchema(operation: ParsedOperation): OpenApiSchema | null;
|
|
15
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/openapi/importer/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE/D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,eAAe,GAAG;IAC7D,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAsEA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,eAAe,GACzB,aAAa,GAAG,IAAI,CAmBtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../src/openapi/importer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,kBAAkB,CAAC"}
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import { GeneratedModel, SchemaField, TypescriptType, generateImports, generateSchemaModelCode, getScalarType, jsonSchemaToType } from "./schema-converter.js";
|
|
14
|
-
import { importFromOpenApi, importOperation } from "./importer/index.js";
|
|
15
|
-
import { DiffOptions, createSpecDiff, diffAll, diffSpecVsOperation, diffSpecs, formatDiffChanges } from "./differ.js";
|
|
16
|
-
export { type ContractSpecOpenApiDocument, type ContractSpecRegistries, type DiffOptions, ExportedDataView, ExportedEvent, ExportedFeature, ExportedForm, ExportedPresentation, ExportedWorkflow, type GeneratedModel, type HttpMethod, type OpenApiDocument, type OpenApiExportOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParseOptions, type OpenApiSchema, type OpenApiServer, type OpenApiSource, type OpenApiTransportHints, type OpenApiVersion, OperationsExportResult, type ParameterLocation, type ParseResult, type ParsedOperation, type ParsedParameter, RegistryGenerationOptions, type SchemaField, type TypescriptType, contractSpecToJson, contractSpecToYaml, createSpecDiff, defaultRestPath, detectFormat, detectVersion, diffAll, diffSpecVsOperation, diffSpecs, exportContractSpec, exportDataViews, exportEvents, exportFeatures, exportForms, exportOperations, exportPresentations, exportPresentationsFromArray, exportWorkflows, formatDiffChanges, generateDataViewsRegistry, generateEventsExports, generateFeaturesRegistry, generateFormsRegistry, generateImports, generateOperationsRegistry, generatePresentationsRegistry, generateRegistryIndex, generateSchemaModelCode, generateWorkflowsRegistry, getScalarType, importFromOpenApi, importOperation, jsonSchemaForSpec, jsonSchemaToType, openApiForRegistry, openApiToJson, openApiToYaml, parseOpenApi, parseOpenApiDocument, parseOpenApiString, schemaModelToJsonSchema, toHttpMethod, toOperationId, toRestPath, toSchemaName };
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI transformation module.
|
|
3
|
+
* Import/export between ContractSpec and OpenAPI 3.x.
|
|
4
|
+
*/
|
|
5
|
+
export type { OpenApiDocument, OpenApiOperation, OpenApiSchema, OpenApiParameter, OpenApiServer, OpenApiExportOptions, OpenApiParseOptions, OpenApiVersion, HttpMethod, ParameterLocation, ParsedOperation, ParsedParameter, ParseResult, OpenApiTransportHints, OpenApiSource, ContractSpecOpenApiDocument, } from './types';
|
|
6
|
+
export { parseOpenApi, parseOpenApiString, parseOpenApiDocument, detectFormat, detectVersion, } from './parser';
|
|
7
|
+
export { openApiForRegistry, openApiToJson, openApiToYaml, defaultRestPath, exportContractSpec, contractSpecToJson, contractSpecToYaml, type ContractSpecRegistries, } from './exporter';
|
|
8
|
+
export * from './exporter/index';
|
|
9
|
+
export { importFromOpenApi, importOperation } from './importer';
|
|
10
|
+
export { jsonSchemaToType, generateSchemaModelCode, generateImports, getScalarType, type TypescriptType, type SchemaField, type GeneratedModel, } from './schema-converter';
|
|
11
|
+
export { diffSpecVsOperation, diffSpecs, createSpecDiff, diffAll, formatDiffChanges, type DiffOptions, } from './differ';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/openapi/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,aAAa,GACd,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,eAAe,EAEf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC;AAGpB,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,OAAO,EACP,iBAAiB,EACjB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC"}
|