@osdk/generator 2.0.2-rc.3 → 2.1.0-beta.0

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 (114) hide show
  1. package/CHANGELOG.md +9 -32
  2. package/build/browser/GenerateContext/EnhanceCommon.d.ts +0 -2
  3. package/build/browser/GenerateContext/EnhanceCommon.d.ts.map +1 -1
  4. package/build/browser/GenerateContext/EnhancedBase.d.ts +1 -3
  5. package/build/browser/GenerateContext/EnhancedBase.d.ts.map +1 -1
  6. package/build/browser/GenerateContext/EnhancedBase.js +2 -11
  7. package/build/browser/GenerateContext/EnhancedBase.js.map +1 -1
  8. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts +4 -4
  9. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
  10. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js +27 -21
  11. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  12. package/build/browser/GenerateContext/ForeignType.d.ts +1 -2
  13. package/build/browser/GenerateContext/ForeignType.d.ts.map +1 -1
  14. package/build/browser/GenerateContext/ForeignType.js +5 -11
  15. package/build/browser/GenerateContext/ForeignType.js.map +1 -1
  16. package/build/browser/GenerateContext/enhanceOntology.d.ts +7 -1
  17. package/build/browser/GenerateContext/enhanceOntology.d.ts.map +1 -1
  18. package/build/browser/GenerateContext/enhanceOntology.js +8 -2
  19. package/build/browser/GenerateContext/enhanceOntology.js.map +1 -1
  20. package/build/browser/generateClientSdkPackage.d.ts +1 -1
  21. package/build/browser/generateClientSdkPackage.d.ts.map +1 -1
  22. package/build/browser/generateClientSdkPackage.js +2 -2
  23. package/build/browser/generateClientSdkPackage.js.map +1 -1
  24. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +12 -6
  25. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  26. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +40 -6
  27. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  28. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  29. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  30. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +16 -80
  31. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  32. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +118 -52
  33. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  34. package/build/browser/v2.0/generateMetadata.js +1 -1
  35. package/build/browser/v2.0/generateMetadata.js.map +1 -1
  36. package/build/browser/v2.0/generatePerActionDataFiles.test.js +14 -2
  37. package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  38. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts +2 -0
  39. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
  40. package/build/browser/v2.0/generatePerInterfaceDataFiles.js +45 -0
  41. package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -0
  42. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts +3 -0
  43. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
  44. package/build/browser/v2.0/generatePerObjectDataFiles.js +47 -0
  45. package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -0
  46. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  47. package/build/browser/v2.0/generatePerQueryDataFiles.js +1 -1
  48. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  49. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +9 -3
  50. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  51. package/build/browser/v2.0/generateRootIndexTsFile.d.ts +3 -0
  52. package/build/browser/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
  53. package/build/browser/v2.0/generateRootIndexTsFile.js +40 -0
  54. package/build/browser/v2.0/generateRootIndexTsFile.js.map +1 -0
  55. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  56. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +19 -9
  57. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  58. package/build/esm/GenerateContext/EnhanceCommon.d.ts +0 -2
  59. package/build/esm/GenerateContext/EnhanceCommon.d.ts.map +1 -1
  60. package/build/esm/GenerateContext/EnhancedBase.d.ts +1 -3
  61. package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
  62. package/build/esm/GenerateContext/EnhancedBase.js +2 -11
  63. package/build/esm/GenerateContext/EnhancedBase.js.map +1 -1
  64. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +4 -4
  65. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
  66. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js +27 -21
  67. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  68. package/build/esm/GenerateContext/ForeignType.d.ts +1 -2
  69. package/build/esm/GenerateContext/ForeignType.d.ts.map +1 -1
  70. package/build/esm/GenerateContext/ForeignType.js +5 -11
  71. package/build/esm/GenerateContext/ForeignType.js.map +1 -1
  72. package/build/esm/GenerateContext/enhanceOntology.d.ts +7 -1
  73. package/build/esm/GenerateContext/enhanceOntology.d.ts.map +1 -1
  74. package/build/esm/GenerateContext/enhanceOntology.js +8 -2
  75. package/build/esm/GenerateContext/enhanceOntology.js.map +1 -1
  76. package/build/esm/generateClientSdkPackage.d.ts +1 -1
  77. package/build/esm/generateClientSdkPackage.d.ts.map +1 -1
  78. package/build/esm/generateClientSdkPackage.js +2 -2
  79. package/build/esm/generateClientSdkPackage.js.map +1 -1
  80. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +12 -6
  81. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  82. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +40 -6
  83. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  84. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  85. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  86. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +16 -80
  87. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  88. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +118 -52
  89. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  90. package/build/esm/v2.0/generateMetadata.js +1 -1
  91. package/build/esm/v2.0/generateMetadata.js.map +1 -1
  92. package/build/esm/v2.0/generatePerActionDataFiles.test.js +14 -2
  93. package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  94. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts +2 -0
  95. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
  96. package/build/esm/v2.0/generatePerInterfaceDataFiles.js +45 -0
  97. package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -0
  98. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts +3 -0
  99. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
  100. package/build/esm/v2.0/generatePerObjectDataFiles.js +47 -0
  101. package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -0
  102. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  103. package/build/esm/v2.0/generatePerQueryDataFiles.js +1 -1
  104. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  105. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +9 -3
  106. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  107. package/build/esm/v2.0/generateRootIndexTsFile.d.ts +3 -0
  108. package/build/esm/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
  109. package/build/esm/v2.0/generateRootIndexTsFile.js +40 -0
  110. package/build/esm/v2.0/generateRootIndexTsFile.js.map +1 -0
  111. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  112. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +19 -9
  113. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  114. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,42 +1,19 @@
1
1
  # @osdk/generator
2
2
 
3
- ## 2.0.2-rc.3
3
+ ## 2.1.0-beta.0
4
4
 
5
- ### Patch Changes
6
-
7
- - Updated dependencies [4c5e0ae]
8
- - @osdk/api@2.0.2-rc.3
9
- - @osdk/generator-converters@2.0.2-rc.3
10
-
11
- ## 2.0.2-beta.2
12
-
13
- ### Patch Changes
14
-
15
- - Updated dependencies [51354c5]
16
- - @osdk/generator-converters@2.0.2-beta.2
17
- - @osdk/api@2.0.2-beta.2
18
-
19
- ## 2.0.2-beta.1
20
-
21
- ### Patch Changes
22
-
23
- - @osdk/generator-converters@2.0.2-beta.1
24
- - @osdk/api@2.0.2-beta.1
25
-
26
- ## 2.0.2-rc.0
27
-
28
- ### Patch Changes
29
-
30
- - @osdk/generator-converters@2.0.2-rc.0
31
- - @osdk/api@2.0.2-rc.0
5
+ ### Minor Changes
32
6
 
33
- ## 2.0.1
7
+ - 0dc40b0: Switch to OSDK.Instance
34
8
 
35
9
  ### Patch Changes
36
10
 
37
- - @osdk/internal.foundry.core@0.2.1
38
- - @osdk/generator-converters@2.0.1
39
- - @osdk/api@2.0.1
11
+ - Updated dependencies [0dc40b0]
12
+ - Updated dependencies [03e1941]
13
+ - Updated dependencies [e548b9b]
14
+ - Updated dependencies [c682504]
15
+ - @osdk/api@2.1.0-beta.0
16
+ - @osdk/generator-converters@2.1.0-beta.0
40
17
 
41
18
  ## 2.0.0
42
19
 
@@ -1,7 +1,5 @@
1
1
  import type { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
2
2
  export interface EnhanceCommon {
3
- ontologyApiNamespace: string | undefined;
4
- apiNamespacePackageMap: Map<string, string>;
5
3
  importExt: string;
6
4
  /** DO NOT USE THIS IN THE CONSTRUCTOR(S) */
7
5
  enhancedOntology: EnhancedOntologyDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"EnhanceCommon.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhanceCommon.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,aAAa;IAC5B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,gBAAgB,EAAE,0BAA0B,CAAC;CAC9C"}
1
+ {"version":3,"file":"EnhanceCommon.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhanceCommon.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,gBAAgB,EAAE,0BAA0B,CAAC;CAC9C"}
@@ -10,9 +10,7 @@ export declare abstract class AbstractImportable {
10
10
  */
11
11
  importPath: string;
12
12
  uniqueImportName: string;
13
- readonly isLocal: boolean;
14
- readonly sourcePackage: string | undefined;
15
- constructor(common: EnhanceCommon, fullApiName: string, basePath: string);
13
+ constructor(common: EnhanceCommon, fullApiName: string, basePath: string, isLocal?: boolean);
16
14
  getImportPathRelTo: (filePath: string) => string;
17
15
  }
18
16
  export declare abstract class EnhancedBase<T> extends AbstractImportable {
@@ -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,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
+ {"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;gBAGvB,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,OAAc;IAiBzB,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;CAKnB;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAChB,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,CAI9B"}
@@ -25,20 +25,14 @@ export class AbstractImportable {
25
25
  */
26
26
  importPath;
27
27
  uniqueImportName;
28
- isLocal;
29
- sourcePackage;
30
- constructor(common, fullApiName, basePath) {
28
+ constructor(common, fullApiName, basePath, isLocal = true) {
31
29
  this._common = common;
32
30
  this.fullApiName = fullApiName;
33
31
  [this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);
34
32
  const {
35
- ontologyApiNamespace,
36
- apiNamespacePackageMap,
37
33
  importExt
38
34
  } = common;
39
- this.isLocal = ontologyApiNamespace === this.apiNamespace;
40
- this.sourcePackage = this.apiNamespace && !this.isLocal ? apiNamespacePackageMap.get(this.apiNamespace) : undefined;
41
- this.importPath = this.isLocal ? `${basePath}/${this.shortApiName}${importExt}` : this.sourcePackage;
35
+ this.importPath = isLocal ? `${basePath}/${this.shortApiName}${importExt}` : basePath;
42
36
  this.uniqueImportName = this.shortApiName;
43
37
  }
44
38
  getImportPathRelTo = filePath => {
@@ -59,9 +53,6 @@ export class EnhancedBase extends AbstractImportable {
59
53
  constructor(common, raw, fullApiName, basePath) {
60
54
  super(common, fullApiName, basePath);
61
55
  this.raw = raw;
62
- if (!this.isLocal && !this.sourcePackage) {
63
- throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);
64
- }
65
56
  }
66
57
  }
67
58
  export function extractNamespace(fqApiName) {
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedBase.js","names":["path","AbstractImportable","_common","shortApiName","fullApiName","apiNamespace","importPath","uniqueImportName","isLocal","sourcePackage","constructor","common","basePath","extractNamespace","ontologyApiNamespace","apiNamespacePackageMap","importExt","get","undefined","getImportPathRelTo","filePath","startsWith","result","relative","dirname","split","sep","join","EnhancedBase","raw","Error","fqApiName","last","lastIndexOf","slice"],"sources":["EnhancedBase.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as path from \"node:path\";\nexport class AbstractImportable {\n _common;\n shortApiName;\n fullApiName;\n apiNamespace;\n /**\n * Either a path relative to the ourDir (e.g. \"./ontology/objects/foo.js\") or a normal\n * module import (e.g. \"@something/foo\")/\n */\n importPath;\n uniqueImportName;\n isLocal;\n sourcePackage;\n constructor(common, fullApiName, basePath) {\n this._common = common;\n this.fullApiName = fullApiName;\n [this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);\n const { ontologyApiNamespace, apiNamespacePackageMap, importExt } = common;\n this.isLocal = ontologyApiNamespace === this.apiNamespace;\n this.sourcePackage = this.apiNamespace && !this.isLocal\n ? apiNamespacePackageMap.get(this.apiNamespace)\n : undefined;\n this.importPath = this.isLocal\n ? `${basePath}/${this.shortApiName}${importExt}`\n : this.sourcePackage;\n this.uniqueImportName = this.shortApiName;\n }\n getImportPathRelTo = (filePath) => {\n if (this.importPath.startsWith(\".\")) {\n const result = path.relative(path.dirname(filePath), this.importPath)\n .split(path.sep).join(\"/\");\n if (result.startsWith(\".\")) {\n return result;\n }\n else {\n return `./${result}`;\n }\n }\n else {\n return this.importPath;\n }\n };\n}\nexport class EnhancedBase extends AbstractImportable {\n raw;\n constructor(common, raw, fullApiName, basePath) {\n super(common, fullApiName, basePath);\n this.raw = raw;\n if (!this.isLocal && !this.sourcePackage) {\n throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);\n }\n }\n}\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,IAAI,MAAM,WAAW;AACjC,OAAO,MAAMC,kBAAkB,CAAC;EAC5BC,OAAO;EACPC,YAAY;EACZC,WAAW;EACXC,YAAY;EACZ;AACJ;AACA;AACA;EACIC,UAAU;EACVC,gBAAgB;EAChBC,OAAO;EACPC,aAAa;EACbC,WAAWA,CAACC,MAAM,EAAEP,WAAW,EAAEQ,QAAQ,EAAE;IACvC,IAAI,CAACV,OAAO,GAAGS,MAAM;IACrB,IAAI,CAACP,WAAW,GAAGA,WAAW;IAC9B,CAAC,IAAI,CAACC,YAAY,EAAE,IAAI,CAACF,YAAY,CAAC,GAAGU,gBAAgB,CAAC,IAAI,CAACT,WAAW,CAAC;IAC3E,MAAM;MAAEU,oBAAoB;MAAEC,sBAAsB;MAAEC;IAAU,CAAC,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,aAAa,EAAE;MACtC,MAAM,IAAIqB,KAAK,CAAC,kBAAkB,IAAI,CAACzB,YAAY,kBAAkB,IAAI,CAACF,YAAY,0BAA0BQ,MAAM,CAACG,oBAAoB,oCAAoC,CAAC;IACpL;EACJ;AACJ;AACA,OAAO,SAASD,gBAAgBA,CAACkB,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EACX,OAAO,CAACd,SAAS,EAAEa,SAAS,CAAC;EACjC,OAAO,CAACA,SAAS,CAACG,KAAK,CAAC,CAAC,EAAEF,IAAI,CAAC,EAAED,SAAS,CAACG,KAAK,CAACF,IAAI,GAAG,CAAC,CAAC,CAAC;AAChE","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedBase.js","names":["path","AbstractImportable","_common","shortApiName","fullApiName","apiNamespace","importPath","uniqueImportName","constructor","common","basePath","isLocal","extractNamespace","importExt","getImportPathRelTo","filePath","startsWith","result","relative","dirname","split","sep","join","EnhancedBase","raw","fqApiName","last","lastIndexOf","undefined","slice"],"sources":["EnhancedBase.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as path from \"node:path\";\nexport class AbstractImportable {\n _common;\n shortApiName;\n fullApiName;\n apiNamespace;\n /**\n * Either a path relative to the ourDir (e.g. \"./ontology/objects/foo.js\") or a normal\n * module import (e.g. \"@something/foo\")/\n */\n importPath;\n uniqueImportName;\n constructor(common, fullApiName, basePath, isLocal = true) {\n this._common = common;\n this.fullApiName = fullApiName;\n [this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);\n const { importExt } = common;\n this.importPath = isLocal\n ? `${basePath}/${this.shortApiName}${importExt}`\n : basePath;\n this.uniqueImportName = this.shortApiName;\n }\n getImportPathRelTo = (filePath) => {\n if (this.importPath.startsWith(\".\")) {\n const result = path.relative(path.dirname(filePath), this.importPath)\n .split(path.sep).join(\"/\");\n if (result.startsWith(\".\")) {\n return result;\n }\n else {\n return `./${result}`;\n }\n }\n else {\n return this.importPath;\n }\n };\n}\nexport class EnhancedBase extends AbstractImportable {\n raw;\n constructor(common, raw, fullApiName, basePath) {\n super(common, fullApiName, basePath);\n this.raw = raw;\n }\n}\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,IAAI,MAAM,WAAW;AACjC,OAAO,MAAMC,kBAAkB,CAAC;EAC5BC,OAAO;EACPC,YAAY;EACZC,WAAW;EACXC,YAAY;EACZ;AACJ;AACA;AACA;EACIC,UAAU;EACVC,gBAAgB;EAChBC,WAAWA,CAACC,MAAM,EAAEL,WAAW,EAAEM,QAAQ,EAAEC,OAAO,GAAG,IAAI,EAAE;IACvD,IAAI,CAACT,OAAO,GAAGO,MAAM;IACrB,IAAI,CAACL,WAAW,GAAGA,WAAW;IAC9B,CAAC,IAAI,CAACC,YAAY,EAAE,IAAI,CAACF,YAAY,CAAC,GAAGS,gBAAgB,CAAC,IAAI,CAACR,WAAW,CAAC;IAC3E,MAAM;MAAES;IAAU,CAAC,GAAGJ,MAAM;IAC5B,IAAI,CAACH,UAAU,GAAGK,OAAO,GACnB,GAAGD,QAAQ,IAAI,IAAI,CAACP,YAAY,GAAGU,SAAS,EAAE,GAC9CH,QAAQ;IACd,IAAI,CAACH,gBAAgB,GAAG,IAAI,CAACJ,YAAY;EAC7C;EACAW,kBAAkB,GAAIC,QAAQ,IAAK;IAC/B,IAAI,IAAI,CAACT,UAAU,CAACU,UAAU,CAAC,GAAG,CAAC,EAAE;MACjC,MAAMC,MAAM,GAAGjB,IAAI,CAACkB,QAAQ,CAAClB,IAAI,CAACmB,OAAO,CAACJ,QAAQ,CAAC,EAAE,IAAI,CAACT,UAAU,CAAC,CAChEc,KAAK,CAACpB,IAAI,CAACqB,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MAC9B,IAAIL,MAAM,CAACD,UAAU,CAAC,GAAG,CAAC,EAAE;QACxB,OAAOC,MAAM;MACjB,CAAC,MACI;QACD,OAAO,KAAKA,MAAM,EAAE;MACxB;IACJ,CAAC,MACI;MACD,OAAO,IAAI,CAACX,UAAU;IAC1B;EACJ,CAAC;AACL;AACA,OAAO,MAAMiB,YAAY,SAAStB,kBAAkB,CAAC;EACjDuB,GAAG;EACHhB,WAAWA,CAACC,MAAM,EAAEe,GAAG,EAAEpB,WAAW,EAAEM,QAAQ,EAAE;IAC5C,KAAK,CAACD,MAAM,EAAEL,WAAW,EAAEM,QAAQ,CAAC;IACpC,IAAI,CAACc,GAAG,GAAGA,GAAG;EAClB;AACJ;AACA,OAAO,SAASZ,gBAAgBA,CAACa,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EACX,OAAO,CAACE,SAAS,EAAEH,SAAS,CAAC;EACjC,OAAO,CAACA,SAAS,CAACI,KAAK,CAAC,CAAC,EAAEH,IAAI,CAAC,EAAED,SAAS,CAACI,KAAK,CAACH,IAAI,GAAG,CAAC,CAAC,CAAC;AAChE","ignoreList":[]}
@@ -10,14 +10,14 @@ import { ForeignType } from "./ForeignType.js";
10
10
  export declare class EnhancedOntologyDefinition {
11
11
  #private;
12
12
  ontology: OntologyV2;
13
- objectTypes: Record<string, EnhancedObjectType>;
13
+ objectTypes: Record<string, EnhancedObjectType | ForeignType>;
14
14
  actionTypes: Record<string, EnhancedAction>;
15
15
  queryTypes: Record<string, EnhancedQuery>;
16
- interfaceTypes: Record<string, EnhancedInterfaceType>;
17
- sharedPropertyTypes: Record<string, EnhancedSharedPropertyType>;
16
+ interfaceTypes: Record<string, EnhancedInterfaceType | ForeignType>;
17
+ sharedPropertyTypes: Record<string, EnhancedSharedPropertyType | ForeignType>;
18
18
  raw: WireOntologyDefinition;
19
19
  common: EnhanceCommon;
20
- constructor(raw: WireOntologyDefinition, ontologyApiNamespace: string | undefined, apiNamespacePackageMap: Map<string, string>, importExt: string);
20
+ constructor(raw: WireOntologyDefinition, importExt: string, externalObjects?: Map<string, string>, externalInterfaces?: Map<string, string>, externalSpts?: Map<string, string>);
21
21
  requireObjectType: <L extends boolean = false>(fullApiName: string, localOnly?: L | undefined) => L extends true ? this["objectTypes"][string] : ForeignType;
22
22
  requireInterfaceType: <L extends boolean = false>(fullApiName: string, localOnly?: L | undefined) => L extends true ? this["interfaceTypes"][string] : ForeignType;
23
23
  requireActionType: <L extends boolean = false>(fullApiName: string, localOnly?: L | undefined) => L extends true ? this["actionTypes"][string] : ForeignType;
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedOntologyDefinition.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/EnhancedOntologyDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yB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,OAAO,uBACV,MAAM,8FAiBiD;IACjE,iBAAiB,GAnBd,CAAC,SAAS,OAAO,uBACV,MAAM,2FAkB2C;IAC3D,gBAAgB,GApBb,CAAC,SAAS,OAAO,uBACV,MAAM,0FAmByC;IACzD,yBAAyB,GArBtB,CAAC,SAAS,OAAO,uBACV,MAAM,mGAsBrB;CACH"}
@@ -30,35 +30,25 @@ export class EnhancedOntologyDefinition {
30
30
  #foreignTypes = {};
31
31
  raw;
32
32
  common;
33
- constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
33
+ constructor(raw, importExt, externalObjects, externalInterfaces, externalSpts) {
34
34
  this.common = {
35
- apiNamespacePackageMap,
36
35
  enhancedOntology: this,
37
- importExt,
38
- ontologyApiNamespace
36
+ importExt
39
37
  };
40
38
  this.raw = raw;
41
39
  this.ontology = raw.ontology;
42
- this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);
40
+ this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType, externalObjects);
43
41
  this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);
44
42
  this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);
45
- this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);
46
- this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
43
+ this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType, externalInterfaces);
44
+ this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType, externalSpts);
47
45
  }
48
46
  #createRequireType = type => {
49
- return (fullApiName, localOnly) => {
47
+ return fullApiName => {
50
48
  const ret = this[type][fullApiName];
51
49
  if (!ret) {
52
50
  const [apiNamespace, shortApiName] = extractNamespace(fullApiName);
53
- if (localOnly || !apiNamespace) {
54
- throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);
55
- }
56
- if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
57
- throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);
58
- }
59
- const ret = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);
60
- this.#foreignTypes[fullApiName] = ret;
61
- return ret;
51
+ throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);
62
52
  }
63
53
  return ret;
64
54
  };
@@ -69,9 +59,25 @@ export class EnhancedOntologyDefinition {
69
59
  requireQueryType = this.#createRequireType("queryTypes");
70
60
  requireSharedPropertyType = this.#createRequireType("sharedPropertyTypes");
71
61
  }
72
- function remap(r, common, Constructor) {
73
- return Object.fromEntries(Object.entries(r ?? {}).map(([fullApiName, v]) => {
74
- return [fullApiName, new Constructor(common, v)];
75
- }).sort((a, b) => a[0].localeCompare(b[0])));
62
+ function remap(r, common, Constructor, externalMap) {
63
+ const entries = [];
64
+ for (const [fullApiName, v] of Object.entries(r ?? {})) {
65
+ if (!externalMap?.has(fullApiName)) {
66
+ entries.push([fullApiName, new Constructor(common, v)]);
67
+ } // skip it, we handle it below
68
+ }
69
+ if (externalMap) {
70
+ for (const [fullApiName, destPackage] of externalMap) {
71
+ const [apiNamespace, shortApiName] = extractNamespace(fullApiName);
72
+ // I think this check should be required but the ontology manager / dev console doesn't enforce it right now
73
+ // if (apiNamespace === undefined) {
74
+ // throw new Error(
75
+ // `Cannot reference an external type (${fullApiName}) that is missing a namespace`,
76
+ // );
77
+ // }
78
+ entries.push([fullApiName, new ForeignType(common, apiNamespace, shortApiName, destPackage)]);
79
+ }
80
+ }
81
+ return Object.fromEntries(entries.sort((a, b) => a[0].localeCompare(b[0])));
76
82
  }
77
83
  //# sourceMappingURL=EnhancedOntologyDefinition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedOntologyDefinition.js","names":["EnhancedAction","extractNamespace","EnhancedInterfaceType","EnhancedObjectType","EnhancedQuery","EnhancedSharedPropertyType","ForeignType","EnhancedOntologyDefinition","ontology","objectTypes","actionTypes","queryTypes","interfaceTypes","sharedPropertyTypes","foreignTypes","raw","common","constructor","ontologyApiNamespace","apiNamespacePackageMap","importExt","enhancedOntology","remap","createRequireType","type","fullApiName","localOnly","ret","apiNamespace","shortApiName","Error","has","requireObjectType","requireInterfaceType","requireActionType","requireQueryType","requireSharedPropertyType","r","Constructor","Object","fromEntries","entries","map","v","sort","a","b","localeCompare"],"sources":["EnhancedOntologyDefinition.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EnhancedAction } from \"./EnhancedAction.js\";\nimport { extractNamespace } from \"./EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"./EnhancedInterfaceType.js\";\nimport { EnhancedObjectType } from \"./EnhancedObjectType.js\";\nimport { EnhancedQuery } from \"./EnhancedQuery.js\";\nimport { EnhancedSharedPropertyType } from \"./EnhancedSharedPropertyType.js\";\nimport { ForeignType } from \"./ForeignType.js\";\nexport class EnhancedOntologyDefinition {\n ontology;\n objectTypes;\n actionTypes;\n queryTypes;\n interfaceTypes;\n sharedPropertyTypes;\n #foreignTypes = {};\n raw;\n common;\n constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {\n this.common = {\n apiNamespacePackageMap,\n enhancedOntology: this,\n importExt,\n ontologyApiNamespace,\n };\n this.raw = raw;\n this.ontology = raw.ontology;\n this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);\n this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);\n this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);\n this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);\n this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);\n }\n #createRequireType = (type) => {\n return (fullApiName, localOnly) => {\n const ret = this[type][fullApiName];\n if (!ret) {\n const [apiNamespace, shortApiName] = extractNamespace(fullApiName);\n if (localOnly || !apiNamespace) {\n throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);\n }\n if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {\n throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);\n }\n const ret = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);\n this.#foreignTypes[fullApiName] = ret;\n return ret;\n }\n return ret;\n };\n };\n requireObjectType = this.#createRequireType(\"objectTypes\");\n requireInterfaceType = this.#createRequireType(\"interfaceTypes\");\n requireActionType = this.#createRequireType(\"actionTypes\");\n requireQueryType = this.#createRequireType(\"queryTypes\");\n requireSharedPropertyType = this.#createRequireType(\"sharedPropertyTypes\");\n}\nfunction remap(r, common, Constructor) {\n return Object.fromEntries(Object.entries(r ?? {}).map(([fullApiName, v]) => {\n return [\n fullApiName,\n new Constructor(common, v),\n ];\n }).sort((a, b) => a[0].localeCompare(b[0])));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,qBAAqB;AACpD,SAASC,gBAAgB,QAAQ,mBAAmB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,OAAO,MAAMC,0BAA0B,CAAC;EACpCC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC,UAAU;EACVC,cAAc;EACdC,mBAAmB;EACnB,CAACC,YAAY,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C,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedOntologyDefinition.js","names":["EnhancedAction","extractNamespace","EnhancedInterfaceType","EnhancedObjectType","EnhancedQuery","EnhancedSharedPropertyType","ForeignType","EnhancedOntologyDefinition","ontology","objectTypes","actionTypes","queryTypes","interfaceTypes","sharedPropertyTypes","foreignTypes","raw","common","constructor","importExt","externalObjects","externalInterfaces","externalSpts","enhancedOntology","remap","createRequireType","type","fullApiName","ret","apiNamespace","shortApiName","Error","requireObjectType","requireInterfaceType","requireActionType","requireQueryType","requireSharedPropertyType","r","Constructor","externalMap","entries","v","Object","has","push","destPackage","fromEntries","sort","a","b","localeCompare"],"sources":["EnhancedOntologyDefinition.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EnhancedAction } from \"./EnhancedAction.js\";\nimport { extractNamespace } from \"./EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"./EnhancedInterfaceType.js\";\nimport { EnhancedObjectType } from \"./EnhancedObjectType.js\";\nimport { EnhancedQuery } from \"./EnhancedQuery.js\";\nimport { EnhancedSharedPropertyType } from \"./EnhancedSharedPropertyType.js\";\nimport { ForeignType } from \"./ForeignType.js\";\nexport class EnhancedOntologyDefinition {\n ontology;\n objectTypes;\n actionTypes;\n queryTypes;\n interfaceTypes;\n sharedPropertyTypes;\n #foreignTypes = {};\n raw;\n common;\n constructor(raw, importExt, externalObjects, externalInterfaces, externalSpts) {\n this.common = {\n enhancedOntology: this,\n importExt,\n };\n this.raw = raw;\n this.ontology = raw.ontology;\n this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType, externalObjects);\n this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);\n this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);\n this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType, externalInterfaces);\n this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType, externalSpts);\n }\n #createRequireType = (type) => {\n return (fullApiName, localOnly) => {\n const ret = this[type][fullApiName];\n if (!ret) {\n const [apiNamespace, shortApiName] = extractNamespace(fullApiName);\n throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);\n }\n return ret;\n };\n };\n requireObjectType = this.#createRequireType(\"objectTypes\");\n requireInterfaceType = this.#createRequireType(\"interfaceTypes\");\n requireActionType = this.#createRequireType(\"actionTypes\");\n requireQueryType = this.#createRequireType(\"queryTypes\");\n requireSharedPropertyType = this.#createRequireType(\"sharedPropertyTypes\");\n}\nfunction remap(r, common, Constructor, externalMap) {\n const entries = [];\n for (const [fullApiName, v] of Object.entries(r ?? {})) {\n if (externalMap?.has(fullApiName)) {\n // skip it, we handle it below\n }\n else {\n entries.push([fullApiName, new Constructor(common, v)]);\n }\n }\n if (externalMap) {\n for (const [fullApiName, destPackage] of externalMap) {\n const [apiNamespace, shortApiName] = extractNamespace(fullApiName);\n // I think this check should be required but the ontology manager / dev console doesn't enforce it right now\n // if (apiNamespace === undefined) {\n // throw new Error(\n // `Cannot reference an external type (${fullApiName}) that is missing a namespace`,\n // );\n // }\n entries.push([\n fullApiName,\n new ForeignType(common, apiNamespace, shortApiName, destPackage),\n ]);\n }\n }\n return Object.fromEntries(entries.sort((a, b) => a[0].localeCompare(b[0])));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,qBAAqB;AACpD,SAASC,gB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AAEC,YAAY,CAAC,GAAG5B,gBAAgB,CAACyB,WAAW,CAAC;MAClE;MACA;MACA;MACA;MACA;MACA;MACAa,OAAO,CAACI,IAAI,CAAC,CACTjB,WAAW,EACX,IAAIpB,WAAW,CAACU,MAAM,EAAEY,YAAY,EAAEC,YAAY,EAAEe,WAAW,CAAC,CACnE,CAAC;IACN;EACJ;EACA,OAAOH,MAAM,CAACI,WAAW,CAACN,OAAO,CAACO,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/E","ignoreList":[]}
@@ -2,8 +2,7 @@ import type { EnhanceCommon } from "./EnhanceCommon.js";
2
2
  import { AbstractImportable } from "./EnhancedBase.js";
3
3
  export declare class ForeignType extends AbstractImportable {
4
4
  _common: EnhanceCommon;
5
- readonly type: string;
6
- constructor(_common: EnhanceCommon, type: string, apiNamespace: string, shortApiName: string);
5
+ constructor(_common: EnhanceCommon, apiNamespace: string | undefined, shortApiName: string, destinationPackage: string);
7
6
  getImportedDefinitionIdentifier(v2: boolean): string;
8
7
  getDefinitionIdentifier(v2: boolean): string;
9
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ForeignType.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/ForeignType.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,qBAAa,WAAY,SAAQ,kBAAkB;IAExC,OAAO,EAAE,aAAa;aACb,IAAI,EAAE,MAAM;gBADrB,OAAO,EAAE,aAAa,EACb,IAAI,EAAE,MAAM,EAC5B,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM;IAStB,+BAA+B,CAAC,EAAE,EAAE,OAAO;IAM3C,uBAAuB,CAAC,EAAE,EAAE,OAAO;CAOpC"}
1
+ {"version":3,"file":"ForeignType.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/ForeignType.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,qBAAa,WAAY,SAAQ,kBAAkB;IAExC,OAAO,EAAE,aAAa;gBAAtB,OAAO,EAAE,aAAa,EAC7B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,MAAM;IAU5B,+BAA+B,CAAC,EAAE,EAAE,OAAO;IAM3C,uBAAuB,CAAC,EAAE,EAAE,OAAO;CAGpC"}
@@ -16,21 +16,15 @@
16
16
  import { AbstractImportable } from "./EnhancedBase.js";
17
17
  export class ForeignType extends AbstractImportable {
18
18
  _common;
19
- type;
20
- constructor(_common, type, apiNamespace, shortApiName) {
21
- super(_common, `${apiNamespace}.${shortApiName}`, _common.apiNamespacePackageMap.get(apiNamespace));
19
+ constructor(_common, apiNamespace, shortApiName, destinationPackage) {
20
+ super(_common, apiNamespace ? `${apiNamespace}.${shortApiName}` : shortApiName, destinationPackage, false);
22
21
  this._common = _common;
23
- this.type = type;
24
22
  }
25
23
  getImportedDefinitionIdentifier() {
26
- return `$Imported$${this.type}$${this.apiNamespace.replace(/\./g, "$")}$${this.shortApiName}`;
24
+ return `$Imported$${this.apiNamespace?.replace(/\./g, "$")}$${this.shortApiName}`;
27
25
  }
28
- getDefinitionIdentifier(v2) {
29
- if (this.type === "objectTypes") {
30
- return v2 ? this.uniqueImportName : `${this.uniqueImportName}Def`;
31
- } else {
32
- return this.uniqueImportName;
33
- }
26
+ getDefinitionIdentifier() {
27
+ return this.uniqueImportName;
34
28
  }
35
29
  }
36
30
  //# sourceMappingURL=ForeignType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ForeignType.js","names":["AbstractImportable","ForeignType","_common","type","constructor","apiNamespace","shortApiName","apiNamespacePackageMap","get","getImportedDefinitionIdentifier","replace","getDefinitionIdentifier","v2","uniqueImportName"],"sources":["ForeignType.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { AbstractImportable } from \"./EnhancedBase.js\";\nexport class ForeignType extends AbstractImportable {\n _common;\n type;\n constructor(_common, type, apiNamespace, shortApiName) {\n super(_common, `${apiNamespace}.${shortApiName}`, _common.apiNamespacePackageMap.get(apiNamespace));\n this._common = _common;\n this.type = type;\n }\n getImportedDefinitionIdentifier(v2) {\n return `$Imported$${this.type}$${this.apiNamespace.replace(/\\./g, \"$\")}$${this.shortApiName}`;\n }\n getDefinitionIdentifier(v2) {\n if (this.type === \"objectTypes\") {\n return v2 ? this.uniqueImportName : `${this.uniqueImportName}Def`;\n }\n else {\n return this.uniqueImportName;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAkB,QAAQ,mBAAmB;AACtD,OAAO,MAAMC,WAAW,SAASD,kBAAkB,CAAC;EAChDE,OAAO;EACPC,IAAI;EACJC,WAAWA,CAACF,OAAO,EAAEC,IAAI,EAAEE,YAAY,EAAEC,YAAY,EAAE;IACnD,KAAK,CAACJ,OAAO,EAAE,GAAGG,YAAY,IAAIC,YAAY,EAAE,EAAEJ,OAAO,CAACK,sBAAsB,CAACC,GAAG,CAACH,YAAY,CAAC,CAAC;IACnG,IAAI,CAACH,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,IAAI,GAAGA,IAAI;EACpB;EACAM,+BAA+BA,CAAA,EAAK;IAChC,OAAO,aAAa,IAAI,CAACN,IAAI,IAAI,IAAI,CAACE,YAAY,CAACK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,IAAI,CAACJ,YAAY,EAAE;EACjG;EACAK,uBAAuBA,CAACC,EAAE,EAAE;IACxB,IAAI,IAAI,CAACT,IAAI,KAAK,aAAa,EAAE;MAC7B,OAAOS,EAAE,GAAG,IAAI,CAACC,gBAAgB,GAAG,GAAG,IAAI,CAACA,gBAAgB,KAAK;IACrE,CAAC,MACI;MACD,OAAO,IAAI,CAACA,gBAAgB;IAChC;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"ForeignType.js","names":["AbstractImportable","ForeignType","_common","constructor","apiNamespace","shortApiName","destinationPackage","getImportedDefinitionIdentifier","replace","getDefinitionIdentifier","uniqueImportName"],"sources":["ForeignType.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { AbstractImportable } from \"./EnhancedBase.js\";\nexport class ForeignType extends AbstractImportable {\n _common;\n constructor(_common, apiNamespace, shortApiName, destinationPackage) {\n super(_common, apiNamespace ? `${apiNamespace}.${shortApiName}` : shortApiName, destinationPackage, false);\n this._common = _common;\n }\n getImportedDefinitionIdentifier(v2) {\n return `$Imported$${this.apiNamespace?.replace(/\\./g, \"$\")}$${this.shortApiName}`;\n }\n getDefinitionIdentifier(v2) {\n return this.uniqueImportName;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAkB,QAAQ,mBAAmB;AACtD,OAAO,MAAMC,WAAW,SAASD,kBAAkB,CAAC;EAChDE,OAAO;EACPC,WAAWA,CAACD,OAAO,EAAEE,YAAY,EAAEC,YAAY,EAAEC,kBAAkB,EAAE;IACjE,KAAK,CAACJ,OAAO,EAAEE,YAAY,GAAG,GAAGA,YAAY,IAAIC,YAAY,EAAE,GAAGA,YAAY,EAAEC,kBAAkB,EAAE,KAAK,CAAC;IAC1G,IAAI,CAACJ,OAAO,GAAGA,OAAO;EAC1B;EACAK,+BAA+BA,CAAA,EAAK;IAChC,OAAO,aAAa,IAAI,CAACH,YAAY,EAAEI,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,IAAI,CAACH,YAAY,EAAE;EACrF;EACAI,uBAAuBA,CAAA,EAAK;IACxB,OAAO,IAAI,CAACC,gBAAgB;EAChC;AACJ","ignoreList":[]}
@@ -1,4 +1,10 @@
1
1
  import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
2
2
  import { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
3
- export declare function enhanceOntology(sanitized: WireOntologyDefinition, ontologyApiNamespace: string | undefined, apiNamespacePackageMap: Map<string, string>, importExt: string): EnhancedOntologyDefinition;
3
+ export declare function enhanceOntology({ sanitized, importExt, externalObjects, externalInterfaces, externalSpts, }: {
4
+ sanitized: WireOntologyDefinition;
5
+ externalObjects?: Map<string, string>;
6
+ externalInterfaces?: Map<string, string>;
7
+ externalSpts?: Map<string, string>;
8
+ importExt: string;
9
+ }): EnhancedOntologyDefinition;
4
10
  //# sourceMappingURL=enhanceOntology.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enhanceOntology.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/enhanceOntology.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,wBAAgB,eAAe,CAC7B,SAAS,EAAE,sBAAsB,EACjC,oBAAoB,EAAE,MAAM,GAAG,SAAS,EACxC,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3C,SAAS,EAAE,MAAM,GAChB,0BAA0B,CAO5B"}
1
+ {"version":3,"file":"enhanceOntology.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/enhanceOntology.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,wBAAgB,eAAe,CAC7B,EACE,SAAS,EACT,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,YAAY,GACb,EAAE;IACD,SAAS,EAAE,sBAAsB,CAAC;IAClC,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB,GACA,0BAA0B,CAQ5B"}
@@ -14,7 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
17
- export function enhanceOntology(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
18
- return new EnhancedOntologyDefinition(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt);
17
+ export function enhanceOntology({
18
+ sanitized,
19
+ importExt,
20
+ externalObjects,
21
+ externalInterfaces,
22
+ externalSpts
23
+ }) {
24
+ return new EnhancedOntologyDefinition(sanitized, importExt, externalObjects, externalInterfaces, externalSpts);
19
25
  }
20
26
  //# sourceMappingURL=enhanceOntology.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enhanceOntology.js","names":["EnhancedOntologyDefinition","enhanceOntology","sanitized","ontologyApiNamespace","apiNamespacePackageMap","importExt"],"sources":["enhanceOntology.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EnhancedOntologyDefinition } from \"./EnhancedOntologyDefinition.js\";\nexport function enhanceOntology(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt) {\n return new EnhancedOntologyDefinition(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,0BAA0B,QAAQ,iCAAiC;AAC5E,OAAO,SAASC,eAAeA,CAACC,SAAS,EAAEC,oBAAoB,EAAEC,sBAAsB,EAAEC,SAAS,EAAE;EAChG,OAAO,IAAIL,0BAA0B,CAACE,SAAS,EAAEC,oBAAoB,EAAEC,sBAAsB,EAAEC,SAAS,CAAC;AAC7G","ignoreList":[]}
1
+ {"version":3,"file":"enhanceOntology.js","names":["EnhancedOntologyDefinition","enhanceOntology","sanitized","importExt","externalObjects","externalInterfaces","externalSpts"],"sources":["enhanceOntology.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EnhancedOntologyDefinition } from \"./EnhancedOntologyDefinition.js\";\nexport function enhanceOntology({ sanitized, importExt, externalObjects, externalInterfaces, externalSpts, }) {\n return new EnhancedOntologyDefinition(sanitized, importExt, externalObjects, externalInterfaces, externalSpts);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,0BAA0B,QAAQ,iCAAiC;AAC5E,OAAO,SAASC,eAAeA,CAAC;EAAEC,SAAS;EAAEC,SAAS;EAAEC,eAAe;EAAEC,kBAAkB;EAAEC;AAAc,CAAC,EAAE;EAC1G,OAAO,IAAIN,0BAA0B,CAACE,SAAS,EAAEC,SAAS,EAAEC,eAAe,EAAEC,kBAAkB,EAAEC,YAAY,CAAC;AAClH","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import type { MinimalFs } from "./MinimalFs.js";
2
2
  import type { WireOntologyDefinition } from "./WireOntologyDefinition.js";
3
- export declare function generateClientSdkPackage(packageName: string, packageVersion: string, sdkVersion: "1.1" | "2.0", baseOutDir: string, ontology: WireOntologyDefinition, minimalFs: MinimalFs, dependencyVersions: DependencyVersions, cliVersion: string, ontologyApiNamespace: string | undefined, apiNamespacePackageMap: Map<string, string>): Promise<void>;
3
+ export declare function generateClientSdkPackage(packageName: string, packageVersion: string, sdkVersion: "1.1" | "2.0", baseOutDir: string, ontology: WireOntologyDefinition, minimalFs: MinimalFs, dependencyVersions: DependencyVersions, cliVersion: string, externalObjects?: Map<string, string>, externalInterfaces?: Map<string, string>): Promise<void>;
4
4
  export interface DependencyVersions {
5
5
  typescriptVersion: string;
6
6
  tslibVersion: string;
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientSdkPackage.d.ts","sourceRoot":"","sources":["../../src/generateClientSdkPackage.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,KAAK,GAAG,KAAK,EACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,EAClB,oBAAoB,EAAE,MAAM,GAAG,SAAS,EACxC,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,iBA4D5C;AA+BD,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,uBAAuB,CACrC,EACE,cAAc,EACd,iBAAiB,GAClB,EAAE,kBAAkB;;;;;;;;EAWtB;AA0BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BvC"}
1
+ {"version":3,"file":"generateClientSdkPackage.d.ts","sourceRoot":"","sources":["../../src/generateClientSdkPackage.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,KAAK,GAAG,KAAK,EACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,EAClB,eAAe,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EAChD,kBAAkB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,iBA4DpD;AA+BD,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,uBAAuB,CACrC,EACE,cAAc,EACd,iBAAiB,GAClB,EAAE,kBAAkB;;;;;;;;EAWtB;AA0BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BvC"}
@@ -16,14 +16,14 @@
16
16
  import * as fs from "node:fs";
17
17
  import * as path from "node:path";
18
18
  import { generateClientSdkVersionTwoPointZero } from "./v2.0/generateClientSdkVersionTwoPointZero.js";
19
- export async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, ontologyApiNamespace, apiNamespacePackageMap) {
19
+ export async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, externalObjects = new Map(), externalInterfaces = new Map()) {
20
20
  if (!packageName) throw new Error("Package name is required");
21
21
  if (sdkVersion === "1.1") {
22
22
  throw new Error("This generator version does not support generating v1 sdks");
23
23
  }
24
24
  for (const packageType of ["module", "commonjs"]) {
25
25
  const outDir = path.join(baseOutDir, "dist", packageType);
26
- generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, ontologyApiNamespace, apiNamespacePackageMap);
26
+ generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, externalObjects, externalInterfaces);
27
27
  await fs.promises.mkdir(outDir, {
28
28
  recursive: true
29
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientSdkPackage.js","names":["fs","path","generateClientSdkVersionTwoPointZero","generateClientSdkPackage","packageName","packageVersion","sdkVersion","baseOutDir","ontology","minimalFs","dependencyVersions","cliVersion","ontologyApiNamespace","apiNamespacePackageMap","Error","packageType","outDir","join","promises","mkdir","recursive","writeJson","type","compilerOptions","getTsCompilerOptions","getPackageJsonContents","writeFile","commonTsconfig","importHelpers","declaration","isolatedModules","esModuleInterop","forceConsistentCasingInFileNames","strict","skipLibCheck","module","target","getExpectedDependencies","osdkApiVersion","osdkClientVersion","devDependencies","peerDependencies","getExpectedDependenciesFull","typescriptVersion","tslibVersion","areTheTypesWrongVersion","base","name","version","esmPrefix","commonjsPrefix","main","exports","import","require","scripts","prepack","check","files","filePath","body","JSON","stringify","undefined"],"sources":["generateClientSdkPackage.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { generateClientSdkVersionTwoPointZero } from \"./v2.0/generateClientSdkVersionTwoPointZero.js\";\nexport async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, ontologyApiNamespace, apiNamespacePackageMap) {\n if (!packageName)\n throw new Error(\"Package name is required\");\n if (sdkVersion === \"1.1\") {\n throw new Error(\"This generator version does not support generating v1 sdks\");\n }\n for (const packageType of [\"module\", \"commonjs\"]) {\n const outDir = path.join(baseOutDir, \"dist\", packageType);\n generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, ontologyApiNamespace, apiNamespacePackageMap);\n await fs.promises.mkdir(outDir, { recursive: true });\n await writeJson(minimalFs, path.join(outDir, \"package.json\"), { type: packageType });\n await writeJson(minimalFs, path.join(outDir, `tsconfig.json`), {\n compilerOptions: getTsCompilerOptions(packageType),\n });\n }\n await writeJson(minimalFs, path.join(baseOutDir, \"package.json\"), await getPackageJsonContents(packageName, packageVersion, dependencyVersions));\n // we need to shim for the node10 resolver\n await minimalFs.mkdir(path.join(baseOutDir, \"ontology\"), {\n recursive: true,\n });\n await minimalFs.writeFile(path.join(baseOutDir, \"ontology\", \"objects.js\"), `module.exports = require(\"../../dist/module/ontology/objects\")`);\n await minimalFs.writeFile(path.join(baseOutDir, \"ontology\", \"objects.d.ts\"), `export * from \"../dist/module/ontology/objects\"`);\n}\nfunction getTsCompilerOptions(packageType) {\n const commonTsconfig = {\n importHelpers: true,\n declaration: true,\n isolatedModules: true,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n strict: true,\n skipLibCheck: true,\n };\n const compilerOptions = packageType === \"commonjs\"\n ? {\n ...commonTsconfig,\n module: \"commonjs\",\n target: \"es2018\",\n }\n : {\n ...commonTsconfig,\n module: \"NodeNext\",\n target: \"ES2020\",\n };\n return compilerOptions;\n}\nexport function getExpectedDependencies({ osdkApiVersion, osdkClientVersion, }) {\n return {\n devDependencies: {\n \"@osdk/api\": osdkApiVersion,\n },\n peerDependencies: {\n \"@osdk/api\": osdkApiVersion,\n \"@osdk/client\": osdkClientVersion,\n },\n };\n}\nfunction getExpectedDependenciesFull(dependencyVersions) {\n const { typescriptVersion, tslibVersion, areTheTypesWrongVersion, } = dependencyVersions;\n const base = getExpectedDependencies(dependencyVersions);\n return {\n devDependencies: {\n ...base.devDependencies,\n \"typescript\": typescriptVersion,\n \"tslib\": tslibVersion,\n \"@arethetypeswrong/cli\": areTheTypesWrongVersion,\n },\n peerDependencies: {\n ...base.peerDependencies,\n },\n };\n}\nexport function getPackageJsonContents(name, version, dependencyVersions) {\n const esmPrefix = \"./dist/module\";\n const commonjsPrefix = \"./dist/commonjs\";\n return {\n name,\n version,\n main: `${commonjsPrefix}/index.js`,\n module: `${esmPrefix}/index.js`,\n exports: {\n \".\": {\n import: `${esmPrefix}/index.js`,\n require: `${commonjsPrefix}/index.js`,\n },\n },\n scripts: {\n prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,\n check: \"npm exec attw $(npm pack)\",\n },\n ...getExpectedDependenciesFull(dependencyVersions),\n files: [\n \"**/*.js\",\n \"**/*.d.ts\",\n \"dist/**/package.json\",\n ],\n };\n}\nasync function writeJson(minimalFs, filePath, body) {\n // consola.info(`Writing ${filePath}`);\n // consola.debug(`Writing ${filePath} with body`, body);\n return await minimalFs.writeFile(filePath, JSON.stringify(body, undefined, 2) + \"\\n\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,EAAE,MAAM,SAAS;AAC7B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,oCAAoC,QAAQ,gDAAgD;AACrG,OAAO,eAAeC,wBAAwBA,CAACC,WAAW,EAAEC,cAAc,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,kBAAkB,EAAEC,UAAU,EAAEC,oBAAoB,EAAEC,sBAAsB,EAAE;EACnM,IAAI,CAACT,WAAW,EACZ,MAAM,IA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AACL;AACA,OAAO,SAAShB,sBAAsBA,CAACsB,IAAI,EAAEC,OAAO,EAAEtC,kBAAkB,EAAE;EACtE,MAAMuC,SAAS,GAAG,eAAe;EACjC,MAAMC,cAAc,GAAG,iBAAiB;EACxC,OAAO;IACHH,IAAI;IACJC,OAAO;IACPG,IAAI,EAAE,GAAGD,cAAc,WAAW;IAClCf,MAAM,EAAE,GAAGc,SAAS,WAAW;IAC/BG,OAAO,EAAE;MACL,GAAG,EAAE;QACDC,MAAM,EAAE,GAAGJ,SAAS,WAAW;QAC/BK,OAAO,EAAE,GAAGJ,cAAc;MAC9B;IACJ,CAAC;IACDK,OAAO,EAAE;MACLC,OAAO,EAAE,UAAUP,SAAS,4BAA4BC,cAAc,gBAAgB;MACtFO,KAAK,EAAE;IACX,CAAC;IACD,GAAGf,2BAA2B,CAAChC,kBAAkB,CAAC;IAClDgD,KAAK,EAAE,CACH,SAAS,EACT,WAAW,EACX,sBAAsB;EAE9B,CAAC;AACL;AACA,eAAerC,SAASA,CAACZ,SAAS,EAAEkD,QAAQ,EAAEC,IAAI,EAAE;EAChD;EACA;EACA,OAAO,MAAMnD,SAAS,CAACiB,SAAS,CAACiC,QAAQ,EAAEE,IAAI,CAACC,SAAS,CAACF,IAAI,EAAEG,SAAS,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AACzF","ignoreList":[]}
1
+ {"version":3,"file":"generateClientSdkPackage.js","names":["fs","path","generateClientSdkVersionTwoPointZero","generateClientSdkPackage","packageName","packageVersion","sdkVersion","baseOutDir","ontology","minimalFs","dependencyVersions","cliVersion","externalObjects","Map","externalInterfaces","Error","packageType","outDir","join","promises","mkdir","recursive","writeJson","type","compilerOptions","getTsCompilerOptions","getPackageJsonContents","writeFile","commonTsconfig","importHelpers","declaration","isolatedModules","esModuleInterop","forceConsistentCasingInFileNames","strict","skipLibCheck","module","target","getExpectedDependencies","osdkApiVersion","osdkClientVersion","devDependencies","peerDependencies","getExpectedDependenciesFull","typescriptVersion","tslibVersion","areTheTypesWrongVersion","base","name","version","esmPrefix","commonjsPrefix","main","exports","import","require","scripts","prepack","check","files","filePath","body","JSON","stringify","undefined"],"sources":["generateClientSdkPackage.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { generateClientSdkVersionTwoPointZero } from \"./v2.0/generateClientSdkVersionTwoPointZero.js\";\nexport async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, externalObjects = new Map(), externalInterfaces = new Map()) {\n if (!packageName)\n throw new Error(\"Package name is required\");\n if (sdkVersion === \"1.1\") {\n throw new Error(\"This generator version does not support generating v1 sdks\");\n }\n for (const packageType of [\"module\", \"commonjs\"]) {\n const outDir = path.join(baseOutDir, \"dist\", packageType);\n generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, externalObjects, externalInterfaces);\n await fs.promises.mkdir(outDir, { recursive: true });\n await writeJson(minimalFs, path.join(outDir, \"package.json\"), { type: packageType });\n await writeJson(minimalFs, path.join(outDir, `tsconfig.json`), {\n compilerOptions: getTsCompilerOptions(packageType),\n });\n }\n await writeJson(minimalFs, path.join(baseOutDir, \"package.json\"), await getPackageJsonContents(packageName, packageVersion, dependencyVersions));\n // we need to shim for the node10 resolver\n await minimalFs.mkdir(path.join(baseOutDir, \"ontology\"), {\n recursive: true,\n });\n await minimalFs.writeFile(path.join(baseOutDir, \"ontology\", \"objects.js\"), `module.exports = require(\"../../dist/module/ontology/objects\")`);\n await minimalFs.writeFile(path.join(baseOutDir, \"ontology\", \"objects.d.ts\"), `export * from \"../dist/module/ontology/objects\"`);\n}\nfunction getTsCompilerOptions(packageType) {\n const commonTsconfig = {\n importHelpers: true,\n declaration: true,\n isolatedModules: true,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n strict: true,\n skipLibCheck: true,\n };\n const compilerOptions = packageType === \"commonjs\"\n ? {\n ...commonTsconfig,\n module: \"commonjs\",\n target: \"es2018\",\n }\n : {\n ...commonTsconfig,\n module: \"NodeNext\",\n target: \"ES2020\",\n };\n return compilerOptions;\n}\nexport function getExpectedDependencies({ osdkApiVersion, osdkClientVersion, }) {\n return {\n devDependencies: {\n \"@osdk/api\": osdkApiVersion,\n },\n peerDependencies: {\n \"@osdk/api\": osdkApiVersion,\n \"@osdk/client\": osdkClientVersion,\n },\n };\n}\nfunction getExpectedDependenciesFull(dependencyVersions) {\n const { typescriptVersion, tslibVersion, areTheTypesWrongVersion, } = dependencyVersions;\n const base = getExpectedDependencies(dependencyVersions);\n return {\n devDependencies: {\n ...base.devDependencies,\n \"typescript\": typescriptVersion,\n \"tslib\": tslibVersion,\n \"@arethetypeswrong/cli\": areTheTypesWrongVersion,\n },\n peerDependencies: {\n ...base.peerDependencies,\n },\n };\n}\nexport function getPackageJsonContents(name, version, dependencyVersions) {\n const esmPrefix = \"./dist/module\";\n const commonjsPrefix = \"./dist/commonjs\";\n return {\n name,\n version,\n main: `${commonjsPrefix}/index.js`,\n module: `${esmPrefix}/index.js`,\n exports: {\n \".\": {\n import: `${esmPrefix}/index.js`,\n require: `${commonjsPrefix}/index.js`,\n },\n },\n scripts: {\n prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,\n check: \"npm exec attw $(npm pack)\",\n },\n ...getExpectedDependenciesFull(dependencyVersions),\n files: [\n \"**/*.js\",\n \"**/*.d.ts\",\n \"dist/**/package.json\",\n ],\n };\n}\nasync function writeJson(minimalFs, filePath, body) {\n // consola.info(`Writing ${filePath}`);\n // consola.debug(`Writing ${filePath} with body`, body);\n return await minimalFs.writeFile(filePath, JSON.stringify(body, undefined, 2) + \"\\n\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,EAAE,MAAM,SAAS;AAC7B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,oCAAoC,QAAQ,gDAAgD;AACrG,OAAO,eAAeC,wBAAwBA,CAACC,WAAW,EAAEC,cAAc,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,kBAAkB,EAAEC,UAAU,EAAEC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC,EAAEC,kBAAkB,GAAG,IAAID,GAAG,CAAC,CAAC,EAAE;EAClN,IAAI,CAACT,WAAW,EACZ,MAAM,IAAIW,KAAK,CAAC,0BAA0B,CAAC;EAC/C,IAAIT,UAAU,KAAK,KAAK,EAAE;IACtB,MAAM,IAAIS,KAAK,CAAC,4DAA4D,CAAC;EACjF;EACA,KAAK,MAAMC,WAAW,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE;IAC9C,MAAMC,MAAM,GAAGhB,IAAI,CAACiB,IAAI,CAACX,UAAU,EAAE,MAAM,EAAES,WAAW,CAAC;IACzDd,oCAAoC,CAACM,QAAQ,EAAE,kBAAkBH,cAAc,aAAaM,UAAU,EAAE,EAAEF,SAAS,EAAEQ,MAAM,EAAED,WAAW,EAAEJ,eAAe,EAAEE,kBAAkB,CAAC;IAC9K,MAAMd,EAAE,CAACmB,QAAQ,CAACC,KAAK,CAACH,MAAM,EAAE;MAAEI,SAAS,EAAE;IAAK,CAAC,CAAC;IACpD,MAAMC,SAAS,CAACb,SAAS,EAAER,IAAI,CAACiB,IAAI,CAACD,MAAM,EAAE,cAAc,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AACA,eAAerC,SAASA,CAACb,SAAS,EAAEmD,QAAQ,EAAEC,IAAI,EAAE;EAChD;EACA;EACA,OAAO,MAAMpD,SAAS,CAACkB,SAAS,CAACiC,QAAQ,EAAEE,IAAI,CAACC,SAAS,CAACF,IAAI,EAAEG,SAAS,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AACzF","ignoreList":[]}
@@ -17,7 +17,7 @@ import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/gener
17
17
  import fastDeepEqual from "fast-deep-equal";
18
18
  import invariant from "tiny-invariant";
19
19
  import { extractNamespace } from "../GenerateContext/EnhancedBase.js";
20
- import { propertyJsdoc } from "../shared/propertyJsdoc.js";
20
+ import { EnhancedInterfaceType } from "../GenerateContext/EnhancedInterfaceType.js";
21
21
  import { deleteUndefineds } from "../util/deleteUndefineds.js";
22
22
  import { stringify } from "../util/stringify.js";
23
23
  import { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps } from "./wireObjectTypeV2ToSdkObjectConstV2.js";
@@ -26,14 +26,21 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ont
26
26
  const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
27
27
  const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
28
28
  const parents = definition.implements?.map(p => {
29
- !(ontology.interfaceTypes[p] != null) ? invariant(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : void 0;
30
- const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));
31
- return it;
29
+ const parent = ontology.requireInterfaceType(p, true);
30
+ if (parent instanceof EnhancedInterfaceType) {
31
+ const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2));
32
+ return it;
33
+ }
32
34
  }) ?? [];
33
35
  const mergedProperties = {
34
36
  ...definition.properties
35
37
  };
36
38
  for (const parent of parents) {
39
+ if (parent == null) {
40
+ // came from a foreign type and we cannot merge properties yet
41
+ // so if they weren't listed on the interface its over
42
+ continue;
43
+ }
37
44
  for (const apiName of Object.keys(parent.properties)) {
38
45
  if (definition.properties[apiName] != null) {
39
46
  !fastDeepEqual(definition.properties[apiName], parent.properties[apiName]) ? invariant(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : void 0;
@@ -43,7 +50,6 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ont
43
50
  mergedProperties[apiName] = parent.properties[apiName];
44
51
  }
45
52
  }
46
- const ogProperties = definition.properties;
47
53
  definition.properties = mergedProperties;
48
54
  const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
49
55
  const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
@@ -103,7 +109,7 @@ ${stringify(definition.links, {
103
109
 
104
110
  ${createObjectSet(interfaceDef, ids)}
105
111
 
106
- ${createOsdkObject(interfaceDef, "OsdkObject", ids)}
112
+ ${createOsdkObject(interfaceDef, "OsdkInstance", ids)}
107
113
 
108
114
  }
109
115