@stripe/extensibility-custom-objects-tools 0.40.0 → 0.41.1
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/build/cli.cjs +2 -2
- package/dist/build/cli.js +2 -2
- package/dist/build/extract-schemas.cli.cjs +382 -2
- package/dist/build/extract-schemas.cli.js +382 -2
- package/dist/build/package-build.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/internal.cjs +374 -2
- package/dist/internal.js +374 -2
- package/dist/transformer/visitors.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/generators/custom-object/files/___packagesSubfolder___/src/___apiName___.object.ts.mustache +4 -3
- package/package.json +4 -4
|
@@ -7667,7 +7667,7 @@ function injectRuntimeImports(sourceFile, hasDescriptors = false) {
|
|
|
7667
7667
|
}
|
|
7668
7668
|
if (hasDescriptors) {
|
|
7669
7669
|
const existingRuntimeStdlibImport = sourceFile.getImportDeclarations().find(
|
|
7670
|
-
(decl) => decl.getModuleSpecifierValue() === "@stripe/extensibility-sdk
|
|
7670
|
+
(decl) => decl.getModuleSpecifierValue() === "@stripe/extensibility-sdk" && !decl.isTypeOnly()
|
|
7671
7671
|
);
|
|
7672
7672
|
if (existingRuntimeStdlibImport) {
|
|
7673
7673
|
const namedImports = existingRuntimeStdlibImport.getNamedImports().map((ni) => ni.getName());
|
|
@@ -7678,7 +7678,7 @@ function injectRuntimeImports(sourceFile, hasDescriptors = false) {
|
|
|
7678
7678
|
}
|
|
7679
7679
|
} else {
|
|
7680
7680
|
sourceFile.insertImportDeclaration(0, {
|
|
7681
|
-
moduleSpecifier: "@stripe/extensibility-sdk
|
|
7681
|
+
moduleSpecifier: "@stripe/extensibility-sdk",
|
|
7682
7682
|
namedImports: [...STDLIB_IMPORTS]
|
|
7683
7683
|
});
|
|
7684
7684
|
}
|
|
@@ -8128,6 +8128,7 @@ function buildCustomObjectPackage(options, dependencies = {}) {
|
|
|
8128
8128
|
appendTransformPlan(transformPlans, target.modulePath, analysis.transformPlan);
|
|
8129
8129
|
}
|
|
8130
8130
|
if (analysis.buildResult) {
|
|
8131
|
+
diagnostics.push(...validateCustomObjectBuildResult(analysis.buildResult));
|
|
8131
8132
|
objects[toObjectKey(target)] = analysis.buildResult;
|
|
8132
8133
|
}
|
|
8133
8134
|
}
|
|
@@ -8168,6 +8169,377 @@ function buildCustomObjectPackage(options, dependencies = {}) {
|
|
|
8168
8169
|
function toObjectKey(target) {
|
|
8169
8170
|
return `${target.modulePath}#${target.exportName}`;
|
|
8170
8171
|
}
|
|
8172
|
+
function validateCustomObjectBuildResult(buildResult) {
|
|
8173
|
+
const diagnostics = [];
|
|
8174
|
+
const fieldsSchema = resolveTopLevelSchema(buildResult.fields.jsonSchema);
|
|
8175
|
+
validateTopLevelObjectShape(fieldsSchema, buildResult, "fields_payload", diagnostics);
|
|
8176
|
+
validatePropertyMap(fieldsSchema, buildResult, diagnostics, "field");
|
|
8177
|
+
for (const [actionApiName, action] of Object.entries(buildResult.actions)) {
|
|
8178
|
+
if (action.input?.jsonSchema) {
|
|
8179
|
+
const inputSchema = resolveTopLevelSchema(action.input.jsonSchema);
|
|
8180
|
+
validateTopLevelObjectShape(
|
|
8181
|
+
inputSchema,
|
|
8182
|
+
buildResult,
|
|
8183
|
+
"action_input_payload",
|
|
8184
|
+
diagnostics,
|
|
8185
|
+
actionApiName
|
|
8186
|
+
);
|
|
8187
|
+
validatePropertyMap(
|
|
8188
|
+
inputSchema,
|
|
8189
|
+
buildResult,
|
|
8190
|
+
diagnostics,
|
|
8191
|
+
"action_input_field",
|
|
8192
|
+
actionApiName
|
|
8193
|
+
);
|
|
8194
|
+
}
|
|
8195
|
+
const outputSchema = resolveTopLevelSchema(action.output.jsonSchema);
|
|
8196
|
+
validateTopLevelObjectShape(
|
|
8197
|
+
outputSchema,
|
|
8198
|
+
buildResult,
|
|
8199
|
+
"action_output_payload",
|
|
8200
|
+
diagnostics,
|
|
8201
|
+
actionApiName
|
|
8202
|
+
);
|
|
8203
|
+
validatePropertyMap(
|
|
8204
|
+
outputSchema,
|
|
8205
|
+
buildResult,
|
|
8206
|
+
diagnostics,
|
|
8207
|
+
"action_output_field",
|
|
8208
|
+
actionApiName
|
|
8209
|
+
);
|
|
8210
|
+
}
|
|
8211
|
+
return diagnostics;
|
|
8212
|
+
}
|
|
8213
|
+
function validatePropertyMap(schema, buildResult, diagnostics, kind, actionApiName) {
|
|
8214
|
+
if (!schema?.properties) {
|
|
8215
|
+
return;
|
|
8216
|
+
}
|
|
8217
|
+
const defs = schema.$defs ?? {};
|
|
8218
|
+
for (const [propertyName, propSchema] of Object.entries(schema.properties)) {
|
|
8219
|
+
const resolved = resolveSchemaRef(propSchema, defs);
|
|
8220
|
+
validatePropertySchema(
|
|
8221
|
+
resolved,
|
|
8222
|
+
buildResult,
|
|
8223
|
+
diagnostics,
|
|
8224
|
+
buildPropertyScope(kind, propertyName, actionApiName)
|
|
8225
|
+
);
|
|
8226
|
+
}
|
|
8227
|
+
}
|
|
8228
|
+
function buildPropertyScope(kind, propertyName, actionApiName) {
|
|
8229
|
+
switch (kind) {
|
|
8230
|
+
case "field":
|
|
8231
|
+
return { kind, propertyName };
|
|
8232
|
+
case "action_input_field":
|
|
8233
|
+
case "action_output_field":
|
|
8234
|
+
return {
|
|
8235
|
+
kind,
|
|
8236
|
+
actionApiName: actionApiName ?? "(unknown action)",
|
|
8237
|
+
propertyName
|
|
8238
|
+
};
|
|
8239
|
+
}
|
|
8240
|
+
}
|
|
8241
|
+
function validateTopLevelObjectShape(schema, buildResult, kind, diagnostics, actionApiName) {
|
|
8242
|
+
const hasProperties = schema.properties !== void 0 && Object.keys(schema.properties).length > 0;
|
|
8243
|
+
const looksObjectLike = schema.type === "object" || hasProperties;
|
|
8244
|
+
if (schema.additionalProperties !== void 0 && schema.additionalProperties !== false) {
|
|
8245
|
+
diagnostics.push(
|
|
8246
|
+
createUnsupportedSchemaDiagnostic(
|
|
8247
|
+
kind,
|
|
8248
|
+
buildResult,
|
|
8249
|
+
buildPayloadScope(kind, actionApiName),
|
|
8250
|
+
schema,
|
|
8251
|
+
getTopLevelMapShapeDetail(kind)
|
|
8252
|
+
)
|
|
8253
|
+
);
|
|
8254
|
+
return;
|
|
8255
|
+
}
|
|
8256
|
+
if (looksObjectLike) {
|
|
8257
|
+
return;
|
|
8258
|
+
}
|
|
8259
|
+
diagnostics.push(
|
|
8260
|
+
createUnsupportedSchemaDiagnostic(
|
|
8261
|
+
kind,
|
|
8262
|
+
buildResult,
|
|
8263
|
+
buildPayloadScope(kind, actionApiName),
|
|
8264
|
+
schema,
|
|
8265
|
+
getTopLevelObjectShapeDetail(kind)
|
|
8266
|
+
)
|
|
8267
|
+
);
|
|
8268
|
+
}
|
|
8269
|
+
function buildPayloadScope(kind, actionApiName) {
|
|
8270
|
+
switch (kind) {
|
|
8271
|
+
case "fields_payload":
|
|
8272
|
+
return { kind };
|
|
8273
|
+
case "action_input_payload":
|
|
8274
|
+
case "action_output_payload":
|
|
8275
|
+
return { kind, actionApiName: actionApiName ?? "(unknown action)" };
|
|
8276
|
+
}
|
|
8277
|
+
}
|
|
8278
|
+
function getTopLevelObjectShapeDetail(kind) {
|
|
8279
|
+
switch (kind) {
|
|
8280
|
+
case "fields_payload":
|
|
8281
|
+
return "Custom object fields must be object-shaped.";
|
|
8282
|
+
case "action_input_payload":
|
|
8283
|
+
case "action_output_payload":
|
|
8284
|
+
return "Action inputs and outputs must be object-shaped for custom objects.";
|
|
8285
|
+
}
|
|
8286
|
+
}
|
|
8287
|
+
function getTopLevelMapShapeDetail(kind) {
|
|
8288
|
+
switch (kind) {
|
|
8289
|
+
case "fields_payload":
|
|
8290
|
+
return "Custom object fields must declare named fields. Record<string, T> and other map-shaped field payloads are not supported for custom objects.";
|
|
8291
|
+
case "action_input_payload":
|
|
8292
|
+
case "action_output_payload":
|
|
8293
|
+
return "Action inputs and outputs must declare named fields. Record<string, T> and other map-shaped payloads are not supported for custom objects.";
|
|
8294
|
+
}
|
|
8295
|
+
}
|
|
8296
|
+
function validatePropertySchema(schema, buildResult, diagnostics, scope) {
|
|
8297
|
+
if (hasNonStringEnumValues(schema)) {
|
|
8298
|
+
diagnostics.push(
|
|
8299
|
+
createUnsupportedSchemaDiagnostic(
|
|
8300
|
+
scope.kind,
|
|
8301
|
+
buildResult,
|
|
8302
|
+
scope,
|
|
8303
|
+
schema,
|
|
8304
|
+
"Only string enums are supported for custom objects."
|
|
8305
|
+
)
|
|
8306
|
+
);
|
|
8307
|
+
return;
|
|
8308
|
+
}
|
|
8309
|
+
if (schema.format === "decimal") {
|
|
8310
|
+
diagnostics.push(
|
|
8311
|
+
createUnsupportedSchemaDiagnostic(
|
|
8312
|
+
scope.kind,
|
|
8313
|
+
buildResult,
|
|
8314
|
+
scope,
|
|
8315
|
+
schema,
|
|
8316
|
+
"Decimal fields are not supported for custom objects."
|
|
8317
|
+
)
|
|
8318
|
+
);
|
|
8319
|
+
return;
|
|
8320
|
+
}
|
|
8321
|
+
if (schema.type === "number") {
|
|
8322
|
+
diagnostics.push(
|
|
8323
|
+
createUnsupportedSchemaDiagnostic(
|
|
8324
|
+
scope.kind,
|
|
8325
|
+
buildResult,
|
|
8326
|
+
scope,
|
|
8327
|
+
schema,
|
|
8328
|
+
"Number fields are not supported for custom objects. Use Integer for whole numbers."
|
|
8329
|
+
)
|
|
8330
|
+
);
|
|
8331
|
+
return;
|
|
8332
|
+
}
|
|
8333
|
+
if (schema.type === "array") {
|
|
8334
|
+
diagnostics.push(
|
|
8335
|
+
createUnsupportedSchemaDiagnostic(
|
|
8336
|
+
scope.kind,
|
|
8337
|
+
buildResult,
|
|
8338
|
+
scope,
|
|
8339
|
+
schema,
|
|
8340
|
+
"Array fields are not supported for custom objects."
|
|
8341
|
+
)
|
|
8342
|
+
);
|
|
8343
|
+
return;
|
|
8344
|
+
}
|
|
8345
|
+
const refTarget = schema.type === "object" ? getRefTargetType(schema) : null;
|
|
8346
|
+
if (schema.type === "object" && refTarget === null) {
|
|
8347
|
+
diagnostics.push(
|
|
8348
|
+
createUnsupportedSchemaDiagnostic(
|
|
8349
|
+
scope.kind,
|
|
8350
|
+
buildResult,
|
|
8351
|
+
scope,
|
|
8352
|
+
schema,
|
|
8353
|
+
"Nested object fields are not supported for custom objects. Use Ref<T> for object references."
|
|
8354
|
+
)
|
|
8355
|
+
);
|
|
8356
|
+
return;
|
|
8357
|
+
}
|
|
8358
|
+
validateNumericBoundary(schema, buildResult, diagnostics, scope);
|
|
8359
|
+
validateDefaultValue(schema, buildResult, diagnostics, scope);
|
|
8360
|
+
if (!isSupportedCustomObjectSchema(schema, refTarget)) {
|
|
8361
|
+
diagnostics.push(
|
|
8362
|
+
createUnsupportedSchemaDiagnostic(
|
|
8363
|
+
scope.kind,
|
|
8364
|
+
buildResult,
|
|
8365
|
+
scope,
|
|
8366
|
+
schema,
|
|
8367
|
+
"This schema shape is not supported for custom objects."
|
|
8368
|
+
)
|
|
8369
|
+
);
|
|
8370
|
+
}
|
|
8371
|
+
}
|
|
8372
|
+
function validateNumericBoundary(schema, buildResult, diagnostics, scope) {
|
|
8373
|
+
const boundaries = [
|
|
8374
|
+
["minimum", schema.minimum],
|
|
8375
|
+
["exclusiveMinimum", schema.exclusiveMinimum],
|
|
8376
|
+
["maximum", schema.maximum],
|
|
8377
|
+
["exclusiveMaximum", schema.exclusiveMaximum]
|
|
8378
|
+
];
|
|
8379
|
+
for (const [name, value] of boundaries) {
|
|
8380
|
+
if (value === void 0 || Number.isInteger(value)) {
|
|
8381
|
+
continue;
|
|
8382
|
+
}
|
|
8383
|
+
diagnostics.push(
|
|
8384
|
+
createUnsupportedSchemaDiagnostic(
|
|
8385
|
+
scope.kind,
|
|
8386
|
+
buildResult,
|
|
8387
|
+
scope,
|
|
8388
|
+
schema,
|
|
8389
|
+
`${name}=${String(value)} is not representable for custom objects; only integer numeric boundaries are supported.`
|
|
8390
|
+
)
|
|
8391
|
+
);
|
|
8392
|
+
}
|
|
8393
|
+
}
|
|
8394
|
+
function validateDefaultValue(schema, buildResult, diagnostics, scope) {
|
|
8395
|
+
if (schema.type === "integer" && schema.default !== void 0 && (typeof schema.default !== "number" || !Number.isInteger(schema.default))) {
|
|
8396
|
+
diagnostics.push(
|
|
8397
|
+
createUnsupportedSchemaDiagnostic(
|
|
8398
|
+
scope.kind,
|
|
8399
|
+
buildResult,
|
|
8400
|
+
scope,
|
|
8401
|
+
schema,
|
|
8402
|
+
`default=${JSON.stringify(schema.default)} is not representable for custom objects; integer fields require integer default values.`
|
|
8403
|
+
)
|
|
8404
|
+
);
|
|
8405
|
+
}
|
|
8406
|
+
}
|
|
8407
|
+
function isSupportedCustomObjectSchema(schema, refTarget) {
|
|
8408
|
+
if (extractEnumValues(schema) !== null) {
|
|
8409
|
+
return true;
|
|
8410
|
+
}
|
|
8411
|
+
if (refTarget !== null) {
|
|
8412
|
+
return true;
|
|
8413
|
+
}
|
|
8414
|
+
switch (schema.type) {
|
|
8415
|
+
case "string":
|
|
8416
|
+
case "integer":
|
|
8417
|
+
case "boolean":
|
|
8418
|
+
return true;
|
|
8419
|
+
default:
|
|
8420
|
+
return false;
|
|
8421
|
+
}
|
|
8422
|
+
}
|
|
8423
|
+
function createUnsupportedSchemaDiagnostic(kind, buildResult, scope, schema, detail) {
|
|
8424
|
+
const { modulePath, className } = buildResult.platformMetadata;
|
|
8425
|
+
return {
|
|
8426
|
+
severity: "error",
|
|
8427
|
+
code: getUnsupportedSchemaDiagnosticCode(kind),
|
|
8428
|
+
message: `${describeValidationScope(scope)} on "${className}" in "${modulePath}" is not supported for custom objects (${describeSchema(schema)}). ${detail}`,
|
|
8429
|
+
modulePath,
|
|
8430
|
+
exportName: className
|
|
8431
|
+
};
|
|
8432
|
+
}
|
|
8433
|
+
function getUnsupportedSchemaDiagnosticCode(kind) {
|
|
8434
|
+
switch (kind) {
|
|
8435
|
+
case "fields_payload":
|
|
8436
|
+
case "field":
|
|
8437
|
+
return "UNSUPPORTED_FIELD_SCHEMA";
|
|
8438
|
+
case "action_input_field":
|
|
8439
|
+
case "action_input_payload":
|
|
8440
|
+
return "UNSUPPORTED_ACTION_INPUT_SCHEMA";
|
|
8441
|
+
case "action_output_field":
|
|
8442
|
+
case "action_output_payload":
|
|
8443
|
+
return "UNSUPPORTED_ACTION_OUTPUT_SCHEMA";
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
function describeValidationScope(scope) {
|
|
8447
|
+
switch (scope.kind) {
|
|
8448
|
+
case "fields_payload":
|
|
8449
|
+
return "Custom object fields schema";
|
|
8450
|
+
case "field":
|
|
8451
|
+
return `Field "${scope.propertyName}"`;
|
|
8452
|
+
case "action_input_field":
|
|
8453
|
+
return `Action "${scope.actionApiName}" input field "${scope.propertyName}"`;
|
|
8454
|
+
case "action_output_field":
|
|
8455
|
+
return `Action "${scope.actionApiName}" output field "${scope.propertyName}"`;
|
|
8456
|
+
case "action_input_payload":
|
|
8457
|
+
return `Action "${scope.actionApiName}" input payload`;
|
|
8458
|
+
case "action_output_payload":
|
|
8459
|
+
return `Action "${scope.actionApiName}" output payload`;
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
function describeSchema(schema) {
|
|
8463
|
+
if (Array.isArray(schema.type)) {
|
|
8464
|
+
return `type: [${schema.type.join(", ")}]`;
|
|
8465
|
+
}
|
|
8466
|
+
if (schema.type === "string" && typeof schema.format === "string") {
|
|
8467
|
+
return `type: string, format: ${schema.format}`;
|
|
8468
|
+
}
|
|
8469
|
+
if (schema.type === "object") {
|
|
8470
|
+
return "type: object";
|
|
8471
|
+
}
|
|
8472
|
+
if (schema.type !== void 0) {
|
|
8473
|
+
return `type: ${schema.type}`;
|
|
8474
|
+
}
|
|
8475
|
+
if (Array.isArray(schema.anyOf) && schema.anyOf.length > 0) {
|
|
8476
|
+
return "anyOf union";
|
|
8477
|
+
}
|
|
8478
|
+
if (Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {
|
|
8479
|
+
return "oneOf union";
|
|
8480
|
+
}
|
|
8481
|
+
return "untyped schema";
|
|
8482
|
+
}
|
|
8483
|
+
function resolveSchemaRef(schema, defs) {
|
|
8484
|
+
const ref = schema.$ref;
|
|
8485
|
+
if (!ref) return schema;
|
|
8486
|
+
if (!ref.startsWith("#/$defs/")) return schema;
|
|
8487
|
+
const defName = ref.slice("#/$defs/".length);
|
|
8488
|
+
const defSchema = defs[defName];
|
|
8489
|
+
if (!defSchema) return schema;
|
|
8490
|
+
const { $ref: _, ...rest } = schema;
|
|
8491
|
+
return { ...defSchema, ...rest };
|
|
8492
|
+
}
|
|
8493
|
+
function resolveTopLevelSchema(schema) {
|
|
8494
|
+
return resolveSchemaRef(schema, schema.$defs ?? {});
|
|
8495
|
+
}
|
|
8496
|
+
function getRefTargetType(schema) {
|
|
8497
|
+
if (!schema.properties) return null;
|
|
8498
|
+
const properties = schema.properties;
|
|
8499
|
+
const realProps = Object.keys(properties).filter((key) => !key.startsWith("__"));
|
|
8500
|
+
const allowedProps = /* @__PURE__ */ new Set(["id", "type", "url"]);
|
|
8501
|
+
if (realProps.length === 0 || realProps.some((key) => !allowedProps.has(key))) {
|
|
8502
|
+
return null;
|
|
8503
|
+
}
|
|
8504
|
+
const idProp = properties.id;
|
|
8505
|
+
const typeProp = properties.type;
|
|
8506
|
+
if (!idProp || !typeProp) return null;
|
|
8507
|
+
if (idProp.type !== "string") return null;
|
|
8508
|
+
const requiredSet = new Set(schema.required ?? []);
|
|
8509
|
+
if (!requiredSet.has("id") || !requiredSet.has("type")) return null;
|
|
8510
|
+
return extractSingleLiteral(typeProp);
|
|
8511
|
+
}
|
|
8512
|
+
function extractSingleLiteral(schema) {
|
|
8513
|
+
if (Array.isArray(schema.enum) && schema.enum.length === 1 && typeof schema.enum[0] === "string") {
|
|
8514
|
+
return schema.enum[0];
|
|
8515
|
+
}
|
|
8516
|
+
if (Array.isArray(schema.oneOf) && schema.oneOf.length === 1 && schema.oneOf.every(
|
|
8517
|
+
(item) => "const" in item && typeof item.const === "string"
|
|
8518
|
+
)) {
|
|
8519
|
+
const values = schema.oneOf.map(
|
|
8520
|
+
(item) => String(item.const)
|
|
8521
|
+
);
|
|
8522
|
+
return values[0] ?? null;
|
|
8523
|
+
}
|
|
8524
|
+
return null;
|
|
8525
|
+
}
|
|
8526
|
+
function extractEnumValues(schema) {
|
|
8527
|
+
if (Array.isArray(schema.enum) && schema.enum.every((value) => typeof value === "string")) {
|
|
8528
|
+
return schema.enum.map(String);
|
|
8529
|
+
}
|
|
8530
|
+
if (Array.isArray(schema.oneOf) && schema.oneOf.length > 0 && schema.oneOf.every(
|
|
8531
|
+
(item) => "const" in item && typeof item.const === "string"
|
|
8532
|
+
)) {
|
|
8533
|
+
return schema.oneOf.map((item) => String(item.const));
|
|
8534
|
+
}
|
|
8535
|
+
return null;
|
|
8536
|
+
}
|
|
8537
|
+
function hasNonStringEnumValues(schema) {
|
|
8538
|
+
if (Array.isArray(schema.enum) && schema.enum.length > 0) {
|
|
8539
|
+
return schema.enum.some((value) => typeof value !== "string");
|
|
8540
|
+
}
|
|
8541
|
+
return Array.isArray(schema.oneOf) && schema.oneOf.length > 0 && schema.oneOf.every((item) => "const" in item) && schema.oneOf.some((item) => typeof item.const !== "string");
|
|
8542
|
+
}
|
|
8171
8543
|
var PRIMARY_FIELD_TAG_RE = /@primaryField\s*(?:$|\*)/m;
|
|
8172
8544
|
var SECONDARY_FIELD_TAG_RE = /@secondaryField\s*(?:$|\*)/m;
|
|
8173
8545
|
var API_NAME_TAG_RE = /@apiName\s+(\S+)/;
|
|
@@ -8720,6 +9092,14 @@ async function main() {
|
|
|
8720
9092
|
);
|
|
8721
9093
|
}
|
|
8722
9094
|
const result = buildCustomObjectPackage({ targets: parsed });
|
|
9095
|
+
const errorDiagnostics = result.diagnostics.filter(
|
|
9096
|
+
(diagnostic) => diagnostic.severity === "error"
|
|
9097
|
+
);
|
|
9098
|
+
if (errorDiagnostics.length > 0) {
|
|
9099
|
+
throw new Error(
|
|
9100
|
+
errorDiagnostics.map((diagnostic) => diagnostic.message).join("\n")
|
|
9101
|
+
);
|
|
9102
|
+
}
|
|
8723
9103
|
const output = {
|
|
8724
9104
|
schemas: result.objects,
|
|
8725
9105
|
diagnostics: result.diagnostics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-build.d.ts","sourceRoot":"","sources":["../../src/build/package-build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAOL,KAAK,cAAc,EAEnB,KAAK,QAAQ,EACd,MAAM,iBAAiB,CAAC;AAmBzB;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,2BAA2B,GAAG,IAAI,CA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BAAuB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,uBAAuB,EAAE,CAAC;CACpC;AAsDD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,+BAA+B,EACxC,YAAY,GAAE;IACZ,aAAa,CAAC,EAAE,CACd,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,EAAE,EAAE,CAAC,eAAe,KACxB,EAAE,CAAC,OAAO,CAAC;CACZ,GACL,8BAA8B,CAqGhC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAEnE"}
|
package/dist/index.cjs
CHANGED
|
@@ -401,7 +401,7 @@ function injectRuntimeImports(sourceFile, hasDescriptors = false) {
|
|
|
401
401
|
}
|
|
402
402
|
if (hasDescriptors) {
|
|
403
403
|
const existingRuntimeStdlibImport = sourceFile.getImportDeclarations().find(
|
|
404
|
-
(decl) => decl.getModuleSpecifierValue() === "@stripe/extensibility-sdk
|
|
404
|
+
(decl) => decl.getModuleSpecifierValue() === "@stripe/extensibility-sdk" && !decl.isTypeOnly()
|
|
405
405
|
);
|
|
406
406
|
if (existingRuntimeStdlibImport) {
|
|
407
407
|
const namedImports = existingRuntimeStdlibImport.getNamedImports().map((ni) => ni.getName());
|
|
@@ -412,7 +412,7 @@ function injectRuntimeImports(sourceFile, hasDescriptors = false) {
|
|
|
412
412
|
}
|
|
413
413
|
} else {
|
|
414
414
|
sourceFile.insertImportDeclaration(0, {
|
|
415
|
-
moduleSpecifier: "@stripe/extensibility-sdk
|
|
415
|
+
moduleSpecifier: "@stripe/extensibility-sdk",
|
|
416
416
|
namedImports: [...STDLIB_IMPORTS]
|
|
417
417
|
});
|
|
418
418
|
}
|
package/dist/index.js
CHANGED
|
@@ -373,7 +373,7 @@ function injectRuntimeImports(sourceFile, hasDescriptors = false) {
|
|
|
373
373
|
}
|
|
374
374
|
if (hasDescriptors) {
|
|
375
375
|
const existingRuntimeStdlibImport = sourceFile.getImportDeclarations().find(
|
|
376
|
-
(decl) => decl.getModuleSpecifierValue() === "@stripe/extensibility-sdk
|
|
376
|
+
(decl) => decl.getModuleSpecifierValue() === "@stripe/extensibility-sdk" && !decl.isTypeOnly()
|
|
377
377
|
);
|
|
378
378
|
if (existingRuntimeStdlibImport) {
|
|
379
379
|
const namedImports = existingRuntimeStdlibImport.getNamedImports().map((ni) => ni.getName());
|
|
@@ -384,7 +384,7 @@ function injectRuntimeImports(sourceFile, hasDescriptors = false) {
|
|
|
384
384
|
}
|
|
385
385
|
} else {
|
|
386
386
|
sourceFile.insertImportDeclaration(0, {
|
|
387
|
-
moduleSpecifier: "@stripe/extensibility-sdk
|
|
387
|
+
moduleSpecifier: "@stripe/extensibility-sdk",
|
|
388
388
|
namedImports: [...STDLIB_IMPORTS]
|
|
389
389
|
});
|
|
390
390
|
}
|