@usecontextlayer/cli 0.13.0 → 0.14.1
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-CRgSQabE.mjs → app-CJgT3IKd.mjs} +94 -2
- package/dist/app-CJgT3IKd.mjs.map +1 -0
- package/dist/cli.mjs +76 -48
- package/dist/cli.mjs.map +1 -1
- package/dist/template/app/root.tsx +1 -1
- package/dist/template/public/slate.json +2 -1
- package/dist/template/workers/local-tools/index.ts +1 -1
- package/dist/vite.d.mts +19 -4
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +10 -5
- package/dist/vite.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/app-CRgSQabE.mjs.map +0 -1
|
@@ -8131,6 +8131,62 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
|
8131
8131
|
});
|
|
8132
8132
|
};
|
|
8133
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
|
+
});
|
|
8134
8190
|
const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
8135
8191
|
$ZodType.init(inst, def);
|
|
8136
8192
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -10337,6 +10393,14 @@ function object(shape, params) {
|
|
|
10337
10393
|
};
|
|
10338
10394
|
return new ZodObject(def);
|
|
10339
10395
|
}
|
|
10396
|
+
function strictObject(shape, params) {
|
|
10397
|
+
return new ZodObject({
|
|
10398
|
+
type: "object",
|
|
10399
|
+
shape,
|
|
10400
|
+
catchall: never(),
|
|
10401
|
+
...normalizeParams(params)
|
|
10402
|
+
});
|
|
10403
|
+
}
|
|
10340
10404
|
function looseObject(shape, params) {
|
|
10341
10405
|
return new ZodObject({
|
|
10342
10406
|
type: "object",
|
|
@@ -10358,6 +10422,18 @@ function union(options, params) {
|
|
|
10358
10422
|
...normalizeParams(params)
|
|
10359
10423
|
});
|
|
10360
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
|
+
}
|
|
10361
10437
|
const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
|
|
10362
10438
|
$ZodIntersection.init(inst, def);
|
|
10363
10439
|
ZodType.init(inst, def);
|
|
@@ -11800,6 +11876,19 @@ async function whoami() {
|
|
|
11800
11876
|
console.log(user.id);
|
|
11801
11877
|
}
|
|
11802
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
|
|
11803
11892
|
//#region app.ts
|
|
11804
11893
|
async function getLocalAppId() {
|
|
11805
11894
|
const { stdout: remote } = await execa("git", [
|
|
@@ -11809,7 +11898,10 @@ async function getLocalAppId() {
|
|
|
11809
11898
|
]);
|
|
11810
11899
|
return uuid().parse(new URL(remote).pathname.replace(/^\/git\//, ""));
|
|
11811
11900
|
}
|
|
11901
|
+
async function readLocalManifest() {
|
|
11902
|
+
return slateSchema.parse(JSON.parse(await readFile("public/slate.json", "utf8")));
|
|
11903
|
+
}
|
|
11812
11904
|
//#endregion
|
|
11813
|
-
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, connectionRequirementSchema as r, login as s, getLocalAppId as t, array as u, string as v, uuid as x, unknown as y };
|
|
11814
11906
|
|
|
11815
|
-
//# sourceMappingURL=app-
|
|
11907
|
+
//# sourceMappingURL=app-CJgT3IKd.mjs.map
|