@osdk/react 0.7.0-beta.2 → 0.7.0-beta.3
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 +13 -2
- package/build/browser/public/experimental.js +1 -0
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/useOsdkMetadata.js +6 -4
- package/build/browser/useOsdkMetadata.js.map +1 -1
- package/build/cjs/chunk-OVBG5VXE.cjs +50 -0
- package/build/cjs/chunk-OVBG5VXE.cjs.map +1 -0
- package/build/cjs/index.cjs +7 -22
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +3 -9
- package/build/cjs/public/experimental.cjs +7 -3
- package/build/cjs/public/experimental.d.cts +1 -1
- package/build/cjs/useOsdkMetadata-DFZhnhGZ.d.cts +14 -0
- package/build/esm/public/experimental.js +1 -0
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/useOsdkMetadata.js +6 -4
- package/build/esm/useOsdkMetadata.js.map +1 -1
- package/build/types/public/experimental.d.ts +2 -0
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/useOsdkMetadata.d.ts +6 -4
- package/build/types/useOsdkMetadata.d.ts.map +1 -1
- package/package.json +7 -7
- package/build/cjs/chunk-2N32USW5.cjs +0 -28
- package/build/cjs/chunk-2N32USW5.cjs.map +0 -1
- package/build/cjs/useOsdkClient-B4iwHO1H.d.cts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @osdkkit/react
|
|
2
2
|
|
|
3
|
+
## 0.7.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ccc85a3: Export useOsdkMetadata hook experimentally
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [3d7461d]
|
|
12
|
+
- Updated dependencies [052a96b]
|
|
13
|
+
- @osdk/client@2.5.0-beta.5
|
|
14
|
+
- @osdk/api@2.5.0-beta.5
|
|
15
|
+
|
|
3
16
|
## 0.7.0-beta.2
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -39,7 +52,6 @@
|
|
|
39
52
|
The `useOsdkAction` hook in `@osdk/react` now provides a `validateAction` function that allows you to check if an action is valid without executing it. This is useful for providing real-time validation feedback to users before they commit to performing an action.
|
|
40
53
|
|
|
41
54
|
### New features:
|
|
42
|
-
|
|
43
55
|
- **validateAction**: A new async function that validates action parameters without executing the action
|
|
44
56
|
- **isValidating**: A boolean state that indicates when validation is in progress
|
|
45
57
|
- **validationResult**: Contains the validation response from the server, including whether the action is valid and any validation errors
|
|
@@ -62,7 +74,6 @@
|
|
|
62
74
|
```
|
|
63
75
|
|
|
64
76
|
### Implementation details:
|
|
65
|
-
|
|
66
77
|
- Multiple validation calls can be made - new calls automatically cancel previous pending validations
|
|
67
78
|
- Validation and action execution are mutually exclusive - you cannot validate while an action is being applied and vice versa
|
|
68
79
|
- The underlying `ObservableClient` in `@osdk/client` has been extended with a `validateAction` method to support this functionality
|
|
@@ -20,4 +20,5 @@ export { useOsdkAction } from "../new/useOsdkAction.js";
|
|
|
20
20
|
export { useOsdkObject } from "../new/useOsdkObject.js";
|
|
21
21
|
export { useOsdkObjects } from "../new/useOsdkObjects.js";
|
|
22
22
|
export { useOsdkClient } from "../useOsdkClient.js";
|
|
23
|
+
export { useOsdkMetadata } from "../useOsdkMetadata.js";
|
|
23
24
|
//# sourceMappingURL=experimental.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":["OsdkProvider2","useLinks","useOsdkAction","useOsdkObject","useOsdkObjects","useOsdkClient"],"sources":["experimental.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 { OsdkProvider2 } from \"../new/OsdkProvider2.js\";\nexport { useLinks } from \"../new/useLinks.js\";\nexport { useOsdkAction } from \"../new/useOsdkAction.js\";\nexport { useOsdkObject } from \"../new/useOsdkObject.js\";\nexport type { UseOsdkListResult } from \"../new/useOsdkObjects.js\";\nexport { useOsdkObjects } from \"../new/useOsdkObjects.js\";\nexport { useOsdkClient } from \"../useOsdkClient.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["OsdkProvider2","useLinks","useOsdkAction","useOsdkObject","useOsdkObjects","useOsdkClient","useOsdkMetadata"],"sources":["experimental.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 { OsdkProvider2 } from \"../new/OsdkProvider2.js\";\nexport { useLinks } from \"../new/useLinks.js\";\nexport { useOsdkAction } from \"../new/useOsdkAction.js\";\nexport { useOsdkObject } from \"../new/useOsdkObject.js\";\nexport type { UseOsdkListResult } from \"../new/useOsdkObjects.js\";\nexport { useOsdkObjects } from \"../new/useOsdkObjects.js\";\nexport { useOsdkClient } from \"../useOsdkClient.js\";\nexport { useOsdkMetadata } from \"../useOsdkMetadata.js\";\nexport type { UseOsdkMetadataResult } from \"../useOsdkMetadata.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,eAAe,QAAQ,uBAAuB","ignoreList":[]}
|
|
@@ -19,12 +19,13 @@ import { useOsdkClient } from "./useOsdkClient.js";
|
|
|
19
19
|
export function useOsdkMetadata(type) {
|
|
20
20
|
const client = useOsdkClient();
|
|
21
21
|
const [metadata, setMetadata] = React.useState(undefined);
|
|
22
|
-
|
|
22
|
+
const [error, setError] = React.useState();
|
|
23
|
+
if (!metadata && !error) {
|
|
23
24
|
client.fetchMetadata(type).then(fetchedMetadata => {
|
|
24
25
|
setMetadata(fetchedMetadata);
|
|
25
26
|
}).catch(error => {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
28
|
+
setError(errorMessage);
|
|
28
29
|
});
|
|
29
30
|
return {
|
|
30
31
|
loading: true
|
|
@@ -32,7 +33,8 @@ export function useOsdkMetadata(type) {
|
|
|
32
33
|
}
|
|
33
34
|
return {
|
|
34
35
|
loading: false,
|
|
35
|
-
metadata
|
|
36
|
+
metadata,
|
|
37
|
+
error
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
//# sourceMappingURL=useOsdkMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkMetadata.js","names":["React","useOsdkClient","useOsdkMetadata","type","client","metadata","setMetadata","useState","undefined","fetchMetadata","then","fetchedMetadata","catch","
|
|
1
|
+
{"version":3,"file":"useOsdkMetadata.js","names":["React","useOsdkClient","useOsdkMetadata","type","client","metadata","setMetadata","useState","undefined","error","setError","fetchMetadata","then","fetchedMetadata","catch","errorMessage","Error","message","String","loading"],"sources":["useOsdkMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectOrInterfaceDefinition,\n ObjectTypeDefinition,\n} from \"@osdk/api\";\nimport React from \"react\";\nimport { useOsdkClient } from \"./useOsdkClient.js\";\n\ntype MetadataFor<T extends ObjectOrInterfaceDefinition> = T extends\n InterfaceDefinition ? InterfaceMetadata\n : T extends ObjectTypeDefinition ? ObjectMetadata\n : never;\n\nexport interface UseOsdkMetadataResult<T extends ObjectOrInterfaceDefinition> {\n loading: boolean;\n metadata?: MetadataFor<T>;\n error?: string;\n}\n\nexport function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(\n type: T,\n): UseOsdkMetadataResult<T> {\n const client = useOsdkClient();\n const [metadata, setMetadata] = React.useState<\n MetadataFor<T> | undefined\n >(undefined);\n const [error, setError] = React.useState<UseOsdkMetadataResult<T>[\"error\"]>();\n\n if (!metadata && !error) {\n client.fetchMetadata(type).then((fetchedMetadata) => {\n setMetadata(fetchedMetadata as MetadataFor<T>);\n }).catch((error: unknown) => {\n const errorMessage = error instanceof Error\n ? error.message\n : String(error);\n setError(errorMessage);\n });\n return { loading: true };\n }\n\n return { loading: false, metadata, error };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,oBAAoB;AAalD,OAAO,SAASC,eAAeA,CAC7BC,IAAO,EACmB;EAC1B,MAAMC,MAAM,GAAGH,aAAa,CAAC,CAAC;EAC9B,MAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAE5CC,SAAS,CAAC;EACZ,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGV,KAAK,CAACO,QAAQ,CAAoC,CAAC;EAE7E,IAAI,CAACF,QAAQ,IAAI,CAACI,KAAK,EAAE;IACvBL,MAAM,CAACO,aAAa,CAACR,IAAI,CAAC,CAACS,IAAI,CAAEC,eAAe,IAAK;MACnDP,WAAW,CAACO,eAAiC,CAAC;IAChD,CAAC,CAAC,CAACC,KAAK,CAAEL,KAAc,IAAK;MAC3B,MAAMM,YAAY,GAAGN,KAAK,YAAYO,KAAK,GACvCP,KAAK,CAACQ,OAAO,GACbC,MAAM,CAACT,KAAK,CAAC;MACjBC,QAAQ,CAACK,YAAY,CAAC;IACxB,CAAC,CAAC;IACF,OAAO;MAAEI,OAAO,EAAE;IAAK,CAAC;EAC1B;EAEA,OAAO;IAAEA,OAAO,EAAE,KAAK;IAAEd,QAAQ;IAAEI;EAAM,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React3 = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
8
|
+
|
|
9
|
+
// src/useOsdkClient.ts
|
|
10
|
+
function fakeClientFn(..._args) {
|
|
11
|
+
throw new Error("This is not a real client. Did you forget to <OsdkContext.Provider>?");
|
|
12
|
+
}
|
|
13
|
+
var fakeClient = Object.assign(fakeClientFn, {
|
|
14
|
+
fetchMetadata: fakeClientFn
|
|
15
|
+
});
|
|
16
|
+
var OsdkContext = /* @__PURE__ */ React3__default.default.createContext({
|
|
17
|
+
client: fakeClient
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// src/useOsdkClient.ts
|
|
21
|
+
function useOsdkClient() {
|
|
22
|
+
return React3__default.default.useContext(OsdkContext).client;
|
|
23
|
+
}
|
|
24
|
+
function useOsdkMetadata(type) {
|
|
25
|
+
const client = useOsdkClient();
|
|
26
|
+
const [metadata, setMetadata] = React3__default.default.useState(void 0);
|
|
27
|
+
const [error, setError] = React3__default.default.useState();
|
|
28
|
+
if (!metadata && !error) {
|
|
29
|
+
client.fetchMetadata(type).then((fetchedMetadata) => {
|
|
30
|
+
setMetadata(fetchedMetadata);
|
|
31
|
+
}).catch((error2) => {
|
|
32
|
+
const errorMessage = error2 instanceof Error ? error2.message : String(error2);
|
|
33
|
+
setError(errorMessage);
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
loading: true
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
loading: false,
|
|
41
|
+
metadata,
|
|
42
|
+
error
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.OsdkContext = OsdkContext;
|
|
47
|
+
exports.useOsdkClient = useOsdkClient;
|
|
48
|
+
exports.useOsdkMetadata = useOsdkMetadata;
|
|
49
|
+
//# sourceMappingURL=chunk-OVBG5VXE.cjs.map
|
|
50
|
+
//# sourceMappingURL=chunk-OVBG5VXE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/OsdkContext.ts","../../src/useOsdkClient.ts","../../src/useOsdkMetadata.ts"],"names":["React","error"],"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;AACY,IAAA,WAAA,2CAAiC,aAAc,CAAA;AAAA,EAC1D,MAAQ,EAAA;AACV,CAAC;;;ACPM,SAAS,aAAgB,GAAA;AAC9B,EAAOA,OAAAA,uBAAAA,CAAM,UAAW,CAAA,WAAW,CAAE,CAAA,MAAA;AACvC;ACFO,SAAS,gBAAgB,IAAM,EAAA;AACpC,EAAA,MAAM,SAAS,aAAc,EAAA;AAC7B,EAAA,MAAM,CAAC,QAAU,EAAA,WAAW,CAAIA,GAAAA,uBAAAA,CAAM,SAAS,MAAS,CAAA;AACxD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIA,wBAAM,QAAS,EAAA;AACzC,EAAI,IAAA,CAAC,QAAY,IAAA,CAAC,KAAO,EAAA;AACvB,IAAA,MAAA,CAAO,aAAc,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,CAAmB,eAAA,KAAA;AACjD,MAAA,WAAA,CAAY,eAAe,CAAA;AAAA,KAC5B,CAAA,CAAE,KAAM,CAAA,CAAAC,MAAS,KAAA;AAChB,MAAA,MAAM,eAAeA,MAAiB,YAAA,KAAA,GAAQA,MAAM,CAAA,OAAA,GAAU,OAAOA,MAAK,CAAA;AAC1E,MAAA,QAAA,CAAS,YAAY,CAAA;AAAA,KACtB,CAAA;AACD,IAAO,OAAA;AAAA,MACL,OAAS,EAAA;AAAA,KACX;AAAA;AAEF,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,KAAA;AAAA,IACT,QAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-OVBG5VXE.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 OsdkContext = /*#__PURE__*/React.createContext({\n client: fakeClient\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 React from \"react\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nexport function useOsdkClient() {\n return React.useContext(OsdkContext).client;\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 React from \"react\";\nimport { useOsdkClient } from \"./useOsdkClient.js\";\nexport function useOsdkMetadata(type) {\n const client = useOsdkClient();\n const [metadata, setMetadata] = React.useState(undefined);\n const [error, setError] = React.useState();\n if (!metadata && !error) {\n client.fetchMetadata(type).then(fetchedMetadata => {\n setMetadata(fetchedMetadata);\n }).catch(error => {\n const errorMessage = error instanceof Error ? error.message : String(error);\n setError(errorMessage);\n });\n return {\n loading: true\n };\n }\n return {\n loading: false,\n metadata,\n error\n };\n}"]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOVBG5VXE_cjs = require('./chunk-OVBG5VXE.cjs');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
6
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -11,36 +11,21 @@ function OsdkProvider({
|
|
|
11
11
|
children,
|
|
12
12
|
client
|
|
13
13
|
}) {
|
|
14
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
14
|
+
return /* @__PURE__ */ React__default.default.createElement(chunkOVBG5VXE_cjs.OsdkContext.Provider, {
|
|
15
15
|
value: {
|
|
16
16
|
client
|
|
17
17
|
}
|
|
18
18
|
}, children);
|
|
19
19
|
}
|
|
20
|
-
function useOsdkMetadata(type) {
|
|
21
|
-
const client = chunk2N32USW5_cjs.useOsdkClient();
|
|
22
|
-
const [metadata, setMetadata] = React__default.default.useState(void 0);
|
|
23
|
-
if (!metadata) {
|
|
24
|
-
client.fetchMetadata(type).then((fetchedMetadata) => {
|
|
25
|
-
setMetadata(fetchedMetadata);
|
|
26
|
-
}).catch((error) => {
|
|
27
|
-
console.error("Failed to fetch metadata", error);
|
|
28
|
-
});
|
|
29
|
-
return {
|
|
30
|
-
loading: true
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
loading: false,
|
|
35
|
-
metadata
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
20
|
|
|
39
21
|
Object.defineProperty(exports, "useOsdkClient", {
|
|
40
22
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkClient; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "useOsdkMetadata", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkMetadata; }
|
|
42
28
|
});
|
|
43
29
|
exports.OsdkProvider = OsdkProvider;
|
|
44
|
-
exports.useOsdkMetadata = useOsdkMetadata;
|
|
45
30
|
//# sourceMappingURL=index.cjs.map
|
|
46
31
|
//# sourceMappingURL=index.cjs.map
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OsdkProvider.tsx"
|
|
1
|
+
{"version":3,"sources":["../../src/OsdkProvider.tsx"],"names":["React","OsdkContext"],"mappings":";;;;;;;;;AAkBO,SAAS,YAAa,CAAA;AAAA,EAC3B,QAAA;AAAA,EACA;AACF,CAAG,EAAA;AACD,EAAoB,uBAAAA,sBAAA,CAAM,aAAc,CAAAC,6BAAA,CAAY,QAAU,EAAA;AAAA,IAC5D,KAAO,EAAA;AAAA,MACL;AAAA;AACF,KACC,QAAQ,CAAA;AACb","file":"index.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\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nexport function OsdkProvider({\n children,\n client\n}) {\n return /*#__PURE__*/React.createElement(OsdkContext.Provider, {\n value: {\n client\n }\n }, children);\n}"]}
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { Client } from '@osdk/client';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export { u as useOsdkClient } from './
|
|
4
|
-
import
|
|
3
|
+
export { u as useOsdkClient, a as useOsdkMetadata } from './useOsdkMetadata-DFZhnhGZ.cjs';
|
|
4
|
+
import '@osdk/api';
|
|
5
5
|
|
|
6
6
|
declare function OsdkProvider({ children, client, }: {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
client: Client;
|
|
9
9
|
}): React.JSX.Element;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
declare function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(type: T): {
|
|
13
|
-
loading: boolean;
|
|
14
|
-
metadata?: MetadataFor<T>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { OsdkProvider, useOsdkMetadata };
|
|
11
|
+
export { OsdkProvider };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOVBG5VXE_cjs = require('../chunk-OVBG5VXE.cjs');
|
|
4
4
|
var unstableDoNotUse = require('@osdk/client/unstable-do-not-use');
|
|
5
5
|
var React4 = require('react');
|
|
6
6
|
var client = require('@osdk/client');
|
|
@@ -32,7 +32,7 @@ function OsdkProvider2({
|
|
|
32
32
|
client,
|
|
33
33
|
observableClient
|
|
34
34
|
}
|
|
35
|
-
}, /* @__PURE__ */ React4__default.default.createElement(
|
|
35
|
+
}, /* @__PURE__ */ React4__default.default.createElement(chunkOVBG5VXE_cjs.OsdkContext.Provider, {
|
|
36
36
|
value: {
|
|
37
37
|
client
|
|
38
38
|
}
|
|
@@ -277,7 +277,11 @@ function useOsdkObjects(type, {
|
|
|
277
277
|
|
|
278
278
|
Object.defineProperty(exports, "useOsdkClient", {
|
|
279
279
|
enumerable: true,
|
|
280
|
-
get: function () { return
|
|
280
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkClient; }
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, "useOsdkMetadata", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkMetadata; }
|
|
281
285
|
});
|
|
282
286
|
exports.OsdkProvider2 = OsdkProvider2;
|
|
283
287
|
exports.useLinks = useLinks;
|
|
@@ -2,7 +2,7 @@ import { Client, ObjectTypeDefinition, Osdk, InterfaceDefinition, WhereClause, P
|
|
|
2
2
|
import { ObservableClient, ActionSignatureFromDef } from '@osdk/client/unstable-do-not-use';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { LinkNames, LinkedType, ObjectTypeDefinition as ObjectTypeDefinition$1, Osdk as Osdk$1, PrimaryKeyType } from '@osdk/api';
|
|
5
|
-
export { u as useOsdkClient } from '../
|
|
5
|
+
export { U as UseOsdkMetadataResult, u as useOsdkClient, a as useOsdkMetadata } from '../useOsdkMetadata-DFZhnhGZ.cjs';
|
|
6
6
|
|
|
7
7
|
interface OsdkProviderOptions {
|
|
8
8
|
children: React.ReactNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client } from '@osdk/client';
|
|
2
|
+
import { ObjectOrInterfaceDefinition, InterfaceDefinition, InterfaceMetadata, ObjectTypeDefinition, ObjectMetadata } from '@osdk/api';
|
|
3
|
+
|
|
4
|
+
declare function useOsdkClient(): Client;
|
|
5
|
+
|
|
6
|
+
type MetadataFor<T extends ObjectOrInterfaceDefinition> = T extends InterfaceDefinition ? InterfaceMetadata : T extends ObjectTypeDefinition ? ObjectMetadata : never;
|
|
7
|
+
interface UseOsdkMetadataResult<T extends ObjectOrInterfaceDefinition> {
|
|
8
|
+
loading: boolean;
|
|
9
|
+
metadata?: MetadataFor<T>;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(type: T): UseOsdkMetadataResult<T>;
|
|
13
|
+
|
|
14
|
+
export { type UseOsdkMetadataResult as U, useOsdkMetadata as a, useOsdkClient as u };
|
|
@@ -20,4 +20,5 @@ export { useOsdkAction } from "../new/useOsdkAction.js";
|
|
|
20
20
|
export { useOsdkObject } from "../new/useOsdkObject.js";
|
|
21
21
|
export { useOsdkObjects } from "../new/useOsdkObjects.js";
|
|
22
22
|
export { useOsdkClient } from "../useOsdkClient.js";
|
|
23
|
+
export { useOsdkMetadata } from "../useOsdkMetadata.js";
|
|
23
24
|
//# sourceMappingURL=experimental.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":["OsdkProvider2","useLinks","useOsdkAction","useOsdkObject","useOsdkObjects","useOsdkClient"],"sources":["experimental.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 { OsdkProvider2 } from \"../new/OsdkProvider2.js\";\nexport { useLinks } from \"../new/useLinks.js\";\nexport { useOsdkAction } from \"../new/useOsdkAction.js\";\nexport { useOsdkObject } from \"../new/useOsdkObject.js\";\nexport type { UseOsdkListResult } from \"../new/useOsdkObjects.js\";\nexport { useOsdkObjects } from \"../new/useOsdkObjects.js\";\nexport { useOsdkClient } from \"../useOsdkClient.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["OsdkProvider2","useLinks","useOsdkAction","useOsdkObject","useOsdkObjects","useOsdkClient","useOsdkMetadata"],"sources":["experimental.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 { OsdkProvider2 } from \"../new/OsdkProvider2.js\";\nexport { useLinks } from \"../new/useLinks.js\";\nexport { useOsdkAction } from \"../new/useOsdkAction.js\";\nexport { useOsdkObject } from \"../new/useOsdkObject.js\";\nexport type { UseOsdkListResult } from \"../new/useOsdkObjects.js\";\nexport { useOsdkObjects } from \"../new/useOsdkObjects.js\";\nexport { useOsdkClient } from \"../useOsdkClient.js\";\nexport { useOsdkMetadata } from \"../useOsdkMetadata.js\";\nexport type { UseOsdkMetadataResult } from \"../useOsdkMetadata.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,eAAe,QAAQ,uBAAuB","ignoreList":[]}
|
|
@@ -19,12 +19,13 @@ import { useOsdkClient } from "./useOsdkClient.js";
|
|
|
19
19
|
export function useOsdkMetadata(type) {
|
|
20
20
|
const client = useOsdkClient();
|
|
21
21
|
const [metadata, setMetadata] = React.useState(undefined);
|
|
22
|
-
|
|
22
|
+
const [error, setError] = React.useState();
|
|
23
|
+
if (!metadata && !error) {
|
|
23
24
|
client.fetchMetadata(type).then(fetchedMetadata => {
|
|
24
25
|
setMetadata(fetchedMetadata);
|
|
25
26
|
}).catch(error => {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
28
|
+
setError(errorMessage);
|
|
28
29
|
});
|
|
29
30
|
return {
|
|
30
31
|
loading: true
|
|
@@ -32,7 +33,8 @@ export function useOsdkMetadata(type) {
|
|
|
32
33
|
}
|
|
33
34
|
return {
|
|
34
35
|
loading: false,
|
|
35
|
-
metadata
|
|
36
|
+
metadata,
|
|
37
|
+
error
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
//# sourceMappingURL=useOsdkMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkMetadata.js","names":["React","useOsdkClient","useOsdkMetadata","type","client","metadata","setMetadata","useState","undefined","fetchMetadata","then","fetchedMetadata","catch","
|
|
1
|
+
{"version":3,"file":"useOsdkMetadata.js","names":["React","useOsdkClient","useOsdkMetadata","type","client","metadata","setMetadata","useState","undefined","error","setError","fetchMetadata","then","fetchedMetadata","catch","errorMessage","Error","message","String","loading"],"sources":["useOsdkMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectOrInterfaceDefinition,\n ObjectTypeDefinition,\n} from \"@osdk/api\";\nimport React from \"react\";\nimport { useOsdkClient } from \"./useOsdkClient.js\";\n\ntype MetadataFor<T extends ObjectOrInterfaceDefinition> = T extends\n InterfaceDefinition ? InterfaceMetadata\n : T extends ObjectTypeDefinition ? ObjectMetadata\n : never;\n\nexport interface UseOsdkMetadataResult<T extends ObjectOrInterfaceDefinition> {\n loading: boolean;\n metadata?: MetadataFor<T>;\n error?: string;\n}\n\nexport function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(\n type: T,\n): UseOsdkMetadataResult<T> {\n const client = useOsdkClient();\n const [metadata, setMetadata] = React.useState<\n MetadataFor<T> | undefined\n >(undefined);\n const [error, setError] = React.useState<UseOsdkMetadataResult<T>[\"error\"]>();\n\n if (!metadata && !error) {\n client.fetchMetadata(type).then((fetchedMetadata) => {\n setMetadata(fetchedMetadata as MetadataFor<T>);\n }).catch((error: unknown) => {\n const errorMessage = error instanceof Error\n ? error.message\n : String(error);\n setError(errorMessage);\n });\n return { loading: true };\n }\n\n return { loading: false, metadata, error };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,oBAAoB;AAalD,OAAO,SAASC,eAAeA,CAC7BC,IAAO,EACmB;EAC1B,MAAMC,MAAM,GAAGH,aAAa,CAAC,CAAC;EAC9B,MAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAE5CC,SAAS,CAAC;EACZ,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGV,KAAK,CAACO,QAAQ,CAAoC,CAAC;EAE7E,IAAI,CAACF,QAAQ,IAAI,CAACI,KAAK,EAAE;IACvBL,MAAM,CAACO,aAAa,CAACR,IAAI,CAAC,CAACS,IAAI,CAAEC,eAAe,IAAK;MACnDP,WAAW,CAACO,eAAiC,CAAC;IAChD,CAAC,CAAC,CAACC,KAAK,CAAEL,KAAc,IAAK;MAC3B,MAAMM,YAAY,GAAGN,KAAK,YAAYO,KAAK,GACvCP,KAAK,CAACQ,OAAO,GACbC,MAAM,CAACT,KAAK,CAAC;MACjBC,QAAQ,CAACK,YAAY,CAAC;IACxB,CAAC,CAAC;IACF,OAAO;MAAEI,OAAO,EAAE;IAAK,CAAC;EAC1B;EAEA,OAAO;IAAEA,OAAO,EAAE,KAAK;IAAEd,QAAQ;IAAEI;EAAM,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -5,3 +5,5 @@ export { useOsdkObject } from "../new/useOsdkObject.js";
|
|
|
5
5
|
export type { UseOsdkListResult } from "../new/useOsdkObjects.js";
|
|
6
6
|
export { useOsdkObjects } from "../new/useOsdkObjects.js";
|
|
7
7
|
export { useOsdkClient } from "../useOsdkClient.js";
|
|
8
|
+
export { useOsdkMetadata } from "../useOsdkMetadata.js";
|
|
9
|
+
export type { UseOsdkMetadataResult } from "../useOsdkMetadata.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,cAAc,yBAAyB;AACvC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,cAAc,yBAAyB;AACvC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,cAAc,6BAA6B","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { InterfaceDefinition, InterfaceMetadata, ObjectMetadata, ObjectOrInterfaceDefinition, ObjectTypeDefinition } from "@osdk/api";
|
|
2
2
|
type MetadataFor<T extends ObjectOrInterfaceDefinition> = T extends InterfaceDefinition ? InterfaceMetadata : T extends ObjectTypeDefinition ? ObjectMetadata : never;
|
|
3
|
-
export
|
|
4
|
-
loading: boolean
|
|
5
|
-
metadata?: MetadataFor<T
|
|
6
|
-
|
|
3
|
+
export interface UseOsdkMetadataResult<T extends ObjectOrInterfaceDefinition> {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
metadata?: MetadataFor<T>;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(type: T): UseOsdkMetadataResult<T>;
|
|
7
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,qBACA,mBACA,gBACA,6BACA,4BACK,WAAY;KAId,YAAY,UAAU,+BAA+B,UACxD,sBAAsB,oBACpB,UAAU,uBAAuB;AAGrC,OAAO,iBAAS,gBAAgB,UAAU,6BACxCA,MAAM,IACL
|
|
1
|
+
{"mappings":"AAgBA,cACE,qBACA,mBACA,gBACA,6BACA,4BACK,WAAY;KAId,YAAY,UAAU,+BAA+B,UACxD,sBAAsB,oBACpB,UAAU,uBAAuB;AAGrC,iBAAiB,sBAAsB,UAAU,6BAA6B;CAC5E;CACA,WAAW,YAAY;CACvB;AACD;AAED,OAAO,iBAAS,gBAAgB,UAAU,6BACxCA,MAAM,IACL,sBAAsB","names":["type: T"],"sources":["../../src/useOsdkMetadata.ts"],"version":3,"file":"useOsdkMetadata.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react",
|
|
3
|
-
"version": "0.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"react-dom": "^17 || ^18 || ^19"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@testing-library/react": "^16.0
|
|
47
|
-
"@types/react": "^18.3.
|
|
46
|
+
"@testing-library/react": "^16.3.0",
|
|
47
|
+
"@types/react": "^18.3.24",
|
|
48
48
|
"happy-dom": "^16.8.1",
|
|
49
49
|
"p-defer": "^4.0.1",
|
|
50
|
-
"react": "^18.
|
|
50
|
+
"react": "^18.3.1",
|
|
51
51
|
"tiny-invariant": "^1.3.3",
|
|
52
52
|
"typescript": "~5.5.4",
|
|
53
|
-
"@osdk/api": "2.5.0-beta.
|
|
53
|
+
"@osdk/api": "2.5.0-beta.5",
|
|
54
54
|
"@osdk/monorepo.api-extractor": "~0.4.0-beta.1",
|
|
55
|
-
"@osdk/
|
|
56
|
-
"@osdk/
|
|
55
|
+
"@osdk/client": "2.5.0-beta.5",
|
|
56
|
+
"@osdk/monorepo.tsconfig": "~0.4.0-beta.1"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
|
|
5
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
-
|
|
7
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
8
|
-
|
|
9
|
-
// src/useOsdkClient.ts
|
|
10
|
-
function fakeClientFn(..._args) {
|
|
11
|
-
throw new Error("This is not a real client. Did you forget to <OsdkContext.Provider>?");
|
|
12
|
-
}
|
|
13
|
-
var fakeClient = Object.assign(fakeClientFn, {
|
|
14
|
-
fetchMetadata: fakeClientFn
|
|
15
|
-
});
|
|
16
|
-
var OsdkContext = /* @__PURE__ */ React__default.default.createContext({
|
|
17
|
-
client: fakeClient
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// src/useOsdkClient.ts
|
|
21
|
-
function useOsdkClient() {
|
|
22
|
-
return React__default.default.useContext(OsdkContext).client;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
exports.OsdkContext = OsdkContext;
|
|
26
|
-
exports.useOsdkClient = useOsdkClient;
|
|
27
|
-
//# sourceMappingURL=chunk-2N32USW5.cjs.map
|
|
28
|
-
//# sourceMappingURL=chunk-2N32USW5.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OsdkContext.ts","../../src/useOsdkClient.ts"],"names":["React"],"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;AACY,IAAA,WAAA,0CAAiC,aAAc,CAAA;AAAA,EAC1D,MAAQ,EAAA;AACV,CAAC;;;ACPM,SAAS,aAAgB,GAAA;AAC9B,EAAOA,OAAAA,sBAAAA,CAAM,UAAW,CAAA,WAAW,CAAE,CAAA,MAAA;AACvC","file":"chunk-2N32USW5.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 OsdkContext = /*#__PURE__*/React.createContext({\n client: fakeClient\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 React from \"react\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nexport function useOsdkClient() {\n return React.useContext(OsdkContext).client;\n}"]}
|