@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
@@ -1,10 +1,8 @@
1
- import { Client, Osdk, WhereClause, PropertyKeys, ActionDefinition, ActionEditResponse, ActionValidationError, ActionValidationResponse } from '@osdk/client';
2
- import { ObservableClient, ActionSignatureFromDef, QueryParameterType, QueryReturnType } from '@osdk/client/unstable-do-not-use';
1
+ import { Client, Osdk, WhereClause, PropertyKeys, ActionDefinition, ActionEditResponse, ActionValidationError, ActionValidationResponse, ObjectTypeDefinition } from '@osdk/client';
2
+ import { ObservableClient, ActionSignatureFromDef, QueryParameterType } from '@osdk/client/unstable-do-not-use';
3
3
  import React from 'react';
4
- import { User, ListUsersResponse } from '@osdk/foundry.admin';
5
- import { UserStatus } from '@osdk/foundry.core';
6
- import { ObjectOrInterfaceDefinition, LinkNames, LinkedType, ObjectTypeDefinition, SimplePropertyDef, ObjectSet, WhereClause as WhereClause$1, DerivedProperty, PropertyKeys as PropertyKeys$1, Osdk as Osdk$1, AggregateOpts, AggregationsResults, QueryDefinition, CompileTimeMetadata, PrimaryKeyType } from '@osdk/api';
7
- export { U as UseOsdkMetadataResult, u as useOsdkClient, a as useOsdkMetadata } from '../useOsdkMetadata-DFZhnhGZ.cjs';
4
+ import { ObjectOrInterfaceDefinition, LinkNames, LinkedType, SimplePropertyDef, ObjectSet, WhereClause as WhereClause$1, DerivedProperty, PropertyKeys as PropertyKeys$1, Osdk as Osdk$1, AggregateOpts, AggregationsResults, QueryDefinition, CompileTimeMetadata, ObjectTypeDefinition as ObjectTypeDefinition$1, PrimaryKeyType } from '@osdk/api';
5
+ export { U as UseOsdkMetadataResult, u as useOsdkClient, a as useOsdkMetadata } from '../useOsdkMetadata-BElt3F5s.cjs';
8
6
 
9
7
  interface OsdkProviderOptions {
10
8
  children: React.ReactNode;
@@ -13,120 +11,6 @@ interface OsdkProviderOptions {
13
11
  }
14
12
  declare function OsdkProvider2({ children, client, observableClient, }: OsdkProviderOptions): React.JSX.Element;
15
13
 
16
- interface UseCurrentFoundryUserOptions {
17
- /**
18
- * Enable or disable the query.
19
- *
20
- * When `false`, the query will not automatically execute.
21
- *
22
- * This is useful for:
23
- * - Lazy/on-demand queries that should wait for user interaction
24
- * - Dependent queries that need data from another query first
25
- * - Conditional queries based on component state
26
- *
27
- * @default true
28
- * });
29
- */
30
- enabled?: boolean;
31
- }
32
- interface UseCurrentFoundryUserResult {
33
- currentUser: User | undefined;
34
- isLoading: boolean;
35
- error: Error | undefined;
36
- refetch: () => void;
37
- }
38
- /**
39
- * Get the currently signed in User.
40
- * @param options Options to control the query.
41
- */
42
- declare function useCurrentFoundryUser({ enabled }?: UseCurrentFoundryUserOptions): UseCurrentFoundryUserResult;
43
-
44
- interface UseFoundryUserOptions {
45
- /**
46
- * Enable or disable the query.
47
- *
48
- * When `false`, the query will not automatically execute.
49
- *
50
- * This is useful for:
51
- * - Lazy/on-demand queries that should wait for user interaction
52
- * - Dependent queries that need data from another query first
53
- * - Conditional queries based on component state
54
- *
55
- * @default true
56
- * });
57
- */
58
- enabled?: boolean;
59
- /**
60
- * The default status of the users returned in the list.
61
- *
62
- * @default "ACTIVE"
63
- */
64
- status?: UserStatus;
65
- }
66
- interface UseFoundryUserResult {
67
- user: User | undefined;
68
- isLoading: boolean;
69
- error: Error | undefined;
70
- refetch: () => void;
71
- }
72
- /**
73
- * Get the User with the specified id.
74
- * @param userId A Foundry User ID.
75
- * @param options Options to control the query.
76
- */
77
- declare function useFoundryUser(userId: string, { enabled, status }?: UseFoundryUserOptions): UseFoundryUserResult;
78
-
79
- interface UseFoundryUsersListOptions {
80
- /**
81
- * Enable or disable the query.
82
- *
83
- * When `false`, the query will not automatically execute.
84
- *
85
- * This is useful for:
86
- * - Lazy/on-demand queries that should wait for user interaction
87
- * - Dependent queries that need data from another query first
88
- * - Conditional queries based on component state
89
- *
90
- * @default true
91
- * });
92
- */
93
- enabled?: boolean;
94
- /**
95
- * The default status of the users returned in the list.
96
- *
97
- * @default "ACTIVE"
98
- */
99
- include?: UserStatus;
100
- /**
101
- * The preferred page size for the list.
102
- *
103
- * @default 1000
104
- */
105
- pageSize?: number;
106
- /**
107
- * The page token indicates where to start paging. This should be omitted from the first page's request.
108
- * To fetch the next page, clients should take the value from the nextPageToken field of the previous
109
- * response and use it to populate the pageToken field of the next request.
110
- */
111
- pageToken?: string;
112
- }
113
- interface UseFoundryUsersListResult {
114
- users: ListUsersResponse["data"] | undefined;
115
- /**
116
- * The page token to be used for the next page of users. If this is undefined, there are no more
117
- * pages of users to load.
118
- */
119
- nextPageToken: string | undefined;
120
- isLoading: boolean;
121
- error: Error | undefined;
122
- refetch: () => void;
123
- }
124
- /**
125
- * Lists all Users. This is a paged endpoint. Each page may be smaller or larger than the requested page size.
126
- * @param options Options to control the query.
127
- */
128
- declare function useFoundryUsersList({ enabled, include, pageSize, pageToken }?: UseFoundryUsersListOptions): UseFoundryUsersListResult;
129
-
130
14
  interface UseLinksOptions<T extends ObjectOrInterfaceDefinition> {
131
15
  /**
132
16
  * Standard OSDK Where clause for filtering linked objects
@@ -140,6 +24,12 @@ interface UseLinksOptions<T extends ObjectOrInterfaceDefinition> {
140
24
  orderBy?: {
141
25
  [K in PropertyKeys<T>]?: "asc" | "desc";
142
26
  };
27
+ /**
28
+ * Restrict which properties are returned for each linked object.
29
+ * When provided, only the specified properties will be fetched,
30
+ * reducing payload sizes for list views.
31
+ */
32
+ $select?: readonly PropertyKeys<T>[];
143
33
  /**
144
34
  * The mode to use for fetching data.
145
35
  * - undefined: Fetch data if not already in cache
@@ -147,6 +37,13 @@ interface UseLinksOptions<T extends ObjectOrInterfaceDefinition> {
147
37
  * - "offline": Only use cached data, don't make network requests
148
38
  */
149
39
  mode?: "force" | "offline";
40
+ /**
41
+ * The number of milliseconds to wait after the last observed link change.
42
+ *
43
+ * Two uses of `useLinks` with the same parameters will only trigger one
44
+ * network request if the second is within `dedupeIntervalMs`.
45
+ */
46
+ dedupeIntervalMs?: number;
150
47
  /**
151
48
  * Enable or disable the query.
152
49
  *
@@ -170,6 +67,12 @@ interface UseLinksOptions<T extends ObjectOrInterfaceDefinition> {
170
67
  }
171
68
  interface UseLinksResult<Q extends ObjectOrInterfaceDefinition> {
172
69
  links: Osdk.Instance<Q>[] | undefined;
70
+ /**
71
+ * Maps each source object's primary key to its linked object instances.
72
+ * Useful when observing links from multiple source objects to determine
73
+ * which source links to which targets.
74
+ */
75
+ linkedObjectsBySourcePrimaryKey: ReadonlyMap<string | number, ReadonlyArray<Osdk.Instance<Q>>>;
173
76
  isLoading: boolean;
174
77
  error: Error | undefined;
175
78
  /**
@@ -195,7 +98,7 @@ interface UseLinksResult<Q extends ObjectOrInterfaceDefinition> {
195
98
  */
196
99
  declare function useLinks<T extends ObjectOrInterfaceDefinition, L extends LinkNames<T>>(objects: Osdk.Instance<T> | Array<Osdk.Instance<T>> | undefined, linkName: L, options?: UseLinksOptions<LinkedType<T, L>>): UseLinksResult<LinkedType<T, L>>;
197
100
 
198
- interface UseObjectSetOptions<Q extends ObjectTypeDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
101
+ interface UseObjectSetOptions<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
199
102
  /**
200
103
  * Where clause for filtering
201
104
  */
@@ -252,6 +155,12 @@ interface UseObjectSetOptions<Q extends ObjectTypeDefinition, RDPs extends Recor
252
155
  * @default false
253
156
  */
254
157
  streamUpdates?: boolean;
158
+ /**
159
+ * Restrict which properties are returned for each object.
160
+ * When provided, only the specified properties will be fetched,
161
+ * reducing payload sizes for list views.
162
+ */
163
+ $select?: readonly PropertyKeys$1<Q>[];
255
164
  /**
256
165
  * Enable or disable the query.
257
166
  *
@@ -273,7 +182,7 @@ interface UseObjectSetOptions<Q extends ObjectTypeDefinition, RDPs extends Recor
273
182
  */
274
183
  enabled?: boolean;
275
184
  }
276
- interface UseObjectSetResult<Q extends ObjectTypeDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
185
+ interface UseObjectSetResult<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
277
186
  /**
278
187
  * The fetched data with derived properties
279
188
  */
@@ -310,7 +219,7 @@ interface UseObjectSetResult<Q extends ObjectTypeDefinition, RDPs extends Record
310
219
  * @param options - Options for filtering, sorting, and adding new derived properties
311
220
  * @returns Object set data with both existing and new derived properties
312
221
  */
313
- declare function useObjectSet<Q extends ObjectTypeDefinition, BaseRDPs extends Record<string, SimplePropertyDef> = never, RDPs extends Record<string, SimplePropertyDef> = {}>(baseObjectSet: ObjectSet<Q, BaseRDPs>, options?: UseObjectSetOptions<Q, RDPs>): UseObjectSetResult<Q, RDPs>;
222
+ declare function useObjectSet<Q extends ObjectOrInterfaceDefinition, BaseRDPs extends Record<string, SimplePropertyDef> = never, RDPs extends Record<string, SimplePropertyDef> = {}>(baseObjectSet: ObjectSet<Q, BaseRDPs>, options?: UseObjectSetOptions<Q, RDPs>): UseObjectSetResult<Q, RDPs>;
314
223
 
315
224
  type ApplyActionParams<Q extends ActionDefinition<any>> = Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0] & {
316
225
  [K in keyof ObservableClient.ApplyActionOptions as `$${K}`]: ObservableClient.ApplyActionOptions[K];
@@ -336,7 +245,7 @@ interface UseOsdkActionResult<Q extends ActionDefinition<any>> {
336
245
  }
337
246
  declare function useOsdkAction<Q extends ActionDefinition<any>>(actionDef: Q): UseOsdkActionResult<Q>;
338
247
 
339
- interface UseOsdkAggregationOptions<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> {
248
+ interface UseOsdkAggregationBaseOptions<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> {
340
249
  /**
341
250
  * Standard OSDK Where clause to filter objects before aggregation
342
251
  */
@@ -348,6 +257,14 @@ interface UseOsdkAggregationOptions<T extends ObjectOrInterfaceDefinition, A ext
348
257
  withProperties?: {
349
258
  [K in keyof RDPs]: DerivedProperty.Creator<T, RDPs[K]>;
350
259
  };
260
+ /**
261
+ * Intersect the main query with additional filtered object sets.
262
+ * Each entry creates a separate object set with its own where clause,
263
+ * and the final result is the intersection of all sets.
264
+ */
265
+ intersectWith?: Array<{
266
+ where: WhereClause$1<T, RDPs>;
267
+ }>;
351
268
  /**
352
269
  * Aggregation options including groupBy and select
353
270
  */
@@ -360,6 +277,14 @@ interface UseOsdkAggregationOptions<T extends ObjectOrInterfaceDefinition, A ext
360
277
  */
361
278
  dedupeIntervalMs?: number;
362
279
  }
280
+ interface UseOsdkAggregationOptions<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> extends UseOsdkAggregationBaseOptions<T, A, RDPs> {
281
+ }
282
+ interface UseOsdkAggregationOptionsWithObjectSet<T extends ObjectTypeDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> extends UseOsdkAggregationBaseOptions<T, A, RDPs> {
283
+ /**
284
+ * The ObjectSet to aggregate on. Enables aggregation on pivoted, filtered, or composed ObjectSets.
285
+ */
286
+ objectSet: ObjectSet<T>;
287
+ }
363
288
  interface UseOsdkAggregationResult<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>> {
364
289
  data: AggregationsResults<T, A> | undefined;
365
290
  isLoading: boolean;
@@ -378,6 +303,7 @@ interface UseOsdkAggregationResult<T extends ObjectOrInterfaceDefinition, A exte
378
303
  *
379
304
  * @example
380
305
  * ```tsx
306
+ * // Basic aggregation without ObjectSet
381
307
  * const { data, isLoading, error } = useOsdkAggregation(Employee, {
382
308
  * where: { department: "Engineering" },
383
309
  * aggregate: {
@@ -388,9 +314,17 @@ interface UseOsdkAggregationResult<T extends ObjectOrInterfaceDefinition, A exte
388
314
  * }
389
315
  * }
390
316
  * });
317
+ *
318
+ * // With a pivoted ObjectSet
319
+ * const pivotedSet = useMemo(() => $(Employee).pivotTo("primaryOffice"), []);
320
+ * const { data } = useOsdkAggregation(Office, {
321
+ * objectSet: pivotedSet,
322
+ * aggregate: { $select: { $count: "unordered" } }
323
+ * });
391
324
  * ```
392
325
  */
393
- declare function useOsdkAggregation<Q extends ObjectOrInterfaceDefinition, const A extends AggregateOpts<Q>, RDPs extends Record<string, SimplePropertyDef> = {}>(type: Q, { where, withProperties, aggregate, dedupeIntervalMs, }: UseOsdkAggregationOptions<Q, A, RDPs>): UseOsdkAggregationResult<Q, A>;
326
+ declare function useOsdkAggregation<Q extends ObjectOrInterfaceDefinition, const A extends AggregateOpts<Q>, RDPs extends Record<string, SimplePropertyDef> = {}>(type: Q, options: UseOsdkAggregationOptions<Q, A, RDPs>): UseOsdkAggregationResult<Q, A>;
327
+ declare function useOsdkAggregation<Q extends ObjectTypeDefinition, const A extends AggregateOpts<Q>, RDPs extends Record<string, SimplePropertyDef> = {}>(type: Q, options: UseOsdkAggregationOptionsWithObjectSet<Q, A, RDPs>): UseOsdkAggregationResult<Q, A>;
394
328
 
395
329
  interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {
396
330
  /**
@@ -408,19 +342,25 @@ interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {
408
342
  * { dependsOn: [Employee] }
409
343
  * ```
410
344
  */
411
- dependsOn?: Array<ObjectTypeDefinition | string>;
345
+ dependsOn?: Array<ObjectTypeDefinition$1 | string>;
412
346
  /**
413
- * Specific object instances this function depends on.
347
+ * Specific object instances or ObjectSets this function depends on.
414
348
  * When any of these specific objects change, the function will refetch.
415
349
  * More fine-grained than dependsOn for precise invalidation control.
416
350
  *
351
+ * For ObjectSets, the object type is extracted asynchronously and changes
352
+ * to any object of that type will trigger a refetch.
353
+ *
417
354
  * @example
418
355
  * ```tsx
419
356
  * // Refetch when this specific employee changes
420
357
  * { dependsOnObjects: [employee] }
358
+ *
359
+ * // Refetch when any object in the ObjectSet's type changes
360
+ * { dependsOnObjects: [employeeObjectSet] }
421
361
  * ```
422
362
  */
423
- dependsOnObjects?: Array<Osdk$1.Instance<ObjectTypeDefinition>>;
363
+ dependsOnObjects?: Array<Osdk$1.Instance<ObjectTypeDefinition$1> | ObjectSet<ObjectTypeDefinition$1>>;
424
364
  /**
425
365
  * The number of milliseconds to dedupe identical function calls.
426
366
  * Two calls with the same function and params will share results
@@ -449,7 +389,7 @@ interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {
449
389
  /**
450
390
  * The function result, or undefined if not yet loaded or on error.
451
391
  */
452
- data: QueryReturnType<CompileTimeMetadata<Q>["output"]> | undefined;
392
+ data: (CompileTimeMetadata<Q>["signature"] extends (...args: never[]) => infer R ? Awaited<R> : never) | undefined;
453
393
  /**
454
394
  * True while the function is executing.
455
395
  */
@@ -503,7 +443,7 @@ interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {
503
443
  */
504
444
  declare function useOsdkFunction<Q extends QueryDefinition<unknown>>(queryDef: Q, options?: UseOsdkFunctionOptions<Q>): UseOsdkFunctionResult<Q>;
505
445
 
506
- interface UseOsdkObjectResult<Q extends ObjectTypeDefinition> {
446
+ interface UseOsdkObjectResult<Q extends ObjectOrInterfaceDefinition> {
507
447
  object: Osdk$1.Instance<Q> | undefined;
508
448
  isLoading: boolean;
509
449
  error: Error | undefined;
@@ -517,15 +457,27 @@ interface UseOsdkObjectResult<Q extends ObjectTypeDefinition> {
517
457
  * @param obj an existing `Osdk.Instance` object to get metadata for.
518
458
  * @param enabled Enable or disable the query (defaults to true)
519
459
  */
520
- declare function useOsdkObject<Q extends ObjectTypeDefinition>(obj: Osdk$1.Instance<Q>, enabled?: boolean): UseOsdkObjectResult<Q>;
460
+ declare function useOsdkObject<Q extends ObjectOrInterfaceDefinition>(obj: Osdk$1.Instance<Q>, enabled?: boolean): UseOsdkObjectResult<Q>;
521
461
  /**
522
- * Loads an object by type and primary key.
462
+ * Loads an object or interface instance by type and primary key.
523
463
  *
524
- * @param type
525
- * @param primaryKey
464
+ * @param type The object type or interface definition
465
+ * @param primaryKey The primary key of the object
526
466
  * @param enabled Enable or disable the query (defaults to true)
527
467
  */
528
- declare function useOsdkObject<Q extends ObjectTypeDefinition>(type: Q, primaryKey: PrimaryKeyType<Q>, enabled?: boolean): UseOsdkObjectResult<Q>;
468
+ declare function useOsdkObject<Q extends ObjectOrInterfaceDefinition>(type: Q, primaryKey: PrimaryKeyType<Q>, enabled?: boolean): UseOsdkObjectResult<Q>;
469
+ /**
470
+ * Loads an object or interface instance by type and primary key with options.
471
+ *
472
+ * @param type The object type or interface definition
473
+ * @param primaryKey The primary key of the object
474
+ * @param options Options including $select, enabled, and $loadPropertySecurityMetadata
475
+ */
476
+ declare function useOsdkObject<Q extends ObjectOrInterfaceDefinition>(type: Q, primaryKey: PrimaryKeyType<Q>, options?: {
477
+ $select?: readonly PropertyKeys$1<Q>[];
478
+ enabled?: boolean;
479
+ $loadPropertySecurityMetadata?: boolean;
480
+ }): UseOsdkObjectResult<Q>;
529
481
 
530
482
  interface UseOsdkObjectsOptions<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
531
483
  /**
@@ -608,8 +560,24 @@ interface UseOsdkObjectsOptions<T extends ObjectOrInterfaceDefinition, RDPs exte
608
560
  */
609
561
  autoFetchMore?: boolean | number;
610
562
  streamUpdates?: boolean;
563
+ /**
564
+ * Restrict which properties are returned for each object.
565
+ * When provided, only the specified properties will be fetched,
566
+ * reducing payload sizes for list views.
567
+ *
568
+ * @example
569
+ * // Only fetch name and status properties
570
+ * useOsdkObjects(Employee, { $select: ["name", "status"] })
571
+ */
572
+ $select?: readonly PropertyKeys$1<T>[];
573
+ /**
574
+ * When true, loads per-property security metadata (marking requirements)
575
+ * alongside each object. The returned objects will have `$propertySecurities`
576
+ * populated with conjunctive/disjunctive marking requirements per property.
577
+ */
578
+ $loadPropertySecurityMetadata?: boolean;
611
579
  }
612
- interface UseOsdkListResult<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
580
+ interface UseOsdkListResult<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}, EXTRA_OPTIONS extends never | "$rid" = never> {
613
581
  /**
614
582
  * Function to fetch more pages (undefined if no more pages)
615
583
  */
@@ -617,7 +585,7 @@ interface UseOsdkListResult<T extends ObjectOrInterfaceDefinition, RDPs extends
617
585
  /**
618
586
  * The fetched data with derived properties
619
587
  */
620
- data: Osdk$1.Instance<T, "$allBaseProperties", PropertyKeys$1<T>, RDPs>[] | undefined;
588
+ data: Osdk$1.Instance<T, "$allBaseProperties" | EXTRA_OPTIONS, PropertyKeys$1<T>, RDPs>[] | undefined;
621
589
  /**
622
590
  * Whether data is currently being loaded
623
591
  */
@@ -639,9 +607,16 @@ interface UseOsdkListResult<T extends ObjectOrInterfaceDefinition, RDPs extends
639
607
  */
640
608
  totalCount?: string;
641
609
  }
610
+ declare function useOsdkObjects<Q extends ObjectOrInterfaceDefinition, L extends LinkNames<Q>>(type: Q, options: UseOsdkObjectsOptions<Q> & {
611
+ pivotTo: L;
612
+ rids: readonly string[];
613
+ }): UseOsdkListResult<LinkedType<Q, L>, {}, "$rid">;
642
614
  declare function useOsdkObjects<Q extends ObjectOrInterfaceDefinition, L extends LinkNames<Q>>(type: Q, options: UseOsdkObjectsOptions<Q> & {
643
615
  pivotTo: L;
644
616
  }): UseOsdkListResult<LinkedType<Q, L>>;
617
+ declare function useOsdkObjects<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(type: Q, options: UseOsdkObjectsOptions<Q, RDPs> & {
618
+ rids: readonly string[];
619
+ }): UseOsdkListResult<Q, RDPs, "$rid">;
645
620
  declare function useOsdkObjects<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(type: Q, options?: UseOsdkObjectsOptions<Q, RDPs>): UseOsdkListResult<Q, RDPs>;
646
621
 
647
622
  interface DebouncedCallback<TArgs extends readonly unknown[]> {
@@ -679,4 +654,4 @@ interface DebouncedCallback<TArgs extends readonly unknown[]> {
679
654
  */
680
655
  declare function useDebouncedCallback<TArgs extends readonly unknown[]>(callback: (...args: TArgs) => void | Promise<void>, delay: number): DebouncedCallback<TArgs>;
681
656
 
682
- export { OsdkProvider2, type UseOsdkAggregationResult, type UseOsdkFunctionOptions, type UseOsdkFunctionResult, type UseOsdkListResult, type UseOsdkObjectsOptions, useCurrentFoundryUser, useDebouncedCallback, useFoundryUser, useFoundryUsersList, useLinks, useObjectSet, useOsdkAction, useOsdkAggregation, useOsdkFunction, useOsdkObject, useOsdkObjects };
657
+ export { OsdkProvider2, type UseOsdkAggregationResult, type UseOsdkFunctionOptions, type UseOsdkFunctionResult, type UseOsdkListResult, type UseOsdkObjectsOptions, useDebouncedCallback, useLinks, useObjectSet, useOsdkAction, useOsdkAggregation, useOsdkFunction, useOsdkObject, useOsdkObjects };
@@ -0,0 +1,15 @@
1
+ import { Client } from '@osdk/client';
2
+ import { ObjectOrInterfaceDefinition, ActionDefinition, ObjectTypeDefinition, ObjectMetadata, InterfaceDefinition, InterfaceMetadata, ActionMetadata } from '@osdk/api';
3
+
4
+ declare function useOsdkClient(): Client;
5
+
6
+ type MetadataFetchableDefinition = ObjectOrInterfaceDefinition | ActionDefinition<any>;
7
+ type MetadataFor<T extends MetadataFetchableDefinition> = T extends ObjectTypeDefinition ? ObjectMetadata : T extends InterfaceDefinition ? InterfaceMetadata : T extends ActionDefinition<any> ? ActionMetadata : never;
8
+ interface UseOsdkMetadataResult<T extends MetadataFetchableDefinition> {
9
+ loading: boolean;
10
+ metadata?: MetadataFor<T>;
11
+ error?: string;
12
+ }
13
+ declare function useOsdkMetadata<T extends MetadataFetchableDefinition>(type: T): UseOsdkMetadataResult<T>;
14
+
15
+ export { type UseOsdkMetadataResult as U, useOsdkMetadata as a, useOsdkClient as u };
@@ -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":"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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,sBAAsBA,CACpCf,iBAE4B,EAC5BC,KAAc,EACdC,YAA0B,EAI1B;EACA,IAAIC,UAAuB,GAAGD,YAAY;EAE1C,SAASE,WAAWA,CAAA,EAAgB;IAClC,OAAOD,UAAU;EACnB;EAEA,SAASE,SAASA,CAACC,YAAwB,EAAE;IAC3C,IAAIU,QAAQ,GAAG,IAAI;IACnB,IAAIC,mBAA+C;IAEnD,MAAMC,mBAAmB,GAAGlB,iBAAiB,CAAC;MAC5CQ,IAAI,EAAGC,OAAO,IAAK;QACjB,IAAIO,QAAQ,EAAE;UACZb,UAAU,GAAGM,OAAsB;UACnCH,YAAY,CAAC,CAAC;QAChB;MACF,CAAC;MACDI,KAAK,EAAGA,KAAc,IAAK;QACzB,IAAIM,QAAQ,EAAE;UACZb,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;MACF,CAAC;MACDO,QAAQ,EAAEA,CAAA,KAAM,CAAC;IACnB,CAAC,CAAC;IAEFK,mBAAmB,CAACC,IAAI,CAAEC,GAAG,IAAK;MAChC,IAAIJ,QAAQ,EAAE;QACZC,mBAAmB,GAAGG,GAAG;MAC3B,CAAC,MAAM;QACLA,GAAG,CAACN,WAAW,CAAC,CAAC;MACnB;IACF,CAAC,CAAC,CAACO,KAAK,CAAEX,KAAc,IAAK;MAC3B,IAAIM,QAAQ,EAAE;QACZb,UAAU,GAAG;UACX,IAAIA,UAAU,IAAI,CAAC,CAAC,CAAC;UACrBO,KAAK,EAAEA,KAAK,YAAYC,KAAK,GAAGD,KAAK,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACF,KAAK,CAAC;QACjE,CAAgB;QAChBJ,YAAY,CAAC,CAAC;MAChB;IACF,CAAC,CAAC;IAEF,OAAO,MAAY;MACjBU,QAAQ,GAAG,KAAK;MAChB,IAAIC,mBAAmB,EAAE;QACvBA,mBAAmB,CAACH,WAAW,CAAC,CAAC;MACnC;IACF,CAAC;EACH;EAEA,OAAO;IACLT,SAAS;IACTD;EACF,CAAC;AACH","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