@postman/sdk-config 0.8.0 → 0.9.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/index.cjs +76 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -7
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +76 -7
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.js +76 -7
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +76 -7
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +520 -114
- package/dist/sdk-config/v1/index.d.ts +520 -114
- package/dist/sdk-config/v1/index.js +76 -7
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +23 -2
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.js +23 -2
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +23 -2
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +52 -10
- package/dist/sdk-config-ir/v1/index.d.ts +52 -10
- package/dist/sdk-config-ir/v1/index.js +23 -2
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk-config-ir/v1/README.md +29 -15
package/dist/sdk-config/index.js
CHANGED
|
@@ -297,7 +297,7 @@ var retryConfigSchema = z.strictObject({
|
|
|
297
297
|
maxDelayMs: z.number().nonnegative().default(5e3).describe("The maximum backoff delay between attempts, in milliseconds."),
|
|
298
298
|
jitterMs: z.number().nonnegative().default(50).describe("The maximum random jitter added to retry delays, in milliseconds."),
|
|
299
299
|
backoffFactor: z.number().positive().default(2).describe("The multiplier applied to the delay after each failed attempt."),
|
|
300
|
-
methods: z.array(nonEmptyStringSchema).default(["GET", "
|
|
300
|
+
methods: z.array(nonEmptyStringSchema).default(["GET", "PUT", "DELETE", "HEAD", "OPTIONS"]).describe("HTTP methods that are eligible for retries."),
|
|
301
301
|
maxRetryAfterDelayMs: z.number().nonnegative().default(6e4).describe("The longest Retry-After delay the client will honor, in milliseconds.")
|
|
302
302
|
}).superRefine(validateRetryDelays);
|
|
303
303
|
var constructorParameterSchema = z.strictObject({
|
|
@@ -323,6 +323,22 @@ var tokenRefreshConfigSchema = z.strictObject({
|
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
|
+
var idempotencyKeyGenerationSchema = z.strictObject({
|
|
327
|
+
enabled: z.boolean().describe("Whether the client generates an idempotency key when the caller supplies none."),
|
|
328
|
+
headerName: nonEmptyStringSchema.optional().describe("The header that carries the generated key. Generators default to Idempotency-Key."),
|
|
329
|
+
methods: z.array(nonEmptyStringSchema).optional().describe("HTTP methods that receive a generated key. Generators default to POST and PUT.")
|
|
330
|
+
});
|
|
331
|
+
var userAgentConfigSchema = z.strictObject({
|
|
332
|
+
template: nonEmptyStringSchema.optional().describe(
|
|
333
|
+
"The User-Agent product token, resolved at generation time. Supports the {packageName}, {version}, {language}, {generatorVersion}, {organization}, and {apiName} placeholders."
|
|
334
|
+
),
|
|
335
|
+
includePlatformInfo: z.boolean().optional().describe(
|
|
336
|
+
"Whether the User-Agent carries operating system, architecture, and runtime details, as `{product} ({os}; {arch}) {runtime}/{runtimeVersion}`."
|
|
337
|
+
),
|
|
338
|
+
allowAppInfo: z.boolean().optional().describe(
|
|
339
|
+
"Whether callers can pass application info that is appended to the User-Agent as a `{name}/{version} ({comment})` product token."
|
|
340
|
+
)
|
|
341
|
+
});
|
|
326
342
|
var clientOverrideShape = {
|
|
327
343
|
retry: clientRetryOverrideSchema.optional().describe("Retry behavior for generated API requests."),
|
|
328
344
|
responseHeaders: z.boolean().optional().describe("Whether generated operations expose HTTP response headers."),
|
|
@@ -335,7 +351,12 @@ var clientOverrideShape = {
|
|
|
335
351
|
filePropertyStyle: parameterStyleSchema.optional().describe("Whether generated file properties are wrapped or passed inline."),
|
|
336
352
|
useDefaultRequestParameterValues: z.boolean().optional().describe("Whether schema defaults are applied to omitted request parameters."),
|
|
337
353
|
respectOptionalRequestBody: z.boolean().optional().describe("Whether an optional request body remains optional in generated methods."),
|
|
338
|
-
tokenRefresh: tokenRefreshConfigSchema.optional().describe("Refresh-token behavior for the generated client.")
|
|
354
|
+
tokenRefresh: tokenRefreshConfigSchema.optional().describe("Refresh-token behavior for the generated client."),
|
|
355
|
+
idempotencyKeyGeneration: idempotencyKeyGenerationSchema.optional().describe("Automatic idempotency keys on eligible requests."),
|
|
356
|
+
userAgent: userAgentConfigSchema.optional().describe("The User-Agent header the generated client sends."),
|
|
357
|
+
offsetSemantics: z.enum(["item-index", "page-index"]).optional().describe(
|
|
358
|
+
"How an offset-paginated endpoint advances: by the number of items returned, or by one page."
|
|
359
|
+
)
|
|
339
360
|
};
|
|
340
361
|
var clientConfigOverrideSchema = z.strictObject(clientOverrideShape);
|
|
341
362
|
var clientConfigSchema = z.strictObject({
|
|
@@ -2405,6 +2426,14 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
2405
2426
|
...prefix,
|
|
2406
2427
|
"config"
|
|
2407
2428
|
]);
|
|
2429
|
+
const apiWideIdempotency = idempotencyKeyGenerationFrom(
|
|
2430
|
+
generator.idempotencyKeyGenerationConfig,
|
|
2431
|
+
[...prefix, "idempotencyKeyGenerationConfig"],
|
|
2432
|
+
state
|
|
2433
|
+
);
|
|
2434
|
+
if (apiWideIdempotency && client.idempotencyKeyGeneration === void 0) {
|
|
2435
|
+
client.idempotencyKeyGeneration = apiWideIdempotency;
|
|
2436
|
+
}
|
|
2408
2437
|
const rawGenerator = isObject(generator.raw) ? generator.raw : void 0;
|
|
2409
2438
|
const smartCasing = typeof rawGenerator?.["smart-casing"] === "boolean" ? rawGenerator["smart-casing"] : generator.smartCasing === false ? false : void 0;
|
|
2410
2439
|
const smartCasingDigitWordBoundary = typeof rawGenerator?.["smart-casing-digit-word-boundary"] === "boolean" ? rawGenerator["smart-casing-digit-word-boundary"] : generator.smartCasingDigitWordBoundary === true ? true : void 0;
|
|
@@ -2438,16 +2467,19 @@ function mapInvocation(generator, language, activeLanguages, index) {
|
|
|
2438
2467
|
...collectUnsupported(config, [...prefix, "config"], state),
|
|
2439
2468
|
...settings ? collectUnsupported(settings, [...prefix, "settings"], state) : [],
|
|
2440
2469
|
...isObject(generator.readme) ? collectUnsupported(generator.readme, [...prefix, "readme"], state) : [],
|
|
2441
|
-
...unsupportedResolvedFields(generator, index)
|
|
2470
|
+
...unsupportedResolvedFields(generator, index, apiWideIdempotency !== void 0)
|
|
2442
2471
|
];
|
|
2443
2472
|
return { client, docs, generation, package: packageConfig, targetGeneration, unsupportedFields };
|
|
2444
2473
|
}
|
|
2445
|
-
function unsupportedResolvedFields(generator, index) {
|
|
2474
|
+
function unsupportedResolvedFields(generator, index, idempotencyMapped) {
|
|
2446
2475
|
const values = [
|
|
2447
2476
|
["automation", isDefaultAutomation(generator.automation) ? void 0 : generator.automation],
|
|
2448
2477
|
["containerImage", generator.containerImage],
|
|
2449
2478
|
["irVersionOverride", generator.irVersionOverride],
|
|
2450
|
-
[
|
|
2479
|
+
[
|
|
2480
|
+
"idempotencyKeyGenerationConfig",
|
|
2481
|
+
idempotencyMapped ? void 0 : generator.idempotencyKeyGenerationConfig
|
|
2482
|
+
],
|
|
2451
2483
|
["absolutePathToLocalSnippets", generator.absolutePathToLocalSnippets],
|
|
2452
2484
|
[
|
|
2453
2485
|
"disableExamples",
|
|
@@ -2480,7 +2512,8 @@ function resolvedFieldGuidance(field) {
|
|
|
2480
2512
|
}
|
|
2481
2513
|
if (field === "idempotencyKeyGenerationConfig") {
|
|
2482
2514
|
return {
|
|
2483
|
-
|
|
2515
|
+
sdkConfigPath: ["client", "idempotencyKeyGeneration"],
|
|
2516
|
+
suggestedAction: "Use true, false, or an object with header-name and methods, or set client.idempotencyKeyGeneration manually."
|
|
2484
2517
|
};
|
|
2485
2518
|
}
|
|
2486
2519
|
if (field === "generateFullProject") {
|
|
@@ -2495,6 +2528,20 @@ function resolvedFieldGuidance(field) {
|
|
|
2495
2528
|
function isDefaultAutomation(value) {
|
|
2496
2529
|
return isObject(value) && value.generate === true && value.upgrade === true && value.preview === true && value.verify === true;
|
|
2497
2530
|
}
|
|
2531
|
+
var HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
|
|
2532
|
+
function idempotencyKeyGenerationFrom(value, path, state) {
|
|
2533
|
+
if (typeof value === "boolean") {
|
|
2534
|
+
consume(state, path);
|
|
2535
|
+
return { enabled: value };
|
|
2536
|
+
}
|
|
2537
|
+
if (!isObject(value)) return void 0;
|
|
2538
|
+
const probe = { consumedPaths: /* @__PURE__ */ new Set() };
|
|
2539
|
+
const headerName = takeString(value, ["headerName"], probe, path);
|
|
2540
|
+
const methods = takeEnumArray(value, ["methods"], HTTP_METHODS, probe, path);
|
|
2541
|
+
if (probe.consumedPaths.size !== Object.keys(value).length) return void 0;
|
|
2542
|
+
consume(state, path);
|
|
2543
|
+
return { enabled: true, ...optional("headerName", headerName), ...optional("methods", methods) };
|
|
2544
|
+
}
|
|
2498
2545
|
function mapCommonConfig(language, config, state, client, generation, packageConfig, basePath) {
|
|
2499
2546
|
const inlinePath = takeBoolean(config, ["inlinePathParameters"], state, basePath);
|
|
2500
2547
|
const inlineFile = takeBoolean(config, ["inlineFileProperties"], state, basePath);
|
|
@@ -2519,6 +2566,23 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2519
2566
|
if (useDefaults !== void 0) client.useDefaultRequestParameterValues = useDefaults;
|
|
2520
2567
|
const respectOptionalBody = takeBoolean(config, ["respectOptionalRequestBody"], state, basePath);
|
|
2521
2568
|
if (respectOptionalBody !== void 0) client.respectOptionalRequestBody = respectOptionalBody;
|
|
2569
|
+
const idempotency = locate(config, ["autoGenerateIdempotencyKey"], basePath);
|
|
2570
|
+
const idempotencyKeyGeneration = idempotency && idempotencyKeyGenerationFrom(idempotency.value, idempotency.path, state);
|
|
2571
|
+
if (idempotencyKeyGeneration) client.idempotencyKeyGeneration = idempotencyKeyGeneration;
|
|
2572
|
+
const userAgent = compact({
|
|
2573
|
+
template: takeString(config, ["userAgent"], state, basePath),
|
|
2574
|
+
includePlatformInfo: takeBoolean(config, ["includePlatformHeaders"], state, basePath),
|
|
2575
|
+
allowAppInfo: takeBoolean(config, ["allowUserAgentAppInfo"], state, basePath)
|
|
2576
|
+
});
|
|
2577
|
+
if (Object.keys(userAgent).length) client.userAgent = userAgent;
|
|
2578
|
+
const offsetSemantics = takeEnum(
|
|
2579
|
+
config,
|
|
2580
|
+
["offsetSemantics"],
|
|
2581
|
+
["item-index", "page-index"],
|
|
2582
|
+
state,
|
|
2583
|
+
basePath
|
|
2584
|
+
);
|
|
2585
|
+
if (offsetSemantics !== void 0) client.offsetSemantics = offsetSemantics;
|
|
2522
2586
|
const maxRetries = takeNumber(config, ["maxRetries"], state, basePath);
|
|
2523
2587
|
const statusCodeProfile = takeEnum(
|
|
2524
2588
|
config,
|
|
@@ -2536,7 +2600,10 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2536
2600
|
const pythonClient = language === "python" ? takeObject(config, ["client"], state, basePath) : void 0;
|
|
2537
2601
|
const typescriptNaming = language === "typescript" || language === "mcp" ? takeObject(config, ["naming"], state, basePath) : void 0;
|
|
2538
2602
|
const directClientName = takeString(config, ["clientName", "clientClassName"], state, basePath);
|
|
2539
|
-
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : typescriptNaming ? takeString(typescriptNaming.value, ["client"], state, typescriptNaming.path) :
|
|
2603
|
+
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : typescriptNaming ? takeString(typescriptNaming.value, ["client"], state, typescriptNaming.path) : language === "ruby" ? (
|
|
2604
|
+
// Fern's Ruby generator renames the root client class (`Auth0::Management`) with it.
|
|
2605
|
+
takeString(config, ["clientModuleName"], state, basePath)
|
|
2606
|
+
) : void 0;
|
|
2540
2607
|
const directExportedClientName = takeString(
|
|
2541
2608
|
config,
|
|
2542
2609
|
["exportedClientName", "exportedClientClassName"],
|
|
@@ -2807,6 +2874,8 @@ function mapComposerRequirements(manifest, state, packageConfig) {
|
|
|
2807
2874
|
function mapRuby(config, state, packageConfig, basePath) {
|
|
2808
2875
|
const moduleName = takeString(config, ["moduleName"], state, basePath);
|
|
2809
2876
|
if (moduleName !== void 0) packageConfig.moduleName = moduleName;
|
|
2877
|
+
const packageName = takeString(config, ["package-name"], state, basePath);
|
|
2878
|
+
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2810
2879
|
return compact({ requirePaths: takeStringArray(config, ["requirePaths"], state, basePath) });
|
|
2811
2880
|
}
|
|
2812
2881
|
function mapRust(config, state, packageConfig, basePath) {
|