@osdk/generator 1.0.2 → 1.0.3
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/CHANGELOG.md +7 -0
- package/build/js/index.cjs +10 -3
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +10 -3
- package/build/js/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/build/js/index.cjs
CHANGED
|
@@ -1020,7 +1020,7 @@ ${Array.from(uniqueLinkTargets).map((linkTarget) => `import type { ${linkTarget}
|
|
|
1020
1020
|
${getDescriptionIfPresent(objectTypeWithLinks.objectType.description)}export interface ${objectTypeWithLinks.objectType.apiName} extends OntologyObject {
|
|
1021
1021
|
readonly __apiName: "${objectTypeWithLinks.objectType.apiName}";
|
|
1022
1022
|
readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
1023
|
-
${Object.entries(objectTypeWithLinks.objectType.properties).flatMap(([propertyName, propertyDefinition]) => {
|
|
1023
|
+
${Object.entries(objectTypeWithLinks.objectType.properties).sort((a, b) => a[0].localeCompare(b[0])).flatMap(([propertyName, propertyDefinition]) => {
|
|
1024
1024
|
const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);
|
|
1025
1025
|
const entries = [`${getDescriptionIfPresent(propertyDefinition.description)}readonly ${propertyName}: ${propertyType} | undefined`];
|
|
1026
1026
|
if (isReservedKeyword(propertyName)) {
|
|
@@ -1092,7 +1092,7 @@ async function generatePerObjectInterfaceAndDataFiles(ontology, fs, outDir, impo
|
|
|
1092
1092
|
await Promise.all(Object.values(ontology.objectTypes).map(async (object) => {
|
|
1093
1093
|
object.linkTypes;
|
|
1094
1094
|
await fs.writeFile(path15__namespace.default.join(outDir, `${object.objectType.apiName}.ts`), await formatTs(`
|
|
1095
|
-
import { ObjectTypeDefinition } from "@osdk/api";
|
|
1095
|
+
import type { ObjectTypeDefinition } from "@osdk/api";
|
|
1096
1096
|
${wireObjectTypeV2ToObjectInterfaceStringV1(object)}
|
|
1097
1097
|
|
|
1098
1098
|
${wireObjectTypeV2ToSdkObjectConst(object)}
|
|
@@ -1554,7 +1554,7 @@ async function generateClientSdkVersionTwoPointZero(ontology, fs, outDir, packag
|
|
|
1554
1554
|
}).join(",\n")}
|
|
1555
1555
|
|
|
1556
1556
|
}
|
|
1557
|
-
} satisfies OntologyDefinition<${objectNames
|
|
1557
|
+
} satisfies OntologyDefinition<${stringUnionFrom2(objectNames)}>;
|
|
1558
1558
|
|
|
1559
1559
|
type _Ontology = typeof _Ontology;
|
|
1560
1560
|
export interface Ontology extends _Ontology {}
|
|
@@ -1589,6 +1589,13 @@ async function generateClientSdkVersionTwoPointZero(ontology, fs, outDir, packag
|
|
|
1589
1589
|
${Object.keys(ontology.objectTypes).map((apiName) => `export * from "./objects/${apiName}${importExt}";`).join("\n")}
|
|
1590
1590
|
`));
|
|
1591
1591
|
}
|
|
1592
|
+
function stringUnionFrom2(values) {
|
|
1593
|
+
if (values.length === 0) {
|
|
1594
|
+
return "never";
|
|
1595
|
+
} else {
|
|
1596
|
+
return values.map((v) => `"${v}"`).join("|");
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1592
1599
|
async function generateOntologyInterfaces(fs, outDir, interfaceNames, ontology, importExt) {
|
|
1593
1600
|
const interfacesDir = path15__namespace.default.join(outDir, "ontology", "interfaces");
|
|
1594
1601
|
await fs.mkdir(interfacesDir, {
|