@osdk/generator 2.1.0-beta.30 → 2.1.0-beta.31

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 (58) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/build/browser/GenerateContext/EnhancedAction.js.map +1 -1
  3. package/build/browser/GenerateContext/EnhancedInterfaceType.js.map +1 -1
  4. package/build/browser/GenerateContext/EnhancedObjectType.js +1 -1
  5. package/build/browser/GenerateContext/EnhancedObjectType.js.map +1 -1
  6. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  7. package/build/browser/GenerateContext/EnhancedQuery.js +1 -1
  8. package/build/browser/GenerateContext/EnhancedQuery.js.map +1 -1
  9. package/build/browser/GenerateContext/EnhancedSharedPropertyType.js.map +1 -1
  10. package/build/browser/WireOntologyDefinition.js.map +1 -1
  11. package/build/browser/shared/getObjectTypeApiNamesFromQuery.js.map +1 -1
  12. package/build/browser/shared/getObjectTypesFromQueryDataType.js.map +1 -1
  13. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +2 -1
  14. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  15. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  16. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  17. package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
  18. package/build/browser/v2.0/generatePerQueryDataFiles.js +9 -4
  19. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  20. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +4 -3
  21. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  22. package/build/cjs/chunk-XOCES5YA.cjs +978 -0
  23. package/build/cjs/chunk-XOCES5YA.cjs.map +1 -0
  24. package/build/cjs/index.cjs +19 -11
  25. package/build/cjs/index.cjs.map +1 -1
  26. package/build/cjs/index.d.cts +1 -1
  27. package/build/cjs/prompt-YMFYYBNJ.cjs +860 -0
  28. package/build/cjs/prompt-YMFYYBNJ.cjs.map +1 -0
  29. package/build/esm/GenerateContext/EnhancedAction.js.map +1 -1
  30. package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -1
  31. package/build/esm/GenerateContext/EnhancedObjectType.js +1 -1
  32. package/build/esm/GenerateContext/EnhancedObjectType.js.map +1 -1
  33. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  34. package/build/esm/GenerateContext/EnhancedQuery.js +1 -1
  35. package/build/esm/GenerateContext/EnhancedQuery.js.map +1 -1
  36. package/build/esm/GenerateContext/EnhancedSharedPropertyType.js.map +1 -1
  37. package/build/esm/WireOntologyDefinition.js.map +1 -1
  38. package/build/esm/shared/getObjectTypeApiNamesFromQuery.js.map +1 -1
  39. package/build/esm/shared/getObjectTypesFromQueryDataType.js.map +1 -1
  40. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +2 -1
  41. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  42. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  43. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  44. package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
  45. package/build/esm/v2.0/generatePerQueryDataFiles.js +9 -4
  46. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  47. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +4 -3
  48. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  49. package/build/types/GenerateContext/EnhancedAction.d.ts +1 -1
  50. package/build/types/GenerateContext/EnhancedInterfaceType.d.ts +1 -1
  51. package/build/types/GenerateContext/EnhancedObjectType.d.ts +1 -1
  52. package/build/types/GenerateContext/EnhancedOntologyDefinition.d.ts +1 -1
  53. package/build/types/GenerateContext/EnhancedQuery.d.ts +1 -1
  54. package/build/types/GenerateContext/EnhancedSharedPropertyType.d.ts +1 -1
  55. package/build/types/WireOntologyDefinition.d.ts +1 -1
  56. package/build/types/shared/getObjectTypeApiNamesFromQuery.d.ts +1 -1
  57. package/build/types/shared/getObjectTypesFromQueryDataType.d.ts +1 -1
  58. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @osdk/generator
2
2
 
3
+ ## 2.1.0-beta.31
4
+
5
+ ### Minor Changes
6
+
7
+ - bb8b219: Use new external packages instead of the internal ones.
8
+ - ecd4aee: Fixing use of logging from client for unknown property types.
9
+ - ee6224b: Explicitly type aggregation types in queries.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [bb8b219]
14
+ - Updated dependencies [81b2fb2]
15
+ - Updated dependencies [ecd4aee]
16
+ - Updated dependencies [ee6224b]
17
+ - Updated dependencies [5fe2c8d]
18
+ - @osdk/generator-converters@2.1.0-beta.31
19
+ - @osdk/api@2.1.0-beta.31
20
+
3
21
  ## 2.1.0-beta.30
4
22
 
5
23
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedAction.js","names":["EnhancedBase","EnhancedAction","constructor","common","raw","apiName","description","parameters","operations","paramsIdentifier","shortApiName","definitionIdentifier","definitionParamsIdentifier"],"sources":["EnhancedAction.ts"],"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 */\n\nimport type { ActionTypeV2, LogicRule } from \"@osdk/internal.foundry.core\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedAction extends EnhancedBase<ActionTypeV2> {\n constructor(common: EnhanceCommon, public raw: ActionTypeV2) {\n super(common, raw, raw.apiName, \"./ontology/actions\");\n }\n\n get description(): string | undefined {\n return this.raw.description;\n }\n\n get parameters(): ActionTypeV2[\"parameters\"] {\n return this.raw.parameters;\n }\n\n get operations(): LogicRule[] {\n return this.raw.operations;\n }\n\n get paramsIdentifier() {\n return `${this.shortApiName}.Params`;\n }\n\n get definitionIdentifier() {\n return `${this.shortApiName}.Definition`;\n }\n\n get definitionParamsIdentifier() {\n return `${this.shortApiName}.ParamsDefinition`;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,cAAc,SAASD,YAAY,CAAe;EAC7DE,WAAWA,CAACC,MAAqB,EAASC,GAAiB,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADdD,GAAiB,GAAjBA,GAAiB;EAE3D;EAEA,IAAIE,WAAWA,CAAA,EAAuB;IACpC,OAAO,IAAI,CAACF,GAAG,CAACE,WAAW;EAC7B;EAEA,IAAIC,UAAUA,CAAA,EAA+B;IAC3C,OAAO,IAAI,CAACH,GAAG,CAACG,UAAU;EAC5B;EAEA,IAAIC,UAAUA,CAAA,EAAgB;IAC5B,OAAO,IAAI,CAACJ,GAAG,CAACI,UAAU;EAC5B;EAEA,IAAIC,gBAAgBA,CAAA,EAAG;IACrB,OAAO,GAAG,IAAI,CAACC,YAAY,SAAS;EACtC;EAEA,IAAIC,oBAAoBA,CAAA,EAAG;IACzB,OAAO,GAAG,IAAI,CAACD,YAAY,aAAa;EAC1C;EAEA,IAAIE,0BAA0BA,CAAA,EAAG;IAC/B,OAAO,GAAG,IAAI,CAACF,YAAY,mBAAmB;EAChD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedAction.js","names":["EnhancedBase","EnhancedAction","constructor","common","raw","apiName","description","parameters","operations","paramsIdentifier","shortApiName","definitionIdentifier","definitionParamsIdentifier"],"sources":["EnhancedAction.ts"],"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 */\n\nimport type { ActionTypeV2, LogicRule } from \"@osdk/foundry.ontologies\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedAction extends EnhancedBase<ActionTypeV2> {\n constructor(common: EnhanceCommon, public raw: ActionTypeV2) {\n super(common, raw, raw.apiName, \"./ontology/actions\");\n }\n\n get description(): string | undefined {\n return this.raw.description;\n }\n\n get parameters(): ActionTypeV2[\"parameters\"] {\n return this.raw.parameters;\n }\n\n get operations(): LogicRule[] {\n return this.raw.operations;\n }\n\n get paramsIdentifier() {\n return `${this.shortApiName}.Params`;\n }\n\n get definitionIdentifier() {\n return `${this.shortApiName}.Definition`;\n }\n\n get definitionParamsIdentifier() {\n return `${this.shortApiName}.ParamsDefinition`;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,cAAc,SAASD,YAAY,CAAe;EAC7DE,WAAWA,CAACC,MAAqB,EAASC,GAAiB,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADdD,GAAiB,GAAjBA,GAAiB;EAE3D;EAEA,IAAIE,WAAWA,CAAA,EAAuB;IACpC,OAAO,IAAI,CAACF,GAAG,CAACE,WAAW;EAC7B;EAEA,IAAIC,UAAUA,CAAA,EAA+B;IAC3C,OAAO,IAAI,CAACH,GAAG,CAACG,UAAU;EAC5B;EAEA,IAAIC,UAAUA,CAAA,EAAgB;IAC5B,OAAO,IAAI,CAACJ,GAAG,CAACI,UAAU;EAC5B;EAEA,IAAIC,gBAAgBA,CAAA,EAAG;IACrB,OAAO,GAAG,IAAI,CAACC,YAAY,SAAS;EACtC;EAEA,IAAIC,oBAAoBA,CAAA,EAAG;IACzB,OAAO,GAAG,IAAI,CAACD,YAAY,aAAa;EAC1C;EAEA,IAAIE,0BAA0BA,CAAA,EAAG;IAC/B,OAAO,GAAG,IAAI,CAACF,YAAY,mBAAmB;EAChD;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedInterfaceType.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","deleteUndefineds","EnhancedBase","EnhancedInterfaceType","constructor","common","raw","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","properties","getCleanedUpDefinition"],"sources":["EnhancedInterfaceType.ts"],"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 */\n\nimport type { InterfaceMetadata } from \"@osdk/api\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport type { InterfaceType } from \"@osdk/internal.foundry.core\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {\n constructor(common: EnhanceCommon, public raw: InterfaceType) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n get properties(): InterfaceType[\"properties\"] {\n return this.raw.properties;\n }\n\n getCleanedUpDefinition(v2: boolean): InterfaceMetadata {\n return deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n this.raw,\n v2,\n ),\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,mDAAmD,QAAQ,4BAA4B;AAEhG,SAASC,gBAAgB,QAAQ,6BAA6B;AAE9D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,qBAAqB,SAASD,YAAY,CAAgB;EACrEE,WAAWA,CAACC,MAAqB,EAASC,GAAkB,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,uBAAuB,CAAC;IAAC,KADjBD,GAAkB,GAAlBA,GAAkB;EAE5D;EAEAE,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEA,IAAIG,UAAUA,CAAA,EAAgC;IAC5C,OAAO,IAAI,CAACN,GAAG,CAACM,UAAU;EAC5B;EAEAC,sBAAsBA,CAACJ,EAAW,EAAqB;IACrD,OAAOR,gBAAgB,CACrBD,mDAAmD,CACjD,IAAI,CAACM,GAAG,EACRG,EACF,CACF,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedInterfaceType.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","deleteUndefineds","EnhancedBase","EnhancedInterfaceType","constructor","common","raw","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","properties","getCleanedUpDefinition"],"sources":["EnhancedInterfaceType.ts"],"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 */\n\nimport type { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {\n constructor(common: EnhanceCommon, public raw: InterfaceType) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n get properties(): InterfaceType[\"properties\"] {\n return this.raw.properties;\n }\n\n getCleanedUpDefinition(v2: boolean): InterfaceMetadata {\n return deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n this.raw,\n v2,\n ),\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,SAASC,gBAAgB,QAAQ,6BAA6B;AAE9D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,qBAAqB,SAASD,YAAY,CAAgB;EACrEE,WAAWA,CAACC,MAAqB,EAASC,GAAkB,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,uBAAuB,CAAC;IAAC,KADjBD,GAAkB,GAAlBA,GAAkB;EAE5D;EAEAE,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEA,IAAIG,UAAUA,CAAA,EAAgC;IAC5C,OAAO,IAAI,CAACN,GAAG,CAACM,UAAU;EAC5B;EAEAC,sBAAsBA,CAACJ,EAAW,EAAqB;IACrD,OAAOR,gBAAgB,CACrBD,mDAAmD,CACjD,IAAI,CAACM,GAAG,EACRG,EACF,CACF,CAAC;EACH;AACF","ignoreList":[]}
@@ -23,7 +23,7 @@ export class EnhancedObjectType extends EnhancedBase {
23
23
  this.raw = raw;
24
24
  }
25
25
  getDefinitionIdentifier(v2) {
26
- return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;
26
+ return v2 ? this.shortApiName : `${this.shortApiName}Def`;
27
27
  }
28
28
  getImportedDefinitionIdentifier(v2) {
29
29
  return this.getDefinitionIdentifier(v2);
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedObjectType.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","deleteUndefineds","EnhancedBase","EnhancedObjectType","constructor","common","raw","objectType","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","getCleanedUpDefinition"],"sources":["EnhancedObjectType.ts"],"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 */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport type { ObjectTypeFullMetadata } from \"@osdk/internal.foundry.core\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetadata> {\n constructor(common: EnhanceCommon, public raw: ObjectTypeFullMetadata) {\n super(common, raw, raw.objectType.apiName, \"./ontology/objects\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n getCleanedUpDefinition(v2: boolean): ObjectMetadata {\n return deleteUndefineds(\n wireObjectTypeFullMetadataToSdkObjectMetadata(\n this.raw,\n v2,\n ),\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,6CAA6C,QAAQ,4BAA4B;AAE1F,SAASC,gBAAgB,QAAQ,6BAA6B;AAE9D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,kBAAkB,SAASD,YAAY,CAAyB;EAC3EE,WAAWA,CAACC,MAAqB,EAASC,GAA2B,EAAE;IACrE,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,UAAU,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADzBF,GAA2B,GAA3BA,GAA2B;EAErE;EAEAG,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,GAAG,IAAI,CAACC,YAAY,EAAE,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAChE;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEAG,sBAAsBA,CAACH,EAAW,EAAkB;IAClD,OAAOT,gBAAgB,CACrBD,6CAA6C,CAC3C,IAAI,CAACM,GAAG,EACRI,EACF,CACF,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedObjectType.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","deleteUndefineds","EnhancedBase","EnhancedObjectType","constructor","common","raw","objectType","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","getCleanedUpDefinition"],"sources":["EnhancedObjectType.ts"],"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 */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport type { ObjectTypeFullMetadata } from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetadata> {\n constructor(common: EnhanceCommon, public raw: ObjectTypeFullMetadata) {\n super(common, raw, raw.objectType.apiName, \"./ontology/objects\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n getCleanedUpDefinition(v2: boolean): ObjectMetadata {\n return deleteUndefineds(\n wireObjectTypeFullMetadataToSdkObjectMetadata(\n this.raw,\n v2,\n ),\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,gBAAgB,QAAQ,6BAA6B;AAE9D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,kBAAkB,SAASD,YAAY,CAAyB;EAC3EE,WAAWA,CAACC,MAAqB,EAASC,GAA2B,EAAE;IACrE,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,UAAU,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADzBF,GAA2B,GAA3BA,GAA2B;EAErE;EAEAG,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEAG,sBAAsBA,CAACH,EAAW,EAAkB;IAClD,OAAOT,gBAAgB,CACrBD,6CAA6C,CAC3C,IAAI,CAACM,GAAG,EACRI,EACF,CACF,CAAC;EACH;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedOntologyDefinition.js","names":["EnhancedAction","extractNamespace","EnhancedInterfaceType","EnhancedObjectType","EnhancedQuery","EnhancedSharedPropertyType","ForeignType","EnhancedOntologyDefinition","foreignTypes","constructor","raw","importExt","externalObjects","externalInterfaces","externalSpts","common","enhancedOntology","ontology","objectTypes","remap","actionTypes","queryTypes","interfaceTypes","sharedPropertyTypes","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.ts"],"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 */\n\nimport type { OntologyV2 } from \"@osdk/internal.foundry.core\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\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\";\n\ntype RequiredType<\n K extends\n | \"objectTypes\"\n | \"actionTypes\"\n | \"interfaceTypes\"\n | \"queryTypes\"\n | \"sharedPropertyTypes\",\n> = <\n L extends boolean = false,\n>(\n fullApiName: string,\n localOnly?: L,\n) => L extends true ? EnhancedOntologyDefinition[K][string] : ForeignType;\n\nexport class EnhancedOntologyDefinition {\n ontology: OntologyV2;\n objectTypes: Record<string, EnhancedObjectType | ForeignType>;\n actionTypes: Record<string, EnhancedAction>;\n queryTypes: Record<string, EnhancedQuery>;\n interfaceTypes: Record<\n string,\n EnhancedInterfaceType | ForeignType\n >;\n sharedPropertyTypes: Record<\n string,\n EnhancedSharedPropertyType | ForeignType\n >;\n #foreignTypes: Record<string, ForeignType> = {};\n\n raw: WireOntologyDefinition;\n common: EnhanceCommon;\n\n constructor(\n raw: WireOntologyDefinition,\n importExt: string,\n externalObjects?: Map<string, string>,\n externalInterfaces?: Map<string, string>,\n externalSpts?: Map<string, string>,\n ) {\n this.common = {\n enhancedOntology: this,\n importExt,\n };\n this.raw = raw;\n this.ontology = raw.ontology;\n this.objectTypes = remap(\n raw.objectTypes,\n this.common,\n EnhancedObjectType,\n externalObjects,\n );\n this.actionTypes = remap(\n raw.actionTypes,\n this.common,\n EnhancedAction,\n );\n this.queryTypes = remap(\n raw.queryTypes,\n this.common,\n EnhancedQuery,\n );\n this.interfaceTypes = remap(\n raw.interfaceTypes,\n this.common,\n EnhancedInterfaceType,\n externalInterfaces,\n );\n this.sharedPropertyTypes = remap(\n raw.sharedPropertyTypes,\n this.common,\n EnhancedSharedPropertyType,\n externalSpts,\n );\n }\n\n #createRequireType = <\n K extends\n | \"objectTypes\"\n | \"actionTypes\"\n | \"interfaceTypes\"\n | \"queryTypes\"\n | \"sharedPropertyTypes\",\n >(\n type: K & keyof this,\n ) => {\n return <L extends boolean = false>(\n fullApiName: string,\n localOnly?: L,\n ): L extends true ? this[K][string] : ForeignType => {\n const ret = this[type][fullApiName];\n if (!ret) {\n const [apiNamespace, shortApiName] = extractNamespace(fullApiName);\n\n throw new Error(\n `Unable to find ${type}: No entry for '${fullApiName}`,\n );\n }\n return ret as this[K][string] as L extends true ? this[K][string]\n : ForeignType;\n };\n };\n\n public requireObjectType: RequiredType<\"objectTypes\"> = this\n .#createRequireType(\"objectTypes\");\n public requireInterfaceType: RequiredType<\"interfaceTypes\"> = this\n .#createRequireType(\"interfaceTypes\");\n public requireActionType: RequiredType<\"actionTypes\"> = this\n .#createRequireType(\"actionTypes\");\n public requireQueryType: RequiredType<\"queryTypes\"> = this\n .#createRequireType(\"queryTypes\");\n public requireSharedPropertyType: RequiredType<\"sharedPropertyTypes\"> = this\n .#createRequireType(\n \"sharedPropertyTypes\",\n );\n}\n\nfunction remap<T, X>(\n r: Record<string, T>,\n common: EnhanceCommon,\n Constructor: { new(common: EnhanceCommon, og: T): X },\n): Record<string, X>;\nfunction remap<T, X>(\n r: Record<string, T>,\n common: EnhanceCommon,\n Constructor: { new(common: EnhanceCommon, original: T): X },\n externalMap?: Map<string, string>,\n): Record<string, X | ForeignType>;\nfunction remap<T, X, const Q extends Map<string, string> | undefined>(\n r: Record<string, T>,\n common: EnhanceCommon,\n Constructor: { new(common: EnhanceCommon, og: T): X },\n externalMap?: Q,\n): Record<string, X | ForeignType> {\n const entries: [string, X | ForeignType][] = [];\n\n for (const [fullApiName, v] of Object.entries(r ?? {})) {\n if (externalMap?.has(fullApiName)) {\n // skip it, we handle it below\n } else {\n entries.push([fullApiName, new Constructor(common, v)]);\n }\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(\n common,\n apiNamespace,\n shortApiName,\n destPackage,\n ),\n ]);\n }\n }\n\n return Object.fromEntries(\n entries.sort((a, b) => a[0].localeCompare(b[0])),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,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;AAgB9C,OAAO,MAAMC,0BAA0B,CAAC;EAatC,CAACC,YAAY,GAAgC,CAAC,CAAC;EAK/CC,WAAWA,CACTC,GAA2B,EAC3BC,SAAiB,EACjBC,eAAqC,EACrCC,kBAAwC,EACxCC,YAAkC,EAClC;IACA,IAAI,CAACC,MAAM,GAAG;MACZC,gBAAgB,EAAE,IAAI;MACtBL;IACF,CAAC;IACD,IAAI,CAACD,GAAG,GAAGA,GAAG;IACd,IAAI,CAACO,QAAQ,GAAGP,GAAG,CAACO,QAAQ;IAC5B,IAAI,CAACC,WAAW,GAAGC,KAAK,CACtBT,GAAG,CAACQ,WAAW,EACf,IAAI,CAACH,MAAM,EACXZ,kBAAkB,EAClBS,eACF,CAAC;IACD,IAAI,CAACQ,WAAW,GAAGD,KAAK,CACtBT,GAAG,CAACU,WAAW,EACf,IAAI,CAACL,MAAM,EACXf,cACF,CAAC;IACD,IAAI,CAACqB,UAAU,GAAGF,KAAK,CACrBT,GAAG,CAACW,UAAU,EACd,IAAI,CAACN,MAAM,EACXX,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EI,GAAG,CAAChB,WAAW,CAAC,EAE1B;MACLa,OAAO,CAACI,IAAI,CAAC,CAACjB,WAAW,EAAE,IAAIW,WAAW,CAACtB,MAAM,EAAEyB,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAHC;EAIJ;EAEA,IAAIF,WAAW,EAAE;IACf,KAAK,MAAM,CAACZ,WAAW,EAAEkB,WAAW,CAAC,IAAIN,WAAW,EAAE;MACpD,MAAM,CAACV,YAAY,EAAEC,YAAY,CAAC,GAAG5B,gBAAgB,CAACyB,WAAW,CAAC;MAClE;MACA;MACA;MACA;MACA;MACA;MACAa,OAAO,CAACI,IAAI,CAAC,CACXjB,WAAW,EACX,IAAIpB,WAAW,CACbS,MAAM,EACNa,YAAY,EACZC,YAAY,EACZe,WACF,CAAC,CACF,CAAC;IACJ;EACF;EAEA,OAAOH,MAAM,CAACI,WAAW,CACvBN,OAAO,CAACO,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC,CAAC,CAAC,CACjD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedOntologyDefinition.js","names":["EnhancedAction","extractNamespace","EnhancedInterfaceType","EnhancedObjectType","EnhancedQuery","EnhancedSharedPropertyType","ForeignType","EnhancedOntologyDefinition","foreignTypes","constructor","raw","importExt","externalObjects","externalInterfaces","externalSpts","common","enhancedOntology","ontology","objectTypes","remap","actionTypes","queryTypes","interfaceTypes","sharedPropertyTypes","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.ts"],"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 */\n\nimport type { OntologyV2 } from \"@osdk/foundry.ontologies\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\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\";\n\ntype RequiredType<\n K extends\n | \"objectTypes\"\n | \"actionTypes\"\n | \"interfaceTypes\"\n | \"queryTypes\"\n | \"sharedPropertyTypes\",\n> = <\n L extends boolean = false,\n>(\n fullApiName: string,\n localOnly?: L,\n) => L extends true ? EnhancedOntologyDefinition[K][string] : ForeignType;\n\nexport class EnhancedOntologyDefinition {\n ontology: OntologyV2;\n objectTypes: Record<string, EnhancedObjectType | ForeignType>;\n actionTypes: Record<string, EnhancedAction>;\n queryTypes: Record<string, EnhancedQuery>;\n interfaceTypes: Record<\n string,\n EnhancedInterfaceType | ForeignType\n >;\n sharedPropertyTypes: Record<\n string,\n EnhancedSharedPropertyType | ForeignType\n >;\n #foreignTypes: Record<string, ForeignType> = {};\n\n raw: WireOntologyDefinition;\n common: EnhanceCommon;\n\n constructor(\n raw: WireOntologyDefinition,\n importExt: string,\n externalObjects?: Map<string, string>,\n externalInterfaces?: Map<string, string>,\n externalSpts?: Map<string, string>,\n ) {\n this.common = {\n enhancedOntology: this,\n importExt,\n };\n this.raw = raw;\n this.ontology = raw.ontology;\n this.objectTypes = remap(\n raw.objectTypes,\n this.common,\n EnhancedObjectType,\n externalObjects,\n );\n this.actionTypes = remap(\n raw.actionTypes,\n this.common,\n EnhancedAction,\n );\n this.queryTypes = remap(\n raw.queryTypes,\n this.common,\n EnhancedQuery,\n );\n this.interfaceTypes = remap(\n raw.interfaceTypes,\n this.common,\n EnhancedInterfaceType,\n externalInterfaces,\n );\n this.sharedPropertyTypes = remap(\n raw.sharedPropertyTypes,\n this.common,\n EnhancedSharedPropertyType,\n externalSpts,\n );\n }\n\n #createRequireType = <\n K extends\n | \"objectTypes\"\n | \"actionTypes\"\n | \"interfaceTypes\"\n | \"queryTypes\"\n | \"sharedPropertyTypes\",\n >(\n type: K & keyof this,\n ) => {\n return <L extends boolean = false>(\n fullApiName: string,\n localOnly?: L,\n ): L extends true ? this[K][string] : ForeignType => {\n const ret = this[type][fullApiName];\n if (!ret) {\n const [apiNamespace, shortApiName] = extractNamespace(fullApiName);\n\n throw new Error(\n `Unable to find ${type}: No entry for '${fullApiName}`,\n );\n }\n return ret as this[K][string] as L extends true ? this[K][string]\n : ForeignType;\n };\n };\n\n public requireObjectType: RequiredType<\"objectTypes\"> = this\n .#createRequireType(\"objectTypes\");\n public requireInterfaceType: RequiredType<\"interfaceTypes\"> = this\n .#createRequireType(\"interfaceTypes\");\n public requireActionType: RequiredType<\"actionTypes\"> = this\n .#createRequireType(\"actionTypes\");\n public requireQueryType: RequiredType<\"queryTypes\"> = this\n .#createRequireType(\"queryTypes\");\n public requireSharedPropertyType: RequiredType<\"sharedPropertyTypes\"> = this\n .#createRequireType(\n \"sharedPropertyTypes\",\n );\n}\n\nfunction remap<T, X>(\n r: Record<string, T>,\n common: EnhanceCommon,\n Constructor: { new(common: EnhanceCommon, og: T): X },\n): Record<string, X>;\nfunction remap<T, X>(\n r: Record<string, T>,\n common: EnhanceCommon,\n Constructor: { new(common: EnhanceCommon, original: T): X },\n externalMap?: Map<string, string>,\n): Record<string, X | ForeignType>;\nfunction remap<T, X, const Q extends Map<string, string> | undefined>(\n r: Record<string, T>,\n common: EnhanceCommon,\n Constructor: { new(common: EnhanceCommon, og: T): X },\n externalMap?: Q,\n): Record<string, X | ForeignType> {\n const entries: [string, X | ForeignType][] = [];\n\n for (const [fullApiName, v] of Object.entries(r ?? {})) {\n if (externalMap?.has(fullApiName)) {\n // skip it, we handle it below\n } else {\n entries.push([fullApiName, new Constructor(common, v)]);\n }\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(\n common,\n apiNamespace,\n shortApiName,\n destPackage,\n ),\n ]);\n }\n }\n\n return Object.fromEntries(\n entries.sort((a, b) => a[0].localeCompare(b[0])),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,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;AAgB9C,OAAO,MAAMC,0BAA0B,CAAC;EAatC,CAACC,YAAY,GAAgC,CAAC,CAAC;EAK/CC,WAAWA,CACTC,GAA2B,EAC3BC,SAAiB,EACjBC,eAAqC,EACrCC,kBAAwC,EACxCC,YAAkC,EAClC;IACA,IAAI,CAACC,MAAM,GAAG;MACZC,gBAAgB,EAAE,IAAI;MACtBL;IACF,CAAC;IACD,IAAI,CAACD,GAAG,GAAGA,GAAG;IAC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CAACV,iBAAiB,CAAC,YAAY,CAAC;EAC5BW,yBAAyB,GAAwC,IAAI,CACzE,CAACX,iBAAiB,CACjB,qBACF,CAAC;AACL;AAaA,SAASL,KAAKA,CACZiB,CAAoB,EACpBrB,MAAqB,EACrBsB,WAAqD,EACrDC,WAAe,EACkB;EACjC,MAAMC,OAAoC,GAAG,EAAE;EAE/C,KAAK,MAAM,CAACb,WAAW,EAAEc,CAAC,CAAC,IAAIC,MAAM,CAACF,OAAO,CAACH,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IACtD,KAAIE,WAAW,EAAEI,GAAG,CAAChB,WAAW,CAAC,EAE1B;MACLa,OAAO,CAACI,IAAI,CAAC,CAACjB,WAAW,EAAE,IAAIW,WAAW,CAACtB,MAAM,EAAEyB,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAHC;EAIJ;EAEA,IAAIF,WAAW,EAAE;IACf,KAAK,MAAM,CAACZ,WAAW,EAAEkB,WAAW,CAAC,IAAIN,WAAW,EAAE;MACpD,MAAM,CAACV,YAAY,EAAEC,YAAY,CAAC,GAAG5B,gBAAgB,CAACyB,WAAW,CAAC;MAClE;MACA;MACA;MACA;MACA;MACA;MACAa,OAAO,CAACI,IAAI,CAAC,CACXjB,WAAW,EACX,IAAIpB,WAAW,CACbS,MAAM,EACNa,YAAY,EACZC,YAAY,EACZe,WACF,CAAC,CACF,CAAC;IACJ;EACF;EAEA,OAAOH,MAAM,CAACI,WAAW,CACvBN,OAAO,CAACO,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC,CAAC,CAAC,CACjD,CAAC;AACH","ignoreList":[]}
@@ -33,7 +33,7 @@ export class EnhancedQuery extends EnhancedBase {
33
33
  return `${this.shortApiName}.Parameters`;
34
34
  }
35
35
  get definitionIdentifier() {
36
- return `${this.shortApiName}`;
36
+ return this.shortApiName;
37
37
  }
38
38
  get definitionParamsIdentifier() {
39
39
  return `${this.definitionIdentifier}$Params`;
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedQuery.js","names":["EnhancedBase","EnhancedQuery","constructor","common","raw","apiName","description","parameters","output","paramsIdentifier","shortApiName","definitionIdentifier","definitionParamsIdentifier"],"sources":["EnhancedQuery.ts"],"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 */\n\nimport type { QueryDataType, QueryTypeV2 } from \"@osdk/internal.foundry.core\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedQuery extends EnhancedBase<QueryTypeV2> {\n constructor(common: EnhanceCommon, public raw: QueryTypeV2) {\n super(common, raw, raw.apiName, \"./ontology/queries\");\n }\n\n get description(): string | undefined {\n return this.raw.description;\n }\n\n get parameters(): QueryTypeV2[\"parameters\"] {\n return this.raw.parameters;\n }\n\n get output(): QueryDataType {\n return this.raw.output;\n }\n\n get paramsIdentifier() {\n return `${this.shortApiName}.Parameters`;\n }\n\n get definitionIdentifier() {\n return `${this.shortApiName}`;\n }\n\n get definitionParamsIdentifier() {\n return `${this.definitionIdentifier}$Params`;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,aAAa,SAASD,YAAY,CAAc;EAC3DE,WAAWA,CAACC,MAAqB,EAASC,GAAgB,EAAE;IAC1D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADdD,GAAgB,GAAhBA,GAAgB;EAE1D;EAEA,IAAIE,WAAWA,CAAA,EAAuB;IACpC,OAAO,IAAI,CAACF,GAAG,CAACE,WAAW;EAC7B;EAEA,IAAIC,UAAUA,CAAA,EAA8B;IAC1C,OAAO,IAAI,CAACH,GAAG,CAACG,UAAU;EAC5B;EAEA,IAAIC,MAAMA,CAAA,EAAkB;IAC1B,OAAO,IAAI,CAACJ,GAAG,CAACI,MAAM;EACxB;EAEA,IAAIC,gBAAgBA,CAAA,EAAG;IACrB,OAAO,GAAG,IAAI,CAACC,YAAY,aAAa;EAC1C;EAEA,IAAIC,oBAAoBA,CAAA,EAAG;IACzB,OAAO,GAAG,IAAI,CAACD,YAAY,EAAE;EAC/B;EAEA,IAAIE,0BAA0BA,CAAA,EAAG;IAC/B,OAAO,GAAG,IAAI,CAACD,oBAAoB,SAAS;EAC9C;AACF","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedQuery.js","names":["EnhancedBase","EnhancedQuery","constructor","common","raw","apiName","description","parameters","output","paramsIdentifier","shortApiName","definitionIdentifier","definitionParamsIdentifier"],"sources":["EnhancedQuery.ts"],"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 */\n\nimport type { QueryDataType, QueryTypeV2 } from \"@osdk/foundry.ontologies\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedQuery extends EnhancedBase<QueryTypeV2> {\n constructor(common: EnhanceCommon, public raw: QueryTypeV2) {\n super(common, raw, raw.apiName, \"./ontology/queries\");\n }\n\n get description(): string | undefined {\n return this.raw.description;\n }\n\n get parameters(): QueryTypeV2[\"parameters\"] {\n return this.raw.parameters;\n }\n\n get output(): QueryDataType {\n return this.raw.output;\n }\n\n get paramsIdentifier() {\n return `${this.shortApiName}.Parameters`;\n }\n\n get definitionIdentifier(): string {\n return this.shortApiName;\n }\n\n get definitionParamsIdentifier() {\n return `${this.definitionIdentifier}$Params`;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,aAAa,SAASD,YAAY,CAAc;EAC3DE,WAAWA,CAACC,MAAqB,EAASC,GAAgB,EAAE;IAC1D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADdD,GAAgB,GAAhBA,GAAgB;EAE1D;EAEA,IAAIE,WAAWA,CAAA,EAAuB;IACpC,OAAO,IAAI,CAACF,GAAG,CAACE,WAAW;EAC7B;EAEA,IAAIC,UAAUA,CAAA,EAA8B;IAC1C,OAAO,IAAI,CAACH,GAAG,CAACG,UAAU;EAC5B;EAEA,IAAIC,MAAMA,CAAA,EAAkB;IAC1B,OAAO,IAAI,CAACJ,GAAG,CAACI,MAAM;EACxB;EAEA,IAAIC,gBAAgBA,CAAA,EAAG;IACrB,OAAO,GAAG,IAAI,CAACC,YAAY,aAAa;EAC1C;EAEA,IAAIC,oBAAoBA,CAAA,EAAW;IACjC,OAAO,IAAI,CAACD,YAAY;EAC1B;EAEA,IAAIE,0BAA0BA,CAAA,EAAG;IAC/B,OAAO,GAAG,IAAI,CAACD,oBAAoB,SAAS;EAC9C;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedSharedPropertyType.js","names":["EnhancedBase","EnhancedSharedPropertyType","constructor","common","raw","apiName"],"sources":["EnhancedSharedPropertyType.ts"],"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 */\n\nimport type { SharedPropertyType } from \"@osdk/internal.foundry.core\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedSharedPropertyType\n extends EnhancedBase<SharedPropertyType>\n{\n constructor(common: EnhanceCommon, public raw: SharedPropertyType) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,0BAA0B,SAC7BD,YAAY,CACtB;EACEE,WAAWA,CAACC,MAAqB,EAASC,GAAuB,EAAE;IACjE,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,uBAAuB,CAAC;IAAC,KADjBD,GAAuB,GAAvBA,GAAuB;EAEjE;AACF","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedSharedPropertyType.js","names":["EnhancedBase","EnhancedSharedPropertyType","constructor","common","raw","apiName"],"sources":["EnhancedSharedPropertyType.ts"],"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 */\n\nimport type { SharedPropertyType } from \"@osdk/foundry.ontologies\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedSharedPropertyType\n extends EnhancedBase<SharedPropertyType>\n{\n constructor(common: EnhanceCommon, public raw: SharedPropertyType) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,0BAA0B,SAC7BD,YAAY,CACtB;EACEE,WAAWA,CAACC,MAAqB,EAASC,GAAuB,EAAE;IACjE,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,uBAAuB,CAAC;IAAC,KADjBD,GAAuB,GAAvBA,GAAuB;EAEjE;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"WireOntologyDefinition.js","names":[],"sources":["WireOntologyDefinition.ts"],"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 */\n\nimport type * as gateway from \"@osdk/internal.foundry.core\";\n\nexport interface WireOntologyDefinition extends gateway.OntologyFullMetadata {\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"WireOntologyDefinition.js","names":[],"sources":["WireOntologyDefinition.ts"],"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 */\n\nimport type * as gateway from \"@osdk/foundry.ontologies\";\n\nexport interface WireOntologyDefinition extends gateway.OntologyFullMetadata {\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"getObjectTypeApiNamesFromQuery.js","names":["getObjectTypesFromQueryDataType","getObjectTypeApiNamesFromQuery","query","types","Set","dataType","Object","values","parameters","output","Array","from"],"sources":["getObjectTypeApiNamesFromQuery.ts"],"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 */\n\nimport type { QueryTypeV2 } from \"@osdk/internal.foundry.core\";\nimport type { EnhancedQuery } from \"../GenerateContext/EnhancedQuery.js\";\nimport { getObjectTypesFromQueryDataType } from \"./getObjectTypesFromQueryDataType.js\";\n\nexport function getObjectTypeApiNamesFromQuery(\n query: QueryTypeV2 | EnhancedQuery,\n): string[] {\n const types = new Set<string>();\n\n for (const { dataType } of Object.values(query.parameters)) {\n getObjectTypesFromQueryDataType(dataType, types);\n }\n getObjectTypesFromQueryDataType(query.output, types);\n\n return Array.from(types);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,+BAA+B,QAAQ,sCAAsC;AAEtF,OAAO,SAASC,8BAA8BA,CAC5CC,KAAkC,EACxB;EACV,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAS,CAAC;EAE/B,KAAK,MAAM;IAAEC;EAAS,CAAC,IAAIC,MAAM,CAACC,MAAM,CAACL,KAAK,CAACM,UAAU,CAAC,EAAE;IAC1DR,+BAA+B,CAACK,QAAQ,EAAEF,KAAK,CAAC;EAClD;EACAH,+BAA+B,CAACE,KAAK,CAACO,MAAM,EAAEN,KAAK,CAAC;EAEpD,OAAOO,KAAK,CAACC,IAAI,CAACR,KAAK,CAAC;AAC1B","ignoreList":[]}
1
+ {"version":3,"file":"getObjectTypeApiNamesFromQuery.js","names":["getObjectTypesFromQueryDataType","getObjectTypeApiNamesFromQuery","query","types","Set","dataType","Object","values","parameters","output","Array","from"],"sources":["getObjectTypeApiNamesFromQuery.ts"],"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 */\n\nimport type { QueryTypeV2 } from \"@osdk/foundry.ontologies\";\nimport type { EnhancedQuery } from \"../GenerateContext/EnhancedQuery.js\";\nimport { getObjectTypesFromQueryDataType } from \"./getObjectTypesFromQueryDataType.js\";\n\nexport function getObjectTypeApiNamesFromQuery(\n query: QueryTypeV2 | EnhancedQuery,\n): string[] {\n const types = new Set<string>();\n\n for (const { dataType } of Object.values(query.parameters)) {\n getObjectTypesFromQueryDataType(dataType, types);\n }\n getObjectTypesFromQueryDataType(query.output, types);\n\n return Array.from(types);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,+BAA+B,QAAQ,sCAAsC;AAEtF,OAAO,SAASC,8BAA8BA,CAC5CC,KAAkC,EACxB;EACV,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAS,CAAC;EAE/B,KAAK,MAAM;IAAEC;EAAS,CAAC,IAAIC,MAAM,CAACC,MAAM,CAACL,KAAK,CAACM,UAAU,CAAC,EAAE;IAC1DR,+BAA+B,CAACK,QAAQ,EAAEF,KAAK,CAAC;EAClD;EACAH,+BAA+B,CAACE,KAAK,CAACO,MAAM,EAAEN,KAAK,CAAC;EAEpD,OAAOO,KAAK,CAACC,IAAI,CAACR,KAAK,CAAC;AAC1B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"getObjectTypesFromQueryDataType.js","names":["getObjectTypesFromQueryDataType","dataType","types","type","subType","add","objectTypeApiName","prop","Object","values","fields","fieldType","unionTypes","Error"],"sources":["getObjectTypesFromQueryDataType.ts"],"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 */\n\nimport type { QueryDataType } from \"@osdk/internal.foundry.core\";\n\nexport function getObjectTypesFromQueryDataType(\n dataType: QueryDataType,\n types: Set<string>,\n): void {\n switch (dataType.type) {\n case \"array\":\n case \"set\":\n getObjectTypesFromQueryDataType(dataType.subType, types);\n return;\n\n case \"object\":\n types.add(dataType.objectTypeApiName);\n return;\n\n case \"objectSet\":\n types.add(dataType.objectTypeApiName!);\n return;\n\n case \"struct\":\n for (const prop of Object.values(dataType.fields)) {\n getObjectTypesFromQueryDataType(prop.fieldType, types);\n }\n return;\n\n case \"union\":\n for (const type of dataType.unionTypes) {\n getObjectTypesFromQueryDataType(type, types);\n }\n return;\n\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"null\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"unsupported\":\n /* complete no-op */\n return;\n\n default:\n const _: never = dataType;\n throw new Error(\n `Cannot find object types from unsupported QueryDataType ${\n (dataType as any).type\n }`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,+BAA+BA,CAC7CC,QAAuB,EACvBC,KAAkB,EACZ;EACN,QAAQD,QAAQ,CAACE,IAAI;IACnB,KAAK,OAAO;IACZ,KAAK,KAAK;MACRH,+BAA+B,CAACC,QAAQ,CAACG,OAAO,EAAEF,KAAK,CAAC;MACxD;IAEF,KAAK,QAAQ;MACXA,KAAK,CAACG,GAAG,CAACJ,QAAQ,CAACK,iBAAiB,CAAC;MACrC;IAEF,KAAK,WAAW;MACdJ,KAAK,CAACG,GAAG,CAACJ,QAAQ,CAACK,iBAAkB,CAAC;MACtC;IAEF,KAAK,QAAQ;MACX,KAAK,MAAMC,IAAI,IAAIC,MAAM,CAACC,MAAM,CAACR,QAAQ,CAACS,MAAM,CAAC,EAAE;QACjDV,+BAA+B,CAACO,IAAI,CAACI,SAAS,EAAET,KAAK,CAAC;MACxD;MACA;IAEF,KAAK,OAAO;MACV,KAAK,MAAMC,IAAI,IAAIF,QAAQ,CAACW,UAAU,EAAE;QACtCZ,+BAA+B,CAACG,IAAI,EAAED,KAAK,CAAC;MAC9C;MACA;IAEF,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,MAAM;IACX,KAAK,QAAQ;IACb,KAAK,6BAA6B;IAClC,KAAK,WAAW;IAChB,KAAK,2BAA2B;IAChC,KAAK,aAAa;MAChB;MACA;IAEF;MAEE,MAAM,IAAIW,KAAK,CACb,2DACGZ,QAAQ,CAASE,IAAI,EAE1B,CAAC;EACL;AACF","ignoreList":[]}
1
+ {"version":3,"file":"getObjectTypesFromQueryDataType.js","names":["getObjectTypesFromQueryDataType","dataType","types","type","subType","add","objectTypeApiName","prop","Object","values","fields","fieldType","unionTypes","Error"],"sources":["getObjectTypesFromQueryDataType.ts"],"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 */\n\nimport type { QueryDataType } from \"@osdk/foundry.ontologies\";\n\nexport function getObjectTypesFromQueryDataType(\n dataType: QueryDataType,\n types: Set<string>,\n): void {\n switch (dataType.type) {\n case \"array\":\n case \"set\":\n getObjectTypesFromQueryDataType(dataType.subType, types);\n return;\n\n case \"object\":\n types.add(dataType.objectTypeApiName);\n return;\n\n case \"objectSet\":\n types.add(dataType.objectTypeApiName!);\n return;\n\n case \"struct\":\n for (const prop of Object.values(dataType.fields)) {\n getObjectTypesFromQueryDataType(prop.fieldType, types);\n }\n return;\n\n case \"union\":\n for (const type of dataType.unionTypes) {\n getObjectTypesFromQueryDataType(type, types);\n }\n return;\n\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"null\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"unsupported\":\n /* complete no-op */\n return;\n\n default:\n const _: never = dataType;\n throw new Error(\n `Cannot find object types from unsupported QueryDataType ${\n (dataType as any).type\n }`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,+BAA+BA,CAC7CC,QAAuB,EACvBC,KAAkB,EACZ;EACN,QAAQD,QAAQ,CAACE,IAAI;IACnB,KAAK,OAAO;IACZ,KAAK,KAAK;MACRH,+BAA+B,CAACC,QAAQ,CAACG,OAAO,EAAEF,KAAK,CAAC;MACxD;IAEF,KAAK,QAAQ;MACXA,KAAK,CAACG,GAAG,CAACJ,QAAQ,CAACK,iBAAiB,CAAC;MACrC;IAEF,KAAK,WAAW;MACdJ,KAAK,CAACG,GAAG,CAACJ,QAAQ,CAACK,iBAAkB,CAAC;MACtC;IAEF,KAAK,QAAQ;MACX,KAAK,MAAMC,IAAI,IAAIC,MAAM,CAACC,MAAM,CAACR,QAAQ,CAACS,MAAM,CAAC,EAAE;QACjDV,+BAA+B,CAACO,IAAI,CAACI,SAAS,EAAET,KAAK,CAAC;MACxD;MACA;IAEF,KAAK,OAAO;MACV,KAAK,MAAMC,IAAI,IAAIF,QAAQ,CAACW,UAAU,EAAE;QACtCZ,+BAA+B,CAACG,IAAI,EAAED,KAAK,CAAC;MAC9C;MACA;IAEF,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,MAAM;IACX,KAAK,QAAQ;IACb,KAAK,6BAA6B;IAClC,KAAK,WAAW;IAChB,KAAK,2BAA2B;IAChC,KAAK,aAAa;MAChB;MACA;IAEF;MAEE,MAAM,IAAIW,KAAK,CACb,2DACGZ,QAAQ,CAASE,IAAI,EAE1B,CAAC;EACL;AACF","ignoreList":[]}
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/generator-converters";
18
+ import consola from "consola";
18
19
  import fastDeepEqual from "fast-deep-equal";
19
20
  import invariant from "tiny-invariant";
20
21
  import { extractNamespace } from "../GenerateContext/EnhancedBase.js";
@@ -30,7 +31,7 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ont
30
31
  const parents = definition.implements?.map(p => {
31
32
  const parent = ontology.requireInterfaceType(p, true);
32
33
  if (parent instanceof EnhancedInterfaceType) {
33
- const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2));
34
+ const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2, consola));
34
35
  return it;
35
36
  }
36
37
  }) ?? [];
@@ -1 +1 @@
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","forInternalUse","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","parent","requireInterfaceType","it","mergedProperties","properties","apiName","Object","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.ts"],"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 */\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 type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport type { Identifiers } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\nimport {\n createDefinition,\n createObjectSet,\n createOsdkObject,\n createPropertyKeys,\n createProps,\n} from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n interfaceDef: EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n v2: boolean = false,\n forInternalUse: boolean = false,\n) {\n const definition = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceDef.raw,\n v2,\n ),\n );\n\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n parent.raw,\n v2,\n ),\n );\n return it;\n }\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(\n fastDeepEqual(\n definition.properties[apiName],\n parent.properties[apiName],\n ),\n `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(\n fastDeepEqual(\n mergedProperties[apiName],\n parent.properties[apiName],\n ),\n `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`,\n );\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n\n definition.properties = mergedProperties;\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 =\n `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n\n const ids: Identifiers = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName =>\n extractNamespace(apiName)[0] == null\n );\n if (badProperties.length > 0) {\n throw new Error(\n `Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${\n badProperties.join(\", \")\n }`,\n );\n }\n }\n\n function getV2Types(forInternalUse: boolean = false) {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n \n ${\n Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${\n stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(\n definition.targetType,\n )\n .getImportedDefinitionIdentifier(v2);\n\n return `${\n definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`\n }\n `;\n },\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\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports: string[] = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types(forInternalUse) : \"\"}\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;;AAEA,SAASA,m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BAAkB,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,EAAE8B,GAAG,CAAC;AAC1C;AACA,QAAQlC,gBAAgB,CAACI,YAAY,EAAE,cAAc,EAAE8B,GAAG,CAAC;AAC3D;AACA;AACA;AACA,MAAMpC,gBAAgB,CAACM,YAAY,EAAEC,QAAQ,EAAED,YAAY,CAACwB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACC,CAAC,CAOmB3B,cAAc,CAAC,GAAG,EAAE;AAC1C;AACA,mBAAmBH,YAAY,CAACwB,YAAY,KAAKxB,YAAY,CAACwB,YAAY;AAC1E;AACA,kBAAkBxB,YAAY,CAACoC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","consola","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","forInternalUse","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","parent","requireInterfaceType","it","mergedProperties","properties","apiName","Object","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.ts"],"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 */\n\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport consola from \"consola\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport type { Identifiers } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\nimport {\n createDefinition,\n createObjectSet,\n createOsdkObject,\n createPropertyKeys,\n createProps,\n} from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n interfaceDef: EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n v2: boolean = false,\n forInternalUse: boolean = false,\n) {\n const definition = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceDef.raw,\n v2,\n ),\n );\n\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n parent.raw,\n v2,\n consola,\n ),\n );\n return it;\n }\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(\n fastDeepEqual(\n definition.properties[apiName],\n parent.properties[apiName],\n ),\n `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(\n fastDeepEqual(\n mergedProperties[apiName],\n parent.properties[apiName],\n ),\n `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`,\n );\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n\n definition.properties = mergedProperties;\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 =\n `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n\n const ids: Identifiers = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName =>\n extractNamespace(apiName)[0] == null\n );\n if (badProperties.length > 0) {\n throw new Error(\n `Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${\n badProperties.join(\", \")\n }`,\n );\n }\n }\n\n function getV2Types(forInternalUse: boolean = false) {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n \n ${\n Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${\n stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(\n definition.targetType,\n )\n .getImportedDefinitionIdentifier(v2);\n\n return `${\n definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`\n }\n `;\n },\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\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports: string[] = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types(forInternalUse) : \"\"}\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;;AAEA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAAqB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aAAa,EAAE,IAAI,CAAC;AACtD;AACA;AACA,QAAQL,eAAe,CAACK,YAAY,EAAE8B,GAAG,CAAC;AAC1C;AACA,QAAQlC,gBAAgB,CAACI,YAAY,EAAE,cAAc,EAAE8B,GAAG,CAAC;AAC3D;AACA;AACA;AACA,MAAMpC,gBAAgB,CAACM,YAAY,EAAEC,QAAQ,EAAED,YAAY,CAACwB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACC,CAAC,CAOmB3B,cAAc,CAAC,GAAG,EAAE;AAC1C;AACA,mBAAmBH,YAAY,CAACwB,YAAY,KAAKxB,YAAY,CAACwB,YAAY;AAC1E;AACA,kBAAkBxB,YAAY,CAACoC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","properties","Object","fromEntries","map","spt","extendsInterfaces","links","implementedByObjectTypes","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.ts"],"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 */\n\nimport type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/internal.foundry.core\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes: [],\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAElH,SAASC,SAASA,C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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEF/C,EAAE,CAAC,yCAAyC,EAAE,YAAY;IACxD,MAAMgD,MAAM,GAAG3C,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM4C,MAAM,GAAG5C,SAAS,CAAC,KAAK,CAAC;IAE/B,MAAMgC,QAAQ,GAAGnC,eAAe,CAC9B;MACEqC,SAAS,EAAEX,cAAc,CAAC,UAAU,EAAE,CACpCd,eAAe,CAAC,KAAK,EAAE,CAACkC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAC5ClC,eAAe,CAAC,QAAQ,EAAE,CAACmC,MAAM,CAAC,EAAE,EAAE,CAAC,CACxC,CAAC;MAEFT,SAAS,EAAE;IACb,CACF,CAAC;IAED,MAAMI,aAAa,GAAG,MAAM/C,MAAM,CAChCO,8CAA8C,CAC5CiC,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAC3Bb,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;IACD9C,MAAM,CAAC6C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEF/C,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMgD,MAAM,GAAG3C,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM4C,MAAM,GAAG5C,SAAS,CAAC,KAAK,CAAC;IAE/B,MAAMgC,QAAQ,GAAGnC,eAAe,CAC9B;MACEqC,SAAS,EAAEX,cAAc,CAAC,UAAU,EAAE,CACpCd,eAAe,CAAC,KAAK,EAAE,CAACkC,MAAM,EAAEC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EACpDnC,eAAe,CAAC,QAAQ,EAAE,CAACmC,MAAM,CAAC,EAAE,EAAE,CAAC,CACxC,CAAC;MACFT,SAAS,EAAE;IACb,CACF,CAAC;IAED,MAAMI,aAAa,GAAG,MAAM/C,MAAM,CAChCO,8CAA8C,CAC5CiC,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAC3Bb,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;IACD9C,MAAM,CAAC6C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","properties","Object","fromEntries","map","spt","extendsInterfaces","links","implementedByObjectTypes","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.ts"],"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 */\n\nimport type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes: [],\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAElH,SAASC,SAASA,CAAmBC,OAAU,EAAEC,aAAwB,GAAG,CAAC,EAAE;EAC7E,OAAO;IACLD,OAAO;IACPE,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDC,GAAG,EAAE,GAAGJ,OAAO,KAAK;IACpBK,WAAW,EAAEJ,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,cAAc,GAAGA,OAAO;IACpEM,WAAW,EAAEL,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,gBAAgB,GAAGO;EACjE,CAAC;AACH;AAEA,SAASC,eAAeA,CACtBR,OAAU,EACVS,IAAS,EACTC,OAAiB,EACjBT,aAAwB,GAAG,CAAC,EAC5B;EACA,MAAMU,UAAU,GAAGC,MAAM,CAACC,WAAW,CAACJ,IAAI,CAACK,GAAG,CAACC,GAAG,IAAI,CAACA,GAAG,CAACf,OAAO,EAAE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E;IACb,CACF,CAAC;IAED,MAAMI,aAAa,GAAG,MAAM/C,MAAM,CAChCO,8CAA8C,CAC5CiC,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAC3Bb,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;IACD9C,MAAM,CAAC6C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}