@osdk/react 0.10.0-beta.9 → 0.10.1-main-20260406220320

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 (117) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/build/browser/new/OsdkContext2.js +22 -2
  3. package/build/browser/new/OsdkContext2.js.map +1 -1
  4. package/build/browser/new/hookUtils.js +32 -0
  5. package/build/browser/new/hookUtils.js.map +1 -0
  6. package/build/browser/new/platform-apis/admin/useCbacBanner.js +63 -0
  7. package/build/browser/new/platform-apis/admin/useCbacBanner.js.map +1 -0
  8. package/build/browser/new/platform-apis/admin/useCbacMarkingRestrictions.js +64 -0
  9. package/build/browser/new/platform-apis/admin/useCbacMarkingRestrictions.js.map +1 -0
  10. package/build/browser/new/platform-apis/admin/useMarkingCategories.js +46 -0
  11. package/build/browser/new/platform-apis/admin/useMarkingCategories.js.map +1 -0
  12. package/build/browser/new/platform-apis/admin/useMarkings.js +46 -0
  13. package/build/browser/new/platform-apis/admin/useMarkings.js.map +1 -0
  14. package/build/browser/new/platform-apis/admin/useUserMarkings.js +50 -0
  15. package/build/browser/new/platform-apis/admin/useUserMarkings.js.map +1 -0
  16. package/build/browser/new/useLinks.js +13 -10
  17. package/build/browser/new/useLinks.js.map +1 -1
  18. package/build/browser/new/useObjectSet.js +45 -26
  19. package/build/browser/new/useObjectSet.js.map +1 -1
  20. package/build/browser/new/useOsdkAction.js +3 -6
  21. package/build/browser/new/useOsdkAction.js.map +1 -1
  22. package/build/browser/new/useOsdkAggregation.js +32 -38
  23. package/build/browser/new/useOsdkAggregation.js.map +1 -1
  24. package/build/browser/new/useOsdkFunctions.js +137 -0
  25. package/build/browser/new/useOsdkFunctions.js.map +1 -0
  26. package/build/browser/new/useOsdkObject.js +6 -2
  27. package/build/browser/new/useOsdkObject.js.map +1 -1
  28. package/build/browser/new/useOsdkObjects.js +36 -33
  29. package/build/browser/new/useOsdkObjects.js.map +1 -1
  30. package/build/browser/public/experimental/admin.js +5 -0
  31. package/build/browser/public/experimental/admin.js.map +1 -1
  32. package/build/browser/public/unstable-do-not-use.js +18 -0
  33. package/build/browser/public/unstable-do-not-use.js.map +1 -0
  34. package/build/cjs/chunk-2N32USW5.cjs +28 -0
  35. package/build/cjs/chunk-2N32USW5.cjs.map +1 -0
  36. package/build/cjs/chunk-R4FZ5MUH.cjs +34 -0
  37. package/build/cjs/chunk-R4FZ5MUH.cjs.map +1 -0
  38. package/build/cjs/{chunk-SVVMLSKN.cjs → chunk-ZUNR45SJ.cjs} +15 -4
  39. package/build/cjs/chunk-ZUNR45SJ.cjs.map +1 -0
  40. package/build/cjs/index.cjs +7 -6
  41. package/build/cjs/index.cjs.map +1 -1
  42. package/build/cjs/public/experimental/admin.cjs +154 -7
  43. package/build/cjs/public/experimental/admin.cjs.map +1 -1
  44. package/build/cjs/public/experimental/admin.d.cts +159 -2
  45. package/build/cjs/public/experimental.cjs +170 -135
  46. package/build/cjs/public/experimental.cjs.map +1 -1
  47. package/build/cjs/public/experimental.d.cts +21 -124
  48. package/build/cjs/public/unstable-do-not-use.cjs +114 -0
  49. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -0
  50. package/build/cjs/public/unstable-do-not-use.d.cts +35 -0
  51. package/build/cjs/useOsdkFunction-B0s7lqgN.d.cts +121 -0
  52. package/build/esm/new/OsdkContext2.js +22 -2
  53. package/build/esm/new/OsdkContext2.js.map +1 -1
  54. package/build/esm/new/hookUtils.js +32 -0
  55. package/build/esm/new/hookUtils.js.map +1 -0
  56. package/build/esm/new/platform-apis/admin/useCbacBanner.js +63 -0
  57. package/build/esm/new/platform-apis/admin/useCbacBanner.js.map +1 -0
  58. package/build/esm/new/platform-apis/admin/useCbacMarkingRestrictions.js +64 -0
  59. package/build/esm/new/platform-apis/admin/useCbacMarkingRestrictions.js.map +1 -0
  60. package/build/esm/new/platform-apis/admin/useMarkingCategories.js +46 -0
  61. package/build/esm/new/platform-apis/admin/useMarkingCategories.js.map +1 -0
  62. package/build/esm/new/platform-apis/admin/useMarkings.js +46 -0
  63. package/build/esm/new/platform-apis/admin/useMarkings.js.map +1 -0
  64. package/build/esm/new/platform-apis/admin/useUserMarkings.js +50 -0
  65. package/build/esm/new/platform-apis/admin/useUserMarkings.js.map +1 -0
  66. package/build/esm/new/useLinks.js +13 -10
  67. package/build/esm/new/useLinks.js.map +1 -1
  68. package/build/esm/new/useObjectSet.js +45 -26
  69. package/build/esm/new/useObjectSet.js.map +1 -1
  70. package/build/esm/new/useOsdkAction.js +3 -6
  71. package/build/esm/new/useOsdkAction.js.map +1 -1
  72. package/build/esm/new/useOsdkAggregation.js +32 -38
  73. package/build/esm/new/useOsdkAggregation.js.map +1 -1
  74. package/build/esm/new/useOsdkFunctions.js +137 -0
  75. package/build/esm/new/useOsdkFunctions.js.map +1 -0
  76. package/build/esm/new/useOsdkObject.js +6 -2
  77. package/build/esm/new/useOsdkObject.js.map +1 -1
  78. package/build/esm/new/useOsdkObjects.js +36 -33
  79. package/build/esm/new/useOsdkObjects.js.map +1 -1
  80. package/build/esm/public/experimental/admin.js +5 -0
  81. package/build/esm/public/experimental/admin.js.map +1 -1
  82. package/build/esm/public/unstable-do-not-use.js +18 -0
  83. package/build/esm/public/unstable-do-not-use.js.map +1 -0
  84. package/build/types/new/OsdkContext2.d.ts +1 -0
  85. package/build/types/new/OsdkContext2.d.ts.map +1 -1
  86. package/build/types/new/hookUtils.d.ts +7 -0
  87. package/build/types/new/hookUtils.d.ts.map +1 -0
  88. package/build/types/new/platform-apis/admin/useCbacBanner.d.ts +33 -0
  89. package/build/types/new/platform-apis/admin/useCbacBanner.d.ts.map +1 -0
  90. package/build/types/new/platform-apis/admin/useCbacMarkingRestrictions.d.ts +34 -0
  91. package/build/types/new/platform-apis/admin/useCbacMarkingRestrictions.d.ts.map +1 -0
  92. package/build/types/new/platform-apis/admin/useMarkingCategories.d.ts +27 -0
  93. package/build/types/new/platform-apis/admin/useMarkingCategories.d.ts.map +1 -0
  94. package/build/types/new/platform-apis/admin/useMarkings.d.ts +27 -0
  95. package/build/types/new/platform-apis/admin/useMarkings.d.ts.map +1 -0
  96. package/build/types/new/platform-apis/admin/useUserMarkings.d.ts +33 -0
  97. package/build/types/new/platform-apis/admin/useUserMarkings.d.ts.map +1 -0
  98. package/build/types/new/useLinks.d.ts.map +1 -1
  99. package/build/types/new/useObjectSet.d.ts +5 -2
  100. package/build/types/new/useObjectSet.d.ts.map +1 -1
  101. package/build/types/new/useOsdkAggregation.d.ts +1 -1
  102. package/build/types/new/useOsdkAggregation.d.ts.map +1 -1
  103. package/build/types/new/useOsdkFunctions.d.ts +31 -0
  104. package/build/types/new/useOsdkFunctions.d.ts.map +1 -0
  105. package/build/types/new/useOsdkObject.d.ts +2 -1
  106. package/build/types/new/useOsdkObject.d.ts.map +1 -1
  107. package/build/types/new/useOsdkObjects.d.ts +10 -1
  108. package/build/types/new/useOsdkObjects.d.ts.map +1 -1
  109. package/build/types/public/experimental/admin.d.ts +8 -0
  110. package/build/types/public/experimental/admin.d.ts.map +1 -1
  111. package/build/types/public/unstable-do-not-use.d.ts +2 -0
  112. package/build/types/public/unstable-do-not-use.d.ts.map +1 -0
  113. package/package.json +19 -10
  114. package/unstable-do-not-use.d.ts +17 -0
  115. package/build/cjs/chunk-OVBG5VXE.cjs +0 -50
  116. package/build/cjs/chunk-OVBG5VXE.cjs.map +0 -1
  117. package/build/cjs/chunk-SVVMLSKN.cjs.map +0 -1
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkOVBG5VXE_cjs = require('../chunk-OVBG5VXE.cjs');
4
- var chunkSVVMLSKN_cjs = require('../chunk-SVVMLSKN.cjs');
3
+ var chunkR4FZ5MUH_cjs = require('../chunk-R4FZ5MUH.cjs');
4
+ var chunk2N32USW5_cjs = require('../chunk-2N32USW5.cjs');
5
+ var chunkZUNR45SJ_cjs = require('../chunk-ZUNR45SJ.cjs');
5
6
  var unstableDoNotUse = require('@osdk/client/unstable-do-not-use');
6
7
  var React4 = require('react');
7
8
  var client = require('@osdk/client');
@@ -16,30 +17,51 @@ function OsdkProvider2({
16
17
  observableClient
17
18
  }) {
18
19
  observableClient = React4.useMemo(() => observableClient ?? unstableDoNotUse.createObservableClient(client), [client, observableClient]);
19
- return /* @__PURE__ */ React4__default.default.createElement(chunkSVVMLSKN_cjs.OsdkContext2.Provider, {
20
+ return /* @__PURE__ */ React4__default.default.createElement(chunkZUNR45SJ_cjs.OsdkContext2.Provider, {
20
21
  value: {
21
22
  client,
22
23
  observableClient
23
24
  }
24
- }, /* @__PURE__ */ React4__default.default.createElement(chunkOVBG5VXE_cjs.OsdkContext.Provider, {
25
+ }, /* @__PURE__ */ React4__default.default.createElement(chunk2N32USW5_cjs.OsdkContext.Provider, {
25
26
  value: {
26
27
  client
27
28
  }
28
29
  }, children));
29
30
  }
31
+
32
+ // src/new/hookUtils.ts
33
+ function extractPayloadError(payload, fallbackMessage) {
34
+ if (payload && "error" in payload && payload.error) {
35
+ return payload.error;
36
+ }
37
+ if (payload?.status === "error") {
38
+ return new Error(fallbackMessage);
39
+ }
40
+ return void 0;
41
+ }
42
+ function isPayloadLoading(payload, enabled) {
43
+ if (!enabled) {
44
+ return false;
45
+ }
46
+ return payload?.status === "loading" || payload?.status === "init" || !payload;
47
+ }
48
+
49
+ // src/new/useLinks.ts
30
50
  var emptyArray = Object.freeze([]);
31
51
  var emptyMap = /* @__PURE__ */ new Map();
32
52
  function useLinks(objects, linkName, options = {}) {
33
53
  const {
34
54
  observableClient
35
- } = React4__default.default.useContext(chunkSVVMLSKN_cjs.OsdkContext2);
55
+ } = React4__default.default.useContext(chunkZUNR45SJ_cjs.OsdkContext2);
36
56
  const {
37
57
  enabled = true,
38
58
  ...otherOptions
39
59
  } = options;
40
- const stableWhere = React4__default.default.useMemo(() => otherOptions.where, [JSON.stringify(otherOptions.where)]);
41
- const stableOrderBy = React4__default.default.useMemo(() => otherOptions.orderBy, [JSON.stringify(otherOptions.orderBy)]);
42
- const stableSelect = React4__default.default.useMemo(() => otherOptions.$select, [JSON.stringify(otherOptions.$select)]);
60
+ const canonOptions = observableClient.canonicalizeOptions({
61
+ where: otherOptions.where,
62
+ orderBy: otherOptions.orderBy,
63
+ $select: otherOptions.$select
64
+ });
43
65
  const objectsKey = React4__default.default.useMemo(() => {
44
66
  if (objects === void 0) return "";
45
67
  const arr = Array.isArray(objects) ? objects : [objects];
@@ -53,30 +75,30 @@ function useLinks(objects, linkName, options = {}) {
53
75
  getSnapShot
54
76
  } = React4__default.default.useMemo(() => {
55
77
  if (!enabled) {
56
- return chunkSVVMLSKN_cjs.makeExternalStore(() => ({
78
+ return chunkZUNR45SJ_cjs.makeExternalStore(() => ({
57
79
  unsubscribe: () => {
58
80
  }
59
81
  }), `links ${linkName} for ${objectsKey} [DISABLED]`);
60
82
  }
61
- return chunkSVVMLSKN_cjs.makeExternalStore((observer) => observableClient.observeLinks(objectsArray, linkName, {
83
+ return chunkZUNR45SJ_cjs.makeExternalStore((observer) => observableClient.observeLinks(objectsArray, linkName, {
62
84
  linkName,
63
- where: stableWhere,
85
+ where: canonOptions.where,
64
86
  pageSize: otherOptions.pageSize,
65
- orderBy: stableOrderBy,
87
+ orderBy: canonOptions.orderBy,
66
88
  mode: otherOptions.mode,
67
89
  dedupeInterval: otherOptions.dedupeIntervalMs ?? 2e3,
68
- ...stableSelect ? {
69
- select: stableSelect
90
+ ...canonOptions.$select ? {
91
+ select: canonOptions.$select
70
92
  } : {}
71
93
  }, observer), `links ${linkName} for ${objectsKey}`);
72
- }, [enabled, observableClient, objectsArray, objectsKey, linkName, stableWhere, otherOptions.pageSize, stableOrderBy, otherOptions.mode, otherOptions.dedupeIntervalMs, stableSelect]);
94
+ }, [enabled, observableClient, objectsArray, objectsKey, linkName, canonOptions.where, otherOptions.pageSize, canonOptions.orderBy, otherOptions.mode, otherOptions.dedupeIntervalMs, canonOptions.$select]);
73
95
  const payload = React4__default.default.useSyncExternalStore(subscribe, getSnapShot);
74
96
  return React4__default.default.useMemo(() => ({
75
97
  links: payload?.resolvedList,
76
98
  linkedObjectsBySourcePrimaryKey: payload?.linkedObjectsBySourcePrimaryKey ?? emptyMap,
77
- isLoading: enabled ? payload?.status === "loading" || payload?.status === "init" || !payload : false,
99
+ isLoading: isPayloadLoading(payload, enabled),
78
100
  isOptimistic: payload?.isOptimistic ?? false,
79
- error: payload?.error,
101
+ error: extractPayloadError(payload, "Failed to load links"),
80
102
  fetchMore: payload?.hasMore ? payload?.fetchMore : void 0,
81
103
  hasMore: payload?.hasMore ?? false
82
104
  }), [payload, enabled]);
@@ -85,13 +107,14 @@ var OBJECT_TYPE_PLACEHOLDER = "$__OBJECT__TYPE__PLACEHOLDER";
85
107
  function useObjectSet(baseObjectSet, options = {}) {
86
108
  const {
87
109
  observableClient
88
- } = React4__default.default.useContext(chunkSVVMLSKN_cjs.OsdkContext2);
110
+ } = React4__default.default.useContext(chunkZUNR45SJ_cjs.OsdkContext2);
89
111
  const {
90
- enabled = true,
112
+ enabled: enabledOption = true,
91
113
  streamUpdates,
92
114
  ...otherOptions
93
115
  } = options;
94
- const objectTypeKey = enabled ? baseObjectSet.$objectSetInternals.def.apiName : OBJECT_TYPE_PLACEHOLDER;
116
+ const enabled = enabledOption && baseObjectSet != null;
117
+ const objectTypeKey = enabled && baseObjectSet ? baseObjectSet.$objectSetInternals.def.apiName : OBJECT_TYPE_PLACEHOLDER;
95
118
  const previousObjectTypeRef = React4__default.default.useRef(objectTypeKey);
96
119
  const previousCompletedPayloadRef = React4__default.default.useRef();
97
120
  const objectTypeChanged = previousObjectTypeRef.current !== objectTypeKey;
@@ -99,61 +122,77 @@ function useObjectSet(baseObjectSet, options = {}) {
99
122
  previousObjectTypeRef.current = objectTypeKey;
100
123
  previousCompletedPayloadRef.current = void 0;
101
124
  }
102
- const stableKey = unstableDoNotUse.computeObjectSetCacheKey(baseObjectSet, {
125
+ const canonOptions = observableClient.canonicalizeOptions({
103
126
  where: otherOptions.where,
104
127
  withProperties: otherOptions.withProperties,
128
+ orderBy: otherOptions.orderBy,
105
129
  union: otherOptions.union,
106
130
  intersect: otherOptions.intersect,
107
131
  subtract: otherOptions.subtract,
108
- pivotTo: otherOptions.pivotTo,
109
- pageSize: otherOptions.pageSize,
110
- orderBy: otherOptions.orderBy,
111
- select: otherOptions.$select
132
+ $select: otherOptions.$select
112
133
  });
134
+ const objectSetKey = baseObjectSet ? JSON.stringify(unstableDoNotUse.getWireObjectSet(baseObjectSet)) : void 0;
135
+ const baseObjectSetRef = React4__default.default.useRef(baseObjectSet);
136
+ baseObjectSetRef.current = baseObjectSet;
113
137
  const {
114
138
  subscribe,
115
139
  getSnapShot
116
140
  } = React4__default.default.useMemo(() => {
117
141
  if (!enabled) {
118
- return chunkSVVMLSKN_cjs.makeExternalStore(() => ({
142
+ return chunkZUNR45SJ_cjs.makeExternalStore(() => ({
119
143
  unsubscribe: () => {
120
144
  }
121
- }), process.env.NODE_ENV !== "production" ? `objectSet ${stableKey} [DISABLED]` : void 0);
145
+ }), process.env.NODE_ENV !== "production" ? `objectSet [DISABLED]` : void 0);
122
146
  }
123
147
  const initialValue = objectTypeChanged ? void 0 : previousCompletedPayloadRef.current;
124
- return chunkSVVMLSKN_cjs.makeExternalStore((observer) => {
125
- const subscription = observableClient.observeObjectSet(baseObjectSet, {
126
- where: otherOptions.where,
127
- withProperties: otherOptions.withProperties,
128
- union: otherOptions.union,
129
- intersect: otherOptions.intersect,
130
- subtract: otherOptions.subtract,
148
+ return chunkZUNR45SJ_cjs.makeExternalStore((observer) => {
149
+ if (!baseObjectSetRef.current) {
150
+ return {
151
+ unsubscribe: () => {
152
+ }
153
+ };
154
+ }
155
+ const subscription = observableClient.observeObjectSet(baseObjectSetRef.current, {
156
+ where: canonOptions.where,
157
+ withProperties: canonOptions.withProperties,
158
+ union: canonOptions.union,
159
+ intersect: canonOptions.intersect,
160
+ subtract: canonOptions.subtract,
131
161
  pivotTo: otherOptions.pivotTo,
132
162
  pageSize: otherOptions.pageSize,
133
- orderBy: otherOptions.orderBy,
163
+ orderBy: canonOptions.orderBy,
134
164
  dedupeInterval: otherOptions.dedupeIntervalMs ?? 2e3,
135
165
  autoFetchMore: otherOptions.autoFetchMore,
136
166
  streamUpdates,
137
- select: otherOptions.$select
167
+ select: canonOptions.$select
138
168
  }, observer);
139
169
  return subscription;
140
- }, process.env.NODE_ENV !== "production" ? `objectSet ${stableKey}` : void 0, initialValue);
141
- }, [enabled, observableClient, stableKey, streamUpdates, objectTypeChanged]);
170
+ }, process.env.NODE_ENV !== "production" ? `objectSet ${objectTypeKey}` : void 0, initialValue);
171
+ }, [enabled, observableClient, objectSetKey, canonOptions.where, canonOptions.withProperties, canonOptions.orderBy, canonOptions.union, canonOptions.intersect, canonOptions.subtract, canonOptions.$select, otherOptions.pivotTo, otherOptions.pageSize, otherOptions.autoFetchMore, otherOptions.dedupeIntervalMs, streamUpdates, objectTypeKey]);
142
172
  const payload = React4__default.default.useSyncExternalStore(subscribe, getSnapShot);
143
173
  if (payload && isPayloadCompleted(payload)) {
144
174
  previousCompletedPayloadRef.current = payload;
145
175
  }
176
+ const typeApiName = baseObjectSet?.$objectSetInternals.def.apiName;
177
+ const refetch = React4__default.default.useCallback(async () => {
178
+ if (typeApiName) {
179
+ await observableClient.invalidateObjectType(typeApiName);
180
+ }
181
+ }, [observableClient, typeApiName]);
146
182
  return React4__default.default.useMemo(() => {
147
183
  const lastLoaded = isPayloadCompleted(payload) ? payload : previousCompletedPayloadRef.current;
148
184
  return {
149
185
  data: lastLoaded?.resolvedList,
150
- isLoading: !isPayloadCompleted(payload),
151
- error: lastLoaded && "error" in lastLoaded ? lastLoaded.error : void 0,
186
+ isLoading: enabled ? !isPayloadCompleted(payload) : false,
187
+ error: extractPayloadError(lastLoaded, "Failed to load object set"),
188
+ isOptimistic: payload?.isOptimistic ?? false,
152
189
  fetchMore: payload?.hasMore ? payload.fetchMore : void 0,
153
- objectSet: payload?.objectSet || baseObjectSet,
154
- totalCount: lastLoaded?.totalCount
190
+ hasMore: payload?.hasMore ?? false,
191
+ objectSet: lastLoaded?.objectSet,
192
+ totalCount: lastLoaded?.totalCount,
193
+ refetch
155
194
  };
156
- }, [payload, baseObjectSet]);
195
+ }, [payload, refetch, enabled]);
157
196
  }
158
197
  function isPayloadCompleted(payload) {
159
198
  if (payload != null && "error" in payload) {
@@ -177,7 +216,7 @@ function isPayloadCompleted(payload) {
177
216
  function useOsdkAction(actionDef) {
178
217
  const {
179
218
  observableClient
180
- } = React4__default.default.useContext(chunkSVVMLSKN_cjs.OsdkContext2);
219
+ } = React4__default.default.useContext(chunkZUNR45SJ_cjs.OsdkContext2);
181
220
  const [error, setError] = React4__default.default.useState();
182
221
  const [data, setData] = React4__default.default.useState();
183
222
  const [isPending, setPending] = React4__default.default.useState(false);
@@ -234,6 +273,7 @@ function useOsdkAction(actionDef) {
234
273
  unknown: e
235
274
  });
236
275
  }
276
+ throw e;
237
277
  } finally {
238
278
  setPending(false);
239
279
  }
@@ -243,9 +283,7 @@ function useOsdkAction(actionDef) {
243
283
  if (isPending) {
244
284
  return void 0;
245
285
  }
246
- if (abortControllerRef.current) {
247
- abortControllerRef.current.abort();
248
- }
286
+ abortControllerRef.current?.abort();
249
287
  const abortController = new AbortController();
250
288
  abortControllerRef.current = abortController;
251
289
  setValidating(true);
@@ -276,9 +314,7 @@ function useOsdkAction(actionDef) {
276
314
  }, [observableClient, actionDef, isPending]);
277
315
  React4__default.default.useEffect(() => {
278
316
  return () => {
279
- if (abortControllerRef.current) {
280
- abortControllerRef.current.abort();
281
- }
317
+ abortControllerRef.current?.abort();
282
318
  };
283
319
  }, []);
284
320
  return React4__default.default.useMemo(() => ({
@@ -291,10 +327,9 @@ function useOsdkAction(actionDef) {
291
327
  validationResult
292
328
  }), [applyAction, validateAction, error, data, isPending, isValidating, validationResult]);
293
329
  }
294
- var EMPTY_WHERE = {};
295
330
  function useOsdkAggregation(type, options) {
296
331
  const {
297
- where = EMPTY_WHERE,
332
+ where,
298
333
  withProperties,
299
334
  intersectWith,
300
335
  aggregate,
@@ -303,65 +338,59 @@ function useOsdkAggregation(type, options) {
303
338
  const objectSet = "objectSet" in options ? options.objectSet : void 0;
304
339
  const {
305
340
  observableClient
306
- } = React4__default.default.useContext(chunkSVVMLSKN_cjs.OsdkContext2);
307
- const canonWhere = observableClient.canonicalizeWhereClause(where);
308
- const stableCanonWhere = React4__default.default.useMemo(() => canonWhere, [JSON.stringify(canonWhere)]);
341
+ } = React4__default.default.useContext(chunkZUNR45SJ_cjs.OsdkContext2);
342
+ const canonOptions = observableClient.canonicalizeOptions({
343
+ where,
344
+ withProperties,
345
+ aggregate,
346
+ intersectWith
347
+ });
348
+ const objectSetKey = objectSet ? JSON.stringify(unstableDoNotUse.getWireObjectSet(objectSet)) : void 0;
309
349
  const objectSetRef = React4__default.default.useRef(objectSet);
310
350
  objectSetRef.current = objectSet;
311
- const objectSetKeyString = objectSet ? unstableDoNotUse.computeObjectSetCacheKey(objectSet) : void 0;
312
- const stableWithProperties = React4__default.default.useMemo(() => withProperties, [JSON.stringify(withProperties)]);
313
- const stableAggregate = React4__default.default.useMemo(() => aggregate, [JSON.stringify(aggregate)]);
314
- const stableIntersectWith = React4__default.default.useMemo(() => intersectWith, [JSON.stringify(intersectWith)]);
315
351
  const {
316
352
  subscribe,
317
353
  getSnapShot
318
354
  } = React4__default.default.useMemo(() => {
319
- if (objectSetKeyString && objectSetRef.current) {
320
- return chunkSVVMLSKN_cjs.makeExternalStoreAsync((observer) => observableClient.observeAggregation({
355
+ const currentObjectSet = objectSetRef.current;
356
+ if (currentObjectSet) {
357
+ return chunkZUNR45SJ_cjs.makeExternalStoreAsync((observer) => observableClient.observeAggregation({
321
358
  type,
322
- objectSet: objectSetRef.current,
323
- where: stableCanonWhere,
324
- withProperties: stableWithProperties,
325
- intersectWith: stableIntersectWith,
326
- aggregate: stableAggregate,
359
+ objectSet: currentObjectSet,
360
+ where: canonOptions.where,
361
+ withProperties: canonOptions.withProperties,
362
+ intersectWith: canonOptions.intersectWith,
363
+ aggregate: canonOptions.aggregate,
327
364
  dedupeInterval: dedupeIntervalMs ?? 2e3
328
- }, observer), process.env.NODE_ENV !== "production" ? `aggregation ${type.apiName} ${objectSetKeyString} ${JSON.stringify(stableCanonWhere)}` : void 0);
365
+ }, observer), process.env.NODE_ENV !== "production" ? `aggregation ${type.apiName} ${JSON.stringify(canonOptions.where)}` : void 0);
329
366
  }
330
- return chunkSVVMLSKN_cjs.makeExternalStore((observer) => (
367
+ return chunkZUNR45SJ_cjs.makeExternalStore((observer) => (
331
368
  // eslint-disable-next-line @typescript-eslint/no-deprecated
332
369
  observableClient.observeAggregation({
333
370
  type,
334
- where: stableCanonWhere,
335
- withProperties: stableWithProperties,
336
- intersectWith: stableIntersectWith,
337
- aggregate: stableAggregate,
371
+ where: canonOptions.where,
372
+ withProperties: canonOptions.withProperties,
373
+ intersectWith: canonOptions.intersectWith,
374
+ aggregate: canonOptions.aggregate,
338
375
  dedupeInterval: dedupeIntervalMs ?? 2e3
339
376
  }, observer)
340
- ), process.env.NODE_ENV !== "production" ? `aggregation ${type.apiName} ${JSON.stringify(stableCanonWhere)}` : void 0);
341
- }, [observableClient, type.apiName, type.type, objectSetKeyString, stableCanonWhere, stableWithProperties, stableIntersectWith, stableAggregate, dedupeIntervalMs]);
377
+ ), process.env.NODE_ENV !== "production" ? `aggregation ${type.apiName} ${JSON.stringify(canonOptions.where)}` : void 0);
378
+ }, [observableClient, type.apiName, type.type, objectSetKey, canonOptions.where, canonOptions.withProperties, canonOptions.intersectWith, canonOptions.aggregate, dedupeIntervalMs]);
342
379
  const payload = React4__default.default.useSyncExternalStore(subscribe, getSnapShot);
343
380
  const refetch = React4__default.default.useCallback(async () => {
344
381
  await observableClient.invalidateObjectType(type.apiName);
345
382
  }, [observableClient, type.apiName]);
346
- return React4__default.default.useMemo(() => {
347
- let error;
348
- if (payload && "error" in payload && payload.error) {
349
- error = payload.error;
350
- } else if (payload?.status === "error") {
351
- error = new Error("Failed to execute aggregation");
352
- }
353
- return {
354
- data: payload?.result,
355
- isLoading: payload?.status === "loading" || payload?.status === "init" || !payload,
356
- error,
357
- refetch
358
- };
359
- }, [payload, refetch]);
383
+ return React4__default.default.useMemo(() => ({
384
+ data: payload?.result,
385
+ isLoading: isPayloadLoading(payload, true),
386
+ error: extractPayloadError(payload, "Failed to execute aggregation"),
387
+ refetch
388
+ }), [payload, refetch]);
360
389
  }
361
390
  function useOsdkFunction(queryDef, options = {}) {
362
391
  const {
363
392
  observableClient
364
- } = React4__default.default.useContext(chunkSVVMLSKN_cjs.OsdkContext2);
393
+ } = React4__default.default.useContext(chunkZUNR45SJ_cjs.OsdkContext2);
365
394
  const {
366
395
  params,
367
396
  dependsOn,
@@ -383,12 +412,12 @@ function useOsdkFunction(queryDef, options = {}) {
383
412
  getSnapShot
384
413
  } = React4__default.default.useMemo(() => {
385
414
  if (!enabled) {
386
- return chunkSVVMLSKN_cjs.makeExternalStore(() => ({
415
+ return chunkZUNR45SJ_cjs.makeExternalStore(() => ({
387
416
  unsubscribe: () => {
388
417
  }
389
418
  }), process.env.NODE_ENV !== "production" ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)} [DISABLED]` : void 0);
390
419
  }
391
- return chunkSVVMLSKN_cjs.makeExternalStore((observer) => observableClient.observeFunction(queryDef, paramsForApi, {
420
+ return chunkZUNR45SJ_cjs.makeExternalStore((observer) => observableClient.observeFunction(queryDef, paramsForApi, {
392
421
  dependsOn: stableDependsOn,
393
422
  dependsOnObjects: stableDependsOnObjects,
394
423
  dedupeInterval: dedupeIntervalMs ?? 2e3
@@ -412,11 +441,12 @@ function useOsdkFunction(queryDef, options = {}) {
412
441
  function useOsdkObject(...args) {
413
442
  const {
414
443
  observableClient
415
- } = React4__default.default.useContext(chunkSVVMLSKN_cjs.OsdkContext2);
444
+ } = React4__default.default.useContext(chunkZUNR45SJ_cjs.OsdkContext2);
416
445
  const isInstanceSignature = "$objectType" in args[0];
417
446
  const optionsArg = !isInstanceSignature && args[2] != null && typeof args[2] === "object" ? args[2] : void 0;
418
447
  const enabled = isInstanceSignature ? typeof args[1] === "boolean" ? args[1] : true : optionsArg ? optionsArg.enabled ?? true : typeof args[2] === "boolean" ? args[2] : true;
419
448
  const selectArg = optionsArg?.$select;
449
+ const loadPropertySecurityMetadata = optionsArg?.$loadPropertySecurityMetadata;
420
450
  const mode = isInstanceSignature ? "offline" : void 0;
421
451
  const typeOrApiName = isInstanceSignature ? args[0].$objectType : args[0];
422
452
  const primaryKey = isInstanceSignature ? args[0].$primaryKey : args[1];
@@ -427,18 +457,21 @@ function useOsdkObject(...args) {
427
457
  getSnapShot
428
458
  } = React4__default.default.useMemo(() => {
429
459
  if (!enabled) {
430
- return chunkSVVMLSKN_cjs.makeExternalStore(() => ({
460
+ return chunkZUNR45SJ_cjs.makeExternalStore(() => ({
431
461
  unsubscribe: () => {
432
462
  }
433
463
  }), `object ${apiNameString} ${primaryKey} [DISABLED]`);
434
464
  }
435
- return chunkSVVMLSKN_cjs.makeExternalStore((observer) => observableClient.observeObject(typeOrApiName, primaryKey, {
465
+ return chunkZUNR45SJ_cjs.makeExternalStore((observer) => observableClient.observeObject(typeOrApiName, primaryKey, {
436
466
  mode,
437
467
  ...stableSelect ? {
438
468
  select: stableSelect
469
+ } : {},
470
+ ...loadPropertySecurityMetadata ? {
471
+ $loadPropertySecurityMetadata: loadPropertySecurityMetadata
439
472
  } : {}
440
473
  }, observer), `object ${apiNameString} ${primaryKey}`);
441
- }, [enabled, observableClient, typeOrApiName, apiNameString, primaryKey, mode, stableSelect]);
474
+ }, [enabled, observableClient, typeOrApiName, apiNameString, primaryKey, mode, stableSelect, loadPropertySecurityMetadata]);
442
475
  const payload = React4__default.default.useSyncExternalStore(subscribe, getSnapShot);
443
476
  const forceUpdate = React4__default.default.useCallback(() => {
444
477
  throw new Error("not implemented");
@@ -459,11 +492,10 @@ function useOsdkObject(...args) {
459
492
  };
460
493
  }, [payload, enabled, forceUpdate]);
461
494
  }
462
- var EMPTY_WHERE2 = {};
463
495
  function useOsdkObjects(type, options) {
464
496
  const {
465
497
  observableClient
466
- } = React4__default.default.useContext(chunkSVVMLSKN_cjs.OsdkContext2);
498
+ } = React4__default.default.useContext(chunkZUNR45SJ_cjs.OsdkContext2);
467
499
  const {
468
500
  pageSize,
469
501
  dedupeIntervalMs,
@@ -476,63 +508,66 @@ function useOsdkObjects(type, options) {
476
508
  autoFetchMore,
477
509
  intersectWith,
478
510
  pivotTo,
479
- $select
511
+ $select,
512
+ $loadPropertySecurityMetadata
480
513
  } = options ?? {};
481
- const canonWhere = observableClient.canonicalizeWhereClause(where ?? EMPTY_WHERE2);
482
- const stableCanonWhere = React4__default.default.useMemo(() => canonWhere, [JSON.stringify(canonWhere)]);
514
+ const canonOptions = observableClient.canonicalizeOptions({
515
+ where,
516
+ withProperties,
517
+ orderBy,
518
+ intersectWith,
519
+ $select
520
+ });
483
521
  const stableRids = React4__default.default.useMemo(() => rids, [JSON.stringify(rids)]);
484
- const stableWithProperties = React4__default.default.useMemo(() => withProperties, [JSON.stringify(withProperties)]);
485
- const stableIntersectWith = React4__default.default.useMemo(() => intersectWith, [JSON.stringify(intersectWith)]);
486
- const stableOrderBy = React4__default.default.useMemo(() => orderBy, [JSON.stringify(orderBy)]);
487
- const stableSelect = React4__default.default.useMemo(() => $select, [JSON.stringify($select)]);
488
522
  const {
489
523
  subscribe,
490
524
  getSnapShot
491
525
  } = React4__default.default.useMemo(() => {
492
526
  if (!enabled) {
493
- return chunkSVVMLSKN_cjs.makeExternalStore(() => ({
527
+ return chunkZUNR45SJ_cjs.makeExternalStore(() => ({
494
528
  unsubscribe: () => {
495
529
  }
496
530
  }), process.env.NODE_ENV !== "production" ? `list ${type.apiName} [DISABLED]` : void 0);
497
531
  }
498
- return chunkSVVMLSKN_cjs.makeExternalStore((observer) => observableClient.observeList({
532
+ return chunkZUNR45SJ_cjs.makeExternalStore((observer) => observableClient.observeList({
499
533
  type,
500
534
  rids: stableRids,
501
- where: stableCanonWhere,
535
+ where: canonOptions.where,
502
536
  dedupeInterval: dedupeIntervalMs ?? 2e3,
503
537
  pageSize,
504
- orderBy: stableOrderBy,
538
+ orderBy: canonOptions.orderBy,
505
539
  streamUpdates,
506
- withProperties: stableWithProperties,
540
+ withProperties: canonOptions.withProperties,
507
541
  autoFetchMore,
508
- ...stableIntersectWith ? {
509
- intersectWith: stableIntersectWith
542
+ ...canonOptions.intersectWith ? {
543
+ intersectWith: canonOptions.intersectWith
510
544
  } : {},
511
545
  ...pivotTo ? {
512
546
  pivotTo
513
547
  } : {},
514
- ...stableSelect ? {
515
- select: stableSelect
548
+ ...canonOptions.$select ? {
549
+ select: canonOptions.$select
550
+ } : {},
551
+ ...$loadPropertySecurityMetadata ? {
552
+ $loadPropertySecurityMetadata
516
553
  } : {}
517
- }, observer), process.env.NODE_ENV !== "production" ? `list ${type.apiName} ${stableRids ? `[${stableRids.length} rids]` : ""} ${JSON.stringify(stableCanonWhere)}` : void 0);
518
- }, [enabled, observableClient, type.apiName, type.type, stableRids, stableCanonWhere, dedupeIntervalMs, pageSize, stableOrderBy, streamUpdates, stableWithProperties, autoFetchMore, stableIntersectWith, pivotTo, stableSelect]);
554
+ }, observer), process.env.NODE_ENV !== "production" ? `list ${type.apiName} ${stableRids ? `[${stableRids.length} rids]` : ""} ${JSON.stringify(canonOptions.where)}` : void 0);
555
+ }, [enabled, observableClient, type.apiName, type.type, stableRids, canonOptions.where, dedupeIntervalMs, pageSize, canonOptions.orderBy, streamUpdates, canonOptions.withProperties, autoFetchMore, canonOptions.intersectWith, pivotTo, canonOptions.$select, $loadPropertySecurityMetadata]);
519
556
  const listPayload = React4__default.default.useSyncExternalStore(subscribe, getSnapShot);
520
- return React4__default.default.useMemo(() => {
521
- let error;
522
- if (listPayload && "error" in listPayload && listPayload.error) {
523
- error = listPayload.error;
524
- } else if (listPayload?.status === "error") {
525
- error = new Error("Failed to load objects");
526
- }
527
- return {
528
- fetchMore: listPayload?.hasMore ? listPayload.fetchMore : void 0,
529
- error,
530
- data: listPayload?.resolvedList,
531
- isLoading: enabled ? listPayload?.status === "loading" || listPayload?.status === "init" || !listPayload : false,
532
- isOptimistic: listPayload?.isOptimistic ?? false,
533
- totalCount: listPayload?.totalCount
534
- };
535
- }, [listPayload, enabled]);
557
+ const refetch = React4__default.default.useCallback(async () => {
558
+ await observableClient.invalidateObjectType(type.apiName);
559
+ }, [observableClient, type.apiName]);
560
+ return React4__default.default.useMemo(() => ({
561
+ fetchMore: listPayload?.hasMore ? listPayload.fetchMore : void 0,
562
+ error: extractPayloadError(listPayload, "Failed to load objects"),
563
+ data: listPayload?.resolvedList,
564
+ isLoading: isPayloadLoading(listPayload, enabled),
565
+ isOptimistic: listPayload?.isOptimistic ?? false,
566
+ totalCount: listPayload?.totalCount,
567
+ hasMore: listPayload?.hasMore ?? false,
568
+ objectSet: listPayload?.objectSet,
569
+ refetch
570
+ }), [listPayload, enabled, refetch]);
536
571
  }
537
572
  function useDebouncedCallback(callback, delay) {
538
573
  const timeoutRef = React4__default.default.useRef();
@@ -570,13 +605,13 @@ function useDebouncedCallback(callback, delay) {
570
605
  });
571
606
  }
572
607
 
573
- Object.defineProperty(exports, "useOsdkClient", {
608
+ Object.defineProperty(exports, "useOsdkMetadata", {
574
609
  enumerable: true,
575
- get: function () { return chunkOVBG5VXE_cjs.useOsdkClient; }
610
+ get: function () { return chunkR4FZ5MUH_cjs.useOsdkMetadata; }
576
611
  });
577
- Object.defineProperty(exports, "useOsdkMetadata", {
612
+ Object.defineProperty(exports, "useOsdkClient", {
578
613
  enumerable: true,
579
- get: function () { return chunkOVBG5VXE_cjs.useOsdkMetadata; }
614
+ get: function () { return chunk2N32USW5_cjs.useOsdkClient; }
580
615
  });
581
616
  exports.OsdkProvider2 = OsdkProvider2;
582
617
  exports.useDebouncedCallback = useDebouncedCallback;