@osdk/client 2.8.0-beta.12 → 2.8.0-beta.14

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 (135) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/build/browser/createMediaFromReference.js +61 -0
  3. package/build/browser/createMediaFromReference.js.map +1 -0
  4. package/build/browser/index.js +1 -0
  5. package/build/browser/index.js.map +1 -1
  6. package/build/browser/object/mediaUpload.js +3 -0
  7. package/build/browser/object/mediaUpload.js.map +1 -1
  8. package/build/browser/observable/LinkPayload.js.map +1 -1
  9. package/build/browser/observable/ListPayload.js.map +1 -1
  10. package/build/browser/observable/ObservableClient/ObserveLink.js.map +1 -1
  11. package/build/browser/observable/ObservableClient.js.map +1 -1
  12. package/build/browser/observable/computeObjectSetCacheKey.js.map +1 -1
  13. package/build/browser/observable/internal/ListQueryView.js +4 -3
  14. package/build/browser/observable/internal/ListQueryView.js.map +1 -1
  15. package/build/browser/observable/internal/ObservableClientImpl.js +1 -1
  16. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  17. package/build/browser/observable/internal/Store.test.js +11 -11
  18. package/build/browser/observable/internal/Store.test.js.map +1 -1
  19. package/build/browser/observable/internal/base-list/BaseCollectionQuery.js.map +1 -1
  20. package/build/browser/observable/internal/base-list/BaseListQuery.js +12 -13
  21. package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
  22. package/build/browser/observable/internal/base-list/createCollectionConnectable.js +2 -2
  23. package/build/browser/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
  24. package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js +2 -2
  25. package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
  26. package/build/browser/observable/internal/list/InterfaceListQuery.js +1 -1
  27. package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
  28. package/build/browser/observable/internal/list/ListQuery.test.js +45 -46
  29. package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -1
  30. package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  31. package/build/browser/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
  32. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -1
  33. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  34. package/build/browser/observable/internal/testUtils.js +2 -2
  35. package/build/browser/observable/internal/testUtils.js.map +1 -1
  36. package/build/browser/queries/applyQuery.js +10 -2
  37. package/build/browser/queries/applyQuery.js.map +1 -1
  38. package/build/browser/queries/queries.test.js +80 -2
  39. package/build/browser/queries/queries.test.js.map +1 -1
  40. package/build/browser/util/UserAgent.js +2 -2
  41. package/build/browser/util/toDataValue.js +7 -7
  42. package/build/browser/util/toDataValue.js.map +1 -1
  43. package/build/browser/util/toDataValue.test.js +23 -0
  44. package/build/browser/util/toDataValue.test.js.map +1 -1
  45. package/build/browser/util/toDataValueQueries.js +19 -0
  46. package/build/browser/util/toDataValueQueries.js.map +1 -1
  47. package/build/cjs/{chunk-22QZVXHI.cjs → chunk-4HVAJSMV.cjs} +205 -123
  48. package/build/cjs/chunk-4HVAJSMV.cjs.map +1 -0
  49. package/build/cjs/{chunk-YVZM2JPW.cjs → chunk-Q2XRNNC7.cjs} +95 -90
  50. package/build/cjs/chunk-Q2XRNNC7.cjs.map +1 -0
  51. package/build/cjs/{chunk-LDTMSHUZ.cjs → chunk-QPPKY7HT.cjs} +4 -4
  52. package/build/cjs/{chunk-LDTMSHUZ.cjs.map → chunk-QPPKY7HT.cjs.map} +1 -1
  53. package/build/cjs/createObjectSet-BagR_R7M.d.cts +15 -0
  54. package/build/cjs/index.cjs +20 -12
  55. package/build/cjs/index.cjs.map +1 -1
  56. package/build/cjs/index.d.cts +2 -1
  57. package/build/cjs/public/internal-node.cjs +219 -219
  58. package/build/cjs/public/internal.cjs +14 -14
  59. package/build/cjs/public/unstable-do-not-use.cjs +148 -144
  60. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  61. package/build/cjs/public/unstable-do-not-use.d.cts +11 -14
  62. package/build/esm/createMediaFromReference.js +61 -0
  63. package/build/esm/createMediaFromReference.js.map +1 -0
  64. package/build/esm/index.js +1 -0
  65. package/build/esm/index.js.map +1 -1
  66. package/build/esm/object/mediaUpload.js +3 -0
  67. package/build/esm/object/mediaUpload.js.map +1 -1
  68. package/build/esm/observable/LinkPayload.js.map +1 -1
  69. package/build/esm/observable/ListPayload.js.map +1 -1
  70. package/build/esm/observable/ObservableClient/ObserveLink.js.map +1 -1
  71. package/build/esm/observable/ObservableClient.js.map +1 -1
  72. package/build/esm/observable/computeObjectSetCacheKey.js.map +1 -1
  73. package/build/esm/observable/internal/ListQueryView.js +4 -3
  74. package/build/esm/observable/internal/ListQueryView.js.map +1 -1
  75. package/build/esm/observable/internal/ObservableClientImpl.js +1 -1
  76. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  77. package/build/esm/observable/internal/Store.test.js +11 -11
  78. package/build/esm/observable/internal/Store.test.js.map +1 -1
  79. package/build/esm/observable/internal/base-list/BaseCollectionQuery.js.map +1 -1
  80. package/build/esm/observable/internal/base-list/BaseListQuery.js +12 -13
  81. package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
  82. package/build/esm/observable/internal/base-list/createCollectionConnectable.js +2 -2
  83. package/build/esm/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
  84. package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js +2 -2
  85. package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
  86. package/build/esm/observable/internal/list/InterfaceListQuery.js +1 -1
  87. package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
  88. package/build/esm/observable/internal/list/ListQuery.test.js +45 -46
  89. package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -1
  90. package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  91. package/build/esm/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
  92. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -1
  93. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  94. package/build/esm/observable/internal/testUtils.js +2 -2
  95. package/build/esm/observable/internal/testUtils.js.map +1 -1
  96. package/build/esm/queries/applyQuery.js +10 -2
  97. package/build/esm/queries/applyQuery.js.map +1 -1
  98. package/build/esm/queries/queries.test.js +80 -2
  99. package/build/esm/queries/queries.test.js.map +1 -1
  100. package/build/esm/util/UserAgent.js +2 -2
  101. package/build/esm/util/toDataValue.js +7 -7
  102. package/build/esm/util/toDataValue.js.map +1 -1
  103. package/build/esm/util/toDataValue.test.js +23 -0
  104. package/build/esm/util/toDataValue.test.js.map +1 -1
  105. package/build/esm/util/toDataValueQueries.js +19 -0
  106. package/build/esm/util/toDataValueQueries.js.map +1 -1
  107. package/build/types/createMediaFromReference.d.ts +1 -0
  108. package/build/types/createMediaFromReference.d.ts.map +1 -0
  109. package/build/types/index.d.ts +2 -0
  110. package/build/types/index.d.ts.map +1 -1
  111. package/build/types/object/mediaUpload.d.ts +2 -1
  112. package/build/types/object/mediaUpload.d.ts.map +1 -1
  113. package/build/types/observable/LinkPayload.d.ts +1 -1
  114. package/build/types/observable/ListPayload.d.ts +1 -1
  115. package/build/types/observable/ObservableClient/ObserveLink.d.ts +1 -1
  116. package/build/types/observable/ObservableClient.d.ts +4 -4
  117. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  118. package/build/types/observable/computeObjectSetCacheKey.d.ts +2 -2
  119. package/build/types/observable/computeObjectSetCacheKey.d.ts.map +1 -1
  120. package/build/types/observable/internal/ListQueryView.d.ts.map +1 -1
  121. package/build/types/observable/internal/Store.test.d.ts.map +1 -1
  122. package/build/types/observable/internal/base-list/BaseCollectionQuery.d.ts +4 -4
  123. package/build/types/observable/internal/base-list/BaseListQuery.d.ts +1 -1
  124. package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
  125. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts +1 -1
  126. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
  127. package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts +2 -2
  128. package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts.map +1 -1
  129. package/build/types/observable/internal/testUtils.d.ts +1 -1
  130. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  131. package/build/types/queries/applyQuery.d.ts.map +1 -1
  132. package/package.json +13 -13
  133. package/build/cjs/chunk-22QZVXHI.cjs.map +0 -1
  134. package/build/cjs/chunk-YVZM2JPW.cjs.map +0 -1
  135. package/build/cjs/createClient-BPK4om7e.d.cts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @osdk/client
2
2
 
3
+ ## 2.8.0-beta.14
4
+
5
+ ### Minor Changes
6
+
7
+ - e64bf0b: Expose getWireObjectSet, isObjectSet, and WireObjectSet type for reading wire object set definitions
8
+ - baba327: return data=undefined during initial loading instead of data=[] to distinguish no data loaded yet from empty results
9
+ - d1ad4d1: Fix remapping query responses with structs that have null fields.
10
+ - 35f2f1a: Add Media inputs/outputs for Queries
11
+ - 71e28ef: Allow interface object sets in useObjectSet
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [35f2f1a]
16
+ - @osdk/api@2.8.0-beta.14
17
+ - @osdk/client.unstable@2.8.0-beta.14
18
+ - @osdk/generator-converters@2.8.0-beta.14
19
+ - @osdk/shared.client.impl@1.8.0-beta.2
20
+ - @osdk/shared.net.errors@2.8.0-beta.2
21
+ - @osdk/shared.net.fetch@1.8.0-beta.2
22
+
23
+ ## 2.8.0-beta.13
24
+
25
+ ### Minor Changes
26
+
27
+ - 4470c0d: Add support to execute queries on branches.
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [4470c0d]
32
+ - @osdk/generator-converters@2.8.0-beta.13
33
+ - @osdk/api@2.8.0-beta.13
34
+ - @osdk/client.unstable@2.8.0-beta.13
35
+
3
36
  ## 2.8.0-beta.12
4
37
 
5
38
  ### Minor Changes
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { MediaSets } from "@osdk/foundry.mediasets";
18
+ /**
19
+ * @internal
20
+ * Creates a Media object from a MediaReference for query results.
21
+ * Unlike MediaReferencePropertyImpl, this doesn't require object context
22
+ * and directly accesses the media set APIs. This is intended for MediaReferences returned
23
+ * from query results or to be used by the functions runtime,
24
+ */
25
+ export function createMediaFromReference(client, mediaReference) {
26
+ const {
27
+ mediaSetRid,
28
+ mediaItemRid
29
+ } = mediaReference.reference.mediaSetViewItem;
30
+ const token = mediaReference.reference.mediaSetViewItem.token;
31
+ return {
32
+ async fetchContents() {
33
+ return MediaSets.read(client, mediaSetRid, mediaItemRid, {
34
+ preview: true
35
+ }, token ? {
36
+ ReadToken: token
37
+ } : undefined);
38
+ },
39
+ async fetchMetadata() {
40
+ const metadata = await MediaSets.metadata(client, mediaSetRid, mediaItemRid, {
41
+ preview: true
42
+ }, token ? {
43
+ ReadToken: token
44
+ } : undefined);
45
+ const info = await MediaSets.info(client, mediaSetRid, mediaItemRid, {
46
+ preview: true
47
+ }, token ? {
48
+ ReadToken: token
49
+ } : undefined);
50
+ return {
51
+ path: info.path,
52
+ sizeBytes: metadata.sizeBytes,
53
+ mediaType: undefined // Media type is not currently returned by the API, so we return undefined here. This can be updated when the API returns media type.
54
+ };
55
+ },
56
+ getMediaReference() {
57
+ return mediaReference;
58
+ }
59
+ };
60
+ }
61
+ //# sourceMappingURL=createMediaFromReference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMediaFromReference.js","names":["MediaSets","createMediaFromReference","client","mediaReference","mediaSetRid","mediaItemRid","reference","mediaSetViewItem","token","fetchContents","read","preview","ReadToken","undefined","fetchMetadata","metadata","info","path","sizeBytes","mediaType","getMediaReference"],"sources":["createMediaFromReference.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 { Media, MediaMetadata, MediaReference } from \"@osdk/api\";\nimport { MediaSets } from \"@osdk/foundry.mediasets\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\n\n/**\n * @internal\n * Creates a Media object from a MediaReference for query results.\n * Unlike MediaReferencePropertyImpl, this doesn't require object context\n * and directly accesses the media set APIs. This is intended for MediaReferences returned\n * from query results or to be used by the functions runtime,\n */\nexport function createMediaFromReference(\n client: MinimalClient,\n mediaReference: MediaReference,\n): Media {\n const { mediaSetRid, mediaItemRid } =\n mediaReference.reference.mediaSetViewItem;\n const token = mediaReference.reference.mediaSetViewItem.token;\n return {\n async fetchContents(): Promise<Response> {\n return MediaSets.read(\n client,\n mediaSetRid,\n mediaItemRid,\n { preview: true },\n token ? { ReadToken: token } : undefined,\n );\n },\n\n async fetchMetadata(): Promise<MediaMetadata> {\n const metadata = await MediaSets.metadata(\n client,\n mediaSetRid,\n mediaItemRid,\n { preview: true },\n token ? { ReadToken: token } : undefined,\n );\n\n const info = await MediaSets.info(\n client,\n mediaSetRid,\n mediaItemRid,\n { preview: true },\n token ? { ReadToken: token } : undefined,\n );\n\n return {\n path: info.path,\n sizeBytes: metadata.sizeBytes,\n mediaType: undefined as any, // Media type is not currently returned by the API, so we return undefined here. This can be updated when the API returns media type.\n };\n },\n\n getMediaReference(): MediaReference {\n return mediaReference;\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,SAAS,QAAQ,yBAAyB;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CACtCC,MAAqB,EACrBC,cAA8B,EACvB;EACP,MAAM;IAAEC,WAAW;IAAEC;EAAa,CAAC,GACjCF,cAAc,CAACG,SAAS,CAACC,gBAAgB;EAC3C,MAAMC,KAAK,GAAGL,cAAc,CAACG,SAAS,CAACC,gBAAgB,CAACC,KAAK;EAC7D,OAAO;IACL,MAAMC,aAAaA,CAAA,EAAsB;MACvC,OAAOT,SAAS,CAACU,IAAI,CACnBR,MAAM,EACNE,WAAW,EACXC,YAAY,EACZ;QAAEM,OAAO,EAAE;MAAK,CAAC,EACjBH,KAAK,GAAG;QAAEI,SAAS,EAAEJ;MAAM,CAAC,GAAGK,SACjC,CAAC;IACH,CAAC;IAED,MAAMC,aAAaA,CAAA,EAA2B;MAC5C,MAAMC,QAAQ,GAAG,MAAMf,SAAS,CAACe,QAAQ,CACvCb,MAAM,EACNE,WAAW,EACXC,YAAY,EACZ;QAAEM,OAAO,EAAE;MAAK,CAAC,EACjBH,KAAK,GAAG;QAAEI,SAAS,EAAEJ;MAAM,CAAC,GAAGK,SACjC,CAAC;MAED,MAAMG,IAAI,GAAG,MAAMhB,SAAS,CAACgB,IAAI,CAC/Bd,MAAM,EACNE,WAAW,EACXC,YAAY,EACZ;QAAEM,OAAO,EAAE;MAAK,CAAC,EACjBH,KAAK,GAAG;QAAEI,SAAS,EAAEJ;MAAM,CAAC,GAAGK,SACjC,CAAC;MAED,OAAO;QACLI,IAAI,EAAED,IAAI,CAACC,IAAI;QACfC,SAAS,EAAEH,QAAQ,CAACG,SAAS;QAC7BC,SAAS,EAAEN,SAAgB,CAAE;MAC/B,CAAC;IACH,CAAC;IAEDO,iBAAiBA,CAAA,EAAmB;MAClC,OAAOjB,cAAc;IACvB;EACF,CAAC;AACH","ignoreList":[]}
@@ -22,6 +22,7 @@ export { ActionValidationError } from "./actions/ActionValidationError.js";
22
22
  export { createClient } from "./createClient.js";
23
23
  export { createPlatformClient } from "./createPlatformClient.js";
24
24
  export { createAttachmentUpload } from "./object/AttachmentUpload.js";
25
+ export { getWireObjectSet, isObjectSet } from "./objectSet/createObjectSet.js";
25
26
  export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
26
27
  export { createObjectSpecifierFromPrimaryKey, extractPrimaryKeyFromObjectSpecifier } from "./util/objectSpecifierUtils.js";
27
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.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\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n MediaReference,\n MediaUpload,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,QAAQ,WAAW;AAyChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B;AAErC,SACEC,mCAAmC,EACnCC,oCAAoC,QAC/B,gCAAgC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","getWireObjectSet","isObjectSet","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.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\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n MediaReference,\n MediaUpload,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nexport { getWireObjectSet, isObjectSet } from \"./objectSet/createObjectSet.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,QAAQ,WAAW;AAyChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAIrE,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,gCAAgC;AAE9E,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B;AAErC,SACEC,mCAAmC,EACnCC,oCAAoC,QAC/B,gCAAgC","ignoreList":[]}
@@ -14,6 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ export function isMedia(o) {
18
+ return typeof o === "object" && o != null && typeof o.fetchMetadata === "function" && typeof o.fetchContents === "function" && typeof o.getMediaReference === "function";
19
+ }
17
20
  export function isMediaReference(o) {
18
21
  return typeof o === `object` && typeof o.mimeType === "string" && "reference" in o && typeof o.reference === "object" && o.reference.type === "mediaSetViewItem" && "mediaSetViewItem" in o.reference && typeof o.reference.mediaSetViewItem === "object" && typeof o.reference.mediaSetViewItem.mediaSetRid === "string" && typeof o.reference.mediaSetViewItem.mediaSetViewRid === "string" && typeof o.reference.mediaSetViewItem.mediaItemRid === "string";
19
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mediaUpload.js","names":["isMediaReference","o","mimeType","reference","type","mediaSetViewItem","mediaSetRid","mediaSetViewRid","mediaItemRid","isMediaUpload","fileName","data","Blob"],"sources":["mediaUpload.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 { MediaReference, MediaUpload } from \"@osdk/api\";\n\nexport function isMediaReference(o: any): o is MediaReference {\n return typeof o === `object`\n && typeof o.mimeType === \"string\"\n && \"reference\" in o\n && typeof o.reference === \"object\"\n && o.reference.type === \"mediaSetViewItem\"\n && \"mediaSetViewItem\" in o.reference\n && typeof o.reference.mediaSetViewItem === \"object\"\n && typeof o.reference.mediaSetViewItem.mediaSetRid === \"string\"\n && typeof o.reference.mediaSetViewItem.mediaSetViewRid === \"string\"\n && typeof o.reference.mediaSetViewItem.mediaItemRid === \"string\";\n}\n\nexport function isMediaUpload(o: any): o is MediaUpload {\n return typeof o === \"object\"\n && o != null\n && \"fileName\" in o\n && typeof o.fileName === \"string\"\n && \"data\" in o\n && typeof o.data === \"object\"\n && o.data instanceof Blob;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,gBAAgBA,CAACC,CAAM,EAAuB;EAC5D,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvB,OAAOA,CAAC,CAACC,QAAQ,KAAK,QAAQ,IAC9B,WAAW,IAAID,CAAC,IAChB,OAAOA,CAAC,CAACE,SAAS,KAAK,QAAQ,IAC/BF,CAAC,CAACE,SAAS,CAACC,IAAI,KAAK,kBAAkB,IACvC,kBAAkB,IAAIH,CAAC,CAACE,SAAS,IACjC,OAAOF,CAAC,CAACE,SAAS,CAACE,gBAAgB,KAAK,QAAQ,IAChD,OAAOJ,CAAC,CAACE,SAAS,CAACE,gBAAgB,CAACC,WAAW,KAAK,QAAQ,IAC5D,OAAOL,CAAC,CAACE,SAAS,CAACE,gBAAgB,CAACE,eAAe,KAAK,QAAQ,IAChE,OAAON,CAAC,CAACE,SAAS,CAACE,gBAAgB,CAACG,YAAY,KAAK,QAAQ;AACpE;AAEA,OAAO,SAASC,aAAaA,CAACR,CAAM,EAAoB;EACtD,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvBA,CAAC,IAAI,IAAI,IACT,UAAU,IAAIA,CAAC,IACf,OAAOA,CAAC,CAACS,QAAQ,KAAK,QAAQ,IAC9B,MAAM,IAAIT,CAAC,IACX,OAAOA,CAAC,CAACU,IAAI,KAAK,QAAQ,IAC1BV,CAAC,CAACU,IAAI,YAAYC,IAAI;AAC7B","ignoreList":[]}
1
+ {"version":3,"file":"mediaUpload.js","names":["isMedia","o","fetchMetadata","fetchContents","getMediaReference","isMediaReference","mimeType","reference","type","mediaSetViewItem","mediaSetRid","mediaSetViewRid","mediaItemRid","isMediaUpload","fileName","data","Blob"],"sources":["mediaUpload.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 { Media, MediaReference, MediaUpload } from \"@osdk/api\";\n\nexport function isMedia(o: any): o is Media {\n return typeof o === \"object\"\n && o != null\n && typeof o.fetchMetadata === \"function\"\n && typeof o.fetchContents === \"function\"\n && typeof o.getMediaReference === \"function\";\n}\n\nexport function isMediaReference(o: any): o is MediaReference {\n return typeof o === `object`\n && typeof o.mimeType === \"string\"\n && \"reference\" in o\n && typeof o.reference === \"object\"\n && o.reference.type === \"mediaSetViewItem\"\n && \"mediaSetViewItem\" in o.reference\n && typeof o.reference.mediaSetViewItem === \"object\"\n && typeof o.reference.mediaSetViewItem.mediaSetRid === \"string\"\n && typeof o.reference.mediaSetViewItem.mediaSetViewRid === \"string\"\n && typeof o.reference.mediaSetViewItem.mediaItemRid === \"string\";\n}\n\nexport function isMediaUpload(o: any): o is MediaUpload {\n return typeof o === \"object\"\n && o != null\n && \"fileName\" in o\n && typeof o.fileName === \"string\"\n && \"data\" in o\n && typeof o.data === \"object\"\n && o.data instanceof Blob;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,OAAOA,CAACC,CAAM,EAAc;EAC1C,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvBA,CAAC,IAAI,IAAI,IACT,OAAOA,CAAC,CAACC,aAAa,KAAK,UAAU,IACrC,OAAOD,CAAC,CAACE,aAAa,KAAK,UAAU,IACrC,OAAOF,CAAC,CAACG,iBAAiB,KAAK,UAAU;AAChD;AAEA,OAAO,SAASC,gBAAgBA,CAACJ,CAAM,EAAuB;EAC5D,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvB,OAAOA,CAAC,CAACK,QAAQ,KAAK,QAAQ,IAC9B,WAAW,IAAIL,CAAC,IAChB,OAAOA,CAAC,CAACM,SAAS,KAAK,QAAQ,IAC/BN,CAAC,CAACM,SAAS,CAACC,IAAI,KAAK,kBAAkB,IACvC,kBAAkB,IAAIP,CAAC,CAACM,SAAS,IACjC,OAAON,CAAC,CAACM,SAAS,CAACE,gBAAgB,KAAK,QAAQ,IAChD,OAAOR,CAAC,CAACM,SAAS,CAACE,gBAAgB,CAACC,WAAW,KAAK,QAAQ,IAC5D,OAAOT,CAAC,CAACM,SAAS,CAACE,gBAAgB,CAACE,eAAe,KAAK,QAAQ,IAChE,OAAOV,CAAC,CAACM,SAAS,CAACE,gBAAgB,CAACG,YAAY,KAAK,QAAQ;AACpE;AAEA,OAAO,SAASC,aAAaA,CAACZ,CAAM,EAAoB;EACtD,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvBA,CAAC,IAAI,IAAI,IACT,UAAU,IAAIA,CAAC,IACf,OAAOA,CAAC,CAACa,QAAQ,KAAK,QAAQ,IAC9B,MAAM,IAAIb,CAAC,IACX,OAAOA,CAAC,CAACc,IAAI,KAAK,QAAQ,IAC1Bd,CAAC,CAACc,IAAI,YAAYC,IAAI;AAC7B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"LinkPayload.js","names":[],"sources":["LinkPayload.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 { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveLinkCallbackArgs } from \"./ObservableClient.js\";\n\n/**\n * Internal type to keep the generic insanity down internal to the observable code\n */\nexport interface SpecificLinkPayload\n extends Omit<ObserveLinkCallbackArgs<any>, \"resolvedList\">\n{\n resolvedList: Array<ObjectHolder | InterfaceHolder>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"LinkPayload.js","names":[],"sources":["LinkPayload.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 { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveLinkCallbackArgs } from \"./ObservableClient.js\";\n\n/**\n * Internal type to keep the generic insanity down internal to the observable code\n */\nexport interface SpecificLinkPayload\n extends Omit<ObserveLinkCallbackArgs<any>, \"resolvedList\">\n{\n resolvedList: Array<ObjectHolder | InterfaceHolder> | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ListPayload.js","names":[],"sources":["ListPayload.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 { WirePropertyTypes } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectsCallbackArgs } from \"./ObservableClient.js\";\n\nexport interface ListPayload<\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> extends Omit<ObserveObjectsCallbackArgs<any, RDPs>, \"resolvedList\"> {\n resolvedList: Array<ObjectHolder | InterfaceHolder>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ListPayload.js","names":[],"sources":["ListPayload.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 { WirePropertyTypes } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectsCallbackArgs } from \"./ObservableClient.js\";\n\nexport interface ListPayload<\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> extends Omit<ObserveObjectsCallbackArgs<any, RDPs>, \"resolvedList\"> {\n resolvedList: Array<ObjectHolder | InterfaceHolder> | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObserveLink.js","names":["ObserveLinks"],"sources":["ObserveLink.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 CompileTimeMetadata,\n InterfaceDefinition,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n WhereClause,\n} from \"@osdk/api\";\nimport type { Unsubscribable } from \"../Unsubscribable.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n OrderBy,\n Status,\n} from \"./common.js\";\n\nexport namespace ObserveLinks {\n export interface Options<\n Q extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<Q>[\"links\"] & string,\n > extends CommonObserveOptions, ObserveOptions {\n srcType: Pick<Q, \"type\" | \"apiName\">;\n sourceUnderlyingObjectType: string;\n pk: PrimaryKeyType<Q>;\n linkName: L;\n where?: WhereClause<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n pageSize?: number;\n orderBy?: OrderBy<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n }\n\n export interface CallbackArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n > {\n resolvedList: Osdk.Instance<T>[];\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n }\n}\n\nexport interface ObserveLinks {\n observeLinks<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | ReadonlyArray<Osdk.Instance<T>>,\n linkName: L,\n options: Omit<\n ObserveLinks.Options<T, L>,\n \"srcType\" | \"pk\" | \"sourceUnderlyingObjectType\"\n >,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ): Unsubscribable;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAkCiBA,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"ObserveLink.js","names":["ObserveLinks"],"sources":["ObserveLink.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 CompileTimeMetadata,\n InterfaceDefinition,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n WhereClause,\n} from \"@osdk/api\";\nimport type { Unsubscribable } from \"../Unsubscribable.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n OrderBy,\n Status,\n} from \"./common.js\";\n\nexport namespace ObserveLinks {\n export interface Options<\n Q extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<Q>[\"links\"] & string,\n > extends CommonObserveOptions, ObserveOptions {\n srcType: Pick<Q, \"type\" | \"apiName\">;\n sourceUnderlyingObjectType: string;\n pk: PrimaryKeyType<Q>;\n linkName: L;\n where?: WhereClause<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n pageSize?: number;\n orderBy?: OrderBy<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n }\n\n export interface CallbackArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n > {\n resolvedList: Osdk.Instance<T>[] | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n }\n}\n\nexport interface ObserveLinks {\n observeLinks<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | ReadonlyArray<Osdk.Instance<T>>,\n linkName: L,\n options: Omit<\n ObserveLinks.Options<T, L>,\n \"srcType\" | \"pk\" | \"sourceUnderlyingObjectType\"\n >,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ): Unsubscribable;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAkCiBA,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { createFetchHeaderMutator } from \"@osdk/shared.net.fetch\";\nimport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport type { QueryReturnType } from \"../queries/types.js\";\nimport { OBSERVABLE_USER_AGENT } from \"../util/UserAgent.js\";\nimport type { Canonical } from \"./internal/Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { ObservableClientImpl } from \"./internal/ObservableClientImpl.js\";\nimport { Store } from \"./internal/Store.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n Status,\n} from \"./ObservableClient/common.js\";\nimport type { ObserveLinks } from \"./ObservableClient/ObserveLink.js\";\nimport type { OptimisticBuilder } from \"./OptimisticBuilder.js\";\n\nexport namespace ObservableClient {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\nexport interface ObserveObjectOptions<\n T extends ObjectOrInterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: PropertyKeys<T>[];\n}\n\nexport type OrderBy<Q extends ObjectOrInterfaceDefinition> = {\n [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" | undefined;\n};\n\nexport interface ObserveListOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: Pick<Q, \"apiName\" | \"type\">;\n where?: WhereClause<Q, RDPs>;\n pageSize?: number;\n orderBy?: OrderBy<Q>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n streamUpdates?: boolean;\n withProperties?: DerivedProperty.Clause<Q>;\n\n /**\n * Fetch objects by their Resource Identifiers (RIDs).\n * When provided, starts with a static objectset containing these RIDs.\n * Can be combined with `where` to filter the RID set, and with `orderBy` to sort results.\n *\n * @example\n * // Fetch specific objects by RID\n * observeList({ type: Employee, rids: ['ri.foo.123', 'ri.foo.456'] }, observer)\n *\n * @example\n * // Fetch specific objects by RID, filtered by status\n * observeList({\n * type: Employee,\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' }\n * }, observer)\n */\n rids?: readonly string[];\n\n /**\n * Automatically fetch additional pages on initial load.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n *\n * @example\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer)\n *\n * @example\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer)\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n}\n\nexport interface ObserveObjectCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<T> | undefined;\n isOptimistic: boolean;\n status: Status;\n lastUpdated: number;\n}\n\nexport interface ObserveObjectsCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList: Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n}\n\nexport interface ObserveObjectSetArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList: Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n objectSet: ObjectSet<T, RDPs>;\n totalCount?: string;\n}\n\ninterface ObserveAggregationBaseOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: T;\n where?: WhereClause<T, RDPs>;\n withProperties?: DerivedProperty.Clause<T>;\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n aggregate: A;\n}\n\n/**\n * Options for observeAggregation without an ObjectSet (synchronous).\n */\nexport interface ObserveAggregationOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet?: undefined;\n}\n\n/**\n * Options for observeAggregation with an ObjectSet (asynchronous).\n *\n * When objectSet is provided, the aggregation is performed on that ObjectSet\n * instead of the base type, enabling aggregation on pivoted or filtered sets.\n */\nexport interface ObserveAggregationOptionsWithObjectSet<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet: ObjectSet<T>;\n}\n\nexport interface ObserveAggregationArgs<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n> {\n result: AggregationsResults<T, A> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\nexport interface ObserveFunctionOptions extends CommonObserveOptions {\n /**\n * Object types this function depends on.\n * When actions modify these types, the function will refetch.\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances or ObjectSets this function depends on.\n * When these objects change, the function will refetch.\n *\n * For ObjectSets, the object type is extracted asynchronously and added\n * to the dependency list. Changes to any object of that type will trigger\n * a refetch.\n */\n dependsOnObjects?: Array<\n Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>\n >;\n}\n\nexport interface ObserveFunctionCallbackArgs<\n Q extends QueryDefinition<unknown>,\n> {\n result: QueryReturnType<CompileTimeMetadata<Q>[\"output\"]> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\n/**\n * User facing callback args for `observeLink`\n */\nexport interface ObserveLinkCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n resolvedList: Osdk.Instance<T>[];\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n}\n\n/**\n * Public interface for reactive data management with automatic updates.\n *\n * The ObservableClient provides a reactive data layer with:\n * - Real-time object and collection observation\n * - Automatic cache updates when data changes\n * - Optimistic updates for immediate UI feedback\n * - Pagination support for large collections\n * - Link traversal for relationship navigation\n */\nexport interface ObservableClient extends ObserveLinks {\n /**\n * Observe a single object or interface instance with automatic updates when it changes.\n *\n * @param apiName - The object type or interface definition, or its API name\n * @param pk - The object's primary key\n * @param options - Observation options including deduplication interval\n * @param subFn - Observer that receives object state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * The observer will receive:\n * - Initial loading state if data not cached\n * - Loaded state with the object data\n * - Updates when the object changes\n * - Error state if fetch fails\n */\n observeObject<T extends ObjectOrInterfaceDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: ObserveOptions,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * Observe an ObjectSet with automatic updates when matching objects change.\n *\n * @param baseObjectSet - The base ObjectSet to observe\n * @param options - Options for transforming and observing the ObjectSet\n * @param subFn - Observer that receives ObjectSet state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports all ObjectSet operations:\n * - Filtering with where clauses\n * - Derived properties with withProperties\n * - Set operations (union, intersect, subtract)\n * - Link traversal with pivotTo\n * - Sorting and pagination\n */\n observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * @deprecated Use the async overload with `objectSet` parameter instead.\n * Pass `objectSet: client(YourType)` to get the base object set.\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n\n /**\n * Observe an aggregation query on a custom ObjectSet with automatic updates.\n *\n * This overload accepts an ObjectSet parameter, enabling aggregation on pivoted,\n * filtered, or composed ObjectSets. Returns a Promise because invalidation type\n * computation is async (requires lookups for link targets).\n *\n * @param options - Aggregation configuration including objectSet, where, aggregate spec\n * @param subFn - Observer that receives aggregation result updates\n * @returns Promise resolving to subscription that can be unsubscribed\n *\n * @example\n * ```typescript\n * const sub = await observableClient.observeAggregation(\n * {\n * type: Office,\n * objectSet: $(Employee).pivotTo(\"primaryOffice\"),\n * aggregate: { $select: { $count: \"unordered\" } }\n * },\n * observer\n * );\n * ```\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Promise<Unsubscribable>;\n\n /**\n * Observe a function execution with automatic updates.\n *\n * @param queryDef - The QueryDefinition to execute\n * @param params - Parameters to pass to the function (undefined if no params)\n * @param options - Observation options including invalidation configuration\n * @param subFn - Observer that receives function result updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Automatic caching and deduplication\n * - Dependency-based invalidation (dependsOn object types)\n * - Instance-based invalidation (dependsOnObjects)\n * - Manual refetch via invalidateFunction()\n */\n observeFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n params: Record<string, unknown> | undefined,\n options: ObserveFunctionOptions,\n subFn: Observer<ObserveFunctionCallbackArgs<Q>>,\n ): Unsubscribable;\n\n /**\n * Execute an action with optional optimistic updates.\n *\n * @param action - Action definition to execute\n * @param args - Arguments for the action\n * @param opts - Options including optimistic updates\n * @returns Promise that resolves when the action completes\n *\n * When providing optimistic updates:\n * - Changes appear immediately in the UI\n * - Server request still happens in background\n * - On success, server data replaces optimistic data\n * - On failure, optimistic changes automatically roll back\n */\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n /**\n * Validate action parameters without executing the action.\n *\n * @param action - Action definition to validate\n * @param args - Arguments to validate\n * @returns Promise with validation result\n *\n * Use this to:\n * - Pre-validate forms before submission\n * - Display warnings or errors in the UI\n * - Enable/disable action buttons based on validity\n */\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n /**\n * Invalidates the entire cache, forcing all queries to refetch.\n * Use sparingly as this can cause significant network traffic.\n */\n invalidateAll(): Promise<void>;\n\n /**\n * Invalidates specific objects in the cache.\n * @param objects - Single object or array of objects to invalidate\n */\n invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void>;\n\n /**\n * Invalidates all cached data for a specific object type.\n * This includes:\n * - All objects of the specified type\n * - All lists containing objects of this type\n * - All links where the source is of this type\n *\n * @param type - Object type definition or API name string\n * @returns Promise that resolves when invalidation is complete\n */\n invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void>;\n\n /**\n * Invalidate function queries.\n * - If params undefined, invalidates ALL queries for this function\n * - If params provided, invalidates only the query with exact params match\n *\n * @param apiName - Function API name string or QueryDefinition\n * @param params - Optional params for exact match\n */\n invalidateFunction(\n apiName: string | QueryDefinition<unknown>,\n params?: Record<string, unknown>,\n ): Promise<void>;\n\n /**\n * Invalidate functions that depend on a specific object instance.\n *\n * @param apiName - Object type API name\n * @param primaryKey - Object primary key\n */\n invalidateFunctionsByObject(\n apiName: string,\n primaryKey: string | number,\n ): Promise<void>;\n\n canonicalizeWhereClause: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n}\n\nexport function createObservableClient(client: Client): ObservableClient {\n // First we need a modified client that adds an extra header so we know its\n // an observable client\n const tweakedClient = createClientFromContext({\n ...client[additionalContext],\n\n fetch: createFetchHeaderMutator(\n client[additionalContext].fetch,\n (headers) => {\n headers.set(\n \"Fetch-User-Agent\",\n [\n headers.get(\"Fetch-User-Agent\"),\n OBSERVABLE_USER_AGENT,\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SAASA,wBAAwB,QAAQ,wBAAwB;AAEjE,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;AAE5D,SAASC,qBAAqB,QAAQ,sBAAsB;AAG5D,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,KAAK,QAAQ,qBAAqB;AAAC,WAW3BC,gBAAgB;AAoIjC;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgPA,OAAO,SAASC,sBAAsBA,CAACC,MAAc,EAAoB;EACvE;EACA;EACA,MAAMC,aAAa,GAAGP,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BS,KAAK,EAAEV,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACS,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BV,qBAAqB,CACtB,CAACW,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAIA,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAC5C,CAAC;MACD,OAAON,OAAO;IAChB,CACF;EACF,CAAC,CAAC;;EAEF;EACA;EACA,OAAO,IAAIP,oBAAoB,CAAC,IAAIC,KAAK,CAACI,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
1
+ {"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { createFetchHeaderMutator } from \"@osdk/shared.net.fetch\";\nimport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport type { QueryReturnType } from \"../queries/types.js\";\nimport { OBSERVABLE_USER_AGENT } from \"../util/UserAgent.js\";\nimport type { Canonical } from \"./internal/Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { ObservableClientImpl } from \"./internal/ObservableClientImpl.js\";\nimport { Store } from \"./internal/Store.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n Status,\n} from \"./ObservableClient/common.js\";\nimport type { ObserveLinks } from \"./ObservableClient/ObserveLink.js\";\nimport type { OptimisticBuilder } from \"./OptimisticBuilder.js\";\n\nexport namespace ObservableClient {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\nexport interface ObserveObjectOptions<\n T extends ObjectOrInterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: PropertyKeys<T>[];\n}\n\nexport type OrderBy<Q extends ObjectOrInterfaceDefinition> = {\n [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" | undefined;\n};\n\nexport interface ObserveListOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: Pick<Q, \"apiName\" | \"type\">;\n where?: WhereClause<Q, RDPs>;\n pageSize?: number;\n orderBy?: OrderBy<Q>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n streamUpdates?: boolean;\n withProperties?: DerivedProperty.Clause<Q>;\n\n /**\n * Fetch objects by their Resource Identifiers (RIDs).\n * When provided, starts with a static objectset containing these RIDs.\n * Can be combined with `where` to filter the RID set, and with `orderBy` to sort results.\n *\n * @example\n * // Fetch specific objects by RID\n * observeList({ type: Employee, rids: ['ri.foo.123', 'ri.foo.456'] }, observer)\n *\n * @example\n * // Fetch specific objects by RID, filtered by status\n * observeList({\n * type: Employee,\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' }\n * }, observer)\n */\n rids?: readonly string[];\n\n /**\n * Automatically fetch additional pages on initial load.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n *\n * @example\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer)\n *\n * @example\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer)\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n}\n\nexport interface ObserveObjectCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<T> | undefined;\n isOptimistic: boolean;\n status: Status;\n lastUpdated: number;\n}\n\nexport interface ObserveObjectsCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList:\n | Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >\n | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n}\n\nexport interface ObserveObjectSetArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList:\n | Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >\n | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n objectSet: ObjectSet<T, RDPs>;\n totalCount?: string;\n}\n\ninterface ObserveAggregationBaseOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: T;\n where?: WhereClause<T, RDPs>;\n withProperties?: DerivedProperty.Clause<T>;\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n aggregate: A;\n}\n\n/**\n * Options for observeAggregation without an ObjectSet (synchronous).\n */\nexport interface ObserveAggregationOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet?: undefined;\n}\n\n/**\n * Options for observeAggregation with an ObjectSet (asynchronous).\n *\n * When objectSet is provided, the aggregation is performed on that ObjectSet\n * instead of the base type, enabling aggregation on pivoted or filtered sets.\n */\nexport interface ObserveAggregationOptionsWithObjectSet<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet: ObjectSet<T>;\n}\n\nexport interface ObserveAggregationArgs<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n> {\n result: AggregationsResults<T, A> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\nexport interface ObserveFunctionOptions extends CommonObserveOptions {\n /**\n * Object types this function depends on.\n * When actions modify these types, the function will refetch.\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances or ObjectSets this function depends on.\n * When these objects change, the function will refetch.\n *\n * For ObjectSets, the object type is extracted asynchronously and added\n * to the dependency list. Changes to any object of that type will trigger\n * a refetch.\n */\n dependsOnObjects?: Array<\n Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>\n >;\n}\n\nexport interface ObserveFunctionCallbackArgs<\n Q extends QueryDefinition<unknown>,\n> {\n result: QueryReturnType<CompileTimeMetadata<Q>[\"output\"]> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\n/**\n * User facing callback args for `observeLink`\n */\nexport interface ObserveLinkCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n resolvedList: Osdk.Instance<T>[] | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n}\n\n/**\n * Public interface for reactive data management with automatic updates.\n *\n * The ObservableClient provides a reactive data layer with:\n * - Real-time object and collection observation\n * - Automatic cache updates when data changes\n * - Optimistic updates for immediate UI feedback\n * - Pagination support for large collections\n * - Link traversal for relationship navigation\n */\nexport interface ObservableClient extends ObserveLinks {\n /**\n * Observe a single object or interface instance with automatic updates when it changes.\n *\n * @param apiName - The object type or interface definition, or its API name\n * @param pk - The object's primary key\n * @param options - Observation options including deduplication interval\n * @param subFn - Observer that receives object state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * The observer will receive:\n * - Initial loading state if data not cached\n * - Loaded state with the object data\n * - Updates when the object changes\n * - Error state if fetch fails\n */\n observeObject<T extends ObjectOrInterfaceDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: ObserveOptions,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * Observe an ObjectSet with automatic updates when matching objects change.\n *\n * @param baseObjectSet - The base ObjectSet to observe\n * @param options - Options for transforming and observing the ObjectSet\n * @param subFn - Observer that receives ObjectSet state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports all ObjectSet operations:\n * - Filtering with where clauses\n * - Derived properties with withProperties\n * - Set operations (union, intersect, subtract)\n * - Link traversal with pivotTo\n * - Sorting and pagination\n */\n observeObjectSet<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * @deprecated Use the async overload with `objectSet` parameter instead.\n * Pass `objectSet: client(YourType)` to get the base object set.\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n\n /**\n * Observe an aggregation query on a custom ObjectSet with automatic updates.\n *\n * This overload accepts an ObjectSet parameter, enabling aggregation on pivoted,\n * filtered, or composed ObjectSets. Returns a Promise because invalidation type\n * computation is async (requires lookups for link targets).\n *\n * @param options - Aggregation configuration including objectSet, where, aggregate spec\n * @param subFn - Observer that receives aggregation result updates\n * @returns Promise resolving to subscription that can be unsubscribed\n *\n * @example\n * ```typescript\n * const sub = await observableClient.observeAggregation(\n * {\n * type: Office,\n * objectSet: $(Employee).pivotTo(\"primaryOffice\"),\n * aggregate: { $select: { $count: \"unordered\" } }\n * },\n * observer\n * );\n * ```\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Promise<Unsubscribable>;\n\n /**\n * Observe a function execution with automatic updates.\n *\n * @param queryDef - The QueryDefinition to execute\n * @param params - Parameters to pass to the function (undefined if no params)\n * @param options - Observation options including invalidation configuration\n * @param subFn - Observer that receives function result updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Automatic caching and deduplication\n * - Dependency-based invalidation (dependsOn object types)\n * - Instance-based invalidation (dependsOnObjects)\n * - Manual refetch via invalidateFunction()\n */\n observeFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n params: Record<string, unknown> | undefined,\n options: ObserveFunctionOptions,\n subFn: Observer<ObserveFunctionCallbackArgs<Q>>,\n ): Unsubscribable;\n\n /**\n * Execute an action with optional optimistic updates.\n *\n * @param action - Action definition to execute\n * @param args - Arguments for the action\n * @param opts - Options including optimistic updates\n * @returns Promise that resolves when the action completes\n *\n * When providing optimistic updates:\n * - Changes appear immediately in the UI\n * - Server request still happens in background\n * - On success, server data replaces optimistic data\n * - On failure, optimistic changes automatically roll back\n */\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n /**\n * Validate action parameters without executing the action.\n *\n * @param action - Action definition to validate\n * @param args - Arguments to validate\n * @returns Promise with validation result\n *\n * Use this to:\n * - Pre-validate forms before submission\n * - Display warnings or errors in the UI\n * - Enable/disable action buttons based on validity\n */\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n /**\n * Invalidates the entire cache, forcing all queries to refetch.\n * Use sparingly as this can cause significant network traffic.\n */\n invalidateAll(): Promise<void>;\n\n /**\n * Invalidates specific objects in the cache.\n * @param objects - Single object or array of objects to invalidate\n */\n invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void>;\n\n /**\n * Invalidates all cached data for a specific object type.\n * This includes:\n * - All objects of the specified type\n * - All lists containing objects of this type\n * - All links where the source is of this type\n *\n * @param type - Object type definition or API name string\n * @returns Promise that resolves when invalidation is complete\n */\n invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void>;\n\n /**\n * Invalidate function queries.\n * - If params undefined, invalidates ALL queries for this function\n * - If params provided, invalidates only the query with exact params match\n *\n * @param apiName - Function API name string or QueryDefinition\n * @param params - Optional params for exact match\n */\n invalidateFunction(\n apiName: string | QueryDefinition<unknown>,\n params?: Record<string, unknown>,\n ): Promise<void>;\n\n /**\n * Invalidate functions that depend on a specific object instance.\n *\n * @param apiName - Object type API name\n * @param primaryKey - Object primary key\n */\n invalidateFunctionsByObject(\n apiName: string,\n primaryKey: string | number,\n ): Promise<void>;\n\n canonicalizeWhereClause: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n}\n\nexport function createObservableClient(client: Client): ObservableClient {\n // First we need a modified client that adds an extra header so we know its\n // an observable client\n const tweakedClient = createClientFromContext({\n ...client[additionalContext],\n\n fetch: createFetchHeaderMutator(\n client[additionalContext].fetch,\n (headers) => {\n headers.set(\n \"Fetch-User-Agent\",\n [\n headers.get(\"Fetch-User-Agent\"),\n OBSERVABLE_USER_AGENT,\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SAASA,wBAAwB,QAAQ,wBAAwB;AAEjE,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;AAE5D,SAASC,qBAAqB,QAAQ,sBAAsB;AAG5D,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,KAAK,QAAQ,qBAAqB;AAAC,WAW3BC,gBAAgB;AAwIjC;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgPA,OAAO,SAASC,sBAAsBA,CAACC,MAAc,EAAoB;EACvE;EACA;EACA,MAAMC,aAAa,GAAGP,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BS,KAAK,EAAEV,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACS,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BV,qBAAqB,CACtB,CAACW,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAIA,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAC5C,CAAC;MACD,OAAON,OAAO;IAChB,CACF;EACF,CAAC,CAAC;;EAEF;EACA;EACA,OAAO,IAAIP,oBAAoB,CAAC,IAAIC,KAAK,CAACI,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"computeObjectSetCacheKey.js","names":["getWireObjectSet","OrderByCanonicalizer","WhereClauseCanonicalizer","whereCanonicalizer","orderByCanonicalizer","computeObjectSetCacheKey","objectSet","options","keyParts","JSON","stringify","where","push","canonicalize","withProperties","propKeys","Object","keys","sort","union","length","map","os","intersect","subtract","pivotTo","orderBy","pageSize"],"sources":["computeObjectSetCacheKey.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 BaseObjectSet,\n ObjectSet,\n ObjectTypeDefinition,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { OrderByCanonicalizer } from \"./internal/OrderByCanonicalizer.js\";\nimport { WhereClauseCanonicalizer } from \"./internal/WhereClauseCanonicalizer.js\";\n\nconst whereCanonicalizer = new WhereClauseCanonicalizer();\nconst orderByCanonicalizer = new OrderByCanonicalizer();\n\n/**\n * Computes a stable cache key for an ObjectSet with options.\n *\n * Note: dedupeInterval is excluded as it doesn't affect the data, only the refresh rate.\n *\n * @param objectSet - The base ObjectSet\n * @param options - Optional observation options (where, orderBy, etc.)\n * @returns A stable string key representing the ObjectSet and options\n */\nexport function computeObjectSetCacheKey<\n T extends ObjectTypeDefinition,\n BaseRDPs extends\n | Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>>\n | BaseObjectSet<T> = never,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n>(\n objectSet: ObjectSet<T, BaseRDPs>,\n options?: ObserveObjectSetOptions<T, RDPs>,\n): string {\n const keyParts: Array<unknown> = [\n \"objectSet\",\n getWireObjectSet(objectSet as unknown as ObjectSet<any>),\n ];\n\n if (!options) {\n return JSON.stringify(keyParts);\n }\n\n if (options.where) {\n keyParts.push(\"where\", whereCanonicalizer.canonicalize(options.where));\n }\n\n if (options.withProperties) {\n const propKeys = Object.keys(options.withProperties).sort();\n keyParts.push(\"props\", propKeys);\n }\n\n if (options.union && options.union.length > 0) {\n keyParts.push(\n \"union\",\n options.union.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.intersect && options.intersect.length > 0) {\n keyParts.push(\n \"intersect\",\n options.intersect.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.subtract && options.subtract.length > 0) {\n keyParts.push(\n \"subtract\",\n options.subtract.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.pivotTo) {\n keyParts.push(\"pivotTo\", options.pivotTo);\n }\n\n if (options.orderBy) {\n keyParts.push(\n \"orderBy\",\n orderByCanonicalizer.canonicalize(options.orderBy),\n );\n }\n\n if (options.pageSize) {\n keyParts.push(\"pageSize\", options.pageSize);\n }\n\n return JSON.stringify(keyParts);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,gBAAgB,QAAQ,iCAAiC;AAElE,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,wBAAwB,QAAQ,wCAAwC;AAEjF,MAAMC,kBAAkB,GAAG,IAAID,wBAAwB,CAAC,CAAC;AACzD,MAAME,oBAAoB,GAAG,IAAIH,oBAAoB,CAAC,CAAC;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,wBAAwBA,CAUtCC,SAAiC,EACjCC,OAA0C,EAClC;EACR,MAAMC,QAAwB,GAAG,CAC/B,WAAW,EACXR,gBAAgB,CAACM,SAAsC,CAAC,CACzD;EAED,IAAI,CAACC,OAAO,EAAE;IACZ,OAAOE,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC;EACjC;EAEA,IAAID,OAAO,CAACI,KAAK,EAAE;IACjBH,QAAQ,CAACI,IAAI,CAAC,OAAO,EAAET,kBAAkB,CAACU,YAAY,CAACN,OAAO,CAACI,KAAK,CAAC,CAAC;EACxE;EAEA,IAAIJ,OAAO,CAACO,cAAc,EAAE;IAC1B,MAAMC,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACV,OAAO,CAACO,cAAc,CAAC,CAACI,IAAI,CAAC,CAAC;IAC3DV,QAAQ,CAACI,IAAI,CAAC,OAAO,EAAEG,QAAQ,CAAC;EAClC;EAEA,IAAIR,OAAO,CAACY,KAAK,IAAIZ,OAAO,CAACY,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;IAC7CZ,QAAQ,CAACI,IAAI,CACX,OAAO,EACPL,OAAO,CAACY,KAAK,CAACE,GAAG,CAAEC,EAAgB,IACjCtB,gBAAgB,CAACsB,EAA+B,CAClD,CACF,CAAC;EACH;EAEA,IAAIf,OAAO,CAACgB,SAAS,IAAIhB,OAAO,CAACgB,SAAS,CAACH,MAAM,GAAG,CAAC,EAAE;IACrDZ,QAAQ,CAACI,IAAI,CACX,WAAW,EACXL,OAAO,CAACgB,SAAS,CAACF,GAAG,CAAEC,EAAgB,IACrCtB,gBAAgB,CAACsB,EAA+B,CAClD,CACF,CAAC;EACH;EAEA,IAAIf,OAAO,CAACiB,QAAQ,IAAIjB,OAAO,CAACiB,QAAQ,CAACJ,MAAM,GAAG,CAAC,EAAE;IACnDZ,QAAQ,CAACI,IAAI,CACX,UAAU,EACVL,OAAO,CAACiB,QAAQ,CAACH,GAAG,CAAEC,EAAgB,IACpCtB,gBAAgB,CAACsB,EAA+B,CAClD,CACF,CAAC;EACH;EAEA,IAAIf,OAAO,CAACkB,OAAO,EAAE;IACnBjB,QAAQ,CAACI,IAAI,CAAC,SAAS,EAAEL,OAAO,CAACkB,OAAO,CAAC;EAC3C;EAEA,IAAIlB,OAAO,CAACmB,OAAO,EAAE;IACnBlB,QAAQ,CAACI,IAAI,CACX,SAAS,EACTR,oBAAoB,CAACS,YAAY,CAACN,OAAO,CAACmB,OAAO,CACnD,CAAC;EACH;EAEA,IAAInB,OAAO,CAACoB,QAAQ,EAAE;IACpBnB,QAAQ,CAACI,IAAI,CAAC,UAAU,EAAEL,OAAO,CAACoB,QAAQ,CAAC;EAC7C;EAEA,OAAOlB,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC;AACjC","ignoreList":[]}
1
+ {"version":3,"file":"computeObjectSetCacheKey.js","names":["getWireObjectSet","OrderByCanonicalizer","WhereClauseCanonicalizer","whereCanonicalizer","orderByCanonicalizer","computeObjectSetCacheKey","objectSet","options","keyParts","JSON","stringify","where","push","canonicalize","withProperties","propKeys","Object","keys","sort","union","length","map","os","intersect","subtract","pivotTo","orderBy","pageSize"],"sources":["computeObjectSetCacheKey.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 BaseObjectSet,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { OrderByCanonicalizer } from \"./internal/OrderByCanonicalizer.js\";\nimport { WhereClauseCanonicalizer } from \"./internal/WhereClauseCanonicalizer.js\";\n\nconst whereCanonicalizer = new WhereClauseCanonicalizer();\nconst orderByCanonicalizer = new OrderByCanonicalizer();\n\n/**\n * Computes a stable cache key for an ObjectSet with options.\n *\n * Note: dedupeInterval is excluded as it doesn't affect the data, only the refresh rate.\n *\n * @param objectSet - The base ObjectSet\n * @param options - Optional observation options (where, orderBy, etc.)\n * @returns A stable string key representing the ObjectSet and options\n */\nexport function computeObjectSetCacheKey<\n T extends ObjectOrInterfaceDefinition,\n BaseRDPs extends\n | Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>>\n | BaseObjectSet<T> = never,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n>(\n objectSet: ObjectSet<T, BaseRDPs>,\n options?: ObserveObjectSetOptions<T, RDPs>,\n): string {\n const keyParts: Array<unknown> = [\n \"objectSet\",\n getWireObjectSet(objectSet as unknown as ObjectSet<any>),\n ];\n\n if (!options) {\n return JSON.stringify(keyParts);\n }\n\n if (options.where) {\n keyParts.push(\"where\", whereCanonicalizer.canonicalize(options.where));\n }\n\n if (options.withProperties) {\n const propKeys = Object.keys(options.withProperties).sort();\n keyParts.push(\"props\", propKeys);\n }\n\n if (options.union && options.union.length > 0) {\n keyParts.push(\n \"union\",\n options.union.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.intersect && options.intersect.length > 0) {\n keyParts.push(\n \"intersect\",\n options.intersect.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.subtract && options.subtract.length > 0) {\n keyParts.push(\n \"subtract\",\n options.subtract.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.pivotTo) {\n keyParts.push(\"pivotTo\", options.pivotTo);\n }\n\n if (options.orderBy) {\n keyParts.push(\n \"orderBy\",\n orderByCanonicalizer.canonicalize(options.orderBy),\n );\n }\n\n if (options.pageSize) {\n keyParts.push(\"pageSize\", options.pageSize);\n }\n\n return JSON.stringify(keyParts);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,gBAAgB,QAAQ,iCAAiC;AAElE,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,wBAAwB,QAAQ,wCAAwC;AAEjF,MAAMC,kBAAkB,GAAG,IAAID,wBAAwB,CAAC,CAAC;AACzD,MAAME,oBAAoB,GAAG,IAAIH,oBAAoB,CAAC,CAAC;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,wBAAwBA,CAUtCC,SAAiC,EACjCC,OAA0C,EAClC;EACR,MAAMC,QAAwB,GAAG,CAC/B,WAAW,EACXR,gBAAgB,CAACM,SAAsC,CAAC,CACzD;EAED,IAAI,CAACC,OAAO,EAAE;IACZ,OAAOE,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC;EACjC;EAEA,IAAID,OAAO,CAACI,KAAK,EAAE;IACjBH,QAAQ,CAACI,IAAI,CAAC,OAAO,EAAET,kBAAkB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A,IAAInB,OAAO,CAACoB,QAAQ,EAAE;IACpBnB,QAAQ,CAACI,IAAI,CAAC,UAAU,EAAEL,OAAO,CAACoB,QAAQ,CAAC;EAC7C;EAEA,OAAOlB,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC;AACjC","ignoreList":[]}
@@ -64,7 +64,7 @@ export class ListQueryView {
64
64
  next: payload => {
65
65
  this.#lastPayload = payload;
66
66
  observer.next?.(this.#transformPayload(payload));
67
- if (!this.#hasAutoFetch && payload.status === "loaded" && payload.resolvedList.length < this.#viewLimit && this.#query.hasMorePages()) {
67
+ if (!this.#hasAutoFetch && payload.status === "loaded" && (payload.resolvedList?.length ?? 0) < this.#viewLimit && this.#query.hasMorePages()) {
68
68
  void this.#query.fetchMore();
69
69
  }
70
70
  },
@@ -86,10 +86,11 @@ export class ListQueryView {
86
86
  }
87
87
  }
88
88
  #transformPayload(payload) {
89
- const loadedCount = payload.resolvedList.length;
89
+ const resolvedList = payload.resolvedList;
90
+ const loadedCount = resolvedList?.length ?? 0;
90
91
  return {
91
92
  ...payload,
92
- resolvedList: payload.resolvedList.slice(0, this.#viewLimit),
93
+ resolvedList: resolvedList?.slice(0, this.#viewLimit),
93
94
  hasMore: this.#viewLimit < loadedCount || payload.hasMore,
94
95
  fetchMore: this.#fetchMore,
95
96
  status: loadedCount >= this.#viewLimit && payload.status === "loading" ? "loaded" : payload.status
@@ -1 +1 @@
1
- {"version":3,"file":"ListQueryView.js","names":["viewIdCounter","ListQueryView","query","viewLimit","pageSize","viewId","hasAutoFetch","fetchMore","pendingFetchMore","lastPayload","observer","constructor","autoFetchMore","Number","MAX_SAFE_INTEGER","createFetchMore","registerFetchPageSize","subscribe","sub","next","payload","transformPayload","status","resolvedList","length","hasMorePages","error","err","complete","add","unregisterFetchPageSize","undefined","reEmitWithNewViewLimit","#reEmitWithNewViewLimit","#transformPayload","loadedCount","slice","hasMore","#createFetchMore","getLoadedCount","hasMoreOnServer","finally","Promise","resolve"],"sources":["ListQueryView.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 { Subscription } from \"rxjs\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { BaseListPayloadShape } from \"./base-list/BaseListQuery.js\";\n\n/**\n * Interface for the query methods that ListQueryView needs.\n * This allows ListQueryView to work with any query that supports these operations.\n */\nexport interface ListQueryViewTarget<PAYLOAD extends BaseListPayloadShape> {\n subscribe(observer: Observer<PAYLOAD>): Subscription;\n registerFetchPageSize(viewId: string, pageSize: number): void;\n unregisterFetchPageSize(viewId: string): void;\n getLoadedCount(): number;\n hasMorePages(): boolean;\n notifySubscribers(): void;\n fetchMore(): Promise<void>;\n}\n\n/**\n * A view into a shared ListQuery cache.\n *\n * Each subscriber gets their own View instance that tracks how much of the\n * shared cache they want to see (viewLimit). This allows multiple components\n * with different pageSize requirements to share the same underlying cache.\n *\n * The View:\n * - Slices the shared data to the subscriber's viewLimit\n * - Provides a fetchMore that increments viewLimit and fetches if needed\n * - Reports hasMore based on both local viewLimit and server pagination\n */\nlet viewIdCounter = 0;\n\nexport class ListQueryView<PAYLOAD extends BaseListPayloadShape> {\n #query: ListQueryViewTarget<PAYLOAD>;\n #viewLimit: number;\n #pageSize: number;\n #viewId: string;\n #hasAutoFetch: boolean;\n #fetchMore: () => Promise<void>;\n #pendingFetchMore: Promise<void> | undefined;\n #lastPayload: PAYLOAD | undefined;\n #observer: Observer<PAYLOAD> | undefined;\n\n constructor(\n query: ListQueryViewTarget<PAYLOAD>,\n pageSize: number,\n autoFetchMore?: boolean | number,\n ) {\n this.#query = query;\n this.#pageSize = pageSize;\n this.#viewId = `view_${++viewIdCounter}`;\n\n // With autoFetchMore, subscriber sees all loaded data (no view limit)\n // Otherwise, limit to their pageSize\n this.#hasAutoFetch = autoFetchMore === true\n || (typeof autoFetchMore === \"number\" && autoFetchMore > 0);\n this.#viewLimit = this.#hasAutoFetch ? Number.MAX_SAFE_INTEGER : pageSize;\n\n // Memoize fetchMore to maintain stable function identity\n this.#fetchMore = this.#createFetchMore();\n\n // Tell the query to fetch with at least this pageSize\n query.registerFetchPageSize(this.#viewId, pageSize);\n }\n\n subscribe(observer: Observer<PAYLOAD>): Subscription {\n this.#observer = observer;\n const sub = this.#query.subscribe({\n next: (payload) => {\n this.#lastPayload = payload;\n observer.next?.(this.#transformPayload(payload));\n\n if (\n !this.#hasAutoFetch\n && payload.status === \"loaded\"\n && payload.resolvedList.length < this.#viewLimit\n && this.#query.hasMorePages()\n ) {\n void this.#query.fetchMore();\n }\n },\n error: (err) => observer.error?.(err),\n complete: () => observer.complete?.(),\n });\n\n // Cleanup: unregister pageSize when subscriber unsubscribes\n sub.add(() => {\n this.#query.unregisterFetchPageSize(this.#viewId);\n this.#observer = undefined;\n this.#lastPayload = undefined;\n });\n\n return sub;\n }\n\n #reEmitWithNewViewLimit(): void {\n if (this.#lastPayload && this.#observer) {\n this.#observer.next?.(this.#transformPayload(this.#lastPayload));\n }\n }\n\n #transformPayload(payload: PAYLOAD): PAYLOAD {\n const loadedCount = payload.resolvedList.length;\n\n return {\n ...payload,\n resolvedList: payload.resolvedList.slice(0, this.#viewLimit),\n hasMore: this.#viewLimit < loadedCount || payload.hasMore,\n fetchMore: this.#fetchMore,\n status: loadedCount >= this.#viewLimit && payload.status === \"loading\"\n ? \"loaded\"\n : payload.status,\n };\n }\n\n #createFetchMore(): () => Promise<void> {\n return () => {\n if (this.#pendingFetchMore) {\n return this.#pendingFetchMore;\n }\n\n this.#viewLimit += this.#pageSize;\n\n const loadedCount = this.#query.getLoadedCount();\n const hasMoreOnServer = this.#query.hasMorePages();\n\n if (this.#viewLimit > loadedCount && hasMoreOnServer) {\n // Need to fetch more data from server\n this.#pendingFetchMore = this.#query.fetchMore().finally(() => {\n this.#pendingFetchMore = undefined;\n });\n return this.#pendingFetchMore;\n }\n\n // We have enough data in cache, just re-emit with new viewLimit (sync)\n this.#reEmitWithNewViewLimit();\n return Promise.resolve();\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,aAAa,GAAG,CAAC;AAErB,OAAO,MAAMC,aAAa,CAAuC;EAC/D,CAACC,KAAK;EACN,CAACC,SAAS;EACV,CAACC,QAAQ;EACT,CAACC,MAAM;EACP,CAACC,YAAY;EACb,CAACC,SAAS;EACV,CAACC,gBAAgB;EACjB,CAACC,WAAW;EACZ,CAACC,QAAQ;EAETC,WAAWA,CACTT,KAAmC,EACnCE,QAAgB,EAChBQ,aAAgC,EAChC;IACA,IAAI,CAAC,CAACV,KAAK,GAAGA,KAAK;IACnB,IAAI,CAAC,CAACE,QAAQ,GAAGA,QAAQ;IACzB,IAAI,CAAC,CAACC,MAAM,GAAG,QAAQ,EAAEL,aAAa,EAAE;;IAExC;IACA;IACA,IAAI,CAAC,CAACM,YAAY,GAAGM,aAAa,KAAK,IAAI,IACrC,OAAOA,aAAa,KAAK,QAAQ,IAAIA,aAAa,GAAG,CAAE;IAC7D,IAAI,CAAC,CAACT,SAAS,GAAG,IAAI,CAAC,CAACG,YAAY,GAAGO,MAAM,CAACC,gBAAgB,GAAGV,QAAQ;;IAEzE;IACA,IAAI,CAAC,CAACG,SAAS,GAAG,IAAI,CAAC,CAACQ,eAAe,CAAC,CAAC;;IAEzC;IACAb,KAAK,CAACc,qBAAqB,CAAC,IAAI,CAAC,CAACX,MAAM,EAAED,Q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AAI,CAAC,CAACwB,sBAAsB,CAAC,CAAC;MAC9B,OAAOU,OAAO,CAACC,OAAO,CAAC,CAAC;IAC1B,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ListQueryView.js","names":["viewIdCounter","ListQueryView","query","viewLimit","pageSize","viewId","hasAutoFetch","fetchMore","pendingFetchMore","lastPayload","observer","constructor","autoFetchMore","Number","MAX_SAFE_INTEGER","createFetchMore","registerFetchPageSize","subscribe","sub","next","payload","transformPayload","status","resolvedList","length","hasMorePages","error","err","complete","add","unregisterFetchPageSize","undefined","reEmitWithNewViewLimit","#reEmitWithNewViewLimit","#transformPayload","loadedCount","slice","hasMore","#createFetchMore","getLoadedCount","hasMoreOnServer","finally","Promise","resolve"],"sources":["ListQueryView.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 { Subscription } from \"rxjs\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { BaseListPayloadShape } from \"./base-list/BaseListQuery.js\";\n\n/**\n * Interface for the query methods that ListQueryView needs.\n * This allows ListQueryView to work with any query that supports these operations.\n */\nexport interface ListQueryViewTarget<PAYLOAD extends BaseListPayloadShape> {\n subscribe(observer: Observer<PAYLOAD>): Subscription;\n registerFetchPageSize(viewId: string, pageSize: number): void;\n unregisterFetchPageSize(viewId: string): void;\n getLoadedCount(): number;\n hasMorePages(): boolean;\n notifySubscribers(): void;\n fetchMore(): Promise<void>;\n}\n\n/**\n * A view into a shared ListQuery cache.\n *\n * Each subscriber gets their own View instance that tracks how much of the\n * shared cache they want to see (viewLimit). This allows multiple components\n * with different pageSize requirements to share the same underlying cache.\n *\n * The View:\n * - Slices the shared data to the subscriber's viewLimit\n * - Provides a fetchMore that increments viewLimit and fetches if needed\n * - Reports hasMore based on both local viewLimit and server pagination\n */\nlet viewIdCounter = 0;\n\nexport class ListQueryView<PAYLOAD extends BaseListPayloadShape> {\n #query: ListQueryViewTarget<PAYLOAD>;\n #viewLimit: number;\n #pageSize: number;\n #viewId: string;\n #hasAutoFetch: boolean;\n #fetchMore: () => Promise<void>;\n #pendingFetchMore: Promise<void> | undefined;\n #lastPayload: PAYLOAD | undefined;\n #observer: Observer<PAYLOAD> | undefined;\n\n constructor(\n query: ListQueryViewTarget<PAYLOAD>,\n pageSize: number,\n autoFetchMore?: boolean | number,\n ) {\n this.#query = query;\n this.#pageSize = pageSize;\n this.#viewId = `view_${++viewIdCounter}`;\n\n // With autoFetchMore, subscriber sees all loaded data (no view limit)\n // Otherwise, limit to their pageSize\n this.#hasAutoFetch = autoFetchMore === true\n || (typeof autoFetchMore === \"number\" && autoFetchMore > 0);\n this.#viewLimit = this.#hasAutoFetch ? Number.MAX_SAFE_INTEGER : pageSize;\n\n // Memoize fetchMore to maintain stable function identity\n this.#fetchMore = this.#createFetchMore();\n\n // Tell the query to fetch with at least this pageSize\n query.registerFetchPageSize(this.#viewId, pageSize);\n }\n\n subscribe(observer: Observer<PAYLOAD>): Subscription {\n this.#observer = observer;\n const sub = this.#query.subscribe({\n next: (payload) => {\n this.#lastPayload = payload;\n observer.next?.(this.#transformPayload(payload));\n\n if (\n !this.#hasAutoFetch\n && payload.status === \"loaded\"\n && (payload.resolvedList?.length ?? 0) < this.#viewLimit\n && this.#query.hasMorePages()\n ) {\n void this.#query.fetchMore();\n }\n },\n error: (err) => observer.error?.(err),\n complete: () => observer.complete?.(),\n });\n\n // Cleanup: unregister pageSize when subscriber unsubscribes\n sub.add(() => {\n this.#query.unregisterFetchPageSize(this.#viewId);\n this.#observer = undefined;\n this.#lastPayload = undefined;\n });\n\n return sub;\n }\n\n #reEmitWithNewViewLimit(): void {\n if (this.#lastPayload && this.#observer) {\n this.#observer.next?.(this.#transformPayload(this.#lastPayload));\n }\n }\n\n #transformPayload(payload: PAYLOAD): PAYLOAD {\n const resolvedList = payload.resolvedList;\n const loadedCount = resolvedList?.length ?? 0;\n\n return {\n ...payload,\n resolvedList: resolvedList?.slice(0, this.#viewLimit),\n hasMore: this.#viewLimit < loadedCount || payload.hasMore,\n fetchMore: this.#fetchMore,\n status: loadedCount >= this.#viewLimit && payload.status === \"loading\"\n ? \"loaded\"\n : payload.status,\n };\n }\n\n #createFetchMore(): () => Promise<void> {\n return () => {\n if (this.#pendingFetchMore) {\n return this.#pendingFetchMore;\n }\n\n this.#viewLimit += this.#pageSize;\n\n const loadedCount = this.#query.getLoadedCount();\n const hasMoreOnServer = this.#query.hasMorePages();\n\n if (this.#viewLimit > loadedCount && hasMoreOnServer) {\n // Need to fetch more data from server\n this.#pendingFetchMore = this.#query.fetchMore().finally(() => {\n this.#pendingFetchMore = undefined;\n });\n return this.#pendingFetchMore;\n }\n\n // We have enough data in cache, just re-emit with new viewLimit (sync)\n this.#reEmitWithNewViewLimit();\n return Promise.resolve();\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,aAAa,GAAG,CAAC;AAErB,OAAO,MAAMC,aAAa,CAAuC;EAC/D,CAACC,KAAK;EACN,CAACC,SAAS;EACV,CAACC,QAAQ;EACT,CAACC,MAAM;EACP,CAACC,YAAY;EACb,CAACC,SAAS;EACV,CAACC,gBAAgB;EACjB,CAACC,WAAW;EACZ,CAACC,QAAQ;EAETC,WAAWA,CACTT,KAAmC,EACnCE,QAAgB,EAChBQ,aAAgC,EAChC;IACA,IAAI,CAAC,CAACV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I,CAAC,CAACA,gBAAgB;MAC/B;MAEA,IAAI,CAAC,CAACL,SAAS,IAAI,IAAI,CAAC,CAACC,QAAQ;MAEjC,MAAM+B,WAAW,GAAG,IAAI,CAAC,CAACjC,KAAK,CAACqC,cAAc,CAAC,CAAC;MAChD,MAAMC,eAAe,GAAG,IAAI,CAAC,CAACtC,KAAK,CAACuB,YAAY,CAAC,CAAC;MAElD,IAAI,IAAI,CAAC,CAACtB,SAAS,GAAGgC,WAAW,IAAIK,eAAe,EAAE;QACpD;QACA,IAAI,CAAC,CAAChC,gBAAgB,GAAG,IAAI,CAAC,CAACN,KAAK,CAACK,SAAS,CAAC,CAAC,CAACkC,OAAO,CAAC,MAAM;UAC7D,IAAI,CAAC,CAACjC,gBAAgB,GAAGuB,SAAS;QACpC,CAAC,CAAC;QACF,OAAO,IAAI,CAAC,CAACvB,gBAAgB;MAC/B;;MAEA;MACA,IAAI,CAAC,CAACwB,sBAAsB,CAAC,CAAC;MAC9B,OAAOU,OAAO,CAACC,OAAO,CAAC,CAAC;IAC1B,CAAC;EACH;AACF","ignoreList":[]}
@@ -159,7 +159,7 @@ function observeMultiLinks(store, objectsArray, linkName, options, observer) {
159
159
  let hasMore = false;
160
160
  let isOptimistic = false;
161
161
  for (const payload of perObjectResults.values()) {
162
- for (const obj of payload.resolvedList) {
162
+ for (const obj of payload.resolvedList ?? []) {
163
163
  seen.set(`${obj.$objectType}:${obj.$primaryKey}`, obj);
164
164
  }
165
165
  if (payload.lastUpdated > latestUpdated) {
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableClientImpl.js","names":["Subscription","additionalContext","getWireObjectSet","isObjectSet","extractObjectOrInterfaceType","UnsubscribableWrapper","ObservableClientImpl","constructor","store","__experimentalStore","applyAction","bind","validateAction","observeObject","apiName","pk","options","subFn","objects","observe","observeList","lists","observeAggregation","objectSet","aggregations","observeAsync","observeFunction","queryDef","params","dependsOn","map","dep","instances","objectSetWires","item","dependsOnObjects","push","$apiName","$objectType","$primaryKey","objectSetTypesPromise","length","Promise","all","wire","client","then","types","filter","t","undefined","functions","observeLinks","linkName","objectsArray","Array","isArray","observer","observeSingleLink","observeMultiLinks","observeObjectSet","baseObjectSet","objectSets","invalidateAll","invalidateObjects","invalidateObjectType","type","invalidateFunction","invalidateFunctionsByObject","primaryKey","canonicalizeWhereClause","where","whereCanonicalizer","canonicalize","next","resolvedList","isOptimistic","lastUpdated","fetchMore","resolve","hasMore","status","totalCount","parentSub","obj","sourceType","add","links","srcType","sourceUnderlyingObjectType","totalExpected","perObjectResults","Map","errored","mergeAndEmit","seen","fetchMores","latestUpdated","payload","values","set","payloads","loading","size","some","p","from","fn","String","objKey","error","err","unsubscribe","complete"],"sources":["ObservableClientImpl.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n CompileTimeMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { Subscription } from \"rxjs\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport { additionalContext } from \"../../Client.js\";\nimport {\n getWireObjectSet,\n isObjectSet,\n} from \"../../objectSet/createObjectSet.js\";\nimport { extractObjectOrInterfaceType } from \"../../util/extractObjectOrInterfaceType.js\";\nimport type { FunctionPayload } from \"../FunctionPayload.js\";\nimport type { SpecificLinkPayload } from \"../LinkPayload.js\";\nimport type { ListPayload } from \"../ListPayload.js\";\nimport type { ObjectPayload } from \"../ObjectPayload.js\";\nimport type { ObjectSetPayload } from \"../ObjectSetPayload.js\";\nimport type {\n ObservableClient,\n ObserveAggregationArgs,\n ObserveAggregationOptions,\n ObserveAggregationOptionsWithObjectSet,\n ObserveFunctionCallbackArgs,\n ObserveFunctionOptions,\n ObserveListOptions,\n ObserveObjectCallbackArgs,\n ObserveObjectOptions,\n ObserveObjectsCallbackArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../ObservableClient.js\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { ObserveLinks } from \"../ObservableClient/ObserveLink.js\";\nimport type { AggregationPayloadBase } from \"./aggregation/AggregationQuery.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./objectset/ObjectSetQueryOptions.js\";\nimport type { Store } from \"./Store.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\n/**\n * Implementation of the public ObservableClient interface.\n * - Delegates all operations to the Store for consistency\n * - Serves as the entry point for reactive data management\n * - Ensures proper method binding and API exposure\n *\n * @internal\n */\nexport class ObservableClientImpl implements ObservableClient {\n __experimentalStore: Store;\n\n constructor(store: Store) {\n this.__experimentalStore = store;\n\n this.applyAction = store.applyAction.bind(store);\n this.validateAction = store.validateAction.bind(store);\n }\n\n public observeObject: <T extends ObjectOrInterfaceDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ) => Unsubscribable = (apiName, pk, options, subFn) => {\n return this.__experimentalStore.objects.observe(\n {\n ...options,\n apiName,\n pk,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectPayload>,\n );\n };\n\n public observeList: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ) => Unsubscribable = (options, subFn) => {\n return this.__experimentalStore.lists.observe(\n options,\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ListPayload>,\n );\n };\n\n public observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n public observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Promise<Unsubscribable>;\n public observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options:\n | ObserveAggregationOptions<T, A, RDPs>\n | ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable | Promise<Unsubscribable> {\n if (options.objectSet) {\n return this.__experimentalStore.aggregations.observeAsync(\n options as ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn as Observer<AggregationPayloadBase>,\n );\n }\n return this.__experimentalStore.aggregations.observe(\n options as ObserveAggregationOptions<T, A, RDPs>,\n subFn as Observer<AggregationPayloadBase>,\n );\n }\n\n public observeFunction: <Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n params: Record<string, unknown> | undefined,\n options: ObserveFunctionOptions,\n subFn: Observer<ObserveFunctionCallbackArgs<Q>>,\n ) => Unsubscribable = (queryDef, params, options, subFn) => {\n const dependsOn = options.dependsOn?.map(dep =>\n typeof dep === \"string\" ? dep : dep.apiName\n );\n\n // Partition dependsOnObjects into instances vs ObjectSets\n type ObjectDependency = { $apiName: string; $primaryKey: string | number };\n const instances: ObjectDependency[] = [];\n const objectSetWires: Array<\n ReturnType<typeof getWireObjectSet>\n > = [];\n\n for (const item of options.dependsOnObjects ?? []) {\n if (isObjectSet(item)) {\n objectSetWires.push(getWireObjectSet(item));\n } else {\n instances.push({\n $apiName: item.$objectType ?? item.$apiName,\n $primaryKey: item.$primaryKey,\n });\n }\n }\n\n // Start async extraction of ObjectSet types\n const objectSetTypesPromise = objectSetWires.length > 0\n ? Promise.all(\n objectSetWires.map(wire =>\n extractObjectOrInterfaceType(\n this.__experimentalStore.client[additionalContext],\n wire,\n )\n ),\n ).then(types =>\n types\n .filter((t): t is NonNullable<typeof t> => t != null)\n .map(t => t.apiName)\n )\n : undefined;\n\n return this.__experimentalStore.functions.observe(\n {\n ...options,\n queryDef,\n params,\n dependsOn,\n dependsOnObjects: instances,\n objectSetTypesPromise,\n },\n subFn as unknown as Observer<FunctionPayload>,\n );\n };\n\n public observeLinks: <\n T extends ObjectOrInterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | Array<Osdk.Instance<T>>,\n linkName: L,\n options: ObserveLinks.Options<T, L>,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ) => Unsubscribable = (objects, linkName, options, subFn) => {\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n const observer = subFn as unknown as Observer<SpecificLinkPayload>;\n\n return objectsArray.length <= 1\n ? observeSingleLink(\n this.__experimentalStore,\n objectsArray,\n linkName,\n options,\n observer,\n )\n : observeMultiLinks(\n this.__experimentalStore,\n objectsArray,\n linkName,\n options,\n observer,\n );\n };\n\n public applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n public validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n public observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable {\n return this.__experimentalStore.objectSets.observe(\n { baseObjectSet, ...options },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectSetPayload>,\n );\n }\n\n public invalidateAll(): Promise<void> {\n return this.__experimentalStore.invalidateAll();\n }\n\n public invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjects(objects);\n }\n\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjectType(type, undefined);\n }\n\n public invalidateFunction(\n apiName: string | QueryDefinition<unknown>,\n params?: Record<string, unknown>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateFunction(apiName, params);\n }\n\n public invalidateFunctionsByObject(\n apiName: string,\n primaryKey: string | number,\n ): Promise<void> {\n return this.__experimentalStore.invalidateFunctionsByObject(\n apiName,\n primaryKey,\n );\n }\n\n public canonicalizeWhereClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(where: WhereClause<T, RDPs>): Canonical<WhereClause<T, RDPs>> {\n return this.__experimentalStore.whereCanonicalizer\n .canonicalize(where) as Canonical<WhereClause<T, RDPs>>;\n }\n}\n\nfunction observeSingleLink(\n store: Store,\n objectsArray: ReadonlyArray<Osdk.Instance<ObjectOrInterfaceDefinition>>,\n linkName: string,\n options: ObserveLinks.Options<ObjectOrInterfaceDefinition, string>,\n observer: Observer<SpecificLinkPayload>,\n): Unsubscribable {\n if (objectsArray.length === 0) {\n observer.next({\n resolvedList: [],\n isOptimistic: false,\n lastUpdated: 0,\n fetchMore: () => Promise.resolve(),\n hasMore: false,\n status: \"loaded\",\n totalCount: \"0\",\n });\n return new UnsubscribableWrapper(new Subscription());\n }\n\n const parentSub = new Subscription();\n\n for (const obj of objectsArray) {\n const sourceType: \"object\" | \"interface\" = obj.$apiName === obj.$objectType\n ? \"object\"\n : \"interface\";\n\n parentSub.add(\n store.links.observe(\n {\n ...options,\n srcType: {\n type: sourceType,\n apiName: obj.$apiName,\n },\n sourceUnderlyingObjectType: obj.$objectType,\n linkName,\n pk: obj.$primaryKey,\n },\n observer,\n ),\n );\n }\n\n return new UnsubscribableWrapper(parentSub);\n}\n\nfunction observeMultiLinks(\n store: Store,\n objectsArray: ReadonlyArray<Osdk.Instance<ObjectOrInterfaceDefinition>>,\n linkName: string,\n options: ObserveLinks.Options<ObjectOrInterfaceDefinition, string>,\n observer: Observer<SpecificLinkPayload>,\n): Unsubscribable {\n const parentSub = new Subscription();\n const totalExpected = objectsArray.length;\n const perObjectResults = new Map<string, SpecificLinkPayload>();\n let errored = false;\n\n function mergeAndEmit() {\n if (errored) {\n return;\n }\n\n const seen = new Map<string, SpecificLinkPayload[\"resolvedList\"][number]>();\n const fetchMores: Array<() => Promise<void>> = [];\n let latestUpdated = 0;\n let hasMore = false;\n let isOptimistic = false;\n\n for (const payload of perObjectResults.values()) {\n for (const obj of payload.resolvedList) {\n seen.set(`${obj.$objectType}:${obj.$primaryKey}`, obj);\n }\n if (payload.lastUpdated > latestUpdated) {\n latestUpdated = payload.lastUpdated;\n }\n if (payload.isOptimistic) {\n isOptimistic = true;\n }\n if (payload.hasMore) {\n hasMore = true;\n fetchMores.push(payload.fetchMore);\n }\n }\n\n const payloads = [...perObjectResults.values()];\n const loading = perObjectResults.size < totalExpected\n || payloads.some(p => p.status === \"init\" || p.status === \"loading\");\n\n observer.next({\n resolvedList: Array.from(seen.values()),\n isOptimistic,\n lastUpdated: latestUpdated,\n fetchMore: hasMore\n ? () => Promise.all(fetchMores.map(fn => fn())).then(() => {})\n : () => Promise.resolve(),\n hasMore,\n status: loading\n ? \"loading\"\n : payloads.some(p => p.status === \"error\")\n ? \"error\"\n : \"loaded\",\n ...(!hasMore ? { totalCount: String(seen.size) } : {}),\n });\n }\n\n for (const obj of objectsArray) {\n const objKey = `${obj.$objectType ?? obj.$apiName}:${obj.$primaryKey}`;\n\n const sourceType: \"object\" | \"interface\" = obj.$apiName === obj.$objectType\n ? \"object\"\n : \"interface\";\n\n parentSub.add(\n store.links.observe(\n {\n ...options,\n srcType: {\n type: sourceType,\n apiName: obj.$apiName,\n },\n sourceUnderlyingObjectType: obj.$objectType,\n linkName,\n pk: obj.$primaryKey,\n },\n {\n next: (payload: SpecificLinkPayload) => {\n if (errored) {\n return;\n }\n perObjectResults.set(objKey, payload);\n mergeAndEmit();\n },\n error: (err: unknown) => {\n if (errored) {\n return;\n }\n errored = true;\n parentSub.unsubscribe();\n observer.error(err);\n },\n // store link queries are long-lived and do not complete\n complete: () => {},\n },\n ),\n );\n }\n\n return new UnsubscribableWrapper(parentSub);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,SAASA,YAAY,QAAQ,MAAM;AAEnC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SACEC,gBAAgB,EAChBC,WAAW,QACN,oCAAoC;AAC3C,SAASC,4BAA4B,QAAQ,4CAA4C;AA0BzF,SAASC,qBAAqB,QAAQ,4BAA4B;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAA6B;EAG5DC,WAAWA,CAACC,KAAY,EAAE;IACxB,IAAI,CAACC,mBAAmB,GAAGD,KAAK;IAEhC,IAAI,CAACE,WAAW,GAAGF,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,IAAIlB,OAAO,EAAE;UACX;QACF;QACAA,OAAO,GAAG,IAAI;QACdV,SAAS,CAAC6B,WAAW,CAAC,CAAC;QACvBvD,QAAQ,CAACqD,KAAK,CAACC,GAAG,CAAC;MACrB,CAAC;MACD;MACAE,QAAQ,EAAEA,CAAA,KAAM,CAAC;IACnB,CACF,CACF,CAAC;EACH;EAEA,OAAO,IAAI5G,qBAAqB,CAAC8E,SAAS,CAAC;AAC7C","ignoreList":[]}
1
+ {"version":3,"file":"ObservableClientImpl.js","names":["Subscription","additionalContext","getWireObjectSet","isObjectSet","extractObjectOrInterfaceType","UnsubscribableWrapper","ObservableClientImpl","constructor","store","__experimentalStore","applyAction","bind","validateAction","observeObject","apiName","pk","options","subFn","objects","observe","observeList","lists","observeAggregation","objectSet","aggregations","observeAsync","observeFunction","queryDef","params","dependsOn","map","dep","instances","objectSetWires","item","dependsOnObjects","push","$apiName","$objectType","$primaryKey","objectSetTypesPromise","length","Promise","all","wire","client","then","types","filter","t","undefined","functions","observeLinks","linkName","objectsArray","Array","isArray","observer","observeSingleLink","observeMultiLinks","observeObjectSet","baseObjectSet","objectSets","invalidateAll","invalidateObjects","invalidateObjectType","type","invalidateFunction","invalidateFunctionsByObject","primaryKey","canonicalizeWhereClause","where","whereCanonicalizer","canonicalize","next","resolvedList","isOptimistic","lastUpdated","fetchMore","resolve","hasMore","status","totalCount","parentSub","obj","sourceType","add","links","srcType","sourceUnderlyingObjectType","totalExpected","perObjectResults","Map","errored","mergeAndEmit","seen","fetchMores","latestUpdated","payload","values","set","payloads","loading","size","some","p","from","fn","String","objKey","error","err","unsubscribe","complete"],"sources":["ObservableClientImpl.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n CompileTimeMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { Subscription } from \"rxjs\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport { additionalContext } from \"../../Client.js\";\nimport {\n getWireObjectSet,\n isObjectSet,\n} from \"../../objectSet/createObjectSet.js\";\nimport { extractObjectOrInterfaceType } from \"../../util/extractObjectOrInterfaceType.js\";\nimport type { FunctionPayload } from \"../FunctionPayload.js\";\nimport type { SpecificLinkPayload } from \"../LinkPayload.js\";\nimport type { ListPayload } from \"../ListPayload.js\";\nimport type { ObjectPayload } from \"../ObjectPayload.js\";\nimport type { ObjectSetPayload } from \"../ObjectSetPayload.js\";\nimport type {\n ObservableClient,\n ObserveAggregationArgs,\n ObserveAggregationOptions,\n ObserveAggregationOptionsWithObjectSet,\n ObserveFunctionCallbackArgs,\n ObserveFunctionOptions,\n ObserveListOptions,\n ObserveObjectCallbackArgs,\n ObserveObjectOptions,\n ObserveObjectsCallbackArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../ObservableClient.js\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { ObserveLinks } from \"../ObservableClient/ObserveLink.js\";\nimport type { AggregationPayloadBase } from \"./aggregation/AggregationQuery.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./objectset/ObjectSetQueryOptions.js\";\nimport type { Store } from \"./Store.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\n/**\n * Implementation of the public ObservableClient interface.\n * - Delegates all operations to the Store for consistency\n * - Serves as the entry point for reactive data management\n * - Ensures proper method binding and API exposure\n *\n * @internal\n */\nexport class ObservableClientImpl implements ObservableClient {\n __experimentalStore: Store;\n\n constructor(store: Store) {\n this.__experimentalStore = store;\n\n this.applyAction = store.applyAction.bind(store);\n this.validateAction = store.validateAction.bind(store);\n }\n\n public observeObject: <T extends ObjectOrInterfaceDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ) => Unsubscribable = (apiName, pk, options, subFn) => {\n return this.__experimentalStore.objects.observe(\n {\n ...options,\n apiName,\n pk,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectPayload>,\n );\n };\n\n public observeList: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ) => Unsubscribable = (options, subFn) => {\n return this.__experimentalStore.lists.observe(\n options,\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ListPayload>,\n );\n };\n\n public observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n public observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Promise<Unsubscribable>;\n public observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options:\n | ObserveAggregationOptions<T, A, RDPs>\n | ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable | Promise<Unsubscribable> {\n if (options.objectSet) {\n return this.__experimentalStore.aggregations.observeAsync(\n options as ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn as Observer<AggregationPayloadBase>,\n );\n }\n return this.__experimentalStore.aggregations.observe(\n options as ObserveAggregationOptions<T, A, RDPs>,\n subFn as Observer<AggregationPayloadBase>,\n );\n }\n\n public observeFunction: <Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n params: Record<string, unknown> | undefined,\n options: ObserveFunctionOptions,\n subFn: Observer<ObserveFunctionCallbackArgs<Q>>,\n ) => Unsubscribable = (queryDef, params, options, subFn) => {\n const dependsOn = options.dependsOn?.map(dep =>\n typeof dep === \"string\" ? dep : dep.apiName\n );\n\n // Partition dependsOnObjects into instances vs ObjectSets\n type ObjectDependency = { $apiName: string; $primaryKey: string | number };\n const instances: ObjectDependency[] = [];\n const objectSetWires: Array<\n ReturnType<typeof getWireObjectSet>\n > = [];\n\n for (const item of options.dependsOnObjects ?? []) {\n if (isObjectSet(item)) {\n objectSetWires.push(getWireObjectSet(item));\n } else {\n instances.push({\n $apiName: item.$objectType ?? item.$apiName,\n $primaryKey: item.$primaryKey,\n });\n }\n }\n\n // Start async extraction of ObjectSet types\n const objectSetTypesPromise = objectSetWires.length > 0\n ? Promise.all(\n objectSetWires.map(wire =>\n extractObjectOrInterfaceType(\n this.__experimentalStore.client[additionalContext],\n wire,\n )\n ),\n ).then(types =>\n types\n .filter((t): t is NonNullable<typeof t> => t != null)\n .map(t => t.apiName)\n )\n : undefined;\n\n return this.__experimentalStore.functions.observe(\n {\n ...options,\n queryDef,\n params,\n dependsOn,\n dependsOnObjects: instances,\n objectSetTypesPromise,\n },\n subFn as unknown as Observer<FunctionPayload>,\n );\n };\n\n public observeLinks: <\n T extends ObjectOrInterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | Array<Osdk.Instance<T>>,\n linkName: L,\n options: ObserveLinks.Options<T, L>,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ) => Unsubscribable = (objects, linkName, options, subFn) => {\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n const observer = subFn as unknown as Observer<SpecificLinkPayload>;\n\n return objectsArray.length <= 1\n ? observeSingleLink(\n this.__experimentalStore,\n objectsArray,\n linkName,\n options,\n observer,\n )\n : observeMultiLinks(\n this.__experimentalStore,\n objectsArray,\n linkName,\n options,\n observer,\n );\n };\n\n public applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n public validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n public observeObjectSet<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable {\n return this.__experimentalStore.objectSets.observe(\n { baseObjectSet, ...options },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectSetPayload>,\n );\n }\n\n public invalidateAll(): Promise<void> {\n return this.__experimentalStore.invalidateAll();\n }\n\n public invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjects(objects);\n }\n\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjectType(type, undefined);\n }\n\n public invalidateFunction(\n apiName: string | QueryDefinition<unknown>,\n params?: Record<string, unknown>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateFunction(apiName, params);\n }\n\n public invalidateFunctionsByObject(\n apiName: string,\n primaryKey: string | number,\n ): Promise<void> {\n return this.__experimentalStore.invalidateFunctionsByObject(\n apiName,\n primaryKey,\n );\n }\n\n public canonicalizeWhereClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(where: WhereClause<T, RDPs>): Canonical<WhereClause<T, RDPs>> {\n return this.__experimentalStore.whereCanonicalizer\n .canonicalize(where) as Canonical<WhereClause<T, RDPs>>;\n }\n}\n\nfunction observeSingleLink(\n store: Store,\n objectsArray: ReadonlyArray<Osdk.Instance<ObjectOrInterfaceDefinition>>,\n linkName: string,\n options: ObserveLinks.Options<ObjectOrInterfaceDefinition, string>,\n observer: Observer<SpecificLinkPayload>,\n): Unsubscribable {\n if (objectsArray.length === 0) {\n observer.next({\n resolvedList: [],\n isOptimistic: false,\n lastUpdated: 0,\n fetchMore: () => Promise.resolve(),\n hasMore: false,\n status: \"loaded\",\n totalCount: \"0\",\n });\n return new UnsubscribableWrapper(new Subscription());\n }\n\n const parentSub = new Subscription();\n\n for (const obj of objectsArray) {\n const sourceType: \"object\" | \"interface\" = obj.$apiName === obj.$objectType\n ? \"object\"\n : \"interface\";\n\n parentSub.add(\n store.links.observe(\n {\n ...options,\n srcType: {\n type: sourceType,\n apiName: obj.$apiName,\n },\n sourceUnderlyingObjectType: obj.$objectType,\n linkName,\n pk: obj.$primaryKey,\n },\n observer,\n ),\n );\n }\n\n return new UnsubscribableWrapper(parentSub);\n}\n\nfunction observeMultiLinks(\n store: Store,\n objectsArray: ReadonlyArray<Osdk.Instance<ObjectOrInterfaceDefinition>>,\n linkName: string,\n options: ObserveLinks.Options<ObjectOrInterfaceDefinition, string>,\n observer: Observer<SpecificLinkPayload>,\n): Unsubscribable {\n const parentSub = new Subscription();\n const totalExpected = objectsArray.length;\n const perObjectResults = new Map<string, SpecificLinkPayload>();\n let errored = false;\n\n function mergeAndEmit() {\n if (errored) {\n return;\n }\n\n const seen = new Map<\n string,\n NonNullable<SpecificLinkPayload[\"resolvedList\"]>[number]\n >();\n const fetchMores: Array<() => Promise<void>> = [];\n let latestUpdated = 0;\n let hasMore = false;\n let isOptimistic = false;\n\n for (const payload of perObjectResults.values()) {\n for (const obj of payload.resolvedList ?? []) {\n seen.set(`${obj.$objectType}:${obj.$primaryKey}`, obj);\n }\n if (payload.lastUpdated > latestUpdated) {\n latestUpdated = payload.lastUpdated;\n }\n if (payload.isOptimistic) {\n isOptimistic = true;\n }\n if (payload.hasMore) {\n hasMore = true;\n fetchMores.push(payload.fetchMore);\n }\n }\n\n const payloads = [...perObjectResults.values()];\n const loading = perObjectResults.size < totalExpected\n || payloads.some(p => p.status === \"init\" || p.status === \"loading\");\n\n observer.next({\n resolvedList: Array.from(seen.values()),\n isOptimistic,\n lastUpdated: latestUpdated,\n fetchMore: hasMore\n ? () => Promise.all(fetchMores.map(fn => fn())).then(() => {})\n : () => Promise.resolve(),\n hasMore,\n status: loading\n ? \"loading\"\n : payloads.some(p => p.status === \"error\")\n ? \"error\"\n : \"loaded\",\n ...(!hasMore ? { totalCount: String(seen.size) } : {}),\n });\n }\n\n for (const obj of objectsArray) {\n const objKey = `${obj.$objectType ?? obj.$apiName}:${obj.$primaryKey}`;\n\n const sourceType: \"object\" | \"interface\" = obj.$apiName === obj.$objectType\n ? \"object\"\n : \"interface\";\n\n parentSub.add(\n store.links.observe(\n {\n ...options,\n srcType: {\n type: sourceType,\n apiName: obj.$apiName,\n },\n sourceUnderlyingObjectType: obj.$objectType,\n linkName,\n pk: obj.$primaryKey,\n },\n {\n next: (payload: SpecificLinkPayload) => {\n if (errored) {\n return;\n }\n perObjectResults.set(objKey, payload);\n mergeAndEmit();\n },\n error: (err: unknown) => {\n if (errored) {\n return;\n }\n errored = true;\n parentSub.unsubscribe();\n observer.error(err);\n },\n // store link queries are long-lived and do not complete\n complete: () => {},\n },\n ),\n );\n }\n\n return new UnsubscribableWrapper(parentSub);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,SAASA,YAAY,QAAQ,MAAM;AAEnC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SACEC,gBAAgB,EAChBC,WAAW,QACN,oCAAoC;AAC3C,SAASC,4BAA4B,QAAQ,4CAA4C;AA0BzF,SAASC,qBAAqB,QAAQ,4BAA4B;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAA6B;EAG5DC,WAAWA,CAACC,KAAY,EAAE;IACxB,IAAI,CAACC,mBAAmB,GAAGD,KAAK;IAEhC,IAAI,CAACE,WAAW,GAAGF,KAAK,CAACE,WAAW,CAACC,IAAI,CAACH,KAAK,CAAC;IAChD,IAAI,CAACI,cAAc,GAAGJ,KAAK,CAACI,cAAc,CAACD,IAAI,CAACH,KAAK,CAAC;EACxD;EAEOK,aAAa,GAKEA,CAACC,OAAO,EAAEC,EAAE,EAAEC,OAAO,EAAEC,KAAK,KAAK;IACrD,OAAO,IAAI,CAACR,mBAAmB,CAACS,OAAO,CAACC,OAAO,CAC7C;MACE,GAAGH,OAAO;MACVF,OAAO;MACPC;IACF,CAAC;IACD;IACAE,KACF,CAAC;EACH,CAAC;EAEMG,WAAW,GAMIA,CAACJ,OAAO,EAAEC,KAAK,KAAK;IACxC,OAAO,IAAI,CAACR,mBAAmB,CAACY,KAAK,CAACF,OAAO,CAC3CH,OAAO;IACP;IACAC,KACF,CAAC;EACH,CAAC;EAkBMK,kBAAkBA,CAKvBN,OAEsD,EACtDC,KAA6C,EACH;IAC1C,IAAID,OAAO,CAACO,SAAS,EAAE;MACrB,OAAO,IAAI,CAACd,mBAA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