@osdk/cli 0.24.2-beta.2 → 0.24.2
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 +6 -0
- package/build/browser/{chunk-LX6TVWKQ.js → chunk-3J7TN5BV.js} +3 -3
- package/build/browser/{chunk-LX6TVWKQ.js.map → chunk-3J7TN5BV.js.map} +1 -1
- package/build/{esm/handleGenerate-BYKD4FQH.js → browser/handleGenerate-FRYQNME6.js} +290 -267
- package/build/browser/handleGenerate-FRYQNME6.js.map +1 -0
- package/build/browser/index.js +22 -11
- package/build/browser/index.js.map +1 -1
- package/build/browser/{siteDeployCommand-ZAJT2N4Q.js → siteDeployCommand-AWCT7E2D.js} +3 -3
- package/build/browser/{siteDeployCommand-ZAJT2N4Q.js.map → siteDeployCommand-AWCT7E2D.js.map} +1 -1
- package/build/browser/{versionDeleteCommand-FAPLHQDP.js → versionDeleteCommand-E26A27RI.js} +3 -3
- package/build/browser/{versionDeleteCommand-FAPLHQDP.js.map → versionDeleteCommand-E26A27RI.js.map} +1 -1
- package/build/{esm/versionGetCommand-C745GXKF.js → browser/versionGetCommand-CJ6LQCQ3.js} +3 -3
- package/build/browser/{versionGetCommand-C745GXKF.js.map → versionGetCommand-CJ6LQCQ3.js.map} +1 -1
- package/build/{esm/versionListCommand-TTBR4UKO.js → browser/versionListCommand-SKKEM3IX.js} +3 -3
- package/build/browser/{versionListCommand-TTBR4UKO.js.map → versionListCommand-SKKEM3IX.js.map} +1 -1
- package/build/{esm/versionSetCommand-S4GBWVYA.js → browser/versionSetCommand-RT74GY73.js} +3 -3
- package/build/browser/{versionSetCommand-S4GBWVYA.js.map → versionSetCommand-RT74GY73.js.map} +1 -1
- package/build/browser/{versionUnsetCommand-4U5FZ7PH.js → versionUnsetCommand-KEXKQTCY.js} +3 -3
- package/build/browser/{versionUnsetCommand-4U5FZ7PH.js.map → versionUnsetCommand-KEXKQTCY.js.map} +1 -1
- package/build/esm/{chunk-LX6TVWKQ.js → chunk-3J7TN5BV.js} +3 -3
- package/build/esm/{chunk-LX6TVWKQ.js.map → chunk-3J7TN5BV.js.map} +1 -1
- package/build/{browser/handleGenerate-BYKD4FQH.js → esm/handleGenerate-FRYQNME6.js} +290 -267
- package/build/esm/handleGenerate-FRYQNME6.js.map +1 -0
- package/build/esm/index.js +22 -11
- package/build/esm/index.js.map +1 -1
- package/build/esm/{siteDeployCommand-ZAJT2N4Q.js → siteDeployCommand-AWCT7E2D.js} +3 -3
- package/build/esm/{siteDeployCommand-ZAJT2N4Q.js.map → siteDeployCommand-AWCT7E2D.js.map} +1 -1
- package/build/esm/{versionDeleteCommand-FAPLHQDP.js → versionDeleteCommand-E26A27RI.js} +3 -3
- package/build/esm/{versionDeleteCommand-FAPLHQDP.js.map → versionDeleteCommand-E26A27RI.js.map} +1 -1
- package/build/{browser/versionGetCommand-C745GXKF.js → esm/versionGetCommand-CJ6LQCQ3.js} +3 -3
- package/build/esm/{versionGetCommand-C745GXKF.js.map → versionGetCommand-CJ6LQCQ3.js.map} +1 -1
- package/build/{browser/versionListCommand-TTBR4UKO.js → esm/versionListCommand-SKKEM3IX.js} +3 -3
- package/build/esm/{versionListCommand-TTBR4UKO.js.map → versionListCommand-SKKEM3IX.js.map} +1 -1
- package/build/{browser/versionSetCommand-S4GBWVYA.js → esm/versionSetCommand-RT74GY73.js} +3 -3
- package/build/esm/{versionSetCommand-S4GBWVYA.js.map → versionSetCommand-RT74GY73.js.map} +1 -1
- package/build/esm/{versionUnsetCommand-4U5FZ7PH.js → versionUnsetCommand-KEXKQTCY.js} +3 -3
- package/build/esm/{versionUnsetCommand-4U5FZ7PH.js.map → versionUnsetCommand-KEXKQTCY.js.map} +1 -1
- package/package.json +4 -4
- package/build/browser/handleGenerate-BYKD4FQH.js.map +0 -1
- package/build/esm/handleGenerate-BYKD4FQH.js.map +0 -1
|
@@ -85,20 +85,14 @@ var AbstractImportable = class {
|
|
|
85
85
|
*/
|
|
86
86
|
importPath;
|
|
87
87
|
uniqueImportName;
|
|
88
|
-
isLocal
|
|
89
|
-
sourcePackage;
|
|
90
|
-
constructor(common2, fullApiName, basePath) {
|
|
88
|
+
constructor(common2, fullApiName, basePath, isLocal = true) {
|
|
91
89
|
this._common = common2;
|
|
92
90
|
this.fullApiName = fullApiName;
|
|
93
91
|
[this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);
|
|
94
92
|
const {
|
|
95
|
-
ontologyApiNamespace,
|
|
96
|
-
apiNamespacePackageMap,
|
|
97
93
|
importExt
|
|
98
94
|
} = common2;
|
|
99
|
-
this.
|
|
100
|
-
this.sourcePackage = this.apiNamespace && !this.isLocal ? apiNamespacePackageMap.get(this.apiNamespace) : void 0;
|
|
101
|
-
this.importPath = this.isLocal ? `${basePath}/${this.shortApiName}${importExt}` : this.sourcePackage;
|
|
95
|
+
this.importPath = isLocal ? `${basePath}/${this.shortApiName}${importExt}` : basePath;
|
|
102
96
|
this.uniqueImportName = this.shortApiName;
|
|
103
97
|
}
|
|
104
98
|
getImportPathRelTo = (filePath) => {
|
|
@@ -119,9 +113,6 @@ var EnhancedBase = class extends AbstractImportable {
|
|
|
119
113
|
constructor(common2, raw, fullApiName, basePath) {
|
|
120
114
|
super(common2, fullApiName, basePath);
|
|
121
115
|
this.raw = raw;
|
|
122
|
-
if (!this.isLocal && !this.sourcePackage) {
|
|
123
|
-
throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common2.ontologyApiNamespace}' or in a provided package mapping`);
|
|
124
|
-
}
|
|
125
116
|
}
|
|
126
117
|
};
|
|
127
118
|
function extractNamespace(fqApiName) {
|
|
@@ -675,21 +666,15 @@ var EnhancedSharedPropertyType = class extends EnhancedBase {
|
|
|
675
666
|
init_esm_shims();
|
|
676
667
|
var ForeignType = class extends AbstractImportable {
|
|
677
668
|
_common;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
super(_common, `${apiNamespace}.${shortApiName}`, _common.apiNamespacePackageMap.get(apiNamespace));
|
|
669
|
+
constructor(_common, apiNamespace, shortApiName, destinationPackage) {
|
|
670
|
+
super(_common, apiNamespace ? `${apiNamespace}.${shortApiName}` : shortApiName, destinationPackage, false);
|
|
681
671
|
this._common = _common;
|
|
682
|
-
this.type = type2;
|
|
683
672
|
}
|
|
684
673
|
getImportedDefinitionIdentifier() {
|
|
685
|
-
return `$Imported$${this.
|
|
674
|
+
return `$Imported$${this.apiNamespace?.replace(/\./g, "$")}$${this.shortApiName}`;
|
|
686
675
|
}
|
|
687
|
-
getDefinitionIdentifier(
|
|
688
|
-
|
|
689
|
-
return v2 ? this.uniqueImportName : `${this.uniqueImportName}Def`;
|
|
690
|
-
} else {
|
|
691
|
-
return this.uniqueImportName;
|
|
692
|
-
}
|
|
676
|
+
getDefinitionIdentifier() {
|
|
677
|
+
return this.uniqueImportName;
|
|
693
678
|
}
|
|
694
679
|
};
|
|
695
680
|
|
|
@@ -704,35 +689,25 @@ var EnhancedOntologyDefinition = class {
|
|
|
704
689
|
#foreignTypes = {};
|
|
705
690
|
raw;
|
|
706
691
|
common;
|
|
707
|
-
constructor(raw,
|
|
692
|
+
constructor(raw, importExt, externalObjects, externalInterfaces, externalSpts) {
|
|
708
693
|
this.common = {
|
|
709
|
-
apiNamespacePackageMap,
|
|
710
694
|
enhancedOntology: this,
|
|
711
|
-
importExt
|
|
712
|
-
ontologyApiNamespace
|
|
695
|
+
importExt
|
|
713
696
|
};
|
|
714
697
|
this.raw = raw;
|
|
715
698
|
this.ontology = raw.ontology;
|
|
716
|
-
this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);
|
|
699
|
+
this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType, externalObjects);
|
|
717
700
|
this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);
|
|
718
701
|
this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);
|
|
719
|
-
this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);
|
|
720
|
-
this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
|
|
702
|
+
this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType, externalInterfaces);
|
|
703
|
+
this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType, externalSpts);
|
|
721
704
|
}
|
|
722
705
|
#createRequireType = (type2) => {
|
|
723
|
-
return (fullApiName
|
|
706
|
+
return (fullApiName) => {
|
|
724
707
|
const ret = this[type2][fullApiName];
|
|
725
708
|
if (!ret) {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
throw new Error(`Unable to find ${type2}: No entry for '${fullApiName}`);
|
|
729
|
-
}
|
|
730
|
-
if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
|
|
731
|
-
throw new Error(`Unable to find ${type2}: Unknown namespace '${apiNamespace}'`);
|
|
732
|
-
}
|
|
733
|
-
const ret2 = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type2, apiNamespace, shortApiName);
|
|
734
|
-
this.#foreignTypes[fullApiName] = ret2;
|
|
735
|
-
return ret2;
|
|
709
|
+
extractNamespace(fullApiName);
|
|
710
|
+
throw new Error(`Unable to find ${type2}: No entry for '${fullApiName}`);
|
|
736
711
|
}
|
|
737
712
|
return ret;
|
|
738
713
|
};
|
|
@@ -743,15 +718,31 @@ var EnhancedOntologyDefinition = class {
|
|
|
743
718
|
requireQueryType = this.#createRequireType("queryTypes");
|
|
744
719
|
requireSharedPropertyType = this.#createRequireType("sharedPropertyTypes");
|
|
745
720
|
};
|
|
746
|
-
function remap(r, common2, Constructor) {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
721
|
+
function remap(r, common2, Constructor, externalMap) {
|
|
722
|
+
const entries = [];
|
|
723
|
+
for (const [fullApiName, v] of Object.entries(r ?? {})) {
|
|
724
|
+
if (!externalMap?.has(fullApiName)) {
|
|
725
|
+
entries.push([fullApiName, new Constructor(common2, v)]);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (externalMap) {
|
|
729
|
+
for (const [fullApiName, destPackage] of externalMap) {
|
|
730
|
+
const [apiNamespace, shortApiName] = extractNamespace(fullApiName);
|
|
731
|
+
entries.push([fullApiName, new ForeignType(common2, apiNamespace, shortApiName, destPackage)]);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return Object.fromEntries(entries.sort((a, b) => a[0].localeCompare(b[0])));
|
|
750
735
|
}
|
|
751
736
|
|
|
752
737
|
// ../generator/build/esm/GenerateContext/enhanceOntology.js
|
|
753
|
-
function enhanceOntology(
|
|
754
|
-
|
|
738
|
+
function enhanceOntology({
|
|
739
|
+
sanitized,
|
|
740
|
+
importExt,
|
|
741
|
+
externalObjects,
|
|
742
|
+
externalInterfaces,
|
|
743
|
+
externalSpts
|
|
744
|
+
}) {
|
|
745
|
+
return new EnhancedOntologyDefinition(sanitized, importExt, externalObjects, externalInterfaces, externalSpts);
|
|
755
746
|
}
|
|
756
747
|
|
|
757
748
|
// ../generator/build/esm/shared/sanitizeMetadata.js
|
|
@@ -771,6 +762,24 @@ function camelize(name) {
|
|
|
771
762
|
return name.replace(/-./g, (segment) => segment[1].toUpperCase());
|
|
772
763
|
}
|
|
773
764
|
|
|
765
|
+
// ../generator/build/esm/util/verifyOutDir.js
|
|
766
|
+
init_esm_shims();
|
|
767
|
+
async function verifyOutDir(outDir, fs9) {
|
|
768
|
+
try {
|
|
769
|
+
const contents = await fs9.readdir(outDir);
|
|
770
|
+
if (contents.length !== 0) {
|
|
771
|
+
throw new Error(`outDir ${outDir} is not empty, please delete its contents and try again`);
|
|
772
|
+
}
|
|
773
|
+
} catch (e) {
|
|
774
|
+
if (!(e.code === "ENOENT")) {
|
|
775
|
+
throw e;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// ../generator/build/esm/v2.0/generateMetadata.js
|
|
781
|
+
init_esm_shims();
|
|
782
|
+
|
|
774
783
|
// ../generator/build/esm/util/test/formatTs.js
|
|
775
784
|
init_esm_shims();
|
|
776
785
|
|
|
@@ -21115,23 +21124,7 @@ function formatTs(contents) {
|
|
|
21115
21124
|
}
|
|
21116
21125
|
}
|
|
21117
21126
|
|
|
21118
|
-
// ../generator/build/esm/util/verifyOutDir.js
|
|
21119
|
-
init_esm_shims();
|
|
21120
|
-
async function verifyOutDir(outDir, fs9) {
|
|
21121
|
-
try {
|
|
21122
|
-
const contents = await fs9.readdir(outDir);
|
|
21123
|
-
if (contents.length !== 0) {
|
|
21124
|
-
throw new Error(`outDir ${outDir} is not empty, please delete its contents and try again`);
|
|
21125
|
-
}
|
|
21126
|
-
} catch (e) {
|
|
21127
|
-
if (!(e.code === "ENOENT")) {
|
|
21128
|
-
throw e;
|
|
21129
|
-
}
|
|
21130
|
-
}
|
|
21131
|
-
}
|
|
21132
|
-
|
|
21133
21127
|
// ../generator/build/esm/v2.0/generateMetadata.js
|
|
21134
|
-
init_esm_shims();
|
|
21135
21128
|
var ExpectedOsdkVersion = "2.0.2";
|
|
21136
21129
|
async function generateOntologyMetadataFile({
|
|
21137
21130
|
fs: fs9,
|
|
@@ -21248,6 +21241,9 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
21248
21241
|
ontology
|
|
21249
21242
|
}, currentFilePath) {
|
|
21250
21243
|
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
21244
|
+
if (object instanceof ForeignType) {
|
|
21245
|
+
throw new Error("Should not be generating types for an external type");
|
|
21246
|
+
}
|
|
21251
21247
|
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
21252
21248
|
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));
|
|
21253
21249
|
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
@@ -21267,7 +21263,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
21267
21263
|
propertyKeysIdentifier
|
|
21268
21264
|
};
|
|
21269
21265
|
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
|
|
21270
|
-
return `${imports}${function() {
|
|
21266
|
+
return `${imports}${function(object2) {
|
|
21271
21267
|
return `import type {
|
|
21272
21268
|
PropertyKeys as $PropertyKeys,
|
|
21273
21269
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
@@ -21282,26 +21278,26 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
21282
21278
|
} from "@osdk/api";
|
|
21283
21279
|
|
|
21284
21280
|
|
|
21285
|
-
export namespace ${
|
|
21281
|
+
export namespace ${object2.shortApiName} {
|
|
21286
21282
|
|
|
21287
|
-
${createPropertyKeys(
|
|
21283
|
+
${createPropertyKeys(object2)}
|
|
21288
21284
|
|
|
21289
21285
|
|
|
21290
|
-
${createLinks(ontology,
|
|
21286
|
+
${createLinks(ontology, object2, "Links")}
|
|
21291
21287
|
|
|
21292
|
-
${createProps(
|
|
21293
|
-
${createProps(
|
|
21288
|
+
${createProps(object2, "Props", false)}
|
|
21289
|
+
${createProps(object2, "StrictProps", true)}
|
|
21294
21290
|
|
|
21295
|
-
${createObjectSet(
|
|
21291
|
+
${createObjectSet(object2, identifiers)}
|
|
21296
21292
|
|
|
21297
|
-
${createOsdkObject(
|
|
21293
|
+
${createOsdkObject(object2, "OsdkInstance", identifiers)}
|
|
21298
21294
|
}
|
|
21299
21295
|
|
|
21300
21296
|
|
|
21301
21297
|
|
|
21302
|
-
${createDefinition(
|
|
21298
|
+
${createDefinition(object2, ontology, object2.shortApiName, identifiers)}
|
|
21303
21299
|
`;
|
|
21304
|
-
}()}
|
|
21300
|
+
}(object)}
|
|
21305
21301
|
|
|
21306
21302
|
export const ${object.shortApiName}: ${objectDefIdentifier}
|
|
21307
21303
|
= {
|
|
@@ -21318,16 +21314,22 @@ function createOsdkObject(object, identifier, {
|
|
|
21318
21314
|
}) {
|
|
21319
21315
|
object.getCleanedUpDefinition(true);
|
|
21320
21316
|
return `
|
|
21321
|
-
|
|
21317
|
+
export type ${identifier}<
|
|
21322
21318
|
OPTIONS extends never | "$notStrict" | "$rid" = never,
|
|
21323
21319
|
K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
|
|
21324
|
-
|
|
21325
|
-
|
|
21326
|
-
= $Osdk<
|
|
21320
|
+
>
|
|
21321
|
+
= $Osdk.Instance<
|
|
21327
21322
|
${objectDefIdentifier},
|
|
21328
|
-
|
|
21329
|
-
|
|
21323
|
+
OPTIONS,
|
|
21324
|
+
K
|
|
21325
|
+
>;
|
|
21330
21326
|
|
|
21327
|
+
|
|
21328
|
+
/** @deprecated use ${identifier} */
|
|
21329
|
+
export type OsdkObject<
|
|
21330
|
+
OPTIONS extends never | "$notStrict" | "$rid" = never,
|
|
21331
|
+
K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
|
|
21332
|
+
> = ${identifier}<OPTIONS, K>;
|
|
21331
21333
|
;
|
|
21332
21334
|
`;
|
|
21333
21335
|
}
|
|
@@ -21637,6 +21639,177 @@ function extractReferencedObjectsFromActionParameter(actionParameter) {
|
|
|
21637
21639
|
}
|
|
21638
21640
|
}
|
|
21639
21641
|
|
|
21642
|
+
// ../generator/build/esm/v2.0/generatePerInterfaceDataFiles.js
|
|
21643
|
+
init_esm_shims();
|
|
21644
|
+
|
|
21645
|
+
// ../generator/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js
|
|
21646
|
+
init_esm_shims();
|
|
21647
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
|
|
21648
|
+
|
|
21649
|
+
// ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
21650
|
+
init_esm_shims();
|
|
21651
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
21652
|
+
var prefix = "Invariant failed";
|
|
21653
|
+
function invariant(condition, message) {
|
|
21654
|
+
if (isProduction) {
|
|
21655
|
+
throw new Error(prefix);
|
|
21656
|
+
}
|
|
21657
|
+
var provided = typeof message === "function" ? message() : message;
|
|
21658
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
21659
|
+
throw new Error(value);
|
|
21660
|
+
}
|
|
21661
|
+
|
|
21662
|
+
// ../generator/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js
|
|
21663
|
+
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
|
|
21664
|
+
const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw));
|
|
21665
|
+
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
21666
|
+
const parents = definition.implements?.map((p) => {
|
|
21667
|
+
const parent = ontology.requireInterfaceType(p, true);
|
|
21668
|
+
if (parent instanceof EnhancedInterfaceType) {
|
|
21669
|
+
const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw));
|
|
21670
|
+
return it;
|
|
21671
|
+
}
|
|
21672
|
+
}) ?? [];
|
|
21673
|
+
const mergedProperties = {
|
|
21674
|
+
...definition.properties
|
|
21675
|
+
};
|
|
21676
|
+
for (const parent of parents) {
|
|
21677
|
+
if (parent == null) {
|
|
21678
|
+
continue;
|
|
21679
|
+
}
|
|
21680
|
+
for (const apiName of Object.keys(parent.properties)) {
|
|
21681
|
+
if (definition.properties[apiName] != null) {
|
|
21682
|
+
!(0, import_fast_deep_equal.default)(definition.properties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : invariant() : void 0;
|
|
21683
|
+
} else if (mergedProperties[apiName] != null) {
|
|
21684
|
+
!(0, import_fast_deep_equal.default)(mergedProperties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : invariant() : void 0;
|
|
21685
|
+
}
|
|
21686
|
+
mergedProperties[apiName] = parent.properties[apiName];
|
|
21687
|
+
}
|
|
21688
|
+
}
|
|
21689
|
+
definition.properties = mergedProperties;
|
|
21690
|
+
const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
|
|
21691
|
+
const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
|
|
21692
|
+
const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;
|
|
21693
|
+
const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;
|
|
21694
|
+
const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;
|
|
21695
|
+
const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;
|
|
21696
|
+
const ids = {
|
|
21697
|
+
objectDefIdentifier: interfaceDef.shortApiName,
|
|
21698
|
+
osdkObjectLinksIdentifier,
|
|
21699
|
+
osdkObjectPropsIdentifier,
|
|
21700
|
+
osdkObjectStrictPropsIdentifier,
|
|
21701
|
+
objectSetIdentifier,
|
|
21702
|
+
osdkObjectIdentifier,
|
|
21703
|
+
propertyKeysIdentifier
|
|
21704
|
+
};
|
|
21705
|
+
if (interfaceDef.apiNamespace) {
|
|
21706
|
+
const badProperties = Object.keys(definition.properties).filter((apiName) => extractNamespace(apiName)[0] == null);
|
|
21707
|
+
if (badProperties.length > 0) {
|
|
21708
|
+
throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(", ")}`);
|
|
21709
|
+
}
|
|
21710
|
+
}
|
|
21711
|
+
return `${[].join("\n")}
|
|
21712
|
+
${v2 ? function() {
|
|
21713
|
+
return `import type {
|
|
21714
|
+
InterfaceDefinition as $InterfaceDefinition,
|
|
21715
|
+
ObjectSet as $ObjectSet,
|
|
21716
|
+
Osdk as $Osdk,
|
|
21717
|
+
PropertyValueWireToClient as $PropType,
|
|
21718
|
+
} from "@osdk/api";
|
|
21719
|
+
|
|
21720
|
+
${Object.keys(definition.links).length === 0 ? `export type ${osdkObjectLinksIdentifier} = {};` : `
|
|
21721
|
+
export interface ${osdkObjectLinksIdentifier} {
|
|
21722
|
+
${stringify(definition.links, {
|
|
21723
|
+
"*": (definition2) => {
|
|
21724
|
+
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(v2);
|
|
21725
|
+
return `${definition2.multiplicity ? `${linkTarget}["objectSet"]` : `SingleLinkAccessor<${linkTarget}>`}
|
|
21726
|
+
`;
|
|
21727
|
+
}
|
|
21728
|
+
})}
|
|
21729
|
+
}
|
|
21730
|
+
`}
|
|
21731
|
+
|
|
21732
|
+
export namespace ${interfaceDef.shortApiName} {
|
|
21733
|
+
|
|
21734
|
+
${createPropertyKeys(interfaceDef)}
|
|
21735
|
+
|
|
21736
|
+
|
|
21737
|
+
${createProps(interfaceDef, "Props", false)}
|
|
21738
|
+
${createProps(interfaceDef, "StrictProps", true)}
|
|
21739
|
+
|
|
21740
|
+
|
|
21741
|
+
${createObjectSet(interfaceDef, ids)}
|
|
21742
|
+
|
|
21743
|
+
${createOsdkObject(interfaceDef, "OsdkInstance", ids)}
|
|
21744
|
+
|
|
21745
|
+
}
|
|
21746
|
+
|
|
21747
|
+
${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}
|
|
21748
|
+
|
|
21749
|
+
`;
|
|
21750
|
+
}() : ""}
|
|
21751
|
+
|
|
21752
|
+
export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {
|
|
21753
|
+
type: "interface",
|
|
21754
|
+
apiName: "${interfaceDef.fullApiName}",
|
|
21755
|
+
osdkMetadata: $osdkMetadata,
|
|
21756
|
+
};`;
|
|
21757
|
+
}
|
|
21758
|
+
|
|
21759
|
+
// ../generator/build/esm/v2.0/generatePerInterfaceDataFiles.js
|
|
21760
|
+
async function generatePerInterfaceDataFiles({
|
|
21761
|
+
fs: fs9,
|
|
21762
|
+
outDir,
|
|
21763
|
+
ontology,
|
|
21764
|
+
importExt
|
|
21765
|
+
}) {
|
|
21766
|
+
const interfacesDir = path9__default.join(outDir, "ontology", "interfaces");
|
|
21767
|
+
await fs9.mkdir(interfacesDir, {
|
|
21768
|
+
recursive: true
|
|
21769
|
+
});
|
|
21770
|
+
for (const obj of Object.values(ontology.interfaceTypes)) {
|
|
21771
|
+
if (obj instanceof ForeignType) continue;
|
|
21772
|
+
await fs9.writeFile(path9__default.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
|
|
21773
|
+
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
21774
|
+
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
21775
|
+
${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
|
|
21776
|
+
`));
|
|
21777
|
+
}
|
|
21778
|
+
await fs9.writeFile(interfacesDir + ".ts", await formatTs(`
|
|
21779
|
+
${Object.values(ontology.interfaceTypes).filter((i2) => i2 instanceof EnhancedInterfaceType).map((interfaceType) => `export {${interfaceType.shortApiName}} from "./interfaces/${interfaceType.shortApiName}${importExt}";`).join("\n")}
|
|
21780
|
+
${Object.keys(ontology.interfaceTypes).length === 0 ? "export {}" : ""}
|
|
21781
|
+
`));
|
|
21782
|
+
}
|
|
21783
|
+
|
|
21784
|
+
// ../generator/build/esm/v2.0/generatePerObjectDataFiles.js
|
|
21785
|
+
init_esm_shims();
|
|
21786
|
+
async function generatePerObjectDataFiles(ctx) {
|
|
21787
|
+
const {
|
|
21788
|
+
fs: fs9,
|
|
21789
|
+
outDir,
|
|
21790
|
+
ontology,
|
|
21791
|
+
importExt
|
|
21792
|
+
} = ctx;
|
|
21793
|
+
await fs9.mkdir(path9__default.join(outDir, "ontology", "objects"), {
|
|
21794
|
+
recursive: true
|
|
21795
|
+
});
|
|
21796
|
+
for (const obj of Object.values(ontology.objectTypes)) {
|
|
21797
|
+
if (obj instanceof ForeignType) continue;
|
|
21798
|
+
const relPath = path9__default.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
|
|
21799
|
+
const outFilePath = path9__default.join(outDir, relPath);
|
|
21800
|
+
await fs9.writeFile(outFilePath, await formatTs(`
|
|
21801
|
+
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
21802
|
+
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
21803
|
+
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
21804
|
+
${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
|
|
21805
|
+
`));
|
|
21806
|
+
}
|
|
21807
|
+
await fs9.writeFile(path9__default.join(outDir, "ontology", "objects.ts"), await formatTs(`
|
|
21808
|
+
${Object.values(ctx.ontology.objectTypes).filter((o) => o instanceof EnhancedObjectType).map((objType) => `export {${objType.shortApiName}} from "./objects/${objType.shortApiName}${importExt}";`).join("\n")}
|
|
21809
|
+
${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
|
|
21810
|
+
`));
|
|
21811
|
+
}
|
|
21812
|
+
|
|
21640
21813
|
// ../generator/build/esm/v2.0/generatePerQueryDataFiles.js
|
|
21641
21814
|
init_esm_shims();
|
|
21642
21815
|
|
|
@@ -21714,7 +21887,7 @@ async function generatePerQueryDataFilesV2({
|
|
|
21714
21887
|
await generateV2QueryFile(fs9, outDir, relOutDir, query, importExt, ontology);
|
|
21715
21888
|
}));
|
|
21716
21889
|
await fs9.writeFile(`${outDir}.ts`, await formatTs(`
|
|
21717
|
-
${Object.values(ontology.queryTypes).map((query) => `export
|
|
21890
|
+
${Object.values(ontology.queryTypes).map((query) => `export {${query.shortApiName}} from "${query.getImportPathRelTo(relOutDir)}";`).join("\n")}
|
|
21718
21891
|
${Object.keys(ontology.queryTypes).length === 0 ? "export {};" : ""}
|
|
21719
21892
|
`));
|
|
21720
21893
|
}
|
|
@@ -21867,219 +22040,69 @@ function getQueryParamType(enhancedOntology, input, type2) {
|
|
|
21867
22040
|
return inner;
|
|
21868
22041
|
}
|
|
21869
22042
|
|
|
21870
|
-
// ../generator/build/esm/v2.0/
|
|
21871
|
-
init_esm_shims();
|
|
21872
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
|
|
21873
|
-
|
|
21874
|
-
// ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
22043
|
+
// ../generator/build/esm/v2.0/generateRootIndexTsFile.js
|
|
21875
22044
|
init_esm_shims();
|
|
21876
|
-
var isProduction = process.env.NODE_ENV === "production";
|
|
21877
|
-
var prefix = "Invariant failed";
|
|
21878
|
-
function invariant(condition, message) {
|
|
21879
|
-
if (isProduction) {
|
|
21880
|
-
throw new Error(prefix);
|
|
21881
|
-
}
|
|
21882
|
-
var provided = typeof message === "function" ? message() : message;
|
|
21883
|
-
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
21884
|
-
throw new Error(value);
|
|
21885
|
-
}
|
|
21886
|
-
|
|
21887
|
-
// ../generator/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js
|
|
21888
|
-
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
|
|
21889
|
-
const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw));
|
|
21890
|
-
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
21891
|
-
const parents = definition.implements?.map((p) => {
|
|
21892
|
-
!(ontology.interfaceTypes[p] != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : invariant() : void 0;
|
|
21893
|
-
const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw));
|
|
21894
|
-
return it;
|
|
21895
|
-
}) ?? [];
|
|
21896
|
-
const mergedProperties = {
|
|
21897
|
-
...definition.properties
|
|
21898
|
-
};
|
|
21899
|
-
for (const parent of parents) {
|
|
21900
|
-
for (const apiName of Object.keys(parent.properties)) {
|
|
21901
|
-
if (definition.properties[apiName] != null) {
|
|
21902
|
-
!(0, import_fast_deep_equal.default)(definition.properties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : invariant() : void 0;
|
|
21903
|
-
} else if (mergedProperties[apiName] != null) {
|
|
21904
|
-
!(0, import_fast_deep_equal.default)(mergedProperties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : invariant() : void 0;
|
|
21905
|
-
}
|
|
21906
|
-
mergedProperties[apiName] = parent.properties[apiName];
|
|
21907
|
-
}
|
|
21908
|
-
}
|
|
21909
|
-
definition.properties;
|
|
21910
|
-
definition.properties = mergedProperties;
|
|
21911
|
-
const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
|
|
21912
|
-
const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
|
|
21913
|
-
const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;
|
|
21914
|
-
const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;
|
|
21915
|
-
const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;
|
|
21916
|
-
const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;
|
|
21917
|
-
const ids = {
|
|
21918
|
-
objectDefIdentifier: interfaceDef.shortApiName,
|
|
21919
|
-
osdkObjectLinksIdentifier,
|
|
21920
|
-
osdkObjectPropsIdentifier,
|
|
21921
|
-
osdkObjectStrictPropsIdentifier,
|
|
21922
|
-
objectSetIdentifier,
|
|
21923
|
-
osdkObjectIdentifier,
|
|
21924
|
-
propertyKeysIdentifier
|
|
21925
|
-
};
|
|
21926
|
-
if (interfaceDef.apiNamespace) {
|
|
21927
|
-
const badProperties = Object.keys(definition.properties).filter((apiName) => extractNamespace(apiName)[0] == null);
|
|
21928
|
-
if (badProperties.length > 0) {
|
|
21929
|
-
throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(", ")}`);
|
|
21930
|
-
}
|
|
21931
|
-
}
|
|
21932
|
-
return `${[].join("\n")}
|
|
21933
|
-
${v2 ? function() {
|
|
21934
|
-
return `import type {
|
|
21935
|
-
InterfaceDefinition as $InterfaceDefinition,
|
|
21936
|
-
ObjectSet as $ObjectSet,
|
|
21937
|
-
Osdk as $Osdk,
|
|
21938
|
-
PropertyValueWireToClient as $PropType,
|
|
21939
|
-
} from "@osdk/api";
|
|
21940
|
-
|
|
21941
|
-
${Object.keys(definition.links).length === 0 ? `export type ${osdkObjectLinksIdentifier} = {};` : `
|
|
21942
|
-
export interface ${osdkObjectLinksIdentifier} {
|
|
21943
|
-
${stringify(definition.links, {
|
|
21944
|
-
"*": (definition2) => {
|
|
21945
|
-
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(v2);
|
|
21946
|
-
return `${definition2.multiplicity ? `${linkTarget}["objectSet"]` : `SingleLinkAccessor<${linkTarget}>`}
|
|
21947
|
-
`;
|
|
21948
|
-
}
|
|
21949
|
-
})}
|
|
21950
|
-
}
|
|
21951
|
-
`}
|
|
21952
|
-
|
|
21953
|
-
export namespace ${interfaceDef.shortApiName} {
|
|
21954
|
-
|
|
21955
|
-
${createPropertyKeys(interfaceDef)}
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
${createProps(interfaceDef, "Props", false)}
|
|
21959
|
-
${createProps(interfaceDef, "StrictProps", true)}
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
${createObjectSet(interfaceDef, ids)}
|
|
21963
|
-
|
|
21964
|
-
${createOsdkObject(interfaceDef, "OsdkObject", ids)}
|
|
21965
|
-
|
|
21966
|
-
}
|
|
21967
|
-
|
|
21968
|
-
${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}
|
|
21969
|
-
|
|
21970
|
-
`;
|
|
21971
|
-
}() : ""}
|
|
21972
|
-
|
|
21973
|
-
export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {
|
|
21974
|
-
type: "interface",
|
|
21975
|
-
apiName: "${interfaceDef.fullApiName}",
|
|
21976
|
-
osdkMetadata: $osdkMetadata,
|
|
21977
|
-
};`;
|
|
21978
|
-
}
|
|
21979
|
-
|
|
21980
|
-
// ../generator/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js
|
|
21981
22045
|
async function generateRootIndexTsFile({
|
|
21982
22046
|
fs: fs9,
|
|
21983
22047
|
outDir,
|
|
21984
22048
|
importExt,
|
|
21985
|
-
ontologyApiNamespace
|
|
22049
|
+
ontologyApiNamespace,
|
|
22050
|
+
ontology
|
|
21986
22051
|
}) {
|
|
21987
|
-
fs9.writeFile(path9__default.join(outDir, "index.ts"), await formatTs(`export
|
|
22052
|
+
fs9.writeFile(path9__default.join(outDir, "index.ts"), await formatTs(`export {${helper(ontology.actionTypes)}} from "./ontology/actions${importExt}";
|
|
21988
22053
|
export * as $Actions from "./ontology/actions${importExt}";
|
|
21989
|
-
export
|
|
22054
|
+
export {${helper(ontology.interfaceTypes)}} from "./ontology/interfaces${importExt}";
|
|
21990
22055
|
export * as $Interfaces from "./ontology/interfaces${importExt}";
|
|
21991
|
-
export
|
|
22056
|
+
export {${helper(ontology.objectTypes)}} from "./ontology/objects${importExt}";
|
|
21992
22057
|
export * as $Objects from "./ontology/objects${importExt}";
|
|
21993
|
-
export
|
|
22058
|
+
export {${helper(ontology.queryTypes)}} from "./ontology/queries${importExt}";
|
|
21994
22059
|
export * as $Queries from "./ontology/queries${importExt}";
|
|
21995
22060
|
${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
|
|
21996
22061
|
`));
|
|
21997
22062
|
}
|
|
21998
|
-
|
|
21999
|
-
|
|
22000
|
-
fs: fs9,
|
|
22001
|
-
outDir,
|
|
22002
|
-
ontology,
|
|
22003
|
-
importExt
|
|
22004
|
-
} = ctx;
|
|
22005
|
-
await fs9.mkdir(path9__default.join(outDir, "ontology", "objects"), {
|
|
22006
|
-
recursive: true
|
|
22007
|
-
});
|
|
22008
|
-
for (const obj of Object.values(ontology.objectTypes)) {
|
|
22009
|
-
const relPath = path9__default.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
|
|
22010
|
-
const outFilePath = path9__default.join(outDir, relPath);
|
|
22011
|
-
await fs9.writeFile(outFilePath, await formatTs(`
|
|
22012
|
-
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
22013
|
-
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
22014
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
22015
|
-
${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
|
|
22016
|
-
`));
|
|
22017
|
-
}
|
|
22063
|
+
function helper(x) {
|
|
22064
|
+
return Object.values(x).filter((x2) => !(x2 instanceof ForeignType)).map((a) => a.shortApiName).join(", ");
|
|
22018
22065
|
}
|
|
22019
|
-
|
|
22066
|
+
|
|
22067
|
+
// ../generator/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js
|
|
22068
|
+
async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs9, outDir, packageType = "commonjs", externalObjects = /* @__PURE__ */ new Map(), externalInterfaces = /* @__PURE__ */ new Map(), externalSpts = /* @__PURE__ */ new Map()) {
|
|
22020
22069
|
const importExt = packageType === "module" ? ".js" : "";
|
|
22021
22070
|
await verifyOutDir(outDir, fs9);
|
|
22022
22071
|
const sanitizedOntology = sanitizeMetadata(ontology);
|
|
22023
22072
|
await fs9.mkdir(outDir, {
|
|
22024
22073
|
recursive: true
|
|
22025
22074
|
});
|
|
22026
|
-
const enhancedOntology = enhanceOntology(
|
|
22075
|
+
const enhancedOntology = enhanceOntology({
|
|
22076
|
+
sanitized: sanitizedOntology,
|
|
22077
|
+
importExt,
|
|
22078
|
+
externalObjects,
|
|
22079
|
+
externalInterfaces,
|
|
22080
|
+
externalSpts
|
|
22081
|
+
});
|
|
22027
22082
|
const ctx = {
|
|
22028
22083
|
sanitizedOntology,
|
|
22029
22084
|
ontology: enhancedOntology,
|
|
22030
22085
|
importExt,
|
|
22031
22086
|
fs: fs9,
|
|
22032
|
-
outDir
|
|
22033
|
-
ontologyApiNamespace,
|
|
22034
|
-
apiNamespacePackageMap
|
|
22087
|
+
outDir
|
|
22035
22088
|
};
|
|
22036
22089
|
await generateRootIndexTsFile(ctx);
|
|
22037
22090
|
await generateOntologyMetadataFile(ctx, userAgent);
|
|
22038
|
-
await
|
|
22039
|
-
await
|
|
22040
|
-
const actionsDir = path9__default.join(outDir, "ontology", "actions");
|
|
22041
|
-
await fs9.mkdir(actionsDir, {
|
|
22042
|
-
recursive: true
|
|
22043
|
-
});
|
|
22091
|
+
await generatePerObjectDataFiles(ctx);
|
|
22092
|
+
await generatePerInterfaceDataFiles(ctx);
|
|
22044
22093
|
await generatePerActionDataFiles(ctx);
|
|
22045
|
-
await fs9.writeFile(path9__default.join(outDir, "ontology", "objects.ts"), await formatTs(`
|
|
22046
|
-
${Object.values(enhancedOntology.objectTypes).map((objType) => `export * from "./objects/${objType.shortApiName}${importExt}";`).join("\n")}
|
|
22047
|
-
${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
|
|
22048
|
-
`));
|
|
22049
22094
|
await generatePerQueryDataFilesV2(ctx);
|
|
22050
22095
|
}
|
|
22051
|
-
async function generateOntologyInterfaces({
|
|
22052
|
-
fs: fs9,
|
|
22053
|
-
outDir,
|
|
22054
|
-
ontology,
|
|
22055
|
-
importExt
|
|
22056
|
-
}) {
|
|
22057
|
-
const interfacesDir = path9__default.join(outDir, "ontology", "interfaces");
|
|
22058
|
-
await fs9.mkdir(interfacesDir, {
|
|
22059
|
-
recursive: true
|
|
22060
|
-
});
|
|
22061
|
-
for (const obj of Object.values(ontology.interfaceTypes)) {
|
|
22062
|
-
await fs9.writeFile(path9__default.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
|
|
22063
|
-
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
22064
|
-
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
22065
|
-
${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
|
|
22066
|
-
`));
|
|
22067
|
-
}
|
|
22068
|
-
await fs9.writeFile(interfacesDir + ".ts", await formatTs(`
|
|
22069
|
-
${Object.values(ontology.interfaceTypes).map((interfaceType) => `export * from "./interfaces/${interfaceType.shortApiName}${importExt}";`).join("\n")}
|
|
22070
|
-
${Object.keys(ontology.interfaceTypes).length === 0 ? "export {}" : ""}
|
|
22071
|
-
`));
|
|
22072
|
-
}
|
|
22073
22096
|
|
|
22074
22097
|
// ../generator/build/esm/generateClientSdkPackage.js
|
|
22075
|
-
async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion,
|
|
22098
|
+
async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, externalObjects = /* @__PURE__ */ new Map(), externalInterfaces = /* @__PURE__ */ new Map()) {
|
|
22076
22099
|
if (!packageName) throw new Error("Package name is required");
|
|
22077
22100
|
if (sdkVersion === "1.1") {
|
|
22078
22101
|
throw new Error("This generator version does not support generating v1 sdks");
|
|
22079
22102
|
}
|
|
22080
22103
|
for (const packageType of ["module", "commonjs"]) {
|
|
22081
22104
|
const outDir = path9.join(baseOutDir, "dist", packageType);
|
|
22082
|
-
generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType,
|
|
22105
|
+
generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, externalObjects, externalInterfaces);
|
|
22083
22106
|
await fs8.promises.mkdir(outDir, {
|
|
22084
22107
|
recursive: true
|
|
22085
22108
|
});
|
|
@@ -22195,12 +22218,12 @@ var symbolClientContext = Symbol("ClientContext");
|
|
|
22195
22218
|
|
|
22196
22219
|
// ../shared.net.platformapi/build/esm/foundryPlatformFetch.js
|
|
22197
22220
|
async function foundryPlatformFetch(client, [httpMethodNum, origPath, flags, contentType, responseContentType], ...args) {
|
|
22198
|
-
const
|
|
22221
|
+
const path21 = origPath.replace(/\{([^}]+)\}/g, () => encodeURIComponent(args.shift()));
|
|
22199
22222
|
const body = flags & 1 ? args.shift() : void 0;
|
|
22200
22223
|
const queryArgs = flags & 2 ? args.shift() : void 0;
|
|
22201
22224
|
const headerArgs = flags & 4 ? args.shift() : void 0;
|
|
22202
22225
|
const method = ["GET", "POST", "PUT", "DELETE", "PATCH"][httpMethodNum];
|
|
22203
|
-
return await apiFetch(client[symbolClientContext] ?? client, method,
|
|
22226
|
+
return await apiFetch(client[symbolClientContext] ?? client, method, path21, body, queryArgs, headerArgs, contentType, responseContentType);
|
|
22204
22227
|
}
|
|
22205
22228
|
async function apiFetch(clientCtx, method, endpointPath, data, queryArguments, headers, requestMediaType, responseMediaType) {
|
|
22206
22229
|
const url2 = new URL(`/api${endpointPath}`, clientCtx.baseUrl);
|
|
@@ -22309,7 +22332,7 @@ init_esm_shims();
|
|
|
22309
22332
|
|
|
22310
22333
|
// ../cli.cmd.typescript/build/esm/generate/handleGenerate.mjs
|
|
22311
22334
|
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal(), 1);
|
|
22312
|
-
var USER_AGENT = `osdk-cli.cmd.typescript/${"0.24.2
|
|
22335
|
+
var USER_AGENT = `osdk-cli.cmd.typescript/${"0.24.2"}`;
|
|
22313
22336
|
async function handleGenerate(args) {
|
|
22314
22337
|
let success = false;
|
|
22315
22338
|
if (args.ontologyPath) {
|
|
@@ -22445,7 +22468,7 @@ async function generateClientSdk(ontology, args) {
|
|
|
22445
22468
|
}
|
|
22446
22469
|
return true;
|
|
22447
22470
|
}
|
|
22448
|
-
await generateClientSdkPackage(args.packageName, args.version, args.beta ? "2.0" : "1.1", args.outDir, ontology, minimalFs, await getDependencyVersions(), "0.24.2
|
|
22471
|
+
await generateClientSdkPackage(args.packageName, args.version, args.beta ? "2.0" : "1.1", args.outDir, ontology, minimalFs, await getDependencyVersions(), "0.24.2", args.externalObjects, args.externalInterfaces);
|
|
22449
22472
|
return true;
|
|
22450
22473
|
} catch (e) {
|
|
22451
22474
|
consola.error("OSDK generation failed", e.message, e.stack);
|
|
@@ -22467,8 +22490,8 @@ async function getDependencyVersions() {
|
|
|
22467
22490
|
const typescriptVersion = ourPackageJson.devDependencies.typescript;
|
|
22468
22491
|
const tslibVersion = ourPackageJson.dependencies.tslib;
|
|
22469
22492
|
const areTheTypesWrongVersion = ourPackageJson.dependencies["@arethetypeswrong/cli"];
|
|
22470
|
-
const osdkClientVersion = `^${"2.0.2
|
|
22471
|
-
const osdkApiVersion = `^${"2.0.2
|
|
22493
|
+
const osdkClientVersion = `^${"2.0.2"}`;
|
|
22494
|
+
const osdkApiVersion = `^${"2.0.2"}`;
|
|
22472
22495
|
const osdkLegacyClientVersion = `^${process.env.PACKAGE_LEGACY_CLIENT_VERSION}`;
|
|
22473
22496
|
return {
|
|
22474
22497
|
typescriptVersion,
|
|
@@ -22492,7 +22515,7 @@ async function getOurPackageJsonPath() {
|
|
|
22492
22515
|
return cachedOurPackageJsonPath = ourPackageJsonPath;
|
|
22493
22516
|
}
|
|
22494
22517
|
async function generateSourceFiles(args, ontology, fs9) {
|
|
22495
|
-
await generateClientSdkVersionTwoPointZero(ontology, getUserAgent(args.version), fs9, args.outDir, args.packageType, args.
|
|
22518
|
+
await generateClientSdkVersionTwoPointZero(ontology, getUserAgent(args.version), fs9, args.outDir, args.packageType, args.externalObjects, args.externalInterfaces);
|
|
22496
22519
|
}
|
|
22497
22520
|
function getUserAgent(version) {
|
|
22498
22521
|
if (version === "dev") {
|
|
@@ -22503,16 +22526,16 @@ function getUserAgent(version) {
|
|
|
22503
22526
|
}
|
|
22504
22527
|
function createNormalFs() {
|
|
22505
22528
|
return {
|
|
22506
|
-
writeFile: (
|
|
22507
|
-
return fs8.promises.writeFile(
|
|
22529
|
+
writeFile: (path21, contents) => {
|
|
22530
|
+
return fs8.promises.writeFile(path21, contents, "utf-8");
|
|
22508
22531
|
},
|
|
22509
|
-
mkdir: async (
|
|
22510
|
-
await fs8.promises.mkdir(
|
|
22532
|
+
mkdir: async (path21, options8) => {
|
|
22533
|
+
await fs8.promises.mkdir(path21, options8);
|
|
22511
22534
|
},
|
|
22512
|
-
readdir: async (
|
|
22535
|
+
readdir: async (path21) => fs8.promises.readdir(path21)
|
|
22513
22536
|
};
|
|
22514
22537
|
}
|
|
22515
22538
|
|
|
22516
22539
|
export { getDependencyVersions, handleGenerate, updateVersionsIfTheyExist };
|
|
22517
|
-
//# sourceMappingURL=handleGenerate-
|
|
22518
|
-
//# sourceMappingURL=handleGenerate-
|
|
22540
|
+
//# sourceMappingURL=handleGenerate-FRYQNME6.js.map
|
|
22541
|
+
//# sourceMappingURL=handleGenerate-FRYQNME6.js.map
|