@trops/dash-core 0.1.554 → 0.1.556
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/dist/electron/index.js +400 -1897
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +4187 -1769
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4186 -1768
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var require$$1$1 = require('path');
|
|
|
5
5
|
var require$$0$2 = require('fs');
|
|
6
6
|
var require$$0$3 = require('crypto');
|
|
7
7
|
var require$$2$1 = require('os');
|
|
8
|
-
var require$$
|
|
8
|
+
var require$$5 = require('adm-zip');
|
|
9
9
|
var require$$4 = require('url');
|
|
10
10
|
var require$$2 = require('vm');
|
|
11
11
|
var require$$0$4 = require('electron-store');
|
|
@@ -13,9 +13,9 @@ var require$$1$2 = require('croner');
|
|
|
13
13
|
var require$$9$1 = require('objects-to-csv');
|
|
14
14
|
var require$$1$3 = require('readline');
|
|
15
15
|
var require$$2$2 = require('xtreamer');
|
|
16
|
-
var require$$3$
|
|
16
|
+
var require$$3$1 = require('xml2js');
|
|
17
17
|
var require$$4$1 = require('JSONStream');
|
|
18
|
-
var require$$5 = require('stream');
|
|
18
|
+
var require$$5$1 = require('stream');
|
|
19
19
|
var require$$6 = require('csv-parser');
|
|
20
20
|
var require$$0$5 = require('quickjs-emscripten');
|
|
21
21
|
var require$$11 = require('https');
|
|
@@ -24,16 +24,17 @@ var require$$1$4 = require('@modelcontextprotocol/sdk/client/stdio.js');
|
|
|
24
24
|
var require$$0$6 = require('pkce-challenge');
|
|
25
25
|
var require$$12 = require('child_process');
|
|
26
26
|
var require$$2$3 = require('algoliasearch');
|
|
27
|
-
var require$$3$
|
|
27
|
+
var require$$3$2 = require('node:path');
|
|
28
28
|
var require$$0$8 = require('openai');
|
|
29
29
|
var require$$0$b = require('@anthropic-ai/sdk');
|
|
30
|
+
var require$$2$4 = require('zod-to-json-schema');
|
|
30
31
|
var require$$8$1 = require('zod');
|
|
31
32
|
var require$$0$9 = require('http');
|
|
32
33
|
var require$$1$5 = require('http2');
|
|
33
|
-
var require$$2$
|
|
34
|
+
var require$$2$5 = require('node-forge');
|
|
34
35
|
var require$$0$a = require('css');
|
|
35
36
|
var require$$1$6 = require('node-vibrant/node');
|
|
36
|
-
var require$$3$
|
|
37
|
+
var require$$3$3 = require('ws');
|
|
37
38
|
|
|
38
39
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
39
40
|
|
|
@@ -460,6 +461,7 @@ const REGISTRY_PUBLISH_WIDGET = "registry:publish-widget";
|
|
|
460
461
|
const REGISTRY_INSPECT_WIDGET_PACKAGE = "registry:inspect-widget-package";
|
|
461
462
|
const REGISTRY_SCAN_WIDGET_DEFAULTS = "registry:scan-widget-defaults";
|
|
462
463
|
const REGISTRY_PREVIEW_FETCH = "registry:preview-fetch";
|
|
464
|
+
const REGISTRY_FETCH_PACKAGE_MANIFEST = "registry:fetch-package-manifest";
|
|
463
465
|
|
|
464
466
|
var registryEvents$1 = {
|
|
465
467
|
REGISTRY_FETCH_INDEX,
|
|
@@ -472,6 +474,7 @@ var registryEvents$1 = {
|
|
|
472
474
|
REGISTRY_INSPECT_WIDGET_PACKAGE,
|
|
473
475
|
REGISTRY_SCAN_WIDGET_DEFAULTS,
|
|
474
476
|
REGISTRY_PREVIEW_FETCH,
|
|
477
|
+
REGISTRY_FETCH_PACKAGE_MANIFEST,
|
|
475
478
|
};
|
|
476
479
|
|
|
477
480
|
/**
|
|
@@ -4700,7 +4703,7 @@ var schedulerController_1 = schedulerController$2;
|
|
|
4700
4703
|
const fs = require$$0$2;
|
|
4701
4704
|
const path = require$$1$1;
|
|
4702
4705
|
const os = require$$2$1;
|
|
4703
|
-
const AdmZip = require$$
|
|
4706
|
+
const AdmZip = require$$5;
|
|
4704
4707
|
const { fileURLToPath } = require$$4;
|
|
4705
4708
|
const { app, ipcMain, BrowserWindow } = require$$0$1;
|
|
4706
4709
|
const { dynamicWidgetLoader } = dynamicWidgetLoaderExports;
|
|
@@ -7313,9 +7316,9 @@ function requireTransform () {
|
|
|
7313
7316
|
var fs = require$$0$2;
|
|
7314
7317
|
var readline = require$$1$3;
|
|
7315
7318
|
const xtreamer = require$$2$2;
|
|
7316
|
-
var xmlParser = require$$3$
|
|
7319
|
+
var xmlParser = require$$3$1;
|
|
7317
7320
|
var JSONStream = require$$4$1;
|
|
7318
|
-
const stream = require$$5;
|
|
7321
|
+
const stream = require$$5$1;
|
|
7319
7322
|
var csv = require$$6;
|
|
7320
7323
|
const path = require$$1$1;
|
|
7321
7324
|
const { app } = require$$0$1;
|
|
@@ -18848,8 +18851,8 @@ api._coercedBigint = _coercedBigint;
|
|
|
18848
18851
|
api._int64 = _int64;
|
|
18849
18852
|
api._uint64 = _uint64;
|
|
18850
18853
|
api._symbol = _symbol;
|
|
18851
|
-
api._undefined = _undefined
|
|
18852
|
-
api._null = _null
|
|
18854
|
+
api._undefined = _undefined;
|
|
18855
|
+
api._null = _null;
|
|
18853
18856
|
api._any = _any;
|
|
18854
18857
|
api._unknown = _unknown;
|
|
18855
18858
|
api._never = _never;
|
|
@@ -18899,17 +18902,17 @@ api._tuple = _tuple;
|
|
|
18899
18902
|
api._record = _record;
|
|
18900
18903
|
api._map = _map;
|
|
18901
18904
|
api._set = _set;
|
|
18902
|
-
api._enum = _enum$
|
|
18905
|
+
api._enum = _enum$1;
|
|
18903
18906
|
api._nativeEnum = _nativeEnum;
|
|
18904
18907
|
api._literal = _literal;
|
|
18905
18908
|
api._file = _file;
|
|
18906
18909
|
api._transform = _transform;
|
|
18907
18910
|
api._optional = _optional;
|
|
18908
18911
|
api._nullable = _nullable;
|
|
18909
|
-
api._default = _default
|
|
18912
|
+
api._default = _default;
|
|
18910
18913
|
api._nonoptional = _nonoptional;
|
|
18911
18914
|
api._success = _success;
|
|
18912
|
-
api._catch = _catch
|
|
18915
|
+
api._catch = _catch;
|
|
18913
18916
|
api._pipe = _pipe;
|
|
18914
18917
|
api._readonly = _readonly;
|
|
18915
18918
|
api._templateLiteral = _templateLiteral;
|
|
@@ -19289,13 +19292,13 @@ function _symbol(Class, params) {
|
|
|
19289
19292
|
...util$2.normalizeParams(params),
|
|
19290
19293
|
});
|
|
19291
19294
|
}
|
|
19292
|
-
function _undefined
|
|
19295
|
+
function _undefined(Class, params) {
|
|
19293
19296
|
return new Class({
|
|
19294
19297
|
type: "undefined",
|
|
19295
19298
|
...util$2.normalizeParams(params),
|
|
19296
19299
|
});
|
|
19297
19300
|
}
|
|
19298
|
-
function _null
|
|
19301
|
+
function _null(Class, params) {
|
|
19299
19302
|
return new Class({
|
|
19300
19303
|
type: "null",
|
|
19301
19304
|
...util$2.normalizeParams(params),
|
|
@@ -19593,7 +19596,7 @@ function _set(Class, valueType, params) {
|
|
|
19593
19596
|
...util$2.normalizeParams(params),
|
|
19594
19597
|
});
|
|
19595
19598
|
}
|
|
19596
|
-
function _enum$
|
|
19599
|
+
function _enum$1(Class, values, params) {
|
|
19597
19600
|
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
19598
19601
|
// if (Array.isArray(values)) {
|
|
19599
19602
|
// for (const value of values) {
|
|
@@ -19657,7 +19660,7 @@ function _nullable(Class, innerType) {
|
|
|
19657
19660
|
innerType,
|
|
19658
19661
|
});
|
|
19659
19662
|
}
|
|
19660
|
-
function _default
|
|
19663
|
+
function _default(Class, innerType, defaultValue) {
|
|
19661
19664
|
return new Class({
|
|
19662
19665
|
type: "default",
|
|
19663
19666
|
innerType,
|
|
@@ -19679,7 +19682,7 @@ function _success(Class, innerType) {
|
|
|
19679
19682
|
innerType,
|
|
19680
19683
|
});
|
|
19681
19684
|
}
|
|
19682
|
-
function _catch
|
|
19685
|
+
function _catch(Class, innerType, catchValue) {
|
|
19683
19686
|
return new Class({
|
|
19684
19687
|
type: "catch",
|
|
19685
19688
|
innerType,
|
|
@@ -22232,26 +22235,26 @@ var __importStar$3 = (commonjsGlobal && commonjsGlobal.__importStar) || function
|
|
|
22232
22235
|
return result;
|
|
22233
22236
|
};
|
|
22234
22237
|
Object.defineProperty(coerce$1, "__esModule", { value: true });
|
|
22235
|
-
coerce$1.string = string$
|
|
22236
|
-
coerce$1.number = number$
|
|
22237
|
-
coerce$1.boolean = boolean$
|
|
22238
|
-
coerce$1.bigint = bigint$
|
|
22239
|
-
coerce$1.date = date$
|
|
22238
|
+
coerce$1.string = string$1;
|
|
22239
|
+
coerce$1.number = number$1;
|
|
22240
|
+
coerce$1.boolean = boolean$1;
|
|
22241
|
+
coerce$1.bigint = bigint$1;
|
|
22242
|
+
coerce$1.date = date$1;
|
|
22240
22243
|
const core$4 = __importStar$3(core$8);
|
|
22241
22244
|
const schemas$2 = __importStar$3(requireSchemas());
|
|
22242
|
-
function string$
|
|
22245
|
+
function string$1(params) {
|
|
22243
22246
|
return core$4._coercedString(schemas$2.ZodString, params);
|
|
22244
22247
|
}
|
|
22245
|
-
function number$
|
|
22248
|
+
function number$1(params) {
|
|
22246
22249
|
return core$4._coercedNumber(schemas$2.ZodNumber, params);
|
|
22247
22250
|
}
|
|
22248
|
-
function boolean$
|
|
22251
|
+
function boolean$1(params) {
|
|
22249
22252
|
return core$4._coercedBoolean(schemas$2.ZodBoolean, params);
|
|
22250
22253
|
}
|
|
22251
|
-
function bigint$
|
|
22254
|
+
function bigint$1(params) {
|
|
22252
22255
|
return core$4._coercedBigint(schemas$2.ZodBigInt, params);
|
|
22253
22256
|
}
|
|
22254
|
-
function date$
|
|
22257
|
+
function date$1(params) {
|
|
22255
22258
|
return core$4._coercedDate(schemas$2.ZodDate, params);
|
|
22256
22259
|
}
|
|
22257
22260
|
|
|
@@ -28750,33 +28753,199 @@ async function getPackage$1(packageName) {
|
|
|
28750
28753
|
}
|
|
28751
28754
|
|
|
28752
28755
|
/**
|
|
28753
|
-
*
|
|
28756
|
+
* Parse an installed widget's id (`@scope/name` or `scope/name` or
|
|
28757
|
+
* `name`) into a `{scope, name}` ref the check-versions endpoint
|
|
28758
|
+
* accepts. Returns null when no scope is present — the new endpoint
|
|
28759
|
+
* needs both fields.
|
|
28760
|
+
*/
|
|
28761
|
+
function _parseScopedRef(installedId) {
|
|
28762
|
+
if (!installedId || typeof installedId !== "string") return null;
|
|
28763
|
+
if (!installedId.includes("/")) return null;
|
|
28764
|
+
const stripped = installedId.replace(/^@/, "");
|
|
28765
|
+
const parts = stripped.split("/");
|
|
28766
|
+
if (parts.length < 2) return null;
|
|
28767
|
+
const scope = parts[0];
|
|
28768
|
+
const name = parts.slice(1).join("/");
|
|
28769
|
+
if (!scope || !name) return null;
|
|
28770
|
+
return { scope, name };
|
|
28771
|
+
}
|
|
28772
|
+
|
|
28773
|
+
/**
|
|
28774
|
+
* Check for updates to installed widgets.
|
|
28775
|
+
*
|
|
28776
|
+
* Uses the registry's POST /api/packages/check-versions endpoint, which
|
|
28777
|
+
* returns latest-version-by-id regardless of auth/visibility. Critically,
|
|
28778
|
+
* this means **private packages the user has installed are checked even
|
|
28779
|
+
* when the app launches anonymously** (before sign-in completes / for
|
|
28780
|
+
* users who haven't signed in this session). The previous implementation
|
|
28781
|
+
* fetched the entire registry index, which is visibility-filtered
|
|
28782
|
+
* server-side and so silently hid private packages from anonymous
|
|
28783
|
+
* callers — the user's installed-but-private widgets reported "no
|
|
28784
|
+
* update available" forever until they manually re-checked after
|
|
28785
|
+
* signing in.
|
|
28786
|
+
*
|
|
28787
|
+
* Bare-name (unscoped) installed widgets can't be queried via the new
|
|
28788
|
+
* endpoint (it needs scope+name). For those we fall back to the legacy
|
|
28789
|
+
* index-scan. Same fallback covers the transition period while the
|
|
28790
|
+
* registry-side endpoint is still being deployed — if the endpoint
|
|
28791
|
+
* isn't there yet, we silently degrade to the old behavior.
|
|
28754
28792
|
*
|
|
28755
28793
|
* @param {Array<Object>} installedWidgets - Array of { name, version } objects
|
|
28756
28794
|
* @returns {Promise<Array<Object>>} Widgets with available updates
|
|
28757
28795
|
*/
|
|
28758
28796
|
async function checkUpdates(installedWidgets = []) {
|
|
28759
|
-
|
|
28760
|
-
|
|
28797
|
+
if (!Array.isArray(installedWidgets) || installedWidgets.length === 0) {
|
|
28798
|
+
return [];
|
|
28799
|
+
}
|
|
28761
28800
|
|
|
28801
|
+
// Bucket installed widgets by whether they have a scope (and so can
|
|
28802
|
+
// use the new endpoint) or not (fall back to index scan).
|
|
28803
|
+
const scopedRefs = []; // { scope, name, installed }
|
|
28804
|
+
const bareInstalled = []; // { name, version }
|
|
28762
28805
|
for (const installed of installedWidgets) {
|
|
28763
28806
|
const installedId = installed.packageId || installed.name;
|
|
28764
|
-
const
|
|
28765
|
-
|
|
28766
|
-
|
|
28767
|
-
|
|
28768
|
-
|
|
28769
|
-
|
|
28770
|
-
|
|
28807
|
+
const ref = _parseScopedRef(installedId);
|
|
28808
|
+
if (ref) {
|
|
28809
|
+
scopedRefs.push({
|
|
28810
|
+
scope: ref.scope,
|
|
28811
|
+
name: ref.name,
|
|
28812
|
+
installed,
|
|
28813
|
+
installedId,
|
|
28814
|
+
});
|
|
28815
|
+
} else {
|
|
28816
|
+
bareInstalled.push(installed);
|
|
28817
|
+
}
|
|
28818
|
+
}
|
|
28819
|
+
|
|
28820
|
+
const updates = [];
|
|
28821
|
+
|
|
28822
|
+
// --- Path A: /api/packages/resolve (covers scoped refs, anon-friendly) ---
|
|
28823
|
+
// The resolve endpoint returns latestVersion per ref for both public
|
|
28824
|
+
// packages AND private packages where the registry's entitlement
|
|
28825
|
+
// check says the caller is allowed (which today includes anonymous
|
|
28826
|
+
// callers for packages with permissive read policies — verified via
|
|
28827
|
+
// curl on 2026-05-19). This means installed-but-private widgets show
|
|
28828
|
+
// up in the update check even at app launch before the user has
|
|
28829
|
+
// signed in, which was the original gap.
|
|
28830
|
+
//
|
|
28831
|
+
// We try check-versions first (a dash-registry PR adds a tighter
|
|
28832
|
+
// endpoint that returns ONLY latestVersion without entitlement
|
|
28833
|
+
// gating); if it's not deployed yet, fall back to /resolve. Both
|
|
28834
|
+
// produce the same shape for our purposes; resolve carries more
|
|
28835
|
+
// metadata but we only read latestVersion.
|
|
28836
|
+
if (scopedRefs.length > 0) {
|
|
28837
|
+
const registryBase =
|
|
28838
|
+
process.env.DASH_REGISTRY_API_URL || DEFAULT_REGISTRY_API_URL;
|
|
28839
|
+
const refsBody = JSON.stringify({
|
|
28840
|
+
refs: scopedRefs.map((r) => ({ scope: r.scope, name: r.name })),
|
|
28771
28841
|
});
|
|
28772
|
-
|
|
28773
|
-
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
|
|
28778
|
-
|
|
28842
|
+
let endpointAvailable = true;
|
|
28843
|
+
let results = null;
|
|
28844
|
+
// Try check-versions first (returns less data, no entitlement
|
|
28845
|
+
// dependency); fall back to /resolve if it 404s (registry without
|
|
28846
|
+
// the new endpoint deployed).
|
|
28847
|
+
for (const endpointPath of [
|
|
28848
|
+
"/api/packages/check-versions",
|
|
28849
|
+
"/api/packages/resolve",
|
|
28850
|
+
]) {
|
|
28851
|
+
const url = `${registryBase}${endpointPath}`;
|
|
28852
|
+
try {
|
|
28853
|
+
const response = await fetch(url, {
|
|
28854
|
+
method: "POST",
|
|
28855
|
+
headers: {
|
|
28856
|
+
"Content-Type": "application/json",
|
|
28857
|
+
// Auth is optional but widens what /resolve returns for
|
|
28858
|
+
// private packages where ownership matters.
|
|
28859
|
+
...buildAuthHeaders(),
|
|
28860
|
+
},
|
|
28861
|
+
body: refsBody,
|
|
28862
|
+
});
|
|
28863
|
+
if (response.status === 404) {
|
|
28864
|
+
// Endpoint not deployed — try the next one.
|
|
28865
|
+
continue;
|
|
28866
|
+
}
|
|
28867
|
+
if (!response.ok) {
|
|
28868
|
+
throw new Error(
|
|
28869
|
+
`${endpointPath} ${response.status} ${response.statusText}`,
|
|
28870
|
+
);
|
|
28871
|
+
}
|
|
28872
|
+
results = await response.json();
|
|
28873
|
+
endpointAvailable = true;
|
|
28874
|
+
break;
|
|
28875
|
+
} catch (error) {
|
|
28876
|
+
console.warn(
|
|
28877
|
+
`[RegistryController] ${endpointPath} failed:`,
|
|
28878
|
+
error.message,
|
|
28879
|
+
);
|
|
28880
|
+
endpointAvailable = false;
|
|
28881
|
+
// Try next endpoint
|
|
28882
|
+
}
|
|
28883
|
+
}
|
|
28884
|
+
|
|
28885
|
+
if (endpointAvailable && Array.isArray(results)) {
|
|
28886
|
+
// Index results by `scope/name` so we can join back to our
|
|
28887
|
+
// scopedRefs list without depending on Promise.all ordering.
|
|
28888
|
+
const byKey = new Map();
|
|
28889
|
+
for (const r of results) {
|
|
28890
|
+
if (r && r.scope && r.name) {
|
|
28891
|
+
byKey.set(`${r.scope}/${r.name}`, r);
|
|
28892
|
+
}
|
|
28893
|
+
}
|
|
28894
|
+
for (const ref of scopedRefs) {
|
|
28895
|
+
const result = byKey.get(`${ref.scope}/${ref.name}`);
|
|
28896
|
+
if (!result || !result.exists) continue;
|
|
28897
|
+
if (
|
|
28898
|
+
result.latestVersion &&
|
|
28899
|
+
result.latestVersion !== ref.installed.version
|
|
28900
|
+
) {
|
|
28901
|
+
// Build the download URL deterministically — same shape the
|
|
28902
|
+
// existing index serves (`/api/packages/<scope>/<name>/download?version=<v>`).
|
|
28903
|
+
// Constructed client-side because check-versions intentionally
|
|
28904
|
+
// doesn't return downloadUrl (less to leak; download still
|
|
28905
|
+
// gated by visibility/entitlements at /download).
|
|
28906
|
+
const downloadUrl = `${registryBase}/api/packages/${encodeURIComponent(
|
|
28907
|
+
ref.scope,
|
|
28908
|
+
)}/${encodeURIComponent(ref.name)}/download?version=${encodeURIComponent(
|
|
28909
|
+
result.latestVersion,
|
|
28910
|
+
)}`;
|
|
28911
|
+
updates.push({
|
|
28912
|
+
name: ref.installed.name,
|
|
28913
|
+
currentVersion: ref.installed.version,
|
|
28914
|
+
latestVersion: result.latestVersion,
|
|
28915
|
+
downloadUrl,
|
|
28916
|
+
changelog: null,
|
|
28917
|
+
});
|
|
28918
|
+
}
|
|
28919
|
+
}
|
|
28920
|
+
} else {
|
|
28921
|
+
// Endpoint unavailable — treat scoped refs as bare for the
|
|
28922
|
+
// fallback path so they at least get a public-only check.
|
|
28923
|
+
for (const ref of scopedRefs) {
|
|
28924
|
+
bareInstalled.push(ref.installed);
|
|
28925
|
+
}
|
|
28926
|
+
}
|
|
28927
|
+
}
|
|
28928
|
+
|
|
28929
|
+
// --- Path B: index scan (bare-name widgets + endpoint fallback) ---
|
|
28930
|
+
if (bareInstalled.length > 0) {
|
|
28931
|
+
const index = await fetchRegistryIndex();
|
|
28932
|
+
for (const installed of bareInstalled) {
|
|
28933
|
+
const installedId = installed.packageId || installed.name;
|
|
28934
|
+
const pkg = (index.packages || []).find((p) => {
|
|
28935
|
+
const registryId = toPackageId(p.scope, p.name);
|
|
28936
|
+
if (registryId === installedId) return true;
|
|
28937
|
+
if (p.name === installedId) return true;
|
|
28938
|
+
return false;
|
|
28779
28939
|
});
|
|
28940
|
+
if (pkg && pkg.version !== installed.version) {
|
|
28941
|
+
updates.push({
|
|
28942
|
+
name: installed.name,
|
|
28943
|
+
currentVersion: installed.version,
|
|
28944
|
+
latestVersion: pkg.version,
|
|
28945
|
+
downloadUrl: pkg.downloadUrl,
|
|
28946
|
+
changelog: pkg.changelog || null,
|
|
28947
|
+
});
|
|
28948
|
+
}
|
|
28780
28949
|
}
|
|
28781
28950
|
}
|
|
28782
28951
|
|
|
@@ -28839,7 +29008,7 @@ async function fetchPackageSource(packageName, componentName = null) {
|
|
|
28839
29008
|
|
|
28840
29009
|
// adm-zip is only available in the host app's node_modules (dash-electron),
|
|
28841
29010
|
// so defer loading until the function actually runs.
|
|
28842
|
-
const AdmZip = require$$
|
|
29011
|
+
const AdmZip = require$$5;
|
|
28843
29012
|
const { validateZipEntries } = widgetRegistryExports;
|
|
28844
29013
|
|
|
28845
29014
|
const pkg = await getPackage$1(packageName);
|
|
@@ -29005,6 +29174,146 @@ async function fetchPackageSource(packageName, componentName = null) {
|
|
|
29005
29174
|
}
|
|
29006
29175
|
}
|
|
29007
29176
|
|
|
29177
|
+
/**
|
|
29178
|
+
* Fetch the `dash.permissions` block from a registry package WITHOUT
|
|
29179
|
+
* installing it. Powers the pre-install preflight: the update flow
|
|
29180
|
+
* uses this to learn which MCP/fs/network grants a new package
|
|
29181
|
+
* version requires before downloading the install. The user then
|
|
29182
|
+
* approves the delta (declared - already-granted) and the install
|
|
29183
|
+
* proceeds knowing nothing will surprise them after the fact.
|
|
29184
|
+
*
|
|
29185
|
+
* Returns `{ packageId, version, permissions }` where `permissions`
|
|
29186
|
+
* is the `dash.permissions` blob from package.json (or null if the
|
|
29187
|
+
* package declares none). Throws on network / unzip / parse errors —
|
|
29188
|
+
* callers should treat a throw as "couldn't preflight; prompt anyway
|
|
29189
|
+
* post-install via the existing flow" rather than blocking the
|
|
29190
|
+
* update on a transient registry hiccup.
|
|
29191
|
+
*
|
|
29192
|
+
* @param {string} packageName
|
|
29193
|
+
* @returns {Promise<{packageId: string, version: string|null, permissions: object|null}>}
|
|
29194
|
+
*/
|
|
29195
|
+
async function fetchPackageManifest(packageName) {
|
|
29196
|
+
if (!packageName) {
|
|
29197
|
+
throw new Error("fetchPackageManifest: packageName is required");
|
|
29198
|
+
}
|
|
29199
|
+
|
|
29200
|
+
const AdmZip = require$$5;
|
|
29201
|
+
const { validateZipEntries } = widgetRegistryExports;
|
|
29202
|
+
|
|
29203
|
+
const pkg = await getPackage$1(packageName);
|
|
29204
|
+
if (!pkg) {
|
|
29205
|
+
throw new Error(`Package "${packageName}" not found in the registry`);
|
|
29206
|
+
}
|
|
29207
|
+
if (!pkg.downloadUrl) {
|
|
29208
|
+
throw new Error(`Package "${packageName}" has no downloadUrl`);
|
|
29209
|
+
}
|
|
29210
|
+
|
|
29211
|
+
const parsedUrl = new URL(pkg.downloadUrl);
|
|
29212
|
+
if (parsedUrl.protocol !== "https:") {
|
|
29213
|
+
throw new Error(
|
|
29214
|
+
`Registry downloads must use HTTPS. Refusing to fetch: ${pkg.downloadUrl}`,
|
|
29215
|
+
);
|
|
29216
|
+
}
|
|
29217
|
+
|
|
29218
|
+
const fetchOpts = {};
|
|
29219
|
+
const registryBase =
|
|
29220
|
+
process.env.DASH_REGISTRY_API_URL ||
|
|
29221
|
+
"https://main.d919rwhuzp7rj.amplifyapp.com";
|
|
29222
|
+
if (
|
|
29223
|
+
pkg.downloadUrl.includes(registryBase) ||
|
|
29224
|
+
pkg.downloadUrl.includes("/api/packages/")
|
|
29225
|
+
) {
|
|
29226
|
+
const auth = getStoredToken$3();
|
|
29227
|
+
if (auth?.token) {
|
|
29228
|
+
fetchOpts.headers = { Authorization: `Bearer ${auth.token}` };
|
|
29229
|
+
}
|
|
29230
|
+
}
|
|
29231
|
+
|
|
29232
|
+
const response = await fetch(pkg.downloadUrl, fetchOpts);
|
|
29233
|
+
if (!response.ok) {
|
|
29234
|
+
if (response.status === 401) {
|
|
29235
|
+
throw new Error("Authentication required to fetch this package manifest");
|
|
29236
|
+
}
|
|
29237
|
+
throw new Error(`Failed to fetch package manifest: ${response.statusText}`);
|
|
29238
|
+
}
|
|
29239
|
+
const contentType = response.headers.get("content-type") || "";
|
|
29240
|
+
let buffer = Buffer.from(await response.arrayBuffer());
|
|
29241
|
+
if (buffer.length === 0) {
|
|
29242
|
+
throw new Error("Manifest fetch failed: registry returned an empty body");
|
|
29243
|
+
}
|
|
29244
|
+
if (contentType.includes("application/json")) {
|
|
29245
|
+
const jsonData = JSON.parse(buffer.toString("utf-8"));
|
|
29246
|
+
if (jsonData.error) {
|
|
29247
|
+
throw new Error(`Manifest fetch failed: ${jsonData.error}`);
|
|
29248
|
+
}
|
|
29249
|
+
if (jsonData.downloadUrl) {
|
|
29250
|
+
const zipResponse = await fetch(jsonData.downloadUrl);
|
|
29251
|
+
if (!zipResponse.ok) {
|
|
29252
|
+
throw new Error(
|
|
29253
|
+
`Manifest fetch failed: storage returned ${zipResponse.status} ${zipResponse.statusText}`,
|
|
29254
|
+
);
|
|
29255
|
+
}
|
|
29256
|
+
buffer = Buffer.from(await zipResponse.arrayBuffer());
|
|
29257
|
+
}
|
|
29258
|
+
}
|
|
29259
|
+
|
|
29260
|
+
const zip = new AdmZip(buffer);
|
|
29261
|
+
const safeName = (pkg.name || "pkg").replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
29262
|
+
const tempDir = path$9.join(
|
|
29263
|
+
os.tmpdir(),
|
|
29264
|
+
`dash-registry-manifest-${safeName}-${Date.now()}`,
|
|
29265
|
+
);
|
|
29266
|
+
|
|
29267
|
+
try {
|
|
29268
|
+
validateZipEntries(zip, tempDir);
|
|
29269
|
+
// Only need package.json — extract that single entry instead of
|
|
29270
|
+
// the whole zip to keep this cheap (the full extract in
|
|
29271
|
+
// fetchPackageSource is the right call for previews, but
|
|
29272
|
+
// pre-install preflight is hot path during a 22-widget batch
|
|
29273
|
+
// update so trimming N×(unzip-everything) helps).
|
|
29274
|
+
const pkgJsonEntry = zip.getEntries().find((e) => {
|
|
29275
|
+
const name = e.entryName.replace(/\\/g, "/");
|
|
29276
|
+
return name === "package.json" || name.endsWith("/package.json");
|
|
29277
|
+
});
|
|
29278
|
+
if (!pkgJsonEntry) {
|
|
29279
|
+
// No package.json in the zip — treat as "no declared
|
|
29280
|
+
// permissions" rather than throwing. Callers fall through to
|
|
29281
|
+
// the post-install consent path.
|
|
29282
|
+
return {
|
|
29283
|
+
packageId: toPackageId(pkg.scope, pkg.name),
|
|
29284
|
+
version: pkg.version || null,
|
|
29285
|
+
permissions: null,
|
|
29286
|
+
};
|
|
29287
|
+
}
|
|
29288
|
+
const pkgJsonText = zip.readAsText(pkgJsonEntry);
|
|
29289
|
+
let parsed;
|
|
29290
|
+
try {
|
|
29291
|
+
parsed = JSON.parse(pkgJsonText);
|
|
29292
|
+
} catch (e) {
|
|
29293
|
+
throw new Error(
|
|
29294
|
+
`Manifest fetch failed: invalid package.json (${e.message})`,
|
|
29295
|
+
);
|
|
29296
|
+
}
|
|
29297
|
+
return {
|
|
29298
|
+
packageId: toPackageId(pkg.scope, pkg.name),
|
|
29299
|
+
version: pkg.version || parsed.version || null,
|
|
29300
|
+
permissions: parsed.dash?.permissions || null,
|
|
29301
|
+
};
|
|
29302
|
+
} finally {
|
|
29303
|
+
// tempDir was never actually created (we read in-memory via
|
|
29304
|
+
// zip.readAsText), but validateZipEntries computes paths against
|
|
29305
|
+
// it. Keep the symmetric cleanup defensively in case future
|
|
29306
|
+
// edits switch back to extractAllTo.
|
|
29307
|
+
try {
|
|
29308
|
+
if (fs$7.existsSync(tempDir)) {
|
|
29309
|
+
fs$7.rmSync(tempDir, { recursive: true, force: true });
|
|
29310
|
+
}
|
|
29311
|
+
} catch (_) {
|
|
29312
|
+
// non-fatal
|
|
29313
|
+
}
|
|
29314
|
+
}
|
|
29315
|
+
}
|
|
29316
|
+
|
|
29008
29317
|
var registryController$3 = {
|
|
29009
29318
|
fetchRegistryIndex,
|
|
29010
29319
|
searchRegistry: searchRegistry$1,
|
|
@@ -29013,12 +29322,13 @@ var registryController$3 = {
|
|
|
29013
29322
|
getPackage: getPackage$1,
|
|
29014
29323
|
checkUpdates,
|
|
29015
29324
|
fetchPackageSource,
|
|
29325
|
+
fetchPackageManifest,
|
|
29016
29326
|
};
|
|
29017
29327
|
|
|
29018
29328
|
var fs$6 = require$$0$2;
|
|
29019
29329
|
var JSONStream = require$$4$1;
|
|
29020
29330
|
const algoliasearch$1 = require$$2$3;
|
|
29021
|
-
const path$8 = require$$3$
|
|
29331
|
+
const path$8 = require$$3$2;
|
|
29022
29332
|
const { ensureDirectoryExistence, checkDirectory } = file;
|
|
29023
29333
|
|
|
29024
29334
|
let AlgoliaIndex$1 = class AlgoliaIndex {
|
|
@@ -35128,26 +35438,26 @@ var __importStar$2 = (commonjsGlobal && commonjsGlobal.__importStar) || function
|
|
|
35128
35438
|
return result;
|
|
35129
35439
|
};
|
|
35130
35440
|
Object.defineProperty(coerce, "__esModule", { value: true });
|
|
35131
|
-
coerce.string = string
|
|
35132
|
-
coerce.number = number
|
|
35133
|
-
coerce.boolean = boolean
|
|
35134
|
-
coerce.bigint = bigint
|
|
35135
|
-
coerce.date = date
|
|
35441
|
+
coerce.string = string;
|
|
35442
|
+
coerce.number = number;
|
|
35443
|
+
coerce.boolean = boolean;
|
|
35444
|
+
coerce.bigint = bigint;
|
|
35445
|
+
coerce.date = date;
|
|
35136
35446
|
const core$3 = __importStar$2(core$8);
|
|
35137
35447
|
const schemas = __importStar$2(schemas$1);
|
|
35138
|
-
function string
|
|
35448
|
+
function string(params) {
|
|
35139
35449
|
return core$3._coercedString(schemas.ZodMiniString, params);
|
|
35140
35450
|
}
|
|
35141
|
-
function number
|
|
35451
|
+
function number(params) {
|
|
35142
35452
|
return core$3._coercedNumber(schemas.ZodMiniNumber, params);
|
|
35143
35453
|
}
|
|
35144
|
-
function boolean
|
|
35454
|
+
function boolean(params) {
|
|
35145
35455
|
return core$3._coercedBoolean(schemas.ZodMiniBoolean, params);
|
|
35146
35456
|
}
|
|
35147
|
-
function bigint
|
|
35457
|
+
function bigint(params) {
|
|
35148
35458
|
return core$3._coercedBigint(schemas.ZodMiniBigInt, params);
|
|
35149
35459
|
}
|
|
35150
|
-
function date
|
|
35460
|
+
function date(params) {
|
|
35151
35461
|
return core$3._coercedDate(schemas.ZodMiniDate, params);
|
|
35152
35462
|
}
|
|
35153
35463
|
|
|
@@ -35533,1838 +35843,6 @@ function isTerminal(status) {
|
|
|
35533
35843
|
|
|
35534
35844
|
var zodJsonSchemaCompat = {};
|
|
35535
35845
|
|
|
35536
|
-
var cjs = {};
|
|
35537
|
-
|
|
35538
|
-
var Options = {};
|
|
35539
|
-
|
|
35540
|
-
(function (exports) {
|
|
35541
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35542
|
-
exports.getDefaultOptions = exports.defaultOptions = exports.jsonDescription = exports.ignoreOverride = void 0;
|
|
35543
|
-
exports.ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
35544
|
-
const jsonDescription = (jsonSchema, def) => {
|
|
35545
|
-
if (def.description) {
|
|
35546
|
-
try {
|
|
35547
|
-
return {
|
|
35548
|
-
...jsonSchema,
|
|
35549
|
-
...JSON.parse(def.description),
|
|
35550
|
-
};
|
|
35551
|
-
}
|
|
35552
|
-
catch { }
|
|
35553
|
-
}
|
|
35554
|
-
return jsonSchema;
|
|
35555
|
-
};
|
|
35556
|
-
exports.jsonDescription = jsonDescription;
|
|
35557
|
-
exports.defaultOptions = {
|
|
35558
|
-
name: undefined,
|
|
35559
|
-
$refStrategy: "root",
|
|
35560
|
-
basePath: ["#"],
|
|
35561
|
-
effectStrategy: "input",
|
|
35562
|
-
pipeStrategy: "all",
|
|
35563
|
-
dateStrategy: "format:date-time",
|
|
35564
|
-
mapStrategy: "entries",
|
|
35565
|
-
removeAdditionalStrategy: "passthrough",
|
|
35566
|
-
allowedAdditionalProperties: true,
|
|
35567
|
-
rejectedAdditionalProperties: false,
|
|
35568
|
-
definitionPath: "definitions",
|
|
35569
|
-
target: "jsonSchema7",
|
|
35570
|
-
strictUnions: false,
|
|
35571
|
-
definitions: {},
|
|
35572
|
-
errorMessages: false,
|
|
35573
|
-
markdownDescription: false,
|
|
35574
|
-
patternStrategy: "escape",
|
|
35575
|
-
applyRegexFlags: false,
|
|
35576
|
-
emailStrategy: "format:email",
|
|
35577
|
-
base64Strategy: "contentEncoding:base64",
|
|
35578
|
-
nameStrategy: "ref",
|
|
35579
|
-
openAiAnyTypeName: "OpenAiAnyType"
|
|
35580
|
-
};
|
|
35581
|
-
const getDefaultOptions = (options) => (typeof options === "string"
|
|
35582
|
-
? {
|
|
35583
|
-
...exports.defaultOptions,
|
|
35584
|
-
name: options,
|
|
35585
|
-
}
|
|
35586
|
-
: {
|
|
35587
|
-
...exports.defaultOptions,
|
|
35588
|
-
...options,
|
|
35589
|
-
});
|
|
35590
|
-
exports.getDefaultOptions = getDefaultOptions;
|
|
35591
|
-
} (Options));
|
|
35592
|
-
|
|
35593
|
-
var Refs = {};
|
|
35594
|
-
|
|
35595
|
-
Object.defineProperty(Refs, "__esModule", { value: true });
|
|
35596
|
-
Refs.getRefs = void 0;
|
|
35597
|
-
const Options_js_1 = Options;
|
|
35598
|
-
const getRefs = (options) => {
|
|
35599
|
-
const _options = (0, Options_js_1.getDefaultOptions)(options);
|
|
35600
|
-
const currentPath = _options.name !== undefined
|
|
35601
|
-
? [..._options.basePath, _options.definitionPath, _options.name]
|
|
35602
|
-
: _options.basePath;
|
|
35603
|
-
return {
|
|
35604
|
-
..._options,
|
|
35605
|
-
flags: { hasReferencedOpenAiAnyType: false },
|
|
35606
|
-
currentPath: currentPath,
|
|
35607
|
-
propertyPath: undefined,
|
|
35608
|
-
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
|
|
35609
|
-
def._def,
|
|
35610
|
-
{
|
|
35611
|
-
def: def._def,
|
|
35612
|
-
path: [..._options.basePath, _options.definitionPath, name],
|
|
35613
|
-
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
35614
|
-
jsonSchema: undefined,
|
|
35615
|
-
},
|
|
35616
|
-
])),
|
|
35617
|
-
};
|
|
35618
|
-
};
|
|
35619
|
-
Refs.getRefs = getRefs;
|
|
35620
|
-
|
|
35621
|
-
var errorMessages = {};
|
|
35622
|
-
|
|
35623
|
-
Object.defineProperty(errorMessages, "__esModule", { value: true });
|
|
35624
|
-
errorMessages.setResponseValueAndErrors = errorMessages.addErrorMessage = void 0;
|
|
35625
|
-
function addErrorMessage(res, key, errorMessage, refs) {
|
|
35626
|
-
if (!refs?.errorMessages)
|
|
35627
|
-
return;
|
|
35628
|
-
if (errorMessage) {
|
|
35629
|
-
res.errorMessage = {
|
|
35630
|
-
...res.errorMessage,
|
|
35631
|
-
[key]: errorMessage,
|
|
35632
|
-
};
|
|
35633
|
-
}
|
|
35634
|
-
}
|
|
35635
|
-
errorMessages.addErrorMessage = addErrorMessage;
|
|
35636
|
-
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
35637
|
-
res[key] = value;
|
|
35638
|
-
addErrorMessage(res, key, errorMessage, refs);
|
|
35639
|
-
}
|
|
35640
|
-
errorMessages.setResponseValueAndErrors = setResponseValueAndErrors;
|
|
35641
|
-
|
|
35642
|
-
var getRelativePath$1 = {};
|
|
35643
|
-
|
|
35644
|
-
Object.defineProperty(getRelativePath$1, "__esModule", { value: true });
|
|
35645
|
-
getRelativePath$1.getRelativePath = void 0;
|
|
35646
|
-
const getRelativePath = (pathA, pathB) => {
|
|
35647
|
-
let i = 0;
|
|
35648
|
-
for (; i < pathA.length && i < pathB.length; i++) {
|
|
35649
|
-
if (pathA[i] !== pathB[i])
|
|
35650
|
-
break;
|
|
35651
|
-
}
|
|
35652
|
-
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
35653
|
-
};
|
|
35654
|
-
getRelativePath$1.getRelativePath = getRelativePath;
|
|
35655
|
-
|
|
35656
|
-
var parseDef = {};
|
|
35657
|
-
|
|
35658
|
-
var selectParser = {};
|
|
35659
|
-
|
|
35660
|
-
var any = {};
|
|
35661
|
-
|
|
35662
|
-
Object.defineProperty(any, "__esModule", { value: true });
|
|
35663
|
-
any.parseAnyDef = void 0;
|
|
35664
|
-
const getRelativePath_js_1 = getRelativePath$1;
|
|
35665
|
-
function parseAnyDef(refs) {
|
|
35666
|
-
if (refs.target !== "openAi") {
|
|
35667
|
-
return {};
|
|
35668
|
-
}
|
|
35669
|
-
const anyDefinitionPath = [
|
|
35670
|
-
...refs.basePath,
|
|
35671
|
-
refs.definitionPath,
|
|
35672
|
-
refs.openAiAnyTypeName,
|
|
35673
|
-
];
|
|
35674
|
-
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
35675
|
-
return {
|
|
35676
|
-
$ref: refs.$refStrategy === "relative"
|
|
35677
|
-
? (0, getRelativePath_js_1.getRelativePath)(anyDefinitionPath, refs.currentPath)
|
|
35678
|
-
: anyDefinitionPath.join("/"),
|
|
35679
|
-
};
|
|
35680
|
-
}
|
|
35681
|
-
any.parseAnyDef = parseAnyDef;
|
|
35682
|
-
|
|
35683
|
-
var array = {};
|
|
35684
|
-
|
|
35685
|
-
var hasRequiredArray;
|
|
35686
|
-
|
|
35687
|
-
function requireArray () {
|
|
35688
|
-
if (hasRequiredArray) return array;
|
|
35689
|
-
hasRequiredArray = 1;
|
|
35690
|
-
Object.defineProperty(array, "__esModule", { value: true });
|
|
35691
|
-
array.parseArrayDef = void 0;
|
|
35692
|
-
const v3_1 = v3;
|
|
35693
|
-
const errorMessages_js_1 = errorMessages;
|
|
35694
|
-
const parseDef_js_1 = requireParseDef();
|
|
35695
|
-
function parseArrayDef(def, refs) {
|
|
35696
|
-
const res = {
|
|
35697
|
-
type: "array",
|
|
35698
|
-
};
|
|
35699
|
-
if (def.type?._def &&
|
|
35700
|
-
def.type?._def?.typeName !== v3_1.ZodFirstPartyTypeKind.ZodAny) {
|
|
35701
|
-
res.items = (0, parseDef_js_1.parseDef)(def.type._def, {
|
|
35702
|
-
...refs,
|
|
35703
|
-
currentPath: [...refs.currentPath, "items"],
|
|
35704
|
-
});
|
|
35705
|
-
}
|
|
35706
|
-
if (def.minLength) {
|
|
35707
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
35708
|
-
}
|
|
35709
|
-
if (def.maxLength) {
|
|
35710
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
35711
|
-
}
|
|
35712
|
-
if (def.exactLength) {
|
|
35713
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
35714
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
35715
|
-
}
|
|
35716
|
-
return res;
|
|
35717
|
-
}
|
|
35718
|
-
array.parseArrayDef = parseArrayDef;
|
|
35719
|
-
return array;
|
|
35720
|
-
}
|
|
35721
|
-
|
|
35722
|
-
var bigint = {};
|
|
35723
|
-
|
|
35724
|
-
Object.defineProperty(bigint, "__esModule", { value: true });
|
|
35725
|
-
bigint.parseBigintDef = void 0;
|
|
35726
|
-
const errorMessages_js_1$2 = errorMessages;
|
|
35727
|
-
function parseBigintDef(def, refs) {
|
|
35728
|
-
const res = {
|
|
35729
|
-
type: "integer",
|
|
35730
|
-
format: "int64",
|
|
35731
|
-
};
|
|
35732
|
-
if (!def.checks)
|
|
35733
|
-
return res;
|
|
35734
|
-
for (const check of def.checks) {
|
|
35735
|
-
switch (check.kind) {
|
|
35736
|
-
case "min":
|
|
35737
|
-
if (refs.target === "jsonSchema7") {
|
|
35738
|
-
if (check.inclusive) {
|
|
35739
|
-
(0, errorMessages_js_1$2.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
|
|
35740
|
-
}
|
|
35741
|
-
else {
|
|
35742
|
-
(0, errorMessages_js_1$2.setResponseValueAndErrors)(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
35743
|
-
}
|
|
35744
|
-
}
|
|
35745
|
-
else {
|
|
35746
|
-
if (!check.inclusive) {
|
|
35747
|
-
res.exclusiveMinimum = true;
|
|
35748
|
-
}
|
|
35749
|
-
(0, errorMessages_js_1$2.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
|
|
35750
|
-
}
|
|
35751
|
-
break;
|
|
35752
|
-
case "max":
|
|
35753
|
-
if (refs.target === "jsonSchema7") {
|
|
35754
|
-
if (check.inclusive) {
|
|
35755
|
-
(0, errorMessages_js_1$2.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
|
|
35756
|
-
}
|
|
35757
|
-
else {
|
|
35758
|
-
(0, errorMessages_js_1$2.setResponseValueAndErrors)(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
35759
|
-
}
|
|
35760
|
-
}
|
|
35761
|
-
else {
|
|
35762
|
-
if (!check.inclusive) {
|
|
35763
|
-
res.exclusiveMaximum = true;
|
|
35764
|
-
}
|
|
35765
|
-
(0, errorMessages_js_1$2.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
|
|
35766
|
-
}
|
|
35767
|
-
break;
|
|
35768
|
-
case "multipleOf":
|
|
35769
|
-
(0, errorMessages_js_1$2.setResponseValueAndErrors)(res, "multipleOf", check.value, check.message, refs);
|
|
35770
|
-
break;
|
|
35771
|
-
}
|
|
35772
|
-
}
|
|
35773
|
-
return res;
|
|
35774
|
-
}
|
|
35775
|
-
bigint.parseBigintDef = parseBigintDef;
|
|
35776
|
-
|
|
35777
|
-
var boolean = {};
|
|
35778
|
-
|
|
35779
|
-
Object.defineProperty(boolean, "__esModule", { value: true });
|
|
35780
|
-
boolean.parseBooleanDef = void 0;
|
|
35781
|
-
function parseBooleanDef() {
|
|
35782
|
-
return {
|
|
35783
|
-
type: "boolean",
|
|
35784
|
-
};
|
|
35785
|
-
}
|
|
35786
|
-
boolean.parseBooleanDef = parseBooleanDef;
|
|
35787
|
-
|
|
35788
|
-
var branded = {};
|
|
35789
|
-
|
|
35790
|
-
var hasRequiredBranded;
|
|
35791
|
-
|
|
35792
|
-
function requireBranded () {
|
|
35793
|
-
if (hasRequiredBranded) return branded;
|
|
35794
|
-
hasRequiredBranded = 1;
|
|
35795
|
-
Object.defineProperty(branded, "__esModule", { value: true });
|
|
35796
|
-
branded.parseBrandedDef = void 0;
|
|
35797
|
-
const parseDef_js_1 = requireParseDef();
|
|
35798
|
-
function parseBrandedDef(_def, refs) {
|
|
35799
|
-
return (0, parseDef_js_1.parseDef)(_def.type._def, refs);
|
|
35800
|
-
}
|
|
35801
|
-
branded.parseBrandedDef = parseBrandedDef;
|
|
35802
|
-
return branded;
|
|
35803
|
-
}
|
|
35804
|
-
|
|
35805
|
-
var _catch = {};
|
|
35806
|
-
|
|
35807
|
-
var hasRequired_catch;
|
|
35808
|
-
|
|
35809
|
-
function require_catch () {
|
|
35810
|
-
if (hasRequired_catch) return _catch;
|
|
35811
|
-
hasRequired_catch = 1;
|
|
35812
|
-
Object.defineProperty(_catch, "__esModule", { value: true });
|
|
35813
|
-
_catch.parseCatchDef = void 0;
|
|
35814
|
-
const parseDef_js_1 = requireParseDef();
|
|
35815
|
-
const parseCatchDef = (def, refs) => {
|
|
35816
|
-
return (0, parseDef_js_1.parseDef)(def.innerType._def, refs);
|
|
35817
|
-
};
|
|
35818
|
-
_catch.parseCatchDef = parseCatchDef;
|
|
35819
|
-
return _catch;
|
|
35820
|
-
}
|
|
35821
|
-
|
|
35822
|
-
var date = {};
|
|
35823
|
-
|
|
35824
|
-
Object.defineProperty(date, "__esModule", { value: true });
|
|
35825
|
-
date.parseDateDef = void 0;
|
|
35826
|
-
const errorMessages_js_1$1 = errorMessages;
|
|
35827
|
-
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
35828
|
-
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
35829
|
-
if (Array.isArray(strategy)) {
|
|
35830
|
-
return {
|
|
35831
|
-
anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)),
|
|
35832
|
-
};
|
|
35833
|
-
}
|
|
35834
|
-
switch (strategy) {
|
|
35835
|
-
case "string":
|
|
35836
|
-
case "format:date-time":
|
|
35837
|
-
return {
|
|
35838
|
-
type: "string",
|
|
35839
|
-
format: "date-time",
|
|
35840
|
-
};
|
|
35841
|
-
case "format:date":
|
|
35842
|
-
return {
|
|
35843
|
-
type: "string",
|
|
35844
|
-
format: "date",
|
|
35845
|
-
};
|
|
35846
|
-
case "integer":
|
|
35847
|
-
return integerDateParser(def, refs);
|
|
35848
|
-
}
|
|
35849
|
-
}
|
|
35850
|
-
date.parseDateDef = parseDateDef;
|
|
35851
|
-
const integerDateParser = (def, refs) => {
|
|
35852
|
-
const res = {
|
|
35853
|
-
type: "integer",
|
|
35854
|
-
format: "unix-time",
|
|
35855
|
-
};
|
|
35856
|
-
if (refs.target === "openApi3") {
|
|
35857
|
-
return res;
|
|
35858
|
-
}
|
|
35859
|
-
for (const check of def.checks) {
|
|
35860
|
-
switch (check.kind) {
|
|
35861
|
-
case "min":
|
|
35862
|
-
(0, errorMessages_js_1$1.setResponseValueAndErrors)(res, "minimum", check.value, // This is in milliseconds
|
|
35863
|
-
check.message, refs);
|
|
35864
|
-
break;
|
|
35865
|
-
case "max":
|
|
35866
|
-
(0, errorMessages_js_1$1.setResponseValueAndErrors)(res, "maximum", check.value, // This is in milliseconds
|
|
35867
|
-
check.message, refs);
|
|
35868
|
-
break;
|
|
35869
|
-
}
|
|
35870
|
-
}
|
|
35871
|
-
return res;
|
|
35872
|
-
};
|
|
35873
|
-
|
|
35874
|
-
var _default = {};
|
|
35875
|
-
|
|
35876
|
-
var hasRequired_default;
|
|
35877
|
-
|
|
35878
|
-
function require_default () {
|
|
35879
|
-
if (hasRequired_default) return _default;
|
|
35880
|
-
hasRequired_default = 1;
|
|
35881
|
-
Object.defineProperty(_default, "__esModule", { value: true });
|
|
35882
|
-
_default.parseDefaultDef = void 0;
|
|
35883
|
-
const parseDef_js_1 = requireParseDef();
|
|
35884
|
-
function parseDefaultDef(_def, refs) {
|
|
35885
|
-
return {
|
|
35886
|
-
...(0, parseDef_js_1.parseDef)(_def.innerType._def, refs),
|
|
35887
|
-
default: _def.defaultValue(),
|
|
35888
|
-
};
|
|
35889
|
-
}
|
|
35890
|
-
_default.parseDefaultDef = parseDefaultDef;
|
|
35891
|
-
return _default;
|
|
35892
|
-
}
|
|
35893
|
-
|
|
35894
|
-
var effects = {};
|
|
35895
|
-
|
|
35896
|
-
var hasRequiredEffects;
|
|
35897
|
-
|
|
35898
|
-
function requireEffects () {
|
|
35899
|
-
if (hasRequiredEffects) return effects;
|
|
35900
|
-
hasRequiredEffects = 1;
|
|
35901
|
-
Object.defineProperty(effects, "__esModule", { value: true });
|
|
35902
|
-
effects.parseEffectsDef = void 0;
|
|
35903
|
-
const parseDef_js_1 = requireParseDef();
|
|
35904
|
-
const any_js_1 = any;
|
|
35905
|
-
function parseEffectsDef(_def, refs) {
|
|
35906
|
-
return refs.effectStrategy === "input"
|
|
35907
|
-
? (0, parseDef_js_1.parseDef)(_def.schema._def, refs)
|
|
35908
|
-
: (0, any_js_1.parseAnyDef)(refs);
|
|
35909
|
-
}
|
|
35910
|
-
effects.parseEffectsDef = parseEffectsDef;
|
|
35911
|
-
return effects;
|
|
35912
|
-
}
|
|
35913
|
-
|
|
35914
|
-
var _enum$1 = {};
|
|
35915
|
-
|
|
35916
|
-
Object.defineProperty(_enum$1, "__esModule", { value: true });
|
|
35917
|
-
_enum$1.parseEnumDef = void 0;
|
|
35918
|
-
function parseEnumDef(def) {
|
|
35919
|
-
return {
|
|
35920
|
-
type: "string",
|
|
35921
|
-
enum: Array.from(def.values),
|
|
35922
|
-
};
|
|
35923
|
-
}
|
|
35924
|
-
_enum$1.parseEnumDef = parseEnumDef;
|
|
35925
|
-
|
|
35926
|
-
var intersection = {};
|
|
35927
|
-
|
|
35928
|
-
var hasRequiredIntersection;
|
|
35929
|
-
|
|
35930
|
-
function requireIntersection () {
|
|
35931
|
-
if (hasRequiredIntersection) return intersection;
|
|
35932
|
-
hasRequiredIntersection = 1;
|
|
35933
|
-
Object.defineProperty(intersection, "__esModule", { value: true });
|
|
35934
|
-
intersection.parseIntersectionDef = void 0;
|
|
35935
|
-
const parseDef_js_1 = requireParseDef();
|
|
35936
|
-
const isJsonSchema7AllOfType = (type) => {
|
|
35937
|
-
if ("type" in type && type.type === "string")
|
|
35938
|
-
return false;
|
|
35939
|
-
return "allOf" in type;
|
|
35940
|
-
};
|
|
35941
|
-
function parseIntersectionDef(def, refs) {
|
|
35942
|
-
const allOf = [
|
|
35943
|
-
(0, parseDef_js_1.parseDef)(def.left._def, {
|
|
35944
|
-
...refs,
|
|
35945
|
-
currentPath: [...refs.currentPath, "allOf", "0"],
|
|
35946
|
-
}),
|
|
35947
|
-
(0, parseDef_js_1.parseDef)(def.right._def, {
|
|
35948
|
-
...refs,
|
|
35949
|
-
currentPath: [...refs.currentPath, "allOf", "1"],
|
|
35950
|
-
}),
|
|
35951
|
-
].filter((x) => !!x);
|
|
35952
|
-
let unevaluatedProperties = refs.target === "jsonSchema2019-09"
|
|
35953
|
-
? { unevaluatedProperties: false }
|
|
35954
|
-
: undefined;
|
|
35955
|
-
const mergedAllOf = [];
|
|
35956
|
-
// If either of the schemas is an allOf, merge them into a single allOf
|
|
35957
|
-
allOf.forEach((schema) => {
|
|
35958
|
-
if (isJsonSchema7AllOfType(schema)) {
|
|
35959
|
-
mergedAllOf.push(...schema.allOf);
|
|
35960
|
-
if (schema.unevaluatedProperties === undefined) {
|
|
35961
|
-
// If one of the schemas has no unevaluatedProperties set,
|
|
35962
|
-
// the merged schema should also have no unevaluatedProperties set
|
|
35963
|
-
unevaluatedProperties = undefined;
|
|
35964
|
-
}
|
|
35965
|
-
}
|
|
35966
|
-
else {
|
|
35967
|
-
let nestedSchema = schema;
|
|
35968
|
-
if ("additionalProperties" in schema &&
|
|
35969
|
-
schema.additionalProperties === false) {
|
|
35970
|
-
const { additionalProperties, ...rest } = schema;
|
|
35971
|
-
nestedSchema = rest;
|
|
35972
|
-
}
|
|
35973
|
-
else {
|
|
35974
|
-
// As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties
|
|
35975
|
-
unevaluatedProperties = undefined;
|
|
35976
|
-
}
|
|
35977
|
-
mergedAllOf.push(nestedSchema);
|
|
35978
|
-
}
|
|
35979
|
-
});
|
|
35980
|
-
return mergedAllOf.length
|
|
35981
|
-
? {
|
|
35982
|
-
allOf: mergedAllOf,
|
|
35983
|
-
...unevaluatedProperties,
|
|
35984
|
-
}
|
|
35985
|
-
: undefined;
|
|
35986
|
-
}
|
|
35987
|
-
intersection.parseIntersectionDef = parseIntersectionDef;
|
|
35988
|
-
return intersection;
|
|
35989
|
-
}
|
|
35990
|
-
|
|
35991
|
-
var literal = {};
|
|
35992
|
-
|
|
35993
|
-
Object.defineProperty(literal, "__esModule", { value: true });
|
|
35994
|
-
literal.parseLiteralDef = void 0;
|
|
35995
|
-
function parseLiteralDef(def, refs) {
|
|
35996
|
-
const parsedType = typeof def.value;
|
|
35997
|
-
if (parsedType !== "bigint" &&
|
|
35998
|
-
parsedType !== "number" &&
|
|
35999
|
-
parsedType !== "boolean" &&
|
|
36000
|
-
parsedType !== "string") {
|
|
36001
|
-
return {
|
|
36002
|
-
type: Array.isArray(def.value) ? "array" : "object",
|
|
36003
|
-
};
|
|
36004
|
-
}
|
|
36005
|
-
if (refs.target === "openApi3") {
|
|
36006
|
-
return {
|
|
36007
|
-
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
36008
|
-
enum: [def.value],
|
|
36009
|
-
};
|
|
36010
|
-
}
|
|
36011
|
-
return {
|
|
36012
|
-
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
36013
|
-
const: def.value,
|
|
36014
|
-
};
|
|
36015
|
-
}
|
|
36016
|
-
literal.parseLiteralDef = parseLiteralDef;
|
|
36017
|
-
|
|
36018
|
-
var map = {};
|
|
36019
|
-
|
|
36020
|
-
var record = {};
|
|
36021
|
-
|
|
36022
|
-
var string = {};
|
|
36023
|
-
|
|
36024
|
-
(function (exports) {
|
|
36025
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36026
|
-
exports.parseStringDef = exports.zodPatterns = void 0;
|
|
36027
|
-
const errorMessages_js_1 = errorMessages;
|
|
36028
|
-
let emojiRegex = undefined;
|
|
36029
|
-
/**
|
|
36030
|
-
* Generated from the regular expressions found here as of 2024-05-22:
|
|
36031
|
-
* https://github.com/colinhacks/zod/blob/master/src/types.ts.
|
|
36032
|
-
*
|
|
36033
|
-
* Expressions with /i flag have been changed accordingly.
|
|
36034
|
-
*/
|
|
36035
|
-
exports.zodPatterns = {
|
|
36036
|
-
/**
|
|
36037
|
-
* `c` was changed to `[cC]` to replicate /i flag
|
|
36038
|
-
*/
|
|
36039
|
-
cuid: /^[cC][^\s-]{8,}$/,
|
|
36040
|
-
cuid2: /^[0-9a-z]+$/,
|
|
36041
|
-
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
36042
|
-
/**
|
|
36043
|
-
* `a-z` was added to replicate /i flag
|
|
36044
|
-
*/
|
|
36045
|
-
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
36046
|
-
/**
|
|
36047
|
-
* Constructed a valid Unicode RegExp
|
|
36048
|
-
*
|
|
36049
|
-
* Lazily instantiate since this type of regex isn't supported
|
|
36050
|
-
* in all envs (e.g. React Native).
|
|
36051
|
-
*
|
|
36052
|
-
* See:
|
|
36053
|
-
* https://github.com/colinhacks/zod/issues/2433
|
|
36054
|
-
* Fix in Zod:
|
|
36055
|
-
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
36056
|
-
*/
|
|
36057
|
-
emoji: () => {
|
|
36058
|
-
if (emojiRegex === undefined) {
|
|
36059
|
-
emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
36060
|
-
}
|
|
36061
|
-
return emojiRegex;
|
|
36062
|
-
},
|
|
36063
|
-
/**
|
|
36064
|
-
* Unused
|
|
36065
|
-
*/
|
|
36066
|
-
uuid: /^[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}$/,
|
|
36067
|
-
/**
|
|
36068
|
-
* Unused
|
|
36069
|
-
*/
|
|
36070
|
-
ipv4: /^(?:(?: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])$/,
|
|
36071
|
-
ipv4Cidr: /^(?:(?: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])$/,
|
|
36072
|
-
/**
|
|
36073
|
-
* Unused
|
|
36074
|
-
*/
|
|
36075
|
-
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
|
|
36076
|
-
ipv6Cidr: /^(([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])$/,
|
|
36077
|
-
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
36078
|
-
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
36079
|
-
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
36080
|
-
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
|
|
36081
|
-
};
|
|
36082
|
-
function parseStringDef(def, refs) {
|
|
36083
|
-
const res = {
|
|
36084
|
-
type: "string",
|
|
36085
|
-
};
|
|
36086
|
-
if (def.checks) {
|
|
36087
|
-
for (const check of def.checks) {
|
|
36088
|
-
switch (check.kind) {
|
|
36089
|
-
case "min":
|
|
36090
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number"
|
|
36091
|
-
? Math.max(res.minLength, check.value)
|
|
36092
|
-
: check.value, check.message, refs);
|
|
36093
|
-
break;
|
|
36094
|
-
case "max":
|
|
36095
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number"
|
|
36096
|
-
? Math.min(res.maxLength, check.value)
|
|
36097
|
-
: check.value, check.message, refs);
|
|
36098
|
-
break;
|
|
36099
|
-
case "email":
|
|
36100
|
-
switch (refs.emailStrategy) {
|
|
36101
|
-
case "format:email":
|
|
36102
|
-
addFormat(res, "email", check.message, refs);
|
|
36103
|
-
break;
|
|
36104
|
-
case "format:idn-email":
|
|
36105
|
-
addFormat(res, "idn-email", check.message, refs);
|
|
36106
|
-
break;
|
|
36107
|
-
case "pattern:zod":
|
|
36108
|
-
addPattern(res, exports.zodPatterns.email, check.message, refs);
|
|
36109
|
-
break;
|
|
36110
|
-
}
|
|
36111
|
-
break;
|
|
36112
|
-
case "url":
|
|
36113
|
-
addFormat(res, "uri", check.message, refs);
|
|
36114
|
-
break;
|
|
36115
|
-
case "uuid":
|
|
36116
|
-
addFormat(res, "uuid", check.message, refs);
|
|
36117
|
-
break;
|
|
36118
|
-
case "regex":
|
|
36119
|
-
addPattern(res, check.regex, check.message, refs);
|
|
36120
|
-
break;
|
|
36121
|
-
case "cuid":
|
|
36122
|
-
addPattern(res, exports.zodPatterns.cuid, check.message, refs);
|
|
36123
|
-
break;
|
|
36124
|
-
case "cuid2":
|
|
36125
|
-
addPattern(res, exports.zodPatterns.cuid2, check.message, refs);
|
|
36126
|
-
break;
|
|
36127
|
-
case "startsWith":
|
|
36128
|
-
addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
|
|
36129
|
-
break;
|
|
36130
|
-
case "endsWith":
|
|
36131
|
-
addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
|
|
36132
|
-
break;
|
|
36133
|
-
case "datetime":
|
|
36134
|
-
addFormat(res, "date-time", check.message, refs);
|
|
36135
|
-
break;
|
|
36136
|
-
case "date":
|
|
36137
|
-
addFormat(res, "date", check.message, refs);
|
|
36138
|
-
break;
|
|
36139
|
-
case "time":
|
|
36140
|
-
addFormat(res, "time", check.message, refs);
|
|
36141
|
-
break;
|
|
36142
|
-
case "duration":
|
|
36143
|
-
addFormat(res, "duration", check.message, refs);
|
|
36144
|
-
break;
|
|
36145
|
-
case "length":
|
|
36146
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number"
|
|
36147
|
-
? Math.max(res.minLength, check.value)
|
|
36148
|
-
: check.value, check.message, refs);
|
|
36149
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number"
|
|
36150
|
-
? Math.min(res.maxLength, check.value)
|
|
36151
|
-
: check.value, check.message, refs);
|
|
36152
|
-
break;
|
|
36153
|
-
case "includes": {
|
|
36154
|
-
addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
|
|
36155
|
-
break;
|
|
36156
|
-
}
|
|
36157
|
-
case "ip": {
|
|
36158
|
-
if (check.version !== "v6") {
|
|
36159
|
-
addFormat(res, "ipv4", check.message, refs);
|
|
36160
|
-
}
|
|
36161
|
-
if (check.version !== "v4") {
|
|
36162
|
-
addFormat(res, "ipv6", check.message, refs);
|
|
36163
|
-
}
|
|
36164
|
-
break;
|
|
36165
|
-
}
|
|
36166
|
-
case "base64url":
|
|
36167
|
-
addPattern(res, exports.zodPatterns.base64url, check.message, refs);
|
|
36168
|
-
break;
|
|
36169
|
-
case "jwt":
|
|
36170
|
-
addPattern(res, exports.zodPatterns.jwt, check.message, refs);
|
|
36171
|
-
break;
|
|
36172
|
-
case "cidr": {
|
|
36173
|
-
if (check.version !== "v6") {
|
|
36174
|
-
addPattern(res, exports.zodPatterns.ipv4Cidr, check.message, refs);
|
|
36175
|
-
}
|
|
36176
|
-
if (check.version !== "v4") {
|
|
36177
|
-
addPattern(res, exports.zodPatterns.ipv6Cidr, check.message, refs);
|
|
36178
|
-
}
|
|
36179
|
-
break;
|
|
36180
|
-
}
|
|
36181
|
-
case "emoji":
|
|
36182
|
-
addPattern(res, exports.zodPatterns.emoji(), check.message, refs);
|
|
36183
|
-
break;
|
|
36184
|
-
case "ulid": {
|
|
36185
|
-
addPattern(res, exports.zodPatterns.ulid, check.message, refs);
|
|
36186
|
-
break;
|
|
36187
|
-
}
|
|
36188
|
-
case "base64": {
|
|
36189
|
-
switch (refs.base64Strategy) {
|
|
36190
|
-
case "format:binary": {
|
|
36191
|
-
addFormat(res, "binary", check.message, refs);
|
|
36192
|
-
break;
|
|
36193
|
-
}
|
|
36194
|
-
case "contentEncoding:base64": {
|
|
36195
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "contentEncoding", "base64", check.message, refs);
|
|
36196
|
-
break;
|
|
36197
|
-
}
|
|
36198
|
-
case "pattern:zod": {
|
|
36199
|
-
addPattern(res, exports.zodPatterns.base64, check.message, refs);
|
|
36200
|
-
break;
|
|
36201
|
-
}
|
|
36202
|
-
}
|
|
36203
|
-
break;
|
|
36204
|
-
}
|
|
36205
|
-
case "nanoid": {
|
|
36206
|
-
addPattern(res, exports.zodPatterns.nanoid, check.message, refs);
|
|
36207
|
-
}
|
|
36208
|
-
}
|
|
36209
|
-
}
|
|
36210
|
-
}
|
|
36211
|
-
return res;
|
|
36212
|
-
}
|
|
36213
|
-
exports.parseStringDef = parseStringDef;
|
|
36214
|
-
function escapeLiteralCheckValue(literal, refs) {
|
|
36215
|
-
return refs.patternStrategy === "escape"
|
|
36216
|
-
? escapeNonAlphaNumeric(literal)
|
|
36217
|
-
: literal;
|
|
36218
|
-
}
|
|
36219
|
-
const ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
36220
|
-
function escapeNonAlphaNumeric(source) {
|
|
36221
|
-
let result = "";
|
|
36222
|
-
for (let i = 0; i < source.length; i++) {
|
|
36223
|
-
if (!ALPHA_NUMERIC.has(source[i])) {
|
|
36224
|
-
result += "\\";
|
|
36225
|
-
}
|
|
36226
|
-
result += source[i];
|
|
36227
|
-
}
|
|
36228
|
-
return result;
|
|
36229
|
-
}
|
|
36230
|
-
// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.
|
|
36231
|
-
function addFormat(schema, value, message, refs) {
|
|
36232
|
-
if (schema.format || schema.anyOf?.some((x) => x.format)) {
|
|
36233
|
-
if (!schema.anyOf) {
|
|
36234
|
-
schema.anyOf = [];
|
|
36235
|
-
}
|
|
36236
|
-
if (schema.format) {
|
|
36237
|
-
schema.anyOf.push({
|
|
36238
|
-
format: schema.format,
|
|
36239
|
-
...(schema.errorMessage &&
|
|
36240
|
-
refs.errorMessages && {
|
|
36241
|
-
errorMessage: { format: schema.errorMessage.format },
|
|
36242
|
-
}),
|
|
36243
|
-
});
|
|
36244
|
-
delete schema.format;
|
|
36245
|
-
if (schema.errorMessage) {
|
|
36246
|
-
delete schema.errorMessage.format;
|
|
36247
|
-
if (Object.keys(schema.errorMessage).length === 0) {
|
|
36248
|
-
delete schema.errorMessage;
|
|
36249
|
-
}
|
|
36250
|
-
}
|
|
36251
|
-
}
|
|
36252
|
-
schema.anyOf.push({
|
|
36253
|
-
format: value,
|
|
36254
|
-
...(message &&
|
|
36255
|
-
refs.errorMessages && { errorMessage: { format: message } }),
|
|
36256
|
-
});
|
|
36257
|
-
}
|
|
36258
|
-
else {
|
|
36259
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "format", value, message, refs);
|
|
36260
|
-
}
|
|
36261
|
-
}
|
|
36262
|
-
// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.
|
|
36263
|
-
function addPattern(schema, regex, message, refs) {
|
|
36264
|
-
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
36265
|
-
if (!schema.allOf) {
|
|
36266
|
-
schema.allOf = [];
|
|
36267
|
-
}
|
|
36268
|
-
if (schema.pattern) {
|
|
36269
|
-
schema.allOf.push({
|
|
36270
|
-
pattern: schema.pattern,
|
|
36271
|
-
...(schema.errorMessage &&
|
|
36272
|
-
refs.errorMessages && {
|
|
36273
|
-
errorMessage: { pattern: schema.errorMessage.pattern },
|
|
36274
|
-
}),
|
|
36275
|
-
});
|
|
36276
|
-
delete schema.pattern;
|
|
36277
|
-
if (schema.errorMessage) {
|
|
36278
|
-
delete schema.errorMessage.pattern;
|
|
36279
|
-
if (Object.keys(schema.errorMessage).length === 0) {
|
|
36280
|
-
delete schema.errorMessage;
|
|
36281
|
-
}
|
|
36282
|
-
}
|
|
36283
|
-
}
|
|
36284
|
-
schema.allOf.push({
|
|
36285
|
-
pattern: stringifyRegExpWithFlags(regex, refs),
|
|
36286
|
-
...(message &&
|
|
36287
|
-
refs.errorMessages && { errorMessage: { pattern: message } }),
|
|
36288
|
-
});
|
|
36289
|
-
}
|
|
36290
|
-
else {
|
|
36291
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
36292
|
-
}
|
|
36293
|
-
}
|
|
36294
|
-
// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true
|
|
36295
|
-
function stringifyRegExpWithFlags(regex, refs) {
|
|
36296
|
-
if (!refs.applyRegexFlags || !regex.flags) {
|
|
36297
|
-
return regex.source;
|
|
36298
|
-
}
|
|
36299
|
-
// Currently handled flags
|
|
36300
|
-
const flags = {
|
|
36301
|
-
i: regex.flags.includes("i"),
|
|
36302
|
-
m: regex.flags.includes("m"),
|
|
36303
|
-
s: regex.flags.includes("s"), // `.` matches newlines
|
|
36304
|
-
};
|
|
36305
|
-
// The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!
|
|
36306
|
-
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
36307
|
-
let pattern = "";
|
|
36308
|
-
let isEscaped = false;
|
|
36309
|
-
let inCharGroup = false;
|
|
36310
|
-
let inCharRange = false;
|
|
36311
|
-
for (let i = 0; i < source.length; i++) {
|
|
36312
|
-
if (isEscaped) {
|
|
36313
|
-
pattern += source[i];
|
|
36314
|
-
isEscaped = false;
|
|
36315
|
-
continue;
|
|
36316
|
-
}
|
|
36317
|
-
if (flags.i) {
|
|
36318
|
-
if (inCharGroup) {
|
|
36319
|
-
if (source[i].match(/[a-z]/)) {
|
|
36320
|
-
if (inCharRange) {
|
|
36321
|
-
pattern += source[i];
|
|
36322
|
-
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
36323
|
-
inCharRange = false;
|
|
36324
|
-
}
|
|
36325
|
-
else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
|
|
36326
|
-
pattern += source[i];
|
|
36327
|
-
inCharRange = true;
|
|
36328
|
-
}
|
|
36329
|
-
else {
|
|
36330
|
-
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
36331
|
-
}
|
|
36332
|
-
continue;
|
|
36333
|
-
}
|
|
36334
|
-
}
|
|
36335
|
-
else if (source[i].match(/[a-z]/)) {
|
|
36336
|
-
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
36337
|
-
continue;
|
|
36338
|
-
}
|
|
36339
|
-
}
|
|
36340
|
-
if (flags.m) {
|
|
36341
|
-
if (source[i] === "^") {
|
|
36342
|
-
pattern += `(^|(?<=[\r\n]))`;
|
|
36343
|
-
continue;
|
|
36344
|
-
}
|
|
36345
|
-
else if (source[i] === "$") {
|
|
36346
|
-
pattern += `($|(?=[\r\n]))`;
|
|
36347
|
-
continue;
|
|
36348
|
-
}
|
|
36349
|
-
}
|
|
36350
|
-
if (flags.s && source[i] === ".") {
|
|
36351
|
-
pattern += inCharGroup ? `${source[i]}\r\n` : `[${source[i]}\r\n]`;
|
|
36352
|
-
continue;
|
|
36353
|
-
}
|
|
36354
|
-
pattern += source[i];
|
|
36355
|
-
if (source[i] === "\\") {
|
|
36356
|
-
isEscaped = true;
|
|
36357
|
-
}
|
|
36358
|
-
else if (inCharGroup && source[i] === "]") {
|
|
36359
|
-
inCharGroup = false;
|
|
36360
|
-
}
|
|
36361
|
-
else if (!inCharGroup && source[i] === "[") {
|
|
36362
|
-
inCharGroup = true;
|
|
36363
|
-
}
|
|
36364
|
-
}
|
|
36365
|
-
try {
|
|
36366
|
-
new RegExp(pattern);
|
|
36367
|
-
}
|
|
36368
|
-
catch {
|
|
36369
|
-
console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
|
|
36370
|
-
return regex.source;
|
|
36371
|
-
}
|
|
36372
|
-
return pattern;
|
|
36373
|
-
}
|
|
36374
|
-
} (string));
|
|
36375
|
-
|
|
36376
|
-
var hasRequiredRecord;
|
|
36377
|
-
|
|
36378
|
-
function requireRecord () {
|
|
36379
|
-
if (hasRequiredRecord) return record;
|
|
36380
|
-
hasRequiredRecord = 1;
|
|
36381
|
-
Object.defineProperty(record, "__esModule", { value: true });
|
|
36382
|
-
record.parseRecordDef = void 0;
|
|
36383
|
-
const v3_1 = v3;
|
|
36384
|
-
const parseDef_js_1 = requireParseDef();
|
|
36385
|
-
const string_js_1 = string;
|
|
36386
|
-
const branded_js_1 = requireBranded();
|
|
36387
|
-
const any_js_1 = any;
|
|
36388
|
-
function parseRecordDef(def, refs) {
|
|
36389
|
-
if (refs.target === "openAi") {
|
|
36390
|
-
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
36391
|
-
}
|
|
36392
|
-
if (refs.target === "openApi3" &&
|
|
36393
|
-
def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodEnum) {
|
|
36394
|
-
return {
|
|
36395
|
-
type: "object",
|
|
36396
|
-
required: def.keyType._def.values,
|
|
36397
|
-
properties: def.keyType._def.values.reduce((acc, key) => ({
|
|
36398
|
-
...acc,
|
|
36399
|
-
[key]: (0, parseDef_js_1.parseDef)(def.valueType._def, {
|
|
36400
|
-
...refs,
|
|
36401
|
-
currentPath: [...refs.currentPath, "properties", key],
|
|
36402
|
-
}) ?? (0, any_js_1.parseAnyDef)(refs),
|
|
36403
|
-
}), {}),
|
|
36404
|
-
additionalProperties: refs.rejectedAdditionalProperties,
|
|
36405
|
-
};
|
|
36406
|
-
}
|
|
36407
|
-
const schema = {
|
|
36408
|
-
type: "object",
|
|
36409
|
-
additionalProperties: (0, parseDef_js_1.parseDef)(def.valueType._def, {
|
|
36410
|
-
...refs,
|
|
36411
|
-
currentPath: [...refs.currentPath, "additionalProperties"],
|
|
36412
|
-
}) ?? refs.allowedAdditionalProperties,
|
|
36413
|
-
};
|
|
36414
|
-
if (refs.target === "openApi3") {
|
|
36415
|
-
return schema;
|
|
36416
|
-
}
|
|
36417
|
-
if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodString &&
|
|
36418
|
-
def.keyType._def.checks?.length) {
|
|
36419
|
-
const { type, ...keyType } = (0, string_js_1.parseStringDef)(def.keyType._def, refs);
|
|
36420
|
-
return {
|
|
36421
|
-
...schema,
|
|
36422
|
-
propertyNames: keyType,
|
|
36423
|
-
};
|
|
36424
|
-
}
|
|
36425
|
-
else if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodEnum) {
|
|
36426
|
-
return {
|
|
36427
|
-
...schema,
|
|
36428
|
-
propertyNames: {
|
|
36429
|
-
enum: def.keyType._def.values,
|
|
36430
|
-
},
|
|
36431
|
-
};
|
|
36432
|
-
}
|
|
36433
|
-
else if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodBranded &&
|
|
36434
|
-
def.keyType._def.type._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodString &&
|
|
36435
|
-
def.keyType._def.type._def.checks?.length) {
|
|
36436
|
-
const { type, ...keyType } = (0, branded_js_1.parseBrandedDef)(def.keyType._def, refs);
|
|
36437
|
-
return {
|
|
36438
|
-
...schema,
|
|
36439
|
-
propertyNames: keyType,
|
|
36440
|
-
};
|
|
36441
|
-
}
|
|
36442
|
-
return schema;
|
|
36443
|
-
}
|
|
36444
|
-
record.parseRecordDef = parseRecordDef;
|
|
36445
|
-
return record;
|
|
36446
|
-
}
|
|
36447
|
-
|
|
36448
|
-
var hasRequiredMap;
|
|
36449
|
-
|
|
36450
|
-
function requireMap () {
|
|
36451
|
-
if (hasRequiredMap) return map;
|
|
36452
|
-
hasRequiredMap = 1;
|
|
36453
|
-
Object.defineProperty(map, "__esModule", { value: true });
|
|
36454
|
-
map.parseMapDef = void 0;
|
|
36455
|
-
const parseDef_js_1 = requireParseDef();
|
|
36456
|
-
const record_js_1 = requireRecord();
|
|
36457
|
-
const any_js_1 = any;
|
|
36458
|
-
function parseMapDef(def, refs) {
|
|
36459
|
-
if (refs.mapStrategy === "record") {
|
|
36460
|
-
return (0, record_js_1.parseRecordDef)(def, refs);
|
|
36461
|
-
}
|
|
36462
|
-
const keys = (0, parseDef_js_1.parseDef)(def.keyType._def, {
|
|
36463
|
-
...refs,
|
|
36464
|
-
currentPath: [...refs.currentPath, "items", "items", "0"],
|
|
36465
|
-
}) || (0, any_js_1.parseAnyDef)(refs);
|
|
36466
|
-
const values = (0, parseDef_js_1.parseDef)(def.valueType._def, {
|
|
36467
|
-
...refs,
|
|
36468
|
-
currentPath: [...refs.currentPath, "items", "items", "1"],
|
|
36469
|
-
}) || (0, any_js_1.parseAnyDef)(refs);
|
|
36470
|
-
return {
|
|
36471
|
-
type: "array",
|
|
36472
|
-
maxItems: 125,
|
|
36473
|
-
items: {
|
|
36474
|
-
type: "array",
|
|
36475
|
-
items: [keys, values],
|
|
36476
|
-
minItems: 2,
|
|
36477
|
-
maxItems: 2,
|
|
36478
|
-
},
|
|
36479
|
-
};
|
|
36480
|
-
}
|
|
36481
|
-
map.parseMapDef = parseMapDef;
|
|
36482
|
-
return map;
|
|
36483
|
-
}
|
|
36484
|
-
|
|
36485
|
-
var nativeEnum = {};
|
|
36486
|
-
|
|
36487
|
-
Object.defineProperty(nativeEnum, "__esModule", { value: true });
|
|
36488
|
-
nativeEnum.parseNativeEnumDef = void 0;
|
|
36489
|
-
function parseNativeEnumDef(def) {
|
|
36490
|
-
const object = def.values;
|
|
36491
|
-
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
36492
|
-
return typeof object[object[key]] !== "number";
|
|
36493
|
-
});
|
|
36494
|
-
const actualValues = actualKeys.map((key) => object[key]);
|
|
36495
|
-
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
36496
|
-
return {
|
|
36497
|
-
type: parsedTypes.length === 1
|
|
36498
|
-
? parsedTypes[0] === "string"
|
|
36499
|
-
? "string"
|
|
36500
|
-
: "number"
|
|
36501
|
-
: ["string", "number"],
|
|
36502
|
-
enum: actualValues,
|
|
36503
|
-
};
|
|
36504
|
-
}
|
|
36505
|
-
nativeEnum.parseNativeEnumDef = parseNativeEnumDef;
|
|
36506
|
-
|
|
36507
|
-
var never = {};
|
|
36508
|
-
|
|
36509
|
-
Object.defineProperty(never, "__esModule", { value: true });
|
|
36510
|
-
never.parseNeverDef = void 0;
|
|
36511
|
-
const any_js_1$3 = any;
|
|
36512
|
-
function parseNeverDef(refs) {
|
|
36513
|
-
return refs.target === "openAi"
|
|
36514
|
-
? undefined
|
|
36515
|
-
: {
|
|
36516
|
-
not: (0, any_js_1$3.parseAnyDef)({
|
|
36517
|
-
...refs,
|
|
36518
|
-
currentPath: [...refs.currentPath, "not"],
|
|
36519
|
-
}),
|
|
36520
|
-
};
|
|
36521
|
-
}
|
|
36522
|
-
never.parseNeverDef = parseNeverDef;
|
|
36523
|
-
|
|
36524
|
-
var _null = {};
|
|
36525
|
-
|
|
36526
|
-
Object.defineProperty(_null, "__esModule", { value: true });
|
|
36527
|
-
_null.parseNullDef = void 0;
|
|
36528
|
-
function parseNullDef(refs) {
|
|
36529
|
-
return refs.target === "openApi3"
|
|
36530
|
-
? {
|
|
36531
|
-
enum: ["null"],
|
|
36532
|
-
nullable: true,
|
|
36533
|
-
}
|
|
36534
|
-
: {
|
|
36535
|
-
type: "null",
|
|
36536
|
-
};
|
|
36537
|
-
}
|
|
36538
|
-
_null.parseNullDef = parseNullDef;
|
|
36539
|
-
|
|
36540
|
-
var nullable = {};
|
|
36541
|
-
|
|
36542
|
-
var union = {};
|
|
36543
|
-
|
|
36544
|
-
var hasRequiredUnion;
|
|
36545
|
-
|
|
36546
|
-
function requireUnion () {
|
|
36547
|
-
if (hasRequiredUnion) return union;
|
|
36548
|
-
hasRequiredUnion = 1;
|
|
36549
|
-
(function (exports) {
|
|
36550
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36551
|
-
exports.parseUnionDef = exports.primitiveMappings = void 0;
|
|
36552
|
-
const parseDef_js_1 = requireParseDef();
|
|
36553
|
-
exports.primitiveMappings = {
|
|
36554
|
-
ZodString: "string",
|
|
36555
|
-
ZodNumber: "number",
|
|
36556
|
-
ZodBigInt: "integer",
|
|
36557
|
-
ZodBoolean: "boolean",
|
|
36558
|
-
ZodNull: "null",
|
|
36559
|
-
};
|
|
36560
|
-
function parseUnionDef(def, refs) {
|
|
36561
|
-
if (refs.target === "openApi3")
|
|
36562
|
-
return asAnyOf(def, refs);
|
|
36563
|
-
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
36564
|
-
// This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.
|
|
36565
|
-
if (options.every((x) => x._def.typeName in exports.primitiveMappings &&
|
|
36566
|
-
(!x._def.checks || !x._def.checks.length))) {
|
|
36567
|
-
// all types in union are primitive and lack checks, so might as well squash into {type: [...]}
|
|
36568
|
-
const types = options.reduce((types, x) => {
|
|
36569
|
-
const type = exports.primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43
|
|
36570
|
-
return type && !types.includes(type) ? [...types, type] : types;
|
|
36571
|
-
}, []);
|
|
36572
|
-
return {
|
|
36573
|
-
type: types.length > 1 ? types : types[0],
|
|
36574
|
-
};
|
|
36575
|
-
}
|
|
36576
|
-
else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
36577
|
-
// all options literals
|
|
36578
|
-
const types = options.reduce((acc, x) => {
|
|
36579
|
-
const type = typeof x._def.value;
|
|
36580
|
-
switch (type) {
|
|
36581
|
-
case "string":
|
|
36582
|
-
case "number":
|
|
36583
|
-
case "boolean":
|
|
36584
|
-
return [...acc, type];
|
|
36585
|
-
case "bigint":
|
|
36586
|
-
return [...acc, "integer"];
|
|
36587
|
-
case "object":
|
|
36588
|
-
if (x._def.value === null)
|
|
36589
|
-
return [...acc, "null"];
|
|
36590
|
-
case "symbol":
|
|
36591
|
-
case "undefined":
|
|
36592
|
-
case "function":
|
|
36593
|
-
default:
|
|
36594
|
-
return acc;
|
|
36595
|
-
}
|
|
36596
|
-
}, []);
|
|
36597
|
-
if (types.length === options.length) {
|
|
36598
|
-
// all the literals are primitive, as far as null can be considered primitive
|
|
36599
|
-
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
36600
|
-
return {
|
|
36601
|
-
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
36602
|
-
enum: options.reduce((acc, x) => {
|
|
36603
|
-
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
36604
|
-
}, []),
|
|
36605
|
-
};
|
|
36606
|
-
}
|
|
36607
|
-
}
|
|
36608
|
-
else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
36609
|
-
return {
|
|
36610
|
-
type: "string",
|
|
36611
|
-
enum: options.reduce((acc, x) => [
|
|
36612
|
-
...acc,
|
|
36613
|
-
...x._def.values.filter((x) => !acc.includes(x)),
|
|
36614
|
-
], []),
|
|
36615
|
-
};
|
|
36616
|
-
}
|
|
36617
|
-
return asAnyOf(def, refs);
|
|
36618
|
-
}
|
|
36619
|
-
exports.parseUnionDef = parseUnionDef;
|
|
36620
|
-
const asAnyOf = (def, refs) => {
|
|
36621
|
-
const anyOf = (def.options instanceof Map
|
|
36622
|
-
? Array.from(def.options.values())
|
|
36623
|
-
: def.options)
|
|
36624
|
-
.map((x, i) => (0, parseDef_js_1.parseDef)(x._def, {
|
|
36625
|
-
...refs,
|
|
36626
|
-
currentPath: [...refs.currentPath, "anyOf", `${i}`],
|
|
36627
|
-
}))
|
|
36628
|
-
.filter((x) => !!x &&
|
|
36629
|
-
(!refs.strictUnions ||
|
|
36630
|
-
(typeof x === "object" && Object.keys(x).length > 0)));
|
|
36631
|
-
return anyOf.length ? { anyOf } : undefined;
|
|
36632
|
-
};
|
|
36633
|
-
} (union));
|
|
36634
|
-
return union;
|
|
36635
|
-
}
|
|
36636
|
-
|
|
36637
|
-
var hasRequiredNullable;
|
|
36638
|
-
|
|
36639
|
-
function requireNullable () {
|
|
36640
|
-
if (hasRequiredNullable) return nullable;
|
|
36641
|
-
hasRequiredNullable = 1;
|
|
36642
|
-
Object.defineProperty(nullable, "__esModule", { value: true });
|
|
36643
|
-
nullable.parseNullableDef = void 0;
|
|
36644
|
-
const parseDef_js_1 = requireParseDef();
|
|
36645
|
-
const union_js_1 = requireUnion();
|
|
36646
|
-
function parseNullableDef(def, refs) {
|
|
36647
|
-
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) &&
|
|
36648
|
-
(!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
36649
|
-
if (refs.target === "openApi3") {
|
|
36650
|
-
return {
|
|
36651
|
-
type: union_js_1.primitiveMappings[def.innerType._def.typeName],
|
|
36652
|
-
nullable: true,
|
|
36653
|
-
};
|
|
36654
|
-
}
|
|
36655
|
-
return {
|
|
36656
|
-
type: [
|
|
36657
|
-
union_js_1.primitiveMappings[def.innerType._def.typeName],
|
|
36658
|
-
"null",
|
|
36659
|
-
],
|
|
36660
|
-
};
|
|
36661
|
-
}
|
|
36662
|
-
if (refs.target === "openApi3") {
|
|
36663
|
-
const base = (0, parseDef_js_1.parseDef)(def.innerType._def, {
|
|
36664
|
-
...refs,
|
|
36665
|
-
currentPath: [...refs.currentPath],
|
|
36666
|
-
});
|
|
36667
|
-
if (base && "$ref" in base)
|
|
36668
|
-
return { allOf: [base], nullable: true };
|
|
36669
|
-
return base && { ...base, nullable: true };
|
|
36670
|
-
}
|
|
36671
|
-
const base = (0, parseDef_js_1.parseDef)(def.innerType._def, {
|
|
36672
|
-
...refs,
|
|
36673
|
-
currentPath: [...refs.currentPath, "anyOf", "0"],
|
|
36674
|
-
});
|
|
36675
|
-
return base && { anyOf: [base, { type: "null" }] };
|
|
36676
|
-
}
|
|
36677
|
-
nullable.parseNullableDef = parseNullableDef;
|
|
36678
|
-
return nullable;
|
|
36679
|
-
}
|
|
36680
|
-
|
|
36681
|
-
var number = {};
|
|
36682
|
-
|
|
36683
|
-
Object.defineProperty(number, "__esModule", { value: true });
|
|
36684
|
-
number.parseNumberDef = void 0;
|
|
36685
|
-
const errorMessages_js_1 = errorMessages;
|
|
36686
|
-
function parseNumberDef(def, refs) {
|
|
36687
|
-
const res = {
|
|
36688
|
-
type: "number",
|
|
36689
|
-
};
|
|
36690
|
-
if (!def.checks)
|
|
36691
|
-
return res;
|
|
36692
|
-
for (const check of def.checks) {
|
|
36693
|
-
switch (check.kind) {
|
|
36694
|
-
case "int":
|
|
36695
|
-
res.type = "integer";
|
|
36696
|
-
(0, errorMessages_js_1.addErrorMessage)(res, "type", check.message, refs);
|
|
36697
|
-
break;
|
|
36698
|
-
case "min":
|
|
36699
|
-
if (refs.target === "jsonSchema7") {
|
|
36700
|
-
if (check.inclusive) {
|
|
36701
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
|
|
36702
|
-
}
|
|
36703
|
-
else {
|
|
36704
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
36705
|
-
}
|
|
36706
|
-
}
|
|
36707
|
-
else {
|
|
36708
|
-
if (!check.inclusive) {
|
|
36709
|
-
res.exclusiveMinimum = true;
|
|
36710
|
-
}
|
|
36711
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
|
|
36712
|
-
}
|
|
36713
|
-
break;
|
|
36714
|
-
case "max":
|
|
36715
|
-
if (refs.target === "jsonSchema7") {
|
|
36716
|
-
if (check.inclusive) {
|
|
36717
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
|
|
36718
|
-
}
|
|
36719
|
-
else {
|
|
36720
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
36721
|
-
}
|
|
36722
|
-
}
|
|
36723
|
-
else {
|
|
36724
|
-
if (!check.inclusive) {
|
|
36725
|
-
res.exclusiveMaximum = true;
|
|
36726
|
-
}
|
|
36727
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
|
|
36728
|
-
}
|
|
36729
|
-
break;
|
|
36730
|
-
case "multipleOf":
|
|
36731
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "multipleOf", check.value, check.message, refs);
|
|
36732
|
-
break;
|
|
36733
|
-
}
|
|
36734
|
-
}
|
|
36735
|
-
return res;
|
|
36736
|
-
}
|
|
36737
|
-
number.parseNumberDef = parseNumberDef;
|
|
36738
|
-
|
|
36739
|
-
var object = {};
|
|
36740
|
-
|
|
36741
|
-
var hasRequiredObject;
|
|
36742
|
-
|
|
36743
|
-
function requireObject () {
|
|
36744
|
-
if (hasRequiredObject) return object;
|
|
36745
|
-
hasRequiredObject = 1;
|
|
36746
|
-
Object.defineProperty(object, "__esModule", { value: true });
|
|
36747
|
-
object.parseObjectDef = void 0;
|
|
36748
|
-
const parseDef_js_1 = requireParseDef();
|
|
36749
|
-
function parseObjectDef(def, refs) {
|
|
36750
|
-
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
36751
|
-
const result = {
|
|
36752
|
-
type: "object",
|
|
36753
|
-
properties: {},
|
|
36754
|
-
};
|
|
36755
|
-
const required = [];
|
|
36756
|
-
const shape = def.shape();
|
|
36757
|
-
for (const propName in shape) {
|
|
36758
|
-
let propDef = shape[propName];
|
|
36759
|
-
if (propDef === undefined || propDef._def === undefined) {
|
|
36760
|
-
continue;
|
|
36761
|
-
}
|
|
36762
|
-
let propOptional = safeIsOptional(propDef);
|
|
36763
|
-
if (propOptional && forceOptionalIntoNullable) {
|
|
36764
|
-
if (propDef._def.typeName === "ZodOptional") {
|
|
36765
|
-
propDef = propDef._def.innerType;
|
|
36766
|
-
}
|
|
36767
|
-
if (!propDef.isNullable()) {
|
|
36768
|
-
propDef = propDef.nullable();
|
|
36769
|
-
}
|
|
36770
|
-
propOptional = false;
|
|
36771
|
-
}
|
|
36772
|
-
const parsedDef = (0, parseDef_js_1.parseDef)(propDef._def, {
|
|
36773
|
-
...refs,
|
|
36774
|
-
currentPath: [...refs.currentPath, "properties", propName],
|
|
36775
|
-
propertyPath: [...refs.currentPath, "properties", propName],
|
|
36776
|
-
});
|
|
36777
|
-
if (parsedDef === undefined) {
|
|
36778
|
-
continue;
|
|
36779
|
-
}
|
|
36780
|
-
result.properties[propName] = parsedDef;
|
|
36781
|
-
if (!propOptional) {
|
|
36782
|
-
required.push(propName);
|
|
36783
|
-
}
|
|
36784
|
-
}
|
|
36785
|
-
if (required.length) {
|
|
36786
|
-
result.required = required;
|
|
36787
|
-
}
|
|
36788
|
-
const additionalProperties = decideAdditionalProperties(def, refs);
|
|
36789
|
-
if (additionalProperties !== undefined) {
|
|
36790
|
-
result.additionalProperties = additionalProperties;
|
|
36791
|
-
}
|
|
36792
|
-
return result;
|
|
36793
|
-
}
|
|
36794
|
-
object.parseObjectDef = parseObjectDef;
|
|
36795
|
-
function decideAdditionalProperties(def, refs) {
|
|
36796
|
-
if (def.catchall._def.typeName !== "ZodNever") {
|
|
36797
|
-
return (0, parseDef_js_1.parseDef)(def.catchall._def, {
|
|
36798
|
-
...refs,
|
|
36799
|
-
currentPath: [...refs.currentPath, "additionalProperties"],
|
|
36800
|
-
});
|
|
36801
|
-
}
|
|
36802
|
-
switch (def.unknownKeys) {
|
|
36803
|
-
case "passthrough":
|
|
36804
|
-
return refs.allowedAdditionalProperties;
|
|
36805
|
-
case "strict":
|
|
36806
|
-
return refs.rejectedAdditionalProperties;
|
|
36807
|
-
case "strip":
|
|
36808
|
-
return refs.removeAdditionalStrategy === "strict"
|
|
36809
|
-
? refs.allowedAdditionalProperties
|
|
36810
|
-
: refs.rejectedAdditionalProperties;
|
|
36811
|
-
}
|
|
36812
|
-
}
|
|
36813
|
-
function safeIsOptional(schema) {
|
|
36814
|
-
try {
|
|
36815
|
-
return schema.isOptional();
|
|
36816
|
-
}
|
|
36817
|
-
catch {
|
|
36818
|
-
return true;
|
|
36819
|
-
}
|
|
36820
|
-
}
|
|
36821
|
-
return object;
|
|
36822
|
-
}
|
|
36823
|
-
|
|
36824
|
-
var optional = {};
|
|
36825
|
-
|
|
36826
|
-
var hasRequiredOptional;
|
|
36827
|
-
|
|
36828
|
-
function requireOptional () {
|
|
36829
|
-
if (hasRequiredOptional) return optional;
|
|
36830
|
-
hasRequiredOptional = 1;
|
|
36831
|
-
Object.defineProperty(optional, "__esModule", { value: true });
|
|
36832
|
-
optional.parseOptionalDef = void 0;
|
|
36833
|
-
const parseDef_js_1 = requireParseDef();
|
|
36834
|
-
const any_js_1 = any;
|
|
36835
|
-
const parseOptionalDef = (def, refs) => {
|
|
36836
|
-
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
36837
|
-
return (0, parseDef_js_1.parseDef)(def.innerType._def, refs);
|
|
36838
|
-
}
|
|
36839
|
-
const innerSchema = (0, parseDef_js_1.parseDef)(def.innerType._def, {
|
|
36840
|
-
...refs,
|
|
36841
|
-
currentPath: [...refs.currentPath, "anyOf", "1"],
|
|
36842
|
-
});
|
|
36843
|
-
return innerSchema
|
|
36844
|
-
? {
|
|
36845
|
-
anyOf: [
|
|
36846
|
-
{
|
|
36847
|
-
not: (0, any_js_1.parseAnyDef)(refs),
|
|
36848
|
-
},
|
|
36849
|
-
innerSchema,
|
|
36850
|
-
],
|
|
36851
|
-
}
|
|
36852
|
-
: (0, any_js_1.parseAnyDef)(refs);
|
|
36853
|
-
};
|
|
36854
|
-
optional.parseOptionalDef = parseOptionalDef;
|
|
36855
|
-
return optional;
|
|
36856
|
-
}
|
|
36857
|
-
|
|
36858
|
-
var pipeline = {};
|
|
36859
|
-
|
|
36860
|
-
var hasRequiredPipeline;
|
|
36861
|
-
|
|
36862
|
-
function requirePipeline () {
|
|
36863
|
-
if (hasRequiredPipeline) return pipeline;
|
|
36864
|
-
hasRequiredPipeline = 1;
|
|
36865
|
-
Object.defineProperty(pipeline, "__esModule", { value: true });
|
|
36866
|
-
pipeline.parsePipelineDef = void 0;
|
|
36867
|
-
const parseDef_js_1 = requireParseDef();
|
|
36868
|
-
const parsePipelineDef = (def, refs) => {
|
|
36869
|
-
if (refs.pipeStrategy === "input") {
|
|
36870
|
-
return (0, parseDef_js_1.parseDef)(def.in._def, refs);
|
|
36871
|
-
}
|
|
36872
|
-
else if (refs.pipeStrategy === "output") {
|
|
36873
|
-
return (0, parseDef_js_1.parseDef)(def.out._def, refs);
|
|
36874
|
-
}
|
|
36875
|
-
const a = (0, parseDef_js_1.parseDef)(def.in._def, {
|
|
36876
|
-
...refs,
|
|
36877
|
-
currentPath: [...refs.currentPath, "allOf", "0"],
|
|
36878
|
-
});
|
|
36879
|
-
const b = (0, parseDef_js_1.parseDef)(def.out._def, {
|
|
36880
|
-
...refs,
|
|
36881
|
-
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"],
|
|
36882
|
-
});
|
|
36883
|
-
return {
|
|
36884
|
-
allOf: [a, b].filter((x) => x !== undefined),
|
|
36885
|
-
};
|
|
36886
|
-
};
|
|
36887
|
-
pipeline.parsePipelineDef = parsePipelineDef;
|
|
36888
|
-
return pipeline;
|
|
36889
|
-
}
|
|
36890
|
-
|
|
36891
|
-
var promise = {};
|
|
36892
|
-
|
|
36893
|
-
var hasRequiredPromise;
|
|
36894
|
-
|
|
36895
|
-
function requirePromise () {
|
|
36896
|
-
if (hasRequiredPromise) return promise;
|
|
36897
|
-
hasRequiredPromise = 1;
|
|
36898
|
-
Object.defineProperty(promise, "__esModule", { value: true });
|
|
36899
|
-
promise.parsePromiseDef = void 0;
|
|
36900
|
-
const parseDef_js_1 = requireParseDef();
|
|
36901
|
-
function parsePromiseDef(def, refs) {
|
|
36902
|
-
return (0, parseDef_js_1.parseDef)(def.type._def, refs);
|
|
36903
|
-
}
|
|
36904
|
-
promise.parsePromiseDef = parsePromiseDef;
|
|
36905
|
-
return promise;
|
|
36906
|
-
}
|
|
36907
|
-
|
|
36908
|
-
var set = {};
|
|
36909
|
-
|
|
36910
|
-
var hasRequiredSet;
|
|
36911
|
-
|
|
36912
|
-
function requireSet () {
|
|
36913
|
-
if (hasRequiredSet) return set;
|
|
36914
|
-
hasRequiredSet = 1;
|
|
36915
|
-
Object.defineProperty(set, "__esModule", { value: true });
|
|
36916
|
-
set.parseSetDef = void 0;
|
|
36917
|
-
const errorMessages_js_1 = errorMessages;
|
|
36918
|
-
const parseDef_js_1 = requireParseDef();
|
|
36919
|
-
function parseSetDef(def, refs) {
|
|
36920
|
-
const items = (0, parseDef_js_1.parseDef)(def.valueType._def, {
|
|
36921
|
-
...refs,
|
|
36922
|
-
currentPath: [...refs.currentPath, "items"],
|
|
36923
|
-
});
|
|
36924
|
-
const schema = {
|
|
36925
|
-
type: "array",
|
|
36926
|
-
uniqueItems: true,
|
|
36927
|
-
items,
|
|
36928
|
-
};
|
|
36929
|
-
if (def.minSize) {
|
|
36930
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
36931
|
-
}
|
|
36932
|
-
if (def.maxSize) {
|
|
36933
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
36934
|
-
}
|
|
36935
|
-
return schema;
|
|
36936
|
-
}
|
|
36937
|
-
set.parseSetDef = parseSetDef;
|
|
36938
|
-
return set;
|
|
36939
|
-
}
|
|
36940
|
-
|
|
36941
|
-
var tuple = {};
|
|
36942
|
-
|
|
36943
|
-
var hasRequiredTuple;
|
|
36944
|
-
|
|
36945
|
-
function requireTuple () {
|
|
36946
|
-
if (hasRequiredTuple) return tuple;
|
|
36947
|
-
hasRequiredTuple = 1;
|
|
36948
|
-
Object.defineProperty(tuple, "__esModule", { value: true });
|
|
36949
|
-
tuple.parseTupleDef = void 0;
|
|
36950
|
-
const parseDef_js_1 = requireParseDef();
|
|
36951
|
-
function parseTupleDef(def, refs) {
|
|
36952
|
-
if (def.rest) {
|
|
36953
|
-
return {
|
|
36954
|
-
type: "array",
|
|
36955
|
-
minItems: def.items.length,
|
|
36956
|
-
items: def.items
|
|
36957
|
-
.map((x, i) => (0, parseDef_js_1.parseDef)(x._def, {
|
|
36958
|
-
...refs,
|
|
36959
|
-
currentPath: [...refs.currentPath, "items", `${i}`],
|
|
36960
|
-
}))
|
|
36961
|
-
.reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),
|
|
36962
|
-
additionalItems: (0, parseDef_js_1.parseDef)(def.rest._def, {
|
|
36963
|
-
...refs,
|
|
36964
|
-
currentPath: [...refs.currentPath, "additionalItems"],
|
|
36965
|
-
}),
|
|
36966
|
-
};
|
|
36967
|
-
}
|
|
36968
|
-
else {
|
|
36969
|
-
return {
|
|
36970
|
-
type: "array",
|
|
36971
|
-
minItems: def.items.length,
|
|
36972
|
-
maxItems: def.items.length,
|
|
36973
|
-
items: def.items
|
|
36974
|
-
.map((x, i) => (0, parseDef_js_1.parseDef)(x._def, {
|
|
36975
|
-
...refs,
|
|
36976
|
-
currentPath: [...refs.currentPath, "items", `${i}`],
|
|
36977
|
-
}))
|
|
36978
|
-
.reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),
|
|
36979
|
-
};
|
|
36980
|
-
}
|
|
36981
|
-
}
|
|
36982
|
-
tuple.parseTupleDef = parseTupleDef;
|
|
36983
|
-
return tuple;
|
|
36984
|
-
}
|
|
36985
|
-
|
|
36986
|
-
var _undefined = {};
|
|
36987
|
-
|
|
36988
|
-
Object.defineProperty(_undefined, "__esModule", { value: true });
|
|
36989
|
-
_undefined.parseUndefinedDef = void 0;
|
|
36990
|
-
const any_js_1$2 = any;
|
|
36991
|
-
function parseUndefinedDef(refs) {
|
|
36992
|
-
return {
|
|
36993
|
-
not: (0, any_js_1$2.parseAnyDef)(refs),
|
|
36994
|
-
};
|
|
36995
|
-
}
|
|
36996
|
-
_undefined.parseUndefinedDef = parseUndefinedDef;
|
|
36997
|
-
|
|
36998
|
-
var unknown = {};
|
|
36999
|
-
|
|
37000
|
-
Object.defineProperty(unknown, "__esModule", { value: true });
|
|
37001
|
-
unknown.parseUnknownDef = void 0;
|
|
37002
|
-
const any_js_1$1 = any;
|
|
37003
|
-
function parseUnknownDef(refs) {
|
|
37004
|
-
return (0, any_js_1$1.parseAnyDef)(refs);
|
|
37005
|
-
}
|
|
37006
|
-
unknown.parseUnknownDef = parseUnknownDef;
|
|
37007
|
-
|
|
37008
|
-
var readonly = {};
|
|
37009
|
-
|
|
37010
|
-
var hasRequiredReadonly;
|
|
37011
|
-
|
|
37012
|
-
function requireReadonly () {
|
|
37013
|
-
if (hasRequiredReadonly) return readonly;
|
|
37014
|
-
hasRequiredReadonly = 1;
|
|
37015
|
-
Object.defineProperty(readonly, "__esModule", { value: true });
|
|
37016
|
-
readonly.parseReadonlyDef = void 0;
|
|
37017
|
-
const parseDef_js_1 = requireParseDef();
|
|
37018
|
-
const parseReadonlyDef = (def, refs) => {
|
|
37019
|
-
return (0, parseDef_js_1.parseDef)(def.innerType._def, refs);
|
|
37020
|
-
};
|
|
37021
|
-
readonly.parseReadonlyDef = parseReadonlyDef;
|
|
37022
|
-
return readonly;
|
|
37023
|
-
}
|
|
37024
|
-
|
|
37025
|
-
var hasRequiredSelectParser;
|
|
37026
|
-
|
|
37027
|
-
function requireSelectParser () {
|
|
37028
|
-
if (hasRequiredSelectParser) return selectParser;
|
|
37029
|
-
hasRequiredSelectParser = 1;
|
|
37030
|
-
Object.defineProperty(selectParser, "__esModule", { value: true });
|
|
37031
|
-
selectParser.selectParser = void 0;
|
|
37032
|
-
const v3_1 = v3;
|
|
37033
|
-
const any_js_1 = any;
|
|
37034
|
-
const array_js_1 = requireArray();
|
|
37035
|
-
const bigint_js_1 = bigint;
|
|
37036
|
-
const boolean_js_1 = boolean;
|
|
37037
|
-
const branded_js_1 = requireBranded();
|
|
37038
|
-
const catch_js_1 = require_catch();
|
|
37039
|
-
const date_js_1 = date;
|
|
37040
|
-
const default_js_1 = require_default();
|
|
37041
|
-
const effects_js_1 = requireEffects();
|
|
37042
|
-
const enum_js_1 = _enum$1;
|
|
37043
|
-
const intersection_js_1 = requireIntersection();
|
|
37044
|
-
const literal_js_1 = literal;
|
|
37045
|
-
const map_js_1 = requireMap();
|
|
37046
|
-
const nativeEnum_js_1 = nativeEnum;
|
|
37047
|
-
const never_js_1 = never;
|
|
37048
|
-
const null_js_1 = _null;
|
|
37049
|
-
const nullable_js_1 = requireNullable();
|
|
37050
|
-
const number_js_1 = number;
|
|
37051
|
-
const object_js_1 = requireObject();
|
|
37052
|
-
const optional_js_1 = requireOptional();
|
|
37053
|
-
const pipeline_js_1 = requirePipeline();
|
|
37054
|
-
const promise_js_1 = requirePromise();
|
|
37055
|
-
const record_js_1 = requireRecord();
|
|
37056
|
-
const set_js_1 = requireSet();
|
|
37057
|
-
const string_js_1 = string;
|
|
37058
|
-
const tuple_js_1 = requireTuple();
|
|
37059
|
-
const undefined_js_1 = _undefined;
|
|
37060
|
-
const union_js_1 = requireUnion();
|
|
37061
|
-
const unknown_js_1 = unknown;
|
|
37062
|
-
const readonly_js_1 = requireReadonly();
|
|
37063
|
-
const selectParser$1 = (def, typeName, refs) => {
|
|
37064
|
-
switch (typeName) {
|
|
37065
|
-
case v3_1.ZodFirstPartyTypeKind.ZodString:
|
|
37066
|
-
return (0, string_js_1.parseStringDef)(def, refs);
|
|
37067
|
-
case v3_1.ZodFirstPartyTypeKind.ZodNumber:
|
|
37068
|
-
return (0, number_js_1.parseNumberDef)(def, refs);
|
|
37069
|
-
case v3_1.ZodFirstPartyTypeKind.ZodObject:
|
|
37070
|
-
return (0, object_js_1.parseObjectDef)(def, refs);
|
|
37071
|
-
case v3_1.ZodFirstPartyTypeKind.ZodBigInt:
|
|
37072
|
-
return (0, bigint_js_1.parseBigintDef)(def, refs);
|
|
37073
|
-
case v3_1.ZodFirstPartyTypeKind.ZodBoolean:
|
|
37074
|
-
return (0, boolean_js_1.parseBooleanDef)();
|
|
37075
|
-
case v3_1.ZodFirstPartyTypeKind.ZodDate:
|
|
37076
|
-
return (0, date_js_1.parseDateDef)(def, refs);
|
|
37077
|
-
case v3_1.ZodFirstPartyTypeKind.ZodUndefined:
|
|
37078
|
-
return (0, undefined_js_1.parseUndefinedDef)(refs);
|
|
37079
|
-
case v3_1.ZodFirstPartyTypeKind.ZodNull:
|
|
37080
|
-
return (0, null_js_1.parseNullDef)(refs);
|
|
37081
|
-
case v3_1.ZodFirstPartyTypeKind.ZodArray:
|
|
37082
|
-
return (0, array_js_1.parseArrayDef)(def, refs);
|
|
37083
|
-
case v3_1.ZodFirstPartyTypeKind.ZodUnion:
|
|
37084
|
-
case v3_1.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
37085
|
-
return (0, union_js_1.parseUnionDef)(def, refs);
|
|
37086
|
-
case v3_1.ZodFirstPartyTypeKind.ZodIntersection:
|
|
37087
|
-
return (0, intersection_js_1.parseIntersectionDef)(def, refs);
|
|
37088
|
-
case v3_1.ZodFirstPartyTypeKind.ZodTuple:
|
|
37089
|
-
return (0, tuple_js_1.parseTupleDef)(def, refs);
|
|
37090
|
-
case v3_1.ZodFirstPartyTypeKind.ZodRecord:
|
|
37091
|
-
return (0, record_js_1.parseRecordDef)(def, refs);
|
|
37092
|
-
case v3_1.ZodFirstPartyTypeKind.ZodLiteral:
|
|
37093
|
-
return (0, literal_js_1.parseLiteralDef)(def, refs);
|
|
37094
|
-
case v3_1.ZodFirstPartyTypeKind.ZodEnum:
|
|
37095
|
-
return (0, enum_js_1.parseEnumDef)(def);
|
|
37096
|
-
case v3_1.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
37097
|
-
return (0, nativeEnum_js_1.parseNativeEnumDef)(def);
|
|
37098
|
-
case v3_1.ZodFirstPartyTypeKind.ZodNullable:
|
|
37099
|
-
return (0, nullable_js_1.parseNullableDef)(def, refs);
|
|
37100
|
-
case v3_1.ZodFirstPartyTypeKind.ZodOptional:
|
|
37101
|
-
return (0, optional_js_1.parseOptionalDef)(def, refs);
|
|
37102
|
-
case v3_1.ZodFirstPartyTypeKind.ZodMap:
|
|
37103
|
-
return (0, map_js_1.parseMapDef)(def, refs);
|
|
37104
|
-
case v3_1.ZodFirstPartyTypeKind.ZodSet:
|
|
37105
|
-
return (0, set_js_1.parseSetDef)(def, refs);
|
|
37106
|
-
case v3_1.ZodFirstPartyTypeKind.ZodLazy:
|
|
37107
|
-
return () => def.getter()._def;
|
|
37108
|
-
case v3_1.ZodFirstPartyTypeKind.ZodPromise:
|
|
37109
|
-
return (0, promise_js_1.parsePromiseDef)(def, refs);
|
|
37110
|
-
case v3_1.ZodFirstPartyTypeKind.ZodNaN:
|
|
37111
|
-
case v3_1.ZodFirstPartyTypeKind.ZodNever:
|
|
37112
|
-
return (0, never_js_1.parseNeverDef)(refs);
|
|
37113
|
-
case v3_1.ZodFirstPartyTypeKind.ZodEffects:
|
|
37114
|
-
return (0, effects_js_1.parseEffectsDef)(def, refs);
|
|
37115
|
-
case v3_1.ZodFirstPartyTypeKind.ZodAny:
|
|
37116
|
-
return (0, any_js_1.parseAnyDef)(refs);
|
|
37117
|
-
case v3_1.ZodFirstPartyTypeKind.ZodUnknown:
|
|
37118
|
-
return (0, unknown_js_1.parseUnknownDef)(refs);
|
|
37119
|
-
case v3_1.ZodFirstPartyTypeKind.ZodDefault:
|
|
37120
|
-
return (0, default_js_1.parseDefaultDef)(def, refs);
|
|
37121
|
-
case v3_1.ZodFirstPartyTypeKind.ZodBranded:
|
|
37122
|
-
return (0, branded_js_1.parseBrandedDef)(def, refs);
|
|
37123
|
-
case v3_1.ZodFirstPartyTypeKind.ZodReadonly:
|
|
37124
|
-
return (0, readonly_js_1.parseReadonlyDef)(def, refs);
|
|
37125
|
-
case v3_1.ZodFirstPartyTypeKind.ZodCatch:
|
|
37126
|
-
return (0, catch_js_1.parseCatchDef)(def, refs);
|
|
37127
|
-
case v3_1.ZodFirstPartyTypeKind.ZodPipeline:
|
|
37128
|
-
return (0, pipeline_js_1.parsePipelineDef)(def, refs);
|
|
37129
|
-
case v3_1.ZodFirstPartyTypeKind.ZodFunction:
|
|
37130
|
-
case v3_1.ZodFirstPartyTypeKind.ZodVoid:
|
|
37131
|
-
case v3_1.ZodFirstPartyTypeKind.ZodSymbol:
|
|
37132
|
-
return undefined;
|
|
37133
|
-
default:
|
|
37134
|
-
return ((_) => undefined)();
|
|
37135
|
-
}
|
|
37136
|
-
};
|
|
37137
|
-
selectParser.selectParser = selectParser$1;
|
|
37138
|
-
return selectParser;
|
|
37139
|
-
}
|
|
37140
|
-
|
|
37141
|
-
var hasRequiredParseDef;
|
|
37142
|
-
|
|
37143
|
-
function requireParseDef () {
|
|
37144
|
-
if (hasRequiredParseDef) return parseDef;
|
|
37145
|
-
hasRequiredParseDef = 1;
|
|
37146
|
-
Object.defineProperty(parseDef, "__esModule", { value: true });
|
|
37147
|
-
parseDef.parseDef = void 0;
|
|
37148
|
-
const Options_js_1 = Options;
|
|
37149
|
-
const selectParser_js_1 = requireSelectParser();
|
|
37150
|
-
const getRelativePath_js_1 = getRelativePath$1;
|
|
37151
|
-
const any_js_1 = any;
|
|
37152
|
-
function parseDef$1(def, refs, forceResolution = false) {
|
|
37153
|
-
const seenItem = refs.seen.get(def);
|
|
37154
|
-
if (refs.override) {
|
|
37155
|
-
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
37156
|
-
if (overrideResult !== Options_js_1.ignoreOverride) {
|
|
37157
|
-
return overrideResult;
|
|
37158
|
-
}
|
|
37159
|
-
}
|
|
37160
|
-
if (seenItem && !forceResolution) {
|
|
37161
|
-
const seenSchema = get$ref(seenItem, refs);
|
|
37162
|
-
if (seenSchema !== undefined) {
|
|
37163
|
-
return seenSchema;
|
|
37164
|
-
}
|
|
37165
|
-
}
|
|
37166
|
-
const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
|
|
37167
|
-
refs.seen.set(def, newItem);
|
|
37168
|
-
const jsonSchemaOrGetter = (0, selectParser_js_1.selectParser)(def, def.typeName, refs);
|
|
37169
|
-
// If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive)
|
|
37170
|
-
const jsonSchema = typeof jsonSchemaOrGetter === "function"
|
|
37171
|
-
? parseDef$1(jsonSchemaOrGetter(), refs)
|
|
37172
|
-
: jsonSchemaOrGetter;
|
|
37173
|
-
if (jsonSchema) {
|
|
37174
|
-
addMeta(def, refs, jsonSchema);
|
|
37175
|
-
}
|
|
37176
|
-
if (refs.postProcess) {
|
|
37177
|
-
const postProcessResult = refs.postProcess(jsonSchema, def, refs);
|
|
37178
|
-
newItem.jsonSchema = jsonSchema;
|
|
37179
|
-
return postProcessResult;
|
|
37180
|
-
}
|
|
37181
|
-
newItem.jsonSchema = jsonSchema;
|
|
37182
|
-
return jsonSchema;
|
|
37183
|
-
}
|
|
37184
|
-
parseDef.parseDef = parseDef$1;
|
|
37185
|
-
const get$ref = (item, refs) => {
|
|
37186
|
-
switch (refs.$refStrategy) {
|
|
37187
|
-
case "root":
|
|
37188
|
-
return { $ref: item.path.join("/") };
|
|
37189
|
-
case "relative":
|
|
37190
|
-
return { $ref: (0, getRelativePath_js_1.getRelativePath)(refs.currentPath, item.path) };
|
|
37191
|
-
case "none":
|
|
37192
|
-
case "seen": {
|
|
37193
|
-
if (item.path.length < refs.currentPath.length &&
|
|
37194
|
-
item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
37195
|
-
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
37196
|
-
return (0, any_js_1.parseAnyDef)(refs);
|
|
37197
|
-
}
|
|
37198
|
-
return refs.$refStrategy === "seen" ? (0, any_js_1.parseAnyDef)(refs) : undefined;
|
|
37199
|
-
}
|
|
37200
|
-
}
|
|
37201
|
-
};
|
|
37202
|
-
const addMeta = (def, refs, jsonSchema) => {
|
|
37203
|
-
if (def.description) {
|
|
37204
|
-
jsonSchema.description = def.description;
|
|
37205
|
-
if (refs.markdownDescription) {
|
|
37206
|
-
jsonSchema.markdownDescription = def.description;
|
|
37207
|
-
}
|
|
37208
|
-
}
|
|
37209
|
-
return jsonSchema;
|
|
37210
|
-
};
|
|
37211
|
-
return parseDef;
|
|
37212
|
-
}
|
|
37213
|
-
|
|
37214
|
-
var parseTypes = {};
|
|
37215
|
-
|
|
37216
|
-
Object.defineProperty(parseTypes, "__esModule", { value: true });
|
|
37217
|
-
|
|
37218
|
-
var zodToJsonSchema$1 = {};
|
|
37219
|
-
|
|
37220
|
-
Object.defineProperty(zodToJsonSchema$1, "__esModule", { value: true });
|
|
37221
|
-
zodToJsonSchema$1.zodToJsonSchema = void 0;
|
|
37222
|
-
const parseDef_js_1 = requireParseDef();
|
|
37223
|
-
const Refs_js_1 = Refs;
|
|
37224
|
-
const any_js_1 = any;
|
|
37225
|
-
const zodToJsonSchema = (schema, options) => {
|
|
37226
|
-
const refs = (0, Refs_js_1.getRefs)(options);
|
|
37227
|
-
let definitions = typeof options === "object" && options.definitions
|
|
37228
|
-
? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
|
|
37229
|
-
...acc,
|
|
37230
|
-
[name]: (0, parseDef_js_1.parseDef)(schema._def, {
|
|
37231
|
-
...refs,
|
|
37232
|
-
currentPath: [...refs.basePath, refs.definitionPath, name],
|
|
37233
|
-
}, true) ?? (0, any_js_1.parseAnyDef)(refs),
|
|
37234
|
-
}), {})
|
|
37235
|
-
: undefined;
|
|
37236
|
-
const name = typeof options === "string"
|
|
37237
|
-
? options
|
|
37238
|
-
: options?.nameStrategy === "title"
|
|
37239
|
-
? undefined
|
|
37240
|
-
: options?.name;
|
|
37241
|
-
const main = (0, parseDef_js_1.parseDef)(schema._def, name === undefined
|
|
37242
|
-
? refs
|
|
37243
|
-
: {
|
|
37244
|
-
...refs,
|
|
37245
|
-
currentPath: [...refs.basePath, refs.definitionPath, name],
|
|
37246
|
-
}, false) ?? (0, any_js_1.parseAnyDef)(refs);
|
|
37247
|
-
const title = typeof options === "object" &&
|
|
37248
|
-
options.name !== undefined &&
|
|
37249
|
-
options.nameStrategy === "title"
|
|
37250
|
-
? options.name
|
|
37251
|
-
: undefined;
|
|
37252
|
-
if (title !== undefined) {
|
|
37253
|
-
main.title = title;
|
|
37254
|
-
}
|
|
37255
|
-
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
37256
|
-
if (!definitions) {
|
|
37257
|
-
definitions = {};
|
|
37258
|
-
}
|
|
37259
|
-
if (!definitions[refs.openAiAnyTypeName]) {
|
|
37260
|
-
definitions[refs.openAiAnyTypeName] = {
|
|
37261
|
-
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
37262
|
-
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
37263
|
-
items: {
|
|
37264
|
-
$ref: refs.$refStrategy === "relative"
|
|
37265
|
-
? "1"
|
|
37266
|
-
: [
|
|
37267
|
-
...refs.basePath,
|
|
37268
|
-
refs.definitionPath,
|
|
37269
|
-
refs.openAiAnyTypeName,
|
|
37270
|
-
].join("/"),
|
|
37271
|
-
},
|
|
37272
|
-
};
|
|
37273
|
-
}
|
|
37274
|
-
}
|
|
37275
|
-
const combined = name === undefined
|
|
37276
|
-
? definitions
|
|
37277
|
-
? {
|
|
37278
|
-
...main,
|
|
37279
|
-
[refs.definitionPath]: definitions,
|
|
37280
|
-
}
|
|
37281
|
-
: main
|
|
37282
|
-
: {
|
|
37283
|
-
$ref: [
|
|
37284
|
-
...(refs.$refStrategy === "relative" ? [] : refs.basePath),
|
|
37285
|
-
refs.definitionPath,
|
|
37286
|
-
name,
|
|
37287
|
-
].join("/"),
|
|
37288
|
-
[refs.definitionPath]: {
|
|
37289
|
-
...definitions,
|
|
37290
|
-
[name]: main,
|
|
37291
|
-
},
|
|
37292
|
-
};
|
|
37293
|
-
if (refs.target === "jsonSchema7") {
|
|
37294
|
-
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
37295
|
-
}
|
|
37296
|
-
else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
37297
|
-
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
37298
|
-
}
|
|
37299
|
-
if (refs.target === "openAi" &&
|
|
37300
|
-
("anyOf" in combined ||
|
|
37301
|
-
"oneOf" in combined ||
|
|
37302
|
-
"allOf" in combined ||
|
|
37303
|
-
("type" in combined && Array.isArray(combined.type)))) {
|
|
37304
|
-
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
37305
|
-
}
|
|
37306
|
-
return combined;
|
|
37307
|
-
};
|
|
37308
|
-
zodToJsonSchema$1.zodToJsonSchema = zodToJsonSchema;
|
|
37309
|
-
|
|
37310
|
-
(function (exports) {
|
|
37311
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
37312
|
-
if (k2 === undefined) k2 = k;
|
|
37313
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
37314
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
37315
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
37316
|
-
}
|
|
37317
|
-
Object.defineProperty(o, k2, desc);
|
|
37318
|
-
}) : (function(o, m, k, k2) {
|
|
37319
|
-
if (k2 === undefined) k2 = k;
|
|
37320
|
-
o[k2] = m[k];
|
|
37321
|
-
}));
|
|
37322
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
37323
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37324
|
-
};
|
|
37325
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37326
|
-
__exportStar(Options, exports);
|
|
37327
|
-
__exportStar(Refs, exports);
|
|
37328
|
-
__exportStar(errorMessages, exports);
|
|
37329
|
-
__exportStar(getRelativePath$1, exports);
|
|
37330
|
-
__exportStar(requireParseDef(), exports);
|
|
37331
|
-
__exportStar(parseTypes, exports);
|
|
37332
|
-
__exportStar(any, exports);
|
|
37333
|
-
__exportStar(requireArray(), exports);
|
|
37334
|
-
__exportStar(bigint, exports);
|
|
37335
|
-
__exportStar(boolean, exports);
|
|
37336
|
-
__exportStar(requireBranded(), exports);
|
|
37337
|
-
__exportStar(require_catch(), exports);
|
|
37338
|
-
__exportStar(date, exports);
|
|
37339
|
-
__exportStar(require_default(), exports);
|
|
37340
|
-
__exportStar(requireEffects(), exports);
|
|
37341
|
-
__exportStar(_enum$1, exports);
|
|
37342
|
-
__exportStar(requireIntersection(), exports);
|
|
37343
|
-
__exportStar(literal, exports);
|
|
37344
|
-
__exportStar(requireMap(), exports);
|
|
37345
|
-
__exportStar(nativeEnum, exports);
|
|
37346
|
-
__exportStar(never, exports);
|
|
37347
|
-
__exportStar(_null, exports);
|
|
37348
|
-
__exportStar(requireNullable(), exports);
|
|
37349
|
-
__exportStar(number, exports);
|
|
37350
|
-
__exportStar(requireObject(), exports);
|
|
37351
|
-
__exportStar(requireOptional(), exports);
|
|
37352
|
-
__exportStar(requirePipeline(), exports);
|
|
37353
|
-
__exportStar(requirePromise(), exports);
|
|
37354
|
-
__exportStar(requireReadonly(), exports);
|
|
37355
|
-
__exportStar(requireRecord(), exports);
|
|
37356
|
-
__exportStar(requireSet(), exports);
|
|
37357
|
-
__exportStar(string, exports);
|
|
37358
|
-
__exportStar(requireTuple(), exports);
|
|
37359
|
-
__exportStar(_undefined, exports);
|
|
37360
|
-
__exportStar(requireUnion(), exports);
|
|
37361
|
-
__exportStar(unknown, exports);
|
|
37362
|
-
__exportStar(requireSelectParser(), exports);
|
|
37363
|
-
__exportStar(zodToJsonSchema$1, exports);
|
|
37364
|
-
const zodToJsonSchema_js_1 = zodToJsonSchema$1;
|
|
37365
|
-
exports.default = zodToJsonSchema_js_1.zodToJsonSchema;
|
|
37366
|
-
} (cjs));
|
|
37367
|
-
|
|
37368
35846
|
// zod-json-schema-compat.ts
|
|
37369
35847
|
// ----------------------------------------------------
|
|
37370
35848
|
// JSON Schema conversion for both Zod v3 and Zod v4 (Mini)
|
|
@@ -37399,7 +35877,7 @@ zodJsonSchemaCompat.getMethodLiteral = getMethodLiteral;
|
|
|
37399
35877
|
zodJsonSchemaCompat.parseWithCompat = parseWithCompat;
|
|
37400
35878
|
const z4mini = __importStar(v4Mini);
|
|
37401
35879
|
const zod_compat_js_1$2 = zodCompat;
|
|
37402
|
-
const zod_to_json_schema_1 =
|
|
35880
|
+
const zod_to_json_schema_1 = require$$2$4;
|
|
37403
35881
|
function mapMiniTarget(t) {
|
|
37404
35882
|
if (!t)
|
|
37405
35883
|
return 'draft-7';
|
|
@@ -47951,7 +46429,7 @@ var import_node_http22 = require$$1$5;
|
|
|
47951
46429
|
|
|
47952
46430
|
// src/request.ts
|
|
47953
46431
|
var import_node_http2 = require$$1$5;
|
|
47954
|
-
var import_node_stream = require$$5;
|
|
46432
|
+
var import_node_stream = require$$5$1;
|
|
47955
46433
|
var RequestError = class extends Error {
|
|
47956
46434
|
constructor(message, options) {
|
|
47957
46435
|
super(message, options);
|
|
@@ -49529,7 +48007,7 @@ streamableHttp.StreamableHTTPServerTransport = StreamableHTTPServerTransport$1;
|
|
|
49529
48007
|
|
|
49530
48008
|
const fs$4 = require$$0$2;
|
|
49531
48009
|
const path$6 = require$$1$1;
|
|
49532
|
-
const forge = require$$2$
|
|
48010
|
+
const forge = require$$2$5;
|
|
49533
48011
|
|
|
49534
48012
|
/**
|
|
49535
48013
|
* Get or create a self-signed TLS certificate for localhost.
|
|
@@ -58761,7 +57239,7 @@ function requireWidgetPublishManifest () {
|
|
|
58761
57239
|
*/
|
|
58762
57240
|
const path$4 = require$$1$1;
|
|
58763
57241
|
const { app: app$4, dialog: dialog$2 } = require$$0$1;
|
|
58764
|
-
const AdmZip$2 = require$$
|
|
57242
|
+
const AdmZip$2 = require$$5;
|
|
58765
57243
|
|
|
58766
57244
|
const themeController$3 = themeController_1;
|
|
58767
57245
|
const registryController$1 = registryController$3;
|
|
@@ -59500,7 +57978,7 @@ var themeRegistryController$1 = {
|
|
|
59500
57978
|
|
|
59501
57979
|
const { app: app$3, dialog: dialog$1 } = require$$0$1;
|
|
59502
57980
|
const path$3 = require$$1$1;
|
|
59503
|
-
const AdmZip$1 = require$$
|
|
57981
|
+
const AdmZip$1 = require$$5;
|
|
59504
57982
|
const { getFileContents: getFileContents$1 } = file;
|
|
59505
57983
|
const {
|
|
59506
57984
|
validateDashboardConfig,
|
|
@@ -61807,7 +60285,7 @@ var notificationController_1 = notificationController$2;
|
|
|
61807
60285
|
const { app: app$2 } = require$$0$1;
|
|
61808
60286
|
const fs$2 = require$$0$2;
|
|
61809
60287
|
const path$2 = require$$1$1;
|
|
61810
|
-
const WebSocket = require$$3$
|
|
60288
|
+
const WebSocket = require$$3$3;
|
|
61811
60289
|
const {
|
|
61812
60290
|
gateNetworkCall,
|
|
61813
60291
|
gateNetworkCallWithJit,
|
|
@@ -63448,7 +61926,7 @@ var dashboardRatingsController = {
|
|
|
63448
61926
|
|
|
63449
61927
|
const fs$1 = require$$0$2;
|
|
63450
61928
|
const path = require$$1$1;
|
|
63451
|
-
const AdmZip = require$$
|
|
61929
|
+
const AdmZip = require$$5;
|
|
63452
61930
|
const { app } = require$$0$1;
|
|
63453
61931
|
|
|
63454
61932
|
const registryApiController$1 = registryApiController$3;
|
|
@@ -65765,6 +64243,31 @@ const registryApi$2 = {
|
|
|
65765
64243
|
throw error;
|
|
65766
64244
|
}
|
|
65767
64245
|
},
|
|
64246
|
+
|
|
64247
|
+
/**
|
|
64248
|
+
* Fetch a registry package's `dash.permissions` block WITHOUT
|
|
64249
|
+
* installing it. Powers the pre-install preflight in the update
|
|
64250
|
+
* flow — the renderer learns what MCP/fs/network grants a new
|
|
64251
|
+
* version would need, diffs against what's already granted, and
|
|
64252
|
+
* asks the user for approval BEFORE downloading the install.
|
|
64253
|
+
*
|
|
64254
|
+
* @param {string} packageName
|
|
64255
|
+
* @returns {Promise<{packageId: string, version: string|null, permissions: object|null}>}
|
|
64256
|
+
*/
|
|
64257
|
+
fetchPackageManifest: async (packageName) => {
|
|
64258
|
+
try {
|
|
64259
|
+
return await ipcRenderer$f.invoke(
|
|
64260
|
+
"registry:fetch-package-manifest",
|
|
64261
|
+
packageName,
|
|
64262
|
+
);
|
|
64263
|
+
} catch (error) {
|
|
64264
|
+
console.error(
|
|
64265
|
+
`[RegistryApi] Error fetching package manifest for ${packageName}:`,
|
|
64266
|
+
error,
|
|
64267
|
+
);
|
|
64268
|
+
throw error;
|
|
64269
|
+
}
|
|
64270
|
+
},
|
|
65768
64271
|
};
|
|
65769
64272
|
|
|
65770
64273
|
var registryApi_1 = registryApi$2;
|