@medusajs/http-types-generator 2.13.6-preview-20260402101111
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/README.md +135 -0
- package/dist/__tests__/compatibility-checker.spec.d.ts +2 -0
- package/dist/__tests__/compatibility-checker.spec.d.ts.map +1 -0
- package/dist/__tests__/compatibility-checker.spec.js +231 -0
- package/dist/__tests__/compatibility-checker.spec.js.map +1 -0
- package/dist/__tests__/config.spec.d.ts +2 -0
- package/dist/__tests__/config.spec.d.ts.map +1 -0
- package/dist/__tests__/config.spec.js +78 -0
- package/dist/__tests__/config.spec.js.map +1 -0
- package/dist/__tests__/import-tracker.spec.d.ts +2 -0
- package/dist/__tests__/import-tracker.spec.d.ts.map +1 -0
- package/dist/__tests__/import-tracker.spec.js +25 -0
- package/dist/__tests__/import-tracker.spec.js.map +1 -0
- package/dist/__tests__/name-classifier.spec.d.ts +2 -0
- package/dist/__tests__/name-classifier.spec.d.ts.map +1 -0
- package/dist/__tests__/name-classifier.spec.js +77 -0
- package/dist/__tests__/name-classifier.spec.js.map +1 -0
- package/dist/__tests__/name-registry.spec.d.ts +2 -0
- package/dist/__tests__/name-registry.spec.d.ts.map +1 -0
- package/dist/__tests__/name-registry.spec.js +67 -0
- package/dist/__tests__/name-registry.spec.js.map +1 -0
- package/dist/__tests__/path-mapper.spec.d.ts +2 -0
- package/dist/__tests__/path-mapper.spec.d.ts.map +1 -0
- package/dist/__tests__/path-mapper.spec.js +98 -0
- package/dist/__tests__/path-mapper.spec.js.map +1 -0
- package/dist/__tests__/type-emitter.spec.d.ts +2 -0
- package/dist/__tests__/type-emitter.spec.d.ts.map +1 -0
- package/dist/__tests__/type-emitter.spec.js +173 -0
- package/dist/__tests__/type-emitter.spec.js.map +1 -0
- package/dist/__tests__/type-pipeline.spec.d.ts +2 -0
- package/dist/__tests__/type-pipeline.spec.d.ts.map +1 -0
- package/dist/__tests__/type-pipeline.spec.js +239 -0
- package/dist/__tests__/type-pipeline.spec.js.map +1 -0
- package/dist/__tests__/utils/ts-utils.d.ts +22 -0
- package/dist/__tests__/utils/ts-utils.d.ts.map +1 -0
- package/dist/__tests__/utils/ts-utils.js +66 -0
- package/dist/__tests__/utils/ts-utils.js.map +1 -0
- package/dist/commands/generate.d.ts +10 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +215 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/validate.d.ts +14 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +201 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config/index.d.ts +52 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +119 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/compatibility-checker.d.ts +92 -0
- package/dist/core/compatibility-checker.d.ts.map +1 -0
- package/dist/core/compatibility-checker.js +415 -0
- package/dist/core/compatibility-checker.js.map +1 -0
- package/dist/core/import-tracker.d.ts +11 -0
- package/dist/core/import-tracker.d.ts.map +1 -0
- package/dist/core/import-tracker.js +17 -0
- package/dist/core/import-tracker.js.map +1 -0
- package/dist/core/program-factory.d.ts +23 -0
- package/dist/core/program-factory.d.ts.map +1 -0
- package/dist/core/program-factory.js +80 -0
- package/dist/core/program-factory.js.map +1 -0
- package/dist/core/schema-extractor.d.ts +73 -0
- package/dist/core/schema-extractor.d.ts.map +1 -0
- package/dist/core/schema-extractor.js +205 -0
- package/dist/core/schema-extractor.js.map +1 -0
- package/dist/core/type-emitter.d.ts +73 -0
- package/dist/core/type-emitter.d.ts.map +1 -0
- package/dist/core/type-emitter.js +246 -0
- package/dist/core/type-emitter.js.map +1 -0
- package/dist/core/type-resolver.d.ts +64 -0
- package/dist/core/type-resolver.d.ts.map +1 -0
- package/dist/core/type-resolver.js +163 -0
- package/dist/core/type-resolver.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/mapping/name-classifier.d.ts +34 -0
- package/dist/mapping/name-classifier.d.ts.map +1 -0
- package/dist/mapping/name-classifier.js +72 -0
- package/dist/mapping/name-classifier.js.map +1 -0
- package/dist/mapping/name-registry.d.ts +54 -0
- package/dist/mapping/name-registry.d.ts.map +1 -0
- package/dist/mapping/name-registry.js +251 -0
- package/dist/mapping/name-registry.js.map +1 -0
- package/dist/mapping/path-mapper.d.ts +62 -0
- package/dist/mapping/path-mapper.d.ts.map +1 -0
- package/dist/mapping/path-mapper.js +116 -0
- package/dist/mapping/path-mapper.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/file-merger.d.ts +47 -0
- package/dist/utils/file-merger.d.ts.map +1 -0
- package/dist/utils/file-merger.js +164 -0
- package/dist/utils/file-merger.js.map +1 -0
- package/dist/utils/formatter.d.ts +12 -0
- package/dist/utils/formatter.d.ts.map +1 -0
- package/dist/utils/formatter.js +31 -0
- package/dist/utils/formatter.js.map +1 -0
- package/dist/utils/fs-helpers.d.ts +21 -0
- package/dist/utils/fs-helpers.d.ts.map +1 -0
- package/dist/utils/fs-helpers.js +42 -0
- package/dist/utils/fs-helpers.js.map +1 -0
- package/dist/utils/index-manager.d.ts +24 -0
- package/dist/utils/index-manager.d.ts.map +1 -0
- package/dist/utils/index-manager.js +95 -0
- package/dist/utils/index-manager.js.map +1 -0
- package/dist/utils/ts-helpers.d.ts +87 -0
- package/dist/utils/ts-helpers.d.ts.map +1 -0
- package/dist/utils/ts-helpers.js +216 -0
- package/dist/utils/ts-helpers.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Config = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
class Config {
|
|
10
|
+
/**
|
|
11
|
+
* Walks up the directory tree from `startDir` to find the nearest ancestor
|
|
12
|
+
* (inclusive) that contains `http-types.config.json`. Returns the directory
|
|
13
|
+
* path and parsed contents, or `undefined` if the file is not found.
|
|
14
|
+
*/
|
|
15
|
+
static findConfigFile(startDir) {
|
|
16
|
+
let dir = startDir;
|
|
17
|
+
while (true) {
|
|
18
|
+
const candidate = path_1.default.join(dir, Config.CONFIG_FILE_NAME);
|
|
19
|
+
if ((0, fs_1.existsSync)(candidate)) {
|
|
20
|
+
try {
|
|
21
|
+
const raw = (0, fs_1.readFileSync)(candidate, "utf-8");
|
|
22
|
+
return { dir, config: JSON.parse(raw) };
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
console.warn(`Warning: could not parse ${candidate}, using default config`);
|
|
26
|
+
return { dir, config: {} };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const parent = path_1.default.dirname(dir);
|
|
30
|
+
if (parent === dir)
|
|
31
|
+
break;
|
|
32
|
+
dir = parent;
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Builds a resolved config by deep-merging `override` over DEFAULTS.
|
|
38
|
+
* When `override` is provided the config file is not read and `projectRoot`
|
|
39
|
+
* is set to `process.cwd()`. When omitted, the nearest `http-types.config.json`
|
|
40
|
+
* is found by searching upward from `process.cwd()`; its directory becomes
|
|
41
|
+
* `projectRoot`. Falls back to `process.cwd()` when no config file is found.
|
|
42
|
+
*/
|
|
43
|
+
static load(override) {
|
|
44
|
+
let projectRoot = process.cwd();
|
|
45
|
+
let userConfig;
|
|
46
|
+
if (override !== undefined) {
|
|
47
|
+
userConfig = override;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const found = Config.findConfigFile(process.cwd());
|
|
51
|
+
if (found) {
|
|
52
|
+
projectRoot = found.dir;
|
|
53
|
+
userConfig = found.config;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
userConfig = {};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
Config._instance = {
|
|
60
|
+
projectRoot,
|
|
61
|
+
validatorGlobs: {
|
|
62
|
+
...Config.DEFAULTS.validatorGlobs,
|
|
63
|
+
...(userConfig.validatorGlobs ?? {}),
|
|
64
|
+
},
|
|
65
|
+
outputBase: userConfig.outputBase ?? Config.DEFAULTS.outputBase,
|
|
66
|
+
tsconfig: userConfig.tsconfig ?? Config.DEFAULTS.tsconfig,
|
|
67
|
+
importSources: {
|
|
68
|
+
...Config.DEFAULTS.importSources,
|
|
69
|
+
...(userConfig.importSources ?? {}),
|
|
70
|
+
},
|
|
71
|
+
validatorPathPattern: (() => {
|
|
72
|
+
const pattern = userConfig.validatorPathPattern ?? Config.DEFAULTS.validatorPathPattern;
|
|
73
|
+
try {
|
|
74
|
+
new RegExp(pattern);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
throw new Error(`validatorPathPattern in http-types.config.json is not a valid regex: "${pattern}"`);
|
|
78
|
+
}
|
|
79
|
+
return pattern;
|
|
80
|
+
})(),
|
|
81
|
+
publicPrefixes: userConfig.publicPrefixes ?? Config.DEFAULTS.publicPrefixes,
|
|
82
|
+
};
|
|
83
|
+
return Config._instance;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns the cached config, loading it from the config file on first call.
|
|
87
|
+
*/
|
|
88
|
+
static get() {
|
|
89
|
+
if (!Config._instance) {
|
|
90
|
+
return Config.load();
|
|
91
|
+
}
|
|
92
|
+
return Config._instance;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resets the cached config singleton. Primarily used in tests.
|
|
96
|
+
*/
|
|
97
|
+
static reset() {
|
|
98
|
+
Config._instance = null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.Config = Config;
|
|
102
|
+
/** Package defaults — used when no http-types.config.json is present */
|
|
103
|
+
Config.DEFAULTS = {
|
|
104
|
+
validatorGlobs: {
|
|
105
|
+
admin: "**/api/admin/*/validators.ts",
|
|
106
|
+
store: "**/api/store/*/validators.ts",
|
|
107
|
+
},
|
|
108
|
+
outputBase: "src/types/http",
|
|
109
|
+
tsconfig: "tsconfig.json",
|
|
110
|
+
importSources: {
|
|
111
|
+
commonRequest: "@medusajs/framework/types",
|
|
112
|
+
dal: "@medusajs/framework/types",
|
|
113
|
+
},
|
|
114
|
+
validatorPathPattern: "/api/([^/]+)/([^/]+)/validators\\.ts$",
|
|
115
|
+
publicPrefixes: ["Admin", "Store"],
|
|
116
|
+
};
|
|
117
|
+
Config.CONFIG_FILE_NAME = "http-types.config.json";
|
|
118
|
+
Config._instance = null;
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,2BAA6C;AA2B7C,MAAa,MAAM;IAqBjB;;;;OAIG;IACK,MAAM,CAAC,cAAc,CAC3B,QAAgB;QAEhB,IAAI,GAAG,GAAG,QAAQ,CAAA;QAClB,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAA;YACzD,IAAI,IAAA,eAAU,EAAC,SAAS,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC;oBACH,MAAM,GAAG,GAAG,IAAA,iBAAY,EAAC,SAAS,EAAE,OAAO,CAAC,CAAA;oBAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAA6B,EAAE,CAAA;gBACrE,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,CAAC,IAAI,CACV,4BAA4B,SAAS,wBAAwB,CAC9D,CAAA;oBACD,OA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
+
httpTypeName: string;
|
|
4
|
+
httpTypeFile: string;
|
|
5
|
+
validatorName: string;
|
|
6
|
+
/** Absolute path to the validator file that contains the Zod schema */
|
|
7
|
+
validatorFile: string;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
/** True when the HTTP type interface was not found in the target file at all. */
|
|
10
|
+
typeNotFound: boolean;
|
|
11
|
+
missingFields: FieldDiff[];
|
|
12
|
+
typeMismatchFields: FieldDiff[];
|
|
13
|
+
extraFields: FieldDiff[];
|
|
14
|
+
}
|
|
15
|
+
export interface FieldDiff {
|
|
16
|
+
fieldName: string;
|
|
17
|
+
expectedType?: string;
|
|
18
|
+
actualType?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CheckPair {
|
|
21
|
+
/** The Zod schema export name (for diagnostics) */
|
|
22
|
+
validatorName: string;
|
|
23
|
+
/** Absolute path to the validator file that contains the Zod schema */
|
|
24
|
+
validatorFile: string;
|
|
25
|
+
/** The HTTP type name to check against */
|
|
26
|
+
httpTypeName: string;
|
|
27
|
+
/** The resolved TypeScript type from the Zod schema (_input or _output) */
|
|
28
|
+
resolvedZodType: ts.Type;
|
|
29
|
+
/** Absolute path to the HTTP type file */
|
|
30
|
+
httpTypeFile: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the Zod schema uses createFindParams(). When true, FindParams
|
|
33
|
+
* fields are expected to be present in the HTTP type via `extends FindParams`.
|
|
34
|
+
*/
|
|
35
|
+
hasFindParams: boolean;
|
|
36
|
+
/** Whether the Zod schema uses createSelectParams() (but not createFindParams). */
|
|
37
|
+
hasSelectParams: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Checks structural compatibility between Zod-inferred types and existing HTTP types.
|
|
41
|
+
*/
|
|
42
|
+
export declare class CompatibilityChecker {
|
|
43
|
+
private readonly program;
|
|
44
|
+
private readonly checker;
|
|
45
|
+
constructor(program: ts.Program, checker: ts.TypeChecker);
|
|
46
|
+
/**
|
|
47
|
+
* Checks structural compatibility between Zod-inferred types and existing HTTP types
|
|
48
|
+
* by performing field-level structural diffs.
|
|
49
|
+
*
|
|
50
|
+
* @param lenient - When true, treats `T | null | undefined` as compatible with
|
|
51
|
+
* `T | undefined` (ignores the presence of `null` in the Zod schema type).
|
|
52
|
+
*/
|
|
53
|
+
check(pairs: CheckPair[], httpTypeFiles: string[], lenient?: boolean): CompatibilityResult[];
|
|
54
|
+
/**
|
|
55
|
+
* Formats a compatibility result as a human-readable string for CLI output.
|
|
56
|
+
*/
|
|
57
|
+
static formatResult(result: CompatibilityResult, verbose?: boolean): string;
|
|
58
|
+
/**
|
|
59
|
+
* Builds a map of HTTP type name → ts.Type by scanning all provided HTTP type files.
|
|
60
|
+
*/
|
|
61
|
+
private buildHttpTypeMap;
|
|
62
|
+
/**
|
|
63
|
+
* Checks a single (zodType, httpType) pair for structural compatibility.
|
|
64
|
+
*/
|
|
65
|
+
private checkSinglePair;
|
|
66
|
+
/**
|
|
67
|
+
* Performs a field-level structural diff between two TypeScript types.
|
|
68
|
+
*/
|
|
69
|
+
private static diffTypes;
|
|
70
|
+
/**
|
|
71
|
+
* Checks string/enum compatibility between a Zod type and an HTTP type.
|
|
72
|
+
*/
|
|
73
|
+
private static isStringEnumCompatible;
|
|
74
|
+
/**
|
|
75
|
+
* Returns true if a type (or one of its union members) has an `$eq` property.
|
|
76
|
+
*/
|
|
77
|
+
private static hasOperatorMapShape;
|
|
78
|
+
/**
|
|
79
|
+
* Checks OperatorMap compatibility between a Zod type and an HTTP type.
|
|
80
|
+
*/
|
|
81
|
+
private static isOperatorMapCompatible;
|
|
82
|
+
/**
|
|
83
|
+
* Recursively checks whether `zodType` is compatible with `httpType` in lenient
|
|
84
|
+
* mode, stripping `null | undefined` at each level before comparing.
|
|
85
|
+
*/
|
|
86
|
+
private static isLenientlyCompatible;
|
|
87
|
+
/**
|
|
88
|
+
* Returns true if a property name should be skipped during structural diffing.
|
|
89
|
+
*/
|
|
90
|
+
private static isInternalPropertyName;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=compatibility-checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility-checker.d.ts","sourceRoot":"","sources":["../../src/core/compatibility-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAM3B,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;IACf,iFAAiF;IACjF,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,EAAE,SAAS,EAAE,CAAA;IAC1B,kBAAkB,EAAE,SAAS,EAAE,CAAA;IAC/B,WAAW,EAAE,SAAS,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAA;IACrB,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,eAAe,EAAE,EAAE,CAAC,IAAI,CAAA;IACxB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAA;IACtB,mFAAmF;IACnF,eAAe,EAAE,OAAO,CAAA;CACzB;AA8CD;;GAEG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,OAAO,EAAE,EAAE,CAAC,WAAW;IAG1C;;;;;;OAMG;IACH,KAAK,CACH,KAAK,EAAE,SAAS,EAAE,EAClB,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,UAAQ,GACd,mBAAmB,EAAE;IAOxB;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,UAAQ,GAAG,MAAM;IAkDzE;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0BxB;;OAEG;IACH,OAAO,CAAC,eAAe;IA2DvB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IA6IxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IA0DrC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAUlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAatC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IA4HpC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAQtC"}
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CompatibilityChecker = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_helpers_1 = require("../utils/fs-helpers");
|
|
10
|
+
const ts_helpers_1 = require("../utils/ts-helpers");
|
|
11
|
+
const type_resolver_1 = require("./type-resolver");
|
|
12
|
+
/**
|
|
13
|
+
* Zod schema method and internal property names that may leak into resolved TypeScript types.
|
|
14
|
+
*/
|
|
15
|
+
const ZOD_INTERNAL_NAMES = new Set([
|
|
16
|
+
"parse",
|
|
17
|
+
"parseAsync",
|
|
18
|
+
"safeParse",
|
|
19
|
+
"safeParseAsync",
|
|
20
|
+
"refine",
|
|
21
|
+
"superRefine",
|
|
22
|
+
"transform",
|
|
23
|
+
"default",
|
|
24
|
+
"describe",
|
|
25
|
+
"optional",
|
|
26
|
+
"nullable",
|
|
27
|
+
"array",
|
|
28
|
+
"or",
|
|
29
|
+
"and",
|
|
30
|
+
"brand",
|
|
31
|
+
"pipe",
|
|
32
|
+
"readonly",
|
|
33
|
+
"catch",
|
|
34
|
+
"preprocess",
|
|
35
|
+
"merge",
|
|
36
|
+
"augment",
|
|
37
|
+
"extend",
|
|
38
|
+
"pick",
|
|
39
|
+
"omit",
|
|
40
|
+
"partial",
|
|
41
|
+
"required",
|
|
42
|
+
"deepPartial",
|
|
43
|
+
"keyof",
|
|
44
|
+
"strip",
|
|
45
|
+
"strict",
|
|
46
|
+
"passthrough",
|
|
47
|
+
"setKey",
|
|
48
|
+
"nonstrict",
|
|
49
|
+
"shape",
|
|
50
|
+
"spa",
|
|
51
|
+
"description",
|
|
52
|
+
"isOptional",
|
|
53
|
+
"isNullable",
|
|
54
|
+
]);
|
|
55
|
+
/**
|
|
56
|
+
* Checks structural compatibility between Zod-inferred types and existing HTTP types.
|
|
57
|
+
*/
|
|
58
|
+
class CompatibilityChecker {
|
|
59
|
+
constructor(program, checker) {
|
|
60
|
+
this.program = program;
|
|
61
|
+
this.checker = checker;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks structural compatibility between Zod-inferred types and existing HTTP types
|
|
65
|
+
* by performing field-level structural diffs.
|
|
66
|
+
*
|
|
67
|
+
* @param lenient - When true, treats `T | null | undefined` as compatible with
|
|
68
|
+
* `T | undefined` (ignores the presence of `null` in the Zod schema type).
|
|
69
|
+
*/
|
|
70
|
+
check(pairs, httpTypeFiles, lenient = false) {
|
|
71
|
+
const httpTypeMap = this.buildHttpTypeMap(httpTypeFiles);
|
|
72
|
+
return pairs.map((pair) => this.checkSinglePair(pair, httpTypeMap, lenient));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Formats a compatibility result as a human-readable string for CLI output.
|
|
76
|
+
*/
|
|
77
|
+
static formatResult(result, verbose = false) {
|
|
78
|
+
const lines = [];
|
|
79
|
+
if (result.passed) {
|
|
80
|
+
if (verbose) {
|
|
81
|
+
lines.push(` PASS ${result.httpTypeName}`);
|
|
82
|
+
}
|
|
83
|
+
return lines.join("\n");
|
|
84
|
+
}
|
|
85
|
+
const relHttpPath = result.httpTypeFile
|
|
86
|
+
? path_1.default.relative(fs_helpers_1.FsHelpers.fromRoot(), result.httpTypeFile)
|
|
87
|
+
: "unknown";
|
|
88
|
+
const relValidatorPath = result.validatorFile
|
|
89
|
+
? path_1.default.relative(fs_helpers_1.FsHelpers.fromRoot(), result.validatorFile)
|
|
90
|
+
: "unknown";
|
|
91
|
+
lines.push(` FAIL ${result.httpTypeName} (${relHttpPath})`);
|
|
92
|
+
lines.push(` Zod schema: ${result.validatorName} (${relValidatorPath})`);
|
|
93
|
+
if (result.typeNotFound) {
|
|
94
|
+
lines.push(` HTTP type not found — run generate:http-types to create it.`);
|
|
95
|
+
return lines.join("\n");
|
|
96
|
+
}
|
|
97
|
+
for (const diff of result.missingFields) {
|
|
98
|
+
lines.push(` Missing field: ${diff.fieldName} (expected: ${diff.expectedType})`);
|
|
99
|
+
}
|
|
100
|
+
for (const diff of result.typeMismatchFields) {
|
|
101
|
+
lines.push(` Type mismatch: ${diff.fieldName}`);
|
|
102
|
+
lines.push(` Zod schema: ${diff.expectedType}`);
|
|
103
|
+
lines.push(` HTTP type: ${diff.actualType}`);
|
|
104
|
+
}
|
|
105
|
+
for (const diff of result.extraFields) {
|
|
106
|
+
lines.push(` HTTP-only field: ${diff.fieldName}${diff.actualType ? ` (${diff.actualType})` : ""}`);
|
|
107
|
+
}
|
|
108
|
+
return lines.join("\n");
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Builds a map of HTTP type name → ts.Type by scanning all provided HTTP type files.
|
|
112
|
+
*/
|
|
113
|
+
buildHttpTypeMap(httpTypeFiles) {
|
|
114
|
+
const map = new Map();
|
|
115
|
+
for (const filePath of httpTypeFiles) {
|
|
116
|
+
const sourceFile = this.program.getSourceFile(filePath);
|
|
117
|
+
if (!sourceFile)
|
|
118
|
+
continue;
|
|
119
|
+
typescript_1.default.forEachChild(sourceFile, (node) => {
|
|
120
|
+
if (typescript_1.default.isInterfaceDeclaration(node) ||
|
|
121
|
+
typescript_1.default.isTypeAliasDeclaration(node)) {
|
|
122
|
+
const symbol = this.checker.getSymbolAtLocation(node.name);
|
|
123
|
+
if (symbol) {
|
|
124
|
+
map.set(node.name.text, this.checker.getDeclaredTypeOfSymbol(symbol));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return map;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Checks a single (zodType, httpType) pair for structural compatibility.
|
|
133
|
+
*/
|
|
134
|
+
checkSinglePair(pair, httpTypeMap, lenient = false) {
|
|
135
|
+
const { validatorName, validatorFile, httpTypeName, resolvedZodType, httpTypeFile, hasFindParams, hasSelectParams, } = pair;
|
|
136
|
+
const httpType = httpTypeMap.get(httpTypeName);
|
|
137
|
+
if (!httpType) {
|
|
138
|
+
return {
|
|
139
|
+
httpTypeName,
|
|
140
|
+
httpTypeFile,
|
|
141
|
+
validatorName,
|
|
142
|
+
validatorFile,
|
|
143
|
+
passed: false,
|
|
144
|
+
typeNotFound: true,
|
|
145
|
+
missingFields: [],
|
|
146
|
+
typeMismatchFields: [],
|
|
147
|
+
extraFields: [],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const { missingFields, typeMismatchFields, extraFields } = CompatibilityChecker.diffTypes({
|
|
151
|
+
checker: this.checker,
|
|
152
|
+
zodType: resolvedZodType,
|
|
153
|
+
httpType,
|
|
154
|
+
lenient,
|
|
155
|
+
hasFindParams,
|
|
156
|
+
hasSelectParams,
|
|
157
|
+
});
|
|
158
|
+
const passed = missingFields.length === 0 &&
|
|
159
|
+
typeMismatchFields.length === 0 &&
|
|
160
|
+
extraFields.length === 0;
|
|
161
|
+
return {
|
|
162
|
+
httpTypeName,
|
|
163
|
+
httpTypeFile,
|
|
164
|
+
validatorName,
|
|
165
|
+
validatorFile,
|
|
166
|
+
passed,
|
|
167
|
+
typeNotFound: false,
|
|
168
|
+
missingFields,
|
|
169
|
+
typeMismatchFields,
|
|
170
|
+
extraFields,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Performs a field-level structural diff between two TypeScript types.
|
|
175
|
+
*/
|
|
176
|
+
static diffTypes({ checker, zodType, httpType, lenient = false, hasFindParams = false, hasSelectParams = false, }) {
|
|
177
|
+
const missingFields = [];
|
|
178
|
+
const typeMismatchFields = [];
|
|
179
|
+
const extraFields = [];
|
|
180
|
+
const zodProps = new Map();
|
|
181
|
+
const httpProps = new Map();
|
|
182
|
+
for (const prop of zodType.getProperties()) {
|
|
183
|
+
zodProps.set(prop.name, prop);
|
|
184
|
+
}
|
|
185
|
+
for (const prop of httpType.getProperties()) {
|
|
186
|
+
httpProps.set(prop.name, prop);
|
|
187
|
+
}
|
|
188
|
+
for (const [name, zodProp] of zodProps) {
|
|
189
|
+
if (CompatibilityChecker.isInternalPropertyName(name)) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const zodPropType = checker.getTypeOfSymbol(zodProp);
|
|
193
|
+
if (zodPropType.getProperty("_output") !== undefined ||
|
|
194
|
+
zodPropType.getProperty("_input") !== undefined) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const callSigs = zodPropType.getCallSignatures();
|
|
198
|
+
if (callSigs.length > 0) {
|
|
199
|
+
const retType = checker.getReturnTypeOfSignature(callSigs[0]);
|
|
200
|
+
if (retType.getProperty("_output") !== undefined ||
|
|
201
|
+
retType.getProperty("_input") !== undefined) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const httpProp = httpProps.get(name);
|
|
206
|
+
if (!httpProp) {
|
|
207
|
+
if (zodPropType.flags & typescript_1.default.TypeFlags.Unknown ||
|
|
208
|
+
zodPropType.flags & typescript_1.default.TypeFlags.Any) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
missingFields.push({
|
|
212
|
+
fieldName: name,
|
|
213
|
+
expectedType: ts_helpers_1.TsHelpers.typeToDisplayString(checker, zodPropType),
|
|
214
|
+
});
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
const httpPropType = checker.getTypeOfSymbol(httpProp);
|
|
218
|
+
if (zodPropType.flags & typescript_1.default.TypeFlags.Unknown ||
|
|
219
|
+
zodPropType.flags & typescript_1.default.TypeFlags.Any) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
let isAssignable = checker.isTypeAssignableTo(zodPropType, httpPropType);
|
|
223
|
+
if (!isAssignable && lenient) {
|
|
224
|
+
isAssignable = CompatibilityChecker.isLenientlyCompatible(checker, zodPropType, httpPropType);
|
|
225
|
+
}
|
|
226
|
+
if (!isAssignable) {
|
|
227
|
+
isAssignable = CompatibilityChecker.isOperatorMapCompatible(checker, zodPropType, httpPropType);
|
|
228
|
+
}
|
|
229
|
+
if (!isAssignable) {
|
|
230
|
+
isAssignable = CompatibilityChecker.isStringEnumCompatible(checker, zodPropType, httpPropType);
|
|
231
|
+
}
|
|
232
|
+
if (!isAssignable) {
|
|
233
|
+
typeMismatchFields.push({
|
|
234
|
+
fieldName: name,
|
|
235
|
+
expectedType: ts_helpers_1.TsHelpers.typeToDisplayString(checker, zodPropType),
|
|
236
|
+
actualType: ts_helpers_1.TsHelpers.typeToDisplayString(checker, httpPropType),
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
for (const [name] of httpProps) {
|
|
241
|
+
if (CompatibilityChecker.isInternalPropertyName(name)) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if ((hasFindParams && type_resolver_1.FIND_PARAMS_FIELDS.has(name)) ||
|
|
245
|
+
(hasSelectParams && type_resolver_1.SELECT_PARAMS_FIELDS.has(name))) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (!zodProps.has(name)) {
|
|
249
|
+
const httpProp = httpProps.get(name);
|
|
250
|
+
const httpPropType = checker.getTypeOfSymbol(httpProp);
|
|
251
|
+
extraFields.push({
|
|
252
|
+
fieldName: name,
|
|
253
|
+
actualType: ts_helpers_1.TsHelpers.typeToDisplayString(checker, httpPropType),
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return { missingFields, typeMismatchFields, extraFields };
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Checks string/enum compatibility between a Zod type and an HTTP type.
|
|
261
|
+
*/
|
|
262
|
+
static isStringEnumCompatible(checker, zodType, httpType) {
|
|
263
|
+
const zodBase = checker.getNonNullableType(zodType);
|
|
264
|
+
const httpBase = checker.getNonNullableType(httpType);
|
|
265
|
+
const zodIsString = ts_helpers_1.TsHelpers.isPlainString(zodBase);
|
|
266
|
+
const zodIsEnum = ts_helpers_1.TsHelpers.isStringLiteralOrUnion(zodBase);
|
|
267
|
+
const httpIsString = ts_helpers_1.TsHelpers.isPlainString(httpBase);
|
|
268
|
+
const httpIsEnum = ts_helpers_1.TsHelpers.isStringLiteralOrUnion(httpBase);
|
|
269
|
+
const httpIsStringEnum = ts_helpers_1.TsHelpers.isStringEnumType(httpBase);
|
|
270
|
+
if (zodIsString && (httpIsEnum || httpIsStringEnum)) {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
if (zodIsEnum && httpIsString) {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
if (zodIsEnum && httpIsEnum) {
|
|
277
|
+
const zodValues = ts_helpers_1.TsHelpers.getStringLiteralValues(zodBase);
|
|
278
|
+
const httpValues = ts_helpers_1.TsHelpers.getStringLiteralValues(httpBase);
|
|
279
|
+
if (zodValues.size !== httpValues.size) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
for (const v of zodValues) {
|
|
283
|
+
if (!httpValues.has(v)) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
if (zodBase.isUnion() && httpBase.isUnion()) {
|
|
290
|
+
const zodScalars = zodBase.types.filter((t) => !checker.isArrayType(t));
|
|
291
|
+
const httpScalars = httpBase.types.filter((t) => !checker.isArrayType(t));
|
|
292
|
+
if (zodScalars.length > 0 && httpScalars.length > 0) {
|
|
293
|
+
const zodScalarsAreStrings = zodScalars.every(ts_helpers_1.TsHelpers.isPlainString);
|
|
294
|
+
const httpScalarsAreStringBased = httpScalars.every((t) => ts_helpers_1.TsHelpers.isPlainString(t) ||
|
|
295
|
+
ts_helpers_1.TsHelpers.isStringLiteralOrUnion(t) ||
|
|
296
|
+
ts_helpers_1.TsHelpers.isStringEnumType(t));
|
|
297
|
+
if (zodScalarsAreStrings && httpScalarsAreStringBased) {
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Returns true if a type (or one of its union members) has an `$eq` property.
|
|
306
|
+
*/
|
|
307
|
+
static hasOperatorMapShape(type) {
|
|
308
|
+
if (type.getProperty("$eq")) {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
if (type.isUnion()) {
|
|
312
|
+
return type.types.some((t) => t.getProperty("$eq") !== undefined);
|
|
313
|
+
}
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Checks OperatorMap compatibility between a Zod type and an HTTP type.
|
|
318
|
+
*/
|
|
319
|
+
static isOperatorMapCompatible(checker, zodType, httpType) {
|
|
320
|
+
const zodNonNull = checker.getNonNullableType(zodType);
|
|
321
|
+
const httpNonNull = checker.getNonNullableType(httpType);
|
|
322
|
+
return (CompatibilityChecker.hasOperatorMapShape(zodNonNull) &&
|
|
323
|
+
CompatibilityChecker.hasOperatorMapShape(httpNonNull));
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Recursively checks whether `zodType` is compatible with `httpType` in lenient
|
|
327
|
+
* mode, stripping `null | undefined` at each level before comparing.
|
|
328
|
+
*/
|
|
329
|
+
static isLenientlyCompatible(checker, zodType, httpType, depth = 0) {
|
|
330
|
+
if (checker.isTypeAssignableTo(zodType, httpType)) {
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
const zodNonNull = checker.getNonNullableType(zodType);
|
|
334
|
+
const httpNonNull = checker.getNonNullableType(httpType);
|
|
335
|
+
if (checker.isTypeAssignableTo(zodNonNull, httpNonNull)) {
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
if (depth >= 8) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
if (zodNonNull.isUnion() && checker.isArrayType(httpNonNull)) {
|
|
342
|
+
const httpElemTypes = checker.getTypeArguments(httpNonNull);
|
|
343
|
+
if (httpElemTypes.length === 1) {
|
|
344
|
+
const httpElemType = httpElemTypes[0];
|
|
345
|
+
const zodArrayMember = zodNonNull.types.find((t) => checker.isArrayType(t));
|
|
346
|
+
const zodScalarMember = zodNonNull.types.find((t) => !checker.isArrayType(t));
|
|
347
|
+
if (zodArrayMember && zodScalarMember) {
|
|
348
|
+
const zodArrayElem = checker.getTypeArguments(zodArrayMember)[0];
|
|
349
|
+
if (zodArrayElem &&
|
|
350
|
+
checker.isTypeAssignableTo(zodArrayElem, httpElemType) &&
|
|
351
|
+
checker.isTypeAssignableTo(zodScalarMember, httpElemType)) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const zodIndexInfos = checker.getIndexInfosOfType(zodNonNull);
|
|
358
|
+
const httpIndexInfos = checker.getIndexInfosOfType(httpNonNull);
|
|
359
|
+
if (zodIndexInfos.length > 0 && zodNonNull.getProperties().length === 0) {
|
|
360
|
+
if ((httpIndexInfos.length > 0 &&
|
|
361
|
+
httpNonNull.getProperties().length === 0) ||
|
|
362
|
+
(!checker.isArrayType(httpNonNull) &&
|
|
363
|
+
httpNonNull.getProperties().length > 0)) {
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (checker.isArrayType(zodNonNull) && checker.isArrayType(httpNonNull)) {
|
|
368
|
+
const zodElem = checker.getTypeArguments(zodNonNull)[0];
|
|
369
|
+
const httpElem = checker.getTypeArguments(httpNonNull)[0];
|
|
370
|
+
if (zodElem && httpElem) {
|
|
371
|
+
return CompatibilityChecker.isLenientlyCompatible(checker, zodElem, httpElem, depth + 1);
|
|
372
|
+
}
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
const zodProps = zodNonNull.getProperties();
|
|
376
|
+
const httpProps = httpNonNull.getProperties();
|
|
377
|
+
if (zodProps.length === 0 || httpProps.length === 0) {
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
const httpPropMap = new Map();
|
|
381
|
+
for (const p of httpProps) {
|
|
382
|
+
httpPropMap.set(p.name, p);
|
|
383
|
+
}
|
|
384
|
+
for (const zodProp of zodProps) {
|
|
385
|
+
if (CompatibilityChecker.isInternalPropertyName(zodProp.name)) {
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
const httpProp = httpPropMap.get(zodProp.name);
|
|
389
|
+
if (!httpProp) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
const zodPropType = checker.getTypeOfSymbol(zodProp);
|
|
393
|
+
const httpPropType = checker.getTypeOfSymbol(httpProp);
|
|
394
|
+
if (zodPropType.flags & typescript_1.default.TypeFlags.Unknown ||
|
|
395
|
+
zodPropType.flags & typescript_1.default.TypeFlags.Any) {
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
if (!CompatibilityChecker.isLenientlyCompatible(checker, zodPropType, httpPropType, depth + 1)) {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Returns true if a property name should be skipped during structural diffing.
|
|
406
|
+
*/
|
|
407
|
+
static isInternalPropertyName(name) {
|
|
408
|
+
return (name.startsWith("_") ||
|
|
409
|
+
name.startsWith("$") ||
|
|
410
|
+
name.startsWith("~") ||
|
|
411
|
+
ZOD_INTERNAL_NAMES.has(name));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
exports.CompatibilityChecker = CompatibilityChecker;
|
|
415
|
+
//# sourceMappingURL=compatibility-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility-checker.js","sourceRoot":"","sources":["../../src/core/compatibility-checker.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA2B;AAC3B,gDAAuB;AACvB,oDAA+C;AAC/C,oDAA+C;AAC/C,mDAA0E;AA0C1E;;GAEG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,OAAO;IACP,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,QAAQ;IACR,aAAa;IACb,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,OAAO;IACP,IAAI;IACJ,KAAK;IACL,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;IACP,YAAY;IACZ,OAAO;IACP,SAAS;IACT,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,aAAa;IACb,OAAO;IACP,OAAO;IACP,QAAQ;IACR,aAAa;IACb,QAAQ;IACR,WAAW;IACX,OAAO;IACP,KAAK;IACL,aAAa;IACb,YAAY;IACZ,YAAY;CACb,CAAC,CAAA;AAEF;;GAEG;AACH,MAAa,oBAAoB;IAC/B,YACmB,OAAmB,EACnB,OAAuB;QADvB,YAAO,GAAP,O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,EAAE,CAAC;gBACd,OAAO,KAAK,CAAA;YACd,CAAC;YACD,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;YACpD,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;YAEtD,IACE,WAAW,CAAC,KAAK,GAAG,oBAAE,CAAC,SAAS,CAAC,OAAO;gBACxC,WAAW,CAAC,KAAK,GAAG,oBAAE,CAAC,SAAS,CAAC,GAAG,EACpC,CAAC;gBACD,SAAQ;YACV,CAAC;YAED,IACE,CAAC,oBAAoB,CAAC,qBAAqB,CACzC,OAAO,EACP,WAAW,EACX,YAAY,EACZ,KAAK,GAAG,CAAC,CACV,EACD,CAAC;gBACD,OAAO,KAAK,CAAA;YACd,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,sBAAsB,CAAC,IAAY;QAChD,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACpB,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAC7B,CAAA;IACH,CAAC;CACF;AA7hBD,oDA6hBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks which external types are referenced in the emitted interfaces,
|
|
3
|
+
* so we can generate the correct import statements for the output file.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ImportTracker {
|
|
6
|
+
needsFindParams: boolean;
|
|
7
|
+
needsSelectParams: boolean;
|
|
8
|
+
needsBaseFilterable: boolean;
|
|
9
|
+
needsOperatorMap: boolean;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=import-tracker.d.ts.map
|