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

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 +15 -0
  2. package/build/browser/index.js +85 -151
  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 +85 -152
  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 +85 -151
  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
@@ -3,7 +3,6 @@ import * as path5 from 'path';
3
3
  import path5__default from 'path';
4
4
  import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from '@osdk/generator-converters';
5
5
  import { format } from 'prettier';
6
- import organizeImports from 'prettier-plugin-organize-imports';
7
6
  import fastDeepEqual from 'fast-deep-equal';
8
7
  import invariant from 'tiny-invariant';
9
8
 
@@ -41,9 +40,9 @@ var AbstractImportable = class {
41
40
  };
42
41
  };
43
42
  var EnhancedBase = class extends AbstractImportable {
44
- constructor(common, og, fullApiName, basePath) {
43
+ constructor(common, raw, fullApiName, basePath) {
45
44
  super(common, fullApiName, basePath);
46
- this.og = og;
45
+ this.raw = raw;
47
46
  if (!this.isLocal && !this.sourcePackage) {
48
47
  throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);
49
48
  }
@@ -57,18 +56,18 @@ function extractNamespace(fqApiName) {
57
56
 
58
57
  // src/GenerateContext/EnhancedAction.ts
59
58
  var EnhancedAction = class extends EnhancedBase {
60
- constructor(common, og) {
61
- super(common, og, og.apiName, "./ontology/actions");
62
- this.og = og;
59
+ constructor(common, raw) {
60
+ super(common, raw, raw.apiName, "./ontology/actions");
61
+ this.raw = raw;
63
62
  }
64
63
  get description() {
65
- return this.og.description;
64
+ return this.raw.description;
66
65
  }
67
66
  get parameters() {
68
- return this.og.parameters;
67
+ return this.raw.parameters;
69
68
  }
70
69
  get operations() {
71
- return this.og.operations;
70
+ return this.raw.operations;
72
71
  }
73
72
  get paramsIdentifier() {
74
73
  return `${this.shortApiName}.Params`;
@@ -88,9 +87,9 @@ function deleteUndefineds(obj) {
88
87
 
89
88
  // src/GenerateContext/EnhancedInterfaceType.ts
90
89
  var EnhancedInterfaceType = class extends EnhancedBase {
91
- constructor(common, og) {
92
- super(common, og, og.apiName, "./ontology/interfaces");
93
- this.og = og;
90
+ constructor(common, raw) {
91
+ super(common, raw, raw.apiName, "./ontology/interfaces");
92
+ this.raw = raw;
94
93
  }
95
94
  getDefinitionIdentifier(v2) {
96
95
  return v2 ? this.shortApiName : `${this.shortApiName}Def`;
@@ -99,16 +98,16 @@ var EnhancedInterfaceType = class extends EnhancedBase {
99
98
  return this.getDefinitionIdentifier(v2);
100
99
  }
101
100
  get properties() {
102
- return this.og.properties;
101
+ return this.raw.properties;
103
102
  }
104
103
  getCleanedUpDefinition(v2) {
105
- return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.og, v2));
104
+ return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2));
106
105
  }
107
106
  };
108
107
  var EnhancedObjectType = class extends EnhancedBase {
109
- constructor(common, og) {
110
- super(common, og, og.objectType.apiName, "./ontology/objects");
111
- this.og = og;
108
+ constructor(common, raw) {
109
+ super(common, raw, raw.objectType.apiName, "./ontology/objects");
110
+ this.raw = raw;
112
111
  }
113
112
  getDefinitionIdentifier(v2) {
114
113
  return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;
@@ -117,24 +116,24 @@ var EnhancedObjectType = class extends EnhancedBase {
117
116
  return this.getDefinitionIdentifier(v2);
118
117
  }
119
118
  getCleanedUpDefinition(v2) {
120
- return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.og, v2));
119
+ return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.raw, v2));
121
120
  }
122
121
  };
123
122
 
124
123
  // src/GenerateContext/EnhancedQuery.ts
125
124
  var EnhancedQuery = class extends EnhancedBase {
126
- constructor(common, og) {
127
- super(common, og, og.apiName, "./ontology/queries");
128
- this.og = og;
125
+ constructor(common, raw) {
126
+ super(common, raw, raw.apiName, "./ontology/queries");
127
+ this.raw = raw;
129
128
  }
130
129
  get description() {
131
- return this.og.description;
130
+ return this.raw.description;
132
131
  }
133
132
  get parameters() {
134
- return this.og.parameters;
133
+ return this.raw.parameters;
135
134
  }
136
135
  get output() {
137
- return this.og.output;
136
+ return this.raw.output;
138
137
  }
139
138
  get paramsIdentifier() {
140
139
  return `${this.shortApiName}.Parameters`;
@@ -149,9 +148,9 @@ var EnhancedQuery = class extends EnhancedBase {
149
148
 
150
149
  // src/GenerateContext/EnhancedSharedPropertyType.ts
151
150
  var EnhancedSharedPropertyType = class extends EnhancedBase {
152
- constructor(common, og) {
153
- super(common, og, og.apiName, "./ontology/interfaces");
154
- this.og = og;
151
+ constructor(common, raw) {
152
+ super(common, raw, raw.apiName, "./ontology/interfaces");
153
+ this.raw = raw;
155
154
  }
156
155
  };
157
156
 
@@ -176,20 +175,21 @@ var ForeignType = class extends AbstractImportable {
176
175
 
177
176
  // src/GenerateContext/EnhancedOntologyDefinition.ts
178
177
  var EnhancedOntologyDefinition = class {
179
- constructor(original, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
178
+ #foreignTypes = {};
179
+ constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
180
180
  this.common = {
181
181
  apiNamespacePackageMap,
182
182
  enhancedOntology: this,
183
183
  importExt,
184
184
  ontologyApiNamespace
185
185
  };
186
- this.og = original;
187
- this.ontology = original.ontology;
188
- this.objectTypes = remap(original.objectTypes, this.common, EnhancedObjectType);
189
- this.actionTypes = remap(original.actionTypes, this.common, EnhancedAction);
190
- this.queryTypes = remap(original.queryTypes, this.common, EnhancedQuery);
191
- this.interfaceTypes = remap(original.interfaceTypes, this.common, EnhancedInterfaceType);
192
- this.sharedPropertyTypes = remap(original.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
186
+ this.raw = raw;
187
+ this.ontology = raw.ontology;
188
+ this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);
189
+ this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);
190
+ this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);
191
+ this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);
192
+ this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
193
193
  }
194
194
  #createRequireType = (type) => {
195
195
  return (fullApiName, localOnly) => {
@@ -202,7 +202,9 @@ var EnhancedOntologyDefinition = class {
202
202
  if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
203
203
  throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);
204
204
  }
205
- return new ForeignType(this.common, type, apiNamespace, shortApiName);
205
+ const ret2 = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);
206
+ this.#foreignTypes[fullApiName] = ret2;
207
+ return ret2;
206
208
  }
207
209
  return ret;
208
210
  };
@@ -245,7 +247,6 @@ function formatTs(contents) {
245
247
  parser: "typescript",
246
248
  singleQuote: true,
247
249
  trailingComma: "all",
248
- plugins: [organizeImports],
249
250
  tabWidth: 2,
250
251
  printWidth: 120
251
252
  });
@@ -288,7 +289,10 @@ async function generateOntologyMetadataFile({
288
289
  // src/shared/getObjectImports.ts
289
290
  function getObjectImports(objects, curApiName, currentFilePath, v2) {
290
291
  return Array.from(objects).filter((obj) => obj.fullApiName !== curApiName).map((obj) => {
291
- return `import type { ${obj.getDefinitionIdentifier(v2)} as ${obj.getImportedDefinitionIdentifier(v2)} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
292
+ const defId = obj.getDefinitionIdentifier(v2);
293
+ const importedId = obj.getImportedDefinitionIdentifier(v2);
294
+ const nameOrAlias = defId === importedId ? defId : `${defId} as ${importedId}`;
295
+ return `import type { ${nameOrAlias} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
292
296
  }).join("\n");
293
297
  }
294
298
 
@@ -411,7 +415,7 @@ function stringUnionFrom(values) {
411
415
  }
412
416
  }
413
417
 
414
- // src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts
418
+ // src/v2.0/getDescriptionIfPresent.ts
415
419
  function getDescriptionIfPresent(description, includeNewline) {
416
420
  if (description) {
417
421
  return `/**
@@ -460,7 +464,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
460
464
  }, currentFilePath) {
461
465
  const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
462
466
  const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
463
- const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.og, true));
467
+ const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.raw, true));
464
468
  const objectDefIdentifier = object.getDefinitionIdentifier(true);
465
469
  const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
466
470
  const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
@@ -469,7 +473,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
469
473
  const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
470
474
  const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
471
475
  const identifiers = {
472
- objectDefIdentifier: `${object.shortApiName}.Definition`,
476
+ objectDefIdentifier: `${object.shortApiName}`,
473
477
  osdkObjectLinksIdentifier,
474
478
  osdkObjectPropsIdentifier,
475
479
  osdkObjectStrictPropsIdentifier,
@@ -479,42 +483,18 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
479
483
  };
480
484
  function getV2Types() {
481
485
  return `import type {
482
- AggregateOpts as $AggregateOpts,
483
- AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy as $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,
484
- AggregationsResults as $AggregationsResults,
485
- Augments as $Augments,
486
- ConvertProps as $ConvertProps,
487
- DefaultToFalse as $DefaultToFalse,
488
- FetchPageArgs as $FetchPageArgs,
489
- FetchPageResult as $FetchPageResult,
490
- IsAny as $IsAny,
491
- LinkedType as $LinkedType,
492
- LinkNames as $LinkNames,
493
- NullabilityAdherence as $NullabilityAdherence,
494
- NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
486
+ ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
487
+ ObjectTypeDefinition as $ObjectTypeDefinition,
488
+ ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
489
+ } from "@osdk/api";
490
+ import type {
495
491
  ObjectSet as $ObjectSet,
496
492
  Osdk as $Osdk,
497
493
  OsdkObject as $OsdkObject,
498
- OsdkObjectLinksEntry as $OsdkObjectLinksEntry,
499
- OsdkObjectLinksObject as $OsdkObjectLinksObject,
500
- OsdkObjectPropertyType as $OsdkObjectPropertyType,
501
- PageResult as $PageResult,
502
- PropertyValueClientToWire as $PropertyValueClientToWire,
503
494
  PropertyValueWireToClient as $PropType,
504
- Result as $Result,
505
- SelectArg as $SelectArg,
506
495
  SingleLinkAccessor as $SingleLinkAccessor,
507
- SingleLinkAccessor as $SingleLinkAccessor
508
- SingleOsdkResult as $SingleOsdkResult,
509
- ValidToFrom as $ValidToFrom,
510
- WhereClause as $WhereClause,
511
496
  } from "@osdk/client.api";
512
- import type * as $clientApi from "@osdk/client.api";
513
- import type {
514
- ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
515
- ObjectTypeDefinition as $ObjectTypeDefinition,
516
- ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
517
- } from "@osdk/api";
497
+
518
498
 
519
499
  export namespace ${object.shortApiName} {
520
500
 
@@ -527,16 +507,15 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
527
507
  ${createProps(object, "StrictProps", true)}
528
508
 
529
509
  ${createObjectSet(object, identifiers)}
530
-
531
- ${createDefinition(object, ontology, "Definition", identifiers)}
510
+
532
511
  ${createOsdkObject(object, "OsdkObject", identifiers)}
533
512
  }
534
513
 
535
514
 
536
515
 
537
-
516
+ ${createDefinition(object, ontology, object.shortApiName, identifiers)}
517
+
538
518
 
539
- export type ${objectDefIdentifier} = ${object.shortApiName}.Definition;
540
519
 
541
520
 
542
521
  `;
@@ -658,7 +637,7 @@ function createLinks(ontology, object, identifier) {
658
637
  ${stringify(definition.links, {
659
638
  "*": (definition2, _, key) => {
660
639
  const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true);
661
- return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}.Definition>`}
640
+ return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}>`}
662
641
  `];
663
642
  }
664
643
  })}
@@ -683,10 +662,10 @@ async function generatePerActionDataFiles({
683
662
  });
684
663
  await Promise.all(Object.values(enhancedOntology.actionTypes).map(async (action) => {
685
664
  const currentFilePath = `${path5__default.join("ontology", "actions", `${action.shortApiName}.ts`)}`;
686
- const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.og);
665
+ const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.raw);
687
666
  const uniqueApiNames = new Set(uniqueApiNamesArray);
688
667
  const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
689
- const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.og));
668
+ const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.raw));
690
669
  const {
691
670
  parameters,
692
671
  ...actionDefSansParameters
@@ -710,9 +689,9 @@ async function generatePerActionDataFiles({
710
689
  return JSON.stringify(type);
711
690
  } else if (type.type === "object") {
712
691
  const obj = enhancedOntology.requireObjectType(type.object);
713
- return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}.Definition>`;
692
+ return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}>`;
714
693
  } else if (type.type === "objectSet") {
715
- return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}.Definition>`;
694
+ return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}>`;
716
695
  }
717
696
  return void 0;
718
697
  }
@@ -725,13 +704,13 @@ async function generatePerActionDataFiles({
725
704
  if (typeof input === "string") {
726
705
  return `ActionParam.PrimitiveType<${JSON.stringify(input)}>`;
727
706
  } else if (input.type === "object") {
728
- return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}.Definition>`;
707
+ return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
729
708
  } else if (input.type === "objectSet") {
730
- return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}.Definition>`;
709
+ return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
731
710
  }
732
711
  }
733
712
  function createV2Types() {
734
- const oldParamsIdentifier = `${action.shortApiName}$Params`;
713
+ `${action.shortApiName}$Params`;
735
714
  return `
736
715
 
737
716
  export namespace ${action.shortApiName}{
@@ -748,8 +727,6 @@ async function generatePerActionDataFiles({
748
727
  }
749
728
  })}
750
729
  }
751
- /** @deprecated **/
752
- export type Parameters = Params;
753
730
 
754
731
 
755
732
  // Represents the definition of the action
@@ -771,11 +748,6 @@ async function generatePerActionDataFiles({
771
748
 
772
749
  }
773
750
 
774
- /**
775
- * @deprecated Use \`${action.paramsIdentifier}\`
776
- */
777
- export type ${oldParamsIdentifier} = ${action.paramsIdentifier} | ReadonlyArray<${action.paramsIdentifier}>;
778
-
779
751
  /** @deprecated Use \`${action.definitionIdentifier}\` **/
780
752
  export type ${action.shortApiName} = ${action.shortApiName}.Signatures;
781
753
  `;
@@ -810,9 +782,9 @@ async function generatePerActionDataFiles({
810
782
  const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
811
783
  await fs2.writeFile(path5__default.join(rootOutDir, currentFilePath), await formatTs(`
812
784
  import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
813
- import type { ApplyActionOptions, ApplyBatchActionOptions, ActionReturnTypeForOptions, ActionParam } from '@osdk/client.api';
814
- import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
785
+ import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
815
786
  import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
787
+ import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
816
788
  ${imports}
817
789
 
818
790
 
@@ -846,6 +818,7 @@ function extractReferencedObjectsFromAction(actionType) {
846
818
  case "deleteObject":
847
819
  case "createLink":
848
820
  case "deleteLink":
821
+ default:
849
822
  return [];
850
823
  }
851
824
  });
@@ -1100,8 +1073,9 @@ async function generatePerQueryDataFilesV2({
1100
1073
  async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ontology) {
1101
1074
  const relFilePath = path5__default.join(relOutDir, `${query.shortApiName}.ts`);
1102
1075
  const objectTypes = getObjectTypeApiNamesFromQuery(query);
1103
- const importObjects = getObjectImports2(ontology, objectTypes, relFilePath);
1104
- const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.og));
1076
+ const objectTypeObjects = new Set(objectTypes.map((o) => ontology.requireObjectType(o)));
1077
+ const importObjects = getObjectImports(objectTypeObjects, "", relFilePath, true);
1078
+ const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw));
1105
1079
  const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));
1106
1080
  const referencedObjectTypes = objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never";
1107
1081
  await fs2.writeFile(path5__default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
@@ -1207,15 +1181,6 @@ function queryParamJsDoc(param, {
1207
1181
  `;
1208
1182
  return ret;
1209
1183
  }
1210
- function getObjectImports2(enhancedOntology, objectTypes, filePath) {
1211
- let ret = "";
1212
- for (const fqObjectApiName of objectTypes) {
1213
- const obj = enhancedOntology.requireObjectType(fqObjectApiName);
1214
- ret += `import type { ${obj.getDefinitionIdentifier(true)} as ${obj.getImportedDefinitionIdentifier(true)} } from "${obj.getImportPathRelTo(filePath)}";
1215
- `;
1216
- }
1217
- return ret;
1218
- }
1219
1184
  function getQueryParamType(enhancedOntology, input, type) {
1220
1185
  let inner = `unknown /* ${input.type} */`;
1221
1186
  switch (input.type) {
@@ -1256,11 +1221,11 @@ function getQueryParamType(enhancedOntology, input, type) {
1256
1221
  return inner;
1257
1222
  }
1258
1223
  function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
1259
- const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.og, v2));
1224
+ const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
1260
1225
  const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
1261
1226
  const parents = definition.implements?.map((p) => {
1262
1227
  !(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(false) : void 0;
1263
- const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).og, v2));
1228
+ const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));
1264
1229
  return it;
1265
1230
  }) ?? [];
1266
1231
  const mergedProperties = {
@@ -1301,43 +1266,15 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
1301
1266
  propertyKeysIdentifier
1302
1267
  };
1303
1268
  function getV2Types() {
1304
- return `import type {
1305
- AggregateOpts as $AggregateOpts,
1306
- AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy as $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,
1307
- AggregationsResults as $AggregationsResults,
1308
- Augments as $Augments,
1309
- ConvertProps as $ConvertProps,
1310
- DefaultToFalse as $DefaultToFalse,
1311
- FetchPageArgs as $FetchPageArgs,
1312
- FetchPageResult as $FetchPageResult,
1313
- IsAny as $IsAny,
1314
- LinkedType as $LinkedType,
1315
- LinkNames as $LinkNames,
1316
- NullabilityAdherence as $NullabilityAdherence,
1317
- NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
1269
+ return ` import type {
1270
+ InterfaceDefinition as $InterfaceDefinition,
1271
+ } from "@osdk/api";
1272
+ import type {
1318
1273
  ObjectSet as $ObjectSet,
1319
1274
  Osdk as $Osdk,
1320
- OsdkObject as $OsdkObject,
1321
- OsdkObjectLinksEntry as $OsdkObjectLinksEntry,
1322
- OsdkObjectLinksObject as $OsdkObjectLinksObject,
1323
- OsdkObjectPropertyType as $OsdkObjectPropertyType,
1324
- PageResult as $PageResult,
1325
- PropertyValueClientToWire as $PropertyValueClientToWire,
1326
- PropertyValueWireToClient as $PropType,
1327
- Result as $Result,
1328
- SelectArg as $SelectArg,
1329
- SingleLinkAccessor as $SingleLinkAccessor,
1330
- SingleOsdkResult as $SingleOsdkResult,
1331
- ValidToFrom as $ValidToFrom,
1332
- WhereClause as $WhereClause,
1333
- } from "@osdk/client.api";
1334
- import type * as $clientApi from "@osdk/client.api";
1335
- import type {
1336
- ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
1337
- ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
1338
- ObjectTypeDefinition as $ObjectTypeDefinition,
1339
- InterfaceDefinition as $InterfaceDefinition,
1340
- } from "@osdk/api";
1275
+ PropertyValueWireToClient as $PropType, } from "@osdk/client.api";
1276
+
1277
+
1341
1278
 
1342
1279
 
1343
1280
 
@@ -1410,15 +1347,15 @@ async function generateRootIndexTsFile({
1410
1347
  importExt,
1411
1348
  ontologyApiNamespace
1412
1349
  }) {
1413
- fs2.writeFile(path5__default.join(outDir, "index.ts"), await formatTs(`${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
1414
- export * from "./ontology/actions${importExt}";
1350
+ fs2.writeFile(path5__default.join(outDir, "index.ts"), await formatTs(`export * from "./ontology/actions${importExt}";
1415
1351
  export * as $Actions from "./ontology/actions${importExt}";
1416
- export * from "./ontology/objects${importExt}";
1417
- export * as $Objects from "./ontology/objects${importExt}";
1418
1352
  export * from "./ontology/interfaces${importExt}";
1419
1353
  export * as $Interfaces from "./ontology/interfaces${importExt}";
1354
+ export * from "./ontology/objects${importExt}";
1355
+ export * as $Objects from "./ontology/objects${importExt}";
1420
1356
  export * from "./ontology/queries${importExt}";
1421
1357
  export * as $Queries from "./ontology/queries${importExt}";
1358
+ ${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
1422
1359
  `));
1423
1360
  }
1424
1361
  async function generateEachObjectFile(ctx) {
@@ -1435,11 +1372,10 @@ async function generateEachObjectFile(ctx) {
1435
1372
  const relPath = path5__default.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
1436
1373
  const outFilePath = path5__default.join(outDir, relPath);
1437
1374
  await fs2.writeFile(outFilePath, await formatTs(`
1438
- import type { VersionBound as $VersionBound, PropertyDef as $PropertyDef } from "@osdk/api";
1439
- import type { Osdk } from "@osdk/client.api";
1375
+ import type { PropertyDef as $PropertyDef } from "@osdk/api";
1440
1376
  import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
1441
1377
  import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
1442
- ${wireObjectTypeV2ToSdkObjectConstV2(obj.og, ctx, relPath)}
1378
+ ${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
1443
1379
  `));
1444
1380
  }
1445
1381
  }
@@ -1487,10 +1423,8 @@ async function generateOntologyInterfaces({
1487
1423
  });
1488
1424
  for (const obj of Object.values(ontology.interfaceTypes)) {
1489
1425
  await fs2.writeFile(path5__default.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
1490
-
1491
- import type { PropertyDef as $PropertyDef, VersionBound as $VersionBound } from "@osdk/api";
1492
- import { $osdkMetadata, $expectedClientVersion } from "../../OntologyMetadata${importExt}";
1493
- import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
1426
+ import type { PropertyDef as $PropertyDef } from "@osdk/api";
1427
+ import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
1494
1428
  ${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
1495
1429
  `));
1496
1430
  }