@osdk/react 0.14.0 → 0.14.1-main-5835d51d99a51882d5cb42d4e9bf5b5fbe4f6bca

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/browser/new/shapes/derivedLinksStore.js +359 -0
  3. package/build/browser/new/shapes/derivedLinksStore.js.map +1 -0
  4. package/build/browser/new/shapes/index.js +18 -0
  5. package/build/browser/new/shapes/index.js.map +1 -0
  6. package/build/browser/new/shapes/types.js +96 -0
  7. package/build/browser/new/shapes/types.js.map +1 -0
  8. package/build/browser/new/shapes/useShape.js +23 -0
  9. package/build/browser/new/shapes/useShape.js.map +1 -0
  10. package/build/browser/new/shared/storeUtils.js +71 -0
  11. package/build/browser/new/shared/storeUtils.js.map +1 -0
  12. package/build/browser/util/UserAgent.js +1 -1
  13. package/build/browser/util/UserAgent.js.map +1 -1
  14. package/build/cjs/public/experimental.cjs +1 -1
  15. package/build/cjs/public/experimental.cjs.map +1 -1
  16. package/build/esm/new/shapes/derivedLinksStore.js +359 -0
  17. package/build/esm/new/shapes/derivedLinksStore.js.map +1 -0
  18. package/build/esm/new/shapes/index.js +18 -0
  19. package/build/esm/new/shapes/index.js.map +1 -0
  20. package/build/esm/new/shapes/types.js +96 -0
  21. package/build/esm/new/shapes/types.js.map +1 -0
  22. package/build/esm/new/shapes/useShape.js +23 -0
  23. package/build/esm/new/shapes/useShape.js.map +1 -0
  24. package/build/esm/new/shared/storeUtils.js +71 -0
  25. package/build/esm/new/shared/storeUtils.js.map +1 -0
  26. package/build/esm/util/UserAgent.js +1 -1
  27. package/build/esm/util/UserAgent.js.map +1 -1
  28. package/build/types/new/shapes/derivedLinksStore.d.ts +27 -0
  29. package/build/types/new/shapes/derivedLinksStore.d.ts.map +1 -0
  30. package/build/types/new/shapes/index.d.ts +2 -0
  31. package/build/types/new/shapes/index.d.ts.map +1 -0
  32. package/build/types/new/shapes/types.d.ts +53 -0
  33. package/build/types/new/shapes/types.d.ts.map +1 -0
  34. package/build/types/new/shapes/useShape.d.ts +44 -0
  35. package/build/types/new/shapes/useShape.d.ts.map +1 -0
  36. package/build/types/new/shared/storeUtils.d.ts +8 -0
  37. package/build/types/new/shared/storeUtils.d.ts.map +1 -0
  38. package/package.json +6 -3
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Copyright 2025 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 deepEqual from "fast-deep-equal";
18
+ import React from "react";
19
+ export function useStableValue(value) {
20
+ const ref = React.useRef(value);
21
+ if (!deepEqual(ref.current, value)) {
22
+ ref.current = value;
23
+ }
24
+ return ref.current;
25
+ }
26
+ export function createVersionedCache() {
27
+ let version = 0;
28
+ let cachedSnapshot = null;
29
+ let snapshotVersion = -1;
30
+ return {
31
+ invalidate() {
32
+ version++;
33
+ cachedSnapshot = null;
34
+ },
35
+ get(builder) {
36
+ if (cachedSnapshot != null && snapshotVersion === version) {
37
+ return cachedSnapshot;
38
+ }
39
+ cachedSnapshot = builder();
40
+ snapshotVersion = version;
41
+ return cachedSnapshot;
42
+ }
43
+ };
44
+ }
45
+ export function wrapError(err) {
46
+ return err instanceof Error ? err : new Error(String(err));
47
+ }
48
+ export function createCachingNotifier(subscribers, cache) {
49
+ return function () {
50
+ cache.invalidate();
51
+ for (const cb of subscribers) {
52
+ cb();
53
+ }
54
+ };
55
+ }
56
+ export function createStoreSubscribe(subscribers, onInit, onCleanup) {
57
+ return notifyUpdate => {
58
+ const shouldInit = subscribers.size === 0;
59
+ subscribers.add(notifyUpdate);
60
+ if (shouldInit) {
61
+ onInit();
62
+ }
63
+ return () => {
64
+ subscribers.delete(notifyUpdate);
65
+ if (subscribers.size === 0) {
66
+ onCleanup();
67
+ }
68
+ };
69
+ };
70
+ }
71
+ //# sourceMappingURL=storeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storeUtils.js","names":["deepEqual","React","useStableValue","value","ref","useRef","current","createVersionedCache","version","cachedSnapshot","snapshotVersion","invalidate","get","builder","wrapError","err","Error","String","createCachingNotifier","subscribers","cache","cb","createStoreSubscribe","onInit","onCleanup","notifyUpdate","shouldInit","size","add","delete"],"sources":["storeUtils.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 deepEqual from \"fast-deep-equal\";\nimport React from \"react\";\n\nexport function useStableValue<T>(value: T): T {\n const ref = React.useRef(value);\n if (!deepEqual(ref.current, value)) {\n ref.current = value;\n }\n return ref.current;\n}\n\nexport function createVersionedCache<T>() {\n let version = 0;\n let cachedSnapshot: T | null = null;\n let snapshotVersion = -1;\n\n return {\n invalidate(): void {\n version++;\n cachedSnapshot = null;\n },\n get(builder: () => T): T {\n if (cachedSnapshot != null && snapshotVersion === version) {\n return cachedSnapshot;\n }\n cachedSnapshot = builder();\n snapshotVersion = version;\n return cachedSnapshot;\n },\n };\n}\n\nexport function wrapError(err: unknown): Error {\n return err instanceof Error ? err : new Error(String(err));\n}\n\nexport function createCachingNotifier<T>(\n subscribers: Set<() => void>,\n cache: ReturnType<typeof createVersionedCache<T>>,\n): () => void {\n return function notify(): void {\n cache.invalidate();\n for (const cb of subscribers) {\n cb();\n }\n };\n}\n\nexport function createStoreSubscribe(\n subscribers: Set<() => void>,\n onInit: () => void,\n onCleanup: () => void,\n): (notifyUpdate: () => void) => () => void {\n return (notifyUpdate: () => void): () => void => {\n const shouldInit = subscribers.size === 0;\n subscribers.add(notifyUpdate);\n\n if (shouldInit) {\n onInit();\n }\n\n return () => {\n subscribers.delete(notifyUpdate);\n if (subscribers.size === 0) {\n onCleanup();\n }\n };\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,iBAAiB;AACvC,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAO,SAASC,cAAcA,CAAIC,KAAQ,EAAK;EAC7C,MAAMC,GAAG,GAAGH,KAAK,CAACI,MAAM,CAACF,KAAK,CAAC;EAC/B,IAAI,CAACH,SAAS,CAACI,GAAG,CAACE,OAAO,EAAEH,KAAK,CAAC,EAAE;IAClCC,GAAG,CAACE,OAAO,GAAGH,KAAK;EACrB;EACA,OAAOC,GAAG,CAACE,OAAO;AACpB;AAEA,OAAO,SAASC,oBAAoBA,CAAA,EAAM;EACxC,IAAIC,OAAO,GAAG,CAAC;EACf,IAAIC,cAAwB,GAAG,IAAI;EACnC,IAAIC,eAAe,GAAG,CAAC,CAAC;EAExB,OAAO;IACLC,UAAUA,CAAA,EAAS;MACjBH,OAAO,EAAE;MACTC,cAAc,GAAG,IAAI;IACvB,CAAC;IACDG,GAAGA,CAACC,OAAgB,EAAK;MACvB,IAAIJ,cAAc,IAAI,IAAI,IAAIC,eAAe,KAAKF,OAAO,EAAE;QACzD,OAAOC,cAAc;MACvB;MACAA,cAAc,GAAGI,OAAO,CAAC,CAAC;MAC1BH,eAAe,GAAGF,OAAO;MACzB,OAAOC,cAAc;IACvB;EACF,CAAC;AACH;AAEA,OAAO,SAASK,SAASA,CAACC,GAAY,EAAS;EAC7C,OAAOA,GAAG,YAAYC,KAAK,GAAGD,GAAG,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACF,GAAG,CAAC,CAAC;AAC5D;AAEA,OAAO,SAASG,qBAAqBA,CACnCC,WAA4B,EAC5BC,KAAiD,EACrC;EACZ,OAAO,YAAwB;IAC7BA,KAAK,CAACT,UAAU,CAAC,CAAC;IAClB,KAAK,MAAMU,EAAE,IAAIF,WAAW,EAAE;MAC5BE,EAAE,CAAC,CAAC;IACN;EACF,CAAC;AACH;AAEA,OAAO,SAASC,oBAAoBA,CAClCH,WAA4B,EAC5BI,MAAkB,EAClBC,SAAqB,EACqB;EAC1C,OAAQC,YAAwB,IAAiB;IAC/C,MAAMC,UAAU,GAAGP,WAAW,CAACQ,IAAI,KAAK,CAAC;IACzCR,WAAW,CAACS,GAAG,CAACH,YAAY,CAAC;IAE7B,IAAIC,UAAU,EAAE;MACdH,MAAM,CAAC,CAAC;IACV;IAEA,OAAO,MAAM;MACXJ,WAAW,CAACU,MAAM,CAACJ,YAAY,CAAC;MAChC,IAAIN,WAAW,CAACQ,IAAI,KAAK,CAAC,EAAE;QAC1BH,SAAS,CAAC,CAAC;MACb;IACF,CAAC;EACH,CAAC;AACH","ignoreList":[]}
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export const REACT_USER_AGENT = `osdk-react/${"0.14.0"}`;
17
+ export const REACT_USER_AGENT = `osdk-react/${"0.14.1-main-5835d51d99a51882d5cb42d4e9bf5b5fbe4f6bca"}`;
18
18
  //# sourceMappingURL=UserAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserAgent.js","names":["REACT_USER_AGENT"],"sources":["UserAgent.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\nexport const REACT_USER_AGENT: string =\n `osdk-react/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,gBAAwB,GACnC,wBAA2C","ignoreList":[]}
1
+ {"version":3,"file":"UserAgent.js","names":["REACT_USER_AGENT"],"sources":["UserAgent.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\nexport const REACT_USER_AGENT: string =\n `osdk-react/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,gBAAwB,GACnC,sEAA2C","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Store layer for one source object's derived links on a given shape. Owns
3
+ * one `LinkEntry` per top-level derived link. If a link's target shape has
4
+ * its own derived links, also owns one `LinkEntry` per (pk, nestedLinkName)
5
+ * under the parent's `nestedByPk`. Feeds `useSyncExternalStore` via
6
+ * `subscribe` / `getSnapShot`. Teardown is one-way via `destroy`.
7
+ */
8
+ import type { ObjectOrInterfaceDefinition, Osdk } from "@osdk/api";
9
+ import type { LinkLoadConfig, ShapeBaseType, ShapeDefinition, ShapeDerivedLinks } from "@osdk/api/unstable";
10
+ import type { Client } from "@osdk/client";
11
+ import type { ObservableClient } from "@osdk/client/unstable-do-not-use";
12
+ import type { DerivedLinksStore } from "./types.js";
13
+ export type { AnyShapeInstance, DerivedLinksPayload, DerivedLinksStore } from "./types.js";
14
+ export { buildDataWithNestedLinks, cleanupNestedMap, createEmptyDerivedLinksStore, isBatchableLink, NOOP_FETCH_MORE, violationsToError } from "./types.js";
15
+ /**
16
+ * Creates a store that observes all derived links for a single source
17
+ * object against the given shape. Returned methods:
18
+ *
19
+ * - `subscribe(notify)`: add a listener. First subscribe kicks off
20
+ * observation of all non-deferred top-level links. Last unsubscribe
21
+ * triggers `destroy`.
22
+ * - `getSnapShot()`: read a cached snapshot of all link data + statuses.
23
+ * - `loadDeferred(linkName)`: start a link configured with `defer: true`.
24
+ * - `retry(linkName?)`: restart error-state entries.
25
+ * - `destroy()`: one-way teardown; cascades through nested subscriptions.
26
+ */
27
+ export declare function createDerivedLinksStore<S extends ShapeDefinition<ObjectOrInterfaceDefinition>>(shape: S, sourceObject: Osdk.Instance<ShapeBaseType<S>>, observableClient: ObservableClient, client: Client, linkConfig: Partial<Record<keyof ShapeDerivedLinks<S>, LinkLoadConfig>>): DerivedLinksStore<S>;
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;AAwBA,cACE,6BAGA,YACK,WAAY;AAEnB,cACE,gBAEA,eACA,iBACA,yBACK,oBAAqB;AAC5B,cAAc,cAAc,cAAe;AAM3C,cACE,wBAEK,kCAAmC;AAO1C,cAGE,yBAGK,YAAa;AAQpB,cACE,kBACA,qBACA,yBACK;AACP,SACE,0BACA,kBACA,8BACA,iBACA,iBACA,yBACK;;;;;;;;;;;;;AA2CP,OAAO,iBAAS,wBACd,UAAU,gBAAgB,8BAE1BA,OAAO,GACPC,cAAc,KAAK,SAAS,cAAc,KAC1CC,kBAAkB,kBAClBC,QAAQ,QACRC,YAAY,QAAQ,aAAa,kBAAkB,IAAI,mBACtD,kBAAkB","names":["shape: S","sourceObject: Osdk.Instance<ShapeBaseType<S>>","observableClient: ObservableClient","client: Client","linkConfig: Partial<Record<keyof ShapeDerivedLinks<S>, LinkLoadConfig>>"],"sources":["../../../../src/new/shapes/derivedLinksStore.ts"],"version":3,"file":"derivedLinksStore.d.ts"}
@@ -0,0 +1,2 @@
1
+ export type { PerItemLinkStatus, UseShapeListOptions, UseShapeListResult, UseShapeResult } from "./useShape.js";
2
+ export { useShapeList, useShapeSingle } from "./useShape.js";
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cACE,mBACA,qBACA,oBACA,sBACK;AAEP,SAAS,cAAc,sBAAsB","names":[],"sources":["../../../../src/new/shapes/index.ts"],"version":3,"file":"index.d.ts"}
@@ -0,0 +1,53 @@
1
+ import type { ObjectOrInterfaceDefinition, Osdk } from "@osdk/api";
2
+ import type { ShapeDerivedLinkDef } from "@osdk/api/shapes-internal";
3
+ import type { LinkStatus, ShapeDefinition, ShapeDerivedLinks, ShapeInstance } from "@osdk/api/unstable";
4
+ import type { Unsubscribable } from "@osdk/client/unstable-do-not-use";
5
+ export type AnyShapeInstance = ShapeInstance<ShapeDefinition<ObjectOrInterfaceDefinition>>;
6
+ export type ListObserverPayload = {
7
+ resolvedList: Osdk.Instance<ObjectOrInterfaceDefinition>[] | undefined
8
+ hasMore: boolean
9
+ fetchMore: () => Promise<void>
10
+ status: string
11
+ isOptimistic: boolean
12
+ };
13
+ export declare const NOOP_FETCH_MORE: () => Promise<void>;
14
+ export declare function violationsToError(shape: ShapeDefinition<ObjectOrInterfaceDefinition>, violations: readonly {
15
+ property: string
16
+ constraint: string
17
+ }[]): Error | undefined;
18
+ export interface LinkEntry {
19
+ linkDef: ShapeDerivedLinkDef;
20
+ sourceObject: Osdk.Instance<ObjectOrInterfaceDefinition>;
21
+ status: "init" | "loading" | "loaded" | "error" | "deferred";
22
+ data: AnyShapeInstance[];
23
+ error?: Error;
24
+ hasMore: boolean;
25
+ fetchMore: () => Promise<void>;
26
+ subscription?: Unsubscribable;
27
+ nestedByPk: Map<string | number, Map<string, LinkEntry>>;
28
+ cleaned: boolean;
29
+ }
30
+ export declare function createLinkEntry(linkDef: ShapeDerivedLinkDef, sourceObject: Osdk.Instance<ObjectOrInterfaceDefinition>, configDefer?: boolean): LinkEntry;
31
+ export interface DerivedLinksPayload<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> {
32
+ links: Record<string, AnyShapeInstance[]>;
33
+ linkStatus: Partial<{ [K in keyof ShapeDerivedLinks<S>] : LinkStatus }>;
34
+ anyLoading: boolean;
35
+ anyError: boolean;
36
+ }
37
+ export interface DerivedLinksStore<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> {
38
+ subscribe: (notifyUpdate: () => void) => () => void;
39
+ getSnapShot: () => DerivedLinksPayload<S>;
40
+ loadDeferred: (linkName: keyof ShapeDerivedLinks<S>) => void;
41
+ retry: (linkName?: keyof ShapeDerivedLinks<S>) => void;
42
+ destroy: () => void;
43
+ }
44
+ export declare function createEmptyDerivedLinksStore<S extends ShapeDefinition<ObjectOrInterfaceDefinition>>(): DerivedLinksStore<S>;
45
+ export declare function cleanupNestedMap(map: Map<string, LinkEntry>): void;
46
+ export declare function buildDataWithNestedLinks(entry: LinkEntry, transformedData: AnyShapeInstance[]): AnyShapeInstance[];
47
+ /**
48
+ * A link is batchable when it can use observeLinks (one API call for all source
49
+ * objects) instead of per-object observeObjectSet calls. This requires a simple
50
+ * single-hop pivotTo with no filters, ordering, limits, or set operations,
51
+ * since observeLinks doesn't support those query features.
52
+ */
53
+ export declare function isBatchableLink(linkDef: ShapeDerivedLinkDef): boolean;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,6BAA6B,YAAY,WAAY;AACnE,cAAc,2BAA2B,2BAA4B;AACrE,cACE,YACA,iBACA,mBACA,qBACK,oBAAqB;AAE5B,cAAc,sBAAsB,kCAAmC;AAEvE,YAAY,mBAAmB,cAC7B,gBAAgB;AAGlB,YAAY,sBAAsB;CAChC,cAAc,KAAK,SAAS;CAC5B;CACA,iBAAiB;CACjB;CACA;AACD;AAED,OAAO,cAAM,uBAA4B;AAEzC,OAAO,iBAAS,kBACdA,OAAO,gBAAgB,8BACvBC,qBAAqB;CAAE;CAAkB;AAAoB,MAC5D;AAcH,iBAAiB,UAAU;CACzB,SAAS;CACT,cAAc,KAAK,SAAS;CAC5B,QAAQ,SAAS,YAAY,WAAW,UAAU;CAClD,MAAM;CACN,QAAQ;CACR;CACA,iBAAiB;CACjB,eAAe;CACf,YAAY,qBAAqB,YAAY;CAC7C;AACD;AAED,OAAO,iBAAS,gBACdC,SAAS,qBACTC,cAAc,KAAK,SAAS,8BAC5BC,wBACC;AAgBH,iBAAiB,oBACf,UAAU,gBAAgB,8BAC1B;CACA,OAAO,eAAe;CACtB,YAAY,WAAW,WAAW,kBAAkB,MAAK;CACzD;CACA;AACD;AAED,iBAAiB,kBACf,UAAU,gBAAgB,8BAC1B;CACA,YAAYC;CACZ,mBAAmB,oBAAoB;CACvC,eAAeC,gBAAgB,kBAAkB;CACjD,QAAQC,iBAAiB,kBAAkB;CAC3C;AACD;AAED,OAAO,iBAAS,6BACd,UAAU,gBAAgB,iCACvB,kBAAkB;AAiBvB,OAAO,iBAAS,iBAAiBC,KAAK,YAAY;AAUlD,OAAO,iBAAS,yBACdC,OAAO,WACPC,iBAAiB,qBAChB;;;;;;;AA+BH,OAAO,iBAAS,gBAAgBR,SAAS","names":["shape: ShapeDefinition<ObjectOrInterfaceDefinition>","violations: readonly { property: string; constraint: string }[]","linkDef: ShapeDerivedLinkDef","sourceObject: Osdk.Instance<ObjectOrInterfaceDefinition>","configDefer?: boolean","notifyUpdate: () => void","linkName: keyof ShapeDerivedLinks<S>","linkName?: keyof ShapeDerivedLinks<S>","map: Map<string, LinkEntry>","entry: LinkEntry","transformedData: AnyShapeInstance[]"],"sources":["../../../../src/new/shapes/types.ts"],"version":3,"file":"types.d.ts"}
@@ -0,0 +1,44 @@
1
+ import type { ObjectOrInterfaceDefinition, PrimaryKeyType, PropertyKeys, WhereClause } from "@osdk/api";
2
+ import type { LinkLoadConfig, LinkStatus, NullabilityViolation, ShapeBaseType, ShapeDefinition, ShapeDerivedLinks, ShapeInstance } from "@osdk/api/unstable";
3
+ export interface UseShapeResult<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> {
4
+ data: ShapeInstance<S> | undefined;
5
+ isLoading: boolean;
6
+ error: Error | undefined;
7
+ isOptimistic: boolean;
8
+ droppedDueToNullability: boolean;
9
+ nullabilityViolations: readonly NullabilityViolation[];
10
+ linkStatus: Partial<{ [K in keyof ShapeDerivedLinks<S>] : LinkStatus }>;
11
+ loadDeferred: (linkName: keyof ShapeDerivedLinks<S>) => void;
12
+ retry: (linkName?: keyof ShapeDerivedLinks<S>) => void;
13
+ invalidate: (linkName?: keyof ShapeDerivedLinks<S>) => void;
14
+ }
15
+ export interface UseShapeListOptions<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> {
16
+ where?: WhereClause<ShapeBaseType<S>>;
17
+ pageSize?: number;
18
+ orderBy?: { [K in PropertyKeys<ShapeBaseType<S>>]? : "asc" | "desc" };
19
+ autoFetchMore?: boolean | number;
20
+ dedupeIntervalMs?: number;
21
+ streamUpdates?: boolean;
22
+ enabled?: boolean;
23
+ links?: Partial<{ [K in keyof ShapeDerivedLinks<S>] : LinkLoadConfig }>;
24
+ }
25
+ export type PerItemLinkStatus<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> = Map<string | number, Partial<{ [K in keyof ShapeDerivedLinks<S>] : LinkStatus }>>;
26
+ export interface UseShapeListResult<S extends ShapeDefinition<ObjectOrInterfaceDefinition>> {
27
+ data: ShapeInstance<S>[] | undefined;
28
+ isLoading: boolean;
29
+ error: Error | undefined;
30
+ isOptimistic: boolean;
31
+ fetchMore: (() => Promise<void>) | undefined;
32
+ droppedCount: number;
33
+ nullabilityViolations: readonly NullabilityViolation[];
34
+ itemLinkStatus: PerItemLinkStatus<S>;
35
+ linkStatus: Partial<{ [K in keyof ShapeDerivedLinks<S>] : LinkStatus }>;
36
+ loadDeferred: (primaryKey: string | number, linkName: keyof ShapeDerivedLinks<S>) => void;
37
+ retry: (primaryKey?: string | number, linkName?: keyof ShapeDerivedLinks<S>) => void;
38
+ invalidate: (linkName?: keyof ShapeDerivedLinks<S>) => void;
39
+ }
40
+ export declare function useShapeSingle<S extends ShapeDefinition<ObjectOrInterfaceDefinition>>(_shape: S, _primaryKey: PrimaryKeyType<ShapeBaseType<S>>, _options?: {
41
+ enabled?: boolean
42
+ links?: Partial<{ [K in keyof ShapeDerivedLinks<S>] : LinkLoadConfig }>
43
+ }): UseShapeResult<S>;
44
+ export declare function useShapeList<S extends ShapeDefinition<ObjectOrInterfaceDefinition>>(_shape: S, _options: UseShapeListOptions<S>): UseShapeListResult<S>;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cACE,6BACA,gBACA,cACA,mBACK,WAAY;AACnB,cACE,gBACA,YACA,sBACA,eACA,iBACA,mBACA,qBACK,oBAAqB;AAE5B,iBAAiB,eACf,UAAU,gBAAgB,8BAC1B;CACA,MAAM,cAAc;CACpB;CACA,OAAO;CACP;CACA;CACA,gCAAgC;CAChC,YAAY,WAAW,WAAW,kBAAkB,MAAK;CACzD,eAAeA,gBAAgB,kBAAkB;CACjD,QAAQC,iBAAiB,kBAAkB;CAC3C,aAAaA,iBAAiB,kBAAkB;AACjD;AAED,iBAAiB,oBACf,UAAU,gBAAgB,8BAC1B;CACA,QAAQ,YAAY,cAAc;CAClC;CACA,aAAa,KAAK,aAAa,cAAc,QAAO,QAAQ;CAC5D;CACA;CACA;CACA;CACA,QAAQ,WAAW,WAAW,kBAAkB,MAAK;AACtD;AAED,YAAY,kBACV,UAAU,gBAAgB,gCACxB,qBAEF,WAAW,WAAW,kBAAkB,MAAK;AAG/C,iBAAiB,mBACf,UAAU,gBAAgB,8BAC1B;CACA,MAAM,cAAc;CACpB;CACA,OAAO;CACP;CACA,kBAAkB;CAClB;CACA,gCAAgC;CAChC,gBAAgB,kBAAkB;CAClC,YAAY,WAAW,WAAW,kBAAkB,MAAK;CACzD,eACEC,6BACAF,gBAAgB,kBAAkB;CAEpC,QACEG,8BACAF,iBAAiB,kBAAkB;CAErC,aAAaA,iBAAiB,kBAAkB;AACjD;AAED,OAAO,iBAAS,eACd,UAAU,gBAAgB,8BAE1BG,QAAQ,GACRC,aAAa,eAAe,cAAc,KAC1CC,WAAW;CACT;CACA,QAAQ,WAAW,WAAW,kBAAkB,MAAK;AACtD,IACA,eAAe;AAIlB,OAAO,iBAAS,aACd,UAAU,gBAAgB,8BAE1BF,QAAQ,GACRG,UAAU,oBAAoB,KAC7B,mBAAmB","names":["linkName: keyof ShapeDerivedLinks<S>","linkName?: keyof ShapeDerivedLinks<S>","primaryKey: string | number","primaryKey?: string | number","_shape: S","_primaryKey: PrimaryKeyType<ShapeBaseType<S>>","_options?: {\n enabled?: boolean;\n links?: Partial<{ [K in keyof ShapeDerivedLinks<S>]: LinkLoadConfig }>;\n }","_options: UseShapeListOptions<S>"],"sources":["../../../../src/new/shapes/useShape.ts"],"version":3,"file":"useShape.d.ts"}
@@ -0,0 +1,8 @@
1
+ export declare function useStableValue<T>(value: T): T;
2
+ export declare function createVersionedCache<T>(): {
3
+ invalidate(): void
4
+ get(builder: () => T): T
5
+ };
6
+ export declare function wrapError(err: unknown): Error;
7
+ export declare function createCachingNotifier<T>(subscribers: Set<() => void>, cache: ReturnType<typeof createVersionedCache<T>>): () => void;
8
+ export declare function createStoreSubscribe(subscribers: Set<() => void>, onInit: () => void, onCleanup: () => void): (notifyUpdate: () => void) => () => void;
@@ -0,0 +1 @@
1
+ {"mappings":"AAmBA,OAAO,iBAAS,eAAe,GAAGA,OAAO,IAAI;AAQ7C,OAAO,iBAAS,qBAAqB;CAMjC;CAIA,IAAIC,eAAe,IAAI;;AAW3B,OAAO,iBAAS,UAAUC,eAAe;AAIzC,OAAO,iBAAS,sBAAsB,GACpCC,aAAa,iBACbC,OAAO,kBAAkB,qBAAqB;AAUhD,OAAO,iBAAS,qBACdD,aAAa,iBACbE,oBACAC,yBACEC","names":["value: T","builder: () => T","err: unknown","subscribers: Set<() => void>","cache: ReturnType<typeof createVersionedCache<T>>","onInit: () => void","onCleanup: () => void","notifyUpdate: () => void"],"sources":["../../../../src/new/shared/storeUtils.ts"],"version":3,"file":"storeUtils.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/react",
3
- "version": "0.14.0",
3
+ "version": "0.14.1-main-5835d51d99a51882d5cb42d4e9bf5b5fbe4f6bca",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -53,6 +53,9 @@
53
53
  "default": "./build/browser/public/*.js"
54
54
  }
55
55
  },
56
+ "dependencies": {
57
+ "fast-deep-equal": "^3.1.3"
58
+ },
56
59
  "peerDependencies": {
57
60
  "@osdk/api": "^2.8.0",
58
61
  "@osdk/client": "^2.8.0",
@@ -87,9 +90,9 @@
87
90
  "typescript": "~5.5.4",
88
91
  "@osdk/api": "2.11.0",
89
92
  "@osdk/client": "2.11.0",
93
+ "@osdk/monorepo.api-extractor": "~0.7.0",
90
94
  "@osdk/client.test.ontology": "2.11.0",
91
- "@osdk/monorepo.tsconfig": "~0.7.0",
92
- "@osdk/monorepo.api-extractor": "~0.7.0"
95
+ "@osdk/monorepo.tsconfig": "~0.7.0"
93
96
  },
94
97
  "publishConfig": {
95
98
  "access": "public"