@osdk/client 2.3.0-beta.4 → 2.3.0-beta.6
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 +26 -0
- package/build/browser/createClient.js +8 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/logger/BaseLogger.js +1 -1
- package/build/browser/logger/BaseLogger.js.map +1 -1
- package/build/browser/observable/ObservableClient.js +17 -1
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/OptimisticBuilder.js.map +1 -1
- package/build/browser/observable/internal/ActionApplication.js +31 -30
- package/build/browser/observable/internal/ActionApplication.js.map +1 -1
- package/build/browser/observable/internal/Changes.js +5 -1
- package/build/browser/observable/internal/Changes.js.map +1 -1
- package/build/browser/observable/internal/ListQuery.js +24 -22
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/ObjectQuery.js +30 -1
- package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +1 -2
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/OptimisticJob.js +8 -0
- package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/Query.js +2 -2
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/Store.js +4 -0
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +45 -5
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/observable/internal/tombstone.js +18 -0
- package/build/browser/observable/internal/tombstone.js.map +1 -0
- package/build/browser/util/UserAgent.js +2 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/toDataValue.js +1 -1
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/cjs/chunk-DHPFI5ZJ.cjs +1793 -0
- package/build/cjs/chunk-DHPFI5ZJ.cjs.map +1 -0
- package/build/cjs/{chunk-MZ4JZQUU.cjs → chunk-N4KFUVWG.cjs} +642 -42
- package/build/cjs/chunk-N4KFUVWG.cjs.map +1 -0
- package/build/cjs/index.cjs +16 -1769
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/internal.cjs +7 -8
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +182 -123
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +2 -1
- package/build/esm/createClient.js +8 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/logger/BaseLogger.js +1 -1
- package/build/esm/logger/BaseLogger.js.map +1 -1
- package/build/esm/observable/ObservableClient.js +17 -1
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/OptimisticBuilder.js.map +1 -1
- package/build/esm/observable/internal/ActionApplication.js +31 -30
- package/build/esm/observable/internal/ActionApplication.js.map +1 -1
- package/build/esm/observable/internal/Changes.js +5 -1
- package/build/esm/observable/internal/Changes.js.map +1 -1
- package/build/esm/observable/internal/ListQuery.js +24 -22
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/ObjectQuery.js +30 -1
- package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +1 -2
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/OptimisticJob.js +8 -0
- package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/Query.js +2 -2
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/Store.js +4 -0
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +45 -5
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/observable/internal/tombstone.js +18 -0
- package/build/esm/observable/internal/tombstone.js.map +1 -0
- package/build/esm/util/UserAgent.js +2 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/toDataValue.js +1 -1
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/observable/ObservableClient.d.ts +2 -2
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/OptimisticBuilder.d.ts +1 -0
- package/build/types/observable/OptimisticBuilder.d.ts.map +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
- package/build/types/observable/internal/Changes.d.ts +2 -0
- package/build/types/observable/internal/Changes.d.ts.map +1 -1
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/ObjectQuery.d.ts +1 -0
- package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts +2 -1
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +1 -1
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/observable/internal/tombstone.d.ts +1 -0
- package/build/types/observable/internal/tombstone.d.ts.map +1 -0
- package/build/types/util/UserAgent.d.ts +1 -0
- package/build/types/util/UserAgent.d.ts.map +1 -1
- package/package.json +8 -8
- package/build/cjs/chunk-C5D7744G.cjs +0 -615
- package/build/cjs/chunk-C5D7744G.cjs.map +0 -1
- package/build/cjs/chunk-MZ4JZQUU.cjs.map +0 -1
- package/build/cjs/chunk-T4NIFYZS.cjs +0 -14
- package/build/cjs/chunk-T4NIFYZS.cjs.map +0 -1
|
@@ -1,28 +1,612 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkC5D7744G_cjs = require('./chunk-C5D7744G.cjs');
|
|
4
3
|
var shared_net_errors = require('@osdk/shared.net.errors');
|
|
5
|
-
var
|
|
4
|
+
var shared_net_fetch = require('@osdk/shared.net.fetch');
|
|
5
|
+
var invariant4 = require('tiny-invariant');
|
|
6
6
|
var api = require('@osdk/api');
|
|
7
7
|
var WebSocket = require('isomorphic-ws');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var invariant4__default = /*#__PURE__*/_interopDefault(invariant4);
|
|
12
12
|
var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
|
|
13
13
|
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __export = (target, all) => {
|
|
16
|
+
for (var name in all)
|
|
17
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
21
|
+
var Action_exports = {};
|
|
22
|
+
__export(Action_exports, {
|
|
23
|
+
apply: () => apply,
|
|
24
|
+
applyAsync: () => applyAsync,
|
|
25
|
+
applyBatch: () => applyBatch
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// ../../node_modules/.pnpm/@osdk+shared.client@1.0.1/node_modules/@osdk/shared.client/index.js
|
|
29
|
+
var symbolClientContext = Symbol("ClientContext");
|
|
30
|
+
|
|
31
|
+
// ../../node_modules/.pnpm/@osdk+shared.client2@1.0.0/node_modules/@osdk/shared.client2/index.js
|
|
32
|
+
var symbolClientContext2 = "__osdkClientContext";
|
|
33
|
+
async function foundryPlatformFetch(client, [httpMethodNum, origPath, flags, contentType, responseContentType], ...args) {
|
|
34
|
+
const path = origPath.replace(/\{([^}]+)\}/g, () => encodeURIComponent(args.shift()));
|
|
35
|
+
const body = flags & 1 ? args.shift() : void 0;
|
|
36
|
+
const queryArgs = flags & 2 ? args.shift() : void 0;
|
|
37
|
+
const headerArgs = flags & 4 ? args.shift() : void 0;
|
|
38
|
+
const method = ["GET", "POST", "PUT", "DELETE", "PATCH"][httpMethodNum];
|
|
39
|
+
return await apiFetch(client[symbolClientContext2] ?? client[symbolClientContext] ?? client, method, path, body, queryArgs, headerArgs, contentType, responseContentType);
|
|
40
|
+
}
|
|
41
|
+
async function apiFetch(clientCtx, method, endpointPath, data, queryArguments, headers, requestMediaType, responseMediaType) {
|
|
42
|
+
const url = parseUrl(clientCtx.baseUrl, endpointPath);
|
|
43
|
+
for (const [key, value] of Object.entries(queryArguments || {})) {
|
|
44
|
+
if (value == null) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
for (const item of value) {
|
|
49
|
+
url.searchParams.append(key, item);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
url.searchParams.append(key, value);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const headersInit = new Headers();
|
|
56
|
+
headersInit.set("Content-Type", requestMediaType ?? "application/json");
|
|
57
|
+
headersInit.set("Accept", responseMediaType ?? "application/json");
|
|
58
|
+
Object.entries(headers || {}).forEach(([key, value]) => {
|
|
59
|
+
if (value != null) {
|
|
60
|
+
headersInit.append(key, value.toString());
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const body = data == null || data instanceof globalThis.Blob ? data : JSON.stringify(data);
|
|
64
|
+
const response = await clientCtx.fetch(url.toString(), {
|
|
65
|
+
body,
|
|
66
|
+
method,
|
|
67
|
+
headers: headersInit
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
try {
|
|
71
|
+
const convertedError = await response.json();
|
|
72
|
+
return new shared_net_errors.PalantirApiError(convertedError.message, convertedError.errorName, convertedError.errorCode, response.status, convertedError.errorInstanceId, convertedError.parameters);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
if (e instanceof Error) {
|
|
75
|
+
return new shared_net_errors.UnknownError(e.message, "UNKNOWN");
|
|
76
|
+
}
|
|
77
|
+
return new shared_net_errors.UnknownError("Unable to parse error response", "UNKNOWN");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (response.status === 204) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (responseMediaType == null || responseMediaType === "application/json") {
|
|
84
|
+
return await response.json();
|
|
85
|
+
}
|
|
86
|
+
return response;
|
|
87
|
+
}
|
|
88
|
+
function parseUrl(baseUrl, endpointPath) {
|
|
89
|
+
baseUrl += baseUrl.endsWith("/") ? "" : "/";
|
|
90
|
+
return new URL(`api${endpointPath}`, baseUrl);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
94
|
+
var _apply = [1, "/v2/ontologies/{0}/actions/{1}/apply", 3];
|
|
95
|
+
function apply($ctx, ...args) {
|
|
96
|
+
return foundryPlatformFetch($ctx, _apply, ...args);
|
|
97
|
+
}
|
|
98
|
+
var _applyAsync = [1, "/v2/ontologies/{0}/actions/{1}/applyAsync", 3];
|
|
99
|
+
function applyAsync($ctx, ...args) {
|
|
100
|
+
return foundryPlatformFetch($ctx, _applyAsync, ...args);
|
|
101
|
+
}
|
|
102
|
+
var _applyBatch = [1, "/v2/ontologies/{0}/actions/{1}/applyBatch", 3];
|
|
103
|
+
function applyBatch($ctx, ...args) {
|
|
104
|
+
return foundryPlatformFetch($ctx, _applyBatch, ...args);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ActionTypeV2.js
|
|
108
|
+
var ActionTypeV2_exports = {};
|
|
109
|
+
__export(ActionTypeV2_exports, {
|
|
110
|
+
get: () => get,
|
|
111
|
+
getByRid: () => getByRid,
|
|
112
|
+
list: () => list
|
|
113
|
+
});
|
|
114
|
+
var _list = [0, "/v2/ontologies/{0}/actionTypes", 2];
|
|
115
|
+
function list($ctx, ...args) {
|
|
116
|
+
return foundryPlatformFetch($ctx, _list, ...args);
|
|
117
|
+
}
|
|
118
|
+
var _get = [0, "/v2/ontologies/{0}/actionTypes/{1}"];
|
|
119
|
+
function get($ctx, ...args) {
|
|
120
|
+
return foundryPlatformFetch($ctx, _get, ...args);
|
|
121
|
+
}
|
|
122
|
+
var _getByRid = [0, "/v2/ontologies/{0}/actionTypes/byRid/{1}"];
|
|
123
|
+
function getByRid($ctx, ...args) {
|
|
124
|
+
return foundryPlatformFetch($ctx, _getByRid, ...args);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Attachment.js
|
|
128
|
+
var Attachment_exports = {};
|
|
129
|
+
__export(Attachment_exports, {
|
|
130
|
+
get: () => get2,
|
|
131
|
+
read: () => read,
|
|
132
|
+
upload: () => upload
|
|
133
|
+
});
|
|
134
|
+
var _upload = [1, "/v2/ontologies/attachments/upload", 7, "*/*"];
|
|
135
|
+
function upload($ctx, ...args) {
|
|
136
|
+
const headerParams = {
|
|
137
|
+
...args[2],
|
|
138
|
+
"Content-Type": args[2]?.["Content-Type"] ?? args[0].type,
|
|
139
|
+
"Content-Length": args[0].size.toString()
|
|
140
|
+
};
|
|
141
|
+
return foundryPlatformFetch($ctx, _upload, args[0], args[1], headerParams);
|
|
142
|
+
}
|
|
143
|
+
var _read = [0, "/v2/ontologies/attachments/{0}/content", , , "*/*"];
|
|
144
|
+
function read($ctx, ...args) {
|
|
145
|
+
return foundryPlatformFetch($ctx, _read, ...args);
|
|
146
|
+
}
|
|
147
|
+
var _get2 = [0, "/v2/ontologies/attachments/{0}"];
|
|
148
|
+
function get2($ctx, ...args) {
|
|
149
|
+
return foundryPlatformFetch($ctx, _get2, ...args);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/MediaReferenceProperty.js
|
|
153
|
+
var MediaReferenceProperty_exports = {};
|
|
154
|
+
__export(MediaReferenceProperty_exports, {
|
|
155
|
+
getMediaContent: () => getMediaContent,
|
|
156
|
+
getMediaMetadata: () => getMediaMetadata,
|
|
157
|
+
upload: () => upload2
|
|
158
|
+
});
|
|
159
|
+
var _getMediaContent = [0, "/v2/ontologies/{0}/objects/{1}/{2}/media/{3}/content", 2, , "*/*"];
|
|
160
|
+
function getMediaContent($ctx, ...args) {
|
|
161
|
+
return foundryPlatformFetch($ctx, _getMediaContent, ...args);
|
|
162
|
+
}
|
|
163
|
+
var _getMediaMetadata = [0, "/v2/ontologies/{0}/objects/{1}/{2}/media/{3}/metadata", 2];
|
|
164
|
+
function getMediaMetadata($ctx, ...args) {
|
|
165
|
+
return foundryPlatformFetch($ctx, _getMediaMetadata, ...args);
|
|
166
|
+
}
|
|
167
|
+
var _upload2 = [1, "/v2/ontologies/{0}/objectTypes/{1}/media/{2}/upload", 3, "*/*"];
|
|
168
|
+
function upload2($ctx, ...args) {
|
|
169
|
+
return foundryPlatformFetch($ctx, _upload2, ...args);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ObjectTypeV2.js
|
|
173
|
+
var ObjectTypeV2_exports = {};
|
|
174
|
+
__export(ObjectTypeV2_exports, {
|
|
175
|
+
get: () => get3,
|
|
176
|
+
getFullMetadata: () => getFullMetadata,
|
|
177
|
+
getOutgoingLinkType: () => getOutgoingLinkType,
|
|
178
|
+
list: () => list2,
|
|
179
|
+
listOutgoingLinkTypes: () => listOutgoingLinkTypes
|
|
180
|
+
});
|
|
181
|
+
var _list2 = [0, "/v2/ontologies/{0}/objectTypes", 2];
|
|
182
|
+
function list2($ctx, ...args) {
|
|
183
|
+
return foundryPlatformFetch($ctx, _list2, ...args);
|
|
184
|
+
}
|
|
185
|
+
var _get3 = [0, "/v2/ontologies/{0}/objectTypes/{1}"];
|
|
186
|
+
function get3($ctx, ...args) {
|
|
187
|
+
return foundryPlatformFetch($ctx, _get3, ...args);
|
|
188
|
+
}
|
|
189
|
+
var _getFullMetadata = [0, "/v2/ontologies/{0}/objectTypes/{1}/fullMetadata", 2];
|
|
190
|
+
function getFullMetadata($ctx, ...args) {
|
|
191
|
+
return foundryPlatformFetch($ctx, _getFullMetadata, ...args);
|
|
192
|
+
}
|
|
193
|
+
var _listOutgoingLinkTypes = [0, "/v2/ontologies/{0}/objectTypes/{1}/outgoingLinkTypes", 2];
|
|
194
|
+
function listOutgoingLinkTypes($ctx, ...args) {
|
|
195
|
+
return foundryPlatformFetch($ctx, _listOutgoingLinkTypes, ...args);
|
|
196
|
+
}
|
|
197
|
+
var _getOutgoingLinkType = [0, "/v2/ontologies/{0}/objectTypes/{1}/outgoingLinkTypes/{2}"];
|
|
198
|
+
function getOutgoingLinkType($ctx, ...args) {
|
|
199
|
+
return foundryPlatformFetch($ctx, _getOutgoingLinkType, ...args);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyInterface.js
|
|
203
|
+
var OntologyInterface_exports = {};
|
|
204
|
+
__export(OntologyInterface_exports, {
|
|
205
|
+
aggregate: () => aggregate,
|
|
206
|
+
get: () => get4,
|
|
207
|
+
list: () => list3,
|
|
208
|
+
search: () => search
|
|
209
|
+
});
|
|
210
|
+
var _list3 = [0, "/v2/ontologies/{0}/interfaceTypes", 2];
|
|
211
|
+
function list3($ctx, ...args) {
|
|
212
|
+
return foundryPlatformFetch($ctx, _list3, ...args);
|
|
213
|
+
}
|
|
214
|
+
var _get4 = [0, "/v2/ontologies/{0}/interfaceTypes/{1}", 2];
|
|
215
|
+
function get4($ctx, ...args) {
|
|
216
|
+
return foundryPlatformFetch($ctx, _get4, ...args);
|
|
217
|
+
}
|
|
218
|
+
var _search = [1, "/v2/ontologies/{0}/interfaces/{1}/search", 3];
|
|
219
|
+
function search($ctx, ...args) {
|
|
220
|
+
return foundryPlatformFetch($ctx, _search, ...args);
|
|
221
|
+
}
|
|
222
|
+
var _aggregate = [1, "/v2/ontologies/{0}/interfaces/{1}/aggregate", 3];
|
|
223
|
+
function aggregate($ctx, ...args) {
|
|
224
|
+
return foundryPlatformFetch($ctx, _aggregate, ...args);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectSet.js
|
|
228
|
+
var OntologyObjectSet_exports = {};
|
|
229
|
+
__export(OntologyObjectSet_exports, {
|
|
230
|
+
aggregate: () => aggregate2,
|
|
231
|
+
createTemporary: () => createTemporary,
|
|
232
|
+
get: () => get5,
|
|
233
|
+
load: () => load,
|
|
234
|
+
loadMultipleObjectTypes: () => loadMultipleObjectTypes,
|
|
235
|
+
loadObjectsOrInterfaces: () => loadObjectsOrInterfaces
|
|
236
|
+
});
|
|
237
|
+
var _createTemporary = [1, "/v2/ontologies/{0}/objectSets/createTemporary", 1];
|
|
238
|
+
function createTemporary($ctx, ...args) {
|
|
239
|
+
return foundryPlatformFetch($ctx, _createTemporary, ...args);
|
|
240
|
+
}
|
|
241
|
+
var _get5 = [0, "/v2/ontologies/{0}/objectSets/{1}"];
|
|
242
|
+
function get5($ctx, ...args) {
|
|
243
|
+
return foundryPlatformFetch($ctx, _get5, ...args);
|
|
244
|
+
}
|
|
245
|
+
var _load = [1, "/v2/ontologies/{0}/objectSets/loadObjects", 3];
|
|
246
|
+
function load($ctx, ...args) {
|
|
247
|
+
return foundryPlatformFetch($ctx, _load, ...args);
|
|
248
|
+
}
|
|
249
|
+
var _loadMultipleObjectTypes = [1, "/v2/ontologies/{0}/objectSets/loadObjectsMultipleObjectTypes", 3];
|
|
250
|
+
function loadMultipleObjectTypes($ctx, ...args) {
|
|
251
|
+
return foundryPlatformFetch($ctx, _loadMultipleObjectTypes, ...args);
|
|
252
|
+
}
|
|
253
|
+
var _loadObjectsOrInterfaces = [1, "/v2/ontologies/{0}/objectSets/loadObjectsOrInterfaces", 3];
|
|
254
|
+
function loadObjectsOrInterfaces($ctx, ...args) {
|
|
255
|
+
return foundryPlatformFetch($ctx, _loadObjectsOrInterfaces, ...args);
|
|
256
|
+
}
|
|
257
|
+
var _aggregate2 = [1, "/v2/ontologies/{0}/objectSets/aggregate", 3];
|
|
258
|
+
function aggregate2($ctx, ...args) {
|
|
259
|
+
return foundryPlatformFetch($ctx, _aggregate2, ...args);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Query.js
|
|
263
|
+
var Query_exports = {};
|
|
264
|
+
__export(Query_exports, {
|
|
265
|
+
execute: () => execute
|
|
266
|
+
});
|
|
267
|
+
var _execute = [1, "/v2/ontologies/{0}/queries/{1}/execute", 3];
|
|
268
|
+
function execute($ctx, ...args) {
|
|
269
|
+
return foundryPlatformFetch($ctx, _execute, ...args);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/QueryType.js
|
|
273
|
+
var QueryType_exports = {};
|
|
274
|
+
__export(QueryType_exports, {
|
|
275
|
+
get: () => get6,
|
|
276
|
+
list: () => list4
|
|
277
|
+
});
|
|
278
|
+
var _list4 = [0, "/v2/ontologies/{0}/queryTypes", 2];
|
|
279
|
+
function list4($ctx, ...args) {
|
|
280
|
+
return foundryPlatformFetch($ctx, _list4, ...args);
|
|
281
|
+
}
|
|
282
|
+
var _get6 = [0, "/v2/ontologies/{0}/queryTypes/{1}", 2];
|
|
283
|
+
function get6($ctx, ...args) {
|
|
284
|
+
return foundryPlatformFetch($ctx, _get6, ...args);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesPropertyV2.js
|
|
288
|
+
var TimeSeriesPropertyV2_exports = {};
|
|
289
|
+
__export(TimeSeriesPropertyV2_exports, {
|
|
290
|
+
getFirstPoint: () => getFirstPoint,
|
|
291
|
+
getLastPoint: () => getLastPoint,
|
|
292
|
+
streamPoints: () => streamPoints
|
|
293
|
+
});
|
|
294
|
+
var _getFirstPoint = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/firstPoint", 2];
|
|
295
|
+
function getFirstPoint($ctx, ...args) {
|
|
296
|
+
return foundryPlatformFetch($ctx, _getFirstPoint, ...args);
|
|
297
|
+
}
|
|
298
|
+
var _getLastPoint = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/lastPoint", 2];
|
|
299
|
+
function getLastPoint($ctx, ...args) {
|
|
300
|
+
return foundryPlatformFetch($ctx, _getLastPoint, ...args);
|
|
301
|
+
}
|
|
302
|
+
var _streamPoints = [1, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/streamPoints", 3, , "*/*"];
|
|
303
|
+
function streamPoints($ctx, ...args) {
|
|
304
|
+
return foundryPlatformFetch($ctx, _streamPoints, ...args);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.20.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesValueBankProperty.js
|
|
308
|
+
var TimeSeriesValueBankProperty_exports = {};
|
|
309
|
+
__export(TimeSeriesValueBankProperty_exports, {
|
|
310
|
+
getLatestValue: () => getLatestValue,
|
|
311
|
+
streamValues: () => streamValues
|
|
312
|
+
});
|
|
313
|
+
var _getLatestValue = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/latestValue", 2];
|
|
314
|
+
function getLatestValue($ctx, ...args) {
|
|
315
|
+
return foundryPlatformFetch($ctx, _getLatestValue, ...args);
|
|
316
|
+
}
|
|
317
|
+
var _streamValues = [1, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/streamValues", 3, , "*/*"];
|
|
318
|
+
function streamValues($ctx, ...args) {
|
|
319
|
+
return foundryPlatformFetch($ctx, _streamValues, ...args);
|
|
320
|
+
}
|
|
321
|
+
var addUserAgentAndRequestContextHeaders = (client, withMetadata) => ({
|
|
322
|
+
...client,
|
|
323
|
+
fetch: shared_net_fetch.createFetchHeaderMutator(client.fetch, (headers) => {
|
|
324
|
+
headers.set("X-OSDK-Request-Context", JSON.stringify(client.requestContext));
|
|
325
|
+
if (withMetadata.osdkMetadata) {
|
|
326
|
+
headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
|
|
327
|
+
}
|
|
328
|
+
return headers;
|
|
329
|
+
})
|
|
330
|
+
});
|
|
331
|
+
async function extractRdpDefinition(clientCtx, objectSet) {
|
|
332
|
+
return (await extractRdpDefinitionInternal(clientCtx, objectSet, void 0)).definitions;
|
|
333
|
+
}
|
|
334
|
+
async function extractRdpDefinitionInternal(clientCtx, objectSet, methodInputObjectType) {
|
|
335
|
+
switch (objectSet.type) {
|
|
336
|
+
case "searchAround": {
|
|
337
|
+
const {
|
|
338
|
+
definitions: definitions2,
|
|
339
|
+
childObjectType
|
|
340
|
+
} = await extractRdpDefinitionInternal(clientCtx, objectSet.objectSet, methodInputObjectType);
|
|
341
|
+
if (childObjectType === void 0 || childObjectType === "") {
|
|
342
|
+
return {
|
|
343
|
+
definitions: {}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
const objDef = await clientCtx.ontologyProvider.getObjectDefinition(childObjectType);
|
|
347
|
+
const linkDef = objDef.links[objectSet.link];
|
|
348
|
+
!linkDef ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Missing link definition for '${objectSet.link}'`) : invariant4__default.default(false) : void 0;
|
|
349
|
+
return {
|
|
350
|
+
definitions: definitions2,
|
|
351
|
+
childObjectType: objDef.links[objectSet.link].targetType
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
case "withProperties": {
|
|
355
|
+
const {
|
|
356
|
+
definitions: definitions2,
|
|
357
|
+
childObjectType
|
|
358
|
+
} = await extractRdpDefinitionInternal(clientCtx, objectSet.objectSet, methodInputObjectType);
|
|
359
|
+
if (childObjectType === void 0 || childObjectType === "") {
|
|
360
|
+
return {
|
|
361
|
+
definitions: {}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
for (const [name, definition] of Object.entries(objectSet.derivedProperties)) {
|
|
365
|
+
if (definition.type !== "selection") {
|
|
366
|
+
definitions2[name] = {
|
|
367
|
+
selectedOrCollectedPropertyType: void 0,
|
|
368
|
+
definition
|
|
369
|
+
};
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
switch (definition.operation.type) {
|
|
373
|
+
case "collectList":
|
|
374
|
+
case "collectSet":
|
|
375
|
+
case "get":
|
|
376
|
+
const {
|
|
377
|
+
childObjectType: operationLevelObjectType
|
|
378
|
+
} = await extractRdpDefinitionInternal(clientCtx, definition.objectSet, childObjectType);
|
|
379
|
+
if (operationLevelObjectType === void 0 || operationLevelObjectType === "") {
|
|
380
|
+
return {
|
|
381
|
+
definitions: {}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
const objDef = await clientCtx.ontologyProvider.getObjectDefinition(operationLevelObjectType);
|
|
385
|
+
definitions2[name] = {
|
|
386
|
+
selectedOrCollectedPropertyType: objDef.properties[definition.operation.selectedPropertyApiName],
|
|
387
|
+
definition
|
|
388
|
+
};
|
|
389
|
+
break;
|
|
390
|
+
default:
|
|
391
|
+
definitions2[name] = {
|
|
392
|
+
selectedOrCollectedPropertyType: void 0,
|
|
393
|
+
definition
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return {
|
|
398
|
+
definitions: definitions2,
|
|
399
|
+
childObjectType
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
case "methodInput":
|
|
403
|
+
return {
|
|
404
|
+
definitions: {},
|
|
405
|
+
childObjectType: methodInputObjectType
|
|
406
|
+
};
|
|
407
|
+
case "base":
|
|
408
|
+
return {
|
|
409
|
+
definitions: {},
|
|
410
|
+
childObjectType: objectSet.objectType
|
|
411
|
+
};
|
|
412
|
+
case "interfaceBase":
|
|
413
|
+
return {
|
|
414
|
+
definitions: {},
|
|
415
|
+
childObjectType: objectSet.interfaceType
|
|
416
|
+
};
|
|
417
|
+
case "filter":
|
|
418
|
+
case "asBaseObjectTypes":
|
|
419
|
+
case "asType":
|
|
420
|
+
case "nearestNeighbors":
|
|
421
|
+
return extractRdpDefinitionInternal(clientCtx, objectSet.objectSet, methodInputObjectType);
|
|
422
|
+
// These will throw in OSS so we should throw here so no request is made
|
|
423
|
+
case "intersect":
|
|
424
|
+
case "subtract":
|
|
425
|
+
case "union":
|
|
426
|
+
const objectSets = objectSet.objectSets;
|
|
427
|
+
const objectSetTypes = await Promise.all(objectSets.map((os) => extractRdpDefinitionInternal(clientCtx, os, methodInputObjectType)));
|
|
428
|
+
const definitions = objectSetTypes.reduce((acc, {
|
|
429
|
+
definitions: definitions2
|
|
430
|
+
}) => ({
|
|
431
|
+
...acc,
|
|
432
|
+
...definitions2
|
|
433
|
+
}), {});
|
|
434
|
+
!(Object.keys(definitions).length === 0) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Object sets combined using intersect, subtract, or union must not contain any derived property definitions") : invariant4__default.default(false) : void 0;
|
|
435
|
+
const firstValidChildObjectType = objectSetTypes.find(({
|
|
436
|
+
childObjectType
|
|
437
|
+
}) => childObjectType != null)?.childObjectType;
|
|
438
|
+
!objectSetTypes.every(({
|
|
439
|
+
childObjectType
|
|
440
|
+
}) => childObjectType === firstValidChildObjectType || childObjectType == null) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "All object sets in an intersect, subtract, or union must have the same child object type") : invariant4__default.default(false) : void 0;
|
|
441
|
+
return {
|
|
442
|
+
definitions: {},
|
|
443
|
+
childObjectType: firstValidChildObjectType
|
|
444
|
+
};
|
|
445
|
+
case "static":
|
|
446
|
+
case "reference":
|
|
447
|
+
return {
|
|
448
|
+
definitions: {}
|
|
449
|
+
};
|
|
450
|
+
// We don't have to worry about new object sets being added and doing a runtime break and breaking people since the OSDK is always constructing these.
|
|
451
|
+
default:
|
|
452
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Unsupported object set type for Runtime Derived Properties`) : invariant4__default.default(false) ;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// src/util/objectSetUtils.ts
|
|
457
|
+
function resolveBaseObjectSetType(objectType) {
|
|
458
|
+
return objectType.type === "interface" ? {
|
|
459
|
+
type: "interfaceBase",
|
|
460
|
+
interfaceType: objectType["apiName"]
|
|
461
|
+
} : {
|
|
462
|
+
type: "base",
|
|
463
|
+
objectType: objectType["apiName"]
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// src/object/fetchPage.ts
|
|
468
|
+
function augment(type, ...properties) {
|
|
469
|
+
return {
|
|
470
|
+
[type.apiName]: properties
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = void 0) {
|
|
474
|
+
if (objectSet.type === "base" || objectSet.type === "interfaceBase") {
|
|
475
|
+
if (objectSet.type === "base" && objectSet.objectType !== expectedApiName) {
|
|
476
|
+
throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);
|
|
477
|
+
}
|
|
478
|
+
if (objectSet.type === "interfaceBase" && objectSet.interfaceType !== expectedApiName) {
|
|
479
|
+
throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.interfaceType}`);
|
|
480
|
+
}
|
|
481
|
+
return existingWhere;
|
|
482
|
+
}
|
|
483
|
+
if (objectSet.type === "filter") {
|
|
484
|
+
return objectSetToSearchJsonV2(objectSet.objectSet, expectedApiName, existingWhere == null ? objectSet.where : {
|
|
485
|
+
type: "and",
|
|
486
|
+
value: [existingWhere, objectSet.where]
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
|
|
490
|
+
}
|
|
491
|
+
function resolveInterfaceObjectSet(objectSet, interfaceTypeApiName, args) {
|
|
492
|
+
return args?.$includeAllBaseObjectProperties ? {
|
|
493
|
+
type: "intersect",
|
|
494
|
+
objectSets: [objectSet, {
|
|
495
|
+
type: "interfaceBase",
|
|
496
|
+
interfaceType: interfaceTypeApiName,
|
|
497
|
+
includeAllBaseObjectProperties: true
|
|
498
|
+
}]
|
|
499
|
+
} : objectSet;
|
|
500
|
+
}
|
|
501
|
+
async function fetchInterfacePage(client, interfaceType, args, objectSet) {
|
|
502
|
+
if (args.$__UNSTABLE_useOldInterfaceApis) {
|
|
503
|
+
const result2 = await OntologyInterface_exports.search(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
504
|
+
augmentedProperties: {},
|
|
505
|
+
augmentedSharedPropertyTypes: {},
|
|
506
|
+
otherInterfaceTypes: [],
|
|
507
|
+
selectedObjectTypes: [],
|
|
508
|
+
selectedSharedPropertyTypes: args.$select ?? [],
|
|
509
|
+
where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName)
|
|
510
|
+
}), {
|
|
511
|
+
preview: true
|
|
512
|
+
});
|
|
513
|
+
result2.data = await client.objectFactory(
|
|
514
|
+
client,
|
|
515
|
+
result2.data,
|
|
516
|
+
// drop readonly
|
|
517
|
+
interfaceType.apiName,
|
|
518
|
+
!args.$includeRid,
|
|
519
|
+
await extractRdpDefinition(client, objectSet)
|
|
520
|
+
);
|
|
521
|
+
return result2;
|
|
522
|
+
}
|
|
523
|
+
const result = await OntologyObjectSet_exports.loadMultipleObjectTypes(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, applyFetchArgs(args, {
|
|
524
|
+
objectSet: resolveInterfaceObjectSet(objectSet, interfaceType.apiName, args),
|
|
525
|
+
select: args?.$select ?? [],
|
|
526
|
+
excludeRid: !args?.$includeRid
|
|
527
|
+
}), {
|
|
528
|
+
preview: true
|
|
529
|
+
});
|
|
530
|
+
return Promise.resolve({
|
|
531
|
+
data: await client.objectFactory2(client, result.data, interfaceType.apiName, {}, !args.$includeRid, args.$select, false, result.interfaceToObjectTypeMappings),
|
|
532
|
+
nextPageToken: result.nextPageToken,
|
|
533
|
+
totalCount: result.totalCount
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
async function fetchPageInternal(client, objectType, objectSet, args = {}) {
|
|
537
|
+
if (objectType.type === "interface") {
|
|
538
|
+
return await fetchInterfacePage(client, objectType, args, objectSet);
|
|
539
|
+
} else {
|
|
540
|
+
return await fetchObjectPage(client, objectType, args, objectSet);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
async function fetchPageWithErrorsInternal(client, objectType, objectSet, args = {}) {
|
|
544
|
+
try {
|
|
545
|
+
const result = await fetchPageInternal(client, objectType, objectSet, args);
|
|
546
|
+
return {
|
|
547
|
+
value: result
|
|
548
|
+
};
|
|
549
|
+
} catch (e) {
|
|
550
|
+
if (e instanceof Error) {
|
|
551
|
+
return {
|
|
552
|
+
error: e
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
return {
|
|
556
|
+
error: e
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
async function fetchPage(client, objectType, args, objectSet = resolveBaseObjectSetType(objectType)) {
|
|
561
|
+
return fetchPageInternal(client, objectType, objectSet, args);
|
|
562
|
+
}
|
|
563
|
+
function applyFetchArgs(args, body) {
|
|
564
|
+
if (args?.$nextPageToken) {
|
|
565
|
+
body.pageToken = args.$nextPageToken;
|
|
566
|
+
}
|
|
567
|
+
if (args?.$pageSize != null) {
|
|
568
|
+
body.pageSize = args.$pageSize;
|
|
569
|
+
}
|
|
570
|
+
if (args?.$orderBy != null) {
|
|
571
|
+
body.orderBy = {
|
|
572
|
+
fields: Object.entries(args.$orderBy).map(([field, direction]) => ({
|
|
573
|
+
field,
|
|
574
|
+
direction
|
|
575
|
+
}))
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
return body;
|
|
579
|
+
}
|
|
580
|
+
async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
581
|
+
const r = await OntologyObjectSet_exports.load(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
|
|
582
|
+
objectSet,
|
|
583
|
+
// We have to do the following case because LoadObjectSetRequestV2 isn't readonly
|
|
584
|
+
select: args?.$select ?? [],
|
|
585
|
+
// FIXME?
|
|
586
|
+
excludeRid: !args?.$includeRid
|
|
587
|
+
}));
|
|
588
|
+
return Promise.resolve({
|
|
589
|
+
data: await client.objectFactory(client, r.data, void 0, void 0, await extractRdpDefinition(client, objectSet), args.$select),
|
|
590
|
+
nextPageToken: r.nextPageToken,
|
|
591
|
+
totalCount: r.totalCount
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// src/Client.ts
|
|
596
|
+
var additionalContext = Symbol("additionalContext");
|
|
597
|
+
|
|
14
598
|
// src/public-utils/hydrateAttachmentFromRid.ts
|
|
15
599
|
function hydrateAttachmentFromRid(client, rid) {
|
|
16
|
-
return hydrateAttachmentFromRidInternal(client[
|
|
600
|
+
return hydrateAttachmentFromRidInternal(client[additionalContext], rid);
|
|
17
601
|
}
|
|
18
602
|
function hydrateAttachmentFromRidInternal(client, rid) {
|
|
19
603
|
return {
|
|
20
604
|
rid,
|
|
21
605
|
async fetchContents() {
|
|
22
|
-
return
|
|
606
|
+
return Attachment_exports.read(client, rid);
|
|
23
607
|
},
|
|
24
608
|
async fetchMetadata() {
|
|
25
|
-
const r = await
|
|
609
|
+
const r = await Attachment_exports.get(client, rid);
|
|
26
610
|
return {
|
|
27
611
|
...r,
|
|
28
612
|
sizeBytes: Number(r.sizeBytes)
|
|
@@ -66,7 +650,7 @@ var BaseLogger = class {
|
|
|
66
650
|
...this.bindings,
|
|
67
651
|
...bindings
|
|
68
652
|
}, {
|
|
69
|
-
level:
|
|
653
|
+
level: options?.level ?? this.options?.level,
|
|
70
654
|
msgPrefix: [this.options?.msgPrefix, options?.msgPrefix].filter((x) => x).join(" ")
|
|
71
655
|
});
|
|
72
656
|
}
|
|
@@ -98,7 +682,7 @@ var MinimalLogger = class _MinimalLogger extends BaseLogger {
|
|
|
98
682
|
}
|
|
99
683
|
};
|
|
100
684
|
async function fetchSingle(client, objectType, args, objectSet) {
|
|
101
|
-
const result = await
|
|
685
|
+
const result = await fetchPage(client, objectType, {
|
|
102
686
|
...args,
|
|
103
687
|
$pageSize: 1
|
|
104
688
|
}, objectSet);
|
|
@@ -193,7 +777,7 @@ function makeGeoFilterPolygon(coordinates, filterType, propertyIdentifier, field
|
|
|
193
777
|
};
|
|
194
778
|
}
|
|
195
779
|
function handleWherePair([fieldName, filter], objectOrInterface, structFieldSelector) {
|
|
196
|
-
!(filter != null) ? process.env.NODE_ENV !== "production" ?
|
|
780
|
+
!(filter != null) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Defined key values are only allowed when they are not undefined.") : invariant4__default.default(false) : void 0;
|
|
197
781
|
const propertyIdentifier = structFieldSelector != null ? {
|
|
198
782
|
type: "structField",
|
|
199
783
|
...structFieldSelector,
|
|
@@ -212,10 +796,10 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
|
|
|
212
796
|
}
|
|
213
797
|
const keysOfFilter = Object.keys(filter);
|
|
214
798
|
const hasDollarSign = keysOfFilter.some((key) => key.startsWith("$"));
|
|
215
|
-
!(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
799
|
+
!(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.") : invariant4__default.default(false) : void 0;
|
|
216
800
|
if (!hasDollarSign) {
|
|
217
801
|
const structFilter = Object.entries(filter);
|
|
218
|
-
!(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
802
|
+
!(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Cannot filter on more than one struct field in the same clause, need to use an and clause") : invariant4__default.default(false) : void 0;
|
|
219
803
|
const structFieldApiName = keysOfFilter[0];
|
|
220
804
|
return handleWherePair(Object.entries(filter)[0], objectOrInterface, {
|
|
221
805
|
propertyApiName: fieldName,
|
|
@@ -223,7 +807,7 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
|
|
|
223
807
|
});
|
|
224
808
|
}
|
|
225
809
|
const firstKey = keysOfFilter[0];
|
|
226
|
-
!(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ?
|
|
810
|
+
!(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false) : invariant4__default.default(false) : void 0;
|
|
227
811
|
if (firstKey === "$ne") {
|
|
228
812
|
return {
|
|
229
813
|
type: "not",
|
|
@@ -371,12 +955,12 @@ function derivedPropertyDefinitionFactory(wireDefinition, definitionMap) {
|
|
|
371
955
|
var getDefinitionFromMap = (arg, definitionMap) => {
|
|
372
956
|
if (typeof arg === "object") {
|
|
373
957
|
const definition = definitionMap.get(arg);
|
|
374
|
-
!definition ? process.env.NODE_ENV !== "production" ?
|
|
958
|
+
!definition ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Derived Property is not defined") : invariant4__default.default(false) : void 0;
|
|
375
959
|
return definition;
|
|
376
960
|
} else if (typeof arg === "number") {
|
|
377
|
-
process.env.NODE_ENV !== "production" ?
|
|
961
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Literals for derived properties are not yet supported") : invariant4__default.default(false) ;
|
|
378
962
|
}
|
|
379
|
-
process.env.NODE_ENV !== "production" ?
|
|
963
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Invalid argument type for a derived property") : invariant4__default.default(false) ;
|
|
380
964
|
};
|
|
381
965
|
|
|
382
966
|
// src/derivedProperties/createWithPropertiesObjectSet.ts
|
|
@@ -398,7 +982,7 @@ function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fro
|
|
|
398
982
|
},
|
|
399
983
|
aggregate: (aggregation, opt) => {
|
|
400
984
|
const splitAggregation = aggregation.split(":");
|
|
401
|
-
!(splitAggregation.length === 2 || splitAggregation[0] === "$count") ? process.env.NODE_ENV !== "production" ?
|
|
985
|
+
!(splitAggregation.length === 2 || splitAggregation[0] === "$count") ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Invalid aggregation format") : invariant4__default.default(false) : void 0;
|
|
402
986
|
const [aggregationPropertyName, aggregationOperation] = splitAggregation;
|
|
403
987
|
let aggregationOperationDefinition;
|
|
404
988
|
switch (aggregationOperation) {
|
|
@@ -436,7 +1020,7 @@ function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fro
|
|
|
436
1020
|
break;
|
|
437
1021
|
}
|
|
438
1022
|
default:
|
|
439
|
-
process.env.NODE_ENV !== "production" ?
|
|
1023
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Invalid aggregation operation " + aggregationOperation) : invariant4__default.default(false) ;
|
|
440
1024
|
}
|
|
441
1025
|
const wrappedObjectSet = {
|
|
442
1026
|
type: "selection",
|
|
@@ -471,19 +1055,19 @@ function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fro
|
|
|
471
1055
|
},
|
|
472
1056
|
constant: {
|
|
473
1057
|
double: (value) => {
|
|
474
|
-
process.env.NODE_ENV !== "production" ?
|
|
1058
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
475
1059
|
},
|
|
476
1060
|
integer: (value) => {
|
|
477
|
-
process.env.NODE_ENV !== "production" ?
|
|
1061
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
478
1062
|
},
|
|
479
1063
|
long: (value) => {
|
|
480
|
-
process.env.NODE_ENV !== "production" ?
|
|
1064
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
481
1065
|
},
|
|
482
1066
|
datetime: (value) => {
|
|
483
|
-
process.env.NODE_ENV !== "production" ?
|
|
1067
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
484
1068
|
},
|
|
485
1069
|
timestamp: (value) => {
|
|
486
|
-
process.env.NODE_ENV !== "production" ?
|
|
1070
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
487
1071
|
}
|
|
488
1072
|
}
|
|
489
1073
|
};
|
|
@@ -494,7 +1078,7 @@ function legacyToModernSingleAggregationResult(entry) {
|
|
|
494
1078
|
if (parts[0] === "count") {
|
|
495
1079
|
return accumulator;
|
|
496
1080
|
}
|
|
497
|
-
!(parts.length === 2) ? process.env.NODE_ENV !== "production" ?
|
|
1081
|
+
!(parts.length === 2) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "assumed we were getting a `${key}.${type}`") : invariant4__default.default(false) : void 0;
|
|
498
1082
|
const property = parts[0];
|
|
499
1083
|
const metricType = parts[1];
|
|
500
1084
|
if (!(property in accumulator)) {
|
|
@@ -580,21 +1164,21 @@ function convertRange(range) {
|
|
|
580
1164
|
}
|
|
581
1165
|
|
|
582
1166
|
// src/object/aggregate.ts
|
|
583
|
-
async function
|
|
584
|
-
|
|
1167
|
+
async function aggregate3(clientCtx, objectType, objectSet = resolveBaseObjectSetType(objectType), req) {
|
|
1168
|
+
resolveBaseObjectSetType(objectType);
|
|
585
1169
|
const body = {
|
|
586
1170
|
aggregation: modernToLegacyAggregationClause(req.$select),
|
|
587
1171
|
groupBy: []};
|
|
588
1172
|
if (req.$groupBy) {
|
|
589
1173
|
body.groupBy = modernToLegacyGroupByClause(req.$groupBy);
|
|
590
1174
|
}
|
|
591
|
-
const result = await
|
|
1175
|
+
const result = await OntologyObjectSet_exports.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
|
|
592
1176
|
objectSet,
|
|
593
1177
|
groupBy: body.groupBy,
|
|
594
1178
|
aggregation: body.aggregation
|
|
595
1179
|
});
|
|
596
1180
|
if (!req.$groupBy) {
|
|
597
|
-
!(result.data.length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
1181
|
+
!(result.data.length === 1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "no group by clause should mean only one data result") : invariant4__default.default(false) : void 0;
|
|
598
1182
|
return {
|
|
599
1183
|
...aggregationToCountResult(result.data[0]),
|
|
600
1184
|
...legacyToModernSingleAggregationResult(result.data[0])
|
|
@@ -620,11 +1204,11 @@ function aggregationToCountResult(entry) {
|
|
|
620
1204
|
}
|
|
621
1205
|
|
|
622
1206
|
// src/util/augmentRequestContext.ts
|
|
623
|
-
var augmentRequestContext = (client,
|
|
1207
|
+
var augmentRequestContext = (client, augment2) => ({
|
|
624
1208
|
...client,
|
|
625
1209
|
requestContext: {
|
|
626
1210
|
...client.requestContext,
|
|
627
|
-
...
|
|
1211
|
+
...augment2(client.requestContext)
|
|
628
1212
|
}
|
|
629
1213
|
});
|
|
630
1214
|
|
|
@@ -690,7 +1274,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
690
1274
|
this.#logger = client.logger?.child({}, {
|
|
691
1275
|
msgPrefix: "<OSW> "
|
|
692
1276
|
});
|
|
693
|
-
!(client.baseUrl.startsWith("https://") || client.baseUrl.startsWith("http://")) ? process.env.NODE_ENV !== "production" ?
|
|
1277
|
+
!(client.baseUrl.startsWith("https://") || client.baseUrl.startsWith("http://")) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Stack must be a URL") : invariant4__default.default(false) : void 0;
|
|
694
1278
|
}
|
|
695
1279
|
async subscribe(objectType, objectSet, listener, properties = []) {
|
|
696
1280
|
const objOrInterfaceDef = objectType.type === "object" ? await this.#client.ontologyProvider.getObjectDefinition(objectType.apiName) : await this.#client.ontologyProvider.getInterfaceDefinition(objectType.apiName);
|
|
@@ -872,7 +1456,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
872
1456
|
return;
|
|
873
1457
|
}
|
|
874
1458
|
default:
|
|
875
|
-
process.env.NODE_ENV !== "production" ?
|
|
1459
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Unexpected message type") : invariant4__default.default(false) ;
|
|
876
1460
|
}
|
|
877
1461
|
};
|
|
878
1462
|
#handleMessage_objectSetChanged = async (payload) => {
|
|
@@ -937,7 +1521,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
937
1521
|
}
|
|
938
1522
|
#handleMessage_refreshObjectSet = (payload) => {
|
|
939
1523
|
const sub = this.#subscriptions.get(payload.id);
|
|
940
|
-
!sub ? process.env.NODE_ENV !== "production" ?
|
|
1524
|
+
!sub ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Expected subscription id ${payload.id}`) : invariant4__default.default(false) : void 0;
|
|
941
1525
|
try {
|
|
942
1526
|
sub.listener.onOutOfDate();
|
|
943
1527
|
} catch (error) {
|
|
@@ -951,7 +1535,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
951
1535
|
responses
|
|
952
1536
|
} = payload;
|
|
953
1537
|
const subs = this.#pendingSubscriptions.get(id);
|
|
954
|
-
!subs ? process.env.NODE_ENV !== "production" ?
|
|
1538
|
+
!subs ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `should have a pending subscription for ${id}`) : invariant4__default.default(false) : void 0;
|
|
955
1539
|
this.#pendingSubscriptions.delete(id);
|
|
956
1540
|
for (let i = 0; i < responses.length; i++) {
|
|
957
1541
|
const sub = subs[i];
|
|
@@ -993,7 +1577,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
993
1577
|
#handleMessage_subscriptionClosed(payload) {
|
|
994
1578
|
const sub = this.#subscriptions.get(payload.id);
|
|
995
1579
|
if (sub == null && this.#endedSubscriptions.has(payload.id)) return;
|
|
996
|
-
!sub ? process.env.NODE_ENV !== "production" ?
|
|
1580
|
+
!sub ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Expected subscription id ${payload.id}`) : invariant4__default.default(false) : void 0;
|
|
997
1581
|
this.#tryCatchOnError(sub, true, payload.cause);
|
|
998
1582
|
this.#unsubscribe(sub, "error");
|
|
999
1583
|
}
|
|
@@ -1018,7 +1602,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
1018
1602
|
if (this.#subscriptions.size > 0) {
|
|
1019
1603
|
if (process.env.NODE_ENV !== "production") {
|
|
1020
1604
|
for (const s of this.#subscriptions.values()) {
|
|
1021
|
-
!(s.status !== "done" && s.status !== "error") ? process.env.NODE_ENV !== "production" ?
|
|
1605
|
+
!(s.status !== "done" && s.status !== "error") ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "should not have done/error subscriptions still") : invariant4__default.default(false) : void 0;
|
|
1022
1606
|
}
|
|
1023
1607
|
}
|
|
1024
1608
|
for (const s of this.#subscriptions.values()) {
|
|
@@ -1067,15 +1651,15 @@ function getWireObjectSet(objectSet) {
|
|
|
1067
1651
|
return objectSetDefinitions.get(objectSet);
|
|
1068
1652
|
}
|
|
1069
1653
|
var objectSetDefinitions = /* @__PURE__ */ new WeakMap();
|
|
1070
|
-
function createObjectSet(objectType, clientCtx, objectSet =
|
|
1654
|
+
function createObjectSet(objectType, clientCtx, objectSet = resolveBaseObjectSetType(objectType)) {
|
|
1071
1655
|
const base = {
|
|
1072
|
-
aggregate:
|
|
1656
|
+
aggregate: aggregate3.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1073
1657
|
finalMethodCall: "aggregate"
|
|
1074
1658
|
})), objectType, objectSet),
|
|
1075
|
-
fetchPage:
|
|
1659
|
+
fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1076
1660
|
finalMethodCall: "fetchPage"
|
|
1077
1661
|
})), objectType, objectSet),
|
|
1078
|
-
fetchPageWithErrors:
|
|
1662
|
+
fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1079
1663
|
finalMethodCall: "fetchPageWithErrors"
|
|
1080
1664
|
})), objectType, objectSet),
|
|
1081
1665
|
where: (clause) => {
|
|
@@ -1109,7 +1693,7 @@ function createObjectSet(objectType, clientCtx, objectSet = chunkC5D7744G_cjs.re
|
|
|
1109
1693
|
asyncIter: async function* (args) {
|
|
1110
1694
|
let $nextPageToken = void 0;
|
|
1111
1695
|
do {
|
|
1112
|
-
const result = await
|
|
1696
|
+
const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
|
|
1113
1697
|
finalMethodCall: "asyncIter"
|
|
1114
1698
|
})), objectType, objectSet, {
|
|
1115
1699
|
...args,
|
|
@@ -1183,11 +1767,26 @@ async function createWithPk(clientCtx, objectType, objectSet, primaryKey) {
|
|
|
1183
1767
|
return withPk;
|
|
1184
1768
|
}
|
|
1185
1769
|
|
|
1770
|
+
exports.ActionTypeV2_exports = ActionTypeV2_exports;
|
|
1771
|
+
exports.Action_exports = Action_exports;
|
|
1772
|
+
exports.Attachment_exports = Attachment_exports;
|
|
1186
1773
|
exports.BaseLogger = BaseLogger;
|
|
1774
|
+
exports.MediaReferenceProperty_exports = MediaReferenceProperty_exports;
|
|
1187
1775
|
exports.MinimalLogger = MinimalLogger;
|
|
1776
|
+
exports.ObjectTypeV2_exports = ObjectTypeV2_exports;
|
|
1777
|
+
exports.OntologyInterface_exports = OntologyInterface_exports;
|
|
1778
|
+
exports.OntologyObjectSet_exports = OntologyObjectSet_exports;
|
|
1779
|
+
exports.QueryType_exports = QueryType_exports;
|
|
1780
|
+
exports.Query_exports = Query_exports;
|
|
1781
|
+
exports.TimeSeriesPropertyV2_exports = TimeSeriesPropertyV2_exports;
|
|
1782
|
+
exports.TimeSeriesValueBankProperty_exports = TimeSeriesValueBankProperty_exports;
|
|
1783
|
+
exports.addUserAgentAndRequestContextHeaders = addUserAgentAndRequestContextHeaders;
|
|
1784
|
+
exports.additionalContext = additionalContext;
|
|
1785
|
+
exports.augment = augment;
|
|
1188
1786
|
exports.augmentRequestContext = augmentRequestContext;
|
|
1189
1787
|
exports.createObjectSet = createObjectSet;
|
|
1190
1788
|
exports.extractNamespace = extractNamespace;
|
|
1789
|
+
exports.fetchPage = fetchPage;
|
|
1191
1790
|
exports.fetchSingle = fetchSingle;
|
|
1192
1791
|
exports.fetchSingleWithErrors = fetchSingleWithErrors;
|
|
1193
1792
|
exports.getWireObjectSet = getWireObjectSet;
|
|
@@ -1195,5 +1794,6 @@ exports.hydrateAttachmentFromRid = hydrateAttachmentFromRid;
|
|
|
1195
1794
|
exports.hydrateAttachmentFromRidInternal = hydrateAttachmentFromRidInternal;
|
|
1196
1795
|
exports.isObjectSet = isObjectSet;
|
|
1197
1796
|
exports.isWireObjectSet = isWireObjectSet;
|
|
1198
|
-
|
|
1199
|
-
//# sourceMappingURL=chunk-
|
|
1797
|
+
exports.symbolClientContext = symbolClientContext;
|
|
1798
|
+
//# sourceMappingURL=chunk-N4KFUVWG.cjs.map
|
|
1799
|
+
//# sourceMappingURL=chunk-N4KFUVWG.cjs.map
|