@skmtc/core 0.0.295 → 0.0.297
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/esm/context/CoreContext.d.ts +27 -54
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +103 -139
- package/esm/context/GenerateContext.d.ts +6 -4
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +84 -6
- package/esm/context/ParseContext.d.ts +11 -11
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +51 -5
- package/esm/context/RenderContext.d.ts +7 -19
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +55 -85
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/context/ResultsHandler.js +2 -6
- package/esm/context/StackTrail.d.ts +10 -0
- package/esm/context/StackTrail.d.ts.map +1 -0
- package/esm/context/StackTrail.js +68 -0
- package/esm/context/types.d.ts +13 -1
- package/esm/context/types.d.ts.map +1 -1
- package/esm/generate/generate.d.ts +6 -3
- package/esm/generate/generate.d.ts.map +1 -1
- package/esm/generate/generate.js +18 -45
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +0 -1
- package/esm/oas/operation/Operation.d.ts +1 -1
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +1 -1
- package/esm/server/createServer.d.ts.map +1 -1
- package/esm/server/createServer.js +12 -13
- package/esm/types/Manifest.d.ts +11 -43
- package/esm/types/Manifest.d.ts.map +1 -1
- package/esm/types/Manifest.js +1 -5
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +27 -54
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +103 -139
- package/script/context/GenerateContext.d.ts +6 -4
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +106 -5
- package/script/context/ParseContext.d.ts +11 -11
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +76 -6
- package/script/context/RenderContext.d.ts +7 -19
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +55 -85
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/context/ResultsHandler.js +2 -6
- package/script/context/StackTrail.d.ts +10 -0
- package/script/context/StackTrail.d.ts.map +1 -0
- package/script/context/StackTrail.js +72 -0
- package/script/context/types.d.ts +13 -1
- package/script/context/types.d.ts.map +1 -1
- package/script/generate/generate.d.ts +6 -3
- package/script/generate/generate.d.ts.map +1 -1
- package/script/generate/generate.js +19 -47
- package/script/mod.d.ts +0 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +0 -1
- package/script/oas/operation/Operation.d.ts +1 -1
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +1 -1
- package/script/server/createServer.d.ts.map +1 -1
- package/script/server/createServer.js +11 -12
- package/script/types/Manifest.d.ts +11 -43
- package/script/types/Manifest.d.ts.map +1 -1
- package/script/types/Manifest.js +1 -5
- package/esm/generate/generateModels.d.ts +0 -3
- package/esm/generate/generateModels.d.ts.map +0 -1
- package/esm/generate/generateModels.js +0 -44
- package/esm/generate/generateOperations.d.ts +0 -3
- package/esm/generate/generateOperations.d.ts.map +0 -1
- package/esm/generate/generateOperations.js +0 -53
- package/esm/parse/parse.d.ts +0 -4
- package/esm/parse/parse.d.ts.map +0 -1
- package/esm/parse/parse.js +0 -16
- package/script/generate/generateModels.d.ts +0 -3
- package/script/generate/generateModels.d.ts.map +0 -1
- package/script/generate/generateModels.js +0 -71
- package/script/generate/generateOperations.d.ts +0 -3
- package/script/generate/generateOperations.d.ts.map +0 -1
- package/script/generate/generateOperations.js +0 -80
- package/script/parse/parse.d.ts +0 -4
- package/script/parse/parse.d.ts.map +0 -1
- package/script/parse/parse.js +0 -20
|
@@ -29,7 +29,7 @@ type ToOperationV3Args = {
|
|
|
29
29
|
context: CoreContext;
|
|
30
30
|
skipped: Record<string, unknown>;
|
|
31
31
|
};
|
|
32
|
-
/** Operation represents a resource path and a method that can be
|
|
32
|
+
/** Operation represents a resource path and a method that can be enacted against it */
|
|
33
33
|
export declare class OasOperation extends OasBase {
|
|
34
34
|
#private;
|
|
35
35
|
oasType: 'operation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,WAAW,CAAA;IACrB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS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,EAAE,oBAAoB,EAAE,GAAG,YAAY,EAAE;IAUzD,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE;IAYlD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,QAAQ,IAAI,WAAW,CAE1B;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED,IAAI,IAAI,IAAI,MAAM,EAAE,GAAG,SAAS,CAE/B;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,UAAU,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,SAAS,CAEnE;IAED,IAAI,WAAW,IAAI,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,SAAS,CAEpE;IAED,IAAI,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAEhE;IAED,IAAI,UAAU,IAAI,OAAO,GAAG,SAAS,CAEpC;CACF"}
|
|
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _OasOperation_fields;
|
|
13
13
|
import { OasBase } from '../../dsl/OasBase.js';
|
|
14
14
|
import { OasObject } from '../object/Object.js';
|
|
15
|
-
/** Operation represents a resource path and a method that can be
|
|
15
|
+
/** Operation represents a resource path and a method that can be enacted against it */
|
|
16
16
|
export class OasOperation extends OasBase {
|
|
17
17
|
constructor({ fields, trail, skipped, context }) {
|
|
18
18
|
super({ trail, skipped, context });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServer.d.ts","sourceRoot":"","sources":["../../src/server/createServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAK3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"createServer.d.ts","sourceRoot":"","sources":["../../src/server/createServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAK3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAiB/D,eAAO,MAAM,YAAY,eACX,CAAC,kBAAkB,GAAG,cAAc,CAAC,EAAE,KAClD,IAuGF,CAAA"}
|
|
@@ -3,10 +3,8 @@ import { Hono } from 'hono';
|
|
|
3
3
|
import { match } from 'ts-pattern';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { clientSettings as settingsSchema } from '../types/Settings.js';
|
|
6
|
-
import { generate
|
|
7
|
-
import { ParseContext } from '../context/ParseContext.js';
|
|
6
|
+
import { generate } from '../generate/generate.js';
|
|
8
7
|
import { CoreContext } from '../context/CoreContext.js';
|
|
9
|
-
import { oasToSkmtc } from '../parse/parse.js';
|
|
10
8
|
const postSettingsBody = z.object({
|
|
11
9
|
schema: z.string(),
|
|
12
10
|
clientSettings: settingsSchema.optional()
|
|
@@ -26,7 +24,7 @@ export const createServer = (generators) => {
|
|
|
26
24
|
return Sentry.startSpan({ name: 'Generate' }, () => {
|
|
27
25
|
const generatorsMap = Object.fromEntries(generators.map(generator => [generator.id, generator]));
|
|
28
26
|
const { traceId, spanId } = span.spanContext();
|
|
29
|
-
|
|
27
|
+
const { artifacts, manifest, renderDependencies } = generate({
|
|
30
28
|
traceId,
|
|
31
29
|
spanId,
|
|
32
30
|
startAt,
|
|
@@ -35,6 +33,7 @@ export const createServer = (generators) => {
|
|
|
35
33
|
settings: clientSettings,
|
|
36
34
|
generatorsMap
|
|
37
35
|
});
|
|
36
|
+
return { artifacts, manifest, renderDependencies };
|
|
38
37
|
});
|
|
39
38
|
});
|
|
40
39
|
return c.json(result);
|
|
@@ -43,10 +42,13 @@ export const createServer = (generators) => {
|
|
|
43
42
|
return Sentry.startSpan({ name: 'GET /generators' }, () => c.json({ generators }));
|
|
44
43
|
});
|
|
45
44
|
app.post('/settings', async (c) => {
|
|
46
|
-
return await Sentry.startSpan({ name: 'POST /settings' }, async () => {
|
|
45
|
+
return await Sentry.startSpan({ name: 'POST /settings' }, async (span) => {
|
|
47
46
|
const body = await c.req.json();
|
|
48
47
|
const { clientSettings } = postSettingsBody.parse(body);
|
|
49
|
-
const oasDocument =
|
|
48
|
+
const oasDocument = toOasDocument({
|
|
49
|
+
schema: body.schema,
|
|
50
|
+
spanId: span.spanContext().spanId
|
|
51
|
+
});
|
|
50
52
|
const out = generators.map(generator => {
|
|
51
53
|
const generatorSettings = clientSettings?.generators?.find(({ id }) => id === generator.id);
|
|
52
54
|
const generatorType = generator.type;
|
|
@@ -101,13 +103,10 @@ const toOperations = ({ generator, oasDocument, operationsSettings }) => {
|
|
|
101
103
|
return acc;
|
|
102
104
|
}, {});
|
|
103
105
|
};
|
|
104
|
-
const toOasDocument = ({ schema,
|
|
105
|
-
const parsedDocument = parseSchema(schema);
|
|
106
|
-
const parseContext = new ParseContext({ parsedDocument });
|
|
106
|
+
const toOasDocument = ({ schema, spanId }) => {
|
|
107
107
|
const context = new CoreContext({
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
spanId
|
|
108
|
+
spanId,
|
|
109
|
+
schema
|
|
111
110
|
});
|
|
112
|
-
return
|
|
111
|
+
return context.parse();
|
|
113
112
|
};
|
package/esm/types/Manifest.d.ts
CHANGED
|
@@ -15,17 +15,17 @@ export declare const manifestEntry: z.ZodObject<{
|
|
|
15
15
|
generatorKeys: z.ZodArray<z.ZodEffects<z.ZodString, GeneratorKey, string>, "many">;
|
|
16
16
|
destinationPath: z.ZodString;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
destinationPath: string;
|
|
19
18
|
numberOfLines: number;
|
|
20
19
|
numberOfCharacters: number;
|
|
21
20
|
hash: string;
|
|
22
21
|
generatorKeys: GeneratorKey[];
|
|
23
|
-
}, {
|
|
24
22
|
destinationPath: string;
|
|
23
|
+
}, {
|
|
25
24
|
numberOfLines: number;
|
|
26
25
|
numberOfCharacters: number;
|
|
27
26
|
hash: string;
|
|
28
27
|
generatorKeys: string[];
|
|
28
|
+
destinationPath: string;
|
|
29
29
|
}>;
|
|
30
30
|
export type SuccessWarningError = 'success' | 'warning' | 'error';
|
|
31
31
|
export type WarningError = 'warning' | 'error';
|
|
@@ -37,19 +37,7 @@ export type Results = {
|
|
|
37
37
|
generate: Record<OperationGeneratorKey | ModelGeneratorKey, SuccessWarningError>;
|
|
38
38
|
render: SuccessWarningError;
|
|
39
39
|
};
|
|
40
|
-
export declare const results: z.
|
|
41
|
-
parse: z.ZodEnum<["success", "warning", "error"]>;
|
|
42
|
-
generate: z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>;
|
|
43
|
-
render: z.ZodEnum<["success", "warning", "error"]>;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
parse: "success" | "warning" | "error";
|
|
46
|
-
generate: Record<string, "success" | "warning" | "error">;
|
|
47
|
-
render: "success" | "warning" | "error";
|
|
48
|
-
}, {
|
|
49
|
-
parse: "success" | "warning" | "error";
|
|
50
|
-
generate: Record<string, "success" | "warning" | "error">;
|
|
51
|
-
render: "success" | "warning" | "error";
|
|
52
|
-
}>;
|
|
40
|
+
export declare const results: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<["success", "warning", "error"]>, z.ZodUndefined]>>;
|
|
53
41
|
export declare const phaseResults: z.ZodObject<{
|
|
54
42
|
parseResult: z.ZodEnum<["success", "warning", "error"]>;
|
|
55
43
|
generateResult: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>>;
|
|
@@ -70,7 +58,7 @@ export type ManifestContent = {
|
|
|
70
58
|
region?: string;
|
|
71
59
|
files: Record<string, ManifestEntry>;
|
|
72
60
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
73
|
-
results:
|
|
61
|
+
results: Record<string, SuccessWarningError | undefined>;
|
|
74
62
|
startAt: number;
|
|
75
63
|
endAt: number;
|
|
76
64
|
};
|
|
@@ -86,32 +74,20 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
86
74
|
generatorKeys: z.ZodArray<z.ZodEffects<z.ZodString, GeneratorKey, string>, "many">;
|
|
87
75
|
destinationPath: z.ZodString;
|
|
88
76
|
}, "strip", z.ZodTypeAny, {
|
|
89
|
-
destinationPath: string;
|
|
90
77
|
numberOfLines: number;
|
|
91
78
|
numberOfCharacters: number;
|
|
92
79
|
hash: string;
|
|
93
80
|
generatorKeys: GeneratorKey[];
|
|
94
|
-
}, {
|
|
95
81
|
destinationPath: string;
|
|
82
|
+
}, {
|
|
96
83
|
numberOfLines: number;
|
|
97
84
|
numberOfCharacters: number;
|
|
98
85
|
hash: string;
|
|
99
86
|
generatorKeys: string[];
|
|
87
|
+
destinationPath: string;
|
|
100
88
|
}>>;
|
|
101
89
|
pinnable: z.ZodRecord<z.ZodEffects<z.ZodString, GeneratorKey, string>, z.ZodString>;
|
|
102
|
-
results: z.
|
|
103
|
-
parse: z.ZodEnum<["success", "warning", "error"]>;
|
|
104
|
-
generate: z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>;
|
|
105
|
-
render: z.ZodEnum<["success", "warning", "error"]>;
|
|
106
|
-
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
parse: "success" | "warning" | "error";
|
|
108
|
-
generate: Record<string, "success" | "warning" | "error">;
|
|
109
|
-
render: "success" | "warning" | "error";
|
|
110
|
-
}, {
|
|
111
|
-
parse: "success" | "warning" | "error";
|
|
112
|
-
generate: Record<string, "success" | "warning" | "error">;
|
|
113
|
-
render: "success" | "warning" | "error";
|
|
114
|
-
}>;
|
|
90
|
+
results: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<["success", "warning", "error"]>, z.ZodUndefined]>>;
|
|
115
91
|
startAt: z.ZodNumber;
|
|
116
92
|
endAt: z.ZodNumber;
|
|
117
93
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -119,18 +95,14 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
119
95
|
traceId: string;
|
|
120
96
|
spanId: string;
|
|
121
97
|
files: Record<string, {
|
|
122
|
-
destinationPath: string;
|
|
123
98
|
numberOfLines: number;
|
|
124
99
|
numberOfCharacters: number;
|
|
125
100
|
hash: string;
|
|
126
101
|
generatorKeys: GeneratorKey[];
|
|
102
|
+
destinationPath: string;
|
|
127
103
|
}>;
|
|
128
104
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
129
|
-
results:
|
|
130
|
-
parse: "success" | "warning" | "error";
|
|
131
|
-
generate: Record<string, "success" | "warning" | "error">;
|
|
132
|
-
render: "success" | "warning" | "error";
|
|
133
|
-
};
|
|
105
|
+
results: Record<string, "success" | "warning" | "error" | undefined>;
|
|
134
106
|
startAt: number;
|
|
135
107
|
endAt: number;
|
|
136
108
|
region?: string | undefined;
|
|
@@ -139,18 +111,14 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
139
111
|
traceId: string;
|
|
140
112
|
spanId: string;
|
|
141
113
|
files: Record<string, {
|
|
142
|
-
destinationPath: string;
|
|
143
114
|
numberOfLines: number;
|
|
144
115
|
numberOfCharacters: number;
|
|
145
116
|
hash: string;
|
|
146
117
|
generatorKeys: string[];
|
|
118
|
+
destinationPath: string;
|
|
147
119
|
}>;
|
|
148
120
|
pinnable: Record<string, string>;
|
|
149
|
-
results:
|
|
150
|
-
parse: "success" | "warning" | "error";
|
|
151
|
-
generate: Record<string, "success" | "warning" | "error">;
|
|
152
|
-
render: "success" | "warning" | "error";
|
|
153
|
-
};
|
|
121
|
+
results: Record<string, "success" | "warning" | "error" | undefined>;
|
|
154
122
|
startAt: number;
|
|
155
123
|
endAt: number;
|
|
156
124
|
region?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../src/types/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,YAAY,EAAE,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAMxB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAEjE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9C,eAAO,MAAM,mBAAmB,4CAA0C,CAAA;AAE1E,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAA;AAEhF,eAAO,MAAM,cAAc,gGAA0C,CAAA;AAErE,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,mBAAmB,CAAA;IAC1B,QAAQ,EAAE,MAAM,CACd,qBAAqB,GAAG,iBAAiB,EACzC,mBAAmB,CACpB,CAAA;IACD,MAAM,EAAE,mBAAmB,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../src/types/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OA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,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC,CAAA;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU1B,CAAA"}
|
package/esm/types/Manifest.js
CHANGED
|
@@ -10,11 +10,7 @@ export const manifestEntry = z.object({
|
|
|
10
10
|
});
|
|
11
11
|
export const successWarningError = z.enum(['success', 'warning', 'error']);
|
|
12
12
|
export const generateResult = z.record(z.record(successWarningError));
|
|
13
|
-
export const results = z.
|
|
14
|
-
parse: successWarningError,
|
|
15
|
-
generate: z.record(successWarningError),
|
|
16
|
-
render: successWarningError
|
|
17
|
-
});
|
|
13
|
+
export const results = z.record(z.union([successWarningError, z.undefined()]));
|
|
18
14
|
export const phaseResults = z.object({
|
|
19
15
|
parseResult: successWarningError,
|
|
20
16
|
generateResult: generateResult,
|
package/package.json
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { GenerateContext } from './GenerateContext.js';
|
|
2
1
|
import type { AddRenderDependencyArgs, GetModelSettingsArgs, GetOperationSettingsArgs, PickArgs, RegisterArgs, InsertReturn, InsertArgs } from './GenerateContext.js';
|
|
3
|
-
import {
|
|
4
|
-
import type { AddGeneratorKeyArgs, FileContents, RenderDependencies, RenderOptions } from './types.js';
|
|
5
|
-
import type { ParseContext } from './ParseContext.js';
|
|
2
|
+
import type { AddGeneratorKeyArgs, FileContents, RenderDependencies } from './types.js';
|
|
6
3
|
import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
7
4
|
import type { OasDocument } from '../oas/document/Document.js';
|
|
8
|
-
import type { OpenAPIV3 } from 'openapi-types';
|
|
9
5
|
import type { BaseSettings, ClientSettings } from '../types/Settings.js';
|
|
10
6
|
import type { Definition } from '../dsl/Definition.js';
|
|
11
7
|
import type { OperationGenerator } from '../dsl/OperationInsertable.js';
|
|
@@ -15,84 +11,61 @@ import type { OasSchema } from '../oas/schema/Schema.js';
|
|
|
15
11
|
import type { OasRef } from '../oas/ref/Ref.js';
|
|
16
12
|
import type { GenerationType } from '../types/GeneratedValue.js';
|
|
17
13
|
import type { RefName } from '../types/RefName.js';
|
|
18
|
-
import type {
|
|
19
|
-
import type { Results, SuccessWarningError, WarningError } from '../types/Manifest.js';
|
|
14
|
+
import type { SuccessWarningError } from '../types/Manifest.js';
|
|
20
15
|
import * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
21
|
-
|
|
22
|
-
type: 'parse';
|
|
23
|
-
context: ParseContext;
|
|
24
|
-
} | {
|
|
25
|
-
type: 'generate';
|
|
26
|
-
context: GenerateContext;
|
|
27
|
-
} | {
|
|
28
|
-
type: 'render';
|
|
29
|
-
context: RenderContext;
|
|
30
|
-
};
|
|
31
|
-
type GenerateArgs = {
|
|
32
|
-
schemaModel: OasDocument;
|
|
33
|
-
generatorsMap: Record<string, OperationGenerator | ModelGenerator>;
|
|
34
|
-
settings: ClientSettings | undefined;
|
|
35
|
-
};
|
|
16
|
+
import { StackTrail } from './StackTrail.js';
|
|
36
17
|
type CoreContextArgs = {
|
|
37
|
-
traceId: string;
|
|
38
18
|
spanId: string;
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
type RenderArgs = {
|
|
42
|
-
renderDependencies: RenderDependencies;
|
|
43
|
-
packageDependencies: Map<string, string>;
|
|
44
|
-
prettier?: PrettierConfigType;
|
|
45
|
-
settings: ClientSettings | undefined;
|
|
46
|
-
pinnableGenerators: string[];
|
|
19
|
+
schema: string;
|
|
47
20
|
};
|
|
48
21
|
type CaptureResultArgs = {
|
|
49
|
-
|
|
50
|
-
result: WarningError;
|
|
51
|
-
} | {
|
|
52
|
-
phase: 'generate';
|
|
53
|
-
generatorKey: OperationGeneratorKey | ModelGeneratorKey;
|
|
22
|
+
stackTrail: string;
|
|
54
23
|
result: SuccessWarningError;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
};
|
|
25
|
+
type TransformArgs = {
|
|
26
|
+
settings: ClientSettings | undefined;
|
|
27
|
+
generatorsMap: Record<string, OperationGenerator | ModelGenerator>;
|
|
28
|
+
prettier?: PrettierConfigType;
|
|
58
29
|
};
|
|
59
30
|
export declare class CoreContext {
|
|
60
31
|
#private;
|
|
61
|
-
|
|
62
|
-
spanId:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
32
|
+
logger: log.Logger;
|
|
33
|
+
constructor({ schema, spanId }: CoreContextArgs);
|
|
34
|
+
parse(): OasDocument;
|
|
35
|
+
transform({ settings, generatorsMap, prettier }: TransformArgs): {
|
|
36
|
+
results: Record<string, SuccessWarningError | undefined>;
|
|
37
|
+
files: Record<string, import("../types/Manifest.js").ManifestEntry>;
|
|
38
|
+
pinnable: Partial<Record<import("../mod.js").GeneratorKey, string>>;
|
|
39
|
+
renderDependencies: Record<string, string[]>;
|
|
40
|
+
artifacts: Record<string, string>;
|
|
41
|
+
};
|
|
42
|
+
captureResult({ stackTrail, result }: CaptureResultArgs): void;
|
|
43
|
+
captureCurrentResult(result: SuccessWarningError): void;
|
|
68
44
|
get phaseType(): 'parse' | 'generate' | 'render';
|
|
69
|
-
|
|
70
|
-
|
|
45
|
+
appendStackTrailChunk(chunk: string | string[] | StackTrail): void;
|
|
46
|
+
removeStackTrailChunk(chunk: string | string[] | StackTrail): void;
|
|
71
47
|
register({ destinationPath, ...args }: RegisterArgs): void;
|
|
72
48
|
addGeneratorKey({ generatorKey }: AddGeneratorKeyArgs): void;
|
|
73
49
|
resolveSchemaRefOnce(refName: RefName): OasSchema | OasRef<'schema'>;
|
|
74
50
|
addRenderDependency(args: AddRenderDependencyArgs): void;
|
|
75
51
|
getFile(filePath: string): FileContents;
|
|
76
52
|
findDefinition(args: PickArgs): Definition<GeneratedValue> | undefined;
|
|
77
|
-
render(options: RenderOptions): FilesRenderResult;
|
|
78
53
|
addFile(normalisedPath: string): FileContents;
|
|
79
54
|
getOperationBaseSettings(args: GetOperationSettingsArgs): BaseSettings;
|
|
80
55
|
insert<V extends GeneratedValue, T extends GenerationType>(args: InsertArgs<V, T>): InsertReturn<V, T>;
|
|
81
56
|
getModelBaseSettings(args: GetModelSettingsArgs): BaseSettings;
|
|
82
|
-
get results(): Results;
|
|
83
57
|
get files(): Map<string, FileContents>;
|
|
84
58
|
get renderDependencies(): RenderDependencies;
|
|
85
59
|
get packageDependencies(): Map<string, string>;
|
|
86
60
|
get schemaModel(): OasDocument;
|
|
87
61
|
get generatorsMap(): Record<string, OperationGenerator | ModelGenerator>;
|
|
88
|
-
get parsedDocument(): OpenAPIV3.Document;
|
|
89
62
|
get settings(): ClientSettings | undefined;
|
|
90
63
|
}
|
|
91
64
|
export type JsonFormatterArgs = {
|
|
92
65
|
logRecord: log.LogRecord;
|
|
93
|
-
|
|
66
|
+
stackTrail: StackTrail;
|
|
94
67
|
};
|
|
95
|
-
export declare function skmtcFormatter({ logRecord,
|
|
96
|
-
export declare function resultFormatter({ logRecord,
|
|
68
|
+
export declare function skmtcFormatter({ logRecord, stackTrail }: JsonFormatterArgs): string;
|
|
69
|
+
export declare function resultFormatter({ logRecord, stackTrail }: JsonFormatterArgs): string;
|
|
97
70
|
export {};
|
|
98
71
|
//# sourceMappingURL=CoreContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,UAAU,EACX,MAAM,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