@osdk/generator 1.13.5 → 1.13.6
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 +9 -0
- package/build/browser/index.js +13 -4
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +14 -4
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/shared/wireObjectTypeV2ToSdkObjectConst.d.ts.map +1 -1
- package/build/cjs/util/test/TodoWireOntology.d.cts +150 -0
- package/build/cjs/util/test/TodoWireOntology.d.ts.map +1 -1
- package/build/cjs/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts.map +1 -1
- package/build/esm/index.js +13 -4
- package/build/esm/index.js.map +1 -1
- package/build/esm/shared/wireObjectTypeV2ToSdkObjectConst.d.ts.map +1 -1
- package/build/esm/util/test/TodoWireOntology.d.ts +150 -0
- package/build/esm/util/test/TodoWireOntology.d.ts.map +1 -1
- package/build/esm/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
package/build/browser/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as path16 from 'path';
|
|
|
3
3
|
import path16__default, { join } from 'path';
|
|
4
4
|
import { format } from 'prettier';
|
|
5
5
|
import organizeImports from 'prettier-plugin-organize-imports';
|
|
6
|
+
import consola2, { consola } from 'consola';
|
|
6
7
|
import { wireObjectTypeFullMetadataToSdkObjectTypeDefinition, __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from '@osdk/generator-converters';
|
|
7
8
|
import fastDeepEqual from 'fast-deep-equal';
|
|
8
9
|
import invariant from 'tiny-invariant';
|
|
@@ -70,6 +71,9 @@ ${Array.from(uniqueLinkTargets).map((linkTarget) => `import type { ${linkTarget}
|
|
|
70
71
|
readonly $primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
71
72
|
${Object.entries(objectTypeWithLinks.objectType.properties).sort((a, b) => a[0].localeCompare(b[0])).flatMap(([propertyName, propertyDefinition]) => {
|
|
72
73
|
const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);
|
|
74
|
+
if (propertyType == null) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
73
77
|
const entries = [`${getDescriptionIfPresent(propertyDefinition.description, true)}readonly ${propertyName}: ${propertyType} | undefined`];
|
|
74
78
|
if (isReservedKeyword(propertyName)) {
|
|
75
79
|
entries.push(`/** @deprecated please migrate to '${propertyName}' instead */
|
|
@@ -91,7 +95,11 @@ function wirePropertyTypeV2ToTypeScriptType(property) {
|
|
|
91
95
|
case "boolean":
|
|
92
96
|
return "boolean";
|
|
93
97
|
case "array":
|
|
94
|
-
|
|
98
|
+
const subType = wirePropertyTypeV2ToTypeScriptType(property.subType);
|
|
99
|
+
if (subType == null) {
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
102
|
+
return subType + "[]";
|
|
95
103
|
case "integer":
|
|
96
104
|
return "number";
|
|
97
105
|
case "attachment":
|
|
@@ -121,7 +129,8 @@ function wirePropertyTypeV2ToTypeScriptType(property) {
|
|
|
121
129
|
case "marking":
|
|
122
130
|
return "string";
|
|
123
131
|
default:
|
|
124
|
-
|
|
132
|
+
consola.info(`Unknown property type ${JSON.stringify(property)}`);
|
|
133
|
+
return void 0;
|
|
125
134
|
}
|
|
126
135
|
}
|
|
127
136
|
function getDescriptionIfPresent(description, includeNewline) {
|
|
@@ -257,7 +266,7 @@ function getObjectDefIdentifier(name, v2) {
|
|
|
257
266
|
}
|
|
258
267
|
function wireObjectTypeV2ToSdkObjectConst(object, importExt, v2 = false) {
|
|
259
268
|
const uniqueLinkTargetTypes = new Set(object.linkTypes.map((a) => a.objectTypeApiName));
|
|
260
|
-
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object, v2));
|
|
269
|
+
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object, v2, consola2));
|
|
261
270
|
const objectDefIdentifier = getObjectDefIdentifier(object.objectType.apiName, v2);
|
|
262
271
|
function getV1Types() {
|
|
263
272
|
return `
|
|
@@ -1756,7 +1765,7 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
|
|
|
1756
1765
|
|
|
1757
1766
|
};`;
|
|
1758
1767
|
}
|
|
1759
|
-
var ExpectedOsdkVersion = "0.21.
|
|
1768
|
+
var ExpectedOsdkVersion = "0.21.3";
|
|
1760
1769
|
async function generateOntologyMetadataFile(ontology, userAgent, fs2, outDir) {
|
|
1761
1770
|
fs2.writeFile(path16__default.join(outDir, "OntologyMetadata.ts"), await formatTs(`
|
|
1762
1771
|
import { OntologyMetadata as OM } from "@osdk/api";
|