@osdk/client 2.1.0-beta.25 → 2.1.0-beta.26
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 +22 -0
- package/build/browser/actions/actions.test.js +11 -2
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/createClient.js +17 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +56 -18
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +193 -7
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/object/aggregate.js +0 -4
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +8 -8
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/mediaUpload.js +20 -0
- package/build/browser/object/mediaUpload.js.map +1 -0
- package/build/browser/objectSet/ObjectSet.test.js +28 -0
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/toDataValue.js +4 -0
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +4 -0
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/cjs/{chunk-RWHJNRHF.cjs → chunk-AMEMEGJZ.cjs} +69 -33
- package/build/cjs/chunk-AMEMEGJZ.cjs.map +1 -0
- package/build/cjs/{chunk-Q4BVHDNO.cjs → chunk-HDBAHEBE.cjs} +19 -15
- package/build/cjs/chunk-HDBAHEBE.cjs.map +1 -0
- package/build/cjs/index.cjs +66 -43
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +1 -1
- package/build/cjs/public/internal.cjs +6 -6
- package/build/cjs/public/unstable-do-not-use.cjs +2 -2
- package/build/esm/actions/actions.test.js +11 -2
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/createClient.js +17 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +56 -18
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +193 -7
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/object/aggregate.js +0 -4
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +8 -8
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/mediaUpload.js +20 -0
- package/build/esm/object/mediaUpload.js.map +1 -0
- package/build/esm/objectSet/ObjectSet.test.js +28 -0
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/toDataValue.js +4 -0
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +4 -0
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/object/mediaUpload.d.ts +2 -0
- package/package.json +11 -11
- package/build/cjs/chunk-Q4BVHDNO.cjs.map +0 -1
- package/build/cjs/chunk-RWHJNRHF.cjs.map +0 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { objectTypeWithAllPropertyTypes } from "@osdk/client.test.ontology";
|
|
17
|
+
import { BgaoNflPlayer, objectTypeWithAllPropertyTypes } from "@osdk/client.test.ontology";
|
|
18
18
|
import { expectType } from "ts-expect";
|
|
19
19
|
import { describe, expect, it } from "vitest";
|
|
20
20
|
import { modernToLegacyWhereClause } from "./modernToLegacyWhereClause.js";
|
|
@@ -23,7 +23,17 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
23
23
|
describe("interfaces", () => {
|
|
24
24
|
it("properly converts shortname to fqApiName", () => {
|
|
25
25
|
const r = modernToLegacyWhereClause({
|
|
26
|
-
|
|
26
|
+
$and: [{
|
|
27
|
+
prop: {
|
|
28
|
+
$eq: 5
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
prop2: {
|
|
32
|
+
innerProp1: {
|
|
33
|
+
$eq: "myProp"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}]
|
|
27
37
|
}, {
|
|
28
38
|
type: "interface",
|
|
29
39
|
apiName: "a.Foo",
|
|
@@ -32,6 +42,12 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
32
42
|
properties: {
|
|
33
43
|
"prop": {
|
|
34
44
|
type: "integer"
|
|
45
|
+
},
|
|
46
|
+
"prop2": {
|
|
47
|
+
type: {
|
|
48
|
+
"innerProp1": "string",
|
|
49
|
+
"innerProp2": "float"
|
|
50
|
+
}
|
|
35
51
|
}
|
|
36
52
|
},
|
|
37
53
|
apiName: "a.Foo",
|
|
@@ -42,16 +58,36 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
42
58
|
});
|
|
43
59
|
expect(r).toMatchInlineSnapshot(`
|
|
44
60
|
{
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
61
|
+
"type": "and",
|
|
62
|
+
"value": [
|
|
63
|
+
{
|
|
64
|
+
"field": "a.prop",
|
|
65
|
+
"type": "eq",
|
|
66
|
+
"value": 5,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"field": undefined,
|
|
70
|
+
"propertyIdentifier": {
|
|
71
|
+
"propertyApiName": "a.prop2",
|
|
72
|
+
"structFieldApiName": "innerProp1",
|
|
73
|
+
"type": "structField",
|
|
74
|
+
},
|
|
75
|
+
"type": "eq",
|
|
76
|
+
"value": "myProp",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
48
79
|
}
|
|
49
80
|
`);
|
|
50
81
|
});
|
|
51
82
|
it("properly does not convert when interface has no apiNamespace", () => {
|
|
52
83
|
const r = modernToLegacyWhereClause({
|
|
53
84
|
"b.prop": 5,
|
|
54
|
-
foo: 6
|
|
85
|
+
foo: 6,
|
|
86
|
+
"c.prop2": {
|
|
87
|
+
innerProp1: {
|
|
88
|
+
$eq: "myProp"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
55
91
|
}, {
|
|
56
92
|
type: "interface",
|
|
57
93
|
apiName: "Foo",
|
|
@@ -66,6 +102,12 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
66
102
|
},
|
|
67
103
|
"prop": {
|
|
68
104
|
type: "integer"
|
|
105
|
+
},
|
|
106
|
+
"c.prop2": {
|
|
107
|
+
type: {
|
|
108
|
+
"innerProp1": "string",
|
|
109
|
+
"innerProp2": "float"
|
|
110
|
+
}
|
|
69
111
|
}
|
|
70
112
|
},
|
|
71
113
|
apiName: "Foo",
|
|
@@ -88,6 +130,16 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
88
130
|
"type": "eq",
|
|
89
131
|
"value": 6,
|
|
90
132
|
},
|
|
133
|
+
{
|
|
134
|
+
"field": undefined,
|
|
135
|
+
"propertyIdentifier": {
|
|
136
|
+
"propertyApiName": "c.prop2",
|
|
137
|
+
"structFieldApiName": "innerProp1",
|
|
138
|
+
"type": "structField",
|
|
139
|
+
},
|
|
140
|
+
"type": "eq",
|
|
141
|
+
"value": "myProp",
|
|
142
|
+
},
|
|
91
143
|
],
|
|
92
144
|
}
|
|
93
145
|
`);
|
|
@@ -95,7 +147,12 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
95
147
|
it("gracefully handles redundant apiNamespace in property", () => {
|
|
96
148
|
const r = modernToLegacyWhereClause({
|
|
97
149
|
"b.prop": 5,
|
|
98
|
-
"a.foo": 6
|
|
150
|
+
"a.foo": 6,
|
|
151
|
+
"c.prop2": {
|
|
152
|
+
innerProp1: {
|
|
153
|
+
$eq: "myProp"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
99
156
|
}, {
|
|
100
157
|
type: "interface",
|
|
101
158
|
apiName: "a.Foo",
|
|
@@ -110,6 +167,12 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
110
167
|
},
|
|
111
168
|
"prop": {
|
|
112
169
|
type: "integer"
|
|
170
|
+
},
|
|
171
|
+
"c.prop2": {
|
|
172
|
+
type: {
|
|
173
|
+
"innerProp1": "string",
|
|
174
|
+
"innerProp2": "float"
|
|
175
|
+
}
|
|
113
176
|
}
|
|
114
177
|
},
|
|
115
178
|
apiName: "a.Foo",
|
|
@@ -132,6 +195,16 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
132
195
|
"type": "eq",
|
|
133
196
|
"value": 6,
|
|
134
197
|
},
|
|
198
|
+
{
|
|
199
|
+
"field": undefined,
|
|
200
|
+
"propertyIdentifier": {
|
|
201
|
+
"propertyApiName": "c.prop2",
|
|
202
|
+
"structFieldApiName": "innerProp1",
|
|
203
|
+
"type": "structField",
|
|
204
|
+
},
|
|
205
|
+
"type": "eq",
|
|
206
|
+
"value": "myProp",
|
|
207
|
+
},
|
|
135
208
|
],
|
|
136
209
|
}
|
|
137
210
|
`);
|
|
@@ -711,6 +784,119 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
711
784
|
}
|
|
712
785
|
`);
|
|
713
786
|
});
|
|
787
|
+
it("converts struct where clauses correctly", () => {
|
|
788
|
+
expect(modernToLegacyWhereClause({
|
|
789
|
+
address: {
|
|
790
|
+
state: {
|
|
791
|
+
$eq: "NJ"
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}, BgaoNflPlayer)).toMatchInlineSnapshot(`
|
|
795
|
+
{
|
|
796
|
+
"field": undefined,
|
|
797
|
+
"propertyIdentifier": {
|
|
798
|
+
"propertyApiName": "address",
|
|
799
|
+
"structFieldApiName": "state",
|
|
800
|
+
"type": "structField",
|
|
801
|
+
},
|
|
802
|
+
"type": "eq",
|
|
803
|
+
"value": "NJ",
|
|
804
|
+
}
|
|
805
|
+
`);
|
|
806
|
+
expect(modernToLegacyWhereClause({
|
|
807
|
+
$and: [{
|
|
808
|
+
address: {
|
|
809
|
+
state: {
|
|
810
|
+
$eq: "NJ"
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}, {
|
|
814
|
+
address: {
|
|
815
|
+
city: {
|
|
816
|
+
$containsAnyTerm: "N"
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}]
|
|
820
|
+
}, BgaoNflPlayer)).toMatchInlineSnapshot(`
|
|
821
|
+
{
|
|
822
|
+
"type": "and",
|
|
823
|
+
"value": [
|
|
824
|
+
{
|
|
825
|
+
"field": undefined,
|
|
826
|
+
"propertyIdentifier": {
|
|
827
|
+
"propertyApiName": "address",
|
|
828
|
+
"structFieldApiName": "state",
|
|
829
|
+
"type": "structField",
|
|
830
|
+
},
|
|
831
|
+
"type": "eq",
|
|
832
|
+
"value": "NJ",
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
"field": undefined,
|
|
836
|
+
"fuzzy": false,
|
|
837
|
+
"propertyIdentifier": {
|
|
838
|
+
"propertyApiName": "address",
|
|
839
|
+
"structFieldApiName": "city",
|
|
840
|
+
"type": "structField",
|
|
841
|
+
},
|
|
842
|
+
"type": "containsAnyTerm",
|
|
843
|
+
"value": "N",
|
|
844
|
+
},
|
|
845
|
+
],
|
|
846
|
+
}
|
|
847
|
+
`);
|
|
848
|
+
expect(modernToLegacyWhereClause({
|
|
849
|
+
$or: [{
|
|
850
|
+
address: {
|
|
851
|
+
state: {
|
|
852
|
+
$eq: "NJ"
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}, {
|
|
856
|
+
address: {
|
|
857
|
+
city: {
|
|
858
|
+
$containsAnyTerm: "N"
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}, {
|
|
862
|
+
gamesPlayed: {
|
|
863
|
+
$gt: 5
|
|
864
|
+
}
|
|
865
|
+
}]
|
|
866
|
+
}, BgaoNflPlayer)).toMatchInlineSnapshot(`
|
|
867
|
+
{
|
|
868
|
+
"type": "or",
|
|
869
|
+
"value": [
|
|
870
|
+
{
|
|
871
|
+
"field": undefined,
|
|
872
|
+
"propertyIdentifier": {
|
|
873
|
+
"propertyApiName": "address",
|
|
874
|
+
"structFieldApiName": "state",
|
|
875
|
+
"type": "structField",
|
|
876
|
+
},
|
|
877
|
+
"type": "eq",
|
|
878
|
+
"value": "NJ",
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
"field": undefined,
|
|
882
|
+
"fuzzy": false,
|
|
883
|
+
"propertyIdentifier": {
|
|
884
|
+
"propertyApiName": "address",
|
|
885
|
+
"structFieldApiName": "city",
|
|
886
|
+
"type": "structField",
|
|
887
|
+
},
|
|
888
|
+
"type": "containsAnyTerm",
|
|
889
|
+
"value": "N",
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
"field": "gamesPlayed",
|
|
893
|
+
"type": "gt",
|
|
894
|
+
"value": 5,
|
|
895
|
+
},
|
|
896
|
+
],
|
|
897
|
+
}
|
|
898
|
+
`);
|
|
899
|
+
});
|
|
714
900
|
});
|
|
715
901
|
describe("multiple checks", () => {
|
|
716
902
|
it("properly handles multiple simple where checks", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyWhereClause.test.js","names":["objectTypeWithAllPropertyTypes","expectType","describe","expect","it","modernToLegacyWhereClause","r","prop","type","apiName","__DefinitionMetadata","properties","displayName","links","rid","toMatchInlineSnapshot","foo","geoPoint","$within","$bbox","$distance","$of","coordinates","$polygon","geoShape","$intersects","integer","$ne","string","$containsAllTerms","term","fuzzySearch","$containsAnyTerm","decimal","$and","$or"],"sources":["modernToLegacyWhereClause.test.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ObjectOrInterfaceDefinition, WhereClause } from \"@osdk/api\";\nimport { objectTypeWithAllPropertyTypes } from \"@osdk/client.test.ontology\";\nimport type { Point } from \"geojson\";\nimport { expectType } from \"ts-expect\";\nimport { describe, expect, it } from \"vitest\";\nimport { modernToLegacyWhereClause } from \"./modernToLegacyWhereClause.js\";\n\ntype ObjAllProps = objectTypeWithAllPropertyTypes;\ndescribe(modernToLegacyWhereClause, () => {\n describe(\"api namespaces\", () => {\n describe(\"interfaces\", () => {\n it(\"properly converts shortname to fqApiName\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: { \"prop\": { type: \"integer\" } },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n prop: 5,\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n\n it(\"properly does not convert when interface has no apiNamespace\", () => {\n const T = {\n type: \"interface\",\n apiName: \"Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n foo: 6,\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n ],\n }\n `);\n });\n\n it(\"gracefully handles redundant apiNamespace in property\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n \"a.foo\": 6,\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"a.foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n ],\n }\n `);\n });\n\n it(\"properly does not convert different apiNamespaces\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n expect(modernToLegacyWhereClause({\n \"b.prop\": 5,\n }, T)).toMatchInlineSnapshot(`\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n\n describe(\"objects\", () => {\n it(\"does not convert object short property names to fq\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n const r = modernToLegacyWhereClause({\n prop: 5,\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n });\n\n describe(\"single checks\", () => {\n describe(\"$within\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: [-5, 5] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius of geopoint\", async () => {\n // suppose you loaded an object with a geopoint field\n // and you want to find all objects within 5 km of that point\n const pointAsGeoJsonPoint: Point = {\n type: \"Point\",\n coordinates: [-5, 5],\n };\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: pointAsGeoJsonPoint },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n it(\"check types\", async () => {\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $distance: [2, \"centimeter\"], $of: [2, 2] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $bbox: [-5, 5, -10, 10] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n // @ts-expect-error\n $distance: [2, \"centimeter\"],\n // @ts-expect-error\n $of: [2, 2],\n },\n },\n });\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $polygon: [[[0, 1], [3, 2], [0, 1]]],\n // @ts-expect-error\n $bbox: [2, 2, 2, 2],\n },\n },\n });\n });\n describe(\"$intersects\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates intersects polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n });\n\n it(\"inverts ne short hand properly\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n integer: { $ne: 5 },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n }\n `);\n });\n it(\"converts $containsAllTerms correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAllTerms correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n it(\"converts $containsAnyTerm correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAnyTerm correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n });\n\n describe(\"multiple checks\", () => {\n it(\"properly handles multiple simple where checks\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n decimal: 5,\n integer: 10,\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $and\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $and: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $or\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $or: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,8BAA8B,QAAQ,4BAA4B;AAE3E,SAASC,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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,CAAC;MACJ,CAAC,CAAC;MAEFX,EAAE,CAAC,sBAAsB,EAAE,MAAM;QAC/BD,MAAM,CAACE,yBAAyB,CAC9B;UACE8B,GAAG,EAAE,CAAC;YACJF,OAAO,EAAE;UACX,CAAC,EAAE;YACDP,OAAO,EAAE;UACX,CAAC;QACH,CAAC,EACD1B,8BACF,CAAC,CAAC,CAACe,qBAAqB,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,CAAC;MACN,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"modernToLegacyWhereClause.test.js","names":["BgaoNflPlayer","objectTypeWithAllPropertyTypes","expectType","describe","expect","it","modernToLegacyWhereClause","r","$and","prop","$eq","prop2","innerProp1","type","apiName","__DefinitionMetadata","properties","displayName","links","rid","toMatchInlineSnapshot","foo","geoPoint","$within","$bbox","$distance","$of","coordinates","$polygon","geoShape","$intersects","integer","$ne","string","$containsAllTerms","term","fuzzySearch","$containsAnyTerm","address","state","city","$or","gamesPlayed","$gt","decimal"],"sources":["modernToLegacyWhereClause.test.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ObjectOrInterfaceDefinition, WhereClause } from \"@osdk/api\";\nimport {\n BgaoNflPlayer,\n objectTypeWithAllPropertyTypes,\n} from \"@osdk/client.test.ontology\";\nimport type { Point } from \"geojson\";\nimport { expectType } from \"ts-expect\";\nimport { describe, expect, it } from \"vitest\";\nimport { modernToLegacyWhereClause } from \"./modernToLegacyWhereClause.js\";\n\ntype ObjAllProps = objectTypeWithAllPropertyTypes;\ntype structObj = BgaoNflPlayer;\ndescribe(modernToLegacyWhereClause, () => {\n describe(\"api namespaces\", () => {\n describe(\"interfaces\", () => {\n it(\"properly converts shortname to fqApiName\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"prop\": { type: \"integer\" },\n \"prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n $and: [\n { prop: { $eq: 5 } },\n { prop2: { innerProp1: { $eq: \"myProp\" } } },\n ],\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"a.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"properly does not convert when interface has no apiNamespace\", () => {\n const T = {\n type: \"interface\",\n apiName: \"Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n \"c.prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n foo: 6,\n \"c.prop2\": { innerProp1: { $eq: \"myProp\" } },\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"c.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"gracefully handles redundant apiNamespace in property\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n \"c.prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n \"a.foo\": 6,\n \"c.prop2\": { innerProp1: { $eq: \"myProp\" } },\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"a.foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"c.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"properly does not convert different apiNamespaces\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n expect(modernToLegacyWhereClause({\n \"b.prop\": 5,\n }, T)).toMatchInlineSnapshot(`\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n\n describe(\"objects\", () => {\n it(\"does not convert object short property names to fq\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n const r = modernToLegacyWhereClause({\n prop: 5,\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n });\n\n describe(\"single checks\", () => {\n describe(\"$within\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: [-5, 5] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius of geopoint\", async () => {\n // suppose you loaded an object with a geopoint field\n // and you want to find all objects within 5 km of that point\n const pointAsGeoJsonPoint: Point = {\n type: \"Point\",\n coordinates: [-5, 5],\n };\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: pointAsGeoJsonPoint },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n it(\"check types\", async () => {\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $distance: [2, \"centimeter\"], $of: [2, 2] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $bbox: [-5, 5, -10, 10] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n // @ts-expect-error\n $distance: [2, \"centimeter\"],\n // @ts-expect-error\n $of: [2, 2],\n },\n },\n });\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $polygon: [[[0, 1], [3, 2], [0, 1]]],\n // @ts-expect-error\n $bbox: [2, 2, 2, 2],\n },\n },\n });\n });\n describe(\"$intersects\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates intersects polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n });\n\n it(\"inverts ne short hand properly\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n integer: { $ne: 5 },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n }\n `);\n });\n it(\"converts $containsAllTerms correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAllTerms correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n it(\"converts $containsAnyTerm correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAnyTerm correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n it(\"converts struct where clauses correctly\", () => {\n expect(modernToLegacyWhereClause<structObj>({\n address: { state: { $eq: \"NJ\" } },\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n }\n `);\n\n expect(modernToLegacyWhereClause<structObj>({\n $and: [\n { address: { state: { $eq: \"NJ\" } } },\n { address: { city: { $containsAnyTerm: \"N\" } } },\n ],\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n },\n {\n \"field\": undefined,\n \"fuzzy\": false,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"city\",\n \"type\": \"structField\",\n },\n \"type\": \"containsAnyTerm\",\n \"value\": \"N\",\n },\n ],\n }\n `);\n\n expect(modernToLegacyWhereClause<structObj>({\n $or: [\n { address: { state: { $eq: \"NJ\" } } },\n { address: { city: { $containsAnyTerm: \"N\" } } },\n { gamesPlayed: { $gt: 5 } },\n ],\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n },\n {\n \"field\": undefined,\n \"fuzzy\": false,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"city\",\n \"type\": \"structField\",\n },\n \"type\": \"containsAnyTerm\",\n \"value\": \"N\",\n },\n {\n \"field\": \"gamesPlayed\",\n \"type\": \"gt\",\n \"value\": 5,\n },\n ],\n }\n `);\n });\n });\n\n describe(\"multiple checks\", () => {\n it(\"properly handles multiple simple where checks\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n decimal: 5,\n integer: 10,\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $and\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $and: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $or\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $or: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SACEA,aAAa,EACbC,8BAA8B,QACzB,4BAA4B;AAEnC,SAASC,UAAU,QAAQ,WAAW;AACtC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,yBAAyB,QAAQ,gCAAgC;AAI1EH,QAAQ,CAACG,yBAAyB,EAAE,MAAM;EACxCH,QAAQ,CAAC,gBAAgB,EAAE,MAAM;IAC/BA,QAAQ,CAAC,YAAY,EAAE,MAAM;MAC3BE,EAAE,CAAC,0CAA0C,EAAE,MAAM;QAmBnD,MAAME,CAAC,GAAGD,yBAAyB,CAAC;UAClCE,IAAI,EAAE,CACJ;YAAEC,IAAI,EAAE;cAAEC,GAAG,EAAE;YAAE;UAAE,CAAC,EACpB;YAAEC,KAAK,EAAE;cAAEC,UAAU,EAAE;gBAAEF,GAAG,EAAE;cAAS;YAAE;UAAE,CAAC;QAEhD,CAAC,EAvBS;UACRG,IAAI,EAAE,WAAW;UACjBC,OAAO,EAAE,OAAO;UAChBC,oBAAoB,EAAE;YACpBF,IA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Ff,EAAE,CAAC,uBAAuB,EAAE,MAAM;QAChCD,MAAM,CAACE,yBAAyB,CAC9B;UACEE,IAAI,EAAE,CAAC;YACLoC,OAAO,EAAE;UACX,CAAC,EAAE;YACDb,OAAO,EAAE;UACX,CAAC;QACH,CAAC,EACD9B,8BACF,CAAC,CAAC,CAACmB,qBAAqB,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,CAAC;MACJ,CAAC,CAAC;MAEFf,EAAE,CAAC,sBAAsB,EAAE,MAAM;QAC/BD,MAAM,CAACE,yBAAyB,CAC9B;UACEmC,GAAG,EAAE,CAAC;YACJG,OAAO,EAAE;UACX,CAAC,EAAE;YACDb,OAAO,EAAE;UACX,CAAC;QACH,CAAC,EACD9B,8BACF,CAAC,CAAC,CAACmB,qBAAqB,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,CAAC;MACN,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -19,7 +19,6 @@ import invariant from "tiny-invariant";
|
|
|
19
19
|
import { legacyToModernSingleAggregationResult } from "../internal/conversions/legacyToModernSingleAggregationResult.js";
|
|
20
20
|
import { modernToLegacyAggregationClause } from "../internal/conversions/modernToLegacyAggregationClause.js";
|
|
21
21
|
import { modernToLegacyGroupByClause } from "../internal/conversions/modernToLegacyGroupByClause.js";
|
|
22
|
-
import { modernToLegacyWhereClause } from "../internal/conversions/modernToLegacyWhereClause.js";
|
|
23
22
|
import { addUserAgentAndRequestContextHeaders } from "../util/addUserAgentAndRequestContextHeaders.js";
|
|
24
23
|
import { resolveBaseObjectSetType } from "../util/objectSetUtils.js";
|
|
25
24
|
|
|
@@ -34,9 +33,6 @@ export async function aggregate(clientCtx, objectType, objectSet = resolveBaseOb
|
|
|
34
33
|
if (req.$groupBy) {
|
|
35
34
|
body.groupBy = modernToLegacyGroupByClause(req.$groupBy);
|
|
36
35
|
}
|
|
37
|
-
if (req.$where) {
|
|
38
|
-
body.where = modernToLegacyWhereClause(req.$where, objectType);
|
|
39
|
-
}
|
|
40
36
|
const result = await OntologiesV2.OntologyObjectSets.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
|
|
41
37
|
objectSet,
|
|
42
38
|
groupBy: body.groupBy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","
|
|
1
|
+
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","addUserAgentAndRequestContextHeaders","resolveBaseObjectSetType","aggregate","clientCtx","objectType","objectSet","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","result","OntologyObjectSets","ontologyRid","data","length","process","env","NODE_ENV","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.ts"],"sourcesContent":["/*\n * Copyright 2023 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 AggregateOpts,\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,\n AggregationResultsWithGroups,\n AggregationsResults,\n ObjectOrInterfaceDefinition,\n} from \"@osdk/api\";\nimport type {\n AggregateObjectsRequestV2,\n AggregateObjectsResponseV2,\n ObjectSet,\n} from \"@osdk/internal.foundry.core\";\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport type { ArrayElement } from \"../util/ArrayElement.js\";\nimport { resolveBaseObjectSetType } from \"../util/objectSetUtils.js\";\n\n/** @internal */\nexport async function aggregate<\n Q extends ObjectOrInterfaceDefinition,\n AO extends AggregateOpts<Q>,\n>(\n clientCtx: MinimalClient,\n objectType: Q,\n objectSet: ObjectSet = resolveBaseObjectSetType(objectType),\n req: AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<Q, AO>,\n): Promise<AggregationsResults<Q, AO>> {\n const resolvedObjectSet = resolveBaseObjectSetType(objectType);\n const body: AggregateObjectsRequestV2 = {\n aggregation: modernToLegacyAggregationClause<AO[\"$select\"]>(\n req.$select,\n ),\n groupBy: [],\n where: undefined,\n };\n\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n\n const result = await OntologiesV2.OntologyObjectSets.aggregate(\n addUserAgentAndRequestContextHeaders(clientCtx, objectType),\n await clientCtx.ontologyRid,\n {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n },\n );\n\n if (!req.$groupBy) {\n invariant(\n result.data.length === 1,\n \"no group by clause should mean only one data result\",\n );\n\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(\n result.data[0],\n ),\n } as any;\n }\n\n const ret: AggregationResultsWithGroups<Q, AO[\"$select\"], any> = result.data\n .map((entry) => {\n return {\n $group: entry.group as any,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }) as any; // fixme\n\n return ret as any; // FIXME\n}\n\nfunction aggregationToCountResult(\n entry: ArrayElement<AggregateObjectsResponseV2[\"data\"]>,\n): { $count: number } | undefined {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,qCAAqC,QAAQ,kEAAkE;AACxH,SAASC,+BAA+B,QAAQ,4DAA4D;AAC5G,SAASC,2BAA2B,QAAQ,wDAAwD;AAEpG,SAASC,oCAAoC,QAAQ,iDAAiD;AAEtG,SAASC,wBAAwB,QAAQ,2BAA2B;;AAEpE;AACA,OAAO,eAAeC,SAASA,CAI7BC,SAAwB,EACxBC,UAAa,EACbC,SAAoB,GAAGJ,wBAAwB,CAACG,UAAU,CAAC,EAC3DE,GAA0E,EACrC;EACXL,wBAAwB,CAACG,UAAU,CAAC;EAC9D,MAAMG,IAA+B,GAAG;IACtCC,WAAW,EAAEV,+BAA+B,CAC1CQ,GAAG,CAACG,OACN,CAAC;IACDC,OAAO,EAAE,EAAE;IACXC,KAAK,EAAEC;EACT,CAAC;EAED,IAAIN,GAAG,CAACO,QAAQ,EAAE;IAChBN,IAAI,CAACG,OAAO,GAAGX,2BAA2B,CAACO,GAAG,CAACO,QAAQ,CAAC;EAC1D;EAEA,MAAMC,MAAM,GAAG,MAAMnB,YAAY,CAACoB,kBAAkB,CAACb,SAAS,CAC5DF,oCAAoC,CAACG,SAAS,EAAEC,UAAU,CAAC,EAC3D,MAAMD,SAAS,CAACa,WAAW,EAC3B;IACEX,SAAS;IACTK,OAAO,EAAEH,IAAI,CAACG,OAAO;IACrBF,WAAW,EAAED,IAAI,CAACC;EACpB,CACF,CAAC;EAED,IAAI,CAACF,GAAG,CAACO,QAAQ,EAAE;IACjB,EACEC,MAAM,CAACG,IAAI,CAACC,MAAM,KAAK,CAAC,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD1BzB,SAAS,QAEP,qDAAqD,IAFvDA,SAAS;IAKT,OAAO;MACL,GAAG0B,wBAAwB,CAACR,MAAM,CAACG,IAAI,CAAC,CAAC,CAAC,CAAC;MAC3C,GAAGpB,qCAAqC,CACtCiB,MAAM,CAACG,IAAI,CAAC,CAAC,CACf;IACF,CAAC;EACH;EAEA,MAAMM,GAAwD,GAAGT,MAAM,CAACG,IAAI,CACzEO,GAAG,CAAEC,KAAK,IAAK;IACd,OAAO;MACLC,MAAM,EAAED,KAAK,CAACE,KAAY;MAC1B,GAAGL,wBAAwB,CAACG,KAAK,CAAC;MAClC,GAAG5B,qCAAqC,CAAC4B,KAAK;IAChD,CAAC;EACH,CAAC,CAAQ,CAAC,CAAC;;EAEb,OAAOF,GAAG,CAAQ,CAAC;AACrB;AAEA,SAASD,wBAAwBA,CAC/BG,KAAuD,EACvB;EAChC,KAAK,MAAMG,eAAe,IAAIH,KAAK,CAACI,OAAO,EAAE;IAC3C,IAAID,eAAe,CAACE,IAAI,KAAK,OAAO,EAAE;MACpC,OAAO;QAAEC,MAAM,EAAEH,eAAe,CAACI;MAAM,CAAC;IAC1C;EACF;AACF","ignoreList":[]}
|
|
@@ -138,12 +138,12 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
138
138
|
ontologyRid: $ontologyRid
|
|
139
139
|
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
140
140
|
createSharedClientContext("https://stack.palantir.com", async () => "myAccessToken", "userAgent");
|
|
141
|
-
|
|
141
|
+
const object = {
|
|
142
142
|
__apiName: Employee.apiName,
|
|
143
143
|
__primaryKey: 0
|
|
144
144
|
};
|
|
145
145
|
const prototypeBefore = Object.getPrototypeOf(object);
|
|
146
|
-
|
|
146
|
+
const object2 = await convertWireToOsdkObjects(clientCtx, [object], undefined, undefined, undefined, false);
|
|
147
147
|
const prototypeAfter = Object.getPrototypeOf(object2);
|
|
148
148
|
expect(prototypeBefore).not.toBe(prototypeAfter);
|
|
149
149
|
});
|
|
@@ -152,12 +152,12 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
152
152
|
ontologyRid: $ontologyRid
|
|
153
153
|
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
154
154
|
createSharedClientContext("https://stack.palantir.com", async () => "myAccessToken", "userAgent");
|
|
155
|
-
|
|
155
|
+
const object = {
|
|
156
156
|
__apiName: Employee.apiName,
|
|
157
157
|
__primaryKey: 0
|
|
158
158
|
};
|
|
159
159
|
const prototypeBefore = Object.getPrototypeOf(object);
|
|
160
|
-
|
|
160
|
+
const object2 = await convertWireToOsdkObjects2(clientCtx, [object], undefined, undefined, undefined, false);
|
|
161
161
|
const prototypeAfter = Object.getPrototypeOf(object2);
|
|
162
162
|
expect(prototypeBefore).not.toBe(prototypeAfter);
|
|
163
163
|
});
|
|
@@ -301,7 +301,7 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
301
301
|
});
|
|
302
302
|
describe("selection keys", () => {
|
|
303
303
|
it("throws when required is missing", async () => {
|
|
304
|
-
|
|
304
|
+
const object = {
|
|
305
305
|
__apiName: "Employee",
|
|
306
306
|
__primaryKey: 0
|
|
307
307
|
};
|
|
@@ -330,7 +330,7 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
330
330
|
});
|
|
331
331
|
describe("selection keys - new", () => {
|
|
332
332
|
it("throws when required is missing", async () => {
|
|
333
|
-
|
|
333
|
+
const object = {
|
|
334
334
|
__apiName: "Employee",
|
|
335
335
|
__primaryKey: 0
|
|
336
336
|
};
|
|
@@ -359,7 +359,7 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
359
359
|
});
|
|
360
360
|
describe("without selection keys", () => {
|
|
361
361
|
it("throws when required is missing", async () => {
|
|
362
|
-
|
|
362
|
+
const object = {
|
|
363
363
|
__apiName: "Employee",
|
|
364
364
|
__primaryKey: 0
|
|
365
365
|
};
|
|
@@ -390,7 +390,7 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
390
390
|
});
|
|
391
391
|
describe("without selection keys - new", () => {
|
|
392
392
|
it("throws when required is missing", async () => {
|
|
393
|
-
|
|
393
|
+
const object = {
|
|
394
394
|
__apiName: "Employee",
|
|
395
395
|
__primaryKey: 0
|
|
396
396
|
};
|