@osdk/client 2.1.0-beta.0 → 2.1.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/CHANGELOG.md +163 -0
- package/build/browser/Client.d.ts +8 -21
- package/build/browser/Client.d.ts.map +1 -1
- package/build/browser/Client.js +2 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.d.ts +1 -1
- package/build/browser/MinimalClientContext.d.ts.map +1 -1
- package/build/browser/__unstable/ConjureSupport.js +4 -4
- package/build/browser/__unstable/ConjureSupport.js.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/browser/actions/applyAction.js +1 -1
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.d.ts +1 -1
- package/build/browser/createClient.d.ts.map +1 -1
- package/build/browser/createClient.js +43 -19
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts +14 -0
- package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -0
- package/build/browser/createGeotimeSeriesProperty.js +50 -0
- package/build/browser/createGeotimeSeriesProperty.js.map +1 -0
- package/build/browser/createMinimalClient.js +3 -3
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createPlatformClient.d.ts +1 -1
- package/build/browser/createPlatformClient.d.ts.map +1 -1
- package/build/browser/createTimeseriesProperty.d.ts.map +1 -1
- package/build/browser/createTimeseriesProperty.js +4 -36
- package/build/browser/createTimeseriesProperty.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +7 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.d.ts +2 -2
- package/build/browser/index.d.ts.map +1 -1
- package/build/browser/index.js +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.js +1 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +3 -3
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +88 -7
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/object/AttachmentUpload.d.ts.map +1 -1
- package/build/browser/object/AttachmentUpload.js +6 -0
- package/build/browser/object/AttachmentUpload.js.map +1 -1
- package/build/browser/object/Cache.test.js +1 -1
- package/build/browser/object/Cache.test.js.map +1 -1
- package/build/browser/object/aggregate.js +4 -5
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -6
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +7 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +70 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +42 -6
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +211 -18
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.d.ts.map +1 -1
- package/build/browser/object/fetchPage.js +35 -25
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js +75 -1
- package/build/browser/object/fetchPage.test.js.map +1 -1
- package/build/browser/object/geotimeseriesreference.test.d.ts +2 -0
- package/build/browser/object/geotimeseriesreference.test.d.ts.map +1 -0
- package/build/browser/object/geotimeseriesreference.test.js +257 -0
- package/build/browser/object/geotimeseriesreference.test.js.map +1 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.d.ts +2 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.js +61 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/browser/objectSet/ObjectSet.test.js +70 -51
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +65 -57
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +116 -26
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +10 -8
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/objectSet/toConjureObjectSet.js +7 -0
- package/build/browser/objectSet/toConjureObjectSet.js.map +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/browser/queries/applyQuery.js +1 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +30 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/tsserver.js +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/datetimeConverters.d.ts +22 -0
- package/build/browser/util/datetimeConverters.d.ts.map +1 -0
- package/build/browser/util/datetimeConverters.js +55 -0
- package/build/browser/util/datetimeConverters.js.map +1 -0
- package/build/browser/util/datetimeConverters.test.d.ts +2 -0
- package/build/browser/util/datetimeConverters.test.d.ts.map +1 -0
- package/build/browser/util/datetimeConverters.test.js +75 -0
- package/build/browser/util/datetimeConverters.test.js.map +1 -0
- package/build/browser/util/objectSetUtils.d.ts +4 -0
- package/build/browser/util/objectSetUtils.d.ts.map +1 -0
- package/build/browser/util/objectSetUtils.js +25 -0
- package/build/browser/util/objectSetUtils.js.map +1 -0
- package/build/browser/util/timeseriesUtils.d.ts +8 -0
- package/build/browser/util/timeseriesUtils.d.ts.map +1 -0
- package/build/browser/util/timeseriesUtils.js +51 -0
- package/build/browser/util/timeseriesUtils.js.map +1 -0
- package/build/esm/Client.d.ts +8 -21
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/Client.js +2 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.d.ts +1 -1
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/__unstable/ConjureSupport.js +4 -4
- package/build/esm/__unstable/ConjureSupport.js.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/esm/actions/applyAction.js +1 -1
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.d.ts +1 -1
- package/build/esm/createClient.d.ts.map +1 -1
- package/build/esm/createClient.js +43 -19
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts +14 -0
- package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -0
- package/build/esm/createGeotimeSeriesProperty.js +50 -0
- package/build/esm/createGeotimeSeriesProperty.js.map +1 -0
- package/build/esm/createMinimalClient.js +3 -3
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createPlatformClient.d.ts +1 -1
- package/build/esm/createPlatformClient.d.ts.map +1 -1
- package/build/esm/createTimeseriesProperty.d.ts.map +1 -1
- package/build/esm/createTimeseriesProperty.js +4 -36
- package/build/esm/createTimeseriesProperty.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +7 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.d.ts +2 -2
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.js +1 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +3 -3
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +88 -7
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/object/AttachmentUpload.d.ts.map +1 -1
- package/build/esm/object/AttachmentUpload.js +6 -0
- package/build/esm/object/AttachmentUpload.js.map +1 -1
- package/build/esm/object/Cache.test.js +1 -1
- package/build/esm/object/Cache.test.js.map +1 -1
- package/build/esm/object/aggregate.js +4 -5
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -6
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +7 -0
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +70 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +42 -6
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +211 -18
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.d.ts.map +1 -1
- package/build/esm/object/fetchPage.js +35 -25
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js +75 -1
- package/build/esm/object/fetchPage.test.js.map +1 -1
- package/build/esm/object/geotimeseriesreference.test.d.ts +2 -0
- package/build/esm/object/geotimeseriesreference.test.d.ts.map +1 -0
- package/build/esm/object/geotimeseriesreference.test.js +257 -0
- package/build/esm/object/geotimeseriesreference.test.js.map +1 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.d.ts +2 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.js +61 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/esm/objectSet/ObjectSet.test.js +70 -51
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +65 -57
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +116 -26
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +10 -8
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/objectSet/toConjureObjectSet.js +7 -0
- package/build/esm/objectSet/toConjureObjectSet.js.map +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/esm/queries/applyQuery.js +1 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +30 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/tsserver.js +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/datetimeConverters.d.ts +22 -0
- package/build/esm/util/datetimeConverters.d.ts.map +1 -0
- package/build/esm/util/datetimeConverters.js +55 -0
- package/build/esm/util/datetimeConverters.js.map +1 -0
- package/build/esm/util/datetimeConverters.test.d.ts +2 -0
- package/build/esm/util/datetimeConverters.test.d.ts.map +1 -0
- package/build/esm/util/datetimeConverters.test.js +75 -0
- package/build/esm/util/datetimeConverters.test.js.map +1 -0
- package/build/esm/util/objectSetUtils.d.ts +4 -0
- package/build/esm/util/objectSetUtils.d.ts.map +1 -0
- package/build/esm/util/objectSetUtils.js +25 -0
- package/build/esm/util/objectSetUtils.js.map +1 -0
- package/build/esm/util/timeseriesUtils.d.ts +8 -0
- package/build/esm/util/timeseriesUtils.d.ts.map +1 -0
- package/build/esm/util/timeseriesUtils.js +51 -0
- package/build/esm/util/timeseriesUtils.js.map +1 -0
- package/package.json +22 -18
|
@@ -14,15 +14,22 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { $ontologyRid, Employee, FooInterface, objectTypeWithAllPropertyTypes } from "@osdk/client.test.ontology";
|
|
17
|
-
import { symbolClientContext } from "@osdk/shared.client";
|
|
18
17
|
import { createSharedClientContext } from "@osdk/shared.client.impl";
|
|
19
18
|
import { apiServer } from "@osdk/shared.test";
|
|
20
19
|
import { afterAll, beforeAll, describe, expect, expectTypeOf, it } from "vitest";
|
|
20
|
+
import { additionalContext } from "../Client.js";
|
|
21
21
|
import { createClient } from "../createClient.js";
|
|
22
22
|
import { createMinimalClient } from "../createMinimalClient.js";
|
|
23
|
-
import { convertWireToOsdkObjects } from "./convertWireToOsdkObjects.js";
|
|
23
|
+
import { convertWireToOsdkObjects, convertWireToOsdkObjects2 } from "./convertWireToOsdkObjects.js";
|
|
24
24
|
describe("convertWireToOsdkObjects", () => {
|
|
25
25
|
let client;
|
|
26
|
+
const interfaceToObjectTypeMappings = {
|
|
27
|
+
FooInterface: {
|
|
28
|
+
Employee: {
|
|
29
|
+
fooSpt: "fullName"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
26
33
|
beforeAll(async () => {
|
|
27
34
|
apiServer.listen();
|
|
28
35
|
client = createClient("https://stack.palantir.com", $ontologyRid, async () => "myAccessToken");
|
|
@@ -34,7 +41,7 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
34
41
|
const {
|
|
35
42
|
data: [employee]
|
|
36
43
|
} = await client(Employee).fetchPage();
|
|
37
|
-
expect(Object.keys(employee).sort()).toEqual(["employeeId", "fullName", "office", "class", "startDate", "employeeStatus", "$apiName", "$objectType", "$primaryKey"].sort());
|
|
44
|
+
expect(Object.keys(employee).sort()).toEqual(["employeeId", "fullName", "office", "class", "startDate", "employeeStatus", "$apiName", "$objectType", "$primaryKey", "employeeLocation"].sort());
|
|
38
45
|
expect(Object.keys(employee.$as)).toEqual([]);
|
|
39
46
|
expect(Object.keys(employee.$link)).toEqual(["peeps", "lead", "officeLink"]);
|
|
40
47
|
});
|
|
@@ -56,10 +63,10 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
56
63
|
}]
|
|
57
64
|
}).fetchPage();
|
|
58
65
|
// Should not have $title
|
|
59
|
-
expect(JSON.stringify(employee)).toMatchInlineSnapshot(`"{"employeeId":50030,"fullName":"John Doe","office":"NYC","class":"Red","startDate":"2019-01-01","employeeStatus":{},"$apiName":"Employee","$objectType":"Employee","$primaryKey":50030}"`);
|
|
66
|
+
expect(JSON.stringify(employee)).toMatchInlineSnapshot(`"{"employeeId":50030,"fullName":"John Doe","office":"NYC","class":"Red","startDate":"2019-01-01","employeeStatus":{},"employeeLocation":{},"$apiName":"Employee","$objectType":"Employee","$primaryKey":50030}"`);
|
|
60
67
|
expect(JSON.stringify(employee.$as(FooInterface))).toMatchInlineSnapshot(`"{"$apiName":"FooInterface","$objectType":"Employee","$primaryKey":50030,"fooSpt":"John Doe"}"`);
|
|
61
68
|
// Should have $title
|
|
62
|
-
expect(JSON.stringify(employee2)).toMatchInlineSnapshot(`"{"employeeId":50031,"fullName":"Jane Doe","office":"SEA","class":"Blue","startDate":"2012-02-12","employeeStatus":{},"$apiName":"Employee","$objectType":"Employee","$primaryKey":50031,"$title":"Jane Doe"}"`);
|
|
69
|
+
expect(JSON.stringify(employee2)).toMatchInlineSnapshot(`"{"employeeId":50031,"fullName":"Jane Doe","office":"SEA","class":"Blue","startDate":"2012-02-12","employeeStatus":{},"employeeLocation":{},"$apiName":"Employee","$objectType":"Employee","$primaryKey":50031,"$title":"Jane Doe"}"`);
|
|
63
70
|
expect(JSON.stringify(employee2.$as(FooInterface))).toMatchInlineSnapshot(`"{"$apiName":"FooInterface","$objectType":"Employee","$primaryKey":50031,"$title":"Jane Doe","fooSpt":"Jane Doe"}"`);
|
|
64
71
|
});
|
|
65
72
|
it("reuses the object prototype across objects", async () => {
|
|
@@ -91,7 +98,7 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
91
98
|
expect(emptyAttachment).toBeUndefined();
|
|
92
99
|
expect(emptyAttachmentArray).toBeUndefined();
|
|
93
100
|
});
|
|
94
|
-
it("works even with unknown apiNames", async () => {
|
|
101
|
+
it("works even with unknown apiNames - old", async () => {
|
|
95
102
|
const clientCtx = createMinimalClient({
|
|
96
103
|
ontologyRid: $ontologyRid
|
|
97
104
|
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
@@ -105,7 +112,21 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
105
112
|
const prototypeAfter = Object.getPrototypeOf(object2);
|
|
106
113
|
expect(prototypeBefore).not.toBe(prototypeAfter);
|
|
107
114
|
});
|
|
108
|
-
it("
|
|
115
|
+
it("works even with unknown apiNames - new", async () => {
|
|
116
|
+
const clientCtx = createMinimalClient({
|
|
117
|
+
ontologyRid: $ontologyRid
|
|
118
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
119
|
+
createSharedClientContext("https://stack.palantir.com", async () => "myAccessToken", "userAgent");
|
|
120
|
+
let object = {
|
|
121
|
+
__apiName: Employee.apiName,
|
|
122
|
+
__primaryKey: 0
|
|
123
|
+
};
|
|
124
|
+
const prototypeBefore = Object.getPrototypeOf(object);
|
|
125
|
+
let object2 = await convertWireToOsdkObjects2(clientCtx, [object], undefined, undefined, undefined, false);
|
|
126
|
+
const prototypeAfter = Object.getPrototypeOf(object2);
|
|
127
|
+
expect(prototypeBefore).not.toBe(prototypeAfter);
|
|
128
|
+
});
|
|
129
|
+
it("updates interface when underlying changes - old", async () => {
|
|
109
130
|
const clientCtx = createMinimalClient({
|
|
110
131
|
ontologyRid: $ontologyRid
|
|
111
132
|
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
@@ -137,7 +158,39 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
137
158
|
expect(obj).toBe(objAsFoo.$as(Employee));
|
|
138
159
|
expect(objAsFoo).toBe(obj.$as(FooInterface));
|
|
139
160
|
});
|
|
140
|
-
it("
|
|
161
|
+
it("updates interface when underlying changes - new", async () => {
|
|
162
|
+
const clientCtx = createMinimalClient({
|
|
163
|
+
ontologyRid: $ontologyRid
|
|
164
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
165
|
+
const [obj] = await convertWireToOsdkObjects2(clientCtx, [{
|
|
166
|
+
__apiName: "Employee",
|
|
167
|
+
__primaryKey: 0,
|
|
168
|
+
__title: "Steve",
|
|
169
|
+
fullName: "Steve",
|
|
170
|
+
employeeId: "5"
|
|
171
|
+
}], undefined);
|
|
172
|
+
expect(obj.fullName).toEqual("Steve");
|
|
173
|
+
expect(Object.keys(obj).sort()).toEqual(["$apiName", "$objectType", "$primaryKey", "$title", "employeeId", "fullName"].sort());
|
|
174
|
+
const objAsFoo = obj.$as(FooInterface);
|
|
175
|
+
expect(objAsFoo).toMatchObject({
|
|
176
|
+
fooSpt: obj.fullName,
|
|
177
|
+
$apiName: FooInterface.apiName,
|
|
178
|
+
$primaryKey: obj.$primaryKey,
|
|
179
|
+
$objectType: obj.$objectType,
|
|
180
|
+
$title: obj.$title
|
|
181
|
+
});
|
|
182
|
+
console.log(obj);
|
|
183
|
+
console.log(objAsFoo);
|
|
184
|
+
obj.$updateInternalValues({
|
|
185
|
+
fullName: "Bob"
|
|
186
|
+
});
|
|
187
|
+
expect(obj.fullName).toEqual("Bob");
|
|
188
|
+
expect(objAsFoo.fooSpt).toEqual(obj.fullName);
|
|
189
|
+
expect(Object.keys(objAsFoo).sort()).toEqual(["$apiName", "$objectType", "$primaryKey", "$title", "fooSpt"].sort());
|
|
190
|
+
expect(obj).toBe(objAsFoo.$as(Employee));
|
|
191
|
+
expect(objAsFoo).toBe(obj.$as(FooInterface));
|
|
192
|
+
});
|
|
193
|
+
it("reconstitutes interfaces properly without rid - old", async () => {
|
|
141
194
|
const clientCtx = createMinimalClient({
|
|
142
195
|
ontologyRid: $ontologyRid
|
|
143
196
|
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
@@ -169,6 +222,37 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
169
222
|
}
|
|
170
223
|
`);
|
|
171
224
|
});
|
|
225
|
+
it("reconstitutes interfaces properly without rid - new", async () => {
|
|
226
|
+
const clientCtx = createMinimalClient({
|
|
227
|
+
ontologyRid: $ontologyRid
|
|
228
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
229
|
+
const [objAsFoo] = await convertWireToOsdkObjects2(clientCtx, [{
|
|
230
|
+
__apiName: "Employee",
|
|
231
|
+
__primaryKey: 0,
|
|
232
|
+
__title: "Steve",
|
|
233
|
+
fullName: "Steve"
|
|
234
|
+
}], FooInterface.apiName, false, undefined, false, interfaceToObjectTypeMappings);
|
|
235
|
+
expect(objAsFoo).toMatchInlineSnapshot(`
|
|
236
|
+
{
|
|
237
|
+
"$apiName": "FooInterface",
|
|
238
|
+
"$objectType": "Employee",
|
|
239
|
+
"$primaryKey": 0,
|
|
240
|
+
"$title": "Steve",
|
|
241
|
+
"fooSpt": "Steve",
|
|
242
|
+
}
|
|
243
|
+
`);
|
|
244
|
+
const obj = objAsFoo.$as(Employee);
|
|
245
|
+
expect(obj.fullName).toEqual("Steve");
|
|
246
|
+
expect(obj).toMatchInlineSnapshot(`
|
|
247
|
+
{
|
|
248
|
+
"$apiName": "Employee",
|
|
249
|
+
"$objectType": "Employee",
|
|
250
|
+
"$primaryKey": 0,
|
|
251
|
+
"$title": "Steve",
|
|
252
|
+
"fullName": "Steve",
|
|
253
|
+
}
|
|
254
|
+
`);
|
|
255
|
+
});
|
|
172
256
|
it("reconstitutes interfaces properly with rid", async () => {
|
|
173
257
|
const clientCtx = createMinimalClient({
|
|
174
258
|
ontologyRid: $ontologyRid
|
|
@@ -206,29 +290,96 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
206
290
|
`);
|
|
207
291
|
expect(obj.$rid).toEqual("hiMom");
|
|
208
292
|
});
|
|
293
|
+
it("reconstitutes interfaces properly with rid - new", async () => {
|
|
294
|
+
const clientCtx = createMinimalClient({
|
|
295
|
+
ontologyRid: $ontologyRid
|
|
296
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
297
|
+
const [objAsFoo] = await convertWireToOsdkObjects2(clientCtx, [{
|
|
298
|
+
__apiName: "Employee",
|
|
299
|
+
__primaryKey: 0,
|
|
300
|
+
__title: "Steve",
|
|
301
|
+
__rid: "hiMom",
|
|
302
|
+
fullName: "Steve",
|
|
303
|
+
employeeId: 0
|
|
304
|
+
}], FooInterface.apiName, false, undefined, false, interfaceToObjectTypeMappings);
|
|
305
|
+
expect(objAsFoo).toMatchInlineSnapshot(`
|
|
306
|
+
{
|
|
307
|
+
"$apiName": "FooInterface",
|
|
308
|
+
"$objectType": "Employee",
|
|
309
|
+
"$primaryKey": 0,
|
|
310
|
+
"$rid": "hiMom",
|
|
311
|
+
"$title": "Steve",
|
|
312
|
+
"fooSpt": "Steve",
|
|
313
|
+
}
|
|
314
|
+
`);
|
|
315
|
+
expect(objAsFoo.$rid).toEqual("hiMom");
|
|
316
|
+
const obj = objAsFoo.$as(Employee);
|
|
317
|
+
expect(obj.fullName).toEqual("Steve");
|
|
318
|
+
expect(obj).toMatchInlineSnapshot(`
|
|
319
|
+
{
|
|
320
|
+
"$apiName": "Employee",
|
|
321
|
+
"$objectType": "Employee",
|
|
322
|
+
"$primaryKey": 0,
|
|
323
|
+
"$rid": "hiMom",
|
|
324
|
+
"$title": "Steve",
|
|
325
|
+
"employeeId": 0,
|
|
326
|
+
"fullName": "Steve",
|
|
327
|
+
}
|
|
328
|
+
`);
|
|
329
|
+
expect(obj.$rid).toEqual("hiMom");
|
|
330
|
+
});
|
|
209
331
|
describe("selection keys", () => {
|
|
210
332
|
it("throws when required is missing", async () => {
|
|
211
333
|
let object = {
|
|
212
334
|
__apiName: "Employee",
|
|
213
335
|
__primaryKey: 0
|
|
214
336
|
};
|
|
215
|
-
await expect(() => convertWireToOsdkObjects(client[
|
|
337
|
+
await expect(() => convertWireToOsdkObjects(client[additionalContext], [object], undefined, undefined, ["employeeId"], "throw")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
338
|
+
});
|
|
339
|
+
it("does not throw when optional is missing", async () => {
|
|
340
|
+
await expect(convertWireToOsdkObjects(client[additionalContext], [{
|
|
341
|
+
__apiName: "Employee",
|
|
342
|
+
__primaryKey: 0
|
|
343
|
+
}], undefined, undefined, ["fullName"], "throw")).resolves.to.not.toBeUndefined();
|
|
344
|
+
});
|
|
345
|
+
it("filters when it should", async () => {
|
|
346
|
+
const result = await convertWireToOsdkObjects(client[additionalContext], [{
|
|
347
|
+
__apiName: "Employee",
|
|
348
|
+
__primaryKey: 0
|
|
349
|
+
}], undefined, undefined, ["employeeId"], "drop");
|
|
350
|
+
expect(result.length).toBe(0);
|
|
351
|
+
});
|
|
352
|
+
it("does not filter when it shouldn't", async () => {
|
|
353
|
+
const result = await convertWireToOsdkObjects(client[additionalContext], [{
|
|
354
|
+
__apiName: "Employee",
|
|
355
|
+
__primaryKey: 0
|
|
356
|
+
}], undefined, undefined, ["fullName"], "drop");
|
|
357
|
+
expect(result.length).toBe(1);
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
describe("selection keys - new", () => {
|
|
361
|
+
it("throws when required is missing", async () => {
|
|
362
|
+
let object = {
|
|
363
|
+
__apiName: "Employee",
|
|
364
|
+
__primaryKey: 0
|
|
365
|
+
};
|
|
366
|
+
await expect(() => convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, ["employeeId"], "throw")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
216
367
|
});
|
|
217
368
|
it("does not throw when optional is missing", async () => {
|
|
218
|
-
await expect(
|
|
369
|
+
await expect(convertWireToOsdkObjects2(client[additionalContext], [{
|
|
219
370
|
__apiName: "Employee",
|
|
220
371
|
__primaryKey: 0
|
|
221
372
|
}], undefined, undefined, ["fullName"], "throw")).resolves.to.not.toBeUndefined();
|
|
222
373
|
});
|
|
223
374
|
it("filters when it should", async () => {
|
|
224
|
-
const result = await
|
|
375
|
+
const result = await convertWireToOsdkObjects2(client[additionalContext], [{
|
|
225
376
|
__apiName: "Employee",
|
|
226
377
|
__primaryKey: 0
|
|
227
378
|
}], undefined, undefined, ["employeeId"], "drop");
|
|
228
379
|
expect(result.length).toBe(0);
|
|
229
380
|
});
|
|
230
381
|
it("does not filter when it shouldn't", async () => {
|
|
231
|
-
const result = await
|
|
382
|
+
const result = await convertWireToOsdkObjects2(client[additionalContext], [{
|
|
232
383
|
__apiName: "Employee",
|
|
233
384
|
__primaryKey: 0
|
|
234
385
|
}], undefined, undefined, ["fullName"], "drop");
|
|
@@ -241,24 +392,55 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
241
392
|
__apiName: "Employee",
|
|
242
393
|
__primaryKey: 0
|
|
243
394
|
};
|
|
244
|
-
await expect(() =>
|
|
395
|
+
await expect(() => convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, "throw")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
245
396
|
});
|
|
246
397
|
it("does not throw when required is present", async () => {
|
|
247
|
-
await expect(
|
|
398
|
+
await expect(convertWireToOsdkObjects2(client[additionalContext], [{
|
|
248
399
|
__apiName: "Employee",
|
|
249
400
|
__primaryKey: 0,
|
|
250
401
|
"employeeId": 0
|
|
251
402
|
}], undefined, undefined, undefined, "throw")).resolves.to.not.toBeUndefined();
|
|
252
403
|
});
|
|
253
404
|
it("filters when it should", async () => {
|
|
254
|
-
const result = await
|
|
405
|
+
const result = await convertWireToOsdkObjects2(client[additionalContext], [{
|
|
255
406
|
__apiName: "Employee",
|
|
256
407
|
__primaryKey: 0
|
|
257
408
|
}], undefined, undefined, undefined, "drop");
|
|
258
409
|
expect(result.length).toBe(0);
|
|
259
410
|
});
|
|
260
411
|
it("does not filter when it shouldn't", async () => {
|
|
261
|
-
const result = await
|
|
412
|
+
const result = await convertWireToOsdkObjects2(client[additionalContext], [{
|
|
413
|
+
__apiName: "Employee",
|
|
414
|
+
__primaryKey: 0,
|
|
415
|
+
"employeeId": 0
|
|
416
|
+
}], undefined, undefined, undefined, "drop");
|
|
417
|
+
expect(result.length).toBe(1);
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
describe("without selection keys - new", () => {
|
|
421
|
+
it("throws when required is missing", async () => {
|
|
422
|
+
let object = {
|
|
423
|
+
__apiName: "Employee",
|
|
424
|
+
__primaryKey: 0
|
|
425
|
+
};
|
|
426
|
+
await expect(() => convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, "throw")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
427
|
+
});
|
|
428
|
+
it("does not throw when required is present", async () => {
|
|
429
|
+
await expect(convertWireToOsdkObjects2(client[additionalContext], [{
|
|
430
|
+
__apiName: "Employee",
|
|
431
|
+
__primaryKey: 0,
|
|
432
|
+
"employeeId": 0
|
|
433
|
+
}], undefined, undefined, undefined, "throw")).resolves.to.not.toBeUndefined();
|
|
434
|
+
});
|
|
435
|
+
it("filters when it should", async () => {
|
|
436
|
+
const result = await convertWireToOsdkObjects2(client[additionalContext], [{
|
|
437
|
+
__apiName: "Employee",
|
|
438
|
+
__primaryKey: 0
|
|
439
|
+
}], undefined, undefined, undefined, "drop");
|
|
440
|
+
expect(result.length).toBe(0);
|
|
441
|
+
});
|
|
442
|
+
it("does not filter when it shouldn't", async () => {
|
|
443
|
+
const result = await convertWireToOsdkObjects2(client[additionalContext], [{
|
|
262
444
|
__apiName: "Employee",
|
|
263
445
|
__primaryKey: 0,
|
|
264
446
|
"employeeId": 0
|
|
@@ -267,12 +449,23 @@ describe("convertWireToOsdkObjects", () => {
|
|
|
267
449
|
});
|
|
268
450
|
});
|
|
269
451
|
it("behaves correctly when converting", async () => {
|
|
270
|
-
const result = await
|
|
452
|
+
const result = await convertWireToOsdkObjects2(client[additionalContext], [{
|
|
271
453
|
__apiName: "Employee",
|
|
272
454
|
__primaryKey: 0,
|
|
273
455
|
fooSpt: "hi"
|
|
274
|
-
}], "FooInterface", undefined, ["fooSpt"], "drop");
|
|
456
|
+
}], "FooInterface", undefined, ["fooSpt"], "drop", interfaceToObjectTypeMappings);
|
|
275
457
|
expect(result.length).toBe(1);
|
|
276
458
|
});
|
|
277
459
|
});
|
|
460
|
+
describe("Osdk.Instance", () => {
|
|
461
|
+
it("is assignable to Osdk<>", () => {});
|
|
462
|
+
it("is assignable from Osdk<>", () => {});
|
|
463
|
+
it("is assignable to Osdk<> with $notStrict", () => {
|
|
464
|
+
const instance = {};
|
|
465
|
+
});
|
|
466
|
+
it("is assignable from Osdk<> with $notStrict", () => {
|
|
467
|
+
const osdk = {};
|
|
468
|
+
});
|
|
469
|
+
it("object with any for props is assignable to its normal self", () => {});
|
|
470
|
+
});
|
|
278
471
|
//# sourceMappingURL=convertWireToOsdkObjects.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertWireToOsdkObjects.test.js","names":["$ontologyRid","Employee","FooInterface","objectTypeWithAllPropertyTypes","symbolClientContext","createSharedClientContext","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","createMinimalClient","convertWireToOsdkObjects","client","listen","close","data","employee","fetchPage","Object","keys","sort","toEqual","$as","$link","employee2","where","$and","employeeId","$gt","$lt","JSON","stringify","toMatchInlineSnapshot","employees","length","toBeGreaterThanOrEqual","a","b","getPrototypeOf","toBe","withValues","id","attachment","attachmentArray","toMatchTypeOf","rid","Array","isArray","toBeTruthy","withoutValues","emptyAttachment","emptyAttachmentArray","toBeUndefined","clientCtx","ontologyRid","object","__apiName","apiName","__primaryKey","prototypeBefore","object2","undefined","prototypeAfter","not","obj","__title","fullName","objAsFoo","toMatchObject","fooSpt","$apiName","$primaryKey","$objectType","$title","console","log","$updateInternalValues","__rid","$rid","rejects","toThrowErrorMatchingInlineSnapshot","resolves","to","result"],"sources":["convertWireToOsdkObjects.test.js"],"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 */\nimport { $ontologyRid, Employee, FooInterface, objectTypeWithAllPropertyTypes, } from \"@osdk/client.test.ontology\";\nimport { symbolClientContext } from \"@osdk/shared.client\";\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\ndescribe(\"convertWireToOsdkObjects\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"configures properties correctly\", async () => {\n const { data: [employee] } = await client(Employee).fetchPage();\n expect(Object.keys(employee).sort()).toEqual([\n \"employeeId\",\n \"fullName\",\n \"office\",\n \"class\",\n \"startDate\",\n \"employeeStatus\",\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n ].sort());\n expect(Object.keys(employee.$as)).toEqual([]);\n expect(Object.keys(employee.$link)).toEqual([\n \"peeps\",\n \"lead\",\n \"officeLink\",\n ]);\n });\n it(\"stringifies properties on objects and interfaces correctly\", async () => {\n const { data: [employee] } = await client(Employee).fetchPage();\n const { data: [employee2] } = await client(Employee).where({\n $and: [{ employeeId: { $gt: 50030 } }, { employeeId: { $lt: 50032 } }],\n }).fetchPage();\n // Should not have $title\n expect(JSON.stringify(employee)).toMatchInlineSnapshot(`\"{\"employeeId\":50030,\"fullName\":\"John Doe\",\"office\":\"NYC\",\"class\":\"Red\",\"startDate\":\"2019-01-01\",\"employeeStatus\":{},\"$apiName\":\"Employee\",\"$objectType\":\"Employee\",\"$primaryKey\":50030}\"`);\n expect(JSON.stringify(employee.$as(FooInterface))).toMatchInlineSnapshot(`\"{\"$apiName\":\"FooInterface\",\"$objectType\":\"Employee\",\"$primaryKey\":50030,\"fooSpt\":\"John Doe\"}\"`);\n // Should have $title\n expect(JSON.stringify(employee2)).toMatchInlineSnapshot(`\"{\"employeeId\":50031,\"fullName\":\"Jane Doe\",\"office\":\"SEA\",\"class\":\"Blue\",\"startDate\":\"2012-02-12\",\"employeeStatus\":{},\"$apiName\":\"Employee\",\"$objectType\":\"Employee\",\"$primaryKey\":50031,\"$title\":\"Jane Doe\"}\"`);\n expect(JSON.stringify(employee2.$as(FooInterface))).toMatchInlineSnapshot(`\"{\"$apiName\":\"FooInterface\",\"$objectType\":\"Employee\",\"$primaryKey\":50031,\"$title\":\"Jane Doe\",\"fooSpt\":\"Jane Doe\"}\"`);\n });\n it(\"reuses the object prototype across objects\", async () => {\n const employees = await client(Employee).fetchPage();\n expect(employees.data.length).toBeGreaterThanOrEqual(2);\n const [a, b] = employees.data;\n expect(Object.getPrototypeOf(Object.getPrototypeOf(a))).toBe(Object.getPrototypeOf(Object.getPrototypeOf(b)));\n });\n it(\"converts attachments as expected\", async () => {\n const withValues = await client(objectTypeWithAllPropertyTypes)\n .where({ id: 1 })\n .fetchPage();\n expect(withValues.data.length).toBeGreaterThanOrEqual(1);\n const { attachment, attachmentArray } = withValues.data[0];\n expectTypeOf(attachment).toMatchTypeOf;\n expect(attachment?.rid).toEqual(\"ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75\");\n expect(Array.isArray(attachmentArray)).toBeTruthy();\n expectTypeOf(attachmentArray[0]).toMatchTypeOf;\n const withoutValues = await client(objectTypeWithAllPropertyTypes).where({ id: 2 }).fetchPage();\n const { attachment: emptyAttachment, attachmentArray: emptyAttachmentArray, } = withoutValues.data[0];\n expect(emptyAttachment).toBeUndefined();\n expect(emptyAttachmentArray).toBeUndefined();\n });\n it(\"works even with unknown apiNames\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n createSharedClientContext(\"https://stack.palantir.com\", async () => \"myAccessToken\", \"userAgent\");\n let object = {\n __apiName: Employee.apiName,\n __primaryKey: 0,\n };\n const prototypeBefore = Object.getPrototypeOf(object);\n let object2 = await convertWireToOsdkObjects(clientCtx, [object], undefined, undefined, undefined, false);\n const prototypeAfter = Object.getPrototypeOf(object2);\n expect(prototypeBefore).not.toBe(prototypeAfter);\n });\n it(\"updates interface when underlying changes\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fullName: \"Steve\",\n employeeId: \"5\",\n };\n const [obj] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], undefined));\n expect(obj.fullName).toEqual(\"Steve\");\n expect(Object.keys(obj).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"employeeId\",\n \"fullName\",\n ].sort());\n const objAsFoo = obj.$as(FooInterface);\n expect(objAsFoo).toMatchObject({\n fooSpt: obj.fullName,\n $apiName: FooInterface.apiName,\n $primaryKey: obj.$primaryKey,\n $objectType: obj.$objectType,\n $title: obj.$title,\n });\n console.log(obj);\n console.log(objAsFoo);\n obj.$updateInternalValues({\n fullName: \"Bob\",\n });\n expect(obj.fullName).toEqual(\"Bob\");\n expect(objAsFoo.fooSpt).toEqual(obj.fullName);\n expect(Object.keys(objAsFoo).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"fooSpt\",\n ].sort());\n expect(obj).toBe(objAsFoo.$as(Employee));\n expect(objAsFoo).toBe(obj.$as(FooInterface));\n });\n it(\"reconstitutes interfaces properly without rid\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fooSpt: \"Steve\",\n };\n const [objAsFoo] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], FooInterface.apiName));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"employeeId\": 0,\n \"fullName\": \"Steve\",\n }\n `);\n });\n it(\"reconstitutes interfaces properly with rid\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n __rid: \"hiMom\",\n fooSpt: \"Steve\",\n };\n const [objAsFoo] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], FooInterface.apiName));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n expect(objAsFoo.$rid).toEqual(\"hiMom\");\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"employeeId\": 0,\n \"fullName\": \"Steve\",\n }\n `);\n expect(obj.$rid).toEqual(\"hiMom\");\n });\n describe(\"selection keys\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"employeeId\"], \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when optional is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"fullName\"], \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"employeeId\"], \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"fullName\"], \"drop\");\n expect(result.length).toBe(1);\n });\n });\n describe(\"without selection keys\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when required is present\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n await expect(convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(1);\n });\n });\n it(\"behaves correctly when converting\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n fooSpt: \"hi\",\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], \"FooInterface\", undefined, [\"fooSpt\"], \"drop\");\n expect(result.length).toBe(1);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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CAAC,mCAAmC,EAAE,YAAY;IAMhD,MAAM2E,MAAM,GAAG,MAAMxE,wBAAwB,CAACC,MAAM,CAACZ,mBAAmB,CAAC,EAAE,CAL5D;MACXwD,SAAS,EAAE,UAAU;MACrBE,YAAY,EAAE,CAAC;MACfW,MAAM,EAAE;IACZ,CAAC,CACkF,EAAE,cAAc,EAAER,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACnIvD,MAAM,CAAC6E,MAAM,CAACjD,MAAM,CAAC,CAACK,IAAI,CAAC,CAAC,CAAC;EACjC,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertWireToOsdkObjects.test.js","names":["$ontologyRid","Employee","FooInterface","objectTypeWithAllPropertyTypes","createSharedClientContext","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","additionalContext","createClient","createMinimalClient","convertWireToOsdkObjects","convertWireToOsdkObjects2","client","interfaceToObjectTypeMappings","fooSpt","listen","close","data","employee","fetchPage","Object","keys","sort","toEqual","$as","$link","employee2","where","$and","employeeId","$gt","$lt","JSON","stringify","toMatchInlineSnapshot","employees","length","toBeGreaterThanOrEqual","a","b","getPrototypeOf","toBe","withValues","id","attachment","attachmentArray","toMatchTypeOf","rid","Array","isArray","toBeTruthy","withoutValues","emptyAttachment","emptyAttachmentArray","toBeUndefined","clientCtx","ontologyRid","object","__apiName","apiName","__primaryKey","prototypeBefore","object2","undefined","prototypeAfter","not","obj","__title","fullName","objAsFoo","toMatchObject","$apiName","$primaryKey","$objectType","$title","console","log","$updateInternalValues","__rid","$rid","rejects","toThrowErrorMatchingInlineSnapshot","resolves","to","result","instance","osdk"],"sources":["convertWireToOsdkObjects.test.js"],"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 */\nimport { $ontologyRid, Employee, FooInterface, objectTypeWithAllPropertyTypes, } from \"@osdk/client.test.ontology\";\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { additionalContext } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport { convertWireToOsdkObjects, convertWireToOsdkObjects2, } from \"./convertWireToOsdkObjects.js\";\ndescribe(\"convertWireToOsdkObjects\", () => {\n let client;\n const interfaceToObjectTypeMappings = {\n FooInterface: { Employee: { fooSpt: \"fullName\" } },\n };\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"configures properties correctly\", async () => {\n const { data: [employee] } = await client(Employee).fetchPage();\n expect(Object.keys(employee).sort()).toEqual([\n \"employeeId\",\n \"fullName\",\n \"office\",\n \"class\",\n \"startDate\",\n \"employeeStatus\",\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"employeeLocation\",\n ].sort());\n expect(Object.keys(employee.$as)).toEqual([]);\n expect(Object.keys(employee.$link)).toEqual([\n \"peeps\",\n \"lead\",\n \"officeLink\",\n ]);\n });\n it(\"stringifies properties on objects and interfaces correctly\", async () => {\n const { data: [employee] } = await client(Employee).fetchPage();\n const { data: [employee2] } = await client(Employee).where({\n $and: [{ employeeId: { $gt: 50030 } }, { employeeId: { $lt: 50032 } }],\n }).fetchPage();\n // Should not have $title\n expect(JSON.stringify(employee)).toMatchInlineSnapshot(`\"{\"employeeId\":50030,\"fullName\":\"John Doe\",\"office\":\"NYC\",\"class\":\"Red\",\"startDate\":\"2019-01-01\",\"employeeStatus\":{},\"employeeLocation\":{},\"$apiName\":\"Employee\",\"$objectType\":\"Employee\",\"$primaryKey\":50030}\"`);\n expect(JSON.stringify(employee.$as(FooInterface))).toMatchInlineSnapshot(`\"{\"$apiName\":\"FooInterface\",\"$objectType\":\"Employee\",\"$primaryKey\":50030,\"fooSpt\":\"John Doe\"}\"`);\n // Should have $title\n expect(JSON.stringify(employee2)).toMatchInlineSnapshot(`\"{\"employeeId\":50031,\"fullName\":\"Jane Doe\",\"office\":\"SEA\",\"class\":\"Blue\",\"startDate\":\"2012-02-12\",\"employeeStatus\":{},\"employeeLocation\":{},\"$apiName\":\"Employee\",\"$objectType\":\"Employee\",\"$primaryKey\":50031,\"$title\":\"Jane Doe\"}\"`);\n expect(JSON.stringify(employee2.$as(FooInterface))).toMatchInlineSnapshot(`\"{\"$apiName\":\"FooInterface\",\"$objectType\":\"Employee\",\"$primaryKey\":50031,\"$title\":\"Jane Doe\",\"fooSpt\":\"Jane Doe\"}\"`);\n });\n it(\"reuses the object prototype across objects\", async () => {\n const employees = await client(Employee).fetchPage();\n expect(employees.data.length).toBeGreaterThanOrEqual(2);\n const [a, b] = employees.data;\n expect(Object.getPrototypeOf(Object.getPrototypeOf(a))).toBe(Object.getPrototypeOf(Object.getPrototypeOf(b)));\n });\n it(\"converts attachments as expected\", async () => {\n const withValues = await client(objectTypeWithAllPropertyTypes)\n .where({ id: 1 })\n .fetchPage();\n expect(withValues.data.length).toBeGreaterThanOrEqual(1);\n const { attachment, attachmentArray } = withValues.data[0];\n expectTypeOf(attachment).toMatchTypeOf;\n expect(attachment?.rid).toEqual(\"ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75\");\n expect(Array.isArray(attachmentArray)).toBeTruthy();\n expectTypeOf(attachmentArray[0]).toMatchTypeOf;\n const withoutValues = await client(objectTypeWithAllPropertyTypes).where({ id: 2 }).fetchPage();\n const { attachment: emptyAttachment, attachmentArray: emptyAttachmentArray, } = withoutValues.data[0];\n expect(emptyAttachment).toBeUndefined();\n expect(emptyAttachmentArray).toBeUndefined();\n });\n it(\"works even with unknown apiNames - old\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n createSharedClientContext(\"https://stack.palantir.com\", async () => \"myAccessToken\", \"userAgent\");\n let object = {\n __apiName: Employee.apiName,\n __primaryKey: 0,\n };\n const prototypeBefore = Object.getPrototypeOf(object);\n let object2 = await convertWireToOsdkObjects(clientCtx, [object], undefined, undefined, undefined, false);\n const prototypeAfter = Object.getPrototypeOf(object2);\n expect(prototypeBefore).not.toBe(prototypeAfter);\n });\n it(\"works even with unknown apiNames - new\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n createSharedClientContext(\"https://stack.palantir.com\", async () => \"myAccessToken\", \"userAgent\");\n let object = {\n __apiName: Employee.apiName,\n __primaryKey: 0,\n };\n const prototypeBefore = Object.getPrototypeOf(object);\n let object2 = await convertWireToOsdkObjects2(clientCtx, [object], undefined, undefined, undefined, false);\n const prototypeAfter = Object.getPrototypeOf(object2);\n expect(prototypeBefore).not.toBe(prototypeAfter);\n });\n it(\"updates interface when underlying changes - old\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fullName: \"Steve\",\n employeeId: \"5\",\n };\n const [obj] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], undefined));\n expect(obj.fullName).toEqual(\"Steve\");\n expect(Object.keys(obj).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"employeeId\",\n \"fullName\",\n ].sort());\n const objAsFoo = obj.$as(FooInterface);\n expect(objAsFoo).toMatchObject({\n fooSpt: obj.fullName,\n $apiName: FooInterface.apiName,\n $primaryKey: obj.$primaryKey,\n $objectType: obj.$objectType,\n $title: obj.$title,\n });\n console.log(obj);\n console.log(objAsFoo);\n obj.$updateInternalValues({\n fullName: \"Bob\",\n });\n expect(obj.fullName).toEqual(\"Bob\");\n expect(objAsFoo.fooSpt).toEqual(obj.fullName);\n expect(Object.keys(objAsFoo).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"fooSpt\",\n ].sort());\n expect(obj).toBe(objAsFoo.$as(Employee));\n expect(objAsFoo).toBe(obj.$as(FooInterface));\n });\n it(\"updates interface when underlying changes - new\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fullName: \"Steve\",\n employeeId: \"5\",\n };\n const [obj] = (await convertWireToOsdkObjects2(clientCtx, [objectFromWire], undefined));\n expect(obj.fullName).toEqual(\"Steve\");\n expect(Object.keys(obj).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"employeeId\",\n \"fullName\",\n ].sort());\n const objAsFoo = obj.$as(FooInterface);\n expect(objAsFoo).toMatchObject({\n fooSpt: obj.fullName,\n $apiName: FooInterface.apiName,\n $primaryKey: obj.$primaryKey,\n $objectType: obj.$objectType,\n $title: obj.$title,\n });\n console.log(obj);\n console.log(objAsFoo);\n obj.$updateInternalValues({\n fullName: \"Bob\",\n });\n expect(obj.fullName).toEqual(\"Bob\");\n expect(objAsFoo.fooSpt).toEqual(obj.fullName);\n expect(Object.keys(objAsFoo).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"fooSpt\",\n ].sort());\n expect(obj).toBe(objAsFoo.$as(Employee));\n expect(objAsFoo).toBe(obj.$as(FooInterface));\n });\n it(\"reconstitutes interfaces properly without rid - old\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fooSpt: \"Steve\",\n };\n const [objAsFoo] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], FooInterface.apiName));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"employeeId\": 0,\n \"fullName\": \"Steve\",\n }\n `);\n });\n it(\"reconstitutes interfaces properly without rid - new\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fullName: \"Steve\",\n };\n const [objAsFoo] = (await convertWireToOsdkObjects2(clientCtx, [objectFromWire], FooInterface.apiName, false, undefined, false, interfaceToObjectTypeMappings));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"fullName\": \"Steve\",\n }\n `);\n });\n it(\"reconstitutes interfaces properly with rid\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n __rid: \"hiMom\",\n fooSpt: \"Steve\",\n };\n const [objAsFoo] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], FooInterface.apiName));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n expect(objAsFoo.$rid).toEqual(\"hiMom\");\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"employeeId\": 0,\n \"fullName\": \"Steve\",\n }\n `);\n expect(obj.$rid).toEqual(\"hiMom\");\n });\n it(\"reconstitutes interfaces properly with rid - new\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n __rid: \"hiMom\",\n fullName: \"Steve\",\n employeeId: 0,\n };\n const [objAsFoo] = (await convertWireToOsdkObjects2(clientCtx, [objectFromWire], FooInterface.apiName, false, undefined, false, interfaceToObjectTypeMappings));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n expect(objAsFoo.$rid).toEqual(\"hiMom\");\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"employeeId\": 0,\n \"fullName\": \"Steve\",\n }\n `);\n expect(obj.$rid).toEqual(\"hiMom\");\n });\n describe(\"selection keys\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects(client[additionalContext], [object], undefined, undefined, [\"employeeId\"], \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when optional is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(convertWireToOsdkObjects(client[additionalContext], [object], undefined, undefined, [\"fullName\"], \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[additionalContext], [object], undefined, undefined, [\"employeeId\"], \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[additionalContext], [object], undefined, undefined, [\"fullName\"], \"drop\");\n expect(result.length).toBe(1);\n });\n });\n describe(\"selection keys - new\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, [\"employeeId\"], \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when optional is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, [\"fullName\"], \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, [\"employeeId\"], \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, [\"fullName\"], \"drop\");\n expect(result.length).toBe(1);\n });\n });\n describe(\"without selection keys\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when required is present\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n await expect(convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n const result = await convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(1);\n });\n });\n describe(\"without selection keys - new\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when required is present\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n await expect(convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n const result = await convertWireToOsdkObjects2(client[additionalContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(1);\n });\n });\n it(\"behaves correctly when converting\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n fooSpt: \"hi\",\n };\n const result = await convertWireToOsdkObjects2(client[additionalContext], [object], \"FooInterface\", undefined, [\"fooSpt\"], \"drop\", interfaceToObjectTypeMappings);\n expect(result.length).toBe(1);\n });\n});\ndescribe(\"Osdk.Instance\", () => {\n it(\"is assignable to Osdk<>\", () => {\n const instance = {};\n const osdk = instance;\n });\n it(\"is assignable from Osdk<>\", () => {\n const osdk = {};\n const instance = osdk;\n });\n it(\"is assignable to Osdk<> with $notStrict\", () => {\n const instance = {};\n const osdk = instance;\n const osdk2 = instance;\n });\n it(\"is assignable from Osdk<> with $notStrict\", () => {\n const osdk = {};\n const osdk2 = osdk;\n const instance = osdk;\n const instance2 = osdk2;\n });\n it(\"object with any for props is assignable to its normal self\", () => {\n const foo = {};\n const bar = foo;\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,8BAA8B,QAAS,4BAA4B;A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mCAAmC,EAAE,YAAY;IAMhD,MAAM8E,MAAM,GAAG,MAAMzE,yBAAyB,CAACC,MAAM,CAACL,iBAAiB,CAAC,EAAE,CAL3D;MACXmD,SAAS,EAAE,UAAU;MACrBE,YAAY,EAAE,CAAC;MACf9C,MAAM,EAAE;IACZ,CAAC,CACiF,EAAE,cAAc,EAAEiD,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAElD,6BAA6B,CAAC;IACjKT,MAAM,CAACgF,MAAM,CAAChD,MAAM,CAAC,CAACK,IAAI,CAAC,CAAC,CAAC;EACjC,CAAC,CAAC;AACN,CAAC,CAAC;AACFtC,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5BG,EAAE,CAAC,yBAAyB,EAAE,MAAM,CAGpC,CAAC,CAAC;EACFA,EAAE,CAAC,2BAA2B,EAAE,MAAM,CAGtC,CAAC,CAAC;EACFA,EAAE,CAAC,yCAAyC,EAAE,MAAM;IAChD,MAAM+E,QAAQ,GAAG,CAAC,CAAC;EAGvB,CAAC,CAAC;EACF/E,EAAE,CAAC,2CAA2C,EAAE,MAAM;IAClD,MAAMgF,IAAI,GAAG,CAAC,CAAC;EAInB,CAAC,CAAC;EACFhF,EAAE,CAAC,4DAA4D,EAAE,MAAM,CAGvE,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchPage.d.ts","sourceRoot":"","sources":["../../../src/object/fetchPage.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,OAAO,EAOP,2BAA2B,EAE3B,YAAY,EAEb,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"fetchPage.d.ts","sourceRoot":"","sources":["../../../src/object/fetchPage.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,OAAO,EAOP,2BAA2B,EAE3B,YAAY,EAEb,MAAM,WAAW,CAAC;AAqBnB,wBAAgB,OAAO,CACrB,CAAC,SAAS,2BAA2B,EACrC,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EAEzB,IAAI,EAAE,CAAC,EACP,GAAG,UAAU,EAAE,CAAC,EAAE,GACjB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAEf"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as OntologiesV2 from "@osdk/internal.foundry.ontologiesv2";
|
|
17
17
|
import { addUserAgentAndRequestContextHeaders } from "../util/addUserAgentAndRequestContextHeaders.js";
|
|
18
|
-
import {
|
|
18
|
+
import { resolveBaseObjectSetType } from "../util/objectSetUtils.js";
|
|
19
|
+
import { convertWireToOsdkObjects, convertWireToOsdkObjects2 } from "./convertWireToOsdkObjects.js";
|
|
19
20
|
export function augment(type, ...properties) {
|
|
20
21
|
return {
|
|
21
22
|
[type.apiName]: properties
|
|
@@ -23,10 +24,13 @@ export function augment(type, ...properties) {
|
|
|
23
24
|
}
|
|
24
25
|
/** @internal */
|
|
25
26
|
export function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = undefined) {
|
|
26
|
-
if (objectSet.type === "base") {
|
|
27
|
-
if (objectSet.objectType !== expectedApiName) {
|
|
27
|
+
if (objectSet.type === "base" || objectSet.type === "interfaceBase") {
|
|
28
|
+
if (objectSet.type === "base" && objectSet.objectType !== expectedApiName) {
|
|
28
29
|
throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);
|
|
29
30
|
}
|
|
31
|
+
if (objectSet.type === "interfaceBase" && objectSet.interfaceType !== expectedApiName) {
|
|
32
|
+
throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.interfaceType}`);
|
|
33
|
+
}
|
|
30
34
|
return existingWhere;
|
|
31
35
|
}
|
|
32
36
|
if (objectSet.type === "filter") {
|
|
@@ -38,20 +42,32 @@ export function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWher
|
|
|
38
42
|
throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
|
|
39
43
|
}
|
|
40
44
|
async function fetchInterfacePage(client, interfaceType, args, objectSet) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
if (args.$__UNSTABLE_useOldInterfaceApis) {
|
|
46
|
+
const result = await OntologiesV2.OntologyInterfaces.search(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
47
|
+
augmentedProperties: {},
|
|
48
|
+
augmentedSharedPropertyTypes: {},
|
|
49
|
+
otherInterfaceTypes: [],
|
|
50
|
+
selectedObjectTypes: [],
|
|
51
|
+
selectedSharedPropertyTypes: args.$select ?? [],
|
|
52
|
+
where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName)
|
|
53
|
+
}), {
|
|
54
|
+
preview: true
|
|
55
|
+
});
|
|
56
|
+
result.data = await convertWireToOsdkObjects(client, result.data,
|
|
57
|
+
// drop readonly
|
|
58
|
+
interfaceType.apiName, !args.$includeRid);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
const result = await OntologiesV2.OntologyObjectSets.loadMultipleObjectTypes(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, applyFetchArgs(args, {
|
|
62
|
+
objectSet,
|
|
63
|
+
select: args?.$select ?? [],
|
|
64
|
+
excludeRid: !args?.$includeRid
|
|
65
|
+
}));
|
|
66
|
+
return Promise.resolve({
|
|
67
|
+
data: await convertWireToOsdkObjects2(client, result.data, interfaceType.apiName, !args.$includeRid, args.$select, false, result.interfaceToObjectTypeMappings),
|
|
68
|
+
nextPageToken: result.nextPageToken,
|
|
69
|
+
totalCount: result.totalCount
|
|
50
70
|
});
|
|
51
|
-
result.data = await convertWireToOsdkObjects(client, result.data,
|
|
52
|
-
// drop readonly
|
|
53
|
-
interfaceType.apiName, !args.$includeRid);
|
|
54
|
-
return result;
|
|
55
71
|
}
|
|
56
72
|
/** @internal */
|
|
57
73
|
export async function fetchPageInternal(client, objectType, objectSet, args = {}) {
|
|
@@ -87,17 +103,11 @@ export async function fetchPageWithErrorsInternal(client, objectType, objectSet,
|
|
|
87
103
|
* @returns
|
|
88
104
|
* @internal
|
|
89
105
|
*/
|
|
90
|
-
export async function fetchPage(client, objectType, args, objectSet = {
|
|
91
|
-
type: "base",
|
|
92
|
-
objectType: objectType["apiName"]
|
|
93
|
-
}) {
|
|
106
|
+
export async function fetchPage(client, objectType, args, objectSet = resolveBaseObjectSetType(objectType)) {
|
|
94
107
|
return fetchPageInternal(client, objectType, objectSet, args);
|
|
95
108
|
}
|
|
96
109
|
/** @internal */
|
|
97
|
-
export async function fetchPageWithErrors(client, objectType, args, objectSet = {
|
|
98
|
-
type: "base",
|
|
99
|
-
objectType: objectType["apiName"]
|
|
100
|
-
}) {
|
|
110
|
+
export async function fetchPageWithErrors(client, objectType, args, objectSet = resolveBaseObjectSetType(objectType)) {
|
|
101
111
|
return fetchPageWithErrorsInternal(client, objectType, objectSet, args);
|
|
102
112
|
}
|
|
103
113
|
function applyFetchArgs(args, body) {
|
|
@@ -127,7 +137,7 @@ export async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
|
127
137
|
excludeRid: !args?.$includeRid
|
|
128
138
|
}));
|
|
129
139
|
return Promise.resolve({
|
|
130
|
-
data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select
|
|
140
|
+
data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select),
|
|
131
141
|
nextPageToken: r.nextPageToken,
|
|
132
142
|
totalCount: r.totalCount
|
|
133
143
|
});
|