@osdk/generator 2.0.0-beta.6 → 2.0.0-beta.8

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/build/browser/index.js +92 -152
  3. package/build/browser/index.js.map +1 -1
  4. package/build/cjs/GenerateContext/EnhancedAction.d.cts +5 -5
  5. package/build/cjs/GenerateContext/EnhancedAction.d.ts.map +1 -1
  6. package/build/cjs/GenerateContext/EnhancedBase.d.cts +2 -2
  7. package/build/cjs/GenerateContext/EnhancedBase.d.ts.map +1 -1
  8. package/build/cjs/GenerateContext/EnhancedInterfaceType.d.cts +4 -4
  9. package/build/cjs/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
  10. package/build/cjs/GenerateContext/EnhancedObjectType.d.cts +3 -3
  11. package/build/cjs/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
  12. package/build/cjs/GenerateContext/EnhancedOntologyDefinition.d.cts +7 -7
  13. package/build/cjs/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
  14. package/build/cjs/GenerateContext/EnhancedQuery.d.cts +5 -5
  15. package/build/cjs/GenerateContext/EnhancedQuery.d.ts.map +1 -1
  16. package/build/cjs/GenerateContext/EnhancedSharedPropertyType.d.cts +3 -3
  17. package/build/cjs/GenerateContext/EnhancedSharedPropertyType.d.ts.map +1 -1
  18. package/build/cjs/WireOntologyDefinition.d.cts +2 -2
  19. package/build/cjs/WireOntologyDefinition.d.ts.map +1 -1
  20. package/build/cjs/index.cjs +92 -153
  21. package/build/cjs/index.cjs.map +1 -1
  22. package/build/cjs/shared/getEditedEntities.d.cts +1 -1
  23. package/build/cjs/shared/getEditedEntities.d.ts.map +1 -1
  24. package/build/cjs/shared/getObjectImports.d.ts.map +1 -1
  25. package/build/cjs/shared/getObjectTypeApiNamesFromQuery.d.cts +1 -1
  26. package/build/cjs/shared/getObjectTypeApiNamesFromQuery.d.ts.map +1 -1
  27. package/build/cjs/shared/getObjectTypesFromQueryDataType.d.cts +1 -1
  28. package/build/cjs/shared/getObjectTypesFromQueryDataType.d.ts.map +1 -1
  29. package/build/cjs/shared/isNullableQueryDataType.d.cts +1 -1
  30. package/build/cjs/shared/isNullableQueryDataType.d.ts.map +1 -1
  31. package/build/cjs/shared/wireActionTypeV2ToSdkActionDefinition.d.cts +1 -1
  32. package/build/cjs/shared/wireActionTypeV2ToSdkActionDefinition.d.ts.map +1 -1
  33. package/build/cjs/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.cts +1 -1
  34. package/build/cjs/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -1
  35. package/build/cjs/shared/wireQueryTypeV2ToSdkQueryDefinition.d.cts +4 -4
  36. package/build/cjs/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts.map +1 -1
  37. package/build/cjs/util/test/TodoWireOntology.d.cts +14 -0
  38. package/build/cjs/util/test/TodoWireOntology.d.ts.map +1 -1
  39. package/build/cjs/util/test/formatTs.d.ts.map +1 -1
  40. package/build/cjs/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  41. package/build/cjs/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
  42. package/build/cjs/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  43. package/build/cjs/v2.0/getDescriptionIfPresent.d.cts +2 -0
  44. package/build/cjs/v2.0/getDescriptionIfPresent.d.ts.map +1 -0
  45. package/build/cjs/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  46. package/build/esm/GenerateContext/EnhancedAction.d.ts +5 -5
  47. package/build/esm/GenerateContext/EnhancedAction.d.ts.map +1 -1
  48. package/build/esm/GenerateContext/EnhancedBase.d.ts +2 -2
  49. package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
  50. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +4 -4
  51. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
  52. package/build/esm/GenerateContext/EnhancedObjectType.d.ts +3 -3
  53. package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
  54. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +7 -7
  55. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
  56. package/build/esm/GenerateContext/EnhancedQuery.d.ts +5 -5
  57. package/build/esm/GenerateContext/EnhancedQuery.d.ts.map +1 -1
  58. package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts +3 -3
  59. package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts.map +1 -1
  60. package/build/esm/WireOntologyDefinition.d.ts +2 -2
  61. package/build/esm/WireOntologyDefinition.d.ts.map +1 -1
  62. package/build/esm/index.js +92 -152
  63. package/build/esm/index.js.map +1 -1
  64. package/build/esm/shared/getEditedEntities.d.ts +1 -1
  65. package/build/esm/shared/getEditedEntities.d.ts.map +1 -1
  66. package/build/esm/shared/getObjectImports.d.ts.map +1 -1
  67. package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts +1 -1
  68. package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts.map +1 -1
  69. package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts +1 -1
  70. package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts.map +1 -1
  71. package/build/esm/shared/isNullableQueryDataType.d.ts +1 -1
  72. package/build/esm/shared/isNullableQueryDataType.d.ts.map +1 -1
  73. package/build/esm/shared/wireActionTypeV2ToSdkActionDefinition.d.ts +1 -1
  74. package/build/esm/shared/wireActionTypeV2ToSdkActionDefinition.d.ts.map +1 -1
  75. package/build/esm/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +1 -1
  76. package/build/esm/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -1
  77. package/build/esm/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts +4 -4
  78. package/build/esm/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts.map +1 -1
  79. package/build/esm/util/test/TodoWireOntology.d.ts +14 -0
  80. package/build/esm/util/test/TodoWireOntology.d.ts.map +1 -1
  81. package/build/esm/util/test/formatTs.d.ts.map +1 -1
  82. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  83. package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
  84. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  85. package/build/esm/v2.0/getDescriptionIfPresent.d.ts +2 -0
  86. package/build/esm/v2.0/getDescriptionIfPresent.d.ts.map +1 -0
  87. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  88. package/package.json +6 -7
  89. package/build/cjs/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.cts +0 -4
  90. package/build/cjs/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts.map +0 -1
  91. package/build/esm/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts +0 -4
  92. package/build/esm/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts.map +0 -1
@@ -4,7 +4,6 @@ var fs = require('fs');
4
4
  var path5 = require('path');
5
5
  var generatorConverters = require('@osdk/generator-converters');
6
6
  var prettier = require('prettier');
7
- var organizeImports = require('prettier-plugin-organize-imports');
8
7
  var fastDeepEqual = require('fast-deep-equal');
9
8
  var invariant = require('tiny-invariant');
10
9
 
@@ -30,7 +29,6 @@ function _interopNamespace(e) {
30
29
 
31
30
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
32
31
  var path5__namespace = /*#__PURE__*/_interopNamespace(path5);
33
- var organizeImports__default = /*#__PURE__*/_interopDefault(organizeImports);
34
32
  var fastDeepEqual__default = /*#__PURE__*/_interopDefault(fastDeepEqual);
35
33
  var invariant__default = /*#__PURE__*/_interopDefault(invariant);
36
34
 
@@ -68,9 +66,9 @@ var AbstractImportable = class {
68
66
  };
69
67
  };
70
68
  var EnhancedBase = class extends AbstractImportable {
71
- constructor(common, og, fullApiName, basePath) {
69
+ constructor(common, raw, fullApiName, basePath) {
72
70
  super(common, fullApiName, basePath);
73
- this.og = og;
71
+ this.raw = raw;
74
72
  if (!this.isLocal && !this.sourcePackage) {
75
73
  throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);
76
74
  }
@@ -84,18 +82,18 @@ function extractNamespace(fqApiName) {
84
82
 
85
83
  // src/GenerateContext/EnhancedAction.ts
86
84
  var EnhancedAction = class extends EnhancedBase {
87
- constructor(common, og) {
88
- super(common, og, og.apiName, "./ontology/actions");
89
- this.og = og;
85
+ constructor(common, raw) {
86
+ super(common, raw, raw.apiName, "./ontology/actions");
87
+ this.raw = raw;
90
88
  }
91
89
  get description() {
92
- return this.og.description;
90
+ return this.raw.description;
93
91
  }
94
92
  get parameters() {
95
- return this.og.parameters;
93
+ return this.raw.parameters;
96
94
  }
97
95
  get operations() {
98
- return this.og.operations;
96
+ return this.raw.operations;
99
97
  }
100
98
  get paramsIdentifier() {
101
99
  return `${this.shortApiName}.Params`;
@@ -115,9 +113,9 @@ function deleteUndefineds(obj) {
115
113
 
116
114
  // src/GenerateContext/EnhancedInterfaceType.ts
117
115
  var EnhancedInterfaceType = class extends EnhancedBase {
118
- constructor(common, og) {
119
- super(common, og, og.apiName, "./ontology/interfaces");
120
- this.og = og;
116
+ constructor(common, raw) {
117
+ super(common, raw, raw.apiName, "./ontology/interfaces");
118
+ this.raw = raw;
121
119
  }
122
120
  getDefinitionIdentifier(v2) {
123
121
  return v2 ? this.shortApiName : `${this.shortApiName}Def`;
@@ -126,16 +124,16 @@ var EnhancedInterfaceType = class extends EnhancedBase {
126
124
  return this.getDefinitionIdentifier(v2);
127
125
  }
128
126
  get properties() {
129
- return this.og.properties;
127
+ return this.raw.properties;
130
128
  }
131
129
  getCleanedUpDefinition(v2) {
132
- return deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.og, v2));
130
+ return deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2));
133
131
  }
134
132
  };
135
133
  var EnhancedObjectType = class extends EnhancedBase {
136
- constructor(common, og) {
137
- super(common, og, og.objectType.apiName, "./ontology/objects");
138
- this.og = og;
134
+ constructor(common, raw) {
135
+ super(common, raw, raw.objectType.apiName, "./ontology/objects");
136
+ this.raw = raw;
139
137
  }
140
138
  getDefinitionIdentifier(v2) {
141
139
  return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;
@@ -144,24 +142,24 @@ var EnhancedObjectType = class extends EnhancedBase {
144
142
  return this.getDefinitionIdentifier(v2);
145
143
  }
146
144
  getCleanedUpDefinition(v2) {
147
- return deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.og, v2));
145
+ return deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.raw, v2));
148
146
  }
149
147
  };
150
148
 
151
149
  // src/GenerateContext/EnhancedQuery.ts
152
150
  var EnhancedQuery = class extends EnhancedBase {
153
- constructor(common, og) {
154
- super(common, og, og.apiName, "./ontology/queries");
155
- this.og = og;
151
+ constructor(common, raw) {
152
+ super(common, raw, raw.apiName, "./ontology/queries");
153
+ this.raw = raw;
156
154
  }
157
155
  get description() {
158
- return this.og.description;
156
+ return this.raw.description;
159
157
  }
160
158
  get parameters() {
161
- return this.og.parameters;
159
+ return this.raw.parameters;
162
160
  }
163
161
  get output() {
164
- return this.og.output;
162
+ return this.raw.output;
165
163
  }
166
164
  get paramsIdentifier() {
167
165
  return `${this.shortApiName}.Parameters`;
@@ -176,9 +174,9 @@ var EnhancedQuery = class extends EnhancedBase {
176
174
 
177
175
  // src/GenerateContext/EnhancedSharedPropertyType.ts
178
176
  var EnhancedSharedPropertyType = class extends EnhancedBase {
179
- constructor(common, og) {
180
- super(common, og, og.apiName, "./ontology/interfaces");
181
- this.og = og;
177
+ constructor(common, raw) {
178
+ super(common, raw, raw.apiName, "./ontology/interfaces");
179
+ this.raw = raw;
182
180
  }
183
181
  };
184
182
 
@@ -203,20 +201,21 @@ var ForeignType = class extends AbstractImportable {
203
201
 
204
202
  // src/GenerateContext/EnhancedOntologyDefinition.ts
205
203
  var EnhancedOntologyDefinition = class {
206
- constructor(original, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
204
+ #foreignTypes = {};
205
+ constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
207
206
  this.common = {
208
207
  apiNamespacePackageMap,
209
208
  enhancedOntology: this,
210
209
  importExt,
211
210
  ontologyApiNamespace
212
211
  };
213
- this.og = original;
214
- this.ontology = original.ontology;
215
- this.objectTypes = remap(original.objectTypes, this.common, EnhancedObjectType);
216
- this.actionTypes = remap(original.actionTypes, this.common, EnhancedAction);
217
- this.queryTypes = remap(original.queryTypes, this.common, EnhancedQuery);
218
- this.interfaceTypes = remap(original.interfaceTypes, this.common, EnhancedInterfaceType);
219
- this.sharedPropertyTypes = remap(original.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
212
+ this.raw = raw;
213
+ this.ontology = raw.ontology;
214
+ this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);
215
+ this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);
216
+ this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);
217
+ this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);
218
+ this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
220
219
  }
221
220
  #createRequireType = (type) => {
222
221
  return (fullApiName, localOnly) => {
@@ -229,7 +228,9 @@ var EnhancedOntologyDefinition = class {
229
228
  if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
230
229
  throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);
231
230
  }
232
- return new ForeignType(this.common, type, apiNamespace, shortApiName);
231
+ const ret2 = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);
232
+ this.#foreignTypes[fullApiName] = ret2;
233
+ return ret2;
233
234
  }
234
235
  return ret;
235
236
  };
@@ -272,7 +273,6 @@ function formatTs(contents) {
272
273
  parser: "typescript",
273
274
  singleQuote: true,
274
275
  trailingComma: "all",
275
- plugins: [organizeImports__default.default],
276
276
  tabWidth: 2,
277
277
  printWidth: 120
278
278
  });
@@ -315,7 +315,10 @@ async function generateOntologyMetadataFile({
315
315
  // src/shared/getObjectImports.ts
316
316
  function getObjectImports(objects, curApiName, currentFilePath, v2) {
317
317
  return Array.from(objects).filter((obj) => obj.fullApiName !== curApiName).map((obj) => {
318
- return `import type { ${obj.getDefinitionIdentifier(v2)} as ${obj.getImportedDefinitionIdentifier(v2)} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
318
+ const defId = obj.getDefinitionIdentifier(v2);
319
+ const importedId = obj.getImportedDefinitionIdentifier(v2);
320
+ const nameOrAlias = defId === importedId ? defId : `${defId} as ${importedId}`;
321
+ return `import type { ${nameOrAlias} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
319
322
  }).join("\n");
320
323
  }
321
324
 
@@ -438,7 +441,7 @@ function stringUnionFrom(values) {
438
441
  }
439
442
  }
440
443
 
441
- // src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts
444
+ // src/v2.0/getDescriptionIfPresent.ts
442
445
  function getDescriptionIfPresent(description, includeNewline) {
443
446
  if (description) {
444
447
  return `/**
@@ -487,7 +490,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
487
490
  }, currentFilePath) {
488
491
  const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
489
492
  const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
490
- const definition = deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.og, true));
493
+ const definition = deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.raw, true));
491
494
  const objectDefIdentifier = object.getDefinitionIdentifier(true);
492
495
  const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
493
496
  const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
@@ -496,7 +499,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
496
499
  const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
497
500
  const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
498
501
  const identifiers = {
499
- objectDefIdentifier: `${object.shortApiName}.Definition`,
502
+ objectDefIdentifier: `${object.shortApiName}`,
500
503
  osdkObjectLinksIdentifier,
501
504
  osdkObjectPropsIdentifier,
502
505
  osdkObjectStrictPropsIdentifier,
@@ -506,42 +509,18 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
506
509
  };
507
510
  function getV2Types() {
508
511
  return `import type {
509
- AggregateOpts as $AggregateOpts,
510
- AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy as $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,
511
- AggregationsResults as $AggregationsResults,
512
- Augments as $Augments,
513
- ConvertProps as $ConvertProps,
514
- DefaultToFalse as $DefaultToFalse,
515
- FetchPageArgs as $FetchPageArgs,
516
- FetchPageResult as $FetchPageResult,
517
- IsAny as $IsAny,
518
- LinkedType as $LinkedType,
519
- LinkNames as $LinkNames,
520
- NullabilityAdherence as $NullabilityAdherence,
521
- NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
512
+ ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
513
+ ObjectTypeDefinition as $ObjectTypeDefinition,
514
+ ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
515
+ } from "@osdk/api";
516
+ import type {
522
517
  ObjectSet as $ObjectSet,
523
518
  Osdk as $Osdk,
524
519
  OsdkObject as $OsdkObject,
525
- OsdkObjectLinksEntry as $OsdkObjectLinksEntry,
526
- OsdkObjectLinksObject as $OsdkObjectLinksObject,
527
- OsdkObjectPropertyType as $OsdkObjectPropertyType,
528
- PageResult as $PageResult,
529
- PropertyValueClientToWire as $PropertyValueClientToWire,
530
520
  PropertyValueWireToClient as $PropType,
531
- Result as $Result,
532
- SelectArg as $SelectArg,
533
521
  SingleLinkAccessor as $SingleLinkAccessor,
534
- SingleLinkAccessor as $SingleLinkAccessor
535
- SingleOsdkResult as $SingleOsdkResult,
536
- ValidToFrom as $ValidToFrom,
537
- WhereClause as $WhereClause,
538
522
  } from "@osdk/client.api";
539
- import type * as $clientApi from "@osdk/client.api";
540
- import type {
541
- ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
542
- ObjectTypeDefinition as $ObjectTypeDefinition,
543
- ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
544
- } from "@osdk/api";
523
+
545
524
 
546
525
  export namespace ${object.shortApiName} {
547
526
 
@@ -554,16 +533,15 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
554
533
  ${createProps(object, "StrictProps", true)}
555
534
 
556
535
  ${createObjectSet(object, identifiers)}
557
-
558
- ${createDefinition(object, ontology, "Definition", identifiers)}
536
+
559
537
  ${createOsdkObject(object, "OsdkObject", identifiers)}
560
538
  }
561
539
 
562
540
 
563
541
 
564
-
542
+ ${createDefinition(object, ontology, object.shortApiName, identifiers)}
543
+
565
544
 
566
- export type ${objectDefIdentifier} = ${object.shortApiName}.Definition;
567
545
 
568
546
 
569
547
  `;
@@ -685,7 +663,7 @@ function createLinks(ontology, object, identifier) {
685
663
  ${stringify(definition.links, {
686
664
  "*": (definition2, _, key) => {
687
665
  const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true);
688
- return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}.Definition>`}
666
+ return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}>`}
689
667
  `];
690
668
  }
691
669
  })}
@@ -710,10 +688,10 @@ async function generatePerActionDataFiles({
710
688
  });
711
689
  await Promise.all(Object.values(enhancedOntology.actionTypes).map(async (action) => {
712
690
  const currentFilePath = `${path5__namespace.default.join("ontology", "actions", `${action.shortApiName}.ts`)}`;
713
- const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.og);
691
+ const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.raw);
714
692
  const uniqueApiNames = new Set(uniqueApiNamesArray);
715
693
  const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
716
- const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.og));
694
+ const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.raw));
717
695
  const {
718
696
  parameters,
719
697
  ...actionDefSansParameters
@@ -737,9 +715,9 @@ async function generatePerActionDataFiles({
737
715
  return JSON.stringify(type);
738
716
  } else if (type.type === "object") {
739
717
  const obj = enhancedOntology.requireObjectType(type.object);
740
- return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}.Definition>`;
718
+ return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}>`;
741
719
  } else if (type.type === "objectSet") {
742
- return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}.Definition>`;
720
+ return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}>`;
743
721
  }
744
722
  return void 0;
745
723
  }
@@ -752,13 +730,17 @@ async function generatePerActionDataFiles({
752
730
  if (typeof input === "string") {
753
731
  return `ActionParam.PrimitiveType<${JSON.stringify(input)}>`;
754
732
  } else if (input.type === "object") {
755
- return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}.Definition>`;
733
+ return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
756
734
  } else if (input.type === "objectSet") {
757
- return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}.Definition>`;
735
+ return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
758
736
  }
759
737
  }
760
738
  function createV2Types() {
761
- const oldParamsIdentifier = `${action.shortApiName}$Params`;
739
+ `${action.shortApiName}$Params`;
740
+ let jsDocBlock = ["/**"];
741
+ if (action.description != null) {
742
+ jsDocBlock.push(`* ${action.description}`);
743
+ }
762
744
  return `
763
745
 
764
746
  export namespace ${action.shortApiName}{
@@ -771,12 +753,11 @@ async function generatePerActionDataFiles({
771
753
  const key = `${getDescriptionIfPresent(ogValue.description)}
772
754
  readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
773
755
  const value = ogValue.multiplicity ? `ReadonlyArray<${getActionParamType(ogValue.type)}>` : `${getActionParamType(ogValue.type)}`;
756
+ jsDocBlock.push(`* @param {${getActionParamType(ogValue.type)}} ${ogValue.nullable ? `[${ogKey}]` : `${ogKey}`} ${ogValue.description ?? ""} `);
774
757
  return [key, value];
775
758
  }
776
759
  })}
777
760
  }
778
- /** @deprecated **/
779
- export type Parameters = Params;
780
761
 
781
762
 
782
763
  // Represents the definition of the action
@@ -798,12 +779,8 @@ async function generatePerActionDataFiles({
798
779
 
799
780
  }
800
781
 
801
- /**
802
- * @deprecated Use \`${action.paramsIdentifier}\`
803
- */
804
- export type ${oldParamsIdentifier} = ${action.paramsIdentifier} | ReadonlyArray<${action.paramsIdentifier}>;
805
-
806
- /** @deprecated Use \`${action.definitionIdentifier}\` **/
782
+ ${jsDocBlock.join("\n")}
783
+ */
807
784
  export type ${action.shortApiName} = ${action.shortApiName}.Signatures;
808
785
  `;
809
786
  }
@@ -837,9 +814,9 @@ async function generatePerActionDataFiles({
837
814
  const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
838
815
  await fs2.writeFile(path5__namespace.default.join(rootOutDir, currentFilePath), await formatTs(`
839
816
  import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
840
- import type { ApplyActionOptions, ApplyBatchActionOptions, ActionReturnTypeForOptions, ActionParam } from '@osdk/client.api';
841
- import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
817
+ import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
842
818
  import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
819
+ import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
843
820
  ${imports}
844
821
 
845
822
 
@@ -873,6 +850,7 @@ function extractReferencedObjectsFromAction(actionType) {
873
850
  case "deleteObject":
874
851
  case "createLink":
875
852
  case "deleteLink":
853
+ default:
876
854
  return [];
877
855
  }
878
856
  });
@@ -1127,8 +1105,9 @@ async function generatePerQueryDataFilesV2({
1127
1105
  async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ontology) {
1128
1106
  const relFilePath = path5__namespace.default.join(relOutDir, `${query.shortApiName}.ts`);
1129
1107
  const objectTypes = getObjectTypeApiNamesFromQuery(query);
1130
- const importObjects = getObjectImports2(ontology, objectTypes, relFilePath);
1131
- const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.og));
1108
+ const objectTypeObjects = new Set(objectTypes.map((o) => ontology.requireObjectType(o)));
1109
+ const importObjects = getObjectImports(objectTypeObjects, "", relFilePath, true);
1110
+ const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw));
1132
1111
  const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));
1133
1112
  const referencedObjectTypes = objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never";
1134
1113
  await fs2.writeFile(path5__namespace.default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
@@ -1234,15 +1213,6 @@ function queryParamJsDoc(param, {
1234
1213
  `;
1235
1214
  return ret;
1236
1215
  }
1237
- function getObjectImports2(enhancedOntology, objectTypes, filePath) {
1238
- let ret = "";
1239
- for (const fqObjectApiName of objectTypes) {
1240
- const obj = enhancedOntology.requireObjectType(fqObjectApiName);
1241
- ret += `import type { ${obj.getDefinitionIdentifier(true)} as ${obj.getImportedDefinitionIdentifier(true)} } from "${obj.getImportPathRelTo(filePath)}";
1242
- `;
1243
- }
1244
- return ret;
1245
- }
1246
1216
  function getQueryParamType(enhancedOntology, input, type) {
1247
1217
  let inner = `unknown /* ${input.type} */`;
1248
1218
  switch (input.type) {
@@ -1283,11 +1253,11 @@ function getQueryParamType(enhancedOntology, input, type) {
1283
1253
  return inner;
1284
1254
  }
1285
1255
  function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
1286
- const definition = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.og, v2));
1256
+ const definition = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
1287
1257
  const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
1288
1258
  const parents = definition.implements?.map((p) => {
1289
1259
  !(ontology.interfaceTypes[p] != null) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : invariant__default.default(false) : void 0;
1290
- const it = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).og, v2));
1260
+ const it = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));
1291
1261
  return it;
1292
1262
  }) ?? [];
1293
1263
  const mergedProperties = {
@@ -1328,43 +1298,15 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
1328
1298
  propertyKeysIdentifier
1329
1299
  };
1330
1300
  function getV2Types() {
1331
- return `import type {
1332
- AggregateOpts as $AggregateOpts,
1333
- AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy as $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,
1334
- AggregationsResults as $AggregationsResults,
1335
- Augments as $Augments,
1336
- ConvertProps as $ConvertProps,
1337
- DefaultToFalse as $DefaultToFalse,
1338
- FetchPageArgs as $FetchPageArgs,
1339
- FetchPageResult as $FetchPageResult,
1340
- IsAny as $IsAny,
1341
- LinkedType as $LinkedType,
1342
- LinkNames as $LinkNames,
1343
- NullabilityAdherence as $NullabilityAdherence,
1344
- NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
1301
+ return ` import type {
1302
+ InterfaceDefinition as $InterfaceDefinition,
1303
+ } from "@osdk/api";
1304
+ import type {
1345
1305
  ObjectSet as $ObjectSet,
1346
1306
  Osdk as $Osdk,
1347
- OsdkObject as $OsdkObject,
1348
- OsdkObjectLinksEntry as $OsdkObjectLinksEntry,
1349
- OsdkObjectLinksObject as $OsdkObjectLinksObject,
1350
- OsdkObjectPropertyType as $OsdkObjectPropertyType,
1351
- PageResult as $PageResult,
1352
- PropertyValueClientToWire as $PropertyValueClientToWire,
1353
- PropertyValueWireToClient as $PropType,
1354
- Result as $Result,
1355
- SelectArg as $SelectArg,
1356
- SingleLinkAccessor as $SingleLinkAccessor,
1357
- SingleOsdkResult as $SingleOsdkResult,
1358
- ValidToFrom as $ValidToFrom,
1359
- WhereClause as $WhereClause,
1360
- } from "@osdk/client.api";
1361
- import type * as $clientApi from "@osdk/client.api";
1362
- import type {
1363
- ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
1364
- ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
1365
- ObjectTypeDefinition as $ObjectTypeDefinition,
1366
- InterfaceDefinition as $InterfaceDefinition,
1367
- } from "@osdk/api";
1307
+ PropertyValueWireToClient as $PropType, } from "@osdk/client.api";
1308
+
1309
+
1368
1310
 
1369
1311
 
1370
1312
 
@@ -1437,15 +1379,15 @@ async function generateRootIndexTsFile({
1437
1379
  importExt,
1438
1380
  ontologyApiNamespace
1439
1381
  }) {
1440
- fs2.writeFile(path5__namespace.default.join(outDir, "index.ts"), await formatTs(`${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
1441
- export * from "./ontology/actions${importExt}";
1382
+ fs2.writeFile(path5__namespace.default.join(outDir, "index.ts"), await formatTs(`export * from "./ontology/actions${importExt}";
1442
1383
  export * as $Actions from "./ontology/actions${importExt}";
1443
- export * from "./ontology/objects${importExt}";
1444
- export * as $Objects from "./ontology/objects${importExt}";
1445
1384
  export * from "./ontology/interfaces${importExt}";
1446
1385
  export * as $Interfaces from "./ontology/interfaces${importExt}";
1386
+ export * from "./ontology/objects${importExt}";
1387
+ export * as $Objects from "./ontology/objects${importExt}";
1447
1388
  export * from "./ontology/queries${importExt}";
1448
1389
  export * as $Queries from "./ontology/queries${importExt}";
1390
+ ${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
1449
1391
  `));
1450
1392
  }
1451
1393
  async function generateEachObjectFile(ctx) {
@@ -1462,11 +1404,10 @@ async function generateEachObjectFile(ctx) {
1462
1404
  const relPath = path5__namespace.default.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
1463
1405
  const outFilePath = path5__namespace.default.join(outDir, relPath);
1464
1406
  await fs2.writeFile(outFilePath, await formatTs(`
1465
- import type { VersionBound as $VersionBound, PropertyDef as $PropertyDef } from "@osdk/api";
1466
- import type { Osdk } from "@osdk/client.api";
1407
+ import type { PropertyDef as $PropertyDef } from "@osdk/api";
1467
1408
  import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
1468
1409
  import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
1469
- ${wireObjectTypeV2ToSdkObjectConstV2(obj.og, ctx, relPath)}
1410
+ ${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
1470
1411
  `));
1471
1412
  }
1472
1413
  }
@@ -1514,10 +1455,8 @@ async function generateOntologyInterfaces({
1514
1455
  });
1515
1456
  for (const obj of Object.values(ontology.interfaceTypes)) {
1516
1457
  await fs2.writeFile(path5__namespace.default.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
1517
-
1518
- import type { PropertyDef as $PropertyDef, VersionBound as $VersionBound } from "@osdk/api";
1519
- import { $osdkMetadata, $expectedClientVersion } from "../../OntologyMetadata${importExt}";
1520
- import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
1458
+ import type { PropertyDef as $PropertyDef } from "@osdk/api";
1459
+ import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
1521
1460
  ${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
1522
1461
  `));
1523
1462
  }