@osdk/react 0.10.0-beta.4 → 0.10.0-beta.6
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 +29 -0
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithRids.js +37 -0
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithRids.js.map +1 -0
- package/build/browser/intellisense.test.js +24 -0
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/new/makeExternalStore.js +61 -0
- package/build/browser/new/makeExternalStore.js.map +1 -1
- package/build/browser/new/useLinks.js +2 -2
- package/build/browser/new/useLinks.js.map +1 -1
- package/build/browser/new/useObjectSet.js +4 -3
- package/build/browser/new/useObjectSet.js.map +1 -1
- package/build/browser/new/useOsdkAction.js +2 -2
- package/build/browser/new/useOsdkAction.js.map +1 -1
- package/build/browser/new/useOsdkAggregation.js +63 -27
- package/build/browser/new/useOsdkAggregation.js.map +1 -1
- package/build/browser/new/useOsdkFunction.js +10 -8
- package/build/browser/new/useOsdkFunction.js.map +1 -1
- package/build/browser/new/useOsdkObject.js +26 -24
- package/build/browser/new/useOsdkObject.js.map +1 -1
- package/build/browser/new/useOsdkObjects.js +16 -14
- package/build/browser/new/useOsdkObjects.js.map +1 -1
- package/build/cjs/public/experimental.cjs +161 -72
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +43 -11
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithRids.js +37 -0
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithRids.js.map +1 -0
- package/build/esm/intellisense.test.js +24 -0
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/new/makeExternalStore.js +61 -0
- package/build/esm/new/makeExternalStore.js.map +1 -1
- package/build/esm/new/useLinks.js +2 -2
- package/build/esm/new/useLinks.js.map +1 -1
- package/build/esm/new/useObjectSet.js +4 -3
- package/build/esm/new/useObjectSet.js.map +1 -1
- package/build/esm/new/useOsdkAction.js +2 -2
- package/build/esm/new/useOsdkAction.js.map +1 -1
- package/build/esm/new/useOsdkAggregation.js +63 -27
- package/build/esm/new/useOsdkAggregation.js.map +1 -1
- package/build/esm/new/useOsdkFunction.js +10 -8
- package/build/esm/new/useOsdkFunction.js.map +1 -1
- package/build/esm/new/useOsdkObject.js +26 -24
- package/build/esm/new/useOsdkObject.js.map +1 -1
- package/build/esm/new/useOsdkObjects.js +16 -14
- package/build/esm/new/useOsdkObjects.js.map +1 -1
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithRids.d.ts +1 -0
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithRids.d.ts.map +1 -0
- package/build/types/new/makeExternalStore.d.ts +11 -0
- package/build/types/new/makeExternalStore.d.ts.map +1 -1
- package/build/types/new/useObjectSet.d.ts.map +1 -1
- package/build/types/new/useOsdkAggregation.d.ts +41 -3
- package/build/types/new/useOsdkAggregation.d.ts.map +1 -1
- package/build/types/new/useOsdkObject.d.ts +7 -7
- package/build/types/new/useOsdkObject.d.ts.map +1 -1
- package/build/types/new/useOsdkObjects.d.ts +16 -2
- package/build/types/new/useOsdkObjects.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -24,10 +24,10 @@ import { OsdkContext2 } from "./OsdkContext2.js";
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Loads an object by type and primary key.
|
|
27
|
+
* Loads an object or interface instance by type and primary key.
|
|
28
28
|
*
|
|
29
|
-
* @param type
|
|
30
|
-
* @param primaryKey
|
|
29
|
+
* @param type The object type or interface definition
|
|
30
|
+
* @param primaryKey The primary key of the object
|
|
31
31
|
* @param enabled Enable or disable the query (defaults to true)
|
|
32
32
|
*/
|
|
33
33
|
|
|
@@ -46,11 +46,10 @@ export function useOsdkObject(...args) {
|
|
|
46
46
|
|
|
47
47
|
// Extract enabled flag - 2nd param for instance signature, 3rd for type signature
|
|
48
48
|
const enabled = isInstanceSignature ? typeof args[1] === "boolean" ? args[1] : true : typeof args[2] === "boolean" ? args[2] : true;
|
|
49
|
-
|
|
50
|
-
// TODO: Figure out what the correct default behavior is for the various scenarios
|
|
51
49
|
const mode = isInstanceSignature ? "offline" : undefined;
|
|
52
|
-
const
|
|
50
|
+
const typeOrApiName = isInstanceSignature ? args[0].$objectType : args[0];
|
|
53
51
|
const primaryKey = isInstanceSignature ? args[0].$primaryKey : args[1];
|
|
52
|
+
const apiNameString = typeof typeOrApiName === "string" ? typeOrApiName : typeOrApiName.apiName;
|
|
54
53
|
const {
|
|
55
54
|
subscribe,
|
|
56
55
|
getSnapShot
|
|
@@ -58,27 +57,30 @@ export function useOsdkObject(...args) {
|
|
|
58
57
|
if (!enabled) {
|
|
59
58
|
return makeExternalStore(() => ({
|
|
60
59
|
unsubscribe: () => {}
|
|
61
|
-
}), `object ${
|
|
60
|
+
}), `object ${apiNameString} ${primaryKey} [DISABLED]`);
|
|
62
61
|
}
|
|
63
|
-
return makeExternalStore(observer => observableClient.observeObject(
|
|
62
|
+
return makeExternalStore(observer => observableClient.observeObject(typeOrApiName, primaryKey, {
|
|
64
63
|
mode
|
|
65
|
-
}, observer), `object ${
|
|
66
|
-
}, [enabled, observableClient,
|
|
64
|
+
}, observer), `object ${apiNameString} ${primaryKey}`);
|
|
65
|
+
}, [enabled, observableClient, typeOrApiName, apiNameString, primaryKey, mode]);
|
|
67
66
|
const payload = React.useSyncExternalStore(subscribe, getSnapShot);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
error
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
isOptimistic: !!payload?.isOptimistic,
|
|
78
|
-
error,
|
|
79
|
-
forceUpdate: () => {
|
|
80
|
-
throw new Error("not implemented");
|
|
67
|
+
const forceUpdate = React.useCallback(() => {
|
|
68
|
+
throw new Error("not implemented");
|
|
69
|
+
}, []);
|
|
70
|
+
return React.useMemo(() => {
|
|
71
|
+
let error;
|
|
72
|
+
if (payload && "error" in payload && payload.error) {
|
|
73
|
+
error = payload.error;
|
|
74
|
+
} else if (payload?.status === "error") {
|
|
75
|
+
error = new Error("Failed to load object");
|
|
81
76
|
}
|
|
82
|
-
|
|
77
|
+
return {
|
|
78
|
+
object: payload?.object,
|
|
79
|
+
isLoading: enabled ? payload?.status === "loading" || payload?.status === "init" || !payload : false,
|
|
80
|
+
isOptimistic: !!payload?.isOptimistic,
|
|
81
|
+
error,
|
|
82
|
+
forceUpdate
|
|
83
|
+
};
|
|
84
|
+
}, [payload, enabled, forceUpdate]);
|
|
83
85
|
}
|
|
84
86
|
//# sourceMappingURL=useOsdkObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObject.js","names":["React","makeExternalStore","OsdkContext2","useOsdkObject","args","observableClient","useContext","isInstanceSignature","enabled","mode","undefined","
|
|
1
|
+
{"version":3,"file":"useOsdkObject.js","names":["React","makeExternalStore","OsdkContext2","useOsdkObject","args","observableClient","useContext","isInstanceSignature","enabled","mode","undefined","typeOrApiName","$objectType","primaryKey","$primaryKey","apiNameString","apiName","subscribe","getSnapShot","useMemo","unsubscribe","observer","observeObject","payload","useSyncExternalStore","forceUpdate","useCallback","Error","error","status","object","isLoading","isOptimistic"],"sources":["useOsdkObject.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n Osdk,\n PrimaryKeyType,\n} from \"@osdk/api\";\nimport type { ObserveObjectCallbackArgs } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkObjectResult<\n Q extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<Q> | undefined;\n isLoading: boolean;\n\n error: Error | undefined;\n\n /**\n * Refers to whether the object is optimistic or not.\n */\n isOptimistic: boolean;\n forceUpdate: () => void;\n}\n\n/**\n * @param obj an existing `Osdk.Instance` object to get metadata for.\n * @param enabled Enable or disable the query (defaults to true)\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n obj: Osdk.Instance<Q>,\n enabled?: boolean,\n): UseOsdkObjectResult<Q>;\n/**\n * Loads an object or interface instance by type and primary key.\n *\n * @param type The object type or interface definition\n * @param primaryKey The primary key of the object\n * @param enabled Enable or disable the query (defaults to true)\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n type: Q,\n primaryKey: PrimaryKeyType<Q>,\n enabled?: boolean,\n): UseOsdkObjectResult<Q>;\n/*\n Implementation of useOsdkObject\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n ...args:\n | [obj: Osdk.Instance<Q>, enabled?: boolean]\n | [type: Q, primaryKey: PrimaryKeyType<Q>, enabled?: boolean]\n): UseOsdkObjectResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n\n // Check if first arg is an instance to discriminate signatures\n // TypeScript cannot narrow rest parameter unions with optional parameters,\n // so we must use type assertions after runtime discrimination\n const isInstanceSignature = \"$objectType\" in args[0];\n\n // Extract enabled flag - 2nd param for instance signature, 3rd for type signature\n const enabled = isInstanceSignature\n ? (typeof args[1] === \"boolean\" ? args[1] : true)\n : (typeof args[2] === \"boolean\" ? args[2] : true);\n\n const mode = isInstanceSignature ? \"offline\" : undefined;\n\n const typeOrApiName = isInstanceSignature\n ? (args[0] as Osdk.Instance<Q>).$objectType\n : (args[0] as Q);\n\n const primaryKey = isInstanceSignature\n ? (args[0] as Osdk.Instance<Q>).$primaryKey\n : (args[1] as PrimaryKeyType<Q>);\n\n const apiNameString = typeof typeOrApiName === \"string\"\n ? typeOrApiName\n : typeOrApiName.apiName;\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<ObserveObjectCallbackArgs<Q>>(\n () => ({ unsubscribe: () => {} }),\n `object ${apiNameString} ${primaryKey} [DISABLED]`,\n );\n }\n return makeExternalStore<ObserveObjectCallbackArgs<Q>>(\n (observer) =>\n observableClient.observeObject(\n typeOrApiName,\n primaryKey,\n {\n mode,\n },\n observer,\n ),\n `object ${apiNameString} ${primaryKey}`,\n );\n },\n [enabled, observableClient, typeOrApiName, apiNameString, primaryKey, mode],\n );\n\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n const forceUpdate = React.useCallback(() => {\n throw new Error(\"not implemented\");\n }, []);\n\n return React.useMemo(() => {\n let error: Error | undefined;\n if (payload && \"error\" in payload && payload.error) {\n error = payload.error;\n } else if (payload?.status === \"error\") {\n error = new Error(\"Failed to load object\");\n }\n\n return {\n object: payload?.object as Osdk.Instance<Q> | undefined,\n isLoading: enabled\n ? (payload?.status === \"loading\" || payload?.status === \"init\"\n || !payload)\n : false,\n isOptimistic: !!payload?.isOptimistic,\n error,\n forceUpdate,\n };\n }, [payload, enabled, forceUpdate]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,YAAY,QAAQ,mBAAmB;;AAiBhD;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAG3B,GAAGC,IAE4D,EACvC;EACxB,MAAM;IAAEC;EAAiB,CAAC,GAAGL,KAAK,CAACM,UA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AEJ,IAAI,CAC5E,CAAC;EAED,MAAMc,OAAO,GAAGvB,KAAK,CAACwB,oBAAoB,CAACP,SAAS,EAAEC,WAAW,CAAC;EAElE,MAAMO,WAAW,GAAGzB,KAAK,CAAC0B,WAAW,CAAC,MAAM;IAC1C,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO3B,KAAK,CAACmB,OAAO,CAAC,MAAM;IACzB,IAAIS,KAAwB;IAC5B,IAAIL,OAAO,IAAI,OAAO,IAAIA,OAAO,IAAIA,OAAO,CAACK,KAAK,EAAE;MAClDA,KAAK,GAAGL,OAAO,CAACK,KAAK;IACvB,CAAC,MAAM,IAAIL,OAAO,EAAEM,MAAM,KAAK,OAAO,EAAE;MACtCD,KAAK,GAAG,IAAID,KAAK,CAAC,uBAAuB,CAAC;IAC5C;IAEA,OAAO;MACLG,MAAM,EAAEP,OAAO,EAAEO,MAAsC;MACvDC,SAAS,EAAEvB,OAAO,GACbe,OAAO,EAAEM,MAAM,KAAK,SAAS,IAAIN,OAAO,EAAEM,MAAM,KAAK,MAAM,IACzD,CAACN,OAAO,GACX,KAAK;MACTS,YAAY,EAAE,CAAC,CAACT,OAAO,EAAES,YAAY;MACrCJ,KAAK;MACLH;IACF,CAAC;EACH,CAAC,EAAE,CAACF,OAAO,EAAEf,OAAO,EAAEiB,WAAW,CAAC,CAAC;AACrC","ignoreList":[]}
|
|
@@ -69,19 +69,21 @@ export function useOsdkObjects(type, options) {
|
|
|
69
69
|
}, observer), process.env.NODE_ENV !== "production" ? `list ${type.apiName} ${stableRids ? `[${stableRids.length} rids]` : ""} ${JSON.stringify(stableCanonWhere)}` : void 0);
|
|
70
70
|
}, [enabled, observableClient, type.apiName, type.type, stableRids, stableCanonWhere, dedupeIntervalMs, pageSize, stableOrderBy, streamUpdates, stableWithProperties, autoFetchMore, stableIntersectWith, pivotTo]);
|
|
71
71
|
const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
error
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
return React.useMemo(() => {
|
|
73
|
+
let error;
|
|
74
|
+
if (listPayload && "error" in listPayload && listPayload.error) {
|
|
75
|
+
error = listPayload.error;
|
|
76
|
+
} else if (listPayload?.status === "error") {
|
|
77
|
+
error = new Error("Failed to load objects");
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
fetchMore: listPayload?.hasMore ? listPayload.fetchMore : undefined,
|
|
81
|
+
error,
|
|
82
|
+
data: listPayload?.resolvedList,
|
|
83
|
+
isLoading: enabled ? listPayload?.status === "loading" || listPayload?.status === "init" || !listPayload : false,
|
|
84
|
+
isOptimistic: listPayload?.isOptimistic ?? false,
|
|
85
|
+
totalCount: listPayload?.totalCount
|
|
86
|
+
};
|
|
87
|
+
}, [listPayload, enabled]);
|
|
86
88
|
}
|
|
87
89
|
//# sourceMappingURL=useOsdkObjects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjects.js","names":["React","makeExternalStore","OsdkContext2","EMPTY_WHERE","useOsdkObjects","type","options","observableClient","useContext","pageSize","dedupeIntervalMs","withProperties","enabled","rids","where","orderBy","streamUpdates","autoFetchMore","intersectWith","pivotTo","canonWhere","canonicalizeWhereClause","stableCanonWhere","useMemo","JSON","stringify","stableRids","stableWithProperties","stableIntersectWith","stableOrderBy","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","apiName","observer","observeList","dedupeInterval","length","listPayload","useSyncExternalStore","error","status","Error","fetchMore","hasMore","undefined","data","resolvedList","isLoading","isOptimistic","totalCount"],"sources":["useOsdkObjects.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n LinkedType,\n LinkNames,\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { ObserveObjectsCallbackArgs } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkObjectsOptions<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Fetch objects by their RIDs (Resource Identifiers).\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 * useOsdkObjects(Employee, { rids: ['ri.foo.123', 'ri.foo.456'] })\n *\n * @example\n * // Fetch specific objects by RID, filtered by status\n * useOsdkObjects(Employee, {\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' }\n * })\n */\n rids?: readonly string[];\n\n /**\n * Standard OSDK Where clause with RDP support.\n * When used with `rids`, filters the RID set.\n * When used alone, filters all objects of the type.\n */\n where?: WhereClause<T, RDPs>;\n\n /**\n * Sort results by one or more properties.\n */\n orderBy?: {\n [K in PropertyKeys<T>]?: \"asc\" | \"desc\";\n };\n\n /**\n * The preferred page size for the list.\n */\n pageSize?: number;\n\n /**\n * Define derived properties (RDPs) to be computed server-side and attached to each object.\n * These properties will be available on the returned objects alongside their regular properties.\n */\n withProperties?: { [K in keyof RDPs]: DerivedProperty.Creator<T, RDPs[K]> };\n\n /**\n * The number of milliseconds to wait after the last observed list change.\n *\n * Two uses of `useOsdkObjects` with the same parameters will only trigger one\n * network request if the second is within `dedupeIntervalMs`.\n */\n dedupeIntervalMs?: number;\n\n /**\n * Enable or disable the query.\n *\n * When `false`, the query will not automatically execute. It will still\n * return any cached data, but will not fetch from the server.\n *\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Intersect the results with additional object sets.\n * Each element defines a where clause for an object set to intersect with.\n * The final result will only include objects that match ALL conditions.\n */\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n\n /**\n * Pivot to related objects through a link.\n * This changes the return type from T to the linked object type.\n */\n pivotTo?: LinkNames<T>;\n\n /**\n * Causes the list to automatically fetch more as soon as the previous page\n * has been loaded. If a number is provided, it will continue to automatically\n * fetch more until the list is at least that long.\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 autoFetchMore?: boolean | number;\n\n streamUpdates?: boolean;\n}\n\nexport interface UseOsdkListResult<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Function to fetch more pages (undefined if no more pages)\n */\n fetchMore: (() => Promise<void>) | undefined;\n\n /**\n * The fetched data with derived properties\n */\n data:\n | Osdk.Instance<T, \"$allBaseProperties\", PropertyKeys<T>, RDPs>[]\n | undefined;\n\n /**\n * Whether data is currently being loaded\n */\n isLoading: boolean;\n\n /**\n * Any error that occurred during fetching\n */\n error: Error | undefined;\n\n /**\n * Refers to whether the ordered list of objects (only considering the $primaryKey)\n * is optimistic or not.\n *\n * If you need to know if the contents of the list are optimistic you can\n * do that on a per object basis with useOsdkObject\n */\n isOptimistic: boolean;\n\n /**\n * The total count of objects matching the query (if available from the API)\n */\n totalCount?: string;\n}\n\nconst EMPTY_WHERE = {};\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n L extends LinkNames<Q>,\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q> & { pivotTo: L },\n): UseOsdkListResult<LinkedType<Q, L>>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n): UseOsdkListResult<Q, RDPs>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n):\n | UseOsdkListResult<Q, RDPs>\n | UseOsdkListResult<LinkedType<Q, LinkNames<Q>>>\n{\n const { observableClient } = React.useContext(OsdkContext2);\n\n const {\n pageSize,\n dedupeIntervalMs,\n withProperties,\n enabled = true,\n rids,\n where,\n orderBy,\n streamUpdates,\n autoFetchMore,\n intersectWith,\n pivotTo,\n } = options ?? {};\n\n const canonWhere = observableClient.canonicalizeWhereClause<\n Q,\n RDPs\n >(where ?? EMPTY_WHERE);\n\n const stableCanonWhere = React.useMemo(\n () => canonWhere,\n [JSON.stringify(canonWhere)],\n );\n\n const stableRids = React.useMemo(\n () => rids,\n [JSON.stringify(rids)],\n );\n\n const stableWithProperties = React.useMemo(\n () => withProperties,\n [JSON.stringify(withProperties)],\n );\n\n const stableIntersectWith = React.useMemo(\n () => intersectWith,\n [JSON.stringify(intersectWith)],\n );\n\n const stableOrderBy = React.useMemo(\n () => orderBy,\n [JSON.stringify(orderBy)],\n );\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} [DISABLED]`\n : void 0,\n );\n }\n\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n (observer) =>\n observableClient.observeList({\n type,\n rids: stableRids,\n where: stableCanonWhere,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n pageSize,\n orderBy: stableOrderBy,\n streamUpdates,\n withProperties: stableWithProperties,\n autoFetchMore,\n ...(stableIntersectWith\n ? { intersectWith: stableIntersectWith }\n : {}),\n ...(pivotTo ? { pivotTo } : {}),\n }, observer),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} ${\n stableRids ? `[${stableRids.length} rids]` : \"\"\n } ${JSON.stringify(stableCanonWhere)}`\n : void 0,\n );\n },\n [\n enabled,\n observableClient,\n type.apiName,\n type.type,\n stableRids,\n stableCanonWhere,\n dedupeIntervalMs,\n pageSize,\n stableOrderBy,\n streamUpdates,\n stableWithProperties,\n autoFetchMore,\n stableIntersectWith,\n pivotTo,\n ],\n );\n\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n let error: Error | undefined;\n if (listPayload && \"error\" in listPayload && listPayload.error) {\n error = listPayload.error;\n } else if (listPayload?.status === \"error\") {\n error = new Error(\"Failed to load objects\");\n }\n\n return {\n fetchMore: listPayload?.hasMore ? listPayload.fetchMore : undefined,\n error,\n data: listPayload?.resolvedList,\n isLoading: enabled\n ? (listPayload?.status === \"loading\" || listPayload?.status === \"init\"\n || !listPayload)\n : false,\n isOptimistic: listPayload?.isOptimistic ?? false,\n totalCount: listPayload?.totalCount,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,YAAY,QAAQ,mBAAmB;AAyIhD,MAAMC,WAAW,GAAG,CAAC,CAAC;AAwBtB,OAAO,SAASC,cAAcA,CAI5BC,IAAO,EACPC,OAAwC,EAI1C;EACE,MAAM;IAAEC;EAAiB,CAAC,GAAGP,KAAK,CAACQ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AIF,WAAW,EAAEG,MAAM,KAAK,OAAO,EAAE;IAC1CD,KAAK,GAAG,IAAIE,KAAK,CAAC,wBAAwB,CAAC;EAC7C;EAEA,OAAO;IACLC,SAAS,EAAEL,WAAW,EAAEM,OAAO,GAAGN,WAAW,CAACK,SAAS,GAAGE,SAAS;IACnEL,KAAK;IACLM,IAAI,EAAER,WAAW,EAAES,YAAY;IAC/BC,SAAS,EAAEvC,OAAO,GACb6B,WAAW,EAAEG,MAAM,KAAK,SAAS,IAAIH,WAAW,EAAEG,MAAM,KAAK,MAAM,IACjE,CAACH,WAAW,GACf,KAAK;IACTW,YAAY,EAAEX,WAAW,EAAEW,YAAY,IAAI,KAAK;IAChDC,UAAU,EAAEZ,WAAW,EAAEY;EAC3B,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useOsdkObjects.js","names":["React","makeExternalStore","OsdkContext2","EMPTY_WHERE","useOsdkObjects","type","options","observableClient","useContext","pageSize","dedupeIntervalMs","withProperties","enabled","rids","where","orderBy","streamUpdates","autoFetchMore","intersectWith","pivotTo","canonWhere","canonicalizeWhereClause","stableCanonWhere","useMemo","JSON","stringify","stableRids","stableWithProperties","stableIntersectWith","stableOrderBy","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","apiName","observer","observeList","dedupeInterval","length","listPayload","useSyncExternalStore","error","status","Error","fetchMore","hasMore","undefined","data","resolvedList","isLoading","isOptimistic","totalCount"],"sources":["useOsdkObjects.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n LinkedType,\n LinkNames,\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { ObserveObjectsCallbackArgs } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkObjectsOptions<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Fetch objects by their RIDs (Resource Identifiers).\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 * useOsdkObjects(Employee, { rids: ['ri.foo.123', 'ri.foo.456'] })\n *\n * @example\n * // Fetch specific objects by RID, filtered by status\n * useOsdkObjects(Employee, {\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' }\n * })\n */\n rids?: readonly string[];\n\n /**\n * Standard OSDK Where clause with RDP support.\n * When used with `rids`, filters the RID set.\n * When used alone, filters all objects of the type.\n */\n where?: WhereClause<T, RDPs>;\n\n /**\n * Sort results by one or more properties.\n */\n orderBy?: {\n [K in PropertyKeys<T>]?: \"asc\" | \"desc\";\n };\n\n /**\n * The preferred page size for the list.\n */\n pageSize?: number;\n\n /**\n * Define derived properties (RDPs) to be computed server-side and attached to each object.\n * These properties will be available on the returned objects alongside their regular properties.\n */\n withProperties?: { [K in keyof RDPs]: DerivedProperty.Creator<T, RDPs[K]> };\n\n /**\n * The number of milliseconds to wait after the last observed list change.\n *\n * Two uses of `useOsdkObjects` with the same parameters will only trigger one\n * network request if the second is within `dedupeIntervalMs`.\n */\n dedupeIntervalMs?: number;\n\n /**\n * Enable or disable the query.\n *\n * When `false`, the query will not automatically execute. It will still\n * return any cached data, but will not fetch from the server.\n *\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Intersect the results with additional object sets.\n * Each element defines a where clause for an object set to intersect with.\n * The final result will only include objects that match ALL conditions.\n */\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n\n /**\n * Pivot to related objects through a link.\n * This changes the return type from T to the linked object type.\n */\n pivotTo?: LinkNames<T>;\n\n /**\n * Causes the list to automatically fetch more as soon as the previous page\n * has been loaded. If a number is provided, it will continue to automatically\n * fetch more until the list is at least that long.\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 autoFetchMore?: boolean | number;\n\n streamUpdates?: boolean;\n}\n\nexport interface UseOsdkListResult<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n EXTRA_OPTIONS extends never | \"$rid\" = never,\n> {\n /**\n * Function to fetch more pages (undefined if no more pages)\n */\n fetchMore: (() => Promise<void>) | undefined;\n\n /**\n * The fetched data with derived properties\n */\n data:\n | Osdk.Instance<\n T,\n \"$allBaseProperties\" | EXTRA_OPTIONS,\n PropertyKeys<T>,\n RDPs\n >[]\n | undefined;\n\n /**\n * Whether data is currently being loaded\n */\n isLoading: boolean;\n\n /**\n * Any error that occurred during fetching\n */\n error: Error | undefined;\n\n /**\n * Refers to whether the ordered list of objects (only considering the $primaryKey)\n * is optimistic or not.\n *\n * If you need to know if the contents of the list are optimistic you can\n * do that on a per object basis with useOsdkObject\n */\n isOptimistic: boolean;\n\n /**\n * The total count of objects matching the query (if available from the API)\n */\n totalCount?: string;\n}\n\nconst EMPTY_WHERE = {};\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n L extends LinkNames<Q>,\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q> & { pivotTo: L; rids: readonly string[] },\n): UseOsdkListResult<LinkedType<Q, L>, {}, \"$rid\">;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n L extends LinkNames<Q>,\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q> & { pivotTo: L },\n): UseOsdkListResult<LinkedType<Q, L>>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q, RDPs> & { rids: readonly string[] },\n): UseOsdkListResult<Q, RDPs, \"$rid\">;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n): UseOsdkListResult<Q, RDPs>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n):\n | UseOsdkListResult<Q, RDPs>\n | UseOsdkListResult<Q, RDPs, \"$rid\">\n | UseOsdkListResult<LinkedType<Q, LinkNames<Q>>>\n | UseOsdkListResult<LinkedType<Q, LinkNames<Q>>, {}, \"$rid\">\n{\n const { observableClient } = React.useContext(OsdkContext2);\n\n const {\n pageSize,\n dedupeIntervalMs,\n withProperties,\n enabled = true,\n rids,\n where,\n orderBy,\n streamUpdates,\n autoFetchMore,\n intersectWith,\n pivotTo,\n } = options ?? {};\n\n const canonWhere = observableClient.canonicalizeWhereClause<\n Q,\n RDPs\n >(where ?? EMPTY_WHERE);\n\n const stableCanonWhere = React.useMemo(\n () => canonWhere,\n [JSON.stringify(canonWhere)],\n );\n\n const stableRids = React.useMemo(\n () => rids,\n [JSON.stringify(rids)],\n );\n\n const stableWithProperties = React.useMemo(\n () => withProperties,\n [JSON.stringify(withProperties)],\n );\n\n const stableIntersectWith = React.useMemo(\n () => intersectWith,\n [JSON.stringify(intersectWith)],\n );\n\n const stableOrderBy = React.useMemo(\n () => orderBy,\n [JSON.stringify(orderBy)],\n );\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} [DISABLED]`\n : void 0,\n );\n }\n\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n (observer) =>\n observableClient.observeList({\n type,\n rids: stableRids,\n where: stableCanonWhere,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n pageSize,\n orderBy: stableOrderBy,\n streamUpdates,\n withProperties: stableWithProperties,\n autoFetchMore,\n ...(stableIntersectWith\n ? { intersectWith: stableIntersectWith }\n : {}),\n ...(pivotTo ? { pivotTo } : {}),\n }, observer),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} ${\n stableRids ? `[${stableRids.length} rids]` : \"\"\n } ${JSON.stringify(stableCanonWhere)}`\n : void 0,\n );\n },\n [\n enabled,\n observableClient,\n type.apiName,\n type.type,\n stableRids,\n stableCanonWhere,\n dedupeIntervalMs,\n pageSize,\n stableOrderBy,\n streamUpdates,\n stableWithProperties,\n autoFetchMore,\n stableIntersectWith,\n pivotTo,\n ],\n );\n\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n return React.useMemo(() => {\n let error: Error | undefined;\n if (listPayload && \"error\" in listPayload && listPayload.error) {\n error = listPayload.error;\n } else if (listPayload?.status === \"error\") {\n error = new Error(\"Failed to load objects\");\n }\n\n return {\n fetchMore: listPayload?.hasMore ? listPayload.fetchMore : undefined,\n error,\n data: listPayload?.resolvedList,\n isLoading: enabled\n ? (listPayload?.status === \"loading\" || listPayload?.status === \"init\"\n || !listPayload)\n : false,\n isOptimistic: listPayload?.isOptimistic ?? false,\n totalCount: listPayload?.totalCount,\n };\n }, [listPayload, enabled]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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mBAAmB,EACnBT,OAAO,CAEX,CAAC;EAED,MAAMsB,WAAW,GAAGzC,KAAK,CAAC0C,oBAAoB,CAACZ,SAAS,EAAEC,WAAW,CAAC;EAEtE,OAAO/B,KAAK,CAACuB,OAAO,CAAC,MAAM;IACzB,IAAIoB,KAAwB;IAC5B,IAAIF,WAAW,IAAI,OAAO,IAAIA,WAAW,IAAIA,WAAW,CAACE,KAAK,EAAE;MAC9DA,KAAK,GAAGF,WAAW,CAACE,KAAK;IAC3B,CAAC,MAAM,IAAIF,WAAW,EAAEG,MAAM,KAAK,OAAO,EAAE;MAC1CD,KAAK,GAAG,IAAIE,KAAK,CAAC,wBAAwB,CAAC;IAC7C;IAEA,OAAO;MACLC,SAAS,EAAEL,WAAW,EAAEM,OAAO,GAAGN,WAAW,CAACK,SAAS,GAAGE,SAAS;MACnEL,KAAK;MACLM,IAAI,EAAER,WAAW,EAAES,YAAY;MAC/BC,SAAS,EAAEvC,OAAO,GACb6B,WAAW,EAAEG,MAAM,KAAK,SAAS,IAAIH,WAAW,EAAEG,MAAM,KAAK,MAAM,IACjE,CAACH,WAAW,GACf,KAAK;MACTW,YAAY,EAAEX,WAAW,EAAEW,YAAY,IAAI,KAAK;MAChDC,UAAU,EAAEZ,WAAW,EAAEY;IAC3B,CAAC;EACH,CAAC,EAAE,CAACZ,WAAW,EAAE7B,OAAO,CAAC,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../../src/intellisense.test.helpers/useOsdkObjectsWithRids.ts"],"version":3,"file":"useOsdkObjectsWithRids.d.ts"}
|
|
@@ -8,3 +8,14 @@ export declare function makeExternalStore<X>(createObservation: (callback: Obser
|
|
|
8
8
|
subscribe: (notifyUpdate: () => void) => () => void
|
|
9
9
|
getSnapShot: () => Snapshot<X>
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Like makeExternalStore but for async subscription creation.
|
|
13
|
+
*
|
|
14
|
+
* Uses an isActive flag to handle race conditions:
|
|
15
|
+
* If cleanup runs before promise resolves, the stale subscription is
|
|
16
|
+
* immediately unsubscribed when it eventually resolves
|
|
17
|
+
*/
|
|
18
|
+
export declare function makeExternalStoreAsync<X>(createObservation: (callback: Observer<X | undefined>) => Promise<Unsubscribable>, _name?: string, initialValue?: Snapshot<X>): {
|
|
19
|
+
subscribe: (notifyUpdate: () => void) => () => void
|
|
20
|
+
getSnapShot: () => Snapshot<X>
|
|
21
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,UACA,sBACK,kCAAmC;AAE1C,YAAY,SAAS,KACjB,IAAI;CAAE,QAAQ;AAAO,KACpB,QAAQ,KAAK;CAAE,QAAQ;AAAO;AAGnC,OAAO,iBAAS,kBAAkB,GAChCA,oBAAoBC,UAAU,SAAS,mBAAmB,gBAC1DC,gBACAC,eAAe,SAAS,KACvB;CACD,YAAYC;CACZ,mBAAmB,SAAS;AAC7B","names":["createObservation: (callback: Observer<X | undefined>) => Unsubscribable","callback: Observer<X | undefined>","_name?: string","initialValue?: Snapshot<X>","notifyUpdate: () => void"],"sources":["../../../src/new/makeExternalStore.ts"],"version":3,"file":"makeExternalStore.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cACE,UACA,sBACK,kCAAmC;AAE1C,YAAY,SAAS,KACjB,IAAI;CAAE,QAAQ;AAAO,KACpB,QAAQ,KAAK;CAAE,QAAQ;AAAO;AAGnC,OAAO,iBAAS,kBAAkB,GAChCA,oBAAoBC,UAAU,SAAS,mBAAmB,gBAC1DC,gBACAC,eAAe,SAAS,KACvB;CACD,YAAYC;CACZ,mBAAmB,SAAS;AAC7B;;;;;;;;AAyCD,OAAO,iBAAS,uBAAuB,GACrCC,oBACEJ,UAAU,SAAS,mBAChB,QAAQ,iBACbC,gBACAC,eAAe,SAAS,KACvB;CACD,YAAYC;CACZ,mBAAmB,SAAS;AAC7B","names":["createObservation: (callback: Observer<X | undefined>) => Unsubscribable","callback: Observer<X | undefined>","_name?: string","initialValue?: Snapshot<X>","notifyUpdate: () => void","createObservation: (\n callback: Observer<X | undefined>,\n ) => Promise<Unsubscribable>"],"sources":["../../../src/new/makeExternalStore.ts"],"version":3,"file":"makeExternalStore.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,iBACA,WACA,WACA,sBACA,MACA,cACA,mBACA,mBACK,WAAY;AAUnB,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;CAIA,QAAQ,YAAY,GAAG;;;;CAKvB,oBAAoB,WAAW,QAAO,gBAAgB,QAAQ,GAAG,KAAK;;;;CAKtE,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;;;;CAKrB,UAAU,UAAU;;;;CAKpB;;;;CAKA,aACG,KAAK,aAAa,OAAM,QAAQ;;;;CAMnC;;;;;;;;CASA;;;;;;;;CASA;;;;;;;;;;;;;;;;;;;;CAqBA;AACD;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;CAIA,MACI,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;CAM5D;;;;CAKA,OAAO;;;;CAKP,kBAAkB;;;;CAKlB,WAAW,UAAU,GAAG;;;;CAKxB;AACD;;;;;;;;;;;;
|
|
1
|
+
{"mappings":"AAgBA,cACE,iBACA,WACA,WACA,sBACA,MACA,cACA,mBACA,mBACK,WAAY;AAUnB,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;CAIA,QAAQ,YAAY,GAAG;;;;CAKvB,oBAAoB,WAAW,QAAO,gBAAgB,QAAQ,GAAG,KAAK;;;;CAKtE,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;;;;CAKrB,UAAU,UAAU;;;;CAKpB;;;;CAKA,aACG,KAAK,aAAa,OAAM,QAAQ;;;;CAMnC;;;;;;;;CASA;;;;;;;;CASA;;;;;;;;;;;;;;;;;;;;CAqBA;AACD;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;CAIA,MACI,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;CAM5D;;;;CAKA,OAAO;;;;CAKP,kBAAkB;;;;CAKlB,WAAW,UAAU,GAAG;;;;CAKxB;AACD;;;;;;;;;;;;AAoBD,OAAO,iBAAS;CACd,UAAU;CACV,iBAAiB,eAAe;CAChC,aAAa,eAAe,qBAAqB,CAAE;EAEnDA,eAAe,UAAU,GAAG,WAC5BC,UAAS,oBAAoB,GAAG,QAC/B,mBAAmB,GAAG","names":["baseObjectSet: ObjectSet<Q, BaseRDPs>","options: UseObjectSetOptions<Q, RDPs>"],"sources":["../../../src/new/useObjectSet.tsx"],"version":3,"file":"useObjectSet.d.ts"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AggregateOpts, AggregationsResults, DerivedProperty, ObjectOrInterfaceDefinition, SimplePropertyDef, WhereClause } from "@osdk/api";
|
|
2
|
-
|
|
1
|
+
import type { AggregateOpts, AggregationsResults, DerivedProperty, ObjectOrInterfaceDefinition, ObjectSet, SimplePropertyDef, WhereClause } from "@osdk/api";
|
|
2
|
+
import type { ObjectTypeDefinition } from "@osdk/client";
|
|
3
|
+
interface UseOsdkAggregationBaseOptions<
|
|
3
4
|
T extends ObjectOrInterfaceDefinition,
|
|
4
5
|
A extends AggregateOpts<T>,
|
|
5
6
|
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
@@ -14,6 +15,14 @@ export interface UseOsdkAggregationOptions<
|
|
|
14
15
|
*/
|
|
15
16
|
withProperties?: { [K in keyof RDPs] : DerivedProperty.Creator<T, RDPs[K]> };
|
|
16
17
|
/**
|
|
18
|
+
* Intersect the main query with additional filtered object sets.
|
|
19
|
+
* Each entry creates a separate object set with its own where clause,
|
|
20
|
+
* and the final result is the intersection of all sets.
|
|
21
|
+
*/
|
|
22
|
+
intersectWith?: Array<{
|
|
23
|
+
where: WhereClause<T, RDPs>
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
17
26
|
* Aggregation options including groupBy and select
|
|
18
27
|
*/
|
|
19
28
|
aggregate: A;
|
|
@@ -25,6 +34,21 @@ export interface UseOsdkAggregationOptions<
|
|
|
25
34
|
*/
|
|
26
35
|
dedupeIntervalMs?: number;
|
|
27
36
|
}
|
|
37
|
+
export interface UseOsdkAggregationOptions<
|
|
38
|
+
T extends ObjectOrInterfaceDefinition,
|
|
39
|
+
A extends AggregateOpts<T>,
|
|
40
|
+
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
41
|
+
> extends UseOsdkAggregationBaseOptions<T, A, RDPs> {}
|
|
42
|
+
export interface UseOsdkAggregationOptionsWithObjectSet<
|
|
43
|
+
T extends ObjectTypeDefinition,
|
|
44
|
+
A extends AggregateOpts<T>,
|
|
45
|
+
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
46
|
+
> extends UseOsdkAggregationBaseOptions<T, A, RDPs> {
|
|
47
|
+
/**
|
|
48
|
+
* The ObjectSet to aggregate on. Enables aggregation on pivoted, filtered, or composed ObjectSets.
|
|
49
|
+
*/
|
|
50
|
+
objectSet: ObjectSet<T>;
|
|
51
|
+
}
|
|
28
52
|
export interface UseOsdkAggregationResult<
|
|
29
53
|
T extends ObjectOrInterfaceDefinition,
|
|
30
54
|
A extends AggregateOpts<T>
|
|
@@ -46,6 +70,7 @@ export interface UseOsdkAggregationResult<
|
|
|
46
70
|
*
|
|
47
71
|
* @example
|
|
48
72
|
* ```tsx
|
|
73
|
+
* // Basic aggregation without ObjectSet
|
|
49
74
|
* const { data, isLoading, error } = useOsdkAggregation(Employee, {
|
|
50
75
|
* where: { department: "Engineering" },
|
|
51
76
|
* aggregate: {
|
|
@@ -56,10 +81,23 @@ export interface UseOsdkAggregationResult<
|
|
|
56
81
|
* }
|
|
57
82
|
* }
|
|
58
83
|
* });
|
|
84
|
+
*
|
|
85
|
+
* // With a pivoted ObjectSet
|
|
86
|
+
* const pivotedSet = useMemo(() => $(Employee).pivotTo("primaryOffice"), []);
|
|
87
|
+
* const { data } = useOsdkAggregation(Office, {
|
|
88
|
+
* objectSet: pivotedSet,
|
|
89
|
+
* aggregate: { $select: { $count: "unordered" } }
|
|
90
|
+
* });
|
|
59
91
|
* ```
|
|
60
92
|
*/
|
|
61
93
|
export declare function useOsdkAggregation<
|
|
62
94
|
Q extends ObjectOrInterfaceDefinition,
|
|
63
95
|
const A extends AggregateOpts<Q>,
|
|
64
96
|
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
65
|
-
>(type: Q,
|
|
97
|
+
>(type: Q, options: UseOsdkAggregationOptions<Q, A, RDPs>): UseOsdkAggregationResult<Q, A>;
|
|
98
|
+
export declare function useOsdkAggregation<
|
|
99
|
+
Q extends ObjectTypeDefinition,
|
|
100
|
+
const A extends AggregateOpts<Q>,
|
|
101
|
+
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
102
|
+
>(type: Q, options: UseOsdkAggregationOptionsWithObjectSet<Q, A, RDPs>): UseOsdkAggregationResult<Q, A>;
|
|
103
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,eACA,qBACA,iBACA,6BACA,mBACA,mBACK,WAAY;
|
|
1
|
+
{"mappings":"AAgBA,cACE,eACA,qBACA,iBACA,6BACA,WACA,mBACA,mBACK,WAAY;AACnB,cAAc,4BAA4B,cAAe;UAU/C;CACR,UAAU;CACV,UAAU,cAAc;CACxB,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;CAIA,QAAQ,YAAY,GAAG;;;;;CAMvB,oBAAoB,WAAW,QAAO,gBAAgB,QAAQ,GAAG,KAAK;;;;;;CAOtE,gBAAgB,MAAM;EACpB,OAAO,YAAY,GAAG;CACvB;;;;CAKD,WAAW;;;;;;;CAQX;AACD;AAED,iBAAiB;CACf,UAAU;CACV,UAAU,cAAc;CACxB,aAAa,eAAe,qBAAqB,CAAE;UAC3C,8BAA8B,GAAG,GAAG,MAAM,CAAE;AAEtD,iBAAiB;CACf,UAAU;CACV,UAAU,cAAc;CACxB,aAAa,eAAe,qBAAqB,CAAE;UAC3C,8BAA8B,GAAG,GAAG,MAAM;;;;CAIlD,WAAW,UAAU;AACtB;AAID,iBAAiB;CACf,UAAU;CACV,UAAU,cAAc;EACxB;CACA,MAAM,oBAAoB,GAAG;CAC7B;CACA,OAAO;CACP;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCD,OAAO,iBAAS;CACd,UAAU;OACJ,UAAU,cAAc;CAC9B,aAAa,eAAe,qBAAqB,CAAE;EAEnDA,MAAM,GACNC,SAAS,0BAA0B,GAAG,GAAG,QACxC,yBAAyB,GAAG;AAC/B,OAAO,iBAAS;CACd,UAAU;OACJ,UAAU,cAAc;CAC9B,aAAa,eAAe,qBAAqB,CAAE;EAEnDD,MAAM,GACNE,SAAS,uCAAuC,GAAG,GAAG,QACrD,yBAAyB,GAAG","names":["type: Q","options: UseOsdkAggregationOptions<Q, A, RDPs>","options: UseOsdkAggregationOptionsWithObjectSet<Q, A, RDPs>"],"sources":["../../../src/new/useOsdkAggregation.ts"],"version":3,"file":"useOsdkAggregation.d.ts"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface UseOsdkObjectResult<Q extends
|
|
1
|
+
import type { ObjectOrInterfaceDefinition, Osdk, PrimaryKeyType } from "@osdk/api";
|
|
2
|
+
export interface UseOsdkObjectResult<Q extends ObjectOrInterfaceDefinition> {
|
|
3
3
|
object: Osdk.Instance<Q> | undefined;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
error: Error | undefined;
|
|
@@ -13,12 +13,12 @@ export interface UseOsdkObjectResult<Q extends ObjectTypeDefinition> {
|
|
|
13
13
|
* @param obj an existing `Osdk.Instance` object to get metadata for.
|
|
14
14
|
* @param enabled Enable or disable the query (defaults to true)
|
|
15
15
|
*/
|
|
16
|
-
export declare function useOsdkObject<Q extends
|
|
16
|
+
export declare function useOsdkObject<Q extends ObjectOrInterfaceDefinition>(obj: Osdk.Instance<Q>, enabled?: boolean): UseOsdkObjectResult<Q>;
|
|
17
17
|
/**
|
|
18
|
-
* Loads an object by type and primary key.
|
|
18
|
+
* Loads an object or interface instance by type and primary key.
|
|
19
19
|
*
|
|
20
|
-
* @param type
|
|
21
|
-
* @param primaryKey
|
|
20
|
+
* @param type The object type or interface definition
|
|
21
|
+
* @param primaryKey The primary key of the object
|
|
22
22
|
* @param enabled Enable or disable the query (defaults to true)
|
|
23
23
|
*/
|
|
24
|
-
export declare function useOsdkObject<Q extends
|
|
24
|
+
export declare function useOsdkObject<Q extends ObjectOrInterfaceDefinition>(type: Q, primaryKey: PrimaryKeyType<Q>, enabled?: boolean): UseOsdkObjectResult<Q>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,
|
|
1
|
+
{"mappings":"AAgBA,cACE,6BACA,MACA,sBACK,WAAY;AAMnB,iBAAiB,oBACf,UAAU,6BACV;CACA,QAAQ,KAAK,SAAS;CACtB;CAEA,OAAO;;;;CAKP;CACA;AACD;;;;;AAMD,OAAO,iBAAS,cACd,UAAU,6BAEVA,KAAK,KAAK,SAAS,IACnBC,oBACC,oBAAoB;;;;;;;;AAQvB,OAAO,iBAAS,cACd,UAAU,6BAEVC,MAAM,GACNC,YAAY,eAAe,IAC3BF,oBACC,oBAAoB","names":["obj: Osdk.Instance<Q>","enabled?: boolean","type: Q","primaryKey: PrimaryKeyType<Q>"],"sources":["../../../src/new/useOsdkObject.ts"],"version":3,"file":"useOsdkObject.d.ts"}
|
|
@@ -82,7 +82,8 @@ export interface UseOsdkObjectsOptions<
|
|
|
82
82
|
}
|
|
83
83
|
export interface UseOsdkListResult<
|
|
84
84
|
T extends ObjectOrInterfaceDefinition,
|
|
85
|
-
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
85
|
+
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
86
|
+
EXTRA_OPTIONS extends never | "$rid" = never
|
|
86
87
|
> {
|
|
87
88
|
/**
|
|
88
89
|
* Function to fetch more pages (undefined if no more pages)
|
|
@@ -91,7 +92,7 @@ export interface UseOsdkListResult<
|
|
|
91
92
|
/**
|
|
92
93
|
* The fetched data with derived properties
|
|
93
94
|
*/
|
|
94
|
-
data: Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs>[] | undefined;
|
|
95
|
+
data: Osdk.Instance<T, "$allBaseProperties" | EXTRA_OPTIONS, PropertyKeys<T>, RDPs>[] | undefined;
|
|
95
96
|
/**
|
|
96
97
|
* Whether data is currently being loaded
|
|
97
98
|
*/
|
|
@@ -113,12 +114,25 @@ export interface UseOsdkListResult<
|
|
|
113
114
|
*/
|
|
114
115
|
totalCount?: string;
|
|
115
116
|
}
|
|
117
|
+
export declare function useOsdkObjects<
|
|
118
|
+
Q extends ObjectOrInterfaceDefinition,
|
|
119
|
+
L extends LinkNames<Q>
|
|
120
|
+
>(type: Q, options: UseOsdkObjectsOptions<Q> & {
|
|
121
|
+
pivotTo: L
|
|
122
|
+
rids: readonly string[]
|
|
123
|
+
}): UseOsdkListResult<LinkedType<Q, L>, {}, "$rid">;
|
|
116
124
|
export declare function useOsdkObjects<
|
|
117
125
|
Q extends ObjectOrInterfaceDefinition,
|
|
118
126
|
L extends LinkNames<Q>
|
|
119
127
|
>(type: Q, options: UseOsdkObjectsOptions<Q> & {
|
|
120
128
|
pivotTo: L
|
|
121
129
|
}): UseOsdkListResult<LinkedType<Q, L>>;
|
|
130
|
+
export declare function useOsdkObjects<
|
|
131
|
+
Q extends ObjectOrInterfaceDefinition,
|
|
132
|
+
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
133
|
+
>(type: Q, options: UseOsdkObjectsOptions<Q, RDPs> & {
|
|
134
|
+
rids: readonly string[]
|
|
135
|
+
}): UseOsdkListResult<Q, RDPs, "$rid">;
|
|
122
136
|
export declare function useOsdkObjects<
|
|
123
137
|
Q extends ObjectOrInterfaceDefinition,
|
|
124
138
|
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,iBACA,YACA,WACA,6BACA,MACA,cACA,mBACA,mBACK,WAAY;AAMnB,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;;;;;;;;;;;;;;CAiBA;;;;;;CAOA,QAAQ,YAAY,GAAG;;;;CAKvB,aACG,KAAK,aAAa,OAAM,QAAQ;;;;CAMnC;;;;;CAMA,oBAAoB,WAAW,QAAO,gBAAgB,QAAQ,GAAG,KAAK;;;;;;;CAQtE;;;;;;;;;CAUA;;;;;;CAOA,gBAAgB,MAAM;EACpB,OAAO,YAAY,GAAG;CACvB;;;;;CAMD,UAAU,UAAU;;;;;;;;;;CAWpB;CAEA;AACD;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;
|
|
1
|
+
{"mappings":"AAgBA,cACE,iBACA,YACA,WACA,6BACA,MACA,cACA,mBACA,mBACK,WAAY;AAMnB,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;;;;;;;;;;;;;;CAiBA;;;;;;CAOA,QAAQ,YAAY,GAAG;;;;CAKvB,aACG,KAAK,aAAa,OAAM,QAAQ;;;;CAMnC;;;;;CAMA,oBAAoB,WAAW,QAAO,gBAAgB,QAAQ,GAAG,KAAK;;;;;;;CAQtE;;;;;;;;;CAUA;;;;;;CAOA,gBAAgB,MAAM;EACpB,OAAO,YAAY,GAAG;CACvB;;;;;CAMD,UAAU,UAAU;;;;;;;;;;CAWpB;CAEA;AACD;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,8BAA8B;EAC9B;;;;CAIA,kBAAkB;;;;CAKlB,MACI,KAAK,SACL,GACA,uBAAuB,eACvB,aAAa,IACb;;;;CAOJ;;;;CAKA,OAAO;;;;;;;;CASP;;;;CAKA;AACD;AAUD,OAAO,iBAAS;CACd,UAAU;CACV,UAAU,UAAU;EAEpBA,MAAM,GACNC,SAAS,sBAAsB,KAAK;CAAE,SAAS;CAAG;AAAyB,IAC1E,kBAAkB,WAAW,GAAG,IAAI,CAAE,GAAE;AAE3C,OAAO,iBAAS;CACd,UAAU;CACV,UAAU,UAAU;EAEpBD,MAAM,GACNE,SAAS,sBAAsB,KAAK;CAAE,SAAS;AAAG,IACjD,kBAAkB,WAAW,GAAG;AAEnC,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EAEnDF,MAAM,GACNG,SAAS,sBAAsB,GAAG,QAAQ;CAAE;AAAyB,IACpE,kBAAkB,GAAG,MAAM;AAE9B,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EAEnDH,MAAM,GACNI,UAAU,sBAAsB,GAAG,QAClC,kBAAkB,GAAG","names":["type: Q","options: UseOsdkObjectsOptions<Q> & { pivotTo: L; rids: readonly string[] }","options: UseOsdkObjectsOptions<Q> & { pivotTo: L }","options: UseOsdkObjectsOptions<Q, RDPs> & { rids: readonly string[] }","options?: UseOsdkObjectsOptions<Q, RDPs>"],"sources":["../../../src/new/useOsdkObjects.ts"],"version":3,"file":"useOsdkObjects.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react",
|
|
3
|
-
"version": "0.10.0-beta.
|
|
3
|
+
"version": "0.10.0-beta.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@osdk/foundry.admin": "2.
|
|
57
|
-
"@osdk/foundry.core": "2.
|
|
56
|
+
"@osdk/foundry.admin": "2.47.0",
|
|
57
|
+
"@osdk/foundry.core": "2.47.0",
|
|
58
58
|
"@testing-library/react": "^16.3.0",
|
|
59
59
|
"@types/react": "^18.3.24",
|
|
60
60
|
"find-up": "^8.0.0",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"tiny-invariant": "^1.3.3",
|
|
69
69
|
"typescript": "~5.5.4",
|
|
70
|
-
"@osdk/api": "2.8.0-beta.
|
|
70
|
+
"@osdk/api": "2.8.0-beta.12",
|
|
71
71
|
"@osdk/monorepo.api-extractor": "~0.7.0-beta.1",
|
|
72
|
-
"@osdk/client
|
|
73
|
-
"@osdk/
|
|
74
|
-
"@osdk/
|
|
72
|
+
"@osdk/client": "2.8.0-beta.12",
|
|
73
|
+
"@osdk/client.test.ontology": "2.8.0-beta.12",
|
|
74
|
+
"@osdk/monorepo.tsconfig": "~0.7.0-beta.1"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|