@skmtc/core 0.0.307 → 0.0.308
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 +3 -27
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +20 -201
- package/esm/context/GenerateContext.d.ts +11 -14
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +48 -64
- package/esm/context/RenderContext.d.ts +5 -11
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +7 -38
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/context/ResultsHandler.js +0 -1
- package/esm/context/types.d.ts +0 -5
- package/esm/context/types.d.ts.map +1 -1
- package/esm/dsl/Definition.d.ts +2 -2
- package/esm/dsl/Definition.d.ts.map +1 -1
- package/esm/dsl/ModelDriver.d.ts +3 -3
- package/esm/dsl/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/ModelInsertable.d.ts +3 -3
- package/esm/dsl/ModelInsertable.d.ts.map +1 -1
- package/esm/dsl/OperationDriver.d.ts +3 -3
- package/esm/dsl/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/OperationInsertable.d.ts +3 -3
- package/esm/dsl/OperationInsertable.d.ts.map +1 -1
- package/esm/dsl/ValueBase.d.ts +3 -3
- package/esm/dsl/ValueBase.d.ts.map +1 -1
- package/esm/dsl/ValueBase.js +1 -3
- package/esm/dsl/base.d.ts +3 -4
- package/esm/dsl/base.d.ts.map +1 -1
- package/esm/dsl/withConfig.d.ts +7 -7
- package/esm/dsl/withConfig.d.ts.map +1 -1
- package/esm/generate/generate.d.ts +0 -1
- package/esm/generate/generate.d.ts.map +1 -1
- package/esm/generate/generate.js +6 -6
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +1 -0
- package/esm/server/createServer.d.ts.map +1 -1
- package/esm/server/createServer.js +3 -7
- package/esm/types/CustomValue.d.ts +2 -2
- package/esm/types/CustomValue.d.ts.map +1 -1
- package/esm/typescript/PathParams.d.ts +3 -3
- package/esm/typescript/PathParams.d.ts.map +1 -1
- package/esm/typescript/ReactRouterPathParams.d.ts +2 -2
- package/esm/typescript/ReactRouterPathParams.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +3 -27
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +20 -201
- package/script/context/GenerateContext.d.ts +11 -14
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +48 -64
- package/script/context/RenderContext.d.ts +5 -11
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +7 -38
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/context/ResultsHandler.js +0 -1
- package/script/context/types.d.ts +0 -5
- package/script/context/types.d.ts.map +1 -1
- package/script/dsl/Definition.d.ts +2 -2
- package/script/dsl/Definition.d.ts.map +1 -1
- package/script/dsl/ModelDriver.d.ts +3 -3
- package/script/dsl/ModelDriver.d.ts.map +1 -1
- package/script/dsl/ModelInsertable.d.ts +3 -3
- package/script/dsl/ModelInsertable.d.ts.map +1 -1
- package/script/dsl/OperationDriver.d.ts +3 -3
- package/script/dsl/OperationDriver.d.ts.map +1 -1
- package/script/dsl/OperationInsertable.d.ts +3 -3
- package/script/dsl/OperationInsertable.d.ts.map +1 -1
- package/script/dsl/ValueBase.d.ts +3 -3
- package/script/dsl/ValueBase.d.ts.map +1 -1
- package/script/dsl/ValueBase.js +1 -3
- package/script/dsl/base.d.ts +3 -4
- package/script/dsl/base.d.ts.map +1 -1
- package/script/dsl/withConfig.d.ts +7 -7
- package/script/dsl/withConfig.d.ts.map +1 -1
- package/script/generate/generate.d.ts +0 -1
- package/script/generate/generate.d.ts.map +1 -1
- package/script/generate/generate.js +6 -6
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +1 -0
- package/script/server/createServer.d.ts.map +1 -1
- package/script/server/createServer.js +3 -7
- package/script/types/CustomValue.d.ts +2 -2
- package/script/types/CustomValue.d.ts.map +1 -1
- package/script/typescript/PathParams.d.ts +3 -3
- package/script/typescript/PathParams.d.ts.map +1 -1
- package/script/typescript/ReactRouterPathParams.d.ts +2 -2
- package/script/typescript/ReactRouterPathParams.d.ts.map +1 -1
package/esm/dsl/base.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import type { CoreContext } from '../context/CoreContext.js';
|
|
2
1
|
import type { OperationInsertable } from './OperationInsertable.js';
|
|
3
2
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
4
3
|
import type { ContentSettings } from './ContentSettings.js';
|
|
5
4
|
import type { ModelInsertable } from './ModelInsertable.js';
|
|
6
|
-
import type { RegisterArgs } from '../context/GenerateContext.js';
|
|
5
|
+
import type { GenerateContext, RegisterArgs } from '../context/GenerateContext.js';
|
|
7
6
|
import type { GeneratedValue } from '../types/GeneratedValue.js';
|
|
8
7
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
9
8
|
import { ValueBase } from './ValueBase.js';
|
|
10
9
|
import type { Definition } from './Definition.js';
|
|
11
10
|
import type { RefName } from '../types/RefName.js';
|
|
12
11
|
export type OperationBaseArgs = {
|
|
13
|
-
context:
|
|
12
|
+
context: GenerateContext;
|
|
14
13
|
settings: ContentSettings;
|
|
15
14
|
generatorKey: GeneratorKey;
|
|
16
15
|
operation: OasOperation;
|
|
@@ -33,7 +32,7 @@ export declare class OperationBase extends ValueBase {
|
|
|
33
32
|
register(args: Partial<RegisterArgs>): void;
|
|
34
33
|
}
|
|
35
34
|
export type ModelBaseArgs = {
|
|
36
|
-
context:
|
|
35
|
+
context: GenerateContext;
|
|
37
36
|
settings: ContentSettings;
|
|
38
37
|
generatorKey: GeneratorKey;
|
|
39
38
|
refName: RefName;
|
package/esm/dsl/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/dsl/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/dsl/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,EAAE,YAAY,CAAA;CACxB,CAAA;AAED,KAAK,aAAa,CAAC,CAAC,SAAS,cAAc,IACvC;IACE,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAClC,SAAS,EAAE,YAAY,CAAA;CACxB,GACD;IACE,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAEL,qBAAa,aAAc,SAAQ,SAAS;IAC1C,QAAQ,EAAE,eAAe,CAAA;IACzB,SAAS,EAAE,YAAY,CAAA;gBAEX,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,SAAS,EACV,EAAE,iBAAiB;IAOpB,MAAM,CAAC,CAAC,SAAS,cAAc,EAC7B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACrB;QAAE,QAAQ,EAAE,eAAe,CAAC;QAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;KAAE;IAY3D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC;CAMrC;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,qBAAa,SAAU,SAAQ,SAAS;IACtC,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;gBACJ,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,aAAa;IAOvE,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;IAQ1D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC;CAMrC"}
|
package/esm/dsl/withConfig.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
2
2
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
3
3
|
import type { ContentSettings } from './ContentSettings.js';
|
|
4
4
|
import type { RefName } from '../types/RefName.js';
|
|
@@ -6,7 +6,7 @@ import { EntityType } from './EntityType.js';
|
|
|
6
6
|
import type { IsModelSelectedArgs, ToModelExportPathArgs, ToModelNameArgs } from './ModelInsertable.js';
|
|
7
7
|
import type { IsOperationSelectedArgs, ToOperationExportPathArgs, ToOperationNameArgs } from './OperationInsertable.js';
|
|
8
8
|
export type GeneratorConfigConstructor = {
|
|
9
|
-
context:
|
|
9
|
+
context: GenerateContext;
|
|
10
10
|
};
|
|
11
11
|
export type OperationGeneratorConfig = GeneratorConfig & OperationConfig & {
|
|
12
12
|
isSupported: (operation: OasOperation) => boolean;
|
|
@@ -23,7 +23,7 @@ export type OperationConfig = {
|
|
|
23
23
|
isSelected({ operation, baseSettings }: IsOperationSelectedArgs): boolean;
|
|
24
24
|
};
|
|
25
25
|
export type OperationInsertableArgs = {
|
|
26
|
-
context:
|
|
26
|
+
context: GenerateContext;
|
|
27
27
|
settings: ContentSettings;
|
|
28
28
|
operation: OasOperation;
|
|
29
29
|
};
|
|
@@ -42,7 +42,7 @@ export declare const toOperationInsertable: (config: OperationConfig) => {
|
|
|
42
42
|
definition: import("./Definition.js").Definition<V>;
|
|
43
43
|
};
|
|
44
44
|
register(args: Partial<import("../context/GenerateContext.js").RegisterArgs>): void;
|
|
45
|
-
context:
|
|
45
|
+
context: GenerateContext;
|
|
46
46
|
skipped: boolean;
|
|
47
47
|
generatorKey: import("../types/GeneratorKeys.js").GeneratorKey;
|
|
48
48
|
};
|
|
@@ -61,7 +61,7 @@ type ModelConfig = {
|
|
|
61
61
|
isSelected({ refName, baseSettings }: IsModelSelectedArgs): boolean;
|
|
62
62
|
};
|
|
63
63
|
export type ModelInsertableArgs = {
|
|
64
|
-
context:
|
|
64
|
+
context: GenerateContext;
|
|
65
65
|
settings: ContentSettings;
|
|
66
66
|
refName: RefName;
|
|
67
67
|
};
|
|
@@ -77,7 +77,7 @@ export declare const toModelInsertable: (config: ModelConfig) => {
|
|
|
77
77
|
refName: RefName;
|
|
78
78
|
}): void;
|
|
79
79
|
register(args: Partial<import("../context/GenerateContext.js").RegisterArgs>): void;
|
|
80
|
-
context:
|
|
80
|
+
context: GenerateContext;
|
|
81
81
|
skipped: boolean;
|
|
82
82
|
generatorKey: import("../types/GeneratorKeys.js").GeneratorKey;
|
|
83
83
|
};
|
|
@@ -99,7 +99,7 @@ export declare const toGeneratorBase: (config: GeneratorConfig & ({
|
|
|
99
99
|
type: "model";
|
|
100
100
|
})) => {
|
|
101
101
|
new ({ context }: GeneratorConfigConstructor): {
|
|
102
|
-
context:
|
|
102
|
+
context: GenerateContext;
|
|
103
103
|
};
|
|
104
104
|
id: string;
|
|
105
105
|
type: "operation" | "model";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"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"}
|
|
@@ -14,7 +14,6 @@ type GenerateArgs = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare const generate: ({ traceId, spanId, schema, settings, prettier, generatorsMap, startAt }: GenerateArgs) => {
|
|
16
16
|
artifacts: Record<string, string>;
|
|
17
|
-
renderDependencies: Record<string, string[]>;
|
|
18
17
|
manifest: ManifestContent;
|
|
19
18
|
};
|
|
20
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAAA;IAClE,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,QAAQ,4EAQlB,YAAY
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAAA;IAClE,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,QAAQ,4EAQlB,YAAY;;;CAsBd,CAAA"}
|
package/esm/generate/generate.js
CHANGED
|
@@ -2,7 +2,11 @@ import * as dntShim from "../_dnt.shims.js";
|
|
|
2
2
|
import { CoreContext } from '../context/CoreContext.js';
|
|
3
3
|
export const generate = ({ traceId, spanId, schema, settings, prettier, generatorsMap, startAt }) => {
|
|
4
4
|
const context = new CoreContext({ spanId, schema });
|
|
5
|
-
const { artifacts, files,
|
|
5
|
+
const { artifacts, files, pinnable, results } = context.transform({
|
|
6
|
+
settings,
|
|
7
|
+
generatorsMap,
|
|
8
|
+
prettier
|
|
9
|
+
});
|
|
6
10
|
const manifest = {
|
|
7
11
|
files,
|
|
8
12
|
pinnable,
|
|
@@ -14,9 +18,5 @@ export const generate = ({ traceId, spanId, schema, settings, prettier, generato
|
|
|
14
18
|
startAt,
|
|
15
19
|
endAt: Date.now()
|
|
16
20
|
};
|
|
17
|
-
return {
|
|
18
|
-
artifacts,
|
|
19
|
-
renderDependencies,
|
|
20
|
-
manifest
|
|
21
|
-
};
|
|
21
|
+
return { artifacts, manifest };
|
|
22
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EACN,CAAC,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GACzD,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iBAAiB,4BAG3B,qBAAqB,KACpB,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GACtC,
|
|
1
|
+
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EACN,CAAC,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GACzD,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iBAAiB,4BAG3B,qBAAqB,KACpB,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GACtC,SAWH,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAChB,MAAM,EACN,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CACtD,CAAA;IACD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CASxE,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,UAAU,EACN,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,GACrE,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,sBAAsB,4BAGhC,0BAA0B,KACzB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAClD,SAMH,CAAA"}
|
|
@@ -12,6 +12,7 @@ export const toParameterListV3 = ({ parameters, context }) => {
|
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
14
|
return parameters.map((parameter, index) => {
|
|
15
|
+
console.log('parameter index', index);
|
|
15
16
|
return tracer(context, `${index}`, () => toParameterV3({ parameter, context }));
|
|
16
17
|
});
|
|
17
18
|
};
|
|
@@ -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;AAiB/D,eAAO,MAAM,YAAY,eACX,CAAC,kBAAkB,GAAG,cAAc,CAAC,EAAE,KAClD,
|
|
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"}
|
|
@@ -24,7 +24,7 @@ export const createServer = (generators) => {
|
|
|
24
24
|
return Sentry.startSpan({ name: 'Generate' }, () => {
|
|
25
25
|
const generatorsMap = Object.fromEntries(generators.map(generator => [generator.id, generator]));
|
|
26
26
|
const { traceId, spanId } = span.spanContext();
|
|
27
|
-
const { artifacts, manifest
|
|
27
|
+
const { artifacts, manifest } = generate({
|
|
28
28
|
traceId,
|
|
29
29
|
spanId,
|
|
30
30
|
startAt,
|
|
@@ -33,10 +33,9 @@ export const createServer = (generators) => {
|
|
|
33
33
|
settings: clientSettings,
|
|
34
34
|
generatorsMap
|
|
35
35
|
});
|
|
36
|
-
return { artifacts, manifest
|
|
36
|
+
return { artifacts, manifest };
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
-
console.log('RESULT', JSON.stringify(result, null, 2).slice(0, 1000));
|
|
40
39
|
return c.json(result);
|
|
41
40
|
});
|
|
42
41
|
app.get('/generators', c => {
|
|
@@ -105,9 +104,6 @@ const toOperations = ({ generator, oasDocument, operationsSettings }) => {
|
|
|
105
104
|
}, {});
|
|
106
105
|
};
|
|
107
106
|
const toOasDocument = ({ schema, spanId }) => {
|
|
108
|
-
const context = new CoreContext({
|
|
109
|
-
spanId,
|
|
110
|
-
schema
|
|
111
|
-
});
|
|
107
|
+
const context = new CoreContext({ spanId, schema });
|
|
112
108
|
return context.parse();
|
|
113
109
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
2
2
|
import { ValueBase } from '../dsl/ValueBase.js';
|
|
3
3
|
import type { Stringable } from '../dsl/Stringable.js';
|
|
4
4
|
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
5
5
|
type CreateArgs = {
|
|
6
|
-
context:
|
|
6
|
+
context: GenerateContext;
|
|
7
7
|
value: Stringable;
|
|
8
8
|
generatorKey: GeneratorKey;
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomValue.d.ts","sourceRoot":"","sources":["../../src/types/CustomValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CustomValue.d.ts","sourceRoot":"","sources":["../../src/types/CustomValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,qBAAa,WAAY,SAAQ,SAAS;IACxC,IAAI,WAAoB;IACxB,KAAK,EAAE,UAAU,CAAA;gBAEL,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,UAAU;IAMxD,QAAQ,IAAI,MAAM;CAGnB;AAED,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,KAAK,IAAI,WAOvD,CAAA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
2
2
|
import { Definition } from '../dsl/Definition.js';
|
|
3
3
|
import type { TypeSystemObject } from '../types/TypeSystem.js';
|
|
4
4
|
import { FunctionParameter } from './FunctionParameter.js';
|
|
5
5
|
type ConstructorArgs = {
|
|
6
|
-
context:
|
|
6
|
+
context: GenerateContext;
|
|
7
7
|
argName?: string;
|
|
8
8
|
typeName: string;
|
|
9
9
|
typeValue: TypeSystemObject;
|
|
10
10
|
pathTemplate: string;
|
|
11
11
|
};
|
|
12
12
|
export declare class PathParams {
|
|
13
|
-
context:
|
|
13
|
+
context: GenerateContext;
|
|
14
14
|
typeDefinition: Definition<TypeSystemObject>;
|
|
15
15
|
parameter: FunctionParameter;
|
|
16
16
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/PathParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"PathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/PathParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,UAAU;IACrB,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAC5C,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;gBAEA,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACb,EAAE,eAAe;CAwBnB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ValueBase } from '../dsl/ValueBase.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
3
3
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
4
4
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
5
5
|
type CreateArgs = {
|
|
6
|
-
context:
|
|
6
|
+
context: GenerateContext;
|
|
7
7
|
generatorKey: GeneratorKey;
|
|
8
8
|
operation: OasOperation;
|
|
9
9
|
destinationPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactRouterPathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/ReactRouterPathParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ReactRouterPathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/ReactRouterPathParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,EAAE,YAAY,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,SAAS,EAAE,MAAM,CAAK;IAEtB,YAAY,EAAE,MAAM,CAAK;IAEzB,SAAS,EAAE,MAAM,CAAK;IAEtB,KAAK,EAAE,MAAM,EAAE,CAAA;gBAEH,EACV,OAAO,EACP,SAAS,EACT,YAAY,EACZ,eAAe,EAChB,EAAE,UAAU;IAwBb,QAAQ,IAAI,MAAM;CAGnB"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import type { AddRenderDependencyArgs, GetModelSettingsArgs, GetOperationSettingsArgs, PickArgs, RegisterArgs, InsertReturn, InsertArgs } from './GenerateContext.js';
|
|
2
|
-
import type { AddGeneratorKeyArgs, FileContents, RenderDependencies } from './types.js';
|
|
3
1
|
import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
4
2
|
import type { OasDocument } from '../oas/document/Document.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type { Definition } from '../dsl/Definition.js';
|
|
3
|
+
import type { ClientSettings } from '../types/Settings.js';
|
|
7
4
|
import type { OperationGenerator } from '../dsl/OperationInsertable.js';
|
|
8
5
|
import type { ModelGenerator } from '../dsl/ModelInsertable.js';
|
|
9
|
-
import type { GeneratedValue } from '../types/GeneratedValue.js';
|
|
10
|
-
import type { OasSchema } from '../oas/schema/Schema.js';
|
|
11
|
-
import type { OasRef } from '../oas/ref/Ref.js';
|
|
12
|
-
import type { GenerationType } from '../types/GeneratedValue.js';
|
|
13
|
-
import type { RefName } from '../types/RefName.js';
|
|
14
6
|
import type { SuccessWarningError } from '../types/Manifest.js';
|
|
15
7
|
import * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
8
|
+
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
16
9
|
type CoreContextArgs = {
|
|
17
10
|
spanId: string;
|
|
18
11
|
schema: string;
|
|
@@ -34,8 +27,7 @@ export declare class CoreContext {
|
|
|
34
27
|
transform({ settings, generatorsMap, prettier }: TransformArgs): {
|
|
35
28
|
results: Record<string, SuccessWarningError>;
|
|
36
29
|
files: Record<string, import("../types/Manifest.js").ManifestEntry>;
|
|
37
|
-
pinnable: Partial<Record<
|
|
38
|
-
renderDependencies: Record<string, string[]>;
|
|
30
|
+
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
39
31
|
artifacts: Record<string, string>;
|
|
40
32
|
};
|
|
41
33
|
captureResult({ stackTrail, result }: CaptureResultArgs): void;
|
|
@@ -43,22 +35,6 @@ export declare class CoreContext {
|
|
|
43
35
|
get phaseType(): 'parse' | 'generate' | 'render';
|
|
44
36
|
appendStackTrailChunk(chunk: string | string[]): void;
|
|
45
37
|
removeStackTrailChunk(chunk: string | string[]): void;
|
|
46
|
-
register({ destinationPath, ...args }: RegisterArgs): void;
|
|
47
|
-
addGeneratorKey({ generatorKey }: AddGeneratorKeyArgs): void;
|
|
48
|
-
resolveSchemaRefOnce(refName: RefName): OasSchema | OasRef<'schema'>;
|
|
49
|
-
addRenderDependency(args: AddRenderDependencyArgs): void;
|
|
50
|
-
getFile(filePath: string): FileContents;
|
|
51
|
-
findDefinition(args: PickArgs): Definition<GeneratedValue> | undefined;
|
|
52
|
-
addFile(normalisedPath: string): FileContents;
|
|
53
|
-
getOperationBaseSettings(args: GetOperationSettingsArgs): BaseSettings;
|
|
54
|
-
insert<V extends GeneratedValue, T extends GenerationType>(args: InsertArgs<V, T>): InsertReturn<V, T>;
|
|
55
|
-
getModelBaseSettings(args: GetModelSettingsArgs): BaseSettings;
|
|
56
|
-
get files(): Map<string, FileContents>;
|
|
57
|
-
get renderDependencies(): RenderDependencies;
|
|
58
|
-
get packageDependencies(): Map<string, string>;
|
|
59
|
-
get schemaModel(): OasDocument;
|
|
60
|
-
get generatorsMap(): Record<string, OperationGenerator | ModelGenerator>;
|
|
61
|
-
get settings(): ClientSettings | undefined;
|
|
62
38
|
}
|
|
63
39
|
export type JsonFormatterArgs = {
|
|
64
40
|
logRecord: log.LogRecord;
|
|
@@ -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":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AA0B7D,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AASD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,mBAAmB,CAAA;CAC5B,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAAA;IAClE,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B,CAAA;AAED,qBAAa,WAAW;;IACtB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;gBAKN,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,eAAe;IAmD/C,KAAK,IAAI,WAAW;IAQpB,SAAS,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,aAAa;;;;;;IAsE9D,aAAa,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,iBAAiB,GAAG,IAAI;IAM9D,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;IA2BvD,IAAI,SAAS,IAAI,OAAO,GAAG,UAAU,GAAG,QAAQ,CAE/C;IAED,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAI9C,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAG/C;AAeD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,GAAG,CAAC,SAAS,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,UAAU,EACX,EAAE,iBAAiB,GAAG,MAAM,CAQ5B;AAUD,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,UAAU,EACX,EAAE,iBAAiB,GAAG,MAAM,CAE5B"}
|
|
@@ -72,24 +72,29 @@ class CoreContext {
|
|
|
72
72
|
if (__classPrivateFieldGet(this, _CoreContext_phase, "f").type !== 'parse') {
|
|
73
73
|
throw new Error(`Expected 'parse' phase, got '${__classPrivateFieldGet(this, _CoreContext_phase, "f").type}'`);
|
|
74
74
|
}
|
|
75
|
+
const callback = (generatorKey) => {
|
|
76
|
+
if (__classPrivateFieldGet(this, _CoreContext_phase, "f").type === 'render') {
|
|
77
|
+
__classPrivateFieldGet(this, _CoreContext_phase, "f").context.addGeneratorKey({ generatorKey });
|
|
78
|
+
}
|
|
79
|
+
};
|
|
75
80
|
const schemaModel = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
76
81
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
77
82
|
schemaModel,
|
|
78
83
|
settings,
|
|
79
|
-
generatorsMap
|
|
84
|
+
generatorsMap,
|
|
85
|
+
callback
|
|
80
86
|
}), "f");
|
|
81
|
-
__classPrivateFieldGet(this, _CoreContext_phase, "f").context.generate(
|
|
82
|
-
this.logger.debug(`${
|
|
87
|
+
const files = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.generate(generatorsMap);
|
|
88
|
+
this.logger.debug(`${files.size} files generated`);
|
|
83
89
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupRenderPhase).call(this, {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
pinnableGenerators: Object.values(this.generatorsMap)
|
|
90
|
+
files,
|
|
91
|
+
pinnableGenerators: Object.values(generatorsMap)
|
|
87
92
|
.map(({ id, pinnable }) => (pinnable ? id : null))
|
|
88
93
|
.filter(generatorId => generatorId !== null),
|
|
89
94
|
prettier,
|
|
90
|
-
settings
|
|
95
|
+
basePath: settings?.basePath
|
|
91
96
|
}), "f");
|
|
92
|
-
const renderOutput = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.render(
|
|
97
|
+
const renderOutput = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.render();
|
|
93
98
|
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").remove('render');
|
|
94
99
|
return {
|
|
95
100
|
...renderOutput,
|
|
@@ -116,192 +121,6 @@ class CoreContext {
|
|
|
116
121
|
removeStackTrailChunk(chunk) {
|
|
117
122
|
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").remove(chunk);
|
|
118
123
|
}
|
|
119
|
-
register({ destinationPath, ...args }) {
|
|
120
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
121
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
122
|
-
return context.register({ destinationPath, ...args });
|
|
123
|
-
})
|
|
124
|
-
.with({ type: 'parse' }, () => {
|
|
125
|
-
throw new Error(`Cannot register during parse phase`);
|
|
126
|
-
})
|
|
127
|
-
.with({ type: 'render' }, () => {
|
|
128
|
-
throw new Error(`Cannot register during render phase`);
|
|
129
|
-
})
|
|
130
|
-
.exhaustive();
|
|
131
|
-
}
|
|
132
|
-
addGeneratorKey({ generatorKey }) {
|
|
133
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
134
|
-
.with({ type: 'generate' }, () => {
|
|
135
|
-
this.logger.info('trying to add generator key during generate phase');
|
|
136
|
-
})
|
|
137
|
-
.with({ type: 'parse' }, () => {
|
|
138
|
-
throw new Error(`Cannot add generator key during parse phase`);
|
|
139
|
-
})
|
|
140
|
-
.with({ type: 'render' }, ({ context }) => {
|
|
141
|
-
return context.addGeneratorKey({ generatorKey });
|
|
142
|
-
})
|
|
143
|
-
.exhaustive();
|
|
144
|
-
}
|
|
145
|
-
resolveSchemaRefOnce(refName) {
|
|
146
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
147
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
148
|
-
return context.resolveSchemaRefOnce(refName);
|
|
149
|
-
})
|
|
150
|
-
.with({ type: 'parse' }, () => {
|
|
151
|
-
throw new Error(`Cannot resolve schema during parse phase`);
|
|
152
|
-
})
|
|
153
|
-
.with({ type: 'render' }, () => {
|
|
154
|
-
throw new Error(`Cannot resolve schema during render phase`);
|
|
155
|
-
})
|
|
156
|
-
.exhaustive();
|
|
157
|
-
}
|
|
158
|
-
addRenderDependency(args) {
|
|
159
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
160
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
161
|
-
return context.addRenderDependency(args);
|
|
162
|
-
})
|
|
163
|
-
.with({ type: 'parse' }, () => {
|
|
164
|
-
throw new Error(`Cannot add render dependency during parse phase`);
|
|
165
|
-
})
|
|
166
|
-
.with({ type: 'render' }, () => {
|
|
167
|
-
throw new Error(`Cannot add render dependency during render phase`);
|
|
168
|
-
})
|
|
169
|
-
.exhaustive();
|
|
170
|
-
}
|
|
171
|
-
getFile(filePath) {
|
|
172
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
173
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
174
|
-
return context.getFile(filePath);
|
|
175
|
-
})
|
|
176
|
-
.with({ type: 'parse' }, () => {
|
|
177
|
-
throw new Error(`Cannot get file during parse phase`);
|
|
178
|
-
})
|
|
179
|
-
.with({ type: 'render' }, () => {
|
|
180
|
-
throw new Error(`Cannot get file during render phase`);
|
|
181
|
-
})
|
|
182
|
-
.exhaustive();
|
|
183
|
-
}
|
|
184
|
-
findDefinition(args) {
|
|
185
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
186
|
-
.with({ type: 'generate' }, ({ context }) => context.findDefinition(args))
|
|
187
|
-
.with({ type: 'parse' }, () => {
|
|
188
|
-
throw new Error(`Cannot pick during parse phase`);
|
|
189
|
-
})
|
|
190
|
-
.with({ type: 'render' }, ({ context }) => context.pick(args))
|
|
191
|
-
.exhaustive();
|
|
192
|
-
}
|
|
193
|
-
addFile(normalisedPath) {
|
|
194
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
195
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
196
|
-
return context.addFile(normalisedPath);
|
|
197
|
-
})
|
|
198
|
-
.with({ type: 'parse' }, () => {
|
|
199
|
-
throw new Error(`Cannot add file during parse phase`);
|
|
200
|
-
})
|
|
201
|
-
.with({ type: 'render' }, () => {
|
|
202
|
-
throw new Error(`Cannot add file during render phase`);
|
|
203
|
-
})
|
|
204
|
-
.exhaustive();
|
|
205
|
-
}
|
|
206
|
-
getOperationBaseSettings(args) {
|
|
207
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
208
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
209
|
-
return context.getOperationBaseSettings(args);
|
|
210
|
-
})
|
|
211
|
-
.with({ type: 'parse' }, () => {
|
|
212
|
-
throw new Error(`Cannot access operation settings during parse phase`);
|
|
213
|
-
})
|
|
214
|
-
.with({ type: 'render' }, () => {
|
|
215
|
-
throw new Error(`Cannot access operation settings during render phase`);
|
|
216
|
-
})
|
|
217
|
-
.exhaustive();
|
|
218
|
-
}
|
|
219
|
-
insert(args) {
|
|
220
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
221
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
222
|
-
return context.insert({ ...args, coreContext: this });
|
|
223
|
-
})
|
|
224
|
-
.with({ type: 'parse' }, () => {
|
|
225
|
-
throw new Error(`Cannot run 'transform' during parse phase`);
|
|
226
|
-
})
|
|
227
|
-
.with({ type: 'render' }, () => {
|
|
228
|
-
throw new Error(`Cannot run 'transform' during render phase`);
|
|
229
|
-
})
|
|
230
|
-
.exhaustive();
|
|
231
|
-
}
|
|
232
|
-
getModelBaseSettings(args) {
|
|
233
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
234
|
-
.with({ type: 'generate' }, ({ context }) => {
|
|
235
|
-
return context.getModelBaseSettings(args);
|
|
236
|
-
})
|
|
237
|
-
.with({ type: 'parse' }, () => {
|
|
238
|
-
throw new Error(`Cannot access model settings during parse phase`);
|
|
239
|
-
})
|
|
240
|
-
.with({ type: 'render' }, () => {
|
|
241
|
-
throw new Error(`Cannot access model settings during render phase`);
|
|
242
|
-
})
|
|
243
|
-
.exhaustive();
|
|
244
|
-
}
|
|
245
|
-
get files() {
|
|
246
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
247
|
-
.with({ type: 'generate' }, ({ context }) => context.files)
|
|
248
|
-
.with({ type: 'parse' }, () => {
|
|
249
|
-
throw new Error(`Cannot access files during parse phase`);
|
|
250
|
-
})
|
|
251
|
-
.with({ type: 'render' }, ({ context }) => context.files)
|
|
252
|
-
.exhaustive();
|
|
253
|
-
}
|
|
254
|
-
get renderDependencies() {
|
|
255
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
256
|
-
.with({ type: 'generate' }, ({ context }) => context.renderDependencies)
|
|
257
|
-
.with({ type: 'parse' }, () => {
|
|
258
|
-
throw new Error(`Cannot access files during parse phase`);
|
|
259
|
-
})
|
|
260
|
-
.with({ type: 'render' }, ({ context }) => context.renderDependencies)
|
|
261
|
-
.exhaustive();
|
|
262
|
-
}
|
|
263
|
-
get packageDependencies() {
|
|
264
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
265
|
-
.with({ type: 'generate' }, ({ context }) => context.packageDependencies)
|
|
266
|
-
.with({ type: 'parse' }, () => {
|
|
267
|
-
throw new Error(`Cannot access package dependencies during parse phase`);
|
|
268
|
-
})
|
|
269
|
-
.with({ type: 'render' }, ({ context }) => context.packageDependencies)
|
|
270
|
-
.exhaustive();
|
|
271
|
-
}
|
|
272
|
-
get schemaModel() {
|
|
273
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
274
|
-
.with({ type: 'generate' }, ({ context }) => context.schemaModel)
|
|
275
|
-
.with({ type: 'parse' }, () => {
|
|
276
|
-
throw new Error(`Cannot access schema model during parse phase`);
|
|
277
|
-
})
|
|
278
|
-
.with({ type: 'render' }, () => {
|
|
279
|
-
throw new Error(`Cannot access schema model during render phase`);
|
|
280
|
-
})
|
|
281
|
-
.exhaustive();
|
|
282
|
-
}
|
|
283
|
-
get generatorsMap() {
|
|
284
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
285
|
-
.with({ type: 'generate' }, ({ context }) => context.generatorsMap)
|
|
286
|
-
.with({ type: 'parse' }, () => {
|
|
287
|
-
throw new Error(`Cannot access schema model during parse phase`);
|
|
288
|
-
})
|
|
289
|
-
.with({ type: 'render' }, () => {
|
|
290
|
-
throw new Error(`Cannot access schema model during render phase`);
|
|
291
|
-
})
|
|
292
|
-
.exhaustive();
|
|
293
|
-
}
|
|
294
|
-
get settings() {
|
|
295
|
-
return (0, ts_pattern_1.match)(__classPrivateFieldGet(this, _CoreContext_phase, "f"))
|
|
296
|
-
.with({ type: 'generate' }, ({ context }) => context.settings)
|
|
297
|
-
.with({ type: 'parse' }, () => {
|
|
298
|
-
throw new Error(`Cannot access settings during parse phase`);
|
|
299
|
-
})
|
|
300
|
-
.with({ type: 'render' }, () => {
|
|
301
|
-
throw new Error(`Cannot access settings during render phase`);
|
|
302
|
-
})
|
|
303
|
-
.exhaustive();
|
|
304
|
-
}
|
|
305
124
|
}
|
|
306
125
|
exports.CoreContext = CoreContext;
|
|
307
126
|
_CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreContext_stackTrail = new WeakMap(), _CoreContext_instances = new WeakSet(), _CoreContext_setupLogger = function _CoreContext_setupLogger(spanId) {
|
|
@@ -341,24 +160,24 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
341
160
|
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").append('parse');
|
|
342
161
|
const parseContext = new ParseContext_js_1.ParseContext({ schema, logger: this.logger });
|
|
343
162
|
return { type: 'parse', context: parseContext };
|
|
344
|
-
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ schemaModel, settings, generatorsMap }) {
|
|
163
|
+
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ schemaModel, settings, generatorsMap, callback }) {
|
|
345
164
|
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").remove('parse');
|
|
346
165
|
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").append('generate');
|
|
347
166
|
const generateContext = new GenerateContext_js_1.GenerateContext({
|
|
348
167
|
schemaModel,
|
|
349
168
|
settings,
|
|
350
|
-
generatorsMap
|
|
169
|
+
generatorsMap,
|
|
170
|
+
logger: this.logger,
|
|
171
|
+
callback
|
|
351
172
|
});
|
|
352
173
|
return { type: 'generate', context: generateContext };
|
|
353
|
-
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({
|
|
174
|
+
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators }) {
|
|
354
175
|
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").remove('generate');
|
|
355
176
|
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").append('render');
|
|
356
177
|
const renderContext = new RenderContext_js_1.RenderContext({
|
|
357
|
-
files
|
|
358
|
-
renderDependencies,
|
|
359
|
-
packageDependencies,
|
|
178
|
+
files,
|
|
360
179
|
prettier,
|
|
361
|
-
|
|
180
|
+
basePath,
|
|
362
181
|
pinnableGenerators
|
|
363
182
|
});
|
|
364
183
|
return { type: 'render', context: renderContext };
|