@osdk/client 2.3.0-beta.5 → 2.3.0-beta.7
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 +30 -0
- package/build/browser/actions/ActionValidationError.js.map +1 -1
- package/build/browser/actions/applyAction.js +9 -8
- package/build/browser/actions/applyAction.js.map +1 -1
- 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/object/mediaUpload.js +3 -0
- package/build/browser/object/mediaUpload.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/extractRdpDefinition.js +2 -0
- package/build/browser/util/extractRdpDefinition.js.map +1 -1
- package/build/browser/util/toDataValue.js +20 -10
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +50 -11
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/cjs/chunk-BITDNXFO.cjs +1804 -0
- package/build/cjs/chunk-BITDNXFO.cjs.map +1 -0
- package/build/cjs/{chunk-MZ4JZQUU.cjs → chunk-HTPVXLYY.cjs} +649 -42
- package/build/cjs/chunk-HTPVXLYY.cjs.map +1 -0
- package/build/cjs/index.cjs +16 -1769
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +4 -3
- 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/actions/ActionValidationError.js.map +1 -1
- package/build/esm/actions/applyAction.js +9 -8
- package/build/esm/actions/applyAction.js.map +1 -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/object/mediaUpload.js +3 -0
- package/build/esm/object/mediaUpload.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/extractRdpDefinition.js +2 -0
- package/build/esm/util/extractRdpDefinition.js.map +1 -1
- package/build/esm/util/toDataValue.js +20 -10
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +50 -11
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/types/actions/ActionValidationError.d.ts +1 -1
- package/build/types/actions/ActionValidationError.d.ts.map +1 -1
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/object/mediaUpload.d.ts +2 -1
- package/build/types/object/mediaUpload.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 +11 -11
- 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,619 @@
|
|
|
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.24.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.24.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.24.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}", 2];
|
|
119
|
+
function get($ctx, ...args) {
|
|
120
|
+
return foundryPlatformFetch($ctx, _get, ...args);
|
|
121
|
+
}
|
|
122
|
+
var _getByRid = [0, "/v2/ontologies/{0}/actionTypes/byRid/{1}", 2];
|
|
123
|
+
function getByRid($ctx, ...args) {
|
|
124
|
+
return foundryPlatformFetch($ctx, _getByRid, ...args);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.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.24.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
|
+
uploadMedia: () => uploadMedia
|
|
159
|
+
});
|
|
160
|
+
var _getMediaContent = [0, "/v2/ontologies/{0}/objects/{1}/{2}/media/{3}/content", 2, , "*/*"];
|
|
161
|
+
function getMediaContent($ctx, ...args) {
|
|
162
|
+
return foundryPlatformFetch($ctx, _getMediaContent, ...args);
|
|
163
|
+
}
|
|
164
|
+
var _getMediaMetadata = [0, "/v2/ontologies/{0}/objects/{1}/{2}/media/{3}/metadata", 2];
|
|
165
|
+
function getMediaMetadata($ctx, ...args) {
|
|
166
|
+
return foundryPlatformFetch($ctx, _getMediaMetadata, ...args);
|
|
167
|
+
}
|
|
168
|
+
var _upload2 = [1, "/v2/ontologies/{0}/objectTypes/{1}/media/{2}/upload", 3, "*/*"];
|
|
169
|
+
function upload2($ctx, ...args) {
|
|
170
|
+
return foundryPlatformFetch($ctx, _upload2, ...args);
|
|
171
|
+
}
|
|
172
|
+
var _uploadMedia = [1, "/v2/ontologies/{0}/actions/{1}/media/upload", 3, "*/*"];
|
|
173
|
+
function uploadMedia($ctx, ...args) {
|
|
174
|
+
return foundryPlatformFetch($ctx, _uploadMedia, ...args);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ObjectTypeV2.js
|
|
178
|
+
var ObjectTypeV2_exports = {};
|
|
179
|
+
__export(ObjectTypeV2_exports, {
|
|
180
|
+
get: () => get3,
|
|
181
|
+
getFullMetadata: () => getFullMetadata,
|
|
182
|
+
getOutgoingLinkType: () => getOutgoingLinkType,
|
|
183
|
+
list: () => list2,
|
|
184
|
+
listOutgoingLinkTypes: () => listOutgoingLinkTypes
|
|
185
|
+
});
|
|
186
|
+
var _list2 = [0, "/v2/ontologies/{0}/objectTypes", 2];
|
|
187
|
+
function list2($ctx, ...args) {
|
|
188
|
+
return foundryPlatformFetch($ctx, _list2, ...args);
|
|
189
|
+
}
|
|
190
|
+
var _get3 = [0, "/v2/ontologies/{0}/objectTypes/{1}", 2];
|
|
191
|
+
function get3($ctx, ...args) {
|
|
192
|
+
return foundryPlatformFetch($ctx, _get3, ...args);
|
|
193
|
+
}
|
|
194
|
+
var _getFullMetadata = [0, "/v2/ontologies/{0}/objectTypes/{1}/fullMetadata", 2];
|
|
195
|
+
function getFullMetadata($ctx, ...args) {
|
|
196
|
+
return foundryPlatformFetch($ctx, _getFullMetadata, ...args);
|
|
197
|
+
}
|
|
198
|
+
var _listOutgoingLinkTypes = [0, "/v2/ontologies/{0}/objectTypes/{1}/outgoingLinkTypes", 2];
|
|
199
|
+
function listOutgoingLinkTypes($ctx, ...args) {
|
|
200
|
+
return foundryPlatformFetch($ctx, _listOutgoingLinkTypes, ...args);
|
|
201
|
+
}
|
|
202
|
+
var _getOutgoingLinkType = [0, "/v2/ontologies/{0}/objectTypes/{1}/outgoingLinkTypes/{2}", 2];
|
|
203
|
+
function getOutgoingLinkType($ctx, ...args) {
|
|
204
|
+
return foundryPlatformFetch($ctx, _getOutgoingLinkType, ...args);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyInterface.js
|
|
208
|
+
var OntologyInterface_exports = {};
|
|
209
|
+
__export(OntologyInterface_exports, {
|
|
210
|
+
aggregate: () => aggregate,
|
|
211
|
+
get: () => get4,
|
|
212
|
+
list: () => list3,
|
|
213
|
+
search: () => search
|
|
214
|
+
});
|
|
215
|
+
var _list3 = [0, "/v2/ontologies/{0}/interfaceTypes", 2];
|
|
216
|
+
function list3($ctx, ...args) {
|
|
217
|
+
return foundryPlatformFetch($ctx, _list3, ...args);
|
|
218
|
+
}
|
|
219
|
+
var _get4 = [0, "/v2/ontologies/{0}/interfaceTypes/{1}", 2];
|
|
220
|
+
function get4($ctx, ...args) {
|
|
221
|
+
return foundryPlatformFetch($ctx, _get4, ...args);
|
|
222
|
+
}
|
|
223
|
+
var _search = [1, "/v2/ontologies/{0}/interfaces/{1}/search", 3];
|
|
224
|
+
function search($ctx, ...args) {
|
|
225
|
+
return foundryPlatformFetch($ctx, _search, ...args);
|
|
226
|
+
}
|
|
227
|
+
var _aggregate = [1, "/v2/ontologies/{0}/interfaces/{1}/aggregate", 3];
|
|
228
|
+
function aggregate($ctx, ...args) {
|
|
229
|
+
return foundryPlatformFetch($ctx, _aggregate, ...args);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectSet.js
|
|
233
|
+
var OntologyObjectSet_exports = {};
|
|
234
|
+
__export(OntologyObjectSet_exports, {
|
|
235
|
+
aggregate: () => aggregate2,
|
|
236
|
+
createTemporary: () => createTemporary,
|
|
237
|
+
get: () => get5,
|
|
238
|
+
load: () => load,
|
|
239
|
+
loadMultipleObjectTypes: () => loadMultipleObjectTypes,
|
|
240
|
+
loadObjectsOrInterfaces: () => loadObjectsOrInterfaces
|
|
241
|
+
});
|
|
242
|
+
var _createTemporary = [1, "/v2/ontologies/{0}/objectSets/createTemporary", 1];
|
|
243
|
+
function createTemporary($ctx, ...args) {
|
|
244
|
+
return foundryPlatformFetch($ctx, _createTemporary, ...args);
|
|
245
|
+
}
|
|
246
|
+
var _get5 = [0, "/v2/ontologies/{0}/objectSets/{1}"];
|
|
247
|
+
function get5($ctx, ...args) {
|
|
248
|
+
return foundryPlatformFetch($ctx, _get5, ...args);
|
|
249
|
+
}
|
|
250
|
+
var _load = [1, "/v2/ontologies/{0}/objectSets/loadObjects", 3];
|
|
251
|
+
function load($ctx, ...args) {
|
|
252
|
+
return foundryPlatformFetch($ctx, _load, ...args);
|
|
253
|
+
}
|
|
254
|
+
var _loadMultipleObjectTypes = [1, "/v2/ontologies/{0}/objectSets/loadObjectsMultipleObjectTypes", 3];
|
|
255
|
+
function loadMultipleObjectTypes($ctx, ...args) {
|
|
256
|
+
return foundryPlatformFetch($ctx, _loadMultipleObjectTypes, ...args);
|
|
257
|
+
}
|
|
258
|
+
var _loadObjectsOrInterfaces = [1, "/v2/ontologies/{0}/objectSets/loadObjectsOrInterfaces", 3];
|
|
259
|
+
function loadObjectsOrInterfaces($ctx, ...args) {
|
|
260
|
+
return foundryPlatformFetch($ctx, _loadObjectsOrInterfaces, ...args);
|
|
261
|
+
}
|
|
262
|
+
var _aggregate2 = [1, "/v2/ontologies/{0}/objectSets/aggregate", 3];
|
|
263
|
+
function aggregate2($ctx, ...args) {
|
|
264
|
+
return foundryPlatformFetch($ctx, _aggregate2, ...args);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Query.js
|
|
268
|
+
var Query_exports = {};
|
|
269
|
+
__export(Query_exports, {
|
|
270
|
+
execute: () => execute
|
|
271
|
+
});
|
|
272
|
+
var _execute = [1, "/v2/ontologies/{0}/queries/{1}/execute", 3];
|
|
273
|
+
function execute($ctx, ...args) {
|
|
274
|
+
return foundryPlatformFetch($ctx, _execute, ...args);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.0/node_modules/@osdk/foundry.ontologies/build/esm/public/QueryType.js
|
|
278
|
+
var QueryType_exports = {};
|
|
279
|
+
__export(QueryType_exports, {
|
|
280
|
+
get: () => get6,
|
|
281
|
+
list: () => list4
|
|
282
|
+
});
|
|
283
|
+
var _list4 = [0, "/v2/ontologies/{0}/queryTypes", 2];
|
|
284
|
+
function list4($ctx, ...args) {
|
|
285
|
+
return foundryPlatformFetch($ctx, _list4, ...args);
|
|
286
|
+
}
|
|
287
|
+
var _get6 = [0, "/v2/ontologies/{0}/queryTypes/{1}", 2];
|
|
288
|
+
function get6($ctx, ...args) {
|
|
289
|
+
return foundryPlatformFetch($ctx, _get6, ...args);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesPropertyV2.js
|
|
293
|
+
var TimeSeriesPropertyV2_exports = {};
|
|
294
|
+
__export(TimeSeriesPropertyV2_exports, {
|
|
295
|
+
getFirstPoint: () => getFirstPoint,
|
|
296
|
+
getLastPoint: () => getLastPoint,
|
|
297
|
+
streamPoints: () => streamPoints
|
|
298
|
+
});
|
|
299
|
+
var _getFirstPoint = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/firstPoint", 2];
|
|
300
|
+
function getFirstPoint($ctx, ...args) {
|
|
301
|
+
return foundryPlatformFetch($ctx, _getFirstPoint, ...args);
|
|
302
|
+
}
|
|
303
|
+
var _getLastPoint = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/lastPoint", 2];
|
|
304
|
+
function getLastPoint($ctx, ...args) {
|
|
305
|
+
return foundryPlatformFetch($ctx, _getLastPoint, ...args);
|
|
306
|
+
}
|
|
307
|
+
var _streamPoints = [1, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/streamPoints", 3, , "*/*"];
|
|
308
|
+
function streamPoints($ctx, ...args) {
|
|
309
|
+
return foundryPlatformFetch($ctx, _streamPoints, ...args);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.24.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesValueBankProperty.js
|
|
313
|
+
var TimeSeriesValueBankProperty_exports = {};
|
|
314
|
+
__export(TimeSeriesValueBankProperty_exports, {
|
|
315
|
+
getLatestValue: () => getLatestValue,
|
|
316
|
+
streamValues: () => streamValues
|
|
317
|
+
});
|
|
318
|
+
var _getLatestValue = [0, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/latestValue", 2];
|
|
319
|
+
function getLatestValue($ctx, ...args) {
|
|
320
|
+
return foundryPlatformFetch($ctx, _getLatestValue, ...args);
|
|
321
|
+
}
|
|
322
|
+
var _streamValues = [1, "/v2/ontologies/{0}/objects/{1}/{2}/timeseries/{3}/streamValues", 3, , "*/*"];
|
|
323
|
+
function streamValues($ctx, ...args) {
|
|
324
|
+
return foundryPlatformFetch($ctx, _streamValues, ...args);
|
|
325
|
+
}
|
|
326
|
+
var addUserAgentAndRequestContextHeaders = (client, withMetadata) => ({
|
|
327
|
+
...client,
|
|
328
|
+
fetch: shared_net_fetch.createFetchHeaderMutator(client.fetch, (headers) => {
|
|
329
|
+
headers.set("X-OSDK-Request-Context", JSON.stringify(client.requestContext));
|
|
330
|
+
if (withMetadata.osdkMetadata) {
|
|
331
|
+
headers.set("Fetch-User-Agent", withMetadata.osdkMetadata.extraUserAgent);
|
|
332
|
+
}
|
|
333
|
+
return headers;
|
|
334
|
+
})
|
|
335
|
+
});
|
|
336
|
+
async function extractRdpDefinition(clientCtx, objectSet) {
|
|
337
|
+
return (await extractRdpDefinitionInternal(clientCtx, objectSet, void 0)).definitions;
|
|
338
|
+
}
|
|
339
|
+
async function extractRdpDefinitionInternal(clientCtx, objectSet, methodInputObjectType) {
|
|
340
|
+
switch (objectSet.type) {
|
|
341
|
+
case "searchAround": {
|
|
342
|
+
const {
|
|
343
|
+
definitions: definitions2,
|
|
344
|
+
childObjectType
|
|
345
|
+
} = await extractRdpDefinitionInternal(clientCtx, objectSet.objectSet, methodInputObjectType);
|
|
346
|
+
if (childObjectType === void 0 || childObjectType === "") {
|
|
347
|
+
return {
|
|
348
|
+
definitions: {}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
const objDef = await clientCtx.ontologyProvider.getObjectDefinition(childObjectType);
|
|
352
|
+
const linkDef = objDef.links[objectSet.link];
|
|
353
|
+
!linkDef ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Missing link definition for '${objectSet.link}'`) : invariant4__default.default(false) : void 0;
|
|
354
|
+
return {
|
|
355
|
+
definitions: definitions2,
|
|
356
|
+
childObjectType: objDef.links[objectSet.link].targetType
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
case "withProperties": {
|
|
360
|
+
const {
|
|
361
|
+
definitions: definitions2,
|
|
362
|
+
childObjectType
|
|
363
|
+
} = await extractRdpDefinitionInternal(clientCtx, objectSet.objectSet, methodInputObjectType);
|
|
364
|
+
if (childObjectType === void 0 || childObjectType === "") {
|
|
365
|
+
return {
|
|
366
|
+
definitions: {}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
for (const [name, definition] of Object.entries(objectSet.derivedProperties)) {
|
|
370
|
+
if (definition.type !== "selection") {
|
|
371
|
+
definitions2[name] = {
|
|
372
|
+
selectedOrCollectedPropertyType: void 0,
|
|
373
|
+
definition
|
|
374
|
+
};
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
switch (definition.operation.type) {
|
|
378
|
+
case "collectList":
|
|
379
|
+
case "collectSet":
|
|
380
|
+
case "get":
|
|
381
|
+
const {
|
|
382
|
+
childObjectType: operationLevelObjectType
|
|
383
|
+
} = await extractRdpDefinitionInternal(clientCtx, definition.objectSet, childObjectType);
|
|
384
|
+
if (operationLevelObjectType === void 0 || operationLevelObjectType === "") {
|
|
385
|
+
return {
|
|
386
|
+
definitions: {}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
const objDef = await clientCtx.ontologyProvider.getObjectDefinition(operationLevelObjectType);
|
|
390
|
+
definitions2[name] = {
|
|
391
|
+
selectedOrCollectedPropertyType: objDef.properties[definition.operation.selectedPropertyApiName],
|
|
392
|
+
definition
|
|
393
|
+
};
|
|
394
|
+
break;
|
|
395
|
+
default:
|
|
396
|
+
definitions2[name] = {
|
|
397
|
+
selectedOrCollectedPropertyType: void 0,
|
|
398
|
+
definition
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return {
|
|
403
|
+
definitions: definitions2,
|
|
404
|
+
childObjectType
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
case "methodInput":
|
|
408
|
+
return {
|
|
409
|
+
definitions: {},
|
|
410
|
+
childObjectType: methodInputObjectType
|
|
411
|
+
};
|
|
412
|
+
case "base":
|
|
413
|
+
return {
|
|
414
|
+
definitions: {},
|
|
415
|
+
childObjectType: objectSet.objectType
|
|
416
|
+
};
|
|
417
|
+
case "interfaceBase":
|
|
418
|
+
return {
|
|
419
|
+
definitions: {},
|
|
420
|
+
childObjectType: objectSet.interfaceType
|
|
421
|
+
};
|
|
422
|
+
case "filter":
|
|
423
|
+
case "asBaseObjectTypes":
|
|
424
|
+
case "asType":
|
|
425
|
+
case "nearestNeighbors":
|
|
426
|
+
return extractRdpDefinitionInternal(clientCtx, objectSet.objectSet, methodInputObjectType);
|
|
427
|
+
// These will throw in OSS so we should throw here so no request is made
|
|
428
|
+
case "intersect":
|
|
429
|
+
case "subtract":
|
|
430
|
+
case "union":
|
|
431
|
+
const objectSets = objectSet.objectSets;
|
|
432
|
+
const objectSetTypes = await Promise.all(objectSets.map((os) => extractRdpDefinitionInternal(clientCtx, os, methodInputObjectType)));
|
|
433
|
+
const definitions = objectSetTypes.reduce((acc, {
|
|
434
|
+
definitions: definitions2
|
|
435
|
+
}) => ({
|
|
436
|
+
...acc,
|
|
437
|
+
...definitions2
|
|
438
|
+
}), {});
|
|
439
|
+
!(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;
|
|
440
|
+
const firstValidChildObjectType = objectSetTypes.find(({
|
|
441
|
+
childObjectType
|
|
442
|
+
}) => childObjectType != null)?.childObjectType;
|
|
443
|
+
!objectSetTypes.every(({
|
|
444
|
+
childObjectType
|
|
445
|
+
}) => 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;
|
|
446
|
+
return {
|
|
447
|
+
definitions: {},
|
|
448
|
+
childObjectType: firstValidChildObjectType
|
|
449
|
+
};
|
|
450
|
+
case "static":
|
|
451
|
+
case "reference":
|
|
452
|
+
return {
|
|
453
|
+
definitions: {}
|
|
454
|
+
};
|
|
455
|
+
// 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.
|
|
456
|
+
case "interfaceLinkSearchAround":
|
|
457
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Unsupported object set type for Runtime Derived Properties`) : invariant4__default.default(false) ;
|
|
458
|
+
default:
|
|
459
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Unsupported object set type for Runtime Derived Properties`) : invariant4__default.default(false) ;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// src/util/objectSetUtils.ts
|
|
464
|
+
function resolveBaseObjectSetType(objectType) {
|
|
465
|
+
return objectType.type === "interface" ? {
|
|
466
|
+
type: "interfaceBase",
|
|
467
|
+
interfaceType: objectType["apiName"]
|
|
468
|
+
} : {
|
|
469
|
+
type: "base",
|
|
470
|
+
objectType: objectType["apiName"]
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/object/fetchPage.ts
|
|
475
|
+
function augment(type, ...properties) {
|
|
476
|
+
return {
|
|
477
|
+
[type.apiName]: properties
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = void 0) {
|
|
481
|
+
if (objectSet.type === "base" || objectSet.type === "interfaceBase") {
|
|
482
|
+
if (objectSet.type === "base" && objectSet.objectType !== expectedApiName) {
|
|
483
|
+
throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);
|
|
484
|
+
}
|
|
485
|
+
if (objectSet.type === "interfaceBase" && objectSet.interfaceType !== expectedApiName) {
|
|
486
|
+
throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.interfaceType}`);
|
|
487
|
+
}
|
|
488
|
+
return existingWhere;
|
|
489
|
+
}
|
|
490
|
+
if (objectSet.type === "filter") {
|
|
491
|
+
return objectSetToSearchJsonV2(objectSet.objectSet, expectedApiName, existingWhere == null ? objectSet.where : {
|
|
492
|
+
type: "and",
|
|
493
|
+
value: [existingWhere, objectSet.where]
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
|
|
497
|
+
}
|
|
498
|
+
function resolveInterfaceObjectSet(objectSet, interfaceTypeApiName, args) {
|
|
499
|
+
return args?.$includeAllBaseObjectProperties ? {
|
|
500
|
+
type: "intersect",
|
|
501
|
+
objectSets: [objectSet, {
|
|
502
|
+
type: "interfaceBase",
|
|
503
|
+
interfaceType: interfaceTypeApiName,
|
|
504
|
+
includeAllBaseObjectProperties: true
|
|
505
|
+
}]
|
|
506
|
+
} : objectSet;
|
|
507
|
+
}
|
|
508
|
+
async function fetchInterfacePage(client, interfaceType, args, objectSet) {
|
|
509
|
+
if (args.$__UNSTABLE_useOldInterfaceApis) {
|
|
510
|
+
const result2 = await OntologyInterface_exports.search(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
511
|
+
augmentedProperties: {},
|
|
512
|
+
augmentedSharedPropertyTypes: {},
|
|
513
|
+
otherInterfaceTypes: [],
|
|
514
|
+
selectedObjectTypes: [],
|
|
515
|
+
selectedSharedPropertyTypes: args.$select ?? [],
|
|
516
|
+
where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName)
|
|
517
|
+
}), {
|
|
518
|
+
preview: true
|
|
519
|
+
});
|
|
520
|
+
result2.data = await client.objectFactory(
|
|
521
|
+
client,
|
|
522
|
+
result2.data,
|
|
523
|
+
// drop readonly
|
|
524
|
+
interfaceType.apiName,
|
|
525
|
+
!args.$includeRid,
|
|
526
|
+
await extractRdpDefinition(client, objectSet)
|
|
527
|
+
);
|
|
528
|
+
return result2;
|
|
529
|
+
}
|
|
530
|
+
const result = await OntologyObjectSet_exports.loadMultipleObjectTypes(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, applyFetchArgs(args, {
|
|
531
|
+
objectSet: resolveInterfaceObjectSet(objectSet, interfaceType.apiName, args),
|
|
532
|
+
select: args?.$select ?? [],
|
|
533
|
+
excludeRid: !args?.$includeRid
|
|
534
|
+
}), {
|
|
535
|
+
preview: true
|
|
536
|
+
});
|
|
537
|
+
return Promise.resolve({
|
|
538
|
+
data: await client.objectFactory2(client, result.data, interfaceType.apiName, {}, !args.$includeRid, args.$select, false, result.interfaceToObjectTypeMappings),
|
|
539
|
+
nextPageToken: result.nextPageToken,
|
|
540
|
+
totalCount: result.totalCount
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
async function fetchPageInternal(client, objectType, objectSet, args = {}) {
|
|
544
|
+
if (objectType.type === "interface") {
|
|
545
|
+
return await fetchInterfacePage(client, objectType, args, objectSet);
|
|
546
|
+
} else {
|
|
547
|
+
return await fetchObjectPage(client, objectType, args, objectSet);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
async function fetchPageWithErrorsInternal(client, objectType, objectSet, args = {}) {
|
|
551
|
+
try {
|
|
552
|
+
const result = await fetchPageInternal(client, objectType, objectSet, args);
|
|
553
|
+
return {
|
|
554
|
+
value: result
|
|
555
|
+
};
|
|
556
|
+
} catch (e) {
|
|
557
|
+
if (e instanceof Error) {
|
|
558
|
+
return {
|
|
559
|
+
error: e
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
return {
|
|
563
|
+
error: e
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
async function fetchPage(client, objectType, args, objectSet = resolveBaseObjectSetType(objectType)) {
|
|
568
|
+
return fetchPageInternal(client, objectType, objectSet, args);
|
|
569
|
+
}
|
|
570
|
+
function applyFetchArgs(args, body) {
|
|
571
|
+
if (args?.$nextPageToken) {
|
|
572
|
+
body.pageToken = args.$nextPageToken;
|
|
573
|
+
}
|
|
574
|
+
if (args?.$pageSize != null) {
|
|
575
|
+
body.pageSize = args.$pageSize;
|
|
576
|
+
}
|
|
577
|
+
if (args?.$orderBy != null) {
|
|
578
|
+
body.orderBy = {
|
|
579
|
+
fields: Object.entries(args.$orderBy).map(([field, direction]) => ({
|
|
580
|
+
field,
|
|
581
|
+
direction
|
|
582
|
+
}))
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
return body;
|
|
586
|
+
}
|
|
587
|
+
async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
588
|
+
const r = await OntologyObjectSet_exports.load(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
|
|
589
|
+
objectSet,
|
|
590
|
+
// We have to do the following case because LoadObjectSetRequestV2 isn't readonly
|
|
591
|
+
select: args?.$select ?? [],
|
|
592
|
+
// FIXME?
|
|
593
|
+
excludeRid: !args?.$includeRid
|
|
594
|
+
}));
|
|
595
|
+
return Promise.resolve({
|
|
596
|
+
data: await client.objectFactory(client, r.data, void 0, void 0, await extractRdpDefinition(client, objectSet), args.$select),
|
|
597
|
+
nextPageToken: r.nextPageToken,
|
|
598
|
+
totalCount: r.totalCount
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// src/Client.ts
|
|
603
|
+
var additionalContext = Symbol("additionalContext");
|
|
604
|
+
|
|
14
605
|
// src/public-utils/hydrateAttachmentFromRid.ts
|
|
15
606
|
function hydrateAttachmentFromRid(client, rid) {
|
|
16
|
-
return hydrateAttachmentFromRidInternal(client[
|
|
607
|
+
return hydrateAttachmentFromRidInternal(client[additionalContext], rid);
|
|
17
608
|
}
|
|
18
609
|
function hydrateAttachmentFromRidInternal(client, rid) {
|
|
19
610
|
return {
|
|
20
611
|
rid,
|
|
21
612
|
async fetchContents() {
|
|
22
|
-
return
|
|
613
|
+
return Attachment_exports.read(client, rid);
|
|
23
614
|
},
|
|
24
615
|
async fetchMetadata() {
|
|
25
|
-
const r = await
|
|
616
|
+
const r = await Attachment_exports.get(client, rid);
|
|
26
617
|
return {
|
|
27
618
|
...r,
|
|
28
619
|
sizeBytes: Number(r.sizeBytes)
|
|
@@ -66,7 +657,7 @@ var BaseLogger = class {
|
|
|
66
657
|
...this.bindings,
|
|
67
658
|
...bindings
|
|
68
659
|
}, {
|
|
69
|
-
level:
|
|
660
|
+
level: options?.level ?? this.options?.level,
|
|
70
661
|
msgPrefix: [this.options?.msgPrefix, options?.msgPrefix].filter((x) => x).join(" ")
|
|
71
662
|
});
|
|
72
663
|
}
|
|
@@ -98,7 +689,7 @@ var MinimalLogger = class _MinimalLogger extends BaseLogger {
|
|
|
98
689
|
}
|
|
99
690
|
};
|
|
100
691
|
async function fetchSingle(client, objectType, args, objectSet) {
|
|
101
|
-
const result = await
|
|
692
|
+
const result = await fetchPage(client, objectType, {
|
|
102
693
|
...args,
|
|
103
694
|
$pageSize: 1
|
|
104
695
|
}, objectSet);
|
|
@@ -193,7 +784,7 @@ function makeGeoFilterPolygon(coordinates, filterType, propertyIdentifier, field
|
|
|
193
784
|
};
|
|
194
785
|
}
|
|
195
786
|
function handleWherePair([fieldName, filter], objectOrInterface, structFieldSelector) {
|
|
196
|
-
!(filter != null) ? process.env.NODE_ENV !== "production" ?
|
|
787
|
+
!(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
788
|
const propertyIdentifier = structFieldSelector != null ? {
|
|
198
789
|
type: "structField",
|
|
199
790
|
...structFieldSelector,
|
|
@@ -212,10 +803,10 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
|
|
|
212
803
|
}
|
|
213
804
|
const keysOfFilter = Object.keys(filter);
|
|
214
805
|
const hasDollarSign = keysOfFilter.some((key) => key.startsWith("$"));
|
|
215
|
-
!(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
806
|
+
!(!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
807
|
if (!hasDollarSign) {
|
|
217
808
|
const structFilter = Object.entries(filter);
|
|
218
|
-
!(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
809
|
+
!(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
810
|
const structFieldApiName = keysOfFilter[0];
|
|
220
811
|
return handleWherePair(Object.entries(filter)[0], objectOrInterface, {
|
|
221
812
|
propertyApiName: fieldName,
|
|
@@ -223,7 +814,7 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
|
|
|
223
814
|
});
|
|
224
815
|
}
|
|
225
816
|
const firstKey = keysOfFilter[0];
|
|
226
|
-
!(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ?
|
|
817
|
+
!(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false) : invariant4__default.default(false) : void 0;
|
|
227
818
|
if (firstKey === "$ne") {
|
|
228
819
|
return {
|
|
229
820
|
type: "not",
|
|
@@ -371,12 +962,12 @@ function derivedPropertyDefinitionFactory(wireDefinition, definitionMap) {
|
|
|
371
962
|
var getDefinitionFromMap = (arg, definitionMap) => {
|
|
372
963
|
if (typeof arg === "object") {
|
|
373
964
|
const definition = definitionMap.get(arg);
|
|
374
|
-
!definition ? process.env.NODE_ENV !== "production" ?
|
|
965
|
+
!definition ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Derived Property is not defined") : invariant4__default.default(false) : void 0;
|
|
375
966
|
return definition;
|
|
376
967
|
} else if (typeof arg === "number") {
|
|
377
|
-
process.env.NODE_ENV !== "production" ?
|
|
968
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Literals for derived properties are not yet supported") : invariant4__default.default(false) ;
|
|
378
969
|
}
|
|
379
|
-
process.env.NODE_ENV !== "production" ?
|
|
970
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Invalid argument type for a derived property") : invariant4__default.default(false) ;
|
|
380
971
|
};
|
|
381
972
|
|
|
382
973
|
// src/derivedProperties/createWithPropertiesObjectSet.ts
|
|
@@ -398,7 +989,7 @@ function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fro
|
|
|
398
989
|
},
|
|
399
990
|
aggregate: (aggregation, opt) => {
|
|
400
991
|
const splitAggregation = aggregation.split(":");
|
|
401
|
-
!(splitAggregation.length === 2 || splitAggregation[0] === "$count") ? process.env.NODE_ENV !== "production" ?
|
|
992
|
+
!(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
993
|
const [aggregationPropertyName, aggregationOperation] = splitAggregation;
|
|
403
994
|
let aggregationOperationDefinition;
|
|
404
995
|
switch (aggregationOperation) {
|
|
@@ -436,7 +1027,7 @@ function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fro
|
|
|
436
1027
|
break;
|
|
437
1028
|
}
|
|
438
1029
|
default:
|
|
439
|
-
process.env.NODE_ENV !== "production" ?
|
|
1030
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Invalid aggregation operation " + aggregationOperation) : invariant4__default.default(false) ;
|
|
440
1031
|
}
|
|
441
1032
|
const wrappedObjectSet = {
|
|
442
1033
|
type: "selection",
|
|
@@ -471,19 +1062,19 @@ function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fro
|
|
|
471
1062
|
},
|
|
472
1063
|
constant: {
|
|
473
1064
|
double: (value) => {
|
|
474
|
-
process.env.NODE_ENV !== "production" ?
|
|
1065
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
475
1066
|
},
|
|
476
1067
|
integer: (value) => {
|
|
477
|
-
process.env.NODE_ENV !== "production" ?
|
|
1068
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
478
1069
|
},
|
|
479
1070
|
long: (value) => {
|
|
480
|
-
process.env.NODE_ENV !== "production" ?
|
|
1071
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
481
1072
|
},
|
|
482
1073
|
datetime: (value) => {
|
|
483
|
-
process.env.NODE_ENV !== "production" ?
|
|
1074
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
484
1075
|
},
|
|
485
1076
|
timestamp: (value) => {
|
|
486
|
-
process.env.NODE_ENV !== "production" ?
|
|
1077
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Not supported") : invariant4__default.default(false) ;
|
|
487
1078
|
}
|
|
488
1079
|
}
|
|
489
1080
|
};
|
|
@@ -494,7 +1085,7 @@ function legacyToModernSingleAggregationResult(entry) {
|
|
|
494
1085
|
if (parts[0] === "count") {
|
|
495
1086
|
return accumulator;
|
|
496
1087
|
}
|
|
497
|
-
!(parts.length === 2) ? process.env.NODE_ENV !== "production" ?
|
|
1088
|
+
!(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
1089
|
const property = parts[0];
|
|
499
1090
|
const metricType = parts[1];
|
|
500
1091
|
if (!(property in accumulator)) {
|
|
@@ -580,21 +1171,21 @@ function convertRange(range) {
|
|
|
580
1171
|
}
|
|
581
1172
|
|
|
582
1173
|
// src/object/aggregate.ts
|
|
583
|
-
async function
|
|
584
|
-
|
|
1174
|
+
async function aggregate3(clientCtx, objectType, objectSet = resolveBaseObjectSetType(objectType), req) {
|
|
1175
|
+
resolveBaseObjectSetType(objectType);
|
|
585
1176
|
const body = {
|
|
586
1177
|
aggregation: modernToLegacyAggregationClause(req.$select),
|
|
587
1178
|
groupBy: []};
|
|
588
1179
|
if (req.$groupBy) {
|
|
589
1180
|
body.groupBy = modernToLegacyGroupByClause(req.$groupBy);
|
|
590
1181
|
}
|
|
591
|
-
const result = await
|
|
1182
|
+
const result = await OntologyObjectSet_exports.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {
|
|
592
1183
|
objectSet,
|
|
593
1184
|
groupBy: body.groupBy,
|
|
594
1185
|
aggregation: body.aggregation
|
|
595
1186
|
});
|
|
596
1187
|
if (!req.$groupBy) {
|
|
597
|
-
!(result.data.length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
1188
|
+
!(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
1189
|
return {
|
|
599
1190
|
...aggregationToCountResult(result.data[0]),
|
|
600
1191
|
...legacyToModernSingleAggregationResult(result.data[0])
|
|
@@ -620,11 +1211,11 @@ function aggregationToCountResult(entry) {
|
|
|
620
1211
|
}
|
|
621
1212
|
|
|
622
1213
|
// src/util/augmentRequestContext.ts
|
|
623
|
-
var augmentRequestContext = (client,
|
|
1214
|
+
var augmentRequestContext = (client, augment2) => ({
|
|
624
1215
|
...client,
|
|
625
1216
|
requestContext: {
|
|
626
1217
|
...client.requestContext,
|
|
627
|
-
...
|
|
1218
|
+
...augment2(client.requestContext)
|
|
628
1219
|
}
|
|
629
1220
|
});
|
|
630
1221
|
|
|
@@ -690,7 +1281,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
690
1281
|
this.#logger = client.logger?.child({}, {
|
|
691
1282
|
msgPrefix: "<OSW> "
|
|
692
1283
|
});
|
|
693
|
-
!(client.baseUrl.startsWith("https://") || client.baseUrl.startsWith("http://")) ? process.env.NODE_ENV !== "production" ?
|
|
1284
|
+
!(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
1285
|
}
|
|
695
1286
|
async subscribe(objectType, objectSet, listener, properties = []) {
|
|
696
1287
|
const objOrInterfaceDef = objectType.type === "object" ? await this.#client.ontologyProvider.getObjectDefinition(objectType.apiName) : await this.#client.ontologyProvider.getInterfaceDefinition(objectType.apiName);
|
|
@@ -872,7 +1463,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
872
1463
|
return;
|
|
873
1464
|
}
|
|
874
1465
|
default:
|
|
875
|
-
process.env.NODE_ENV !== "production" ?
|
|
1466
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Unexpected message type") : invariant4__default.default(false) ;
|
|
876
1467
|
}
|
|
877
1468
|
};
|
|
878
1469
|
#handleMessage_objectSetChanged = async (payload) => {
|
|
@@ -937,7 +1528,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
937
1528
|
}
|
|
938
1529
|
#handleMessage_refreshObjectSet = (payload) => {
|
|
939
1530
|
const sub = this.#subscriptions.get(payload.id);
|
|
940
|
-
!sub ? process.env.NODE_ENV !== "production" ?
|
|
1531
|
+
!sub ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Expected subscription id ${payload.id}`) : invariant4__default.default(false) : void 0;
|
|
941
1532
|
try {
|
|
942
1533
|
sub.listener.onOutOfDate();
|
|
943
1534
|
} catch (error) {
|
|
@@ -951,7 +1542,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
951
1542
|
responses
|
|
952
1543
|
} = payload;
|
|
953
1544
|
const subs = this.#pendingSubscriptions.get(id);
|
|
954
|
-
!subs ? process.env.NODE_ENV !== "production" ?
|
|
1545
|
+
!subs ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `should have a pending subscription for ${id}`) : invariant4__default.default(false) : void 0;
|
|
955
1546
|
this.#pendingSubscriptions.delete(id);
|
|
956
1547
|
for (let i = 0; i < responses.length; i++) {
|
|
957
1548
|
const sub = subs[i];
|
|
@@ -993,7 +1584,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
993
1584
|
#handleMessage_subscriptionClosed(payload) {
|
|
994
1585
|
const sub = this.#subscriptions.get(payload.id);
|
|
995
1586
|
if (sub == null && this.#endedSubscriptions.has(payload.id)) return;
|
|
996
|
-
!sub ? process.env.NODE_ENV !== "production" ?
|
|
1587
|
+
!sub ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Expected subscription id ${payload.id}`) : invariant4__default.default(false) : void 0;
|
|
997
1588
|
this.#tryCatchOnError(sub, true, payload.cause);
|
|
998
1589
|
this.#unsubscribe(sub, "error");
|
|
999
1590
|
}
|
|
@@ -1018,7 +1609,7 @@ var ObjectSetListenerWebsocket = class _ObjectSetListenerWebsocket {
|
|
|
1018
1609
|
if (this.#subscriptions.size > 0) {
|
|
1019
1610
|
if (process.env.NODE_ENV !== "production") {
|
|
1020
1611
|
for (const s of this.#subscriptions.values()) {
|
|
1021
|
-
!(s.status !== "done" && s.status !== "error") ? process.env.NODE_ENV !== "production" ?
|
|
1612
|
+
!(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
1613
|
}
|
|
1023
1614
|
}
|
|
1024
1615
|
for (const s of this.#subscriptions.values()) {
|
|
@@ -1067,15 +1658,15 @@ function getWireObjectSet(objectSet) {
|
|
|
1067
1658
|
return objectSetDefinitions.get(objectSet);
|
|
1068
1659
|
}
|
|
1069
1660
|
var objectSetDefinitions = /* @__PURE__ */ new WeakMap();
|
|
1070
|
-
function createObjectSet(objectType, clientCtx, objectSet =
|
|
1661
|
+
function createObjectSet(objectType, clientCtx, objectSet = resolveBaseObjectSetType(objectType)) {
|
|
1071
1662
|
const base = {
|
|
1072
|
-
aggregate:
|
|
1663
|
+
aggregate: aggregate3.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1073
1664
|
finalMethodCall: "aggregate"
|
|
1074
1665
|
})), objectType, objectSet),
|
|
1075
|
-
fetchPage:
|
|
1666
|
+
fetchPage: fetchPageInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1076
1667
|
finalMethodCall: "fetchPage"
|
|
1077
1668
|
})), objectType, objectSet),
|
|
1078
|
-
fetchPageWithErrors:
|
|
1669
|
+
fetchPageWithErrors: fetchPageWithErrorsInternal.bind(globalThis, augmentRequestContext(clientCtx, (_) => ({
|
|
1079
1670
|
finalMethodCall: "fetchPageWithErrors"
|
|
1080
1671
|
})), objectType, objectSet),
|
|
1081
1672
|
where: (clause) => {
|
|
@@ -1109,7 +1700,7 @@ function createObjectSet(objectType, clientCtx, objectSet = chunkC5D7744G_cjs.re
|
|
|
1109
1700
|
asyncIter: async function* (args) {
|
|
1110
1701
|
let $nextPageToken = void 0;
|
|
1111
1702
|
do {
|
|
1112
|
-
const result = await
|
|
1703
|
+
const result = await fetchPageInternal(augmentRequestContext(clientCtx, (_) => ({
|
|
1113
1704
|
finalMethodCall: "asyncIter"
|
|
1114
1705
|
})), objectType, objectSet, {
|
|
1115
1706
|
...args,
|
|
@@ -1183,11 +1774,26 @@ async function createWithPk(clientCtx, objectType, objectSet, primaryKey) {
|
|
|
1183
1774
|
return withPk;
|
|
1184
1775
|
}
|
|
1185
1776
|
|
|
1777
|
+
exports.ActionTypeV2_exports = ActionTypeV2_exports;
|
|
1778
|
+
exports.Action_exports = Action_exports;
|
|
1779
|
+
exports.Attachment_exports = Attachment_exports;
|
|
1186
1780
|
exports.BaseLogger = BaseLogger;
|
|
1781
|
+
exports.MediaReferenceProperty_exports = MediaReferenceProperty_exports;
|
|
1187
1782
|
exports.MinimalLogger = MinimalLogger;
|
|
1783
|
+
exports.ObjectTypeV2_exports = ObjectTypeV2_exports;
|
|
1784
|
+
exports.OntologyInterface_exports = OntologyInterface_exports;
|
|
1785
|
+
exports.OntologyObjectSet_exports = OntologyObjectSet_exports;
|
|
1786
|
+
exports.QueryType_exports = QueryType_exports;
|
|
1787
|
+
exports.Query_exports = Query_exports;
|
|
1788
|
+
exports.TimeSeriesPropertyV2_exports = TimeSeriesPropertyV2_exports;
|
|
1789
|
+
exports.TimeSeriesValueBankProperty_exports = TimeSeriesValueBankProperty_exports;
|
|
1790
|
+
exports.addUserAgentAndRequestContextHeaders = addUserAgentAndRequestContextHeaders;
|
|
1791
|
+
exports.additionalContext = additionalContext;
|
|
1792
|
+
exports.augment = augment;
|
|
1188
1793
|
exports.augmentRequestContext = augmentRequestContext;
|
|
1189
1794
|
exports.createObjectSet = createObjectSet;
|
|
1190
1795
|
exports.extractNamespace = extractNamespace;
|
|
1796
|
+
exports.fetchPage = fetchPage;
|
|
1191
1797
|
exports.fetchSingle = fetchSingle;
|
|
1192
1798
|
exports.fetchSingleWithErrors = fetchSingleWithErrors;
|
|
1193
1799
|
exports.getWireObjectSet = getWireObjectSet;
|
|
@@ -1195,5 +1801,6 @@ exports.hydrateAttachmentFromRid = hydrateAttachmentFromRid;
|
|
|
1195
1801
|
exports.hydrateAttachmentFromRidInternal = hydrateAttachmentFromRidInternal;
|
|
1196
1802
|
exports.isObjectSet = isObjectSet;
|
|
1197
1803
|
exports.isWireObjectSet = isWireObjectSet;
|
|
1198
|
-
|
|
1199
|
-
//# sourceMappingURL=chunk-
|
|
1804
|
+
exports.symbolClientContext = symbolClientContext;
|
|
1805
|
+
//# sourceMappingURL=chunk-HTPVXLYY.cjs.map
|
|
1806
|
+
//# sourceMappingURL=chunk-HTPVXLYY.cjs.map
|