@osdk/react 0.4.0-beta.5 → 0.4.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
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @osdkkit/react
|
|
2
2
|
|
|
3
|
+
## 0.4.0-beta.6
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a1f5bdc: Adds react 19 as valid peer deps
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [4183a55]
|
|
12
|
+
- @osdk/client@2.2.0-beta.23
|
|
13
|
+
- @osdk/api@2.2.0-beta.23
|
|
14
|
+
|
|
3
15
|
## 0.4.0-beta.5
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -57,6 +69,115 @@
|
|
|
57
69
|
- @osdk/client@2.2.0-beta.4
|
|
58
70
|
- @osdk/api@2.2.0-beta.4
|
|
59
71
|
|
|
72
|
+
## 0.3.0
|
|
73
|
+
|
|
74
|
+
### Minor Changes
|
|
75
|
+
|
|
76
|
+
- 9d35a1f: Remove unused imports
|
|
77
|
+
- c691c8b: Package now has experimental support for commonjs
|
|
78
|
+
- 287de1d: Adjusts dependencies on @osdk/client and @osdk/api to work with prerelease packages
|
|
79
|
+
- c9da74c: Improves code quality by fixing linting errors
|
|
80
|
+
- 66a8ee4: Adding support for react caching work.
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [966d408]
|
|
85
|
+
- Updated dependencies [b773513]
|
|
86
|
+
- Updated dependencies [cddc196]
|
|
87
|
+
- Updated dependencies [d794c19]
|
|
88
|
+
- Updated dependencies [05febf4]
|
|
89
|
+
- Updated dependencies [55c05f2]
|
|
90
|
+
- Updated dependencies [a06ec35]
|
|
91
|
+
- Updated dependencies [0dc40b0]
|
|
92
|
+
- Updated dependencies [3703d81]
|
|
93
|
+
- Updated dependencies [6f50516]
|
|
94
|
+
- Updated dependencies [25fd9f0]
|
|
95
|
+
- Updated dependencies [11a05cc]
|
|
96
|
+
- Updated dependencies [7865cb6]
|
|
97
|
+
- Updated dependencies [e6fbd94]
|
|
98
|
+
- Updated dependencies [9c4efe6]
|
|
99
|
+
- Updated dependencies [0a7c747]
|
|
100
|
+
- Updated dependencies [3ea2e79]
|
|
101
|
+
- Updated dependencies [1812118]
|
|
102
|
+
- Updated dependencies [d927a1d]
|
|
103
|
+
- Updated dependencies [bc1761c]
|
|
104
|
+
- Updated dependencies [656f975]
|
|
105
|
+
- Updated dependencies [f1145ff]
|
|
106
|
+
- Updated dependencies [1c59d93]
|
|
107
|
+
- Updated dependencies [f446d0c]
|
|
108
|
+
- Updated dependencies [c80ca45]
|
|
109
|
+
- Updated dependencies [bb8b219]
|
|
110
|
+
- Updated dependencies [44e62f6]
|
|
111
|
+
- Updated dependencies [03f95eb]
|
|
112
|
+
- Updated dependencies [91cfa3a]
|
|
113
|
+
- Updated dependencies [94463b6]
|
|
114
|
+
- Updated dependencies [14624f7]
|
|
115
|
+
- Updated dependencies [1a89f23]
|
|
116
|
+
- Updated dependencies [9d35a1f]
|
|
117
|
+
- Updated dependencies [c691c8b]
|
|
118
|
+
- Updated dependencies [749cf69]
|
|
119
|
+
- Updated dependencies [f03e39f]
|
|
120
|
+
- Updated dependencies [d464009]
|
|
121
|
+
- Updated dependencies [11088aa]
|
|
122
|
+
- Updated dependencies [72c1905]
|
|
123
|
+
- Updated dependencies [720218d]
|
|
124
|
+
- Updated dependencies [9298f75]
|
|
125
|
+
- Updated dependencies [eb27b54]
|
|
126
|
+
- Updated dependencies [7a95618]
|
|
127
|
+
- Updated dependencies [f34b3d4]
|
|
128
|
+
- Updated dependencies [d88fdb9]
|
|
129
|
+
- Updated dependencies [8eb2378]
|
|
130
|
+
- Updated dependencies [acbfab9]
|
|
131
|
+
- Updated dependencies [c9da74c]
|
|
132
|
+
- Updated dependencies [27f0f77]
|
|
133
|
+
- Updated dependencies [015279b]
|
|
134
|
+
- Updated dependencies [62c1d63]
|
|
135
|
+
- Updated dependencies [3c9ac22]
|
|
136
|
+
- Updated dependencies [1591f04]
|
|
137
|
+
- Updated dependencies [91cfa3a]
|
|
138
|
+
- Updated dependencies [03e1941]
|
|
139
|
+
- Updated dependencies [e86e91d]
|
|
140
|
+
- Updated dependencies [abfe4b3]
|
|
141
|
+
- Updated dependencies [b79becf]
|
|
142
|
+
- Updated dependencies [27866a8]
|
|
143
|
+
- Updated dependencies [0cd1603]
|
|
144
|
+
- Updated dependencies [a7a4aef]
|
|
145
|
+
- Updated dependencies [e5fe7c0]
|
|
146
|
+
- Updated dependencies [1b2e8c9]
|
|
147
|
+
- Updated dependencies [9f3807c]
|
|
148
|
+
- Updated dependencies [d12c92b]
|
|
149
|
+
- Updated dependencies [0c56d21]
|
|
150
|
+
- Updated dependencies [e548b9b]
|
|
151
|
+
- Updated dependencies [6671a39]
|
|
152
|
+
- Updated dependencies [5e78575]
|
|
153
|
+
- Updated dependencies [ee6224b]
|
|
154
|
+
- Updated dependencies [1dc0228]
|
|
155
|
+
- Updated dependencies [6c60414]
|
|
156
|
+
- Updated dependencies [5fe2c8d]
|
|
157
|
+
- Updated dependencies [fa02ebf]
|
|
158
|
+
- Updated dependencies [9af346e]
|
|
159
|
+
- Updated dependencies [d3b3f35]
|
|
160
|
+
- Updated dependencies [c682504]
|
|
161
|
+
- Updated dependencies [785f663]
|
|
162
|
+
- Updated dependencies [9018dc2]
|
|
163
|
+
- Updated dependencies [a6c320d]
|
|
164
|
+
- Updated dependencies [8026baf]
|
|
165
|
+
- Updated dependencies [6b6c8a1]
|
|
166
|
+
- Updated dependencies [c537e2d]
|
|
167
|
+
- Updated dependencies [3fc2ee6]
|
|
168
|
+
- Updated dependencies [0d8ac3b]
|
|
169
|
+
- Updated dependencies [73fa373]
|
|
170
|
+
- Updated dependencies [8e6a5f4]
|
|
171
|
+
- Updated dependencies [09eaf24]
|
|
172
|
+
- Updated dependencies [71dfb4c]
|
|
173
|
+
- Updated dependencies [2d5e648]
|
|
174
|
+
- Updated dependencies [31e7d70]
|
|
175
|
+
- Updated dependencies [c4f88a8]
|
|
176
|
+
- Updated dependencies [d665147]
|
|
177
|
+
- Updated dependencies [f19da8e]
|
|
178
|
+
- @osdk/client@2.1.0
|
|
179
|
+
- @osdk/api@2.1.0
|
|
180
|
+
|
|
60
181
|
## 0.3.0-beta.3
|
|
61
182
|
|
|
62
183
|
### Minor Changes
|
|
@@ -17,7 +17,7 @@ var fakeClient = Object.assign(fakeClientFn, {
|
|
|
17
17
|
});
|
|
18
18
|
var OsdkContext2 = /* @__PURE__ */ React3__default.default.createContext({
|
|
19
19
|
client: fakeClient,
|
|
20
|
-
observableClient:
|
|
20
|
+
observableClient: void 0
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// src/new/OsdkProvider2.tsx
|
|
@@ -113,7 +113,7 @@ function useOsdkObject(...args) {
|
|
|
113
113
|
const {
|
|
114
114
|
observableClient
|
|
115
115
|
} = React3__default.default.useContext(OsdkContext2);
|
|
116
|
-
const mode = args.length === 1 ? "offline" :
|
|
116
|
+
const mode = args.length === 1 ? "offline" : void 0;
|
|
117
117
|
const objectType = args.length === 1 ? args[0].$objectType : args[0].apiName;
|
|
118
118
|
const primaryKey = args.length === 1 ? args[0].$primaryKey : args[1];
|
|
119
119
|
const {
|
|
@@ -127,7 +127,7 @@ function useOsdkObject(...args) {
|
|
|
127
127
|
object: payload?.object,
|
|
128
128
|
isLoading: payload?.status === "loading",
|
|
129
129
|
isOptimistic: !!payload?.isOptimistic,
|
|
130
|
-
error: payload && "error" in payload ? payload.error :
|
|
130
|
+
error: payload && "error" in payload ? payload.error : void 0,
|
|
131
131
|
forceUpdate: () => {
|
|
132
132
|
throw "not implemented";
|
|
133
133
|
}
|
|
@@ -154,11 +154,11 @@ function useOsdkObjects(type, {
|
|
|
154
154
|
pageSize,
|
|
155
155
|
orderBy,
|
|
156
156
|
streamUpdates
|
|
157
|
-
}, observer), process.env.NODE_ENV !== "production" ? `list ${type.apiName} ${JSON.stringify(canonWhere)}` :
|
|
157
|
+
}, observer), process.env.NODE_ENV !== "production" ? `list ${type.apiName} ${JSON.stringify(canonWhere)}` : void 0), [observableClient, type, canonWhere, dedupeIntervalMs]);
|
|
158
158
|
const listPayload = React3__default.default.useSyncExternalStore(subscribe, getSnapShot);
|
|
159
159
|
return {
|
|
160
160
|
fetchMore: listPayload?.fetchMore,
|
|
161
|
-
error: listPayload && "error" in listPayload ? listPayload?.error :
|
|
161
|
+
error: listPayload && "error" in listPayload ? listPayload?.error : void 0,
|
|
162
162
|
data: listPayload?.resolvedList,
|
|
163
163
|
isLoading: listPayload?.status === "loading",
|
|
164
164
|
isOptimistic: listPayload?.isOptimistic ?? false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/new/OsdkContext2.ts","../../../src/new/OsdkProvider2.tsx","../../../src/new/useOsdkAction.ts","../../../src/new/makeExternalStore.ts","../../../src/new/useOsdkObject.ts","../../../src/new/useOsdkObjects.ts"],"names":["useMemo","createObservableClient","React","applyAction","ActionValidationError"],"mappings":";;;;;;;;;;;AAiBA,SAAS,gBAAgB,KAAO,EAAA;AAC9B,EAAM,MAAA,IAAI,MAAM,sEAAsE,CAAA;AACxF;AACA,IAAM,UAAA,GAAa,MAAO,CAAA,MAAA,CAAO,YAAc,EAAA;AAAA,EAC7C,aAAe,EAAA;AACjB,CAAC,CAAA;AACM,IAAM,YAAA,2CAAkC,aAAc,CAAA;AAAA,EAC3D,MAAQ,EAAA,UAAA;AAAA,EACR,gBAAkB,EAAA;AACpB,CAAC,CAAA;;;ACPM,SAAS,aAAc,CAAA;AAAA,EAC5B,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAG,EAAA;AACD,EAAmB,gBAAA,GAAAA,cAAA,CAAQ,MAAM,gBAAoB,IAAAC,uCAAA,CAAuB,MAAM,CAAG,EAAA,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A,CAAQ,MAAM,iBAAkB,CAAA,CAAA,QAAA,KAAY,iBAAiB,WAAY,CAAA;AAAA,IACjF,IAAA;AAAA,IACA,KAAO,EAAA,UAAA;AAAA,IACP,gBAAgB,gBAAoB,IAAA,GAAA;AAAA,IACpC,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF,EAAG,QAAQ,CAAG,EAAA,OAAA,CAAQ,IAAI,QAAa,KAAA,YAAA,GAAe,CAAQ,KAAA,EAAA,IAAA,CAAK,OAAO,CAAA,CAAA,EAAI,KAAK,SAAU,CAAA,UAAU,CAAC,CAAA,CAAA,GAAK,SAAM,CAAA,EAAG,CAAC,gBAAkB,EAAA,IAAA,EAAM,UAAY,EAAA,gBAAgB,CAAC,CAAA;AAC5K,EAAA,MAAM,WAAcA,GAAAA,uBAAAA,CAAM,oBAAqB,CAAA,SAAA,EAAW,WAAW,CAAA;AAErE,EAAO,OAAA;AAAA,IACL,WAAW,WAAa,EAAA,SAAA;AAAA,IACxB,KAAO,EAAA,WAAA,IAAe,OAAW,IAAA,WAAA,GAAc,aAAa,KAAQ,GAAA,SAAA;AAAA,IACpE,MAAM,WAAa,EAAA,YAAA;AAAA,IACnB,SAAA,EAAW,aAAa,MAAW,KAAA,SAAA;AAAA,IACnC,YAAA,EAAc,aAAa,YAAgB,IAAA;AAAA,GAC7C;AACF","file":"experimental.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nfunction fakeClientFn(..._args) {\n throw new Error(\"This is not a real client. Did you forget to <OsdkContext.Provider>?\");\n}\nconst fakeClient = Object.assign(fakeClientFn, {\n fetchMetadata: fakeClientFn\n});\nexport const OsdkContext2 = /*#__PURE__*/React.createContext({\n client: fakeClient,\n observableClient: undefined\n});","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createObservableClient } from \"@osdk/client/unstable-do-not-use\";\nimport React, { useMemo } from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function OsdkProvider2({\n children,\n client,\n observableClient\n}) {\n observableClient = useMemo(() => observableClient ?? createObservableClient(client), [client, observableClient]);\n return /*#__PURE__*/React.createElement(OsdkContext2.Provider, {\n value: {\n client,\n observableClient\n }\n }, children);\n}","/*\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 { ActionValidationError } from \"@osdk/client\";\nimport React from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkAction(actionDef) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const [error, setError] = React.useState();\n const [data, setData] = React.useState();\n const [isPending, setPending] = React.useState(false);\n const applyAction = React.useCallback(async function applyAction(hookArgs) {\n const {\n $optimisticUpdate,\n ...args\n } = hookArgs;\n try {\n setPending(true);\n setError(undefined);\n const r = await observableClient.applyAction(actionDef, args, {\n optimisticUpdate: $optimisticUpdate\n });\n setData(r);\n return r;\n } catch (e) {\n if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e\n });\n } else {\n setError({\n unknown: e\n });\n }\n } finally {\n setPending(false);\n }\n }, [observableClient, setError]);\n return {\n applyAction,\n error,\n data,\n isPending\n };\n}","/*\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 function makeExternalStore(createObservation, name) {\n let lastResult;\n function getSnapShot() {\n return lastResult;\n }\n function subscribe(notifyUpdate) {\n const obs = createObservation({\n next: payload => {\n lastResult = payload;\n notifyUpdate();\n },\n error: error => {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error))\n };\n notifyUpdate();\n },\n complete: () => {}\n });\n return () => {\n obs.unsubscribe();\n };\n }\n return {\n subscribe,\n getSnapShot\n };\n}","/*\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\n/**\n * @param obj an existing `Osdk.Instance` object to get metadata for.\n */\n\n/**\n * Loads an object by type and primary key.\n *\n * @param type\n * @param primaryKey\n */\n\n/*\n Implementation of useOsdkObject\n */\nexport function useOsdkObject(...args) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n\n // TODO: Figure out what the correct default behavior is for the various scenarios\n const mode = args.length === 1 ? \"offline\" : undefined;\n const objectType = args.length === 1 ? args[0].$objectType : args[0].apiName;\n const primaryKey = args.length === 1 ? args[0].$primaryKey : args[1];\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => makeExternalStore(observer => observableClient.observeObject(objectType, primaryKey, {\n mode\n }, observer), `object ${objectType} ${primaryKey}`), [observableClient, objectType, primaryKey, mode]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n return {\n object: payload?.object,\n isLoading: payload?.status === \"loading\",\n isOptimistic: !!payload?.isOptimistic,\n error: payload && \"error\" in payload ? payload.error : undefined,\n forceUpdate: () => {\n throw \"not implemented\";\n }\n };\n}","/*\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkObjects(type, {\n pageSize,\n orderBy,\n dedupeIntervalMs,\n where = {},\n streamUpdates\n} = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n\n /* We want the canonical where clause so that the use of `React.useMemo`\n is stable. No real added cost as we canonicalize internal to\n the ObservableClient anyway.\n */\n const canonWhere = observableClient.canonicalizeWhereClause(where ?? {});\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => makeExternalStore(observer => observableClient.observeList({\n type,\n where: canonWhere,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n pageSize,\n orderBy,\n streamUpdates\n }, observer), process.env.NODE_ENV !== \"production\" ? `list ${type.apiName} ${JSON.stringify(canonWhere)}` : void 0), [observableClient, type, canonWhere, dedupeIntervalMs]);\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n // TODO: we need to expose the error in the result\n return {\n fetchMore: listPayload?.fetchMore,\n error: listPayload && \"error\" in listPayload ? listPayload?.error : undefined,\n data: listPayload?.resolvedList,\n isLoading: listPayload?.status === \"loading\",\n isOptimistic: listPayload?.isOptimistic ?? false\n };\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/new/OsdkContext2.ts","../../../src/new/OsdkProvider2.tsx","../../../src/new/useOsdkAction.ts","../../../src/new/makeExternalStore.ts","../../../src/new/useOsdkObject.ts","../../../src/new/useOsdkObjects.ts"],"names":["useMemo","createObservableClient","React","applyAction","ActionValidationError"],"mappings":";;;;;;;;;;;AAiBA,SAAS,gBAAgB,KAAO,EAAA;AAC9B,EAAM,MAAA,IAAI,MAAM,sEAAsE,CAAA;AACxF;AACA,IAAM,UAAA,GAAa,MAAO,CAAA,MAAA,CAAO,YAAc,EAAA;AAAA,EAC7C,aAAe,EAAA;AACjB,CAAC,CAAA;AACM,IAAM,YAAA,2CAAkC,aAAc,CAAA;AAAA,EAC3D,MAAQ,EAAA,UAAA;AAAA,EACR,gBAAkB,EAAA;AACpB,CAAC,CAAA;;;ACPM,SAAS,aAAc,CAAA;AAAA,EAC5B,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAG,EAAA;AACD,EAAmB,gBAAA,GAAAA,cAAA,CAAQ,MAAM,gBAAoB,IAAAC,uCAAA,CAAuB,MAAM,CAAG,EAAA,CAAC,MAAQ,EAAA,gBAAgB,CAAC,CAAA;AA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KAAY,iBAAiB,WAAY,CAAA;AAAA,IACjF,IAAA;AAAA,IACA,KAAO,EAAA,UAAA;AAAA,IACP,gBAAgB,gBAAoB,IAAA,GAAA;AAAA,IACpC,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF,EAAG,QAAQ,CAAG,EAAA,OAAA,CAAQ,IAAI,QAAa,KAAA,YAAA,GAAe,CAAQ,KAAA,EAAA,IAAA,CAAK,OAAO,CAAA,CAAA,EAAI,KAAK,SAAU,CAAA,UAAU,CAAC,CAAA,CAAA,GAAK,MAAM,CAAA,EAAG,CAAC,gBAAkB,EAAA,IAAA,EAAM,UAAY,EAAA,gBAAgB,CAAC,CAAA;AAC5K,EAAA,MAAM,WAAcA,GAAAA,uBAAAA,CAAM,oBAAqB,CAAA,SAAA,EAAW,WAAW,CAAA;AAErE,EAAO,OAAA;AAAA,IACL,WAAW,WAAa,EAAA,SAAA;AAAA,IACxB,KAAO,EAAA,WAAA,IAAe,OAAW,IAAA,WAAA,GAAc,aAAa,KAAQ,GAAA,MAAA;AAAA,IACpE,MAAM,WAAa,EAAA,YAAA;AAAA,IACnB,SAAA,EAAW,aAAa,MAAW,KAAA,SAAA;AAAA,IACnC,YAAA,EAAc,aAAa,YAAgB,IAAA;AAAA,GAC7C;AACF","file":"experimental.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nfunction fakeClientFn(..._args) {\n throw new Error(\"This is not a real client. Did you forget to <OsdkContext.Provider>?\");\n}\nconst fakeClient = Object.assign(fakeClientFn, {\n fetchMetadata: fakeClientFn\n});\nexport const OsdkContext2 = /*#__PURE__*/React.createContext({\n client: fakeClient,\n observableClient: undefined\n});","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createObservableClient } from \"@osdk/client/unstable-do-not-use\";\nimport React, { useMemo } from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function OsdkProvider2({\n children,\n client,\n observableClient\n}) {\n observableClient = useMemo(() => observableClient ?? createObservableClient(client), [client, observableClient]);\n return /*#__PURE__*/React.createElement(OsdkContext2.Provider, {\n value: {\n client,\n observableClient\n }\n }, children);\n}","/*\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 { ActionValidationError } from \"@osdk/client\";\nimport React from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkAction(actionDef) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const [error, setError] = React.useState();\n const [data, setData] = React.useState();\n const [isPending, setPending] = React.useState(false);\n const applyAction = React.useCallback(async function applyAction(hookArgs) {\n const {\n $optimisticUpdate,\n ...args\n } = hookArgs;\n try {\n setPending(true);\n setError(undefined);\n const r = await observableClient.applyAction(actionDef, args, {\n optimisticUpdate: $optimisticUpdate\n });\n setData(r);\n return r;\n } catch (e) {\n if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e\n });\n } else {\n setError({\n unknown: e\n });\n }\n } finally {\n setPending(false);\n }\n }, [observableClient, setError]);\n return {\n applyAction,\n error,\n data,\n isPending\n };\n}","/*\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 function makeExternalStore(createObservation, name) {\n let lastResult;\n function getSnapShot() {\n return lastResult;\n }\n function subscribe(notifyUpdate) {\n const obs = createObservation({\n next: payload => {\n lastResult = payload;\n notifyUpdate();\n },\n error: error => {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error))\n };\n notifyUpdate();\n },\n complete: () => {}\n });\n return () => {\n obs.unsubscribe();\n };\n }\n return {\n subscribe,\n getSnapShot\n };\n}","/*\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\n/**\n * @param obj an existing `Osdk.Instance` object to get metadata for.\n */\n\n/**\n * Loads an object by type and primary key.\n *\n * @param type\n * @param primaryKey\n */\n\n/*\n Implementation of useOsdkObject\n */\nexport function useOsdkObject(...args) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n\n // TODO: Figure out what the correct default behavior is for the various scenarios\n const mode = args.length === 1 ? \"offline\" : undefined;\n const objectType = args.length === 1 ? args[0].$objectType : args[0].apiName;\n const primaryKey = args.length === 1 ? args[0].$primaryKey : args[1];\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => makeExternalStore(observer => observableClient.observeObject(objectType, primaryKey, {\n mode\n }, observer), `object ${objectType} ${primaryKey}`), [observableClient, objectType, primaryKey, mode]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n return {\n object: payload?.object,\n isLoading: payload?.status === \"loading\",\n isOptimistic: !!payload?.isOptimistic,\n error: payload && \"error\" in payload ? payload.error : undefined,\n forceUpdate: () => {\n throw \"not implemented\";\n }\n };\n}","/*\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkObjects(type, {\n pageSize,\n orderBy,\n dedupeIntervalMs,\n where = {},\n streamUpdates\n} = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n\n /* We want the canonical where clause so that the use of `React.useMemo`\n is stable. No real added cost as we canonicalize internal to\n the ObservableClient anyway.\n */\n const canonWhere = observableClient.canonicalizeWhereClause(where ?? {});\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => makeExternalStore(observer => observableClient.observeList({\n type,\n where: canonWhere,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n pageSize,\n orderBy,\n streamUpdates\n }, observer), process.env.NODE_ENV !== \"production\" ? `list ${type.apiName} ${JSON.stringify(canonWhere)}` : void 0), [observableClient, type, canonWhere, dedupeIntervalMs]);\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n // TODO: we need to expose the error in the result\n return {\n fetchMore: listPayload?.fetchMore,\n error: listPayload && \"error\" in listPayload ? listPayload?.error : undefined,\n data: listPayload?.resolvedList,\n isLoading: listPayload?.status === \"loading\",\n isOptimistic: listPayload?.isOptimistic ?? false\n };\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@osdk/api": "*",
|
|
40
40
|
"@osdk/client": "*",
|
|
41
|
-
"@types/react": "^18",
|
|
42
|
-
"react": "^17 || ^18",
|
|
43
|
-
"react-dom": "^17 || ^18"
|
|
41
|
+
"@types/react": "^17 || ^18 || ^19",
|
|
42
|
+
"react": "^17 || ^18 || ^19",
|
|
43
|
+
"react-dom": "^17 || ^18 || ^19"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@testing-library/react": "^16.0.1",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"p-defer": "^4.0.1",
|
|
50
50
|
"react": "^18.0.0",
|
|
51
51
|
"typescript": "~5.5.4",
|
|
52
|
-
"@osdk/api": "2.2.0-beta.
|
|
53
|
-
"@osdk/
|
|
52
|
+
"@osdk/api": "2.2.0-beta.23",
|
|
53
|
+
"@osdk/client": "2.2.0-beta.23",
|
|
54
54
|
"@osdk/monorepo.tsconfig": "~0.1.0-beta.1",
|
|
55
|
-
"@osdk/
|
|
55
|
+
"@osdk/monorepo.api-extractor": "~0.1.0-beta.1"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|