@osdk/client 2.8.0-beta.13 → 2.8.0-beta.15
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.
- package/CHANGELOG.md +32 -0
- package/build/browser/createMediaFromReference.js +61 -0
- package/build/browser/createMediaFromReference.js.map +1 -0
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/object/mediaUpload.js +3 -0
- package/build/browser/object/mediaUpload.js.map +1 -1
- package/build/browser/observable/LinkPayload.js.map +1 -1
- package/build/browser/observable/ListPayload.js.map +1 -1
- package/build/browser/observable/ObservableClient/ObserveLink.js.map +1 -1
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/computeObjectSetCacheKey.js.map +1 -1
- package/build/browser/observable/internal/ListQueryView.js +4 -3
- package/build/browser/observable/internal/ListQueryView.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +11 -11
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/base-list/BaseCollectionQuery.js.map +1 -1
- package/build/browser/observable/internal/base-list/BaseListQuery.js +12 -13
- package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/browser/observable/internal/base-list/createCollectionConnectable.js +2 -2
- package/build/browser/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
- package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js +2 -2
- package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
- package/build/browser/observable/internal/list/InterfaceListQuery.js +1 -1
- package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.test.js +45 -46
- package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectsHelper.js +22 -1
- package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectsHelper.test.js +132 -0
- package/build/browser/observable/internal/object/ObjectsHelper.test.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
- package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -1
- package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +2 -2
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/queries/applyQuery.js +8 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +80 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/toDataValue.js +7 -7
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +23 -0
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +19 -0
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{chunk-JVLSSAAP.cjs → chunk-Q2XRNNC7.cjs} +68 -68
- package/build/cjs/{chunk-JVLSSAAP.cjs.map → chunk-Q2XRNNC7.cjs.map} +1 -1
- package/build/cjs/{chunk-LDTMSHUZ.cjs → chunk-QPPKY7HT.cjs} +4 -4
- package/build/cjs/{chunk-LDTMSHUZ.cjs.map → chunk-QPPKY7HT.cjs.map} +1 -1
- package/build/cjs/{chunk-FE6Q5R5O.cjs → chunk-RTSJQAWK.cjs} +189 -123
- package/build/cjs/chunk-RTSJQAWK.cjs.map +1 -0
- package/build/cjs/createObjectSet-BagR_R7M.d.cts +15 -0
- package/build/cjs/index.cjs +20 -12
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +2 -1
- package/build/cjs/public/internal-node.cjs +219 -219
- package/build/cjs/public/internal.cjs +14 -14
- package/build/cjs/public/unstable-do-not-use.cjs +164 -145
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +11 -14
- package/build/esm/createMediaFromReference.js +61 -0
- package/build/esm/createMediaFromReference.js.map +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/object/mediaUpload.js +3 -0
- package/build/esm/object/mediaUpload.js.map +1 -1
- package/build/esm/observable/LinkPayload.js.map +1 -1
- package/build/esm/observable/ListPayload.js.map +1 -1
- package/build/esm/observable/ObservableClient/ObserveLink.js.map +1 -1
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/computeObjectSetCacheKey.js.map +1 -1
- package/build/esm/observable/internal/ListQueryView.js +4 -3
- package/build/esm/observable/internal/ListQueryView.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +11 -11
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/base-list/BaseCollectionQuery.js.map +1 -1
- package/build/esm/observable/internal/base-list/BaseListQuery.js +12 -13
- package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/esm/observable/internal/base-list/createCollectionConnectable.js +2 -2
- package/build/esm/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
- package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js +2 -2
- package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
- package/build/esm/observable/internal/list/InterfaceListQuery.js +1 -1
- package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.test.js +45 -46
- package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectsHelper.js +22 -1
- package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectsHelper.test.js +132 -0
- package/build/esm/observable/internal/object/ObjectsHelper.test.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQueryOptions.js.map +1 -1
- package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -1
- package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +2 -2
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/queries/applyQuery.js +8 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +80 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/toDataValue.js +7 -7
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +23 -0
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +19 -0
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/createMediaFromReference.d.ts +1 -0
- package/build/types/createMediaFromReference.d.ts.map +1 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/object/mediaUpload.d.ts +2 -1
- package/build/types/object/mediaUpload.d.ts.map +1 -1
- package/build/types/observable/LinkPayload.d.ts +1 -1
- package/build/types/observable/ListPayload.d.ts +1 -1
- package/build/types/observable/ObservableClient/ObserveLink.d.ts +1 -1
- package/build/types/observable/ObservableClient.d.ts +4 -4
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/computeObjectSetCacheKey.d.ts +2 -2
- package/build/types/observable/computeObjectSetCacheKey.d.ts.map +1 -1
- package/build/types/observable/internal/ListQueryView.d.ts.map +1 -1
- package/build/types/observable/internal/Store.test.d.ts.map +1 -1
- package/build/types/observable/internal/base-list/BaseCollectionQuery.d.ts +4 -4
- package/build/types/observable/internal/base-list/BaseListQuery.d.ts +1 -1
- package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts +2 -2
- package/build/types/observable/internal/objectset/ObjectSetQueryOptions.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +1 -1
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/package.json +10 -10
- package/build/cjs/chunk-FE6Q5R5O.cjs.map +0 -1
- package/build/cjs/createClient-BPK4om7e.d.cts +0 -10
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { ObjectOrInterfaceDefinition, PropertyKeys, Augment,
|
|
2
|
-
|
|
3
|
-
import { ObjectSet as ObjectSet$1 } from '@osdk/foundry.ontologies';
|
|
1
|
+
import { ObjectOrInterfaceDefinition, PropertyKeys, Augment, ObjectTypeDefinition, InterfaceDefinition, WirePropertyTypes, WhereClause, DerivedProperty, ObjectSet, LinkNames, BaseObjectSet, CompileTimeMetadata, PrimaryKeyType, Osdk, SimplePropertyDef, AggregateOpts, AggregationsResults, QueryDefinition, ActionDefinition, ActionEditResponse, ActionValidationResponse } from '@osdk/api';
|
|
2
|
+
export { a as createClientWithTransaction, g as getWireObjectSet, i as isObjectSet } from '../createObjectSet-BagR_R7M.cjs';
|
|
4
3
|
import { C as Client, Q as QueryReturnType, A as ActionSignatureFromDef } from '../Client-Cmx6x_V1.cjs';
|
|
5
4
|
export { a as QueryParameterType } from '../Client-Cmx6x_V1.cjs';
|
|
6
|
-
|
|
5
|
+
import '@osdk/api/unstable';
|
|
6
|
+
import '@osdk/foundry.ontologies';
|
|
7
7
|
import '@osdk/shared.client';
|
|
8
8
|
import '@osdk/shared.client2';
|
|
9
9
|
|
|
10
10
|
declare function augment<Q extends ObjectOrInterfaceDefinition, T extends PropertyKeys<Q>>(type: Q, ...properties: T[]): Augment<Q, T>;
|
|
11
11
|
|
|
12
|
-
declare function isObjectSet(o: object): o is ObjectSet<ObjectOrInterfaceDefinition>;
|
|
13
|
-
declare function getWireObjectSet(objectSet: ObjectSet<any> | MinimalObjectSet<any>): ObjectSet$1;
|
|
14
|
-
|
|
15
12
|
/**
|
|
16
13
|
* Represents the current state of an observation.
|
|
17
14
|
*
|
|
@@ -81,7 +78,7 @@ type OrderBy$1<Q extends ObjectTypeDefinition | InterfaceDefinition> = {
|
|
|
81
78
|
*/
|
|
82
79
|
type InvalidationMode = "in-place" | "wait" | "reset";
|
|
83
80
|
|
|
84
|
-
interface ObserveObjectSetOptions<Q extends
|
|
81
|
+
interface ObserveObjectSetOptions<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> extends CommonObserveOptions {
|
|
85
82
|
where?: WhereClause<Q>;
|
|
86
83
|
withProperties?: {
|
|
87
84
|
[K in keyof RDPs]: DerivedProperty.Creator<Q, RDPs[K]>;
|
|
@@ -121,7 +118,7 @@ interface ObserveObjectSetOptions<Q extends ObjectTypeDefinition, RDPs extends R
|
|
|
121
118
|
* @param options - Optional observation options (where, orderBy, etc.)
|
|
122
119
|
* @returns A stable string key representing the ObjectSet and options
|
|
123
120
|
*/
|
|
124
|
-
declare function computeObjectSetCacheKey<T extends
|
|
121
|
+
declare function computeObjectSetCacheKey<T extends ObjectOrInterfaceDefinition, BaseRDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> | BaseObjectSet<T> = never, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}>(objectSet: ObjectSet<T, BaseRDPs>, options?: ObserveObjectSetOptions<T, RDPs>): string;
|
|
125
122
|
|
|
126
123
|
type Canonical<T> = T & {
|
|
127
124
|
__canonical: true;
|
|
@@ -144,7 +141,7 @@ declare namespace ObserveLinks {
|
|
|
144
141
|
expectedLength?: number;
|
|
145
142
|
}
|
|
146
143
|
interface CallbackArgs<T extends ObjectTypeDefinition | InterfaceDefinition> {
|
|
147
|
-
resolvedList: Osdk.Instance<T>[];
|
|
144
|
+
resolvedList: Osdk.Instance<T>[] | undefined;
|
|
148
145
|
isOptimistic: boolean;
|
|
149
146
|
lastUpdated: number;
|
|
150
147
|
fetchMore: () => Promise<void>;
|
|
@@ -220,7 +217,7 @@ interface ObserveObjectCallbackArgs<T extends ObjectOrInterfaceDefinition> {
|
|
|
220
217
|
lastUpdated: number;
|
|
221
218
|
}
|
|
222
219
|
interface ObserveObjectsCallbackArgs<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> {
|
|
223
|
-
resolvedList: Array<Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs
|
|
220
|
+
resolvedList: Array<Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs>> | undefined;
|
|
224
221
|
isOptimistic: boolean;
|
|
225
222
|
lastUpdated: number;
|
|
226
223
|
fetchMore: () => Promise<void>;
|
|
@@ -229,7 +226,7 @@ interface ObserveObjectsCallbackArgs<T extends ObjectOrInterfaceDefinition, RDPs
|
|
|
229
226
|
totalCount?: string;
|
|
230
227
|
}
|
|
231
228
|
interface ObserveObjectSetArgs<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> {
|
|
232
|
-
resolvedList: Array<Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs
|
|
229
|
+
resolvedList: Array<Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs>> | undefined;
|
|
233
230
|
isOptimistic: boolean;
|
|
234
231
|
lastUpdated: number;
|
|
235
232
|
fetchMore: () => Promise<void>;
|
|
@@ -351,7 +348,7 @@ interface ObservableClient extends ObserveLinks {
|
|
|
351
348
|
* - Link traversal with pivotTo
|
|
352
349
|
* - Sorting and pagination
|
|
353
350
|
*/
|
|
354
|
-
observeObjectSet<T extends
|
|
351
|
+
observeObjectSet<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}>(baseObjectSet: ObjectSet<T>, options: ObserveObjectSetOptions<T, RDPs>, subFn: Observer<ObserveObjectSetArgs<T, RDPs>>): Unsubscribable;
|
|
355
352
|
/**
|
|
356
353
|
* @deprecated Use the async overload with `objectSet` parameter instead.
|
|
357
354
|
* Pass `objectSet: client(YourType)` to get the base object set.
|
|
@@ -478,4 +475,4 @@ interface OsdkConfig {
|
|
|
478
475
|
}
|
|
479
476
|
declare function getOsdkConfig(ontologyRid: string): OsdkConfig;
|
|
480
477
|
|
|
481
|
-
export { ActionSignatureFromDef, ObservableClient, type ObserveAggregationArgs, type ObserveFunctionCallbackArgs, type ObserveFunctionOptions, ObserveLinks, type ObserveObjectCallbackArgs, type ObserveObjectSetArgs, type ObserveObjectsCallbackArgs, type Observer, type OsdkConfig, QueryReturnType, type Unsubscribable, augment, computeObjectSetCacheKey, createObservableClient, getMetaTagContent, getOsdkConfig
|
|
478
|
+
export { ActionSignatureFromDef, ObservableClient, type ObserveAggregationArgs, type ObserveFunctionCallbackArgs, type ObserveFunctionOptions, ObserveLinks, type ObserveObjectCallbackArgs, type ObserveObjectSetArgs, type ObserveObjectsCallbackArgs, type Observer, type OsdkConfig, QueryReturnType, type Unsubscribable, augment, computeObjectSetCacheKey, createObservableClient, getMetaTagContent, getOsdkConfig };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { MediaSets } from "@osdk/foundry.mediasets";
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
* Creates a Media object from a MediaReference for query results.
|
|
21
|
+
* Unlike MediaReferencePropertyImpl, this doesn't require object context
|
|
22
|
+
* and directly accesses the media set APIs. This is intended for MediaReferences returned
|
|
23
|
+
* from query results or to be used by the functions runtime,
|
|
24
|
+
*/
|
|
25
|
+
export function createMediaFromReference(client, mediaReference) {
|
|
26
|
+
const {
|
|
27
|
+
mediaSetRid,
|
|
28
|
+
mediaItemRid
|
|
29
|
+
} = mediaReference.reference.mediaSetViewItem;
|
|
30
|
+
const token = mediaReference.reference.mediaSetViewItem.token;
|
|
31
|
+
return {
|
|
32
|
+
async fetchContents() {
|
|
33
|
+
return MediaSets.read(client, mediaSetRid, mediaItemRid, {
|
|
34
|
+
preview: true
|
|
35
|
+
}, token ? {
|
|
36
|
+
ReadToken: token
|
|
37
|
+
} : undefined);
|
|
38
|
+
},
|
|
39
|
+
async fetchMetadata() {
|
|
40
|
+
const metadata = await MediaSets.metadata(client, mediaSetRid, mediaItemRid, {
|
|
41
|
+
preview: true
|
|
42
|
+
}, token ? {
|
|
43
|
+
ReadToken: token
|
|
44
|
+
} : undefined);
|
|
45
|
+
const info = await MediaSets.info(client, mediaSetRid, mediaItemRid, {
|
|
46
|
+
preview: true
|
|
47
|
+
}, token ? {
|
|
48
|
+
ReadToken: token
|
|
49
|
+
} : undefined);
|
|
50
|
+
return {
|
|
51
|
+
path: info.path,
|
|
52
|
+
sizeBytes: metadata.sizeBytes,
|
|
53
|
+
mediaType: undefined // Media type is not currently returned by the API, so we return undefined here. This can be updated when the API returns media type.
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
getMediaReference() {
|
|
57
|
+
return mediaReference;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=createMediaFromReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMediaFromReference.js","names":["MediaSets","createMediaFromReference","client","mediaReference","mediaSetRid","mediaItemRid","reference","mediaSetViewItem","token","fetchContents","read","preview","ReadToken","undefined","fetchMetadata","metadata","info","path","sizeBytes","mediaType","getMediaReference"],"sources":["createMediaFromReference.ts"],"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 */\n\nimport type { Media, MediaMetadata, MediaReference } from \"@osdk/api\";\nimport { MediaSets } from \"@osdk/foundry.mediasets\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\n\n/**\n * @internal\n * Creates a Media object from a MediaReference for query results.\n * Unlike MediaReferencePropertyImpl, this doesn't require object context\n * and directly accesses the media set APIs. This is intended for MediaReferences returned\n * from query results or to be used by the functions runtime,\n */\nexport function createMediaFromReference(\n client: MinimalClient,\n mediaReference: MediaReference,\n): Media {\n const { mediaSetRid, mediaItemRid } =\n mediaReference.reference.mediaSetViewItem;\n const token = mediaReference.reference.mediaSetViewItem.token;\n return {\n async fetchContents(): Promise<Response> {\n return MediaSets.read(\n client,\n mediaSetRid,\n mediaItemRid,\n { preview: true },\n token ? { ReadToken: token } : undefined,\n );\n },\n\n async fetchMetadata(): Promise<MediaMetadata> {\n const metadata = await MediaSets.metadata(\n client,\n mediaSetRid,\n mediaItemRid,\n { preview: true },\n token ? { ReadToken: token } : undefined,\n );\n\n const info = await MediaSets.info(\n client,\n mediaSetRid,\n mediaItemRid,\n { preview: true },\n token ? { ReadToken: token } : undefined,\n );\n\n return {\n path: info.path,\n sizeBytes: metadata.sizeBytes,\n mediaType: undefined as any, // Media type is not currently returned by the API, so we return undefined here. This can be updated when the API returns media type.\n };\n },\n\n getMediaReference(): MediaReference {\n return mediaReference;\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,SAAS,QAAQ,yBAAyB;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CACtCC,MAAqB,EACrBC,cAA8B,EACvB;EACP,MAAM;IAAEC,WAAW;IAAEC;EAAa,CAAC,GACjCF,cAAc,CAACG,SAAS,CAACC,gBAAgB;EAC3C,MAAMC,KAAK,GAAGL,cAAc,CAACG,SAAS,CAACC,gBAAgB,CAACC,KAAK;EAC7D,OAAO;IACL,MAAMC,aAAaA,CAAA,EAAsB;MACvC,OAAOT,SAAS,CAACU,IAAI,CACnBR,MAAM,EACNE,WAAW,EACXC,YAAY,EACZ;QAAEM,OAAO,EAAE;MAAK,CAAC,EACjBH,KAAK,GAAG;QAAEI,SAAS,EAAEJ;MAAM,CAAC,GAAGK,SACjC,CAAC;IACH,CAAC;IAED,MAAMC,aAAaA,CAAA,EAA2B;MAC5C,MAAMC,QAAQ,GAAG,MAAMf,SAAS,CAACe,QAAQ,CACvCb,MAAM,EACNE,WAAW,EACXC,YAAY,EACZ;QAAEM,OAAO,EAAE;MAAK,CAAC,EACjBH,KAAK,GAAG;QAAEI,SAAS,EAAEJ;MAAM,CAAC,GAAGK,SACjC,CAAC;MAED,MAAMG,IAAI,GAAG,MAAMhB,SAAS,CAACgB,IAAI,CAC/Bd,MAAM,EACNE,WAAW,EACXC,YAAY,EACZ;QAAEM,OAAO,EAAE;MAAK,CAAC,EACjBH,KAAK,GAAG;QAAEI,SAAS,EAAEJ;MAAM,CAAC,GAAGK,SACjC,CAAC;MAED,OAAO;QACLI,IAAI,EAAED,IAAI,CAACC,IAAI;QACfC,SAAS,EAAEH,QAAQ,CAACG,SAAS;QAC7BC,SAAS,EAAEN,SAAgB,CAAE;MAC/B,CAAC;IACH,CAAC;IAEDO,iBAAiBA,CAAA,EAAmB;MAClC,OAAOjB,cAAc;IACvB;EACF,CAAC;AACH","ignoreList":[]}
|
package/build/esm/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
|
22
22
|
export { createClient } from "./createClient.js";
|
|
23
23
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
24
24
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
|
25
|
+
export { getWireObjectSet, isObjectSet } from "./objectSet/createObjectSet.js";
|
|
25
26
|
export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
|
|
26
27
|
export { createObjectSpecifierFromPrimaryKey, extractPrimaryKeyFromObjectSpecifier } from "./util/objectSpecifierUtils.js";
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.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\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n MediaReference,\n MediaUpload,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,QAAQ,WAAW;AAyChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","getWireObjectSet","isObjectSet","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.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\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n MediaReference,\n MediaUpload,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nexport { getWireObjectSet, isObjectSet } from \"./objectSet/createObjectSet.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,QAAQ,WAAW;AAyChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAIrE,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,gCAAgC;AAE9E,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B;AAErC,SACEC,mCAAmC,EACnCC,oCAAoC,QAC/B,gCAAgC","ignoreList":[]}
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
export function isMedia(o) {
|
|
18
|
+
return typeof o === "object" && o != null && typeof o.fetchMetadata === "function" && typeof o.fetchContents === "function" && typeof o.getMediaReference === "function";
|
|
19
|
+
}
|
|
17
20
|
export function isMediaReference(o) {
|
|
18
21
|
return typeof o === `object` && typeof o.mimeType === "string" && "reference" in o && typeof o.reference === "object" && o.reference.type === "mediaSetViewItem" && "mediaSetViewItem" in o.reference && typeof o.reference.mediaSetViewItem === "object" && typeof o.reference.mediaSetViewItem.mediaSetRid === "string" && typeof o.reference.mediaSetViewItem.mediaSetViewRid === "string" && typeof o.reference.mediaSetViewItem.mediaItemRid === "string";
|
|
19
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mediaUpload.js","names":["
|
|
1
|
+
{"version":3,"file":"mediaUpload.js","names":["isMedia","o","fetchMetadata","fetchContents","getMediaReference","isMediaReference","mimeType","reference","type","mediaSetViewItem","mediaSetRid","mediaSetViewRid","mediaItemRid","isMediaUpload","fileName","data","Blob"],"sources":["mediaUpload.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 { Media, MediaReference, MediaUpload } from \"@osdk/api\";\n\nexport function isMedia(o: any): o is Media {\n return typeof o === \"object\"\n && o != null\n && typeof o.fetchMetadata === \"function\"\n && typeof o.fetchContents === \"function\"\n && typeof o.getMediaReference === \"function\";\n}\n\nexport function isMediaReference(o: any): o is MediaReference {\n return typeof o === `object`\n && typeof o.mimeType === \"string\"\n && \"reference\" in o\n && typeof o.reference === \"object\"\n && o.reference.type === \"mediaSetViewItem\"\n && \"mediaSetViewItem\" in o.reference\n && typeof o.reference.mediaSetViewItem === \"object\"\n && typeof o.reference.mediaSetViewItem.mediaSetRid === \"string\"\n && typeof o.reference.mediaSetViewItem.mediaSetViewRid === \"string\"\n && typeof o.reference.mediaSetViewItem.mediaItemRid === \"string\";\n}\n\nexport function isMediaUpload(o: any): o is MediaUpload {\n return typeof o === \"object\"\n && o != null\n && \"fileName\" in o\n && typeof o.fileName === \"string\"\n && \"data\" in o\n && typeof o.data === \"object\"\n && o.data instanceof Blob;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,OAAOA,CAACC,CAAM,EAAc;EAC1C,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvBA,CAAC,IAAI,IAAI,IACT,OAAOA,CAAC,CAACC,aAAa,KAAK,UAAU,IACrC,OAAOD,CAAC,CAACE,aAAa,KAAK,UAAU,IACrC,OAAOF,CAAC,CAACG,iBAAiB,KAAK,UAAU;AAChD;AAEA,OAAO,SAASC,gBAAgBA,CAACJ,CAAM,EAAuB;EAC5D,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvB,OAAOA,CAAC,CAACK,QAAQ,KAAK,QAAQ,IAC9B,WAAW,IAAIL,CAAC,IAChB,OAAOA,CAAC,CAACM,SAAS,KAAK,QAAQ,IAC/BN,CAAC,CAACM,SAAS,CAACC,IAAI,KAAK,kBAAkB,IACvC,kBAAkB,IAAIP,CAAC,CAACM,SAAS,IACjC,OAAON,CAAC,CAACM,SAAS,CAACE,gBAAgB,KAAK,QAAQ,IAChD,OAAOR,CAAC,CAACM,SAAS,CAACE,gBAAgB,CAACC,WAAW,KAAK,QAAQ,IAC5D,OAAOT,CAAC,CAACM,SAAS,CAACE,gBAAgB,CAACE,eAAe,KAAK,QAAQ,IAChE,OAAOV,CAAC,CAACM,SAAS,CAACE,gBAAgB,CAACG,YAAY,KAAK,QAAQ;AACpE;AAEA,OAAO,SAASC,aAAaA,CAACZ,CAAM,EAAoB;EACtD,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvBA,CAAC,IAAI,IAAI,IACT,UAAU,IAAIA,CAAC,IACf,OAAOA,CAAC,CAACa,QAAQ,KAAK,QAAQ,IAC9B,MAAM,IAAIb,CAAC,IACX,OAAOA,CAAC,CAACc,IAAI,KAAK,QAAQ,IAC1Bd,CAAC,CAACc,IAAI,YAAYC,IAAI;AAC7B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkPayload.js","names":[],"sources":["LinkPayload.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveLinkCallbackArgs } from \"./ObservableClient.js\";\n\n/**\n * Internal type to keep the generic insanity down internal to the observable code\n */\nexport interface SpecificLinkPayload\n extends Omit<ObserveLinkCallbackArgs<any>, \"resolvedList\">\n{\n resolvedList: Array<ObjectHolder | InterfaceHolder
|
|
1
|
+
{"version":3,"file":"LinkPayload.js","names":[],"sources":["LinkPayload.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveLinkCallbackArgs } from \"./ObservableClient.js\";\n\n/**\n * Internal type to keep the generic insanity down internal to the observable code\n */\nexport interface SpecificLinkPayload\n extends Omit<ObserveLinkCallbackArgs<any>, \"resolvedList\">\n{\n resolvedList: Array<ObjectHolder | InterfaceHolder> | undefined;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListPayload.js","names":[],"sources":["ListPayload.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { WirePropertyTypes } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectsCallbackArgs } from \"./ObservableClient.js\";\n\nexport interface ListPayload<\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> extends Omit<ObserveObjectsCallbackArgs<any, RDPs>, \"resolvedList\"> {\n resolvedList: Array<ObjectHolder | InterfaceHolder
|
|
1
|
+
{"version":3,"file":"ListPayload.js","names":[],"sources":["ListPayload.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { WirePropertyTypes } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"../object/convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { ObserveObjectsCallbackArgs } from \"./ObservableClient.js\";\n\nexport interface ListPayload<\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> extends Omit<ObserveObjectsCallbackArgs<any, RDPs>, \"resolvedList\"> {\n resolvedList: Array<ObjectHolder | InterfaceHolder> | undefined;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObserveLink.js","names":["ObserveLinks"],"sources":["ObserveLink.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 CompileTimeMetadata,\n InterfaceDefinition,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n WhereClause,\n} from \"@osdk/api\";\nimport type { Unsubscribable } from \"../Unsubscribable.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n OrderBy,\n Status,\n} from \"./common.js\";\n\nexport namespace ObserveLinks {\n export interface Options<\n Q extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<Q>[\"links\"] & string,\n > extends CommonObserveOptions, ObserveOptions {\n srcType: Pick<Q, \"type\" | \"apiName\">;\n sourceUnderlyingObjectType: string;\n pk: PrimaryKeyType<Q>;\n linkName: L;\n where?: WhereClause<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n pageSize?: number;\n orderBy?: OrderBy<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n }\n\n export interface CallbackArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n > {\n resolvedList: Osdk.Instance<T>[];\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n }\n}\n\nexport interface ObserveLinks {\n observeLinks<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | ReadonlyArray<Osdk.Instance<T>>,\n linkName: L,\n options: Omit<\n ObserveLinks.Options<T, L>,\n \"srcType\" | \"pk\" | \"sourceUnderlyingObjectType\"\n >,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ): Unsubscribable;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAkCiBA,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObserveLink.js","names":["ObserveLinks"],"sources":["ObserveLink.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 CompileTimeMetadata,\n InterfaceDefinition,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n WhereClause,\n} from \"@osdk/api\";\nimport type { Unsubscribable } from \"../Unsubscribable.js\";\nimport type {\n CommonObserveOptions,\n InvalidationMode,\n ObserveOptions,\n Observer,\n OrderBy,\n Status,\n} from \"./common.js\";\n\nexport namespace ObserveLinks {\n export interface Options<\n Q extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<Q>[\"links\"] & string,\n > extends CommonObserveOptions, ObserveOptions {\n srcType: Pick<Q, \"type\" | \"apiName\">;\n sourceUnderlyingObjectType: string;\n pk: PrimaryKeyType<Q>;\n linkName: L;\n where?: WhereClause<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n pageSize?: number;\n orderBy?: OrderBy<CompileTimeMetadata<Q>[\"links\"][L][\"targetType\"]>;\n invalidationMode?: InvalidationMode;\n expectedLength?: number;\n }\n\n export interface CallbackArgs<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n > {\n resolvedList: Osdk.Instance<T>[] | undefined;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n }\n}\n\nexport interface ObserveLinks {\n observeLinks<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | ReadonlyArray<Osdk.Instance<T>>,\n linkName: L,\n options: Omit<\n ObserveLinks.Options<T, L>,\n \"srcType\" | \"pk\" | \"sourceUnderlyingObjectType\"\n >,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ): Unsubscribable;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAkCiBA,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n 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 { ObserveLinks } from \"./ObservableClient/ObserveLink.js\";\nimport type { OptimisticBuilder } from \"./OptimisticBuilder.js\";\n\nexport namespace ObservableClient {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\nexport interface ObserveObjectOptions<\n T extends ObjectOrInterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: PropertyKeys<T>[];\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 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 * // Fetch specific objects by RID\n * observeList({ type: Employee, rids: ['ri.foo.123', 'ri.foo.456'] }, observer)\n *\n * @example\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 rids?: readonly string[];\n\n /**\n * Automatically fetch additional pages on initial load.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n *\n * @example\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer)\n *\n * @example\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer)\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n}\n\nexport interface ObserveObjectCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<T> | 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: Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n totalCount?: string;\n}\n\nexport interface ObserveObjectSetArgs<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n> {\n resolvedList: Array<\n Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>\n >;\n isOptimistic: boolean;\n lastUpdated: number;\n fetchMore: () => Promise<void>;\n hasMore: boolean;\n status: Status;\n objectSet: ObjectSet<T, RDPs>;\n 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>[];\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: ObserveOptions,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends 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 ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable;\n\n /**\n * @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 canonicalizeWhereClause: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n}\n\nexport function createObservableClient(client: Client): ObservableClient {\n // First we need a modified client that adds an extra header so we know its\n // an observable client\n const tweakedClient = createClientFromContext({\n ...client[additionalContext],\n\n fetch: createFetchHeaderMutator(\n client[additionalContext].fetch,\n (headers) => {\n headers.set(\n \"Fetch-User-Agent\",\n [\n headers.get(\"Fetch-User-Agent\"),\n OBSERVABLE_USER_AGENT,\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;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,WAW3BC,gBAAgB;AAoIjC;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgPA,OAAO,SAASC,sBAAsBA,CAACC,MAAc,EAAoB;EACvE;EACA;EACA,MAAMC,aAAa,GAAGP,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BS,KAAK,EAAEV,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACS,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BV,qBAAqB,CACtB,CAACW,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAIA,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAC5C,CAAC;MACD,OAAON,OAAO;IAChB,CACF;EACF,CAAC,CAAC;;EAEF;EACA;EACA,OAAO,IAAIP,oBAAoB,CAAC,IAAIC,KAAK,CAACI,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObservableClient.js","names":["createFetchHeaderMutator","additionalContext","createClientFromContext","OBSERVABLE_USER_AGENT","ObservableClientImpl","Store","ObservableClient","createObservableClient","client","tweakedClient","fetch","headers","set","get","filter","x","length","join"],"sources":["ObservableClient.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n AggregateOpts,\n AggregationsResults,\n 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 { ObserveLinks } from \"./ObservableClient/ObserveLink.js\";\nimport type { OptimisticBuilder } from \"./OptimisticBuilder.js\";\n\nexport namespace ObservableClient {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\nexport interface ObserveObjectOptions<\n T extends ObjectOrInterfaceDefinition,\n> extends ObserveOptions {\n apiName: T[\"apiName\"] | T;\n pk: PrimaryKeyType<T>;\n select?: PropertyKeys<T>[];\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 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 * // Fetch specific objects by RID\n * observeList({ type: Employee, rids: ['ri.foo.123', 'ri.foo.456'] }, observer)\n *\n * @example\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 rids?: readonly string[];\n\n /**\n * Automatically fetch additional pages on initial load.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n *\n * @example\n * // Fetch all todos at once\n * observeList({ type: Todo, autoFetchMore: true }, observer)\n *\n * @example\n * // Fetch at least 100 todos\n * observeList({ type: Todo, autoFetchMore: 100, pageSize: 25 }, observer)\n */\n autoFetchMore?: boolean | number;\n intersectWith?: Array<{\n where: WhereClause<Q, RDPs>;\n }>;\n pivotTo?: string;\n}\n\nexport interface ObserveObjectCallbackArgs<\n T extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<T> | 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<\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 totalCount?: string;\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>[] | undefined;\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: ObserveOptions,\n subFn: Observer<ObserveObjectCallbackArgs<T>>,\n ): Unsubscribable;\n\n /**\n * Observe a filtered and sorted collection of objects.\n *\n * @param options - Filter, sort, and pagination options\n * @param subFn - Observer that receives collection state updates\n * @returns Subscription that can be unsubscribed to stop updates\n *\n * Supports:\n * - Filtering with where clauses\n * - Sorting with orderBy\n * - Pagination via fetchMore() in the payload\n * - Automatic updates when any matching object changes\n */\n observeList<\n T extends 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 canonicalizeWhereClause: <\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n where: WhereClause<T, RDPs>,\n ) => Canonical<WhereClause<T, RDPs>>;\n}\n\nexport function createObservableClient(client: Client): ObservableClient {\n // First we need a modified client that adds an extra header so we know its\n // an observable client\n const tweakedClient = createClientFromContext({\n ...client[additionalContext],\n\n fetch: createFetchHeaderMutator(\n client[additionalContext].fetch,\n (headers) => {\n headers.set(\n \"Fetch-User-Agent\",\n [\n headers.get(\"Fetch-User-Agent\"),\n OBSERVABLE_USER_AGENT,\n ].filter(x => x && x?.length > 0).join(\" \"),\n );\n return headers;\n },\n ),\n });\n\n // Then we use that client instead. Because the `client` does not hold\n // any real state, this whole thing works.\n return new ObservableClientImpl(new Store(tweakedClient));\n}\n\nexport interface Unsubscribable {\n unsubscribe: () => void;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;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,WAW3BC,gBAAgB;AAwIjC;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgPA,OAAO,SAASC,sBAAsBA,CAACC,MAAc,EAAoB;EACvE;EACA;EACA,MAAMC,aAAa,GAAGP,uBAAuB,CAAC;IAC5C,GAAGM,MAAM,CAACP,iBAAiB,CAAC;IAE5BS,KAAK,EAAEV,wBAAwB,CAC7BQ,MAAM,CAACP,iBAAiB,CAAC,CAACS,KAAK,EAC9BC,OAAO,IAAK;MACXA,OAAO,CAACC,GAAG,CACT,kBAAkB,EAClB,CACED,OAAO,CAACE,GAAG,CAAC,kBAAkB,CAAC,EAC/BV,qBAAqB,CACtB,CAACW,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAIA,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAC5C,CAAC;MACD,OAAON,OAAO;IAChB,CACF;EACF,CAAC,CAAC;;EAEF;EACA;EACA,OAAO,IAAIP,oBAAoB,CAAC,IAAIC,KAAK,CAACI,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeObjectSetCacheKey.js","names":["getWireObjectSet","OrderByCanonicalizer","WhereClauseCanonicalizer","whereCanonicalizer","orderByCanonicalizer","computeObjectSetCacheKey","objectSet","options","keyParts","JSON","stringify","where","push","canonicalize","withProperties","propKeys","Object","keys","sort","union","length","map","os","intersect","subtract","pivotTo","orderBy","pageSize"],"sources":["computeObjectSetCacheKey.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 BaseObjectSet,\n
|
|
1
|
+
{"version":3,"file":"computeObjectSetCacheKey.js","names":["getWireObjectSet","OrderByCanonicalizer","WhereClauseCanonicalizer","whereCanonicalizer","orderByCanonicalizer","computeObjectSetCacheKey","objectSet","options","keyParts","JSON","stringify","where","push","canonicalize","withProperties","propKeys","Object","keys","sort","union","length","map","os","intersect","subtract","pivotTo","orderBy","pageSize"],"sources":["computeObjectSetCacheKey.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 BaseObjectSet,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport type { ObserveObjectSetOptions } from \"./internal/objectset/ObjectSetQueryOptions.js\";\nimport { OrderByCanonicalizer } from \"./internal/OrderByCanonicalizer.js\";\nimport { WhereClauseCanonicalizer } from \"./internal/WhereClauseCanonicalizer.js\";\n\nconst whereCanonicalizer = new WhereClauseCanonicalizer();\nconst orderByCanonicalizer = new OrderByCanonicalizer();\n\n/**\n * Computes a stable cache key for an ObjectSet with options.\n *\n * Note: dedupeInterval is excluded as it doesn't affect the data, only the refresh rate.\n *\n * @param objectSet - The base ObjectSet\n * @param options - Optional observation options (where, orderBy, etc.)\n * @returns A stable string key representing the ObjectSet and options\n */\nexport function computeObjectSetCacheKey<\n T extends ObjectOrInterfaceDefinition,\n BaseRDPs extends\n | Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>>\n | BaseObjectSet<T> = never,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n>(\n objectSet: ObjectSet<T, BaseRDPs>,\n options?: ObserveObjectSetOptions<T, RDPs>,\n): string {\n const keyParts: Array<unknown> = [\n \"objectSet\",\n getWireObjectSet(objectSet as unknown as ObjectSet<any>),\n ];\n\n if (!options) {\n return JSON.stringify(keyParts);\n }\n\n if (options.where) {\n keyParts.push(\"where\", whereCanonicalizer.canonicalize(options.where));\n }\n\n if (options.withProperties) {\n const propKeys = Object.keys(options.withProperties).sort();\n keyParts.push(\"props\", propKeys);\n }\n\n if (options.union && options.union.length > 0) {\n keyParts.push(\n \"union\",\n options.union.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.intersect && options.intersect.length > 0) {\n keyParts.push(\n \"intersect\",\n options.intersect.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.subtract && options.subtract.length > 0) {\n keyParts.push(\n \"subtract\",\n options.subtract.map((os: ObjectSet<T>) =>\n getWireObjectSet(os as unknown as ObjectSet<any>)\n ),\n );\n }\n\n if (options.pivotTo) {\n keyParts.push(\"pivotTo\", options.pivotTo);\n }\n\n if (options.orderBy) {\n keyParts.push(\n \"orderBy\",\n orderByCanonicalizer.canonicalize(options.orderBy),\n );\n }\n\n if (options.pageSize) {\n keyParts.push(\"pageSize\", options.pageSize);\n }\n\n return JSON.stringify(keyParts);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,gBAAgB,QAAQ,iCAAiC;AAElE,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,wBAAwB,QAAQ,wCAAwC;AAEjF,MAAMC,kBAAkB,GAAG,IAAID,wBAAwB,CAAC,CAAC;AACzD,MAAME,oBAAoB,GAAG,IAAIH,oBAAoB,CAAC,CAAC;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,wBAAwBA,CAUtCC,SAAiC,EACjCC,OAA0C,EAClC;EACR,MAAMC,QAAwB,GAAG,CAC/B,WAAW,EACXR,gBAAgB,CAACM,SAAsC,CAAC,CACzD;EAED,IAAI,CAACC,OAAO,EAAE;IACZ,OAAOE,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC;EACjC;EAEA,IAAID,OAAO,CAACI,KAAK,EAAE;IACjBH,QAAQ,CAACI,IAAI,CAAC,OAAO,EAAET,kBAAkB,CAACU,YAAY,CAACN,OAAO,CAACI,KAAK,CAAC,CAAC;EACxE;EAEA,IAAIJ,OAAO,CAACO,cAAc,EAAE;IAC1B,MAAMC,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACV,OAAO,CAACO,cAAc,CAAC,CAACI,IAAI,CAAC,CAAC;IAC3DV,QAAQ,CAACI,IAAI,CAAC,OAAO,EAAEG,QAAQ,CAAC;EAClC;EAEA,IAAIR,OAAO,CAACY,KAAK,IAAIZ,OAAO,CAACY,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;IAC7CZ,QAAQ,CAACI,IAAI,CACX,OAAO,EACPL,OAAO,CAACY,KAAK,CAACE,GAAG,CAAEC,EAAgB,IACjCtB,gBAAgB,CAACsB,EAA+B,CAClD,CACF,CAAC;EACH;EAEA,IAAIf,OAAO,CAACgB,SAAS,IAAIhB,OAAO,CAACgB,SAAS,CAACH,MAAM,GAAG,CAAC,EAAE;IACrDZ,QAAQ,CAACI,IAAI,CACX,WAAW,EACXL,OAAO,CAACgB,SAAS,CAACF,GAAG,CAAEC,EAAgB,IACrCtB,gBAAgB,CAACsB,EAA+B,CAClD,CACF,CAAC;EACH;EAEA,IAAIf,OAAO,CAACiB,QAAQ,IAAIjB,OAAO,CAACiB,QAAQ,CAACJ,MAAM,GAAG,CAAC,EAAE;IACnDZ,QAAQ,CAACI,IAAI,CACX,UAAU,EACVL,OAAO,CAACiB,QAAQ,CAACH,GAAG,CAAEC,EAAgB,IACpCtB,gBAAgB,CAACsB,EAA+B,CAClD,CACF,CAAC;EACH;EAEA,IAAIf,OAAO,CAACkB,OAAO,EAAE;IACnBjB,QAAQ,CAACI,IAAI,CAAC,SAAS,EAAEL,OAAO,CAACkB,OAAO,CAAC;EAC3C;EAEA,IAAIlB,OAAO,CAACmB,OAAO,EAAE;IACnBlB,QAAQ,CAACI,IAAI,CACX,SAAS,EACTR,oBAAoB,CAACS,YAAY,CAACN,OAAO,CAACmB,OAAO,CACnD,CAAC;EACH;EAEA,IAAInB,OAAO,CAACoB,QAAQ,EAAE;IACpBnB,QAAQ,CAACI,IAAI,CAAC,UAAU,EAAEL,OAAO,CAACoB,QAAQ,CAAC;EAC7C;EAEA,OAAOlB,IAAI,CAACC,SAAS,CAACF,QAAQ,CAAC;AACjC","ignoreList":[]}
|
|
@@ -64,7 +64,7 @@ export class ListQueryView {
|
|
|
64
64
|
next: payload => {
|
|
65
65
|
this.#lastPayload = payload;
|
|
66
66
|
observer.next?.(this.#transformPayload(payload));
|
|
67
|
-
if (!this.#hasAutoFetch && payload.status === "loaded" && payload.resolvedList
|
|
67
|
+
if (!this.#hasAutoFetch && payload.status === "loaded" && (payload.resolvedList?.length ?? 0) < this.#viewLimit && this.#query.hasMorePages()) {
|
|
68
68
|
void this.#query.fetchMore();
|
|
69
69
|
}
|
|
70
70
|
},
|
|
@@ -86,10 +86,11 @@ export class ListQueryView {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
#transformPayload(payload) {
|
|
89
|
-
const
|
|
89
|
+
const resolvedList = payload.resolvedList;
|
|
90
|
+
const loadedCount = resolvedList?.length ?? 0;
|
|
90
91
|
return {
|
|
91
92
|
...payload,
|
|
92
|
-
resolvedList:
|
|
93
|
+
resolvedList: resolvedList?.slice(0, this.#viewLimit),
|
|
93
94
|
hasMore: this.#viewLimit < loadedCount || payload.hasMore,
|
|
94
95
|
fetchMore: this.#fetchMore,
|
|
95
96
|
status: loadedCount >= this.#viewLimit && payload.status === "loading" ? "loaded" : payload.status
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListQueryView.js","names":["viewIdCounter","ListQueryView","query","viewLimit","pageSize","viewId","hasAutoFetch","fetchMore","pendingFetchMore","lastPayload","observer","constructor","autoFetchMore","Number","MAX_SAFE_INTEGER","createFetchMore","registerFetchPageSize","subscribe","sub","next","payload","transformPayload","status","resolvedList","length","hasMorePages","error","err","complete","add","unregisterFetchPageSize","undefined","reEmitWithNewViewLimit","#reEmitWithNewViewLimit","#transformPayload","loadedCount","slice","hasMore","#createFetchMore","getLoadedCount","hasMoreOnServer","finally","Promise","resolve"],"sources":["ListQueryView.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 { Subscription } from \"rxjs\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { BaseListPayloadShape } from \"./base-list/BaseListQuery.js\";\n\n/**\n * Interface for the query methods that ListQueryView needs.\n * This allows ListQueryView to work with any query that supports these operations.\n */\nexport interface ListQueryViewTarget<PAYLOAD extends BaseListPayloadShape> {\n subscribe(observer: Observer<PAYLOAD>): Subscription;\n registerFetchPageSize(viewId: string, pageSize: number): void;\n unregisterFetchPageSize(viewId: string): void;\n getLoadedCount(): number;\n hasMorePages(): boolean;\n notifySubscribers(): void;\n fetchMore(): Promise<void>;\n}\n\n/**\n * A view into a shared ListQuery cache.\n *\n * Each subscriber gets their own View instance that tracks how much of the\n * shared cache they want to see (viewLimit). This allows multiple components\n * with different pageSize requirements to share the same underlying cache.\n *\n * The View:\n * - Slices the shared data to the subscriber's viewLimit\n * - Provides a fetchMore that increments viewLimit and fetches if needed\n * - Reports hasMore based on both local viewLimit and server pagination\n */\nlet viewIdCounter = 0;\n\nexport class ListQueryView<PAYLOAD extends BaseListPayloadShape> {\n #query: ListQueryViewTarget<PAYLOAD>;\n #viewLimit: number;\n #pageSize: number;\n #viewId: string;\n #hasAutoFetch: boolean;\n #fetchMore: () => Promise<void>;\n #pendingFetchMore: Promise<void> | undefined;\n #lastPayload: PAYLOAD | undefined;\n #observer: Observer<PAYLOAD> | undefined;\n\n constructor(\n query: ListQueryViewTarget<PAYLOAD>,\n pageSize: number,\n autoFetchMore?: boolean | number,\n ) {\n this.#query = query;\n this.#pageSize = pageSize;\n this.#viewId = `view_${++viewIdCounter}`;\n\n // With autoFetchMore, subscriber sees all loaded data (no view limit)\n // Otherwise, limit to their pageSize\n this.#hasAutoFetch = autoFetchMore === true\n || (typeof autoFetchMore === \"number\" && autoFetchMore > 0);\n this.#viewLimit = this.#hasAutoFetch ? Number.MAX_SAFE_INTEGER : pageSize;\n\n // Memoize fetchMore to maintain stable function identity\n this.#fetchMore = this.#createFetchMore();\n\n // Tell the query to fetch with at least this pageSize\n query.registerFetchPageSize(this.#viewId, pageSize);\n }\n\n subscribe(observer: Observer<PAYLOAD>): Subscription {\n this.#observer = observer;\n const sub = this.#query.subscribe({\n next: (payload) => {\n this.#lastPayload = payload;\n observer.next?.(this.#transformPayload(payload));\n\n if (\n !this.#hasAutoFetch\n && payload.status === \"loaded\"\n && payload.resolvedList
|
|
1
|
+
{"version":3,"file":"ListQueryView.js","names":["viewIdCounter","ListQueryView","query","viewLimit","pageSize","viewId","hasAutoFetch","fetchMore","pendingFetchMore","lastPayload","observer","constructor","autoFetchMore","Number","MAX_SAFE_INTEGER","createFetchMore","registerFetchPageSize","subscribe","sub","next","payload","transformPayload","status","resolvedList","length","hasMorePages","error","err","complete","add","unregisterFetchPageSize","undefined","reEmitWithNewViewLimit","#reEmitWithNewViewLimit","#transformPayload","loadedCount","slice","hasMore","#createFetchMore","getLoadedCount","hasMoreOnServer","finally","Promise","resolve"],"sources":["ListQueryView.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 { Subscription } from \"rxjs\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { BaseListPayloadShape } from \"./base-list/BaseListQuery.js\";\n\n/**\n * Interface for the query methods that ListQueryView needs.\n * This allows ListQueryView to work with any query that supports these operations.\n */\nexport interface ListQueryViewTarget<PAYLOAD extends BaseListPayloadShape> {\n subscribe(observer: Observer<PAYLOAD>): Subscription;\n registerFetchPageSize(viewId: string, pageSize: number): void;\n unregisterFetchPageSize(viewId: string): void;\n getLoadedCount(): number;\n hasMorePages(): boolean;\n notifySubscribers(): void;\n fetchMore(): Promise<void>;\n}\n\n/**\n * A view into a shared ListQuery cache.\n *\n * Each subscriber gets their own View instance that tracks how much of the\n * shared cache they want to see (viewLimit). This allows multiple components\n * with different pageSize requirements to share the same underlying cache.\n *\n * The View:\n * - Slices the shared data to the subscriber's viewLimit\n * - Provides a fetchMore that increments viewLimit and fetches if needed\n * - Reports hasMore based on both local viewLimit and server pagination\n */\nlet viewIdCounter = 0;\n\nexport class ListQueryView<PAYLOAD extends BaseListPayloadShape> {\n #query: ListQueryViewTarget<PAYLOAD>;\n #viewLimit: number;\n #pageSize: number;\n #viewId: string;\n #hasAutoFetch: boolean;\n #fetchMore: () => Promise<void>;\n #pendingFetchMore: Promise<void> | undefined;\n #lastPayload: PAYLOAD | undefined;\n #observer: Observer<PAYLOAD> | undefined;\n\n constructor(\n query: ListQueryViewTarget<PAYLOAD>,\n pageSize: number,\n autoFetchMore?: boolean | number,\n ) {\n this.#query = query;\n this.#pageSize = pageSize;\n this.#viewId = `view_${++viewIdCounter}`;\n\n // With autoFetchMore, subscriber sees all loaded data (no view limit)\n // Otherwise, limit to their pageSize\n this.#hasAutoFetch = autoFetchMore === true\n || (typeof autoFetchMore === \"number\" && autoFetchMore > 0);\n this.#viewLimit = this.#hasAutoFetch ? Number.MAX_SAFE_INTEGER : pageSize;\n\n // Memoize fetchMore to maintain stable function identity\n this.#fetchMore = this.#createFetchMore();\n\n // Tell the query to fetch with at least this pageSize\n query.registerFetchPageSize(this.#viewId, pageSize);\n }\n\n subscribe(observer: Observer<PAYLOAD>): Subscription {\n this.#observer = observer;\n const sub = this.#query.subscribe({\n next: (payload) => {\n this.#lastPayload = payload;\n observer.next?.(this.#transformPayload(payload));\n\n if (\n !this.#hasAutoFetch\n && payload.status === \"loaded\"\n && (payload.resolvedList?.length ?? 0) < this.#viewLimit\n && this.#query.hasMorePages()\n ) {\n void this.#query.fetchMore();\n }\n },\n error: (err) => observer.error?.(err),\n complete: () => observer.complete?.(),\n });\n\n // Cleanup: unregister pageSize when subscriber unsubscribes\n sub.add(() => {\n this.#query.unregisterFetchPageSize(this.#viewId);\n this.#observer = undefined;\n this.#lastPayload = undefined;\n });\n\n return sub;\n }\n\n #reEmitWithNewViewLimit(): void {\n if (this.#lastPayload && this.#observer) {\n this.#observer.next?.(this.#transformPayload(this.#lastPayload));\n }\n }\n\n #transformPayload(payload: PAYLOAD): PAYLOAD {\n const resolvedList = payload.resolvedList;\n const loadedCount = resolvedList?.length ?? 0;\n\n return {\n ...payload,\n resolvedList: resolvedList?.slice(0, this.#viewLimit),\n hasMore: this.#viewLimit < loadedCount || payload.hasMore,\n fetchMore: this.#fetchMore,\n status: loadedCount >= this.#viewLimit && payload.status === \"loading\"\n ? \"loaded\"\n : payload.status,\n };\n }\n\n #createFetchMore(): () => Promise<void> {\n return () => {\n if (this.#pendingFetchMore) {\n return this.#pendingFetchMore;\n }\n\n this.#viewLimit += this.#pageSize;\n\n const loadedCount = this.#query.getLoadedCount();\n const hasMoreOnServer = this.#query.hasMorePages();\n\n if (this.#viewLimit > loadedCount && hasMoreOnServer) {\n // Need to fetch more data from server\n this.#pendingFetchMore = this.#query.fetchMore().finally(() => {\n this.#pendingFetchMore = undefined;\n });\n return this.#pendingFetchMore;\n }\n\n // We have enough data in cache, just re-emit with new viewLimit (sync)\n this.#reEmitWithNewViewLimit();\n return Promise.resolve();\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,aAAa,GAAG,CAAC;AAErB,OAAO,MAAMC,aAAa,CAAuC;EAC/D,CAACC,KAAK;EACN,CAACC,SAAS;EACV,CAACC,QAAQ;EACT,CAACC,MAAM;EACP,CAACC,YAAY;EACb,CAACC,SAAS;EACV,CAACC,gBAAgB;EACjB,CAACC,WAAW;EACZ,CAACC,QAAQ;EAETC,WAAWA,CACTT,KAAmC,EACnCE,QAAgB,EAChBQ,aAAgC,EAChC;IACA,IAAI,CAAC,CAACV,KAAK,GAAGA,KAAK;IACnB,IAAI,CAAC,CAACE,QAAQ,GAAGA,QAAQ;IACzB,IAAI,CAAC,CAACC,MAAM,GAAG,QAAQ,EAAEL,aAAa,EAAE;;IAExC;IACA;IACA,IAAI,CAAC,CAACM,YAAY,GAAGM,aAAa,KAAK,IAAI,IACrC,OAAOA,aAAa,KAAK,QAAQ,IAAIA,aAAa,GAAG,CAAE;IAC7D,IAAI,CAAC,CAACT,SAAS,GAAG,IAAI,CAAC,CAACG,YAAY,GAAGO,MAAM,CAACC,gBAAgB,GAAGV,QAAQ;;IAEzE;IACA,IAAI,CAAC,CAACG,SAAS,GAAG,IAAI,CAAC,CAACQ,eAAe,CAAC,CAAC;;IAEzC;IACAb,KAAK,CAACc,qBAAqB,CAAC,IAAI,CAAC,CAACX,MAAM,EAAED,QAAQ,CAAC;EACrD;EAEAa,SAASA,CAACP,QAA2B,EAAgB;IACnD,IAAI,CAAC,CAACA,QAAQ,GAAGA,QAAQ;IACzB,MAAMQ,GAAG,GAAG,IAAI,CAAC,CAAChB,KAAK,CAACe,SAAS,CAAC;MAChCE,IAAI,EAAGC,OAAO,IAAK;QACjB,IAAI,CAAC,CAACX,WAAW,GAAGW,OAAO;QAC3BV,QAAQ,CAACS,IAAI,GAAG,IAAI,CAAC,CAACE,gBAAgB,CAACD,OAAO,CAAC,CAAC;QAEhD,IACE,CAAC,IAAI,CAAC,CAACd,YAAY,IAChBc,OAAO,CAACE,MAAM,KAAK,QAAQ,IAC3B,CAACF,OAAO,CAACG,YAAY,EAAEC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,CAACrB,SAAS,IACrD,IAAI,CAAC,CAACD,KAAK,CAACuB,YAAY,CAAC,CAAC,EAC7B;UACA,KAAK,IAAI,CAAC,CAACvB,KAAK,CAACK,SAAS,CAAC,CAAC;QAC9B;MACF,CAAC;MACDmB,KAAK,EAAGC,GAAG,IAAKjB,QAAQ,CAACgB,KAAK,GAAGC,GAAG,CAAC;MACrCC,QAAQ,EAAEA,CAAA,KAAMlB,QAAQ,CAACkB,QAAQ,GAAG;IACtC,CAAC,CAAC;;IAEF;IACAV,GAAG,CAACW,GAAG,CAAC,MAAM;MACZ,IAAI,CAAC,CAAC3B,KAAK,CAAC4B,uBAAuB,CAAC,IAAI,CAAC,CAACzB,MAAM,CAAC;MACjD,IAAI,CAAC,CAACK,QAAQ,GAAGqB,SAAS;MAC1B,IAAI,CAAC,CAACtB,WAAW,GAAGsB,SAAS;IAC/B,CAAC,CAAC;IAEF,OAAOb,GAAG;EACZ;EAEA,CAACc,sBAAsBC,CAAA,EAAS;IAC9B,IAAI,IAAI,CAAC,CAACxB,WAAW,IAAI,IAAI,CAAC,CAACC,QAAQ,EAAE;MACvC,IAAI,CAAC,CAACA,QAAQ,CAACS,IAAI,GAAG,IAAI,CAAC,CAACE,gBAAgB,CAAC,IAAI,CAAC,CAACZ,WAAW,CAAC,CAAC;IAClE;EACF;EAEA,CAACY,gBAAgBa,CAACd,OAAgB,EAAW;IAC3C,MAAMG,YAAY,GAAGH,OAAO,CAACG,YAAY;IACzC,MAAMY,WAAW,GAAGZ,YAAY,EAAEC,MAAM,IAAI,CAAC;IAE7C,OAAO;MACL,GAAGJ,OAAO;MACVG,YAAY,EAAEA,YAAY,EAAEa,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAACjC,SAAS,CAAC;MACrDkC,OAAO,EAAE,IAAI,CAAC,CAAClC,SAAS,GAAGgC,WAAW,IAAIf,OAAO,CAACiB,OAAO;MACzD9B,SAAS,EAAE,IAAI,CAAC,CAACA,SAAS;MAC1Be,MAAM,EAAEa,WAAW,IAAI,IAAI,CAAC,CAAChC,SAAS,IAAIiB,OAAO,CAACE,MAAM,KAAK,SAAS,GAClE,QAAQ,GACRF,OAAO,CAACE;IACd,CAAC;EACH;EAEA,CAACP,eAAeuB,CAAA,EAAwB;IACtC,OAAO,MAAM;MACX,IAAI,IAAI,CAAC,CAAC9B,gBAAgB,EAAE;QAC1B,OAAO,IAAI,CAAC,CAACA,gBAAgB;MAC/B;MAEA,IAAI,CAAC,CAACL,SAAS,IAAI,IAAI,CAAC,CAACC,QAAQ;MAEjC,MAAM+B,WAAW,GAAG,IAAI,CAAC,CAACjC,KAAK,CAACqC,cAAc,CAAC,CAAC;MAChD,MAAMC,eAAe,GAAG,IAAI,CAAC,CAACtC,KAAK,CAACuB,YAAY,CAAC,CAAC;MAElD,IAAI,IAAI,CAAC,CAACtB,SAAS,GAAGgC,WAAW,IAAIK,eAAe,EAAE;QACpD;QACA,IAAI,CAAC,CAAChC,gBAAgB,GAAG,IAAI,CAAC,CAACN,KAAK,CAACK,SAAS,CAAC,CAAC,CAACkC,OAAO,CAAC,MAAM;UAC7D,IAAI,CAAC,CAACjC,gBAAgB,GAAGuB,SAAS;QACpC,CAAC,CAAC;QACF,OAAO,IAAI,CAAC,CAACvB,gBAAgB;MAC/B;;MAEA;MACA,IAAI,CAAC,CAACwB,sBAAsB,CAAC,CAAC;MAC9B,OAAOU,OAAO,CAACC,OAAO,CAAC,CAAC;IAC1B,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -159,7 +159,7 @@ function observeMultiLinks(store, objectsArray, linkName, options, observer) {
|
|
|
159
159
|
let hasMore = false;
|
|
160
160
|
let isOptimistic = false;
|
|
161
161
|
for (const payload of perObjectResults.values()) {
|
|
162
|
-
for (const obj of payload.resolvedList) {
|
|
162
|
+
for (const obj of payload.resolvedList ?? []) {
|
|
163
163
|
seen.set(`${obj.$objectType}:${obj.$primaryKey}`, obj);
|
|
164
164
|
}
|
|
165
165
|
if (payload.lastUpdated > latestUpdated) {
|