@postman/sdk-config 0.5.1 → 0.7.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/README.md +15 -0
- package/dist/index.cjs +263 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +260 -28
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +224 -27
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.d.cts +2 -2
- package/dist/sdk-config/index.d.ts +2 -2
- package/dist/sdk-config/index.js +224 -28
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +224 -27
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +20 -2
- package/dist/sdk-config/v1/index.d.ts +20 -2
- package/dist/sdk-config/v1/index.js +224 -28
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +153 -0
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.d.cts +2 -2
- package/dist/sdk-config-ir/index.d.ts +2 -2
- package/dist/sdk-config-ir/index.js +151 -1
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +153 -0
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +43 -3
- package/dist/sdk-config-ir/v1/index.d.ts +43 -3
- package/dist/sdk-config-ir/v1/index.js +151 -1
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-BruxA5zG.d.cts → typescript-BdDv_kwT.d.cts} +8 -0
- package/dist/{typescript-BruxA5zG.d.ts → typescript-BdDv_kwT.d.ts} +8 -0
- package/package.json +1 -1
- package/src/sdk-config-ir/v1/README.md +10 -2
|
@@ -790,6 +790,7 @@ function githubOutput(value, publishInfo, rawOutput, language, sourcePath, state
|
|
|
790
790
|
consume(state, [...sourcePath, "repo"]);
|
|
791
791
|
const publication = publishInfo ? mapPublication(publishInfo, rawOutput, language, [...sourcePath, "publishInfo"], state, index) : void 0;
|
|
792
792
|
const type = stringValue(value.type);
|
|
793
|
+
const licensePackage = mapGithubLicense(value.license, [...sourcePath, "license"], state);
|
|
793
794
|
const reviewers = mapReviewers(value.reviewers, [...sourcePath, "reviewers"], state);
|
|
794
795
|
if (type) consume(state, [...sourcePath, "type"]);
|
|
795
796
|
if (typeof value.makePr === "boolean") consume(state, [...sourcePath, "makePr"]);
|
|
@@ -816,9 +817,20 @@ function githubOutput(value, publishInfo, rawOutput, language, sourcePath, state
|
|
|
816
817
|
},
|
|
817
818
|
...publication ? { publish: publication.publish } : {}
|
|
818
819
|
},
|
|
819
|
-
|
|
820
|
+
// The GitHub license wins over a publication-supplied one; `licensePackage` is `{}` or `{ license }`.
|
|
821
|
+
...optionalObject("package", { ...publication?.package, ...licensePackage })
|
|
820
822
|
};
|
|
821
823
|
}
|
|
824
|
+
var basicLicenseTypes = { mit: "MIT", apache: "APACHE" };
|
|
825
|
+
function mapGithubLicense(value, sourcePath, state) {
|
|
826
|
+
if (!isObject(value) || stringValue(value.type) !== "basic") return {};
|
|
827
|
+
const id = stringValue(value.id);
|
|
828
|
+
const type = id ? basicLicenseTypes[id.toLowerCase()] : void 0;
|
|
829
|
+
if (!type) return {};
|
|
830
|
+
consume(state, [...sourcePath, "type"]);
|
|
831
|
+
consume(state, [...sourcePath, "id"]);
|
|
832
|
+
return { license: { type } };
|
|
833
|
+
}
|
|
822
834
|
function consumeCredentialObject(value, sourcePath, state) {
|
|
823
835
|
if (!isObject(value)) return;
|
|
824
836
|
for (const field of ["username", "password", "token", "apiKey"]) {
|
|
@@ -1339,6 +1351,113 @@ function outputDiagnostic(path, index) {
|
|
|
1339
1351
|
suggestedAction: resolvedGuidance?.suggestedAction ?? "Review this output setting and preserve it outside SDK Config when no equivalent exists."
|
|
1340
1352
|
};
|
|
1341
1353
|
}
|
|
1354
|
+
var OMIT = /* @__PURE__ */ Symbol("omit");
|
|
1355
|
+
function inputJsonSchema(schema) {
|
|
1356
|
+
return zod.z.toJSONSchema(schema, {
|
|
1357
|
+
io: "input",
|
|
1358
|
+
unrepresentable: "any"
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
function stripUnknownProperties(value, schema) {
|
|
1362
|
+
return project(value, schema, schema);
|
|
1363
|
+
}
|
|
1364
|
+
function project(value, candidateSchema, rootSchema, omitDefaults) {
|
|
1365
|
+
const resolvedCandidate = resolveSchema(candidateSchema, rootSchema);
|
|
1366
|
+
const schema = selectSchema(value, resolvedCandidate, rootSchema);
|
|
1367
|
+
if (Array.isArray(value)) {
|
|
1368
|
+
if (!schema.items) return value;
|
|
1369
|
+
return value.map((item) => {
|
|
1370
|
+
const projected = project(item, schema.items, rootSchema);
|
|
1371
|
+
return projected === OMIT ? item : projected;
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
if (!isRecord(value) || schema.type !== "object") return value;
|
|
1375
|
+
const entries = [];
|
|
1376
|
+
const properties = schema.properties ?? {};
|
|
1377
|
+
const unionProperties = collectAlternativeProperties(resolvedCandidate, rootSchema);
|
|
1378
|
+
for (const [key, propertySchema] of Object.entries(properties)) {
|
|
1379
|
+
if (!Object.hasOwn(value, key)) continue;
|
|
1380
|
+
const projected = project(value[key], propertySchema, rootSchema);
|
|
1381
|
+
if (projected !== OMIT) entries.push([key, projected]);
|
|
1382
|
+
}
|
|
1383
|
+
for (const [key, fieldValue] of Object.entries(value)) {
|
|
1384
|
+
if (Object.hasOwn(properties, key)) continue;
|
|
1385
|
+
if (Object.hasOwn(unionProperties, key)) {
|
|
1386
|
+
entries.push([key, fieldValue]);
|
|
1387
|
+
continue;
|
|
1388
|
+
}
|
|
1389
|
+
if (schema.additionalProperties !== false) {
|
|
1390
|
+
const projected = typeof schema.additionalProperties === "object" ? project(fieldValue, schema.additionalProperties, rootSchema) : fieldValue;
|
|
1391
|
+
if (projected !== OMIT) entries.push([key, projected]);
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
return Object.fromEntries(entries);
|
|
1395
|
+
}
|
|
1396
|
+
function collectAlternativeProperties(schema, rootSchema) {
|
|
1397
|
+
const alternatives = schema.oneOf ?? schema.anyOf;
|
|
1398
|
+
if (!alternatives) return schema.properties ?? {};
|
|
1399
|
+
return Object.assign(
|
|
1400
|
+
{},
|
|
1401
|
+
...alternatives.map((alternative) => resolveSchema(alternative, rootSchema).properties ?? {})
|
|
1402
|
+
);
|
|
1403
|
+
}
|
|
1404
|
+
function selectSchema(value, schema, rootSchema) {
|
|
1405
|
+
const alternatives = schema.oneOf ?? schema.anyOf;
|
|
1406
|
+
if (!alternatives || alternatives.length === 0) return schema;
|
|
1407
|
+
const best = alternatives.map((alternative, index) => {
|
|
1408
|
+
const resolved = resolveSchema(alternative, rootSchema);
|
|
1409
|
+
return { index, schema: resolved, score: schemaMatchScore(value, resolved) };
|
|
1410
|
+
}).sort((left, right) => right.score - left.score || left.index - right.index)[0];
|
|
1411
|
+
return best.score === Number.NEGATIVE_INFINITY ? schema : best.schema;
|
|
1412
|
+
}
|
|
1413
|
+
function schemaMatchScore(value, schema) {
|
|
1414
|
+
if (Object.hasOwn(schema, "const") && !deepEqual(value, schema.const)) {
|
|
1415
|
+
return Number.NEGATIVE_INFINITY;
|
|
1416
|
+
}
|
|
1417
|
+
if (schema.enum && !schema.enum.some((candidate) => deepEqual(value, candidate))) {
|
|
1418
|
+
return Number.NEGATIVE_INFINITY;
|
|
1419
|
+
}
|
|
1420
|
+
if (schema.type === "object") {
|
|
1421
|
+
if (!isRecord(value)) return Number.NEGATIVE_INFINITY;
|
|
1422
|
+
const properties = schema.properties ?? {};
|
|
1423
|
+
for (const [key, propertySchema] of Object.entries(properties)) {
|
|
1424
|
+
if (!Object.hasOwn(value, key)) continue;
|
|
1425
|
+
if (Object.hasOwn(propertySchema, "const") && !deepEqual(value[key], propertySchema.const)) {
|
|
1426
|
+
return Number.NEGATIVE_INFINITY;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
return Object.keys(value).filter((key) => Object.hasOwn(properties, key)).length;
|
|
1430
|
+
}
|
|
1431
|
+
if (schema.type === "array") return Array.isArray(value) ? 1 : Number.NEGATIVE_INFINITY;
|
|
1432
|
+
if (schema.type === "string") return typeof value === "string" ? 1 : Number.NEGATIVE_INFINITY;
|
|
1433
|
+
if (schema.type === "number" || schema.type === "integer") {
|
|
1434
|
+
return typeof value === "number" ? 1 : Number.NEGATIVE_INFINITY;
|
|
1435
|
+
}
|
|
1436
|
+
if (schema.type === "boolean") return typeof value === "boolean" ? 1 : Number.NEGATIVE_INFINITY;
|
|
1437
|
+
if (schema.type === "null") return value === null ? 1 : Number.NEGATIVE_INFINITY;
|
|
1438
|
+
return 0;
|
|
1439
|
+
}
|
|
1440
|
+
function resolveSchema(schema, rootSchema) {
|
|
1441
|
+
if (!schema.$ref) return schema;
|
|
1442
|
+
if (!schema.$ref.startsWith("#/$defs/")) return schema;
|
|
1443
|
+
const name = schema.$ref.slice("#/$defs/".length).replaceAll("~1", "/").replaceAll("~0", "~");
|
|
1444
|
+
return rootSchema.$defs?.[name] ?? schema;
|
|
1445
|
+
}
|
|
1446
|
+
function isRecord(value) {
|
|
1447
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1448
|
+
}
|
|
1449
|
+
function deepEqual(left, right) {
|
|
1450
|
+
if (Object.is(left, right)) return true;
|
|
1451
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
1452
|
+
return left.length === right.length && left.every((value, index) => deepEqual(value, right[index]));
|
|
1453
|
+
}
|
|
1454
|
+
if (isRecord(left) && isRecord(right)) {
|
|
1455
|
+
const leftKeys = Object.keys(left);
|
|
1456
|
+
const rightKeys = Object.keys(right);
|
|
1457
|
+
return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual(left[key], right[key]));
|
|
1458
|
+
}
|
|
1459
|
+
return false;
|
|
1460
|
+
}
|
|
1342
1461
|
var namingConfigSchema = zod.z.strictObject({
|
|
1343
1462
|
clientName: nonEmptyStringSchema.optional(),
|
|
1344
1463
|
exportedClientName: nonEmptyStringSchema.optional(),
|
|
@@ -1699,17 +1818,22 @@ var typescriptGenerationConfigSchema = zod.z.strictObject({
|
|
|
1699
1818
|
compilerOptions: compilerOptionsSchema.optional(),
|
|
1700
1819
|
httpClient: httpClientSchema.optional(),
|
|
1701
1820
|
packageManager: zod.z.enum(["pnpm", "yarn"]).optional(),
|
|
1821
|
+
/** e.g. `1.22.22` — from the customer's own `config.packageJson.packageManager` (`yarn@1.22.22`). */
|
|
1822
|
+
packageManagerVersion: nonEmptyStringSchema.optional(),
|
|
1702
1823
|
testFramework: zod.z.enum(["jest", "vitest"]).optional(),
|
|
1703
1824
|
namingStrategy: zod.z.enum(["base", "originalPropertyNames"]).optional(),
|
|
1704
1825
|
bundle: zod.z.boolean().optional(),
|
|
1705
1826
|
exportClassDefault: zod.z.boolean().optional(),
|
|
1706
1827
|
/** Name of the top-level namespace export emitted by Fern-compatible TypeScript SDKs. */
|
|
1707
1828
|
namespaceExportName: nonEmptyStringSchema.optional(),
|
|
1829
|
+
consolidateTypeFiles: zod.z.boolean().optional(),
|
|
1708
1830
|
allowCustomFetcher: zod.z.boolean().optional(),
|
|
1709
1831
|
useBrandedStringAliases: zod.z.boolean().optional(),
|
|
1710
1832
|
useLegacyExports: zod.z.boolean().optional(),
|
|
1711
1833
|
useBigInt: zod.z.boolean().optional(),
|
|
1712
1834
|
serdeLayer: zod.z.boolean().optional(),
|
|
1835
|
+
/** Ship only the ESM build (drops CJS) to avoid the Node dual-package hazard. */
|
|
1836
|
+
esmOnly: zod.z.boolean().optional(),
|
|
1713
1837
|
scripts: zod.z.array(packageScriptSchema).optional()
|
|
1714
1838
|
});
|
|
1715
1839
|
|
|
@@ -2017,6 +2141,10 @@ function validateSdkConfigV1(value) {
|
|
|
2017
2141
|
function parseSdkConfigV1(value) {
|
|
2018
2142
|
return sdkConfigV1Schema.parse(value);
|
|
2019
2143
|
}
|
|
2144
|
+
var sdkConfigV1InputJsonSchema = inputJsonSchema(sdkConfigV1Schema);
|
|
2145
|
+
function parseSdkConfigV1ForConsumption(value) {
|
|
2146
|
+
return parseSdkConfigV1(stripUnknownProperties(value, sdkConfigV1InputJsonSchema));
|
|
2147
|
+
}
|
|
2020
2148
|
|
|
2021
2149
|
// src/sdk-config/v1/fern-config-mapper.ts
|
|
2022
2150
|
var generatorLanguages = {
|
|
@@ -2379,15 +2507,23 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2379
2507
|
};
|
|
2380
2508
|
}
|
|
2381
2509
|
const pythonClient = language === "python" ? takeObject(config, ["client"], state, basePath) : void 0;
|
|
2510
|
+
const typescriptNaming = language === "typescript" || language === "mcp" ? takeObject(config, ["naming"], state, basePath) : void 0;
|
|
2382
2511
|
const directClientName = takeString(config, ["clientName", "clientClassName"], state, basePath);
|
|
2383
|
-
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : void 0;
|
|
2512
|
+
const nestedClientName = pythonClient ? takeString(pythonClient.value, ["className"], state, pythonClient.path) : typescriptNaming ? takeString(typescriptNaming.value, ["client"], state, typescriptNaming.path) : void 0;
|
|
2384
2513
|
const directExportedClientName = takeString(
|
|
2385
2514
|
config,
|
|
2386
2515
|
["exportedClientName", "exportedClientClassName"],
|
|
2387
2516
|
state,
|
|
2388
2517
|
basePath
|
|
2389
2518
|
);
|
|
2390
|
-
const nestedExportedClientName = pythonClient ? takeString(pythonClient.value, ["exportedClassName"], state, pythonClient.path) :
|
|
2519
|
+
const nestedExportedClientName = pythonClient ? takeString(pythonClient.value, ["exportedClassName"], state, pythonClient.path) : typescriptNaming ? (
|
|
2520
|
+
// TypeScript's `naming.namespace` is the base every other naming.* field defaults from
|
|
2521
|
+
// (Fern's docs: `client` defaults to `${PascalCase(namespace)}Client`, same for
|
|
2522
|
+
// `environment`/`error`/etc.) — the same role `exportedClientName` already plays for every
|
|
2523
|
+
// other language's `clientPrefix` derivation.
|
|
2524
|
+
takeString(typescriptNaming.value, ["namespace"], state, typescriptNaming.path)
|
|
2525
|
+
) : void 0;
|
|
2526
|
+
const nestedEnvironmentTypeName = typescriptNaming ? takeString(typescriptNaming.value, ["environment"], state, typescriptNaming.path) : void 0;
|
|
2391
2527
|
const naming = compact({
|
|
2392
2528
|
pagerName: takeString(
|
|
2393
2529
|
config,
|
|
@@ -2397,12 +2533,7 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2397
2533
|
),
|
|
2398
2534
|
clientName: directClientName ?? nestedClientName,
|
|
2399
2535
|
exportedClientName: directExportedClientName ?? nestedExportedClientName,
|
|
2400
|
-
environmentTypeName: takeString(
|
|
2401
|
-
config,
|
|
2402
|
-
["environmentClassName", "environmentEnumName"],
|
|
2403
|
-
state,
|
|
2404
|
-
basePath
|
|
2405
|
-
),
|
|
2536
|
+
environmentTypeName: takeString(config, ["environmentClassName", "environmentEnumName"], state, basePath) ?? nestedEnvironmentTypeName,
|
|
2406
2537
|
apiErrorName: takeString(config, ["baseApiExceptionClassName"], state, basePath),
|
|
2407
2538
|
baseErrorName: takeString(config, ["baseExceptionClassName"], state, basePath)
|
|
2408
2539
|
});
|
|
@@ -2416,6 +2547,10 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2416
2547
|
basePath
|
|
2417
2548
|
);
|
|
2418
2549
|
if (webSockets !== void 0) generation.webSockets = webSockets;
|
|
2550
|
+
if (language === "typescript") {
|
|
2551
|
+
const streams = mapTypescriptStreams(config, state, basePath);
|
|
2552
|
+
if (streams) generation.streams = streams;
|
|
2553
|
+
}
|
|
2419
2554
|
const generateFullProject = takeBoolean(config, ["generateFullProject"], state, basePath);
|
|
2420
2555
|
if (generateFullProject !== void 0) generation.generateFullProject = generateFullProject;
|
|
2421
2556
|
const inlineTypes = takeBoolean(config, ["enableInlineTypes"], state, basePath);
|
|
@@ -2433,6 +2568,18 @@ function mapCommonConfig(language, config, state, client, generation, packageCon
|
|
|
2433
2568
|
if (packagePath !== void 0) generation.layout = { packagePath };
|
|
2434
2569
|
mapDependencies(config, state, packageConfig, basePath);
|
|
2435
2570
|
}
|
|
2571
|
+
function mapTypescriptStreams(config, state, basePath) {
|
|
2572
|
+
const responseType = takeEnum(config, ["streamType"], ["wrapper", "web"], state, basePath);
|
|
2573
|
+
const fileResponseType = takeEnum(
|
|
2574
|
+
config,
|
|
2575
|
+
["fileResponseType"],
|
|
2576
|
+
["stream", "binary-response"],
|
|
2577
|
+
state,
|
|
2578
|
+
basePath
|
|
2579
|
+
);
|
|
2580
|
+
if (responseType === void 0 && fileResponseType === void 0) return void 0;
|
|
2581
|
+
return { enabled: true, ...compact({ responseType, fileResponseType }) };
|
|
2582
|
+
}
|
|
2436
2583
|
function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
2437
2584
|
switch (language) {
|
|
2438
2585
|
case "typescript":
|
|
@@ -2466,29 +2613,39 @@ function mapLanguageConfig(language, config, state, packageConfig, basePath) {
|
|
|
2466
2613
|
}
|
|
2467
2614
|
}
|
|
2468
2615
|
function mapTypescript(config, state, packageConfig, basePath) {
|
|
2469
|
-
|
|
2616
|
+
const packageJsonManifest = mapPackageManifest(
|
|
2617
|
+
config,
|
|
2618
|
+
["packageJson"],
|
|
2619
|
+
state,
|
|
2620
|
+
packageConfig,
|
|
2621
|
+
basePath
|
|
2622
|
+
);
|
|
2623
|
+
const packageJsonPackageManager = packageJsonManifest ? takeString(packageJsonManifest.value, ["packageManager"], state, packageJsonManifest.path) : void 0;
|
|
2624
|
+
const packageManagerAtIndex = packageJsonPackageManager ? packageJsonPackageManager.indexOf("@", packageJsonPackageManager.startsWith("@") ? 1 : 0) : -1;
|
|
2625
|
+
const packageManagerVersionPart = packageManagerAtIndex >= 0 ? packageJsonPackageManager?.slice(packageManagerAtIndex + 1).split("+")[0] : void 0;
|
|
2626
|
+
const packageManagerVersion = packageManagerVersionPart || void 0;
|
|
2470
2627
|
const serdeLayer = takeBoolean(config, ["serdeLayer"], state, basePath);
|
|
2471
2628
|
const noSerdeLayer = takeBoolean(config, ["noSerdeLayer"], state, basePath);
|
|
2472
2629
|
const fetchSupport = takeEnum(config, ["fetchSupport"], ["native"], state, basePath);
|
|
2630
|
+
const namingObject = takeObject(config, ["naming"], state, basePath);
|
|
2631
|
+
const nestedNamespace = namingObject ? takeString(namingObject.value, ["namespace"], state, namingObject.path) : void 0;
|
|
2473
2632
|
return compact({
|
|
2474
2633
|
typescriptVersion: takeString(config, ["typescriptVersion"], state, basePath),
|
|
2475
2634
|
zodVersion: takeString(config, ["zodVersion"], state, basePath),
|
|
2476
2635
|
packageManager: takeEnum(config, ["packageManager"], ["pnpm", "yarn"], state, basePath),
|
|
2636
|
+
packageManagerVersion,
|
|
2477
2637
|
testFramework: takeEnum(config, ["testFramework"], ["jest", "vitest"], state, basePath),
|
|
2478
2638
|
httpClient: fetchSupport === "native" ? { name: "fetch" } : void 0,
|
|
2479
2639
|
bundle: takeBoolean(config, ["bundle"], state, basePath),
|
|
2480
2640
|
exportClassDefault: takeBoolean(config, ["exportClassDefault"], state, basePath),
|
|
2481
|
-
namespaceExportName: takeString(
|
|
2482
|
-
|
|
2483
|
-
["namespaceExportName", "namespaceExport"],
|
|
2484
|
-
state,
|
|
2485
|
-
basePath
|
|
2486
|
-
),
|
|
2641
|
+
namespaceExportName: takeString(config, ["namespaceExportName", "namespaceExport"], state, basePath) ?? nestedNamespace,
|
|
2642
|
+
consolidateTypeFiles: takeBoolean(config, ["consolidateTypeFiles"], state, basePath),
|
|
2487
2643
|
allowCustomFetcher: takeBoolean(config, ["allowCustomFetcher"], state, basePath),
|
|
2488
2644
|
useBrandedStringAliases: takeBoolean(config, ["useBrandedStringAliases"], state, basePath),
|
|
2489
2645
|
useLegacyExports: takeBoolean(config, ["useLegacyExports"], state, basePath),
|
|
2490
2646
|
useBigInt: takeBoolean(config, ["useBigInt"], state, basePath),
|
|
2491
|
-
serdeLayer: serdeLayer ?? (noSerdeLayer === void 0 ? void 0 : !noSerdeLayer)
|
|
2647
|
+
serdeLayer: serdeLayer ?? (noSerdeLayer === void 0 ? void 0 : !noSerdeLayer),
|
|
2648
|
+
esmOnly: takeBoolean(config, ["esmOnly"], state, basePath)
|
|
2492
2649
|
});
|
|
2493
2650
|
}
|
|
2494
2651
|
function mapPython(config, state, packageConfig, basePath) {
|
|
@@ -2599,7 +2756,8 @@ function mapCsharp(config, state, packageConfig, basePath) {
|
|
|
2599
2756
|
});
|
|
2600
2757
|
}
|
|
2601
2758
|
function mapPhp(config, state, packageConfig, basePath) {
|
|
2602
|
-
mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2759
|
+
const manifest = mapPackageManifest(config, ["composerJson"], state, packageConfig, basePath);
|
|
2760
|
+
if (manifest) mapComposerRequirements(manifest, state, packageConfig);
|
|
2603
2761
|
const packageName = takeString(config, ["packageName"], state, basePath);
|
|
2604
2762
|
if (packageName !== void 0) packageConfig.packageName = packageName;
|
|
2605
2763
|
return compact({
|
|
@@ -2607,6 +2765,20 @@ function mapPhp(config, state, packageConfig, basePath) {
|
|
|
2607
2765
|
generateClientInterfaces: takeBoolean(config, ["generateClientInterfaces"], state, basePath)
|
|
2608
2766
|
});
|
|
2609
2767
|
}
|
|
2768
|
+
function mapComposerRequirements(manifest, state, packageConfig) {
|
|
2769
|
+
const fields = [
|
|
2770
|
+
["require", "extraDependencies"],
|
|
2771
|
+
["require-dev", "extraDevDependencies"]
|
|
2772
|
+
];
|
|
2773
|
+
for (const [composerField, packageField] of fields) {
|
|
2774
|
+
const located = takeObject(manifest.value, [composerField], state, manifest.path);
|
|
2775
|
+
if (!located) continue;
|
|
2776
|
+
const dependencies = Object.entries(located.value).flatMap(
|
|
2777
|
+
([name, dependency]) => mapDependency(name, dependency, state, [...located.path, name])
|
|
2778
|
+
);
|
|
2779
|
+
if (dependencies.length) packageConfig[packageField] = dependencies;
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2610
2782
|
function mapRuby(config, state, packageConfig, basePath) {
|
|
2611
2783
|
const moduleName = takeString(config, ["moduleName"], state, basePath);
|
|
2612
2784
|
if (moduleName !== void 0) packageConfig.moduleName = moduleName;
|
|
@@ -2776,28 +2948,52 @@ function takeCustomSections(value, language, activeLanguages, state, basePath) {
|
|
|
2776
2948
|
}
|
|
2777
2949
|
function mapPackageManifest(config, aliases, state, packageConfig, basePath) {
|
|
2778
2950
|
const manifest = takeObject(config, aliases, state, basePath);
|
|
2779
|
-
if (!manifest) return;
|
|
2951
|
+
if (!manifest) return void 0;
|
|
2780
2952
|
const packageName = takeString(manifest.value, ["name"], state, manifest.path);
|
|
2781
2953
|
const description = takeString(manifest.value, ["description"], state, manifest.path);
|
|
2954
|
+
const keywords = takeStringArray(manifest.value, ["keywords"], state, manifest.path);
|
|
2782
2955
|
const license = takeString(manifest.value, ["license"], state, manifest.path);
|
|
2783
2956
|
const author = takeObject(manifest.value, ["author"], state, manifest.path);
|
|
2784
2957
|
const authorName = author ? takeString(author.value, ["name"], state, author.path) : void 0;
|
|
2785
|
-
const authors =
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2958
|
+
const authors = [
|
|
2959
|
+
...authorName && author ? [
|
|
2960
|
+
compact({
|
|
2961
|
+
name: authorName,
|
|
2962
|
+
email: takeString(author.value, ["email"], state, author.path),
|
|
2963
|
+
url: takeString(author.value, ["url"], state, author.path)
|
|
2964
|
+
})
|
|
2965
|
+
] : [],
|
|
2966
|
+
...takeManifestAuthors(manifest, state)
|
|
2967
|
+
];
|
|
2792
2968
|
Object.assign(
|
|
2793
2969
|
packageConfig,
|
|
2794
2970
|
compact({
|
|
2795
2971
|
packageName,
|
|
2796
2972
|
description,
|
|
2797
|
-
|
|
2973
|
+
homepage: takeString(manifest.value, ["homepage"], state, manifest.path),
|
|
2974
|
+
keywords,
|
|
2975
|
+
authors: authors.length ? authors : void 0,
|
|
2798
2976
|
license: license ? { type: license } : void 0
|
|
2799
2977
|
})
|
|
2800
2978
|
);
|
|
2979
|
+
return manifest;
|
|
2980
|
+
}
|
|
2981
|
+
function takeManifestAuthors(manifest, state) {
|
|
2982
|
+
const located = locate(manifest.value, ["authors"], manifest.path);
|
|
2983
|
+
if (!located || !Array.isArray(located.value)) return [];
|
|
2984
|
+
return located.value.flatMap((entry, index) => {
|
|
2985
|
+
if (!isObject(entry)) return [];
|
|
2986
|
+
const path = [...located.path, index];
|
|
2987
|
+
const name = takeString(entry, ["name"], state, path);
|
|
2988
|
+
if (!name) return [];
|
|
2989
|
+
return [
|
|
2990
|
+
compact({
|
|
2991
|
+
name,
|
|
2992
|
+
email: takeString(entry, ["email"], state, path),
|
|
2993
|
+
url: takeString(entry, ["url"], state, path)
|
|
2994
|
+
})
|
|
2995
|
+
];
|
|
2996
|
+
});
|
|
2801
2997
|
}
|
|
2802
2998
|
function takePythonAdditionalInitExports(config, state, basePath) {
|
|
2803
2999
|
const located = locate(config, ["additionalInitExports"], basePath);
|
|
@@ -2896,6 +3092,7 @@ exports.FernConfigMappingError = FernConfigMappingError;
|
|
|
2896
3092
|
exports.SDK_CONFIG_V1_SCHEMA_VERSION = SDK_CONFIG_V1_SCHEMA_VERSION;
|
|
2897
3093
|
exports.mapFernConfigToSdkConfigV1 = mapFernConfigToSdkConfigV1;
|
|
2898
3094
|
exports.parseSdkConfigV1 = parseSdkConfigV1;
|
|
3095
|
+
exports.parseSdkConfigV1ForConsumption = parseSdkConfigV1ForConsumption;
|
|
2899
3096
|
exports.sdkConfigV1ApiConfigSchema = sdkConfigV1ApiConfigSchema;
|
|
2900
3097
|
exports.sdkConfigV1AuthConfigSchema = sdkConfigV1AuthConfigSchema;
|
|
2901
3098
|
exports.sdkConfigV1AuthSchemeSchema = sdkConfigV1AuthSchemeSchema;
|