@osdk/generator 2.0.2-rc.3 → 2.0.2

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 (110) hide show
  1. package/CHANGELOG.md +12 -0
  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/generatePerActionDataFiles.test.js +14 -2
  35. package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  36. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts +2 -0
  37. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
  38. package/build/browser/v2.0/generatePerInterfaceDataFiles.js +45 -0
  39. package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -0
  40. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts +3 -0
  41. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
  42. package/build/browser/v2.0/generatePerObjectDataFiles.js +47 -0
  43. package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -0
  44. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  45. package/build/browser/v2.0/generatePerQueryDataFiles.js +1 -1
  46. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  47. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +9 -3
  48. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  49. package/build/browser/v2.0/generateRootIndexTsFile.d.ts +3 -0
  50. package/build/browser/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
  51. package/build/browser/v2.0/generateRootIndexTsFile.js +40 -0
  52. package/build/browser/v2.0/generateRootIndexTsFile.js.map +1 -0
  53. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  54. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +19 -9
  55. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  56. package/build/esm/GenerateContext/EnhanceCommon.d.ts +0 -2
  57. package/build/esm/GenerateContext/EnhanceCommon.d.ts.map +1 -1
  58. package/build/esm/GenerateContext/EnhancedBase.d.ts +1 -3
  59. package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
  60. package/build/esm/GenerateContext/EnhancedBase.js +2 -11
  61. package/build/esm/GenerateContext/EnhancedBase.js.map +1 -1
  62. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +4 -4
  63. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
  64. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js +27 -21
  65. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  66. package/build/esm/GenerateContext/ForeignType.d.ts +1 -2
  67. package/build/esm/GenerateContext/ForeignType.d.ts.map +1 -1
  68. package/build/esm/GenerateContext/ForeignType.js +5 -11
  69. package/build/esm/GenerateContext/ForeignType.js.map +1 -1
  70. package/build/esm/GenerateContext/enhanceOntology.d.ts +7 -1
  71. package/build/esm/GenerateContext/enhanceOntology.d.ts.map +1 -1
  72. package/build/esm/GenerateContext/enhanceOntology.js +8 -2
  73. package/build/esm/GenerateContext/enhanceOntology.js.map +1 -1
  74. package/build/esm/generateClientSdkPackage.d.ts +1 -1
  75. package/build/esm/generateClientSdkPackage.d.ts.map +1 -1
  76. package/build/esm/generateClientSdkPackage.js +2 -2
  77. package/build/esm/generateClientSdkPackage.js.map +1 -1
  78. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +12 -6
  79. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  80. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +40 -6
  81. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  82. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  83. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  84. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +16 -80
  85. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  86. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +118 -52
  87. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  88. package/build/esm/v2.0/generatePerActionDataFiles.test.js +14 -2
  89. package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  90. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts +2 -0
  91. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
  92. package/build/esm/v2.0/generatePerInterfaceDataFiles.js +45 -0
  93. package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -0
  94. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts +3 -0
  95. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
  96. package/build/esm/v2.0/generatePerObjectDataFiles.js +47 -0
  97. package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -0
  98. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  99. package/build/esm/v2.0/generatePerQueryDataFiles.js +1 -1
  100. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  101. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +9 -3
  102. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  103. package/build/esm/v2.0/generateRootIndexTsFile.d.ts +3 -0
  104. package/build/esm/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
  105. package/build/esm/v2.0/generateRootIndexTsFile.js +40 -0
  106. package/build/esm/v2.0/generateRootIndexTsFile.js.map +1 -0
  107. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  108. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +19 -9
  109. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  110. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @osdk/generator
2
2
 
3
+ ## 2.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1edf95b: Switch to OSDK.Instance
8
+ - 05b7934: Rework namespace codegen
9
+ - Updated dependencies [1edf95b]
10
+ - Updated dependencies [4c5e0ae]
11
+ - Updated dependencies [51354c5]
12
+ - @osdk/api@2.0.2
13
+ - @osdk/generator-converters@2.0.2
14
+
3
15
  ## 2.0.2-rc.3
4
16
 
5
17
  ### Patch Changes
@@ -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;AAC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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,CAAChB,UAAU;IAC1B;EACJ,CAAC;AACL;AACA,OAAO,MAAMsB,YAAY,SAAS3B,kBAAkB,CAAC;EACjD4B,GAAG;EACHnB,WAAWA,CAACC,MAAM,EAAEkB,GAAG,EAAEzB,WAAW,EAAEQ,QAAQ,EAAE;IAC5C,KAAK,CAACD,MAAM,EAAEP,WAAW,EAAEQ,QAAQ,CAAC;IACpC,IAAI,CAACiB,GAAG,GAAGA,GAAG;IACd,IAAI,CAAC,IAAI,CAACrB,OAAO,IAAI,CAAC,IAAI,CAACC,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,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AEL,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,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,0BAA0B;;IACrC,QAAQ,EAAE,UAAU,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACtD,mBAAmB,EAAE,MAAM,CACzB,MAAM,EACN,0BAA0B,CAC3B,CAAC;IAGF,GAAG,EAAE,sBAAsB,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;gBAGpB,GAAG,EAAE,sBAAsB,EAC3B,oBAAoB,EAAE,MAAM,GAAG,SAAS,EACxC,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3C,SA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AAG,WAAW,CACpC,CAAC;IACF,mBAAmB,EAAE,MAAM,CACzB,MAAM,EACN,0BAA0B,GAAG,WAAW,CACzC,CAAC;IAGF,GAAG,EAAE,sBAAsB,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;gBAGpB,GAAG,EAAE,sBAAsB,EAC3B,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAiE7B,iBAAiB,GAjBd,CAAC,SAAS,OAAO,uBACV,MAAM,2FAgB2C;IAC3D,oBAAoB,GAlBjB,CAAC,SAAS,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 ];\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xDa,yBAAyB,GAAG,IAAI,CAAC,CAACb,iBAAiB,CAAC,qBAAqB,CAAC;AAC9E;AACA,SAASD,KAAKA,CAACe,CAAC,EAAErB,MAAM,EAAEsB,WAAW,EAAE;EACnC,OAAOC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACJ,CAAC,IAAI,CAAC,CAAC,CAAC,CAACK,GAAG,CAAC,CAAC,CAACjB,WAAW,EAAEkB,CAAC,CAAC,KAAK;IACxE,OAAO,CACHlB,WAAW,EACX,IAAIa,WAAW,CAACtB,MAAM,EAAE2B,CAAC,CAAC,CAC7B;EACL,CAAC,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,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,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,GAAG,CAAC,CAAC;EAClBC,GAAG;EACHC,MAAM;EACNC,WAAWA,CAACF,GAAG,EAAEG,SAAS,EAAEC,eAAe,EAAEC,kBAAkB,EAAEC,YAAY,EAAE;IAC3E,IAAI,CAACL,MAAM,GAAG;MACVM,gBAAgB,EAAE,IAAI;MACtBJ;IACJ,CAAC;IACD,IAAI,CAACH,GAAG,GAAGA,GAAG;IACd,IAAI,CAACP,QAAQ,GAAGO,GAAG,CAACP,QAAQ;IAC5B,IAAI,CAACC,WAAW,GAAGc,KAAK,CAACR,GAAG,CAACN,WAAW,EAAE,IAAI,CAACO,MAAM,EAAEb,kBAAkB,EAAEgB,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AM,EAAEqB,WAAW,EAAEC,WAAW,EAAE;EAChD,MAAMC,OAAO,GAAG,EAAE;EAClB,KAAK,MAAM,CAACb,WAAW,EAAEc,CAAC,CAAC,IAAIC,MAAM,CAACF,OAAO,CAACH,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IACpD,KAAIE,WAAW,EAAEI,GAAG,CAAChB,WAAW,CAAC,EAG5B;MACDa,OAAO,CAACI,IAAI,CAAC,CAACjB,WAAW,EAAE,IAAIW,WAAW,CAACrB,MAAM,EAAEwB,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC,CAJG;EAKR;EACA,IAAIF,WAAW,EAAE;IACb,KAAK,MAAM,CAACZ,WAAW,EAAEkB,WAAW,CAAC,IAAIN,WAAW,EAAE;MAClD,MAAM,CAACV,YAAY,EAAEC,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,IAAIU,KAAK,CAAC,0BAA0B,CAAC;EAC/C,IAAIR,UAAU,KAAK,KAAK,EAAE;IACtB,MAAM,IAAIQ,KAAK,CAAC,4DAA4D,CAAC;EACjF;EACA,KAAK,MAAMC,WAAW,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE;IAC9C,MAAMC,MAAM,GAAGf,IAAI,CAACgB,IAAI,CAACV,UAAU,EAAE,MAAM,EAAEQ,WAAW,CAAC;IACzDb,oCAAoC,CAACM,QAAQ,EAAE,kBAAkBH,cAAc,aAAaM,UAAU,EAAE,EAAEF,SAAS,EAAEO,MAAM,EAAED,WAAW,EAAEH,oBAAoB,EAAEC,sBAAsB,CAAC;IACvL,MAAMb,EAAE,CAACkB,QAAQ,CAACC,KAAK,CAACH,MAAM,EAAE;MAAEI,SAAS,EAAE;IAAK,CAAC,CAAC;IACpD,MAAMC,SAAS,CAACZ,SAAS,EAAER,IAAI,CAACgB,IAAI,CAACD,MAAM,EAAE,cAAc,CAAC,EAAE;MAAEM,IAAI,EAAEP;IAAY,CAAC,CAAC;IACpF,MAAMM,SAAS,CAACZ,SAAS,EAAER,IAAI,CAACgB,IAAI,CAACD,MAAM,EAAE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Q,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,C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e;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,CAACjC,kBAAkB,CAAC;IAClDiD,KAAK,EAAE,CACH,SAAS,EACT,WAAW,EACX,sBAAsB;EAE9B,CAAC;AACL;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
 
@@ -1 +1 @@
1
- {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","fastDeepEqual","invariant","extractNamespace","propertyJsdoc","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","interfaceTypes","it","requireInterfaceType","mergedProperties","properties","parent","apiName","Object","keys","ogProperties","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js"],"sourcesContent":["/*\n * Copyright 2023 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 { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {\n const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n const parents = definition.implements?.map(p => {\n invariant(ontology.interfaceTypes[p] != null, `Expected to find a parent interface named ${p} in the ontology and did not.`);\n const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));\n return it;\n }) ?? [];\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(fastDeepEqual(definition.properties[apiName], parent.properties[apiName]), `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`);\n }\n else if (mergedProperties[apiName] != null) {\n invariant(fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]), `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`);\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n const ogProperties = definition.properties;\n definition.properties = mergedProperties;\n function localPropertyJsdoc(apiName) {\n const property = definition.properties[apiName];\n const isInherited = ogProperties[apiName] == null;\n return propertyJsdoc(property, { isInherited, apiName });\n }\n function maybeStripNamespace(q) {\n if (interfaceDef.apiNamespace && q.startsWith(`${interfaceDef.apiNamespace}.`)) {\n return q.slice(interfaceDef.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n }\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n const ids = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName => extractNamespace(apiName)[0] == null);\n if (badProperties.length > 0) {\n throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(\", \")}`);\n }\n }\n function getV2Types() {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n \n ${Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(v2);\n return `${definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`}\n `;\n },\n })}\n }\n `}\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkObject\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types() : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,EAAEC,WAAW,QAAS,yCAAyC;AAC/I;AACA,OAAO,SAASC,8CAA8CA,CAACC,YAAY,EAAEC,QAAQ,EAAEC,EAAE,GAAG,KAAK,EAAE;EAC/F,MAAMC,UAAU,GAAGX,gBAAgB,CAACL,mDAAmD,CAACa,YAAY,CAACI,GAAG,EAAEF,EAAE,CAAC,CAAC;EAC9G,MAAMG,mBAAmB,GAAGL,YAAY,CAACM,uBAAuB,CAACJ,EAAE,CAAC;EACpE,MAAMK,OAAO,GAAGJ,UAAU,CAACK,UAAU,EAAEC,GAAG,CAACC,CAAC,IAAI;IAC5C,EAAUT,QAAQ,CAACU,cAAc,CAACD,CAAC,CAAC,IAAI,IAAI,IAA5CrB,SAAS,QAAqC,6CAA6CqB,CAAC,+BAA+B;IAC3H,MAAME,EAAE,GAAGpB,gBAAgB,CAACL,mDAAmD,CAACc,QAAQ,CAACY,oBAAoB,CAACH,CAAC,EAAE,IAAI,CAAC,CAACN,GAAG,EAAEF,EAAE,CAAC,CAAC;IAChI,OAAOU,EAAE;EACb,CAAC,CAAC,IAAI,EAAE;EACR,MAAME,gBAAgB,GAAG;I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;AACA,uBAAuBrC,YAAY,CAACsB,YAAY;AAChD;AACA,QAAQzB,kBAAkB,CAACG,YAAY,CAAC;AACxC;AACA;AACA,QAAQF,WAAW,CAACE,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC;AACjD,QAAQF,WAAW,CAACE,YAAY,EAAE,aAAa,EAAE,IAAI,CAAC;AACtD;AACA;AACA,QAAQL,eAAe,CAACK,YAAY,EAAE4B,GAAG,CAAC;AAC1C;AACA,QAAQhC,gBAAgB,CAACI,YAAY,EAAE,YAAY,EAAE4B,GAAG,CAAC;AACzD;AACA;AACA;AACA,MAAMlC,gBAAgB,CAACM,YAAY,EAAEC,QAAQ,EAAED,YAAY,CAACsB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACG,CAAC,CAMiB,CAAC,GAAG,EAAE;AAC5B;AACA,mBAAmB5B,YAAY,CAACsB,YAAY,KAAKtB,YAAY,CAACsB,YAAY;AAC1E;AACA,kBAAkBtB,YAAY,CAACkC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","parent","requireInterfaceType","it","mergedProperties","properties","apiName","Object","keys","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js"],"sourcesContent":["/*\n * Copyright 2023 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 { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {\n const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2));\n return it;\n }\n }) ?? [];\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n if (parent == null) {\n // came from a foreign type and we cannot merge properties yet\n // so if they weren't listed on the interface its over\n continue;\n }\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(fastDeepEqual(definition.properties[apiName], parent.properties[apiName]), `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`);\n }\n else if (mergedProperties[apiName] != null) {\n invariant(fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]), `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`);\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n definition.properties = mergedProperties;\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n const ids = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName => extractNamespace(apiName)[0] == null);\n if (badProperties.length > 0) {\n throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(\", \")}`);\n }\n }\n function getV2Types() {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n \n ${Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(v2);\n return `${definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`}\n `;\n },\n })}\n }\n `}\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkInstance\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types() : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,EAAEC,WAAW,QAAS,yCAAyC;AAC/I;AACA,OAAO,SAASC,8CAA8CA,CAACC,YAAY,EAAEC,QAAQ,EAAEC,EAAE,GAAG,KAAK,EAAE;EAC/F,MAAMC,UAAU,GAAGX,gBAAgB,CAACL,mDAAmD,CAACa,YAAY,CAACI,GAAG,EAAEF,EAAE,CAAC,CAAC;EAC9G,MAAMG,mBAAmB,GAAGL,YAAY,CAACM,uBAAu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