@contractspec/lib.contracts-transformers 1.57.0 → 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 -120
- 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 -21
- package/dist/openapi/differ.d.ts.map +1 -1
- package/dist/openapi/exporter/data-views.d.ts +24 -25
- package/dist/openapi/exporter/data-views.d.ts.map +1 -1
- package/dist/openapi/exporter/events.d.ts +15 -15
- package/dist/openapi/exporter/events.d.ts.map +1 -1
- package/dist/openapi/exporter/features.d.ts +23 -24
- package/dist/openapi/exporter/features.d.ts.map +1 -1
- package/dist/openapi/exporter/forms.d.ts +17 -17
- 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 -29
- package/dist/openapi/exporter/operations.d.ts.map +1 -1
- package/dist/openapi/exporter/presentations.d.ts +16 -17
- package/dist/openapi/exporter/presentations.d.ts.map +1 -1
- package/dist/openapi/exporter/registries.d.ts +13 -14
- package/dist/openapi/exporter/registries.d.ts.map +1 -1
- package/dist/openapi/exporter/workflows.d.ts +23 -24
- package/dist/openapi/exporter/workflows.d.ts.map +1 -1
- package/dist/openapi/exporter.d.ts +24 -23
- 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 -9
- 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 -9
- 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 -8
- 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 -45
- 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 -198
- 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 -72
- 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 -461
- package/dist/openapi/schema-generators/index.js.map +0 -1
package/dist/common/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Common types and utilities for contract transformations.
|
|
3
|
+
*/
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './utils';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/common/index.js
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/common/utils.ts
|
|
3
|
+
function toPascalCase(str) {
|
|
4
|
+
return str.replace(/[-_./\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").replace(/^./, (c) => c.toUpperCase());
|
|
5
|
+
}
|
|
6
|
+
function toCamelCase(str) {
|
|
7
|
+
const pascal = toPascalCase(str);
|
|
8
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
9
|
+
}
|
|
10
|
+
function toKebabCase(str) {
|
|
11
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_./]+/g, "-").toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
function toSnakeCase(str) {
|
|
14
|
+
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s\-./]+/g, "_").toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
function toValidIdentifier(str) {
|
|
17
|
+
let result = str.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
18
|
+
if (/^[0-9]/.test(result)) {
|
|
19
|
+
result = "_" + result;
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
function toSpecKey(operationId, prefix) {
|
|
24
|
+
const key = toCamelCase(operationId);
|
|
25
|
+
return prefix ? `${prefix}.${key}` : key;
|
|
26
|
+
}
|
|
27
|
+
function toFileName(specName) {
|
|
28
|
+
return toKebabCase(specName.replace(/\./g, "-")) + ".ts";
|
|
29
|
+
}
|
|
30
|
+
function deepEqual(a, b) {
|
|
31
|
+
if (a === b)
|
|
32
|
+
return true;
|
|
33
|
+
if (a === null || b === null)
|
|
34
|
+
return false;
|
|
35
|
+
if (typeof a !== typeof b)
|
|
36
|
+
return false;
|
|
37
|
+
if (typeof a === "object") {
|
|
38
|
+
const aObj = a;
|
|
39
|
+
const bObj = b;
|
|
40
|
+
const aKeys = Object.keys(aObj);
|
|
41
|
+
const bKeys = Object.keys(bObj);
|
|
42
|
+
if (aKeys.length !== bKeys.length)
|
|
43
|
+
return false;
|
|
44
|
+
for (const key of aKeys) {
|
|
45
|
+
if (!bKeys.includes(key))
|
|
46
|
+
return false;
|
|
47
|
+
if (!deepEqual(aObj[key], bObj[key]))
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
function getByPath(obj, path) {
|
|
55
|
+
const parts = path.split(".").filter(Boolean);
|
|
56
|
+
let current = obj;
|
|
57
|
+
for (const part of parts) {
|
|
58
|
+
if (current === null || current === undefined)
|
|
59
|
+
return;
|
|
60
|
+
if (typeof current !== "object")
|
|
61
|
+
return;
|
|
62
|
+
current = current[part];
|
|
63
|
+
}
|
|
64
|
+
return current;
|
|
65
|
+
}
|
|
66
|
+
function extractPathParams(path) {
|
|
67
|
+
const matches = path.match(/\{([^}]+)\}/g) || [];
|
|
68
|
+
return matches.map((m) => m.slice(1, -1));
|
|
69
|
+
}
|
|
70
|
+
function normalizePath(path) {
|
|
71
|
+
let normalized = path.replace(/^\/+|\/+$/g, "");
|
|
72
|
+
normalized = normalized.replace(/\/+/g, "/");
|
|
73
|
+
return "/" + normalized;
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
toValidIdentifier,
|
|
77
|
+
toSpecKey,
|
|
78
|
+
toSnakeCase,
|
|
79
|
+
toPascalCase,
|
|
80
|
+
toKebabCase,
|
|
81
|
+
toFileName,
|
|
82
|
+
toCamelCase,
|
|
83
|
+
normalizePath,
|
|
84
|
+
getByPath,
|
|
85
|
+
extractPathParams,
|
|
86
|
+
deepEqual
|
|
87
|
+
};
|
package/dist/common/types.d.ts
CHANGED
|
@@ -1,158 +1,157 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Common types for contract transformations.
|
|
3
|
+
*/
|
|
4
|
+
import type { AnyOperationSpec } from '@contractspec/lib.contracts';
|
|
4
5
|
/**
|
|
5
6
|
* Source information for imported specs.
|
|
6
7
|
*/
|
|
7
|
-
interface SpecSource {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
export interface SpecSource {
|
|
9
|
+
/** The format the spec was imported from */
|
|
10
|
+
type: 'openapi' | 'asyncapi' | 'graphql' | 'protobuf';
|
|
11
|
+
/** URL if fetched from remote */
|
|
12
|
+
url?: string;
|
|
13
|
+
/** File path if loaded from local file */
|
|
14
|
+
file?: string;
|
|
15
|
+
/** Original identifier in source format */
|
|
16
|
+
sourceId: string;
|
|
17
|
+
/** Timestamp of import */
|
|
18
|
+
importedAt: Date;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Transport hints preserved from external formats.
|
|
21
22
|
* These enable accurate round-trip transformations.
|
|
22
23
|
*/
|
|
23
|
-
interface TransportHints {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
export interface TransportHints {
|
|
25
|
+
rest?: {
|
|
26
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
27
|
+
path: string;
|
|
28
|
+
params?: {
|
|
29
|
+
path?: string[];
|
|
30
|
+
query?: string[];
|
|
31
|
+
header?: string[];
|
|
32
|
+
cookie?: string[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
graphql?: {
|
|
36
|
+
type: 'query' | 'mutation' | 'subscription';
|
|
37
|
+
fieldName: string;
|
|
32
38
|
};
|
|
33
|
-
};
|
|
34
|
-
graphql?: {
|
|
35
|
-
type: 'query' | 'mutation' | 'subscription';
|
|
36
|
-
fieldName: string;
|
|
37
|
-
};
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Result of importing a single spec from an external format.
|
|
41
42
|
*/
|
|
42
|
-
interface ImportedOperationSpec {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
export interface ImportedOperationSpec {
|
|
44
|
+
/**
|
|
45
|
+
* The generated ContractSpec.
|
|
46
|
+
* Optional because during code generation the actual spec object is not
|
|
47
|
+
* available until the generated code is executed at runtime.
|
|
48
|
+
*/
|
|
49
|
+
operationSpec?: AnyOperationSpec;
|
|
50
|
+
/** Generated TypeScript code for the spec */
|
|
51
|
+
code: string;
|
|
52
|
+
/** Suggested file name for the spec */
|
|
53
|
+
fileName: string;
|
|
54
|
+
/** Group folder for organizing the file (based on grouping config) */
|
|
55
|
+
groupFolder?: string;
|
|
56
|
+
/** Source information for provenance tracking */
|
|
57
|
+
source: SpecSource;
|
|
58
|
+
/** Transport hints for accurate round-trips */
|
|
59
|
+
transportHints: TransportHints;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* Result of an import operation.
|
|
62
63
|
*/
|
|
63
|
-
interface ImportResult {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
export interface ImportResult {
|
|
65
|
+
/** Successfully imported specs */
|
|
66
|
+
operationSpecs: ImportedOperationSpec[];
|
|
67
|
+
/** Specs that were skipped (e.g., unsupported features) */
|
|
68
|
+
skipped: {
|
|
69
|
+
sourceId: string;
|
|
70
|
+
reason: string;
|
|
71
|
+
}[];
|
|
72
|
+
/** Errors encountered during import */
|
|
73
|
+
errors: {
|
|
74
|
+
sourceId: string;
|
|
75
|
+
error: string;
|
|
76
|
+
}[];
|
|
77
|
+
/** Summary statistics */
|
|
78
|
+
summary: {
|
|
79
|
+
total: number;
|
|
80
|
+
imported: number;
|
|
81
|
+
skipped: number;
|
|
82
|
+
errors: number;
|
|
83
|
+
};
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
85
86
|
* Type of change detected during diff.
|
|
86
87
|
*/
|
|
87
|
-
type DiffChangeType = 'added' | 'removed' | 'modified' | 'type_changed' | 'required_changed';
|
|
88
|
+
export type DiffChangeType = 'added' | 'removed' | 'modified' | 'type_changed' | 'required_changed';
|
|
88
89
|
/**
|
|
89
90
|
* A single change detected during diff.
|
|
90
91
|
*/
|
|
91
|
-
interface DiffChange {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
export interface DiffChange {
|
|
93
|
+
/** JSON path to the changed property */
|
|
94
|
+
path: string;
|
|
95
|
+
/** Type of change */
|
|
96
|
+
type: DiffChangeType;
|
|
97
|
+
/** Previous value (for modified/removed) */
|
|
98
|
+
oldValue?: unknown;
|
|
99
|
+
/** New value (for modified/added) */
|
|
100
|
+
newValue?: unknown;
|
|
101
|
+
/** Human-readable description of the change */
|
|
102
|
+
description: string;
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
104
105
|
* Result of diffing two specs.
|
|
105
106
|
*/
|
|
106
|
-
interface SpecDiff {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
107
|
+
export interface SpecDiff {
|
|
108
|
+
/** Identifier for the operation */
|
|
109
|
+
operationId: string;
|
|
110
|
+
/** Existing ContractSpec (if any) */
|
|
111
|
+
existing?: AnyOperationSpec;
|
|
112
|
+
/** Incoming imported spec */
|
|
113
|
+
incoming: ImportedOperationSpec;
|
|
114
|
+
/** List of detected changes */
|
|
115
|
+
changes: DiffChange[];
|
|
116
|
+
/** Whether specs are semantically equivalent */
|
|
117
|
+
isEquivalent: boolean;
|
|
118
|
+
/** User's resolution choice (for interactive sync) */
|
|
119
|
+
resolution?: 'keep' | 'replace' | 'merge' | 'skip';
|
|
119
120
|
}
|
|
120
121
|
/**
|
|
121
122
|
* Result of a sync operation.
|
|
122
123
|
*/
|
|
123
|
-
interface SyncResult {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
export interface SyncResult {
|
|
125
|
+
/** Specs that were added (new imports) */
|
|
126
|
+
added: ImportedOperationSpec[];
|
|
127
|
+
/** Specs that were updated */
|
|
128
|
+
updated: {
|
|
129
|
+
spec: ImportedOperationSpec;
|
|
130
|
+
changes: DiffChange[];
|
|
131
|
+
}[];
|
|
132
|
+
/** Specs that were kept unchanged */
|
|
133
|
+
unchanged: string[];
|
|
134
|
+
/** Specs that had conflicts requiring resolution */
|
|
135
|
+
conflicts: SpecDiff[];
|
|
136
|
+
/** Summary statistics */
|
|
137
|
+
summary: {
|
|
138
|
+
added: number;
|
|
139
|
+
updated: number;
|
|
140
|
+
unchanged: number;
|
|
141
|
+
conflicts: number;
|
|
142
|
+
};
|
|
142
143
|
}
|
|
143
144
|
/**
|
|
144
145
|
* Validation result for a single spec.
|
|
145
146
|
*/
|
|
146
|
-
interface ValidationResult {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
export interface ValidationResult {
|
|
148
|
+
/** Whether the spec is valid against the source */
|
|
149
|
+
valid: boolean;
|
|
150
|
+
/** Detected differences */
|
|
151
|
+
diffs: DiffChange[];
|
|
152
|
+
/** Validation errors */
|
|
153
|
+
errors: string[];
|
|
154
|
+
/** Validation warnings */
|
|
155
|
+
warnings: string[];
|
|
155
156
|
}
|
|
156
|
-
//#endregion
|
|
157
|
-
export { DiffChange, DiffChangeType, ImportResult, ImportedOperationSpec, SpecDiff, SpecSource, SyncResult, TransportHints, ValidationResult };
|
|
158
157
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"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"}
|
package/dist/common/utils.d.ts
CHANGED
|
@@ -1,52 +1,49 @@
|
|
|
1
|
-
//#region src/common/utils.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Common utilities for contract transformations.
|
|
4
3
|
*/
|
|
5
4
|
/**
|
|
6
5
|
* Convert a string to PascalCase.
|
|
7
6
|
*/
|
|
8
|
-
declare function toPascalCase(str: string): string;
|
|
7
|
+
export declare function toPascalCase(str: string): string;
|
|
9
8
|
/**
|
|
10
9
|
* Convert a string to camelCase.
|
|
11
10
|
*/
|
|
12
|
-
declare function toCamelCase(str: string): string;
|
|
11
|
+
export declare function toCamelCase(str: string): string;
|
|
13
12
|
/**
|
|
14
13
|
* Convert a string to kebab-case.
|
|
15
14
|
*/
|
|
16
|
-
declare function toKebabCase(str: string): string;
|
|
15
|
+
export declare function toKebabCase(str: string): string;
|
|
17
16
|
/**
|
|
18
17
|
* Convert a string to snake_case.
|
|
19
18
|
*/
|
|
20
|
-
declare function toSnakeCase(str: string): string;
|
|
19
|
+
export declare function toSnakeCase(str: string): string;
|
|
21
20
|
/**
|
|
22
21
|
* Sanitize a string to be a valid TypeScript identifier.
|
|
23
22
|
*/
|
|
24
|
-
declare function toValidIdentifier(str: string): string;
|
|
23
|
+
export declare function toValidIdentifier(str: string): string;
|
|
25
24
|
/**
|
|
26
25
|
* Generate a ContractSpec key from an operation identifier.
|
|
27
26
|
*/
|
|
28
|
-
declare function toSpecKey(operationId: string, prefix?: string): string;
|
|
27
|
+
export declare function toSpecKey(operationId: string, prefix?: string): string;
|
|
29
28
|
/**
|
|
30
29
|
* Generate a file name from a spec name.
|
|
31
30
|
*/
|
|
32
|
-
declare function toFileName(specName: string): string;
|
|
31
|
+
export declare function toFileName(specName: string): string;
|
|
33
32
|
/**
|
|
34
33
|
* Deep equality check for objects.
|
|
35
34
|
*/
|
|
36
|
-
declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
35
|
+
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
37
36
|
/**
|
|
38
37
|
* Get a value from an object by JSON path.
|
|
39
38
|
*/
|
|
40
|
-
declare function getByPath(obj: unknown, path: string): unknown;
|
|
39
|
+
export declare function getByPath(obj: unknown, path: string): unknown;
|
|
41
40
|
/**
|
|
42
41
|
* Extract path parameters from a URL path template.
|
|
43
42
|
* e.g., "/users/{userId}/orders/{orderId}" -> ["userId", "orderId"]
|
|
44
43
|
*/
|
|
45
|
-
declare function extractPathParams(path: string): string[];
|
|
44
|
+
export declare function extractPathParams(path: string): string[];
|
|
46
45
|
/**
|
|
47
46
|
* Normalize a URL path for comparison.
|
|
48
47
|
*/
|
|
49
|
-
declare function normalizePath(path: string): string;
|
|
50
|
-
//#endregion
|
|
51
|
-
export { deepEqual, extractPathParams, getByPath, normalizePath, toCamelCase, toFileName, toKebabCase, toPascalCase, toSnakeCase, toSpecKey, toValidIdentifier };
|
|
48
|
+
export declare function normalizePath(path: string): string;
|
|
52
49
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAuBzD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAW7D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAGxD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOlD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @contractspec/lib.contracts-transformers
|
|
3
|
+
*
|
|
4
|
+
* Contract format transformations: bidirectional import/export between
|
|
5
|
+
* ContractSpec and external API specification formats.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Export to OpenAPI
|
|
10
|
+
* import { openApiForRegistry } from '@contractspec/lib.contracts-transformers/openapi';
|
|
11
|
+
*
|
|
12
|
+
* // Import from OpenAPI
|
|
13
|
+
* import { parseOpenApi, importFromOpenApi } from '@contractspec/lib.contracts-transformers/openapi';
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export * from './openapi';
|
|
17
|
+
export * from './common';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|