@osdk/client 2.27.0 → 2.28.0-main-a5066b5822179d54731c738017fc477dbfee32b4

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 (54) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/observable/ObservableClient.js.map +1 -1
  5. package/build/browser/observable/internal/list/InterfaceListQuery.js +6 -3
  6. package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
  7. package/build/browser/observable/internal/list/ListCacheKey.js +1 -0
  8. package/build/browser/observable/internal/list/ListCacheKey.js.map +1 -1
  9. package/build/browser/observable/internal/list/ListQueryOptions.js.map +1 -1
  10. package/build/browser/observable/internal/list/ListsHelper.js +4 -2
  11. package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
  12. package/build/browser/util/UserAgent.js +2 -2
  13. package/build/browser/util/UserAgent.js.map +1 -1
  14. package/build/cjs/{applyStreamingQuery-ZUGQCOWE.cjs → applyStreamingQuery-KHSD5LEJ.cjs} +9 -9
  15. package/build/cjs/{applyStreamingQuery-ZUGQCOWE.cjs.map → applyStreamingQuery-KHSD5LEJ.cjs.map} +1 -1
  16. package/build/cjs/{chunk-YLVUONG3.cjs → chunk-I3OTWRGM.cjs} +2 -2
  17. package/build/cjs/{chunk-YLVUONG3.cjs.map → chunk-I3OTWRGM.cjs.map} +1 -1
  18. package/build/cjs/{chunk-SVB5K454.cjs → chunk-I5YLE6VJ.cjs} +45 -45
  19. package/build/cjs/chunk-I5YLE6VJ.cjs.map +1 -0
  20. package/build/cjs/{chunk-YRGYLMU5.cjs → chunk-QJ7NT4K4.cjs} +13 -13
  21. package/build/cjs/{chunk-YRGYLMU5.cjs.map → chunk-QJ7NT4K4.cjs.map} +1 -1
  22. package/build/cjs/{chunk-5QXHJGSL.cjs → chunk-VLZFGRAF.cjs} +84 -79
  23. package/build/cjs/chunk-VLZFGRAF.cjs.map +1 -0
  24. package/build/cjs/index.cjs +11 -11
  25. package/build/cjs/public/experimental.cjs +6 -6
  26. package/build/cjs/public/internal.cjs +7 -7
  27. package/build/cjs/public/observable.cjs +5 -5
  28. package/build/cjs/public/observable.d.cts +14 -0
  29. package/build/cjs/public/unstable-do-not-use.cjs +14 -14
  30. package/build/esm/Client.js +1 -1
  31. package/build/esm/Client.js.map +1 -1
  32. package/build/esm/observable/ObservableClient.js.map +1 -1
  33. package/build/esm/observable/internal/list/InterfaceListQuery.js +6 -3
  34. package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
  35. package/build/esm/observable/internal/list/ListCacheKey.js +1 -0
  36. package/build/esm/observable/internal/list/ListCacheKey.js.map +1 -1
  37. package/build/esm/observable/internal/list/ListQueryOptions.js.map +1 -1
  38. package/build/esm/observable/internal/list/ListsHelper.js +4 -2
  39. package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
  40. package/build/esm/util/UserAgent.js +2 -2
  41. package/build/esm/util/UserAgent.js.map +1 -1
  42. package/build/types/Client.d.ts +1 -1
  43. package/build/types/observable/ObservableClient.d.ts +14 -0
  44. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  45. package/build/types/observable/internal/list/InterfaceListQuery.d.ts +1 -0
  46. package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
  47. package/build/types/observable/internal/list/ListCacheKey.d.ts +2 -1
  48. package/build/types/observable/internal/list/ListCacheKey.d.ts.map +1 -1
  49. package/build/types/observable/internal/list/ListQueryOptions.d.ts +1 -0
  50. package/build/types/observable/internal/list/ListQueryOptions.d.ts.map +1 -1
  51. package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
  52. package/package.json +9 -9
  53. package/build/cjs/chunk-5QXHJGSL.cjs.map +0 -1
  54. package/build/cjs/chunk-SVB5K454.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @osdk/client
2
2
 
3
+ ## 2.28.0-main-a5066b5822179d54731c738017fc477dbfee32b4
4
+
5
+ ### Minor Changes
6
+
7
+ - a5066b5: add resolveToObjectType option to useOsdkObjects so interface queries return full concrete object-type instances
8
+
9
+ ### Patch Changes
10
+
11
+ - @osdk/shared.test@2.20.1-main-a5066b5822179d54731c738017fc477dbfee32b4
12
+ - @osdk/api@2.28.0-main-a5066b5822179d54731c738017fc477dbfee32b4
13
+ - @osdk/client.unstable@2.28.0-main-a5066b5822179d54731c738017fc477dbfee32b4
14
+ - @osdk/generator-converters@2.28.0-main-a5066b5822179d54731c738017fc477dbfee32b4
15
+
3
16
  ## 2.27.0
4
17
 
5
18
  ### Minor Changes
@@ -21,7 +21,7 @@
21
21
  export const additionalContext = Symbol("additionalContext");
22
22
 
23
23
  // BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
24
- const MaxOsdkVersion = "2.27.0";
24
+ const MaxOsdkVersion = "2.28.0";
25
25
  // END: THIS IS GENERATED CODE. DO NOT EDIT.
26
26
 
27
27
  const ErrorMessage = Symbol("ErrorMessage");
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const ref = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference)\n * .createMediaReference({ data: blob, fileName: \"media.mp4\", objectType: Employee, propertyType: \"photo\" });\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.27.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AA8HA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,QAAQ;AAC/B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const ref = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference)\n * .createMediaReference({ data: blob, fileName: \"media.mp4\", objectType: Employee, propertyType: \"photo\" });\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.28.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AA8HA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,QAAQ;AAC/B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","extraUserAgents","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { createFetchHeaderMutator } from \"@osdk/shared.net.fetch\";\nimport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport type { QueryReturnType } from \"../queries/types.js\";\nimport { OBSERVABLE_USER_AGENT } from \"../util/UserAgent.js\";\nimport type { Canonical } from \"./internal/Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { ObservableClientImpl } from \"./internal/ObservableClientImpl.js\";\nimport { Store } from \"./internal/Store.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n Status,\n} from \"./ObservableClient/common.js\";\nimport type {\n MediaMetadataObserveOptions,\n MediaMetadataPayload,\n} from \"./ObservableClient/MediaObservableTypes.js\";\nimport type { MediaPropertyLocation } from \"./ObservableClient/MediaTypes.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 CacheSnapshot {\n entries: CacheEntry[];\n stats: {\n totalEntries: number;\n totalSize: number;\n totalHits?: number;\n };\n}\n\ninterface CacheEntryMetadata {\n timestamp: number;\n status: \"init\" | \"loading\" | \"loaded\" | \"error\";\n hitCount?: number;\n size: number;\n isOptimistic?: boolean;\n}\n\ninterface CacheEntryBase {\n key: string;\n objectType: string;\n metadata: CacheEntryMetadata;\n data?: unknown;\n}\n\nexport type CacheEntry =\n | CacheEntryBase & { type: \"object\" }\n | CacheEntryBase & {\n type: \"list\";\n where?: unknown;\n orderBy?: unknown;\n pageSize?: number;\n }\n | CacheEntryBase & { type: \"link\"; linkName?: string }\n | CacheEntryBase & { type: \"objectSet\" };\n\nexport interface ObserveObjectOptions<\n T extends ObjectOrInterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: readonly PropertyKeys<T>[];\n $loadPropertySecurityMetadata?: boolean;\n\n /**\n * When true, includes all properties of the underlying concrete object type\n * for interface queries. Has no effect for non-interface queries.\n */\n $includeAllBaseObjectProperties?: boolean;\n}\n\nexport type OrderBy<Q extends ObjectOrInterfaceDefinition> = {\n [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" | undefined;\n};\n\nexport interface ObserveListOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: Pick<Q, \"apiName\" | \"type\">;\n where?: WhereClause<Q, RDPs>;\n pageSize?: number;\n orderBy?: OrderBy<Q>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n\n /**\n * Enable streaming updates via websocket subscription.\n *\n * Cannot be combined with `pivotTo`. The server does not support\n * websocket subscriptions for link-traversal queries.\n *\n * Cannot be combined with `withProperties`. The server does not support\n * websocket subscriptions for object sets that include derived properties;\n * in that case `streamUpdates` is ignored and a warning is logged in\n * development.\n */\n streamUpdates?: boolean;\n withProperties?: DerivedProperty.Clause<Q>;\n\n /**\n * Fetch objects by their Resource Identifiers (RIDs).\n * When provided, starts with a static objectset containing these RIDs.\n * Can be combined with `where` to filter the RID set, and with `orderBy` to sort results.\n *\n * @example\n * ```ts\n * // Fetch specific objects by RID\n * observeList({ type: Employee, rids: ['ri.foo.123', 'ri.foo.456'] }, observer);\n * ```\n *\n * @example\n * ```ts\n * // Fetch specific objects by RID, filtered by status\n * observeList({\n * type: Employee,\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' },\n * }, observer);\n * ```\n */\n rids?: readonly string[];\n\n /**\n * Restrict which properties are returned for each object.\n * When provided, only the specified properties will be fetched,\n * reducing payload sizes for list views.\n */\n select?: readonly PropertyKeys<Q>[];\n\n /**\n * When true, loads per-property security metadata (marking requirements)\n * alongside each object. The returned objects will have `$propertySecurities`\n * populated with conjunctive/disjunctive marking requirements per property.\n */\n $loadPropertySecurityMetadata?: boolean;\n\n /**\n * When true, includes all properties of the underlying concrete object type\n * for interface queries. Has no effect for non-interface queries.\n */\n $includeAllBaseObjectProperties?: boolean;\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 * ```ts\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer);\n * ```\n *\n * @example\n * ```ts\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer);\n * ```\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n\n /**\n * Traverse to linked objects. Cannot be combined with `streamUpdates`.\n * The server does not support websocket subscriptions for link-traversal\n * queries.\n */\n pivotTo?: string;\n}\n\nexport interface ObserveObjectCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<T, \"$allBaseProperties\"> | undefined;\n isOptimistic: boolean;\n status: Status;\n lastUpdated: number;\n}\n\nexport interface ObserveObjectsCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList:\n | Array<Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>>\n | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n objectSet: ObjectSet<T, RDPs>;\n}\n\nexport interface ObserveObjectSetArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList:\n | Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >\n | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n objectSet: ObjectSet<T, RDPs>;\n totalCount?: string;\n}\n\ninterface ObserveAggregationBaseOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: T;\n where?: WhereClause<T, RDPs>;\n withProperties?: DerivedProperty.Clause<T>;\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n aggregate: A;\n}\n\n/**\n * Options for observeAggregation without an ObjectSet (synchronous).\n */\nexport interface ObserveAggregationOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet?: undefined;\n}\n\n/**\n * Options for observeAggregation with an ObjectSet (asynchronous).\n *\n * When objectSet is provided, the aggregation is performed on that ObjectSet\n * instead of the base type, enabling aggregation on pivoted or filtered sets.\n */\nexport interface ObserveAggregationOptionsWithObjectSet<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet: ObjectSet<T>;\n}\n\nexport interface ObserveAggregationArgs<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n> {\n result: AggregationsResults<T, A> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\nexport interface ObserveFunctionOptions extends CommonObserveOptions {\n /**\n * Object types this function depends on.\n * When actions modify these types, the function will refetch.\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances or ObjectSets this function depends on.\n * When these objects change, the function will refetch.\n *\n * For ObjectSets, the object type is extracted asynchronously and added\n * to the dependency list. Changes to any object of that type will trigger\n * a refetch.\n */\n dependsOnObjects?: Array<\n Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>\n >;\n}\n\nexport interface ObserveFunctionCallbackArgs<\n Q extends QueryDefinition<unknown>,\n> {\n result: QueryReturnType<CompileTimeMetadata<Q>[\"output\"]> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\n/**\n * User facing callback args for `observeLink`\n */\nexport interface ObserveLinkCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n resolvedList: Osdk.Instance<T, \"$allBaseProperties\">[] | undefined;\n linkedObjectsBySourcePrimaryKey: ReadonlyMap<\n string | number,\n ReadonlyArray<Osdk.Instance<T, \"$allBaseProperties\">>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n}\n\n/**\n * Public interface for reactive data management with automatic updates.\n *\n * The ObservableClient provides a reactive data layer with:\n * - Real-time object and collection observation\n * - Automatic cache updates when data changes\n * - Optimistic updates for immediate UI feedback\n * - Pagination support for large collections\n * - Link traversal for relationship navigation\n */\nexport interface ObservableClient extends ObserveLinks {\n /**\n * Observe a single object or interface instance with automatic updates when it changes.\n *\n * @param apiName - The object type or interface definition, or its API name\n * @param pk - The object's primary key\n * @param options - Observation options including deduplication interval\n * @param subFn - Observer that receives object state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * The observer will receive:\n * - Initial loading state if data not cached\n * - Loaded state with the object data\n * - Updates when the object changes\n * - Error state if fetch fails\n */\n observeObject<T extends ObjectOrInterfaceDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options:\n & ObserveOptions\n & Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * Observe an ObjectSet with automatic updates when matching objects change.\n *\n * @param baseObjectSet - The base ObjectSet to observe\n * @param options - Options for transforming and observing the ObjectSet\n * @param subFn - Observer that receives ObjectSet state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports all ObjectSet operations:\n * - Filtering with where clauses\n * - Derived properties with withProperties\n * - Set operations (union, intersect, subtract)\n * - Link traversal with pivotTo\n * - Sorting and pagination\n */\n observeObjectSet<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * @deprecated Use the async overload with `objectSet` parameter instead.\n * Pass `objectSet: client(YourType)` to get the base object set.\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n\n /**\n * Observe an aggregation query on a custom ObjectSet with automatic updates.\n *\n * This overload accepts an ObjectSet parameter, enabling aggregation on pivoted,\n * filtered, or composed ObjectSets. Returns a Promise because invalidation type\n * computation is async (requires lookups for link targets).\n *\n * @param options - Aggregation configuration including objectSet, where, aggregate spec\n * @param subFn - Observer that receives aggregation result updates\n * @returns Promise resolving to subscription that can be unsubscribed\n *\n * @example\n * ```typescript\n * const sub = await observableClient.observeAggregation(\n * {\n * type: Office,\n * objectSet: $(Employee).pivotTo(\"primaryOffice\"),\n * aggregate: { $select: { $count: \"unordered\" } }\n * },\n * observer\n * );\n * ```\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Promise<Unsubscribable>;\n\n /**\n * Observe a function execution with automatic updates.\n *\n * @param queryDef - The QueryDefinition to execute\n * @param params - Parameters to pass to the function (undefined if no params)\n * @param options - Observation options including invalidation configuration\n * @param subFn - Observer that receives function result updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Automatic caching and deduplication\n * - Dependency-based invalidation (dependsOn object types)\n * - Instance-based invalidation (dependsOnObjects)\n * - Manual refetch via invalidateFunction()\n */\n observeFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n params: Record<string, unknown> | undefined,\n options: ObserveFunctionOptions,\n subFn: Observer<ObserveFunctionCallbackArgs<Q>>,\n ): Unsubscribable;\n\n /**\n * Execute an action with optional optimistic updates.\n *\n * @param action - Action definition to execute\n * @param args - Arguments for the action\n * @param opts - Options including optimistic updates\n * @returns Promise that resolves when the action completes\n *\n * When providing optimistic updates:\n * - Changes appear immediately in the UI\n * - Server request still happens in background\n * - On success, server data replaces optimistic data\n * - On failure, optimistic changes automatically roll back\n */\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n /**\n * Validate action parameters without executing the action.\n *\n * @param action - Action definition to validate\n * @param args - Arguments to validate\n * @returns Promise with validation result\n *\n * Use this to:\n * - Pre-validate forms before submission\n * - Display warnings or errors in the UI\n * - Enable/disable action buttons based on validity\n */\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n /**\n * Invalidates the entire cache, forcing all queries to refetch.\n * Use sparingly as this can cause significant network traffic.\n */\n invalidateAll(): Promise<void>;\n\n /**\n * Invalidates specific objects in the cache.\n * @param objects - Single object or array of objects to invalidate\n */\n invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void>;\n\n /**\n * Invalidates all cached data for a specific object type.\n * This includes:\n * - All objects of the specified type\n * - All lists containing objects of this type\n * - All links where the source is of this type\n *\n * @param type - Object type definition or API name string\n * @returns Promise that resolves when invalidation is complete\n */\n invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void>;\n\n /**\n * Invalidate function queries.\n * - If params undefined, invalidates ALL queries for this function\n * - If params provided, invalidates only the query with exact params match\n *\n * @param apiName - Function API name string or QueryDefinition\n * @param params - Optional params for exact match\n */\n invalidateFunction(\n apiName: string | QueryDefinition<unknown>,\n params?: Record<string, unknown>,\n ): Promise<void>;\n\n /**\n * Invalidate functions that depend on a specific object instance.\n *\n * @param apiName - Object type API name\n * @param primaryKey - Object primary key\n */\n invalidateFunctionsByObject(\n apiName: string,\n primaryKey: string | number,\n ): Promise<void>;\n\n getCacheSnapshot(): Promise<CacheSnapshot>;\n\n canonicalizeWhereClause: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n\n canonicalizeOptions: <OS, T extends CanonicalizeOptionsInput<OS>>(\n options: T,\n ) => CanonicalizedOptions<T>;\n\n observeMediaMetadata(\n coords: MediaPropertyLocation,\n options: MediaMetadataObserveOptions,\n observer: Observer<MediaMetadataPayload>,\n ): Unsubscribable;\n}\n\nexport interface CanonicalizeOptionsInput<OS = ObjectSet<any, any>> {\n where?: object;\n withProperties?: object;\n orderBy?: Record<string, \"asc\" | \"desc\" | undefined>;\n aggregate?: object;\n intersectWith?: Array<{ where: object }>;\n union?: ReadonlyArray<OS>;\n intersect?: ReadonlyArray<OS>;\n subtract?: ReadonlyArray<OS>;\n $select?: ReadonlyArray<string>;\n}\n\nexport type CanonicalizedOptions<\n T extends CanonicalizeOptionsInput<any>,\n> = {\n [K in keyof T]: T[K];\n};\n\nexport function createObservableClient(\n client: Client,\n extraUserAgents?: () => string[],\n): 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 ...(extraUserAgents?.() ?? []),\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SAASA,wBAAwB,QAAQ,wBAAwB;AAEjE,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;AAE5D,SAASC,qBAAqB,QAAQ,sBAAsB;AAG5D,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,KAAK,QAAQ,qBAAqB;AAAC,WAgB3BC,gBAAgB;AA+NjC;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgRA,OAAO,SAASC,sBAAsBA,CACpCC,MAAc,EACdC,eAAgC,EACd;EAClB;EACA;EACA,MAAMC,aAAa,GAAGR,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BU,KAAK,EAAEX,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACU,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BX,qBAAqB,EACrB,IAAIM,eAAe,GAAG,CAAC,IAAI,EAAE,CAAC,CAC/B,CAACM,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,IAAIR,oBAAoB,CAAC,IAAIC,KAAK,CAACK,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
1
+ {"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","extraUserAgents","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { createFetchHeaderMutator } from \"@osdk/shared.net.fetch\";\nimport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport type { QueryReturnType } from \"../queries/types.js\";\nimport { OBSERVABLE_USER_AGENT } from \"../util/UserAgent.js\";\nimport type { Canonical } from \"./internal/Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { ObservableClientImpl } from \"./internal/ObservableClientImpl.js\";\nimport { Store } from \"./internal/Store.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n Status,\n} from \"./ObservableClient/common.js\";\nimport type {\n MediaMetadataObserveOptions,\n MediaMetadataPayload,\n} from \"./ObservableClient/MediaObservableTypes.js\";\nimport type { MediaPropertyLocation } from \"./ObservableClient/MediaTypes.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 CacheSnapshot {\n entries: CacheEntry[];\n stats: {\n totalEntries: number;\n totalSize: number;\n totalHits?: number;\n };\n}\n\ninterface CacheEntryMetadata {\n timestamp: number;\n status: \"init\" | \"loading\" | \"loaded\" | \"error\";\n hitCount?: number;\n size: number;\n isOptimistic?: boolean;\n}\n\ninterface CacheEntryBase {\n key: string;\n objectType: string;\n metadata: CacheEntryMetadata;\n data?: unknown;\n}\n\nexport type CacheEntry =\n | CacheEntryBase & { type: \"object\" }\n | CacheEntryBase & {\n type: \"list\";\n where?: unknown;\n orderBy?: unknown;\n pageSize?: number;\n }\n | CacheEntryBase & { type: \"link\"; linkName?: string }\n | CacheEntryBase & { type: \"objectSet\" };\n\nexport interface ObserveObjectOptions<\n T extends ObjectOrInterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: readonly PropertyKeys<T>[];\n $loadPropertySecurityMetadata?: boolean;\n\n /**\n * When true, includes all properties of the underlying concrete object type\n * for interface queries. Has no effect for non-interface queries.\n */\n $includeAllBaseObjectProperties?: boolean;\n}\n\nexport type OrderBy<Q extends ObjectOrInterfaceDefinition> = {\n [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" | undefined;\n};\n\nexport interface ObserveListOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: Pick<Q, \"apiName\" | \"type\">;\n where?: WhereClause<Q, RDPs>;\n pageSize?: number;\n orderBy?: OrderBy<Q>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n\n /**\n * Enable streaming updates via websocket subscription.\n *\n * Cannot be combined with `pivotTo`. The server does not support\n * websocket subscriptions for link-traversal queries.\n *\n * Cannot be combined with `withProperties`. The server does not support\n * websocket subscriptions for object sets that include derived properties;\n * in that case `streamUpdates` is ignored and a warning is logged in\n * development.\n */\n streamUpdates?: boolean;\n withProperties?: DerivedProperty.Clause<Q>;\n\n /**\n * Fetch objects by their Resource Identifiers (RIDs).\n * When provided, starts with a static objectset containing these RIDs.\n * Can be combined with `where` to filter the RID set, and with `orderBy` to sort results.\n *\n * @example\n * ```ts\n * // Fetch specific objects by RID\n * observeList({ type: Employee, rids: ['ri.foo.123', 'ri.foo.456'] }, observer);\n * ```\n *\n * @example\n * ```ts\n * // Fetch specific objects by RID, filtered by status\n * observeList({\n * type: Employee,\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' },\n * }, observer);\n * ```\n */\n rids?: readonly string[];\n\n /**\n * Restrict which properties are returned for each object.\n * When provided, only the specified properties will be fetched,\n * reducing payload sizes for list views.\n */\n select?: readonly PropertyKeys<Q>[];\n\n /**\n * When true, loads per-property security metadata (marking requirements)\n * alongside each object. The returned objects will have `$propertySecurities`\n * populated with conjunctive/disjunctive marking requirements per property.\n */\n $loadPropertySecurityMetadata?: boolean;\n\n /**\n * When true, includes all properties of the underlying concrete object type\n * for interface queries. Has no effect for non-interface queries.\n */\n $includeAllBaseObjectProperties?: boolean;\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 * ```ts\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer);\n * ```\n *\n * @example\n * ```ts\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer);\n * ```\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n\n /**\n * Traverse to linked objects. Cannot be combined with `streamUpdates`.\n * The server does not support websocket subscriptions for link-traversal\n * queries.\n */\n pivotTo?: string;\n\n /**\n * When loading objects via an interface type, return the full concrete\n * object type instances instead of interface views.\n *\n * By default, interface queries return objects narrowed to interface\n * properties only. With `resolveToObjectType: true`, returned objects\n * include all properties from the implementing object type (e.g. `$title`,\n * custom properties not on the interface).\n *\n * Only has an effect when `type` is an interface.\n *\n * @default false\n */\n resolveToObjectType?: boolean;\n}\n\nexport interface ObserveObjectCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<T, \"$allBaseProperties\"> | undefined;\n isOptimistic: boolean;\n status: Status;\n lastUpdated: number;\n}\n\nexport interface ObserveObjectsCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList:\n | Array<Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>>\n | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n objectSet: ObjectSet<T, RDPs>;\n}\n\nexport interface ObserveObjectSetArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList:\n | Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >\n | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n objectSet: ObjectSet<T, RDPs>;\n totalCount?: string;\n}\n\ninterface ObserveAggregationBaseOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends CommonObserveOptions, ObserveOptions {\n type: T;\n where?: WhereClause<T, RDPs>;\n withProperties?: DerivedProperty.Clause<T>;\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n aggregate: A;\n}\n\n/**\n * Options for observeAggregation without an ObjectSet (synchronous).\n */\nexport interface ObserveAggregationOptions<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet?: undefined;\n}\n\n/**\n * Options for observeAggregation with an ObjectSet (asynchronous).\n *\n * When objectSet is provided, the aggregation is performed on that ObjectSet\n * instead of the base type, enabling aggregation on pivoted or filtered sets.\n */\nexport interface ObserveAggregationOptionsWithObjectSet<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> extends ObserveAggregationBaseOptions<T, A, RDPs> {\n objectSet: ObjectSet<T>;\n}\n\nexport interface ObserveAggregationArgs<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n> {\n result: AggregationsResults<T, A> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\nexport interface ObserveFunctionOptions extends CommonObserveOptions {\n /**\n * Object types this function depends on.\n * When actions modify these types, the function will refetch.\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances or ObjectSets this function depends on.\n * When these objects change, the function will refetch.\n *\n * For ObjectSets, the object type is extracted asynchronously and added\n * to the dependency list. Changes to any object of that type will trigger\n * a refetch.\n */\n dependsOnObjects?: Array<\n Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>\n >;\n}\n\nexport interface ObserveFunctionCallbackArgs<\n Q extends QueryDefinition<unknown>,\n> {\n result: QueryReturnType<CompileTimeMetadata<Q>[\"output\"]> | undefined;\n status: Status;\n lastUpdated: number;\n error?: Error;\n}\n\n/**\n * User facing callback args for `observeLink`\n */\nexport interface ObserveLinkCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n resolvedList: Osdk.Instance<T, \"$allBaseProperties\">[] | undefined;\n linkedObjectsBySourcePrimaryKey: ReadonlyMap<\n string | number,\n ReadonlyArray<Osdk.Instance<T, \"$allBaseProperties\">>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n}\n\n/**\n * Public interface for reactive data management with automatic updates.\n *\n * The ObservableClient provides a reactive data layer with:\n * - Real-time object and collection observation\n * - Automatic cache updates when data changes\n * - Optimistic updates for immediate UI feedback\n * - Pagination support for large collections\n * - Link traversal for relationship navigation\n */\nexport interface ObservableClient extends ObserveLinks {\n /**\n * Observe a single object or interface instance with automatic updates when it changes.\n *\n * @param apiName - The object type or interface definition, or its API name\n * @param pk - The object's primary key\n * @param options - Observation options including deduplication interval\n * @param subFn - Observer that receives object state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * The observer will receive:\n * - Initial loading state if data not cached\n * - Loaded state with the object data\n * - Updates when the object changes\n * - Error state if fetch fails\n */\n observeObject<T extends ObjectOrInterfaceDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options:\n & ObserveOptions\n & Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * Observe an ObjectSet with automatic updates when matching objects change.\n *\n * @param baseObjectSet - The base ObjectSet to observe\n * @param options - Options for transforming and observing the ObjectSet\n * @param subFn - Observer that receives ObjectSet state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports all ObjectSet operations:\n * - Filtering with where clauses\n * - Derived properties with withProperties\n * - Set operations (union, intersect, subtract)\n * - Link traversal with pivotTo\n * - Sorting and pagination\n */\n observeObjectSet<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * @deprecated Use the async overload with `objectSet` parameter instead.\n * Pass `objectSet: client(YourType)` to get the base object set.\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptions<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Unsubscribable;\n\n /**\n * Observe an aggregation query on a custom ObjectSet with automatic updates.\n *\n * This overload accepts an ObjectSet parameter, enabling aggregation on pivoted,\n * filtered, or composed ObjectSets. Returns a Promise because invalidation type\n * computation is async (requires lookups for link targets).\n *\n * @param options - Aggregation configuration including objectSet, where, aggregate spec\n * @param subFn - Observer that receives aggregation result updates\n * @returns Promise resolving to subscription that can be unsubscribed\n *\n * @example\n * ```typescript\n * const sub = await observableClient.observeAggregation(\n * {\n * type: Office,\n * objectSet: $(Employee).pivotTo(\"primaryOffice\"),\n * aggregate: { $select: { $count: \"unordered\" } }\n * },\n * observer\n * );\n * ```\n */\n observeAggregation<\n T extends ObjectOrInterfaceDefinition,\n A extends AggregateOpts<T>,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveAggregationOptionsWithObjectSet<T, A, RDPs>,\n subFn: Observer<ObserveAggregationArgs<T, A>>,\n ): Promise<Unsubscribable>;\n\n /**\n * Observe a function execution with automatic updates.\n *\n * @param queryDef - The QueryDefinition to execute\n * @param params - Parameters to pass to the function (undefined if no params)\n * @param options - Observation options including invalidation configuration\n * @param subFn - Observer that receives function result updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Automatic caching and deduplication\n * - Dependency-based invalidation (dependsOn object types)\n * - Instance-based invalidation (dependsOnObjects)\n * - Manual refetch via invalidateFunction()\n */\n observeFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n params: Record<string, unknown> | undefined,\n options: ObserveFunctionOptions,\n subFn: Observer<ObserveFunctionCallbackArgs<Q>>,\n ): Unsubscribable;\n\n /**\n * Execute an action with optional optimistic updates.\n *\n * @param action - Action definition to execute\n * @param args - Arguments for the action\n * @param opts - Options including optimistic updates\n * @returns Promise that resolves when the action completes\n *\n * When providing optimistic updates:\n * - Changes appear immediately in the UI\n * - Server request still happens in background\n * - On success, server data replaces optimistic data\n * - On failure, optimistic changes automatically roll back\n */\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<ActionEditResponse>;\n\n /**\n * Validate action parameters without executing the action.\n *\n * @param action - Action definition to validate\n * @param args - Arguments to validate\n * @returns Promise with validation result\n *\n * Use this to:\n * - Pre-validate forms before submission\n * - Display warnings or errors in the UI\n * - Enable/disable action buttons based on validity\n */\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n /**\n * Invalidates the entire cache, forcing all queries to refetch.\n * Use sparingly as this can cause significant network traffic.\n */\n invalidateAll(): Promise<void>;\n\n /**\n * Invalidates specific objects in the cache.\n * @param objects - Single object or array of objects to invalidate\n */\n invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void>;\n\n /**\n * Invalidates all cached data for a specific object type.\n * This includes:\n * - All objects of the specified type\n * - All lists containing objects of this type\n * - All links where the source is of this type\n *\n * @param type - Object type definition or API name string\n * @returns Promise that resolves when invalidation is complete\n */\n invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void>;\n\n /**\n * Invalidate function queries.\n * - If params undefined, invalidates ALL queries for this function\n * - If params provided, invalidates only the query with exact params match\n *\n * @param apiName - Function API name string or QueryDefinition\n * @param params - Optional params for exact match\n */\n invalidateFunction(\n apiName: string | QueryDefinition<unknown>,\n params?: Record<string, unknown>,\n ): Promise<void>;\n\n /**\n * Invalidate functions that depend on a specific object instance.\n *\n * @param apiName - Object type API name\n * @param primaryKey - Object primary key\n */\n invalidateFunctionsByObject(\n apiName: string,\n primaryKey: string | number,\n ): Promise<void>;\n\n getCacheSnapshot(): Promise<CacheSnapshot>;\n\n canonicalizeWhereClause: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n\n canonicalizeOptions: <OS, T extends CanonicalizeOptionsInput<OS>>(\n options: T,\n ) => CanonicalizedOptions<T>;\n\n observeMediaMetadata(\n coords: MediaPropertyLocation,\n options: MediaMetadataObserveOptions,\n observer: Observer<MediaMetadataPayload>,\n ): Unsubscribable;\n}\n\nexport interface CanonicalizeOptionsInput<OS = ObjectSet<any, any>> {\n where?: object;\n withProperties?: object;\n orderBy?: Record<string, \"asc\" | \"desc\" | undefined>;\n aggregate?: object;\n intersectWith?: Array<{ where: object }>;\n union?: ReadonlyArray<OS>;\n intersect?: ReadonlyArray<OS>;\n subtract?: ReadonlyArray<OS>;\n $select?: ReadonlyArray<string>;\n}\n\nexport type CanonicalizedOptions<\n T extends CanonicalizeOptionsInput<any>,\n> = {\n [K in keyof T]: T[K];\n};\n\nexport function createObservableClient(\n client: Client,\n extraUserAgents?: () => string[],\n): 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 ...(extraUserAgents?.() ?? []),\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SAASA,wBAAwB,QAAQ,wBAAwB;AAEjE,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;AAE5D,SAASC,qBAAqB,QAAQ,sBAAsB;AAG5D,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,KAAK,QAAQ,qBAAqB;AAAC,WAgB3BC,gBAAgB;AA8OjC;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgRA,OAAO,SAASC,sBAAsBA,CACpCC,MAAc,EACdC,eAAgC,EACd;EAClB;EACA;EACA,MAAMC,aAAa,GAAGR,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BU,KAAK,EAAEX,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACU,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BX,qBAAqB,EACrB,IAAIM,eAAe,GAAG,CAAC,IAAI,EAAE,CAAC,CAC/B,CAACM,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,IAAIR,oBAAoB,CAAC,IAAIC,KAAK,CAACK,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
@@ -80,8 +80,11 @@ export class InterfaceListQuery extends ListQuery {
80
80
  async postProcessFetchedData(data) {
81
81
  return reloadDataAsFullObjects(this.store.client, data);
82
82
  }
83
+ wrapObject(object) {
84
+ return this.options.resolveToObjectType ? object : object.$as(this.apiName);
85
+ }
83
86
  createPayload(params) {
84
- const resolvedList = params.resolvedData?.map(obj => obj.$as(this.apiName));
87
+ const resolvedList = params.resolvedData?.map(obj => this.wrapObject(obj));
85
88
  return {
86
89
  ...super.createPayload(params),
87
90
  resolvedList
@@ -91,8 +94,8 @@ export class InterfaceListQuery extends ListQuery {
91
94
  const matchesApiName = ([, object]) => {
92
95
  return this.apiName in object[ObjectDefRef].interfaceMap;
93
96
  };
94
- const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
95
- const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
97
+ const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => this.wrapObject(object));
98
+ const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => this.wrapObject(object));
96
99
  return {
97
100
  added: {
98
101
  all: added,
@@ -1 +1 @@
1
- {"version":3,"file":"InterfaceListQuery.js","names":["groupBy","arr","fn","result","item","key","push","invariant","additionalContext","ObjectDefRef","ListQuery","PIVOT_IDX","RDP_IDX","RIDS_IDX","InterfaceListQuery","createObjectSet","store","rdpConfig","cacheKey","otherKeys","pivotInfo","rids","sourceSet","createSourceSetForPivot","objectSet","where","canonicalWhere","pivotTo","linkName","withProperties","objectTypeDef","type","apiName","clientCtx","client","objectSetFactory","objects","revalidateObjectType","objectType","objectMetadata","fetchMetadata","interfaceMap","postProcessFetchedData","data","reloadDataAsFullObjects","createPayload","params","resolvedList","resolvedData","map","obj","$as","extractRelevantObjects","changes","matchesApiName","object","added","Array","from","addedObjects","filter","modified","modifiedObjects","all","strictMatches","Set","sortaMatches","sourceType","sourceTypeKind","length","groups","x","$objectType","objectTypeToPrimaryKeyToObject","Object","fromEntries","Promise","entries","objectDef","primaryKeyApiName","$in","$primaryKey","fetchPage","$includeRid","fullObject","process","env","NODE_ENV"],"sources":["InterfaceListQuery.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 DerivedProperty,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n WhereClause,\n} from \"@osdk/api\";\nfunction groupBy<T>(\n arr: T[],\n fn: (item: T) => string,\n): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n for (const item of arr) {\n const key = fn(item);\n (result[key] ??= []).push(item);\n }\n return result;\n}\nimport invariant from \"tiny-invariant\";\nimport { additionalContext, type Client } from \"../../../Client.js\";\nimport type { InterfaceHolder } from \"../../../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport { ObjectDefRef } from \"../../../object/convertWireToOsdkObjects/InternalSymbols.js\";\nimport type { ObjectHolder } from \"../../../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ListPayload } from \"../../ListPayload.js\";\nimport type { CollectionConnectableParams } from \"../base-list/BaseCollectionQuery.js\";\nimport type { Changes } from \"../Changes.js\";\nimport type { PivotInfo } from \"../PivotCanonicalizer.js\";\nimport type { Rdp } from \"../RdpCanonicalizer.js\";\nimport type { SimpleWhereClause } from \"../SimpleWhereClause.js\";\nimport type { Store } from \"../Store.js\";\nimport { ListQuery, PIVOT_IDX, RDP_IDX, RIDS_IDX } from \"./ListQuery.js\";\n\ntype ExtractRelevantObjectsResult = Record<\"added\" | \"modified\", {\n all: (ObjectHolder | InterfaceHolder)[];\n strictMatches: Set<(ObjectHolder | InterfaceHolder)>;\n sortaMatches: Set<(ObjectHolder | InterfaceHolder)>;\n}>;\n\nexport class InterfaceListQuery extends ListQuery {\n protected createObjectSet(store: Store): ObjectSet<ObjectTypeDefinition> {\n const rdpConfig = this.cacheKey.otherKeys[RDP_IDX];\n const pivotInfo = this.cacheKey.otherKeys[PIVOT_IDX];\n const rids = this.cacheKey.otherKeys[RIDS_IDX];\n\n if (pivotInfo != null) {\n const sourceSet = createSourceSetForPivot(store, pivotInfo, rids);\n\n let objectSet = sourceSet\n .where(this.canonicalWhere as WhereClause<any>)\n .pivotTo(pivotInfo.linkName);\n\n if (rdpConfig != null) {\n objectSet = objectSet.withProperties(\n rdpConfig as DerivedProperty.Clause<ObjectTypeDefinition>,\n );\n }\n\n // intersectWith for pivot queries is deferred to fetchPageData\n // where the target type can be resolved asynchronously\n return objectSet;\n }\n\n const type: string = \"interface\" as const;\n const objectTypeDef = {\n type,\n apiName: this.apiName,\n } as ObjectTypeDefinition;\n\n const clientCtx = store.client[additionalContext];\n let objectSet: ObjectSet<ObjectTypeDefinition>;\n if (rids != null) {\n objectSet = clientCtx.objectSetFactory(\n objectTypeDef,\n clientCtx,\n { type: \"static\", objects: [...rids] },\n );\n } else {\n objectSet = store.client(objectTypeDef);\n }\n\n if (rdpConfig != null) {\n objectSet = objectSet.withProperties(rdpConfig as Rdp);\n }\n\n return objectSet.where(this.canonicalWhere);\n }\n\n async revalidateObjectType(objectType: string): Promise<boolean> {\n if (await super.revalidateObjectType(objectType)) return true;\n\n // For interface queries: also check if the invalidated concrete type\n // implements this query's interface. e.g. invalidating \"Employee\"\n // should revalidate a query for \"Assignable\" if Employee implements it.\n try {\n const objectMetadata = await this.store.client.fetchMetadata({\n type: \"object\",\n apiName: objectType,\n });\n return this.apiName in objectMetadata.interfaceMap;\n } catch {\n return true;\n }\n }\n\n protected async postProcessFetchedData(\n data: Osdk.Instance<any>[],\n ): Promise<Osdk.Instance<any>[]> {\n return reloadDataAsFullObjects(this.store.client, data);\n }\n\n protected createPayload(\n params: CollectionConnectableParams,\n ): ListPayload {\n const resolvedList = params.resolvedData?.map((obj: ObjectHolder) =>\n obj.$as(this.apiName)\n );\n\n return {\n ...super.createPayload(params),\n resolvedList,\n };\n }\n\n protected extractRelevantObjects(\n changes: Changes,\n ): ExtractRelevantObjectsResult {\n const matchesApiName = ([, object]: [unknown, ObjectHolder]) => {\n return this.apiName in object[ObjectDefRef].interfaceMap;\n };\n\n const added = Array.from(changes.addedObjects).filter(matchesApiName).map((\n [, object],\n ) => object.$as(this.apiName));\n\n const modified = Array.from(changes.modifiedObjects).filter(matchesApiName)\n .map((\n [, object],\n ) => object.$as(this.apiName));\n\n return {\n added: {\n all: added,\n strictMatches: new Set(),\n sortaMatches: new Set(),\n },\n modified: {\n all: modified,\n strictMatches: new Set(),\n sortaMatches: new Set(),\n },\n };\n }\n}\n\nfunction createSourceSetForPivot(\n store: Store,\n pivotInfo: PivotInfo,\n rids: string[] | undefined,\n): ObjectSet<ObjectOrInterfaceDefinition> {\n const clientCtx = store.client[additionalContext];\n\n if (rids != null) {\n return clientCtx.objectSetFactory(\n {\n type: \"object\",\n apiName: pivotInfo.sourceType,\n } as ObjectTypeDefinition,\n clientCtx,\n { type: \"static\", objects: [...rids] },\n );\n }\n\n if (pivotInfo.sourceTypeKind === \"interface\") {\n return store.client({\n type: \"interface\",\n apiName: pivotInfo.sourceType,\n } as InterfaceDefinition) as ObjectSet<ObjectOrInterfaceDefinition>;\n }\n\n return store.client({\n type: \"object\",\n apiName: pivotInfo.sourceType,\n } as ObjectTypeDefinition) as ObjectSet<ObjectOrInterfaceDefinition>;\n}\n\n// Hopefully this can go away when we can just request the full object properties on first load\nasync function reloadDataAsFullObjects(\n client: Client,\n data: Osdk.Instance<any>[],\n) {\n if (data.length === 0) {\n return data;\n }\n\n const groups = groupBy(data, (x) => x.$objectType);\n const objectTypeToPrimaryKeyToObject = Object.fromEntries(\n await Promise.all(\n Object.entries(groups).map<\n Promise<\n [\n /** objectType **/ string,\n Record<string | number, Osdk.Instance<ObjectTypeDefinition>>,\n ]\n >\n >(async ([apiName, objects]) => {\n // Interface query results don't have ObjectDefRef, so we fetch metadata to get primaryKeyApiName\n const objectDef = await client.fetchMetadata({\n type: \"object\",\n apiName,\n });\n const where: SimpleWhereClause = {\n [objectDef.primaryKeyApiName]: {\n $in: objects.map(x => x.$primaryKey),\n },\n };\n\n const result = await client(\n objectDef as ObjectTypeDefinition,\n ).where(\n where as Parameters<ObjectSet<ObjectTypeDefinition>[\"where\"]>[0],\n ).fetchPage({ $includeRid: true });\n return [\n apiName,\n Object.fromEntries(result.data.map(\n x => [x.$primaryKey, x],\n )),\n ];\n }),\n ),\n );\n\n return data.map((obj) => {\n const fullObject =\n objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey];\n invariant(\n fullObject,\n `Could not find object ${obj.$objectType} ${obj.$primaryKey}`,\n );\n return fullObject;\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,OAAOA,CACdC,GAAQ,EACRC,EAAuB,EACF;EACrB,MAAMC,MAA2B,GAAG,CAAC,CAAC;EACtC,KAAK,MAAMC,IAAI,IAAIH,GAAG,EAAE;IACtB,MAAMI,GAAG,GAAGH,EAAE,CAACE,IAAI,CAAC;IACpB,CAACD,MAAM,CAACE,GAAG,CAAC,KAAK,EAAE,EAAEC,IAAI,CAACF,IAAI,CAAC;EACjC;EACA,OAAOD,MAAM;AACf;AACA,OAAOI,SAAS,MAAM,gBAAgB;AACtC,SAASC,iBAAiB,QAAqB,oBAAoB;AAEnE,SAASC,YAAY,QAAQ,6DAA6D;AAS1F,SAASC,SAAS,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,gBAAgB;AAQxE,OAAO,MAAMC,kBAAkB,SAASJ,SAAS,CAAC;EACtCK,eAAeA,CAACC,KAAY,EAAmC;IACvE,MAAMC,SAAS,GAAG,IAAI,CAACC,QAAQ,CAACC,SAAS,CAACP,OAAO,CAAC;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UAAU;EACnB,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"InterfaceListQuery.js","names":["groupBy","arr","fn","result","item","key","push","invariant","additionalContext","ObjectDefRef","ListQuery","PIVOT_IDX","RDP_IDX","RIDS_IDX","InterfaceListQuery","createObjectSet","store","rdpConfig","cacheKey","otherKeys","pivotInfo","rids","sourceSet","createSourceSetForPivot","objectSet","where","canonicalWhere","pivotTo","linkName","withProperties","objectTypeDef","type","apiName","clientCtx","client","objectSetFactory","objects","revalidateObjectType","objectType","objectMetadata","fetchMetadata","interfaceMap","postProcessFetchedData","data","reloadDataAsFullObjects","wrapObject","object","options","resolveToObjectType","$as","createPayload","params","resolvedList","resolvedData","map","obj","extractRelevantObjects","changes","matchesApiName","added","Array","from","addedObjects","filter","modified","modifiedObjects","all","strictMatches","Set","sortaMatches","sourceType","sourceTypeKind","length","groups","x","$objectType","objectTypeToPrimaryKeyToObject","Object","fromEntries","Promise","entries","objectDef","primaryKeyApiName","$in","$primaryKey","fetchPage","$includeRid","fullObject","process","env","NODE_ENV"],"sources":["InterfaceListQuery.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 DerivedProperty,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n WhereClause,\n} from \"@osdk/api\";\nfunction groupBy<T>(\n arr: T[],\n fn: (item: T) => string,\n): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n for (const item of arr) {\n const key = fn(item);\n (result[key] ??= []).push(item);\n }\n return result;\n}\nimport invariant from \"tiny-invariant\";\nimport { additionalContext, type Client } from \"../../../Client.js\";\nimport type { InterfaceHolder } from \"../../../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport { ObjectDefRef } from \"../../../object/convertWireToOsdkObjects/InternalSymbols.js\";\nimport type { ObjectHolder } from \"../../../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ListPayload } from \"../../ListPayload.js\";\nimport type { CollectionConnectableParams } from \"../base-list/BaseCollectionQuery.js\";\nimport type { Changes } from \"../Changes.js\";\nimport type { PivotInfo } from \"../PivotCanonicalizer.js\";\nimport type { Rdp } from \"../RdpCanonicalizer.js\";\nimport type { SimpleWhereClause } from \"../SimpleWhereClause.js\";\nimport type { Store } from \"../Store.js\";\nimport { ListQuery, PIVOT_IDX, RDP_IDX, RIDS_IDX } from \"./ListQuery.js\";\n\ntype ExtractRelevantObjectsResult = Record<\"added\" | \"modified\", {\n all: (ObjectHolder | InterfaceHolder)[];\n strictMatches: Set<(ObjectHolder | InterfaceHolder)>;\n sortaMatches: Set<(ObjectHolder | InterfaceHolder)>;\n}>;\n\nexport class InterfaceListQuery extends ListQuery {\n protected createObjectSet(store: Store): ObjectSet<ObjectTypeDefinition> {\n const rdpConfig = this.cacheKey.otherKeys[RDP_IDX];\n const pivotInfo = this.cacheKey.otherKeys[PIVOT_IDX];\n const rids = this.cacheKey.otherKeys[RIDS_IDX];\n\n if (pivotInfo != null) {\n const sourceSet = createSourceSetForPivot(store, pivotInfo, rids);\n\n let objectSet = sourceSet\n .where(this.canonicalWhere as WhereClause<any>)\n .pivotTo(pivotInfo.linkName);\n\n if (rdpConfig != null) {\n objectSet = objectSet.withProperties(\n rdpConfig as DerivedProperty.Clause<ObjectTypeDefinition>,\n );\n }\n\n // intersectWith for pivot queries is deferred to fetchPageData\n // where the target type can be resolved asynchronously\n return objectSet;\n }\n\n const type: string = \"interface\" as const;\n const objectTypeDef = {\n type,\n apiName: this.apiName,\n } as ObjectTypeDefinition;\n\n const clientCtx = store.client[additionalContext];\n let objectSet: ObjectSet<ObjectTypeDefinition>;\n if (rids != null) {\n objectSet = clientCtx.objectSetFactory(\n objectTypeDef,\n clientCtx,\n { type: \"static\", objects: [...rids] },\n );\n } else {\n objectSet = store.client(objectTypeDef);\n }\n\n if (rdpConfig != null) {\n objectSet = objectSet.withProperties(rdpConfig as Rdp);\n }\n\n return objectSet.where(this.canonicalWhere);\n }\n\n async revalidateObjectType(objectType: string): Promise<boolean> {\n if (await super.revalidateObjectType(objectType)) return true;\n\n // For interface queries: also check if the invalidated concrete type\n // implements this query's interface. e.g. invalidating \"Employee\"\n // should revalidate a query for \"Assignable\" if Employee implements it.\n try {\n const objectMetadata = await this.store.client.fetchMetadata({\n type: \"object\",\n apiName: objectType,\n });\n return this.apiName in objectMetadata.interfaceMap;\n } catch {\n return true;\n }\n }\n\n protected async postProcessFetchedData(\n data: Osdk.Instance<any>[],\n ): Promise<Osdk.Instance<any>[]> {\n return reloadDataAsFullObjects(this.store.client, data);\n }\n\n private wrapObject(object: ObjectHolder): ObjectHolder | InterfaceHolder {\n return this.options.resolveToObjectType ? object : object.$as(this.apiName);\n }\n\n protected createPayload(\n params: CollectionConnectableParams,\n ): ListPayload {\n const resolvedList = params.resolvedData?.map((obj: ObjectHolder) =>\n this.wrapObject(obj)\n );\n\n return {\n ...super.createPayload(params),\n resolvedList,\n };\n }\n\n protected extractRelevantObjects(\n changes: Changes,\n ): ExtractRelevantObjectsResult {\n const matchesApiName = ([, object]: [unknown, ObjectHolder]) => {\n return this.apiName in object[ObjectDefRef].interfaceMap;\n };\n\n const added = Array.from(changes.addedObjects).filter(matchesApiName).map((\n [, object],\n ) => this.wrapObject(object));\n\n const modified = Array.from(changes.modifiedObjects).filter(matchesApiName)\n .map((\n [, object],\n ) => this.wrapObject(object));\n\n return {\n added: {\n all: added,\n strictMatches: new Set(),\n sortaMatches: new Set(),\n },\n modified: {\n all: modified,\n strictMatches: new Set(),\n sortaMatches: new Set(),\n },\n };\n }\n}\n\nfunction createSourceSetForPivot(\n store: Store,\n pivotInfo: PivotInfo,\n rids: string[] | undefined,\n): ObjectSet<ObjectOrInterfaceDefinition> {\n const clientCtx = store.client[additionalContext];\n\n if (rids != null) {\n return clientCtx.objectSetFactory(\n {\n type: \"object\",\n apiName: pivotInfo.sourceType,\n } as ObjectTypeDefinition,\n clientCtx,\n { type: \"static\", objects: [...rids] },\n );\n }\n\n if (pivotInfo.sourceTypeKind === \"interface\") {\n return store.client({\n type: \"interface\",\n apiName: pivotInfo.sourceType,\n } as InterfaceDefinition) as ObjectSet<ObjectOrInterfaceDefinition>;\n }\n\n return store.client({\n type: \"object\",\n apiName: pivotInfo.sourceType,\n } as ObjectTypeDefinition) as ObjectSet<ObjectOrInterfaceDefinition>;\n}\n\n// Hopefully this can go away when we can just request the full object properties on first load\nasync function reloadDataAsFullObjects(\n client: Client,\n data: Osdk.Instance<any>[],\n) {\n if (data.length === 0) {\n return data;\n }\n\n const groups = groupBy(data, (x) => x.$objectType);\n const objectTypeToPrimaryKeyToObject = Object.fromEntries(\n await Promise.all(\n Object.entries(groups).map<\n Promise<\n [\n /** objectType **/ string,\n Record<string | number, Osdk.Instance<ObjectTypeDefinition>>,\n ]\n >\n >(async ([apiName, objects]) => {\n // Interface query results don't have ObjectDefRef, so we fetch metadata to get primaryKeyApiName\n const objectDef = await client.fetchMetadata({\n type: \"object\",\n apiName,\n });\n const where: SimpleWhereClause = {\n [objectDef.primaryKeyApiName]: {\n $in: objects.map(x => x.$primaryKey),\n },\n };\n\n const result = await client(\n objectDef as ObjectTypeDefinition,\n ).where(\n where as Parameters<ObjectSet<ObjectTypeDefinition>[\"where\"]>[0],\n ).fetchPage({ $includeRid: true });\n return [\n apiName,\n Object.fromEntries(result.data.map(\n x => [x.$primaryKey, x],\n )),\n ];\n }),\n ),\n );\n\n return data.map((obj) => {\n const fullObject =\n objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey];\n invariant(\n fullObject,\n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CAAC;MAC3CT,IAAI,EAAE,QAAQ;MACdC;IACF,CAAC,CAAC;IACF,MAAMP,KAAwB,GAAG;MAC/B,CAACwD,SAAS,CAACC,iBAAiB,GAAG;QAC7BC,GAAG,EAAE/C,OAAO,CAACkB,GAAG,CAACoB,CAAC,IAAIA,CAAC,CAACU,WAAW;MACrC;IACF,CAAC;IAED,MAAMjF,MAAM,GAAG,MAAM+B,MAAM,CACzB+C,SACF,CAAC,CAACxD,KAAK,CACLA,KACF,CAAC,CAAC4D,SAAS,CAAC;MAAEC,WAAW,EAAE;IAAK,CAAC,CAAC;IAClC,OAAO,CACLtD,OAAO,EACP6C,MAAM,CAACC,WAAW,CAAC3E,MAAM,CAACwC,IAAI,CAACW,GAAG,CAChCoB,CAAC,IAAI,CAACA,CAAC,CAACU,WAAW,EAAEV,CAAC,CACxB,CAAC,CAAC,CACH;EACH,CAAC,CACH,CACF,CAAC;EAED,OAAO/B,IAAI,CAACW,GAAG,CAAEC,GAAG,IAAK;IACvB,MAAMgC,UAAU,GACdX,8BAA8B,CAACrB,GAAG,CAACoB,WAAW,CAAC,CAACpB,GAAG,CAAC6B,WAAW,CAAC;IAClE,CACEG,UAAU,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADZnF,SAAS,QAEP,yBAAyBgD,GAAG,CAACoB,WAAW,IAAIpB,GAAG,CAAC6B,WAAW,EAAE,IAF/D7E,SAAS;IAIT,OAAOgF,UAAU;EACnB,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -26,4 +26,5 @@ export const RIDS_IDX = 7;
26
26
  export const SELECT_IDX = 8;
27
27
  export const LOAD_PROPERTY_SECURITY_IDX = 9;
28
28
  export const INCLUDE_ALL_BASE_PROPERTIES_IDX = 10;
29
+ export const RESOLVE_TO_OBJECT_TYPE_IDX = 11;
29
30
  //# sourceMappingURL=ListCacheKey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListCacheKey.js","names":["TYPE_IDX","API_NAME_IDX","WHERE_IDX","ORDER_BY_IDX","RDP_IDX","INTERSECT_IDX","PIVOT_IDX","RIDS_IDX","SELECT_IDX","LOAD_PROPERTY_SECURITY_IDX","INCLUDE_ALL_BASE_PROPERTIES_IDX"],"sources":["ListCacheKey.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 type { CollectionStorageData } from \"../base-list/BaseCollectionQuery.js\";\nimport type { CacheKey } from \"../CacheKey.js\";\nimport type { Canonical } from \"../Canonical.js\";\nimport type { PivotInfo } from \"../PivotCanonicalizer.js\";\nimport type { Rdp } from \"../RdpCanonicalizer.js\";\nimport type { SimpleWhereClause } from \"../SimpleWhereClause.js\";\nimport type { ListQuery } from \"./ListQuery.js\";\n\n// Index constants for accessing otherKeys array elements\nexport const TYPE_IDX = 0;\nexport const API_NAME_IDX = 1;\nexport const WHERE_IDX = 2;\nexport const ORDER_BY_IDX = 3;\nexport const RDP_IDX = 4;\nexport const INTERSECT_IDX = 5;\nexport const PIVOT_IDX = 6;\nexport const RIDS_IDX = 7;\nexport const SELECT_IDX = 8;\nexport const LOAD_PROPERTY_SECURITY_IDX = 9;\nexport const INCLUDE_ALL_BASE_PROPERTIES_IDX = 10;\n\nexport interface ListStorageData extends CollectionStorageData {}\n\nexport interface ListCacheKey extends\n CacheKey<\n \"list\",\n ListStorageData,\n ListQuery,\n [\n type: \"object\" | \"interface\",\n apiName: string,\n whereClause: Canonical<SimpleWhereClause>,\n orderByClause: Canonical<Record<string, \"asc\" | \"desc\" | undefined>>,\n rdpConfig?: Canonical<Rdp> | undefined,\n intersectWith?:\n | Canonical<Array<Canonical<SimpleWhereClause>>>\n | undefined,\n pivotInfo?: Canonical<PivotInfo> | undefined,\n rids?: Canonical<string[]> | undefined,\n select?: Canonical<readonly string[]> | undefined,\n loadPropertySecurity?: true | undefined,\n includeAllBaseObjectProperties?: true | undefined,\n ]\n >\n{\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA,OAAO,MAAMA,QAAQ,GAAG,CAAC;AACzB,OAAO,MAAMC,YAAY,GAAG,CAAC;AAC7B,OAAO,MAAMC,SAAS,GAAG,CAAC;AAC1B,OAAO,MAAMC,YAAY,GAAG,CAAC;AAC7B,OAAO,MAAMC,OAAO,GAAG,CAAC;AACxB,OAAO,MAAMC,aAAa,GAAG,CAAC;AAC9B,OAAO,MAAMC,SAAS,GAAG,CAAC;AAC1B,OAAO,MAAMC,QAAQ,GAAG,CAAC;AACzB,OAAO,MAAMC,UAAU,GAAG,CAAC;AAC3B,OAAO,MAAMC,0BAA0B,GAAG,CAAC;AAC3C,OAAO,MAAMC,+BAA+B,GAAG,EAAE","ignoreList":[]}
1
+ {"version":3,"file":"ListCacheKey.js","names":["TYPE_IDX","API_NAME_IDX","WHERE_IDX","ORDER_BY_IDX","RDP_IDX","INTERSECT_IDX","PIVOT_IDX","RIDS_IDX","SELECT_IDX","LOAD_PROPERTY_SECURITY_IDX","INCLUDE_ALL_BASE_PROPERTIES_IDX","RESOLVE_TO_OBJECT_TYPE_IDX"],"sources":["ListCacheKey.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 type { CollectionStorageData } from \"../base-list/BaseCollectionQuery.js\";\nimport type { CacheKey } from \"../CacheKey.js\";\nimport type { Canonical } from \"../Canonical.js\";\nimport type { PivotInfo } from \"../PivotCanonicalizer.js\";\nimport type { Rdp } from \"../RdpCanonicalizer.js\";\nimport type { SimpleWhereClause } from \"../SimpleWhereClause.js\";\nimport type { ListQuery } from \"./ListQuery.js\";\n\n// Index constants for accessing otherKeys array elements\nexport const TYPE_IDX = 0;\nexport const API_NAME_IDX = 1;\nexport const WHERE_IDX = 2;\nexport const ORDER_BY_IDX = 3;\nexport const RDP_IDX = 4;\nexport const INTERSECT_IDX = 5;\nexport const PIVOT_IDX = 6;\nexport const RIDS_IDX = 7;\nexport const SELECT_IDX = 8;\nexport const LOAD_PROPERTY_SECURITY_IDX = 9;\nexport const INCLUDE_ALL_BASE_PROPERTIES_IDX = 10;\nexport const RESOLVE_TO_OBJECT_TYPE_IDX = 11;\n\nexport interface ListStorageData extends CollectionStorageData {}\n\nexport interface ListCacheKey extends\n CacheKey<\n \"list\",\n ListStorageData,\n ListQuery,\n [\n type: \"object\" | \"interface\",\n apiName: string,\n whereClause: Canonical<SimpleWhereClause>,\n orderByClause: Canonical<Record<string, \"asc\" | \"desc\" | undefined>>,\n rdpConfig?: Canonical<Rdp> | undefined,\n intersectWith?:\n | Canonical<Array<Canonical<SimpleWhereClause>>>\n | undefined,\n pivotInfo?: Canonical<PivotInfo> | undefined,\n rids?: Canonical<string[]> | undefined,\n select?: Canonical<readonly string[]> | undefined,\n loadPropertySecurity?: true | undefined,\n includeAllBaseObjectProperties?: true | undefined,\n resolveToObjectType?: true | undefined,\n ]\n >\n{\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA,OAAO,MAAMA,QAAQ,GAAG,CAAC;AACzB,OAAO,MAAMC,YAAY,GAAG,CAAC;AAC7B,OAAO,MAAMC,SAAS,GAAG,CAAC;AAC1B,OAAO,MAAMC,YAAY,GAAG,CAAC;AAC7B,OAAO,MAAMC,OAAO,GAAG,CAAC;AACxB,OAAO,MAAMC,aAAa,GAAG,CAAC;AAC9B,OAAO,MAAMC,SAAS,GAAG,CAAC;AAC1B,OAAO,MAAMC,QAAQ,GAAG,CAAC;AACzB,OAAO,MAAMC,UAAU,GAAG,CAAC;AAC3B,OAAO,MAAMC,0BAA0B,GAAG,CAAC;AAC3C,OAAO,MAAMC,+BAA+B,GAAG,EAAE;AACjD,OAAO,MAAMC,0BAA0B,GAAG,EAAE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ListQueryOptions.js","names":[],"sources":["ListQueryOptions.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 ObjectOrInterfaceDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { CommonObserveOptions } from \"../../ObservableClient/common.js\";\n\nexport interface ListQueryOptions<\n Q extends ObjectOrInterfaceDefinition = ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n SimplePropertyDef\n >,\n> extends CommonObserveOptions {\n pageSize?: number;\n select?: readonly string[];\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n $loadPropertySecurityMetadata?: boolean;\n $includeAllBaseObjectProperties?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ListQueryOptions.js","names":[],"sources":["ListQueryOptions.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 ObjectOrInterfaceDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { CommonObserveOptions } from \"../../ObservableClient/common.js\";\n\nexport interface ListQueryOptions<\n Q extends ObjectOrInterfaceDefinition = ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n SimplePropertyDef\n >,\n> extends CommonObserveOptions {\n pageSize?: number;\n select?: readonly string[];\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n $loadPropertySecurityMetadata?: boolean;\n $includeAllBaseObjectProperties?: boolean;\n resolveToObjectType?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -57,7 +57,8 @@ export class ListsHelper extends AbstractHelper {
57
57
  pivotTo,
58
58
  rids,
59
59
  select,
60
- $loadPropertySecurityMetadata
60
+ $loadPropertySecurityMetadata,
61
+ resolveToObjectType
61
62
  } = options;
62
63
  const {
63
64
  apiName,
@@ -66,6 +67,7 @@ export class ListsHelper extends AbstractHelper {
66
67
  // The flag is interface-only on the server. Drop it for object queries so
67
68
  // they don't fragment the cache.
68
69
  const $includeAllBaseObjectProperties = type === "interface" && options.$includeAllBaseObjectProperties ? true : undefined;
70
+ const canonResolveToObjectType = type === "interface" && resolveToObjectType ? true : undefined;
69
71
  const canonWhere = this.whereCanonicalizer.canonicalize(where ?? {});
70
72
  const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy ?? {});
71
73
  const canonRdp = withProperties ? this.rdpCanonicalizer.canonicalize(withProperties) : undefined;
@@ -73,7 +75,7 @@ export class ListsHelper extends AbstractHelper {
73
75
  const canonPivot = pivotTo ? this.pivotCanonicalizer.canonicalize(apiName, type, pivotTo) : undefined;
74
76
  const canonRids = rids != null ? this.ridListCanonicalizer.canonicalize(rids) : undefined;
75
77
  const canonSelect = select && select.length > 0 ? this.selectCanonicalizer.canonicalize(select) : undefined;
76
- const listCacheKey = this.cacheKeys.get("list", type, apiName, canonWhere, canonOrderBy, canonRdp, canonIntersect, canonPivot, canonRids, canonSelect, $loadPropertySecurityMetadata ? true : undefined, $includeAllBaseObjectProperties);
78
+ const listCacheKey = this.cacheKeys.get("list", type, apiName, canonWhere, canonOrderBy, canonRdp, canonIntersect, canonPivot, canonRids, canonSelect, $loadPropertySecurityMetadata ? true : undefined, $includeAllBaseObjectProperties, canonResolveToObjectType);
77
79
  return this.store.queries.get(listCacheKey, () => {
78
80
  const QueryClass = type === "object" ? ObjectListQuery : InterfaceListQuery;
79
81
  return new QueryClass(this.store, this.store.subjects.get(listCacheKey), apiName, listCacheKey, options);
@@ -1 +1 @@
1
- {"version":3,"file":"ListsHelper.js","names":["AbstractHelper","InterfaceListQuery","ObjectListQuery","ListsHelper","constructor","store","cacheKeys","whereCanonicalizer","orderByCanonicalizer","rdpCanonicalizer","intersectCanonicalizer","pivotCanonicalizer","ridListCanonicalizer","selectCanonicalizer","observe","options","subFn","ret","streamUpdates","pivotTo","process","env","NODE_ENV","console","warn","withProperties","query","registerStreamUpdates","subscription","getQuery","type","typeDefinition","where","orderBy","intersectWith","rids","select","$loadPropertySecurityMetadata","apiName","$includeAllBaseObjectProperties","undefined","canonWhere","canonicalize","canonOrderBy","canonRdp","canonIntersect","length","canonPivot","canonRids","canonSelect","listCacheKey","get","queries","QueryClass","subjects"],"sources":["ListsHelper.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 { ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type { ListPayload } from \"../../ListPayload.js\";\nimport type { ObserveListOptions } from \"../../ObservableClient.js\";\nimport type { Observer } from \"../../ObservableClient/common.js\";\nimport { AbstractHelper } from \"../AbstractHelper.js\";\nimport type { CacheKeys } from \"../CacheKeys.js\";\nimport type { IntersectCanonicalizer } from \"../IntersectCanonicalizer.js\";\nimport type { KnownCacheKey } from \"../KnownCacheKey.js\";\nimport type { OrderByCanonicalizer } from \"../OrderByCanonicalizer.js\";\nimport type { PivotCanonicalizer } from \"../PivotCanonicalizer.js\";\nimport type { QuerySubscription } from \"../QuerySubscription.js\";\nimport type { RdpCanonicalizer } from \"../RdpCanonicalizer.js\";\nimport type { RidListCanonicalizer } from \"../RidListCanonicalizer.js\";\nimport type { SelectCanonicalizer } from \"../SelectCanonicalizer.js\";\nimport type { Store } from \"../Store.js\";\nimport type { WhereClauseCanonicalizer } from \"../WhereClauseCanonicalizer.js\";\nimport { InterfaceListQuery } from \"./InterfaceListQuery.js\";\nimport type { ListCacheKey } from \"./ListCacheKey.js\";\nimport type { ListQuery } from \"./ListQuery.js\";\nimport { ObjectListQuery } from \"./ObjectListQuery.js\";\n\nexport class ListsHelper extends AbstractHelper<\n ListQuery,\n ObserveListOptions<ObjectOrInterfaceDefinition, {}>\n> {\n whereCanonicalizer: WhereClauseCanonicalizer;\n orderByCanonicalizer: OrderByCanonicalizer;\n rdpCanonicalizer: RdpCanonicalizer;\n intersectCanonicalizer: IntersectCanonicalizer;\n pivotCanonicalizer: PivotCanonicalizer;\n ridListCanonicalizer: RidListCanonicalizer;\n selectCanonicalizer: SelectCanonicalizer;\n\n constructor(\n store: Store,\n cacheKeys: CacheKeys<KnownCacheKey>,\n whereCanonicalizer: WhereClauseCanonicalizer,\n orderByCanonicalizer: OrderByCanonicalizer,\n rdpCanonicalizer: RdpCanonicalizer,\n intersectCanonicalizer: IntersectCanonicalizer,\n pivotCanonicalizer: PivotCanonicalizer,\n ridListCanonicalizer: RidListCanonicalizer,\n selectCanonicalizer: SelectCanonicalizer,\n ) {\n super(store, cacheKeys);\n\n this.whereCanonicalizer = whereCanonicalizer;\n this.orderByCanonicalizer = orderByCanonicalizer;\n this.rdpCanonicalizer = rdpCanonicalizer;\n this.intersectCanonicalizer = intersectCanonicalizer;\n this.pivotCanonicalizer = pivotCanonicalizer;\n this.ridListCanonicalizer = ridListCanonicalizer;\n this.selectCanonicalizer = selectCanonicalizer;\n }\n\n observe<T extends ObjectOrInterfaceDefinition>(\n options: ObserveListOptions<T, {}>,\n subFn: Observer<ListPayload>,\n ): QuerySubscription<ListQuery> {\n const ret = super.observe(options, subFn);\n\n if (options.streamUpdates) {\n if (options.pivotTo) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@osdk/client] streamUpdates is not supported with pivotTo. \"\n + \"The server does not support websocket subscriptions for \"\n + \"link-traversal queries. Ignoring streamUpdates.\",\n );\n }\n } else if (options.withProperties) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@osdk/client] streamUpdates is not supported with withProperties. \"\n + \"The server does not support websocket subscriptions for \"\n + \"object sets that include derived properties. Ignoring streamUpdates.\",\n );\n }\n } else {\n ret.query.registerStreamUpdates(ret.subscription);\n }\n }\n return ret;\n }\n\n getQuery<T extends ObjectOrInterfaceDefinition>(\n options: ObserveListOptions<T, {}>,\n ): ListQuery {\n const {\n type: typeDefinition,\n where,\n orderBy,\n withProperties,\n intersectWith,\n pivotTo,\n rids,\n select,\n $loadPropertySecurityMetadata,\n } = options;\n const { apiName, type } = typeDefinition;\n // The flag is interface-only on the server. Drop it for object queries so\n // they don't fragment the cache.\n const $includeAllBaseObjectProperties =\n type === \"interface\" && options.$includeAllBaseObjectProperties\n ? true\n : undefined;\n\n const canonWhere = this.whereCanonicalizer.canonicalize(where ?? {});\n const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy ?? {});\n const canonRdp = withProperties\n ? this.rdpCanonicalizer.canonicalize(withProperties)\n : undefined;\n\n const canonIntersect = intersectWith && intersectWith.length > 0\n ? this.intersectCanonicalizer.canonicalize(intersectWith)\n : undefined;\n\n const canonPivot = pivotTo\n ? this.pivotCanonicalizer.canonicalize(apiName, type, pivotTo)\n : undefined;\n\n const canonRids = rids != null\n ? this.ridListCanonicalizer.canonicalize(rids)\n : undefined;\n\n const canonSelect = select && select.length > 0\n ? this.selectCanonicalizer.canonicalize(select)\n : undefined;\n\n const listCacheKey = this.cacheKeys.get<ListCacheKey>(\n \"list\",\n type,\n apiName,\n canonWhere,\n canonOrderBy,\n canonRdp,\n canonIntersect,\n canonPivot,\n canonRids,\n canonSelect,\n $loadPropertySecurityMetadata ? true : undefined,\n $includeAllBaseObjectProperties,\n );\n\n return this.store.queries.get(listCacheKey, () => {\n const QueryClass = type === \"object\"\n ? ObjectListQuery\n : InterfaceListQuery;\n return new QueryClass(\n this.store,\n this.store.subjects.get(listCacheKey),\n apiName,\n listCacheKey,\n options,\n );\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,cAAc,QAAQ,sBAAsB;AAYrD,SAASC,kBAAkB,QAAQ,yBAAyB;AAG5D,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,OAAO,MAAMC,WAAW,SAASH,cAAc,CAG7C;EASAI,WAAWA,CACTC,KAAY,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ACZC,QAAQ,EACRC,cAAc,EACdE,UAAU,EACVC,SAAS,EACTC,WAAW,EACXZ,6BAA6B,GAAG,IAAI,GAAGG,SAAS,EAChDD,+BACF,CAAC;IAED,OAAO,IAAI,CAAClC,KAAK,CAAC+C,OAAO,CAACD,GAAG,CAACD,YAAY,EAAE,MAAM;MAChD,MAAMG,UAAU,GAAGvB,IAAI,KAAK,QAAQ,GAChC5B,eAAe,GACfD,kBAAkB;MACtB,OAAO,IAAIoD,UAAU,CACnB,IAAI,CAAChD,KAAK,EACV,IAAI,CAACA,KAAK,CAACiD,QAAQ,CAACH,GAAG,CAACD,YAAY,CAAC,EACrCZ,OAAO,EACPY,YAAY,EACZnC,OACF,CAAC;IACH,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ListsHelper.js","names":["AbstractHelper","InterfaceListQuery","ObjectListQuery","ListsHelper","constructor","store","cacheKeys","whereCanonicalizer","orderByCanonicalizer","rdpCanonicalizer","intersectCanonicalizer","pivotCanonicalizer","ridListCanonicalizer","selectCanonicalizer","observe","options","subFn","ret","streamUpdates","pivotTo","process","env","NODE_ENV","console","warn","withProperties","query","registerStreamUpdates","subscription","getQuery","type","typeDefinition","where","orderBy","intersectWith","rids","select","$loadPropertySecurityMetadata","resolveToObjectType","apiName","$includeAllBaseObjectProperties","undefined","canonResolveToObjectType","canonWhere","canonicalize","canonOrderBy","canonRdp","canonIntersect","length","canonPivot","canonRids","canonSelect","listCacheKey","get","queries","QueryClass","subjects"],"sources":["ListsHelper.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 { ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type { ListPayload } from \"../../ListPayload.js\";\nimport type { ObserveListOptions } from \"../../ObservableClient.js\";\nimport type { Observer } from \"../../ObservableClient/common.js\";\nimport { AbstractHelper } from \"../AbstractHelper.js\";\nimport type { CacheKeys } from \"../CacheKeys.js\";\nimport type { IntersectCanonicalizer } from \"../IntersectCanonicalizer.js\";\nimport type { KnownCacheKey } from \"../KnownCacheKey.js\";\nimport type { OrderByCanonicalizer } from \"../OrderByCanonicalizer.js\";\nimport type { PivotCanonicalizer } from \"../PivotCanonicalizer.js\";\nimport type { QuerySubscription } from \"../QuerySubscription.js\";\nimport type { RdpCanonicalizer } from \"../RdpCanonicalizer.js\";\nimport type { RidListCanonicalizer } from \"../RidListCanonicalizer.js\";\nimport type { SelectCanonicalizer } from \"../SelectCanonicalizer.js\";\nimport type { Store } from \"../Store.js\";\nimport type { WhereClauseCanonicalizer } from \"../WhereClauseCanonicalizer.js\";\nimport { InterfaceListQuery } from \"./InterfaceListQuery.js\";\nimport type { ListCacheKey } from \"./ListCacheKey.js\";\nimport type { ListQuery } from \"./ListQuery.js\";\nimport { ObjectListQuery } from \"./ObjectListQuery.js\";\n\nexport class ListsHelper extends AbstractHelper<\n ListQuery,\n ObserveListOptions<ObjectOrInterfaceDefinition, {}>\n> {\n whereCanonicalizer: WhereClauseCanonicalizer;\n orderByCanonicalizer: OrderByCanonicalizer;\n rdpCanonicalizer: RdpCanonicalizer;\n intersectCanonicalizer: IntersectCanonicalizer;\n pivotCanonicalizer: PivotCanonicalizer;\n ridListCanonicalizer: RidListCanonicalizer;\n selectCanonicalizer: SelectCanonicalizer;\n\n constructor(\n store: Store,\n cacheKeys: CacheKeys<KnownCacheKey>,\n whereCanonicalizer: WhereClauseCanonicalizer,\n orderByCanonicalizer: OrderByCanonicalizer,\n rdpCanonicalizer: RdpCanonicalizer,\n intersectCanonicalizer: IntersectCanonicalizer,\n pivotCanonicalizer: PivotCanonicalizer,\n ridListCanonicalizer: RidListCanonicalizer,\n selectCanonicalizer: SelectCanonicalizer,\n ) {\n super(store, cacheKeys);\n\n this.whereCanonicalizer = whereCanonicalizer;\n this.orderByCanonicalizer = orderByCanonicalizer;\n this.rdpCanonicalizer = rdpCanonicalizer;\n this.intersectCanonicalizer = intersectCanonicalizer;\n this.pivotCanonicalizer = pivotCanonicalizer;\n this.ridListCanonicalizer = ridListCanonicalizer;\n this.selectCanonicalizer = selectCanonicalizer;\n }\n\n observe<T extends ObjectOrInterfaceDefinition>(\n options: ObserveListOptions<T, {}>,\n subFn: Observer<ListPayload>,\n ): QuerySubscription<ListQuery> {\n const ret = super.observe(options, subFn);\n\n if (options.streamUpdates) {\n if (options.pivotTo) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@osdk/client] streamUpdates is not supported with pivotTo. \"\n + \"The server does not support websocket subscriptions for \"\n + \"link-traversal queries. Ignoring streamUpdates.\",\n );\n }\n } else if (options.withProperties) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@osdk/client] streamUpdates is not supported with withProperties. \"\n + \"The server does not support websocket subscriptions for \"\n + \"object sets that include derived properties. Ignoring streamUpdates.\",\n );\n }\n } else {\n ret.query.registerStreamUpdates(ret.subscription);\n }\n }\n return ret;\n }\n\n getQuery<T extends ObjectOrInterfaceDefinition>(\n options: ObserveListOptions<T, {}>,\n ): ListQuery {\n const {\n type: typeDefinition,\n where,\n orderBy,\n withProperties,\n intersectWith,\n pivotTo,\n rids,\n select,\n $loadPropertySecurityMetadata,\n resolveToObjectType,\n } = options;\n const { apiName, type } = typeDefinition;\n // The flag is interface-only on the server. Drop it for object queries so\n // they don't fragment the cache.\n const $includeAllBaseObjectProperties =\n type === \"interface\" && options.$includeAllBaseObjectProperties\n ? true\n : undefined;\n const canonResolveToObjectType = type === \"interface\" && resolveToObjectType\n ? true\n : undefined;\n\n const canonWhere = this.whereCanonicalizer.canonicalize(where ?? {});\n const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy ?? {});\n const canonRdp = withProperties\n ? this.rdpCanonicalizer.canonicalize(withProperties)\n : undefined;\n\n const canonIntersect = intersectWith && intersectWith.length > 0\n ? this.intersectCanonicalizer.canonicalize(intersectWith)\n : undefined;\n\n const canonPivot = pivotTo\n ? this.pivotCanonicalizer.canonicalize(apiName, type, pivotTo)\n : undefined;\n\n const canonRids = rids != null\n ? this.ridListCanonicalizer.canonicalize(rids)\n : undefined;\n\n const canonSelect = select && select.length > 0\n ? this.selectCanonicalizer.canonicalize(select)\n : undefined;\n\n const listCacheKey = this.cacheKeys.get<ListCacheKey>(\n \"list\",\n type,\n apiName,\n canonWhere,\n canonOrderBy,\n canonRdp,\n canonIntersect,\n canonPivot,\n canonRids,\n canonSelect,\n $loadPropertySecurityMetadata ? true : undefined,\n $includeAllBaseObjectProperties,\n canonResolveToObjectType,\n );\n\n return this.store.queries.get(listCacheKey, () => {\n const QueryClass = type === \"object\"\n ? ObjectListQuery\n : InterfaceListQuery;\n return new QueryClass(\n this.store,\n this.store.subjects.get(listCacheKey),\n apiName,\n listCacheKey,\n options,\n );\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,cAAc,QAAQ,sBAAsB;AAYrD,SAASC,kBAAkB,QAAQ,yBAAyB;AAG5D,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,OAAO,MAAMC,WAAW,SAASH,cAAc,CAG7C;EASAI,WAAWA,CACTC,KAAY,EACZC,SAAmC,EACnCC,kBAA4C,EAC5CC,oBAA0C,EAC1CC,gBAAkC,EAClCC,sBAA8C,EAC9CC,kBAAsC,EACtCC,oBAA0C,EAC1CC,mBAAwC,EACxC;IACA,KAAK,CAACR,KAAK,EAAEC,SAAS,CAAC;IAEvB,IAAI,CAACC,kBAAk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AChDD,+BAA+B,EAC/BE,wBACF,CAAC;IAED,OAAO,IAAI,CAACrC,KAAK,CAACiD,OAAO,CAACD,GAAG,CAACD,YAAY,EAAE,MAAM;MAChD,MAAMG,UAAU,GAAGzB,IAAI,KAAK,QAAQ,GAChC5B,eAAe,GACfD,kBAAkB;MACtB,OAAO,IAAIsD,UAAU,CACnB,IAAI,CAAClD,KAAK,EACV,IAAI,CAACA,KAAK,CAACmD,QAAQ,CAACH,GAAG,CAACD,YAAY,CAAC,EACrCb,OAAO,EACPa,YAAY,EACZrC,OACF,CAAC;IACH,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -14,6 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export const USER_AGENT = `osdk-client/${"2.27.0"}`;
18
- export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.27.0"}`;
17
+ export const USER_AGENT = `osdk-client/${"2.28.0-main-a5066b5822179d54731c738017fc477dbfee32b4"}`;
18
+ export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.28.0-main-a5066b5822179d54731c738017fc477dbfee32b4"}`;
19
19
  //# sourceMappingURL=UserAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string =\n `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,yBAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GACxC,oCAAuD","ignoreList":[]}
1
+ {"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string =\n `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,uEAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GACxC,kFAAuD","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkYRGYLMU5_cjs = require('./chunk-YRGYLMU5.cjs');
4
- var chunkYLVUONG3_cjs = require('./chunk-YLVUONG3.cjs');
3
+ var chunkQJ7NT4K4_cjs = require('./chunk-QJ7NT4K4.cjs');
4
+ var chunkI3OTWRGM_cjs = require('./chunk-I3OTWRGM.cjs');
5
5
  require('./chunk-HRWHTCP3.cjs');
6
6
  var chunkH6PXPU6F_cjs = require('./chunk-H6PXPU6F.cjs');
7
7
  require('./chunk-74HV6NQQ.cjs');
@@ -18,11 +18,11 @@ async function* applyStreamingQuery(client, query, params) {
18
18
  if (client.flushEdits != null) {
19
19
  await client.flushEdits();
20
20
  }
21
- const response = await streamingExecute(chunkYLVUONG3_cjs.addUserAgentAndRequestContextHeaders(chunkYLVUONG3_cjs.augmentRequestContext(client, (_) => ({
21
+ const response = await streamingExecute(chunkI3OTWRGM_cjs.addUserAgentAndRequestContextHeaders(chunkI3OTWRGM_cjs.augmentRequestContext(client, (_) => ({
22
22
  finalMethodCall: "applyStreamingQuery"
23
23
  })), query), query.apiName, {
24
24
  ontology: await client.ontologyRid,
25
- parameters: params ? await chunkYRGYLMU5_cjs.remapQueryParams(params, client, qd.parameters) : {},
25
+ parameters: params ? await chunkQJ7NT4K4_cjs.remapQueryParams(params, client, qd.parameters) : {},
26
26
  version: query.isFixedVersion ? query.version : void 0,
27
27
  branch: client.branch
28
28
  }, {
@@ -32,15 +32,15 @@ async function* applyStreamingQuery(client, query, params) {
32
32
  if (response.body == null) {
33
33
  throw new Error("streamingExecute returned no response body");
34
34
  }
35
- const definitions = await chunkYRGYLMU5_cjs.getRequiredDefinitions(qd.output, client);
35
+ const definitions = await chunkQJ7NT4K4_cjs.getRequiredDefinitions(qd.output, client);
36
36
  const reader = response.body.getReader();
37
- for await (const line of chunkYRGYLMU5_cjs.parseNdjsonStream(chunkYRGYLMU5_cjs.iterateReadableStream(reader))) {
37
+ for await (const line of chunkQJ7NT4K4_cjs.parseNdjsonStream(chunkQJ7NT4K4_cjs.iterateReadableStream(reader))) {
38
38
  if (line.type === "error") {
39
39
  const err = new Error(`${line.errorName} (${line.errorCode}) [${line.errorInstanceId}]: ${line.errorDescription ?? ""}`);
40
40
  Object.assign(err, line);
41
41
  throw err;
42
42
  }
43
- const remapped = await chunkYRGYLMU5_cjs.remapQueryResponse(client, qd.output, line.value, definitions);
43
+ const remapped = await chunkQJ7NT4K4_cjs.remapQueryResponse(client, qd.output, line.value, definitions);
44
44
  if (qd.output.type === "array" && Array.isArray(remapped)) {
45
45
  for (const item of remapped) {
46
46
  yield item;
@@ -52,5 +52,5 @@ async function* applyStreamingQuery(client, query, params) {
52
52
  }
53
53
 
54
54
  exports.applyStreamingQuery = applyStreamingQuery;
55
- //# sourceMappingURL=applyStreamingQuery-ZUGQCOWE.cjs.map
56
- //# sourceMappingURL=applyStreamingQuery-ZUGQCOWE.cjs.map
55
+ //# sourceMappingURL=applyStreamingQuery-KHSD5LEJ.cjs.map
56
+ //# sourceMappingURL=applyStreamingQuery-KHSD5LEJ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.63.0/node_modules/@osdk/foundry.functions/build/esm/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentAndRequestContextHeaders","augmentRequestContext","remapQueryParams","getRequiredDefinitions","parseNdjsonStream","iterateReadableStream","remapQueryResponse"],"mappings":";;;;;;;;;AA2EA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,0BAA0B,CAAA;AAiCnG,SAAS,gBAAA,CAAiB,SAAS,IAAA,EAAM;AAC9C,EAAA,OAAOA,sCAAA,CAAsB,IAAA,EAAM,iBAAA,EAAmB,GAAG,IAAI,CAAA;AAC/D;;;ACzFA,gBAAuB,mBAAA,CAAoB,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ;AAChE,EAAA,MAAM,EAAA,GAAK,MAAM,MAAA,CAAO,gBAAA,CAAiB,kBAAA,CAAmB,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,cAAA,GAAiB,KAAA,CAAM,OAAA,GAAU,MAAS,CAAA;AAC3H,EAAA,IAAI,MAAA,CAAO,cAAc,IAAA,EAAM;AAC7B,IAAA,MAAM,OAAO,UAAA,EAAW;AAAA,EAC1B;AACA,EAAA,MAAM,WAAW,MAAgB,gBAAA,CAAiBC,sDAAA,CAAqCC,uCAAA,CAAsB,QAAQ,CAAA,CAAA,MAAM;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A,CAAK,OAAO,WAAW,CAAA;AACpF,IAAA,IAAI,GAAG,MAAA,CAAO,IAAA,KAAS,WAAW,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACzD,MAAA,KAAA,MAAW,QAAQ,QAAA,EAAU;AAC3B,QAAA,MAAM,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-ZUGQCOWE.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this gets the latest version of the query.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query using the given parameters. By default, this executes the latest version of the query.\n *\n * This endpoint is maintained for backward compatibility only.\n *\n * For all new implementations, use the `streamingExecute` endpoint, which supports all function types\n * and provides enhanced functionality.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"application/octet-stream\"];\n/**\n * Executes a Query using the given parameters, returning results as an NDJSON stream. By default, this executes the latest version of the query.\n *\n * This endpoint supports all Query functions. The endpoint name 'streamingExecute' refers to the NDJSON\n * streaming response format. Both streaming and non-streaming functions can use this endpoint.\n * Non-streaming functions return a single-line NDJSON response, while streaming functions return multi-line NDJSON responses.\n * This is the recommended endpoint for all query execution.\n *\n * The response is returned as a binary stream in NDJSON (Newline Delimited JSON) format, where each line\n * is a StreamingExecuteQueryResponse containing either a data batch or an error.\n *\n * For a function returning a list of 5 records with a batch size of 3, the response stream would contain\n * two lines. The first line contains the first 3 items, and the second line contains the remaining 2 items:\n *\n * ```\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99},{\"productId\":\"SKU-002\",\"price\":49.99},{\"productId\":\"SKU-003\",\"price\":19.99}]}\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-004\",\"price\":39.99},{\"productId\":\"SKU-005\",\"price\":59.99}]}\n * ```\n *\n * Each line is a separate JSON object followed by a newline character. Clients should parse the stream\n * line-by-line to process results as they arrive. If an error occurs during execution, the stream will\n * contain an error line:\n *\n * ```\n * {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { iterateReadableStream, parseNdjsonStream } from \"../util/streamutils.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({\n finalMethodCall: \"applyStreamingQuery\"\n })), query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n if (response.body == null) {\n throw new Error(\"streamingExecute returned no response body\");\n }\n const definitions = await getRequiredDefinitions(qd.output, client);\n const reader = response.body.getReader();\n for await (const line of parseNdjsonStream(iterateReadableStream(reader))) {\n if (line.type === \"error\") {\n const err = new Error(`${line.errorName} (${line.errorCode}) [${line.errorInstanceId}]: ${line.errorDescription ?? \"\"}`);\n Object.assign(err, line);\n throw err;\n }\n const remapped = await remapQueryResponse(client, qd.output, line.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.63.0/node_modules/@osdk/foundry.functions/build/esm/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentAndRequestContextHeaders","augmentRequestContext","remapQueryParams","getRequiredDefinitions","parseNdjsonStream","iterateReadableStream","remapQueryResponse"],"mappings":";;;;;;;;;AA2EA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,0BAA0B,CAAA;AAiCnG,SAAS,gBAAA,CAAiB,SAAS,IAAA,EAAM;AAC9C,EAAA,OAAOA,sCAAA,CAAsB,IAAA,EAAM,iBAAA,EAAmB,GAAG,IAAI,CAAA;AAC/D;;;ACzFA,gBAAuB,mBAAA,CAAoB,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ;AAChE,EAAA,MAAM,EAAA,GAAK,MAAM,MAAA,CAAO,gBAAA,CA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,EAAA,EAAK,IAAA,CAAK,SAAS,CAAA,GAAA,EAAM,KAAK,eAAe,CAAA,GAAA,EAAM,IAAA,CAAK,gBAAA,IAAoB,EAAE,CAAA,CAAE,CAAA;AACvH,MAAA,MAAA,CAAO,MAAA,CAAO,KAAK,IAAI,CAAA;AACvB,MAAA,MAAM,GAAA;AAAA,IACR;AACA,IAAA,MAAM,QAAA,GAAW,MAAMC,oCAAA,CAAmB,MAAA,EAAQ,GAAG,MAAA,EAAQ,IAAA,CAAK,OAAO,WAAW,CAAA;AACpF,IAAA,IAAI,GAAG,MAAA,CAAO,IAAA,KAAS,WAAW,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACzD,MAAA,KAAA,MAAW,QAAQ,QAAA,EAAU;AAC3B,QAAA,MAAM,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-KHSD5LEJ.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this gets the latest version of the query.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query using the given parameters. By default, this executes the latest version of the query.\n *\n * This endpoint is maintained for backward compatibility only.\n *\n * For all new implementations, use the `streamingExecute` endpoint, which supports all function types\n * and provides enhanced functionality.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"application/octet-stream\"];\n/**\n * Executes a Query using the given parameters, returning results as an NDJSON stream. By default, this executes the latest version of the query.\n *\n * This endpoint supports all Query functions. The endpoint name 'streamingExecute' refers to the NDJSON\n * streaming response format. Both streaming and non-streaming functions can use this endpoint.\n * Non-streaming functions return a single-line NDJSON response, while streaming functions return multi-line NDJSON responses.\n * This is the recommended endpoint for all query execution.\n *\n * The response is returned as a binary stream in NDJSON (Newline Delimited JSON) format, where each line\n * is a StreamingExecuteQueryResponse containing either a data batch or an error.\n *\n * For a function returning a list of 5 records with a batch size of 3, the response stream would contain\n * two lines. The first line contains the first 3 items, and the second line contains the remaining 2 items:\n *\n * ```\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99},{\"productId\":\"SKU-002\",\"price\":49.99},{\"productId\":\"SKU-003\",\"price\":19.99}]}\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-004\",\"price\":39.99},{\"productId\":\"SKU-005\",\"price\":59.99}]}\n * ```\n *\n * Each line is a separate JSON object followed by a newline character. Clients should parse the stream\n * line-by-line to process results as they arrive. If an error occurs during execution, the stream will\n * contain an error line:\n *\n * ```\n * {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { iterateReadableStream, parseNdjsonStream } from \"../util/streamutils.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({\n finalMethodCall: \"applyStreamingQuery\"\n })), query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n if (response.body == null) {\n throw new Error(\"streamingExecute returned no response body\");\n }\n const definitions = await getRequiredDefinitions(qd.output, client);\n const reader = response.body.getReader();\n for await (const line of parseNdjsonStream(iterateReadableStream(reader))) {\n if (line.type === \"error\") {\n const err = new Error(`${line.errorName} (${line.errorCode}) [${line.errorInstanceId}]: ${line.errorDescription ?? \"\"}`);\n Object.assign(err, line);\n throw err;\n }\n const remapped = await remapQueryResponse(client, qd.output, line.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
@@ -1585,5 +1585,5 @@ exports.hydrateAttachmentFromRidInternal = hydrateAttachmentFromRidInternal;
1585
1585
  exports.isObjectSet = isObjectSet;
1586
1586
  exports.isWireObjectSet = isWireObjectSet;
1587
1587
  exports.upload = upload;
1588
- //# sourceMappingURL=chunk-YLVUONG3.cjs.map
1589
- //# sourceMappingURL=chunk-YLVUONG3.cjs.map
1588
+ //# sourceMappingURL=chunk-I3OTWRGM.cjs.map
1589
+ //# sourceMappingURL=chunk-I3OTWRGM.cjs.map