@osdk/client 2.3.1 → 2.4.0-beta.10

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 (136) hide show
  1. package/CHANGELOG.md +117 -57
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +41 -1
  5. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  6. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +145 -12
  7. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  8. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
  9. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
  10. package/build/browser/fetchMetadata.test.js +14 -0
  11. package/build/browser/fetchMetadata.test.js.map +1 -1
  12. package/build/browser/index.js +1 -1
  13. package/build/browser/index.js.map +1 -1
  14. package/build/browser/intellisense.test.js +1 -1
  15. package/build/browser/intellisense.test.js.map +1 -1
  16. package/build/browser/internal/conversions/modernToLegacyGroupByClause.js +2 -1
  17. package/build/browser/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
  18. package/build/browser/object/aggregate.test.js +85 -0
  19. package/build/browser/object/aggregate.test.js.map +1 -1
  20. package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
  21. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
  22. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +7 -0
  23. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  24. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +9 -0
  25. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  26. package/build/browser/object/convertWireToOsdkObjects.test.js +240 -0
  27. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  28. package/build/browser/object/mediaUpload.js +3 -0
  29. package/build/browser/object/mediaUpload.js.map +1 -1
  30. package/build/browser/objectSet/ObjectSet.test.js +105 -106
  31. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  32. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  33. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +1 -1
  34. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  35. package/build/browser/objectSet/createObjectSet.js +22 -0
  36. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  37. package/build/browser/observable/ObservableClient.js.map +1 -1
  38. package/build/browser/observable/internal/ObservableClientImpl.js +1 -0
  39. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  40. package/build/browser/observable/internal/Store.js +7 -0
  41. package/build/browser/observable/internal/Store.js.map +1 -1
  42. package/build/browser/ontology/StandardOntologyProvider.js +3 -2
  43. package/build/browser/ontology/StandardOntologyProvider.js.map +1 -1
  44. package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js +4 -1
  45. package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -1
  46. package/build/browser/util/UserAgent.js +2 -2
  47. package/build/browser/util/UserAgent.js.map +1 -1
  48. package/build/browser/util/deepFreeze.js +26 -0
  49. package/build/browser/util/deepFreeze.js.map +1 -0
  50. package/build/browser/util/toDataValue.js +17 -1
  51. package/build/browser/util/toDataValue.js.map +1 -1
  52. package/build/browser/util/toDataValue.test.js +42 -2
  53. package/build/browser/util/toDataValue.test.js.map +1 -1
  54. package/build/cjs/{chunk-FWYXUSCF.cjs → chunk-3DKSV2QU.cjs} +103 -63
  55. package/build/cjs/chunk-3DKSV2QU.cjs.map +1 -0
  56. package/build/cjs/{chunk-T5KGTBH2.cjs → chunk-E5BQ7757.cjs} +187 -38
  57. package/build/cjs/chunk-E5BQ7757.cjs.map +1 -0
  58. package/build/cjs/index.cjs +10 -6
  59. package/build/cjs/index.d.cts +1 -1
  60. package/build/cjs/public/internal.cjs +12 -9
  61. package/build/cjs/public/internal.cjs.map +1 -1
  62. package/build/cjs/public/internal.d.cts +1 -1
  63. package/build/cjs/public/unstable-do-not-use.cjs +24 -16
  64. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  65. package/build/cjs/public/unstable-do-not-use.d.cts +2 -1
  66. package/build/esm/Client.js +1 -1
  67. package/build/esm/Client.js.map +1 -1
  68. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +41 -1
  69. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  70. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +145 -12
  71. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  72. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
  73. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
  74. package/build/esm/fetchMetadata.test.js +14 -0
  75. package/build/esm/fetchMetadata.test.js.map +1 -1
  76. package/build/esm/index.js +1 -1
  77. package/build/esm/index.js.map +1 -1
  78. package/build/esm/intellisense.test.js +1 -1
  79. package/build/esm/intellisense.test.js.map +1 -1
  80. package/build/esm/internal/conversions/modernToLegacyGroupByClause.js +2 -1
  81. package/build/esm/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
  82. package/build/esm/object/aggregate.test.js +85 -0
  83. package/build/esm/object/aggregate.test.js.map +1 -1
  84. package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
  85. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
  86. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +7 -0
  87. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  88. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +9 -0
  89. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  90. package/build/esm/object/convertWireToOsdkObjects.test.js +240 -0
  91. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  92. package/build/esm/object/mediaUpload.js +3 -0
  93. package/build/esm/object/mediaUpload.js.map +1 -1
  94. package/build/esm/objectSet/ObjectSet.test.js +105 -106
  95. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  96. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  97. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +1 -1
  98. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  99. package/build/esm/objectSet/createObjectSet.js +22 -0
  100. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  101. package/build/esm/observable/ObservableClient.js.map +1 -1
  102. package/build/esm/observable/internal/ObservableClientImpl.js +1 -0
  103. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  104. package/build/esm/observable/internal/Store.js +7 -0
  105. package/build/esm/observable/internal/Store.js.map +1 -1
  106. package/build/esm/ontology/StandardOntologyProvider.js +3 -2
  107. package/build/esm/ontology/StandardOntologyProvider.js.map +1 -1
  108. package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js +4 -1
  109. package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -1
  110. package/build/esm/util/UserAgent.js +2 -2
  111. package/build/esm/util/UserAgent.js.map +1 -1
  112. package/build/esm/util/deepFreeze.js +26 -0
  113. package/build/esm/util/deepFreeze.js.map +1 -0
  114. package/build/esm/util/toDataValue.js +17 -1
  115. package/build/esm/util/toDataValue.js.map +1 -1
  116. package/build/esm/util/toDataValue.test.js +42 -2
  117. package/build/esm/util/toDataValue.test.js.map +1 -1
  118. package/build/types/Client.d.ts +1 -1
  119. package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts +1 -0
  120. package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts.map +1 -0
  121. package/build/types/index.d.ts +1 -1
  122. package/build/types/index.d.ts.map +1 -1
  123. package/build/types/object/mediaUpload.d.ts +2 -1
  124. package/build/types/object/mediaUpload.d.ts.map +1 -1
  125. package/build/types/observable/ObservableClient.d.ts +2 -1
  126. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  127. package/build/types/observable/internal/Store.d.ts +2 -1
  128. package/build/types/observable/internal/Store.d.ts.map +1 -1
  129. package/build/types/ontology/StandardOntologyProvider.d.ts.map +1 -1
  130. package/build/types/public-utils/hydrateObjectSetFromObjectRids.d.ts +1 -1
  131. package/build/types/public-utils/hydrateObjectSetFromObjectRids.d.ts.map +1 -1
  132. package/build/types/util/deepFreeze.d.ts +1 -0
  133. package/build/types/util/deepFreeze.d.ts.map +1 -0
  134. package/package.json +13 -13
  135. package/build/cjs/chunk-FWYXUSCF.cjs.map +0 -1
  136. package/build/cjs/chunk-T5KGTBH2.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot","sendCompletionsRequest","triggerKind","CompletionTriggerKind","Invoked","entries","length","toBeGreaterThan","map","e","toEqual","resp2","not"],"sources":["intellisense.test.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 { Logger } from \"@osdk/api\";\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type { TsServer } from \"./tsserver.js\";\nimport { startTsServer } from \"./tsserver.js\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let clientPackagePath: string;\n\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ clientsPackageJson });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(\n path.dirname(clientsPackageJson),\n \"..\",\n );\n\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n\n let tsServer: TsServer;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n clientPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined as any;\n });\n\n it(\"callsQueryAcceptsObject\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"(no ontology metadata)\"`,\n );\n });\n\n it(\"showsObjectPropertyJsdoc\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 26,\n offset: 13,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"description: Geotime series reference of the location of the employee\"`,\n );\n });\n\n it(\"orderBySuggestionIsRight\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendCompletionsRequest({\n file: intellisenseFilePath,\n line: 28,\n offset: 14,\n triggerKind: ts.CompletionTriggerKind.Invoked,\n });\n expect(resp.body?.entries.length).toBeGreaterThan(2);\n expect(resp.body?.entries.map(e => e.name)).toEqual([\n \"class\",\n \"employeeId\",\n \"employeeLocation\",\n \"employeeSensor\",\n \"employeeStatus\",\n \"fullName\",\n \"office\",\n \"startDate\",\n ]);\n\n const { resp: resp2 } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 32,\n offset: 3,\n });\n expect(resp2.body?.documentation).not.toEqual(\"'(property) $orderBy: any'\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SACEC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,EAAE,EACFC,EAAE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MAAM,EAAE;IACV,CAAC,CAAC;IACFnD,MAAM,CAACiE,KAAK,CAACb,IAAI,EAAEC,aAAa,CAAC,CAACa,GAAG,CAACF,OAAO,CAAC,4BAA4B,CAAC;EAC7E,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot","sendCompletionsRequest","triggerKind","CompletionTriggerKind","Invoked","entries","length","toBeGreaterThan","map","e","toEqual","resp2","not"],"sources":["intellisense.test.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 { Logger } from \"@osdk/api\";\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type { TsServer } from \"./tsserver.js\";\nimport { startTsServer } from \"./tsserver.js\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let clientPackagePath: string;\n\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ clientsPackageJson });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(\n path.dirname(clientsPackageJson),\n \"..\",\n );\n\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n\n let tsServer: TsServer;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n clientPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined as any;\n });\n\n it(\"callsQueryAcceptsObject\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"(no ontology metadata)\"`,\n );\n });\n\n it(\"showsObjectPropertyJsdoc\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 26,\n offset: 13,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"description: Geotime series reference of the location of the employee\"`,\n );\n });\n\n it(\"orderBySuggestionIsRight\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendCompletionsRequest({\n file: intellisenseFilePath,\n line: 28,\n offset: 14,\n triggerKind: ts.CompletionTriggerKind.Invoked,\n });\n expect(resp.body?.entries.length).toBeGreaterThan(2);\n expect(resp.body?.entries.map(e => e.name)).toEqual([\n \"class\",\n \"employeeId\",\n \"employeeLocation\",\n \"employeeSensor\",\n \"employeeStatus\",\n \"fullName\",\n \"office\",\n \"skillSet\",\n \"skillSetEmbedding\",\n \"startDate\",\n ]);\n\n const { resp: resp2 } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 32,\n offset: 3,\n });\n expect(resp2.body?.documentation).not.toEqual(\"'(property) $orderBy: any'\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SACEC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,EAAE,EACFC,EAAE,QACG,QAAQ;AAEf,SAASC,aAAa,QAAQ,eAAe;;AAE7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAA6B;EAC/D,MAAMC,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAEA,IAAI;EACxC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAC9C,MAAM;IAAEC;EAAa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EAAE,EAAE;MACRC,MAAM,EAAE;IACV,CAAC,CAAC;IACFnD,MAAM,CAACgD,IAAI,CAACI,IAAI,EAAEC,aAAa,CAAC,CAACC,qBAAqB,CACpD,yEACF,CAAC;EACH,CAAC,CAAC;EAEFrD,EAAE,CAAC,0BAA0B,EAAE;IAAE8C,OAAO,EAAE;EAAO,CAAC,EAAE,YAAY;IAC9D,MAAM;MAAEC;IAAK,CAAC,GAAG,MAAMX,QAAQ,CAACkB,sBAAsB,CAAC;MACrDV,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE,EAAE;MACVK,WAAW,EAAE7D,EAAE,CAAC8D,qBAAqB,CAACC;IACxC,CAAC,CAAC;IACF1D,MAAM,CAACgD,IAAI,CAACI,IAAI,EAAEO,OAAO,CAACC,MAAM,CAAC,CAACC,eAAe,CAAC,CAAC,CAAC;IACpD7D,MAAM,CAACgD,IAAI,CAACI,IAAI,EAAEO,OAAO,CAACG,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACvB,IAAI,CAAC,CAAC,CAACwB,OAAO,CAAC,CAClD,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,WAAW,CACZ,CAAC;IAEF,MAAM;MAAEhB,IAAI,EAAEiB;IAAM,CAAC,GAAG,MAAM5B,QAAQ,CAACY,oBAAoB,CAAC;MAC1DJ,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACV,CAAC,CAAC;IACFnD,MAAM,CAACiE,KAAK,CAACb,IAAI,EAAEC,aAAa,CAAC,CAACa,GAAG,CAACF,OAAO,CAAC,4BAA4B,CAAC;EAC7E,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -37,7 +37,8 @@ export function modernToLegacyGroupByClause(groupByClause) {
37
37
  type: "exact",
38
38
  field,
39
39
  maxGroupCount: type.$exact?.$limit ?? undefined,
40
- defaultValue: type.$exact.$defaultValue ?? undefined
40
+ defaultValue: type.$exact.$defaultValue ?? undefined,
41
+ includeNullValues: type.$exact.$includeNullValue === true ? true : undefined
41
42
  }];
42
43
  } else if ("$fixedWidth" in type) {
43
44
  return [{
@@ -1 +1 @@
1
- {"version":3,"file":"modernToLegacyGroupByClause.js","names":["DurationMapping","modernToLegacyGroupByClause","groupByClause","Object","entries","flatMap","field","type","maxGroupCount","$exactWithLimit","$exact","$limit","undefined","defaultValue","$defaultValue","fixedWidth","$fixedWidth","ranges","$ranges","map","range","convertRange","value","$duration","unit","startValue","endValue"],"sources":["modernToLegacyGroupByClause.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 { AllGroupByValues, GroupByClause, GroupByRange } from \"@osdk/api\";\nimport { DurationMapping } from \"@osdk/api\";\nimport type {\n AggregationGroupByV2,\n AggregationRangeV2,\n} from \"@osdk/foundry.ontologies\";\n\n/** @internal */\nexport function modernToLegacyGroupByClause(\n groupByClause: GroupByClause<any> | undefined,\n) {\n if (!groupByClause) return [];\n\n return Object.entries(\n groupByClause as Record<string, AllGroupByValues>,\n ).flatMap<AggregationGroupByV2>(([field, type]) => {\n if (type === \"exact\") {\n return [{ type, field }];\n } else if (\"$exactWithLimit\" in type) {\n {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exactWithLimit,\n },\n ];\n }\n } else if (\"$exact\" in type) {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exact?.$limit ?? undefined,\n defaultValue: type.$exact.$defaultValue ?? undefined,\n },\n ];\n } else if (\"$fixedWidth\" in type) {\n return [{\n type: \"fixedWidth\",\n field,\n fixedWidth: type.$fixedWidth,\n }];\n } else if (\"$ranges\" in type) {\n return [{\n type: \"ranges\",\n field,\n ranges: type.$ranges.map(range => convertRange(range)),\n }];\n } else if (\"$duration\" in type) {\n return [{\n type: \"duration\",\n field,\n value: type.$duration[0],\n unit: DurationMapping[type.$duration[1]],\n }];\n } else return [];\n });\n}\n\nfunction convertRange(\n range: GroupByRange<number | string>,\n): AggregationRangeV2 {\n return { startValue: range[0], endValue: range[1] };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,WAAW;AAM3C;AACA,OAAO,SAASC,2BAA2BA,CACzCC,aAA6C,EAC7C;EACA,IAAI,CAACA,aAAa,EAAE,OAAO,EAAE;EAE7B,OAAOC,MAAM,CAACC,OAAO,CACnBF,aACF,CAAC,CAACG,OAAO,CAAuB,CAAC,CAACC,KAAK,EAAEC,IAAI,CAAC,KAAK;IACjD,IAAIA,IAAI,KAAK,OAAO,EAAE;MACpB,OAAO,CAAC;QAAEA,IAAI;QAAED;MAAM,CAAC,CAAC;IAC1B,CAAC,MAAM,IAAI,iBAAiB,IAAIC,IAAI,EAAE;MACpC;QACE,OAAO,CACL;UACEA,IAAI,EAAE,OAAO;UACbD,KAAK;UACLE,aAAa,EAAED,IAAI,CAACE;QACtB,CAAC,CACF;MACH;IACF,CAAC,MAAM,IAAI,QAAQ,IAAIF,IAAI,EAAE;MAC3B,OAAO,CACL;QACEA,IAAI,EAAE,OAAO;QACbD,KAAK;QACLE,aAAa,EAAED,IAAI,CAACG,MAAM,EAAEC,MAAM,IAAIC,SAAS;QAC/CC,YAAY,EAAEN,IAAI,CAACG,MAAM,CAACI,aAAa,IAAIF;MAC7C,CAAC,CACF;IACH,CAAC,MAAM,IAAI,aAAa,IAAIL,IAAI,EAAE;MAChC,OAAO,CAAC;QACNA,IAAI,EAAE,YAAY;QAClBD,KAAK;QACLS,UAAU,EAAER,IAAI,CAACS;MACnB,CAAC,CAAC;IACJ,CAAC,MAAM,IAAI,SAAS,IAAIT,IAAI,EAAE;MAC5B,OAAO,CAAC;QACNA,IAAI,EAAE,QAAQ;QACdD,KAAK;QACLW,MAAM,EAAEV,IAAI,CAACW,OAAO,CAACC,GAAG,CAACC,KAAK,IAAIC,YAAY,CAACD,KAAK,CAAC;MACvD,CAAC,CAAC;IACJ,CAAC,MAAM,IAAI,WAAW,IAAIb,IAAI,EAAE;MAC9B,OAAO,CAAC;QACNA,IAAI,EAAE,UAAU;QAChBD,KAAK;QACLgB,KAAK,EAAEf,IAAI,CAACgB,SAAS,CAAC,CAAC,CAAC;QACxBC,IAAI,EAAExB,eAAe,CAACO,IAAI,CAACgB,SAAS,CAAC,CAAC,CAAC;MACzC,CAAC,CAAC;IACJ,CAAC,MAAM,OAAO,EAAE;EAClB,CAAC,CAAC;AACJ;AAEA,SAASF,YAAYA,CACnBD,KAAoC,EAChB;EACpB,OAAO;IAAEK,UAAU,EAAEL,KAAK,CAAC,CAAC,CAAC;IAAEM,QAAQ,EAAEN,KAAK,CAAC,CAAC;EAAE,CAAC;AACrD","ignoreList":[]}
1
+ {"version":3,"file":"modernToLegacyGroupByClause.js","names":["DurationMapping","modernToLegacyGroupByClause","groupByClause","Object","entries","flatMap","field","type","maxGroupCount","$exactWithLimit","$exact","$limit","undefined","defaultValue","$defaultValue","includeNullValues","$includeNullValue","fixedWidth","$fixedWidth","ranges","$ranges","map","range","convertRange","value","$duration","unit","startValue","endValue"],"sources":["modernToLegacyGroupByClause.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 { AllGroupByValues, GroupByClause, GroupByRange } from \"@osdk/api\";\nimport { DurationMapping } from \"@osdk/api\";\nimport type {\n AggregationGroupByV2,\n AggregationRangeV2,\n} from \"@osdk/foundry.ontologies\";\n\n/** @internal */\nexport function modernToLegacyGroupByClause(\n groupByClause: GroupByClause<any> | undefined,\n) {\n if (!groupByClause) return [];\n\n return Object.entries(\n groupByClause as Record<string, AllGroupByValues>,\n ).flatMap<AggregationGroupByV2>(([field, type]) => {\n if (type === \"exact\") {\n return [{ type, field }];\n } else if (\"$exactWithLimit\" in type) {\n {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exactWithLimit,\n },\n ];\n }\n } else if (\"$exact\" in type) {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exact?.$limit ?? undefined,\n defaultValue: type.$exact.$defaultValue ?? undefined,\n includeNullValues: type.$exact.$includeNullValue === true\n ? true\n : undefined,\n },\n ];\n } else if (\"$fixedWidth\" in type) {\n return [{\n type: \"fixedWidth\",\n field,\n fixedWidth: type.$fixedWidth,\n }];\n } else if (\"$ranges\" in type) {\n return [{\n type: \"ranges\",\n field,\n ranges: type.$ranges.map(range => convertRange(range)),\n }];\n } else if (\"$duration\" in type) {\n return [{\n type: \"duration\",\n field,\n value: type.$duration[0],\n unit: DurationMapping[type.$duration[1]],\n }];\n } else return [];\n });\n}\n\nfunction convertRange(\n range: GroupByRange<number | string>,\n): AggregationRangeV2 {\n return { startValue: range[0], endValue: range[1] };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,WAAW;AAM3C;AACA,OAAO,SAASC,2B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;QAChBD,KAAK;QACLkB,KAAK,EAAEjB,IAAI,CAACkB,SAAS,CAAC,CAAC,CAAC;QACxBC,IAAI,EAAE1B,eAAe,CAACO,IAAI,CAACkB,SAAS,CAAC,CAAC,CAAC;MACzC,CAAC,CAAC;IACJ,CAAC,MAAM,OAAO,EAAE;EAClB,CAAC,CAAC;AACJ;AAEA,SAASF,YAAYA,CACnBD,KAAoC,EAChB;EACpB,OAAO;IAAEK,UAAU,EAAEL,KAAK,CAAC,CAAC,CAAC;IAAEM,QAAQ,EAAEN,KAAK,CAAC,CAAC;EAAE,CAAC;AACrD","ignoreList":[]}
@@ -405,6 +405,91 @@ describe("aggregate", () => {
405
405
  }
406
406
  });
407
407
  });
408
+ describe("$exact", () => {
409
+ it("correctly nulls bucket type when $includeNullValue is true", async () => {
410
+ const result = await client(Todo).aggregate({
411
+ $select: {
412
+ "id:avg": "unordered"
413
+ },
414
+ $groupBy: {
415
+ text: {
416
+ $exact: {
417
+ $includeNullValue: true
418
+ }
419
+ }
420
+ }
421
+ });
422
+ expectTypeOf(result[0].$group.text).toEqualTypeOf();
423
+ });
424
+ it("disallows null values with ordering", () => {
425
+ void client(Todo).aggregate({
426
+ $select: {
427
+ // @ts-expect-error
428
+ "id:avg": "asc"
429
+ },
430
+ $groupBy: {
431
+ text: {
432
+ $exact: {
433
+ $includeNullValue: true
434
+ }
435
+ }
436
+ }
437
+ });
438
+ });
439
+ it("disallows null values with default value", async () => {
440
+ void client(Todo).aggregate({
441
+ $select: {
442
+ "text:exactDistinct": "unordered",
443
+ "id:max": "unordered",
444
+ "$count": "unordered"
445
+ },
446
+ $groupBy: {
447
+ text: {
448
+ // Should work since $includeNullValue is false. Making this possible makes intellisense better and
449
+ // lets the user understand the difference between the two.
450
+ $exact: {
451
+ $defaultValue: "default",
452
+ $includeNullValue: false
453
+ }
454
+ }
455
+ }
456
+ });
457
+ void client(Todo).aggregate({
458
+ $select: {
459
+ "text:exactDistinct": "unordered",
460
+ "id:max": "unordered",
461
+ "$count": "unordered"
462
+ },
463
+ $groupBy: {
464
+ text: {
465
+ // @ts-expect-error
466
+ $exact: {
467
+ $defaultValue: "default",
468
+ $includeNullValue: true
469
+ }
470
+ }
471
+ }
472
+ });
473
+ });
474
+ it("allows null or default values with limit", async () => {
475
+ const result = await client(Todo).aggregate({
476
+ $select: {
477
+ "text:exactDistinct": "unordered",
478
+ "id:max": "unordered",
479
+ "$count": "unordered"
480
+ },
481
+ $groupBy: {
482
+ text: {
483
+ $exact: {
484
+ $limit: 10,
485
+ $includeNullValue: true
486
+ }
487
+ }
488
+ }
489
+ });
490
+ expectTypeOf(result[0].$group.text).toEqualTypeOf();
491
+ });
492
+ });
408
493
  it("works with where: todo", async () => {});
409
494
  });
410
495
  //# sourceMappingURL=aggregate.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate.test.js","names":["objectTypeWithAllPropertyTypes","Todo","expectType","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createMinimalClient","aggregate","metadata","expectsClientVersion","ontologyRid","ontologyApiName","userAgent","mockFetch","clientCtx","client","fn","mockResolvedValue","ok","status","json","Promise","resolve","aggregationResponse","undefined","accuracy","data","group","string","metrics","name","value","toEqualTypeOf","notGrouped","type","objectType","$select","toHaveBeenCalledWith","body","JSON","stringify","method","headers","anything","approximateDistinct","exactDistinct","id","max","avg","$count","grouped","$groupBy","$exactWithLimit","integer","$ranges","short","float","$fixedWidth","dateTime","$duration","date","boolean","double","$defaultValue","$limit","$group","wrongSelectKey","wrongKey","$exact","toBeCallableWith","direction","timestamp"],"sources":["aggregate.test.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 {\n AggregateOpts,\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,\n GroupByClause,\n ValidAggregationKeys,\n} from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\nimport {\n objectTypeWithAllPropertyTypes,\n Todo,\n} from \"@osdk/client.test.ontology\";\nimport type { AggregateObjectsResponseV2 } from \"@osdk/foundry.ontologies\";\nimport type { TypeOf } from \"ts-expect\";\nimport { expectType } from \"ts-expect\";\nimport {\n beforeAll,\n describe,\n expect,\n expectTypeOf,\n it,\n type Mock,\n vi,\n} from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { aggregate } from \"./aggregate.js\";\n\nconst metadata = {\n expectsClientVersion: \"0.0.0\",\n ontologyRid: \"ri.a.b.c.d\",\n ontologyApiName: \"apiName\",\n userAgent: \"\",\n};\n\nlet mockFetch: Mock;\nlet clientCtx: MinimalClient;\nlet client: Client;\n\nbeforeAll(() => {\n mockFetch = vi.fn();\n\n mockFetch.mockResolvedValue({\n ok: true,\n status: 200,\n json: () => new Promise((resolve) => resolve(aggregationResponse)),\n });\n\n clientCtx = createMinimalClient(\n metadata,\n \"https://host.com\",\n async () => \"myAccessToken\",\n {},\n mockFetch,\n );\n\n client = createClient(\n \"https://host.com\",\n metadata.ontologyRid,\n async () => \"\",\n undefined,\n mockFetch,\n );\n});\n\nconst aggregationResponse: AggregateObjectsResponseV2 = {\n accuracy: \"APPROXIMATE\",\n data: [\n {\n group: {\n string: \"hello\",\n },\n metrics: [\n {\n name: \"string.approximateDistinct\",\n value: 1,\n },\n {\n name: \"string.exactDistinct\",\n value: 1,\n },\n {\n name: \"id.max\",\n value: 1,\n },\n {\n name: \"id.avg\",\n value: 1,\n },\n ],\n },\n ],\n};\n\ndescribe(\"aggregate\", () => {\n it(\"works\", async () => {\n expectTypeOf<ValidAggregationKeys<Todo>>().toEqualTypeOf<\n | \"$count\"\n | \"id:min\"\n | \"id:max\"\n | \"id:sum\"\n | \"id:avg\"\n | \"id:approximateDistinct\"\n | \"id:exactDistinct\"\n | \"text:approximateDistinct\"\n | \"text:exactDistinct\"\n >;\n\n const notGrouped = await aggregate(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"string:approximateDistinct\": \"unordered\",\n \"string:exactDistinct\": \"unordered\",\n \"id:max\": \"unordered\",\n \"id:avg\": \"unordered\",\n \"$count\": \"unordered\",\n },\n },\n );\n\n expect(mockFetch).toHaveBeenCalledWith(\n \"https://host.com/api/v2/ontologies/ri.a.b.c.d/objectSets/aggregate\",\n {\n body: JSON.stringify({\n \"objectSet\": { \"type\": \"base\", \"objectType\": \"ToDo\" },\n \"groupBy\": [],\n \"aggregation\": [\n {\n \"type\": \"approximateDistinct\",\n \"name\": \"string.approximateDistinct\",\n \"field\": \"string\",\n },\n {\n \"type\": \"exactDistinct\",\n \"name\": \"string.exactDistinct\",\n \"field\": \"string\",\n },\n { \"type\": \"max\", \"name\": \"id.max\", \"field\": \"id\" },\n { \"type\": \"avg\", \"name\": \"id.avg\", \"field\": \"id\" },\n { \"type\": \"count\", \"name\": \"count\" },\n ],\n }),\n method: \"POST\",\n headers: expect.anything(),\n },\n );\n\n expectType<number>(notGrouped.string.approximateDistinct);\n expectType<number>(notGrouped.string.exactDistinct);\n expectType<number | undefined>(notGrouped.id.max);\n expectType<number | undefined>(notGrouped.id.avg);\n expectType<number>(notGrouped.$count);\n expectType<\n TypeOf<\n {\n other: any;\n },\n typeof notGrouped\n >\n >(false); // subSelect should hide unused keys\n\n const grouped = await client(objectTypeWithAllPropertyTypes).aggregate(\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\",\n \"id:exactDistinct\": \"unordered\",\n \"id:max\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n string: \"exact\",\n id: { $exactWithLimit: 10 },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n dateTime: { $duration: [10, \"seconds\"] },\n date: { $ranges: [[\"2024-01-02\", \"2024-01-09\"]] },\n boolean: \"exact\",\n double: { \"$exact\": { $defaultValue: \"default\", $limit: 300 } },\n },\n },\n );\n expectType<Array<any>>(grouped);\n expectType<string | undefined>(grouped[0].$group.string);\n expectType<number>(grouped[0].id.approximateDistinct);\n expectType<number>(grouped[0].id.exactDistinct);\n expectType<number>(grouped[0].$group.id);\n expectType<number>(grouped[0].$count);\n expectType<{ startValue: number; endValue: number }>(\n grouped[0].$group.integer,\n );\n expectType<{ startValue: number; endValue: number }>(\n grouped[0].$group.short,\n );\n expectType<number | undefined>(grouped[0].$group.float);\n expectType<string | undefined>(grouped[0].$group.dateTime);\n expectType<{ startValue: string; endValue: string }>(\n grouped[0].$group.date,\n );\n expectType<boolean | undefined>(grouped[0].$group.boolean);\n expectType<number | undefined>(grouped[0].$group.double);\n\n expectType<\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<\n objectTypeWithAllPropertyTypes,\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\";\n \"$count\": \"unordered\";\n };\n $groupBy: {\n string: \"exact\";\n id: { $exactWithLimit: 10 };\n integer: { $ranges: [[1, 2]] };\n short: {\n $ranges: [[2, 3], [4, 5]];\n };\n float: { $fixedWidth: 10 };\n };\n }\n >\n >({\n $select: {\n \"id:approximateDistinct\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n string: \"exact\",\n id: { $exactWithLimit: 10 },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n },\n });\n\n expectType<\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<\n objectTypeWithAllPropertyTypes,\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\";\n \"wrongSelectKey\": \"don't work\";\n \"$count\": \"unordered\";\n };\n $groupBy: {\n wrongKey: \"don't work\";\n text: \"exact\";\n id: { $exact: { $limit: 10; $defaultValue: \"default\" } };\n integer: { $ranges: [[1, 2]] };\n short: {\n $ranges: [[2, 3], [4, 5]];\n };\n float: { $fixedWidth: 10 };\n };\n }\n >\n >({\n $select: {\n id: \"approximateDistinct\",\n // @ts-expect-error\n wrongSelectKey: \"don't work\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n // @ts-expect-error\n wrongKey: \"don't work\",\n string: \"exact\",\n id: { $exact: { $limit: 10, $defaultValue: \"default\" } },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n },\n });\n\n expectTypeOf<\n typeof aggregate<objectTypeWithAllPropertyTypes, {\n $select: {\n \"id:approximateDistinct\": \"unordered\";\n \"wrongSelectKey\": \"wrong key\";\n \"$count\": \"unordered\";\n };\n $groupBy: {\n string: \"exact\";\n wrongKey: \"wrongKey\";\n id: { $exactWithLimit: 10 };\n integer: { $ranges: [[1, 2]] };\n short: {\n $ranges: [[2, 3], [4, 5]];\n };\n float: { $fixedWidth: 10 };\n };\n }>\n >().toBeCallableWith(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\",\n // @ts-expect-error\n \"wrongSelectKey\": \"don't work\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n string: \"exact\",\n // @ts-expect-error\n wrongKey: \"wrongKey\",\n id: { $exactWithLimit: 10 },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n },\n },\n );\n\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n dateTime: { $duration: [10, \"seconds\"] },\n date: { $duration: [1, \"years\"] },\n });\n\n // Can't use value greater than 1 for years\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n // @ts-expect-error\n date: { $duration: [10, \"years\"] },\n });\n\n // Can't use arbitrary string for time unit\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n // @ts-expect-error\n dateTime: { $duration: [1, \"nonexistentTimeUnit\"] },\n });\n\n // Can't use time unit smaller than days for date type\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n // @ts-expect-error\n date: { $duration: [1, \"seconds\"] },\n });\n });\n\n it(\"works with $orderBy (no groups)\", async () => {\n const notGrouped = await aggregate(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"string:approximateDistinct\": \"asc\",\n \"id:exactDistinct\": \"asc\",\n \"id:avg\": \"desc\",\n \"id:max\": \"asc\",\n \"$count\": \"unordered\",\n },\n },\n );\n\n expect(mockFetch).toHaveBeenCalledWith(\n \"https://host.com/api/v2/ontologies/ri.a.b.c.d/objectSets/aggregate\",\n {\n body: JSON.stringify({\n \"objectSet\": { \"type\": \"base\", \"objectType\": \"ToDo\" },\n \"groupBy\": [],\n \"aggregation\": [\n {\n \"type\": \"approximateDistinct\",\n \"name\": \"string.approximateDistinct\",\n direction: \"ASC\",\n \"field\": \"string\",\n },\n {\n \"type\": \"exactDistinct\",\n \"name\": \"id.exactDistinct\",\n direction: \"ASC\",\n \"field\": \"id\",\n },\n {\n \"type\": \"avg\",\n \"name\": \"id.avg\",\n direction: \"DESC\",\n \"field\": \"id\",\n },\n {\n \"type\": \"max\",\n \"name\": \"id.max\",\n direction: \"ASC\",\n \"field\": \"id\",\n },\n { \"type\": \"count\", \"name\": \"count\" },\n ],\n }),\n method: \"POST\",\n headers: expect.anything(),\n },\n );\n\n expectType<number>(notGrouped.string.approximateDistinct);\n expectType<number>(notGrouped.id.exactDistinct);\n expectType<number>(notGrouped.id.max);\n expectType<number>(notGrouped.id.avg);\n expectType<number>(notGrouped.$count);\n expectType<\n TypeOf<\n {\n other: any;\n },\n typeof notGrouped\n >\n >(false); // subselect should hide unused keys\n });\n\n it(\"works with $orderBy (1 group)\", async () => {\n const grouped = await aggregate(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"id:max\": \"desc\",\n \"string:approximateDistinct\": \"asc\",\n \"id:avg\": \"unordered\",\n \"$count\": \"unordered\",\n \"string:exactDistinct\": \"desc\",\n },\n $groupBy: {\n id: \"exact\",\n },\n },\n );\n\n expect(mockFetch).toHaveBeenCalledWith(\n \"https://host.com/api/v2/ontologies/ri.a.b.c.d/objectSets/aggregate\",\n {\n body: JSON.stringify({\n \"objectSet\": { \"type\": \"base\", \"objectType\": \"ToDo\" },\n \"groupBy\": [{ \"type\": \"exact\", \"field\": \"id\" }],\n \"aggregation\": [\n {\n \"type\": \"max\",\n \"name\": \"id.max\",\n direction: \"DESC\",\n \"field\": \"id\",\n },\n {\n \"type\": \"approximateDistinct\",\n \"name\": \"string.approximateDistinct\",\n direction: \"ASC\",\n \"field\": \"string\",\n },\n { \"type\": \"avg\", \"name\": \"id.avg\", \"field\": \"id\" },\n { \"type\": \"count\", \"name\": \"count\" },\n {\n \"type\": \"exactDistinct\",\n \"name\": \"string.exactDistinct\",\n direction: \"DESC\",\n \"field\": \"string\",\n },\n ],\n }),\n method: \"POST\",\n headers: expect.anything(),\n },\n );\n\n expectType<number>(grouped[0].string.approximateDistinct);\n expectType<number>(grouped[0].id.max);\n expectType<number>(grouped[0].id.avg);\n expectType<number>(grouped[0].$count);\n expectType<number>(grouped[0].string.exactDistinct);\n expectType<\n TypeOf<\n {\n other: any;\n },\n typeof grouped\n >\n >(false); // subselect should hide unused keys\n });\n\n it(\"prohibits ordered select with multiple groupBy\", async () => {\n await client(Todo).aggregate(\n {\n $select: {\n // @ts-expect-error\n \"id:max\": \"desc\",\n // @ts-expect-error\n \"text:approximateDistinct\": \"asc\",\n // @ts-expect-error\n \"text:exactDistinct\": \"desc\",\n \"id:avg\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n id: \"exact\",\n timestamp: \"exact\",\n },\n },\n );\n });\n\n it(\"works with where: todo\", async () => {\n const f: AggregateOpts<\n Employee\n > = {\n $select: {\n \"office:approximateDistinct\": \"unordered\",\n },\n };\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SACEA,8BAA8B,EAC9BC,IAAI,QACC,4BAA4B;AAGnC,SAASC,UAAU,QAAQ,WAAW;AACtC,SACEC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,YAAY,EACZC,EAAE,EAEFC,EAAE,QACG,QAAQ;AAEf,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,2BAA2B;AAE/D,SAASC,SAAS,QAAQ,gBAAgB;AAE1C,MAAMC,QAAQ,GAAG;EACfC,oBAAoB,EAAE,OAAO;EAC7BC,WAAW,EAAE,YAAY;EACzBC,eAAe,EAAE,SAAS;EAC1BC,SAAS,EAAE;AACb,CAAC;AAED,IAAIC,SAAe;AACnB,IAAIC,SAAwB;AAC5B,IAAIC,MAAc;AAElBhB,SAAS,CAAC,MAAM;EACdc,SAAS,GAAGT,EAAE,CAACY,EAAE,CAAC,CAAC;EAEnBH,SAAS,CAACI,iBAAiB,CAAC;IAC1BC,EAAE,EAAE,IAAI;IACRC,MAAM,EAAE,GAAG;IACXC,IAAI,EAAEA,CAAA,KAAM,IAAIC,OAAO,CAAEC,OAAO,IAAKA,OAAO,CAACC,mBAAmB,CAAC;EACnE,CAAC,CAAC;EAEFT,SAAS,GAAGR,mBAAmB,CAC7BE,QAAQ,EACR,kBAAkB,EAClB,YAAY,eAAe,EAC3B,CAAC,CAAC,EACFK,SACF,CAAC;EAEDE,MAAM,GAAGV,YAAY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EAAE;QAAQ,CAAC,EACpC;UACE,MAAM,EAAE,eAAe;UACvB,MAAM,EAAE,sBAAsB;UAC9BA,SAAS,EAAE,MAAM;UACjB,OAAO,EAAE;QACX,CAAC;MAEL,CAAC,CAAC;MACF7B,MAAM,EAAE,MAAM;MACdC,OAAO,EAAEzC,MAAM,CAAC0C,QAAQ,CAAC;IAC3B,CACF,CAAC;IAED7C,UAAU,CAASoD,OAAO,CAAC,CAAC,CAAC,CAACtB,MAAM,CAACgB,mBAAmB,CAAC;IACzD9C,UAAU,CAASoD,OAAO,CAAC,CAAC,CAAC,CAACJ,EAAE,CAACC,GAAG,CAAC;IACrCjD,UAAU,CAASoD,OAAO,CAAC,CAAC,CAAC,CAACJ,EAAE,CAACE,GAAG,CAAC;IACrClD,UAAU,CAASoD,OAAO,CAAC,CAAC,CAAC,CAACD,MAAM,CAAC;IACrCnD,UAAU,CAASoD,OAAO,CAAC,CAAC,CAAC,CAACtB,MAAM,CAACiB,aAAa,CAAC;IACnD/C,UAAU,CAOR,KAAK,CAAC,CAAC,CAAC;EACZ,CAAC,CAAC;EAEFK,EAAE,CAAC,gDAAgD,EAAE,YAAY;IAC/D,MAAMY,MAAM,CAAClB,IAAI,CAAC,CAACU,SAAS,CAC1B;MACE6B,OAAO,EAAE;QACP;QACA,QAAQ,EAAE,MAAM;QAChB;QACA,0BAA0B,EAAE,KAAK;QACjC;QACA,oBAAoB,EAAE,MAAM;QAC5B,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE;MACZ,CAAC;MACDe,QAAQ,EAAE;QACRL,EAAE,EAAE,OAAO;QACXyB,SAAS,EAAE;MACb;IACF,CACF,CAAC;EACH,CAAC,CAAC;EAEFpE,EAAE,CAAC,wBAAwB,EAAE,YAAY,CAQzC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"aggregate.test.js","names":["objectTypeWithAllPropertyTypes","Todo","expectType","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createMinimalClient","aggregate","metadata","expectsClientVersion","ontologyRid","ontologyApiName","userAgent","mockFetch","clientCtx","client","fn","mockResolvedValue","ok","status","json","Promise","resolve","aggregationResponse","undefined","accuracy","data","group","string","metrics","name","value","toEqualTypeOf","notGrouped","type","objectType","$select","toHaveBeenCalledWith","body","JSON","stringify","method","headers","anything","approximateDistinct","exactDistinct","id","max","avg","$count","grouped","$groupBy","$exactWithLimit","integer","$ranges","short","float","$fixedWidth","dateTime","$duration","date","boolean","double","$defaultValue","$limit","$group","wrongSelectKey","wrongKey","$exact","toBeCallableWith","direction","timestamp","result","text","$includeNullValue"],"sources":["aggregate.test.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 {\n AggregateOpts,\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,\n GroupByClause,\n ValidAggregationKeys,\n} from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\nimport {\n objectTypeWithAllPropertyTypes,\n Todo,\n} from \"@osdk/client.test.ontology\";\nimport type { AggregateObjectsResponseV2 } from \"@osdk/foundry.ontologies\";\nimport type { TypeOf } from \"ts-expect\";\nimport { expectType } from \"ts-expect\";\nimport {\n beforeAll,\n describe,\n expect,\n expectTypeOf,\n it,\n type Mock,\n vi,\n} from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { aggregate } from \"./aggregate.js\";\n\nconst metadata = {\n expectsClientVersion: \"0.0.0\",\n ontologyRid: \"ri.a.b.c.d\",\n ontologyApiName: \"apiName\",\n userAgent: \"\",\n};\n\nlet mockFetch: Mock;\nlet clientCtx: MinimalClient;\nlet client: Client;\n\nbeforeAll(() => {\n mockFetch = vi.fn();\n\n mockFetch.mockResolvedValue({\n ok: true,\n status: 200,\n json: () => new Promise((resolve) => resolve(aggregationResponse)),\n });\n\n clientCtx = createMinimalClient(\n metadata,\n \"https://host.com\",\n async () => \"myAccessToken\",\n {},\n mockFetch,\n );\n\n client = createClient(\n \"https://host.com\",\n metadata.ontologyRid,\n async () => \"\",\n undefined,\n mockFetch,\n );\n});\n\nconst aggregationResponse: AggregateObjectsResponseV2 = {\n accuracy: \"APPROXIMATE\",\n data: [\n {\n group: {\n string: \"hello\",\n },\n metrics: [\n {\n name: \"string.approximateDistinct\",\n value: 1,\n },\n {\n name: \"string.exactDistinct\",\n value: 1,\n },\n {\n name: \"id.max\",\n value: 1,\n },\n {\n name: \"id.avg\",\n value: 1,\n },\n ],\n },\n ],\n};\n\ndescribe(\"aggregate\", () => {\n it(\"works\", async () => {\n expectTypeOf<ValidAggregationKeys<Todo>>().toEqualTypeOf<\n | \"$count\"\n | \"id:min\"\n | \"id:max\"\n | \"id:sum\"\n | \"id:avg\"\n | \"id:approximateDistinct\"\n | \"id:exactDistinct\"\n | \"text:approximateDistinct\"\n | \"text:exactDistinct\"\n >;\n\n const notGrouped = await aggregate(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"string:approximateDistinct\": \"unordered\",\n \"string:exactDistinct\": \"unordered\",\n \"id:max\": \"unordered\",\n \"id:avg\": \"unordered\",\n \"$count\": \"unordered\",\n },\n },\n );\n\n expect(mockFetch).toHaveBeenCalledWith(\n \"https://host.com/api/v2/ontologies/ri.a.b.c.d/objectSets/aggregate\",\n {\n body: JSON.stringify({\n \"objectSet\": { \"type\": \"base\", \"objectType\": \"ToDo\" },\n \"groupBy\": [],\n \"aggregation\": [\n {\n \"type\": \"approximateDistinct\",\n \"name\": \"string.approximateDistinct\",\n \"field\": \"string\",\n },\n {\n \"type\": \"exactDistinct\",\n \"name\": \"string.exactDistinct\",\n \"field\": \"string\",\n },\n { \"type\": \"max\", \"name\": \"id.max\", \"field\": \"id\" },\n { \"type\": \"avg\", \"name\": \"id.avg\", \"field\": \"id\" },\n { \"type\": \"count\", \"name\": \"count\" },\n ],\n }),\n method: \"POST\",\n headers: expect.anything(),\n },\n );\n\n expectType<number>(notGrouped.string.approximateDistinct);\n expectType<number>(notGrouped.string.exactDistinct);\n expectType<number | undefined>(notGrouped.id.max);\n expectType<number | undefined>(notGrouped.id.avg);\n expectType<number>(notGrouped.$count);\n expectType<\n TypeOf<\n {\n other: any;\n },\n typeof notGrouped\n >\n >(false); // subSelect should hide unused keys\n\n const grouped = await client(objectTypeWithAllPropertyTypes).aggregate(\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\",\n \"id:exactDistinct\": \"unordered\",\n \"id:max\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n string: \"exact\",\n id: { $exactWithLimit: 10 },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n dateTime: { $duration: [10, \"seconds\"] },\n date: { $ranges: [[\"2024-01-02\", \"2024-01-09\"]] },\n boolean: \"exact\",\n double: { \"$exact\": { $defaultValue: \"default\", $limit: 300 } },\n },\n },\n );\n expectType<Array<any>>(grouped);\n expectType<string | undefined>(grouped[0].$group.string);\n expectType<number>(grouped[0].id.approximateDistinct);\n expectType<number>(grouped[0].id.exactDistinct);\n expectType<number>(grouped[0].$group.id);\n expectType<number>(grouped[0].$count);\n expectType<{ startValue: number; endValue: number }>(\n grouped[0].$group.integer,\n );\n expectType<{ startValue: number; endValue: number }>(\n grouped[0].$group.short,\n );\n expectType<number | undefined>(grouped[0].$group.float);\n expectType<string | undefined>(grouped[0].$group.dateTime);\n expectType<{ startValue: string; endValue: string }>(\n grouped[0].$group.date,\n );\n expectType<boolean | undefined>(grouped[0].$group.boolean);\n expectType<number | undefined>(grouped[0].$group.double);\n\n expectType<\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<\n objectTypeWithAllPropertyTypes,\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\";\n \"$count\": \"unordered\";\n };\n $groupBy: {\n string: \"exact\";\n id: { $exactWithLimit: 10 };\n integer: { $ranges: [[1, 2]] };\n short: {\n $ranges: [[2, 3], [4, 5]];\n };\n float: { $fixedWidth: 10 };\n };\n }\n >\n >({\n $select: {\n \"id:approximateDistinct\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n string: \"exact\",\n id: { $exactWithLimit: 10 },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n },\n });\n\n expectType<\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<\n objectTypeWithAllPropertyTypes,\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\";\n \"wrongSelectKey\": \"don't work\";\n \"$count\": \"unordered\";\n };\n $groupBy: {\n wrongKey: \"don't work\";\n text: \"exact\";\n id: { $exact: { $limit: 10; $defaultValue: \"default\" } };\n integer: { $ranges: [[1, 2]] };\n short: {\n $ranges: [[2, 3], [4, 5]];\n };\n float: { $fixedWidth: 10 };\n };\n }\n >\n >({\n $select: {\n id: \"approximateDistinct\",\n // @ts-expect-error\n wrongSelectKey: \"don't work\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n // @ts-expect-error\n wrongKey: \"don't work\",\n string: \"exact\",\n id: { $exact: { $limit: 10, $defaultValue: \"default\" } },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n },\n });\n\n expectTypeOf<\n typeof aggregate<objectTypeWithAllPropertyTypes, {\n $select: {\n \"id:approximateDistinct\": \"unordered\";\n \"wrongSelectKey\": \"wrong key\";\n \"$count\": \"unordered\";\n };\n $groupBy: {\n string: \"exact\";\n wrongKey: \"wrongKey\";\n id: { $exactWithLimit: 10 };\n integer: { $ranges: [[1, 2]] };\n short: {\n $ranges: [[2, 3], [4, 5]];\n };\n float: { $fixedWidth: 10 };\n };\n }>\n >().toBeCallableWith(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"id:approximateDistinct\": \"unordered\",\n // @ts-expect-error\n \"wrongSelectKey\": \"don't work\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n string: \"exact\",\n // @ts-expect-error\n wrongKey: \"wrongKey\",\n id: { $exactWithLimit: 10 },\n integer: { $ranges: [[1, 2]] },\n short: {\n $ranges: [[2, 3], [4, 5]],\n },\n float: { $fixedWidth: 10 },\n },\n },\n );\n\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n dateTime: { $duration: [10, \"seconds\"] },\n date: { $duration: [1, \"years\"] },\n });\n\n // Can't use value greater than 1 for years\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n // @ts-expect-error\n date: { $duration: [10, \"years\"] },\n });\n\n // Can't use arbitrary string for time unit\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n // @ts-expect-error\n dateTime: { $duration: [1, \"nonexistentTimeUnit\"] },\n });\n\n // Can't use time unit smaller than days for date type\n expectType<GroupByClause<objectTypeWithAllPropertyTypes>>({\n // @ts-expect-error\n date: { $duration: [1, \"seconds\"] },\n });\n });\n\n it(\"works with $orderBy (no groups)\", async () => {\n const notGrouped = await aggregate(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"string:approximateDistinct\": \"asc\",\n \"id:exactDistinct\": \"asc\",\n \"id:avg\": \"desc\",\n \"id:max\": \"asc\",\n \"$count\": \"unordered\",\n },\n },\n );\n\n expect(mockFetch).toHaveBeenCalledWith(\n \"https://host.com/api/v2/ontologies/ri.a.b.c.d/objectSets/aggregate\",\n {\n body: JSON.stringify({\n \"objectSet\": { \"type\": \"base\", \"objectType\": \"ToDo\" },\n \"groupBy\": [],\n \"aggregation\": [\n {\n \"type\": \"approximateDistinct\",\n \"name\": \"string.approximateDistinct\",\n direction: \"ASC\",\n \"field\": \"string\",\n },\n {\n \"type\": \"exactDistinct\",\n \"name\": \"id.exactDistinct\",\n direction: \"ASC\",\n \"field\": \"id\",\n },\n {\n \"type\": \"avg\",\n \"name\": \"id.avg\",\n direction: \"DESC\",\n \"field\": \"id\",\n },\n {\n \"type\": \"max\",\n \"name\": \"id.max\",\n direction: \"ASC\",\n \"field\": \"id\",\n },\n { \"type\": \"count\", \"name\": \"count\" },\n ],\n }),\n method: \"POST\",\n headers: expect.anything(),\n },\n );\n\n expectType<number>(notGrouped.string.approximateDistinct);\n expectType<number>(notGrouped.id.exactDistinct);\n expectType<number>(notGrouped.id.max);\n expectType<number>(notGrouped.id.avg);\n expectType<number>(notGrouped.$count);\n expectType<\n TypeOf<\n {\n other: any;\n },\n typeof notGrouped\n >\n >(false); // subselect should hide unused keys\n });\n\n it(\"works with $orderBy (1 group)\", async () => {\n const grouped = await aggregate(\n clientCtx,\n objectTypeWithAllPropertyTypes,\n {\n type: \"base\",\n objectType: \"ToDo\",\n },\n {\n $select: {\n \"id:max\": \"desc\",\n \"string:approximateDistinct\": \"asc\",\n \"id:avg\": \"unordered\",\n \"$count\": \"unordered\",\n \"string:exactDistinct\": \"desc\",\n },\n $groupBy: {\n id: \"exact\",\n },\n },\n );\n\n expect(mockFetch).toHaveBeenCalledWith(\n \"https://host.com/api/v2/ontologies/ri.a.b.c.d/objectSets/aggregate\",\n {\n body: JSON.stringify({\n \"objectSet\": { \"type\": \"base\", \"objectType\": \"ToDo\" },\n \"groupBy\": [{ \"type\": \"exact\", \"field\": \"id\" }],\n \"aggregation\": [\n {\n \"type\": \"max\",\n \"name\": \"id.max\",\n direction: \"DESC\",\n \"field\": \"id\",\n },\n {\n \"type\": \"approximateDistinct\",\n \"name\": \"string.approximateDistinct\",\n direction: \"ASC\",\n \"field\": \"string\",\n },\n { \"type\": \"avg\", \"name\": \"id.avg\", \"field\": \"id\" },\n { \"type\": \"count\", \"name\": \"count\" },\n {\n \"type\": \"exactDistinct\",\n \"name\": \"string.exactDistinct\",\n direction: \"DESC\",\n \"field\": \"string\",\n },\n ],\n }),\n method: \"POST\",\n headers: expect.anything(),\n },\n );\n\n expectType<number>(grouped[0].string.approximateDistinct);\n expectType<number>(grouped[0].id.max);\n expectType<number>(grouped[0].id.avg);\n expectType<number>(grouped[0].$count);\n expectType<number>(grouped[0].string.exactDistinct);\n expectType<\n TypeOf<\n {\n other: any;\n },\n typeof grouped\n >\n >(false); // subselect should hide unused keys\n });\n\n it(\"prohibits ordered select with multiple groupBy\", async () => {\n await client(Todo).aggregate(\n {\n $select: {\n // @ts-expect-error\n \"id:max\": \"desc\",\n // @ts-expect-error\n \"text:approximateDistinct\": \"asc\",\n // @ts-expect-error\n \"text:exactDistinct\": \"desc\",\n \"id:avg\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n id: \"exact\",\n timestamp: \"exact\",\n },\n },\n );\n });\n\n describe(\"$exact\", () => {\n it(\"correctly nulls bucket type when $includeNullValue is true\", async () => {\n const result = await client(Todo).aggregate({\n $select: {\n \"id:avg\": \"unordered\",\n },\n $groupBy: {\n text: { $exact: { $includeNullValue: true } },\n },\n });\n\n expectTypeOf(result[0].$group.text).toEqualTypeOf<\n string | null | undefined\n >();\n });\n\n it(\"disallows null values with ordering\", () => {\n void client(Todo).aggregate({\n $select: {\n // @ts-expect-error\n \"id:avg\": \"asc\",\n },\n $groupBy: {\n text: { $exact: { $includeNullValue: true } },\n },\n });\n });\n\n it(\"disallows null values with default value\", async () => {\n void client(Todo).aggregate({\n $select: {\n \"text:exactDistinct\": \"unordered\",\n \"id:max\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n text: {\n // Should work since $includeNullValue is false. Making this possible makes intellisense better and\n // lets the user understand the difference between the two.\n $exact: { $defaultValue: \"default\", $includeNullValue: false },\n },\n },\n });\n\n void client(Todo).aggregate({\n $select: {\n \"text:exactDistinct\": \"unordered\",\n \"id:max\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n text: {\n // @ts-expect-error\n $exact: { $defaultValue: \"default\", $includeNullValue: true },\n },\n },\n });\n });\n\n it(\"allows null or default values with limit\", async () => {\n const result = await client(Todo).aggregate({\n $select: {\n \"text:exactDistinct\": \"unordered\",\n \"id:max\": \"unordered\",\n \"$count\": \"unordered\",\n },\n $groupBy: {\n text: { $exact: { $limit: 10, $includeNullValue: true } },\n },\n });\n\n expectTypeOf(result[0].$group.text).toEqualTypeOf<\n string | null | undefined\n >();\n });\n });\n\n it(\"works with where: todo\", async () => {\n const f: AggregateOpts<\n Employee\n > = {\n $select: {\n \"office:approximateDistinct\": \"unordered\",\n },\n };\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SACEA,8BAA8B,EAC9BC,IAAI,QACC,4BAA4B;AAGnC,SAASC,UAAU,QAAQ,WAAW;AACtC,SACEC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,YAAY,EACZC,EAAE,EAEFC,EAAE,QACG,QAAQ;AAEf,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,2BAA2B;AAE/D,SAASC,SAAS,QAAQ,gBAAgB;AAE1C,MAAMC,QAAQ,GAAG;EACfC,oBAAoB,EAAE,OAAO;EAC7BC,WAAW,EAAE,YAAY;EACzBC,eAAe,EAAE,SAAS;EAC1BC,SAAS,EAAE;AACb,CAAC;AAED,IAAIC,SAAe;AACnB,IAAIC,SAAwB;AAC5B,IAAIC,MAAc;AAElBhB,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E,SAAS;cAAEW,iBAAiB,EAAE;YAAM;UAC/D;QACF;MACF,CAAC,CAAC;MAEF,KAAK3D,MAAM,CAAClB,IAAI,CAAC,CAACU,SAAS,CAAC;QAC1B6B,OAAO,EAAE;UACP,oBAAoB,EAAE,WAAW;UACjC,QAAQ,EAAE,WAAW;UACrB,QAAQ,EAAE;QACZ,CAAC;QACDe,QAAQ,EAAE;UACRsB,IAAI,EAAE;YACJ;YACAL,MAAM,EAAE;cAAEL,aAAa,EAAE,SAAS;cAAEW,iBAAiB,EAAE;YAAK;UAC9D;QACF;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFvE,EAAE,CAAC,0CAA0C,EAAE,YAAY;MACzD,MAAMqE,MAAM,GAAG,MAAMzD,MAAM,CAAClB,IAAI,CAAC,CAACU,SAAS,CAAC;QAC1C6B,OAAO,EAAE;UACP,oBAAoB,EAAE,WAAW;UACjC,QAAQ,EAAE,WAAW;UACrB,QAAQ,EAAE;QACZ,CAAC;QACDe,QAAQ,EAAE;UACRsB,IAAI,EAAE;YAAEL,MAAM,EAAE;cAAEJ,MAAM,EAAE,EAAE;cAAEU,iBAAiB,EAAE;YAAK;UAAE;QAC1D;MACF,CAAC,CAAC;MAEFxE,YAAY,CAACsE,MAAM,CAAC,CAAC,CAAC,CAACP,MAAM,CAACQ,IAAI,CAAC,CAACzC,aAAa,CAE/C,CAAC;IACL,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF7B,EAAE,CAAC,wBAAwB,EAAE,YAAY,CAQzC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ObjectOrInterfaceDefinition, ObjectSpecifier } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number;\n readonly $title: string | undefined;\n readonly $objectSpecifier: ObjectSpecifier<any>;\n\n readonly \"$as\": (\n newDef: string | ObjectOrInterfaceDefinition,\n ) => ObjectHolder | InterfaceHolder;\n\n readonly \"$clone\": (\n newProps?: Record<string, any>,\n ) => this;\n\n // [key: `$$${string}`]: any;\n // Unlike SimpleOsdkProperties, all of our remaining types are unknown as the full\n // union is basically `any` when you consider the above fields.\n [key: string]: unknown;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 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 ObjectMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSpecifier,\n} from \"@osdk/api\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number;\n readonly $title: string | undefined;\n readonly $objectSpecifier: ObjectSpecifier<any>;\n\n readonly \"$as\": (\n newDef: string | ObjectOrInterfaceDefinition,\n ) => ObjectHolder | InterfaceHolder;\n\n readonly \"$clone\": (\n newProps?: Record<string, any>,\n ) => this;\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n readonly ObjectMetadata: ObjectMetadata;\n };\n\n // [key: `$$${string}`]: any;\n // Unlike SimpleOsdkProperties, all of our remaining types are unknown as the full\n // union is basically `any` when you consider the above fields.\n [key: string]: unknown;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.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, Osdk } from \"@osdk/api\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { InterfaceDefRef } from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n _Q extends Osdk.Instance<any> = never,\n> extends BaseHolder {\n [InterfaceDefRef]: InterfaceMetadata;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.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, ObjectMetadata, Osdk } from \"@osdk/api\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { InterfaceDefRef } from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n _Q extends Osdk.Instance<any> = never,\n> extends BaseHolder {\n [InterfaceDefRef]: InterfaceMetadata;\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n readonly ObjectMetadata: ObjectMetadata;\n readonly InterfaceMetadata: InterfaceMetadata;\n };\n}\n"],"mappings":"","ignoreList":[]}
@@ -56,6 +56,13 @@ export function createOsdkInterface(underlying, interfaceDef) {
56
56
  value: clone,
57
57
  enumerable: false
58
58
  },
59
+ "$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata": {
60
+ value: {
61
+ "ObjectMetadata": underlying[ObjectDefRef],
62
+ "InterfaceMetadata": interfaceDef
63
+ },
64
+ enumerable: false
65
+ },
59
66
  [InterfaceDefRef]: {
60
67
  value: interfaceDef
61
68
  },
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$objectSpecifier","$title","$rid","clone","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap","update","$clone","key","Error","remappedProps","mapProperty","filter","x","propertyName"],"sources":["createOsdkInterface.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 { extractNamespace } from \"../../internal/conversions/modernToLegacyWhereClause.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: ObjectHolder,\n interfaceDef: InterfaceMetadata,\n): InterfaceHolder {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$objectSpecifier\": {\n value: underlying.$objectSpecifier,\n enumerable: \"$objectSpecifier\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n \"$clone\": {\n value: clone,\n enumerable: false,\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder,\n );\n function clone(update: Record<string, any> | undefined) {\n if (update == null) {\n return underlying.$clone().$as(interfaceDef);\n }\n\n for (const key of Object.keys(update)) {\n if (!(key in interfaceDef.properties)) {\n throw new Error(\n `Invalid property ${key} for interface ${interfaceDef.apiName}`,\n );\n }\n }\n\n const remappedProps = Object.fromEntries(\n Object.keys(update).map(p => mapProperty(p, update[p])).filter(x =>\n x != null\n ),\n );\n\n return underlying.$clone(remappedProps).$as(interfaceDef);\n }\n function mapProperty(propertyName: string, value: any) {\n const objDef = underlying[ObjectDefRef];\n const targetPropName =\n objDef.interfaceMap![interfaceDef.apiName][propertyName];\n // If the underlying object does not implement the SPT, throw errors\n if (targetPropName == null) {\n throw new Error(\n `Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`,\n );\n }\n return [targetPropName, value];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,yDAAyD;AAG1F,SACEC,eAAe,EACfC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,mBAAmBA,CAGjCC,UAAwB,EACxBC,YAA+B,EACd;EACjB,MAAM,CAACC,eAAe,CAAC,GAAGP,gBAAgB,CAACM,YAAY,CAACE,OAAO,CAAC;EAEhE,OAAOC,MAAM,CAACC,MAAM,CAClBD,MAAM,CAACE,gBAAgB,CAAC,CAAC,CAAC,EAAE;IAC1B;IACA,CAACR,oBAAoB,GAAG;MAAES,KAA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AAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACoB,cAAc,EAAEhB,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$objectSpecifier","$title","$rid","clone","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap","update","$clone","key","Error","remappedProps","mapProperty","filter","x","propertyName"],"sources":["createOsdkInterface.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 { extractNamespace } from \"../../internal/conversions/modernToLegacyWhereClause.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: ObjectHolder,\n interfaceDef: InterfaceMetadata,\n): InterfaceHolder {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$objectSpecifier\": {\n value: underlying.$objectSpecifier,\n enumerable: \"$objectSpecifier\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n \"$clone\": {\n value: clone,\n enumerable: false,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n value: {\n \"ObjectMetadata\": underlying[ObjectDefRef],\n \"InterfaceMetadata\": interfaceDef,\n },\n enumerable: false,\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder,\n );\n function clone(update: Record<string, any> | undefined) {\n if (update == null) {\n return underlying.$clone().$as(interfaceDef);\n }\n\n for (const key of Object.keys(update)) {\n if (!(key in interfaceDef.properties)) {\n throw new Error(\n `Invalid property ${key} for interface ${interfaceDef.apiName}`,\n );\n }\n }\n\n const remappedProps = Object.fromEntries(\n Object.keys(update).map(p => mapProperty(p, update[p])).filter(x =>\n x != null\n ),\n );\n\n return underlying.$clone(remappedProps).$as(interfaceDef);\n }\n function mapProperty(propertyName: string, value: any) {\n const objDef = underlying[ObjectDefRef];\n const targetPropName =\n objDef.interfaceMap![interfaceDef.apiName][propertyName];\n // If the underlying object does not implement the SPT, throw errors\n if (targetPropName == null) {\n throw new Error(\n `Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`,\n );\n }\n return [targetPropName, value];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,yDAAyD;AAG1F,SACEC,eAAe,EACfC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,mBAAmBA,CAGjCC,UAAwB,EACxBC,YAA+B,EACd;EACjB,MAAM,CAACC,eAAe,CAAC,GAAGP,gBAAgB,CAACM,YAAY,CAACE,OAAO,CAAC;EAEhE,OAAOC,MAAM,CAACC,MAAM,CAClBD,MAAM,CAACE,gBAAgB,CAAC,CAAC,CAAC,EAAE;IAC1B;IACA,CAACR,oBAAoB,GAAG;MAAES,KAAK,EAAEP;IAAW,CAAC;IAE7C,UAAU,EAAE;MAAEO,KAAK,EAAEN,YAAY,CAACE,OAAO;MAAEK,UAAU,EAAE;IAAK,CAAC;IAC7D,KAAK,EAAE;MACLD,KAAK,EAAEP,UAAU,CAACS,GAAG;MACrBD,UAAU,EAAE;IACd,CAAC;IACD,aAAa,EAAE;MACbD,KAAK,EAAEP,UAAU,CAACU,WAAW;MAC7BF,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,aAAa,EAAE;MACbO,KAAK,EAAEP,UAAU,CAACW,WAAW;MAC7BH,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,kBAAkB,EAAE;MAClBO,KAAK,EAAEP,UAAU,CAACY,gBAAgB;MAClCJ,UAAU,EAAE,kBAAkB,IAAIR;IACpC,CAAC;IACD,QAAQ,EAAE;MACRO,KAAK,EAAEP,UAAU,CAACa,MAAM;MACxBL,UAAU,EAAE,QAAQ,IAAIR;IAC1B,CAAC;IACD,MAAM,EAAE;MACNO,KAAK,EAAGP,UAAU,CAASc,IAAI;MAC/BN,UAAU,EAAE,MAAM,IAA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,OAAO,EAC/D,CAAC;MACH;IACF;IAEA,MAAM0B,aAAa,GAAGzB,MAAM,CAACY,WAAW,CACtCZ,MAAM,CAACa,IAAI,CAACQ,MAAM,CAAC,CAACN,GAAG,CAACC,CAAC,IAAIU,WAAW,CAACV,CAAC,EAAEK,MAAM,CAACL,CAAC,CAAC,CAAC,CAAC,CAACW,MAAM,CAACC,CAAC,IAC9DA,CAAC,IAAI,IACP,CACF,CAAC;IAED,OAAOhC,UAAU,CAAC0B,MAAM,CAACG,aAAa,CAAC,CAACpB,GAAG,CAACR,YAAY,CAAC;EAC3D;EACA,SAAS6B,WAAWA,CAACG,YAAoB,EAAE1B,KAAU,EAAE;IACrD,MAAMc,MAAM,GAAGrB,UAAU,CAACH,YAAY,CAAC;IACvC,MAAM0B,cAAc,GAClBF,MAAM,CAACG,YAAY,CAAEvB,YAAY,CAACE,OAAO,CAAC,CAAC8B,YAAY,CAAC;IAC1D;IACA,IAAIV,cAAc,IAAI,IAAI,EAAE;MAC1B,MAAM,IAAIK,KAAK,CACb,+BAA+BK,YAAY,iEAAiEZ,MAAM,CAAClB,OAAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACoB,cAAc,EAAEhB,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
@@ -67,6 +67,14 @@ const basePropDefs = {
67
67
  return createObjectSpecifierFromPrimaryKey(this[ObjectDefRef], rawObj.$primaryKey);
68
68
  },
69
69
  enumerable: true
70
+ },
71
+ "$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata": {
72
+ get: function () {
73
+ return {
74
+ ObjectMetadata: this[ObjectDefRef]
75
+ };
76
+ },
77
+ enumerable: false
70
78
  }
71
79
  };
72
80
 
@@ -88,6 +96,7 @@ export function createOsdkObject(client, objectDef, simpleOsdkProperties, derive
88
96
  value: objectDef,
89
97
  enumerable: false
90
98
  },
99
+ // TODO: Potentially update when GA metadata field
91
100
  [ClientRef]: {
92
101
  value: client,
93
102
  enumerable: false
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","createObjectSpecifierFromPrimaryKey","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","$primaryKey","enumerable","client","objectDef","simpleOsdkProperties","derivedPropertyTypeByName","Object","defineProperties","propKey","keys","properties","type","has","createSpecialProperty","modifyRdpProperties","freeze","rawValue","definition","operation","num","Number","isSafeInteger","process","env","NODE_ENV","selectedOrCollectedPropertyType","Array","isArray","map","a","rid","rawObject","p","propDef","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName","mediaReference"],"sources":["createOsdkObject.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 { MediaReference } from \"@osdk/foundry.core\";\nimport type { Attachment, ReferenceValue } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { createObjectSpecifierFromPrimaryKey } from \"../../util/objectSpecifierUtils.js\";\nimport type { SimpleOsdkProperties } from \"../SimpleOsdkProperties.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\n\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function(this: ObjectHolder) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: ObjectHolder) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: ObjectHolder,\n update: Record<string, any> | undefined,\n ) {\n // I think `rawObj` is the same thing as `this` and can be removed?\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n \"$objectSpecifier\": {\n get: function(this: ObjectHolder) {\n const rawObj = this[UnderlyingOsdkObject];\n return createObjectSpecifierFromPrimaryKey(\n this[ObjectDefRef],\n rawObj.$primaryKey,\n );\n },\n enumerable: true,\n },\n};\n\n/**\n * @internal\n * @param client\n * @param objectDef\n * @param simpleOsdkProperties\n */\nexport function createOsdkObject(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n simpleOsdkProperties: SimpleOsdkProperties,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata = {},\n): ObjectHolder {\n // updates the object's \"hidden class/map\".\n const rawObj = simpleOsdkProperties as ObjectHolder;\n Object.defineProperties(\n rawObj,\n {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: simpleOsdkProperties,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n } satisfies Record<keyof ObjectHolder, PropertyDescriptor>,\n );\n\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj,\n propKey,\n );\n } else if (propKey in derivedPropertyTypeByName) {\n rawObj[propKey] = modifyRdpProperties(\n client,\n derivedPropertyTypeByName,\n rawObj[propKey],\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction modifyRdpProperties(\n client: MinimalClient,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n rawValue: any,\n propKey: string,\n): any {\n if (\n derivedPropertyTypeByName[propKey].definition.type === \"selection\"\n && derivedPropertyTypeByName[propKey].definition.operation.type\n === \"count\"\n ) {\n const num = Number(rawValue);\n invariant(\n Number.isSafeInteger(num),\n \"Count aggregation for derived property \" + propKey\n + \" returned a value larger than safe integer.\",\n );\n return num;\n } // Selected or collected properties need to be deserialized specially when constructed with RDP\n else if (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n != null\n && typeof (derivedPropertyTypeByName[propKey]\n .selectedOrCollectedPropertyType.type)\n === \"string\"\n && specialPropertyTypes.has(\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n .type,\n )\n ) {\n switch (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n ?.type\n ) {\n case \"attachment\":\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n } else {\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n break;\n default:\n invariant(\n false,\n \"Derived property aggregations for Timeseries and Media are not supported\",\n );\n }\n }\n return rawValue;\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: ObjectHolder,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\n );\n }\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));\n }\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n (rawValue as ReferenceValue).type === \"geotimeSeriesValue\"\n ? {\n time: (rawValue as ReferenceValue).timestamp,\n value: {\n type: \"Point\",\n coordinates: (rawValue as ReferenceValue).position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n mediaReference: rawValue as MediaReference,\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,sBAAsB,QAAQ,mCAAmC;AAI1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,mCAAmC,QAAQ,oCAAoC;AAExF,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAClC,CACE,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CAEtB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG;EACnB,KAAK,EAAE;IACLC,GAAG,EAAE,SAAAA,CAAA,EAA6B;MAChC,OAAOR,MAAM,CAAC,IAAI,CAACG,YAAY,CAAC,CAAC;IACnC;EACF,CAAC;EACD,OAAO,EAAE;IACPK,GAAG,EAAE,SAAAA,CAAA,EAA6B;MAChC,OAAOP,QAAQ,CAAC,IAAI,CAAC;IACvB;EACF,CAAC;EACD,QAAQ,EAAE;IACRQ,KAAK,EAAE,SAAAA,CAELC,MAAuC,EACvC;MACA;MACA,MAAMC,MAAM,GAAG,IAAI,CAACP,oBAAoB,CAAyB;MACjE,MAAMQ,GAAG,GAAG,IAAI,CAACT,YAAY,CAAC;MAE9B,IAAIO,MAAM,IAAI,IAAI,EAAE;QAClB,O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AAS,CAACP,OAAO;MAChC4C,UAAU,EAAET,SAAS,CAAC5B,SAAS,CAACT,iBAAiB,CAAW;MAC5D+C,YAAY,EAAET,CAAW;MACzBU,cAAc,EAAE1B;IAClB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","createObjectSpecifierFromPrimaryKey","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","$primaryKey","enumerable","ObjectMetadata","client","objectDef","simpleOsdkProperties","derivedPropertyTypeByName","Object","defineProperties","propKey","keys","properties","type","has","createSpecialProperty","modifyRdpProperties","freeze","rawValue","definition","operation","num","Number","isSafeInteger","process","env","NODE_ENV","selectedOrCollectedPropertyType","Array","isArray","map","a","rid","rawObject","p","propDef","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName","mediaReference"],"sources":["createOsdkObject.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 { MediaReference } from \"@osdk/foundry.core\";\nimport type { Attachment, ReferenceValue } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { createObjectSpecifierFromPrimaryKey } from \"../../util/objectSpecifierUtils.js\";\nimport type { SimpleOsdkProperties } from \"../SimpleOsdkProperties.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\n\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function(this: ObjectHolder) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: ObjectHolder) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: ObjectHolder,\n update: Record<string, any> | undefined,\n ) {\n // I think `rawObj` is the same thing as `this` and can be removed?\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n \"$objectSpecifier\": {\n get: function(this: ObjectHolder) {\n const rawObj = this[UnderlyingOsdkObject];\n return createObjectSpecifierFromPrimaryKey(\n this[ObjectDefRef],\n rawObj.$primaryKey,\n );\n },\n enumerable: true,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n get: function(this: ObjectHolder) {\n return {\n ObjectMetadata: this[ObjectDefRef],\n };\n },\n enumerable: false,\n },\n};\n\n/**\n * @internal\n * @param client\n * @param objectDef\n * @param simpleOsdkProperties\n */\nexport function createOsdkObject(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n simpleOsdkProperties: SimpleOsdkProperties,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata = {},\n): ObjectHolder {\n // updates the object's \"hidden class/map\".\n const rawObj = simpleOsdkProperties as ObjectHolder;\n Object.defineProperties(\n rawObj,\n {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: simpleOsdkProperties,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false }, // TODO: Potentially update when GA metadata field\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n } satisfies Record<keyof ObjectHolder, PropertyDescriptor>,\n );\n\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj,\n propKey,\n );\n } else if (propKey in derivedPropertyTypeByName) {\n rawObj[propKey] = modifyRdpProperties(\n client,\n derivedPropertyTypeByName,\n rawObj[propKey],\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction modifyRdpProperties(\n client: MinimalClient,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n rawValue: any,\n propKey: string,\n): any {\n if (\n derivedPropertyTypeByName[propKey].definition.type === \"selection\"\n && derivedPropertyTypeByName[propKey].definition.operation.type\n === \"count\"\n ) {\n const num = Number(rawValue);\n invariant(\n Number.isSafeInteger(num),\n \"Count aggregation for derived property \" + propKey\n + \" returned a value larger than safe integer.\",\n );\n return num;\n } // Selected or collected properties need to be deserialized specially when constructed with RDP\n else if (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n != null\n && typeof (derivedPropertyTypeByName[propKey]\n .selectedOrCollectedPropertyType.type)\n === \"string\"\n && specialPropertyTypes.has(\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n .type,\n )\n ) {\n switch (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n ?.type\n ) {\n case \"attachment\":\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n } else {\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n break;\n default:\n invariant(\n false,\n \"Derived property aggregations for Timeseries and Media are not supported\",\n );\n }\n }\n return rawValue;\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: ObjectHolder,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\n );\n }\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));\n }\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n (rawValue as ReferenceValue).type === \"geotimeSeriesValue\"\n ? {\n time: (rawValue as ReferenceValue).timestamp,\n value: {\n type: \"Point\",\n coordinates: (rawValue as ReferenceValue).position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n mediaReference: rawValue as MediaReference,\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,sBAAsB,QAAQ,mCAAmC;AAI1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,mCAAmC,QAAQ,oCAAoC;AAExF,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAClC,CACE,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CAEtB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG;EACnB,KAAK,EAAE;IACLC,GAAG,EAAE,SAAAA,CAAA,EAA6B;MAChC,OAAOR,MAAM,CAAC,IAAI,CAACG,YAAY,CAAC,CAAC;IACnC;EACF,CAAC;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