@skmtc/core 0.0.316 → 0.0.318
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 +2 -2
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +9 -17
- package/esm/context/GenerateContext.d.ts +2 -2
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +1 -1
- package/esm/context/RenderContext.d.ts +7 -1
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +40 -25
- package/esm/context/types.d.ts +2 -1
- package/esm/context/types.d.ts.map +1 -1
- package/esm/helpers/ResultsLog.d.ts +8 -0
- package/esm/helpers/ResultsLog.d.ts.map +1 -0
- package/esm/helpers/ResultsLog.js +50 -0
- package/esm/types/Manifest.d.ts +6 -29
- package/esm/types/Manifest.d.ts.map +1 -1
- package/esm/types/Manifest.js +2 -9
- package/esm/types/Results.d.ts +10 -0
- package/esm/types/Results.d.ts.map +1 -0
- package/esm/types/Results.js +4 -0
- package/package.json +5 -1
- package/script/context/CoreContext.d.ts +2 -2
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +9 -17
- package/script/context/GenerateContext.d.ts +2 -2
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +1 -1
- package/script/context/RenderContext.d.ts +7 -1
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +40 -25
- package/script/context/types.d.ts +2 -1
- package/script/context/types.d.ts.map +1 -1
- package/script/helpers/ResultsLog.d.ts +8 -0
- package/script/helpers/ResultsLog.d.ts.map +1 -0
- package/script/helpers/ResultsLog.js +57 -0
- package/script/types/Manifest.d.ts +6 -29
- package/script/types/Manifest.d.ts.map +1 -1
- package/script/types/Manifest.js +3 -10
- package/script/types/Results.d.ts +10 -0
- package/script/types/Results.d.ts.map +1 -0
- package/script/types/Results.js +7 -0
|
@@ -3,7 +3,7 @@ import type { OasDocument } from '../oas/document/Document.js';
|
|
|
3
3
|
import type { ClientSettings } from '../types/Settings.js';
|
|
4
4
|
import type { OperationGenerator } from '../dsl/OperationInsertable.js';
|
|
5
5
|
import type { ModelGenerator } from '../dsl/ModelInsertable.js';
|
|
6
|
-
import type { SuccessWarningError } from '../types/
|
|
6
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
7
7
|
import * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
8
8
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
9
9
|
type CoreContextArgs = {
|
|
@@ -21,7 +21,7 @@ export declare class CoreContext {
|
|
|
21
21
|
constructor({ spanId }: CoreContextArgs);
|
|
22
22
|
parse(schema: string): OasDocument;
|
|
23
23
|
transform({ schema, settings, generatorsMap, prettier }: TransformArgs): {
|
|
24
|
-
results:
|
|
24
|
+
results: import("../types/Results.js").ResultsItem;
|
|
25
25
|
files: Record<string, import("../types/Manifest.js").ManifestEntry>;
|
|
26
26
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
27
27
|
artifacts: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAIA,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,
|
|
1
|
+
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AA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,GAAG,MAAM,CAQ5B"}
|
|
@@ -17,6 +17,7 @@ import * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
|
17
17
|
import { ResultsHandler } from './ResultsHandler.js';
|
|
18
18
|
import { StackTrail } from './StackTrail.js';
|
|
19
19
|
import { tracer } from '../helpers/tracer.js';
|
|
20
|
+
import { ResultsLog } from '../helpers/ResultsLog.js';
|
|
20
21
|
export class CoreContext {
|
|
21
22
|
constructor({ spanId }) {
|
|
22
23
|
_CoreContext_instances.add(this);
|
|
@@ -30,7 +31,7 @@ export class CoreContext {
|
|
|
30
31
|
_CoreContext_results.set(this, void 0);
|
|
31
32
|
_CoreContext_stackTrail.set(this, void 0);
|
|
32
33
|
__classPrivateFieldSet(this, _CoreContext_stackTrail, new StackTrail([spanId]), "f");
|
|
33
|
-
__classPrivateFieldSet(this, _CoreContext_results,
|
|
34
|
+
__classPrivateFieldSet(this, _CoreContext_results, new ResultsLog(), "f");
|
|
34
35
|
this.logger = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupLogger).call(this, spanId);
|
|
35
36
|
}
|
|
36
37
|
parse(schema) {
|
|
@@ -70,17 +71,11 @@ export class CoreContext {
|
|
|
70
71
|
});
|
|
71
72
|
return {
|
|
72
73
|
...renderOutput,
|
|
73
|
-
results: __classPrivateFieldGet(this, _CoreContext_results, "f")
|
|
74
|
+
results: __classPrivateFieldGet(this, _CoreContext_results, "f").toTree()
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
captureCurrentResult(result) {
|
|
77
|
-
|
|
78
|
-
if (incomingResultIsWorse({
|
|
79
|
-
current: __classPrivateFieldGet(this, _CoreContext_results, "f")[stackTrail],
|
|
80
|
-
incoming: result
|
|
81
|
-
})) {
|
|
82
|
-
__classPrivateFieldGet(this, _CoreContext_results, "f")[stackTrail] = result;
|
|
83
|
-
}
|
|
78
|
+
__classPrivateFieldGet(this, _CoreContext_results, "f").capture(__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").toString(), result);
|
|
84
79
|
}
|
|
85
80
|
}
|
|
86
81
|
_CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreContext_stackTrail = new WeakMap(), _CoreContext_instances = new WeakSet(), _CoreContext_setupLogger = function _CoreContext_setupLogger(spanId) {
|
|
@@ -120,8 +115,8 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
120
115
|
generatorsMap,
|
|
121
116
|
logger: this.logger,
|
|
122
117
|
callback,
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
119
|
+
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
125
120
|
});
|
|
126
121
|
return { type: 'generate', context: generateContext };
|
|
127
122
|
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators }) {
|
|
@@ -130,15 +125,12 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
130
125
|
prettier,
|
|
131
126
|
basePath,
|
|
132
127
|
pinnableGenerators,
|
|
133
|
-
|
|
128
|
+
logger: this.logger,
|
|
129
|
+
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
130
|
+
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
134
131
|
});
|
|
135
132
|
return { type: 'render', context: renderContext };
|
|
136
133
|
};
|
|
137
|
-
const incomingResultIsWorse = ({ current, incoming }) => {
|
|
138
|
-
return (current === undefined ||
|
|
139
|
-
(current === 'success' && incoming !== 'success') ||
|
|
140
|
-
(current === 'warning' && incoming === 'error'));
|
|
141
|
-
};
|
|
142
134
|
export function skmtcFormatter({ logRecord, stackTrail }) {
|
|
143
135
|
return JSON.stringify({
|
|
144
136
|
stackTrail,
|
|
@@ -14,7 +14,7 @@ import type { ContentSettings } from '../dsl/ContentSettings.js';
|
|
|
14
14
|
import type { RefName } from '../types/RefName.js';
|
|
15
15
|
import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
16
16
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
17
|
-
import type { SuccessWarningError } from '../types/
|
|
17
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
18
18
|
import type { StackTrail } from './StackTrail.js';
|
|
19
19
|
type ConstructorArgs = {
|
|
20
20
|
schemaModel: OasDocument;
|
|
@@ -22,8 +22,8 @@ type ConstructorArgs = {
|
|
|
22
22
|
generatorsMap: Record<string, OperationGenerator | ModelGenerator>;
|
|
23
23
|
logger: log.Logger;
|
|
24
24
|
callback: (generatorKey: GeneratorKey) => void;
|
|
25
|
-
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
26
25
|
stackTrail: StackTrail;
|
|
26
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
27
27
|
};
|
|
28
28
|
export type PickArgs = {
|
|
29
29
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAEnB,MAA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AQ,CACN,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,GACjE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC;IAkG5B,OAAO,CACL,QAAQ,EAAE,MAAM,EAChB,EAAE,eAAuB,EAAE,GAAE,cAAmB,GAC/C,YAAY;IAgBf,QAAQ,CAAC,EAAE,OAAY,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,YAAY;IAyBrE,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,EAAE,EACzD,UAAU,EACV,eAAe,EACf,GAAG,IAAI,EACR,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IA4BxC,wBAAwB,CAAC,EACvB,WAAW,EACX,IAAI,EACJ,MAAM,EACP,EAAE,wBAAwB;IAwB3B,oBAAoB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,oBAAoB;IAwBnE,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY;IAgB7C,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAWpE,oDAAoD;IACpD,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
|
|
@@ -56,8 +56,8 @@ export class GenerateContext {
|
|
|
56
56
|
this.schemaModel = schemaModel;
|
|
57
57
|
this.settings = settings;
|
|
58
58
|
this.callback = callback;
|
|
59
|
-
this.captureCurrentResult = captureCurrentResult;
|
|
60
59
|
__classPrivateFieldSet(this, _GenerateContext_stackTrail, stackTrail, "f");
|
|
60
|
+
this.captureCurrentResult = captureCurrentResult;
|
|
61
61
|
}
|
|
62
62
|
generate(generatorsMap) {
|
|
63
63
|
Sentry.startSpan({ name: 'Generate operations' }, () => Object.values(generatorsMap)
|
|
@@ -2,13 +2,17 @@ import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
|
2
2
|
import type { AddGeneratorKeyArgs, FileContents, RenderResult } from './types.js';
|
|
3
3
|
import type { Definition } from '../dsl/Definition.js';
|
|
4
4
|
import type { PickArgs } from './GenerateContext.js';
|
|
5
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
5
6
|
import type { StackTrail } from './StackTrail.js';
|
|
7
|
+
import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
6
8
|
type ConstructorArgs = {
|
|
7
9
|
files: Map<string, FileContents>;
|
|
8
10
|
prettier?: PrettierConfigType;
|
|
9
11
|
basePath: string | undefined;
|
|
10
12
|
pinnableGenerators: string[];
|
|
11
13
|
stackTrail: StackTrail;
|
|
14
|
+
logger: log.Logger;
|
|
15
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
12
16
|
};
|
|
13
17
|
export declare class RenderContext {
|
|
14
18
|
#private;
|
|
@@ -17,7 +21,9 @@ export declare class RenderContext {
|
|
|
17
21
|
basePath: string | undefined;
|
|
18
22
|
currentDestinationPath: string | 'PRE_RENDER' | 'POST_RENDER';
|
|
19
23
|
pinnableGenerators: string[];
|
|
20
|
-
|
|
24
|
+
logger: log.Logger;
|
|
25
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
26
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }: ConstructorArgs);
|
|
21
27
|
render(): Omit<RenderResult, 'results'>;
|
|
22
28
|
private collate;
|
|
23
29
|
getFile(filePath: string): FileContents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,YAAY,EACb,MAAM,YAAY,CAAA;AAEnB,OAAO,KAA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B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAElB,oBAAoB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;gBAC/C,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,oBAAoB,EACrB,EAAE,eAAe;IAWlB,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAuBvC,OAAO,CAAC,OAAO;IA0Df,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IAavC,eAAe,CAAC,EAAE,YAAY,EAAE,EAAE,mBAAmB;IAarD,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -17,7 +17,7 @@ import { normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
|
17
17
|
import { toResolvedArtifactPath } from '../helpers/toResolvedArtifactPath.js';
|
|
18
18
|
import { tracer } from '../helpers/tracer.js';
|
|
19
19
|
export class RenderContext {
|
|
20
|
-
constructor({ files, prettier, basePath, pinnableGenerators, stackTrail }) {
|
|
20
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }) {
|
|
21
21
|
Object.defineProperty(this, "files", {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
configurable: true,
|
|
@@ -48,13 +48,27 @@ export class RenderContext {
|
|
|
48
48
|
writable: true,
|
|
49
49
|
value: void 0
|
|
50
50
|
});
|
|
51
|
+
Object.defineProperty(this, "logger", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
writable: true,
|
|
55
|
+
value: void 0
|
|
56
|
+
});
|
|
51
57
|
_RenderContext_stackTrail.set(this, void 0);
|
|
58
|
+
Object.defineProperty(this, "captureCurrentResult", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: void 0
|
|
63
|
+
});
|
|
52
64
|
this.currentDestinationPath = 'PRE_RENDER';
|
|
53
65
|
this.files = files;
|
|
54
66
|
this.prettier = prettier;
|
|
55
67
|
this.basePath = basePath;
|
|
56
68
|
this.pinnableGenerators = pinnableGenerators;
|
|
69
|
+
this.logger = logger;
|
|
57
70
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
71
|
+
this.captureCurrentResult = captureCurrentResult;
|
|
58
72
|
}
|
|
59
73
|
render() {
|
|
60
74
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
@@ -77,43 +91,43 @@ export class RenderContext {
|
|
|
77
91
|
}
|
|
78
92
|
collate() {
|
|
79
93
|
const fileEntries = Array.from(this.files.entries());
|
|
80
|
-
const fileObjects = fileEntries
|
|
94
|
+
const fileObjects = fileEntries
|
|
95
|
+
.map(([destinationPath, file]) => {
|
|
81
96
|
return tracer(__classPrivateFieldGet(this, _RenderContext_stackTrail, "f"), destinationPath, () => {
|
|
82
97
|
// Set the current destination path to be used by
|
|
83
98
|
// addGeneratorKey method to apply generator keys
|
|
84
99
|
// to Correct file
|
|
85
100
|
// @TODO: Could this be combined with the tracer call above?
|
|
86
101
|
this.currentDestinationPath = destinationPath;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
try {
|
|
103
|
+
const renderedFile = renderFile({
|
|
104
|
+
file,
|
|
105
|
+
destinationPath,
|
|
106
|
+
basePath: this.basePath,
|
|
107
|
+
prettier: this.prettier
|
|
108
|
+
});
|
|
109
|
+
this.captureCurrentResult('success');
|
|
110
|
+
return renderedFile;
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.logger.error(error);
|
|
114
|
+
this.captureCurrentResult('error');
|
|
115
|
+
Sentry.captureException(error);
|
|
116
|
+
}
|
|
93
117
|
});
|
|
94
|
-
})
|
|
118
|
+
})
|
|
119
|
+
.filter(fileObject => fileObject !== undefined);
|
|
95
120
|
this.currentDestinationPath = 'POST_RENDER';
|
|
96
|
-
|
|
97
|
-
for (const fileObject of fileObjects) {
|
|
98
|
-
resolvedFileObjects.push({
|
|
99
|
-
...fileObject,
|
|
100
|
-
hash: 'ADD LATER'
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
return resolvedFileObjects.reduce((acc, fileObject) => ({
|
|
121
|
+
return fileObjects.reduce((acc, { content, path, ...fileMeta }) => ({
|
|
104
122
|
...acc,
|
|
105
123
|
artifacts: {
|
|
106
124
|
...acc.artifacts,
|
|
107
|
-
[
|
|
125
|
+
[path]: content
|
|
108
126
|
},
|
|
109
127
|
files: {
|
|
110
128
|
...acc.files,
|
|
111
|
-
[
|
|
112
|
-
|
|
113
|
-
numberOfLines: fileObject.numberOfLines,
|
|
114
|
-
numberOfCharacters: fileObject.numberOfCharacters,
|
|
115
|
-
hash: fileObject.hash,
|
|
116
|
-
generatorKeys: fileObject.generatorKeys
|
|
129
|
+
[path]: {
|
|
130
|
+
...fileMeta
|
|
117
131
|
}
|
|
118
132
|
}
|
|
119
133
|
}), {
|
|
@@ -152,7 +166,8 @@ const renderFile = ({ file, destinationPath, basePath }) => {
|
|
|
152
166
|
destinationPath,
|
|
153
167
|
numberOfLines: content.split('\n').length,
|
|
154
168
|
numberOfCharacters: content.length,
|
|
155
|
-
generatorKeys: Array.from(file.generatorKeys).filter(Boolean)
|
|
169
|
+
generatorKeys: Array.from(file.generatorKeys).filter(Boolean),
|
|
170
|
+
hash: 'PLACEHOLDER'
|
|
156
171
|
};
|
|
157
172
|
};
|
|
158
173
|
const generatePinnable = ({ pinnableGenerators, files }) => {
|
package/esm/context/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Definition } from '../dsl/Definition.js';
|
|
2
2
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
3
|
-
import type { ManifestEntry
|
|
3
|
+
import type { ManifestEntry } from '../types/Manifest.js';
|
|
4
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
4
5
|
export type PhaseType = 'parse' | 'generate' | 'render';
|
|
5
6
|
export type FileContents = {
|
|
6
7
|
imports: Map<string, Set<string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,aAAa,EAAE,GAAG,CAAC,YAAY,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAC7C,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResultsItem, SuccessWarningError } from '../types/Results.js';
|
|
2
|
+
export declare class ResultsLog {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
capture(stackTrail: string, result: SuccessWarningError): void;
|
|
6
|
+
toTree(): ResultsItem;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ResultsLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultsLog.d.ts","sourceRoot":"","sources":["../../src/helpers/ResultsLog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE3E,qBAAa,UAAU;;;IAOrB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB;IAiBvD,MAAM,IAAI,WAAW;CAyBtB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _ResultsLog_instances, _ResultsLog_results, _ResultsLog_incomingResultIsWorse;
|
|
13
|
+
import invariant from 'tiny-invariant';
|
|
14
|
+
export class ResultsLog {
|
|
15
|
+
constructor() {
|
|
16
|
+
_ResultsLog_instances.add(this);
|
|
17
|
+
_ResultsLog_results.set(this, void 0);
|
|
18
|
+
__classPrivateFieldSet(this, _ResultsLog_results, {}, "f");
|
|
19
|
+
}
|
|
20
|
+
capture(stackTrail, result) {
|
|
21
|
+
if (__classPrivateFieldGet(this, _ResultsLog_instances, "m", _ResultsLog_incomingResultIsWorse).call(this, __classPrivateFieldGet(this, _ResultsLog_results, "f")[stackTrail], result)) {
|
|
22
|
+
__classPrivateFieldGet(this, _ResultsLog_results, "f")[stackTrail] = result;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
toTree() {
|
|
26
|
+
const tree = {};
|
|
27
|
+
Object.entries(__classPrivateFieldGet(this, _ResultsLog_results, "f")).forEach(([key, value], index, arr) => {
|
|
28
|
+
const keys = key.split(':');
|
|
29
|
+
let branch = tree;
|
|
30
|
+
keys.forEach(key => {
|
|
31
|
+
if (branch[key] === undefined) {
|
|
32
|
+
branch[key] = {};
|
|
33
|
+
}
|
|
34
|
+
invariant(typeof branch[key] === 'object');
|
|
35
|
+
if (index === arr.length - 1) {
|
|
36
|
+
branch[key] = value;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
branch = branch[key];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return tree;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
_ResultsLog_results = new WeakMap(), _ResultsLog_instances = new WeakSet(), _ResultsLog_incomingResultIsWorse = function _ResultsLog_incomingResultIsWorse(current, incoming) {
|
|
47
|
+
return (current === undefined ||
|
|
48
|
+
(current === 'success' && incoming !== 'success') ||
|
|
49
|
+
(current === 'warning' && incoming === 'error'));
|
|
50
|
+
};
|
package/esm/types/Manifest.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
import type { GeneratorKey
|
|
2
|
+
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { type ResultsItem } from './Results.js';
|
|
4
5
|
export type ManifestEntry = {
|
|
5
6
|
numberOfLines: number;
|
|
6
7
|
numberOfCharacters: number;
|
|
@@ -27,30 +28,6 @@ export declare const manifestEntry: z.ZodObject<{
|
|
|
27
28
|
generatorKeys: string[];
|
|
28
29
|
destinationPath: string;
|
|
29
30
|
}>;
|
|
30
|
-
export type SuccessWarningError = 'success' | 'warning' | 'error';
|
|
31
|
-
export type WarningError = 'warning' | 'error';
|
|
32
|
-
export declare const successWarningError: z.ZodEnum<["success", "warning", "error"]>;
|
|
33
|
-
export type GenerateResult = Record<string, Record<string, SuccessWarningError>>;
|
|
34
|
-
export declare const generateResult: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>>;
|
|
35
|
-
export type Results = {
|
|
36
|
-
parse: SuccessWarningError;
|
|
37
|
-
generate: Record<OperationGeneratorKey | ModelGeneratorKey, SuccessWarningError>;
|
|
38
|
-
render: SuccessWarningError;
|
|
39
|
-
};
|
|
40
|
-
export declare const results: z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>;
|
|
41
|
-
export declare const phaseResults: z.ZodObject<{
|
|
42
|
-
parseResult: z.ZodEnum<["success", "warning", "error"]>;
|
|
43
|
-
generateResult: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>>;
|
|
44
|
-
renderResult: z.ZodEnum<["success", "warning", "error"]>;
|
|
45
|
-
}, "strip", z.ZodTypeAny, {
|
|
46
|
-
parseResult: "success" | "warning" | "error";
|
|
47
|
-
generateResult: Record<string, Record<string, "success" | "warning" | "error">>;
|
|
48
|
-
renderResult: "success" | "warning" | "error";
|
|
49
|
-
}, {
|
|
50
|
-
parseResult: "success" | "warning" | "error";
|
|
51
|
-
generateResult: Record<string, Record<string, "success" | "warning" | "error">>;
|
|
52
|
-
renderResult: "success" | "warning" | "error";
|
|
53
|
-
}>;
|
|
54
31
|
export type ManifestContent = {
|
|
55
32
|
deploymentId: string;
|
|
56
33
|
traceId: string;
|
|
@@ -58,7 +35,7 @@ export type ManifestContent = {
|
|
|
58
35
|
region?: string;
|
|
59
36
|
files: Record<string, ManifestEntry>;
|
|
60
37
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
61
|
-
results:
|
|
38
|
+
results: ResultsItem;
|
|
62
39
|
startAt: number;
|
|
63
40
|
endAt: number;
|
|
64
41
|
};
|
|
@@ -87,7 +64,7 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
87
64
|
destinationPath: string;
|
|
88
65
|
}>>;
|
|
89
66
|
pinnable: z.ZodRecord<z.ZodEffects<z.ZodString, GeneratorKey, string>, z.ZodString>;
|
|
90
|
-
results: z.
|
|
67
|
+
results: z.ZodType<ResultsItem, z.ZodTypeDef, ResultsItem>;
|
|
91
68
|
startAt: z.ZodNumber;
|
|
92
69
|
endAt: z.ZodNumber;
|
|
93
70
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -102,7 +79,7 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
102
79
|
destinationPath: string;
|
|
103
80
|
}>;
|
|
104
81
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
105
|
-
results:
|
|
82
|
+
results: ResultsItem;
|
|
106
83
|
startAt: number;
|
|
107
84
|
endAt: number;
|
|
108
85
|
region?: string | undefined;
|
|
@@ -118,7 +95,7 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
118
95
|
destinationPath: string;
|
|
119
96
|
}>;
|
|
120
97
|
pinnable: Record<string, string>;
|
|
121
|
-
results:
|
|
98
|
+
results: ResultsItem;
|
|
122
99
|
startAt: number;
|
|
123
100
|
endAt: number;
|
|
124
101
|
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,
|
|
1
|
+
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../src/types/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D,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,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU1B,CAAA"}
|
package/esm/types/Manifest.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
import { isGeneratorKey } from './GeneratorKeys.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { resultsItem } from './Results.js';
|
|
4
5
|
export const manifestEntry = z.object({
|
|
5
6
|
numberOfLines: z.number(),
|
|
6
7
|
numberOfCharacters: z.number(),
|
|
@@ -8,14 +9,6 @@ export const manifestEntry = z.object({
|
|
|
8
9
|
generatorKeys: z.array(z.string().refine(isGeneratorKey)),
|
|
9
10
|
destinationPath: z.string()
|
|
10
11
|
});
|
|
11
|
-
export const successWarningError = z.enum(['success', 'warning', 'error']);
|
|
12
|
-
export const generateResult = z.record(z.record(successWarningError));
|
|
13
|
-
export const results = z.record(successWarningError);
|
|
14
|
-
export const phaseResults = z.object({
|
|
15
|
-
parseResult: successWarningError,
|
|
16
|
-
generateResult: generateResult,
|
|
17
|
-
renderResult: successWarningError
|
|
18
|
-
});
|
|
19
12
|
export const manifestContent = z.object({
|
|
20
13
|
deploymentId: z.string(),
|
|
21
14
|
traceId: z.string(),
|
|
@@ -23,7 +16,7 @@ export const manifestContent = z.object({
|
|
|
23
16
|
region: z.string().optional(),
|
|
24
17
|
files: z.record(manifestEntry),
|
|
25
18
|
pinnable: z.record(z.string().refine(isGeneratorKey), z.string()),
|
|
26
|
-
results:
|
|
19
|
+
results: resultsItem,
|
|
27
20
|
startAt: z.number(),
|
|
28
21
|
endAt: z.number()
|
|
29
22
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../_dnt.polyfills.js";
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export type SuccessWarningError = 'success' | 'warning' | 'error';
|
|
4
|
+
export type WarningError = 'warning' | 'error';
|
|
5
|
+
export declare const successWarningError: z.ZodEnum<["success", "warning", "error"]>;
|
|
6
|
+
export interface ResultsItem {
|
|
7
|
+
[key: string]: SuccessWarningError | ResultsItem;
|
|
8
|
+
}
|
|
9
|
+
export declare const resultsItem: z.ZodType<ResultsItem>;
|
|
10
|
+
//# sourceMappingURL=Results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Results.d.ts","sourceRoot":"","sources":["../../src/types/Results.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,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,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,WAAW,CAAA;CACjD;AAED,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAE9C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skmtc/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.318",
|
|
4
4
|
"main": "./script/mod.js",
|
|
5
5
|
"module": "./esm/mod.js",
|
|
6
6
|
"exports": {
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"import": "./esm/types/RefName.js",
|
|
29
29
|
"require": "./script/types/RefName.js"
|
|
30
30
|
},
|
|
31
|
+
"./Results": {
|
|
32
|
+
"import": "./esm/types/Results.js",
|
|
33
|
+
"require": "./script/types/Results.js"
|
|
34
|
+
},
|
|
31
35
|
"./toResolvedArtifactPath": {
|
|
32
36
|
"import": "./esm/helpers/toResolvedArtifactPath.js",
|
|
33
37
|
"require": "./script/helpers/toResolvedArtifactPath.js"
|
|
@@ -3,7 +3,7 @@ import type { OasDocument } from '../oas/document/Document.js';
|
|
|
3
3
|
import type { ClientSettings } from '../types/Settings.js';
|
|
4
4
|
import type { OperationGenerator } from '../dsl/OperationInsertable.js';
|
|
5
5
|
import type { ModelGenerator } from '../dsl/ModelInsertable.js';
|
|
6
|
-
import type { SuccessWarningError } from '../types/
|
|
6
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
7
7
|
import * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
8
8
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
9
9
|
type CoreContextArgs = {
|
|
@@ -21,7 +21,7 @@ export declare class CoreContext {
|
|
|
21
21
|
constructor({ spanId }: CoreContextArgs);
|
|
22
22
|
parse(schema: string): OasDocument;
|
|
23
23
|
transform({ schema, settings, generatorsMap, prettier }: TransformArgs): {
|
|
24
|
-
results:
|
|
24
|
+
results: import("../types/Results.js").ResultsItem;
|
|
25
25
|
files: Record<string, import("../types/Manifest.js").ManifestEntry>;
|
|
26
26
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
27
27
|
artifacts: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,W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AMlC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,aAAa;;;;;;IA0EtE,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;CAsBxD;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"}
|
|
@@ -44,6 +44,7 @@ const log = __importStar(require("../deps/jsr.io/@std/log/0.224.6/mod.js"));
|
|
|
44
44
|
const ResultsHandler_js_1 = require("./ResultsHandler.js");
|
|
45
45
|
const StackTrail_js_1 = require("./StackTrail.js");
|
|
46
46
|
const tracer_js_1 = require("../helpers/tracer.js");
|
|
47
|
+
const ResultsLog_js_1 = require("../helpers/ResultsLog.js");
|
|
47
48
|
class CoreContext {
|
|
48
49
|
constructor({ spanId }) {
|
|
49
50
|
_CoreContext_instances.add(this);
|
|
@@ -57,7 +58,7 @@ class CoreContext {
|
|
|
57
58
|
_CoreContext_results.set(this, void 0);
|
|
58
59
|
_CoreContext_stackTrail.set(this, void 0);
|
|
59
60
|
__classPrivateFieldSet(this, _CoreContext_stackTrail, new StackTrail_js_1.StackTrail([spanId]), "f");
|
|
60
|
-
__classPrivateFieldSet(this, _CoreContext_results,
|
|
61
|
+
__classPrivateFieldSet(this, _CoreContext_results, new ResultsLog_js_1.ResultsLog(), "f");
|
|
61
62
|
this.logger = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupLogger).call(this, spanId);
|
|
62
63
|
}
|
|
63
64
|
parse(schema) {
|
|
@@ -97,17 +98,11 @@ class CoreContext {
|
|
|
97
98
|
});
|
|
98
99
|
return {
|
|
99
100
|
...renderOutput,
|
|
100
|
-
results: __classPrivateFieldGet(this, _CoreContext_results, "f")
|
|
101
|
+
results: __classPrivateFieldGet(this, _CoreContext_results, "f").toTree()
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
captureCurrentResult(result) {
|
|
104
|
-
|
|
105
|
-
if (incomingResultIsWorse({
|
|
106
|
-
current: __classPrivateFieldGet(this, _CoreContext_results, "f")[stackTrail],
|
|
107
|
-
incoming: result
|
|
108
|
-
})) {
|
|
109
|
-
__classPrivateFieldGet(this, _CoreContext_results, "f")[stackTrail] = result;
|
|
110
|
-
}
|
|
105
|
+
__classPrivateFieldGet(this, _CoreContext_results, "f").capture(__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").toString(), result);
|
|
111
106
|
}
|
|
112
107
|
}
|
|
113
108
|
exports.CoreContext = CoreContext;
|
|
@@ -148,8 +143,8 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
148
143
|
generatorsMap,
|
|
149
144
|
logger: this.logger,
|
|
150
145
|
callback,
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
147
|
+
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
153
148
|
});
|
|
154
149
|
return { type: 'generate', context: generateContext };
|
|
155
150
|
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators }) {
|
|
@@ -158,15 +153,12 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
158
153
|
prettier,
|
|
159
154
|
basePath,
|
|
160
155
|
pinnableGenerators,
|
|
161
|
-
|
|
156
|
+
logger: this.logger,
|
|
157
|
+
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
158
|
+
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
162
159
|
});
|
|
163
160
|
return { type: 'render', context: renderContext };
|
|
164
161
|
};
|
|
165
|
-
const incomingResultIsWorse = ({ current, incoming }) => {
|
|
166
|
-
return (current === undefined ||
|
|
167
|
-
(current === 'success' && incoming !== 'success') ||
|
|
168
|
-
(current === 'warning' && incoming === 'error'));
|
|
169
|
-
};
|
|
170
162
|
function skmtcFormatter({ logRecord, stackTrail }) {
|
|
171
163
|
return JSON.stringify({
|
|
172
164
|
stackTrail,
|
|
@@ -14,7 +14,7 @@ import type { ContentSettings } from '../dsl/ContentSettings.js';
|
|
|
14
14
|
import type { RefName } from '../types/RefName.js';
|
|
15
15
|
import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
16
16
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
17
|
-
import type { SuccessWarningError } from '../types/
|
|
17
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
18
18
|
import type { StackTrail } from './StackTrail.js';
|
|
19
19
|
type ConstructorArgs = {
|
|
20
20
|
schemaModel: OasDocument;
|
|
@@ -22,8 +22,8 @@ type ConstructorArgs = {
|
|
|
22
22
|
generatorsMap: Record<string, OperationGenerator | ModelGenerator>;
|
|
23
23
|
logger: log.Logger;
|
|
24
24
|
callback: (generatorKey: GeneratorKey) => void;
|
|
25
|
-
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
26
25
|
stackTrail: StackTrail;
|
|
26
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
27
27
|
};
|
|
28
28
|
export type PickArgs = {
|
|
29
29
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAA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ings;
|
|
84
84
|
this.callback = callback;
|
|
85
|
-
this.captureCurrentResult = captureCurrentResult;
|
|
86
85
|
__classPrivateFieldSet(this, _GenerateContext_stackTrail, stackTrail, "f");
|
|
86
|
+
this.captureCurrentResult = captureCurrentResult;
|
|
87
87
|
}
|
|
88
88
|
generate(generatorsMap) {
|
|
89
89
|
Sentry.startSpan({ name: 'Generate operations' }, () => Object.values(generatorsMap)
|
|
@@ -2,13 +2,17 @@ import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
|
2
2
|
import type { AddGeneratorKeyArgs, FileContents, RenderResult } from './types.js';
|
|
3
3
|
import type { Definition } from '../dsl/Definition.js';
|
|
4
4
|
import type { PickArgs } from './GenerateContext.js';
|
|
5
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
5
6
|
import type { StackTrail } from './StackTrail.js';
|
|
7
|
+
import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
6
8
|
type ConstructorArgs = {
|
|
7
9
|
files: Map<string, FileContents>;
|
|
8
10
|
prettier?: PrettierConfigType;
|
|
9
11
|
basePath: string | undefined;
|
|
10
12
|
pinnableGenerators: string[];
|
|
11
13
|
stackTrail: StackTrail;
|
|
14
|
+
logger: log.Logger;
|
|
15
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
12
16
|
};
|
|
13
17
|
export declare class RenderContext {
|
|
14
18
|
#private;
|
|
@@ -17,7 +21,9 @@ export declare class RenderContext {
|
|
|
17
21
|
basePath: string | undefined;
|
|
18
22
|
currentDestinationPath: string | 'PRE_RENDER' | 'POST_RENDER';
|
|
19
23
|
pinnableGenerators: string[];
|
|
20
|
-
|
|
24
|
+
logger: log.Logger;
|
|
25
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
26
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }: ConstructorArgs);
|
|
21
27
|
render(): Omit<RenderResult, 'results'>;
|
|
22
28
|
private collate;
|
|
23
29
|
getFile(filePath: string): FileContents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,YAAY,EACb,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,YAAY,EACb,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAElE,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,oBAAoB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;CAC5D,CAAA;AAYD,qBAAa,aAAa;;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,OAAO,CAAC,QAAQ,CAAC,CAAoB;IACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,sBAAsB,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,CAAA;IAC7D,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAElB,oBAAoB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;gBAC/C,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,oBAAoB,EACrB,EAAE,eAAe;IAWlB,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAuBvC,OAAO,CAAC,OAAO;IA0Df,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IAavC,eAAe,CAAC,EAAE,YAAY,EAAE,EAAE,mBAAmB;IAarD,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -46,7 +46,7 @@ const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.0/mod.js");
|
|
|
46
46
|
const toResolvedArtifactPath_js_1 = require("../helpers/toResolvedArtifactPath.js");
|
|
47
47
|
const tracer_js_1 = require("../helpers/tracer.js");
|
|
48
48
|
class RenderContext {
|
|
49
|
-
constructor({ files, prettier, basePath, pinnableGenerators, stackTrail }) {
|
|
49
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }) {
|
|
50
50
|
Object.defineProperty(this, "files", {
|
|
51
51
|
enumerable: true,
|
|
52
52
|
configurable: true,
|
|
@@ -77,13 +77,27 @@ class RenderContext {
|
|
|
77
77
|
writable: true,
|
|
78
78
|
value: void 0
|
|
79
79
|
});
|
|
80
|
+
Object.defineProperty(this, "logger", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
configurable: true,
|
|
83
|
+
writable: true,
|
|
84
|
+
value: void 0
|
|
85
|
+
});
|
|
80
86
|
_RenderContext_stackTrail.set(this, void 0);
|
|
87
|
+
Object.defineProperty(this, "captureCurrentResult", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
configurable: true,
|
|
90
|
+
writable: true,
|
|
91
|
+
value: void 0
|
|
92
|
+
});
|
|
81
93
|
this.currentDestinationPath = 'PRE_RENDER';
|
|
82
94
|
this.files = files;
|
|
83
95
|
this.prettier = prettier;
|
|
84
96
|
this.basePath = basePath;
|
|
85
97
|
this.pinnableGenerators = pinnableGenerators;
|
|
98
|
+
this.logger = logger;
|
|
86
99
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
100
|
+
this.captureCurrentResult = captureCurrentResult;
|
|
87
101
|
}
|
|
88
102
|
render() {
|
|
89
103
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
@@ -106,43 +120,43 @@ class RenderContext {
|
|
|
106
120
|
}
|
|
107
121
|
collate() {
|
|
108
122
|
const fileEntries = Array.from(this.files.entries());
|
|
109
|
-
const fileObjects = fileEntries
|
|
123
|
+
const fileObjects = fileEntries
|
|
124
|
+
.map(([destinationPath, file]) => {
|
|
110
125
|
return (0, tracer_js_1.tracer)(__classPrivateFieldGet(this, _RenderContext_stackTrail, "f"), destinationPath, () => {
|
|
111
126
|
// Set the current destination path to be used by
|
|
112
127
|
// addGeneratorKey method to apply generator keys
|
|
113
128
|
// to Correct file
|
|
114
129
|
// @TODO: Could this be combined with the tracer call above?
|
|
115
130
|
this.currentDestinationPath = destinationPath;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
try {
|
|
132
|
+
const renderedFile = renderFile({
|
|
133
|
+
file,
|
|
134
|
+
destinationPath,
|
|
135
|
+
basePath: this.basePath,
|
|
136
|
+
prettier: this.prettier
|
|
137
|
+
});
|
|
138
|
+
this.captureCurrentResult('success');
|
|
139
|
+
return renderedFile;
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
this.logger.error(error);
|
|
143
|
+
this.captureCurrentResult('error');
|
|
144
|
+
Sentry.captureException(error);
|
|
145
|
+
}
|
|
122
146
|
});
|
|
123
|
-
})
|
|
147
|
+
})
|
|
148
|
+
.filter(fileObject => fileObject !== undefined);
|
|
124
149
|
this.currentDestinationPath = 'POST_RENDER';
|
|
125
|
-
|
|
126
|
-
for (const fileObject of fileObjects) {
|
|
127
|
-
resolvedFileObjects.push({
|
|
128
|
-
...fileObject,
|
|
129
|
-
hash: 'ADD LATER'
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return resolvedFileObjects.reduce((acc, fileObject) => ({
|
|
150
|
+
return fileObjects.reduce((acc, { content, path, ...fileMeta }) => ({
|
|
133
151
|
...acc,
|
|
134
152
|
artifacts: {
|
|
135
153
|
...acc.artifacts,
|
|
136
|
-
[
|
|
154
|
+
[path]: content
|
|
137
155
|
},
|
|
138
156
|
files: {
|
|
139
157
|
...acc.files,
|
|
140
|
-
[
|
|
141
|
-
|
|
142
|
-
numberOfLines: fileObject.numberOfLines,
|
|
143
|
-
numberOfCharacters: fileObject.numberOfCharacters,
|
|
144
|
-
hash: fileObject.hash,
|
|
145
|
-
generatorKeys: fileObject.generatorKeys
|
|
158
|
+
[path]: {
|
|
159
|
+
...fileMeta
|
|
146
160
|
}
|
|
147
161
|
}
|
|
148
162
|
}), {
|
|
@@ -182,7 +196,8 @@ const renderFile = ({ file, destinationPath, basePath }) => {
|
|
|
182
196
|
destinationPath,
|
|
183
197
|
numberOfLines: content.split('\n').length,
|
|
184
198
|
numberOfCharacters: content.length,
|
|
185
|
-
generatorKeys: Array.from(file.generatorKeys).filter(Boolean)
|
|
199
|
+
generatorKeys: Array.from(file.generatorKeys).filter(Boolean),
|
|
200
|
+
hash: 'PLACEHOLDER'
|
|
186
201
|
};
|
|
187
202
|
};
|
|
188
203
|
const generatePinnable = ({ pinnableGenerators, files }) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Definition } from '../dsl/Definition.js';
|
|
2
2
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
3
|
-
import type { ManifestEntry
|
|
3
|
+
import type { ManifestEntry } from '../types/Manifest.js';
|
|
4
|
+
import type { SuccessWarningError } from '../types/Results.js';
|
|
4
5
|
export type PhaseType = 'parse' | 'generate' | 'render';
|
|
5
6
|
export type FileContents = {
|
|
6
7
|
imports: Map<string, Set<string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,aAAa,EAAE,GAAG,CAAC,YAAY,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAC7C,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResultsItem, SuccessWarningError } from '../types/Results.js';
|
|
2
|
+
export declare class ResultsLog {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
capture(stackTrail: string, result: SuccessWarningError): void;
|
|
6
|
+
toTree(): ResultsItem;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ResultsLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultsLog.d.ts","sourceRoot":"","sources":["../../src/helpers/ResultsLog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE3E,qBAAa,UAAU;;;IAOrB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB;IAiBvD,MAAM,IAAI,WAAW;CAyBtB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _ResultsLog_instances, _ResultsLog_results, _ResultsLog_incomingResultIsWorse;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ResultsLog = void 0;
|
|
19
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
20
|
+
class ResultsLog {
|
|
21
|
+
constructor() {
|
|
22
|
+
_ResultsLog_instances.add(this);
|
|
23
|
+
_ResultsLog_results.set(this, void 0);
|
|
24
|
+
__classPrivateFieldSet(this, _ResultsLog_results, {}, "f");
|
|
25
|
+
}
|
|
26
|
+
capture(stackTrail, result) {
|
|
27
|
+
if (__classPrivateFieldGet(this, _ResultsLog_instances, "m", _ResultsLog_incomingResultIsWorse).call(this, __classPrivateFieldGet(this, _ResultsLog_results, "f")[stackTrail], result)) {
|
|
28
|
+
__classPrivateFieldGet(this, _ResultsLog_results, "f")[stackTrail] = result;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
toTree() {
|
|
32
|
+
const tree = {};
|
|
33
|
+
Object.entries(__classPrivateFieldGet(this, _ResultsLog_results, "f")).forEach(([key, value], index, arr) => {
|
|
34
|
+
const keys = key.split(':');
|
|
35
|
+
let branch = tree;
|
|
36
|
+
keys.forEach(key => {
|
|
37
|
+
if (branch[key] === undefined) {
|
|
38
|
+
branch[key] = {};
|
|
39
|
+
}
|
|
40
|
+
(0, tiny_invariant_1.default)(typeof branch[key] === 'object');
|
|
41
|
+
if (index === arr.length - 1) {
|
|
42
|
+
branch[key] = value;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
branch = branch[key];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return tree;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.ResultsLog = ResultsLog;
|
|
53
|
+
_ResultsLog_results = new WeakMap(), _ResultsLog_instances = new WeakSet(), _ResultsLog_incomingResultIsWorse = function _ResultsLog_incomingResultIsWorse(current, incoming) {
|
|
54
|
+
return (current === undefined ||
|
|
55
|
+
(current === 'success' && incoming !== 'success') ||
|
|
56
|
+
(current === 'warning' && incoming === 'error'));
|
|
57
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
import type { GeneratorKey
|
|
2
|
+
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { type ResultsItem } from './Results.js';
|
|
4
5
|
export type ManifestEntry = {
|
|
5
6
|
numberOfLines: number;
|
|
6
7
|
numberOfCharacters: number;
|
|
@@ -27,30 +28,6 @@ export declare const manifestEntry: z.ZodObject<{
|
|
|
27
28
|
generatorKeys: string[];
|
|
28
29
|
destinationPath: string;
|
|
29
30
|
}>;
|
|
30
|
-
export type SuccessWarningError = 'success' | 'warning' | 'error';
|
|
31
|
-
export type WarningError = 'warning' | 'error';
|
|
32
|
-
export declare const successWarningError: z.ZodEnum<["success", "warning", "error"]>;
|
|
33
|
-
export type GenerateResult = Record<string, Record<string, SuccessWarningError>>;
|
|
34
|
-
export declare const generateResult: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>>;
|
|
35
|
-
export type Results = {
|
|
36
|
-
parse: SuccessWarningError;
|
|
37
|
-
generate: Record<OperationGeneratorKey | ModelGeneratorKey, SuccessWarningError>;
|
|
38
|
-
render: SuccessWarningError;
|
|
39
|
-
};
|
|
40
|
-
export declare const results: z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>;
|
|
41
|
-
export declare const phaseResults: z.ZodObject<{
|
|
42
|
-
parseResult: z.ZodEnum<["success", "warning", "error"]>;
|
|
43
|
-
generateResult: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodEnum<["success", "warning", "error"]>>>;
|
|
44
|
-
renderResult: z.ZodEnum<["success", "warning", "error"]>;
|
|
45
|
-
}, "strip", z.ZodTypeAny, {
|
|
46
|
-
parseResult: "success" | "warning" | "error";
|
|
47
|
-
generateResult: Record<string, Record<string, "success" | "warning" | "error">>;
|
|
48
|
-
renderResult: "success" | "warning" | "error";
|
|
49
|
-
}, {
|
|
50
|
-
parseResult: "success" | "warning" | "error";
|
|
51
|
-
generateResult: Record<string, Record<string, "success" | "warning" | "error">>;
|
|
52
|
-
renderResult: "success" | "warning" | "error";
|
|
53
|
-
}>;
|
|
54
31
|
export type ManifestContent = {
|
|
55
32
|
deploymentId: string;
|
|
56
33
|
traceId: string;
|
|
@@ -58,7 +35,7 @@ export type ManifestContent = {
|
|
|
58
35
|
region?: string;
|
|
59
36
|
files: Record<string, ManifestEntry>;
|
|
60
37
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
61
|
-
results:
|
|
38
|
+
results: ResultsItem;
|
|
62
39
|
startAt: number;
|
|
63
40
|
endAt: number;
|
|
64
41
|
};
|
|
@@ -87,7 +64,7 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
87
64
|
destinationPath: string;
|
|
88
65
|
}>>;
|
|
89
66
|
pinnable: z.ZodRecord<z.ZodEffects<z.ZodString, GeneratorKey, string>, z.ZodString>;
|
|
90
|
-
results: z.
|
|
67
|
+
results: z.ZodType<ResultsItem, z.ZodTypeDef, ResultsItem>;
|
|
91
68
|
startAt: z.ZodNumber;
|
|
92
69
|
endAt: z.ZodNumber;
|
|
93
70
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -102,7 +79,7 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
102
79
|
destinationPath: string;
|
|
103
80
|
}>;
|
|
104
81
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
105
|
-
results:
|
|
82
|
+
results: ResultsItem;
|
|
106
83
|
startAt: number;
|
|
107
84
|
endAt: number;
|
|
108
85
|
region?: string | undefined;
|
|
@@ -118,7 +95,7 @@ export declare const manifestContent: z.ZodObject<{
|
|
|
118
95
|
destinationPath: string;
|
|
119
96
|
}>;
|
|
120
97
|
pinnable: Record<string, string>;
|
|
121
|
-
results:
|
|
98
|
+
results: ResultsItem;
|
|
122
99
|
startAt: number;
|
|
123
100
|
endAt: number;
|
|
124
101
|
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,
|
|
1
|
+
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../src/types/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D,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,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU1B,CAAA"}
|
package/script/types/Manifest.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.manifestContent = exports.
|
|
3
|
+
exports.manifestContent = exports.manifestEntry = void 0;
|
|
4
4
|
require("../_dnt.polyfills.js");
|
|
5
5
|
const GeneratorKeys_js_1 = require("./GeneratorKeys.js");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
|
+
const Results_js_1 = require("./Results.js");
|
|
7
8
|
exports.manifestEntry = zod_1.z.object({
|
|
8
9
|
numberOfLines: zod_1.z.number(),
|
|
9
10
|
numberOfCharacters: zod_1.z.number(),
|
|
@@ -11,14 +12,6 @@ exports.manifestEntry = zod_1.z.object({
|
|
|
11
12
|
generatorKeys: zod_1.z.array(zod_1.z.string().refine(GeneratorKeys_js_1.isGeneratorKey)),
|
|
12
13
|
destinationPath: zod_1.z.string()
|
|
13
14
|
});
|
|
14
|
-
exports.successWarningError = zod_1.z.enum(['success', 'warning', 'error']);
|
|
15
|
-
exports.generateResult = zod_1.z.record(zod_1.z.record(exports.successWarningError));
|
|
16
|
-
exports.results = zod_1.z.record(exports.successWarningError);
|
|
17
|
-
exports.phaseResults = zod_1.z.object({
|
|
18
|
-
parseResult: exports.successWarningError,
|
|
19
|
-
generateResult: exports.generateResult,
|
|
20
|
-
renderResult: exports.successWarningError
|
|
21
|
-
});
|
|
22
15
|
exports.manifestContent = zod_1.z.object({
|
|
23
16
|
deploymentId: zod_1.z.string(),
|
|
24
17
|
traceId: zod_1.z.string(),
|
|
@@ -26,7 +19,7 @@ exports.manifestContent = zod_1.z.object({
|
|
|
26
19
|
region: zod_1.z.string().optional(),
|
|
27
20
|
files: zod_1.z.record(exports.manifestEntry),
|
|
28
21
|
pinnable: zod_1.z.record(zod_1.z.string().refine(GeneratorKeys_js_1.isGeneratorKey), zod_1.z.string()),
|
|
29
|
-
results:
|
|
22
|
+
results: Results_js_1.resultsItem,
|
|
30
23
|
startAt: zod_1.z.number(),
|
|
31
24
|
endAt: zod_1.z.number()
|
|
32
25
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../_dnt.polyfills.js";
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export type SuccessWarningError = 'success' | 'warning' | 'error';
|
|
4
|
+
export type WarningError = 'warning' | 'error';
|
|
5
|
+
export declare const successWarningError: z.ZodEnum<["success", "warning", "error"]>;
|
|
6
|
+
export interface ResultsItem {
|
|
7
|
+
[key: string]: SuccessWarningError | ResultsItem;
|
|
8
|
+
}
|
|
9
|
+
export declare const resultsItem: z.ZodType<ResultsItem>;
|
|
10
|
+
//# sourceMappingURL=Results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Results.d.ts","sourceRoot":"","sources":["../../src/types/Results.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,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,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,WAAW,CAAA;CACjD;AAED,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAE9C,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resultsItem = exports.successWarningError = void 0;
|
|
4
|
+
require("../_dnt.polyfills.js");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.successWarningError = zod_1.z.enum(['success', 'warning', 'error']);
|
|
7
|
+
exports.resultsItem = zod_1.z.record(zod_1.z.lazy(() => zod_1.z.union([exports.resultsItem, exports.successWarningError])));
|