@osdk/generator 2.0.0-beta.11 → 2.0.0-beta.13
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 +30 -0
- package/build/browser/index.js +45 -158
- package/build/browser/index.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +2 -2
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts +2 -2
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
- package/build/esm/index.js +45 -158
- package/build/esm/index.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/package.json +6 -6
- package/build/esm/shared/getEditedEntities.d.ts +0 -7
- package/build/esm/shared/getEditedEntities.d.ts.map +0 -1
- package/build/esm/shared/wireActionTypeV2ToSdkActionDefinition.d.ts +0 -4
- package/build/esm/shared/wireActionTypeV2ToSdkActionDefinition.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedBase.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhancedBase.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,8BAAsB,kBAAkB;IACtC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC;IAEjC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;gBAGzC,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM;IAqBlB,kBAAkB,aAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"EnhancedBase.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhancedBase.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,8BAAsB,kBAAkB;IACtC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC;IAEjC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;gBAGzC,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM;IAqBlB,kBAAkB,aAAc,MAAM,YAapC;CACH;AAED,8BAAsB,YAAY,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAC9D,GAAG,EAAE,CAAC,CAAC;gBAGL,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,CAAC,EACN,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM;CAWnB;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAChB,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,CAI9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InterfaceMetadata } from "@osdk/api";
|
|
2
2
|
import type { InterfaceType } from "@osdk/internal.foundry.core";
|
|
3
3
|
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
4
4
|
import { EnhancedBase } from "./EnhancedBase.js";
|
|
@@ -8,6 +8,6 @@ export declare class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {
|
|
|
8
8
|
getDefinitionIdentifier(v2: boolean): string;
|
|
9
9
|
getImportedDefinitionIdentifier(v2: boolean): string;
|
|
10
10
|
get properties(): Record<import("@osdk/internal.foundry.core").SharedPropertyTypeApiName, import("@osdk/internal.foundry.core").SharedPropertyType>;
|
|
11
|
-
getCleanedUpDefinition(v2: boolean):
|
|
11
|
+
getCleanedUpDefinition(v2: boolean): InterfaceMetadata<any, any>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=EnhancedInterfaceType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedInterfaceType.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhancedInterfaceType.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"EnhancedInterfaceType.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhancedInterfaceType.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,qBAAa,qBAAsB,SAAQ,YAAY,CAAC,aAAa,CAAC;IAC1B,GAAG,EAAE,aAAa;gBAAhD,MAAM,EAAE,aAAa,EAAS,GAAG,EAAE,aAAa;IAI5D,uBAAuB,CAAC,EAAE,EAAE,OAAO;IAInC,+BAA+B,CAAC,EAAE,EAAE,OAAO;IAI3C,IAAI,UAAU,sIAEb;IAED,sBAAsB,CAAC,EAAE,EAAE,OAAO,GAAG,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC;CAQjE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectMetadata } from "@osdk/api";
|
|
2
2
|
import type { ObjectTypeFullMetadata } from "@osdk/internal.foundry.core";
|
|
3
3
|
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
4
4
|
import { EnhancedBase } from "./EnhancedBase.js";
|
|
@@ -7,6 +7,6 @@ export declare class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetad
|
|
|
7
7
|
constructor(common: EnhanceCommon, raw: ObjectTypeFullMetadata);
|
|
8
8
|
getDefinitionIdentifier(v2: boolean): string;
|
|
9
9
|
getImportedDefinitionIdentifier(v2: boolean): string;
|
|
10
|
-
getCleanedUpDefinition(v2: boolean):
|
|
10
|
+
getCleanedUpDefinition(v2: boolean): ObjectMetadata<any>;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=EnhancedObjectType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedObjectType.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhancedObjectType.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"EnhancedObjectType.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhancedObjectType.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,qBAAa,kBAAmB,SAAQ,YAAY,CAAC,sBAAsB,CAAC;IAChC,GAAG,EAAE,sBAAsB;gBAAzD,MAAM,EAAE,aAAa,EAAS,GAAG,EAAE,sBAAsB;IAIrE,uBAAuB,CAAC,EAAE,EAAE,OAAO;IAInC,+BAA+B,CAAC,EAAE,EAAE,OAAO;IAI3C,sBAAsB,CAAC,EAAE,EAAE,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC;CAQzD"}
|
package/build/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path5 from 'path';
|
|
3
3
|
import path5__default from 'path';
|
|
4
|
-
import { wireQueryTypeV2ToSdkQueryDefinitionNoParams, wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition, __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition,
|
|
4
|
+
import { wireActionTypeV2ToSdkActionMetadata, wireQueryTypeV2ToSdkQueryDefinitionNoParams, wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition, __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectMetadata } from '@osdk/generator-converters';
|
|
5
5
|
import { format } from 'prettier';
|
|
6
6
|
import fastDeepEqual from 'fast-deep-equal';
|
|
7
7
|
import invariant from 'tiny-invariant';
|
|
@@ -28,7 +28,7 @@ var AbstractImportable = class {
|
|
|
28
28
|
}
|
|
29
29
|
getImportPathRelTo = (filePath) => {
|
|
30
30
|
if (this.importPath.startsWith(".")) {
|
|
31
|
-
const result = path5.relative(path5.dirname(filePath), this.importPath);
|
|
31
|
+
const result = path5.relative(path5.dirname(filePath), this.importPath).split(path5.sep).join("/");
|
|
32
32
|
if (result.startsWith(".")) {
|
|
33
33
|
return result;
|
|
34
34
|
} else {
|
|
@@ -116,7 +116,7 @@ var EnhancedObjectType = class extends EnhancedBase {
|
|
|
116
116
|
return this.getDefinitionIdentifier(v2);
|
|
117
117
|
}
|
|
118
118
|
getCleanedUpDefinition(v2) {
|
|
119
|
-
return deleteUndefineds(
|
|
119
|
+
return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(this.raw, v2));
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
|
|
@@ -139,7 +139,7 @@ var EnhancedQuery = class extends EnhancedBase {
|
|
|
139
139
|
return `${this.shortApiName}.Parameters`;
|
|
140
140
|
}
|
|
141
141
|
get definitionIdentifier() {
|
|
142
|
-
return `${this.shortApiName}
|
|
142
|
+
return `${this.shortApiName}`;
|
|
143
143
|
}
|
|
144
144
|
get definitionParamsIdentifier() {
|
|
145
145
|
return `${this.definitionIdentifier}$Params`;
|
|
@@ -296,94 +296,6 @@ function getObjectImports(objects, curApiName, currentFilePath, v2) {
|
|
|
296
296
|
}).join("\n");
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
// src/shared/getEditedEntities.ts
|
|
300
|
-
function getModifiedEntityTypes(action) {
|
|
301
|
-
const addedObjects = /* @__PURE__ */ new Set();
|
|
302
|
-
const modifiedObjects = /* @__PURE__ */ new Set();
|
|
303
|
-
for (const operation of action.operations) {
|
|
304
|
-
switch (operation.type) {
|
|
305
|
-
case "createObject":
|
|
306
|
-
addedObjects.add(operation.objectTypeApiName);
|
|
307
|
-
break;
|
|
308
|
-
case "modifyObject":
|
|
309
|
-
modifiedObjects.add(operation.objectTypeApiName);
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return {
|
|
314
|
-
addedObjects,
|
|
315
|
-
modifiedObjects
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// src/shared/wireActionTypeV2ToSdkActionDefinition.ts
|
|
320
|
-
function wireActionTypeV2ToSdkActionDefinition(input) {
|
|
321
|
-
const modifiedEntityTypes = getModifiedEntityTypes(input);
|
|
322
|
-
return {
|
|
323
|
-
type: "action",
|
|
324
|
-
apiName: input.apiName,
|
|
325
|
-
parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),
|
|
326
|
-
displayName: input.displayName,
|
|
327
|
-
description: input.description,
|
|
328
|
-
modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
function wireActionParameterV2ToSdkParameterDefinition(value) {
|
|
332
|
-
return {
|
|
333
|
-
multiplicity: value.dataType.type === "array",
|
|
334
|
-
type: actionPropertyToSdkPropertyDefinition(value.dataType.type === "array" ? value.dataType.subType : value.dataType),
|
|
335
|
-
nullable: !value.required,
|
|
336
|
-
description: value.description
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
function actionPropertyToSdkPropertyDefinition(parameterType) {
|
|
340
|
-
switch (parameterType.type) {
|
|
341
|
-
case "string":
|
|
342
|
-
case "boolean":
|
|
343
|
-
case "attachment":
|
|
344
|
-
case "double":
|
|
345
|
-
case "integer":
|
|
346
|
-
case "long":
|
|
347
|
-
case "timestamp":
|
|
348
|
-
case "marking":
|
|
349
|
-
return parameterType.type;
|
|
350
|
-
case "date":
|
|
351
|
-
return "datetime";
|
|
352
|
-
case "objectSet":
|
|
353
|
-
return {
|
|
354
|
-
type: "objectSet",
|
|
355
|
-
objectSet: parameterType.objectTypeApiName
|
|
356
|
-
};
|
|
357
|
-
case "object":
|
|
358
|
-
return {
|
|
359
|
-
type: "object",
|
|
360
|
-
object: parameterType.objectTypeApiName
|
|
361
|
-
};
|
|
362
|
-
case "array":
|
|
363
|
-
return actionPropertyToSdkPropertyDefinition(parameterType.subType);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
function createModifiedEntities(addedObjects, modifiedObjects) {
|
|
367
|
-
let entities = {};
|
|
368
|
-
for (const key of addedObjects) {
|
|
369
|
-
entities[key] = {
|
|
370
|
-
created: true,
|
|
371
|
-
modified: false
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
for (const key of modifiedObjects) {
|
|
375
|
-
if (entities[key]) {
|
|
376
|
-
entities[key].modified = true;
|
|
377
|
-
} else {
|
|
378
|
-
entities[key] = {
|
|
379
|
-
created: false,
|
|
380
|
-
modified: true
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return entities;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
299
|
// src/util/stringify.ts
|
|
388
300
|
var defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatter) => {
|
|
389
301
|
return [defaultKeyFormatter(key), defaultValueFormatter(value)];
|
|
@@ -464,7 +376,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
464
376
|
}, currentFilePath) {
|
|
465
377
|
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
466
378
|
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
467
|
-
const definition = deleteUndefineds(
|
|
379
|
+
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));
|
|
468
380
|
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
469
381
|
const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
|
|
470
382
|
const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
|
|
@@ -484,7 +396,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
484
396
|
function getV2Types() {
|
|
485
397
|
return `import type {
|
|
486
398
|
ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
|
|
487
|
-
|
|
399
|
+
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
488
400
|
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
489
401
|
} from "@osdk/api";
|
|
490
402
|
import type {
|
|
@@ -602,8 +514,6 @@ function createDefinition(object, ontology, identifier, {
|
|
|
602
514
|
linksType: ${osdkObjectLinksIdentifier};
|
|
603
515
|
strictProps: ${osdkObjectStrictPropsIdentifier};
|
|
604
516
|
${stringify(definition, {
|
|
605
|
-
osdkMetadata: () => void 0,
|
|
606
|
-
// we are going to reference another object instead
|
|
607
517
|
links: (_value) => `{
|
|
608
518
|
${stringify(definition.links, {
|
|
609
519
|
"*": (definition2) => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true)}, ${definition2.multiplicity}>`
|
|
@@ -657,7 +567,7 @@ async function generatePerActionDataFiles({
|
|
|
657
567
|
const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.raw);
|
|
658
568
|
const uniqueApiNames = new Set(uniqueApiNamesArray);
|
|
659
569
|
const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
|
|
660
|
-
const fullActionDef = deleteUndefineds(
|
|
570
|
+
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionMetadata(action.raw));
|
|
661
571
|
function createParamsDef() {
|
|
662
572
|
const entries = Object.entries(fullActionDef.parameters ?? {});
|
|
663
573
|
entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
@@ -734,7 +644,7 @@ async function generatePerActionDataFiles({
|
|
|
734
644
|
|
|
735
645
|
${jsDocBlock.join("\n")}
|
|
736
646
|
*/
|
|
737
|
-
export interface ${action.shortApiName} extends
|
|
647
|
+
export interface ${action.shortApiName} extends ActionDefinition<"${action.fullApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures> {
|
|
738
648
|
__DefinitionMetadata?: {
|
|
739
649
|
${stringify(fullActionDef, {
|
|
740
650
|
"parameters": () => action.definitionParamsIdentifier
|
|
@@ -746,7 +656,9 @@ async function generatePerActionDataFiles({
|
|
|
746
656
|
"description": () => void 0,
|
|
747
657
|
"displayName": () => void 0,
|
|
748
658
|
"modifiedEntities": () => void 0,
|
|
749
|
-
"parameters": () => void 0
|
|
659
|
+
"parameters": () => void 0,
|
|
660
|
+
"rid": () => void 0,
|
|
661
|
+
"status": () => void 0
|
|
750
662
|
})}
|
|
751
663
|
osdkMetadata: typeof $osdkMetadata;
|
|
752
664
|
}
|
|
@@ -759,7 +671,9 @@ async function generatePerActionDataFiles({
|
|
|
759
671
|
"description": () => void 0,
|
|
760
672
|
"displayName": () => void 0,
|
|
761
673
|
"modifiedEntities": () => void 0,
|
|
762
|
-
"parameters": () => void 0
|
|
674
|
+
"parameters": () => void 0,
|
|
675
|
+
"rid": () => void 0,
|
|
676
|
+
"status": () => void 0
|
|
763
677
|
})},
|
|
764
678
|
osdkMetadata: $osdkMetadata
|
|
765
679
|
}
|
|
@@ -786,7 +700,7 @@ async function generatePerActionDataFiles({
|
|
|
786
700
|
}
|
|
787
701
|
const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
|
|
788
702
|
await fs2.writeFile(path5__default.join(rootOutDir, currentFilePath), await formatTs(`
|
|
789
|
-
import type {
|
|
703
|
+
import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
|
|
790
704
|
import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
|
|
791
705
|
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
792
706
|
${imports}
|
|
@@ -931,9 +845,10 @@ async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ont
|
|
|
931
845
|
const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));
|
|
932
846
|
const referencedObjectTypes = objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never";
|
|
933
847
|
await fs2.writeFile(path5__default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
|
|
934
|
-
import type {
|
|
848
|
+
import type { QueryDefinition , VersionBound} from "@osdk/api";
|
|
935
849
|
import type { QueryParam, QueryResult } from "@osdk/client.api";
|
|
936
850
|
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
851
|
+
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
937
852
|
${importObjects}
|
|
938
853
|
|
|
939
854
|
export namespace ${query.shortApiName} {
|
|
@@ -959,12 +874,17 @@ async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ont
|
|
|
959
874
|
|
|
960
875
|
` : ""}
|
|
961
876
|
|
|
962
|
-
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
export interface ${query.shortApiName} extends QueryDefinition<
|
|
963
882
|
"${query.fullApiName}",
|
|
964
883
|
${referencedObjectTypes},
|
|
965
884
|
${query.shortApiName}.Signature
|
|
966
885
|
>, VersionBound<$ExpectedClientVersion>{
|
|
967
|
-
|
|
886
|
+
__DefinitionMetadata?: {
|
|
887
|
+
${stringify(baseProps)}
|
|
968
888
|
parameters: {
|
|
969
889
|
${parameterDefsForType(ontology, query)}
|
|
970
890
|
};
|
|
@@ -972,33 +892,27 @@ async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ont
|
|
|
972
892
|
${stringify(outputBase)},
|
|
973
893
|
${getLineFor__OsdkTargetType(ontology, query.output)}
|
|
974
894
|
};
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
895
|
+
signature: ${query.shortApiName}.Signature;
|
|
896
|
+
},
|
|
897
|
+
${stringify(baseProps, {
|
|
898
|
+
"description": () => void 0,
|
|
899
|
+
"displayName": () => void 0,
|
|
900
|
+
"rid": () => void 0
|
|
901
|
+
})},
|
|
902
|
+
osdkMetadata: typeof $osdkMetadata;
|
|
903
|
+
}
|
|
984
904
|
|
|
985
905
|
|
|
986
906
|
export const ${query.shortApiName}: ${query.definitionIdentifier} = {
|
|
987
|
-
${stringify(baseProps
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
}
|
|
907
|
+
${stringify(baseProps, {
|
|
908
|
+
"description": () => void 0,
|
|
909
|
+
"displayName": () => void 0,
|
|
910
|
+
"rid": () => void 0
|
|
911
|
+
})},
|
|
912
|
+
osdkMetadata: $osdkMetadata
|
|
994
913
|
};
|
|
995
914
|
`));
|
|
996
915
|
}
|
|
997
|
-
function parametersForConst(query) {
|
|
998
|
-
return stringify(query.parameters, {
|
|
999
|
-
"*": (parameter, formatter) => formatter(deleteUndefineds(wireQueryParameterV2ToQueryParameterDefinition(parameter)))
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
916
|
function parameterDefsForType(ontology, query) {
|
|
1003
917
|
return stringify(query.parameters, {
|
|
1004
918
|
"*": (parameter, valueFormatter, apiName) => [`${queryParamJsDoc(wireQueryParameterV2ToQueryParameterDefinition(parameter), {
|
|
@@ -1095,13 +1009,6 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
|
|
|
1095
1009
|
}
|
|
1096
1010
|
definition.properties;
|
|
1097
1011
|
definition.properties = mergedProperties;
|
|
1098
|
-
function maybeStripNamespace2(q) {
|
|
1099
|
-
if (interfaceDef.apiNamespace && q.startsWith(`${interfaceDef.apiNamespace}.`)) {
|
|
1100
|
-
return q.slice(interfaceDef.apiNamespace.length + 1);
|
|
1101
|
-
} else {
|
|
1102
|
-
return q;
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
1012
|
const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
|
|
1106
1013
|
const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
|
|
1107
1014
|
const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;
|
|
@@ -1109,7 +1016,7 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
|
|
|
1109
1016
|
const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;
|
|
1110
1017
|
const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;
|
|
1111
1018
|
const ids = {
|
|
1112
|
-
objectDefIdentifier:
|
|
1019
|
+
objectDefIdentifier: interfaceDef.shortApiName,
|
|
1113
1020
|
osdkObjectLinksIdentifier,
|
|
1114
1021
|
osdkObjectPropsIdentifier,
|
|
1115
1022
|
osdkObjectStrictPropsIdentifier,
|
|
@@ -1153,20 +1060,11 @@ ${stringify(definition.links, {
|
|
|
1153
1060
|
|
|
1154
1061
|
${createObjectSet(interfaceDef, ids)}
|
|
1155
1062
|
|
|
1156
|
-
${createDefinition(interfaceDef, ontology, "Definition", ids)}
|
|
1157
|
-
|
|
1158
1063
|
${createOsdkObject(interfaceDef, "OsdkObject", ids)}
|
|
1159
1064
|
|
|
1160
1065
|
}
|
|
1161
1066
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
/** @deprecated use ${interfaceDef.shortApiName}.Definition **/
|
|
1166
|
-
export type ${objectDefIdentifier} = ${interfaceDef.shortApiName}.Definition;
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1067
|
+
${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}
|
|
1170
1068
|
|
|
1171
1069
|
`;
|
|
1172
1070
|
}
|
|
@@ -1174,22 +1072,11 @@ ${stringify(definition.links, {
|
|
|
1174
1072
|
return `${imports.join("\n")}
|
|
1175
1073
|
${v2 ? getV2Types() : ""}
|
|
1176
1074
|
|
|
1177
|
-
export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName}
|
|
1075
|
+
export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {
|
|
1076
|
+
type: "interface",
|
|
1077
|
+
apiName: "${interfaceDef.fullApiName}",
|
|
1178
1078
|
osdkMetadata: $osdkMetadata,
|
|
1179
|
-
|
|
1180
|
-
props: undefined as any,
|
|
1181
|
-
linksType: undefined as any,
|
|
1182
|
-
strictProps: undefined as any,
|
|
1183
|
-
${stringify(definition, {
|
|
1184
|
-
osdkMetadata: () => void 0,
|
|
1185
|
-
properties: (properties) => `{
|
|
1186
|
-
${stringify(properties, {
|
|
1187
|
-
"*": (propertyDefinition, _, key) => [`"${maybeStripNamespace2(key)}"`, _(propertyDefinition)]
|
|
1188
|
-
})}
|
|
1189
|
-
}`
|
|
1190
|
-
})}
|
|
1191
|
-
|
|
1192
|
-
};`;
|
|
1079
|
+
};`;
|
|
1193
1080
|
}
|
|
1194
1081
|
|
|
1195
1082
|
// src/v2.0/generateClientSdkVersionTwoPointZero.ts
|