@stripe/extensibility-jsonschema-tools 1.0.1 → 1.0.3-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensibility-jsonschema-tools-alpha.d.ts +25 -909
- package/dist/extensibility-jsonschema-tools-beta.d.ts +25 -909
- package/dist/extensibility-jsonschema-tools-internal.d.ts +25 -907
- package/dist/extensibility-jsonschema-tools-public.d.ts +25 -909
- package/dist/extract-config-schemas.d.ts +4 -2
- package/dist/extract-config-schemas.d.ts.map +1 -1
- package/dist/fixup-decimal-path-constraints.d.ts +1 -1
- package/dist/fixup-decimal-path-constraints.d.ts.map +1 -1
- package/dist/generate-schemas.d.ts +2 -2
- package/dist/generate-schemas.d.ts.map +1 -1
- package/dist/index.cjs +24 -12
- package/dist/index.d.cts +52 -942
- package/dist/index.d.ts +52 -942
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -12
- package/dist/stdlib-extension.d.ts +2 -2
- package/dist/stdlib-extension.d.ts.map +1 -1
- package/dist/stripe-formspec-config.d.ts +1 -1
- package/dist/stripe-formspec-config.d.ts.map +1 -1
- package/dist/stripe-schema-defaults.d.ts +1 -1
- package/dist/stripe-schema-defaults.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* walks its `implements` clause to find generic type arguments, and
|
|
6
6
|
* extracts JSON Schema + UI Schema from each config type.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
import type { JsonSchema2020, UISchema } from '@stripe/formspec-build';
|
|
9
10
|
/**
|
|
10
11
|
* Options for extracting config schemas from a class export.
|
|
11
12
|
*
|
|
@@ -84,13 +85,14 @@ export interface _ConfigTypeRef {
|
|
|
84
85
|
* ```
|
|
85
86
|
*
|
|
86
87
|
* @param options - File path and export name
|
|
88
|
+
* @param program - Optional program configured with the caller's declaration libraries
|
|
87
89
|
* @returns Array of resolved config type references
|
|
88
90
|
* @throws If the export name is not found (lists available exports).
|
|
89
91
|
* @throws If the export exists but is not a class declaration.
|
|
90
92
|
*
|
|
91
93
|
* @internal
|
|
92
94
|
*/
|
|
93
|
-
export declare function _resolveConfigTypeArgs(options: _ExtractConfigSchemasOptions): _ConfigTypeRef[];
|
|
95
|
+
export declare function _resolveConfigTypeArgs(options: _ExtractConfigSchemasOptions, program?: ts.Program): _ConfigTypeRef[];
|
|
94
96
|
/**
|
|
95
97
|
* Extracts config schemas from the generic type arguments in a class's
|
|
96
98
|
* `implements` clause.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-config-schemas.d.ts","sourceRoot":"","sources":["../src/extract-config-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"extract-config-schemas.d.ts","sourceRoot":"","sources":["../src/extract-config-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAQjC,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOvE;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;AAEvC;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,UAAU,EAAE,cAAc,CAAC;IAC3B,8BAA8B;IAC9B,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qEAAqE;IACrE,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC;AAkBD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;CACxB;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,4BAA4B,EACrC,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,GACnB,cAAc,EAAE,CAuDlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CAc7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsonSchema2020 } from '@formspec
|
|
1
|
+
import type { JsonSchema2020 } from '@stripe/formspec-build';
|
|
2
2
|
/**
|
|
3
3
|
* Post-processes a generated JSON Schema to fix path-targeted constraints on
|
|
4
4
|
* Decimal sub-properties. Mutates the schema in place for efficiency.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixup-decimal-path-constraints.d.ts","sourceRoot":"","sources":["../src/fixup-decimal-path-constraints.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fixup-decimal-path-constraints.d.ts","sourceRoot":"","sources":["../src/fixup-decimal-path-constraints.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAc7D;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAgBnF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GenerateSchemasOptions } from '@formspec
|
|
1
|
+
import { type GenerateSchemasOptions } from '@stripe/formspec-build';
|
|
2
2
|
/**
|
|
3
3
|
* Generates JSON Schema and UI Schema using Stripe's canonical config.
|
|
4
4
|
*
|
|
@@ -8,5 +8,5 @@ import { type GenerateSchemasOptions } from '@formspec/build';
|
|
|
8
8
|
*
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export declare function _generateSchemas(options: Omit<GenerateSchemasOptions, 'errorReporting'>): import("@formspec
|
|
11
|
+
export declare function _generateSchemas(options: Omit<GenerateSchemasOptions, 'errorReporting'>): import("@stripe/formspec-build").GenerateFromClassResult;
|
|
12
12
|
//# sourceMappingURL=generate-schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-schemas.d.ts","sourceRoot":"","sources":["../src/generate-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"generate-schemas.d.ts","sourceRoot":"","sources":["../src/generate-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAIhC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,IAAI,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,4DAoBxD"}
|
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
});
|
|
47
47
|
module.exports = __toCommonJS(index_exports);
|
|
48
48
|
|
|
49
|
-
// ../../node_modules/.pnpm/@formspec
|
|
49
|
+
// ../../node_modules/.pnpm/@stripe+formspec-core@0.1.0-alpha.73/node_modules/@stripe/formspec-core/dist/index.js
|
|
50
50
|
function defineExtension(def) {
|
|
51
51
|
return def;
|
|
52
52
|
}
|
|
@@ -98,7 +98,7 @@ function matchesGlob(glob, namespace) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
// ../../node_modules/.pnpm/@formspec
|
|
101
|
+
// ../../node_modules/.pnpm/@stripe+formspec-core@0.1.0-alpha.73/node_modules/@stripe/formspec-core/dist/internals.js
|
|
102
102
|
var _BUILTIN_CONSTRAINT_DEFINITIONS = {
|
|
103
103
|
minimum: "number",
|
|
104
104
|
maximum: "number",
|
|
@@ -4170,7 +4170,7 @@ var coerce = {
|
|
|
4170
4170
|
};
|
|
4171
4171
|
var NEVER = INVALID;
|
|
4172
4172
|
|
|
4173
|
-
// ../../node_modules/.pnpm/@formspec
|
|
4173
|
+
// ../../node_modules/.pnpm/@stripe+formspec-analysis@0.1.0-alpha.73_typescript@5.9.3/node_modules/@stripe/formspec-analysis/dist/internal.js
|
|
4174
4174
|
var ts3 = __toESM(require("typescript"), 1);
|
|
4175
4175
|
var ts = __toESM(require("typescript"), 1);
|
|
4176
4176
|
var ts2 = __toESM(require("typescript"), 1);
|
|
@@ -10058,7 +10058,7 @@ var TSDocParser = class {
|
|
|
10058
10058
|
}
|
|
10059
10059
|
};
|
|
10060
10060
|
|
|
10061
|
-
// ../../node_modules/.pnpm/@formspec
|
|
10061
|
+
// ../../node_modules/.pnpm/@stripe+formspec-analysis@0.1.0-alpha.73_typescript@5.9.3/node_modules/@stripe/formspec-analysis/dist/internal.js
|
|
10062
10062
|
var import_meta = {};
|
|
10063
10063
|
function expectedCloseFor(open) {
|
|
10064
10064
|
if (open === "[") return "]";
|
|
@@ -14182,7 +14182,7 @@ function extractSummaryText(docComment, commentText, parsed) {
|
|
|
14182
14182
|
return hasTagOnlySummary ? "" : summary;
|
|
14183
14183
|
}
|
|
14184
14184
|
|
|
14185
|
-
// ../../node_modules/.pnpm/@formspec
|
|
14185
|
+
// ../../node_modules/.pnpm/@stripe+formspec-build@0.1.0-alpha.73_typescript@5.9.3/node_modules/@stripe/formspec-build/dist/index.js
|
|
14186
14186
|
var ts82 = __toESM(require("typescript"), 1);
|
|
14187
14187
|
var ts62 = __toESM(require("typescript"), 1);
|
|
14188
14188
|
var path = __toESM(require("path"), 1);
|
|
@@ -19770,8 +19770,8 @@ function isDefineCustomTypeCall(node, checker) {
|
|
|
19770
19770
|
const decl = resolved.declarations?.[0];
|
|
19771
19771
|
if (decl !== void 0) {
|
|
19772
19772
|
const sourceFile = decl.getSourceFile().fileName.replace(/\\/g, "/");
|
|
19773
|
-
return resolved.name === "defineCustomType" && // Match whether in node_modules/@formspec
|
|
19774
|
-
(sourceFile.includes("@formspec
|
|
19773
|
+
return resolved.name === "defineCustomType" && // Match whether in node_modules/@stripe/formspec-core or monorepo packages/core.
|
|
19774
|
+
(sourceFile.includes("@stripe/formspec-core") || sourceFile.includes("/packages/core/"));
|
|
19775
19775
|
}
|
|
19776
19776
|
}
|
|
19777
19777
|
return ts72.isIdentifier(node.expression) && node.expression.text === "defineCustomType";
|
|
@@ -19804,7 +19804,7 @@ function isDefineExtensionCall(node, checker) {
|
|
|
19804
19804
|
const decl = resolved.declarations?.[0];
|
|
19805
19805
|
if (decl !== void 0) {
|
|
19806
19806
|
const sourceFile = decl.getSourceFile().fileName.replace(/\\/g, "/");
|
|
19807
|
-
return resolved.name === "defineExtension" && (sourceFile.includes("@formspec
|
|
19807
|
+
return resolved.name === "defineExtension" && (sourceFile.includes("@stripe/formspec-core") || sourceFile.includes("/packages/core/"));
|
|
19808
19808
|
}
|
|
19809
19809
|
}
|
|
19810
19810
|
return ts72.isIdentifier(node.expression) && node.expression.text === "defineExtension";
|
|
@@ -20290,7 +20290,7 @@ function _generateSchemas(options) {
|
|
|
20290
20290
|
return result;
|
|
20291
20291
|
}
|
|
20292
20292
|
|
|
20293
|
-
// ../../node_modules/.pnpm/@formspec
|
|
20293
|
+
// ../../node_modules/.pnpm/@stripe+formspec-build@0.1.0-alpha.73_typescript@5.9.3/node_modules/@stripe/formspec-build/dist/browser.js
|
|
20294
20294
|
function toKebabCase2(logicalName) {
|
|
20295
20295
|
return logicalName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").replace(/-+/g, "-").toLowerCase();
|
|
20296
20296
|
}
|
|
@@ -20528,7 +20528,7 @@ var jsonSchema7Schema2 = external_exports.lazy(
|
|
|
20528
20528
|
// src/extract-config-schemas.ts
|
|
20529
20529
|
var ts12 = __toESM(require("typescript"), 1);
|
|
20530
20530
|
|
|
20531
|
-
// ../../node_modules/.pnpm/@formspec
|
|
20531
|
+
// ../../node_modules/.pnpm/@stripe+formspec-build@0.1.0-alpha.73_typescript@5.9.3/node_modules/@stripe/formspec-build/dist/internals.js
|
|
20532
20532
|
var ts63 = __toESM(require("typescript"), 1);
|
|
20533
20533
|
var path3 = __toESM(require("path"), 1);
|
|
20534
20534
|
var ts53 = __toESM(require("typescript"), 1);
|
|
@@ -20539,6 +20539,18 @@ var ts11 = __toESM(require("typescript"), 1);
|
|
|
20539
20539
|
var ts83 = __toESM(require("typescript"), 1);
|
|
20540
20540
|
var ts73 = __toESM(require("typescript"), 1);
|
|
20541
20541
|
var TYPE_FORMAT_FLAGS2 = ts33.TypeFormatFlags.NoTruncation | ts33.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
|
|
20542
|
+
function createProgramContextFromProgram(program, filePath) {
|
|
20543
|
+
const absolutePath = path3.resolve(filePath);
|
|
20544
|
+
const sourceFile = program.getSourceFile(absolutePath) ?? program.getSourceFile(filePath);
|
|
20545
|
+
if (!sourceFile) {
|
|
20546
|
+
throw new Error(`Could not find source file in provided program: ${absolutePath}`);
|
|
20547
|
+
}
|
|
20548
|
+
return {
|
|
20549
|
+
program,
|
|
20550
|
+
checker: program.getTypeChecker(),
|
|
20551
|
+
sourceFile
|
|
20552
|
+
};
|
|
20553
|
+
}
|
|
20542
20554
|
function createProgramContext2(filePath, additionalFiles) {
|
|
20543
20555
|
const absolutePath = path3.resolve(filePath);
|
|
20544
20556
|
const fileDir = path3.dirname(absolutePath);
|
|
@@ -20757,9 +20769,9 @@ var uiSchema3 = external_exports.lazy(
|
|
|
20757
20769
|
);
|
|
20758
20770
|
|
|
20759
20771
|
// src/extract-config-schemas.ts
|
|
20760
|
-
function _resolveConfigTypeArgs(options) {
|
|
20772
|
+
function _resolveConfigTypeArgs(options, program) {
|
|
20761
20773
|
const { filePath, exportName } = options;
|
|
20762
|
-
const { sourceFile, checker } = createProgramContext2(filePath);
|
|
20774
|
+
const { sourceFile, checker } = program ? createProgramContextFromProgram(program, filePath) : createProgramContext2(filePath);
|
|
20763
20775
|
const exportResult = resolveExport(sourceFile, exportName, checker);
|
|
20764
20776
|
if (!exportResult.resolved) {
|
|
20765
20777
|
if (exportResult.reason === "no-module-symbol") {
|