@usecontextlayer/cli 0.12.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-BqaczjqV.mjs → app-DUUpiXEm.mjs} +366 -6
- package/dist/app-DUUpiXEm.mjs.map +1 -0
- package/dist/cli.mjs +948 -22
- package/dist/cli.mjs.map +1 -1
- package/dist/template/app/root.tsx +38 -0
- package/dist/template/public/slate.json +2 -1
- package/dist/template/workers/local-tools/index.ts +1 -1
- package/dist/vite.d.mts +2 -0
- package/dist/vite.mjs +3 -1
- package/dist/vite.mjs.map +1 -1
- package/package.json +7 -2
- package/dist/app-BqaczjqV.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path, { join } from "node:path";
|
|
2
3
|
import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
|
|
3
4
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
4
|
-
import path, { join } from "node:path";
|
|
5
5
|
import fs, { appendFileSync, closeSync, createReadStream, createWriteStream, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
|
|
7
7
|
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
@@ -6957,6 +6957,7 @@ const string$1 = (params) => {
|
|
|
6957
6957
|
};
|
|
6958
6958
|
const integer = /^-?\d+$/;
|
|
6959
6959
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
6960
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
6960
6961
|
const lowercase = /^[^A-Z]*$/;
|
|
6961
6962
|
const uppercase = /^[^a-z]*$/;
|
|
6962
6963
|
//#endregion
|
|
@@ -7768,6 +7769,24 @@ const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, d
|
|
|
7768
7769
|
$ZodCheckNumberFormat.init(inst, def);
|
|
7769
7770
|
$ZodNumber.init(inst, def);
|
|
7770
7771
|
});
|
|
7772
|
+
const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
|
|
7773
|
+
$ZodType.init(inst, def);
|
|
7774
|
+
inst._zod.pattern = boolean$1;
|
|
7775
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
7776
|
+
if (def.coerce) try {
|
|
7777
|
+
payload.value = Boolean(payload.value);
|
|
7778
|
+
} catch (_) {}
|
|
7779
|
+
const input = payload.value;
|
|
7780
|
+
if (typeof input === "boolean") return payload;
|
|
7781
|
+
payload.issues.push({
|
|
7782
|
+
expected: "boolean",
|
|
7783
|
+
code: "invalid_type",
|
|
7784
|
+
input,
|
|
7785
|
+
inst
|
|
7786
|
+
});
|
|
7787
|
+
return payload;
|
|
7788
|
+
};
|
|
7789
|
+
});
|
|
7771
7790
|
const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
|
|
7772
7791
|
$ZodType.init(inst, def);
|
|
7773
7792
|
inst._zod.parse = (payload) => payload;
|
|
@@ -8112,6 +8131,62 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
|
8112
8131
|
});
|
|
8113
8132
|
};
|
|
8114
8133
|
});
|
|
8134
|
+
const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
8135
|
+
def.inclusive = false;
|
|
8136
|
+
$ZodUnion.init(inst, def);
|
|
8137
|
+
const _super = inst._zod.parse;
|
|
8138
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
8139
|
+
const propValues = {};
|
|
8140
|
+
for (const option of def.options) {
|
|
8141
|
+
const pv = option._zod.propValues;
|
|
8142
|
+
if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
8143
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
8144
|
+
if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
|
|
8145
|
+
for (const val of v) propValues[k].add(val);
|
|
8146
|
+
}
|
|
8147
|
+
}
|
|
8148
|
+
return propValues;
|
|
8149
|
+
});
|
|
8150
|
+
const disc = cached(() => {
|
|
8151
|
+
const opts = def.options;
|
|
8152
|
+
const map = /* @__PURE__ */ new Map();
|
|
8153
|
+
for (const o of opts) {
|
|
8154
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
8155
|
+
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
8156
|
+
for (const v of values) {
|
|
8157
|
+
if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
8158
|
+
map.set(v, o);
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
8161
|
+
return map;
|
|
8162
|
+
});
|
|
8163
|
+
inst._zod.parse = (payload, ctx) => {
|
|
8164
|
+
const input = payload.value;
|
|
8165
|
+
if (!isObject(input)) {
|
|
8166
|
+
payload.issues.push({
|
|
8167
|
+
code: "invalid_type",
|
|
8168
|
+
expected: "object",
|
|
8169
|
+
input,
|
|
8170
|
+
inst
|
|
8171
|
+
});
|
|
8172
|
+
return payload;
|
|
8173
|
+
}
|
|
8174
|
+
const opt = disc.value.get(input?.[def.discriminator]);
|
|
8175
|
+
if (opt) return opt._zod.run(payload, ctx);
|
|
8176
|
+
if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
|
|
8177
|
+
payload.issues.push({
|
|
8178
|
+
code: "invalid_union",
|
|
8179
|
+
errors: [],
|
|
8180
|
+
note: "No matching discriminator",
|
|
8181
|
+
discriminator: def.discriminator,
|
|
8182
|
+
options: Array.from(disc.value.keys()),
|
|
8183
|
+
input,
|
|
8184
|
+
path: [def.discriminator],
|
|
8185
|
+
inst
|
|
8186
|
+
});
|
|
8187
|
+
return payload;
|
|
8188
|
+
};
|
|
8189
|
+
});
|
|
8115
8190
|
const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
8116
8191
|
$ZodType.init(inst, def);
|
|
8117
8192
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -8211,6 +8286,115 @@ function handleIntersectionResults(result, left, right) {
|
|
|
8211
8286
|
result.value = merged.data;
|
|
8212
8287
|
return result;
|
|
8213
8288
|
}
|
|
8289
|
+
const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
8290
|
+
$ZodType.init(inst, def);
|
|
8291
|
+
inst._zod.parse = (payload, ctx) => {
|
|
8292
|
+
const input = payload.value;
|
|
8293
|
+
if (!isPlainObject(input)) {
|
|
8294
|
+
payload.issues.push({
|
|
8295
|
+
expected: "record",
|
|
8296
|
+
code: "invalid_type",
|
|
8297
|
+
input,
|
|
8298
|
+
inst
|
|
8299
|
+
});
|
|
8300
|
+
return payload;
|
|
8301
|
+
}
|
|
8302
|
+
const proms = [];
|
|
8303
|
+
const values = def.keyType._zod.values;
|
|
8304
|
+
if (values) {
|
|
8305
|
+
payload.value = {};
|
|
8306
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
8307
|
+
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
8308
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
8309
|
+
const keyResult = def.keyType._zod.run({
|
|
8310
|
+
value: key,
|
|
8311
|
+
issues: []
|
|
8312
|
+
}, ctx);
|
|
8313
|
+
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
8314
|
+
if (keyResult.issues.length) {
|
|
8315
|
+
payload.issues.push({
|
|
8316
|
+
code: "invalid_key",
|
|
8317
|
+
origin: "record",
|
|
8318
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
8319
|
+
input: key,
|
|
8320
|
+
path: [key],
|
|
8321
|
+
inst
|
|
8322
|
+
});
|
|
8323
|
+
continue;
|
|
8324
|
+
}
|
|
8325
|
+
const outKey = keyResult.value;
|
|
8326
|
+
const result = def.valueType._zod.run({
|
|
8327
|
+
value: input[key],
|
|
8328
|
+
issues: []
|
|
8329
|
+
}, ctx);
|
|
8330
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
8331
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
8332
|
+
payload.value[outKey] = result.value;
|
|
8333
|
+
}));
|
|
8334
|
+
else {
|
|
8335
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
8336
|
+
payload.value[outKey] = result.value;
|
|
8337
|
+
}
|
|
8338
|
+
}
|
|
8339
|
+
let unrecognized;
|
|
8340
|
+
for (const key in input) if (!recordKeys.has(key)) {
|
|
8341
|
+
unrecognized = unrecognized ?? [];
|
|
8342
|
+
unrecognized.push(key);
|
|
8343
|
+
}
|
|
8344
|
+
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
8345
|
+
code: "unrecognized_keys",
|
|
8346
|
+
input,
|
|
8347
|
+
inst,
|
|
8348
|
+
keys: unrecognized
|
|
8349
|
+
});
|
|
8350
|
+
} else {
|
|
8351
|
+
payload.value = {};
|
|
8352
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
8353
|
+
if (key === "__proto__") continue;
|
|
8354
|
+
if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
|
|
8355
|
+
let keyResult = def.keyType._zod.run({
|
|
8356
|
+
value: key,
|
|
8357
|
+
issues: []
|
|
8358
|
+
}, ctx);
|
|
8359
|
+
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
8360
|
+
if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
|
|
8361
|
+
const retryResult = def.keyType._zod.run({
|
|
8362
|
+
value: Number(key),
|
|
8363
|
+
issues: []
|
|
8364
|
+
}, ctx);
|
|
8365
|
+
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
8366
|
+
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
8367
|
+
}
|
|
8368
|
+
if (keyResult.issues.length) {
|
|
8369
|
+
if (def.mode === "loose") payload.value[key] = input[key];
|
|
8370
|
+
else payload.issues.push({
|
|
8371
|
+
code: "invalid_key",
|
|
8372
|
+
origin: "record",
|
|
8373
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
8374
|
+
input: key,
|
|
8375
|
+
path: [key],
|
|
8376
|
+
inst
|
|
8377
|
+
});
|
|
8378
|
+
continue;
|
|
8379
|
+
}
|
|
8380
|
+
const result = def.valueType._zod.run({
|
|
8381
|
+
value: input[key],
|
|
8382
|
+
issues: []
|
|
8383
|
+
}, ctx);
|
|
8384
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
8385
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
8386
|
+
payload.value[keyResult.value] = result.value;
|
|
8387
|
+
}));
|
|
8388
|
+
else {
|
|
8389
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
8390
|
+
payload.value[keyResult.value] = result.value;
|
|
8391
|
+
}
|
|
8392
|
+
}
|
|
8393
|
+
}
|
|
8394
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
8395
|
+
return payload;
|
|
8396
|
+
};
|
|
8397
|
+
});
|
|
8214
8398
|
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
8215
8399
|
$ZodType.init(inst, def);
|
|
8216
8400
|
const values = getEnumValues(def.entries);
|
|
@@ -8229,6 +8413,24 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
8229
8413
|
return payload;
|
|
8230
8414
|
};
|
|
8231
8415
|
});
|
|
8416
|
+
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
8417
|
+
$ZodType.init(inst, def);
|
|
8418
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
8419
|
+
const values = new Set(def.values);
|
|
8420
|
+
inst._zod.values = values;
|
|
8421
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
8422
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
8423
|
+
const input = payload.value;
|
|
8424
|
+
if (values.has(input)) return payload;
|
|
8425
|
+
payload.issues.push({
|
|
8426
|
+
code: "invalid_value",
|
|
8427
|
+
values: def.values,
|
|
8428
|
+
input,
|
|
8429
|
+
inst
|
|
8430
|
+
});
|
|
8431
|
+
return payload;
|
|
8432
|
+
};
|
|
8433
|
+
});
|
|
8232
8434
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
8233
8435
|
$ZodType.init(inst, def);
|
|
8234
8436
|
inst._zod.optin = "optional";
|
|
@@ -8800,6 +9002,13 @@ function _int(Class, params) {
|
|
|
8800
9002
|
});
|
|
8801
9003
|
}
|
|
8802
9004
|
// @__NO_SIDE_EFFECTS__
|
|
9005
|
+
function _boolean(Class, params) {
|
|
9006
|
+
return new Class({
|
|
9007
|
+
type: "boolean",
|
|
9008
|
+
...normalizeParams(params)
|
|
9009
|
+
});
|
|
9010
|
+
}
|
|
9011
|
+
// @__NO_SIDE_EFFECTS__
|
|
8803
9012
|
function _unknown(Class) {
|
|
8804
9013
|
return new Class({ type: "unknown" });
|
|
8805
9014
|
}
|
|
@@ -9363,6 +9572,9 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
9363
9572
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
9364
9573
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
9365
9574
|
};
|
|
9575
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
9576
|
+
json.type = "boolean";
|
|
9577
|
+
};
|
|
9366
9578
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
9367
9579
|
json.not = {};
|
|
9368
9580
|
};
|
|
@@ -9373,6 +9585,28 @@ const enumProcessor = (schema, _ctx, json, _params) => {
|
|
|
9373
9585
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
9374
9586
|
json.enum = values;
|
|
9375
9587
|
};
|
|
9588
|
+
const literalProcessor = (schema, ctx, json, _params) => {
|
|
9589
|
+
const def = schema._zod.def;
|
|
9590
|
+
const vals = [];
|
|
9591
|
+
for (const val of def.values) if (val === void 0) {
|
|
9592
|
+
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
9593
|
+
} else if (typeof val === "bigint") {
|
|
9594
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
9595
|
+
else vals.push(Number(val));
|
|
9596
|
+
} else vals.push(val);
|
|
9597
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
9598
|
+
const val = vals[0];
|
|
9599
|
+
json.type = val === null ? "null" : typeof val;
|
|
9600
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
9601
|
+
else json.const = val;
|
|
9602
|
+
} else {
|
|
9603
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
9604
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
9605
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
9606
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
9607
|
+
json.enum = vals;
|
|
9608
|
+
}
|
|
9609
|
+
};
|
|
9376
9610
|
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
9377
9611
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
9378
9612
|
};
|
|
@@ -9455,6 +9689,39 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
9455
9689
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
9456
9690
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
9457
9691
|
};
|
|
9692
|
+
const recordProcessor = (schema, ctx, _json, params) => {
|
|
9693
|
+
const json = _json;
|
|
9694
|
+
const def = schema._zod.def;
|
|
9695
|
+
json.type = "object";
|
|
9696
|
+
const keyType = def.keyType;
|
|
9697
|
+
const patterns = keyType._zod.bag?.patterns;
|
|
9698
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
9699
|
+
const valueSchema = process$2(def.valueType, ctx, {
|
|
9700
|
+
...params,
|
|
9701
|
+
path: [
|
|
9702
|
+
...params.path,
|
|
9703
|
+
"patternProperties",
|
|
9704
|
+
"*"
|
|
9705
|
+
]
|
|
9706
|
+
});
|
|
9707
|
+
json.patternProperties = {};
|
|
9708
|
+
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
9709
|
+
} else {
|
|
9710
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$2(def.keyType, ctx, {
|
|
9711
|
+
...params,
|
|
9712
|
+
path: [...params.path, "propertyNames"]
|
|
9713
|
+
});
|
|
9714
|
+
json.additionalProperties = process$2(def.valueType, ctx, {
|
|
9715
|
+
...params,
|
|
9716
|
+
path: [...params.path, "additionalProperties"]
|
|
9717
|
+
});
|
|
9718
|
+
}
|
|
9719
|
+
const keyValues = keyType._zod.values;
|
|
9720
|
+
if (keyValues) {
|
|
9721
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
9722
|
+
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
9723
|
+
}
|
|
9724
|
+
};
|
|
9458
9725
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
9459
9726
|
const def = schema._zod.def;
|
|
9460
9727
|
const inner = process$2(def.innerType, ctx, params);
|
|
@@ -10004,6 +10271,14 @@ const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def
|
|
|
10004
10271
|
function int$1(params) {
|
|
10005
10272
|
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
10006
10273
|
}
|
|
10274
|
+
const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
|
|
10275
|
+
$ZodBoolean.init(inst, def);
|
|
10276
|
+
ZodType.init(inst, def);
|
|
10277
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
10278
|
+
});
|
|
10279
|
+
function boolean(params) {
|
|
10280
|
+
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
10281
|
+
}
|
|
10007
10282
|
const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
|
|
10008
10283
|
$ZodUnknown.init(inst, def);
|
|
10009
10284
|
ZodType.init(inst, def);
|
|
@@ -10118,6 +10393,22 @@ function object(shape, params) {
|
|
|
10118
10393
|
};
|
|
10119
10394
|
return new ZodObject(def);
|
|
10120
10395
|
}
|
|
10396
|
+
function strictObject(shape, params) {
|
|
10397
|
+
return new ZodObject({
|
|
10398
|
+
type: "object",
|
|
10399
|
+
shape,
|
|
10400
|
+
catchall: never(),
|
|
10401
|
+
...normalizeParams(params)
|
|
10402
|
+
});
|
|
10403
|
+
}
|
|
10404
|
+
function looseObject(shape, params) {
|
|
10405
|
+
return new ZodObject({
|
|
10406
|
+
type: "object",
|
|
10407
|
+
shape,
|
|
10408
|
+
catchall: unknown(),
|
|
10409
|
+
...normalizeParams(params)
|
|
10410
|
+
});
|
|
10411
|
+
}
|
|
10121
10412
|
const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
|
|
10122
10413
|
$ZodUnion.init(inst, def);
|
|
10123
10414
|
ZodType.init(inst, def);
|
|
@@ -10131,6 +10422,18 @@ function union(options, params) {
|
|
|
10131
10422
|
...normalizeParams(params)
|
|
10132
10423
|
});
|
|
10133
10424
|
}
|
|
10425
|
+
const ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
10426
|
+
ZodUnion.init(inst, def);
|
|
10427
|
+
$ZodDiscriminatedUnion.init(inst, def);
|
|
10428
|
+
});
|
|
10429
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
10430
|
+
return new ZodDiscriminatedUnion({
|
|
10431
|
+
type: "union",
|
|
10432
|
+
options,
|
|
10433
|
+
discriminator,
|
|
10434
|
+
...normalizeParams(params)
|
|
10435
|
+
});
|
|
10436
|
+
}
|
|
10134
10437
|
const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
|
|
10135
10438
|
$ZodIntersection.init(inst, def);
|
|
10136
10439
|
ZodType.init(inst, def);
|
|
@@ -10143,6 +10446,27 @@ function intersection(left, right) {
|
|
|
10143
10446
|
right
|
|
10144
10447
|
});
|
|
10145
10448
|
}
|
|
10449
|
+
const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
|
|
10450
|
+
$ZodRecord.init(inst, def);
|
|
10451
|
+
ZodType.init(inst, def);
|
|
10452
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
10453
|
+
inst.keyType = def.keyType;
|
|
10454
|
+
inst.valueType = def.valueType;
|
|
10455
|
+
});
|
|
10456
|
+
function record(keyType, valueType, params) {
|
|
10457
|
+
if (!valueType || !valueType._zod) return new ZodRecord({
|
|
10458
|
+
type: "record",
|
|
10459
|
+
keyType: string(),
|
|
10460
|
+
valueType: keyType,
|
|
10461
|
+
...normalizeParams(valueType)
|
|
10462
|
+
});
|
|
10463
|
+
return new ZodRecord({
|
|
10464
|
+
type: "record",
|
|
10465
|
+
keyType,
|
|
10466
|
+
valueType,
|
|
10467
|
+
...normalizeParams(params)
|
|
10468
|
+
});
|
|
10469
|
+
}
|
|
10146
10470
|
const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
10147
10471
|
$ZodEnum.init(inst, def);
|
|
10148
10472
|
ZodType.init(inst, def);
|
|
@@ -10181,6 +10505,23 @@ function _enum(values, params) {
|
|
|
10181
10505
|
...normalizeParams(params)
|
|
10182
10506
|
});
|
|
10183
10507
|
}
|
|
10508
|
+
const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
|
|
10509
|
+
$ZodLiteral.init(inst, def);
|
|
10510
|
+
ZodType.init(inst, def);
|
|
10511
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
10512
|
+
inst.values = new Set(def.values);
|
|
10513
|
+
Object.defineProperty(inst, "value", { get() {
|
|
10514
|
+
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
10515
|
+
return def.values[0];
|
|
10516
|
+
} });
|
|
10517
|
+
});
|
|
10518
|
+
function literal(value, params) {
|
|
10519
|
+
return new ZodLiteral({
|
|
10520
|
+
type: "literal",
|
|
10521
|
+
values: Array.isArray(value) ? value : [value],
|
|
10522
|
+
...normalizeParams(params)
|
|
10523
|
+
});
|
|
10524
|
+
}
|
|
10184
10525
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
10185
10526
|
$ZodTransform.init(inst, def);
|
|
10186
10527
|
ZodType.init(inst, def);
|
|
@@ -11525,13 +11866,29 @@ async function getAccessToken() {
|
|
|
11525
11866
|
}
|
|
11526
11867
|
return credentials.accessToken;
|
|
11527
11868
|
}
|
|
11528
|
-
async function
|
|
11529
|
-
const response = await fetch(new URL("/api/me", env.
|
|
11869
|
+
async function getCurrentUser(headers) {
|
|
11870
|
+
const response = await fetch(new URL("/api/me", env.CTX_AUTH_ISSUER), { headers });
|
|
11530
11871
|
if (!response.ok) throw new Error(`Identity request failed: HTTP ${response.status}`);
|
|
11531
|
-
|
|
11872
|
+
return object({ id: string().min(1) }).parse(await response.json());
|
|
11873
|
+
}
|
|
11874
|
+
async function whoami() {
|
|
11875
|
+
const user = await getCurrentUser({ authorization: `Bearer ${await getAccessToken()}` });
|
|
11532
11876
|
console.log(user.id);
|
|
11533
11877
|
}
|
|
11534
11878
|
//#endregion
|
|
11879
|
+
//#region ../shared/dist/slate.mjs
|
|
11880
|
+
const credentialModeSchema = _enum(["viewer", "owner"]);
|
|
11881
|
+
const connectionRequirementSchema = strictObject({
|
|
11882
|
+
mode: credentialModeSchema,
|
|
11883
|
+
toolkit: string().min(1)
|
|
11884
|
+
});
|
|
11885
|
+
const secretNameSchema = string().regex(/^[A-Z_][A-Z0-9_]*$/);
|
|
11886
|
+
const secretRequirementSchema = strictObject({ mode: credentialModeSchema });
|
|
11887
|
+
const slateSchema = strictObject({
|
|
11888
|
+
connections: record(string().min(1), connectionRequirementSchema),
|
|
11889
|
+
secrets: record(secretNameSchema, secretRequirementSchema).default({})
|
|
11890
|
+
});
|
|
11891
|
+
//#endregion
|
|
11535
11892
|
//#region app.ts
|
|
11536
11893
|
async function getLocalAppId() {
|
|
11537
11894
|
const { stdout: remote } = await execa("git", [
|
|
@@ -11541,7 +11898,10 @@ async function getLocalAppId() {
|
|
|
11541
11898
|
]);
|
|
11542
11899
|
return uuid().parse(new URL(remote).pathname.replace(/^\/git\//, ""));
|
|
11543
11900
|
}
|
|
11901
|
+
async function readLocalManifest() {
|
|
11902
|
+
return slateSchema.parse(JSON.parse(await readFile("public/slate.json", "utf8")));
|
|
11903
|
+
}
|
|
11544
11904
|
//#endregion
|
|
11545
|
-
export {
|
|
11905
|
+
export { execa as S, record as _, getAccessToken as a, url as b, whoami as c, boolean as d, discriminatedUnion as f, object as g, looseObject as h, secretNameSchema as i, env as l, literal as m, readLocalManifest as n, getCurrentUser as o, hostname as p, credentialModeSchema as r, login as s, getLocalAppId as t, array as u, string as v, uuid as x, unknown as y };
|
|
11546
11906
|
|
|
11547
|
-
//# sourceMappingURL=app-
|
|
11907
|
+
//# sourceMappingURL=app-DUUpiXEm.mjs.map
|