@osdk/react 0.10.0-beta.1 → 0.10.0-beta.11

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 (129) hide show
  1. package/AGENTS.md +46 -221
  2. package/CHANGELOG.md +147 -0
  3. package/build/browser/new/makeExternalStore.js +61 -0
  4. package/build/browser/new/makeExternalStore.js.map +1 -1
  5. package/build/browser/new/platform-apis/admin/useCbacBanner.js +63 -0
  6. package/build/browser/new/platform-apis/admin/useCbacBanner.js.map +1 -0
  7. package/build/browser/new/platform-apis/admin/useCbacMarkingRestrictions.js +64 -0
  8. package/build/browser/new/platform-apis/admin/useCbacMarkingRestrictions.js.map +1 -0
  9. package/build/browser/new/platform-apis/admin/useMarkingCategories.js +46 -0
  10. package/build/browser/new/platform-apis/admin/useMarkingCategories.js.map +1 -0
  11. package/build/browser/new/platform-apis/admin/useMarkings.js +46 -0
  12. package/build/browser/new/platform-apis/admin/useMarkings.js.map +1 -0
  13. package/build/browser/new/platform-apis/admin/useUserMarkings.js +50 -0
  14. package/build/browser/new/platform-apis/admin/useUserMarkings.js.map +1 -0
  15. package/build/browser/new/useLinks.js +11 -4
  16. package/build/browser/new/useLinks.js.map +1 -1
  17. package/build/browser/new/useObjectSet.js +42 -18
  18. package/build/browser/new/useObjectSet.js.map +1 -1
  19. package/build/browser/new/useOsdkAction.js +2 -2
  20. package/build/browser/new/useOsdkAction.js.map +1 -1
  21. package/build/browser/new/useOsdkAggregation.js +65 -27
  22. package/build/browser/new/useOsdkAggregation.js.map +1 -1
  23. package/build/browser/new/useOsdkFunction.js +17 -12
  24. package/build/browser/new/useOsdkFunction.js.map +1 -1
  25. package/build/browser/new/useOsdkObject.js +48 -26
  26. package/build/browser/new/useOsdkObject.js.map +1 -1
  27. package/build/browser/new/useOsdkObjects.js +32 -19
  28. package/build/browser/new/useOsdkObjects.js.map +1 -1
  29. package/build/browser/public/experimental/admin.js +25 -0
  30. package/build/browser/public/experimental/admin.js.map +1 -0
  31. package/build/browser/public/experimental.js +0 -3
  32. package/build/browser/public/experimental.js.map +1 -1
  33. package/build/browser/useOsdkMetadata.js.map +1 -1
  34. package/build/cjs/{chunk-V32JHU3O.cjs → chunk-OVBG5VXE.cjs} +3 -8
  35. package/build/cjs/chunk-OVBG5VXE.cjs.map +1 -0
  36. package/build/cjs/chunk-SVVMLSKN.cjs +111 -0
  37. package/build/cjs/chunk-SVVMLSKN.cjs.map +1 -0
  38. package/build/cjs/index.cjs +4 -4
  39. package/build/cjs/index.d.cts +1 -1
  40. package/build/cjs/public/experimental/admin.cjs +293 -0
  41. package/build/cjs/public/experimental/admin.cjs.map +1 -0
  42. package/build/cjs/public/experimental/admin.d.cts +275 -0
  43. package/build/cjs/public/experimental.cjs +261 -492
  44. package/build/cjs/public/experimental.cjs.map +1 -1
  45. package/build/cjs/public/experimental.d.cts +113 -138
  46. package/build/cjs/useOsdkMetadata-BElt3F5s.d.cts +15 -0
  47. package/build/esm/new/makeExternalStore.js +61 -0
  48. package/build/esm/new/makeExternalStore.js.map +1 -1
  49. package/build/esm/new/platform-apis/admin/useCbacBanner.js +63 -0
  50. package/build/esm/new/platform-apis/admin/useCbacBanner.js.map +1 -0
  51. package/build/esm/new/platform-apis/admin/useCbacMarkingRestrictions.js +64 -0
  52. package/build/esm/new/platform-apis/admin/useCbacMarkingRestrictions.js.map +1 -0
  53. package/build/esm/new/platform-apis/admin/useMarkingCategories.js +46 -0
  54. package/build/esm/new/platform-apis/admin/useMarkingCategories.js.map +1 -0
  55. package/build/esm/new/platform-apis/admin/useMarkings.js +46 -0
  56. package/build/esm/new/platform-apis/admin/useMarkings.js.map +1 -0
  57. package/build/esm/new/platform-apis/admin/useUserMarkings.js +50 -0
  58. package/build/esm/new/platform-apis/admin/useUserMarkings.js.map +1 -0
  59. package/build/esm/new/useLinks.js +11 -4
  60. package/build/esm/new/useLinks.js.map +1 -1
  61. package/build/esm/new/useObjectSet.js +42 -18
  62. package/build/esm/new/useObjectSet.js.map +1 -1
  63. package/build/esm/new/useOsdkAction.js +2 -2
  64. package/build/esm/new/useOsdkAction.js.map +1 -1
  65. package/build/esm/new/useOsdkAggregation.js +65 -27
  66. package/build/esm/new/useOsdkAggregation.js.map +1 -1
  67. package/build/esm/new/useOsdkFunction.js +17 -12
  68. package/build/esm/new/useOsdkFunction.js.map +1 -1
  69. package/build/esm/new/useOsdkObject.js +48 -26
  70. package/build/esm/new/useOsdkObject.js.map +1 -1
  71. package/build/esm/new/useOsdkObjects.js +32 -19
  72. package/build/esm/new/useOsdkObjects.js.map +1 -1
  73. package/build/esm/public/experimental/admin.js +25 -0
  74. package/build/esm/public/experimental/admin.js.map +1 -0
  75. package/build/esm/public/experimental.js +0 -3
  76. package/build/esm/public/experimental.js.map +1 -1
  77. package/build/esm/useOsdkMetadata.js.map +1 -1
  78. package/build/types/new/makeExternalStore.d.ts +11 -0
  79. package/build/types/new/makeExternalStore.d.ts.map +1 -1
  80. package/build/types/new/platform-apis/admin/useCbacBanner.d.ts +33 -0
  81. package/build/types/new/platform-apis/admin/useCbacBanner.d.ts.map +1 -0
  82. package/build/types/new/platform-apis/admin/useCbacMarkingRestrictions.d.ts +34 -0
  83. package/build/types/new/platform-apis/admin/useCbacMarkingRestrictions.d.ts.map +1 -0
  84. package/build/types/new/platform-apis/admin/useMarkingCategories.d.ts +27 -0
  85. package/build/types/new/platform-apis/admin/useMarkingCategories.d.ts.map +1 -0
  86. package/build/types/new/platform-apis/admin/useMarkings.d.ts +27 -0
  87. package/build/types/new/platform-apis/admin/useMarkings.d.ts.map +1 -0
  88. package/build/types/new/platform-apis/admin/useUserMarkings.d.ts +33 -0
  89. package/build/types/new/platform-apis/admin/useUserMarkings.d.ts.map +1 -0
  90. package/build/types/new/useLinks.d.ts +19 -0
  91. package/build/types/new/useLinks.d.ts.map +1 -1
  92. package/build/types/new/useObjectSet.d.ts +10 -4
  93. package/build/types/new/useObjectSet.d.ts.map +1 -1
  94. package/build/types/new/useOsdkAggregation.d.ts +41 -3
  95. package/build/types/new/useOsdkAggregation.d.ts.map +1 -1
  96. package/build/types/new/useOsdkFunction.d.ts +11 -5
  97. package/build/types/new/useOsdkFunction.d.ts.map +1 -1
  98. package/build/types/new/useOsdkObject.d.ts +19 -7
  99. package/build/types/new/useOsdkObject.d.ts.map +1 -1
  100. package/build/types/new/useOsdkObjects.d.ts +32 -2
  101. package/build/types/new/useOsdkObjects.d.ts.map +1 -1
  102. package/build/types/public/experimental/admin.d.ts +11 -0
  103. package/build/types/public/experimental/admin.d.ts.map +1 -0
  104. package/build/types/public/experimental.d.ts +0 -3
  105. package/build/types/public/experimental.d.ts.map +1 -1
  106. package/build/types/useOsdkMetadata.d.ts +5 -4
  107. package/build/types/useOsdkMetadata.d.ts.map +1 -1
  108. package/docs/querying-data.md +19 -0
  109. package/{build/browser/intellisense.test.helpers/useOsdkObjectsWithPivot.js → experimental/admin.d.ts} +1 -19
  110. package/package.json +28 -7
  111. package/build/browser/intellisense.test.helpers/useOsdkObjectsWithPivot.js.map +0 -1
  112. package/build/browser/intellisense.test.helpers/useOsdkObjectsWithProperties.js +0 -34
  113. package/build/browser/intellisense.test.helpers/useOsdkObjectsWithProperties.js.map +0 -1
  114. package/build/browser/intellisense.test.js +0 -148
  115. package/build/browser/intellisense.test.js.map +0 -1
  116. package/build/cjs/chunk-V32JHU3O.cjs.map +0 -1
  117. package/build/cjs/useOsdkMetadata-DFZhnhGZ.d.cts +0 -14
  118. package/build/esm/intellisense.test.helpers/useOsdkObjectsWithPivot.js +0 -35
  119. package/build/esm/intellisense.test.helpers/useOsdkObjectsWithPivot.js.map +0 -1
  120. package/build/esm/intellisense.test.helpers/useOsdkObjectsWithProperties.js +0 -34
  121. package/build/esm/intellisense.test.helpers/useOsdkObjectsWithProperties.js.map +0 -1
  122. package/build/esm/intellisense.test.js +0 -148
  123. package/build/esm/intellisense.test.js.map +0 -1
  124. package/build/types/intellisense.test.d.ts +0 -1
  125. package/build/types/intellisense.test.d.ts.map +0 -1
  126. package/build/types/intellisense.test.helpers/useOsdkObjectsWithPivot.d.ts +0 -1
  127. package/build/types/intellisense.test.helpers/useOsdkObjectsWithPivot.d.ts.map +0 -1
  128. package/build/types/intellisense.test.helpers/useOsdkObjectsWithProperties.d.ts +0 -1
  129. package/build/types/intellisense.test.helpers/useOsdkObjectsWithProperties.d.ts.map +0 -1
package/AGENTS.md CHANGED
@@ -1,21 +1,20 @@
1
- # @osdk/react - AI Agent Instructions
1
+ # @osdk/react
2
2
 
3
- ## Critical Rules
3
+ ## Rules
4
4
 
5
- 1. **Use `OsdkProvider2`** - Not `OsdkProvider`. All modern hooks require `OsdkProvider2`.
6
- 2. **Import from `@osdk/react/experimental`** - Not `@osdk/react`. The main entry point only has legacy hooks.
7
- 3. **Never conditionally call hooks** - Use the `enabled` option instead.
8
- 4. **Keep rendering during loading** - No early returns like `if (isLoading) return <Spinner />`. Show loading indicators while rendering existing data.
5
+ 1. **Use `OsdkProvider2`**, not `OsdkProvider`. All modern hooks require it.
6
+ 2. **Import from `@osdk/react/experimental`**, not `@osdk/react`. Main entry only has legacy hooks.
7
+ 3. **Never conditionally call hooks.** Use the `enabled` option instead.
8
+ 4. **Keep rendering during loading.** No early returns like `if (isLoading) return <Spinner />`. Show loading indicators alongside existing data to prevent UI flashing. Exception: `if (!data && isLoading)` is acceptable for initial load.
9
+ 5. **`useOsdkObject` `enabled` is positional**, not in an options object: `useOsdkObject(Type, id, false)`.
9
10
 
10
11
  ## Exports
11
12
 
12
- **Stable** (`@osdk/react`):
13
+ **Stable** (`@osdk/react`): `OsdkProvider` (legacy), `useOsdkClient`, `useOsdkMetadata`
13
14
 
14
- - `OsdkProvider` - Legacy provider
15
- - `useOsdkClient` - Access client
16
- - `useOsdkMetadata` - Fetch metadata
15
+ **Experimental** (`@osdk/react/experimental`): `OsdkProvider2`, `useOsdkObjects`, `useOsdkObject`, `useOsdkAction`, `useLinks`, `useObjectSet`, `useOsdkAggregation`, `useOsdkFunction`, `useDebouncedCallback`, `useCurrentFoundryUser`, `useFoundryUser`, `useFoundryUsersList`
17
16
 
18
- **Experimental** (`@osdk/react/experimental`):
17
+ ## Hook Options
19
18
 
20
19
  - `OsdkProvider2` - Modern provider (use this)
21
20
  - `useOsdkObjects` - Query lists of objects
@@ -24,230 +23,56 @@
24
23
  - `useLinks` - Navigate object relationships
25
24
  - `useObjectSet` - Advanced set operations (union, intersect, subtract, pivot)
26
25
  - `useOsdkAggregation` - Server-side aggregations with groupBy/select
27
- - `useCurrentFoundryUser`, `useFoundryUser`, `useFoundryUsersList` - Platform APIs
28
26
  - `useOsdkClient`, `useOsdkMetadata` - Also available from experimental
29
27
 
30
- ## Correct Patterns
31
-
32
- ### Loading States
33
-
34
- ```tsx
35
- import { Todo } from "@my/osdk";
36
- import { useOsdkObjects } from "@osdk/react/experimental";
37
-
38
- function TodoList() {
39
- const { data, isLoading, error } = useOsdkObjects(Todo);
40
-
41
- return (
42
- <div>
43
- {isLoading && <LoadingIndicator />}
44
- {error && <ErrorMessage error={error} />}
45
- {data?.map(todo => <TodoItem key={todo.$primaryKey} todo={todo} />)}
46
- </div>
47
- );
48
- }
49
- ```
28
+ **Experimental Admin** (`@osdk/react/experimental/admin`):
50
29
 
51
- ### Single Object (useOsdkObject)
52
-
53
- ```tsx
54
- import { Employee } from "@my/osdk";
55
- import { useOsdkObject } from "@osdk/react/experimental";
56
-
57
- // By type + primary key (enabled is 3rd positional param)
58
- const { object, isLoading, error, isOptimistic } = useOsdkObject(
59
- Employee,
60
- "employee-123",
61
- true, // enabled (optional, defaults to true)
62
- );
63
-
64
- // By existing instance (enabled is 2nd positional param)
65
- const { object: refreshed } = useOsdkObject(existingEmployee, true);
66
- ```
67
-
68
- ### Conditional Fetching
69
-
70
- ```tsx
71
- // useOsdkObjects uses options object
72
- const { data: reports } = useOsdkObjects(Employee, {
73
- where: { managerId: selectedManagerId },
74
- enabled: !!selectedManagerId,
75
- });
76
-
77
- // useOsdkObject uses positional enabled parameter
78
- const { object: manager } = useOsdkObject(Employee, managerId, !!managerId);
79
- ```
30
+ - `useCurrentFoundryUser`, `useFoundryUser`, `useFoundryUsersList` - Platform APIs (requires `@osdk/foundry.admin`)
80
31
 
81
- ### Actions (useOsdkAction)
32
+ ## Correct Patterns
82
33
 
83
- ```tsx
84
- import { $Actions } from "@my/osdk";
85
- import { useOsdkAction } from "@osdk/react/experimental";
86
-
87
- function CompleteTodoButton({ todo }) {
88
- const {
89
- applyAction,
90
- validateAction,
91
- isPending,
92
- isValidating,
93
- error,
94
- data,
95
- validationResult,
96
- } = useOsdkAction($Actions.completeTodo);
97
-
98
- // Validate before applying
99
- const handleValidate = async () => {
100
- const result = await validateAction({ todo, isComplete: true });
101
- };
102
-
103
- // Apply the action
104
- const handleComplete = async () => {
105
- await applyAction({ todo, isComplete: true });
106
- };
107
-
108
- // With optimistic update (use $ prefix for client options)
109
- const handleOptimistic = async () => {
110
- await applyAction({
111
- todo,
112
- isComplete: true,
113
- $optimisticUpdate: (ctx) => {
114
- ctx.updateObject(todo, { isComplete: true });
115
- },
116
- });
117
- };
118
-
119
- return (
120
- <button onClick={handleComplete} disabled={isPending}>
121
- Complete
122
- </button>
123
- );
124
- }
125
- ```
34
+ | Hook | Key Options |
35
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
36
+ | `useOsdkObjects` | `where`, `orderBy`, `pageSize`, `withProperties`, `enabled`, `autoFetchMore`, `dedupeIntervalMs`, `streamUpdates`, `intersectWith`, `pivotTo` |
37
+ | `useObjectSet` | Same as above plus `union`, `intersect`, `subtract`. Use when you need set operations. |
38
+ | `useOsdkObject` | `enabled` is **positional** (2nd param for instance, 3rd for type+key) |
39
+ | `useLinks` | `where`, `pageSize`, `enabled`, `mode` (`"force"` / `"offline"`), `dedupeIntervalMs`. Accepts single object or array. |
40
+ | `useOsdkAction` | Returns `applyAction`, `validateAction`, `isPending`, `error`, `validationResult`. Pass `$optimisticUpdate` with `$` prefix in action params. |
41
+ | `useOsdkAggregation` | `where`, `aggregate: { $groupBy, $select }`. Metrics: `$count`, `sum`, `avg`, `min`, `max`, `exactDistinct`, `approximateDistinct`. |
42
+ | `useOsdkFunction` | `params`, `dependsOn` (object types), `dependsOnObjects` (instances), `enabled`, `dedupeIntervalMs` |
126
43
 
127
- ### Links (useLinks)
44
+ ## Text Search Filters
128
45
 
129
- ```tsx
130
- import { useLinks } from "@osdk/react/experimental";
131
-
132
- // Single object
133
- const { links, isLoading, hasMore, fetchMore, error } = useLinks(
134
- employee,
135
- "directReports",
136
- { pageSize: 20 },
137
- );
138
-
139
- // Multiple objects (returns all linked objects)
140
- const { links: allReports } = useLinks(
141
- [employee1, employee2],
142
- "directReports",
143
- );
144
- ```
46
+ `$startsWith`, `$containsAnyTerm`, `$containsAllTerms`, `$containsAllTermsInOrder`. All support `{ term, fuzzySearch: true }`.
145
47
 
146
- ### Object Set Operations (useObjectSet)
48
+ ## useOsdkObjects vs useObjectSet
147
49
 
148
- ```tsx
149
- import { Employee } from "@my/osdk";
150
- import { useObjectSet } from "@osdk/react/experimental";
151
-
152
- const { data, isLoading, fetchMore, objectSet } = useObjectSet(
153
- Employee.all(),
154
- {
155
- where: { department: "Engineering" },
156
- orderBy: { hireDate: "desc" },
157
- pageSize: 50,
158
- union: [otherObjectSet],
159
- intersect: [anotherObjectSet],
160
- autoFetchMore: 100, // fetch until 100 items
161
- streamUpdates: true,
162
- enabled: true,
163
- },
164
- );
165
- ```
50
+ Use `useOsdkObjects` by default (more optimized). Use `useObjectSet` only when you need `union`/`intersect`/`subtract` set operations.
166
51
 
167
- ### Aggregations (useOsdkAggregation)
52
+ ## Cache
168
53
 
169
- ```tsx
170
- import { Employee } from "@my/osdk";
171
- import { useOsdkAggregation } from "@osdk/react/experimental";
172
-
173
- const { data, isLoading, error, refetch } = useOsdkAggregation(Employee, {
174
- where: { department: "Engineering" },
175
- aggregate: {
176
- groupBy: { department: "exact" },
177
- select: {
178
- avgSalary: { $avg: "salary" },
179
- count: { $count: {} },
180
- },
181
- },
182
- });
183
- ```
54
+ The `ObservableClient` maintains a normalized cache. Objects update automatically after actions. For manual invalidation: `observableClient.invalidateObjects()`, `.invalidateObjectType()`, `.invalidateFunction()`, `.invalidateAll()`.
184
55
 
185
56
  ## Anti-Patterns
186
57
 
187
- ### Wrong: Conditional Hook Call
188
-
189
- ```tsx
190
- if (shouldLoad) {
191
- const { data } = useOsdkObjects(Todo); // NEVER do this
192
- }
193
- ```
194
-
195
- ### Wrong: Early Return During Loading
196
-
197
- ```tsx
198
- if (isLoading) return <Spinner />; // Causes UI flashing
199
- if (!data) return null; // Loses state
200
- ```
201
-
202
- ### Wrong: Importing from Main Entry
203
-
204
- ```tsx
205
- import { useOsdkObjects } from "@osdk/react"; // WRONG - doesn't exist here
206
- ```
207
-
208
- ### Wrong: Using OsdkProvider Instead of OsdkProvider2
209
-
210
58
  ```tsx
211
- <OsdkProvider client={client}> // WRONG - new hooks won't work
212
- ```
213
-
214
- ### Wrong: Using options object for useOsdkObject enabled
215
-
216
- ```tsx
217
- // WRONG - enabled is positional, not in options
218
- const { object } = useOsdkObject(Employee, id, { enabled: false });
219
-
59
+ // WRONG: conditional hook
60
+ if (x) { useOsdkObjects(Todo); }
61
+ // CORRECT: use enabled
62
+ useOsdkObjects(Todo, { enabled: x });
63
+
64
+ // WRONG: early return
65
+ if (isLoading) return <Spinner />;
66
+ // CORRECT: render together
67
+ <div>{isLoading && <Spinner />}{data?.map(...)}</div>
68
+
69
+ // WRONG: import from main entry
70
+ import { useOsdkObjects } from "@osdk/react";
220
71
  // CORRECT
221
- const { object } = useOsdkObject(Employee, id, false);
222
- ```
223
-
224
- ## Hook Options Reference
225
-
226
- **useOsdkObjects / useObjectSet:**
227
-
228
- - `where` - Filter conditions
229
- - `orderBy` - Sort order (`{ field: "asc" | "desc" }`)
230
- - `pageSize` - Results per page
231
- - `withProperties` - Derived properties
232
- - `enabled` - Enable/disable query
233
- - `autoFetchMore` - Auto-pagination (`true` | `number`)
234
- - `dedupeIntervalMs` - Request deduplication
235
- - `streamUpdates` - WebSocket updates
236
-
237
- **useObjectSet additional:**
238
-
239
- - `union`, `intersect`, `subtract` - Set operations
240
- - `pivotTo` - Pivot to linked type
241
-
242
- **useOsdkObject:**
243
-
244
- - `enabled` is a **positional parameter**, not in options
245
-
246
- **useLinks:**
247
-
248
- - `where`, `pageSize`, `enabled`
249
- - `mode` - `"force"` | `"offline"`
250
-
251
- **useOsdkAction:**
72
+ import { useOsdkObjects } from "@osdk/react/experimental";
252
73
 
253
- - `$optimisticUpdate` - Passed to action with `$` prefix
74
+ // WRONG: useOsdkObject enabled in options
75
+ useOsdkObject(Employee, id, { enabled: false });
76
+ // CORRECT: positional
77
+ useOsdkObject(Employee, id, false);
78
+ ```
package/CHANGELOG.md CHANGED
@@ -1,5 +1,152 @@
1
1
  # @osdkkit/react
2
2
 
3
+ ## 0.10.0-beta.11
4
+
5
+ ### Minor Changes
6
+
7
+ - b1e8bba: add cbac admin hooks for markings, categories, and restrictions
8
+ - 599426b: expose $loadPropertySecurityMetadata option in observable client and react hooks
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [599426b]
13
+ - Updated dependencies [60b5ffb]
14
+ - Updated dependencies [61e33ab]
15
+ - @osdk/client@2.8.0-beta.26
16
+ - @osdk/api@2.8.0-beta.26
17
+
18
+ ## 0.10.0-beta.10
19
+
20
+ ### Minor Changes
21
+
22
+ - dbbfb6f: Add experimental ActionForm component with field renderers, form state hook, and tests
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [cbfa135]
27
+ - Updated dependencies [f4604c2]
28
+ - @osdk/client@2.8.0-beta.22
29
+ - @osdk/api@2.8.0-beta.22
30
+
31
+ ## 0.10.0-beta.9
32
+
33
+ ### Minor Changes
34
+
35
+ - c40444b: Add linkedObjectsBySourcePrimaryKey to link observation responses
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [c40444b]
40
+ - Updated dependencies [dda14be]
41
+ - @osdk/client@2.8.0-beta.21
42
+ - @osdk/api@2.8.0-beta.21
43
+
44
+ ## 0.10.0-beta.8
45
+
46
+ ### Minor Changes
47
+
48
+ - 9720083: Add AGENTS.md files for AI IDE context
49
+ - 09e5659: add $select support to observable client and react hooks
50
+ - 8a82492: Move admin hooks to @osdk/react/experimental/admin subpath to avoid bundler crash when @osdk/foundry.admin is not installed
51
+ - 2ebe62c: package and bundle size optimizations
52
+
53
+ ### Patch Changes
54
+
55
+ - Updated dependencies [09e5659]
56
+ - Updated dependencies [2ebe62c]
57
+ - @osdk/client@2.8.0-beta.16
58
+ - @osdk/api@2.8.0-beta.16
59
+
60
+ ## 0.10.0-beta.7
61
+
62
+ ### Minor Changes
63
+
64
+ - 9156827: Preserve object set data between loads
65
+ - 35f2f1a: Add Media inputs/outputs for Queries
66
+ - 71e28ef: Allow interface object sets in useObjectSet
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [e64bf0b]
71
+ - Updated dependencies [baba327]
72
+ - Updated dependencies [d1ad4d1]
73
+ - Updated dependencies [35f2f1a]
74
+ - Updated dependencies [71e28ef]
75
+ - @osdk/client@2.8.0-beta.14
76
+ - @osdk/api@2.8.0-beta.14
77
+
78
+ ## 0.10.0-beta.6
79
+
80
+ ### Minor Changes
81
+
82
+ - 993c023: ObjectTable supports objectSet input
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [8825f8c]
87
+ - @osdk/client@2.8.0-beta.12
88
+ - @osdk/api@2.8.0-beta.12
89
+
90
+ ## 0.10.0-beta.5
91
+
92
+ ### Minor Changes
93
+
94
+ - 525f277: update useOsdkAggregation to support composed object sets, async
95
+ - d80c234: add interface support to useOsdkObject
96
+ - 996d8e4: memoize hook responses
97
+
98
+ ### Patch Changes
99
+
100
+ - Updated dependencies [642be5f]
101
+ - Updated dependencies [525f277]
102
+ - Updated dependencies [f5f95e2]
103
+ - Updated dependencies [d80c234]
104
+ - @osdk/client@2.8.0-beta.11
105
+ - @osdk/api@2.8.0-beta.11
106
+
107
+ ## 0.10.0-beta.4
108
+
109
+ ### Minor Changes
110
+
111
+ - 727fd0e: fix dual @types/react version mismatch
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [8c60682]
116
+ - Updated dependencies [15e1686]
117
+ - Updated dependencies [c9d954d]
118
+ - Updated dependencies [044eb80]
119
+ - Updated dependencies [9d234b9]
120
+ - @osdk/client@2.8.0-beta.6
121
+ - @osdk/api@2.8.0-beta.6
122
+
123
+ ## 0.10.0-beta.3
124
+
125
+ ### Minor Changes
126
+
127
+ - 73e617e: expose dedupeInterval on useLinks and fix forced revalidation bypassing dedupeInterval
128
+ - a027f3c: stabilize subscription deps in useOsdkObjects and useOsdkAggregation
129
+
130
+ ### Patch Changes
131
+
132
+ - Updated dependencies [73e617e]
133
+ - Updated dependencies [5848e3c]
134
+ - @osdk/client@2.8.0-beta.4
135
+ - @osdk/api@2.8.0-beta.4
136
+
137
+ ## 0.10.0-beta.2
138
+
139
+ ### Minor Changes
140
+
141
+ - 0d174a2: useOsdkFunction typing updates
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [26cec61]
146
+ - Updated dependencies [0d174a2]
147
+ - @osdk/client@2.8.0-beta.3
148
+ - @osdk/api@2.8.0-beta.3
149
+
3
150
  ## 0.9.0-beta.10
4
151
 
5
152
  ### Minor Changes
@@ -42,4 +42,65 @@ export function makeExternalStore(createObservation, _name, initialValue) {
42
42
  getSnapShot
43
43
  };
44
44
  }
45
+
46
+ /**
47
+ * Like makeExternalStore but for async subscription creation.
48
+ *
49
+ * Uses an isActive flag to handle race conditions:
50
+ * If cleanup runs before promise resolves, the stale subscription is
51
+ * immediately unsubscribed when it eventually resolves
52
+ */
53
+ export function makeExternalStoreAsync(createObservation, _name, initialValue) {
54
+ let lastResult = initialValue;
55
+ function getSnapShot() {
56
+ return lastResult;
57
+ }
58
+ function subscribe(notifyUpdate) {
59
+ let isActive = true;
60
+ let currentSubscription;
61
+ const subscriptionPromise = createObservation({
62
+ next: payload => {
63
+ if (isActive) {
64
+ lastResult = payload;
65
+ notifyUpdate();
66
+ }
67
+ },
68
+ error: error => {
69
+ if (isActive) {
70
+ lastResult = {
71
+ ...(lastResult ?? {}),
72
+ error: error instanceof Error ? error : new Error(String(error))
73
+ };
74
+ notifyUpdate();
75
+ }
76
+ },
77
+ complete: () => {}
78
+ });
79
+ subscriptionPromise.then(sub => {
80
+ if (isActive) {
81
+ currentSubscription = sub;
82
+ } else {
83
+ sub.unsubscribe();
84
+ }
85
+ }).catch(error => {
86
+ if (isActive) {
87
+ lastResult = {
88
+ ...(lastResult ?? {}),
89
+ error: error instanceof Error ? error : new Error(String(error))
90
+ };
91
+ notifyUpdate();
92
+ }
93
+ });
94
+ return () => {
95
+ isActive = false;
96
+ if (currentSubscription) {
97
+ currentSubscription.unsubscribe();
98
+ }
99
+ };
100
+ }
101
+ return {
102
+ subscribe,
103
+ getSnapShot
104
+ };
105
+ }
45
106
  //# sourceMappingURL=makeExternalStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"makeExternalStore.js","names":["makeExternalStore","createObservation","_name","initialValue","lastResult","getSnapShot","subscribe","notifyUpdate","obs","next","payload","error","Error","String","complete","unsubscribe"],"sources":["makeExternalStore.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 Observer,\n Unsubscribable,\n} from \"@osdk/client/unstable-do-not-use\";\n\nexport type Snapshot<X> =\n | X & { error?: Error }\n | (Partial<X> & { error?: Error })\n | undefined;\n\nexport function makeExternalStore<X>(\n createObservation: (callback: Observer<X | undefined>) => Unsubscribable,\n _name?: string,\n initialValue?: Snapshot<X>,\n): {\n subscribe: (notifyUpdate: () => void) => () => void;\n getSnapShot: () => Snapshot<X>;\n} {\n let lastResult: Snapshot<X> = initialValue;\n\n function getSnapShot(): Snapshot<X> {\n return lastResult;\n }\n\n function subscribe(notifyUpdate: () => void) {\n const obs = createObservation({\n next: (payload) => {\n lastResult = payload as Snapshot<X>;\n notifyUpdate();\n },\n error: (error: unknown) => {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error)),\n } as Snapshot<X>;\n notifyUpdate();\n },\n complete: () => {},\n });\n\n return (): void => {\n obs.unsubscribe();\n };\n }\n\n return {\n subscribe,\n getSnapShot,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAO,SAASA,iBAAiBA,CAC/BC,iBAAwE,EACxEC,KAAc,EACdC,YAA0B,EAI1B;EACA,IAAIC,UAAuB,GAAGD,YAAY;EAE1C,SAASE,WAAWA,CAAA,EAAgB;IAClC,OAAOD,UAAU;EACnB;EAuBA,OAAO;IACLE,SAAS,EAtBX,SAASA,SAASA,CAACC,YAAwB,EAAE;MAC3C,MAAMC,GAAG,GAAGP,iBAAiB,CAAC;QAC5BQ,IAAI,EAAGC,OAAO,IAAK;UACjBN,UAAU,GAAGM,OAAsB;UACnCH,YAAY,CAAC,CAAC;QAChB,CAAC;QACDI,KAAK,EAAGA,KAAc,IAAK;UACzBP,UAAU,GAAG;YACX,IAAIA,UAAU,IAAI,CAAC,CAAC,CAAC;YACrBO,KAAK,EAAEA,KAAK,YAAYC,KAAK,GAAGD,KAAK,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACF,KAAK,CAAC;UACjE,CAAgB;UAChBJ,YAAY,CAAC,CAAC;QAChB,CAAC;QACDO,QAAQ,EAAEA,CAAA,KAAM,CAAC;MACnB,CAAC,CAAC;MAEF,OAAO,MAAY;QACjBN,GAAG,CAACO,WAAW,CAAC,CAAC;MACnB,CAAC;IACH,CAGW;IACTV;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"makeExternalStore.js","names":["makeExternalStore","createObservation","_name","initialValue","lastResult","getSnapShot","subscribe","notifyUpdate","obs","next","payload","error","Error","String","complete","unsubscribe","makeExternalStoreAsync","isActive","currentSubscription","subscriptionPromise","then","sub","catch"],"sources":["makeExternalStore.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 Observer,\n Unsubscribable,\n} from \"@osdk/client/unstable-do-not-use\";\n\nexport type Snapshot<X> =\n | X & { error?: Error }\n | (Partial<X> & { error?: Error })\n | undefined;\n\nexport function makeExternalStore<X>(\n createObservation: (callback: Observer<X | undefined>) => Unsubscribable,\n _name?: string,\n initialValue?: Snapshot<X>,\n): {\n subscribe: (notifyUpdate: () => void) => () => void;\n getSnapShot: () => Snapshot<X>;\n} {\n let lastResult: Snapshot<X> = initialValue;\n\n function getSnapShot(): Snapshot<X> {\n return lastResult;\n }\n\n function subscribe(notifyUpdate: () => void) {\n const obs = createObservation({\n next: (payload) => {\n lastResult = payload as Snapshot<X>;\n notifyUpdate();\n },\n error: (error: unknown) => {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error)),\n } as Snapshot<X>;\n notifyUpdate();\n },\n complete: () => {},\n });\n\n return (): void => {\n obs.unsubscribe();\n };\n }\n\n return {\n subscribe,\n getSnapShot,\n };\n}\n\n/**\n * Like makeExternalStore but for async subscription creation.\n *\n * Uses an isActive flag to handle race conditions:\n * If cleanup runs before promise resolves, the stale subscription is\n * immediately unsubscribed when it eventually resolves\n */\nexport function makeExternalStoreAsync<X>(\n createObservation: (\n callback: Observer<X | undefined>,\n ) => Promise<Unsubscribable>,\n _name?: string,\n initialValue?: Snapshot<X>,\n): {\n subscribe: (notifyUpdate: () => void) => () => void;\n getSnapShot: () => Snapshot<X>;\n} {\n let lastResult: Snapshot<X> = initialValue;\n\n function getSnapShot(): Snapshot<X> {\n return lastResult;\n }\n\n function subscribe(notifyUpdate: () => void) {\n let isActive = true;\n let currentSubscription: Unsubscribable | undefined;\n\n const subscriptionPromise = createObservation({\n next: (payload) => {\n if (isActive) {\n lastResult = payload as Snapshot<X>;\n notifyUpdate();\n }\n },\n error: (error: unknown) => {\n if (isActive) {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error)),\n } as Snapshot<X>;\n notifyUpdate();\n }\n },\n complete: () => {},\n });\n\n subscriptionPromise.then((sub) => {\n if (isActive) {\n currentSubscription = sub;\n } else {\n sub.unsubscribe();\n }\n }).catch((error: unknown) => {\n if (isActive) {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error)),\n } as Snapshot<X>;\n notifyUpdate();\n }\n });\n\n return (): void => {\n isActive = false;\n if (currentSubscription) {\n currentSubscription.unsubscribe();\n }\n };\n }\n\n return {\n subscribe,\n getSnapShot,\n };\n}\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,63 @@
1
+ /*
2
+ * Copyright 2026 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 { CbacBanners } from "@osdk/foundry.admin";
18
+ import React from "react";
19
+ import { usePlatformQuery } from "../../../utils/usePlatformQuery.js";
20
+ import { OsdkContext2 } from "../../OsdkContext2.js";
21
+ /**
22
+ * Get the CBAC banner data for the given marking IDs.
23
+ * @param options Options to control the query.
24
+ */
25
+ export function useCbacBanner({
26
+ markingIds,
27
+ enabled: externalEnabled = true
28
+ }) {
29
+ const {
30
+ client
31
+ } = React.useContext(OsdkContext2);
32
+ const stableMarkingIds = React.useMemo(() => markingIds, [JSON.stringify(markingIds)]);
33
+ const enabled = stableMarkingIds.length > 0 && externalEnabled;
34
+ const handleQuery = React.useCallback(() => {
35
+ return CbacBanners.get(client, {
36
+ markingIds: stableMarkingIds,
37
+ preview: true
38
+ });
39
+ }, [client, stableMarkingIds]);
40
+ const query = usePlatformQuery({
41
+ query: handleQuery,
42
+ enabled,
43
+ queryName: "cbac-banner"
44
+ });
45
+ const banner = React.useMemo(() => {
46
+ if (query.data == null) {
47
+ return undefined;
48
+ }
49
+ return {
50
+ classificationString: query.data.classificationString,
51
+ textColor: query.data.textColor,
52
+ backgroundColors: query.data.backgroundColors,
53
+ markingIds: query.data.markings
54
+ };
55
+ }, [query.data]);
56
+ return {
57
+ banner,
58
+ isLoading: query.isLoading,
59
+ error: query.error,
60
+ refetch: query.refetch
61
+ };
62
+ }
63
+ //# sourceMappingURL=useCbacBanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCbacBanner.js","names":["CbacBanners","React","usePlatformQuery","OsdkContext2","useCbacBanner","markingIds","enabled","externalEnabled","client","useContext","stableMarkingIds","useMemo","JSON","stringify","length","handleQuery","useCallback","get","preview","query","queryName","banner","data","undefined","classificationString","textColor","backgroundColors","markings","isLoading","error","refetch"],"sources":["useCbacBanner.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { CbacBanners } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n\nexport interface CbacBannerData {\n classificationString: string;\n textColor: string;\n backgroundColors: string[];\n markingIds: string[];\n}\n\nexport interface UseCbacBannerOptions {\n markingIds: string[];\n /**\n * Enable or disable the query.\n *\n * When `false`, the query will not automatically execute.\n *\n * This is useful for:\n * - Lazy/on-demand queries that should wait for user interaction\n * - Dependent queries that need data from another query first\n * - Conditional queries based on component state\n *\n * @default true\n */\n enabled?: boolean;\n}\n\nexport interface UseCbacBannerResult {\n banner: CbacBannerData | undefined;\n isLoading: boolean;\n\n error: Error | undefined;\n\n refetch: () => void;\n}\n\n/**\n * Get the CBAC banner data for the given marking IDs.\n * @param options Options to control the query.\n */\nexport function useCbacBanner(\n { markingIds, enabled: externalEnabled = true }: UseCbacBannerOptions,\n): UseCbacBannerResult {\n const { client } = React.useContext(OsdkContext2);\n\n const stableMarkingIds = React.useMemo(\n () => markingIds,\n [JSON.stringify(markingIds)],\n );\n\n const enabled = stableMarkingIds.length > 0 && externalEnabled;\n\n const handleQuery = React.useCallback(() => {\n return CbacBanners.get(client, {\n markingIds: stableMarkingIds,\n preview: true,\n });\n }, [client, stableMarkingIds]);\n\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"cbac-banner\",\n });\n\n const banner = React.useMemo((): CbacBannerData | undefined => {\n if (query.data == null) {\n return undefined;\n }\n return {\n classificationString: query.data.classificationString,\n textColor: query.data.textColor,\n backgroundColors: query.data.backgroundColors,\n markingIds: query.data.markings,\n };\n }, [query.data]);\n\n return {\n banner,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,qBAAqB;AACjD,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,YAAY,QAAQ,uBAAuB;AAmCpD;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAC3B;EAAEC,UAAU;EAAEC,OAAO,EAAEC,eAAe,GAAG;AAA2B,CAAC,EAChD;EACrB,MAAM;IAAEC;EAAO,CAAC,GAAGP,KAAK,CAACQ,UAAU,CAACN,YAAY,CAAC;EAEjD,MAAMO,gBAAgB,GAAGT,KAAK,CAACU,OAAO,CACpC,MAAMN,UAAU,EAChB,CAACO,IAAI,CAACC,SAAS,CAACR,UAAU,CAAC,CAC7B,CAAC;EAED,MAAMC,OAAO,GAAGI,gBAAgB,CAACI,MAAM,GAAG,CAAC,IAAIP,eAAe;EAE9D,MAAMQ,WAAW,GAAGd,KAAK,CAACe,WAAW,CAAC,MAAM;IAC1C,OAAOhB,WAAW,CAACiB,GAAG,CAACT,MAAM,EAAE;MAC7BH,UAAU,EAAEK,gBAAgB;MAC5BQ,OAAO,EAAE;IACX,CAAC,CAAC;EACJ,CAAC,EAAE,CAACV,MAAM,EAAEE,gBAAgB,CAAC,CAAC;EAE9B,MAAMS,KAAK,GAAGjB,gBAAgB,CAAC;IAC7BiB,KAAK,EAAEJ,WAAW;IAClBT,OAAO;IACPc,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,MAAMC,MAAM,GAAGpB,KAAK,CAACU,OAAO,CAAC,MAAkC;IAC7D,IAAIQ,KAAK,CAACG,IAAI,IAAI,IAAI,EAAE;MACtB,OAAOC,SAAS;IAClB;IACA,OAAO;MACLC,oBAAoB,EAAEL,KAAK,CAACG,IAAI,CAACE,oBAAoB;MACrDC,SAAS,EAAEN,KAAK,CAACG,IAAI,CAACG,SAAS;MAC/BC,gBAAgB,EAAEP,KAAK,CAACG,IAAI,CAACI,gBAAgB;MAC7CrB,UAAU,EAAEc,KAAK,CAACG,IAAI,CAACK;IACzB,CAAC;EACH,CAAC,EAAE,CAACR,KAAK,CAACG,IAAI,CAAC,CAAC;EAEhB,OAAO;IACLD,MAAM;IACNO,SAAS,EAAET,KAAK,CAACS,SAAS;IAC1BC,KAAK,EAAEV,KAAK,CAACU,KAAK;IAClBC,OAAO,EAAEX,KAAK,CAACW;EACjB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Copyright 2026 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 { CbacMarkingRestrictionsObjects } from "@osdk/foundry.admin";
18
+ import React from "react";
19
+ import { usePlatformQuery } from "../../../utils/usePlatformQuery.js";
20
+ import { OsdkContext2 } from "../../OsdkContext2.js";
21
+ /**
22
+ * Get CBAC marking restrictions (implied, disallowed, required) for the given marking IDs.
23
+ * @param options Options to control the query.
24
+ */
25
+ export function useCbacMarkingRestrictions({
26
+ markingIds,
27
+ enabled: externalEnabled = true
28
+ }) {
29
+ const {
30
+ client
31
+ } = React.useContext(OsdkContext2);
32
+ const stableMarkingIds = React.useMemo(() => markingIds, [JSON.stringify(markingIds)]);
33
+ const enabled = stableMarkingIds.length > 0 && externalEnabled;
34
+ const handleQuery = React.useCallback(() => {
35
+ return CbacMarkingRestrictionsObjects.get(client, {
36
+ markingIds: stableMarkingIds,
37
+ preview: true
38
+ });
39
+ }, [client, stableMarkingIds]);
40
+ const query = usePlatformQuery({
41
+ query: handleQuery,
42
+ enabled,
43
+ queryName: "cbac-marking-restrictions"
44
+ });
45
+ const restrictions = React.useMemo(() => {
46
+ if (query.data == null) {
47
+ return undefined;
48
+ }
49
+ return {
50
+ disallowedMarkings: query.data.disallowedMarkings.map(String),
51
+ impliedMarkings: query.data.impliedMarkings.map(String),
52
+ requiredMarkings: query.data.requiredMarkings.map(group => group.map(String)),
53
+ userSatisfiesMarkings: query.data.userSatisfiesMarkings,
54
+ isValid: query.data.isValid
55
+ };
56
+ }, [query.data]);
57
+ return {
58
+ restrictions,
59
+ isLoading: query.isLoading,
60
+ error: query.error,
61
+ refetch: query.refetch
62
+ };
63
+ }
64
+ //# sourceMappingURL=useCbacMarkingRestrictions.js.map