@osdk/generator 2.0.0-beta.12 → 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.
@@ -1,4 +1,4 @@
1
- import type { InterfaceDefinition } from "@osdk/api";
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): InterfaceDefinition<any, any>;
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,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,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,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC;CAQnE"}
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 { ObjectTypeDefinition } from "@osdk/api";
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): ObjectTypeDefinition<any>;
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,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD,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,oBAAoB,CAAC,GAAG,CAAC;CAQ/D"}
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"}
@@ -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 { wireActionTypeV2ToSdkActionDefinition, wireQueryTypeV2ToSdkQueryDefinitionNoParams, wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition, __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from '@osdk/generator-converters';
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(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.raw, v2));
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}.Definition`;
142
+ return `${this.shortApiName}`;
143
143
  }
144
144
  get definitionParamsIdentifier() {
145
145
  return `${this.definitionIdentifier}$Params`;
@@ -376,7 +376,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
376
376
  }, currentFilePath) {
377
377
  const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
378
378
  const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
379
- const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.raw, true));
379
+ const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));
380
380
  const objectDefIdentifier = object.getDefinitionIdentifier(true);
381
381
  const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
382
382
  const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
@@ -396,7 +396,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
396
396
  function getV2Types() {
397
397
  return `import type {
398
398
  ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
399
- MinObjectDef as $ObjectTypeDefinition,
399
+ ObjectTypeDefinition as $ObjectTypeDefinition,
400
400
  ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
401
401
  } from "@osdk/api";
402
402
  import type {
@@ -514,8 +514,6 @@ function createDefinition(object, ontology, identifier, {
514
514
  linksType: ${osdkObjectLinksIdentifier};
515
515
  strictProps: ${osdkObjectStrictPropsIdentifier};
516
516
  ${stringify(definition, {
517
- osdkMetadata: () => void 0,
518
- // we are going to reference another object instead
519
517
  links: (_value) => `{
520
518
  ${stringify(definition.links, {
521
519
  "*": (definition2) => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true)}, ${definition2.multiplicity}>`
@@ -569,7 +567,7 @@ async function generatePerActionDataFiles({
569
567
  const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.raw);
570
568
  const uniqueApiNames = new Set(uniqueApiNamesArray);
571
569
  const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
572
- const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.raw));
570
+ const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionMetadata(action.raw));
573
571
  function createParamsDef() {
574
572
  const entries = Object.entries(fullActionDef.parameters ?? {});
575
573
  entries.sort((a, b) => a[0].localeCompare(b[0]));
@@ -646,7 +644,7 @@ async function generatePerActionDataFiles({
646
644
 
647
645
  ${jsDocBlock.join("\n")}
648
646
  */
649
- export interface ${action.shortApiName} extends MinActionDef<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures> {
647
+ export interface ${action.shortApiName} extends ActionDefinition<"${action.fullApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures> {
650
648
  __DefinitionMetadata?: {
651
649
  ${stringify(fullActionDef, {
652
650
  "parameters": () => action.definitionParamsIdentifier
@@ -658,7 +656,9 @@ async function generatePerActionDataFiles({
658
656
  "description": () => void 0,
659
657
  "displayName": () => void 0,
660
658
  "modifiedEntities": () => void 0,
661
- "parameters": () => void 0
659
+ "parameters": () => void 0,
660
+ "rid": () => void 0,
661
+ "status": () => void 0
662
662
  })}
663
663
  osdkMetadata: typeof $osdkMetadata;
664
664
  }
@@ -671,7 +671,9 @@ async function generatePerActionDataFiles({
671
671
  "description": () => void 0,
672
672
  "displayName": () => void 0,
673
673
  "modifiedEntities": () => void 0,
674
- "parameters": () => void 0
674
+ "parameters": () => void 0,
675
+ "rid": () => void 0,
676
+ "status": () => void 0
675
677
  })},
676
678
  osdkMetadata: $osdkMetadata
677
679
  }
@@ -698,7 +700,7 @@ async function generatePerActionDataFiles({
698
700
  }
699
701
  const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
700
702
  await fs2.writeFile(path5__default.join(rootOutDir, currentFilePath), await formatTs(`
701
- import type { MinActionDef, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
703
+ import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
702
704
  import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
703
705
  import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
704
706
  ${imports}
@@ -843,9 +845,10 @@ async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ont
843
845
  const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));
844
846
  const referencedObjectTypes = objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never";
845
847
  await fs2.writeFile(path5__default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
846
- import type { MinQueryDef , VersionBound} from "@osdk/api";
848
+ import type { QueryDefinition , VersionBound} from "@osdk/api";
847
849
  import type { QueryParam, QueryResult } from "@osdk/client.api";
848
850
  import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
851
+ import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
849
852
  ${importObjects}
850
853
 
851
854
  export namespace ${query.shortApiName} {
@@ -871,12 +874,17 @@ async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ont
871
874
 
872
875
  ` : ""}
873
876
 
874
- export interface Definition extends MinQueryDef<
877
+
878
+
879
+ }
880
+
881
+ export interface ${query.shortApiName} extends QueryDefinition<
875
882
  "${query.fullApiName}",
876
883
  ${referencedObjectTypes},
877
884
  ${query.shortApiName}.Signature
878
885
  >, VersionBound<$ExpectedClientVersion>{
879
- ${stringify(baseProps)},
886
+ __DefinitionMetadata?: {
887
+ ${stringify(baseProps)}
880
888
  parameters: {
881
889
  ${parameterDefsForType(ontology, query)}
882
890
  };
@@ -884,33 +892,27 @@ async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ont
884
892
  ${stringify(outputBase)},
885
893
  ${getLineFor__OsdkTargetType(ontology, query.output)}
886
894
  };
887
- }
888
-
889
- }
890
-
891
- /** @deprecated use \`${query.shortApiName}.Signature' instead */
892
- export type ${query.shortApiName} = ${query.shortApiName}.Signature;
893
-
894
-
895
-
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
+ }
896
904
 
897
905
 
898
906
  export const ${query.shortApiName}: ${query.definitionIdentifier} = {
899
- ${stringify(baseProps)},
900
- parameters: {
901
- ${parametersForConst(query)}
902
- },
903
- output: {
904
- ${stringify(outputBase)},
905
- }
907
+ ${stringify(baseProps, {
908
+ "description": () => void 0,
909
+ "displayName": () => void 0,
910
+ "rid": () => void 0
911
+ })},
912
+ osdkMetadata: $osdkMetadata
906
913
  };
907
914
  `));
908
915
  }
909
- function parametersForConst(query) {
910
- return stringify(query.parameters, {
911
- "*": (parameter, formatter) => formatter(deleteUndefineds(wireQueryParameterV2ToQueryParameterDefinition(parameter)))
912
- });
913
- }
914
916
  function parameterDefsForType(ontology, query) {
915
917
  return stringify(query.parameters, {
916
918
  "*": (parameter, valueFormatter, apiName) => [`${queryParamJsDoc(wireQueryParameterV2ToQueryParameterDefinition(parameter), {
@@ -1007,13 +1009,6 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
1007
1009
  }
1008
1010
  definition.properties;
1009
1011
  definition.properties = mergedProperties;
1010
- function maybeStripNamespace2(q) {
1011
- if (interfaceDef.apiNamespace && q.startsWith(`${interfaceDef.apiNamespace}.`)) {
1012
- return q.slice(interfaceDef.apiNamespace.length + 1);
1013
- } else {
1014
- return q;
1015
- }
1016
- }
1017
1012
  const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
1018
1013
  const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
1019
1014
  const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;
@@ -1021,7 +1016,7 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
1021
1016
  const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;
1022
1017
  const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;
1023
1018
  const ids = {
1024
- objectDefIdentifier: `${interfaceDef.shortApiName}.Definition`,
1019
+ objectDefIdentifier: interfaceDef.shortApiName,
1025
1020
  osdkObjectLinksIdentifier,
1026
1021
  osdkObjectPropsIdentifier,
1027
1022
  osdkObjectStrictPropsIdentifier,
@@ -1065,20 +1060,11 @@ ${stringify(definition.links, {
1065
1060
 
1066
1061
  ${createObjectSet(interfaceDef, ids)}
1067
1062
 
1068
- ${createDefinition(interfaceDef, ontology, "Definition", ids)}
1069
-
1070
1063
  ${createOsdkObject(interfaceDef, "OsdkObject", ids)}
1071
1064
 
1072
1065
  }
1073
1066
 
1074
-
1075
-
1076
-
1077
- /** @deprecated use ${interfaceDef.shortApiName}.Definition **/
1078
- export type ${objectDefIdentifier} = ${interfaceDef.shortApiName}.Definition;
1079
-
1080
-
1081
-
1067
+ ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}
1082
1068
 
1083
1069
  `;
1084
1070
  }
@@ -1086,22 +1072,11 @@ ${stringify(definition.links, {
1086
1072
  return `${imports.join("\n")}
1087
1073
  ${v2 ? getV2Types() : ""}
1088
1074
 
1089
- export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName}.Definition = {
1075
+ export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {
1076
+ type: "interface",
1077
+ apiName: "${interfaceDef.fullApiName}",
1090
1078
  osdkMetadata: $osdkMetadata,
1091
- objectSet: undefined as any,
1092
- props: undefined as any,
1093
- linksType: undefined as any,
1094
- strictProps: undefined as any,
1095
- ${stringify(definition, {
1096
- osdkMetadata: () => void 0,
1097
- properties: (properties) => `{
1098
- ${stringify(properties, {
1099
- "*": (propertyDefinition, _, key) => [`"${maybeStripNamespace2(key)}"`, _(propertyDefinition)]
1100
- })}
1101
- }`
1102
- })}
1103
-
1104
- };`;
1079
+ };`;
1105
1080
  }
1106
1081
 
1107
1082
  // src/v2.0/generateClientSdkVersionTwoPointZero.ts