@osdk/client 2.5.0-beta.6 → 2.5.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/browser/observable/internal/AbstractHelper.js +4 -1
- package/build/browser/observable/internal/AbstractHelper.js.map +1 -1
- package/build/browser/observable/internal/Query.js +29 -3
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/QuerySubscription.js +7 -0
- package/build/browser/observable/internal/QuerySubscription.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{chunk-4GWXMQZE.cjs → chunk-BY2PQEYA.cjs} +4 -4
- package/build/cjs/{chunk-4GWXMQZE.cjs.map → chunk-BY2PQEYA.cjs.map} +1 -1
- package/build/cjs/index.cjs +6 -6
- package/build/cjs/public/unstable-do-not-use.cjs +42 -8
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/observable/internal/AbstractHelper.js +4 -1
- package/build/esm/observable/internal/AbstractHelper.js.map +1 -1
- package/build/esm/observable/internal/Query.js +29 -3
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/QuerySubscription.js +7 -0
- package/build/esm/observable/internal/QuerySubscription.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/observable/internal/AbstractHelper.d.ts.map +1 -1
- package/build/types/observable/internal/Query.d.ts +12 -0
- package/build/types/observable/internal/Query.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.5.0-beta.7
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ab29baa: make dedupeIntervals dynamic
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @osdk/api@2.5.0-beta.7
|
|
12
|
+
- @osdk/client.unstable@2.5.0-beta.7
|
|
13
|
+
- @osdk/generator-converters@2.5.0-beta.7
|
|
14
|
+
|
|
3
15
|
## 2.5.0-beta.6
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -42,10 +42,13 @@ export class AbstractHelper {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
const sub = query.subscribe(subFn);
|
|
45
|
+
const querySub = new QuerySubscription(query, sub);
|
|
46
|
+
query.registerSubscriptionDedupeInterval(querySub.subscriptionId, options.dedupeInterval);
|
|
45
47
|
sub.add(() => {
|
|
48
|
+
query.unregisterSubscriptionDedupeInterval(querySub.subscriptionId);
|
|
46
49
|
this.store.cacheKeys.release(query.cacheKey);
|
|
47
50
|
});
|
|
48
|
-
return
|
|
51
|
+
return querySub;
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
//# sourceMappingURL=AbstractHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractHelper.js","names":["QuerySubscription","AbstractHelper","constructor","store","cacheKeys","observe","options","subFn","query","getQuery","_subscribe","retain","cacheKey","mode","revalidate","catch","e","error","logger","sub","subscribe","add","release"],"sources":["AbstractHelper.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 CommonObserveOptions,\n Observer,\n} from \"../ObservableClient/common.js\";\nimport type { CacheKeys } from \"./CacheKeys.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Query } from \"./Query.js\";\nimport { QuerySubscription } from \"./QuerySubscription.js\";\nimport type { Store } from \"./Store.js\";\n\nexport abstract class AbstractHelper<\n TQuery extends Query<KnownCacheKey, any, CommonObserveOptions>,\n TObserveOptions extends CommonObserveOptions,\n> {\n protected readonly store: Store;\n protected readonly cacheKeys: CacheKeys<KnownCacheKey>;\n\n constructor(store: Store, cacheKeys: CacheKeys<KnownCacheKey>) {\n this.store = store;\n this.cacheKeys = cacheKeys;\n }\n\n observe(\n options: TObserveOptions,\n subFn: Observer<\n TQuery extends Query<any, infer PAYLOAD, any> ? PAYLOAD : never\n >,\n ): QuerySubscription<TQuery> {\n const query = this.getQuery(options);\n return this._subscribe(query, options, subFn);\n }\n\n abstract getQuery(options: TObserveOptions): TQuery;\n\n protected _subscribe(\n query: TQuery,\n options: TObserveOptions,\n subFn: Observer<\n TQuery extends Query<any, infer PAYLOAD, any> ? PAYLOAD : never\n >,\n ): QuerySubscription<TQuery> {\n // the ListQuery represents the shared state of the list\n this.store.cacheKeys.retain(query.cacheKey);\n\n if (options.mode !== \"offline\") {\n query.revalidate(options.mode === \"force\").catch((e: unknown) => {\n subFn.error(e);\n\n // we don't want observeObject() to return a promise,\n // so we settle for logging an error here instead of\n // dropping it on the floor.\n if (this.store.logger) {\n this.store.logger.error(\"Unhandled error in observeObject\", e);\n } else {\n throw e;\n }\n });\n }\n const sub = query.subscribe(subFn);\n sub.add(() => {\n this.store.cacheKeys.release(query.cacheKey);\n });\n\n return
|
|
1
|
+
{"version":3,"file":"AbstractHelper.js","names":["QuerySubscription","AbstractHelper","constructor","store","cacheKeys","observe","options","subFn","query","getQuery","_subscribe","retain","cacheKey","mode","revalidate","catch","e","error","logger","sub","subscribe","querySub","registerSubscriptionDedupeInterval","subscriptionId","dedupeInterval","add","unregisterSubscriptionDedupeInterval","release"],"sources":["AbstractHelper.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 CommonObserveOptions,\n Observer,\n} from \"../ObservableClient/common.js\";\nimport type { CacheKeys } from \"./CacheKeys.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Query } from \"./Query.js\";\nimport { QuerySubscription } from \"./QuerySubscription.js\";\nimport type { Store } from \"./Store.js\";\n\nexport abstract class AbstractHelper<\n TQuery extends Query<KnownCacheKey, any, CommonObserveOptions>,\n TObserveOptions extends CommonObserveOptions,\n> {\n protected readonly store: Store;\n protected readonly cacheKeys: CacheKeys<KnownCacheKey>;\n\n constructor(store: Store, cacheKeys: CacheKeys<KnownCacheKey>) {\n this.store = store;\n this.cacheKeys = cacheKeys;\n }\n\n observe(\n options: TObserveOptions,\n subFn: Observer<\n TQuery extends Query<any, infer PAYLOAD, any> ? PAYLOAD : never\n >,\n ): QuerySubscription<TQuery> {\n const query = this.getQuery(options);\n return this._subscribe(query, options, subFn);\n }\n\n abstract getQuery(options: TObserveOptions): TQuery;\n\n protected _subscribe(\n query: TQuery,\n options: TObserveOptions,\n subFn: Observer<\n TQuery extends Query<any, infer PAYLOAD, any> ? PAYLOAD : never\n >,\n ): QuerySubscription<TQuery> {\n // the ListQuery represents the shared state of the list\n this.store.cacheKeys.retain(query.cacheKey);\n\n if (options.mode !== \"offline\") {\n query.revalidate(options.mode === \"force\").catch((e: unknown) => {\n subFn.error(e);\n\n // we don't want observeObject() to return a promise,\n // so we settle for logging an error here instead of\n // dropping it on the floor.\n if (this.store.logger) {\n this.store.logger.error(\"Unhandled error in observeObject\", e);\n } else {\n throw e;\n }\n });\n }\n\n const sub = query.subscribe(subFn);\n const querySub = new QuerySubscription(query, sub);\n\n query.registerSubscriptionDedupeInterval(\n querySub.subscriptionId,\n (options as CommonObserveOptions).dedupeInterval,\n );\n\n sub.add(() => {\n query.unregisterSubscriptionDedupeInterval(querySub.subscriptionId);\n this.store.cacheKeys.release(query.cacheKey);\n });\n\n return querySub;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,iBAAiB,QAAQ,wBAAwB;AAG1D,OAAO,MAAeC,cAAc,CAGlC;EAIAC,WAAWA,CAACC,KAAY,EAAEC,SAAmC,EAAE;IAC7D,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC5B;EAEAC,OAAOA,CACLC,OAAwB,EACxBC,KAEC,EAC0B;IAC3B,MAAMC,KAAK,GAAG,IAAI,CAACC,QAAQ,CAACH,OAAO,CAAC;IACpC,OAAO,IAAI,CAACI,UAAU,CAACF,KAAK,EAAEF,OAAO,EAAEC,KAAK,CAAC;EAC/C;EAIUG,UAAUA,CAClBF,KAAa,EACbF,OAAwB,EACxBC,KAEC,EAC0B;IAC3B;IACA,IAAI,CAACJ,KAAK,CAACC,SAAS,CAACO,MAAM,CAACH,KAAK,CAACI,QAAQ,CAAC;IAE3C,IAAIN,OAAO,CAACO,IAAI,KAAK,SAAS,EAAE;MAC9BL,KAAK,CAACM,UAAU,CAACR,OAAO,CAACO,IAAI,KAAK,OAAO,CAAC,CAACE,KAAK,CAAEC,CAAU,IAAK;QAC/DT,KAAK,CAACU,KAAK,CAACD,CAAC,CAAC;;QAEd;QACA;QACA;QACA,IAAI,IAAI,CAACb,KAAK,CAACe,MAAM,EAAE;UACrB,IAAI,CAACf,KAAK,CAACe,MAAM,CAACD,KAAK,CAAC,kCAAkC,EAAED,CAAC,CAAC;QAChE,CAAC,MAAM;UACL,MAAMA,CAAC;QACT;MACF,CAAC,CAAC;IACJ;IAEA,MAAMG,GAAG,GAAGX,KAAK,CAACY,SAAS,CAACb,KAAK,CAAC;IAClC,MAAMc,QAAQ,GAAG,IAAIrB,iBAAiB,CAACQ,KAAK,EAAEW,GAAG,CAAC;IAElDX,KAAK,CAACc,kCAAkC,CACtCD,QAAQ,CAACE,cAAc,EACtBjB,OAAO,CAA0BkB,cACpC,CAAC;IAEDL,GAAG,CAACM,GAAG,CAAC,MAAM;MACZjB,KAAK,CAACkB,oCAAoC,CAACL,QAAQ,CAACE,cAAc,CAAC;MACnE,IAAI,CAACpB,KAAK,CAACC,SAAS,CAACuB,OAAO,CAACnB,KAAK,CAACI,QAAQ,CAAC;IAC9C,CAAC,CAAC;IAEF,OAAOS,QAAQ;EACjB;AACF","ignoreList":[]}
|
|
@@ -20,6 +20,7 @@ export class Query {
|
|
|
20
20
|
#connectable;
|
|
21
21
|
#subscription;
|
|
22
22
|
#subject;
|
|
23
|
+
#subscriptionDedupeIntervals = new Map();
|
|
23
24
|
|
|
24
25
|
/** @internal */
|
|
25
26
|
|
|
@@ -39,6 +40,32 @@ export class Query {
|
|
|
39
40
|
return this.#connectable.subscribe(observer);
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Register a subscription's dedupeInterval value
|
|
45
|
+
*/
|
|
46
|
+
registerSubscriptionDedupeInterval(subscriptionId, dedupeInterval) {
|
|
47
|
+
if (dedupeInterval != null && dedupeInterval > 0) {
|
|
48
|
+
this.#subscriptionDedupeIntervals.set(subscriptionId, dedupeInterval);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Unregister a subscription's dedupeInterval value
|
|
54
|
+
*/
|
|
55
|
+
unregisterSubscriptionDedupeInterval(subscriptionId) {
|
|
56
|
+
this.#subscriptionDedupeIntervals.delete(subscriptionId);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get the minimum dedupeInterval from all active subscriptions
|
|
61
|
+
*/
|
|
62
|
+
getMinimumDedupeInterval() {
|
|
63
|
+
if (this.#subscriptionDedupeIntervals.size === 0) {
|
|
64
|
+
return this.options.dedupeInterval ?? 0;
|
|
65
|
+
}
|
|
66
|
+
return Math.min(...this.#subscriptionDedupeIntervals.values());
|
|
67
|
+
}
|
|
68
|
+
|
|
42
69
|
/**
|
|
43
70
|
* Causes the query to revalidate. This will cause the query to fetch
|
|
44
71
|
* the latest data from the server and update the store if it is deemed
|
|
@@ -67,9 +94,8 @@ export class Query {
|
|
|
67
94
|
await this.pendingFetch;
|
|
68
95
|
return;
|
|
69
96
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if ((this.options.dedupeInterval ?? 0) > 0 && this.lastFetchStarted != null && Date.now() - this.lastFetchStarted < (this.options.dedupeInterval ?? 0)) {
|
|
97
|
+
const minDedupeInterval = this.getMinimumDedupeInterval();
|
|
98
|
+
if (minDedupeInterval > 0 && this.lastFetchStarted != null && Date.now() - this.lastFetchStarted < minDedupeInterval) {
|
|
73
99
|
if (process.env.NODE_ENV !== "production") {
|
|
74
100
|
logger?.debug("Within dupeInterval, aborting revalidate");
|
|
75
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.js","names":["additionalContext","Query","retainCount","connectable","subscription","subject","constructor","store","observable","opts","cacheKey","logger","options","cacheKeys","process","env","NODE_ENV","client","child","msgPrefix","type","otherKeys","map","x","JSON","stringify","join","subscribe","observer","_createConnectable","connect","revalidate","force","methodName","abortController","abort","pendingFetch","debug","dedupeInterval","lastFetchStarted","Date","now","Promise","resolve","batch","setStatus","_preFetch","_fetchAndStore","finally","undefined","status","existing","read","write","value","dispose","unsubscribe","_dispose"],"sources":["Query.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 { Logger } from \"@osdk/api\";\nimport type {\n Connectable,\n Observable,\n Observer,\n Subscribable,\n Subscription,\n} from \"rxjs\";\nimport { additionalContext } from \"../../Client.js\";\nimport type {\n CommonObserveOptions,\n Status,\n} from \"../ObservableClient/common.js\";\nimport type { BatchContext } from \"./BatchContext.js\";\nimport type { CacheKeys } from \"./CacheKeys.js\";\nimport type { Changes } from \"./Changes.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Entry } from \"./Layer.js\";\nimport type { OptimisticId } from \"./OptimisticId.js\";\nimport type { Store } from \"./Store.js\";\nimport type { SubjectPayload } from \"./SubjectPayload.js\";\n\nexport abstract class Query<\n KEY extends KnownCacheKey,\n PAYLOAD,\n O extends CommonObserveOptions,\n> implements Subscribable<PAYLOAD> {\n lastFetchStarted?: number;\n pendingFetch?: Promise<void>;\n retainCount: number = 0;\n options: O;\n cacheKey: KEY;\n store: Store;\n abortController?: AbortController;\n #connectable?: Connectable<PAYLOAD>;\n #subscription?: Subscription;\n #subject: Observable<SubjectPayload<KEY>>;\n\n /** @internal */\n protected logger: Logger | undefined;\n\n protected readonly cacheKeys: CacheKeys<KnownCacheKey>;\n\n constructor(\n store: Store,\n observable: Observable<SubjectPayload<KEY>>,\n opts: O,\n cacheKey: KEY,\n logger?: Logger,\n ) {\n this.options = opts;\n this.cacheKey = cacheKey;\n this.store = store;\n this.cacheKeys = store.cacheKeys;\n this.#subject = observable;\n\n this.logger = logger ?? (\n process.env.NODE_ENV === \"production\"\n ? store.client[additionalContext].logger\n : store.client[additionalContext].logger?.child({}, {\n msgPrefix: process.env.NODE_ENV !== \"production\"\n ? (`Query<${cacheKey.type}, ${\n cacheKey.otherKeys.map(x => JSON.stringify(x)).join(\", \")\n }>`)\n : \"Query\",\n })\n );\n }\n\n protected abstract _createConnectable(\n subject: Observable<SubjectPayload<KEY>>,\n ): Connectable<PAYLOAD>;\n\n public subscribe(\n observer: Observer<PAYLOAD>,\n ): Subscription {\n this.#connectable ??= this._createConnectable(this.#subject);\n this.#subscription = this.#connectable.connect();\n return this.#connectable.subscribe(observer);\n }\n\n /**\n * Causes the query to revalidate. This will cause the query to fetch\n * the latest data from the server and update the store if it is deemed\n * \"stale\" or if `force` is true.\n *\n * @param force\n * @returns\n */\n async revalidate(force?: boolean): Promise<void> {\n const logger = process.env.NODE_ENV !== \"production\"\n ? this.logger?.child({ methodName: \"revalidate\" })\n : this.logger;\n\n if (force) {\n this.abortController?.abort();\n }\n\n // n.b. I think this isn't quite right since we may require multiple\n // pages to properly \"revalidate\" for someone. This only really works if you\n // have a single page/object. It needs to be redone. FIXME\n\n // if we are pending the first page/object we can just ignore this\n if (this.pendingFetch) {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"Fetch is already pending, using it\");\n }\n await this.pendingFetch;\n return;\n }\n\n // FIXME: This gets set to the first value used\n if (\n (this.options.dedupeInterval ?? 0) > 0 && (\n this.lastFetchStarted != null\n && Date.now() - this.lastFetchStarted < (this.options.dedupeInterval\n ?? 0)\n )\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"Within dupeInterval, aborting revalidate\");\n }\n\n return Promise.resolve();\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"Starting actual revalidate\");\n }\n\n this.store.batch({}, (batch) => {\n // make sure the truth layer knows we are loading\n\n // this will not trigger an update to `changes` so it cannot trigger an\n // update of a list either. This may not be the behavior we want.\n this.setStatus(\"loading\", batch);\n });\n\n this._preFetch();\n\n this.lastFetchStarted = Date.now();\n\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"calling _fetchAndStore()\");\n }\n this.pendingFetch = this._fetchAndStore()\n .finally(() => {\n logger?.debug(\"promise's finally for _fetchAndStore()\");\n this.pendingFetch = undefined;\n });\n\n await this.pendingFetch;\n return;\n }\n\n protected _preFetch(): void {}\n\n protected abstract _fetchAndStore(): Promise<void>;\n\n /**\n * Sets the status of the query in the store (but does not store that in `changes`).\n *\n * @param status\n * @param batch\n * @returns\n */\n setStatus(\n status: Status,\n batch: BatchContext,\n ): void {\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"setStatus\" }).debug(\n `Attempting to set status to '${status}'`,\n );\n }\n const existing = batch.read(this.cacheKey);\n if (existing?.status === status) {\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"setStatus\" }).debug(\n `Status is already set to '${status}'; aborting`,\n );\n }\n return;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"setStatus\" }).debug(\n `Writing status '${status}' to cache`,\n );\n }\n batch.write(this.cacheKey, existing?.value, status);\n }\n\n dispose(): void {\n if (this.abortController) {\n this.abortController.abort();\n }\n this.#subscription?.unsubscribe();\n this._dispose();\n }\n\n /**\n * Per query type dispose functionality\n */\n protected _dispose(): void {}\n\n /**\n * The purpose of this method is to provide a way for others to write\n * directly into the store for this query.\n *\n * @param data\n * @param status\n * @param batch\n */\n abstract writeToStore(\n data: KEY[\"__cacheKey\"][\"value\"],\n status: Status,\n batch: BatchContext,\n ): Entry<KEY>;\n\n /**\n * @param changes\n * @param optimisticId\n * @returns If revalidation is needed, a promise that resolves after the\n * revalidation is complete. Otherwise, undefined.\n */\n maybeUpdateAndRevalidate?: (\n changes: Changes,\n optimisticId: OptimisticId | undefined,\n ) => Promise<void> | undefined;\n\n abstract invalidateObjectType(\n objectType: string,\n changes: Changes | undefined,\n ): Promise<void>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,iBAAiB,QAAQ,iBAAiB;AAcnD,OAAO,MAAeC,KAAK,CAIQ;EAGjCC,WAAW,GAAW,CAAC;EAKvB,CAACC,WAAW;E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AK,CAAC,IAAI,CAAC3C,QAAQ,EAAEyC,QAAQ,EAAEG,KAAK,EAAEJ,MAAM,CAAC;EACrD;EAEAK,OAAOA,CAAA,EAAS;IACd,IAAI,IAAI,CAACrB,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,CAACC,KAAK,CAAC,CAAC;IAC9B;IACA,IAAI,CAAC,CAAC/B,YAAY,EAAEoD,WAAW,CAAC,CAAC;IACjC,IAAI,CAACC,QAAQ,CAAC,CAAC;EACjB;;EAEA;AACF;AACA;EACYA,QAAQA,CAAA,EAAS,CAAC;;EAE5B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAOE;AACF;AACA;AACA;AACA;AACA;AAUA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Query.js","names":["additionalContext","Query","retainCount","connectable","subscription","subject","subscriptionDedupeIntervals","Map","constructor","store","observable","opts","cacheKey","logger","options","cacheKeys","process","env","NODE_ENV","client","child","msgPrefix","type","otherKeys","map","x","JSON","stringify","join","subscribe","observer","_createConnectable","connect","registerSubscriptionDedupeInterval","subscriptionId","dedupeInterval","set","unregisterSubscriptionDedupeInterval","delete","getMinimumDedupeInterval","size","Math","min","values","revalidate","force","methodName","abortController","abort","pendingFetch","debug","minDedupeInterval","lastFetchStarted","Date","now","Promise","resolve","batch","setStatus","_preFetch","_fetchAndStore","finally","undefined","status","existing","read","write","value","dispose","unsubscribe","_dispose"],"sources":["Query.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 { Logger } from \"@osdk/api\";\nimport type {\n Connectable,\n Observable,\n Observer,\n Subscribable,\n Subscription,\n} from \"rxjs\";\nimport { additionalContext } from \"../../Client.js\";\nimport type {\n CommonObserveOptions,\n Status,\n} from \"../ObservableClient/common.js\";\nimport type { BatchContext } from \"./BatchContext.js\";\nimport type { CacheKeys } from \"./CacheKeys.js\";\nimport type { Changes } from \"./Changes.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Entry } from \"./Layer.js\";\nimport type { OptimisticId } from \"./OptimisticId.js\";\nimport type { Store } from \"./Store.js\";\nimport type { SubjectPayload } from \"./SubjectPayload.js\";\n\nexport abstract class Query<\n KEY extends KnownCacheKey,\n PAYLOAD,\n O extends CommonObserveOptions,\n> implements Subscribable<PAYLOAD> {\n lastFetchStarted?: number;\n pendingFetch?: Promise<void>;\n retainCount: number = 0;\n options: O;\n cacheKey: KEY;\n store: Store;\n abortController?: AbortController;\n #connectable?: Connectable<PAYLOAD>;\n #subscription?: Subscription;\n #subject: Observable<SubjectPayload<KEY>>;\n #subscriptionDedupeIntervals: Map<string, number> = new Map();\n\n /** @internal */\n protected logger: Logger | undefined;\n\n protected readonly cacheKeys: CacheKeys<KnownCacheKey>;\n\n constructor(\n store: Store,\n observable: Observable<SubjectPayload<KEY>>,\n opts: O,\n cacheKey: KEY,\n logger?: Logger,\n ) {\n this.options = opts;\n this.cacheKey = cacheKey;\n this.store = store;\n this.cacheKeys = store.cacheKeys;\n this.#subject = observable;\n\n this.logger = logger ?? (\n process.env.NODE_ENV === \"production\"\n ? store.client[additionalContext].logger\n : store.client[additionalContext].logger?.child({}, {\n msgPrefix: process.env.NODE_ENV !== \"production\"\n ? (`Query<${cacheKey.type}, ${\n cacheKey.otherKeys.map(x => JSON.stringify(x)).join(\", \")\n }>`)\n : \"Query\",\n })\n );\n }\n\n protected abstract _createConnectable(\n subject: Observable<SubjectPayload<KEY>>,\n ): Connectable<PAYLOAD>;\n\n public subscribe(\n observer: Observer<PAYLOAD>,\n ): Subscription {\n this.#connectable ??= this._createConnectable(this.#subject);\n this.#subscription = this.#connectable.connect();\n return this.#connectable.subscribe(observer);\n }\n\n /**\n * Register a subscription's dedupeInterval value\n */\n registerSubscriptionDedupeInterval(\n subscriptionId: string,\n dedupeInterval: number | undefined,\n ): void {\n if (dedupeInterval != null && dedupeInterval > 0) {\n this.#subscriptionDedupeIntervals.set(subscriptionId, dedupeInterval);\n }\n }\n\n /**\n * Unregister a subscription's dedupeInterval value\n */\n unregisterSubscriptionDedupeInterval(subscriptionId: string): void {\n this.#subscriptionDedupeIntervals.delete(subscriptionId);\n }\n\n /**\n * Get the minimum dedupeInterval from all active subscriptions\n */\n private getMinimumDedupeInterval(): number {\n if (this.#subscriptionDedupeIntervals.size === 0) {\n return this.options.dedupeInterval ?? 0;\n }\n\n return Math.min(...this.#subscriptionDedupeIntervals.values());\n }\n\n /**\n * Causes the query to revalidate. This will cause the query to fetch\n * the latest data from the server and update the store if it is deemed\n * \"stale\" or if `force` is true.\n *\n * @param force\n * @returns\n */\n async revalidate(force?: boolean): Promise<void> {\n const logger = process.env.NODE_ENV !== \"production\"\n ? this.logger?.child({ methodName: \"revalidate\" })\n : this.logger;\n\n if (force) {\n this.abortController?.abort();\n }\n\n // n.b. I think this isn't quite right since we may require multiple\n // pages to properly \"revalidate\" for someone. This only really works if you\n // have a single page/object. It needs to be redone. FIXME\n\n // if we are pending the first page/object we can just ignore this\n if (this.pendingFetch) {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"Fetch is already pending, using it\");\n }\n await this.pendingFetch;\n return;\n }\n\n const minDedupeInterval = this.getMinimumDedupeInterval();\n if (\n minDedupeInterval > 0 && (\n this.lastFetchStarted != null\n && Date.now() - this.lastFetchStarted < minDedupeInterval\n )\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"Within dupeInterval, aborting revalidate\");\n }\n\n return Promise.resolve();\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"Starting actual revalidate\");\n }\n\n this.store.batch({}, (batch) => {\n // make sure the truth layer knows we are loading\n\n // this will not trigger an update to `changes` so it cannot trigger an\n // update of a list either. This may not be the behavior we want.\n this.setStatus(\"loading\", batch);\n });\n\n this._preFetch();\n\n this.lastFetchStarted = Date.now();\n\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"calling _fetchAndStore()\");\n }\n this.pendingFetch = this._fetchAndStore()\n .finally(() => {\n logger?.debug(\"promise's finally for _fetchAndStore()\");\n this.pendingFetch = undefined;\n });\n\n await this.pendingFetch;\n return;\n }\n\n protected _preFetch(): void {}\n\n protected abstract _fetchAndStore(): Promise<void>;\n\n /**\n * Sets the status of the query in the store (but does not store that in `changes`).\n *\n * @param status\n * @param batch\n * @returns\n */\n setStatus(\n status: Status,\n batch: BatchContext,\n ): void {\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"setStatus\" }).debug(\n `Attempting to set status to '${status}'`,\n );\n }\n const existing = batch.read(this.cacheKey);\n if (existing?.status === status) {\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"setStatus\" }).debug(\n `Status is already set to '${status}'; aborting`,\n );\n }\n return;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"setStatus\" }).debug(\n `Writing status '${status}' to cache`,\n );\n }\n batch.write(this.cacheKey, existing?.value, status);\n }\n\n dispose(): void {\n if (this.abortController) {\n this.abortController.abort();\n }\n this.#subscription?.unsubscribe();\n this._dispose();\n }\n\n /**\n * Per query type dispose functionality\n */\n protected _dispose(): void {}\n\n /**\n * The purpose of this method is to provide a way for others to write\n * directly into the store for this query.\n *\n * @param data\n * @param status\n * @param batch\n */\n abstract writeToStore(\n data: KEY[\"__cacheKey\"][\"value\"],\n status: Status,\n batch: BatchContext,\n ): Entry<KEY>;\n\n /**\n * @param changes\n * @param optimisticId\n * @returns If revalidation is needed, a promise that resolves after the\n * revalidation is complete. Otherwise, undefined.\n */\n maybeUpdateAndRevalidate?: (\n changes: Changes,\n optimisticId: OptimisticId | undefined,\n ) => Promise<void> | undefined;\n\n abstract invalidateObjectType(\n objectType: string,\n changes: Changes | undefined,\n ): Promise<void>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,iBAAiB,QAAQ,iBAAiB;AAcnD,OAAO,MAAeC,KAAK,CAIQ;EAGjCC,WAAW,GAAW,CAAC;EAKvB,CAACC,WAAW;EACZ,CAACC,YAAY;EACb,CAACC,OAAO;EACR,CAACC,2BAA2B,GAAwB,IAAIC,GAAG,CAAC,CAAC;;EAE7D;;EAKAC,WAAWA,CACTC,KAAY,EACZC,UAA2C,EAC3CC,IAAO,EACPC,QAAa,EACbC,MAAe,EACf;IACA,IAAI,CAACC,OAAO,GAAGH,IAAI;IACnB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACH,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACM,SAAS,GAAGN,KAAK,CAACM,SAAS;IAChC,IAAI,CAAC,CAACV,OAAO,GAAGK,UAAU;IAE1B,IAAI,CAACG,MAAM,GAAGA,MAAM,KAClBG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GACjCT,KAAK,CAACU,MAAM,CAACnB,iBAAiB,CAAC,CAACa,MAAM,GACtCJ,KAAK,CAACU,MAAM,CAACnB,iBAAiB,CAAC,CAACa,MAAM,EAAEO,KAAK,CAAC,CAAC,CAAC,EAAE;MAClDC,SAAS,EAAEL,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GAC3C,SAASN,QAAQ,CAACU,IAAI,KACvBV,QAAQ,CAACW,SAAS,CAACC,GAAG,CAACC,CAAC,IAAIC,IAAI,CAACC,SAAS,CAACF,CAAC,CAAC,CAAC,CAACG,IAAI,CAAC,IAAI,CAAC,GACxD,GACD;IACN,CAAC,CAAC,CACL;EACH;EAMOC,SAASA,CACdC,QAA2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,CAAC;IACjC,IAAI,CAACC,QAAQ,CAAC,CAAC;EACjB;;EAEA;AACF;AACA;EACYA,QAAQA,CAAA,EAAS,CAAC;;EAE5B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAOE;AACF;AACA;AACA;AACA;AACA;AAUA","ignoreList":[]}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { UnsubscribableWrapper } from "./UnsubscribableWrapper.js";
|
|
18
|
+
let subscriptionIdCounter = 0;
|
|
18
19
|
|
|
19
20
|
/** @internal */
|
|
20
21
|
export class QuerySubscription extends UnsubscribableWrapper {
|
|
@@ -22,10 +23,13 @@ export class QuerySubscription extends UnsubscribableWrapper {
|
|
|
22
23
|
|
|
23
24
|
/** @internal */
|
|
24
25
|
|
|
26
|
+
/** @internal */
|
|
27
|
+
|
|
25
28
|
constructor(query, subscription) {
|
|
26
29
|
super(subscription);
|
|
27
30
|
this.query = query;
|
|
28
31
|
this.subscription = subscription;
|
|
32
|
+
this.subscriptionId = `sub_${++subscriptionIdCounter}`;
|
|
29
33
|
|
|
30
34
|
// hide these from introspection
|
|
31
35
|
Object.defineProperties(this, {
|
|
@@ -34,6 +38,9 @@ export class QuerySubscription extends UnsubscribableWrapper {
|
|
|
34
38
|
},
|
|
35
39
|
subscription: {
|
|
36
40
|
enumerable: false
|
|
41
|
+
},
|
|
42
|
+
subscriptionId: {
|
|
43
|
+
enumerable: false
|
|
37
44
|
}
|
|
38
45
|
});
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuerySubscription.js","names":["UnsubscribableWrapper","QuerySubscription","constructor","query","subscription","Object","defineProperties","enumerable"],"sources":["QuerySubscription.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 {\n CommonObserveOptions,\n ObserveOptions,\n} from \"../ObservableClient/common.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Query } from \"./Query.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\n/** @internal */\nexport class QuerySubscription<\n TQuery extends Query<\n KnownCacheKey,\n unknown,\n CommonObserveOptions & ObserveOptions\n >,\n> extends UnsubscribableWrapper {\n /** @internal */\n query: TQuery;\n\n /** @internal */\n subscription: Subscription;\n\n constructor(query: TQuery, subscription: Subscription) {\n super(subscription);\n this.query = query;\n this.subscription = subscription;\n\n // hide these from introspection\n Object.defineProperties(this, {\n query: { enumerable: false },\n subscription: { enumerable: false },\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,qBAAqB,QAAQ,4BAA4B;;
|
|
1
|
+
{"version":3,"file":"QuerySubscription.js","names":["UnsubscribableWrapper","subscriptionIdCounter","QuerySubscription","constructor","query","subscription","subscriptionId","Object","defineProperties","enumerable"],"sources":["QuerySubscription.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 {\n CommonObserveOptions,\n ObserveOptions,\n} from \"../ObservableClient/common.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Query } from \"./Query.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\nlet subscriptionIdCounter = 0;\n\n/** @internal */\nexport class QuerySubscription<\n TQuery extends Query<\n KnownCacheKey,\n unknown,\n CommonObserveOptions & ObserveOptions\n >,\n> extends UnsubscribableWrapper {\n /** @internal */\n query: TQuery;\n\n /** @internal */\n subscription: Subscription;\n\n /** @internal */\n subscriptionId: string;\n\n constructor(query: TQuery, subscription: Subscription) {\n super(subscription);\n this.query = query;\n this.subscription = subscription;\n this.subscriptionId = `sub_${++subscriptionIdCounter}`;\n\n // hide these from introspection\n Object.defineProperties(this, {\n query: { enumerable: false },\n subscription: { enumerable: false },\n subscriptionId: { enumerable: false },\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,qBAAqB,QAAQ,4BAA4B;AAElE,IAAIC,qBAAqB,GAAG,CAAC;;AAE7B;AACA,OAAO,MAAMC,iBAAiB,SAMpBF,qBAAqB,CAAC;EAC9B;;EAGA;;EAGA;;EAGAG,WAAWA,CAACC,KAAa,EAAEC,YAA0B,EAAE;IACrD,KAAK,CAACA,YAAY,CAAC;IACnB,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,cAAc,GAAG,OAAO,EAAEL,qBAAqB,EAAE;;IAEtD;IACAM,MAAM,CAACC,gBAAgB,CAAC,IAAI,EAAE;MAC5BJ,KAAK,EAAE;QAAEK,UAAU,EAAE;MAAM,CAAC;MAC5BJ,YAAY,EAAE;QAAEI,UAAU,EAAE;MAAM,CAAC;MACnCH,cAAc,EAAE;QAAEG,UAAU,EAAE;MAAM;IACtC,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export const USER_AGENT = `osdk-client/${"2.5.0-beta.
|
|
18
|
-
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.5.0-beta.
|
|
17
|
+
export const USER_AGENT = `osdk-client/${"2.5.0-beta.7"}`;
|
|
18
|
+
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.5.0-beta.7"}`;
|
|
19
19
|
//# sourceMappingURL=UserAgent.js.map
|
|
@@ -1395,8 +1395,8 @@ var createStandardOntologyProviderFactory = (client) => {
|
|
|
1395
1395
|
};
|
|
1396
1396
|
|
|
1397
1397
|
// src/util/UserAgent.ts
|
|
1398
|
-
var USER_AGENT = `osdk-client/${"2.5.0-beta.
|
|
1399
|
-
var OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.5.0-beta.
|
|
1398
|
+
var USER_AGENT = `osdk-client/${"2.5.0-beta.7"}`;
|
|
1399
|
+
var OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.5.0-beta.7"}`;
|
|
1400
1400
|
|
|
1401
1401
|
// src/createMinimalClient.ts
|
|
1402
1402
|
function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = chunk5KDG5ZET_cjs.createObjectSet, createOntologyProviderFactory = createStandardOntologyProviderFactory) {
|
|
@@ -1918,5 +1918,5 @@ exports.createClient = createClient;
|
|
|
1918
1918
|
exports.createClientFromContext = createClientFromContext;
|
|
1919
1919
|
exports.createClientWithTransaction = createClientWithTransaction;
|
|
1920
1920
|
exports.createObjectSpecifierFromPrimaryKey = createObjectSpecifierFromPrimaryKey;
|
|
1921
|
-
//# sourceMappingURL=chunk-
|
|
1922
|
-
//# sourceMappingURL=chunk-
|
|
1921
|
+
//# sourceMappingURL=chunk-BY2PQEYA.cjs.map
|
|
1922
|
+
//# sourceMappingURL=chunk-BY2PQEYA.cjs.map
|