@osdk/client 2.7.0-beta.5 → 2.7.0-beta.7

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 (53) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/build/browser/observable/ListPayload.js.map +1 -1
  3. package/build/browser/observable/ObjectPayload.js.map +1 -1
  4. package/build/browser/observable/ObservableClient.js +0 -5
  5. package/build/browser/observable/ObservableClient.js.map +1 -1
  6. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  7. package/build/browser/observable/internal/Store.test.js +54 -0
  8. package/build/browser/observable/internal/Store.test.js.map +1 -1
  9. package/build/browser/observable/internal/base-list/BaseListQuery.js +1 -1
  10. package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
  11. package/build/browser/observable/internal/utils/rdpFieldOperations.js +46 -25
  12. package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  13. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  14. package/build/browser/util/UserAgent.js +2 -2
  15. package/build/cjs/{chunk-6SCDLAU2.cjs → chunk-LDTMSHUZ.cjs} +4 -4
  16. package/build/cjs/{chunk-6SCDLAU2.cjs.map → chunk-LDTMSHUZ.cjs.map} +1 -1
  17. package/build/cjs/{chunk-HM4EXGFD.cjs → chunk-PUP56SUU.cjs} +67 -67
  18. package/build/cjs/{chunk-HM4EXGFD.cjs.map → chunk-PUP56SUU.cjs.map} +1 -1
  19. package/build/cjs/{chunk-LBXKB67X.cjs → chunk-UAJMOJN3.cjs} +117 -115
  20. package/build/cjs/chunk-UAJMOJN3.cjs.map +1 -0
  21. package/build/cjs/{delay-KIUUJ5NJ.cjs → delay-W2TSML2P.cjs} +4 -4
  22. package/build/cjs/{delay-KIUUJ5NJ.cjs.map → delay-W2TSML2P.cjs.map} +1 -1
  23. package/build/cjs/index.cjs +12 -12
  24. package/build/cjs/public/internal-node.cjs +219 -219
  25. package/build/cjs/public/internal.cjs +14 -14
  26. package/build/cjs/public/unstable-do-not-use.cjs +139 -123
  27. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  28. package/build/cjs/public/unstable-do-not-use.d.cts +6 -6
  29. package/build/esm/observable/ListPayload.js.map +1 -1
  30. package/build/esm/observable/ObjectPayload.js.map +1 -1
  31. package/build/esm/observable/ObservableClient.js +0 -5
  32. package/build/esm/observable/ObservableClient.js.map +1 -1
  33. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  34. package/build/esm/observable/internal/Store.test.js +54 -0
  35. package/build/esm/observable/internal/Store.test.js.map +1 -1
  36. package/build/esm/observable/internal/base-list/BaseListQuery.js +1 -1
  37. package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
  38. package/build/esm/observable/internal/utils/rdpFieldOperations.js +46 -25
  39. package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  40. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  41. package/build/esm/util/UserAgent.js +2 -2
  42. package/build/types/observable/ListPayload.d.ts +3 -2
  43. package/build/types/observable/ListPayload.d.ts.map +1 -1
  44. package/build/types/observable/ObjectPayload.d.ts +2 -2
  45. package/build/types/observable/ObjectPayload.d.ts.map +1 -1
  46. package/build/types/observable/ObservableClient.d.ts +8 -5
  47. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  48. package/build/types/observable/internal/Store.test.d.ts.map +1 -1
  49. package/build/types/observable/internal/utils/rdpFieldOperations.d.ts.map +1 -1
  50. package/build/types/public/unstable-do-not-use.d.ts +1 -1
  51. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  52. package/package.json +7 -7
  53. package/build/cjs/chunk-LBXKB67X.cjs.map +0 -1
@@ -189,14 +189,14 @@ interface ObserveListOptions<Q extends ObjectOrInterfaceDefinition, RDPs extends
189
189
  }>;
190
190
  pivotTo?: string;
191
191
  }
192
- interface ObserveObjectArgs<T extends ObjectTypeDefinition> {
192
+ interface ObserveObjectCallbackArgs<T extends ObjectTypeDefinition> {
193
193
  object: Osdk.Instance<T> | undefined;
194
194
  isOptimistic: boolean;
195
195
  status: Status;
196
196
  lastUpdated: number;
197
197
  }
198
- interface ObserveObjectsArgs<T extends ObjectTypeDefinition | InterfaceDefinition> {
199
- resolvedList: Array<Osdk.Instance<T>>;
198
+ interface ObserveObjectsCallbackArgs<T extends ObjectTypeDefinition | InterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> {
199
+ resolvedList: Array<Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs>>;
200
200
  isOptimistic: boolean;
201
201
  lastUpdated: number;
202
202
  fetchMore: () => Promise<void>;
@@ -258,7 +258,7 @@ interface ObservableClient extends ObserveLinks {
258
258
  * - Updates when the object changes
259
259
  * - Error state if fetch fails
260
260
  */
261
- observeObject<T extends ObjectTypeDefinition>(apiName: T["apiName"] | T, pk: PrimaryKeyType<T>, options: ObserveOptions, subFn: Observer<ObserveObjectArgs<T>>): Unsubscribable;
261
+ observeObject<T extends ObjectTypeDefinition>(apiName: T["apiName"] | T, pk: PrimaryKeyType<T>, options: ObserveOptions, subFn: Observer<ObserveObjectCallbackArgs<T>>): Unsubscribable;
262
262
  /**
263
263
  * Observe a filtered and sorted collection of objects.
264
264
  *
@@ -272,7 +272,7 @@ interface ObservableClient extends ObserveLinks {
272
272
  * - Pagination via fetchMore() in the payload
273
273
  * - Automatic updates when any matching object changes
274
274
  */
275
- observeList<T extends ObjectTypeDefinition | InterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(options: ObserveListOptions<T, RDPs>, subFn: Observer<ObserveObjectsArgs<T>>): Unsubscribable;
275
+ observeList<T extends ObjectTypeDefinition | InterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(options: ObserveListOptions<T, RDPs>, subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>): Unsubscribable;
276
276
  /**
277
277
  * Observe an ObjectSet with automatic updates when matching objects change.
278
278
  *
@@ -369,4 +369,4 @@ interface OsdkConfig {
369
369
  }
370
370
  declare function getOsdkConfig(ontologyRid: string): OsdkConfig;
371
371
 
372
- export { ActionSignatureFromDef, ObservableClient, type ObserveAggregationArgs, ObserveLinks, type ObserveObjectArgs, type ObserveObjectSetArgs, type ObserveObjectsArgs, type Observer, type OsdkConfig, type Unsubscribable, augment, computeObjectSetCacheKey, createObservableClient, getMetaTagContent, getOsdkConfig };
372
+ export { ActionSignatureFromDef, ObservableClient, type ObserveAggregationArgs, ObserveLinks, type ObserveObjectCallbackArgs, type ObserveObjectSetArgs, type ObserveObjectsCallbackArgs, type Observer, type OsdkConfig, type Unsubscribable, augment, computeObjectSetCacheKey, createObservableClient, getMetaTagContent, getOsdkConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"ListPayload.js","names":[],"sources":["ListPayload.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectsArgs } from \"./ObservableClient.js\";\n\nexport interface ListPayload\n extends Omit<ObserveObjectsArgs<any>, \"resolvedList\">\n{\n resolvedList: Array<ObjectHolder | InterfaceHolder>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ListPayload.js","names":[],"sources":["ListPayload.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { WirePropertyTypes } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectsCallbackArgs } from \"./ObservableClient.js\";\n\nexport interface ListPayload<\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> extends Omit<ObserveObjectsCallbackArgs<any, RDPs>, \"resolvedList\"> {\n resolvedList: Array<ObjectHolder | InterfaceHolder>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectPayload.js","names":[],"sources":["ObjectPayload.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 { ObjectTypeDefinition, Osdk } from \"@osdk/api\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectArgs } from \"./ObservableClient.js\";\n\nexport interface ObjectPayload extends Omit<ObserveObjectArgs<any>, \"object\"> {\n object: ObjectHolder | undefined;\n}\n\nexport interface TypedObjectPayload<T extends ObjectTypeDefinition>\n extends ObjectPayload\n{\n object: ObjectHolder<Osdk.Instance<T>> & Osdk.Instance<T> | undefined;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectPayload.js","names":[],"sources":["ObjectPayload.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 { ObjectTypeDefinition, Osdk } from \"@osdk/api\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectCallbackArgs } from \"./ObservableClient.js\";\n\nexport interface ObjectPayload\n extends Omit<ObserveObjectCallbackArgs<any>, \"object\">\n{\n object: ObjectHolder | undefined;\n}\n\nexport interface TypedObjectPayload<T extends ObjectTypeDefinition>\n extends ObjectPayload\n{\n object: ObjectHolder<Osdk.Instance<T>> & Osdk.Instance<T> | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -21,11 +21,6 @@ import { OBSERVABLE_USER_AGENT } from "../util/UserAgent.js";
21
21
  import { ObservableClientImpl } from "./internal/ObservableClientImpl.js";
22
22
  import { Store } from "./internal/Store.js";
23
23
  export let ObservableClient;
24
- // TODO: Rename this from `ObserveObjectArgs` => `ObserveObjectCallbackArgs`. Not doing it now to reduce churn
25
- // in repo.
26
-
27
- // TODO: Rename this from `ObserveObjectsArgs` => `ObserveObjectsCallbackArgs`. Not doing it now to reduce churn
28
-
29
24
  /**
30
25
  * User facing callback args for `observeLink`
31
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n DerivedProperty,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { createFetchHeaderMutator } from \"@osdk/shared.net.fetch\";\nimport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport { OBSERVABLE_USER_AGENT } from \"../util/UserAgent.js\";\nimport type { Canonical } from \"./internal/Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { ObservableClientImpl } from \"./internal/ObservableClientImpl.js\";\nimport { Store } from \"./internal/Store.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n Status,\n} from \"./ObservableClient/common.js\";\nimport type { ObserveLinks } from \"./ObservableClient/ObserveLink.js\";\nimport type { OptimisticBuilder } from \"./OptimisticBuilder.js\";\n\nexport namespace ObservableClient {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\nexport interface ObserveObjectOptions<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: PropertyKeys<T>[];\n}\n\nexport type OrderBy<Q extends ObjectTypeDefinition | InterfaceDefinition> = {\n [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" | undefined;\n};\n\nexport interface ObserveListOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: Pick<Q, \"apiName\" | \"type\">;\n where?: WhereClause<Q, RDPs>;\n pageSize?: number;\n orderBy?: OrderBy<Q>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n streamUpdates?: boolean;\n withProperties?: DerivedProperty.Clause<Q>;\n\n /**\n * Automatically fetch additional pages on initial load.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n *\n * @example\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer)\n *\n * @example\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer)\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n}\n\n// TODO: Rename this from `ObserveObjectArgs` => `ObserveObjectCallbackArgs`. Not doing it now to reduce churn\n// in repo.\nexport interface ObserveObjectArgs<T extends ObjectTypeDefinition> {\n object: Osdk.Instance<T> | undefined;\n isOptimistic: boolean;\n status: Status;\n lastUpdated: number;\n}\n\n// TODO: Rename this from `ObserveObjectsArgs` => `ObserveObjectsCallbackArgs`. Not doing it now to reduce churn\nexport interface ObserveObjectsArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n> {\n resolvedList: Array<Osdk.Instance<T>>;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n}\n\nexport interface ObserveObjectSetArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList: Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n objectSet: ObjectSet<T, RDPs>;\n}\n\nexport interface ObserveAggregationOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: T;\n where?: WhereClause<T, RDPs>;\n withProperties?: DerivedProperty.Clause<T>;\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n aggregate: A;\n}\n\nexport interface ObserveAggregationArgs<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n> {\n result: AggregationsResults<T, A> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\n/**\n * User facing callback args for `observeLink`\n */\nexport interface ObserveLinkCallbackArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n> {\n resolvedList: Osdk.Instance<T>[];\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n}\n\n/**\n * Public interface for reactive data management with automatic updates.\n *\n * The ObservableClient provides a reactive data layer with:\n * - Real-time object and collection observation\n * - Automatic cache updates when data changes\n * - Optimistic updates for immediate UI feedback\n * - Pagination support for large collections\n * - Link traversal for relationship navigation\n */\nexport interface ObservableClient extends ObserveLinks {\n /**\n * Observe a single object with automatic updates when it changes.\n *\n * @param apiName - The object type definition or name\n * @param pk - The object's primary key\n * @param options - Observation options including deduplication interval\n * @param subFn - Observer that receives object state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * The observer will receive:\n * - Initial loading state if data not cached\n * - Loaded state with the object data\n * - Updates when the object changes\n * - Error state if fetch fails\n */\n observeObject<T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: ObserveOptions,\n subFn: Observer<ObserveObjectArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe an ObjectSet with automatic updates when matching objects change.\n *\n * @param baseObjectSet - The base ObjectSet to observe\n * @param options - Options for transforming and observing the ObjectSet\n * @param subFn - Observer that receives ObjectSet state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports all ObjectSet operations:\n * - Filtering with where clauses\n * - Derived properties with withProperties\n * - Set operations (union, intersect, subtract)\n * - Link traversal with pivotTo\n * - Sorting and pagination\n */\n observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * Observe an aggregation query with automatic updates when underlying data changes.\n *\n * @param options - Aggregation configuration including where, aggregate spec, and derived properties\n * @param subFn - Observer that receives aggregation result updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Derived properties (RDPs) via withProperties\n * - Set intersections\n * - GroupBy and metric aggregations\n * - Automatic updates when source data changes\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n\n /**\n * Execute an action with optional optimistic updates.\n *\n * @param action - Action definition to execute\n * @param args - Arguments for the action\n * @param opts - Options including optimistic updates\n * @returns Promise that resolves when the action completes\n *\n * When providing optimistic updates:\n * - Changes appear immediately in the UI\n * - Server request still happens in background\n * - On success, server data replaces optimistic data\n * - On failure, optimistic changes automatically roll back\n */\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n /**\n * Validate action parameters without executing the action.\n *\n * @param action - Action definition to validate\n * @param args - Arguments to validate\n * @returns Promise with validation result\n *\n * Use this to:\n * - Pre-validate forms before submission\n * - Display warnings or errors in the UI\n * - Enable/disable action buttons based on validity\n */\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n /**\n * Invalidates the entire cache, forcing all queries to refetch.\n * Use sparingly as this can cause significant network traffic.\n */\n invalidateAll(): Promise<void>;\n\n /**\n * Invalidates specific objects in the cache.\n * @param objects - Single object or array of objects to invalidate\n */\n invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void>;\n\n /**\n * Invalidates all cached data for a specific object type.\n * This includes:\n * - All objects of the specified type\n * - All lists containing objects of this type\n * - All links where the source is of this type\n *\n * @param type - Object type definition or API name string\n * @returns Promise that resolves when invalidation is complete\n */\n invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void>;\n\n canonicalizeWhereClause: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n}\n\nexport function createObservableClient(client: Client): ObservableClient {\n // First we need a modified client that adds an extra header so we know its\n // an observable client\n const tweakedClient = createClientFromContext({\n ...client[additionalContext],\n\n fetch: createFetchHeaderMutator(\n client[additionalContext].fetch,\n (headers) => {\n headers.set(\n \"Fetch-User-Agent\",\n [\n headers.get(\"Fetch-User-Agent\"),\n OBSERVABLE_USER_AGENT,\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,SAASA,wBAAwB,QAAQ,wBAAwB;AAEjE,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,qBAAqB,QAAQ,sBAAsB;AAG5D,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,KAAK,QAAQ,qBAAqB;AAAC,WAW3BC,gBAAgB;AAqDjC;AACA;;AAQA;;AAsDA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4KA,OAAO,SAASC,sBAAsBA,CAACC,MAAc,EAAoB;EACvE;EACA;EACA,MAAMC,aAAa,GAAGP,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BS,KAAK,EAAEV,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACS,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BV,qBAAqB,CACtB,CAACW,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAIA,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAC5C,CAAC;MACD,OAAON,OAAO;IAChB,CACF;EACF,CAAC,CAAC;;EAEF;EACA;EACA,OAAO,IAAIP,oBAAoB,CAAC,IAAIC,KAAK,CAACI,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
1
+ {"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n DerivedProperty,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { createFetchHeaderMutator } from \"@osdk/shared.net.fetch\";\nimport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport { OBSERVABLE_USER_AGENT } from \"../util/UserAgent.js\";\nimport type { Canonical } from \"./internal/Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { ObservableClientImpl } from \"./internal/ObservableClientImpl.js\";\nimport { Store } from \"./internal/Store.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n Status,\n} from \"./ObservableClient/common.js\";\nimport type { ObserveLinks } from \"./ObservableClient/ObserveLink.js\";\nimport type { OptimisticBuilder } from \"./OptimisticBuilder.js\";\n\nexport namespace ObservableClient {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\nexport interface ObserveObjectOptions<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: PropertyKeys<T>[];\n}\n\nexport type OrderBy<Q extends ObjectTypeDefinition | InterfaceDefinition> = {\n [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" | undefined;\n};\n\nexport interface ObserveListOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: Pick<Q, \"apiName\" | \"type\">;\n where?: WhereClause<Q, RDPs>;\n pageSize?: number;\n orderBy?: OrderBy<Q>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n streamUpdates?: boolean;\n withProperties?: DerivedProperty.Clause<Q>;\n\n /**\n * Automatically fetch additional pages on initial load.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n *\n * @example\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer)\n *\n * @example\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer)\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n}\n\nexport interface ObserveObjectCallbackArgs<T extends ObjectTypeDefinition> {\n object: Osdk.Instance<T> | undefined;\n isOptimistic: boolean;\n status: Status;\n lastUpdated: number;\n}\n\nexport interface ObserveObjectsCallbackArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList: Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n}\n\nexport interface ObserveObjectSetArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList: Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n objectSet: ObjectSet<T, RDPs>;\n}\n\nexport interface ObserveAggregationOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: T;\n where?: WhereClause<T, RDPs>;\n withProperties?: DerivedProperty.Clause<T>;\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n aggregate: A;\n}\n\nexport interface ObserveAggregationArgs<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n> {\n result: AggregationsResults<T, A> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\n/**\n * User facing callback args for `observeLink`\n */\nexport interface ObserveLinkCallbackArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n> {\n resolvedList: Osdk.Instance<T>[];\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n}\n\n/**\n * Public interface for reactive data management with automatic updates.\n *\n * The ObservableClient provides a reactive data layer with:\n * - Real-time object and collection observation\n * - Automatic cache updates when data changes\n * - Optimistic updates for immediate UI feedback\n * - Pagination support for large collections\n * - Link traversal for relationship navigation\n */\nexport interface ObservableClient extends ObserveLinks {\n /**\n * Observe a single object with automatic updates when it changes.\n *\n * @param apiName - The object type definition or name\n * @param pk - The object's primary key\n * @param options - Observation options including deduplication interval\n * @param subFn - Observer that receives object state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * The observer will receive:\n * - Initial loading state if data not cached\n * - Loaded state with the object data\n * - Updates when the object changes\n * - Error state if fetch fails\n */\n observeObject<T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: ObserveOptions,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * Observe an ObjectSet with automatic updates when matching objects change.\n *\n * @param baseObjectSet - The base ObjectSet to observe\n * @param options - Options for transforming and observing the ObjectSet\n * @param subFn - Observer that receives ObjectSet state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports all ObjectSet operations:\n * - Filtering with where clauses\n * - Derived properties with withProperties\n * - Set operations (union, intersect, subtract)\n * - Link traversal with pivotTo\n * - Sorting and pagination\n */\n observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * Observe an aggregation query with automatic updates when underlying data changes.\n *\n * @param options - Aggregation configuration including where, aggregate spec, and derived properties\n * @param subFn - Observer that receives aggregation result updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Derived properties (RDPs) via withProperties\n * - Set intersections\n * - GroupBy and metric aggregations\n * - Automatic updates when source data changes\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n\n /**\n * Execute an action with optional optimistic updates.\n *\n * @param action - Action definition to execute\n * @param args - Arguments for the action\n * @param opts - Options including optimistic updates\n * @returns Promise that resolves when the action completes\n *\n * When providing optimistic updates:\n * - Changes appear immediately in the UI\n * - Server request still happens in background\n * - On success, server data replaces optimistic data\n * - On failure, optimistic changes automatically roll back\n */\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n /**\n * Validate action parameters without executing the action.\n *\n * @param action - Action definition to validate\n * @param args - Arguments to validate\n * @returns Promise with validation result\n *\n * Use this to:\n * - Pre-validate forms before submission\n * - Display warnings or errors in the UI\n * - Enable/disable action buttons based on validity\n */\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n /**\n * Invalidates the entire cache, forcing all queries to refetch.\n * Use sparingly as this can cause significant network traffic.\n */\n invalidateAll(): Promise<void>;\n\n /**\n * Invalidates specific objects in the cache.\n * @param objects - Single object or array of objects to invalidate\n */\n invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void>;\n\n /**\n * Invalidates all cached data for a specific object type.\n * This includes:\n * - All objects of the specified type\n * - All lists containing objects of this type\n * - All links where the source is of this type\n *\n * @param type - Object type definition or API name string\n * @returns Promise that resolves when invalidation is complete\n */\n invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void>;\n\n canonicalizeWhereClause: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n}\n\nexport function createObservableClient(client: Client): ObservableClient {\n // First we need a modified client that adds an extra header so we know its\n // an observable client\n const tweakedClient = createClientFromContext({\n ...client[additionalContext],\n\n fetch: createFetchHeaderMutator(\n client[additionalContext].fetch,\n (headers) => {\n headers.set(\n \"Fetch-User-Agent\",\n [\n headers.get(\"Fetch-User-Agent\"),\n OBSERVABLE_USER_AGENT,\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,SAASA,wBAAwB,QAAQ,wBAAwB;AAEjE,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,qBAAqB,QAAQ,sBAAsB;AAG5D,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,KAAK,QAAQ,qBAAqB;AAAC,WAW3BC,gBAAgB;AAuHjC;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4KA,OAAO,SAASC,sBAAsBA,CAACC,MAAc,EAAoB;EACvE;EACA;EACA,MAAMC,aAAa,GAAGP,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BS,KAAK,EAAEV,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACS,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BV,qBAAqB,CACtB,CAACW,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAIA,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAC5C,CAAC;MACD,OAAON,OAAO;IAChB,CACF;EACF,CAAC,CAAC;;EAEF;EACA;EACA,OAAO,IAAIP,oBAAoB,CAAC,IAAIC,KAAK,CAACI,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableClientImpl.js","names":["Subscription","UnsubscribableWrapper","ObservableClientImpl","constructor","store","__experimentalStore","applyAction","bind","validateAction","observeObject","apiName","pk","options","subFn","objects","observe","observeList","lists","observeAggregation","aggregations","observeLinks","linkName","objectsArray","Array","isArray","parentSub","obj","querySubscription","links","srcType","type","$apiName","$primaryKey","add","observeObjectSet","baseObjectSet","objectSets","invalidateAll","invalidateObjects","invalidateObjectType","undefined","canonicalizeWhereClause","where","whereCanonicalizer","canonicalize"],"sources":["ObservableClientImpl.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { Subscription } from \"rxjs\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport type { SpecificLinkPayload } from \"../LinkPayload.js\";\nimport type { ListPayload } from \"../ListPayload.js\";\nimport type { ObjectPayload } from \"../ObjectPayload.js\";\nimport type { ObjectSetPayload } from \"../ObjectSetPayload.js\";\nimport type {\n ObservableClient,\n ObserveAggregationArgs,\n ObserveAggregationOptions,\n ObserveListOptions,\n ObserveObjectArgs,\n ObserveObjectOptions,\n ObserveObjectsArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../ObservableClient.js\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { ObserveLinks } from \"../ObservableClient/ObserveLink.js\";\nimport type { AggregationPayloadBase } from \"./aggregation/AggregationQuery.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./objectset/ObjectSetQueryOptions.js\";\nimport type { Store } from \"./Store.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\n/**\n * Implementation of the public ObservableClient interface.\n * - Delegates all operations to the Store for consistency\n * - Serves as the entry point for reactive data management\n * - Ensures proper method binding and API exposure\n *\n * @internal\n */\nexport class ObservableClientImpl implements ObservableClient {\n __experimentalStore: Store;\n\n constructor(store: Store) {\n this.__experimentalStore = store;\n\n this.applyAction = store.applyAction.bind(store);\n this.validateAction = store.validateAction.bind(store);\n }\n\n public observeObject: <T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectArgs<T>>,\n ) => Unsubscribable = (apiName, pk, options, subFn) => {\n return this.__experimentalStore.objects.observe(\n {\n ...options,\n apiName,\n pk,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectPayload>,\n );\n };\n\n public observeList: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsArgs<T>>,\n ) => Unsubscribable = (options, subFn) => {\n return this.__experimentalStore.lists.observe(\n options,\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ListPayload>,\n );\n };\n\n public observeAggregation: <\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ) => Unsubscribable = <\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ) => {\n return this.__experimentalStore.aggregations.observe(\n options,\n subFn as Observer<AggregationPayloadBase>,\n );\n };\n\n public observeLinks: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | Array<Osdk.Instance<T>>,\n linkName: L,\n options: ObserveLinks.Options<T, L>,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ) => Unsubscribable = (objects, linkName, options, subFn) => {\n // Convert to array if single object provided\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n\n const parentSub = new Subscription();\n\n for (const obj of objectsArray) {\n const querySubscription = this.__experimentalStore.links\n .observe(\n {\n ...options,\n srcType: {\n type: \"object\",\n apiName: obj.$apiName,\n },\n linkName,\n pk: obj.$primaryKey,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<SpecificLinkPayload>,\n );\n\n parentSub.add(querySubscription);\n }\n\n return new UnsubscribableWrapper(parentSub);\n };\n\n public applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n public validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n public observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable {\n return this.__experimentalStore.objectSets.observe(\n { baseObjectSet, ...options },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectSetPayload>,\n );\n }\n\n public invalidateAll(): Promise<void> {\n return this.__experimentalStore.invalidateAll();\n }\n\n public invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjects(objects);\n }\n\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjectType(type, undefined);\n }\n\n public canonicalizeWhereClause<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(where: WhereClause<T, RDPs>): Canonical<WhereClause<T, RDPs>> {\n return this.__experimentalStore.whereCanonicalizer\n .canonicalize(where) as Canonical<WhereClause<T, RDPs>>;\n }\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"ObservableClientImpl.js","names":["Subscription","UnsubscribableWrapper","ObservableClientImpl","constructor","store","__experimentalStore","applyAction","bind","validateAction","observeObject","apiName","pk","options","subFn","objects","observe","observeList","lists","observeAggregation","aggregations","observeLinks","linkName","objectsArray","Array","isArray","parentSub","obj","querySubscription","links","srcType","type","$apiName","$primaryKey","add","observeObjectSet","baseObjectSet","objectSets","invalidateAll","invalidateObjects","invalidateObjectType","undefined","canonicalizeWhereClause","where","whereCanonicalizer","canonicalize"],"sources":["ObservableClientImpl.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { Subscription } from \"rxjs\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport type { SpecificLinkPayload } from \"../LinkPayload.js\";\nimport type { ListPayload } from \"../ListPayload.js\";\nimport type { ObjectPayload } from \"../ObjectPayload.js\";\nimport type { ObjectSetPayload } from \"../ObjectSetPayload.js\";\nimport type {\n ObservableClient,\n ObserveAggregationArgs,\n ObserveAggregationOptions,\n ObserveListOptions,\n ObserveObjectCallbackArgs,\n ObserveObjectOptions,\n ObserveObjectsCallbackArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../ObservableClient.js\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { ObserveLinks } from \"../ObservableClient/ObserveLink.js\";\nimport type { AggregationPayloadBase } from \"./aggregation/AggregationQuery.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./objectset/ObjectSetQueryOptions.js\";\nimport type { Store } from \"./Store.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\n/**\n * Implementation of the public ObservableClient interface.\n * - Delegates all operations to the Store for consistency\n * - Serves as the entry point for reactive data management\n * - Ensures proper method binding and API exposure\n *\n * @internal\n */\nexport class ObservableClientImpl implements ObservableClient {\n __experimentalStore: Store;\n\n constructor(store: Store) {\n this.__experimentalStore = store;\n\n this.applyAction = store.applyAction.bind(store);\n this.validateAction = store.validateAction.bind(store);\n }\n\n public observeObject: <T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ) => Unsubscribable = (apiName, pk, options, subFn) => {\n return this.__experimentalStore.objects.observe(\n {\n ...options,\n apiName,\n pk,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectPayload>,\n );\n };\n\n public observeList: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ) => Unsubscribable = (options, subFn) => {\n return this.__experimentalStore.lists.observe(\n options,\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ListPayload>,\n );\n };\n\n public observeAggregation: <\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ) => Unsubscribable = <\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ) => {\n return this.__experimentalStore.aggregations.observe(\n options,\n subFn as Observer<AggregationPayloadBase>,\n );\n };\n\n public observeLinks: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | Array<Osdk.Instance<T>>,\n linkName: L,\n options: ObserveLinks.Options<T, L>,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ) => Unsubscribable = (objects, linkName, options, subFn) => {\n // Convert to array if single object provided\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n\n const parentSub = new Subscription();\n\n for (const obj of objectsArray) {\n const querySubscription = this.__experimentalStore.links\n .observe(\n {\n ...options,\n srcType: {\n type: \"object\",\n apiName: obj.$apiName,\n },\n linkName,\n pk: obj.$primaryKey,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<SpecificLinkPayload>,\n );\n\n parentSub.add(querySubscription);\n }\n\n return new UnsubscribableWrapper(parentSub);\n };\n\n public applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n public validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n public observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable {\n return this.__experimentalStore.objectSets.observe(\n { baseObjectSet, ...options },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectSetPayload>,\n );\n }\n\n public invalidateAll(): Promise<void> {\n return this.__experimentalStore.invalidateAll();\n }\n\n public invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjects(objects);\n }\n\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjectType(type, undefined);\n }\n\n public canonicalizeWhereClause<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(where: WhereClause<T, RDPs>): Canonical<WhereClause<T, RDPs>> {\n return this.__experimentalStore.whereCanonicalizer\n .canonicalize(where) as Canonical<WhereClause<T, RDPs>>;\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -930,6 +930,60 @@ describe(Store, () => {
930
930
  status: "loaded"
931
931
  });
932
932
  });
933
+ it("handles multiple sequential fetchMore calls", async () => {
934
+ const listSub = mockListSubCallback();
935
+ defer(cache.lists.observe({
936
+ type: Employee,
937
+ where: {},
938
+ orderBy: {},
939
+ mode: "force",
940
+ pageSize: 1
941
+ }, listSub));
942
+ await waitForCall(listSub, 1);
943
+ expectSingleListCallAndClear(listSub, [], {
944
+ status: "loading"
945
+ });
946
+ await waitForCall(listSub, 1);
947
+ let {
948
+ fetchMore
949
+ } = listSub.next.mock.calls[0][0];
950
+ expectSingleListCallAndClear(listSub, employeesAsServerReturns.slice(0, 1), {
951
+ status: "loaded"
952
+ });
953
+ void fetchMore();
954
+ await waitForCall(listSub, 1);
955
+ expectSingleListCallAndClear(listSub, employeesAsServerReturns.slice(0, 1), {
956
+ status: "loading"
957
+ });
958
+ await waitForCall(listSub, 1);
959
+ ({
960
+ fetchMore
961
+ } = listSub.next.mock.calls[0][0]);
962
+ expectSingleListCallAndClear(listSub, employeesAsServerReturns.slice(0, 2), {
963
+ status: "loaded"
964
+ });
965
+ void fetchMore();
966
+ await waitForCall(listSub, 1);
967
+ expectSingleListCallAndClear(listSub, employeesAsServerReturns.slice(0, 2), {
968
+ status: "loading"
969
+ });
970
+ await waitForCall(listSub, 1);
971
+ ({
972
+ fetchMore
973
+ } = listSub.next.mock.calls[0][0]);
974
+ expectSingleListCallAndClear(listSub, employeesAsServerReturns.slice(0, 3), {
975
+ status: "loaded"
976
+ });
977
+ void fetchMore();
978
+ await waitForCall(listSub, 1);
979
+ expectSingleListCallAndClear(listSub, employeesAsServerReturns.slice(0, 3), {
980
+ status: "loading"
981
+ });
982
+ await waitForCall(listSub, 1);
983
+ expectSingleListCallAndClear(listSub, employeesAsServerReturns.slice(0, 4), {
984
+ status: "loaded"
985
+ });
986
+ });
933
987
  });
934
988
  });
935
989
  describe("with mock client", () => {