@osdk/generator 2.0.2-rc.3 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/browser/GenerateContext/EnhanceCommon.d.ts +0 -2
  3. package/build/browser/GenerateContext/EnhanceCommon.d.ts.map +1 -1
  4. package/build/browser/GenerateContext/EnhancedBase.d.ts +1 -3
  5. package/build/browser/GenerateContext/EnhancedBase.d.ts.map +1 -1
  6. package/build/browser/GenerateContext/EnhancedBase.js +2 -11
  7. package/build/browser/GenerateContext/EnhancedBase.js.map +1 -1
  8. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts +4 -4
  9. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
  10. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js +27 -21
  11. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  12. package/build/browser/GenerateContext/ForeignType.d.ts +1 -2
  13. package/build/browser/GenerateContext/ForeignType.d.ts.map +1 -1
  14. package/build/browser/GenerateContext/ForeignType.js +5 -11
  15. package/build/browser/GenerateContext/ForeignType.js.map +1 -1
  16. package/build/browser/GenerateContext/enhanceOntology.d.ts +7 -1
  17. package/build/browser/GenerateContext/enhanceOntology.d.ts.map +1 -1
  18. package/build/browser/GenerateContext/enhanceOntology.js +8 -2
  19. package/build/browser/GenerateContext/enhanceOntology.js.map +1 -1
  20. package/build/browser/generateClientSdkPackage.d.ts +1 -1
  21. package/build/browser/generateClientSdkPackage.d.ts.map +1 -1
  22. package/build/browser/generateClientSdkPackage.js +2 -2
  23. package/build/browser/generateClientSdkPackage.js.map +1 -1
  24. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +12 -6
  25. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  26. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +40 -6
  27. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  28. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  29. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  30. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +16 -80
  31. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  32. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +118 -52
  33. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  34. package/build/browser/v2.0/generatePerActionDataFiles.test.js +14 -2
  35. package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  36. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts +2 -0
  37. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
  38. package/build/browser/v2.0/generatePerInterfaceDataFiles.js +45 -0
  39. package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -0
  40. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts +3 -0
  41. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
  42. package/build/browser/v2.0/generatePerObjectDataFiles.js +47 -0
  43. package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -0
  44. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  45. package/build/browser/v2.0/generatePerQueryDataFiles.js +1 -1
  46. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  47. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +9 -3
  48. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  49. package/build/browser/v2.0/generateRootIndexTsFile.d.ts +3 -0
  50. package/build/browser/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
  51. package/build/browser/v2.0/generateRootIndexTsFile.js +40 -0
  52. package/build/browser/v2.0/generateRootIndexTsFile.js.map +1 -0
  53. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  54. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +19 -9
  55. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  56. package/build/esm/GenerateContext/EnhanceCommon.d.ts +0 -2
  57. package/build/esm/GenerateContext/EnhanceCommon.d.ts.map +1 -1
  58. package/build/esm/GenerateContext/EnhancedBase.d.ts +1 -3
  59. package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
  60. package/build/esm/GenerateContext/EnhancedBase.js +2 -11
  61. package/build/esm/GenerateContext/EnhancedBase.js.map +1 -1
  62. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +4 -4
  63. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
  64. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js +27 -21
  65. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  66. package/build/esm/GenerateContext/ForeignType.d.ts +1 -2
  67. package/build/esm/GenerateContext/ForeignType.d.ts.map +1 -1
  68. package/build/esm/GenerateContext/ForeignType.js +5 -11
  69. package/build/esm/GenerateContext/ForeignType.js.map +1 -1
  70. package/build/esm/GenerateContext/enhanceOntology.d.ts +7 -1
  71. package/build/esm/GenerateContext/enhanceOntology.d.ts.map +1 -1
  72. package/build/esm/GenerateContext/enhanceOntology.js +8 -2
  73. package/build/esm/GenerateContext/enhanceOntology.js.map +1 -1
  74. package/build/esm/generateClientSdkPackage.d.ts +1 -1
  75. package/build/esm/generateClientSdkPackage.d.ts.map +1 -1
  76. package/build/esm/generateClientSdkPackage.js +2 -2
  77. package/build/esm/generateClientSdkPackage.js.map +1 -1
  78. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +12 -6
  79. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  80. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +40 -6
  81. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  82. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  83. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  84. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +16 -80
  85. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  86. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +118 -52
  87. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  88. package/build/esm/v2.0/generatePerActionDataFiles.test.js +14 -2
  89. package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  90. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts +2 -0
  91. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
  92. package/build/esm/v2.0/generatePerInterfaceDataFiles.js +45 -0
  93. package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -0
  94. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts +3 -0
  95. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
  96. package/build/esm/v2.0/generatePerObjectDataFiles.js +47 -0
  97. package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -0
  98. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  99. package/build/esm/v2.0/generatePerQueryDataFiles.js +1 -1
  100. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  101. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +9 -3
  102. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  103. package/build/esm/v2.0/generateRootIndexTsFile.d.ts +3 -0
  104. package/build/esm/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
  105. package/build/esm/v2.0/generateRootIndexTsFile.js +40 -0
  106. package/build/esm/v2.0/generateRootIndexTsFile.js.map +1 -0
  107. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  108. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +19 -9
  109. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  110. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","enhanceOntology","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","properties","Object","fromEntries","map","spt","extendsInterfaces","links","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","Map","formattedCode","Bar","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nfunction simpleSpt(apiName, metadataLevel = 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 };\n}\nfunction simpleInterface(apiName, spts, parents, metadataLevel = 2) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\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 };\n}\nfunction simpleOntology(apiName, interfaces) {\n const interfaceTypes = Object\n .fromEntries(interfaces.map(i => [i.apiName, i]));\n const sharedPropertyTypes = Object\n .fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));\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 };\n}\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology(simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]), undefined, new Map(), \"\");\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {\n parser: \"typescript\",\n printWidth: 100,\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 interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk<Bar, K | OPTIONS>;\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 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 it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology(simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]), undefined, new Map(), \"\");\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 interface StrictProps {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk<Foo, K | OPTIONS>;\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 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 it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology(simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]), undefined, new Map(), \"\");\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk<Foo, K | OPTIONS>;\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 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;AACA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,8CAA8C,QAAQ,mDAAmD;AAClH,SAASC,SAASA,CAACC,OAAO,EAAEC,aAAa,GAAG,CAAC,EAAE;EAC3C,OAAO;IACHD,OAAO;IACPE,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV,CAAC;IACDC,GAAG,EAAE,GAAGJ,OAAO,KAAK;IACpBK,WAAW,EAAEJ,aAAa,IAAI,CAAC,GA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AM,CAACK,8CAA8C,CAAC6B,QAAQ,CAACP,cAAc,CAACiB,GAAG,EAAEV,QAAQ,EAAE,IAAI,CAAC,EAAE;MAC5HK,MAAM,EAAE;IACZ,CAAC,CAAC;IACFrC,MAAM,CAACmC,aAAa,CAAC,CAACI,qBAAqB,CAAC;AACpD;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;EACF,CAAC,CAAC;AACN,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","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.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { 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 { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nfunction simpleSpt(apiName, metadataLevel = 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 };\n}\nfunction simpleInterface(apiName, spts, parents, metadataLevel = 2) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\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 };\n}\nfunction simpleOntology(apiName, interfaces) {\n const interfaceTypes = Object\n .fromEntries(interfaces.map(i => [i.apiName, i]));\n const sharedPropertyTypes = Object\n .fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));\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 };\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 expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(true);\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {\n parser: \"typescript\",\n printWidth: 100,\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 interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$notStrict\" | \"$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 | \"$notStrict\" | \"$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 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 it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 interface StrictProps {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$notStrict\" | \"$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 | \"$notStrict\" | \"$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 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 it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$notStrict\" | \"$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 | \"$notStrict\" | \"$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 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;AACA,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;AAC/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAClH,SAASC,SAASA,CAACC,OAAO,EAAEC,aAAa,GAAG,CAAC,EAAE;EAC3C,OAAO;IACHD,OAAO;IACPE,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV,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;EACnE,CAAC;AACL;AACA,SAASC,eAAeA,CAACR,OAAO,EAAES,IAAI,EAAEC,OAAO,EAAET,a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;MACFT,SAAS,EAAE;IACf,CAAC,CAAC;IACF,MAAMI,aAAa,GAAG,MAAM3C,MAAM,CAACO,8CAA8C,CAAC6B,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAAEb,QAAQ,EAAE,IAAI,CAAC,EAAE;MAC5HQ,MAAM,EAAE;IACZ,CAAC,CAAC;IACF1C,MAAM,CAACyC,aAAa,CAAC,CAACG,qBAAqB,CAAC;AACpD;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;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import type { MinimalFs } from "../MinimalFs.js";
2
2
  import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
3
- export declare function generateClientSdkVersionTwoPointZero(ontology: WireOntologyDefinition, userAgent: string, fs: MinimalFs, outDir: string, packageType?: "module" | "commonjs", ontologyApiNamespace?: string, apiNamespacePackageMap?: Map<string, string>): Promise<void>;
3
+ export declare function generateClientSdkVersionTwoPointZero(ontology: WireOntologyDefinition, userAgent: string, fs: MinimalFs, outDir: string, packageType?: "module" | "commonjs", externalObjects?: Map<string, string>, externalInterfaces?: Map<string, string>, externalSpts?: Map<string, string>): Promise<void>;
4
4
  //# sourceMappingURL=generateClientSdkVersionTwoPointZero.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientSdkVersionTwoPointZero.d.ts","sourceRoot":"","sources":["../../../src/v2.0/generateClientSdkVersionTwoPointZero.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAgE3E,wBAAsB,oCAAoC,CACxD,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,QAAQ,GAAG,UAAuB,EAC/C,oBAAoB,CAAC,EAAE,MAAM,EAC7B,sBAAsB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,iBAgDxD"}
1
+ {"version":3,"file":"generateClientSdkVersionTwoPointZero.d.ts","sourceRoot":"","sources":["../../../src/v2.0/generateClientSdkVersionTwoPointZero.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAQ3E,wBAAsB,oCAAoC,CACxD,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,QAAQ,GAAG,UAAuB,EAC/C,eAAe,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EAChD,kBAAkB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EACnD,YAAY,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,iBAkC9C"}
@@ -13,107 +13,43 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import path from "node:path";
17
16
  import { enhanceOntology } from "../GenerateContext/enhanceOntology.js";
18
17
  import { sanitizeMetadata } from "../shared/sanitizeMetadata.js";
19
- import { formatTs } from "../util/test/formatTs.js";
20
18
  import { verifyOutDir } from "../util/verifyOutDir.js";
21
19
  import { generateOntologyMetadataFile } from "./generateMetadata.js";
22
20
  import { generatePerActionDataFiles } from "./generatePerActionDataFiles.js";
21
+ import { generatePerInterfaceDataFiles } from "./generatePerInterfaceDataFiles.js";
22
+ import { generatePerObjectDataFiles } from "./generatePerObjectDataFiles.js";
23
23
  import { generatePerQueryDataFilesV2 } from "./generatePerQueryDataFiles.js";
24
- import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from "./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js";
25
- import { wireObjectTypeV2ToSdkObjectConstV2 } from "./wireObjectTypeV2ToSdkObjectConstV2.js";
26
- async function generateRootIndexTsFile({
27
- fs,
28
- outDir,
29
- importExt,
30
- ontologyApiNamespace
31
- }) {
32
- fs.writeFile(path.join(outDir, "index.ts"), await formatTs(`export * from "./ontology/actions${importExt}";
33
- export * as $Actions from "./ontology/actions${importExt}";
34
- export * from "./ontology/interfaces${importExt}";
35
- export * as $Interfaces from "./ontology/interfaces${importExt}";
36
- export * from "./ontology/objects${importExt}";
37
- export * as $Objects from "./ontology/objects${importExt}";
38
- export * from "./ontology/queries${importExt}";
39
- export * as $Queries from "./ontology/queries${importExt}";
40
- ${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
41
- `));
42
- }
43
- async function generateEachObjectFile(ctx) {
44
- const {
45
- fs,
46
- outDir,
47
- ontology,
48
- importExt
49
- } = ctx;
50
- await fs.mkdir(path.join(outDir, "ontology", "objects"), {
51
- recursive: true
52
- });
53
- for (const obj of Object.values(ontology.objectTypes)) {
54
- const relPath = path.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
55
- const outFilePath = path.join(outDir, relPath);
56
- await fs.writeFile(outFilePath, await formatTs(`
57
- import type { PropertyDef as $PropertyDef } from "@osdk/api";
58
- import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
59
- import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
60
- ${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
61
- `));
62
- }
63
- }
64
- export async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = "commonjs", ontologyApiNamespace, apiNamespacePackageMap = new Map()) {
24
+ import { generateRootIndexTsFile } from "./generateRootIndexTsFile.js";
25
+ export async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = "commonjs", externalObjects = new Map(), externalInterfaces = new Map(), externalSpts = new Map()) {
65
26
  const importExt = packageType === "module" ? ".js" : "";
27
+ // Structurally, we need to have multiple ontologies read in
28
+ // with one per package.
66
29
  await verifyOutDir(outDir, fs);
67
30
  const sanitizedOntology = sanitizeMetadata(ontology);
68
31
  await fs.mkdir(outDir, {
69
32
  recursive: true
70
33
  });
71
- const enhancedOntology = enhanceOntology(sanitizedOntology, ontologyApiNamespace, apiNamespacePackageMap, importExt);
34
+ const enhancedOntology = enhanceOntology({
35
+ sanitized: sanitizedOntology,
36
+ importExt,
37
+ externalObjects,
38
+ externalInterfaces,
39
+ externalSpts
40
+ });
72
41
  const ctx = {
73
42
  sanitizedOntology,
74
43
  ontology: enhancedOntology,
75
44
  importExt,
76
45
  fs,
77
- outDir,
78
- ontologyApiNamespace,
79
- apiNamespacePackageMap
46
+ outDir
80
47
  };
81
48
  await generateRootIndexTsFile(ctx);
82
49
  await generateOntologyMetadataFile(ctx, userAgent);
83
- await generateEachObjectFile(ctx);
84
- await generateOntologyInterfaces(ctx);
85
- const actionsDir = path.join(outDir, "ontology", "actions");
86
- await fs.mkdir(actionsDir, {
87
- recursive: true
88
- });
50
+ await generatePerObjectDataFiles(ctx);
51
+ await generatePerInterfaceDataFiles(ctx);
89
52
  await generatePerActionDataFiles(ctx);
90
- await fs.writeFile(path.join(outDir, "ontology", "objects.ts"), await formatTs(`
91
- ${Object.values(enhancedOntology.objectTypes).map(objType => `export * from "./objects/${objType.shortApiName}${importExt}";`).join("\n")}
92
- ${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
93
- `));
94
53
  await generatePerQueryDataFilesV2(ctx, true);
95
54
  }
96
- /** @internal */
97
- async function generateOntologyInterfaces({
98
- fs,
99
- outDir,
100
- ontology,
101
- importExt
102
- }) {
103
- const interfacesDir = path.join(outDir, "ontology", "interfaces");
104
- await fs.mkdir(interfacesDir, {
105
- recursive: true
106
- });
107
- for (const obj of Object.values(ontology.interfaceTypes)) {
108
- await fs.writeFile(path.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
109
- import type { PropertyDef as $PropertyDef } from "@osdk/api";
110
- import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
111
- ${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
112
- `));
113
- }
114
- await fs.writeFile(interfacesDir + ".ts", await formatTs(`
115
- ${Object.values(ontology.interfaceTypes).map(interfaceType => `export * from "./interfaces/${interfaceType.shortApiName}${importExt}";`).join("\n")}
116
- ${Object.keys(ontology.interfaceTypes).length === 0 ? "export {}" : ""}
117
- `));
118
- }
119
55
  //# sourceMappingURL=generateClientSdkVersionTwoPointZero.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientSdkVersionTwoPointZero.js","names":["path","enhanceOntology","sanitizeMetadata","formatTs","verifyOutDir","generateOntologyMetadataFile","generatePerActionDataFiles","generatePerQueryDataFilesV2","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","wireObjectTypeV2ToSdkObjectConstV2","generateRootIndexTsFile","fs","outDir","importExt","ontologyApiNamespace","writeFile","join","generateEachObjectFile","ctx","ontology","mkdir","recursive","obj","Object","values","objectTypes","relPath","shortApiName","outFilePath","raw","generateClientSdkVersionTwoPointZero","userAgent","packageType","apiNamespacePackageMap","Map","sanitizedOntology","enhancedOntology","generateOntologyInterfaces","actionsDir","map","objType","keys","length","interfacesDir","interfaceTypes","interfaceType"],"sources":["generateClientSdkVersionTwoPointZero.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport path from \"node:path\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata.js\";\nimport { formatTs } from \"../util/test/formatTs.js\";\nimport { verifyOutDir } from \"../util/verifyOutDir.js\";\nimport { generateOntologyMetadataFile } from \"./generateMetadata.js\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nimport { wireObjectTypeV2ToSdkObjectConstV2, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\nasync function generateRootIndexTsFile({ fs, outDir, importExt, ontologyApiNamespace }) {\n fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`export * from \"./ontology/actions${importExt}\";\n export * as $Actions from \"./ontology/actions${importExt}\";\n export * from \"./ontology/interfaces${importExt}\";\n export * as $Interfaces from \"./ontology/interfaces${importExt}\";\n export * from \"./ontology/objects${importExt}\";\n export * as $Objects from \"./ontology/objects${importExt}\";\n export * from \"./ontology/queries${importExt}\";\n export * as $Queries from \"./ontology/queries${importExt}\";\n ${ontologyApiNamespace == null\n ? `export { $ontologyRid } from \"./OntologyMetadata${importExt}\";`\n : ``}\n `));\n}\nasync function generateEachObjectFile(ctx) {\n const { fs, outDir, ontology, importExt, } = ctx;\n await fs.mkdir(path.join(outDir, \"ontology\", \"objects\"), { recursive: true });\n for (const obj of Object.values(ontology.objectTypes)) {\n const relPath = path.join(\".\", \"ontology\", `objects`, `${obj.shortApiName}.ts`);\n const outFilePath = path.join(outDir, relPath);\n await fs.writeFile(outFilePath, await formatTs(`\n import type { PropertyDef as $PropertyDef } from \"@osdk/api\";\n import { $osdkMetadata } from \"../../OntologyMetadata${importExt}\";\n import type { $ExpectedClientVersion } from \"../../OntologyMetadata${importExt}\";\n ${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}\n `));\n }\n}\nexport async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = \"commonjs\", ontologyApiNamespace, apiNamespacePackageMap = new Map()) {\n const importExt = packageType === \"module\" ? \".js\" : \"\";\n await verifyOutDir(outDir, fs);\n const sanitizedOntology = sanitizeMetadata(ontology);\n await fs.mkdir(outDir, { recursive: true });\n const enhancedOntology = enhanceOntology(sanitizedOntology, ontologyApiNamespace, apiNamespacePackageMap, importExt);\n const ctx = {\n sanitizedOntology,\n ontology: enhancedOntology,\n importExt,\n fs,\n outDir,\n ontologyApiNamespace,\n apiNamespacePackageMap,\n };\n await generateRootIndexTsFile(ctx);\n await generateOntologyMetadataFile(ctx, userAgent);\n await generateEachObjectFile(ctx);\n await generateOntologyInterfaces(ctx);\n const actionsDir = path.join(outDir, \"ontology\", \"actions\");\n await fs.mkdir(actionsDir, { recursive: true });\n await generatePerActionDataFiles(ctx);\n await fs.writeFile(path.join(outDir, \"ontology\", \"objects.ts\"), await formatTs(`\n ${Object.values(enhancedOntology.objectTypes).map(objType => `export * from \"./objects/${objType.shortApiName}${importExt}\";`).join(\"\\n\")}\n ${Object.keys(ontology.objectTypes).length === 0 ? \"export {};\" : \"\"}\n `));\n await generatePerQueryDataFilesV2(ctx, true);\n}\n/** @internal */\nasync function generateOntologyInterfaces({ fs, outDir, ontology, importExt }) {\n const interfacesDir = path.join(outDir, \"ontology\", \"interfaces\");\n await fs.mkdir(interfacesDir, {\n recursive: true,\n });\n for (const obj of Object.values(ontology.interfaceTypes)) {\n await fs.writeFile(path.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`\n import type { PropertyDef as $PropertyDef } from \"@osdk/api\";\n import { $osdkMetadata } from \"../../OntologyMetadata${importExt}\";\n ${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}\n `));\n }\n await fs.writeFile(interfacesDir + \".ts\", await formatTs(`\n ${Object.values(ontology.interfaceTypes).map(interfaceType => `export * from \"./interfaces/${interfaceType.shortApiName}${importExt}\";`).join(\"\\n\")}\n ${Object.keys(ontology.interfaceTypes).length === 0\n ? \"export {}\"\n : \"\"}\n `));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,WAAW;AAC5B,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,4BAA4B,QAAQ,uBAAuB;AACpE,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,8CAA8C,QAAQ,mDAAmD;AAClH,SAASC,kCAAkC,QAAS,yCAAyC;AAC7F,eAAeC,uBAAuBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAqB,CAAC,EAAE;EACpFH,EAAE,CAACI,SAAS,CAACf,IAAI,CAACgB,IAAI,CAACJ,MAAM,EAAE,UAAU,CAAC,EAAE,MAAMT,QAAQ,CAAC,oCAAoCU,SAAS;AAC5G,uDAAuDA,SAAS;AAChE,8CAA8CA,SAAS;AACvD,6DAA6DA,SAAS;AACtE,2CAA2CA,SAAS;AACpD,uDAAuDA,SAAS;AAChE,2CAA2CA,SAAS;AACpD,uDAAuDA,SAAS;AAChE,UAAUC,oBAAoB,IAAI,IAAI,GAC5B,mDAAmDD,SAAS,IAA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0BAA0BA,CAAC;EAAE1B,EAAE;EAAEC,MAAM;EAAEO,QAAQ;EAAEN;AAAU,CAAC,EAAE;EAC3E,MAAM8B,aAAa,GAAG3C,IAAI,CAACgB,IAAI,CAACJ,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC;EACjE,MAAMD,EAAE,CAACS,KAAK,CAACuB,aAAa,EAAE;IAC1BtB,SAAS,EAAE;EACf,CAAC,CAAC;EACF,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,MAAM,CAACL,QAAQ,CAACyB,cAAc,CAAC,EAAE;IACtD,MAAMjC,EAAE,CAACI,SAAS,CAACf,IAAI,CAACgB,IAAI,CAAC2B,aAAa,EAAE,GAAGrB,GAAG,CAACK,YAAY,KAAK,CAAC,EAAE,MAAMxB,QAAQ,CAAC;AAC9F;AACA,+DAA+DU,SAAS;AACxE,QAAQL,8CAA8C,CAACc,GAAG,EAAEH,QAAQ,EAAE,IAAI,CAAC;AAC3E,KAAK,CAAC,CAAC;EACH;EACA,MAAMR,EAAE,CAACI,SAAS,CAAC4B,aAAa,GAAG,KAAK,EAAE,MAAMxC,QAAQ,CAAC;AAC7D,MAAMoB,MAAM,CAACC,MAAM,CAACL,QAAQ,CAACyB,cAAc,CAAC,CAACL,GAAG,CAACM,aAAa,IAAI,+BAA+BA,aAAa,CAAClB,YAAY,GAAGd,SAAS,IAAI,CAAC,CAACG,IAAI,CAAC,IAAI,CAAC;AACvJ,MAAMO,MAAM,CAACkB,IAAI,CAACtB,QAAQ,CAACyB,cAAc,CAAC,CAACF,MAAM,KAAK,CAAC,GAC7C,WAAW,GACX,EAAE;AACZ,KAAK,CAAC,CAAC;AACP","ignoreList":[]}
1
+ {"version":3,"file":"generateClientSdkVersionTwoPointZero.js","names":["enhanceOntology","sanitizeMetadata","verifyOutDir","generateOntologyMetadataFile","generatePerActionDataFiles","generatePerInterfaceDataFiles","generatePerObjectDataFiles","generatePerQueryDataFilesV2","generateRootIndexTsFile","generateClientSdkVersionTwoPointZero","ontology","userAgent","fs","outDir","packageType","externalObjects","Map","externalInterfaces","externalSpts","importExt","sanitizedOntology","mkdir","recursive","enhancedOntology","sanitized","ctx"],"sources":["generateClientSdkVersionTwoPointZero.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata.js\";\nimport { verifyOutDir } from \"../util/verifyOutDir.js\";\nimport { generateOntologyMetadataFile } from \"./generateMetadata.js\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles.js\";\nimport { generatePerInterfaceDataFiles } from \"./generatePerInterfaceDataFiles.js\";\nimport { generatePerObjectDataFiles } from \"./generatePerObjectDataFiles.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\nimport { generateRootIndexTsFile } from \"./generateRootIndexTsFile.js\";\nexport async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = \"commonjs\", externalObjects = new Map(), externalInterfaces = new Map(), externalSpts = new Map()) {\n const importExt = packageType === \"module\" ? \".js\" : \"\";\n // Structurally, we need to have multiple ontologies read in\n // with one per package.\n await verifyOutDir(outDir, fs);\n const sanitizedOntology = sanitizeMetadata(ontology);\n await fs.mkdir(outDir, { recursive: true });\n const enhancedOntology = enhanceOntology({\n sanitized: sanitizedOntology,\n importExt,\n externalObjects,\n externalInterfaces,\n externalSpts,\n });\n const ctx = {\n sanitizedOntology,\n ontology: enhancedOntology,\n importExt,\n fs,\n outDir,\n };\n await generateRootIndexTsFile(ctx);\n await generateOntologyMetadataFile(ctx, userAgent);\n await generatePerObjectDataFiles(ctx);\n await generatePerInterfaceDataFiles(ctx);\n await generatePerActionDataFiles(ctx);\n await generatePerQueryDataFilesV2(ctx, true);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,uCAAuC;AACvE,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,4BAA4B,QAAQ,uBAAuB;AACpE,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,6BAA6B,QAAQ,oCAAoC;AAClF,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,OAAO,eAAeC,oCAAoCA,CAACC,QAAQ,EAAEC,SAAS,EAAEC,EAAE,EAAEC,MAAM,EAAEC,WAAW,GAAG,UAAU,EAAEC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC,EAAEC,kBAAkB,GAAG,IAAID,GAAG,CAAC,CAAC,EAAEE,YAAY,GAAG,IAAIF,GAAG,CAAC,CAAC,EAAE;EACzM,MAAMG,SAAS,GAAGL,WAAW,KAAK,QAAQ,GAAG,KAAK,GAAG,EAAE;EACvD;EACA;EACA,MAAMZ,YAAY,CAACW,MAAM,EAAED,EAAE,CAAC;EAC9B,MAAMQ,iBAAiB,GAAGnB,gBAAgB,CAACS,QAAQ,CAAC;EACpD,MAAME,EAAE,CAACS,KAAK,CAACR,MAAM,EAAE;IAAES,SAAS,EAAE;EAAK,CAAC,CAAC;EAC3C,MAAMC,gBAAgB,GAAGvB,eAAe,CAAC;IACrCwB,SAAS,EAAEJ,iBAAiB;IAC5BD,SAAS;IACTJ,eAAe;IACfE,kBAAkB;IAClBC;EACJ,CAAC,CA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