@osdk/react 0.3.0-beta.2 → 0.3.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build/browser/OsdkContext.js +2 -1
  3. package/build/browser/OsdkContext.js.map +1 -1
  4. package/build/browser/OsdkProvider.js +2 -1
  5. package/build/browser/OsdkProvider.js.map +1 -1
  6. package/build/browser/index.js +5 -0
  7. package/build/browser/index.js.map +1 -1
  8. package/build/browser/new/OsdkContext2.js +28 -0
  9. package/build/browser/new/OsdkContext2.js.map +1 -0
  10. package/build/browser/new/OsdkProvider2.js +31 -0
  11. package/build/browser/new/OsdkProvider2.js.map +1 -0
  12. package/build/browser/new/makeExternalStore.js +39 -0
  13. package/build/browser/new/makeExternalStore.js.map +1 -0
  14. package/build/browser/new/useOsdkAction.js +49 -0
  15. package/build/browser/new/useOsdkAction.js.map +1 -0
  16. package/build/browser/new/useOsdkList.js +40 -0
  17. package/build/browser/new/useOsdkList.js.map +1 -0
  18. package/build/browser/new/useOsdkObject.js +60 -0
  19. package/build/browser/new/useOsdkObject.js.map +1 -0
  20. package/build/browser/public/experimental.js +22 -0
  21. package/build/browser/public/experimental.js.map +1 -0
  22. package/build/browser/useOsdkClient.js +1 -0
  23. package/build/browser/useOsdkClient.js.map +1 -1
  24. package/build/browser/useOsdkMetadata.js +1 -0
  25. package/build/browser/useOsdkMetadata.js.map +1 -1
  26. package/build/cjs/chunk-2N32USW5.cjs +28 -0
  27. package/build/cjs/chunk-2N32USW5.cjs.map +1 -0
  28. package/build/cjs/index.cjs +27 -0
  29. package/build/cjs/index.cjs.map +1 -0
  30. package/build/cjs/index.d.cts +10 -0
  31. package/build/cjs/public/experimental.cjs +142 -0
  32. package/build/cjs/public/experimental.cjs.map +1 -0
  33. package/build/cjs/public/experimental.d.cts +71 -0
  34. package/build/cjs/useOsdkClient-B4iwHO1H.d.cts +5 -0
  35. package/build/esm/OsdkContext.js +2 -1
  36. package/build/esm/OsdkContext.js.map +1 -1
  37. package/build/esm/OsdkProvider.js +2 -1
  38. package/build/esm/OsdkProvider.js.map +1 -1
  39. package/build/esm/index.js +5 -0
  40. package/build/esm/index.js.map +1 -1
  41. package/build/esm/new/OsdkContext2.js +28 -0
  42. package/build/esm/new/OsdkContext2.js.map +1 -0
  43. package/build/esm/new/OsdkProvider2.js +31 -0
  44. package/build/esm/new/OsdkProvider2.js.map +1 -0
  45. package/build/esm/new/makeExternalStore.js +39 -0
  46. package/build/esm/new/makeExternalStore.js.map +1 -0
  47. package/build/esm/new/useOsdkAction.js +49 -0
  48. package/build/esm/new/useOsdkAction.js.map +1 -0
  49. package/build/esm/new/useOsdkList.js +40 -0
  50. package/build/esm/new/useOsdkList.js.map +1 -0
  51. package/build/esm/new/useOsdkObject.js +60 -0
  52. package/build/esm/new/useOsdkObject.js.map +1 -0
  53. package/build/esm/public/experimental.js +22 -0
  54. package/build/esm/public/experimental.js.map +1 -0
  55. package/build/esm/useOsdkClient.js +1 -0
  56. package/build/esm/useOsdkClient.js.map +1 -1
  57. package/build/esm/useOsdkMetadata.js +1 -0
  58. package/build/esm/useOsdkMetadata.js.map +1 -1
  59. package/build/{browser → types}/OsdkContext.d.ts +1 -2
  60. package/build/types/OsdkContext.d.ts.map +1 -0
  61. package/build/types/OsdkProvider.d.ts +6 -0
  62. package/build/types/OsdkProvider.d.ts.map +1 -0
  63. package/build/{browser → types}/index.d.ts +3 -1
  64. package/build/types/index.d.ts.map +1 -0
  65. package/build/types/new/OsdkContext2.d.ts +9 -0
  66. package/build/types/new/OsdkContext2.d.ts.map +1 -0
  67. package/build/types/new/OsdkProvider2.d.ts +10 -0
  68. package/build/types/new/OsdkProvider2.d.ts.map +1 -0
  69. package/build/types/new/makeExternalStore.d.ts +5 -0
  70. package/build/types/new/makeExternalStore.d.ts.map +1 -0
  71. package/build/types/new/useOsdkAction.d.ts +12 -0
  72. package/build/types/new/useOsdkAction.d.ts.map +1 -0
  73. package/build/types/new/useOsdkList.d.ts +26 -0
  74. package/build/types/new/useOsdkList.d.ts.map +1 -0
  75. package/build/types/new/useOsdkObject.d.ts +21 -0
  76. package/build/types/new/useOsdkObject.d.ts.map +1 -0
  77. package/build/types/public/experimental.d.ts +5 -0
  78. package/build/types/public/experimental.d.ts.map +1 -0
  79. package/build/{browser → types}/useOsdkClient.d.ts +0 -1
  80. package/build/types/useOsdkClient.d.ts.map +1 -0
  81. package/build/{browser → types}/useOsdkMetadata.d.ts +2 -3
  82. package/build/types/useOsdkMetadata.d.ts.map +1 -0
  83. package/experimental.d.ts +17 -0
  84. package/package.json +34 -11
  85. package/build/browser/OsdkContext.d.ts.map +0 -1
  86. package/build/browser/OsdkProvider.d.ts +0 -7
  87. package/build/browser/OsdkProvider.d.ts.map +0 -1
  88. package/build/browser/index.d.ts.map +0 -1
  89. package/build/browser/useOsdkClient.d.ts.map +0 -1
  90. package/build/browser/useOsdkMetadata.d.ts.map +0 -1
  91. package/build/esm/OsdkContext.d.ts +0 -6
  92. package/build/esm/OsdkContext.d.ts.map +0 -1
  93. package/build/esm/OsdkProvider.d.ts +0 -7
  94. package/build/esm/OsdkProvider.d.ts.map +0 -1
  95. package/build/esm/index.d.ts +0 -3
  96. package/build/esm/index.d.ts.map +0 -1
  97. package/build/esm/useOsdkClient.d.ts +0 -3
  98. package/build/esm/useOsdkClient.d.ts.map +0 -1
  99. package/build/esm/useOsdkMetadata.d.ts +0 -8
  100. package/build/esm/useOsdkMetadata.d.ts.map +0 -1
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export { OsdkProvider2 } from "../new/OsdkProvider2.js";
18
+ export { useOsdkAction } from "../new/useOsdkAction.js";
19
+ export { useOsdkList } from "../new/useOsdkList.js";
20
+ export { useOsdkObject } from "../new/useOsdkObject.js";
21
+ export { useOsdkClient } from "../useOsdkClient.js";
22
+ //# sourceMappingURL=experimental.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental.js","names":["OsdkProvider2","useOsdkAction","useOsdkList","useOsdkObject","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 { useOsdkAction } from \"../new/useOsdkAction.js\";\nexport { useOsdkList } from \"../new/useOsdkList.js\";\nexport { useOsdkObject } from \"../new/useOsdkObject.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,aAAa,QAAQ,yBAAyB;AACvD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,aAAa,QAAQ,qBAAqB","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import React from "react";
17
18
  import { OsdkContext } from "./OsdkContext.js";
18
19
  export function useOsdkClient() {
@@ -1 +1 @@
1
- {"version":3,"file":"useOsdkClient.js","names":["React","OsdkContext","useOsdkClient","useContext","client"],"sources":["useOsdkClient.js"],"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 */\nimport React from \"react\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nexport function useOsdkClient() {\n return React.useContext(OsdkContext).client;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC5B,OAAOF,KAAK,CAACG,UAAU,CAACF,WAAW,CAAC,CAACG,MAAM;AAC/C","ignoreList":[]}
1
+ {"version":3,"file":"useOsdkClient.js","names":["React","OsdkContext","useOsdkClient","useContext","client"],"sources":["useOsdkClient.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 { Client } from \"@osdk/client\";\nimport React from \"react\";\nimport { OsdkContext } from \"./OsdkContext.js\";\n\nexport function useOsdkClient(): Client {\n return React.useContext(OsdkContext).client;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,OAAO,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAOF,KAAK,CAACG,UAAU,CAACF,WAAW,CAAC,CAACG,MAAM;AAC7C","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import React from "react";
17
18
  import { useOsdkClient } from "./useOsdkClient.js";
18
19
  export function useOsdkMetadata(type) {
@@ -1 +1 @@
1
- {"version":3,"file":"useOsdkMetadata.js","names":["React","useOsdkClient","useOsdkMetadata","type","client","metadata","setMetadata","useState","undefined","fetchMetadata","then","fetchedMetadata","catch","error","console","loading"],"sources":["useOsdkMetadata.js"],"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 */\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 if (!metadata) {\n client.fetchMetadata(type).then((fetchedMetadata) => {\n setMetadata(fetchedMetadata);\n }).catch((error) => {\n // eslint-disable-next-line no-console\n console.error(\"Failed to fetch metadata\", error);\n });\n return { loading: true };\n }\n return { loading: false, metadata };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAO,SAASC,eAAeA,CAACC,IAAI,EAAE;EAClC,MAAMC,MAAM,GAAGH,aAAa,CAAC,CAAC;EAC9B,MAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAACC,SAAS,CAAC;EACzD,IAAI,CAACH,QAAQ,EAAE;IACXD,MAAM,CAACK,aAAa,CAACN,IAAI,CAAC,CAACO,IAAI,CAAEC,eAAe,IAAK;MACjDL,WAAW,CAACK,eAAe,CAAC;IAChC,CAAC,CAAC,CAACC,KAAK,CAAEC,KAAK,IAAK;MAChB;MACAC,OAAO,CAACD,KAAK,CAAC,0BAA0B,EAAEA,KAAK,CAAC;IACpD,CAAC,CAAC;IACF,OAAO;MAAEE,OAAO,EAAE;IAAK,CAAC;EAC5B;EACA,OAAO;IAAEA,OAAO,EAAE,KAAK;IAAEV;EAAS,CAAC;AACvC","ignoreList":[]}
1
+ {"version":3,"file":"useOsdkMetadata.js","names":["React","useOsdkClient","useOsdkMetadata","type","client","metadata","setMetadata","useState","undefined","fetchMetadata","then","fetchedMetadata","catch","error","console","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 function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(\n type: T,\n): {\n loading: boolean;\n metadata?: MetadataFor<T>;\n} {\n const client = useOsdkClient();\n const [metadata, setMetadata] = React.useState<\n MetadataFor<T> | undefined\n >(undefined);\n\n if (!metadata) {\n client.fetchMetadata(type).then((fetchedMetadata) => {\n setMetadata(fetchedMetadata as MetadataFor<T>);\n }).catch((error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Failed to fetch metadata\", error);\n });\n return { loading: true };\n }\n\n return { loading: false, metadata };\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;AAOlD,OAAO,SAASC,eAAeA,CAC7BC,IAAO,EAIP;EACA,MAAMC,MAAM,GAAGH,aAAa,CAAC,CAAC;EAC9B,MAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAE5CC,SAAS,CAAC;EAEZ,IAAI,CAACH,QAAQ,EAAE;IACbD,MAAM,CAACK,aAAa,CAACN,IAAI,CAAC,CAACO,IAAI,CAAEC,eAAe,IAAK;MACnDL,WAAW,CAACK,eAAiC,CAAC;IAChD,CAAC,CAAC,CAACC,KAAK,CAAEC,KAAc,IAAK;MAC3B;MACAC,OAAO,CAACD,KAAK,CAAC,0BAA0B,EAAEA,KAAK,CAAC;IAClD,CAAC,CAAC;IACF,OAAO;MAAEE,OAAO,EAAE;IAAK,CAAC;EAC1B;EAEA,OAAO;IAAEA,OAAO,EAAE,KAAK;IAAEV;EAAS,CAAC;AACrC","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  import type { Client } from "@osdk/client";
2
2
  import React from "react";
3
3
  export declare const OsdkContext: React.Context<{
4
- client: Client;
4
+ client: Client
5
5
  }>;
6
- //# sourceMappingURL=OsdkContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,cAAc,cAAe;AAC3C,OAAO,WAAW,OAAQ;AAY1B,OAAO,cAAMA,aAAa,MAAM,QAAQ;CACtC,QAAQ;AACT","names":["OsdkContext: React.Context<{\n client: Client;\n}>"],"sources":["../../src/OsdkContext.ts"],"version":3,"file":"OsdkContext.d.ts"}
@@ -0,0 +1,6 @@
1
+ import type { Client } from "@osdk/client";
2
+ import React from "react";
3
+ export declare function OsdkProvider({ children, client }: {
4
+ children: React.ReactNode
5
+ client: Client
6
+ }): React.JSX.Element;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,cAAc,cAAe;AAC3C,OAAO,WAAW,OAAQ;AAG1B,OAAO,iBAAS,aAAa,EAC3B,UACA,QAID,EAHE;CACD,UAAU,MAAM;CAChB,QAAQ;AACT,IAAG,MAAM,IAAI","names":[],"sources":["../../src/OsdkProvider.tsx"],"version":3,"file":"OsdkProvider.d.ts"}
@@ -1,3 +1,5 @@
1
+ /**
2
+ * @module @osdk/react
3
+ */
1
4
  export { OsdkProvider } from "./OsdkProvider.js";
2
5
  export { useOsdkClient } from "./useOsdkClient.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAoBA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
@@ -0,0 +1,9 @@
1
+ import type { Client } from "@osdk/client";
2
+ import type { ObservableClient } from "@osdk/client/unstable-do-not-use";
3
+ import React from "react";
4
+ interface OsdkContextContents {
5
+ client: Client;
6
+ store: ObservableClient;
7
+ }
8
+ export declare const OsdkContext2: React.Context<OsdkContextContents>;
9
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,cAAc,cAAe;AAC3C,cAAc,wBAAwB,kCAAmC;AACzE,OAAO,WAAW,OAAQ;UAYhB,oBAAoB;CAC5B,QAAQ;CAKR,OAAO;AACR;AAED,OAAO,cAAMA,cAAc,MAAM,QAAQ","names":["OsdkContext2: React.Context<OsdkContextContents>"],"sources":["../../../src/new/OsdkContext2.ts"],"version":3,"file":"OsdkContext2.d.ts"}
@@ -0,0 +1,10 @@
1
+ import type { Client } from "@osdk/client";
2
+ import type { ObservableClient } from "@osdk/client/unstable-do-not-use";
3
+ import React from "react";
4
+ interface OsdkProviderOptions {
5
+ children: React.ReactNode;
6
+ client: Client;
7
+ store: ObservableClient;
8
+ }
9
+ export declare function OsdkProvider2({ children, client, store }: OsdkProviderOptions): React.JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,cAAc,cAAe;AAC3C,cAAc,wBAAwB,kCAAmC;AACzE,OAAO,WAAW,OAAQ;UAGhB,oBAAoB;CAC5B,UAAU,MAAM;CAChB,QAAQ;CACR,OAAO;AACR;AAED,OAAO,iBAAS,cAAc,EAC5B,UACA,QACA,OACoB,EAAnB,sBAAsB,MAAM,IAAI","names":[],"sources":["../../../src/new/OsdkProvider2.tsx"],"version":3,"file":"OsdkProvider2.d.ts"}
@@ -0,0 +1,5 @@
1
+ import type { Unsubscribable } from "@osdk/client/unstable-do-not-use";
2
+ export declare function makeExternalStore<X>(createObservation: (callback: (x: X | undefined) => void) => Unsubscribable, name?: string): {
3
+ subscribe: (notifyUpdate: () => void) => () => void
4
+ getSnapShot: () => X | undefined
5
+ };
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,sBAAsB,kCAAmC;AAEvE,OAAO,iBAAS,kBAAkB,GAChCA,oBAAoBC,WAAWC,GAAG,2BAA2B,gBAC7DC,gBACC;CACD,YAAYC;CACZ,mBAAmB;AACpB","names":["createObservation: (callback: (x: X | undefined) => void) => Unsubscribable","callback: (x: X | undefined) => void","x: X | undefined","name?: string","notifyUpdate: () => void"],"sources":["../../../src/new/makeExternalStore.ts"],"version":3,"file":"makeExternalStore.d.ts"}
@@ -0,0 +1,12 @@
1
+ import type { ActionDefinition } from "@osdk/client";
2
+ import { ActionValidationError } from "@osdk/client";
3
+ import type { ActionSignatureFromDef, ObservableClient } from "@osdk/client/unstable-do-not-use";
4
+ export interface UseOsdkActionResult<Q extends ActionDefinition<any>> {
5
+ applyAction: (args: Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0], opts: ObservableClient.ApplyActionOptions) => Promise<unknown>;
6
+ error: undefined | Partial<{
7
+ actionValidation: ActionValidationError
8
+ unknown: unknown
9
+ }>;
10
+ data: unknown;
11
+ }
12
+ export declare function useOsdkAction<Q extends ActionDefinition<any>>(actionDef: Q): UseOsdkActionResult<Q>;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,wBAAwB,cAAe;AACrD,SAAS,6BAA6B,cAAe;AACrD,cACE,wBACA,wBACK,kCAAmC;AAI1C,iBAAiB,oBAAoB,UAAU,uBAAuB;CACpE,cACEA,MAAM,WAAW,uBAAuB,GAAG,gBAAgB,IAC3DC,MAAM,iBAAiB,uBACpB;CAEL,mBAEI,QAAQ;EACR,kBAAkB;EAClB;CACD;CACH;AACD;AAED,OAAO,iBAAS,cAAc,UAAU,uBACtCC,WAAW,IACV,oBAAoB","names":["args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]","opts: ObservableClient.ApplyActionOptions","actionDef: Q"],"sources":["../../../src/new/useOsdkAction.ts"],"version":3,"file":"useOsdkAction.d.ts"}
@@ -0,0 +1,26 @@
1
+ import type { ObjectTypeDefinition, Osdk, WhereClause } from "@osdk/client";
2
+ export interface UseOsdkListOptions<T extends ObjectTypeDefinition> {
3
+ where: WhereClause<T>;
4
+ /**
5
+ * The number of milliseconds to wait after the last observed list change.
6
+ *
7
+ * Two uses of `useOsdkList` with the where clause will only trigger one
8
+ * network request if the second is within `dedupeIntervalMs`.
9
+ */
10
+ dedupeIntervalMs?: number;
11
+ }
12
+ export interface UseOsdkListResult<T extends ObjectTypeDefinition> {
13
+ fetchMore: (() => Promise<unknown>) | undefined;
14
+ data: Osdk.Instance<T>[];
15
+ isLoading: boolean;
16
+ error: undefined;
17
+ /**
18
+ * Refers to whether the ordered list of objects (only considering the $primaryKey)
19
+ * is optimistic or not.
20
+ *
21
+ * If you need to know if the contents of the list are optimistic you can
22
+ * do that on a per object basis with useOsdkObject
23
+ */
24
+ isOptimistic: boolean;
25
+ }
26
+ export declare function useOsdkList<T extends ObjectTypeDefinition>(type: T, opts: UseOsdkListOptions<T>): UseOsdkListResult<T>;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,sBAAsB,MAAM,mBAAmB,cAAe;AAM5E,iBAAiB,mBAAmB,UAAU,sBAAsB;CAClE,OAAO,YAAY;;;;;;;CAQnB;AACD;AACD,iBAAiB,kBAAkB,UAAU,sBAAsB;CACjE,kBAAkB;CAClB,MAAM,KAAK,SAAS;CACpB;CAGA;;;;;;;;CASA;AACD;AAED,OAAO,iBAAS,YAAY,UAAU,sBACpCA,MAAM,GACNC,MAAM,mBAAmB,KACxB,kBAAkB","names":["type: T","opts: UseOsdkListOptions<T>"],"sources":["../../../src/new/useOsdkList.ts"],"version":3,"file":"useOsdkList.d.ts"}
@@ -0,0 +1,21 @@
1
+ import type { ObjectTypeDefinition, Osdk, PrimaryKeyType } from "@osdk/api";
2
+ export interface UseOsdkObjectResult<Q extends ObjectTypeDefinition> {
3
+ object: Osdk.Instance<Q> | undefined;
4
+ isLoading: boolean;
5
+ /**
6
+ * Refers to whether the object is optimistic or not.
7
+ */
8
+ isOptimistic: boolean;
9
+ forceUpdate: () => void;
10
+ }
11
+ /**
12
+ * @param obj an existing `Osdk.Instance` object to get metadata for.
13
+ */
14
+ export declare function useOsdkObject<Q extends ObjectTypeDefinition>(obj: Osdk.Instance<Q>): UseOsdkObjectResult<Q>;
15
+ /**
16
+ * Loads an object by type and primary key.
17
+ *
18
+ * @param type
19
+ * @param primaryKey
20
+ */
21
+ export declare function useOsdkObject<Q extends ObjectTypeDefinition>(type: Q, primaryKey: PrimaryKeyType<Q>): UseOsdkObjectResult<Q>;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,sBAAsB,MAAM,sBAAsB,WAAY;AAM5E,iBAAiB,oBAAoB,UAAU,sBAAsB;CACnE,QAAQ,KAAK,SAAS;CACtB;;;;CAKA;CACA;AACD;;;;AAKD,OAAO,iBAAS,cAAc,UAAU,sBACtCA,KAAK,KAAK,SAAS,KAClB,oBAAoB;;;;;;;AAOvB,OAAO,iBAAS,cAAc,UAAU,sBACtCC,MAAM,GACNC,YAAY,eAAe,KAC1B,oBAAoB","names":["obj: Osdk.Instance<Q>","type: Q","primaryKey: PrimaryKeyType<Q>"],"sources":["../../../src/new/useOsdkObject.ts"],"version":3,"file":"useOsdkObject.d.ts"}
@@ -0,0 +1,5 @@
1
+ export { OsdkProvider2 } from "../new/OsdkProvider2.js";
2
+ export { useOsdkAction } from "../new/useOsdkAction.js";
3
+ export { useOsdkList } from "../new/useOsdkList.js";
4
+ export { useOsdkObject } from "../new/useOsdkObject.js";
5
+ export { useOsdkClient } from "../useOsdkClient.js";
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
@@ -1,3 +1,2 @@
1
1
  import type { Client } from "@osdk/client";
2
2
  export declare function useOsdkClient(): Client;
3
- //# sourceMappingURL=useOsdkClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,cAAc,cAAe;AAI3C,OAAO,iBAAS,iBAAiB","names":[],"sources":["../../src/useOsdkClient.ts"],"version":3,"file":"useOsdkClient.d.ts"}
@@ -1,8 +1,7 @@
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
3
  export declare function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(type: T): {
4
- loading: boolean;
5
- metadata?: MetadataFor<T>;
4
+ loading: boolean
5
+ metadata?: MetadataFor<T>
6
6
  };
7
7
  export {};
8
- //# sourceMappingURL=useOsdkMetadata.d.ts.map
@@ -0,0 +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;CACD;CACA,WAAW,YAAY;AACxB","names":["type: T"],"sources":["../../src/useOsdkMetadata.ts"],"version":3,"file":"useOsdkMetadata.d.ts"}
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export * from "./build/cjs/public/experimental.cjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/react",
3
- "version": "0.3.0-beta.2",
3
+ "version": "0.3.0-rc.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,12 +9,29 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "browser": "./build/browser/index.js",
12
- "import": "./build/esm/index.js",
12
+ "import": {
13
+ "types": "./build/types/index.d.ts",
14
+ "default": "./build/esm/index.js"
15
+ },
16
+ "require": "./build/cjs/index.cjs",
13
17
  "default": "./build/browser/index.js"
14
18
  },
19
+ "./experimental": {
20
+ "browser": "./build/browser/public/experimental.js",
21
+ "import": {
22
+ "types": "./build/types/public/experimental.d.ts",
23
+ "default": "./build/esm/public/experimental.js"
24
+ },
25
+ "require": "./build/cjs/public/experimental.cjs",
26
+ "default": "./build/browser/public/experimental.js"
27
+ },
15
28
  "./*": {
16
29
  "browser": "./build/browser/public/*.js",
17
- "import": "./build/esm/public/*.js",
30
+ "import": {
31
+ "types": "./build/types/public/*.d.ts",
32
+ "default": "./build/esm/public/*.js"
33
+ },
34
+ "require": "./build/cjs/public/*.cjs",
18
35
  "default": "./build/browser/public/*.js"
19
36
  }
20
37
  },
@@ -28,15 +45,14 @@
28
45
  "devDependencies": {
29
46
  "@testing-library/react": "^16.0.1",
30
47
  "@types/react": "^18.3.12",
31
- "happy-dom": "^15.7.4",
48
+ "happy-dom": "^16.8.1",
32
49
  "p-defer": "^4.0.1",
33
50
  "react": "^18.0.0",
34
51
  "typescript": "~5.5.4",
35
- "@osdk/client": "2.1.0-beta.22",
36
- "@osdk/api": "2.1.0-beta.22",
52
+ "@osdk/api": "2.1.0-rc.32",
53
+ "@osdk/client": "2.1.0-rc.32",
37
54
  "@osdk/monorepo.api-extractor": "~0.0.0",
38
- "@osdk/monorepo.tsconfig": "~0.0.0",
39
- "@osdk/monorepo.tsup": "~0.0.0"
55
+ "@osdk/monorepo.tsconfig": "~0.0.0"
40
56
  },
41
57
  "publishConfig": {
42
58
  "access": "public"
@@ -45,21 +61,28 @@
45
61
  "build/cjs",
46
62
  "build/esm",
47
63
  "build/browser",
64
+ "build/types",
48
65
  "CHANGELOG.md",
49
66
  "package.json",
50
67
  "templates",
51
68
  "*.d.ts"
52
69
  ],
70
+ "main": "./build/cjs/index.cjs",
53
71
  "module": "./build/esm/index.js",
54
- "types": "./build/esm/index.d.ts",
72
+ "types": "./build/cjs/index.d.cts",
55
73
  "type": "module",
56
74
  "scripts": {
57
- "check-attw": "monorepo.tool.attw esm",
75
+ "apiDocs": "npx typedoc ",
76
+ "check-attw": "attw --pack .",
58
77
  "check-spelling": "cspell --quiet .",
59
78
  "clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
60
79
  "fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
61
80
  "lint": "eslint . && dprint check --config $(find-up dprint.json)",
62
81
  "test": "vitest run",
63
- "transpile": "monorepo.tool.transpile"
82
+ "transpileBrowser": "monorepo.tool.transpile -f esm -m normal -t browser",
83
+ "transpileCjs": "monorepo.tool.transpile -f cjs -m bundle -t node",
84
+ "transpileEsm": "monorepo.tool.transpile -f esm -m normal -t node",
85
+ "transpileTypes": "monorepo.tool.transpile -f esm -m types -t node",
86
+ "typecheck": "tsc --noEmit --emitDeclarationOnly false"
64
87
  }
65
88
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"OsdkContext.d.ts","sourceRoot":"","sources":["../../src/OsdkContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB,CAEC,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { Client } from "@osdk/client";
2
- import React from "react";
3
- export declare function OsdkProvider({ children, client, }: {
4
- children: React.ReactNode;
5
- client: Client;
6
- }): React.JSX.Element;
7
- //# sourceMappingURL=OsdkProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OsdkProvider.d.ts","sourceRoot":"","sources":["../../src/OsdkProvider.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,qBAIA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOsdkClient.d.ts","sourceRoot":"","sources":["../../src/useOsdkClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOsdkMetadata.d.ts","sourceRoot":"","sources":["../../src/useOsdkMetadata.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,WAAW,CAAC;AAInB,KAAK,WAAW,CAAC,CAAC,SAAS,2BAA2B,IAAI,CAAC,SACzD,mBAAmB,GAAG,iBAAiB,GACrC,CAAC,SAAS,oBAAoB,GAAG,cAAc,GAC/C,KAAK,CAAC;AAEV,wBAAgB,eAAe,CAAC,CAAC,SAAS,2BAA2B,EACnE,IAAI,EAAE,CAAC,GACN;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CAC3B,CAiBA"}
@@ -1,6 +0,0 @@
1
- import type { Client } from "@osdk/client";
2
- import React from "react";
3
- export declare const OsdkContext: React.Context<{
4
- client: Client;
5
- }>;
6
- //# sourceMappingURL=OsdkContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OsdkContext.d.ts","sourceRoot":"","sources":["../../src/OsdkContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB,CAEC,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { Client } from "@osdk/client";
2
- import React from "react";
3
- export declare function OsdkProvider({ children, client, }: {
4
- children: React.ReactNode;
5
- client: Client;
6
- }): React.JSX.Element;
7
- //# sourceMappingURL=OsdkProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OsdkProvider.d.ts","sourceRoot":"","sources":["../../src/OsdkProvider.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,qBAIA"}
@@ -1,3 +0,0 @@
1
- export { OsdkProvider } from "./OsdkProvider.js";
2
- export { useOsdkClient } from "./useOsdkClient.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Client } from "@osdk/client";
2
- export declare function useOsdkClient(): Client;
3
- //# sourceMappingURL=useOsdkClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOsdkClient.d.ts","sourceRoot":"","sources":["../../src/useOsdkClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
@@ -1,8 +0,0 @@
1
- import type { InterfaceDefinition, InterfaceMetadata, ObjectMetadata, ObjectOrInterfaceDefinition, ObjectTypeDefinition } from "@osdk/api";
2
- type MetadataFor<T extends ObjectOrInterfaceDefinition> = T extends InterfaceDefinition ? InterfaceMetadata : T extends ObjectTypeDefinition ? ObjectMetadata : never;
3
- export declare function useOsdkMetadata<T extends ObjectOrInterfaceDefinition>(type: T): {
4
- loading: boolean;
5
- metadata?: MetadataFor<T>;
6
- };
7
- export {};
8
- //# sourceMappingURL=useOsdkMetadata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOsdkMetadata.d.ts","sourceRoot":"","sources":["../../src/useOsdkMetadata.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,WAAW,CAAC;AAInB,KAAK,WAAW,CAAC,CAAC,SAAS,2BAA2B,IAAI,CAAC,SACzD,mBAAmB,GAAG,iBAAiB,GACrC,CAAC,SAAS,oBAAoB,GAAG,cAAc,GAC/C,KAAK,CAAC;AAEV,wBAAgB,eAAe,CAAC,CAAC,SAAS,2BAA2B,EACnE,IAAI,EAAE,CAAC,GACN;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CAC3B,CAiBA"}