@osdk/client 0.2.1 → 0.3.1
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 +16 -0
- package/build/js/{chunk-MT2HE6AQ.mjs → chunk-DVD5PAXO.mjs} +119 -8
- package/build/js/chunk-DVD5PAXO.mjs.map +1 -0
- package/build/js/{chunk-CCKGGMYW.cjs → chunk-YVZITKIQ.cjs} +117 -6
- package/build/js/chunk-YVZITKIQ.cjs.map +1 -0
- package/build/js/index.cjs +15 -13
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +12 -10
- package/build/js/index.mjs.map +1 -1
- package/build/js/public/objects.cjs +3 -3
- package/build/js/public/objects.mjs +1 -1
- package/build/types/Client.d.ts +2 -2
- package/build/types/Definitions.d.ts +4 -4
- package/build/types/OsdkObjectFrom.d.ts +2 -0
- package/build/types/definitions/LinkDefinitions.d.ts +19 -0
- package/build/types/definitions/LinkDefinitions.test.d.ts +1 -0
- package/build/types/generated/object-set-service/api/ObjectSetServiceV2/getLinks.d.ts +1 -1
- package/build/types/generated/ontology-metadata/api/GetFeatureConfigurationsResponse.d.ts +1 -0
- package/build/types/generated/ontology-metadata/api/OntologyMetadataGothamTypeMappingService/checkTranslationEligibility.d.ts +8 -0
- package/build/types/generated/ontology-metadata/api/OntologyMetadataGothamTypeMappingService.d.ts +1 -0
- package/build/types/generated/ontology-metadata/api/TypeGroupGetOrganizationsRequest.d.ts +7 -0
- package/build/types/generated/ontology-metadata/api/TypeGroupGetOrganizationsResponse.d.ts +9 -0
- package/build/types/generated/ontology-metadata/api/TypeGroupOrgsService/getOrganizationsForTypeGroups.d.ts +9 -0
- package/build/types/generated/ontology-metadata/api/TypeGroupOrgsService/setOrganizationsForTypeGroups.d.ts +9 -0
- package/build/types/generated/ontology-metadata/api/TypeGroupOrgsService.d.ts +2 -0
- package/build/types/generated/ontology-metadata/api/TypeGroupSetOrganizationsRequest.d.ts +11 -0
- package/build/types/generated/ontology-metadata/api/index.d.ts +4 -0
- package/build/types/generated/ontology-metadata/api/search/ActionTypeClause.d.ts +5 -1
- package/build/types/generated/ontology-metadata/api/typemapping/CaseSensitiveGothamObjectTypeUri.d.ts +6 -0
- package/build/types/generated/ontology-metadata/api/typemapping/CaseSensitiveGothamPropertyTypeUri.d.ts +6 -0
- package/build/types/generated/ontology-metadata/api/typemapping/CheckTranslationEligibilityRequest.d.ts +8 -0
- package/build/types/generated/ontology-metadata/api/typemapping/CheckTranslationEligibilityResponse.d.ts +7 -0
- package/build/types/generated/ontology-metadata/api/typemapping/ClientTranslationEligibilityResult.d.ts +10 -0
- package/build/types/generated/ontology-metadata/api/typemapping/GothamDatasourceDelegateId.d.ts +5 -0
- package/build/types/generated/ontology-metadata/api/typemapping/IntegrationClientType.d.ts +4 -0
- package/build/types/generated/ontology-metadata/api/typemapping/LoadGothamTypeInstallationStatusesResponse.d.ts +4 -4
- package/build/types/generated/ontology-metadata/api/typemapping/TranslatableDatasource.d.ts +5 -0
- package/build/types/generated/ontology-metadata/api/typemapping/TranslationEligibility.d.ts +11 -0
- package/build/types/generated/ontology-metadata/api/typemapping/UntranslatableSecurity.d.ts +7 -0
- package/build/types/generated/ontology-metadata/api/typemapping/UntranslatableSecurityFailureType.d.ts +1 -0
- package/build/types/generated/ontology-metadata/api/typemapping/index.d.ts +11 -0
- package/build/types/generated/ontology-metadata/branch/api/BranchStatus.d.ts +11 -1
- package/build/types/generated/ontology-metadata/branch/api/LoadOntologyBranchMarkingsRequest.d.ts +2 -0
- package/build/types/generated/ontology-metadata/branch/api/LoadOntologyBranchMarkingsResponse.d.ts +4 -0
- package/build/types/generated/ontology-metadata/branch/api/MediaReferencePropertyTypeConstraintError.d.ts +9 -0
- package/build/types/generated/ontology-metadata/branch/api/MediaReferencePropertyTypeHasNoDatasourcesError.d.ts +9 -0
- package/build/types/generated/ontology-metadata/branch/api/OntologyBranchService/loadOntologyBranchMarkings.d.ts +9 -0
- package/build/types/generated/ontology-metadata/branch/api/OntologyBranchService/setOntologyBranchOrganizationMarkings.d.ts +2 -2
- package/build/types/generated/ontology-metadata/branch/api/OntologyBranchService.d.ts +1 -0
- package/build/types/generated/ontology-metadata/branch/api/ValidationError.d.ts +6 -1
- package/build/types/generated/ontology-metadata/branch/api/index.d.ts +4 -0
- package/build/types/generatedNoCheck/Ontology.d.ts +483 -0
- package/build/types/generatedNoCheck/OntologyMetadata.d.ts +5 -0
- package/build/types/generatedNoCheck/index.d.ts +1 -0
- package/build/types/generatedNoCheck/ontology/actions/actionTakesObjectSet.d.ts +15 -0
- package/build/types/generatedNoCheck/ontology/actions/createOffice.d.ts +35 -0
- package/build/types/generatedNoCheck/ontology/actions/createOfficeAndEmployee.d.ts +45 -0
- package/build/types/generatedNoCheck/ontology/actions/index.d.ts +6 -0
- package/build/types/generatedNoCheck/ontology/actions/moveOffice.d.ts +35 -0
- package/build/types/generatedNoCheck/ontology/actions/promoteEmployee.d.ts +27 -0
- package/build/types/generatedNoCheck/ontology/actions/promoteEmployeeObject.d.ts +30 -0
- package/build/types/generatedNoCheck/ontology/interfaces.d.ts +1 -0
- package/build/types/generatedNoCheck/ontology/objects/Employee.d.ts +49 -0
- package/build/types/generatedNoCheck/ontology/objects/ObjectWithTimestampPrimaryKey.d.ts +18 -0
- package/build/types/generatedNoCheck/ontology/objects/Office.d.ts +35 -0
- package/build/types/generatedNoCheck/ontology/objects/equipment.d.ts +18 -0
- package/build/types/generatedNoCheck/ontology/objects/objectTypeWithAllPropertyTypes.d.ts +158 -0
- package/build/types/generatedNoCheck/ontology/objects.d.ts +5 -0
- package/build/types/internal/conversions/legacyToModernSingleAggregationResult.d.ts +2 -2
- package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts +2 -2
- package/build/types/object/Attachment.d.ts +8 -0
- package/build/types/object/ObjectDefinitions.test.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects.d.ts +5 -3
- package/build/types/object/convertWireToOsdkObjects.test.d.ts +1 -0
- package/build/types/object/fetchPageOrThrow.d.ts +6 -4
- package/build/types/object/getLinkedObjectByPkOrThrow.d.ts +4 -0
- package/build/types/object/getLinkedObjectOrThrow.d.ts +4 -0
- package/build/types/object/object.test.d.ts +1 -0
- package/build/types/object/pageLinkedObjectsOrThrow.d.ts +9 -0
- package/build/types/objectSet/ObjectSet.d.ts +2 -5
- package/build/types/objectSet/ObjectSetListenerWebsocket.d.ts +2 -2
- package/build/types/objectSet/createObjectSet.d.ts +3 -3
- package/build/types/objectSet/toConjureObjectSet.d.ts +3 -3
- package/build/types/query/WhereClause.d.ts +2 -2
- package/build/types/util/test/mockOntology.d.ts +59 -0
- package/package.json +8 -3
- package/build/js/chunk-CCKGGMYW.cjs.map +0 -1
- package/build/js/chunk-MT2HE6AQ.mjs.map +0 -1
- package/build/types/internal/net/V2_BASE.d.ts +0 -1
- package/build/types/internal/net/index.d.ts +0 -1
- package/build/types/internal/net/types.d.ts +0 -357
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const Employee: {
|
|
2
|
+
apiName: "Employee";
|
|
3
|
+
description: string;
|
|
4
|
+
primaryKeyType: "integer";
|
|
5
|
+
links: {
|
|
6
|
+
peeps: {
|
|
7
|
+
multiplicity: true;
|
|
8
|
+
targetType: "Employee";
|
|
9
|
+
};
|
|
10
|
+
lead: {
|
|
11
|
+
multiplicity: false;
|
|
12
|
+
targetType: "Employee";
|
|
13
|
+
};
|
|
14
|
+
officeLink: {
|
|
15
|
+
multiplicity: false;
|
|
16
|
+
targetType: "Office";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
properties: {
|
|
20
|
+
employeeId: {
|
|
21
|
+
multiplicity: false;
|
|
22
|
+
type: "integer";
|
|
23
|
+
nullable: false;
|
|
24
|
+
};
|
|
25
|
+
fullName: {
|
|
26
|
+
multiplicity: false;
|
|
27
|
+
type: "string";
|
|
28
|
+
nullable: true;
|
|
29
|
+
};
|
|
30
|
+
office: {
|
|
31
|
+
multiplicity: false;
|
|
32
|
+
description: string;
|
|
33
|
+
type: "string";
|
|
34
|
+
nullable: true;
|
|
35
|
+
};
|
|
36
|
+
startDate: {
|
|
37
|
+
multiplicity: false;
|
|
38
|
+
description: string;
|
|
39
|
+
type: "datetime";
|
|
40
|
+
nullable: true;
|
|
41
|
+
};
|
|
42
|
+
employeeStatus: {
|
|
43
|
+
multiplicity: false;
|
|
44
|
+
description: string;
|
|
45
|
+
type: "stringTimeseries";
|
|
46
|
+
nullable: true;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const ObjectWithTimestampPrimaryKey: {
|
|
2
|
+
apiName: "ObjectWithTimestampPrimaryKey";
|
|
3
|
+
description: string;
|
|
4
|
+
primaryKeyType: "timestamp";
|
|
5
|
+
links: {};
|
|
6
|
+
properties: {
|
|
7
|
+
timestamp: {
|
|
8
|
+
multiplicity: false;
|
|
9
|
+
type: "timestamp";
|
|
10
|
+
nullable: false;
|
|
11
|
+
};
|
|
12
|
+
value: {
|
|
13
|
+
multiplicity: false;
|
|
14
|
+
type: "string";
|
|
15
|
+
nullable: true;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const Office: {
|
|
2
|
+
apiName: "Office";
|
|
3
|
+
description: string;
|
|
4
|
+
primaryKeyType: "string";
|
|
5
|
+
links: {
|
|
6
|
+
occupants: {
|
|
7
|
+
multiplicity: true;
|
|
8
|
+
targetType: "Employee";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
properties: {
|
|
12
|
+
officeId: {
|
|
13
|
+
multiplicity: false;
|
|
14
|
+
type: "string";
|
|
15
|
+
nullable: false;
|
|
16
|
+
};
|
|
17
|
+
entrance: {
|
|
18
|
+
multiplicity: false;
|
|
19
|
+
type: "geopoint";
|
|
20
|
+
nullable: true;
|
|
21
|
+
};
|
|
22
|
+
occupiedArea: {
|
|
23
|
+
multiplicity: false;
|
|
24
|
+
description: string;
|
|
25
|
+
type: "geoshape";
|
|
26
|
+
nullable: true;
|
|
27
|
+
};
|
|
28
|
+
name: {
|
|
29
|
+
multiplicity: false;
|
|
30
|
+
description: string;
|
|
31
|
+
type: "string";
|
|
32
|
+
nullable: true;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const equipment: {
|
|
2
|
+
apiName: "equipment";
|
|
3
|
+
primaryKeyType: "string";
|
|
4
|
+
links: {};
|
|
5
|
+
properties: {
|
|
6
|
+
equipmentId: {
|
|
7
|
+
multiplicity: false;
|
|
8
|
+
description: string;
|
|
9
|
+
type: "string";
|
|
10
|
+
nullable: false;
|
|
11
|
+
};
|
|
12
|
+
type: {
|
|
13
|
+
multiplicity: false;
|
|
14
|
+
type: "string";
|
|
15
|
+
nullable: true;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export declare const objectTypeWithAllPropertyTypes: {
|
|
2
|
+
apiName: "objectTypeWithAllPropertyTypes";
|
|
3
|
+
description: string;
|
|
4
|
+
primaryKeyType: "integer";
|
|
5
|
+
links: {};
|
|
6
|
+
properties: {
|
|
7
|
+
id: {
|
|
8
|
+
multiplicity: false;
|
|
9
|
+
type: "integer";
|
|
10
|
+
nullable: false;
|
|
11
|
+
};
|
|
12
|
+
string: {
|
|
13
|
+
multiplicity: false;
|
|
14
|
+
type: "string";
|
|
15
|
+
nullable: true;
|
|
16
|
+
};
|
|
17
|
+
boolean: {
|
|
18
|
+
multiplicity: false;
|
|
19
|
+
type: "boolean";
|
|
20
|
+
nullable: true;
|
|
21
|
+
};
|
|
22
|
+
date: {
|
|
23
|
+
multiplicity: false;
|
|
24
|
+
type: "datetime";
|
|
25
|
+
nullable: true;
|
|
26
|
+
};
|
|
27
|
+
dateTime: {
|
|
28
|
+
multiplicity: false;
|
|
29
|
+
type: "timestamp";
|
|
30
|
+
nullable: true;
|
|
31
|
+
};
|
|
32
|
+
decimal: {
|
|
33
|
+
multiplicity: false;
|
|
34
|
+
type: "decimal";
|
|
35
|
+
nullable: true;
|
|
36
|
+
};
|
|
37
|
+
integer: {
|
|
38
|
+
multiplicity: false;
|
|
39
|
+
type: "integer";
|
|
40
|
+
nullable: true;
|
|
41
|
+
};
|
|
42
|
+
long: {
|
|
43
|
+
multiplicity: false;
|
|
44
|
+
type: "long";
|
|
45
|
+
nullable: true;
|
|
46
|
+
};
|
|
47
|
+
short: {
|
|
48
|
+
multiplicity: false;
|
|
49
|
+
type: "short";
|
|
50
|
+
nullable: true;
|
|
51
|
+
};
|
|
52
|
+
float: {
|
|
53
|
+
multiplicity: false;
|
|
54
|
+
type: "float";
|
|
55
|
+
nullable: true;
|
|
56
|
+
};
|
|
57
|
+
double: {
|
|
58
|
+
multiplicity: false;
|
|
59
|
+
type: "double";
|
|
60
|
+
nullable: true;
|
|
61
|
+
};
|
|
62
|
+
byte: {
|
|
63
|
+
multiplicity: false;
|
|
64
|
+
type: "byte";
|
|
65
|
+
nullable: true;
|
|
66
|
+
};
|
|
67
|
+
attachment: {
|
|
68
|
+
multiplicity: false;
|
|
69
|
+
type: "attachment";
|
|
70
|
+
nullable: true;
|
|
71
|
+
};
|
|
72
|
+
attachment2: {
|
|
73
|
+
multiplicity: false;
|
|
74
|
+
type: "attachment";
|
|
75
|
+
nullable: true;
|
|
76
|
+
};
|
|
77
|
+
geoPoint: {
|
|
78
|
+
multiplicity: false;
|
|
79
|
+
type: "geopoint";
|
|
80
|
+
nullable: true;
|
|
81
|
+
};
|
|
82
|
+
geoShape: {
|
|
83
|
+
multiplicity: false;
|
|
84
|
+
type: "geoshape";
|
|
85
|
+
nullable: true;
|
|
86
|
+
};
|
|
87
|
+
stringArray: {
|
|
88
|
+
multiplicity: true;
|
|
89
|
+
type: "string";
|
|
90
|
+
nullable: true;
|
|
91
|
+
};
|
|
92
|
+
booleanArray: {
|
|
93
|
+
multiplicity: true;
|
|
94
|
+
type: "boolean";
|
|
95
|
+
nullable: true;
|
|
96
|
+
};
|
|
97
|
+
dateArray: {
|
|
98
|
+
multiplicity: true;
|
|
99
|
+
type: "datetime";
|
|
100
|
+
nullable: true;
|
|
101
|
+
};
|
|
102
|
+
dateTimeArray: {
|
|
103
|
+
multiplicity: true;
|
|
104
|
+
type: "timestamp";
|
|
105
|
+
nullable: true;
|
|
106
|
+
};
|
|
107
|
+
decimalArray: {
|
|
108
|
+
multiplicity: true;
|
|
109
|
+
type: "decimal";
|
|
110
|
+
nullable: true;
|
|
111
|
+
};
|
|
112
|
+
integerArray: {
|
|
113
|
+
multiplicity: true;
|
|
114
|
+
type: "integer";
|
|
115
|
+
nullable: true;
|
|
116
|
+
};
|
|
117
|
+
longArray: {
|
|
118
|
+
multiplicity: true;
|
|
119
|
+
type: "long";
|
|
120
|
+
nullable: true;
|
|
121
|
+
};
|
|
122
|
+
shortArray: {
|
|
123
|
+
multiplicity: true;
|
|
124
|
+
type: "short";
|
|
125
|
+
nullable: true;
|
|
126
|
+
};
|
|
127
|
+
floatArray: {
|
|
128
|
+
multiplicity: true;
|
|
129
|
+
type: "float";
|
|
130
|
+
nullable: true;
|
|
131
|
+
};
|
|
132
|
+
doubleArray: {
|
|
133
|
+
multiplicity: true;
|
|
134
|
+
type: "double";
|
|
135
|
+
nullable: true;
|
|
136
|
+
};
|
|
137
|
+
byteArray: {
|
|
138
|
+
multiplicity: true;
|
|
139
|
+
type: "byte";
|
|
140
|
+
nullable: true;
|
|
141
|
+
};
|
|
142
|
+
attachmentArray: {
|
|
143
|
+
multiplicity: true;
|
|
144
|
+
type: "attachment";
|
|
145
|
+
nullable: true;
|
|
146
|
+
};
|
|
147
|
+
geoPointArray: {
|
|
148
|
+
multiplicity: true;
|
|
149
|
+
type: "geopoint";
|
|
150
|
+
nullable: true;
|
|
151
|
+
};
|
|
152
|
+
geoShapeArray: {
|
|
153
|
+
multiplicity: true;
|
|
154
|
+
type: "geoshape";
|
|
155
|
+
nullable: true;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { AggregateObjectsResponseV2 } from "@osdk/gateway/types";
|
|
1
2
|
import type { AggregationClause, AggregationResultsWithoutGroups } from "../../query/index.js";
|
|
2
3
|
import type { ArrayElement } from "../../util/ArrayElement.js";
|
|
3
|
-
|
|
4
|
-
export declare function legacyToModernSingleAggregationResult<AC extends AggregationClause<any, any>>(entry: ArrayElement<Wire.AggregateObjectsResponseV2["data"]>): AggregationResultsWithoutGroups<any, any, AC>;
|
|
4
|
+
export declare function legacyToModernSingleAggregationResult<AC extends AggregationClause<any, any>>(entry: ArrayElement<AggregateObjectsResponseV2["data"]>): AggregationResultsWithoutGroups<any, any, AC>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceDefinition } from "@osdk/api";
|
|
2
|
+
import type { SearchJsonQueryV2 } from "@osdk/gateway/types";
|
|
2
3
|
import type { WhereClause } from "../../query/index.js";
|
|
3
|
-
|
|
4
|
-
export declare function modernToLegacyWhereClause<T extends ObjectOrInterfaceDefinition<any, any>>(whereClause: WhereClause<T>): Wire.SearchJsonQueryV2;
|
|
4
|
+
export declare function modernToLegacyWhereClause<T extends ObjectOrInterfaceDefinition<any, any>>(whereClause: WhereClause<T>): SearchJsonQueryV2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OntologyDefinition } from "@osdk/api";
|
|
2
2
|
import type { OntologyObjectV2 } from "@osdk/gateway/types";
|
|
3
3
|
import type { ClientContext } from "@osdk/shared.net";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @param objs the objects to be converted, the contents of this array will be mutated
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertWireToOsdkObjects<T_OntologyDefinition extends OntologyDefinition<any>>(client: ClientContext<T_OntologyDefinition>, objs: OntologyObjectV2[]): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceKeysFrom, ObjectOrInterfacePropertyKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import type { ObjectSet } from "@osdk/gateway/types";
|
|
2
3
|
import type { ClientContext } from "@osdk/shared.net";
|
|
3
|
-
import type { Wire } from "../internal/net/index.js";
|
|
4
4
|
import type { OsdkObjectFrom } from "../OsdkObjectFrom.js";
|
|
5
5
|
import type { PageResult } from "../PageResult.js";
|
|
6
|
-
|
|
7
|
-
export interface FetchPageOrThrowArgs<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>, L extends ObjectOrInterfacePropertyKeysFrom<O, K>> {
|
|
6
|
+
export interface SelectArg<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>, L = ObjectOrInterfacePropertyKeysFrom<O, K>> {
|
|
8
7
|
select?: readonly L[];
|
|
8
|
+
}
|
|
9
|
+
export interface FetchPageOrThrowArgs<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>, L = ObjectOrInterfacePropertyKeysFrom<O, K>> extends SelectArg<O, K, L> {
|
|
9
10
|
nextPageToken?: string;
|
|
11
|
+
pageSize?: number;
|
|
10
12
|
}
|
|
11
|
-
export declare function fetchPageOrThrow<O extends OntologyDefinition<any>, T extends ObjectOrInterfaceKeysFrom<O>, const A extends FetchPageOrThrowArgs<O, T
|
|
13
|
+
export declare function fetchPageOrThrow<O extends OntologyDefinition<any>, T extends ObjectOrInterfaceKeysFrom<O>, const A extends FetchPageOrThrowArgs<O, T>>(client: ClientContext<O>, objectType: T & string, args: A, objectSet?: ObjectSet): Promise<PageResult<OsdkObjectFrom<T, O, A["select"] extends readonly string[] ? A["select"][number] : ObjectOrInterfacePropertyKeysFrom<O, T>>>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjectOrInterfacePropertyKeysFrom, ObjectTypeKeysFrom, ObjectTypeLinkKeysFrom, ObjectTypeLinkTargetTypeFrom, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import type { ClientContext } from "@osdk/shared.net";
|
|
3
|
+
import type { OsdkObjectFrom } from "../OsdkObjectFrom.js";
|
|
4
|
+
export declare function getLinkedObjectByPkOrThrow<O extends OntologyDefinition<any>, T extends ObjectTypeKeysFrom<O> & string, L extends ObjectTypeLinkKeysFrom<O, T> & string, S = ReadonlyArray<ObjectOrInterfacePropertyKeysFrom<O, ObjectTypeLinkTargetTypeFrom<O, T, L>>>>(client: ClientContext<O>, sourceApiName: T, primaryKey: any, linkTypeApiName: L, linkedObjectPrimaryKey: any, select?: S): Promise<OsdkObjectFrom<T, O>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjectTypeKeysFrom, ObjectTypeLinkKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import { type ClientContext } from "@osdk/shared.net";
|
|
3
|
+
import type { SelectArg } from "./fetchPageOrThrow.js";
|
|
4
|
+
export declare function getLinkedObjectOrThrow<O extends OntologyDefinition<any>, T extends ObjectTypeKeysFrom<O> & string, L extends ObjectTypeLinkKeysFrom<O, T> & string, S extends SelectArg<O, T>["select"]>(client: ClientContext<O>, sourceApiName: T, primaryKey: any, linkTypeApiName: L, select?: S): Promise<import("../OsdkObjectFrom.js").OsdkObjectFrom<T, O, S extends readonly string[] ? S[number] : import("@osdk/api").ObjectOrInterfacePropertyKeysFrom<O, T>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ObjectOrInterfacePropertyKeysFrom, ObjectTypeKeysFrom, ObjectTypeLinkKeysFrom, ObjectTypeLinkTargetTypeFrom, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import { type ClientContext } from "@osdk/shared.net";
|
|
3
|
+
import type { OsdkObjectFrom } from "../OsdkObjectFrom.js";
|
|
4
|
+
import type { PageResult } from "../PageResult.js";
|
|
5
|
+
export declare function pageLinkedObjectsOrThrow<O extends OntologyDefinition<any>, T extends ObjectTypeKeysFrom<O>, L extends ObjectTypeLinkKeysFrom<O, T>, S = ReadonlyArray<ObjectOrInterfacePropertyKeysFrom<O, ObjectTypeLinkTargetTypeFrom<O, T, L>>>>(client: ClientContext<O>, sourceApiName: T & string, primaryKey: any, linkTypeApiName: string, options?: {
|
|
6
|
+
nextPageToken?: string;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
select?: S;
|
|
9
|
+
}): Promise<PageResult<OsdkObjectFrom<T, O, S extends readonly string[] ? S[number] : ObjectOrInterfacePropertyKeysFrom<O, T>>>>;
|
|
@@ -11,10 +11,7 @@ export interface BaseObjectSet<O extends OntologyDefinition<any>, K extends Obje
|
|
|
11
11
|
fetchPageOrThrow: <L extends ObjectOrInterfacePropertyKeysFrom<O, K>>(args?: FetchPageOrThrowArgs<O, K, L>) => Promise<PageResult<K extends InterfaceKeysFrom<O> ? OsdkInterfaceFrom<K, O, L> : OsdkObjectFrom<K, O, L>>>;
|
|
12
12
|
aggregateOrThrow: <const AO extends AggregateOpts<O, K, any>>(req: AO) => Promise<AggregationsResults<O, K, AO>>;
|
|
13
13
|
where: (clause: WhereClause<ObjectOrInterfaceDefinitionFrom<O, K>>) => ObjectSet<O, K>;
|
|
14
|
-
pivotTo: <T extends LinkTypesFrom<O, K>>(type: T & string
|
|
14
|
+
pivotTo: <T extends LinkTypesFrom<O, K>>(type: T & string) => ObjectSet<O, O["objects"][K]["links"][T]["targetType"]>;
|
|
15
15
|
subscribe: (listener: ObjectSetListener<O, K>) => () => void;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
18
|
-
$where?: WhereClause<ObjectOrInterfaceDefinitionFrom<O, K>>;
|
|
19
|
-
}
|
|
20
|
-
export type ObjectSetFactory<O extends OntologyDefinition<any>> = <K extends ObjectOrInterfaceKeysFrom<O>>(type: K & string, opts?: ObjectSetOptions<O, K>) => ObjectSet<O, K>;
|
|
17
|
+
export type ObjectSetFactory<O extends OntologyDefinition<any>> = <K extends ObjectOrInterfaceKeysFrom<O>>(type: K & string) => ObjectSet<O, K>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import type { ObjectSet } from "@osdk/gateway/types";
|
|
2
3
|
import { type ClientContext } from "@osdk/shared.net";
|
|
3
|
-
import type { Wire } from "../internal/net/index.js";
|
|
4
4
|
import type { ObjectSetListener } from "./ObjectSetListener.js";
|
|
5
5
|
export declare class ObjectSetListenerWebsocket<O extends OntologyDefinition<any, any, any>> {
|
|
6
6
|
#private;
|
|
7
7
|
static getInstance<O extends OntologyDefinition<any, any, any>>(client: ClientContext<O>): ObjectSetListenerWebsocket<O>;
|
|
8
8
|
private constructor();
|
|
9
|
-
subscribe<K extends ObjectOrInterfaceKeysFrom<O>>(objectSet:
|
|
9
|
+
subscribe<K extends ObjectOrInterfaceKeysFrom<O>>(objectSet: ObjectSet, listener: ObjectSetListener<O, K>): () => void;
|
|
10
10
|
}
|
|
11
11
|
export type ObjectPropertyMapping = {
|
|
12
12
|
apiName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import type { ObjectSet as WireObjectSet } from "@osdk/gateway/types";
|
|
2
3
|
import type { ClientContext } from "@osdk/shared.net";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
export declare function createObjectSet<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>>(objectType: K & string, clientCtx: ClientContext<O>, opts: ObjectSetOptions<O, K> | undefined, objectSet?: Wire.ObjectSet): ObjectSet<O, K>;
|
|
4
|
+
import type { ObjectSet } from "./ObjectSet.js";
|
|
5
|
+
export declare function createObjectSet<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>>(objectType: K & string, clientCtx: ClientContext<O>, objectSet?: WireObjectSet): ObjectSet<O, K>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ObjectTypeKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import type { ObjectSet } from "@osdk/gateway/types";
|
|
2
3
|
import type { ObjectSet as OssObjectSet } from "../generated/object-set-service/api/index.js";
|
|
3
|
-
import type { Wire } from "../internal/net/index.js";
|
|
4
4
|
import type { ObjectPropertyMapping } from "./ObjectSetListenerWebsocket.js";
|
|
5
|
-
export declare function toConjureObjectSet<O extends OntologyDefinition<any>, K extends ObjectTypeKeysFrom<O>>(objectSet:
|
|
6
|
-
export declare function getObjectSetBaseType(objectSet:
|
|
5
|
+
export declare function toConjureObjectSet<O extends OntologyDefinition<any>, K extends ObjectTypeKeysFrom<O>>(objectSet: ObjectSet, objectPropertyMapping: ObjectPropertyMapping): OssObjectSet;
|
|
6
|
+
export declare function getObjectSetBaseType(objectSet: ObjectSet): Promise<string>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceDefinition, ObjectTypePropertyDefinition } from "@osdk/api";
|
|
2
|
-
export type PossibleWhereClauseFilters = "gt" | "eq" | "ne" | "isNull" | "gte" | "lt" | "lte";
|
|
2
|
+
export type PossibleWhereClauseFilters = "gt" | "eq" | "ne" | "isNull" | "contains" | "gte" | "lt" | "lte";
|
|
3
3
|
type MakeFilter<K extends PossibleWhereClauseFilters, V> = K extends string ? Omit<{
|
|
4
4
|
[k in PossibleWhereClauseFilters]?: undefined;
|
|
5
5
|
}, K> & {
|
|
6
6
|
[k in K]: V;
|
|
7
7
|
} : never;
|
|
8
|
-
type BaseFilter<T> = T | MakeFilter<"eq" | "ne", T> | MakeFilter<"isNull", boolean>;
|
|
8
|
+
type BaseFilter<T> = T | MakeFilter<"eq" | "ne" | "contains", T> | MakeFilter<"isNull", boolean>;
|
|
9
9
|
type StringFilter = BaseFilter<string>;
|
|
10
10
|
type NumberFilter = BaseFilter<number> | MakeFilter<"gt" | "gte" | "lt" | "lte", number>;
|
|
11
11
|
type FilterFor<PD extends ObjectTypePropertyDefinition> = PD["type"] extends "string" ? StringFilter : NumberFilter;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const MockOntology: {
|
|
2
|
+
metadata: {
|
|
3
|
+
ontologyRid: string;
|
|
4
|
+
ontologyApiName: string;
|
|
5
|
+
userAgent: string;
|
|
6
|
+
};
|
|
7
|
+
objects: {
|
|
8
|
+
Task: {
|
|
9
|
+
apiName: "Task";
|
|
10
|
+
primaryKeyType: "integer";
|
|
11
|
+
properties: {
|
|
12
|
+
id: {
|
|
13
|
+
type: "integer";
|
|
14
|
+
};
|
|
15
|
+
name: {
|
|
16
|
+
type: "string";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
links: {
|
|
20
|
+
Todos: {
|
|
21
|
+
targetType: "Todo";
|
|
22
|
+
multiplicity: true;
|
|
23
|
+
};
|
|
24
|
+
RP: {
|
|
25
|
+
targetType: "Person";
|
|
26
|
+
multiplicity: false;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
Todo: {
|
|
31
|
+
apiName: "Todo";
|
|
32
|
+
primaryKeyType: "integer";
|
|
33
|
+
properties: {
|
|
34
|
+
id: {
|
|
35
|
+
type: "integer";
|
|
36
|
+
};
|
|
37
|
+
text: {
|
|
38
|
+
type: "string";
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
links: {};
|
|
42
|
+
};
|
|
43
|
+
Person: {
|
|
44
|
+
apiName: "Person";
|
|
45
|
+
primaryKeyType: "integer";
|
|
46
|
+
properties: {
|
|
47
|
+
id: {
|
|
48
|
+
type: "integer";
|
|
49
|
+
};
|
|
50
|
+
name: {
|
|
51
|
+
type: "string";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
links: {};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
actions: {};
|
|
58
|
+
queries: {};
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"conjure-lite": "^0.3.
|
|
20
|
+
"conjure-lite": "^0.3.3",
|
|
21
21
|
"fetch-retry": "^5.0.6",
|
|
22
22
|
"isomorphic-ws": "^5.0.0",
|
|
23
23
|
"tiny-invariant": "^1.3.1",
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/ws": "^8.5.10",
|
|
31
31
|
"ts-expect": "^1.3.0",
|
|
32
|
-
"typescript": "^5.2.2"
|
|
32
|
+
"typescript": "^5.2.2",
|
|
33
|
+
"@osdk/generator": "1.0.4",
|
|
34
|
+
"@osdk/shared.test": "1.0.4"
|
|
33
35
|
},
|
|
34
36
|
"publishConfig": {
|
|
35
37
|
"access": "public"
|
|
@@ -48,9 +50,12 @@
|
|
|
48
50
|
"type": "module",
|
|
49
51
|
"scripts": {
|
|
50
52
|
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
|
|
53
|
+
"codegen": "node ./generateMockOntology.js",
|
|
51
54
|
"dev:transpile": "tsup --watch",
|
|
52
55
|
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
|
|
53
56
|
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
|
|
57
|
+
"test": "vitest run --pool=forks",
|
|
58
|
+
"test:watch": "vitest",
|
|
54
59
|
"transpile": "tsup",
|
|
55
60
|
"transpileWatch": "tsup --watch",
|
|
56
61
|
"typecheck": "tsc-absolute --build"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/object/aggregateOrThrow.ts","../../src/internal/conversions/legacyToModernSingleAggregationResult.ts","../../src/internal/conversions/modernToLegacyAggregationClause.ts","../../src/internal/conversions/modernToLegacyGroupByClause.ts","../../src/internal/conversions/modernToLegacyWhereClause.ts","../../src/object/fetchPageOrThrow.ts","../../src/createCachedOntologyTransform.ts","../../src/object/convertWireToOsdkObjects.ts","../../src/object/index.ts"],"names":["invariant","createOpenApiRequest"],"mappings":";;;;;;;AAgBA,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,OAAOA,gBAAe;;;ACFtB,OAAO,eAAe;AACf,SAAS,sCAAsC,OAAO;AAC3D,SAAO,MAAM,QAAQ,OAAO,CAAC,aAAa,aAAa;AACrD,UAAM,QAAQ,SAAS,KAAK,MAAM,GAAG;AACrC,MAAE,MAAM,UAAU,KAAK,QAAQ,IAAI,aAAa,eAAe,UAAU,OAAO,4CAA4C,IAAI,UAAU,KAAK,IAAI;AACnJ,QAAI,EAAE,MAAM,CAAC,KAAK,cAAc;AAC9B,kBAAY,MAAM,CAAC,CAAC,IAAI,CAAC;AAAA,IAC3B;AACA,gBAAY,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,SAAS;AAC3C,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;;;ACXO,SAAS,gCAAgC,QAAQ;AACtD,SAAO,OAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM;AAChD,QAAI,MAAM,QAAQ,CAAC,GAAG;AACpB,aAAO,EAAE,IAAI,QAAM;AACjB,eAAO;AAAA,UACL,MAAM;AAAA,UACN,MAAM,GAAG,CAAC,IAAI,EAAE;AAAA,UAChB,OAAO;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,aAAO,CAAC;AAAA,QACN,MAAM;AAAA;AAAA,QAEN,MAAM,GAAG,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A,WAAO;AAAA,EACT;AACF;;;ACjBA,IAAM,eAAe,8BAA8B,eAAe;AAClE,SAAS,gBAAgB,UAAU,MAAM;AACvC,QAAM,SAAS,SAAS,QAAQ,IAAI;AACpC,QAAM,QAAQ,CAAC;AAIf,SAAO,eAAe,OAAO,UAAU;AAAA,IACrC,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,UAAU;AAAA,EACZ,CAAC;AACD,SAAO;AACT;AACO,SAAS,yBAAyB,QAAQ,SAAS,MAAM;AAC9D,QAAM,QAAQ,aAAa,OAAO,UAAU,OAAO;AACnD,aAAW,OAAO,MAAM;AACtB,WAAO,eAAe,KAAK,KAAK;AAAA,EA8BlC;AAEA,SAAO;AACT;;;AFjDA,eAAsB,iBAAiB,QAAQ,YAAY,MAAM,YAAY;AAAA,EAC3E,MAAM;AAAA,EACN;AACF,GAAG;AACD,QAAM,OAAO;AAAA,IACX;AAAA;AAAA,IAEA,QAAQ,MAAM,UAAU,CAAC;AAAA;AAAA,EAC3B;AAEA,MAAI,MAAM,eAAe;AACvB,SAAK,YAAY,KAAK;AAAA,EACxB;AACA,QAAM,IAAI,MAAM,gBAAgBA,sBAAqB,OAAO,OAAO,OAAO,KAAK,GAAG,OAAO,SAAS,SAAS,iBAAiB,IAAI;AAChI,2BAAyB,QAAQ,YAAY,EAAE,IAAI;AAInD,SAAO;AACT;;;AGtCA;AAAA;AAAA;AAAA;AAAA","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 { aggregateObjectsV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult, modernToLegacyAggregationClause, modernToLegacyGroupByClause, modernToLegacyWhereClause } from \"../internal/conversions/index.js\";\nexport async function aggregateOrThrow(clientCtx, objectType, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.select),\n groupBy: [],\n where: undefined\n };\n if (req.groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.groupBy);\n }\n if (req.where) {\n body.where = modernToLegacyWhereClause(req.where);\n // TODO: orderBy\n // TODO The token stuff here sucks\n }\n\n const result = await aggregateObjectsV2(createOpenApiRequest(clientCtx.stack, clientCtx.fetch), clientCtx.ontology.metadata.ontologyApiName, objectType, body);\n if (!req.groupBy) {\n !(result.data.length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"no group by clause should mean only one data result\") : invariant(false) : void 0;\n return legacyToModernSingleAggregationResult(result.data[0]);\n }\n const ret = result.data.map(entry => {\n return {\n group: entry.group,\n values: legacyToModernSingleAggregationResult(entry)\n };\n }); // fixme\n\n return ret; // FIXME\n}","/*\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 invariant from \"tiny-invariant\";\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n !(parts.length == 2) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"assumed we were getting a `${key}.${type}`\") : invariant(false) : void 0;\n if (!(parts[0] in accumulator)) {\n accumulator[parts[0]] = {};\n }\n accumulator[parts[0]][parts[1]] = curValue.value;\n return accumulator;\n }, {});\n}","/*\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\nexport function modernToLegacyAggregationClause(select) {\n return Object.entries(select).flatMap(([k, v]) => {\n if (Array.isArray(v)) {\n return v.map(v2 => {\n return {\n type: v2,\n name: `${k}.${v2}`,\n field: k\n };\n });\n } else {\n return [{\n type: v,\n // FIXME v has additional possible values\n name: `${k}.${v}`,\n field: k\n }];\n }\n });\n}","/*\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\nexport function modernToLegacyGroupByClause(groupByClause) {\n if (!groupByClause) return [];\n return Object.entries(groupByClause).flatMap(([field, type]) => {\n if (type === \"exact\") {\n return [{\n type,\n field\n }];\n } else if (type.exactWithLimit) {\n return [{\n type: \"exact\",\n field,\n maxGroupCount: type.exactWithLimit\n }];\n } else {\n return [];\n }\n });\n}","/*\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 invariant from \"tiny-invariant\";\nexport function modernToLegacyWhereClause(whereClause) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map(modernToLegacyWhereClause)\n };\n } else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map(modernToLegacyWhereClause)\n };\n } else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not)\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n const [field, filter] = parts[0];\n !(filter != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Defined key values are only allowed when they are not undefined.\") : invariant(false) : void 0;\n if (typeof filter === \"string\" || typeof filter === \"number\") {\n return {\n type: \"eq\",\n field,\n value: filter\n };\n }\n !(Object.keys(filter).length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"WhereClause Filter with multiple properties isn't allowed\") : invariant(false) : void 0;\n const type = Object.keys(filter)[0];\n !(filter[type] != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n if (type === \"ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[type]\n }\n };\n }\n return {\n type,\n field,\n value: filter[type]\n };\n }\n return {\n type: \"and\",\n value: Object.entries(whereClause).map(([field, filter]) => {\n !(filter != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Defined key values are only allowed when they are not undefined.\") : invariant(false) : void 0;\n if (typeof filter === \"string\" || typeof filter === \"number\") {\n return {\n type: \"eq\",\n field,\n value: filter\n };\n }\n !(Object.keys(filter).length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"WhereClause Filter with multiple properties isn't allowed\") : invariant(false) : void 0;\n const q = Object.keys(filter)[0];\n !(filter[q] != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n if (q === \"ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[q]\n }\n };\n }\n return {\n type: q,\n field,\n value: filter[q]\n };\n })\n };\n}","/*\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 { loadObjectSetV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\nexport async function fetchPageOrThrow(client, objectType, args, objectSet = {\n type: \"base\",\n objectType\n}) {\n const body = {\n objectSet,\n // We have to do the following case because LoadObjectSetRequestV2 isnt readonly\n select: args?.select ?? [] // FIXME?\n };\n\n if (args?.nextPageToken) {\n body.pageToken = args.nextPageToken;\n }\n const r = await loadObjectSetV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, body);\n convertWireToOsdkObjects(client, objectType, r.data);\n\n // any is okay here because we have properly converted the wire objects via prototypes\n // which don't type out correctly.\n return r;\n}","/*\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\n/**\n * Creates a getter function that caches based on the ontology.objects[type] value\n *\n * Any extra arguments are passed through, but only the first args passed in will be used and are not considered as part of the caching\n */\nexport function createCachedOntologyTransform(creator) {\n // We can use the ObjectTypeDefinition as the key because it will be a globally unique singleton\n // Use Map instead of WeakMap here so usage for things like object prototypes do not churn over time\n const cache = new Map();\n return (ontology, type) => {\n const objectDefinition = ontology.objects[type];\n let result = cache.get(objectDefinition);\n if (result == null) {\n result = creator(ontology, type);\n cache.set(objectDefinition, result);\n }\n return result;\n };\n}","/*\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 { createCachedOntologyTransform } from \"../createCachedOntologyTransform.js\";\nconst getPrototype = createCachedOntologyTransform(createPrototype);\nfunction createPrototype(ontology, type) {\n const objDef = ontology.objects[type];\n const proto = {};\n\n // Earlier versions of \"2.0\" included this by hand (even though it seems the wire gives it to us anyway).\n // Its deprecated but I'm it for now (lets delete after Dec 31, 2023) so our beta users can transition.\n Object.defineProperty(proto, \"__name\", {\n value: type,\n enumerable: false,\n configurable: false,\n writable: false\n });\n return proto;\n}\nexport function convertWireToOsdkObjects(client, apiName, objs) {\n const proto = getPrototype(client.ontology, apiName);\n for (const obj of objs) {\n Object.setPrototypeOf(obj, proto);\n\n // Saving this code in case we want to come back to temporal. For now its not worth the\n // risk and we can stick to string until we know what we want.\n // ====================================================================================================\n // FIXME\n // Im not going for performance for now, just something usable by beta users\n // Also not married to the $raw\n // obj[\"$raw\"] = {};\n\n // for (\n // const [key, def] of Object.entries(\n // client.ontology.objects[apiName].properties,\n // )\n // ) {\n // if (!(key in obj)) continue;\n // obj[\"$raw\"][key] = obj[key];\n\n // if (def.type === \"timestamp\") {\n // const value = obj[key] as string | undefined;\n // if (value !== undefined) {\n // obj[key] = Temporal.Instant.from(value);\n // }\n // } else if (def.type === \"datetime\") {\n // const value = obj[key] as string | undefined;\n // if (value !== undefined) {\n // obj[key] = Temporal.PlainDateTime.from(value);\n // }\n // }\n // }\n }\n\n return objs;\n}","/*\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\nexport { aggregateOrThrow } from \"./aggregateOrThrow.js\";\nexport { fetchPageOrThrow } from \"./fetchPageOrThrow.js\";"]}
|