@telemetryos/root-sdk 1.14.0 → 1.16.0
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 +38 -0
- package/dist/applications.d.ts +102 -23
- package/dist/client.d.ts +12 -2
- package/dist/dependency-store.d.ts +103 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1748 -1544
- package/dist/media.d.ts +0 -6
- package/dist/store.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
version:
|
|
1
|
+
const He = "1.16.0", Le = {
|
|
2
|
+
version: He
|
|
3
3
|
};
|
|
4
|
-
class
|
|
4
|
+
class De {
|
|
5
5
|
constructor(e) {
|
|
6
6
|
this._client = e;
|
|
7
7
|
}
|
|
@@ -20,10 +20,32 @@ class Le {
|
|
|
20
20
|
return e.account;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
class
|
|
23
|
+
class Ve {
|
|
24
24
|
constructor(e) {
|
|
25
25
|
this._client = e;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve a single application by its id.
|
|
29
|
+
*
|
|
30
|
+
* @param applicationId The unique identifier of the application to retrieve
|
|
31
|
+
* @returns A promise that resolves to the application data
|
|
32
|
+
*/
|
|
33
|
+
async getById(e) {
|
|
34
|
+
return (await this._client.request("applications.getById", {
|
|
35
|
+
applicationId: e
|
|
36
|
+
})).application;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves a single application by specifier
|
|
40
|
+
*
|
|
41
|
+
* @param applicationSpecifier The unique specifier of the application to retrieve
|
|
42
|
+
* @returns A promise that resolves to the application data
|
|
43
|
+
*/
|
|
44
|
+
async getBySpecifier(e) {
|
|
45
|
+
return (await this._client.request("applications.getBySpecifier", {
|
|
46
|
+
applicationSpecifier: e
|
|
47
|
+
})).application;
|
|
48
|
+
}
|
|
27
49
|
/**
|
|
28
50
|
* Retrieves all applications with a specific mount point within the current account.
|
|
29
51
|
*
|
|
@@ -42,21 +64,6 @@ class He {
|
|
|
42
64
|
mountPoint: e
|
|
43
65
|
})).applications;
|
|
44
66
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves an application by its name.
|
|
47
|
-
*
|
|
48
|
-
* This method allows finding a specific application when you know its name. It's useful
|
|
49
|
-
* when you need to check if a particular application is available or get its details
|
|
50
|
-
* before attempting to embed it.
|
|
51
|
-
*
|
|
52
|
-
* @param name The name of the application to query for
|
|
53
|
-
* @returns A promise that resolves to the application object if found, or null if not found
|
|
54
|
-
*/
|
|
55
|
-
async getByName(e) {
|
|
56
|
-
return (await this._client.request("applications.getByName", {
|
|
57
|
-
name: e
|
|
58
|
-
})).application;
|
|
59
|
-
}
|
|
60
67
|
/**
|
|
61
68
|
* Sets the dependencies for the current application.
|
|
62
69
|
*
|
|
@@ -64,20 +71,24 @@ class He {
|
|
|
64
71
|
* The player will download and prepare these dependencies before they can be loaded.
|
|
65
72
|
*
|
|
66
73
|
* IMPORTANT: This method must be called and awaited before loading any sub-applications
|
|
67
|
-
* in iframes.
|
|
74
|
+
* in iframes.
|
|
68
75
|
*
|
|
69
|
-
* @param applicationSpecifiers
|
|
70
|
-
* @returns A
|
|
76
|
+
* @param applicationSpecifiers A map of application specifier to an array of instance IDs
|
|
77
|
+
* @returns A function that returns a {@link DependencyHandle} for a given specifier and instance ID
|
|
71
78
|
*
|
|
72
79
|
* @example
|
|
73
80
|
* ```typescript
|
|
74
|
-
* const
|
|
75
|
-
*
|
|
76
|
-
*
|
|
81
|
+
* const getHandle = await applications().setDependencies({
|
|
82
|
+
* 'app1-specifier-hash': ['instance-1', 'instance-2'],
|
|
83
|
+
* 'app2-specifier-hash': ['instance-1'],
|
|
84
|
+
* })
|
|
85
|
+
* const handle = getHandle('app1-specifier-hash', 'instance-1')
|
|
86
|
+
* handle.onStatus((status) => console.log(status))
|
|
87
|
+
* const iframe = await handle.frame()
|
|
77
88
|
* ```
|
|
78
89
|
*/
|
|
79
90
|
async setDependencies(e) {
|
|
80
|
-
return await this._client.
|
|
91
|
+
return await this._client._dependencyStore.setDependencies(e), (t, s) => this._client._dependencyStore.handleFor(t, s);
|
|
81
92
|
}
|
|
82
93
|
/**
|
|
83
94
|
* Registers a message interceptor for client messages from sub-applications.
|
|
@@ -116,64 +127,6 @@ class He {
|
|
|
116
127
|
}
|
|
117
128
|
}
|
|
118
129
|
class ze {
|
|
119
|
-
constructor(e) {
|
|
120
|
-
this._client = e;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Retrieves hardware information about the current physical device.
|
|
124
|
-
*
|
|
125
|
-
* This method returns details about the device running the application, such as
|
|
126
|
-
* serial number, model, manufacturer, and platform. This information is only
|
|
127
|
-
* available when running on a physical device (player), not in the admin UI.
|
|
128
|
-
*
|
|
129
|
-
* @returns A promise that resolves to the device hardware information
|
|
130
|
-
* @example
|
|
131
|
-
* // Get hardware info of the current device
|
|
132
|
-
* const info = await devices.getInformation();
|
|
133
|
-
* console.log(`Device: ${info.deviceManufacturer} ${info.deviceModel}`);
|
|
134
|
-
*/
|
|
135
|
-
async getInformation() {
|
|
136
|
-
const e = await this._client.request("devices.getInformation", {});
|
|
137
|
-
if (!e.success)
|
|
138
|
-
throw new Error("Failed to get device information");
|
|
139
|
-
return e.deviceInformation;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Retrieves the capabilities of the current device.
|
|
143
|
-
*
|
|
144
|
-
* Capabilities indicate what hardware and software features are available on
|
|
145
|
-
* the device running the application. This can be used to conditionally enable
|
|
146
|
-
* features based on what the device supports (e.g., MQTT, Bluetooth, WiFi).
|
|
147
|
-
*
|
|
148
|
-
* @returns A promise that resolves to an array of device capability strings
|
|
149
|
-
* @example
|
|
150
|
-
* const capabilities = await devices.getCapabilities();
|
|
151
|
-
* if (capabilities.includes('mqtt')) {
|
|
152
|
-
* // Enable MQTT features
|
|
153
|
-
* }
|
|
154
|
-
*/
|
|
155
|
-
async getCapabilities() {
|
|
156
|
-
const e = await this._client.request("devices.getCapabilities", {});
|
|
157
|
-
if (!e.success)
|
|
158
|
-
throw new Error("Failed to get device capabilities");
|
|
159
|
-
return e.capabilities;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
class De {
|
|
163
|
-
constructor(e) {
|
|
164
|
-
this._client = e;
|
|
165
|
-
}
|
|
166
|
-
async getColorScheme() {
|
|
167
|
-
return (await this._client.request("environment.getColorScheme", {})).colorScheme;
|
|
168
|
-
}
|
|
169
|
-
async subscribeColorScheme(e) {
|
|
170
|
-
return (await this._client.subscribe("environment.subscribeColorScheme", {}, e)).success;
|
|
171
|
-
}
|
|
172
|
-
async unsubscribeColorScheme(e) {
|
|
173
|
-
return (await this._client.unsubscribe("environment.unsubscribeColorScheme", {}, e)).success;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
class Ve {
|
|
177
130
|
constructor(e) {
|
|
178
131
|
this._client = e;
|
|
179
132
|
}
|
|
@@ -232,695 +185,195 @@ class Ve {
|
|
|
232
185
|
})).selection;
|
|
233
186
|
}
|
|
234
187
|
}
|
|
235
|
-
|
|
188
|
+
var b;
|
|
189
|
+
(function(i) {
|
|
190
|
+
i.assertEqual = (n) => {
|
|
191
|
+
};
|
|
192
|
+
function e(n) {
|
|
193
|
+
}
|
|
194
|
+
i.assertIs = e;
|
|
195
|
+
function t(n) {
|
|
196
|
+
throw new Error();
|
|
197
|
+
}
|
|
198
|
+
i.assertNever = t, i.arrayToEnum = (n) => {
|
|
199
|
+
const a = {};
|
|
200
|
+
for (const r of n)
|
|
201
|
+
a[r] = r;
|
|
202
|
+
return a;
|
|
203
|
+
}, i.getValidEnumValues = (n) => {
|
|
204
|
+
const a = i.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), r = {};
|
|
205
|
+
for (const o of a)
|
|
206
|
+
r[o] = n[o];
|
|
207
|
+
return i.objectValues(r);
|
|
208
|
+
}, i.objectValues = (n) => i.objectKeys(n).map(function(a) {
|
|
209
|
+
return n[a];
|
|
210
|
+
}), i.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
211
|
+
const a = [];
|
|
212
|
+
for (const r in n)
|
|
213
|
+
Object.prototype.hasOwnProperty.call(n, r) && a.push(r);
|
|
214
|
+
return a;
|
|
215
|
+
}, i.find = (n, a) => {
|
|
216
|
+
for (const r of n)
|
|
217
|
+
if (a(r))
|
|
218
|
+
return r;
|
|
219
|
+
}, i.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n;
|
|
220
|
+
function s(n, a = " | ") {
|
|
221
|
+
return n.map((r) => typeof r == "string" ? `'${r}'` : r).join(a);
|
|
222
|
+
}
|
|
223
|
+
i.joinValues = s, i.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
224
|
+
})(b || (b = {}));
|
|
225
|
+
var ye;
|
|
226
|
+
(function(i) {
|
|
227
|
+
i.mergeShapes = (e, t) => ({
|
|
228
|
+
...e,
|
|
229
|
+
...t
|
|
230
|
+
// second overwrites first
|
|
231
|
+
});
|
|
232
|
+
})(ye || (ye = {}));
|
|
233
|
+
const h = b.arrayToEnum([
|
|
234
|
+
"string",
|
|
235
|
+
"nan",
|
|
236
|
+
"number",
|
|
237
|
+
"integer",
|
|
238
|
+
"float",
|
|
239
|
+
"boolean",
|
|
240
|
+
"date",
|
|
241
|
+
"bigint",
|
|
242
|
+
"symbol",
|
|
243
|
+
"function",
|
|
244
|
+
"undefined",
|
|
245
|
+
"null",
|
|
246
|
+
"array",
|
|
247
|
+
"object",
|
|
248
|
+
"unknown",
|
|
249
|
+
"promise",
|
|
250
|
+
"void",
|
|
251
|
+
"never",
|
|
252
|
+
"map",
|
|
253
|
+
"set"
|
|
254
|
+
]), A = (i) => {
|
|
255
|
+
switch (typeof i) {
|
|
256
|
+
case "undefined":
|
|
257
|
+
return h.undefined;
|
|
258
|
+
case "string":
|
|
259
|
+
return h.string;
|
|
260
|
+
case "number":
|
|
261
|
+
return Number.isNaN(i) ? h.nan : h.number;
|
|
262
|
+
case "boolean":
|
|
263
|
+
return h.boolean;
|
|
264
|
+
case "function":
|
|
265
|
+
return h.function;
|
|
266
|
+
case "bigint":
|
|
267
|
+
return h.bigint;
|
|
268
|
+
case "symbol":
|
|
269
|
+
return h.symbol;
|
|
270
|
+
case "object":
|
|
271
|
+
return Array.isArray(i) ? h.array : i === null ? h.null : i.then && typeof i.then == "function" && i.catch && typeof i.catch == "function" ? h.promise : typeof Map < "u" && i instanceof Map ? h.map : typeof Set < "u" && i instanceof Set ? h.set : typeof Date < "u" && i instanceof Date ? h.date : h.object;
|
|
272
|
+
default:
|
|
273
|
+
return h.unknown;
|
|
274
|
+
}
|
|
275
|
+
}, d = b.arrayToEnum([
|
|
276
|
+
"invalid_type",
|
|
277
|
+
"invalid_literal",
|
|
278
|
+
"custom",
|
|
279
|
+
"invalid_union",
|
|
280
|
+
"invalid_union_discriminator",
|
|
281
|
+
"invalid_enum_value",
|
|
282
|
+
"unrecognized_keys",
|
|
283
|
+
"invalid_arguments",
|
|
284
|
+
"invalid_return_type",
|
|
285
|
+
"invalid_date",
|
|
286
|
+
"invalid_string",
|
|
287
|
+
"too_small",
|
|
288
|
+
"too_big",
|
|
289
|
+
"invalid_intersection_types",
|
|
290
|
+
"not_multiple_of",
|
|
291
|
+
"not_finite"
|
|
292
|
+
]);
|
|
293
|
+
class N extends Error {
|
|
294
|
+
get errors() {
|
|
295
|
+
return this.issues;
|
|
296
|
+
}
|
|
236
297
|
constructor(e) {
|
|
237
|
-
this.
|
|
298
|
+
super(), this.issues = [], this.addIssue = (s) => {
|
|
299
|
+
this.issues = [...this.issues, s];
|
|
300
|
+
}, this.addIssues = (s = []) => {
|
|
301
|
+
this.issues = [...this.issues, ...s];
|
|
302
|
+
};
|
|
303
|
+
const t = new.target.prototype;
|
|
304
|
+
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
238
305
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
url: n,
|
|
260
|
-
method: (t == null ? void 0 : t.method) || "GET",
|
|
261
|
-
headers: r,
|
|
262
|
-
body: (s = t == null ? void 0 : t.body) !== null && s !== void 0 ? s : null
|
|
263
|
-
});
|
|
264
|
-
if (!i.success)
|
|
265
|
-
throw new TypeError(i.errorMessage, {
|
|
266
|
-
cause: i.errorCause ? Error(i.errorCause) : void 0
|
|
267
|
-
});
|
|
268
|
-
const o = new Headers(i.headers), c = {
|
|
269
|
-
status: i.status,
|
|
270
|
-
statusText: i.statusText,
|
|
271
|
-
headers: o
|
|
306
|
+
format(e) {
|
|
307
|
+
const t = e || function(a) {
|
|
308
|
+
return a.message;
|
|
309
|
+
}, s = { _errors: [] }, n = (a) => {
|
|
310
|
+
for (const r of a.issues)
|
|
311
|
+
if (r.code === "invalid_union")
|
|
312
|
+
r.unionErrors.map(n);
|
|
313
|
+
else if (r.code === "invalid_return_type")
|
|
314
|
+
n(r.returnTypeError);
|
|
315
|
+
else if (r.code === "invalid_arguments")
|
|
316
|
+
n(r.argumentsError);
|
|
317
|
+
else if (r.path.length === 0)
|
|
318
|
+
s._errors.push(t(r));
|
|
319
|
+
else {
|
|
320
|
+
let o = s, c = 0;
|
|
321
|
+
for (; c < r.path.length; ) {
|
|
322
|
+
const l = r.path[c];
|
|
323
|
+
c === r.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(t(r))) : o[l] = o[l] || { _errors: [] }, o = o[l], c++;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
272
326
|
};
|
|
273
|
-
|
|
274
|
-
if (i.body !== null && i.body !== void 0)
|
|
275
|
-
if (i.bodyType === "binary") {
|
|
276
|
-
const g = atob(i.body), w = new Uint8Array(g.length);
|
|
277
|
-
for (let T = 0; T < g.length; T++)
|
|
278
|
-
w[T] = g.charCodeAt(T);
|
|
279
|
-
l = w;
|
|
280
|
-
} else i.bodyType === "text" ? l = i.body : i.bodyType === "json" && (l = JSON.stringify(i.body));
|
|
281
|
-
return new Response(l, c);
|
|
327
|
+
return n(this), s;
|
|
282
328
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
this._client = e;
|
|
329
|
+
static assert(e) {
|
|
330
|
+
if (!(e instanceof N))
|
|
331
|
+
throw new Error(`Not a ZodError: ${e}`);
|
|
287
332
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
*
|
|
291
|
-
* Data stored in the application scope is shared across all instances of your application
|
|
292
|
-
* within the current account. Use this scope for application-wide settings, shared resources,
|
|
293
|
-
* or any data that should be consistent across all instances.
|
|
294
|
-
*
|
|
295
|
-
* @returns A StoreSlice instance for the application scope
|
|
296
|
-
*/
|
|
297
|
-
get application() {
|
|
298
|
-
return new G("application", void 0, this._client);
|
|
333
|
+
toString() {
|
|
334
|
+
return this.message;
|
|
299
335
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
*
|
|
303
|
-
* Data stored in the instance scope is only available to the current instance of your
|
|
304
|
-
* application. This is ideal for instance-specific settings, UI state, temporary data,
|
|
305
|
-
* or any information that shouldn't be shared with other instances.
|
|
306
|
-
*
|
|
307
|
-
* @returns A StoreSlice instance for the instance scope
|
|
308
|
-
*/
|
|
309
|
-
get instance() {
|
|
310
|
-
return new G("instance", this._client.applicationInstance, this._client);
|
|
336
|
+
get message() {
|
|
337
|
+
return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
|
|
311
338
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
*
|
|
315
|
-
* Data stored in the device scope is only available to the application on the
|
|
316
|
-
* current physical device. This is useful for device-specific settings, caching, or
|
|
317
|
-
* any data that should persist across application instances but only on a single device.
|
|
318
|
-
*
|
|
319
|
-
* Note: This scope cannot be used for Settings-related mount points as the User
|
|
320
|
-
* Administration UI does not run on a device.
|
|
321
|
-
*
|
|
322
|
-
* @returns A StoreSlice instance for the device scope
|
|
323
|
-
*/
|
|
324
|
-
get device() {
|
|
325
|
-
return new G("device", this._client.deviceId, this._client);
|
|
339
|
+
get isEmpty() {
|
|
340
|
+
return this.issues.length === 0;
|
|
326
341
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
*
|
|
337
|
-
* @param namespace A string identifier for the shared data space
|
|
338
|
-
* @returns A StoreSlice instance for the specified shared namespace
|
|
339
|
-
*/
|
|
340
|
-
shared(e) {
|
|
341
|
-
return new G("shared", e, this._client);
|
|
342
|
+
flatten(e = (t) => t.message) {
|
|
343
|
+
const t = {}, s = [];
|
|
344
|
+
for (const n of this.issues)
|
|
345
|
+
if (n.path.length > 0) {
|
|
346
|
+
const a = n.path[0];
|
|
347
|
+
t[a] = t[a] || [], t[a].push(e(n));
|
|
348
|
+
} else
|
|
349
|
+
s.push(e(n));
|
|
350
|
+
return { formErrors: s, fieldErrors: t };
|
|
342
351
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
constructor(e, t, s) {
|
|
346
|
-
this._kind = e, this._namespace = t, this._client = s;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Saves a value in the store.
|
|
350
|
-
*
|
|
351
|
-
* This method stores data under the specified key within the current store scope and namespace.
|
|
352
|
-
* The value must be serializable (can be converted to JSON). Complex objects like Date instances
|
|
353
|
-
* will be serialized and deserialize as regular objects, losing their prototype methods.
|
|
354
|
-
*
|
|
355
|
-
* @param key The key to save the value under
|
|
356
|
-
* @param value The value to store - must be JSON serializable
|
|
357
|
-
* @returns A promise that resolves to true if the value was saved successfully
|
|
358
|
-
*/
|
|
359
|
-
async set(e, t) {
|
|
360
|
-
return (await this._client.request("store.set", {
|
|
361
|
-
kind: this._kind,
|
|
362
|
-
namespace: this._namespace,
|
|
363
|
-
key: e,
|
|
364
|
-
value: t
|
|
365
|
-
})).success;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Retrieves a value from the store.
|
|
369
|
-
*
|
|
370
|
-
* This method fetches data stored under the specified key within the current store scope
|
|
371
|
-
* and namespace. For real-time applications that need to respond to changes, consider
|
|
372
|
-
* using subscribe() instead.
|
|
373
|
-
*
|
|
374
|
-
* @template T The expected type of the stored value
|
|
375
|
-
* @param key The key to retrieve the value for
|
|
376
|
-
* @returns A promise that resolves to the stored value, or undefined if the key does not exist
|
|
377
|
-
*/
|
|
378
|
-
async get(e) {
|
|
379
|
-
return (await this._client.request("store.get", {
|
|
380
|
-
kind: this._kind,
|
|
381
|
-
namespace: this._namespace,
|
|
382
|
-
key: e
|
|
383
|
-
})).value;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Subscribes to changes in the store for a specific key.
|
|
387
|
-
*
|
|
388
|
-
* This method sets up a subscription that will call the provided handler whenever
|
|
389
|
-
* the value associated with the specified key changes. This is the recommended way
|
|
390
|
-
* to access store data in long-running applications that need to stay responsive
|
|
391
|
-
* to data changes.
|
|
392
|
-
*
|
|
393
|
-
* @param key The key to subscribe to
|
|
394
|
-
* @param handler The callback function to call when the value changes
|
|
395
|
-
* @returns A promise that resolves to true if the subscription was successful
|
|
396
|
-
*/
|
|
397
|
-
async subscribe(e, t) {
|
|
398
|
-
return (await this._client.subscribe("store.subscribe", {
|
|
399
|
-
kind: this._kind,
|
|
400
|
-
namespace: this._namespace,
|
|
401
|
-
key: e
|
|
402
|
-
}, t)).success;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Unsubscribes from changes in the store for a specific key.
|
|
406
|
-
*
|
|
407
|
-
* This method removes a subscription previously created with subscribe(). It can
|
|
408
|
-
* either remove a specific handler or all handlers for the given key.
|
|
409
|
-
*
|
|
410
|
-
* @param key The key to unsubscribe from
|
|
411
|
-
* @param handler Optional. The specific handler to remove. If not provided, all handlers for this key will be removed.
|
|
412
|
-
* @returns A promise that resolves to true if the unsubscribe was successful
|
|
413
|
-
*/
|
|
414
|
-
async unsubscribe(e, t) {
|
|
415
|
-
return (await this._client.unsubscribe("store.unsubscribe", {
|
|
416
|
-
kind: this._kind,
|
|
417
|
-
namespace: this._namespace,
|
|
418
|
-
key: e
|
|
419
|
-
}, t)).success;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Deletes a value from the store.
|
|
423
|
-
*
|
|
424
|
-
* This method removes the data stored under the specified key within the
|
|
425
|
-
* current store scope and namespace.
|
|
426
|
-
*
|
|
427
|
-
* @param key The key to delete
|
|
428
|
-
* @returns A promise that resolves to true if the value was deleted successfully
|
|
429
|
-
*/
|
|
430
|
-
async delete(e) {
|
|
431
|
-
return (await this._client.request("store.delete", {
|
|
432
|
-
kind: this._kind,
|
|
433
|
-
namespace: this._namespace,
|
|
434
|
-
key: e
|
|
435
|
-
})).success;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
class Ke {
|
|
439
|
-
constructor(e) {
|
|
440
|
-
this._client = e;
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Retrieves information about the user associated with the current session.
|
|
444
|
-
*
|
|
445
|
-
* This method allows an application to get details about the TelemetryOS user
|
|
446
|
-
* who is currently using the application.
|
|
447
|
-
*
|
|
448
|
-
* @returns A promise that resolves to the current user result object
|
|
449
|
-
* @example
|
|
450
|
-
* // Get the current user information
|
|
451
|
-
* const userResult = await users.getCurrent();
|
|
452
|
-
* console.log(`Current user ID: ${userResult.user.id}`);
|
|
453
|
-
*/
|
|
454
|
-
async getCurrent() {
|
|
455
|
-
const e = await this._client.request("users.getCurrent", {});
|
|
456
|
-
if (!e.success)
|
|
457
|
-
throw new Error(e.error || "Failed to fetch current user");
|
|
458
|
-
return e.user;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
class We {
|
|
462
|
-
constructor(e) {
|
|
463
|
-
this._client = e;
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Searches for cities by name or country
|
|
467
|
-
*
|
|
468
|
-
* @param params - Search parameters including optional country code and search query
|
|
469
|
-
* @returns A promise that resolves to an array of matching cities
|
|
470
|
-
* @throws {Error} If the request fails
|
|
471
|
-
*
|
|
472
|
-
* @example
|
|
473
|
-
* ```typescript
|
|
474
|
-
* // Search for cities named "New York"
|
|
475
|
-
* const cities = await weather.getCities({ search: 'New York' })
|
|
476
|
-
*
|
|
477
|
-
* // Search for cities in the United States
|
|
478
|
-
* const cities = await weather.getCities({ countryCode: 'US' })
|
|
479
|
-
*
|
|
480
|
-
* // Get a cityId for use in other methods
|
|
481
|
-
* const cities = await weather.getCities({ search: 'London' })
|
|
482
|
-
* const cityId = cities[0].cityId
|
|
483
|
-
* ```
|
|
484
|
-
*/
|
|
485
|
-
async getCities(e) {
|
|
486
|
-
const t = await this._client.request("weather.getCities", e);
|
|
487
|
-
if (!t.success)
|
|
488
|
-
throw new Error(t.error || "Failed to fetch cities");
|
|
489
|
-
return t.data || [];
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Retrieves current weather conditions for a specified city
|
|
493
|
-
*
|
|
494
|
-
* @param params - Weather request parameters including cityId and optional language
|
|
495
|
-
* @returns A promise that resolves to the current weather conditions with dual units (C/F, kph/mph, etc.)
|
|
496
|
-
* @throws {Error} If the request fails or cityId is invalid
|
|
497
|
-
*
|
|
498
|
-
* @example
|
|
499
|
-
* ```typescript
|
|
500
|
-
* // Get current conditions for a city
|
|
501
|
-
* const conditions = await weather.getConditions({ cityId: 12345 })
|
|
502
|
-
*
|
|
503
|
-
* // With localized language
|
|
504
|
-
* const conditions = await weather.getConditions({
|
|
505
|
-
* cityId: 12345,
|
|
506
|
-
* language: 'es'
|
|
507
|
-
* })
|
|
508
|
-
*
|
|
509
|
-
* // Access both units
|
|
510
|
-
* console.log(`${conditions.temperatureC}°C / ${conditions.temperatureF}°F`)
|
|
511
|
-
* console.log(`${conditions.windSpeedKph} kph / ${conditions.windSpeedMph} mph`)
|
|
512
|
-
* ```
|
|
513
|
-
*/
|
|
514
|
-
async getConditions(e) {
|
|
515
|
-
const t = await this._client.request("weather.getConditions", e);
|
|
516
|
-
if (!t.success)
|
|
517
|
-
throw new Error(t.error || "Failed to fetch weather conditions");
|
|
518
|
-
return t;
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Retrieves daily weather forecast for a specified city
|
|
522
|
-
*
|
|
523
|
-
* @param params - Forecast request parameters including cityId, optional language and days
|
|
524
|
-
* @returns A promise that resolves to daily forecast data with location information
|
|
525
|
-
* @throws {Error} If the request fails or cityId is invalid
|
|
526
|
-
*
|
|
527
|
-
* @example
|
|
528
|
-
* ```typescript
|
|
529
|
-
* // Get 5-day forecast
|
|
530
|
-
* const forecast = await weather.getDailyForecast({ cityId: 12345 })
|
|
531
|
-
*
|
|
532
|
-
* // Get 10-day forecast
|
|
533
|
-
* const forecast = await weather.getDailyForecast({ cityId: 12345, days: 10 })
|
|
534
|
-
*
|
|
535
|
-
* // Access forecast data
|
|
536
|
-
* forecast.data.forEach(day => {
|
|
537
|
-
* console.log(`${day.forecastDate}: ${day.weatherDescription}`)
|
|
538
|
-
* console.log(`High: ${day.maxTemperatureC}°C, Low: ${day.minTemperatureC}°C`)
|
|
539
|
-
* })
|
|
540
|
-
* ```
|
|
541
|
-
*/
|
|
542
|
-
async getDailyForecast(e) {
|
|
543
|
-
const t = await this._client.request("weather.getDailyForecast", e);
|
|
544
|
-
if (!t.success)
|
|
545
|
-
throw new Error(t.error || "Failed to fetch daily forecast");
|
|
546
|
-
return t;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Retrieves hourly weather forecast for a specified city
|
|
550
|
-
*
|
|
551
|
-
* @param params - Forecast request parameters including cityId, optional language and hours
|
|
552
|
-
* @returns A promise that resolves to hourly forecast data with location information
|
|
553
|
-
* @throws {Error} If the request fails or cityId is invalid
|
|
554
|
-
*
|
|
555
|
-
* @example
|
|
556
|
-
* ```typescript
|
|
557
|
-
* // Get 24-hour forecast
|
|
558
|
-
* const forecast = await weather.getHourlyForecast({ cityId: 12345, hours: 24 })
|
|
559
|
-
*
|
|
560
|
-
* // Get 48-hour forecast
|
|
561
|
-
* const forecast = await weather.getHourlyForecast({ cityId: 12345, hours: 48 })
|
|
562
|
-
*
|
|
563
|
-
* // Access forecast data
|
|
564
|
-
* forecast.data.forEach(hour => {
|
|
565
|
-
* console.log(`${hour.forecastTimeLocal}: ${hour.weatherDescription}`)
|
|
566
|
-
* console.log(`Temp: ${hour.temperatureC}°C`)
|
|
567
|
-
* })
|
|
568
|
-
* ```
|
|
569
|
-
*/
|
|
570
|
-
async getHourlyForecast(e) {
|
|
571
|
-
const t = await this._client.request("weather.getHourlyForecast", e);
|
|
572
|
-
if (!t.success)
|
|
573
|
-
throw new Error(t.error || "Failed to fetch hourly forecast");
|
|
574
|
-
return t;
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Retrieves weather alerts and warnings for a specified city
|
|
578
|
-
*
|
|
579
|
-
* @param params - Alert request parameters including cityId and optional language
|
|
580
|
-
* @returns A promise that resolves to weather alerts with location information
|
|
581
|
-
* @throws {Error} If the request fails or cityId is invalid
|
|
582
|
-
*
|
|
583
|
-
* @example
|
|
584
|
-
* ```typescript
|
|
585
|
-
* // Get weather alerts for a city
|
|
586
|
-
* const alerts = await weather.getAlerts({ cityId: 12345 })
|
|
587
|
-
*
|
|
588
|
-
* // Check if there are any active alerts
|
|
589
|
-
* if (alerts.alerts.length > 0) {
|
|
590
|
-
* alerts.alerts.forEach(alert => {
|
|
591
|
-
* console.log(`${alert.severity}: ${alert.title}`)
|
|
592
|
-
* console.log(alert.description)
|
|
593
|
-
* })
|
|
594
|
-
* }
|
|
595
|
-
* ```
|
|
596
|
-
*/
|
|
597
|
-
async getAlerts(e) {
|
|
598
|
-
const t = await this._client.request("weather.getAlerts", e);
|
|
599
|
-
if (!t.success)
|
|
600
|
-
throw new Error(t.error || "Failed to fetch weather alerts");
|
|
601
|
-
return t;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
class Je {
|
|
605
|
-
constructor(e) {
|
|
606
|
-
this._client = e;
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Retrieves all available currency symbols and their full names.
|
|
610
|
-
*
|
|
611
|
-
* @returns A promise that resolves to a mapping of currency codes to their full names
|
|
612
|
-
* @throws {Error} If the request fails
|
|
613
|
-
*
|
|
614
|
-
* @example
|
|
615
|
-
* ```typescript
|
|
616
|
-
* const symbols = await currency().getSymbols()
|
|
617
|
-
* // { "USD": "United States Dollar", "EUR": "Euro", ... }
|
|
618
|
-
* ```
|
|
619
|
-
*/
|
|
620
|
-
async getSymbols() {
|
|
621
|
-
const e = await this._client.request("currency.getSymbols", {});
|
|
622
|
-
if (!e.success || !e.symbols)
|
|
623
|
-
throw new Error("Failed to fetch currency symbols");
|
|
624
|
-
return e.symbols;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Retrieves current exchange rates for a base currency against target currencies.
|
|
628
|
-
*
|
|
629
|
-
* @param params - Currency rate request parameters including base currency and target symbols
|
|
630
|
-
* @returns A promise that resolves to a mapping of currency codes to their exchange rates
|
|
631
|
-
* @throws {Error} If the request fails or currencies are invalid
|
|
632
|
-
*
|
|
633
|
-
* @example
|
|
634
|
-
* ```typescript
|
|
635
|
-
* // Get exchange rates for USD against EUR, GBP, and JPY
|
|
636
|
-
* const rates = await currency().getRates({
|
|
637
|
-
* base: 'USD',
|
|
638
|
-
* symbols: 'EUR,GBP,JPY'
|
|
639
|
-
* })
|
|
640
|
-
* // { "EUR": 0.92, "GBP": 0.79, "JPY": 149.50 }
|
|
641
|
-
* ```
|
|
642
|
-
*/
|
|
643
|
-
async getRates(e) {
|
|
644
|
-
var t, s, n;
|
|
645
|
-
const r = await this._client.request("currency.getRates", e);
|
|
646
|
-
if (!r.success || !r.rates)
|
|
647
|
-
throw ((t = r.error) === null || t === void 0 ? void 0 : t.code) === 201 ? new Error(`Invalid base currency '${e.base}'`) : ((s = r.error) === null || s === void 0 ? void 0 : s.code) === 202 ? new Error(`Invalid target currency symbol '${e.symbols}'`) : new Error(((n = r.error) === null || n === void 0 ? void 0 : n.message) || "Failed to fetch currency rates");
|
|
648
|
-
return r.rates;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
class Qe {
|
|
652
|
-
constructor(e) {
|
|
653
|
-
this._client = e;
|
|
654
|
-
}
|
|
655
|
-
async discover() {
|
|
656
|
-
const e = await this._client.request("mqtt.discover", {});
|
|
657
|
-
if (!e.success)
|
|
658
|
-
throw new Error("Failed to discover MQTT brokers");
|
|
659
|
-
return e.brokers;
|
|
660
|
-
}
|
|
661
|
-
async connect(e, t) {
|
|
662
|
-
const s = await this._client.request("mqtt.connect", {
|
|
663
|
-
brokerUrl: e,
|
|
664
|
-
...t
|
|
665
|
-
});
|
|
666
|
-
if (!s.success)
|
|
667
|
-
throw new Error("Failed to connect to MQTT broker");
|
|
668
|
-
return s.clientId;
|
|
669
|
-
}
|
|
670
|
-
async disconnect(e) {
|
|
671
|
-
if (!(await this._client.request("mqtt.disconnect", { clientId: e })).success)
|
|
672
|
-
throw new Error("Failed to disconnect from MQTT broker");
|
|
673
|
-
}
|
|
674
|
-
async publish(e, t, s, n) {
|
|
675
|
-
if (!(await this._client.request("mqtt.publish", {
|
|
676
|
-
clientId: e,
|
|
677
|
-
topic: t,
|
|
678
|
-
payload: s,
|
|
679
|
-
...n
|
|
680
|
-
})).success)
|
|
681
|
-
throw new Error("Failed to publish MQTT message");
|
|
682
|
-
}
|
|
683
|
-
async subscribe(e, t, s, n) {
|
|
684
|
-
return (await this._client.subscribe("mqtt.subscribe", {
|
|
685
|
-
clientId: e,
|
|
686
|
-
topic: t,
|
|
687
|
-
...n
|
|
688
|
-
}, s)).success;
|
|
689
|
-
}
|
|
690
|
-
async unsubscribe(e, t, s) {
|
|
691
|
-
return (await this._client.unsubscribe("mqtt.unsubscribe", {
|
|
692
|
-
clientId: e,
|
|
693
|
-
topic: t
|
|
694
|
-
}, s)).success;
|
|
695
|
-
}
|
|
696
|
-
async getConnectionStatus(e) {
|
|
697
|
-
const t = await this._client.request("mqtt.getConnectionStatus", {
|
|
698
|
-
clientId: e
|
|
699
|
-
});
|
|
700
|
-
if (!t.success)
|
|
701
|
-
throw new Error("Failed to get MQTT connection status");
|
|
702
|
-
return t.status;
|
|
703
|
-
}
|
|
704
|
-
async subscribeConnectionStatus(e, t) {
|
|
705
|
-
return (await this._client.subscribe("mqtt.subscribeConnectionStatus", {
|
|
706
|
-
clientId: e
|
|
707
|
-
}, t)).success;
|
|
708
|
-
}
|
|
709
|
-
async unsubscribeConnectionStatus(e, t) {
|
|
710
|
-
return (await this._client.unsubscribe("mqtt.unsubscribeConnectionStatus", {
|
|
711
|
-
clientId: e
|
|
712
|
-
}, t)).success;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
class Ge {
|
|
716
|
-
constructor(e) {
|
|
717
|
-
this._originalPushState = null, this._originalReplaceState = null, this._popstateHandler = null, this._backHandler = null, this._forwardHandler = null, this._client = e;
|
|
718
|
-
}
|
|
719
|
-
bind() {
|
|
720
|
-
typeof window > "u" || this._originalPushState || (this._originalPushState = history.pushState.bind(history), history.pushState = (...e) => {
|
|
721
|
-
this._originalPushState(...e), this._sendLocationChanged();
|
|
722
|
-
}, this._originalReplaceState = history.replaceState.bind(history), history.replaceState = (...e) => {
|
|
723
|
-
this._originalReplaceState(...e), this._sendLocationChanged();
|
|
724
|
-
}, this._popstateHandler = () => this._sendLocationChanged(), window.addEventListener("popstate", this._popstateHandler), this._backHandler = () => history.back(), this._forwardHandler = () => history.forward(), this._client.on("navigation.back", this._backHandler), this._client.on("navigation.forward", this._forwardHandler), this._sendLocationChanged());
|
|
725
|
-
}
|
|
726
|
-
unbind() {
|
|
727
|
-
typeof window > "u" || (this._originalPushState && (history.pushState = this._originalPushState, this._originalPushState = null), this._originalReplaceState && (history.replaceState = this._originalReplaceState, this._originalReplaceState = null), this._popstateHandler && (window.removeEventListener("popstate", this._popstateHandler), this._popstateHandler = null), this._backHandler && (this._client.off("navigation.back", this._backHandler), this._backHandler = null), this._forwardHandler && (this._client.off("navigation.forward", this._forwardHandler), this._forwardHandler = null));
|
|
728
|
-
}
|
|
729
|
-
_sendLocationChanged() {
|
|
730
|
-
this._client.send("navigation.locationChanged", {
|
|
731
|
-
pathname: window.location.pathname
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
var b;
|
|
736
|
-
(function(a) {
|
|
737
|
-
a.assertEqual = (n) => {
|
|
738
|
-
};
|
|
739
|
-
function e(n) {
|
|
740
|
-
}
|
|
741
|
-
a.assertIs = e;
|
|
742
|
-
function t(n) {
|
|
743
|
-
throw new Error();
|
|
744
|
-
}
|
|
745
|
-
a.assertNever = t, a.arrayToEnum = (n) => {
|
|
746
|
-
const r = {};
|
|
747
|
-
for (const i of n)
|
|
748
|
-
r[i] = i;
|
|
749
|
-
return r;
|
|
750
|
-
}, a.getValidEnumValues = (n) => {
|
|
751
|
-
const r = a.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
|
|
752
|
-
for (const o of r)
|
|
753
|
-
i[o] = n[o];
|
|
754
|
-
return a.objectValues(i);
|
|
755
|
-
}, a.objectValues = (n) => a.objectKeys(n).map(function(r) {
|
|
756
|
-
return n[r];
|
|
757
|
-
}), a.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
758
|
-
const r = [];
|
|
759
|
-
for (const i in n)
|
|
760
|
-
Object.prototype.hasOwnProperty.call(n, i) && r.push(i);
|
|
761
|
-
return r;
|
|
762
|
-
}, a.find = (n, r) => {
|
|
763
|
-
for (const i of n)
|
|
764
|
-
if (r(i))
|
|
765
|
-
return i;
|
|
766
|
-
}, a.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n;
|
|
767
|
-
function s(n, r = " | ") {
|
|
768
|
-
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(r);
|
|
769
|
-
}
|
|
770
|
-
a.joinValues = s, a.jsonStringifyReplacer = (n, r) => typeof r == "bigint" ? r.toString() : r;
|
|
771
|
-
})(b || (b = {}));
|
|
772
|
-
var ge;
|
|
773
|
-
(function(a) {
|
|
774
|
-
a.mergeShapes = (e, t) => ({
|
|
775
|
-
...e,
|
|
776
|
-
...t
|
|
777
|
-
// second overwrites first
|
|
778
|
-
});
|
|
779
|
-
})(ge || (ge = {}));
|
|
780
|
-
const h = b.arrayToEnum([
|
|
781
|
-
"string",
|
|
782
|
-
"nan",
|
|
783
|
-
"number",
|
|
784
|
-
"integer",
|
|
785
|
-
"float",
|
|
786
|
-
"boolean",
|
|
787
|
-
"date",
|
|
788
|
-
"bigint",
|
|
789
|
-
"symbol",
|
|
790
|
-
"function",
|
|
791
|
-
"undefined",
|
|
792
|
-
"null",
|
|
793
|
-
"array",
|
|
794
|
-
"object",
|
|
795
|
-
"unknown",
|
|
796
|
-
"promise",
|
|
797
|
-
"void",
|
|
798
|
-
"never",
|
|
799
|
-
"map",
|
|
800
|
-
"set"
|
|
801
|
-
]), O = (a) => {
|
|
802
|
-
switch (typeof a) {
|
|
803
|
-
case "undefined":
|
|
804
|
-
return h.undefined;
|
|
805
|
-
case "string":
|
|
806
|
-
return h.string;
|
|
807
|
-
case "number":
|
|
808
|
-
return Number.isNaN(a) ? h.nan : h.number;
|
|
809
|
-
case "boolean":
|
|
810
|
-
return h.boolean;
|
|
811
|
-
case "function":
|
|
812
|
-
return h.function;
|
|
813
|
-
case "bigint":
|
|
814
|
-
return h.bigint;
|
|
815
|
-
case "symbol":
|
|
816
|
-
return h.symbol;
|
|
817
|
-
case "object":
|
|
818
|
-
return Array.isArray(a) ? h.array : a === null ? h.null : a.then && typeof a.then == "function" && a.catch && typeof a.catch == "function" ? h.promise : typeof Map < "u" && a instanceof Map ? h.map : typeof Set < "u" && a instanceof Set ? h.set : typeof Date < "u" && a instanceof Date ? h.date : h.object;
|
|
819
|
-
default:
|
|
820
|
-
return h.unknown;
|
|
821
|
-
}
|
|
822
|
-
}, d = b.arrayToEnum([
|
|
823
|
-
"invalid_type",
|
|
824
|
-
"invalid_literal",
|
|
825
|
-
"custom",
|
|
826
|
-
"invalid_union",
|
|
827
|
-
"invalid_union_discriminator",
|
|
828
|
-
"invalid_enum_value",
|
|
829
|
-
"unrecognized_keys",
|
|
830
|
-
"invalid_arguments",
|
|
831
|
-
"invalid_return_type",
|
|
832
|
-
"invalid_date",
|
|
833
|
-
"invalid_string",
|
|
834
|
-
"too_small",
|
|
835
|
-
"too_big",
|
|
836
|
-
"invalid_intersection_types",
|
|
837
|
-
"not_multiple_of",
|
|
838
|
-
"not_finite"
|
|
839
|
-
]);
|
|
840
|
-
class Z extends Error {
|
|
841
|
-
get errors() {
|
|
842
|
-
return this.issues;
|
|
843
|
-
}
|
|
844
|
-
constructor(e) {
|
|
845
|
-
super(), this.issues = [], this.addIssue = (s) => {
|
|
846
|
-
this.issues = [...this.issues, s];
|
|
847
|
-
}, this.addIssues = (s = []) => {
|
|
848
|
-
this.issues = [...this.issues, ...s];
|
|
849
|
-
};
|
|
850
|
-
const t = new.target.prototype;
|
|
851
|
-
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
852
|
-
}
|
|
853
|
-
format(e) {
|
|
854
|
-
const t = e || function(r) {
|
|
855
|
-
return r.message;
|
|
856
|
-
}, s = { _errors: [] }, n = (r) => {
|
|
857
|
-
for (const i of r.issues)
|
|
858
|
-
if (i.code === "invalid_union")
|
|
859
|
-
i.unionErrors.map(n);
|
|
860
|
-
else if (i.code === "invalid_return_type")
|
|
861
|
-
n(i.returnTypeError);
|
|
862
|
-
else if (i.code === "invalid_arguments")
|
|
863
|
-
n(i.argumentsError);
|
|
864
|
-
else if (i.path.length === 0)
|
|
865
|
-
s._errors.push(t(i));
|
|
866
|
-
else {
|
|
867
|
-
let o = s, c = 0;
|
|
868
|
-
for (; c < i.path.length; ) {
|
|
869
|
-
const l = i.path[c];
|
|
870
|
-
c === i.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(t(i))) : o[l] = o[l] || { _errors: [] }, o = o[l], c++;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
};
|
|
874
|
-
return n(this), s;
|
|
875
|
-
}
|
|
876
|
-
static assert(e) {
|
|
877
|
-
if (!(e instanceof Z))
|
|
878
|
-
throw new Error(`Not a ZodError: ${e}`);
|
|
879
|
-
}
|
|
880
|
-
toString() {
|
|
881
|
-
return this.message;
|
|
882
|
-
}
|
|
883
|
-
get message() {
|
|
884
|
-
return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
|
|
885
|
-
}
|
|
886
|
-
get isEmpty() {
|
|
887
|
-
return this.issues.length === 0;
|
|
888
|
-
}
|
|
889
|
-
flatten(e = (t) => t.message) {
|
|
890
|
-
const t = {}, s = [];
|
|
891
|
-
for (const n of this.issues)
|
|
892
|
-
if (n.path.length > 0) {
|
|
893
|
-
const r = n.path[0];
|
|
894
|
-
t[r] = t[r] || [], t[r].push(e(n));
|
|
895
|
-
} else
|
|
896
|
-
s.push(e(n));
|
|
897
|
-
return { formErrors: s, fieldErrors: t };
|
|
898
|
-
}
|
|
899
|
-
get formErrors() {
|
|
900
|
-
return this.flatten();
|
|
352
|
+
get formErrors() {
|
|
353
|
+
return this.flatten();
|
|
901
354
|
}
|
|
902
355
|
}
|
|
903
|
-
|
|
904
|
-
const
|
|
356
|
+
N.create = (i) => new N(i);
|
|
357
|
+
const de = (i, e) => {
|
|
905
358
|
let t;
|
|
906
|
-
switch (
|
|
359
|
+
switch (i.code) {
|
|
907
360
|
case d.invalid_type:
|
|
908
|
-
|
|
361
|
+
i.received === h.undefined ? t = "Required" : t = `Expected ${i.expected}, received ${i.received}`;
|
|
909
362
|
break;
|
|
910
363
|
case d.invalid_literal:
|
|
911
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
364
|
+
t = `Invalid literal value, expected ${JSON.stringify(i.expected, b.jsonStringifyReplacer)}`;
|
|
912
365
|
break;
|
|
913
366
|
case d.unrecognized_keys:
|
|
914
|
-
t = `Unrecognized key(s) in object: ${b.joinValues(
|
|
367
|
+
t = `Unrecognized key(s) in object: ${b.joinValues(i.keys, ", ")}`;
|
|
915
368
|
break;
|
|
916
369
|
case d.invalid_union:
|
|
917
370
|
t = "Invalid input";
|
|
918
371
|
break;
|
|
919
372
|
case d.invalid_union_discriminator:
|
|
920
|
-
t = `Invalid discriminator value. Expected ${b.joinValues(
|
|
373
|
+
t = `Invalid discriminator value. Expected ${b.joinValues(i.options)}`;
|
|
921
374
|
break;
|
|
922
375
|
case d.invalid_enum_value:
|
|
923
|
-
t = `Invalid enum value. Expected ${b.joinValues(
|
|
376
|
+
t = `Invalid enum value. Expected ${b.joinValues(i.options)}, received '${i.received}'`;
|
|
924
377
|
break;
|
|
925
378
|
case d.invalid_arguments:
|
|
926
379
|
t = "Invalid function arguments";
|
|
@@ -932,13 +385,13 @@ const oe = (a, e) => {
|
|
|
932
385
|
t = "Invalid date";
|
|
933
386
|
break;
|
|
934
387
|
case d.invalid_string:
|
|
935
|
-
typeof
|
|
388
|
+
typeof i.validation == "object" ? "includes" in i.validation ? (t = `Invalid input: must include "${i.validation.includes}"`, typeof i.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${i.validation.position}`)) : "startsWith" in i.validation ? t = `Invalid input: must start with "${i.validation.startsWith}"` : "endsWith" in i.validation ? t = `Invalid input: must end with "${i.validation.endsWith}"` : b.assertNever(i.validation) : i.validation !== "regex" ? t = `Invalid ${i.validation}` : t = "Invalid";
|
|
936
389
|
break;
|
|
937
390
|
case d.too_small:
|
|
938
|
-
|
|
391
|
+
i.type === "array" ? t = `Array must contain ${i.exact ? "exactly" : i.inclusive ? "at least" : "more than"} ${i.minimum} element(s)` : i.type === "string" ? t = `String must contain ${i.exact ? "exactly" : i.inclusive ? "at least" : "over"} ${i.minimum} character(s)` : i.type === "number" ? t = `Number must be ${i.exact ? "exactly equal to " : i.inclusive ? "greater than or equal to " : "greater than "}${i.minimum}` : i.type === "bigint" ? t = `Number must be ${i.exact ? "exactly equal to " : i.inclusive ? "greater than or equal to " : "greater than "}${i.minimum}` : i.type === "date" ? t = `Date must be ${i.exact ? "exactly equal to " : i.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(i.minimum))}` : t = "Invalid input";
|
|
939
392
|
break;
|
|
940
393
|
case d.too_big:
|
|
941
|
-
|
|
394
|
+
i.type === "array" ? t = `Array must contain ${i.exact ? "exactly" : i.inclusive ? "at most" : "less than"} ${i.maximum} element(s)` : i.type === "string" ? t = `String must contain ${i.exact ? "exactly" : i.inclusive ? "at most" : "under"} ${i.maximum} character(s)` : i.type === "number" ? t = `Number must be ${i.exact ? "exactly" : i.inclusive ? "less than or equal to" : "less than"} ${i.maximum}` : i.type === "bigint" ? t = `BigInt must be ${i.exact ? "exactly" : i.inclusive ? "less than or equal to" : "less than"} ${i.maximum}` : i.type === "date" ? t = `Date must be ${i.exact ? "exactly" : i.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(i.maximum))}` : t = "Invalid input";
|
|
942
395
|
break;
|
|
943
396
|
case d.custom:
|
|
944
397
|
t = "Invalid input";
|
|
@@ -947,60 +400,60 @@ const oe = (a, e) => {
|
|
|
947
400
|
t = "Intersection results could not be merged";
|
|
948
401
|
break;
|
|
949
402
|
case d.not_multiple_of:
|
|
950
|
-
t = `Number must be a multiple of ${
|
|
403
|
+
t = `Number must be a multiple of ${i.multipleOf}`;
|
|
951
404
|
break;
|
|
952
405
|
case d.not_finite:
|
|
953
406
|
t = "Number must be finite";
|
|
954
407
|
break;
|
|
955
408
|
default:
|
|
956
|
-
t = e.defaultError, b.assertNever(
|
|
409
|
+
t = e.defaultError, b.assertNever(i);
|
|
957
410
|
}
|
|
958
411
|
return { message: t };
|
|
959
412
|
};
|
|
960
|
-
let
|
|
961
|
-
function
|
|
962
|
-
return
|
|
413
|
+
let Be = de;
|
|
414
|
+
function Ue() {
|
|
415
|
+
return Be;
|
|
963
416
|
}
|
|
964
|
-
const
|
|
965
|
-
const { data: e, path: t, errorMaps: s, issueData: n } =
|
|
417
|
+
const Ke = (i) => {
|
|
418
|
+
const { data: e, path: t, errorMaps: s, issueData: n } = i, a = [...t, ...n.path || []], r = {
|
|
966
419
|
...n,
|
|
967
|
-
path:
|
|
420
|
+
path: a
|
|
968
421
|
};
|
|
969
422
|
if (n.message !== void 0)
|
|
970
423
|
return {
|
|
971
424
|
...n,
|
|
972
|
-
path:
|
|
425
|
+
path: a,
|
|
973
426
|
message: n.message
|
|
974
427
|
};
|
|
975
428
|
let o = "";
|
|
976
429
|
const c = s.filter((l) => !!l).slice().reverse();
|
|
977
430
|
for (const l of c)
|
|
978
|
-
o = l(
|
|
431
|
+
o = l(r, { data: e, defaultError: o }).message;
|
|
979
432
|
return {
|
|
980
433
|
...n,
|
|
981
|
-
path:
|
|
434
|
+
path: a,
|
|
982
435
|
message: o
|
|
983
436
|
};
|
|
984
437
|
};
|
|
985
|
-
function u(
|
|
986
|
-
const t =
|
|
438
|
+
function u(i, e) {
|
|
439
|
+
const t = Ue(), s = Ke({
|
|
987
440
|
issueData: e,
|
|
988
|
-
data:
|
|
989
|
-
path:
|
|
441
|
+
data: i.data,
|
|
442
|
+
path: i.path,
|
|
990
443
|
errorMaps: [
|
|
991
|
-
|
|
444
|
+
i.common.contextualErrorMap,
|
|
992
445
|
// contextual error map is first priority
|
|
993
|
-
|
|
446
|
+
i.schemaErrorMap,
|
|
994
447
|
// then schema-bound map if available
|
|
995
448
|
t,
|
|
996
449
|
// then global override map
|
|
997
|
-
t ===
|
|
450
|
+
t === de ? void 0 : de
|
|
998
451
|
// then global default map
|
|
999
452
|
].filter((n) => !!n)
|
|
1000
453
|
});
|
|
1001
|
-
|
|
454
|
+
i.common.issues.push(s);
|
|
1002
455
|
}
|
|
1003
|
-
class
|
|
456
|
+
class T {
|
|
1004
457
|
constructor() {
|
|
1005
458
|
this.value = "valid";
|
|
1006
459
|
}
|
|
@@ -1014,7 +467,7 @@ class S {
|
|
|
1014
467
|
const s = [];
|
|
1015
468
|
for (const n of t) {
|
|
1016
469
|
if (n.status === "aborted")
|
|
1017
|
-
return
|
|
470
|
+
return g;
|
|
1018
471
|
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
1019
472
|
}
|
|
1020
473
|
return { status: e.value, value: s };
|
|
@@ -1022,33 +475,33 @@ class S {
|
|
|
1022
475
|
static async mergeObjectAsync(e, t) {
|
|
1023
476
|
const s = [];
|
|
1024
477
|
for (const n of t) {
|
|
1025
|
-
const
|
|
478
|
+
const a = await n.key, r = await n.value;
|
|
1026
479
|
s.push({
|
|
1027
|
-
key:
|
|
1028
|
-
value:
|
|
480
|
+
key: a,
|
|
481
|
+
value: r
|
|
1029
482
|
});
|
|
1030
483
|
}
|
|
1031
|
-
return
|
|
484
|
+
return T.mergeObjectSync(e, s);
|
|
1032
485
|
}
|
|
1033
486
|
static mergeObjectSync(e, t) {
|
|
1034
487
|
const s = {};
|
|
1035
488
|
for (const n of t) {
|
|
1036
|
-
const { key:
|
|
1037
|
-
if (
|
|
1038
|
-
return
|
|
1039
|
-
|
|
489
|
+
const { key: a, value: r } = n;
|
|
490
|
+
if (a.status === "aborted" || r.status === "aborted")
|
|
491
|
+
return g;
|
|
492
|
+
a.status === "dirty" && e.dirty(), r.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof r.value < "u" || n.alwaysSet) && (s[a.value] = r.value);
|
|
1040
493
|
}
|
|
1041
494
|
return { status: e.value, value: s };
|
|
1042
495
|
}
|
|
1043
496
|
}
|
|
1044
|
-
const
|
|
497
|
+
const g = Object.freeze({
|
|
1045
498
|
status: "aborted"
|
|
1046
|
-
}),
|
|
499
|
+
}), ue = (i) => ({ status: "dirty", value: i }), C = (i) => ({ status: "valid", value: i }), ve = (i) => i.status === "aborted", be = (i) => i.status === "dirty", q = (i) => i.status === "valid", se = (i) => typeof Promise < "u" && i instanceof Promise;
|
|
1047
500
|
var p;
|
|
1048
|
-
(function(
|
|
1049
|
-
|
|
501
|
+
(function(i) {
|
|
502
|
+
i.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, i.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1050
503
|
})(p || (p = {}));
|
|
1051
|
-
class
|
|
504
|
+
class $ {
|
|
1052
505
|
constructor(e, t, s, n) {
|
|
1053
506
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
1054
507
|
}
|
|
@@ -1056,30 +509,30 @@ class j {
|
|
|
1056
509
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1057
510
|
}
|
|
1058
511
|
}
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
512
|
+
const we = (i, e) => {
|
|
513
|
+
if (q(e))
|
|
1061
514
|
return { success: !0, data: e.value };
|
|
1062
|
-
if (!
|
|
515
|
+
if (!i.common.issues.length)
|
|
1063
516
|
throw new Error("Validation failed but no issues detected.");
|
|
1064
517
|
return {
|
|
1065
518
|
success: !1,
|
|
1066
519
|
get error() {
|
|
1067
520
|
if (this._error)
|
|
1068
521
|
return this._error;
|
|
1069
|
-
const t = new
|
|
522
|
+
const t = new N(i.common.issues);
|
|
1070
523
|
return this._error = t, this._error;
|
|
1071
524
|
}
|
|
1072
525
|
};
|
|
1073
526
|
};
|
|
1074
|
-
function y(
|
|
1075
|
-
if (!
|
|
527
|
+
function y(i) {
|
|
528
|
+
if (!i)
|
|
1076
529
|
return {};
|
|
1077
|
-
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } =
|
|
530
|
+
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = i;
|
|
1078
531
|
if (e && (t || s))
|
|
1079
532
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1080
|
-
return e ? { errorMap: e, description: n } : { errorMap: (
|
|
1081
|
-
const { message: o } =
|
|
1082
|
-
return
|
|
533
|
+
return e ? { errorMap: e, description: n } : { errorMap: (a, r) => {
|
|
534
|
+
const { message: o } = i;
|
|
535
|
+
return a.code === "invalid_enum_value" ? { message: o ?? r.defaultError } : typeof r.data > "u" ? { message: o ?? s ?? r.defaultError } : a.code !== "invalid_type" ? { message: r.defaultError } : { message: o ?? t ?? r.defaultError };
|
|
1083
536
|
}, description: n };
|
|
1084
537
|
}
|
|
1085
538
|
class v {
|
|
@@ -1087,13 +540,13 @@ class v {
|
|
|
1087
540
|
return this._def.description;
|
|
1088
541
|
}
|
|
1089
542
|
_getType(e) {
|
|
1090
|
-
return
|
|
543
|
+
return A(e.data);
|
|
1091
544
|
}
|
|
1092
545
|
_getOrReturnCtx(e, t) {
|
|
1093
546
|
return t || {
|
|
1094
547
|
common: e.parent.common,
|
|
1095
548
|
data: e.data,
|
|
1096
|
-
parsedType:
|
|
549
|
+
parsedType: A(e.data),
|
|
1097
550
|
schemaErrorMap: this._def.errorMap,
|
|
1098
551
|
path: e.path,
|
|
1099
552
|
parent: e.parent
|
|
@@ -1101,11 +554,11 @@ class v {
|
|
|
1101
554
|
}
|
|
1102
555
|
_processInputParams(e) {
|
|
1103
556
|
return {
|
|
1104
|
-
status: new
|
|
557
|
+
status: new T(),
|
|
1105
558
|
ctx: {
|
|
1106
559
|
common: e.parent.common,
|
|
1107
560
|
data: e.data,
|
|
1108
|
-
parsedType:
|
|
561
|
+
parsedType: A(e.data),
|
|
1109
562
|
schemaErrorMap: this._def.errorMap,
|
|
1110
563
|
path: e.path,
|
|
1111
564
|
parent: e.parent
|
|
@@ -1114,7 +567,7 @@ class v {
|
|
|
1114
567
|
}
|
|
1115
568
|
_parseSync(e) {
|
|
1116
569
|
const t = this._parse(e);
|
|
1117
|
-
if (
|
|
570
|
+
if (se(t))
|
|
1118
571
|
throw new Error("Synchronous parse encountered promise.");
|
|
1119
572
|
return t;
|
|
1120
573
|
}
|
|
@@ -1139,9 +592,9 @@ class v {
|
|
|
1139
592
|
schemaErrorMap: this._def.errorMap,
|
|
1140
593
|
parent: null,
|
|
1141
594
|
data: e,
|
|
1142
|
-
parsedType:
|
|
595
|
+
parsedType: A(e)
|
|
1143
596
|
}, n = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1144
|
-
return
|
|
597
|
+
return we(s, n);
|
|
1145
598
|
}
|
|
1146
599
|
"~validate"(e) {
|
|
1147
600
|
var t, s;
|
|
@@ -1154,24 +607,24 @@ class v {
|
|
|
1154
607
|
schemaErrorMap: this._def.errorMap,
|
|
1155
608
|
parent: null,
|
|
1156
609
|
data: e,
|
|
1157
|
-
parsedType:
|
|
610
|
+
parsedType: A(e)
|
|
1158
611
|
};
|
|
1159
612
|
if (!this["~standard"].async)
|
|
1160
613
|
try {
|
|
1161
|
-
const
|
|
1162
|
-
return
|
|
1163
|
-
value:
|
|
614
|
+
const a = this._parseSync({ data: e, path: [], parent: n });
|
|
615
|
+
return q(a) ? {
|
|
616
|
+
value: a.value
|
|
1164
617
|
} : {
|
|
1165
618
|
issues: n.common.issues
|
|
1166
619
|
};
|
|
1167
|
-
} catch (
|
|
1168
|
-
(s = (t =
|
|
620
|
+
} catch (a) {
|
|
621
|
+
(s = (t = a == null ? void 0 : a.message) == null ? void 0 : t.toLowerCase()) != null && s.includes("encountered") && (this["~standard"].async = !0), n.common = {
|
|
1169
622
|
issues: [],
|
|
1170
623
|
async: !0
|
|
1171
624
|
};
|
|
1172
625
|
}
|
|
1173
|
-
return this._parseAsync({ data: e, path: [], parent: n }).then((
|
|
1174
|
-
value:
|
|
626
|
+
return this._parseAsync({ data: e, path: [], parent: n }).then((a) => q(a) ? {
|
|
627
|
+
value: a.value
|
|
1175
628
|
} : {
|
|
1176
629
|
issues: n.common.issues
|
|
1177
630
|
});
|
|
@@ -1193,27 +646,27 @@ class v {
|
|
|
1193
646
|
schemaErrorMap: this._def.errorMap,
|
|
1194
647
|
parent: null,
|
|
1195
648
|
data: e,
|
|
1196
|
-
parsedType:
|
|
1197
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }),
|
|
1198
|
-
return
|
|
649
|
+
parsedType: A(e)
|
|
650
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = await (se(n) ? n : Promise.resolve(n));
|
|
651
|
+
return we(s, a);
|
|
1199
652
|
}
|
|
1200
653
|
refine(e, t) {
|
|
1201
654
|
const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
1202
|
-
return this._refinement((n,
|
|
1203
|
-
const
|
|
655
|
+
return this._refinement((n, a) => {
|
|
656
|
+
const r = e(n), o = () => a.addIssue({
|
|
1204
657
|
code: d.custom,
|
|
1205
658
|
...s(n)
|
|
1206
659
|
});
|
|
1207
|
-
return typeof Promise < "u" &&
|
|
660
|
+
return typeof Promise < "u" && r instanceof Promise ? r.then((c) => c ? !0 : (o(), !1)) : r ? !0 : (o(), !1);
|
|
1208
661
|
});
|
|
1209
662
|
}
|
|
1210
663
|
refinement(e, t) {
|
|
1211
664
|
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
1212
665
|
}
|
|
1213
666
|
_refinement(e) {
|
|
1214
|
-
return new
|
|
667
|
+
return new L({
|
|
1215
668
|
schema: this,
|
|
1216
|
-
typeName:
|
|
669
|
+
typeName: _.ZodEffects,
|
|
1217
670
|
effect: { type: "refinement", refinement: e }
|
|
1218
671
|
});
|
|
1219
672
|
}
|
|
@@ -1231,54 +684,54 @@ class v {
|
|
|
1231
684
|
return E.create(this, this._def);
|
|
1232
685
|
}
|
|
1233
686
|
nullable() {
|
|
1234
|
-
return
|
|
687
|
+
return D.create(this, this._def);
|
|
1235
688
|
}
|
|
1236
689
|
nullish() {
|
|
1237
690
|
return this.nullable().optional();
|
|
1238
691
|
}
|
|
1239
692
|
array() {
|
|
1240
|
-
return
|
|
693
|
+
return I.create(this);
|
|
1241
694
|
}
|
|
1242
695
|
promise() {
|
|
1243
696
|
return re.create(this, this._def);
|
|
1244
697
|
}
|
|
1245
698
|
or(e) {
|
|
1246
|
-
return
|
|
699
|
+
return ie.create([this, e], this._def);
|
|
1247
700
|
}
|
|
1248
701
|
and(e) {
|
|
1249
702
|
return ae.create(this, e, this._def);
|
|
1250
703
|
}
|
|
1251
704
|
transform(e) {
|
|
1252
|
-
return new
|
|
705
|
+
return new L({
|
|
1253
706
|
...y(this._def),
|
|
1254
707
|
schema: this,
|
|
1255
|
-
typeName:
|
|
708
|
+
typeName: _.ZodEffects,
|
|
1256
709
|
effect: { type: "transform", transform: e }
|
|
1257
710
|
});
|
|
1258
711
|
}
|
|
1259
712
|
default(e) {
|
|
1260
713
|
const t = typeof e == "function" ? e : () => e;
|
|
1261
|
-
return new
|
|
714
|
+
return new fe({
|
|
1262
715
|
...y(this._def),
|
|
1263
716
|
innerType: this,
|
|
1264
717
|
defaultValue: t,
|
|
1265
|
-
typeName:
|
|
718
|
+
typeName: _.ZodDefault
|
|
1266
719
|
});
|
|
1267
720
|
}
|
|
1268
721
|
brand() {
|
|
1269
|
-
return new
|
|
1270
|
-
typeName:
|
|
722
|
+
return new _t({
|
|
723
|
+
typeName: _.ZodBranded,
|
|
1271
724
|
type: this,
|
|
1272
725
|
...y(this._def)
|
|
1273
726
|
});
|
|
1274
727
|
}
|
|
1275
728
|
catch(e) {
|
|
1276
729
|
const t = typeof e == "function" ? e : () => e;
|
|
1277
|
-
return new
|
|
730
|
+
return new me({
|
|
1278
731
|
...y(this._def),
|
|
1279
732
|
innerType: this,
|
|
1280
733
|
catchValue: t,
|
|
1281
|
-
typeName:
|
|
734
|
+
typeName: _.ZodCatch
|
|
1282
735
|
});
|
|
1283
736
|
}
|
|
1284
737
|
describe(e) {
|
|
@@ -1289,10 +742,10 @@ class v {
|
|
|
1289
742
|
});
|
|
1290
743
|
}
|
|
1291
744
|
pipe(e) {
|
|
1292
|
-
return
|
|
745
|
+
return ge.create(this, e);
|
|
1293
746
|
}
|
|
1294
747
|
readonly() {
|
|
1295
|
-
return
|
|
748
|
+
return _e.create(this);
|
|
1296
749
|
}
|
|
1297
750
|
isOptional() {
|
|
1298
751
|
return this.safeParse(void 0).success;
|
|
@@ -1301,31 +754,31 @@ class v {
|
|
|
1301
754
|
return this.safeParse(null).success;
|
|
1302
755
|
}
|
|
1303
756
|
}
|
|
1304
|
-
const
|
|
1305
|
-
let
|
|
1306
|
-
const
|
|
1307
|
-
function
|
|
757
|
+
const We = /^c[^\s-]{8,}$/i, Je = /^[0-9a-z]+$/, Qe = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ge = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Ye = /^[a-z0-9_-]{21}$/i, Xe = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, et = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, tt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, st = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
758
|
+
let ce;
|
|
759
|
+
const nt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, it = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, at = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, rt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, ot = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ct = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ee = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", dt = new RegExp(`^${Ee}$`);
|
|
760
|
+
function $e(i) {
|
|
1308
761
|
let e = "[0-5]\\d";
|
|
1309
|
-
|
|
1310
|
-
const t =
|
|
762
|
+
i.precision ? e = `${e}\\.\\d{${i.precision}}` : i.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
763
|
+
const t = i.precision ? "+" : "?";
|
|
1311
764
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
1312
765
|
}
|
|
1313
|
-
function
|
|
1314
|
-
return new RegExp(`^${
|
|
766
|
+
function ut(i) {
|
|
767
|
+
return new RegExp(`^${$e(i)}$`);
|
|
1315
768
|
}
|
|
1316
|
-
function
|
|
1317
|
-
let e = `${
|
|
769
|
+
function lt(i) {
|
|
770
|
+
let e = `${Ee}T${$e(i)}`;
|
|
1318
771
|
const t = [];
|
|
1319
|
-
return t.push(
|
|
772
|
+
return t.push(i.local ? "Z?" : "Z"), i.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1320
773
|
}
|
|
1321
|
-
function
|
|
1322
|
-
return !!((e === "v4" || !e) &&
|
|
774
|
+
function ht(i, e) {
|
|
775
|
+
return !!((e === "v4" || !e) && nt.test(i) || (e === "v6" || !e) && at.test(i));
|
|
1323
776
|
}
|
|
1324
|
-
function
|
|
1325
|
-
if (!
|
|
777
|
+
function pt(i, e) {
|
|
778
|
+
if (!Xe.test(i))
|
|
1326
779
|
return !1;
|
|
1327
780
|
try {
|
|
1328
|
-
const [t] =
|
|
781
|
+
const [t] = i.split(".");
|
|
1329
782
|
if (!t)
|
|
1330
783
|
return !1;
|
|
1331
784
|
const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(s));
|
|
@@ -1334,10 +787,10 @@ function bt(a, e) {
|
|
|
1334
787
|
return !1;
|
|
1335
788
|
}
|
|
1336
789
|
}
|
|
1337
|
-
function
|
|
1338
|
-
return !!((e === "v4" || !e) &&
|
|
790
|
+
function ft(i, e) {
|
|
791
|
+
return !!((e === "v4" || !e) && it.test(i) || (e === "v6" || !e) && rt.test(i));
|
|
1339
792
|
}
|
|
1340
|
-
class
|
|
793
|
+
class O extends v {
|
|
1341
794
|
_parse(e) {
|
|
1342
795
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
1343
796
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1345,9 +798,9 @@ class I extends v {
|
|
|
1345
798
|
code: d.invalid_type,
|
|
1346
799
|
expected: h.string,
|
|
1347
800
|
received: n.parsedType
|
|
1348
|
-
}),
|
|
801
|
+
}), g;
|
|
1349
802
|
}
|
|
1350
|
-
const t = new
|
|
803
|
+
const t = new T();
|
|
1351
804
|
let s;
|
|
1352
805
|
for (const n of this._def.checks)
|
|
1353
806
|
if (n.kind === "min")
|
|
@@ -1369,15 +822,15 @@ class I extends v {
|
|
|
1369
822
|
message: n.message
|
|
1370
823
|
}), t.dirty());
|
|
1371
824
|
else if (n.kind === "length") {
|
|
1372
|
-
const
|
|
1373
|
-
(
|
|
825
|
+
const a = e.data.length > n.value, r = e.data.length < n.value;
|
|
826
|
+
(a || r) && (s = this._getOrReturnCtx(e, s), a ? u(s, {
|
|
1374
827
|
code: d.too_big,
|
|
1375
828
|
maximum: n.value,
|
|
1376
829
|
type: "string",
|
|
1377
830
|
inclusive: !0,
|
|
1378
831
|
exact: !0,
|
|
1379
832
|
message: n.message
|
|
1380
|
-
}) :
|
|
833
|
+
}) : r && u(s, {
|
|
1381
834
|
code: d.too_small,
|
|
1382
835
|
minimum: n.value,
|
|
1383
836
|
type: "string",
|
|
@@ -1386,43 +839,43 @@ class I extends v {
|
|
|
1386
839
|
message: n.message
|
|
1387
840
|
}), t.dirty());
|
|
1388
841
|
} else if (n.kind === "email")
|
|
1389
|
-
|
|
842
|
+
tt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1390
843
|
validation: "email",
|
|
1391
844
|
code: d.invalid_string,
|
|
1392
845
|
message: n.message
|
|
1393
846
|
}), t.dirty());
|
|
1394
847
|
else if (n.kind === "emoji")
|
|
1395
|
-
|
|
848
|
+
ce || (ce = new RegExp(st, "u")), ce.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1396
849
|
validation: "emoji",
|
|
1397
850
|
code: d.invalid_string,
|
|
1398
851
|
message: n.message
|
|
1399
852
|
}), t.dirty());
|
|
1400
853
|
else if (n.kind === "uuid")
|
|
1401
|
-
|
|
854
|
+
Ge.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1402
855
|
validation: "uuid",
|
|
1403
856
|
code: d.invalid_string,
|
|
1404
857
|
message: n.message
|
|
1405
858
|
}), t.dirty());
|
|
1406
859
|
else if (n.kind === "nanoid")
|
|
1407
|
-
|
|
860
|
+
Ye.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1408
861
|
validation: "nanoid",
|
|
1409
862
|
code: d.invalid_string,
|
|
1410
863
|
message: n.message
|
|
1411
864
|
}), t.dirty());
|
|
1412
865
|
else if (n.kind === "cuid")
|
|
1413
|
-
|
|
866
|
+
We.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1414
867
|
validation: "cuid",
|
|
1415
868
|
code: d.invalid_string,
|
|
1416
869
|
message: n.message
|
|
1417
870
|
}), t.dirty());
|
|
1418
871
|
else if (n.kind === "cuid2")
|
|
1419
|
-
|
|
872
|
+
Je.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1420
873
|
validation: "cuid2",
|
|
1421
874
|
code: d.invalid_string,
|
|
1422
875
|
message: n.message
|
|
1423
876
|
}), t.dirty());
|
|
1424
877
|
else if (n.kind === "ulid")
|
|
1425
|
-
|
|
878
|
+
Qe.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1426
879
|
validation: "ulid",
|
|
1427
880
|
code: d.invalid_string,
|
|
1428
881
|
message: n.message
|
|
@@ -1453,39 +906,39 @@ class I extends v {
|
|
|
1453
906
|
code: d.invalid_string,
|
|
1454
907
|
validation: { endsWith: n.value },
|
|
1455
908
|
message: n.message
|
|
1456
|
-
}), t.dirty()) : n.kind === "datetime" ?
|
|
909
|
+
}), t.dirty()) : n.kind === "datetime" ? lt(n).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1457
910
|
code: d.invalid_string,
|
|
1458
911
|
validation: "datetime",
|
|
1459
912
|
message: n.message
|
|
1460
|
-
}), t.dirty()) : n.kind === "date" ?
|
|
913
|
+
}), t.dirty()) : n.kind === "date" ? dt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1461
914
|
code: d.invalid_string,
|
|
1462
915
|
validation: "date",
|
|
1463
916
|
message: n.message
|
|
1464
|
-
}), t.dirty()) : n.kind === "time" ?
|
|
917
|
+
}), t.dirty()) : n.kind === "time" ? ut(n).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1465
918
|
code: d.invalid_string,
|
|
1466
919
|
validation: "time",
|
|
1467
920
|
message: n.message
|
|
1468
|
-
}), t.dirty()) : n.kind === "duration" ?
|
|
921
|
+
}), t.dirty()) : n.kind === "duration" ? et.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1469
922
|
validation: "duration",
|
|
1470
923
|
code: d.invalid_string,
|
|
1471
924
|
message: n.message
|
|
1472
|
-
}), t.dirty()) : n.kind === "ip" ?
|
|
925
|
+
}), t.dirty()) : n.kind === "ip" ? ht(e.data, n.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1473
926
|
validation: "ip",
|
|
1474
927
|
code: d.invalid_string,
|
|
1475
928
|
message: n.message
|
|
1476
|
-
}), t.dirty()) : n.kind === "jwt" ?
|
|
929
|
+
}), t.dirty()) : n.kind === "jwt" ? pt(e.data, n.alg) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1477
930
|
validation: "jwt",
|
|
1478
931
|
code: d.invalid_string,
|
|
1479
932
|
message: n.message
|
|
1480
|
-
}), t.dirty()) : n.kind === "cidr" ?
|
|
933
|
+
}), t.dirty()) : n.kind === "cidr" ? ft(e.data, n.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1481
934
|
validation: "cidr",
|
|
1482
935
|
code: d.invalid_string,
|
|
1483
936
|
message: n.message
|
|
1484
|
-
}), t.dirty()) : n.kind === "base64" ?
|
|
937
|
+
}), t.dirty()) : n.kind === "base64" ? ot.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1485
938
|
validation: "base64",
|
|
1486
939
|
code: d.invalid_string,
|
|
1487
940
|
message: n.message
|
|
1488
|
-
}), t.dirty()) : n.kind === "base64url" ?
|
|
941
|
+
}), t.dirty()) : n.kind === "base64url" ? ct.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1489
942
|
validation: "base64url",
|
|
1490
943
|
code: d.invalid_string,
|
|
1491
944
|
message: n.message
|
|
@@ -1500,7 +953,7 @@ class I extends v {
|
|
|
1500
953
|
});
|
|
1501
954
|
}
|
|
1502
955
|
_addCheck(e) {
|
|
1503
|
-
return new
|
|
956
|
+
return new O({
|
|
1504
957
|
...this._def,
|
|
1505
958
|
checks: [...this._def.checks, e]
|
|
1506
959
|
});
|
|
@@ -1636,19 +1089,19 @@ class I extends v {
|
|
|
1636
1089
|
return this.min(1, p.errToObj(e));
|
|
1637
1090
|
}
|
|
1638
1091
|
trim() {
|
|
1639
|
-
return new
|
|
1092
|
+
return new O({
|
|
1640
1093
|
...this._def,
|
|
1641
1094
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1642
1095
|
});
|
|
1643
1096
|
}
|
|
1644
1097
|
toLowerCase() {
|
|
1645
|
-
return new
|
|
1098
|
+
return new O({
|
|
1646
1099
|
...this._def,
|
|
1647
1100
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1648
1101
|
});
|
|
1649
1102
|
}
|
|
1650
1103
|
toUpperCase() {
|
|
1651
|
-
return new
|
|
1104
|
+
return new O({
|
|
1652
1105
|
...this._def,
|
|
1653
1106
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1654
1107
|
});
|
|
@@ -1714,17 +1167,17 @@ class I extends v {
|
|
|
1714
1167
|
return e;
|
|
1715
1168
|
}
|
|
1716
1169
|
}
|
|
1717
|
-
|
|
1170
|
+
O.create = (i) => new O({
|
|
1718
1171
|
checks: [],
|
|
1719
|
-
typeName:
|
|
1720
|
-
coerce: (
|
|
1721
|
-
...y(
|
|
1172
|
+
typeName: _.ZodString,
|
|
1173
|
+
coerce: (i == null ? void 0 : i.coerce) ?? !1,
|
|
1174
|
+
...y(i)
|
|
1722
1175
|
});
|
|
1723
|
-
function
|
|
1724
|
-
const t = (
|
|
1725
|
-
return
|
|
1176
|
+
function mt(i, e) {
|
|
1177
|
+
const t = (i.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = Number.parseInt(i.toFixed(n).replace(".", "")), r = Number.parseInt(e.toFixed(n).replace(".", ""));
|
|
1178
|
+
return a % r / 10 ** n;
|
|
1726
1179
|
}
|
|
1727
|
-
class
|
|
1180
|
+
class J extends v {
|
|
1728
1181
|
constructor() {
|
|
1729
1182
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1730
1183
|
}
|
|
@@ -1735,10 +1188,10 @@ class W extends v {
|
|
|
1735
1188
|
code: d.invalid_type,
|
|
1736
1189
|
expected: h.number,
|
|
1737
1190
|
received: n.parsedType
|
|
1738
|
-
}),
|
|
1191
|
+
}), g;
|
|
1739
1192
|
}
|
|
1740
1193
|
let t;
|
|
1741
|
-
const s = new
|
|
1194
|
+
const s = new T();
|
|
1742
1195
|
for (const n of this._def.checks)
|
|
1743
1196
|
n.kind === "int" ? b.isInteger(e.data) || (t = this._getOrReturnCtx(e, t), u(t, {
|
|
1744
1197
|
code: d.invalid_type,
|
|
@@ -1759,7 +1212,7 @@ class W extends v {
|
|
|
1759
1212
|
inclusive: n.inclusive,
|
|
1760
1213
|
exact: !1,
|
|
1761
1214
|
message: n.message
|
|
1762
|
-
}), s.dirty()) : n.kind === "multipleOf" ?
|
|
1215
|
+
}), s.dirty()) : n.kind === "multipleOf" ? mt(e.data, n.value) !== 0 && (t = this._getOrReturnCtx(e, t), u(t, {
|
|
1763
1216
|
code: d.not_multiple_of,
|
|
1764
1217
|
multipleOf: n.value,
|
|
1765
1218
|
message: n.message
|
|
@@ -1782,7 +1235,7 @@ class W extends v {
|
|
|
1782
1235
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1783
1236
|
}
|
|
1784
1237
|
setLimit(e, t, s, n) {
|
|
1785
|
-
return new
|
|
1238
|
+
return new J({
|
|
1786
1239
|
...this._def,
|
|
1787
1240
|
checks: [
|
|
1788
1241
|
...this._def.checks,
|
|
@@ -1796,7 +1249,7 @@ class W extends v {
|
|
|
1796
1249
|
});
|
|
1797
1250
|
}
|
|
1798
1251
|
_addCheck(e) {
|
|
1799
|
-
return new
|
|
1252
|
+
return new J({
|
|
1800
1253
|
...this._def,
|
|
1801
1254
|
checks: [...this._def.checks, e]
|
|
1802
1255
|
});
|
|
@@ -1890,13 +1343,13 @@ class W extends v {
|
|
|
1890
1343
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1891
1344
|
}
|
|
1892
1345
|
}
|
|
1893
|
-
|
|
1346
|
+
J.create = (i) => new J({
|
|
1894
1347
|
checks: [],
|
|
1895
|
-
typeName:
|
|
1896
|
-
coerce: (
|
|
1897
|
-
...y(
|
|
1348
|
+
typeName: _.ZodNumber,
|
|
1349
|
+
coerce: (i == null ? void 0 : i.coerce) || !1,
|
|
1350
|
+
...y(i)
|
|
1898
1351
|
});
|
|
1899
|
-
class
|
|
1352
|
+
class Q extends v {
|
|
1900
1353
|
constructor() {
|
|
1901
1354
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1902
1355
|
}
|
|
@@ -1910,7 +1363,7 @@ class J extends v {
|
|
|
1910
1363
|
if (this._getType(e) !== h.bigint)
|
|
1911
1364
|
return this._getInvalidInput(e);
|
|
1912
1365
|
let t;
|
|
1913
|
-
const s = new
|
|
1366
|
+
const s = new T();
|
|
1914
1367
|
for (const n of this._def.checks)
|
|
1915
1368
|
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (t = this._getOrReturnCtx(e, t), u(t, {
|
|
1916
1369
|
code: d.too_small,
|
|
@@ -1937,7 +1390,7 @@ class J extends v {
|
|
|
1937
1390
|
code: d.invalid_type,
|
|
1938
1391
|
expected: h.bigint,
|
|
1939
1392
|
received: t.parsedType
|
|
1940
|
-
}),
|
|
1393
|
+
}), g;
|
|
1941
1394
|
}
|
|
1942
1395
|
gte(e, t) {
|
|
1943
1396
|
return this.setLimit("min", e, !0, p.toString(t));
|
|
@@ -1952,7 +1405,7 @@ class J extends v {
|
|
|
1952
1405
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1953
1406
|
}
|
|
1954
1407
|
setLimit(e, t, s, n) {
|
|
1955
|
-
return new
|
|
1408
|
+
return new Q({
|
|
1956
1409
|
...this._def,
|
|
1957
1410
|
checks: [
|
|
1958
1411
|
...this._def.checks,
|
|
@@ -1966,7 +1419,7 @@ class J extends v {
|
|
|
1966
1419
|
});
|
|
1967
1420
|
}
|
|
1968
1421
|
_addCheck(e) {
|
|
1969
|
-
return new
|
|
1422
|
+
return new Q({
|
|
1970
1423
|
...this._def,
|
|
1971
1424
|
checks: [...this._def.checks, e]
|
|
1972
1425
|
});
|
|
@@ -2023,13 +1476,13 @@ class J extends v {
|
|
|
2023
1476
|
return e;
|
|
2024
1477
|
}
|
|
2025
1478
|
}
|
|
2026
|
-
|
|
1479
|
+
Q.create = (i) => new Q({
|
|
2027
1480
|
checks: [],
|
|
2028
|
-
typeName:
|
|
2029
|
-
coerce: (
|
|
2030
|
-
...y(
|
|
1481
|
+
typeName: _.ZodBigInt,
|
|
1482
|
+
coerce: (i == null ? void 0 : i.coerce) ?? !1,
|
|
1483
|
+
...y(i)
|
|
2031
1484
|
});
|
|
2032
|
-
class
|
|
1485
|
+
class ke extends v {
|
|
2033
1486
|
_parse(e) {
|
|
2034
1487
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
2035
1488
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2037,17 +1490,17 @@ class we extends v {
|
|
|
2037
1490
|
code: d.invalid_type,
|
|
2038
1491
|
expected: h.boolean,
|
|
2039
1492
|
received: t.parsedType
|
|
2040
|
-
}),
|
|
1493
|
+
}), g;
|
|
2041
1494
|
}
|
|
2042
1495
|
return C(e.data);
|
|
2043
1496
|
}
|
|
2044
1497
|
}
|
|
2045
|
-
|
|
2046
|
-
typeName:
|
|
2047
|
-
coerce: (
|
|
2048
|
-
...y(
|
|
1498
|
+
ke.create = (i) => new ke({
|
|
1499
|
+
typeName: _.ZodBoolean,
|
|
1500
|
+
coerce: (i == null ? void 0 : i.coerce) || !1,
|
|
1501
|
+
...y(i)
|
|
2049
1502
|
});
|
|
2050
|
-
class
|
|
1503
|
+
class ne extends v {
|
|
2051
1504
|
_parse(e) {
|
|
2052
1505
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
2053
1506
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2055,15 +1508,15 @@ class se extends v {
|
|
|
2055
1508
|
code: d.invalid_type,
|
|
2056
1509
|
expected: h.date,
|
|
2057
1510
|
received: n.parsedType
|
|
2058
|
-
}),
|
|
1511
|
+
}), g;
|
|
2059
1512
|
}
|
|
2060
1513
|
if (Number.isNaN(e.data.getTime())) {
|
|
2061
1514
|
const n = this._getOrReturnCtx(e);
|
|
2062
1515
|
return u(n, {
|
|
2063
1516
|
code: d.invalid_date
|
|
2064
|
-
}),
|
|
1517
|
+
}), g;
|
|
2065
1518
|
}
|
|
2066
|
-
const t = new
|
|
1519
|
+
const t = new T();
|
|
2067
1520
|
let s;
|
|
2068
1521
|
for (const n of this._def.checks)
|
|
2069
1522
|
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
@@ -2087,7 +1540,7 @@ class se extends v {
|
|
|
2087
1540
|
};
|
|
2088
1541
|
}
|
|
2089
1542
|
_addCheck(e) {
|
|
2090
|
-
return new
|
|
1543
|
+
return new ne({
|
|
2091
1544
|
...this._def,
|
|
2092
1545
|
checks: [...this._def.checks, e]
|
|
2093
1546
|
});
|
|
@@ -2119,13 +1572,13 @@ class se extends v {
|
|
|
2119
1572
|
return e != null ? new Date(e) : null;
|
|
2120
1573
|
}
|
|
2121
1574
|
}
|
|
2122
|
-
|
|
1575
|
+
ne.create = (i) => new ne({
|
|
2123
1576
|
checks: [],
|
|
2124
|
-
coerce: (
|
|
2125
|
-
typeName:
|
|
2126
|
-
...y(
|
|
1577
|
+
coerce: (i == null ? void 0 : i.coerce) || !1,
|
|
1578
|
+
typeName: _.ZodDate,
|
|
1579
|
+
...y(i)
|
|
2127
1580
|
});
|
|
2128
|
-
class
|
|
1581
|
+
class xe extends v {
|
|
2129
1582
|
_parse(e) {
|
|
2130
1583
|
if (this._getType(e) !== h.symbol) {
|
|
2131
1584
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2133,16 +1586,16 @@ class ke extends v {
|
|
|
2133
1586
|
code: d.invalid_type,
|
|
2134
1587
|
expected: h.symbol,
|
|
2135
1588
|
received: t.parsedType
|
|
2136
|
-
}),
|
|
1589
|
+
}), g;
|
|
2137
1590
|
}
|
|
2138
1591
|
return C(e.data);
|
|
2139
1592
|
}
|
|
2140
1593
|
}
|
|
2141
|
-
|
|
2142
|
-
typeName:
|
|
2143
|
-
...y(
|
|
1594
|
+
xe.create = (i) => new xe({
|
|
1595
|
+
typeName: _.ZodSymbol,
|
|
1596
|
+
...y(i)
|
|
2144
1597
|
});
|
|
2145
|
-
class
|
|
1598
|
+
class Se extends v {
|
|
2146
1599
|
_parse(e) {
|
|
2147
1600
|
if (this._getType(e) !== h.undefined) {
|
|
2148
1601
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2150,16 +1603,16 @@ class xe extends v {
|
|
|
2150
1603
|
code: d.invalid_type,
|
|
2151
1604
|
expected: h.undefined,
|
|
2152
1605
|
received: t.parsedType
|
|
2153
|
-
}),
|
|
1606
|
+
}), g;
|
|
2154
1607
|
}
|
|
2155
1608
|
return C(e.data);
|
|
2156
1609
|
}
|
|
2157
1610
|
}
|
|
2158
|
-
|
|
2159
|
-
typeName:
|
|
2160
|
-
...y(
|
|
1611
|
+
Se.create = (i) => new Se({
|
|
1612
|
+
typeName: _.ZodUndefined,
|
|
1613
|
+
...y(i)
|
|
2161
1614
|
});
|
|
2162
|
-
class
|
|
1615
|
+
class Te extends v {
|
|
2163
1616
|
_parse(e) {
|
|
2164
1617
|
if (this._getType(e) !== h.null) {
|
|
2165
1618
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2167,16 +1620,16 @@ class Se extends v {
|
|
|
2167
1620
|
code: d.invalid_type,
|
|
2168
1621
|
expected: h.null,
|
|
2169
1622
|
received: t.parsedType
|
|
2170
|
-
}),
|
|
1623
|
+
}), g;
|
|
2171
1624
|
}
|
|
2172
1625
|
return C(e.data);
|
|
2173
1626
|
}
|
|
2174
1627
|
}
|
|
2175
|
-
|
|
2176
|
-
typeName:
|
|
2177
|
-
...y(
|
|
1628
|
+
Te.create = (i) => new Te({
|
|
1629
|
+
typeName: _.ZodNull,
|
|
1630
|
+
...y(i)
|
|
2178
1631
|
});
|
|
2179
|
-
class
|
|
1632
|
+
class le extends v {
|
|
2180
1633
|
constructor() {
|
|
2181
1634
|
super(...arguments), this._any = !0;
|
|
2182
1635
|
}
|
|
@@ -2184,9 +1637,9 @@ class de extends v {
|
|
|
2184
1637
|
return C(e.data);
|
|
2185
1638
|
}
|
|
2186
1639
|
}
|
|
2187
|
-
|
|
2188
|
-
typeName:
|
|
2189
|
-
...y(
|
|
1640
|
+
le.create = (i) => new le({
|
|
1641
|
+
typeName: _.ZodAny,
|
|
1642
|
+
...y(i)
|
|
2190
1643
|
});
|
|
2191
1644
|
class Ce extends v {
|
|
2192
1645
|
constructor() {
|
|
@@ -2196,25 +1649,25 @@ class Ce extends v {
|
|
|
2196
1649
|
return C(e.data);
|
|
2197
1650
|
}
|
|
2198
1651
|
}
|
|
2199
|
-
Ce.create = (
|
|
2200
|
-
typeName:
|
|
2201
|
-
...y(
|
|
1652
|
+
Ce.create = (i) => new Ce({
|
|
1653
|
+
typeName: _.ZodUnknown,
|
|
1654
|
+
...y(i)
|
|
2202
1655
|
});
|
|
2203
|
-
class
|
|
1656
|
+
class j extends v {
|
|
2204
1657
|
_parse(e) {
|
|
2205
1658
|
const t = this._getOrReturnCtx(e);
|
|
2206
1659
|
return u(t, {
|
|
2207
1660
|
code: d.invalid_type,
|
|
2208
1661
|
expected: h.never,
|
|
2209
1662
|
received: t.parsedType
|
|
2210
|
-
}),
|
|
1663
|
+
}), g;
|
|
2211
1664
|
}
|
|
2212
1665
|
}
|
|
2213
|
-
|
|
2214
|
-
typeName:
|
|
2215
|
-
...y(
|
|
1666
|
+
j.create = (i) => new j({
|
|
1667
|
+
typeName: _.ZodNever,
|
|
1668
|
+
...y(i)
|
|
2216
1669
|
});
|
|
2217
|
-
class
|
|
1670
|
+
class Ie extends v {
|
|
2218
1671
|
_parse(e) {
|
|
2219
1672
|
if (this._getType(e) !== h.undefined) {
|
|
2220
1673
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2222,16 +1675,16 @@ class Te extends v {
|
|
|
2222
1675
|
code: d.invalid_type,
|
|
2223
1676
|
expected: h.void,
|
|
2224
1677
|
received: t.parsedType
|
|
2225
|
-
}),
|
|
1678
|
+
}), g;
|
|
2226
1679
|
}
|
|
2227
1680
|
return C(e.data);
|
|
2228
1681
|
}
|
|
2229
1682
|
}
|
|
2230
|
-
|
|
2231
|
-
typeName:
|
|
2232
|
-
...y(
|
|
1683
|
+
Ie.create = (i) => new Ie({
|
|
1684
|
+
typeName: _.ZodVoid,
|
|
1685
|
+
...y(i)
|
|
2233
1686
|
});
|
|
2234
|
-
class
|
|
1687
|
+
class I extends v {
|
|
2235
1688
|
_parse(e) {
|
|
2236
1689
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
2237
1690
|
if (t.parsedType !== h.array)
|
|
@@ -2239,13 +1692,13 @@ class N extends v {
|
|
|
2239
1692
|
code: d.invalid_type,
|
|
2240
1693
|
expected: h.array,
|
|
2241
1694
|
received: t.parsedType
|
|
2242
|
-
}),
|
|
1695
|
+
}), g;
|
|
2243
1696
|
if (n.exactLength !== null) {
|
|
2244
|
-
const
|
|
2245
|
-
(
|
|
2246
|
-
code:
|
|
1697
|
+
const r = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
|
|
1698
|
+
(r || o) && (u(t, {
|
|
1699
|
+
code: r ? d.too_big : d.too_small,
|
|
2247
1700
|
minimum: o ? n.exactLength.value : void 0,
|
|
2248
|
-
maximum:
|
|
1701
|
+
maximum: r ? n.exactLength.value : void 0,
|
|
2249
1702
|
type: "array",
|
|
2250
1703
|
inclusive: !0,
|
|
2251
1704
|
exact: !0,
|
|
@@ -2267,27 +1720,27 @@ class N extends v {
|
|
|
2267
1720
|
exact: !1,
|
|
2268
1721
|
message: n.maxLength.message
|
|
2269
1722
|
}), s.dirty()), t.common.async)
|
|
2270
|
-
return Promise.all([...t.data].map((
|
|
2271
|
-
const
|
|
2272
|
-
return
|
|
1723
|
+
return Promise.all([...t.data].map((r, o) => n.type._parseAsync(new $(t, r, t.path, o)))).then((r) => T.mergeArray(s, r));
|
|
1724
|
+
const a = [...t.data].map((r, o) => n.type._parseSync(new $(t, r, t.path, o)));
|
|
1725
|
+
return T.mergeArray(s, a);
|
|
2273
1726
|
}
|
|
2274
1727
|
get element() {
|
|
2275
1728
|
return this._def.type;
|
|
2276
1729
|
}
|
|
2277
1730
|
min(e, t) {
|
|
2278
|
-
return new
|
|
1731
|
+
return new I({
|
|
2279
1732
|
...this._def,
|
|
2280
1733
|
minLength: { value: e, message: p.toString(t) }
|
|
2281
1734
|
});
|
|
2282
1735
|
}
|
|
2283
1736
|
max(e, t) {
|
|
2284
|
-
return new
|
|
1737
|
+
return new I({
|
|
2285
1738
|
...this._def,
|
|
2286
1739
|
maxLength: { value: e, message: p.toString(t) }
|
|
2287
1740
|
});
|
|
2288
1741
|
}
|
|
2289
1742
|
length(e, t) {
|
|
2290
|
-
return new
|
|
1743
|
+
return new I({
|
|
2291
1744
|
...this._def,
|
|
2292
1745
|
exactLength: { value: e, message: p.toString(t) }
|
|
2293
1746
|
});
|
|
@@ -2296,29 +1749,29 @@ class N extends v {
|
|
|
2296
1749
|
return this.min(1, e);
|
|
2297
1750
|
}
|
|
2298
1751
|
}
|
|
2299
|
-
|
|
2300
|
-
type:
|
|
1752
|
+
I.create = (i, e) => new I({
|
|
1753
|
+
type: i,
|
|
2301
1754
|
minLength: null,
|
|
2302
1755
|
maxLength: null,
|
|
2303
1756
|
exactLength: null,
|
|
2304
|
-
typeName:
|
|
1757
|
+
typeName: _.ZodArray,
|
|
2305
1758
|
...y(e)
|
|
2306
1759
|
});
|
|
2307
|
-
function
|
|
2308
|
-
if (
|
|
1760
|
+
function M(i) {
|
|
1761
|
+
if (i instanceof k) {
|
|
2309
1762
|
const e = {};
|
|
2310
|
-
for (const t in
|
|
2311
|
-
const s =
|
|
2312
|
-
e[t] = E.create(
|
|
1763
|
+
for (const t in i.shape) {
|
|
1764
|
+
const s = i.shape[t];
|
|
1765
|
+
e[t] = E.create(M(s));
|
|
2313
1766
|
}
|
|
2314
1767
|
return new k({
|
|
2315
|
-
...
|
|
1768
|
+
...i._def,
|
|
2316
1769
|
shape: () => e
|
|
2317
1770
|
});
|
|
2318
|
-
} else return
|
|
2319
|
-
...
|
|
2320
|
-
type:
|
|
2321
|
-
}) :
|
|
1771
|
+
} else return i instanceof I ? new I({
|
|
1772
|
+
...i._def,
|
|
1773
|
+
type: M(i.element)
|
|
1774
|
+
}) : i instanceof E ? E.create(M(i.unwrap())) : i instanceof D ? D.create(M(i.unwrap())) : i instanceof R ? R.create(i.items.map((e) => M(e))) : i;
|
|
2322
1775
|
}
|
|
2323
1776
|
class k extends v {
|
|
2324
1777
|
constructor() {
|
|
@@ -2337,43 +1790,43 @@ class k extends v {
|
|
|
2337
1790
|
code: d.invalid_type,
|
|
2338
1791
|
expected: h.object,
|
|
2339
1792
|
received: c.parsedType
|
|
2340
|
-
}),
|
|
1793
|
+
}), g;
|
|
2341
1794
|
}
|
|
2342
|
-
const { status: t, ctx: s } = this._processInputParams(e), { shape: n, keys:
|
|
2343
|
-
if (!(this._def.catchall instanceof
|
|
1795
|
+
const { status: t, ctx: s } = this._processInputParams(e), { shape: n, keys: a } = this._getCached(), r = [];
|
|
1796
|
+
if (!(this._def.catchall instanceof j && this._def.unknownKeys === "strip"))
|
|
2344
1797
|
for (const c in s.data)
|
|
2345
|
-
|
|
1798
|
+
a.includes(c) || r.push(c);
|
|
2346
1799
|
const o = [];
|
|
2347
|
-
for (const c of
|
|
2348
|
-
const l = n[c],
|
|
1800
|
+
for (const c of a) {
|
|
1801
|
+
const l = n[c], f = s.data[c];
|
|
2349
1802
|
o.push({
|
|
2350
1803
|
key: { status: "valid", value: c },
|
|
2351
|
-
value: l._parse(new
|
|
1804
|
+
value: l._parse(new $(s, f, s.path, c)),
|
|
2352
1805
|
alwaysSet: c in s.data
|
|
2353
1806
|
});
|
|
2354
1807
|
}
|
|
2355
|
-
if (this._def.catchall instanceof
|
|
1808
|
+
if (this._def.catchall instanceof j) {
|
|
2356
1809
|
const c = this._def.unknownKeys;
|
|
2357
1810
|
if (c === "passthrough")
|
|
2358
|
-
for (const l of
|
|
1811
|
+
for (const l of r)
|
|
2359
1812
|
o.push({
|
|
2360
1813
|
key: { status: "valid", value: l },
|
|
2361
1814
|
value: { status: "valid", value: s.data[l] }
|
|
2362
1815
|
});
|
|
2363
1816
|
else if (c === "strict")
|
|
2364
|
-
|
|
1817
|
+
r.length > 0 && (u(s, {
|
|
2365
1818
|
code: d.unrecognized_keys,
|
|
2366
|
-
keys:
|
|
1819
|
+
keys: r
|
|
2367
1820
|
}), t.dirty());
|
|
2368
1821
|
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2369
1822
|
} else {
|
|
2370
1823
|
const c = this._def.catchall;
|
|
2371
|
-
for (const l of
|
|
2372
|
-
const
|
|
1824
|
+
for (const l of r) {
|
|
1825
|
+
const f = s.data[l];
|
|
2373
1826
|
o.push({
|
|
2374
1827
|
key: { status: "valid", value: l },
|
|
2375
1828
|
value: c._parse(
|
|
2376
|
-
new
|
|
1829
|
+
new $(s, f, s.path, l)
|
|
2377
1830
|
//, ctx.child(key), value, getParsedType(value)
|
|
2378
1831
|
),
|
|
2379
1832
|
alwaysSet: l in s.data
|
|
@@ -2383,15 +1836,15 @@ class k extends v {
|
|
|
2383
1836
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
2384
1837
|
const c = [];
|
|
2385
1838
|
for (const l of o) {
|
|
2386
|
-
const
|
|
1839
|
+
const f = await l.key, w = await l.value;
|
|
2387
1840
|
c.push({
|
|
2388
|
-
key:
|
|
1841
|
+
key: f,
|
|
2389
1842
|
value: w,
|
|
2390
1843
|
alwaysSet: l.alwaysSet
|
|
2391
1844
|
});
|
|
2392
1845
|
}
|
|
2393
1846
|
return c;
|
|
2394
|
-
}).then((c) =>
|
|
1847
|
+
}).then((c) => T.mergeObjectSync(t, c)) : T.mergeObjectSync(t, o);
|
|
2395
1848
|
}
|
|
2396
1849
|
get shape() {
|
|
2397
1850
|
return this._def.shape();
|
|
@@ -2402,12 +1855,12 @@ class k extends v {
|
|
|
2402
1855
|
unknownKeys: "strict",
|
|
2403
1856
|
...e !== void 0 ? {
|
|
2404
1857
|
errorMap: (t, s) => {
|
|
2405
|
-
var n,
|
|
2406
|
-
const
|
|
1858
|
+
var n, a;
|
|
1859
|
+
const r = ((a = (n = this._def).errorMap) == null ? void 0 : a.call(n, t, s).message) ?? s.defaultError;
|
|
2407
1860
|
return t.code === "unrecognized_keys" ? {
|
|
2408
|
-
message: p.errToObj(e).message ??
|
|
1861
|
+
message: p.errToObj(e).message ?? r
|
|
2409
1862
|
} : {
|
|
2410
|
-
message:
|
|
1863
|
+
message: r
|
|
2411
1864
|
};
|
|
2412
1865
|
}
|
|
2413
1866
|
} : {}
|
|
@@ -2464,7 +1917,7 @@ class k extends v {
|
|
|
2464
1917
|
...this._def.shape(),
|
|
2465
1918
|
...e._def.shape()
|
|
2466
1919
|
}),
|
|
2467
|
-
typeName:
|
|
1920
|
+
typeName: _.ZodObject
|
|
2468
1921
|
});
|
|
2469
1922
|
}
|
|
2470
1923
|
// merge<
|
|
@@ -2554,7 +2007,7 @@ class k extends v {
|
|
|
2554
2007
|
* @deprecated
|
|
2555
2008
|
*/
|
|
2556
2009
|
deepPartial() {
|
|
2557
|
-
return
|
|
2010
|
+
return M(this);
|
|
2558
2011
|
}
|
|
2559
2012
|
partial(e) {
|
|
2560
2013
|
const t = {};
|
|
@@ -2587,46 +2040,46 @@ class k extends v {
|
|
|
2587
2040
|
return je(b.objectKeys(this.shape));
|
|
2588
2041
|
}
|
|
2589
2042
|
}
|
|
2590
|
-
k.create = (
|
|
2591
|
-
shape: () =>
|
|
2043
|
+
k.create = (i, e) => new k({
|
|
2044
|
+
shape: () => i,
|
|
2592
2045
|
unknownKeys: "strip",
|
|
2593
|
-
catchall:
|
|
2594
|
-
typeName:
|
|
2046
|
+
catchall: j.create(),
|
|
2047
|
+
typeName: _.ZodObject,
|
|
2595
2048
|
...y(e)
|
|
2596
2049
|
});
|
|
2597
|
-
k.strictCreate = (
|
|
2598
|
-
shape: () =>
|
|
2050
|
+
k.strictCreate = (i, e) => new k({
|
|
2051
|
+
shape: () => i,
|
|
2599
2052
|
unknownKeys: "strict",
|
|
2600
|
-
catchall:
|
|
2601
|
-
typeName:
|
|
2053
|
+
catchall: j.create(),
|
|
2054
|
+
typeName: _.ZodObject,
|
|
2602
2055
|
...y(e)
|
|
2603
2056
|
});
|
|
2604
|
-
k.lazycreate = (
|
|
2605
|
-
shape:
|
|
2057
|
+
k.lazycreate = (i, e) => new k({
|
|
2058
|
+
shape: i,
|
|
2606
2059
|
unknownKeys: "strip",
|
|
2607
|
-
catchall:
|
|
2608
|
-
typeName:
|
|
2060
|
+
catchall: j.create(),
|
|
2061
|
+
typeName: _.ZodObject,
|
|
2609
2062
|
...y(e)
|
|
2610
2063
|
});
|
|
2611
|
-
class
|
|
2064
|
+
class ie extends v {
|
|
2612
2065
|
_parse(e) {
|
|
2613
2066
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2614
|
-
function n(
|
|
2615
|
-
for (const o of
|
|
2067
|
+
function n(a) {
|
|
2068
|
+
for (const o of a)
|
|
2616
2069
|
if (o.result.status === "valid")
|
|
2617
2070
|
return o.result;
|
|
2618
|
-
for (const o of
|
|
2071
|
+
for (const o of a)
|
|
2619
2072
|
if (o.result.status === "dirty")
|
|
2620
2073
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2621
|
-
const
|
|
2074
|
+
const r = a.map((o) => new N(o.ctx.common.issues));
|
|
2622
2075
|
return u(t, {
|
|
2623
2076
|
code: d.invalid_union,
|
|
2624
|
-
unionErrors:
|
|
2625
|
-
}),
|
|
2077
|
+
unionErrors: r
|
|
2078
|
+
}), g;
|
|
2626
2079
|
}
|
|
2627
2080
|
if (t.common.async)
|
|
2628
|
-
return Promise.all(s.map(async (
|
|
2629
|
-
const
|
|
2081
|
+
return Promise.all(s.map(async (a) => {
|
|
2082
|
+
const r = {
|
|
2630
2083
|
...t,
|
|
2631
2084
|
common: {
|
|
2632
2085
|
...t.common,
|
|
@@ -2635,17 +2088,17 @@ class ne extends v {
|
|
|
2635
2088
|
parent: null
|
|
2636
2089
|
};
|
|
2637
2090
|
return {
|
|
2638
|
-
result: await
|
|
2091
|
+
result: await a._parseAsync({
|
|
2639
2092
|
data: t.data,
|
|
2640
2093
|
path: t.path,
|
|
2641
|
-
parent:
|
|
2094
|
+
parent: r
|
|
2642
2095
|
}),
|
|
2643
|
-
ctx:
|
|
2096
|
+
ctx: r
|
|
2644
2097
|
};
|
|
2645
2098
|
})).then(n);
|
|
2646
2099
|
{
|
|
2647
|
-
let
|
|
2648
|
-
const
|
|
2100
|
+
let a;
|
|
2101
|
+
const r = [];
|
|
2649
2102
|
for (const c of s) {
|
|
2650
2103
|
const l = {
|
|
2651
2104
|
...t,
|
|
@@ -2654,68 +2107,68 @@ class ne extends v {
|
|
|
2654
2107
|
issues: []
|
|
2655
2108
|
},
|
|
2656
2109
|
parent: null
|
|
2657
|
-
},
|
|
2110
|
+
}, f = c._parseSync({
|
|
2658
2111
|
data: t.data,
|
|
2659
2112
|
path: t.path,
|
|
2660
2113
|
parent: l
|
|
2661
2114
|
});
|
|
2662
|
-
if (
|
|
2663
|
-
return
|
|
2664
|
-
|
|
2115
|
+
if (f.status === "valid")
|
|
2116
|
+
return f;
|
|
2117
|
+
f.status === "dirty" && !a && (a = { result: f, ctx: l }), l.common.issues.length && r.push(l.common.issues);
|
|
2665
2118
|
}
|
|
2666
|
-
if (
|
|
2667
|
-
return t.common.issues.push(...
|
|
2668
|
-
const o =
|
|
2119
|
+
if (a)
|
|
2120
|
+
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2121
|
+
const o = r.map((c) => new N(c));
|
|
2669
2122
|
return u(t, {
|
|
2670
2123
|
code: d.invalid_union,
|
|
2671
2124
|
unionErrors: o
|
|
2672
|
-
}),
|
|
2125
|
+
}), g;
|
|
2673
2126
|
}
|
|
2674
2127
|
}
|
|
2675
2128
|
get options() {
|
|
2676
2129
|
return this._def.options;
|
|
2677
2130
|
}
|
|
2678
2131
|
}
|
|
2679
|
-
|
|
2680
|
-
options:
|
|
2681
|
-
typeName:
|
|
2132
|
+
ie.create = (i, e) => new ie({
|
|
2133
|
+
options: i,
|
|
2134
|
+
typeName: _.ZodUnion,
|
|
2682
2135
|
...y(e)
|
|
2683
2136
|
});
|
|
2684
|
-
function
|
|
2685
|
-
const t =
|
|
2686
|
-
if (
|
|
2687
|
-
return { valid: !0, data:
|
|
2137
|
+
function he(i, e) {
|
|
2138
|
+
const t = A(i), s = A(e);
|
|
2139
|
+
if (i === e)
|
|
2140
|
+
return { valid: !0, data: i };
|
|
2688
2141
|
if (t === h.object && s === h.object) {
|
|
2689
|
-
const n = b.objectKeys(e),
|
|
2690
|
-
for (const o of
|
|
2691
|
-
const c =
|
|
2142
|
+
const n = b.objectKeys(e), a = b.objectKeys(i).filter((o) => n.indexOf(o) !== -1), r = { ...i, ...e };
|
|
2143
|
+
for (const o of a) {
|
|
2144
|
+
const c = he(i[o], e[o]);
|
|
2692
2145
|
if (!c.valid)
|
|
2693
2146
|
return { valid: !1 };
|
|
2694
|
-
|
|
2147
|
+
r[o] = c.data;
|
|
2695
2148
|
}
|
|
2696
|
-
return { valid: !0, data:
|
|
2149
|
+
return { valid: !0, data: r };
|
|
2697
2150
|
} else if (t === h.array && s === h.array) {
|
|
2698
|
-
if (
|
|
2151
|
+
if (i.length !== e.length)
|
|
2699
2152
|
return { valid: !1 };
|
|
2700
2153
|
const n = [];
|
|
2701
|
-
for (let
|
|
2702
|
-
const
|
|
2154
|
+
for (let a = 0; a < i.length; a++) {
|
|
2155
|
+
const r = i[a], o = e[a], c = he(r, o);
|
|
2703
2156
|
if (!c.valid)
|
|
2704
2157
|
return { valid: !1 };
|
|
2705
2158
|
n.push(c.data);
|
|
2706
2159
|
}
|
|
2707
2160
|
return { valid: !0, data: n };
|
|
2708
|
-
} else return t === h.date && s === h.date && +
|
|
2161
|
+
} else return t === h.date && s === h.date && +i == +e ? { valid: !0, data: i } : { valid: !1 };
|
|
2709
2162
|
}
|
|
2710
2163
|
class ae extends v {
|
|
2711
2164
|
_parse(e) {
|
|
2712
|
-
const { status: t, ctx: s } = this._processInputParams(e), n = (
|
|
2713
|
-
if (
|
|
2714
|
-
return
|
|
2715
|
-
const o =
|
|
2716
|
-
return o.valid ? ((
|
|
2165
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = (a, r) => {
|
|
2166
|
+
if (ve(a) || ve(r))
|
|
2167
|
+
return g;
|
|
2168
|
+
const o = he(a.value, r.value);
|
|
2169
|
+
return o.valid ? ((be(a) || be(r)) && t.dirty(), { status: t.value, value: o.data }) : (u(s, {
|
|
2717
2170
|
code: d.invalid_intersection_types
|
|
2718
|
-
}),
|
|
2171
|
+
}), g);
|
|
2719
2172
|
};
|
|
2720
2173
|
return s.common.async ? Promise.all([
|
|
2721
2174
|
this._def.left._parseAsync({
|
|
@@ -2728,7 +2181,7 @@ class ae extends v {
|
|
|
2728
2181
|
path: s.path,
|
|
2729
2182
|
parent: s
|
|
2730
2183
|
})
|
|
2731
|
-
]).then(([
|
|
2184
|
+
]).then(([a, r]) => n(a, r)) : n(this._def.left._parseSync({
|
|
2732
2185
|
data: s.data,
|
|
2733
2186
|
path: s.path,
|
|
2734
2187
|
parent: s
|
|
@@ -2739,13 +2192,13 @@ class ae extends v {
|
|
|
2739
2192
|
}));
|
|
2740
2193
|
}
|
|
2741
2194
|
}
|
|
2742
|
-
ae.create = (
|
|
2743
|
-
left:
|
|
2195
|
+
ae.create = (i, e, t) => new ae({
|
|
2196
|
+
left: i,
|
|
2744
2197
|
right: e,
|
|
2745
|
-
typeName:
|
|
2198
|
+
typeName: _.ZodIntersection,
|
|
2746
2199
|
...y(t)
|
|
2747
2200
|
});
|
|
2748
|
-
class
|
|
2201
|
+
class R extends v {
|
|
2749
2202
|
_parse(e) {
|
|
2750
2203
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2751
2204
|
if (s.parsedType !== h.array)
|
|
@@ -2753,7 +2206,7 @@ class $ extends v {
|
|
|
2753
2206
|
code: d.invalid_type,
|
|
2754
2207
|
expected: h.array,
|
|
2755
2208
|
received: s.parsedType
|
|
2756
|
-
}),
|
|
2209
|
+
}), g;
|
|
2757
2210
|
if (s.data.length < this._def.items.length)
|
|
2758
2211
|
return u(s, {
|
|
2759
2212
|
code: d.too_small,
|
|
@@ -2761,7 +2214,7 @@ class $ extends v {
|
|
|
2761
2214
|
inclusive: !0,
|
|
2762
2215
|
exact: !1,
|
|
2763
2216
|
type: "array"
|
|
2764
|
-
}),
|
|
2217
|
+
}), g;
|
|
2765
2218
|
!this._def.rest && s.data.length > this._def.items.length && (u(s, {
|
|
2766
2219
|
code: d.too_big,
|
|
2767
2220
|
maximum: this._def.items.length,
|
|
@@ -2769,28 +2222,28 @@ class $ extends v {
|
|
|
2769
2222
|
exact: !1,
|
|
2770
2223
|
type: "array"
|
|
2771
2224
|
}), t.dirty());
|
|
2772
|
-
const n = [...s.data].map((
|
|
2773
|
-
const o = this._def.items[
|
|
2774
|
-
return o ? o._parse(new
|
|
2775
|
-
}).filter((
|
|
2776
|
-
return s.common.async ? Promise.all(n).then((
|
|
2225
|
+
const n = [...s.data].map((a, r) => {
|
|
2226
|
+
const o = this._def.items[r] || this._def.rest;
|
|
2227
|
+
return o ? o._parse(new $(s, a, s.path, r)) : null;
|
|
2228
|
+
}).filter((a) => !!a);
|
|
2229
|
+
return s.common.async ? Promise.all(n).then((a) => T.mergeArray(t, a)) : T.mergeArray(t, n);
|
|
2777
2230
|
}
|
|
2778
2231
|
get items() {
|
|
2779
2232
|
return this._def.items;
|
|
2780
2233
|
}
|
|
2781
2234
|
rest(e) {
|
|
2782
|
-
return new
|
|
2235
|
+
return new R({
|
|
2783
2236
|
...this._def,
|
|
2784
2237
|
rest: e
|
|
2785
2238
|
});
|
|
2786
2239
|
}
|
|
2787
2240
|
}
|
|
2788
|
-
|
|
2789
|
-
if (!Array.isArray(
|
|
2241
|
+
R.create = (i, e) => {
|
|
2242
|
+
if (!Array.isArray(i))
|
|
2790
2243
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2791
|
-
return new
|
|
2792
|
-
items:
|
|
2793
|
-
typeName:
|
|
2244
|
+
return new R({
|
|
2245
|
+
items: i,
|
|
2246
|
+
typeName: _.ZodTuple,
|
|
2794
2247
|
rest: null,
|
|
2795
2248
|
...y(e)
|
|
2796
2249
|
});
|
|
@@ -2809,41 +2262,41 @@ class Ne extends v {
|
|
|
2809
2262
|
code: d.invalid_type,
|
|
2810
2263
|
expected: h.map,
|
|
2811
2264
|
received: s.parsedType
|
|
2812
|
-
}),
|
|
2813
|
-
const n = this._def.keyType,
|
|
2814
|
-
key: n._parse(new
|
|
2815
|
-
value:
|
|
2265
|
+
}), g;
|
|
2266
|
+
const n = this._def.keyType, a = this._def.valueType, r = [...s.data.entries()].map(([o, c], l) => ({
|
|
2267
|
+
key: n._parse(new $(s, o, s.path, [l, "key"])),
|
|
2268
|
+
value: a._parse(new $(s, c, s.path, [l, "value"]))
|
|
2816
2269
|
}));
|
|
2817
2270
|
if (s.common.async) {
|
|
2818
2271
|
const o = /* @__PURE__ */ new Map();
|
|
2819
2272
|
return Promise.resolve().then(async () => {
|
|
2820
|
-
for (const c of
|
|
2821
|
-
const l = await c.key,
|
|
2822
|
-
if (l.status === "aborted" ||
|
|
2823
|
-
return
|
|
2824
|
-
(l.status === "dirty" ||
|
|
2273
|
+
for (const c of r) {
|
|
2274
|
+
const l = await c.key, f = await c.value;
|
|
2275
|
+
if (l.status === "aborted" || f.status === "aborted")
|
|
2276
|
+
return g;
|
|
2277
|
+
(l.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(l.value, f.value);
|
|
2825
2278
|
}
|
|
2826
2279
|
return { status: t.value, value: o };
|
|
2827
2280
|
});
|
|
2828
2281
|
} else {
|
|
2829
2282
|
const o = /* @__PURE__ */ new Map();
|
|
2830
|
-
for (const c of
|
|
2831
|
-
const l = c.key,
|
|
2832
|
-
if (l.status === "aborted" ||
|
|
2833
|
-
return
|
|
2834
|
-
(l.status === "dirty" ||
|
|
2283
|
+
for (const c of r) {
|
|
2284
|
+
const l = c.key, f = c.value;
|
|
2285
|
+
if (l.status === "aborted" || f.status === "aborted")
|
|
2286
|
+
return g;
|
|
2287
|
+
(l.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(l.value, f.value);
|
|
2835
2288
|
}
|
|
2836
2289
|
return { status: t.value, value: o };
|
|
2837
2290
|
}
|
|
2838
2291
|
}
|
|
2839
2292
|
}
|
|
2840
|
-
Ne.create = (
|
|
2293
|
+
Ne.create = (i, e, t) => new Ne({
|
|
2841
2294
|
valueType: e,
|
|
2842
|
-
keyType:
|
|
2843
|
-
typeName:
|
|
2295
|
+
keyType: i,
|
|
2296
|
+
typeName: _.ZodMap,
|
|
2844
2297
|
...y(t)
|
|
2845
2298
|
});
|
|
2846
|
-
class
|
|
2299
|
+
class G extends v {
|
|
2847
2300
|
_parse(e) {
|
|
2848
2301
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2849
2302
|
if (s.parsedType !== h.set)
|
|
@@ -2851,7 +2304,7 @@ class Q extends v {
|
|
|
2851
2304
|
code: d.invalid_type,
|
|
2852
2305
|
expected: h.set,
|
|
2853
2306
|
received: s.parsedType
|
|
2854
|
-
}),
|
|
2307
|
+
}), g;
|
|
2855
2308
|
const n = this._def;
|
|
2856
2309
|
n.minSize !== null && s.data.size < n.minSize.value && (u(s, {
|
|
2857
2310
|
code: d.too_small,
|
|
@@ -2868,27 +2321,27 @@ class Q extends v {
|
|
|
2868
2321
|
exact: !1,
|
|
2869
2322
|
message: n.maxSize.message
|
|
2870
2323
|
}), t.dirty());
|
|
2871
|
-
const
|
|
2872
|
-
function
|
|
2324
|
+
const a = this._def.valueType;
|
|
2325
|
+
function r(c) {
|
|
2873
2326
|
const l = /* @__PURE__ */ new Set();
|
|
2874
|
-
for (const
|
|
2875
|
-
if (
|
|
2876
|
-
return
|
|
2877
|
-
|
|
2327
|
+
for (const f of c) {
|
|
2328
|
+
if (f.status === "aborted")
|
|
2329
|
+
return g;
|
|
2330
|
+
f.status === "dirty" && t.dirty(), l.add(f.value);
|
|
2878
2331
|
}
|
|
2879
2332
|
return { status: t.value, value: l };
|
|
2880
2333
|
}
|
|
2881
|
-
const o = [...s.data.values()].map((c, l) =>
|
|
2882
|
-
return s.common.async ? Promise.all(o).then((c) =>
|
|
2334
|
+
const o = [...s.data.values()].map((c, l) => a._parse(new $(s, c, s.path, l)));
|
|
2335
|
+
return s.common.async ? Promise.all(o).then((c) => r(c)) : r(o);
|
|
2883
2336
|
}
|
|
2884
2337
|
min(e, t) {
|
|
2885
|
-
return new
|
|
2338
|
+
return new G({
|
|
2886
2339
|
...this._def,
|
|
2887
2340
|
minSize: { value: e, message: p.toString(t) }
|
|
2888
2341
|
});
|
|
2889
2342
|
}
|
|
2890
2343
|
max(e, t) {
|
|
2891
|
-
return new
|
|
2344
|
+
return new G({
|
|
2892
2345
|
...this._def,
|
|
2893
2346
|
maxSize: { value: e, message: p.toString(t) }
|
|
2894
2347
|
});
|
|
@@ -2900,11 +2353,11 @@ class Q extends v {
|
|
|
2900
2353
|
return this.min(1, e);
|
|
2901
2354
|
}
|
|
2902
2355
|
}
|
|
2903
|
-
|
|
2904
|
-
valueType:
|
|
2356
|
+
G.create = (i, e) => new G({
|
|
2357
|
+
valueType: i,
|
|
2905
2358
|
minSize: null,
|
|
2906
2359
|
maxSize: null,
|
|
2907
|
-
typeName:
|
|
2360
|
+
typeName: _.ZodSet,
|
|
2908
2361
|
...y(e)
|
|
2909
2362
|
});
|
|
2910
2363
|
class Ze extends v {
|
|
@@ -2916,12 +2369,12 @@ class Ze extends v {
|
|
|
2916
2369
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2917
2370
|
}
|
|
2918
2371
|
}
|
|
2919
|
-
Ze.create = (
|
|
2920
|
-
getter:
|
|
2921
|
-
typeName:
|
|
2372
|
+
Ze.create = (i, e) => new Ze({
|
|
2373
|
+
getter: i,
|
|
2374
|
+
typeName: _.ZodLazy,
|
|
2922
2375
|
...y(e)
|
|
2923
2376
|
});
|
|
2924
|
-
class
|
|
2377
|
+
class pe extends v {
|
|
2925
2378
|
_parse(e) {
|
|
2926
2379
|
if (e.data !== this._def.value) {
|
|
2927
2380
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2929,7 +2382,7 @@ class le extends v {
|
|
|
2929
2382
|
received: t.data,
|
|
2930
2383
|
code: d.invalid_literal,
|
|
2931
2384
|
expected: this._def.value
|
|
2932
|
-
}),
|
|
2385
|
+
}), g;
|
|
2933
2386
|
}
|
|
2934
2387
|
return { status: "valid", value: e.data };
|
|
2935
2388
|
}
|
|
@@ -2937,19 +2390,19 @@ class le extends v {
|
|
|
2937
2390
|
return this._def.value;
|
|
2938
2391
|
}
|
|
2939
2392
|
}
|
|
2940
|
-
|
|
2941
|
-
value:
|
|
2942
|
-
typeName:
|
|
2393
|
+
pe.create = (i, e) => new pe({
|
|
2394
|
+
value: i,
|
|
2395
|
+
typeName: _.ZodLiteral,
|
|
2943
2396
|
...y(e)
|
|
2944
2397
|
});
|
|
2945
|
-
function je(
|
|
2946
|
-
return new
|
|
2947
|
-
values:
|
|
2948
|
-
typeName:
|
|
2398
|
+
function je(i, e) {
|
|
2399
|
+
return new H({
|
|
2400
|
+
values: i,
|
|
2401
|
+
typeName: _.ZodEnum,
|
|
2949
2402
|
...y(e)
|
|
2950
2403
|
});
|
|
2951
2404
|
}
|
|
2952
|
-
class
|
|
2405
|
+
class H extends v {
|
|
2953
2406
|
_parse(e) {
|
|
2954
2407
|
if (typeof e.data != "string") {
|
|
2955
2408
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
@@ -2957,7 +2410,7 @@ class L extends v {
|
|
|
2957
2410
|
expected: b.joinValues(s),
|
|
2958
2411
|
received: t.parsedType,
|
|
2959
2412
|
code: d.invalid_type
|
|
2960
|
-
}),
|
|
2413
|
+
}), g;
|
|
2961
2414
|
}
|
|
2962
2415
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2963
2416
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
@@ -2965,7 +2418,7 @@ class L extends v {
|
|
|
2965
2418
|
received: t.data,
|
|
2966
2419
|
code: d.invalid_enum_value,
|
|
2967
2420
|
options: s
|
|
2968
|
-
}),
|
|
2421
|
+
}), g;
|
|
2969
2422
|
}
|
|
2970
2423
|
return C(e.data);
|
|
2971
2424
|
}
|
|
@@ -2991,19 +2444,19 @@ class L extends v {
|
|
|
2991
2444
|
return e;
|
|
2992
2445
|
}
|
|
2993
2446
|
extract(e, t = this._def) {
|
|
2994
|
-
return
|
|
2447
|
+
return H.create(e, {
|
|
2995
2448
|
...this._def,
|
|
2996
2449
|
...t
|
|
2997
2450
|
});
|
|
2998
2451
|
}
|
|
2999
2452
|
exclude(e, t = this._def) {
|
|
3000
|
-
return
|
|
2453
|
+
return H.create(this.options.filter((s) => !e.includes(s)), {
|
|
3001
2454
|
...this._def,
|
|
3002
2455
|
...t
|
|
3003
2456
|
});
|
|
3004
2457
|
}
|
|
3005
2458
|
}
|
|
3006
|
-
|
|
2459
|
+
H.create = je;
|
|
3007
2460
|
class Ae extends v {
|
|
3008
2461
|
_parse(e) {
|
|
3009
2462
|
const t = b.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
@@ -3013,7 +2466,7 @@ class Ae extends v {
|
|
|
3013
2466
|
expected: b.joinValues(n),
|
|
3014
2467
|
received: s.parsedType,
|
|
3015
2468
|
code: d.invalid_type
|
|
3016
|
-
}),
|
|
2469
|
+
}), g;
|
|
3017
2470
|
}
|
|
3018
2471
|
if (this._cache || (this._cache = new Set(b.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
3019
2472
|
const n = b.objectValues(t);
|
|
@@ -3021,7 +2474,7 @@ class Ae extends v {
|
|
|
3021
2474
|
received: s.data,
|
|
3022
2475
|
code: d.invalid_enum_value,
|
|
3023
2476
|
options: n
|
|
3024
|
-
}),
|
|
2477
|
+
}), g;
|
|
3025
2478
|
}
|
|
3026
2479
|
return C(e.data);
|
|
3027
2480
|
}
|
|
@@ -3029,9 +2482,9 @@ class Ae extends v {
|
|
|
3029
2482
|
return this._def.values;
|
|
3030
2483
|
}
|
|
3031
2484
|
}
|
|
3032
|
-
Ae.create = (
|
|
3033
|
-
values:
|
|
3034
|
-
typeName:
|
|
2485
|
+
Ae.create = (i, e) => new Ae({
|
|
2486
|
+
values: i,
|
|
2487
|
+
typeName: _.ZodNativeEnum,
|
|
3035
2488
|
...y(e)
|
|
3036
2489
|
});
|
|
3037
2490
|
class re extends v {
|
|
@@ -3045,7 +2498,7 @@ class re extends v {
|
|
|
3045
2498
|
code: d.invalid_type,
|
|
3046
2499
|
expected: h.promise,
|
|
3047
2500
|
received: t.parsedType
|
|
3048
|
-
}),
|
|
2501
|
+
}), g;
|
|
3049
2502
|
const s = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
|
|
3050
2503
|
return C(s.then((n) => this._def.type.parseAsync(n, {
|
|
3051
2504
|
path: t.path,
|
|
@@ -3053,54 +2506,54 @@ class re extends v {
|
|
|
3053
2506
|
})));
|
|
3054
2507
|
}
|
|
3055
2508
|
}
|
|
3056
|
-
re.create = (
|
|
3057
|
-
type:
|
|
3058
|
-
typeName:
|
|
2509
|
+
re.create = (i, e) => new re({
|
|
2510
|
+
type: i,
|
|
2511
|
+
typeName: _.ZodPromise,
|
|
3059
2512
|
...y(e)
|
|
3060
2513
|
});
|
|
3061
|
-
class
|
|
2514
|
+
class L extends v {
|
|
3062
2515
|
innerType() {
|
|
3063
2516
|
return this._def.schema;
|
|
3064
2517
|
}
|
|
3065
2518
|
sourceType() {
|
|
3066
|
-
return this._def.schema._def.typeName ===
|
|
2519
|
+
return this._def.schema._def.typeName === _.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3067
2520
|
}
|
|
3068
2521
|
_parse(e) {
|
|
3069
|
-
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null,
|
|
3070
|
-
addIssue: (
|
|
3071
|
-
u(s,
|
|
2522
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
2523
|
+
addIssue: (r) => {
|
|
2524
|
+
u(s, r), r.fatal ? t.abort() : t.dirty();
|
|
3072
2525
|
},
|
|
3073
2526
|
get path() {
|
|
3074
2527
|
return s.path;
|
|
3075
2528
|
}
|
|
3076
2529
|
};
|
|
3077
|
-
if (
|
|
3078
|
-
const
|
|
2530
|
+
if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
|
|
2531
|
+
const r = n.transform(s.data, a);
|
|
3079
2532
|
if (s.common.async)
|
|
3080
|
-
return Promise.resolve(
|
|
2533
|
+
return Promise.resolve(r).then(async (o) => {
|
|
3081
2534
|
if (t.value === "aborted")
|
|
3082
|
-
return
|
|
2535
|
+
return g;
|
|
3083
2536
|
const c = await this._def.schema._parseAsync({
|
|
3084
2537
|
data: o,
|
|
3085
2538
|
path: s.path,
|
|
3086
2539
|
parent: s
|
|
3087
2540
|
});
|
|
3088
|
-
return c.status === "aborted" ?
|
|
2541
|
+
return c.status === "aborted" ? g : c.status === "dirty" || t.value === "dirty" ? ue(c.value) : c;
|
|
3089
2542
|
});
|
|
3090
2543
|
{
|
|
3091
2544
|
if (t.value === "aborted")
|
|
3092
|
-
return
|
|
2545
|
+
return g;
|
|
3093
2546
|
const o = this._def.schema._parseSync({
|
|
3094
|
-
data:
|
|
2547
|
+
data: r,
|
|
3095
2548
|
path: s.path,
|
|
3096
2549
|
parent: s
|
|
3097
2550
|
});
|
|
3098
|
-
return o.status === "aborted" ?
|
|
2551
|
+
return o.status === "aborted" ? g : o.status === "dirty" || t.value === "dirty" ? ue(o.value) : o;
|
|
3099
2552
|
}
|
|
3100
2553
|
}
|
|
3101
2554
|
if (n.type === "refinement") {
|
|
3102
|
-
const
|
|
3103
|
-
const c = n.refinement(o,
|
|
2555
|
+
const r = (o) => {
|
|
2556
|
+
const c = n.refinement(o, a);
|
|
3104
2557
|
if (s.common.async)
|
|
3105
2558
|
return Promise.resolve(c);
|
|
3106
2559
|
if (c instanceof Promise)
|
|
@@ -3113,41 +2566,41 @@ class H extends v {
|
|
|
3113
2566
|
path: s.path,
|
|
3114
2567
|
parent: s
|
|
3115
2568
|
});
|
|
3116
|
-
return o.status === "aborted" ?
|
|
2569
|
+
return o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), r(o.value), { status: t.value, value: o.value });
|
|
3117
2570
|
} else
|
|
3118
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ?
|
|
2571
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), r(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
3119
2572
|
}
|
|
3120
2573
|
if (n.type === "transform")
|
|
3121
2574
|
if (s.common.async === !1) {
|
|
3122
|
-
const
|
|
2575
|
+
const r = this._def.schema._parseSync({
|
|
3123
2576
|
data: s.data,
|
|
3124
2577
|
path: s.path,
|
|
3125
2578
|
parent: s
|
|
3126
2579
|
});
|
|
3127
|
-
if (!
|
|
3128
|
-
return
|
|
3129
|
-
const o = n.transform(
|
|
2580
|
+
if (!q(r))
|
|
2581
|
+
return g;
|
|
2582
|
+
const o = n.transform(r.value, a);
|
|
3130
2583
|
if (o instanceof Promise)
|
|
3131
2584
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3132
2585
|
return { status: t.value, value: o };
|
|
3133
2586
|
} else
|
|
3134
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((
|
|
2587
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((r) => q(r) ? Promise.resolve(n.transform(r.value, a)).then((o) => ({
|
|
3135
2588
|
status: t.value,
|
|
3136
2589
|
value: o
|
|
3137
|
-
})) :
|
|
2590
|
+
})) : g);
|
|
3138
2591
|
b.assertNever(n);
|
|
3139
2592
|
}
|
|
3140
2593
|
}
|
|
3141
|
-
|
|
3142
|
-
schema:
|
|
3143
|
-
typeName:
|
|
2594
|
+
L.create = (i, e, t) => new L({
|
|
2595
|
+
schema: i,
|
|
2596
|
+
typeName: _.ZodEffects,
|
|
3144
2597
|
effect: e,
|
|
3145
2598
|
...y(t)
|
|
3146
2599
|
});
|
|
3147
|
-
|
|
2600
|
+
L.createWithPreprocess = (i, e, t) => new L({
|
|
3148
2601
|
schema: e,
|
|
3149
|
-
effect: { type: "preprocess", transform:
|
|
3150
|
-
typeName:
|
|
2602
|
+
effect: { type: "preprocess", transform: i },
|
|
2603
|
+
typeName: _.ZodEffects,
|
|
3151
2604
|
...y(t)
|
|
3152
2605
|
});
|
|
3153
2606
|
class E extends v {
|
|
@@ -3158,268 +2611,829 @@ class E extends v {
|
|
|
3158
2611
|
return this._def.innerType;
|
|
3159
2612
|
}
|
|
3160
2613
|
}
|
|
3161
|
-
E.create = (
|
|
3162
|
-
innerType:
|
|
3163
|
-
typeName:
|
|
3164
|
-
...y(e)
|
|
3165
|
-
});
|
|
3166
|
-
class
|
|
2614
|
+
E.create = (i, e) => new E({
|
|
2615
|
+
innerType: i,
|
|
2616
|
+
typeName: _.ZodOptional,
|
|
2617
|
+
...y(e)
|
|
2618
|
+
});
|
|
2619
|
+
class D extends v {
|
|
2620
|
+
_parse(e) {
|
|
2621
|
+
return this._getType(e) === h.null ? C(null) : this._def.innerType._parse(e);
|
|
2622
|
+
}
|
|
2623
|
+
unwrap() {
|
|
2624
|
+
return this._def.innerType;
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
D.create = (i, e) => new D({
|
|
2628
|
+
innerType: i,
|
|
2629
|
+
typeName: _.ZodNullable,
|
|
2630
|
+
...y(e)
|
|
2631
|
+
});
|
|
2632
|
+
class fe extends v {
|
|
2633
|
+
_parse(e) {
|
|
2634
|
+
const { ctx: t } = this._processInputParams(e);
|
|
2635
|
+
let s = t.data;
|
|
2636
|
+
return t.parsedType === h.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
2637
|
+
data: s,
|
|
2638
|
+
path: t.path,
|
|
2639
|
+
parent: t
|
|
2640
|
+
});
|
|
2641
|
+
}
|
|
2642
|
+
removeDefault() {
|
|
2643
|
+
return this._def.innerType;
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
fe.create = (i, e) => new fe({
|
|
2647
|
+
innerType: i,
|
|
2648
|
+
typeName: _.ZodDefault,
|
|
2649
|
+
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2650
|
+
...y(e)
|
|
2651
|
+
});
|
|
2652
|
+
class me extends v {
|
|
2653
|
+
_parse(e) {
|
|
2654
|
+
const { ctx: t } = this._processInputParams(e), s = {
|
|
2655
|
+
...t,
|
|
2656
|
+
common: {
|
|
2657
|
+
...t.common,
|
|
2658
|
+
issues: []
|
|
2659
|
+
}
|
|
2660
|
+
}, n = this._def.innerType._parse({
|
|
2661
|
+
data: s.data,
|
|
2662
|
+
path: s.path,
|
|
2663
|
+
parent: {
|
|
2664
|
+
...s
|
|
2665
|
+
}
|
|
2666
|
+
});
|
|
2667
|
+
return se(n) ? n.then((a) => ({
|
|
2668
|
+
status: "valid",
|
|
2669
|
+
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2670
|
+
get error() {
|
|
2671
|
+
return new N(s.common.issues);
|
|
2672
|
+
},
|
|
2673
|
+
input: s.data
|
|
2674
|
+
})
|
|
2675
|
+
})) : {
|
|
2676
|
+
status: "valid",
|
|
2677
|
+
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2678
|
+
get error() {
|
|
2679
|
+
return new N(s.common.issues);
|
|
2680
|
+
},
|
|
2681
|
+
input: s.data
|
|
2682
|
+
})
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
removeCatch() {
|
|
2686
|
+
return this._def.innerType;
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
me.create = (i, e) => new me({
|
|
2690
|
+
innerType: i,
|
|
2691
|
+
typeName: _.ZodCatch,
|
|
2692
|
+
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2693
|
+
...y(e)
|
|
2694
|
+
});
|
|
2695
|
+
class Oe extends v {
|
|
2696
|
+
_parse(e) {
|
|
2697
|
+
if (this._getType(e) !== h.nan) {
|
|
2698
|
+
const t = this._getOrReturnCtx(e);
|
|
2699
|
+
return u(t, {
|
|
2700
|
+
code: d.invalid_type,
|
|
2701
|
+
expected: h.nan,
|
|
2702
|
+
received: t.parsedType
|
|
2703
|
+
}), g;
|
|
2704
|
+
}
|
|
2705
|
+
return { status: "valid", value: e.data };
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
Oe.create = (i) => new Oe({
|
|
2709
|
+
typeName: _.ZodNaN,
|
|
2710
|
+
...y(i)
|
|
2711
|
+
});
|
|
2712
|
+
class _t extends v {
|
|
2713
|
+
_parse(e) {
|
|
2714
|
+
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2715
|
+
return this._def.type._parse({
|
|
2716
|
+
data: s,
|
|
2717
|
+
path: t.path,
|
|
2718
|
+
parent: t
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
unwrap() {
|
|
2722
|
+
return this._def.type;
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
class ge extends v {
|
|
2726
|
+
_parse(e) {
|
|
2727
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2728
|
+
if (s.common.async)
|
|
2729
|
+
return (async () => {
|
|
2730
|
+
const n = await this._def.in._parseAsync({
|
|
2731
|
+
data: s.data,
|
|
2732
|
+
path: s.path,
|
|
2733
|
+
parent: s
|
|
2734
|
+
});
|
|
2735
|
+
return n.status === "aborted" ? g : n.status === "dirty" ? (t.dirty(), ue(n.value)) : this._def.out._parseAsync({
|
|
2736
|
+
data: n.value,
|
|
2737
|
+
path: s.path,
|
|
2738
|
+
parent: s
|
|
2739
|
+
});
|
|
2740
|
+
})();
|
|
2741
|
+
{
|
|
2742
|
+
const n = this._def.in._parseSync({
|
|
2743
|
+
data: s.data,
|
|
2744
|
+
path: s.path,
|
|
2745
|
+
parent: s
|
|
2746
|
+
});
|
|
2747
|
+
return n.status === "aborted" ? g : n.status === "dirty" ? (t.dirty(), {
|
|
2748
|
+
status: "dirty",
|
|
2749
|
+
value: n.value
|
|
2750
|
+
}) : this._def.out._parseSync({
|
|
2751
|
+
data: n.value,
|
|
2752
|
+
path: s.path,
|
|
2753
|
+
parent: s
|
|
2754
|
+
});
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
static create(e, t) {
|
|
2758
|
+
return new ge({
|
|
2759
|
+
in: e,
|
|
2760
|
+
out: t,
|
|
2761
|
+
typeName: _.ZodPipeline
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
class _e extends v {
|
|
3167
2766
|
_parse(e) {
|
|
3168
|
-
|
|
2767
|
+
const t = this._def.innerType._parse(e), s = (n) => (q(n) && (n.value = Object.freeze(n.value)), n);
|
|
2768
|
+
return se(t) ? t.then((n) => s(n)) : s(t);
|
|
3169
2769
|
}
|
|
3170
2770
|
unwrap() {
|
|
3171
2771
|
return this._def.innerType;
|
|
3172
2772
|
}
|
|
3173
2773
|
}
|
|
3174
|
-
|
|
3175
|
-
innerType:
|
|
3176
|
-
typeName:
|
|
2774
|
+
_e.create = (i, e) => new _e({
|
|
2775
|
+
innerType: i,
|
|
2776
|
+
typeName: _.ZodReadonly,
|
|
3177
2777
|
...y(e)
|
|
3178
2778
|
});
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
2779
|
+
var _;
|
|
2780
|
+
(function(i) {
|
|
2781
|
+
i.ZodString = "ZodString", i.ZodNumber = "ZodNumber", i.ZodNaN = "ZodNaN", i.ZodBigInt = "ZodBigInt", i.ZodBoolean = "ZodBoolean", i.ZodDate = "ZodDate", i.ZodSymbol = "ZodSymbol", i.ZodUndefined = "ZodUndefined", i.ZodNull = "ZodNull", i.ZodAny = "ZodAny", i.ZodUnknown = "ZodUnknown", i.ZodNever = "ZodNever", i.ZodVoid = "ZodVoid", i.ZodArray = "ZodArray", i.ZodObject = "ZodObject", i.ZodUnion = "ZodUnion", i.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", i.ZodIntersection = "ZodIntersection", i.ZodTuple = "ZodTuple", i.ZodRecord = "ZodRecord", i.ZodMap = "ZodMap", i.ZodSet = "ZodSet", i.ZodFunction = "ZodFunction", i.ZodLazy = "ZodLazy", i.ZodLiteral = "ZodLiteral", i.ZodEnum = "ZodEnum", i.ZodEffects = "ZodEffects", i.ZodNativeEnum = "ZodNativeEnum", i.ZodOptional = "ZodOptional", i.ZodNullable = "ZodNullable", i.ZodDefault = "ZodDefault", i.ZodCatch = "ZodCatch", i.ZodPromise = "ZodPromise", i.ZodBranded = "ZodBranded", i.ZodPipeline = "ZodPipeline", i.ZodReadonly = "ZodReadonly";
|
|
2782
|
+
})(_ || (_ = {}));
|
|
2783
|
+
const Z = O.create, Pe = le.create;
|
|
2784
|
+
j.create;
|
|
2785
|
+
I.create;
|
|
2786
|
+
const Re = k.create;
|
|
2787
|
+
ie.create;
|
|
2788
|
+
ae.create;
|
|
2789
|
+
R.create;
|
|
2790
|
+
const Fe = pe.create, gt = H.create;
|
|
2791
|
+
re.create;
|
|
2792
|
+
E.create;
|
|
2793
|
+
D.create;
|
|
2794
|
+
const yt = Re({
|
|
2795
|
+
type: Fe("bridge"),
|
|
2796
|
+
name: Z(),
|
|
2797
|
+
data: Pe()
|
|
2798
|
+
});
|
|
2799
|
+
function Pt(i) {
|
|
2800
|
+
return { ...i, type: "bridge" };
|
|
2801
|
+
}
|
|
2802
|
+
const vt = Re({
|
|
2803
|
+
type: Fe("client"),
|
|
2804
|
+
telemetrySdkVersion: Z(),
|
|
2805
|
+
applicationSpecifier: Z(),
|
|
2806
|
+
applicationInstance: Z(),
|
|
2807
|
+
runtime: gt(["window", "worker"]),
|
|
2808
|
+
name: Z(),
|
|
2809
|
+
data: Pe(),
|
|
2810
|
+
responseName: Z().optional(),
|
|
2811
|
+
subscriptionName: Z().optional(),
|
|
2812
|
+
unsubscribeName: Z().optional()
|
|
2813
|
+
});
|
|
2814
|
+
function Y(i) {
|
|
2815
|
+
return { ...i, type: "client" };
|
|
2816
|
+
}
|
|
2817
|
+
class bt {
|
|
2818
|
+
constructor(e) {
|
|
2819
|
+
this._client = e;
|
|
3188
2820
|
}
|
|
3189
|
-
|
|
3190
|
-
|
|
2821
|
+
/**
|
|
2822
|
+
* Provides access to the application store scope.
|
|
2823
|
+
*
|
|
2824
|
+
* Data stored in the application scope is shared across all instances of your application
|
|
2825
|
+
* within the current account. Use this scope for application-wide settings, shared resources,
|
|
2826
|
+
* or any data that should be consistent across all instances.
|
|
2827
|
+
*
|
|
2828
|
+
* @returns A StoreSlice instance for the application scope
|
|
2829
|
+
*/
|
|
2830
|
+
get application() {
|
|
2831
|
+
return new X("application", "application", this._client);
|
|
2832
|
+
}
|
|
2833
|
+
/**
|
|
2834
|
+
* Provides access to the instance store scope.
|
|
2835
|
+
*
|
|
2836
|
+
* Data stored in the instance scope is only available to the current instance of your
|
|
2837
|
+
* application. This is ideal for instance-specific settings, UI state, temporary data,
|
|
2838
|
+
* or any information that shouldn't be shared with other instances.
|
|
2839
|
+
*
|
|
2840
|
+
* @returns A StoreSlice instance for the instance scope
|
|
2841
|
+
*/
|
|
2842
|
+
get instance() {
|
|
2843
|
+
return new X("instance", this._client.applicationInstance, this._client);
|
|
2844
|
+
}
|
|
2845
|
+
/**
|
|
2846
|
+
* Provides access to the device store scope.
|
|
2847
|
+
*
|
|
2848
|
+
* Data stored in the device scope is only available to the application on the
|
|
2849
|
+
* current physical device. This is useful for device-specific settings, caching, or
|
|
2850
|
+
* any data that should persist across application instances but only on a single device.
|
|
2851
|
+
*
|
|
2852
|
+
* Note: This scope cannot be used for Settings-related mount points as the User
|
|
2853
|
+
* Administration UI does not run on a device.
|
|
2854
|
+
*
|
|
2855
|
+
* @returns A StoreSlice instance for the device scope
|
|
2856
|
+
*/
|
|
2857
|
+
get device() {
|
|
2858
|
+
return new X("device", this._client.deviceId, this._client);
|
|
2859
|
+
}
|
|
2860
|
+
/**
|
|
2861
|
+
* Provides access to the shared store scope with a specified namespace.
|
|
2862
|
+
*
|
|
2863
|
+
* The shared scope enables data sharing between different applications within the
|
|
2864
|
+
* same account. By specifying a common namespace, any two applications can exchange
|
|
2865
|
+
* data and communicate with each other.
|
|
2866
|
+
*
|
|
2867
|
+
* This is particularly useful for application ecosystems where multiple applications
|
|
2868
|
+
* need to coordinate or share configuration.
|
|
2869
|
+
*
|
|
2870
|
+
* @param namespace A string identifier for the shared data space
|
|
2871
|
+
* @returns A StoreSlice instance for the specified shared namespace
|
|
2872
|
+
*/
|
|
2873
|
+
shared(e) {
|
|
2874
|
+
return new X("shared", e, this._client);
|
|
3191
2875
|
}
|
|
3192
2876
|
}
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3197
|
-
...y(e)
|
|
3198
|
-
});
|
|
3199
|
-
class pe extends v {
|
|
3200
|
-
_parse(e) {
|
|
3201
|
-
const { ctx: t } = this._processInputParams(e), s = {
|
|
3202
|
-
...t,
|
|
3203
|
-
common: {
|
|
3204
|
-
...t.common,
|
|
3205
|
-
issues: []
|
|
3206
|
-
}
|
|
3207
|
-
}, n = this._def.innerType._parse({
|
|
3208
|
-
data: s.data,
|
|
3209
|
-
path: s.path,
|
|
3210
|
-
parent: {
|
|
3211
|
-
...s
|
|
3212
|
-
}
|
|
3213
|
-
});
|
|
3214
|
-
return te(n) ? n.then((r) => ({
|
|
3215
|
-
status: "valid",
|
|
3216
|
-
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
3217
|
-
get error() {
|
|
3218
|
-
return new Z(s.common.issues);
|
|
3219
|
-
},
|
|
3220
|
-
input: s.data
|
|
3221
|
-
})
|
|
3222
|
-
})) : {
|
|
3223
|
-
status: "valid",
|
|
3224
|
-
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
3225
|
-
get error() {
|
|
3226
|
-
return new Z(s.common.issues);
|
|
3227
|
-
},
|
|
3228
|
-
input: s.data
|
|
3229
|
-
})
|
|
3230
|
-
};
|
|
2877
|
+
class X {
|
|
2878
|
+
constructor(e, t, s) {
|
|
2879
|
+
this._kind = e, this._namespace = t, this._client = s;
|
|
3231
2880
|
}
|
|
3232
|
-
|
|
3233
|
-
|
|
2881
|
+
/**
|
|
2882
|
+
* Saves a value in the store.
|
|
2883
|
+
*
|
|
2884
|
+
* This method stores data under the specified key within the current store scope and namespace.
|
|
2885
|
+
* The value must be serializable (can be converted to JSON). Complex objects like Date instances
|
|
2886
|
+
* will be serialized and deserialize as regular objects, losing their prototype methods.
|
|
2887
|
+
*
|
|
2888
|
+
* @param key The key to save the value under
|
|
2889
|
+
* @param value The value to store - must be JSON serializable
|
|
2890
|
+
* @returns A promise that resolves to true if the value was saved successfully
|
|
2891
|
+
*/
|
|
2892
|
+
async set(e, t) {
|
|
2893
|
+
return (await this._client.request("store.set", {
|
|
2894
|
+
kind: this._kind,
|
|
2895
|
+
namespace: this._namespace,
|
|
2896
|
+
key: e,
|
|
2897
|
+
value: t
|
|
2898
|
+
})).success;
|
|
2899
|
+
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Retrieves a value from the store.
|
|
2902
|
+
*
|
|
2903
|
+
* This method fetches data stored under the specified key within the current store scope
|
|
2904
|
+
* and namespace. For real-time applications that need to respond to changes, consider
|
|
2905
|
+
* using subscribe() instead.
|
|
2906
|
+
*
|
|
2907
|
+
* @template T The expected type of the stored value
|
|
2908
|
+
* @param key The key to retrieve the value for
|
|
2909
|
+
* @returns A promise that resolves to the stored value, or undefined if the key does not exist
|
|
2910
|
+
*/
|
|
2911
|
+
async get(e) {
|
|
2912
|
+
return (await this._client.request("store.get", {
|
|
2913
|
+
kind: this._kind,
|
|
2914
|
+
namespace: this._namespace,
|
|
2915
|
+
key: e
|
|
2916
|
+
})).value;
|
|
2917
|
+
}
|
|
2918
|
+
/**
|
|
2919
|
+
* Subscribes to changes in the store for a specific key.
|
|
2920
|
+
*
|
|
2921
|
+
* This method sets up a subscription that will call the provided handler whenever
|
|
2922
|
+
* the value associated with the specified key changes. This is the recommended way
|
|
2923
|
+
* to access store data in long-running applications that need to stay responsive
|
|
2924
|
+
* to data changes.
|
|
2925
|
+
*
|
|
2926
|
+
* @param key The key to subscribe to
|
|
2927
|
+
* @param handler The callback function to call when the value changes
|
|
2928
|
+
* @returns A promise that resolves to true if the subscription was successful
|
|
2929
|
+
*/
|
|
2930
|
+
async subscribe(e, t) {
|
|
2931
|
+
return (await this._client.subscribe("store.subscribe", {
|
|
2932
|
+
kind: this._kind,
|
|
2933
|
+
namespace: this._namespace,
|
|
2934
|
+
key: e
|
|
2935
|
+
}, t)).success;
|
|
2936
|
+
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Unsubscribes from changes in the store for a specific key.
|
|
2939
|
+
*
|
|
2940
|
+
* This method removes a subscription previously created with subscribe(). It can
|
|
2941
|
+
* either remove a specific handler or all handlers for the given key.
|
|
2942
|
+
*
|
|
2943
|
+
* @param key The key to unsubscribe from
|
|
2944
|
+
* @param handler Optional. The specific handler to remove. If not provided, all handlers for this key will be removed.
|
|
2945
|
+
* @returns A promise that resolves to true if the unsubscribe was successful
|
|
2946
|
+
*/
|
|
2947
|
+
async unsubscribe(e, t) {
|
|
2948
|
+
return (await this._client.unsubscribe("store.unsubscribe", {
|
|
2949
|
+
kind: this._kind,
|
|
2950
|
+
namespace: this._namespace,
|
|
2951
|
+
key: e
|
|
2952
|
+
}, t)).success;
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Deletes a value from the store.
|
|
2956
|
+
*
|
|
2957
|
+
* This method removes the data stored under the specified key within the
|
|
2958
|
+
* current store scope and namespace.
|
|
2959
|
+
*
|
|
2960
|
+
* @param key The key to delete
|
|
2961
|
+
* @returns A promise that resolves to true if the value was deleted successfully
|
|
2962
|
+
*/
|
|
2963
|
+
async delete(e) {
|
|
2964
|
+
return (await this._client.request("store.delete", {
|
|
2965
|
+
kind: this._kind,
|
|
2966
|
+
namespace: this._namespace,
|
|
2967
|
+
key: e
|
|
2968
|
+
})).success;
|
|
3234
2969
|
}
|
|
3235
2970
|
}
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
}
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
if (
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
2971
|
+
class wt {
|
|
2972
|
+
/**
|
|
2973
|
+
* Creates a new RootSettingsNavigation API instance.
|
|
2974
|
+
*
|
|
2975
|
+
* @param store The Store instance to use for persistence
|
|
2976
|
+
* @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
|
|
2977
|
+
*/
|
|
2978
|
+
constructor(e) {
|
|
2979
|
+
if (e._client._applicationSpecifier !== "rootSettingsNavigation")
|
|
2980
|
+
throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");
|
|
2981
|
+
this._store = e;
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* Registers navigation entries for the root application in the TelemetryOS admin UI.
|
|
2985
|
+
*
|
|
2986
|
+
* This method allows a root application to define its sidebar navigation structure
|
|
2987
|
+
* within the TelemetryOS administration UI. The navigation entries will appear in the
|
|
2988
|
+
* sidebar menu, allowing users to navigate to different sections of the application.
|
|
2989
|
+
*
|
|
2990
|
+
* @param navigation An object containing the navigation entries to register
|
|
2991
|
+
* @returns A promise that resolves when the navigation has been registered
|
|
2992
|
+
*/
|
|
2993
|
+
async setRootSettingsNavigation(e) {
|
|
2994
|
+
var t;
|
|
2995
|
+
const s = this._store.shared("root-settings-navigation"), n = (t = await s.get("navigation")) !== null && t !== void 0 ? t : {}, a = this._store._client._applicationSpecifier;
|
|
2996
|
+
n[a] = {
|
|
2997
|
+
applicationSpecifier: a,
|
|
2998
|
+
entries: e.entries
|
|
2999
|
+
}, s.set("navigation", n);
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Retrieves the current navigation entries for this root application.
|
|
3003
|
+
*
|
|
3004
|
+
* This method returns the navigation structure that was previously registered
|
|
3005
|
+
* for this application using setRootSettingsNavigation().
|
|
3006
|
+
*
|
|
3007
|
+
* @returns A promise that resolves to the navigation state for this application
|
|
3008
|
+
*/
|
|
3009
|
+
async getRootSettingsNavigation() {
|
|
3010
|
+
var e;
|
|
3011
|
+
const s = (e = await this._store.shared("root-settings-navigation").get("navigation")) !== null && e !== void 0 ? e : {}, n = this._store._client._applicationSpecifier;
|
|
3012
|
+
return s[n];
|
|
3013
|
+
}
|
|
3014
|
+
/**
|
|
3015
|
+
* Retrieves the navigation entries for all root applications.
|
|
3016
|
+
*
|
|
3017
|
+
* This method returns the navigation structures for all root applications registered
|
|
3018
|
+
* in the TelemetryOS administration UI. This can be useful for coordination between
|
|
3019
|
+
* different root applications.
|
|
3020
|
+
*
|
|
3021
|
+
* @returns A promise that resolves to the navigation state for all applications
|
|
3022
|
+
*/
|
|
3023
|
+
async getAllRootSettingsNavigation() {
|
|
3024
|
+
var e;
|
|
3025
|
+
return (e = await this._store.shared("root-settings-navigation").get("navigation")) !== null && e !== void 0 ? e : {};
|
|
3253
3026
|
}
|
|
3254
3027
|
}
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
});
|
|
3259
|
-
class xt extends v {
|
|
3260
|
-
_parse(e) {
|
|
3261
|
-
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3262
|
-
return this._def.type._parse({
|
|
3263
|
-
data: s,
|
|
3264
|
-
path: t.path,
|
|
3265
|
-
parent: t
|
|
3266
|
-
});
|
|
3028
|
+
class kt {
|
|
3029
|
+
constructor(e) {
|
|
3030
|
+
this._client = e;
|
|
3267
3031
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3032
|
+
/**
|
|
3033
|
+
* Retrieves information about the user associated with the current session.
|
|
3034
|
+
*
|
|
3035
|
+
* This method allows an application to get details about the TelemetryOS user
|
|
3036
|
+
* who is currently using the application.
|
|
3037
|
+
*
|
|
3038
|
+
* @returns A promise that resolves to the current user result object
|
|
3039
|
+
* @example
|
|
3040
|
+
* // Get the current user information
|
|
3041
|
+
* const userResult = await users.getCurrent();
|
|
3042
|
+
* console.log(`Current user ID: ${userResult.user.id}`);
|
|
3043
|
+
*/
|
|
3044
|
+
async getCurrent() {
|
|
3045
|
+
const e = await this._client.request("users.getCurrent", {});
|
|
3046
|
+
if (!e.success)
|
|
3047
|
+
throw new Error(e.error || "Failed to fetch current user");
|
|
3048
|
+
return e.user;
|
|
3270
3049
|
}
|
|
3271
3050
|
}
|
|
3272
|
-
class
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
if (s.common.async)
|
|
3276
|
-
return (async () => {
|
|
3277
|
-
const n = await this._def.in._parseAsync({
|
|
3278
|
-
data: s.data,
|
|
3279
|
-
path: s.path,
|
|
3280
|
-
parent: s
|
|
3281
|
-
});
|
|
3282
|
-
return n.status === "aborted" ? _ : n.status === "dirty" ? (t.dirty(), ce(n.value)) : this._def.out._parseAsync({
|
|
3283
|
-
data: n.value,
|
|
3284
|
-
path: s.path,
|
|
3285
|
-
parent: s
|
|
3286
|
-
});
|
|
3287
|
-
})();
|
|
3288
|
-
{
|
|
3289
|
-
const n = this._def.in._parseSync({
|
|
3290
|
-
data: s.data,
|
|
3291
|
-
path: s.path,
|
|
3292
|
-
parent: s
|
|
3293
|
-
});
|
|
3294
|
-
return n.status === "aborted" ? _ : n.status === "dirty" ? (t.dirty(), {
|
|
3295
|
-
status: "dirty",
|
|
3296
|
-
value: n.value
|
|
3297
|
-
}) : this._def.out._parseSync({
|
|
3298
|
-
data: n.value,
|
|
3299
|
-
path: s.path,
|
|
3300
|
-
parent: s
|
|
3301
|
-
});
|
|
3302
|
-
}
|
|
3051
|
+
class xt {
|
|
3052
|
+
constructor(e) {
|
|
3053
|
+
this._client = e;
|
|
3303
3054
|
}
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3055
|
+
async fetch(e, t) {
|
|
3056
|
+
var s;
|
|
3057
|
+
let n;
|
|
3058
|
+
typeof e == "string" ? n = e : e instanceof URL ? n = e.toString() : (n = e.url, t || (t = {
|
|
3059
|
+
method: e.method,
|
|
3060
|
+
headers: e.headers,
|
|
3061
|
+
body: e.body,
|
|
3062
|
+
credentials: e.credentials,
|
|
3063
|
+
cache: e.cache,
|
|
3064
|
+
redirect: e.redirect,
|
|
3065
|
+
referrer: e.referrer,
|
|
3066
|
+
integrity: e.integrity
|
|
3067
|
+
}));
|
|
3068
|
+
let a = {};
|
|
3069
|
+
t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((f, w) => {
|
|
3070
|
+
a[w] = f;
|
|
3071
|
+
}) : Array.isArray(t.headers) ? t.headers.forEach(([f, w]) => {
|
|
3072
|
+
a[f] = w;
|
|
3073
|
+
}) : a = t.headers);
|
|
3074
|
+
const r = await this._client.request("proxy.fetch", {
|
|
3075
|
+
url: n,
|
|
3076
|
+
method: (t == null ? void 0 : t.method) || "GET",
|
|
3077
|
+
headers: a,
|
|
3078
|
+
body: (s = t == null ? void 0 : t.body) !== null && s !== void 0 ? s : null
|
|
3309
3079
|
});
|
|
3080
|
+
if (!r.success)
|
|
3081
|
+
throw new TypeError(r.errorMessage, {
|
|
3082
|
+
cause: r.errorCause ? Error(r.errorCause) : void 0
|
|
3083
|
+
});
|
|
3084
|
+
const o = new Headers(r.headers), c = {
|
|
3085
|
+
status: r.status,
|
|
3086
|
+
statusText: r.statusText,
|
|
3087
|
+
headers: o
|
|
3088
|
+
};
|
|
3089
|
+
let l = null;
|
|
3090
|
+
if (r.body !== null && r.body !== void 0)
|
|
3091
|
+
if (r.bodyType === "binary") {
|
|
3092
|
+
const f = atob(r.body), w = new Uint8Array(f.length);
|
|
3093
|
+
for (let S = 0; S < f.length; S++)
|
|
3094
|
+
w[S] = f.charCodeAt(S);
|
|
3095
|
+
l = w;
|
|
3096
|
+
} else r.bodyType === "text" ? l = r.body : r.bodyType === "json" && (l = JSON.stringify(r.body));
|
|
3097
|
+
return new Response(l, c);
|
|
3310
3098
|
}
|
|
3311
3099
|
}
|
|
3312
|
-
class
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
return te(t) ? t.then((n) => s(n)) : s(t);
|
|
3100
|
+
class St {
|
|
3101
|
+
constructor(e) {
|
|
3102
|
+
this._client = e;
|
|
3316
3103
|
}
|
|
3317
|
-
|
|
3318
|
-
|
|
3104
|
+
/**
|
|
3105
|
+
* Retrieves hardware information about the current physical device.
|
|
3106
|
+
*
|
|
3107
|
+
* This method returns details about the device running the application, such as
|
|
3108
|
+
* serial number, model, manufacturer, and platform. This information is only
|
|
3109
|
+
* available when running on a physical device (player), not in the admin UI.
|
|
3110
|
+
*
|
|
3111
|
+
* @returns A promise that resolves to the device hardware information
|
|
3112
|
+
* @example
|
|
3113
|
+
* // Get hardware info of the current device
|
|
3114
|
+
* const info = await devices.getInformation();
|
|
3115
|
+
* console.log(`Device: ${info.deviceManufacturer} ${info.deviceModel}`);
|
|
3116
|
+
*/
|
|
3117
|
+
async getInformation() {
|
|
3118
|
+
const e = await this._client.request("devices.getInformation", {});
|
|
3119
|
+
if (!e.success)
|
|
3120
|
+
throw new Error("Failed to get device information");
|
|
3121
|
+
return e.deviceInformation;
|
|
3122
|
+
}
|
|
3123
|
+
/**
|
|
3124
|
+
* Retrieves the capabilities of the current device.
|
|
3125
|
+
*
|
|
3126
|
+
* Capabilities indicate what hardware and software features are available on
|
|
3127
|
+
* the device running the application. This can be used to conditionally enable
|
|
3128
|
+
* features based on what the device supports (e.g., MQTT, Bluetooth, WiFi).
|
|
3129
|
+
*
|
|
3130
|
+
* @returns A promise that resolves to an array of device capability strings
|
|
3131
|
+
* @example
|
|
3132
|
+
* const capabilities = await devices.getCapabilities();
|
|
3133
|
+
* if (capabilities.includes('mqtt')) {
|
|
3134
|
+
* // Enable MQTT features
|
|
3135
|
+
* }
|
|
3136
|
+
*/
|
|
3137
|
+
async getCapabilities() {
|
|
3138
|
+
const e = await this._client.request("devices.getCapabilities", {});
|
|
3139
|
+
if (!e.success)
|
|
3140
|
+
throw new Error("Failed to get device capabilities");
|
|
3141
|
+
return e.capabilities;
|
|
3319
3142
|
}
|
|
3320
3143
|
}
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
});
|
|
3326
|
-
var m;
|
|
3327
|
-
(function(a) {
|
|
3328
|
-
a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
|
|
3329
|
-
})(m || (m = {}));
|
|
3330
|
-
const A = I.create, Pe = de.create;
|
|
3331
|
-
P.create;
|
|
3332
|
-
N.create;
|
|
3333
|
-
const Re = k.create;
|
|
3334
|
-
ne.create;
|
|
3335
|
-
ae.create;
|
|
3336
|
-
$.create;
|
|
3337
|
-
const $e = le.create;
|
|
3338
|
-
L.create;
|
|
3339
|
-
re.create;
|
|
3340
|
-
E.create;
|
|
3341
|
-
z.create;
|
|
3342
|
-
const St = Re({
|
|
3343
|
-
type: $e("bridge"),
|
|
3344
|
-
name: A(),
|
|
3345
|
-
data: Pe()
|
|
3346
|
-
});
|
|
3347
|
-
Re({
|
|
3348
|
-
type: $e("client"),
|
|
3349
|
-
telemetrySdkVersion: A(),
|
|
3350
|
-
applicationSpecifier: A(),
|
|
3351
|
-
applicationInstance: A(),
|
|
3352
|
-
name: A(),
|
|
3353
|
-
data: Pe(),
|
|
3354
|
-
responseName: A().optional(),
|
|
3355
|
-
subscriptionName: A().optional(),
|
|
3356
|
-
unsubscribeName: A().optional()
|
|
3357
|
-
});
|
|
3358
|
-
function Y(a) {
|
|
3359
|
-
return { ...a, type: "client" };
|
|
3360
|
-
}
|
|
3361
|
-
class Ct {
|
|
3144
|
+
class Tt {
|
|
3145
|
+
constructor(e) {
|
|
3146
|
+
this._client = e;
|
|
3147
|
+
}
|
|
3362
3148
|
/**
|
|
3363
|
-
*
|
|
3149
|
+
* Searches for cities by name or country
|
|
3364
3150
|
*
|
|
3365
|
-
* @param
|
|
3366
|
-
* @
|
|
3151
|
+
* @param params - Search parameters including optional country code and search query
|
|
3152
|
+
* @returns A promise that resolves to an array of matching cities
|
|
3153
|
+
* @throws {Error} If the request fails
|
|
3154
|
+
*
|
|
3155
|
+
* @example
|
|
3156
|
+
* ```typescript
|
|
3157
|
+
* // Search for cities named "New York"
|
|
3158
|
+
* const cities = await weather.getCities({ search: 'New York' })
|
|
3159
|
+
*
|
|
3160
|
+
* // Search for cities in the United States
|
|
3161
|
+
* const cities = await weather.getCities({ countryCode: 'US' })
|
|
3162
|
+
*
|
|
3163
|
+
* // Get a cityId for use in other methods
|
|
3164
|
+
* const cities = await weather.getCities({ search: 'London' })
|
|
3165
|
+
* const cityId = cities[0].cityId
|
|
3166
|
+
* ```
|
|
3167
|
+
*/
|
|
3168
|
+
async getCities(e) {
|
|
3169
|
+
const t = await this._client.request("weather.getCities", e);
|
|
3170
|
+
if (!t.success)
|
|
3171
|
+
throw new Error(t.error || "Failed to fetch cities");
|
|
3172
|
+
return t.data || [];
|
|
3173
|
+
}
|
|
3174
|
+
/**
|
|
3175
|
+
* Retrieves current weather conditions for a specified city
|
|
3176
|
+
*
|
|
3177
|
+
* @param params - Weather request parameters including cityId and optional language
|
|
3178
|
+
* @returns A promise that resolves to the current weather conditions with dual units (C/F, kph/mph, etc.)
|
|
3179
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
3180
|
+
*
|
|
3181
|
+
* @example
|
|
3182
|
+
* ```typescript
|
|
3183
|
+
* // Get current conditions for a city
|
|
3184
|
+
* const conditions = await weather.getConditions({ cityId: 12345 })
|
|
3185
|
+
*
|
|
3186
|
+
* // With localized language
|
|
3187
|
+
* const conditions = await weather.getConditions({
|
|
3188
|
+
* cityId: 12345,
|
|
3189
|
+
* language: 'es'
|
|
3190
|
+
* })
|
|
3191
|
+
*
|
|
3192
|
+
* // Access both units
|
|
3193
|
+
* console.log(`${conditions.temperatureC}°C / ${conditions.temperatureF}°F`)
|
|
3194
|
+
* console.log(`${conditions.windSpeedKph} kph / ${conditions.windSpeedMph} mph`)
|
|
3195
|
+
* ```
|
|
3196
|
+
*/
|
|
3197
|
+
async getConditions(e) {
|
|
3198
|
+
const t = await this._client.request("weather.getConditions", e);
|
|
3199
|
+
if (!t.success)
|
|
3200
|
+
throw new Error(t.error || "Failed to fetch weather conditions");
|
|
3201
|
+
return t;
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* Retrieves daily weather forecast for a specified city
|
|
3205
|
+
*
|
|
3206
|
+
* @param params - Forecast request parameters including cityId, optional language and days
|
|
3207
|
+
* @returns A promise that resolves to daily forecast data with location information
|
|
3208
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
3209
|
+
*
|
|
3210
|
+
* @example
|
|
3211
|
+
* ```typescript
|
|
3212
|
+
* // Get 5-day forecast
|
|
3213
|
+
* const forecast = await weather.getDailyForecast({ cityId: 12345 })
|
|
3214
|
+
*
|
|
3215
|
+
* // Get 10-day forecast
|
|
3216
|
+
* const forecast = await weather.getDailyForecast({ cityId: 12345, days: 10 })
|
|
3217
|
+
*
|
|
3218
|
+
* // Access forecast data
|
|
3219
|
+
* forecast.data.forEach(day => {
|
|
3220
|
+
* console.log(`${day.forecastDate}: ${day.weatherDescription}`)
|
|
3221
|
+
* console.log(`High: ${day.maxTemperatureC}°C, Low: ${day.minTemperatureC}°C`)
|
|
3222
|
+
* })
|
|
3223
|
+
* ```
|
|
3224
|
+
*/
|
|
3225
|
+
async getDailyForecast(e) {
|
|
3226
|
+
const t = await this._client.request("weather.getDailyForecast", e);
|
|
3227
|
+
if (!t.success)
|
|
3228
|
+
throw new Error(t.error || "Failed to fetch daily forecast");
|
|
3229
|
+
return t;
|
|
3230
|
+
}
|
|
3231
|
+
/**
|
|
3232
|
+
* Retrieves hourly weather forecast for a specified city
|
|
3233
|
+
*
|
|
3234
|
+
* @param params - Forecast request parameters including cityId, optional language and hours
|
|
3235
|
+
* @returns A promise that resolves to hourly forecast data with location information
|
|
3236
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
3237
|
+
*
|
|
3238
|
+
* @example
|
|
3239
|
+
* ```typescript
|
|
3240
|
+
* // Get 24-hour forecast
|
|
3241
|
+
* const forecast = await weather.getHourlyForecast({ cityId: 12345, hours: 24 })
|
|
3242
|
+
*
|
|
3243
|
+
* // Get 48-hour forecast
|
|
3244
|
+
* const forecast = await weather.getHourlyForecast({ cityId: 12345, hours: 48 })
|
|
3245
|
+
*
|
|
3246
|
+
* // Access forecast data
|
|
3247
|
+
* forecast.data.forEach(hour => {
|
|
3248
|
+
* console.log(`${hour.forecastTimeLocal}: ${hour.weatherDescription}`)
|
|
3249
|
+
* console.log(`Temp: ${hour.temperatureC}°C`)
|
|
3250
|
+
* })
|
|
3251
|
+
* ```
|
|
3367
3252
|
*/
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3253
|
+
async getHourlyForecast(e) {
|
|
3254
|
+
const t = await this._client.request("weather.getHourlyForecast", e);
|
|
3255
|
+
if (!t.success)
|
|
3256
|
+
throw new Error(t.error || "Failed to fetch hourly forecast");
|
|
3257
|
+
return t;
|
|
3372
3258
|
}
|
|
3373
3259
|
/**
|
|
3374
|
-
*
|
|
3260
|
+
* Retrieves weather alerts and warnings for a specified city
|
|
3375
3261
|
*
|
|
3376
|
-
*
|
|
3377
|
-
*
|
|
3378
|
-
*
|
|
3262
|
+
* @param params - Alert request parameters including cityId and optional language
|
|
3263
|
+
* @returns A promise that resolves to weather alerts with location information
|
|
3264
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
3379
3265
|
*
|
|
3380
|
-
* @
|
|
3381
|
-
*
|
|
3266
|
+
* @example
|
|
3267
|
+
* ```typescript
|
|
3268
|
+
* // Get weather alerts for a city
|
|
3269
|
+
* const alerts = await weather.getAlerts({ cityId: 12345 })
|
|
3270
|
+
*
|
|
3271
|
+
* // Check if there are any active alerts
|
|
3272
|
+
* if (alerts.alerts.length > 0) {
|
|
3273
|
+
* alerts.alerts.forEach(alert => {
|
|
3274
|
+
* console.log(`${alert.severity}: ${alert.title}`)
|
|
3275
|
+
* console.log(alert.description)
|
|
3276
|
+
* })
|
|
3277
|
+
* }
|
|
3278
|
+
* ```
|
|
3382
3279
|
*/
|
|
3383
|
-
async
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3280
|
+
async getAlerts(e) {
|
|
3281
|
+
const t = await this._client.request("weather.getAlerts", e);
|
|
3282
|
+
if (!t.success)
|
|
3283
|
+
throw new Error(t.error || "Failed to fetch weather alerts");
|
|
3284
|
+
return t;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
class Ct {
|
|
3288
|
+
constructor(e) {
|
|
3289
|
+
this._client = e;
|
|
3390
3290
|
}
|
|
3391
3291
|
/**
|
|
3392
|
-
* Retrieves
|
|
3292
|
+
* Retrieves all available currency symbols and their full names.
|
|
3393
3293
|
*
|
|
3394
|
-
*
|
|
3395
|
-
*
|
|
3294
|
+
* @returns A promise that resolves to a mapping of currency codes to their full names
|
|
3295
|
+
* @throws {Error} If the request fails
|
|
3396
3296
|
*
|
|
3397
|
-
* @
|
|
3297
|
+
* @example
|
|
3298
|
+
* ```typescript
|
|
3299
|
+
* const symbols = await currency().getSymbols()
|
|
3300
|
+
* // { "USD": "United States Dollar", "EUR": "Euro", ... }
|
|
3301
|
+
* ```
|
|
3398
3302
|
*/
|
|
3399
|
-
async
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3303
|
+
async getSymbols() {
|
|
3304
|
+
const e = await this._client.request("currency.getSymbols", {});
|
|
3305
|
+
if (!e.success || !e.symbols)
|
|
3306
|
+
throw new Error("Failed to fetch currency symbols");
|
|
3307
|
+
return e.symbols;
|
|
3403
3308
|
}
|
|
3404
3309
|
/**
|
|
3405
|
-
* Retrieves
|
|
3310
|
+
* Retrieves current exchange rates for a base currency against target currencies.
|
|
3406
3311
|
*
|
|
3407
|
-
*
|
|
3408
|
-
*
|
|
3409
|
-
*
|
|
3312
|
+
* @param params - Currency rate request parameters including base currency and target symbols
|
|
3313
|
+
* @returns A promise that resolves to a mapping of currency codes to their exchange rates
|
|
3314
|
+
* @throws {Error} If the request fails or currencies are invalid
|
|
3410
3315
|
*
|
|
3411
|
-
* @
|
|
3316
|
+
* @example
|
|
3317
|
+
* ```typescript
|
|
3318
|
+
* // Get exchange rates for USD against EUR, GBP, and JPY
|
|
3319
|
+
* const rates = await currency().getRates({
|
|
3320
|
+
* base: 'USD',
|
|
3321
|
+
* symbols: 'EUR,GBP,JPY'
|
|
3322
|
+
* })
|
|
3323
|
+
* // { "EUR": 0.92, "GBP": 0.79, "JPY": 149.50 }
|
|
3324
|
+
* ```
|
|
3412
3325
|
*/
|
|
3413
|
-
async
|
|
3414
|
-
var
|
|
3415
|
-
|
|
3326
|
+
async getRates(e) {
|
|
3327
|
+
var t, s, n;
|
|
3328
|
+
const a = await this._client.request("currency.getRates", e);
|
|
3329
|
+
if (!a.success || !a.rates)
|
|
3330
|
+
throw ((t = a.error) === null || t === void 0 ? void 0 : t.code) === 201 ? new Error(`Invalid base currency '${e.base}'`) : ((s = a.error) === null || s === void 0 ? void 0 : s.code) === 202 ? new Error(`Invalid target currency symbol '${e.symbols}'`) : new Error(((n = a.error) === null || n === void 0 ? void 0 : n.message) || "Failed to fetch currency rates");
|
|
3331
|
+
return a.rates;
|
|
3416
3332
|
}
|
|
3417
3333
|
}
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3334
|
+
class It {
|
|
3335
|
+
constructor(e) {
|
|
3336
|
+
this._client = e;
|
|
3337
|
+
}
|
|
3338
|
+
async getColorScheme() {
|
|
3339
|
+
return (await this._client.request("environment.getColorScheme", {})).colorScheme;
|
|
3340
|
+
}
|
|
3341
|
+
async subscribeColorScheme(e) {
|
|
3342
|
+
return (await this._client.subscribe("environment.subscribeColorScheme", {}, e)).success;
|
|
3343
|
+
}
|
|
3344
|
+
async unsubscribeColorScheme(e) {
|
|
3345
|
+
return (await this._client.unsubscribe("environment.unsubscribeColorScheme", {}, e)).success;
|
|
3346
|
+
}
|
|
3421
3347
|
}
|
|
3422
|
-
class
|
|
3348
|
+
class Nt {
|
|
3349
|
+
constructor(e) {
|
|
3350
|
+
this._client = e;
|
|
3351
|
+
}
|
|
3352
|
+
async discover() {
|
|
3353
|
+
const e = await this._client.request("mqtt.discover", {});
|
|
3354
|
+
if (!e.success)
|
|
3355
|
+
throw new Error("Failed to discover MQTT brokers");
|
|
3356
|
+
return e.brokers;
|
|
3357
|
+
}
|
|
3358
|
+
async connect(e, t) {
|
|
3359
|
+
const s = await this._client.request("mqtt.connect", {
|
|
3360
|
+
brokerUrl: e,
|
|
3361
|
+
...t
|
|
3362
|
+
});
|
|
3363
|
+
if (!s.success)
|
|
3364
|
+
throw new Error("Failed to connect to MQTT broker");
|
|
3365
|
+
return s.clientId;
|
|
3366
|
+
}
|
|
3367
|
+
async disconnect(e) {
|
|
3368
|
+
if (!(await this._client.request("mqtt.disconnect", { clientId: e })).success)
|
|
3369
|
+
throw new Error("Failed to disconnect from MQTT broker");
|
|
3370
|
+
}
|
|
3371
|
+
async publish(e, t, s, n) {
|
|
3372
|
+
if (!(await this._client.request("mqtt.publish", {
|
|
3373
|
+
clientId: e,
|
|
3374
|
+
topic: t,
|
|
3375
|
+
payload: s,
|
|
3376
|
+
...n
|
|
3377
|
+
})).success)
|
|
3378
|
+
throw new Error("Failed to publish MQTT message");
|
|
3379
|
+
}
|
|
3380
|
+
async subscribe(e, t, s, n) {
|
|
3381
|
+
return (await this._client.subscribe("mqtt.subscribe", {
|
|
3382
|
+
clientId: e,
|
|
3383
|
+
topic: t,
|
|
3384
|
+
...n
|
|
3385
|
+
}, s)).success;
|
|
3386
|
+
}
|
|
3387
|
+
async unsubscribe(e, t, s) {
|
|
3388
|
+
return (await this._client.unsubscribe("mqtt.unsubscribe", {
|
|
3389
|
+
clientId: e,
|
|
3390
|
+
topic: t
|
|
3391
|
+
}, s)).success;
|
|
3392
|
+
}
|
|
3393
|
+
async getConnectionStatus(e) {
|
|
3394
|
+
const t = await this._client.request("mqtt.getConnectionStatus", {
|
|
3395
|
+
clientId: e
|
|
3396
|
+
});
|
|
3397
|
+
if (!t.success)
|
|
3398
|
+
throw new Error("Failed to get MQTT connection status");
|
|
3399
|
+
return t.status;
|
|
3400
|
+
}
|
|
3401
|
+
async subscribeConnectionStatus(e, t) {
|
|
3402
|
+
return (await this._client.subscribe("mqtt.subscribeConnectionStatus", {
|
|
3403
|
+
clientId: e
|
|
3404
|
+
}, t)).success;
|
|
3405
|
+
}
|
|
3406
|
+
async unsubscribeConnectionStatus(e, t) {
|
|
3407
|
+
return (await this._client.unsubscribe("mqtt.unsubscribeConnectionStatus", {
|
|
3408
|
+
clientId: e
|
|
3409
|
+
}, t)).success;
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
class Zt {
|
|
3413
|
+
constructor(e) {
|
|
3414
|
+
this._originalPushState = null, this._originalReplaceState = null, this._popstateHandler = null, this._backHandler = null, this._forwardHandler = null, this._client = e;
|
|
3415
|
+
}
|
|
3416
|
+
bind() {
|
|
3417
|
+
typeof window > "u" || this._originalPushState || (this._originalPushState = history.pushState.bind(history), history.pushState = (...e) => {
|
|
3418
|
+
this._originalPushState(...e), this._sendLocationChanged();
|
|
3419
|
+
}, this._originalReplaceState = history.replaceState.bind(history), history.replaceState = (...e) => {
|
|
3420
|
+
this._originalReplaceState(...e), this._sendLocationChanged();
|
|
3421
|
+
}, this._popstateHandler = () => this._sendLocationChanged(), window.addEventListener("popstate", this._popstateHandler), this._backHandler = () => history.back(), this._forwardHandler = () => history.forward(), this._client.on("navigation.back", this._backHandler), this._client.on("navigation.forward", this._forwardHandler), this._sendLocationChanged());
|
|
3422
|
+
}
|
|
3423
|
+
unbind() {
|
|
3424
|
+
typeof window > "u" || (this._originalPushState && (history.pushState = this._originalPushState, this._originalPushState = null), this._originalReplaceState && (history.replaceState = this._originalReplaceState, this._originalReplaceState = null), this._popstateHandler && (window.removeEventListener("popstate", this._popstateHandler), this._popstateHandler = null), this._backHandler && (this._client.off("navigation.back", this._backHandler), this._backHandler = null), this._forwardHandler && (this._client.off("navigation.forward", this._forwardHandler), this._forwardHandler = null));
|
|
3425
|
+
}
|
|
3426
|
+
_sendLocationChanged() {
|
|
3427
|
+
this._client.send("navigation.locationChanged", {
|
|
3428
|
+
pathname: window.location.pathname
|
|
3429
|
+
});
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
const B = 1e3 * 30, Me = 1e3 * 5, oe = typeof window > "u" && typeof self < "u", ee = oe ? "worker" : "window", W = oe ? self : window;
|
|
3433
|
+
function U(i) {
|
|
3434
|
+
oe ? self.postMessage(i) : W.parent.postMessage(i, "*");
|
|
3435
|
+
}
|
|
3436
|
+
class At {
|
|
3423
3437
|
/**
|
|
3424
3438
|
* Creates a new Client instance for communicating with the TelemetryOS platform.
|
|
3425
3439
|
*
|
|
@@ -3428,7 +3442,7 @@ class Tt {
|
|
|
3428
3442
|
* the application ID from the URL.
|
|
3429
3443
|
*/
|
|
3430
3444
|
constructor() {
|
|
3431
|
-
this._applicationInstance = "", this._applicationSpecifier = "", this._deviceId = "", this.
|
|
3445
|
+
this._applicationInstance = "", this._applicationSpecifier = "", this._deviceId = "", this._heartbeatInterval = null, this._heartbeatSignature = K(), this._messageInterceptors = /* @__PURE__ */ new Map(), this._onHandlers = /* @__PURE__ */ new Map(), this._onceHandlers = /* @__PURE__ */ new Map(), this._subscriptionNamesByHandler = /* @__PURE__ */ new Map(), this._subscriptionNamesBySubjectName = /* @__PURE__ */ new Map(), this._dependencyStore = new Et(this), this._navigation = new Zt(this);
|
|
3432
3446
|
}
|
|
3433
3447
|
/**
|
|
3434
3448
|
* Provides access to the accounts API for retrieving TelemetryOS account information.
|
|
@@ -3442,7 +3456,7 @@ class Tt {
|
|
|
3442
3456
|
* @returns An Accounts instance bound to this client
|
|
3443
3457
|
*/
|
|
3444
3458
|
get accounts() {
|
|
3445
|
-
return new
|
|
3459
|
+
return new De(this);
|
|
3446
3460
|
}
|
|
3447
3461
|
/**
|
|
3448
3462
|
* Provides access to the users API for retrieving TelemetryOS user information.
|
|
@@ -3456,7 +3470,7 @@ class Tt {
|
|
|
3456
3470
|
* @returns A Users instance bound to this client
|
|
3457
3471
|
*/
|
|
3458
3472
|
get users() {
|
|
3459
|
-
return new
|
|
3473
|
+
return new kt(this);
|
|
3460
3474
|
}
|
|
3461
3475
|
/**
|
|
3462
3476
|
* Provides access to the store API for data persistence with multiple storage scopes.
|
|
@@ -3470,7 +3484,7 @@ class Tt {
|
|
|
3470
3484
|
* @returns A Store instance bound to this client
|
|
3471
3485
|
*/
|
|
3472
3486
|
get store() {
|
|
3473
|
-
return new
|
|
3487
|
+
return new bt(this);
|
|
3474
3488
|
}
|
|
3475
3489
|
/**
|
|
3476
3490
|
* Provides access to the applications API for discovering other TelemetryOS applications.
|
|
@@ -3484,7 +3498,7 @@ class Tt {
|
|
|
3484
3498
|
* @returns An Applications instance bound to this client
|
|
3485
3499
|
*/
|
|
3486
3500
|
get applications() {
|
|
3487
|
-
return new
|
|
3501
|
+
return new Ve(this);
|
|
3488
3502
|
}
|
|
3489
3503
|
/**
|
|
3490
3504
|
* Provides access to the media API for working with content hosted on the TelemetryOS platform.
|
|
@@ -3499,7 +3513,7 @@ class Tt {
|
|
|
3499
3513
|
* @returns A Media instance bound to this client
|
|
3500
3514
|
*/
|
|
3501
3515
|
get media() {
|
|
3502
|
-
return new
|
|
3516
|
+
return new ze(this);
|
|
3503
3517
|
}
|
|
3504
3518
|
/**
|
|
3505
3519
|
* Provides access to the proxy API for fetching third-party content through the TelemetryOS API.
|
|
@@ -3513,7 +3527,7 @@ class Tt {
|
|
|
3513
3527
|
* @returns A Proxy instance bound to this client
|
|
3514
3528
|
*/
|
|
3515
3529
|
get proxy() {
|
|
3516
|
-
return new
|
|
3530
|
+
return new xt(this);
|
|
3517
3531
|
}
|
|
3518
3532
|
/**
|
|
3519
3533
|
* Provides access to the devices API for interacting with the current device.
|
|
@@ -3528,7 +3542,7 @@ class Tt {
|
|
|
3528
3542
|
* @returns A Devices instance bound to this client
|
|
3529
3543
|
*/
|
|
3530
3544
|
get devices() {
|
|
3531
|
-
return new
|
|
3545
|
+
return new St(this);
|
|
3532
3546
|
}
|
|
3533
3547
|
/**
|
|
3534
3548
|
* Provides access to the root settings navigation API for TelemetryOS administration UI integration.
|
|
@@ -3546,7 +3560,7 @@ class Tt {
|
|
|
3546
3560
|
* @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
|
|
3547
3561
|
*/
|
|
3548
3562
|
get rootSettingsNavigation() {
|
|
3549
|
-
return new
|
|
3563
|
+
return new wt(this.store);
|
|
3550
3564
|
}
|
|
3551
3565
|
/**
|
|
3552
3566
|
* Provides access to the weather API for retrieving weather data.
|
|
@@ -3560,7 +3574,7 @@ class Tt {
|
|
|
3560
3574
|
* @returns A Weather instance bound to this client
|
|
3561
3575
|
*/
|
|
3562
3576
|
get weather() {
|
|
3563
|
-
return new
|
|
3577
|
+
return new Tt(this);
|
|
3564
3578
|
}
|
|
3565
3579
|
/**
|
|
3566
3580
|
* Provides access to the currency API for retrieving currency exchange rates.
|
|
@@ -3574,7 +3588,7 @@ class Tt {
|
|
|
3574
3588
|
* @returns A Currency instance bound to this client
|
|
3575
3589
|
*/
|
|
3576
3590
|
get currency() {
|
|
3577
|
-
return new
|
|
3591
|
+
return new Ct(this);
|
|
3578
3592
|
}
|
|
3579
3593
|
/**
|
|
3580
3594
|
* Provides access to the environment API for accessing environment settings.
|
|
@@ -3588,10 +3602,10 @@ class Tt {
|
|
|
3588
3602
|
* @returns An Environment instance bound to this client
|
|
3589
3603
|
*/
|
|
3590
3604
|
get environment() {
|
|
3591
|
-
return new
|
|
3605
|
+
return new It(this);
|
|
3592
3606
|
}
|
|
3593
3607
|
get mqtt() {
|
|
3594
|
-
return new
|
|
3608
|
+
return new Nt(this);
|
|
3595
3609
|
}
|
|
3596
3610
|
get applicationSpecifier() {
|
|
3597
3611
|
return this._applicationSpecifier;
|
|
@@ -3619,53 +3633,67 @@ class Tt {
|
|
|
3619
3633
|
*/
|
|
3620
3634
|
bind() {
|
|
3621
3635
|
var e, t;
|
|
3622
|
-
const s = new URL(
|
|
3636
|
+
const s = new URL(W.location.href), n = s.searchParams;
|
|
3623
3637
|
this._applicationInstance = n.get("applicationInstance") || "single", this._deviceId = n.get("deviceId") || this._applicationInstance;
|
|
3624
|
-
const
|
|
3625
|
-
if (this._applicationSpecifier = (e = n.get("applicationSpecifier")) !== null && e !== void 0 ? e : "", !this._applicationSpecifier || !
|
|
3626
|
-
const
|
|
3627
|
-
this._applicationSpecifier = (t =
|
|
3638
|
+
const a = /^[a-z0-9-]{40}$/i;
|
|
3639
|
+
if (this._applicationSpecifier = (e = n.get("applicationSpecifier")) !== null && e !== void 0 ? e : "", !this._applicationSpecifier || !a.test(this._applicationSpecifier)) {
|
|
3640
|
+
const r = s.hostname.split(".");
|
|
3641
|
+
this._applicationSpecifier = (t = r[0]) !== null && t !== void 0 ? t : "";
|
|
3628
3642
|
}
|
|
3629
|
-
if (!this._applicationSpecifier || !
|
|
3643
|
+
if (!this._applicationSpecifier || !a.test(this._applicationSpecifier))
|
|
3630
3644
|
throw console.error("TelemetryOS apps require an applicationSpecifier in the URL query parameters or subdomain. Make sure your app is being served correctly through the TelemetryOS platform or development environment."), new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);
|
|
3631
|
-
this._windowMessageHandler = (
|
|
3632
|
-
if (
|
|
3645
|
+
this._windowMessageHandler = (r) => {
|
|
3646
|
+
if (r.source === W || !r.data || typeof r.data != "object" || !("type" in r.data) || r.data.type !== "client" && r.data.type !== "bridge")
|
|
3633
3647
|
return;
|
|
3634
3648
|
let o;
|
|
3635
|
-
if (
|
|
3636
|
-
const c =
|
|
3637
|
-
if (!c) {
|
|
3638
|
-
|
|
3649
|
+
if (r.data.type === "client") {
|
|
3650
|
+
const c = vt.safeParse(r.data);
|
|
3651
|
+
if (!c.success) {
|
|
3652
|
+
const S = r.data;
|
|
3653
|
+
S && typeof S == "object" && S.type === "client" && console.warn("[sdk-client] Received a message that looks like a client message but failed schema validation. This may indicate a version mismatch between the SDK and the host environment.", c.error.issues);
|
|
3639
3654
|
return;
|
|
3640
3655
|
}
|
|
3656
|
+
const l = c.data, f = this._messageInterceptors.get(l.name);
|
|
3657
|
+
if (!f)
|
|
3658
|
+
return U(l);
|
|
3659
|
+
let w;
|
|
3660
|
+
try {
|
|
3661
|
+
w = f(l);
|
|
3662
|
+
} catch (S) {
|
|
3663
|
+
console.error(`Error in interceptor for message ${l.name}:`, S);
|
|
3664
|
+
}
|
|
3665
|
+
if (!w)
|
|
3666
|
+
return;
|
|
3641
3667
|
o = {
|
|
3642
|
-
...
|
|
3668
|
+
...w,
|
|
3643
3669
|
type: "bridge",
|
|
3644
|
-
...
|
|
3670
|
+
...r.data.responseName ? { name: r.data.responseName } : {}
|
|
3645
3671
|
};
|
|
3646
3672
|
}
|
|
3647
3673
|
if (!o) {
|
|
3648
|
-
const c =
|
|
3674
|
+
const c = yt.safeParse(r.data);
|
|
3649
3675
|
if (!c.success) {
|
|
3650
|
-
const w =
|
|
3676
|
+
const w = r.data;
|
|
3651
3677
|
w && typeof w == "object" && w.type === "bridge" && console.warn("[sdk-client] Received a message that looks like a bridge message but failed schema validation. This may indicate a version mismatch between the SDK and the host environment.", c.error.issues);
|
|
3652
3678
|
return;
|
|
3653
3679
|
}
|
|
3654
3680
|
o = c.data;
|
|
3655
|
-
const l = this._onHandlers.get(o.name),
|
|
3681
|
+
const l = this._onHandlers.get(o.name), f = this._onceHandlers.get(o.name);
|
|
3656
3682
|
if (l)
|
|
3657
3683
|
for (const w of l)
|
|
3658
3684
|
w(o.data);
|
|
3659
|
-
if (
|
|
3660
|
-
for (const w of
|
|
3685
|
+
if (f) {
|
|
3686
|
+
for (const w of f)
|
|
3661
3687
|
w(o.data);
|
|
3662
3688
|
this._onceHandlers.delete(o.name);
|
|
3663
3689
|
}
|
|
3664
3690
|
}
|
|
3665
|
-
if (!
|
|
3691
|
+
if (!oe)
|
|
3666
3692
|
for (let c = 0; c < window.frames.length; c += 1)
|
|
3667
3693
|
window.frames[c].postMessage(o, "*");
|
|
3668
|
-
},
|
|
3694
|
+
}, W.addEventListener("message", this._windowMessageHandler), this._navigation.bind(), this._heartbeatInterval = setInterval(() => {
|
|
3695
|
+
this.send("heartbeat", { signature: this._heartbeatSignature });
|
|
3696
|
+
}, Me);
|
|
3669
3697
|
}
|
|
3670
3698
|
/**
|
|
3671
3699
|
* Removes the message event listener and cleans up resources.
|
|
@@ -3681,7 +3709,7 @@ class Tt {
|
|
|
3681
3709
|
* of managing their own Client instances.
|
|
3682
3710
|
*/
|
|
3683
3711
|
unbind() {
|
|
3684
|
-
this._windowMessageHandler && (this._navigation.unbind(),
|
|
3712
|
+
this._windowMessageHandler && (this._navigation.unbind(), W.removeEventListener("message", this._windowMessageHandler), this._heartbeatInterval && clearInterval(this._heartbeatInterval));
|
|
3685
3713
|
}
|
|
3686
3714
|
/**
|
|
3687
3715
|
* Sends a one-way message to the TelemetryOS platform.
|
|
@@ -3698,9 +3726,10 @@ class Tt {
|
|
|
3698
3726
|
*/
|
|
3699
3727
|
send(e, t) {
|
|
3700
3728
|
const s = Y({
|
|
3701
|
-
telemetrySdkVersion:
|
|
3729
|
+
telemetrySdkVersion: te,
|
|
3702
3730
|
applicationSpecifier: this._applicationSpecifier,
|
|
3703
3731
|
applicationInstance: this._applicationInstance,
|
|
3732
|
+
runtime: ee,
|
|
3704
3733
|
name: e,
|
|
3705
3734
|
data: t
|
|
3706
3735
|
});
|
|
@@ -3727,97 +3756,100 @@ class Tt {
|
|
|
3727
3756
|
*/
|
|
3728
3757
|
request(e, t, s) {
|
|
3729
3758
|
var n;
|
|
3730
|
-
const
|
|
3731
|
-
telemetrySdkVersion:
|
|
3759
|
+
const a = K(), r = Y({
|
|
3760
|
+
telemetrySdkVersion: te,
|
|
3732
3761
|
applicationSpecifier: this._applicationSpecifier,
|
|
3733
3762
|
applicationInstance: this._applicationInstance,
|
|
3763
|
+
runtime: ee,
|
|
3734
3764
|
name: e,
|
|
3735
3765
|
data: t,
|
|
3736
|
-
responseName:
|
|
3766
|
+
responseName: a
|
|
3737
3767
|
});
|
|
3738
|
-
U(
|
|
3768
|
+
U(r);
|
|
3739
3769
|
const o = (n = s == null ? void 0 : s.timeout) !== null && n !== void 0 ? n : B;
|
|
3740
3770
|
let c = !1, l;
|
|
3741
|
-
const
|
|
3742
|
-
l = (
|
|
3743
|
-
c ||
|
|
3744
|
-
}, this.once(
|
|
3771
|
+
const f = new Promise((S) => {
|
|
3772
|
+
l = (P) => {
|
|
3773
|
+
c || S(P);
|
|
3774
|
+
}, this.once(a, l);
|
|
3745
3775
|
});
|
|
3746
3776
|
if (o === 0)
|
|
3747
|
-
return
|
|
3748
|
-
const w = new Promise((
|
|
3749
|
-
const
|
|
3777
|
+
return f;
|
|
3778
|
+
const w = new Promise((S, P) => {
|
|
3779
|
+
const V = new Error(`${e} message request with response name of ${a} timed out after ${o}`);
|
|
3750
3780
|
setTimeout(() => {
|
|
3751
|
-
c = !0, this.off(
|
|
3781
|
+
c = !0, this.off(a, l), P(V);
|
|
3752
3782
|
}, o);
|
|
3753
3783
|
});
|
|
3754
|
-
return Promise.race([w,
|
|
3784
|
+
return Promise.race([w, f]);
|
|
3755
3785
|
}
|
|
3756
3786
|
async subscribe(e, t, s) {
|
|
3757
|
-
let n,
|
|
3758
|
-
typeof t == "function" ?
|
|
3759
|
-
const
|
|
3787
|
+
let n, a;
|
|
3788
|
+
typeof t == "function" ? a = t : (n = t, a = s);
|
|
3789
|
+
const r = K(), o = K();
|
|
3760
3790
|
let c = this._subscriptionNamesBySubjectName.get(e);
|
|
3761
|
-
c || (c = [], this._subscriptionNamesBySubjectName.set(e, c)), c.push(
|
|
3791
|
+
c || (c = [], this._subscriptionNamesBySubjectName.set(e, c)), c.push(r), this._subscriptionNamesByHandler.set(a, r), this.on(r, a);
|
|
3762
3792
|
const l = Y({
|
|
3763
|
-
telemetrySdkVersion:
|
|
3793
|
+
telemetrySdkVersion: te,
|
|
3764
3794
|
applicationSpecifier: this._applicationSpecifier,
|
|
3765
3795
|
applicationInstance: this._applicationInstance,
|
|
3796
|
+
runtime: ee,
|
|
3766
3797
|
name: e,
|
|
3767
3798
|
data: n,
|
|
3768
3799
|
responseName: o,
|
|
3769
|
-
subscriptionName:
|
|
3800
|
+
subscriptionName: r
|
|
3770
3801
|
});
|
|
3771
3802
|
U(l);
|
|
3772
|
-
let
|
|
3773
|
-
const
|
|
3774
|
-
const
|
|
3803
|
+
let f = !1, w;
|
|
3804
|
+
const S = new Promise((V, F) => {
|
|
3805
|
+
const z = new Error(`${e} subscribe request with subscription name of ${r} and response name of ${o} timed out after ${B}`);
|
|
3775
3806
|
setTimeout(() => {
|
|
3776
|
-
|
|
3807
|
+
f = !0, this.off(o, w), F(z);
|
|
3777
3808
|
}, B);
|
|
3778
|
-
}),
|
|
3809
|
+
}), P = new Promise((V) => {
|
|
3779
3810
|
w = (F) => {
|
|
3780
|
-
|
|
3811
|
+
f || V(F);
|
|
3781
3812
|
}, this.once(o, w);
|
|
3782
3813
|
});
|
|
3783
|
-
return Promise.race([
|
|
3814
|
+
return Promise.race([S, P]);
|
|
3784
3815
|
}
|
|
3785
3816
|
async unsubscribe(e, t, s) {
|
|
3786
|
-
let n,
|
|
3787
|
-
typeof t == "function" ?
|
|
3788
|
-
const
|
|
3817
|
+
let n, a;
|
|
3818
|
+
typeof t == "function" ? a = t : (n = t, a = s);
|
|
3819
|
+
const r = K();
|
|
3789
3820
|
let o = [];
|
|
3790
|
-
if (
|
|
3791
|
-
const c = this._subscriptionNamesByHandler.get(
|
|
3821
|
+
if (a) {
|
|
3822
|
+
const c = this._subscriptionNamesByHandler.get(a);
|
|
3792
3823
|
if (!c)
|
|
3793
3824
|
return { success: !1 };
|
|
3794
|
-
o = [c], this._subscriptionNamesByHandler.delete(
|
|
3825
|
+
o = [c], this._subscriptionNamesByHandler.delete(a);
|
|
3795
3826
|
} else if (!this._subscriptionNamesBySubjectName.get(e))
|
|
3796
3827
|
return { success: !1 };
|
|
3797
3828
|
for await (const c of o) {
|
|
3798
|
-
this.off(c,
|
|
3829
|
+
this.off(c, a);
|
|
3799
3830
|
const l = Y({
|
|
3800
|
-
telemetrySdkVersion:
|
|
3831
|
+
telemetrySdkVersion: te,
|
|
3801
3832
|
applicationInstance: this._applicationInstance,
|
|
3802
3833
|
applicationSpecifier: this._applicationSpecifier,
|
|
3834
|
+
runtime: ee,
|
|
3803
3835
|
name: e,
|
|
3804
3836
|
data: n,
|
|
3805
|
-
responseName:
|
|
3837
|
+
responseName: r,
|
|
3806
3838
|
unsubscribeName: c
|
|
3807
3839
|
});
|
|
3808
3840
|
U(l);
|
|
3809
|
-
let
|
|
3810
|
-
const
|
|
3811
|
-
const
|
|
3841
|
+
let f = !1, w;
|
|
3842
|
+
const S = new Promise((F, z) => {
|
|
3843
|
+
const qe = new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${r} timed out after ${B}`);
|
|
3812
3844
|
setTimeout(() => {
|
|
3813
|
-
|
|
3845
|
+
f = !0, this.off(r, w), z(qe);
|
|
3814
3846
|
}, B);
|
|
3815
|
-
}),
|
|
3816
|
-
w = (
|
|
3817
|
-
|
|
3818
|
-
}, this.once(
|
|
3847
|
+
}), P = new Promise((F) => {
|
|
3848
|
+
w = (z) => {
|
|
3849
|
+
f || F(z);
|
|
3850
|
+
}, this.once(r, w);
|
|
3819
3851
|
});
|
|
3820
|
-
if (!(await Promise.race([
|
|
3852
|
+
if (!(await Promise.race([S, P])).success)
|
|
3821
3853
|
return { success: !1 };
|
|
3822
3854
|
}
|
|
3823
3855
|
return { success: !0 };
|
|
@@ -3882,129 +3914,301 @@ class Tt {
|
|
|
3882
3914
|
const s = this._onHandlers.get(e), n = this._onceHandlers.get(e);
|
|
3883
3915
|
if (!(!s && !n)) {
|
|
3884
3916
|
if (s) {
|
|
3885
|
-
for (let
|
|
3886
|
-
t && s[
|
|
3917
|
+
for (let a = 0; a < s.length; a += 1)
|
|
3918
|
+
t && s[a] !== t || (s.splice(a, 1), a -= 1);
|
|
3887
3919
|
s.length === 0 && this._onHandlers.delete(e);
|
|
3888
3920
|
}
|
|
3889
3921
|
if (n) {
|
|
3890
|
-
for (let
|
|
3891
|
-
t && n[
|
|
3922
|
+
for (let a = 0; a < n.length; a += 1)
|
|
3923
|
+
t && n[a] !== t || (n.splice(a, 1), a -= 1);
|
|
3892
3924
|
n.length === 0 && this._onceHandlers.delete(e);
|
|
3893
3925
|
}
|
|
3894
3926
|
}
|
|
3895
3927
|
}
|
|
3896
3928
|
}
|
|
3897
|
-
function
|
|
3929
|
+
function K() {
|
|
3898
3930
|
return Math.random().toString(36).slice(2, 9);
|
|
3899
3931
|
}
|
|
3900
|
-
const
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3932
|
+
const Ot = 3;
|
|
3933
|
+
class Et {
|
|
3934
|
+
constructor(e) {
|
|
3935
|
+
this._client = e, this._dependencies = /* @__PURE__ */ new Map(), this._heartbeatTimeouts = /* @__PURE__ */ new Map(), this._client._messageInterceptors.set("heartbeat", (t) => {
|
|
3936
|
+
this._handleHeartbeat(t.applicationSpecifier, t.applicationInstance);
|
|
3937
|
+
});
|
|
3938
|
+
}
|
|
3939
|
+
/**
|
|
3940
|
+
* Sends the full set of dependency specifiers to the platform and reconciles
|
|
3941
|
+
* local handles. Any previously tracked dependency that is no longer present
|
|
3942
|
+
* in the new specifiers map is destroyed.
|
|
3943
|
+
*
|
|
3944
|
+
* @param applicationSpecifiers A map of application specifier to an array of instance IDs
|
|
3945
|
+
*/
|
|
3946
|
+
async setDependencies(e) {
|
|
3947
|
+
this._client.send("applications.setDependencies", {
|
|
3948
|
+
applicationSpecifiers: e
|
|
3949
|
+
});
|
|
3950
|
+
const t = [];
|
|
3951
|
+
for (const [s, n] of this._dependencies.entries()) {
|
|
3952
|
+
const [a, r] = s.split(":");
|
|
3953
|
+
(!e[a] || !e[a].includes(r)) && (t.push(n._destroy()), this._dependencies.delete(s));
|
|
3954
|
+
}
|
|
3955
|
+
await Promise.all(t);
|
|
3956
|
+
}
|
|
3957
|
+
/**
|
|
3958
|
+
* Returns the {@link DependencyHandle} for a given specifier and instance ID,
|
|
3959
|
+
* creating one if it does not already exist.
|
|
3960
|
+
*
|
|
3961
|
+
* @param specifier The application specifier (40-char hex)
|
|
3962
|
+
* @param instanceId The unique instance identifier
|
|
3963
|
+
* @returns The existing or newly created DependencyHandle
|
|
3964
|
+
*/
|
|
3965
|
+
handleFor(e, t) {
|
|
3966
|
+
let s = this._dependencies.get(`${e}:${t}`);
|
|
3967
|
+
return s || (s = new $t(this, e, t), this._dependencies.set(`${e}:${t}`, s), s);
|
|
3968
|
+
}
|
|
3969
|
+
/**
|
|
3970
|
+
* Resets the heartbeat timeout for the given dependency. If no heartbeat
|
|
3971
|
+
* arrives within {@link missedHeartbeatsThreshold} intervals the
|
|
3972
|
+
* dependency's iframe is reloaded.
|
|
3973
|
+
*/
|
|
3974
|
+
_handleHeartbeat(e, t) {
|
|
3975
|
+
const s = `${e}:${t}`, n = this._dependencies.get(s);
|
|
3976
|
+
if (!n)
|
|
3977
|
+
return;
|
|
3978
|
+
const a = this._heartbeatTimeouts.get(s);
|
|
3979
|
+
a && clearTimeout(a), this._heartbeatTimeouts.set(s, setTimeout(() => {
|
|
3980
|
+
this._heartbeatTimeouts.delete(s), n._resetIframe();
|
|
3981
|
+
}, Me * Ot));
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
class $t {
|
|
3985
|
+
/** The current download/readiness status of the dependency. */
|
|
3986
|
+
get status() {
|
|
3987
|
+
return this._status;
|
|
3988
|
+
}
|
|
3989
|
+
/** A deep clone of the application record, or null if not yet available. */
|
|
3990
|
+
get application() {
|
|
3991
|
+
return structuredClone(this._application);
|
|
3992
|
+
}
|
|
3993
|
+
constructor(e, t, s) {
|
|
3994
|
+
this._store = e, this._specifier = t, this._instanceId = s, this._status = "unloaded", this._application = null, this._iframe = null, this._onStatusHandlers = /* @__PURE__ */ new Set(), this._subscriptionHandler = (n) => {
|
|
3995
|
+
this._status = n.status, this._application = n.application;
|
|
3996
|
+
for (const a of this._onStatusHandlers)
|
|
3997
|
+
a(n.status);
|
|
3998
|
+
}, this._store._client.subscribe("applications.dependency", {
|
|
3999
|
+
applicationSpecifier: this._specifier,
|
|
4000
|
+
applicationInstance: this._instanceId
|
|
4001
|
+
}, this._subscriptionHandler).catch((n) => {
|
|
4002
|
+
console.error(`Dependency subscription failed for ${this._specifier}:${this._instanceId}:`, n);
|
|
4003
|
+
});
|
|
4004
|
+
}
|
|
4005
|
+
/**
|
|
4006
|
+
* Returns a promise that resolves with an iframe element once the dependency
|
|
4007
|
+
* is ready, or null if the dependency becomes unloaded before it is ready.
|
|
4008
|
+
*
|
|
4009
|
+
* If the dependency is already ready, the promise resolves immediately with
|
|
4010
|
+
* the cached iframe. The iframe's `src` is pre-configured for the dependency.
|
|
4011
|
+
*
|
|
4012
|
+
* @returns A promise resolving to the iframe element or null
|
|
4013
|
+
*/
|
|
4014
|
+
async frame() {
|
|
4015
|
+
return new Promise((e) => {
|
|
4016
|
+
if (this._iframe)
|
|
4017
|
+
return e(this._iframe);
|
|
4018
|
+
if (this._status === "ready")
|
|
4019
|
+
return this._iframe = this._buildIframe(), e(this._iframe);
|
|
4020
|
+
let t;
|
|
4021
|
+
const s = (n) => {
|
|
4022
|
+
if (n === "ready")
|
|
4023
|
+
return t(), this._iframe = this._buildIframe(), e(this._iframe);
|
|
4024
|
+
if (n === "unloaded")
|
|
4025
|
+
return t(), e(null);
|
|
4026
|
+
};
|
|
4027
|
+
t = this.onStatus(s);
|
|
4028
|
+
});
|
|
4029
|
+
}
|
|
4030
|
+
/**
|
|
4031
|
+
* Registers a callback that fires whenever the dependency status changes.
|
|
4032
|
+
*
|
|
4033
|
+
* @param handler Callback receiving the new {@link ApplicationStatus}
|
|
4034
|
+
* @returns An unsubscribe function that removes the handler
|
|
4035
|
+
*/
|
|
4036
|
+
onStatus(e) {
|
|
4037
|
+
return this._onStatusHandlers.add(e), () => {
|
|
4038
|
+
this._onStatusHandlers.delete(e);
|
|
4039
|
+
};
|
|
4040
|
+
}
|
|
4041
|
+
_buildIframe() {
|
|
4042
|
+
var e, t;
|
|
4043
|
+
const s = (t = (e = this._application) === null || e === void 0 ? void 0 : e.versions) === null || t === void 0 ? void 0 : t[0], n = s == null ? void 0 : s.baseUrl;
|
|
4044
|
+
if (!n)
|
|
4045
|
+
return console.error(`No baseUrl for dependency ${this._specifier}:${this._instanceId}`), null;
|
|
4046
|
+
const a = new URL(n);
|
|
4047
|
+
a.searchParams.set("applicationSpecifier", this._specifier), a.searchParams.set("applicationInstance", this._instanceId), a.searchParams.set("deviceId", this._store._client.deviceId);
|
|
4048
|
+
const r = document.createElement("iframe");
|
|
4049
|
+
return r.src = a.toString(), r;
|
|
4050
|
+
}
|
|
4051
|
+
/**
|
|
4052
|
+
* Resets the iframe by clearing it, requesting the host to clean up
|
|
4053
|
+
* subscriptions and state for this instance, then reloading it if the
|
|
4054
|
+
* iframe is still in the DOM.
|
|
4055
|
+
*/
|
|
4056
|
+
async _resetIframe() {
|
|
4057
|
+
if (!this._iframe)
|
|
4058
|
+
return;
|
|
4059
|
+
const e = this._iframe, t = e.src;
|
|
4060
|
+
e.src = "about:blank";
|
|
4061
|
+
try {
|
|
4062
|
+
await this._store._client.request("applications.reset", {
|
|
4063
|
+
applicationSpecifier: this._specifier,
|
|
4064
|
+
applicationInstance: this._instanceId,
|
|
4065
|
+
cause: "heartbeat-timeout"
|
|
4066
|
+
});
|
|
4067
|
+
} catch (s) {
|
|
4068
|
+
console.error(`Failed to reset application ${this._specifier}:${this._instanceId}:`, s);
|
|
4069
|
+
}
|
|
4070
|
+
this._iframe === e && e.isConnected && (e.src = t);
|
|
4071
|
+
}
|
|
4072
|
+
/**
|
|
4073
|
+
* Tears down this handle: resets status to 'unloaded', blanks the iframe,
|
|
4074
|
+
* requests the host to clean up all subscriptions (window + worker),
|
|
4075
|
+
* notifies status handlers, and unsubscribes from platform updates.
|
|
4076
|
+
*/
|
|
4077
|
+
async _destroy() {
|
|
4078
|
+
this._status = "unloaded", this._iframe && (this._iframe.src = "about:blank"), this._iframe = null;
|
|
4079
|
+
for (const s of this._onStatusHandlers)
|
|
4080
|
+
s("unloaded");
|
|
4081
|
+
const e = `${this._specifier}:${this._instanceId}`, t = this._store._heartbeatTimeouts.get(e);
|
|
4082
|
+
t && (clearTimeout(t), this._store._heartbeatTimeouts.delete(e));
|
|
4083
|
+
try {
|
|
4084
|
+
await this._store._client.request("applications.destroy", {
|
|
4085
|
+
applicationSpecifier: this._specifier,
|
|
4086
|
+
applicationInstance: this._instanceId
|
|
4087
|
+
});
|
|
4088
|
+
} catch (s) {
|
|
4089
|
+
console.error(`Failed to destroy ${this._specifier}:${this._instanceId}:`, s);
|
|
4090
|
+
}
|
|
4091
|
+
await this._store._client.unsubscribe("applications.dependency", {
|
|
4092
|
+
applicationSpecifier: this._specifier,
|
|
4093
|
+
applicationInstance: this._instanceId
|
|
4094
|
+
}, this._subscriptionHandler).catch((s) => {
|
|
4095
|
+
console.error(`Dependency unsubscription failed for ${this._specifier}:${this._instanceId}:`, s);
|
|
4096
|
+
});
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
const te = Le.version;
|
|
4100
|
+
let m = null;
|
|
4101
|
+
function Rt() {
|
|
4102
|
+
return m;
|
|
3904
4103
|
}
|
|
3905
|
-
function
|
|
3906
|
-
|
|
4104
|
+
function Ft(i) {
|
|
4105
|
+
jt(), m = new At(), m.bind();
|
|
3907
4106
|
}
|
|
3908
|
-
function
|
|
3909
|
-
|
|
4107
|
+
function jt() {
|
|
4108
|
+
m == null || m.unbind(), m = null;
|
|
3910
4109
|
}
|
|
3911
|
-
function
|
|
3912
|
-
return x(
|
|
4110
|
+
function Mt(...i) {
|
|
4111
|
+
return x(m), m.on(...i);
|
|
3913
4112
|
}
|
|
3914
|
-
function
|
|
3915
|
-
return x(
|
|
4113
|
+
function qt(...i) {
|
|
4114
|
+
return x(m), m.once(...i);
|
|
3916
4115
|
}
|
|
3917
|
-
function
|
|
3918
|
-
return x(
|
|
4116
|
+
function Ht(...i) {
|
|
4117
|
+
return x(m), m.off(...i);
|
|
3919
4118
|
}
|
|
3920
|
-
function
|
|
3921
|
-
return x(
|
|
4119
|
+
function Lt(...i) {
|
|
4120
|
+
return x(m), m.send(...i);
|
|
3922
4121
|
}
|
|
3923
|
-
function
|
|
3924
|
-
return x(
|
|
4122
|
+
function Dt(...i) {
|
|
4123
|
+
return x(m), m.request(...i);
|
|
3925
4124
|
}
|
|
3926
|
-
function
|
|
3927
|
-
return x(
|
|
4125
|
+
function Vt(...i) {
|
|
4126
|
+
return x(m), m.subscribe(...i);
|
|
3928
4127
|
}
|
|
3929
|
-
function
|
|
3930
|
-
return x(
|
|
4128
|
+
function zt(...i) {
|
|
4129
|
+
return x(m), m.unsubscribe(...i);
|
|
3931
4130
|
}
|
|
3932
|
-
function
|
|
3933
|
-
return x(
|
|
4131
|
+
function Bt() {
|
|
4132
|
+
return x(m), m.store;
|
|
3934
4133
|
}
|
|
3935
|
-
function
|
|
3936
|
-
return x(
|
|
4134
|
+
function Ut() {
|
|
4135
|
+
return x(m), m.applications;
|
|
3937
4136
|
}
|
|
3938
|
-
function
|
|
3939
|
-
return x(
|
|
4137
|
+
function Kt() {
|
|
4138
|
+
return x(m), m.media;
|
|
3940
4139
|
}
|
|
3941
|
-
function
|
|
3942
|
-
return x(
|
|
4140
|
+
function Wt() {
|
|
4141
|
+
return x(m), m.accounts;
|
|
3943
4142
|
}
|
|
3944
|
-
function
|
|
3945
|
-
return x(
|
|
4143
|
+
function Jt() {
|
|
4144
|
+
return x(m), m.users;
|
|
3946
4145
|
}
|
|
3947
|
-
function
|
|
3948
|
-
return x(
|
|
4146
|
+
function Qt() {
|
|
4147
|
+
return x(m), m.devices;
|
|
3949
4148
|
}
|
|
3950
|
-
function
|
|
3951
|
-
return x(
|
|
4149
|
+
function Gt() {
|
|
4150
|
+
return x(m), m.proxy;
|
|
3952
4151
|
}
|
|
3953
|
-
function
|
|
3954
|
-
return x(
|
|
4152
|
+
function Yt() {
|
|
4153
|
+
return x(m), m.rootSettingsNavigation;
|
|
3955
4154
|
}
|
|
3956
|
-
function
|
|
3957
|
-
return x(
|
|
4155
|
+
function Xt() {
|
|
4156
|
+
return x(m), m.weather;
|
|
3958
4157
|
}
|
|
3959
|
-
function
|
|
3960
|
-
return x(
|
|
4158
|
+
function es() {
|
|
4159
|
+
return x(m), m.currency;
|
|
3961
4160
|
}
|
|
3962
|
-
function
|
|
3963
|
-
return x(
|
|
4161
|
+
function ts() {
|
|
4162
|
+
return x(m), m.environment;
|
|
3964
4163
|
}
|
|
3965
|
-
function
|
|
3966
|
-
return x(
|
|
4164
|
+
function ss() {
|
|
4165
|
+
return x(m), m.mqtt;
|
|
3967
4166
|
}
|
|
3968
|
-
function x(
|
|
3969
|
-
if (!
|
|
4167
|
+
function x(i) {
|
|
4168
|
+
if (!i)
|
|
3970
4169
|
throw new Error("SDK is not configured");
|
|
3971
4170
|
}
|
|
3972
4171
|
export {
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
Bt as
|
|
4172
|
+
De as Accounts,
|
|
4173
|
+
Ve as Applications,
|
|
4174
|
+
At as Client,
|
|
4175
|
+
Ct as Currency,
|
|
4176
|
+
$t as DependencyHandle,
|
|
4177
|
+
St as Devices,
|
|
4178
|
+
It as Environment,
|
|
4179
|
+
ze as Media,
|
|
4180
|
+
Nt as Mqtt,
|
|
4181
|
+
Zt as Navigation,
|
|
4182
|
+
xt as Proxy,
|
|
4183
|
+
bt as Store,
|
|
4184
|
+
X as StoreSlice,
|
|
4185
|
+
kt as Users,
|
|
4186
|
+
Tt as Weather,
|
|
4187
|
+
Wt as accounts,
|
|
4188
|
+
Ut as applications,
|
|
4189
|
+
yt as bridgeMessageValidator,
|
|
4190
|
+
vt as clientMessageValidator,
|
|
4191
|
+
Ft as configure,
|
|
4192
|
+
es as currency,
|
|
4193
|
+
jt as destroy,
|
|
4194
|
+
Qt as devices,
|
|
4195
|
+
ts as environment,
|
|
4196
|
+
Pt as formatBridgeMessage,
|
|
4197
|
+
Y as formatClientMessage,
|
|
4198
|
+
Rt as globalClient,
|
|
4199
|
+
Kt as media,
|
|
4200
|
+
ss as mqtt,
|
|
4201
|
+
Ht as off,
|
|
4202
|
+
Mt as on,
|
|
4203
|
+
qt as once,
|
|
4204
|
+
Gt as proxy,
|
|
4205
|
+
Dt as request,
|
|
4206
|
+
Yt as rootSettingsNavigation,
|
|
4207
|
+
Lt as send,
|
|
4208
|
+
Bt as store,
|
|
4209
|
+
Vt as subscribe,
|
|
4210
|
+
te as telemetrySdkVersion,
|
|
4211
|
+
zt as unsubscribe,
|
|
4212
|
+
Jt as users,
|
|
4213
|
+
Xt as weather
|
|
4010
4214
|
};
|