@osdk/react 0.9.3 → 0.10.0-beta.10
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/AGENTS.md +46 -221
- package/CHANGELOG.md +109 -51
- package/build/browser/new/makeExternalStore.js +61 -0
- package/build/browser/new/makeExternalStore.js.map +1 -1
- package/build/browser/new/useLinks.js +11 -4
- package/build/browser/new/useLinks.js.map +1 -1
- package/build/browser/new/useObjectSet.js +6 -3
- package/build/browser/new/useObjectSet.js.map +1 -1
- package/build/browser/new/useOsdkAction.js +2 -2
- package/build/browser/new/useOsdkAction.js.map +1 -1
- package/build/browser/new/useOsdkAggregation.js +65 -27
- package/build/browser/new/useOsdkAggregation.js.map +1 -1
- package/build/browser/new/useOsdkFunction.js +17 -12
- package/build/browser/new/useOsdkFunction.js.map +1 -1
- package/build/browser/new/useOsdkObject.js +36 -17
- package/build/browser/new/useOsdkObject.js.map +1 -1
- package/build/browser/new/useOsdkObjects.js +28 -19
- package/build/browser/new/useOsdkObjects.js.map +1 -1
- package/build/browser/{intellisense.test.helpers/useOsdkObjectsWithPivot.js → public/experimental/admin.js} +4 -19
- package/build/browser/public/experimental/admin.js.map +1 -0
- package/build/browser/public/experimental.js +0 -3
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/useOsdkMetadata.js.map +1 -1
- package/build/cjs/{chunk-V32JHU3O.cjs → chunk-OVBG5VXE.cjs} +3 -8
- package/build/cjs/chunk-OVBG5VXE.cjs.map +1 -0
- package/build/cjs/chunk-SVVMLSKN.cjs +111 -0
- package/build/cjs/chunk-SVVMLSKN.cjs.map +1 -0
- package/build/cjs/index.cjs +4 -4
- package/build/cjs/index.d.cts +1 -1
- package/build/cjs/public/experimental/admin.cjs +146 -0
- package/build/cjs/public/experimental/admin.cjs.map +1 -0
- package/build/cjs/public/experimental/admin.d.cts +118 -0
- package/build/cjs/public/experimental.cjs +217 -478
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +88 -127
- package/build/cjs/useOsdkMetadata-BElt3F5s.d.cts +15 -0
- package/build/esm/new/makeExternalStore.js +61 -0
- package/build/esm/new/makeExternalStore.js.map +1 -1
- package/build/esm/new/useLinks.js +11 -4
- package/build/esm/new/useLinks.js.map +1 -1
- package/build/esm/new/useObjectSet.js +6 -3
- package/build/esm/new/useObjectSet.js.map +1 -1
- package/build/esm/new/useOsdkAction.js +2 -2
- package/build/esm/new/useOsdkAction.js.map +1 -1
- package/build/esm/new/useOsdkAggregation.js +65 -27
- package/build/esm/new/useOsdkAggregation.js.map +1 -1
- package/build/esm/new/useOsdkFunction.js +17 -12
- package/build/esm/new/useOsdkFunction.js.map +1 -1
- package/build/esm/new/useOsdkObject.js +36 -17
- package/build/esm/new/useOsdkObject.js.map +1 -1
- package/build/esm/new/useOsdkObjects.js +28 -19
- package/build/esm/new/useOsdkObjects.js.map +1 -1
- package/build/esm/{intellisense.test.helpers/useOsdkObjectsWithPivot.js → public/experimental/admin.js} +4 -19
- package/build/esm/public/experimental/admin.js.map +1 -0
- package/build/esm/public/experimental.js +0 -3
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/useOsdkMetadata.js.map +1 -1
- package/build/types/new/makeExternalStore.d.ts +11 -0
- package/build/types/new/makeExternalStore.d.ts.map +1 -1
- package/build/types/new/useLinks.d.ts +19 -0
- package/build/types/new/useLinks.d.ts.map +1 -1
- package/build/types/new/useObjectSet.d.ts +6 -0
- package/build/types/new/useObjectSet.d.ts.map +1 -1
- package/build/types/new/useOsdkAggregation.d.ts +41 -3
- package/build/types/new/useOsdkAggregation.d.ts.map +1 -1
- package/build/types/new/useOsdkFunction.d.ts +11 -5
- package/build/types/new/useOsdkFunction.d.ts.map +1 -1
- package/build/types/new/useOsdkObject.d.ts +12 -1
- package/build/types/new/useOsdkObject.d.ts.map +1 -1
- package/build/types/new/useOsdkObjects.d.ts +10 -0
- package/build/types/new/useOsdkObjects.d.ts.map +1 -1
- package/build/types/public/experimental/admin.d.ts +3 -0
- package/build/types/public/experimental/admin.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +0 -3
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/useOsdkMetadata.d.ts +5 -4
- package/build/types/useOsdkMetadata.d.ts.map +1 -1
- package/docs/querying-data.md +19 -0
- package/{build/esm/intellisense.test.helpers/useOsdkObjectsWithProperties.js → experimental/admin.d.ts} +1 -18
- package/package.json +29 -8
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithPivot.js.map +0 -1
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithProperties.js +0 -34
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithProperties.js.map +0 -1
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithRids.js +0 -37
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithRids.js.map +0 -1
- package/build/browser/intellisense.test.js +0 -172
- package/build/browser/intellisense.test.js.map +0 -1
- package/build/cjs/chunk-V32JHU3O.cjs.map +0 -1
- package/build/cjs/useOsdkMetadata-DFZhnhGZ.d.cts +0 -14
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithPivot.js.map +0 -1
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithProperties.js.map +0 -1
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithRids.js +0 -37
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithRids.js.map +0 -1
- package/build/esm/intellisense.test.js +0 -172
- package/build/esm/intellisense.test.js.map +0 -1
- package/build/types/intellisense.test.d.ts +0 -1
- package/build/types/intellisense.test.d.ts.map +0 -1
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithPivot.d.ts +0 -1
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithPivot.d.ts.map +0 -1
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithProperties.d.ts +0 -1
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithProperties.d.ts.map +0 -1
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithRids.d.ts +0 -1
- package/build/types/intellisense.test.helpers/useOsdkObjectsWithRids.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-beta.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,6 +25,15 @@
|
|
|
25
25
|
"require": "./build/cjs/public/experimental.cjs",
|
|
26
26
|
"default": "./build/browser/public/experimental.js"
|
|
27
27
|
},
|
|
28
|
+
"./experimental/admin": {
|
|
29
|
+
"browser": "./build/browser/public/experimental/admin.js",
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./build/types/public/experimental/admin.d.ts",
|
|
32
|
+
"default": "./build/esm/public/experimental/admin.js"
|
|
33
|
+
},
|
|
34
|
+
"require": "./build/cjs/public/experimental/admin.cjs",
|
|
35
|
+
"default": "./build/browser/public/experimental/admin.js"
|
|
36
|
+
},
|
|
28
37
|
"./*": {
|
|
29
38
|
"browser": "./build/browser/public/*.js",
|
|
30
39
|
"import": {
|
|
@@ -38,13 +47,23 @@
|
|
|
38
47
|
"peerDependencies": {
|
|
39
48
|
"@osdk/api": "*",
|
|
40
49
|
"@osdk/client": "*",
|
|
50
|
+
"@osdk/foundry.admin": "*",
|
|
51
|
+
"@osdk/foundry.core": "*",
|
|
41
52
|
"@types/react": "^17 || ^18 || ^19",
|
|
42
53
|
"react": "^17 || ^18 || ^19",
|
|
43
54
|
"react-dom": "^17 || ^18 || ^19"
|
|
44
55
|
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"@osdk/foundry.admin": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"@osdk/foundry.core": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
45
64
|
"devDependencies": {
|
|
46
|
-
"@osdk/foundry.admin": "2.
|
|
47
|
-
"@osdk/foundry.core": "2.
|
|
65
|
+
"@osdk/foundry.admin": "2.50.0",
|
|
66
|
+
"@osdk/foundry.core": "2.50.0",
|
|
48
67
|
"@testing-library/react": "^16.3.0",
|
|
49
68
|
"@types/react": "^18.3.24",
|
|
50
69
|
"find-up": "^8.0.0",
|
|
@@ -57,11 +76,11 @@
|
|
|
57
76
|
"react": "^18.3.1",
|
|
58
77
|
"tiny-invariant": "^1.3.3",
|
|
59
78
|
"typescript": "~5.5.4",
|
|
60
|
-
"@osdk/
|
|
61
|
-
"@osdk/client": "2.
|
|
62
|
-
"@osdk/
|
|
63
|
-
"@osdk/monorepo.
|
|
64
|
-
"@osdk/monorepo.
|
|
79
|
+
"@osdk/api": "2.8.0-beta.22",
|
|
80
|
+
"@osdk/client": "2.8.0-beta.22",
|
|
81
|
+
"@osdk/client.test.ontology": "2.8.0-beta.22",
|
|
82
|
+
"@osdk/monorepo.tsconfig": "~0.7.0-beta.1",
|
|
83
|
+
"@osdk/monorepo.api-extractor": "~0.7.0-beta.1"
|
|
65
84
|
},
|
|
66
85
|
"publishConfig": {
|
|
67
86
|
"access": "public"
|
|
@@ -69,6 +88,7 @@
|
|
|
69
88
|
"files": [
|
|
70
89
|
"AGENTS.md",
|
|
71
90
|
"docs",
|
|
91
|
+
"experimental",
|
|
72
92
|
"build/cjs",
|
|
73
93
|
"build/esm",
|
|
74
94
|
"build/browser",
|
|
@@ -81,6 +101,7 @@
|
|
|
81
101
|
"main": "./build/cjs/index.cjs",
|
|
82
102
|
"module": "./build/esm/index.js",
|
|
83
103
|
"types": "./build/cjs/index.d.cts",
|
|
104
|
+
"sideEffects": false,
|
|
84
105
|
"type": "module",
|
|
85
106
|
"scripts": {
|
|
86
107
|
"apiDocs": "npx typedoc ",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithPivot.js","names":["Employee","useOsdkObjects","TestComponent","data","pivotTo"],"sources":["useOsdkObjectsWithPivot.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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\ndeclare const MyComponent: () => void;\n\nfunction TestComponent() {\n const { data } = useOsdkObjects(Employee, {\n pivotTo: \"lead\",\n });\n\n // Line 31: Check that data has the correct pivoted type\n const firstItem = data?.[0];\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAIzD,SAASC,aAAaA,CAAA,EAAG;EACvB,MAAM;IAAEC;EAAK,CAAC,GAAGF,cAAc,CAACD,QAAQ,EAAE;IACxCI,OAAO,EAAE;EACX,CAAC,CAAC;;EAEF;EACkBD,IAAI,GAAG,CAAC,CAAC;EAE3B,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
// WARNING!
|
|
18
|
-
// WARNING!
|
|
19
|
-
// This file is used for tests that check intellisense. Editing this file by hand will likely
|
|
20
|
-
// break tests that have hard coded line numbers and line offsets.
|
|
21
|
-
|
|
22
|
-
import { Employee } from "@osdk/client.test.ontology";
|
|
23
|
-
import { useOsdkObjects } from "@osdk/react/experimental";
|
|
24
|
-
function TestComponent() {
|
|
25
|
-
const {
|
|
26
|
-
data
|
|
27
|
-
} = useOsdkObjects(Employee, {
|
|
28
|
-
withProperties: {
|
|
29
|
-
constantValue: employee => employee.selectProperty("class")
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=useOsdkObjectsWithProperties.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithProperties.js","names":["Employee","useOsdkObjects","TestComponent","data","withProperties","constantValue","employee","selectProperty"],"sources":["useOsdkObjectsWithProperties.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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction TestComponent() {\n const withProps: DerivedProperty.Clause<typeof Employee> = {\n constantValue: (employee) => employee.selectProperty(\"class\"),\n };\n\n const { data } = useOsdkObjects(Employee, {\n withProperties: withProps,\n });\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SAASC,aAAaA,CAAA,EAAG;EAKvB,MAAM;IAAEC;EAAK,CAAC,GAAGF,cAAc,CAACD,QAAQ,EAAE;IACxCI,cAAc,EAL2C;MACzDC,aAAa,EAAGC,QAAQ,IAAKA,QAAQ,CAACC,cAAc,CAAC,OAAO;IAC9D;EAIA,CAAC,CAAC;EAEF,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 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
|
-
// WARNING!
|
|
18
|
-
// WARNING!
|
|
19
|
-
// This file is used for tests that check intellisense. Editing this file by hand will likely
|
|
20
|
-
// break tests that have hard coded line numbers and line offsets.
|
|
21
|
-
|
|
22
|
-
import { Employee } from "@osdk/client.test.ontology";
|
|
23
|
-
import { useOsdkObjects } from "@osdk/react/experimental";
|
|
24
|
-
function TestComponent() {
|
|
25
|
-
const {
|
|
26
|
-
data: ridsData
|
|
27
|
-
} = useOsdkObjects(Employee, {
|
|
28
|
-
rids: ["ri.foo.123"]
|
|
29
|
-
});
|
|
30
|
-
ridsData?.[0];
|
|
31
|
-
const {
|
|
32
|
-
data: noRidsData
|
|
33
|
-
} = useOsdkObjects(Employee);
|
|
34
|
-
noRidsData?.[0];
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=useOsdkObjectsWithRids.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithRids.js","names":["Employee","useOsdkObjects","TestComponent","data","ridsData","rids","noRidsData"],"sources":["useOsdkObjectsWithRids.ts"],"sourcesContent":["/*\n * Copyright 2026 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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction TestComponent() {\n const { data: ridsData } = useOsdkObjects(Employee, {\n rids: [\"ri.foo.123\"],\n });\n\n const ridsItem = ridsData?.[0];\n\n const { data: noRidsData } = useOsdkObjects(Employee);\n\n const noRidsItem = noRidsData?.[0];\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SAASC,aAAaA,CAAA,EAAG;EACvB,MAAM;IAAEC,IAAI,EAAEC;EAAS,CAAC,GAAGH,cAAc,CAACD,QAAQ,EAAE;IAClDK,IAAI,EAAE,CAAC,YAAY;EACrB,CAAC,CAAC;EAEeD,QAAQ,GAAG,CAAC,CAAC;EAE9B,MAAM;IAAED,IAAI,EAAEG;EAAW,CAAC,GAAGL,cAAc,CAACD,QAAQ,CAAC;EAElCM,UAAU,GAAG,CAAC,CAAC;EAElC,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { startTsServer } from "@osdk/client/internal-node";
|
|
18
|
-
import { findUpSync } from "find-up";
|
|
19
|
-
import * as path from "node:path";
|
|
20
|
-
import invariant from "tiny-invariant";
|
|
21
|
-
import * as ts from "typescript";
|
|
22
|
-
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
23
|
-
|
|
24
|
-
// it needs to be hoisted because its referenced from our mocked WebSocket
|
|
25
|
-
// which must be hoisted to work
|
|
26
|
-
const rootLogger = await vi.hoisted(async () => {
|
|
27
|
-
const pino = (await import("pino")).pino;
|
|
28
|
-
const pinoPretty = await import("pino-pretty");
|
|
29
|
-
const {
|
|
30
|
-
EventEmitter
|
|
31
|
-
} = await import("node:events");
|
|
32
|
-
return Promise.resolve(pino({
|
|
33
|
-
level: "info"
|
|
34
|
-
}, pinoPretty.build({
|
|
35
|
-
sync: true,
|
|
36
|
-
timestampKey: undefined,
|
|
37
|
-
errorLikeObjectKeys: ["error", "err", "exception"],
|
|
38
|
-
errorProps: "stack,cause,properties",
|
|
39
|
-
ignore: "time,hostname,pid",
|
|
40
|
-
destination: new class extends EventEmitter {
|
|
41
|
-
write(a) {
|
|
42
|
-
// remove trailing newline since console.log adds one
|
|
43
|
-
if (a.at(-1) === "\n") a = a.slice(0, -1);
|
|
44
|
-
|
|
45
|
-
// This lets the test framework aggregate the logs per test, whereas direct to stdout does not
|
|
46
|
-
console.log(a);
|
|
47
|
-
}
|
|
48
|
-
}()
|
|
49
|
-
})));
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @vitest-environment node
|
|
54
|
-
* @vitest-pool forks
|
|
55
|
-
*/
|
|
56
|
-
describe("intellisense", () => {
|
|
57
|
-
let packagesDir;
|
|
58
|
-
let reactPackagePath;
|
|
59
|
-
beforeAll(() => {
|
|
60
|
-
const reactPackageJson = findUpSync("package.json", {
|
|
61
|
-
cwd: import.meta.dirname
|
|
62
|
-
});
|
|
63
|
-
console.log({
|
|
64
|
-
reactPackageJson
|
|
65
|
-
});
|
|
66
|
-
!(reactPackageJson != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
67
|
-
packagesDir = path.join(path.dirname(reactPackageJson), "..");
|
|
68
|
-
reactPackagePath = path.join(packagesDir, "react");
|
|
69
|
-
});
|
|
70
|
-
let tsServer;
|
|
71
|
-
let intellisenseFilePath;
|
|
72
|
-
beforeEach(async a => {
|
|
73
|
-
intellisenseFilePath = path.join(reactPackagePath, "src", "intellisense.test.helpers", `${a.task.name}.ts`);
|
|
74
|
-
console.log(intellisenseFilePath);
|
|
75
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
76
|
-
try {
|
|
77
|
-
tsServer = await startTsServer(rootLogger);
|
|
78
|
-
await tsServer.sendOpenRequest({
|
|
79
|
-
file: intellisenseFilePath
|
|
80
|
-
});
|
|
81
|
-
} catch (error) {
|
|
82
|
-
if (tsServer) {
|
|
83
|
-
try {
|
|
84
|
-
tsServer.stop();
|
|
85
|
-
} catch {
|
|
86
|
-
// Ignore cleanup errors
|
|
87
|
-
}
|
|
88
|
-
tsServer = undefined;
|
|
89
|
-
}
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
afterEach(() => {
|
|
94
|
-
if (tsServer) {
|
|
95
|
-
tsServer.stop();
|
|
96
|
-
tsServer = undefined;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
it("useOsdkObjectsWithPivot", {
|
|
100
|
-
timeout: 40_000
|
|
101
|
-
}, async () => {
|
|
102
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
103
|
-
!tsServer ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
104
|
-
const {
|
|
105
|
-
resp
|
|
106
|
-
} = await tsServer.sendCompletionsRequest({
|
|
107
|
-
file: intellisenseFilePath,
|
|
108
|
-
line: 29,
|
|
109
|
-
offset: 15,
|
|
110
|
-
triggerKind: ts.CompletionTriggerKind.Invoked
|
|
111
|
-
});
|
|
112
|
-
const completions = resp.body?.entries.map(e => e.name) ?? [];
|
|
113
|
-
expect(completions).toContain("lead");
|
|
114
|
-
const {
|
|
115
|
-
resp: typeResp
|
|
116
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
117
|
-
file: intellisenseFilePath,
|
|
118
|
-
line: 33,
|
|
119
|
-
offset: 10
|
|
120
|
-
});
|
|
121
|
-
expect(typeResp.body?.displayString).toBeDefined();
|
|
122
|
-
expect(typeResp.body?.displayString).toContain("Employee");
|
|
123
|
-
});
|
|
124
|
-
it("useOsdkObjectsWithRids", {
|
|
125
|
-
timeout: 40_000
|
|
126
|
-
}, async () => {
|
|
127
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
128
|
-
!tsServer ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
129
|
-
const {
|
|
130
|
-
resp: ridsResp
|
|
131
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
132
|
-
file: intellisenseFilePath,
|
|
133
|
-
line: 30,
|
|
134
|
-
offset: 9
|
|
135
|
-
});
|
|
136
|
-
expect(ridsResp.body?.displayString).toBeDefined();
|
|
137
|
-
expect(ridsResp.body?.displayString).toContain("$rid");
|
|
138
|
-
const {
|
|
139
|
-
resp: noRidsResp
|
|
140
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
141
|
-
file: intellisenseFilePath,
|
|
142
|
-
line: 34,
|
|
143
|
-
offset: 9
|
|
144
|
-
});
|
|
145
|
-
expect(noRidsResp.body?.displayString).toBeDefined();
|
|
146
|
-
expect(noRidsResp.body?.displayString).not.toContain("$rid");
|
|
147
|
-
});
|
|
148
|
-
it("useOsdkObjectsWithProperties", {
|
|
149
|
-
timeout: 40_000
|
|
150
|
-
}, async () => {
|
|
151
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
152
|
-
!tsServer ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
153
|
-
const {
|
|
154
|
-
resp
|
|
155
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
156
|
-
file: intellisenseFilePath,
|
|
157
|
-
line: 27,
|
|
158
|
-
offset: 10
|
|
159
|
-
});
|
|
160
|
-
expect(resp.body?.displayString).toContain("DerivedProperty.Clause");
|
|
161
|
-
const {
|
|
162
|
-
resp: dataResp
|
|
163
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
164
|
-
file: intellisenseFilePath,
|
|
165
|
-
line: 31,
|
|
166
|
-
offset: 11
|
|
167
|
-
});
|
|
168
|
-
expect(dataResp.body?.displayString).toBeDefined();
|
|
169
|
-
expect(dataResp.body?.displayString).toContain("Osdk.Instance<Employee");
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
//# sourceMappingURL=intellisense.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intellisense.test.js","names":["startTsServer","findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","reactPackagePath","reactPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","error","stop","timeout","resp","sendCompletionsRequest","line","offset","triggerKind","CompletionTriggerKind","Invoked","completions","body","entries","map","e","toContain","typeResp","sendQuickInfoRequest","displayString","toBeDefined","ridsResp","noRidsResp","not","dataResp"],"sources":["intellisense.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport type { TsServer } from \"@osdk/client/internal-node\";\nimport { startTsServer } from \"@osdk/client/internal-node\";\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\n/**\n * @vitest-environment node\n * @vitest-pool forks\n */\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let reactPackagePath: string;\n\n beforeAll(() => {\n const reactPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ reactPackageJson });\n invariant(reactPackageJson != null);\n packagesDir = path.join(\n path.dirname(reactPackageJson),\n \"..\",\n );\n\n reactPackagePath = path.join(packagesDir, \"react\");\n });\n\n let tsServer: TsServer | undefined;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n reactPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n try {\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n } catch (error) {\n if (tsServer) {\n try {\n tsServer.stop();\n } catch {\n // Ignore cleanup errors\n }\n tsServer = undefined;\n }\n throw error;\n }\n });\n\n afterEach(() => {\n if (tsServer) {\n tsServer.stop();\n tsServer = undefined;\n }\n });\n\n it(\"useOsdkObjectsWithPivot\", { timeout: 40_000 }, async () => {\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n invariant(tsServer);\n\n const { resp } = await tsServer.sendCompletionsRequest({\n file: intellisenseFilePath,\n line: 29,\n offset: 15,\n triggerKind: ts.CompletionTriggerKind.Invoked,\n });\n\n const completions = resp.body?.entries.map(e => e.name) ?? [];\n expect(completions).toContain(\"lead\");\n\n const { resp: typeResp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 33,\n offset: 10,\n });\n\n expect(typeResp.body?.displayString).toBeDefined();\n expect(typeResp.body?.displayString).toContain(\"Employee\");\n });\n\n it(\"useOsdkObjectsWithRids\", { timeout: 40_000 }, async () => {\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n invariant(tsServer);\n\n const { resp: ridsResp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 30,\n offset: 9,\n });\n\n expect(ridsResp.body?.displayString).toBeDefined();\n expect(ridsResp.body?.displayString).toContain(\"$rid\");\n\n const { resp: noRidsResp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 34,\n offset: 9,\n });\n\n expect(noRidsResp.body?.displayString).toBeDefined();\n expect(noRidsResp.body?.displayString).not.toContain(\"$rid\");\n });\n\n it(\"useOsdkObjectsWithProperties\", { timeout: 40_000 }, async () => {\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n invariant(tsServer);\n\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 10,\n });\n\n expect(resp.body?.displayString).toContain(\"DerivedProperty.Clause\");\n\n const { resp: dataResp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 31,\n offset: 11,\n });\n\n expect(dataResp.body?.displayString).toBeDefined();\n expect(dataResp.body?.displayString).toContain(\"Osdk.Instance<Employee\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SACEC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,EAAE,EACFC,EAAE,QACG,QAAQ;;AAEf;AACA;AACA,MAAMC,UAAU,GAAG,MAAMD,EAAE,CAACE,OAAO,CAAC,YAA6B;EAC/D,MAAMC,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAEA,IAAI;EACxC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAUpD,OAAOC,OAAO,CAACC,OAAO,CAACJ,IAAI,CACzB;IAAEK,KAAK,EAAE;EAAO,CAAC,EAChBJ,UAAU,CAACK,KAAK,CAAE;IACjBC,IAAI,EAAE,IAAI;IACVC,YAAY,EAAEC,SAAS;IACvBC,mBAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC;IAClDC,UAAU,EAAE,wBAAwB;IACpCC,MAAM,EAAE,mBAAmB;IAC3BC,WAAW,EAAE,IAjBjB,cAAwCX,YAAY,CAAC;MACnDY,KAAKA,CAACC,CAAS,EAAE;QACf;QACA,IAAIA,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAA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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-V32JHU3O.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}"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithPivot.js","names":["Employee","useOsdkObjects","TestComponent","data","pivotTo"],"sources":["useOsdkObjectsWithPivot.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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\ndeclare const MyComponent: () => void;\n\nfunction TestComponent() {\n const { data } = useOsdkObjects(Employee, {\n pivotTo: \"lead\",\n });\n\n // Line 31: Check that data has the correct pivoted type\n const firstItem = data?.[0];\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAIzD,SAASC,aAAaA,CAAA,EAAG;EACvB,MAAM;IAAEC;EAAK,CAAC,GAAGF,cAAc,CAACD,QAAQ,EAAE;IACxCI,OAAO,EAAE;EACX,CAAC,CAAC;;EAEF;EACkBD,IAAI,GAAG,CAAC,CAAC;EAE3B,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithProperties.js","names":["Employee","useOsdkObjects","TestComponent","data","withProperties","constantValue","employee","selectProperty"],"sources":["useOsdkObjectsWithProperties.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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction TestComponent() {\n const withProps: DerivedProperty.Clause<typeof Employee> = {\n constantValue: (employee) => employee.selectProperty(\"class\"),\n };\n\n const { data } = useOsdkObjects(Employee, {\n withProperties: withProps,\n });\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SAASC,aAAaA,CAAA,EAAG;EAKvB,MAAM;IAAEC;EAAK,CAAC,GAAGF,cAAc,CAACD,QAAQ,EAAE;IACxCI,cAAc,EAL2C;MACzDC,aAAa,EAAGC,QAAQ,IAAKA,QAAQ,CAACC,cAAc,CAAC,OAAO;IAC9D;EAIA,CAAC,CAAC;EAEF,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 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
|
-
// WARNING!
|
|
18
|
-
// WARNING!
|
|
19
|
-
// This file is used for tests that check intellisense. Editing this file by hand will likely
|
|
20
|
-
// break tests that have hard coded line numbers and line offsets.
|
|
21
|
-
|
|
22
|
-
import { Employee } from "@osdk/client.test.ontology";
|
|
23
|
-
import { useOsdkObjects } from "@osdk/react/experimental";
|
|
24
|
-
function TestComponent() {
|
|
25
|
-
const {
|
|
26
|
-
data: ridsData
|
|
27
|
-
} = useOsdkObjects(Employee, {
|
|
28
|
-
rids: ["ri.foo.123"]
|
|
29
|
-
});
|
|
30
|
-
ridsData?.[0];
|
|
31
|
-
const {
|
|
32
|
-
data: noRidsData
|
|
33
|
-
} = useOsdkObjects(Employee);
|
|
34
|
-
noRidsData?.[0];
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=useOsdkObjectsWithRids.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithRids.js","names":["Employee","useOsdkObjects","TestComponent","data","ridsData","rids","noRidsData"],"sources":["useOsdkObjectsWithRids.ts"],"sourcesContent":["/*\n * Copyright 2026 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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction TestComponent() {\n const { data: ridsData } = useOsdkObjects(Employee, {\n rids: [\"ri.foo.123\"],\n });\n\n const ridsItem = ridsData?.[0];\n\n const { data: noRidsData } = useOsdkObjects(Employee);\n\n const noRidsItem = noRidsData?.[0];\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SAASC,aAAaA,CAAA,EAAG;EACvB,MAAM;IAAEC,IAAI,EAAEC;EAAS,CAAC,GAAGH,cAAc,CAACD,QAAQ,EAAE;IAClDK,IAAI,EAAE,CAAC,YAAY;EACrB,CAAC,CAAC;EAEeD,QAAQ,GAAG,CAAC,CAAC;EAE9B,MAAM;IAAED,IAAI,EAAEG;EAAW,CAAC,GAAGL,cAAc,CAACD,QAAQ,CAAC;EAElCM,UAAU,GAAG,CAAC,CAAC;EAElC,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { startTsServer } from "@osdk/client/internal-node";
|
|
18
|
-
import { findUpSync } from "find-up";
|
|
19
|
-
import * as path from "node:path";
|
|
20
|
-
import invariant from "tiny-invariant";
|
|
21
|
-
import * as ts from "typescript";
|
|
22
|
-
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
23
|
-
|
|
24
|
-
// it needs to be hoisted because its referenced from our mocked WebSocket
|
|
25
|
-
// which must be hoisted to work
|
|
26
|
-
const rootLogger = await vi.hoisted(async () => {
|
|
27
|
-
const pino = (await import("pino")).pino;
|
|
28
|
-
const pinoPretty = await import("pino-pretty");
|
|
29
|
-
const {
|
|
30
|
-
EventEmitter
|
|
31
|
-
} = await import("node:events");
|
|
32
|
-
return Promise.resolve(pino({
|
|
33
|
-
level: "info"
|
|
34
|
-
}, pinoPretty.build({
|
|
35
|
-
sync: true,
|
|
36
|
-
timestampKey: undefined,
|
|
37
|
-
errorLikeObjectKeys: ["error", "err", "exception"],
|
|
38
|
-
errorProps: "stack,cause,properties",
|
|
39
|
-
ignore: "time,hostname,pid",
|
|
40
|
-
destination: new class extends EventEmitter {
|
|
41
|
-
write(a) {
|
|
42
|
-
// remove trailing newline since console.log adds one
|
|
43
|
-
if (a.at(-1) === "\n") a = a.slice(0, -1);
|
|
44
|
-
|
|
45
|
-
// This lets the test framework aggregate the logs per test, whereas direct to stdout does not
|
|
46
|
-
console.log(a);
|
|
47
|
-
}
|
|
48
|
-
}()
|
|
49
|
-
})));
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @vitest-environment node
|
|
54
|
-
* @vitest-pool forks
|
|
55
|
-
*/
|
|
56
|
-
describe("intellisense", () => {
|
|
57
|
-
let packagesDir;
|
|
58
|
-
let reactPackagePath;
|
|
59
|
-
beforeAll(() => {
|
|
60
|
-
const reactPackageJson = findUpSync("package.json", {
|
|
61
|
-
cwd: import.meta.dirname
|
|
62
|
-
});
|
|
63
|
-
console.log({
|
|
64
|
-
reactPackageJson
|
|
65
|
-
});
|
|
66
|
-
!(reactPackageJson != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
67
|
-
packagesDir = path.join(path.dirname(reactPackageJson), "..");
|
|
68
|
-
reactPackagePath = path.join(packagesDir, "react");
|
|
69
|
-
});
|
|
70
|
-
let tsServer;
|
|
71
|
-
let intellisenseFilePath;
|
|
72
|
-
beforeEach(async a => {
|
|
73
|
-
intellisenseFilePath = path.join(reactPackagePath, "src", "intellisense.test.helpers", `${a.task.name}.ts`);
|
|
74
|
-
console.log(intellisenseFilePath);
|
|
75
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
76
|
-
try {
|
|
77
|
-
tsServer = await startTsServer(rootLogger);
|
|
78
|
-
await tsServer.sendOpenRequest({
|
|
79
|
-
file: intellisenseFilePath
|
|
80
|
-
});
|
|
81
|
-
} catch (error) {
|
|
82
|
-
if (tsServer) {
|
|
83
|
-
try {
|
|
84
|
-
tsServer.stop();
|
|
85
|
-
} catch {
|
|
86
|
-
// Ignore cleanup errors
|
|
87
|
-
}
|
|
88
|
-
tsServer = undefined;
|
|
89
|
-
}
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
afterEach(() => {
|
|
94
|
-
if (tsServer) {
|
|
95
|
-
tsServer.stop();
|
|
96
|
-
tsServer = undefined;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
it("useOsdkObjectsWithPivot", {
|
|
100
|
-
timeout: 40_000
|
|
101
|
-
}, async () => {
|
|
102
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
103
|
-
!tsServer ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
104
|
-
const {
|
|
105
|
-
resp
|
|
106
|
-
} = await tsServer.sendCompletionsRequest({
|
|
107
|
-
file: intellisenseFilePath,
|
|
108
|
-
line: 29,
|
|
109
|
-
offset: 15,
|
|
110
|
-
triggerKind: ts.CompletionTriggerKind.Invoked
|
|
111
|
-
});
|
|
112
|
-
const completions = resp.body?.entries.map(e => e.name) ?? [];
|
|
113
|
-
expect(completions).toContain("lead");
|
|
114
|
-
const {
|
|
115
|
-
resp: typeResp
|
|
116
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
117
|
-
file: intellisenseFilePath,
|
|
118
|
-
line: 33,
|
|
119
|
-
offset: 10
|
|
120
|
-
});
|
|
121
|
-
expect(typeResp.body?.displayString).toBeDefined();
|
|
122
|
-
expect(typeResp.body?.displayString).toContain("Employee");
|
|
123
|
-
});
|
|
124
|
-
it("useOsdkObjectsWithRids", {
|
|
125
|
-
timeout: 40_000
|
|
126
|
-
}, async () => {
|
|
127
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
128
|
-
!tsServer ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
129
|
-
const {
|
|
130
|
-
resp: ridsResp
|
|
131
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
132
|
-
file: intellisenseFilePath,
|
|
133
|
-
line: 30,
|
|
134
|
-
offset: 9
|
|
135
|
-
});
|
|
136
|
-
expect(ridsResp.body?.displayString).toBeDefined();
|
|
137
|
-
expect(ridsResp.body?.displayString).toContain("$rid");
|
|
138
|
-
const {
|
|
139
|
-
resp: noRidsResp
|
|
140
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
141
|
-
file: intellisenseFilePath,
|
|
142
|
-
line: 34,
|
|
143
|
-
offset: 9
|
|
144
|
-
});
|
|
145
|
-
expect(noRidsResp.body?.displayString).toBeDefined();
|
|
146
|
-
expect(noRidsResp.body?.displayString).not.toContain("$rid");
|
|
147
|
-
});
|
|
148
|
-
it("useOsdkObjectsWithProperties", {
|
|
149
|
-
timeout: 40_000
|
|
150
|
-
}, async () => {
|
|
151
|
-
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
152
|
-
!tsServer ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
153
|
-
const {
|
|
154
|
-
resp
|
|
155
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
156
|
-
file: intellisenseFilePath,
|
|
157
|
-
line: 27,
|
|
158
|
-
offset: 10
|
|
159
|
-
});
|
|
160
|
-
expect(resp.body?.displayString).toContain("DerivedProperty.Clause");
|
|
161
|
-
const {
|
|
162
|
-
resp: dataResp
|
|
163
|
-
} = await tsServer.sendQuickInfoRequest({
|
|
164
|
-
file: intellisenseFilePath,
|
|
165
|
-
line: 31,
|
|
166
|
-
offset: 11
|
|
167
|
-
});
|
|
168
|
-
expect(dataResp.body?.displayString).toBeDefined();
|
|
169
|
-
expect(dataResp.body?.displayString).toContain("Osdk.Instance<Employee");
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
//# sourceMappingURL=intellisense.test.js.map
|