@postman/sdk-config 0.2.0 → 0.3.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/README.md +3 -2
- package/dist/index.cjs +82 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +82 -18
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +14 -12
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.js +14 -12
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +14 -12
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +10 -10
- package/dist/sdk-config/v1/index.d.ts +10 -10
- package/dist/sdk-config/v1/index.js +14 -12
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +70 -8
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.js +70 -8
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +70 -8
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +440 -0
- package/dist/sdk-config-ir/v1/index.d.ts +440 -0
- package/dist/sdk-config-ir/v1/index.js +70 -8
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk-config/v1/README.md +3 -3
- package/src/sdk-config-ir/v1/README.md +89 -82
package/README.md
CHANGED
|
@@ -36,9 +36,7 @@ const input: SdkConfigV1Input = {
|
|
|
36
36
|
source: {
|
|
37
37
|
specs: [{ id: 'example', type: 'openapi', path: './openapi.yml' }],
|
|
38
38
|
},
|
|
39
|
-
api: {},
|
|
40
39
|
client: { timeoutMs: 30_000 },
|
|
41
|
-
package: {},
|
|
42
40
|
output: { delivery: 'zip', fileName: 'example-typescript.zip' },
|
|
43
41
|
docs: { includeApiReference: true },
|
|
44
42
|
generation: { includeWatermark: true },
|
|
@@ -59,6 +57,9 @@ const sdkConfig: SdkConfigV1 = parseSdkConfigV1(document);
|
|
|
59
57
|
Use `parseSdkConfigV1` when entering the runtime boundary and materializing the shared domain
|
|
60
58
|
defaults. For validation without throwing, use the exported schema:
|
|
61
59
|
|
|
60
|
+
Empty top-level `api`, `client`, `package`, `docs`, and `generation` blocks may be omitted from the
|
|
61
|
+
customer document. Runtime parsing materializes those blocks and their versioned defaults.
|
|
62
|
+
|
|
62
63
|
```ts
|
|
63
64
|
import { sdkConfigV1Schema } from '@postman/sdk-config/sdk-config/v1';
|
|
64
65
|
|
package/dist/index.cjs
CHANGED
|
@@ -283,8 +283,8 @@ var clientConfigSchema = zod.z.strictObject({
|
|
|
283
283
|
var sdkConfigV1ClientConfigSchema = clientConfigSchema;
|
|
284
284
|
var sdkConfigV1ClientConfigOverrideSchema = clientConfigOverrideSchema;
|
|
285
285
|
var goModulePathSchema = relativePathSchema.regex(
|
|
286
|
-
/^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)
|
|
287
|
-
"Go module path must
|
|
286
|
+
/^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*$/,
|
|
287
|
+
"Go module path must use letters, numbers, dots, dashes, underscores or tildes, in slash-delimited segments"
|
|
288
288
|
);
|
|
289
289
|
var composerPackageNameSchema = nonEmptyStringSchema.regex(
|
|
290
290
|
/^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$/,
|
|
@@ -549,6 +549,9 @@ function compact(value) {
|
|
|
549
549
|
function optional(key, value) {
|
|
550
550
|
return value === void 0 ? {} : { [key]: value };
|
|
551
551
|
}
|
|
552
|
+
function optionalObject(key, value) {
|
|
553
|
+
return Object.keys(value).length === 0 ? {} : { [key]: value };
|
|
554
|
+
}
|
|
552
555
|
function isObject(value) {
|
|
553
556
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
554
557
|
}
|
|
@@ -1558,12 +1561,12 @@ var sdkConfigV1Schema = zod.z.strictObject({
|
|
|
1558
1561
|
sdkVersion: nonEmptyStringSchema.default("1.0.0"),
|
|
1559
1562
|
apiVersion: nonEmptyStringSchema.optional(),
|
|
1560
1563
|
source: sdkConfigV1SourceConfigSchema,
|
|
1561
|
-
api: sdkConfigV1ApiConfigSchema,
|
|
1562
|
-
client: sdkConfigV1ClientConfigSchema,
|
|
1563
|
-
package: sdkConfigV1PackageConfigSchema,
|
|
1564
|
+
api: sdkConfigV1ApiConfigSchema.prefault({}),
|
|
1565
|
+
client: sdkConfigV1ClientConfigSchema.prefault({}),
|
|
1566
|
+
package: sdkConfigV1PackageConfigSchema.prefault({}),
|
|
1564
1567
|
output: sdkConfigV1OutputConfigSchema.optional(),
|
|
1565
|
-
docs: sdkConfigV1DocsConfigSchema,
|
|
1566
|
-
generation: sdkConfigV1GenerationConfigSchema,
|
|
1568
|
+
docs: sdkConfigV1DocsConfigSchema.prefault({}),
|
|
1569
|
+
generation: sdkConfigV1GenerationConfigSchema.prefault({}),
|
|
1567
1570
|
targets: zod.z.array(sdkConfigV1TargetSchema).min(1)
|
|
1568
1571
|
}).superRefine(({ output, package: globalPackage, targets }, context) => {
|
|
1569
1572
|
const configuredLanguages = /* @__PURE__ */ new Set();
|
|
@@ -1679,11 +1682,10 @@ function mapFernConfigToSdkConfigV1(input) {
|
|
|
1679
1682
|
source: input.source,
|
|
1680
1683
|
...optional("sdkVersion", input.sdkVersion),
|
|
1681
1684
|
...optional("apiVersion", input.apiVersion),
|
|
1682
|
-
api,
|
|
1683
|
-
client
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
generation: generations.shared,
|
|
1685
|
+
...optionalObject("api", api),
|
|
1686
|
+
...optionalObject("client", clients.shared),
|
|
1687
|
+
...optionalObject("docs", docs.shared),
|
|
1688
|
+
...optionalObject("generation", generations.shared),
|
|
1687
1689
|
targets
|
|
1688
1690
|
};
|
|
1689
1691
|
const parsed = sdkConfigV1Schema.safeParse(sdkConfig);
|
|
@@ -2544,19 +2546,74 @@ var commonPublishShape2 = {
|
|
|
2544
2546
|
* SDK Config IR; the external publisher or orchestrator resolves this reference before use.
|
|
2545
2547
|
*/
|
|
2546
2548
|
credentialsRef: nonEmptyStringSchema.optional(),
|
|
2549
|
+
/**
|
|
2550
|
+
* Registry-specific package version override. If omitted, the external publisher/orchestrator may
|
|
2551
|
+
* fall back to target.sdkVersion.
|
|
2552
|
+
*/
|
|
2553
|
+
version: nonEmptyStringSchema.optional(),
|
|
2547
2554
|
releaseBranch: nonEmptyStringSchema.optional(),
|
|
2548
|
-
tolerateRepublish: zod.z.boolean().optional()
|
|
2555
|
+
tolerateRepublish: zod.z.boolean().optional(),
|
|
2556
|
+
/** Generate registry publishing workflow files when publishing through GitHub delivery. */
|
|
2557
|
+
shouldGeneratePublishWorkflow: zod.z.boolean().optional()
|
|
2558
|
+
};
|
|
2559
|
+
var trustedPublishingShape = {
|
|
2560
|
+
/** Use registry trusted publishing / OIDC instead of a static token secret. */
|
|
2561
|
+
trustedPublishing: zod.z.boolean().optional()
|
|
2549
2562
|
};
|
|
2563
|
+
var mavenCoordinateSchema = nonEmptyStringSchema.regex(
|
|
2564
|
+
/^[A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+$/,
|
|
2565
|
+
"Maven coordinate must be in groupId:artifactId form"
|
|
2566
|
+
);
|
|
2567
|
+
var mavenSignatureEnvironmentSchema = zod.z.strictObject({
|
|
2568
|
+
keyIdEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2569
|
+
passwordEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2570
|
+
secretKeyEnvironmentVariable: nonEmptyStringSchema.optional()
|
|
2571
|
+
});
|
|
2550
2572
|
var publishConfigSchema = zod.z.discriminatedUnion("registry", [
|
|
2551
|
-
zod.z.strictObject({
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2573
|
+
zod.z.strictObject({
|
|
2574
|
+
registry: zod.z.literal("npm"),
|
|
2575
|
+
/** Environment variable name containing the npm registry token. */
|
|
2576
|
+
tokenEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2577
|
+
/** Write npm package metadata as private when the publisher creates/updates package.json. */
|
|
2578
|
+
isPackagePrivate: zod.z.boolean().optional(),
|
|
2579
|
+
/** Also publish the TypeScript package to JSR from the npm publishing path. */
|
|
2580
|
+
publishToJsr: zod.z.boolean().optional(),
|
|
2581
|
+
...trustedPublishingShape,
|
|
2582
|
+
...commonPublishShape2
|
|
2583
|
+
}),
|
|
2584
|
+
zod.z.strictObject({
|
|
2585
|
+
registry: zod.z.literal("pypi"),
|
|
2586
|
+
usernameEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2587
|
+
passwordEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2588
|
+
...trustedPublishingShape,
|
|
2589
|
+
...commonPublishShape2
|
|
2590
|
+
}),
|
|
2591
|
+
zod.z.strictObject({
|
|
2592
|
+
registry: zod.z.literal("nuget"),
|
|
2593
|
+
apiKeyEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2594
|
+
...trustedPublishingShape,
|
|
2595
|
+
...commonPublishShape2
|
|
2596
|
+
}),
|
|
2597
|
+
zod.z.strictObject({
|
|
2598
|
+
registry: zod.z.literal("rubygems"),
|
|
2599
|
+
apiKeyEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2600
|
+
...commonPublishShape2
|
|
2601
|
+
}),
|
|
2602
|
+
zod.z.strictObject({
|
|
2603
|
+
registry: zod.z.literal("crates"),
|
|
2604
|
+
tokenEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2605
|
+
...commonPublishShape2
|
|
2606
|
+
}),
|
|
2556
2607
|
zod.z.strictObject({ registry: zod.z.literal("go"), ...commonPublishShape2 }),
|
|
2557
2608
|
zod.z.strictObject({ registry: zod.z.literal("composer"), ...commonPublishShape2 }),
|
|
2558
2609
|
zod.z.strictObject({
|
|
2559
2610
|
registry: zod.z.literal("maven"),
|
|
2611
|
+
/** Maven coordinate in groupId:artifactId form when consumers need the combined value. */
|
|
2612
|
+
coordinate: mavenCoordinateSchema.optional(),
|
|
2613
|
+
usernameEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2614
|
+
passwordEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2615
|
+
mavenUrlEnvironmentVariable: nonEmptyStringSchema.optional(),
|
|
2616
|
+
signatureEnvironmentVariables: mavenSignatureEnvironmentSchema.optional(),
|
|
2560
2617
|
/**
|
|
2561
2618
|
* Reference to Maven signing credentials. Raw signing keys are intentionally not part of SDK
|
|
2562
2619
|
* Config IR; the external publisher or orchestrator resolves this reference before use.
|
|
@@ -2796,6 +2853,13 @@ var sdkConfigIrV1Schema = zod.z.strictObject({
|
|
|
2796
2853
|
}
|
|
2797
2854
|
if (output.publish) {
|
|
2798
2855
|
validatePublishingIdentity2(packageConfig, output.publish.registry, context);
|
|
2856
|
+
if (output.delivery !== "github" && output.publish.shouldGeneratePublishWorkflow === true) {
|
|
2857
|
+
context.addIssue({
|
|
2858
|
+
code: "custom",
|
|
2859
|
+
message: "output.publish.shouldGeneratePublishWorkflow requires GitHub delivery",
|
|
2860
|
+
path: ["output", "publish", "shouldGeneratePublishWorkflow"]
|
|
2861
|
+
});
|
|
2862
|
+
}
|
|
2799
2863
|
}
|
|
2800
2864
|
if (compatibility?.legacyInput) {
|
|
2801
2865
|
const expectedKind = target.sourceOrigin === "postman" ? "postman-build-parameters" : "fern-generator-invocation";
|