@powerhousedao/host-core 6.2.3-dev.79 → 6.2.3-dev.80
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/{compound-Cfqa5Jal.mjs → compound-C7GuPnTP.mjs} +249 -14
- package/dist/compound-C7GuPnTP.mjs.map +1 -0
- package/dist/{compound-DXcOFNcC.d.mts → compound-fPleFc-P.d.mts} +53 -23
- package/dist/compound-fPleFc-P.d.mts.map +1 -0
- package/dist/{env-substitution-qS_lDcbn.mjs → env-substitution-CzlXbvQJ.mjs} +236 -10
- package/dist/env-substitution-CzlXbvQJ.mjs.map +1 -0
- package/dist/{host-schemas-B6DsXA0Y.d.mts → host-schemas-ByrS_x_Z.d.mts} +47 -24
- package/dist/host-schemas-ByrS_x_Z.d.mts.map +1 -0
- package/dist/index.d.mts +5 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{plugins-EFYLaYQi.d.mts → plugins-CUY86XvH.d.mts} +2 -2
- package/dist/{plugins-EFYLaYQi.d.mts.map → plugins-CUY86XvH.d.mts.map} +1 -1
- package/dist/plugins.d.mts +1 -1
- package/dist/projection.d.mts +2 -2
- package/dist/projection.mjs +8 -4
- package/dist/projection.mjs.map +1 -1
- package/dist/runners/compound.d.mts +5 -3
- package/dist/runners/compound.d.mts.map +1 -1
- package/dist/runners/compound.mjs +1 -1
- package/dist/schema.d.mts +4 -3
- package/dist/schema.d.mts.map +1 -1
- package/dist/schema.mjs +3 -2
- package/dist/schema.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/compound-Cfqa5Jal.mjs.map +0 -1
- package/dist/compound-DXcOFNcC.d.mts.map +0 -1
- package/dist/env-substitution-qS_lDcbn.mjs.map +0 -1
- package/dist/host-schemas-B6DsXA0Y.d.mts.map +0 -1
|
@@ -4,7 +4,8 @@ import fs, { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { TOKEN_ESCAPE_KEY, TOKEN_KEYS, concatTokenSchema, envTokenSchema, envTokenable, findToken, forbidRef, isToken, itemTokenSchema, keyTokenSchema, mapTokenSchema, outputTokenSchema, ref, tokenKeyOf, tokenSchema, tokenable } from "@powerhousedao/shared/host-tokens";
|
|
7
|
+
import { TOKEN_ESCAPE_KEY, TOKEN_KEYS, concatTokenSchema, envTokenSchema, envTokenable, findToken, forbidRef, isToken, itemTokenSchema, keyTokenSchema, mapTokenSchema, outputTokenSchema, ref, switchboardOfDrive, tokenKeyOf, tokenSchema, tokenable } from "@powerhousedao/shared/host-tokens";
|
|
8
|
+
import { isOriginPlaceholderUrl } from "@powerhousedao/shared/connect/origin-placeholder";
|
|
8
9
|
import { resolvePhDir } from "@powerhousedao/shared/clis/ph-dir";
|
|
9
10
|
//#region src/plugins.ts
|
|
10
11
|
/**
|
|
@@ -454,9 +455,21 @@ function projectDriveIdWith(sha256Hex, projectRoot, slug) {
|
|
|
454
455
|
* `config` is runner-defined.
|
|
455
456
|
*
|
|
456
457
|
* Token-able fields (typed-host-configs 3.5): `reactor.backends.*.remote.url`
|
|
457
|
-
* (required), `reactor.drives` (whole list, e.g. `$map`),
|
|
458
|
+
* (required, a switchboard drive address), `reactor.drives` (whole list, e.g. `$map`),
|
|
458
459
|
* `reactor.drives[].remote.url` and `storage.dataDir` (`$env` only). Their z.input admits tokens, their z.output is the resolved type.
|
|
459
460
|
*/
|
|
461
|
+
/** A host's `name` keys its run record, `.ph/run/<name>.json`, so it must be
|
|
462
|
+
* one safe path segment. */
|
|
463
|
+
const HOST_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
464
|
+
const HOST_NAME_MAX_LENGTH = 128;
|
|
465
|
+
const HOST_NAME_MESSAGE = "A host name is used as a file name, so use only letters, digits, '.', '_' and '-', start with a letter or digit, and keep it to 128 characters.";
|
|
466
|
+
const hostNameSchema = z.string().min(1).max(128, HOST_NAME_MESSAGE).regex(HOST_NAME_PATTERN, HOST_NAME_MESSAGE);
|
|
467
|
+
/**
|
|
468
|
+
* A URL, or one written against the page origin (`${origin}/graphql`): the
|
|
469
|
+
* browser resolves the placeholder when it loads Connect's config, for a
|
|
470
|
+
* member whose own server proxies the switchboard's paths.
|
|
471
|
+
*/
|
|
472
|
+
const originOrUrlSchema = z.union([z.url(), z.string().refine(isOriginPlaceholderUrl, { message: "a URL, or ${origin}/<path> for a proxied sibling" })]);
|
|
460
473
|
const profileSchema = z.strictObject({
|
|
461
474
|
appId: z.string().min(1).optional(),
|
|
462
475
|
name: z.string().min(1).optional(),
|
|
@@ -539,11 +552,184 @@ const FORBID_TOKENS = {
|
|
|
539
552
|
any: (schema) => z.union([schema]),
|
|
540
553
|
env: (schema) => z.union([schema])
|
|
541
554
|
};
|
|
555
|
+
/** The replacement a non-drive `remote.url` message names. */
|
|
556
|
+
function useDriveUrl(host = "switchboard", member) {
|
|
557
|
+
return `remote: { url: ${host}.drives.<slug>.url } with ${host} from ../${host}/outputs.js, or remote: { url: { $output: { host: "${host}"${member ? `, member: "${member}"` : ""}, path: ["drives", "<slug>", "url"] } } }`;
|
|
558
|
+
}
|
|
559
|
+
/** The `$output` of a declared `remote.url` that reads `endpoints.graphql`. */
|
|
560
|
+
function endpointsGraphqlRef(url) {
|
|
561
|
+
if (typeof url !== "object" || url === null || !("$output" in url)) return;
|
|
562
|
+
const ref = url.$output;
|
|
563
|
+
if (typeof ref !== "object" || ref === null) return void 0;
|
|
564
|
+
const { host, member, path } = ref;
|
|
565
|
+
if (typeof host !== "string" || !Array.isArray(path)) return void 0;
|
|
566
|
+
if (path.join(".") !== "endpoints.graphql") return void 0;
|
|
567
|
+
return {
|
|
568
|
+
host,
|
|
569
|
+
...typeof member === "string" ? { member } : {}
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
/** The slug a drive link names: a `drives.<slug>.url` token's slug or a
|
|
573
|
+
* literal address's served slug; undefined when only runtime knows it. */
|
|
574
|
+
function linkedSlug(url) {
|
|
575
|
+
if (typeof url === "string") return switchboardOfDrive(url)?.slug;
|
|
576
|
+
const ref = typeof url === "object" && url !== null && "$output" in url ? url.$output : void 0;
|
|
577
|
+
const path = Array.isArray(ref?.path) ? ref.path : [];
|
|
578
|
+
return path.length === 3 && path[0] === "drives" && typeof path[1] === "string" && path[2] === "url" ? path[1] : void 0;
|
|
579
|
+
}
|
|
580
|
+
/** The drives a declared host names (home drives, `reactor.drives`, plugin
|
|
581
|
+
* `config.drive` links), or undefined when one is known only at runtime. */
|
|
582
|
+
function knownDriveSlugs(host) {
|
|
583
|
+
const reactor = host.reactor ?? {};
|
|
584
|
+
const slugs = [];
|
|
585
|
+
for (const backend of Object.values(reactor.backends ?? {})) {
|
|
586
|
+
if (backend.kind !== "remote") continue;
|
|
587
|
+
const slug = linkedSlug(backend.remote?.url);
|
|
588
|
+
if (slug === void 0) return void 0;
|
|
589
|
+
slugs.push(slug);
|
|
590
|
+
}
|
|
591
|
+
if (reactor.drives !== void 0) {
|
|
592
|
+
if (!Array.isArray(reactor.drives)) return void 0;
|
|
593
|
+
for (const drive of reactor.drives) if (typeof drive.slug === "string") slugs.push(drive.slug);
|
|
594
|
+
}
|
|
595
|
+
const plugins = Array.isArray(host.runner?.plugins) ? host.runner.plugins : [];
|
|
596
|
+
for (const entry of plugins) {
|
|
597
|
+
const config = typeof entry === "object" && entry !== null && "config" in entry ? entry.config : void 0;
|
|
598
|
+
if (typeof config !== "object" || config === null) continue;
|
|
599
|
+
if (!("drive" in config) || config.drive === void 0) continue;
|
|
600
|
+
const slug = linkedSlug(config.drive);
|
|
601
|
+
if (slug === void 0) return void 0;
|
|
602
|
+
slugs.push(slug);
|
|
603
|
+
}
|
|
604
|
+
return slugs;
|
|
605
|
+
}
|
|
606
|
+
/** Declared form, at host level so plugin drives are seen: a placement key
|
|
607
|
+
* must name a drive the host names, when every drive is knowable. A host
|
|
608
|
+
* with no remote backend is not checked: its plugins may contribute drives
|
|
609
|
+
* (a switchboard's workflows drive) that no field names. */
|
|
610
|
+
function refineDeclaredPlacementKeys(host, ctx) {
|
|
611
|
+
const placed = Object.keys(host.reactor?.placement?.drives ?? {});
|
|
612
|
+
if (placed.length === 0) return;
|
|
613
|
+
if (!Object.values(host.reactor?.backends ?? {}).some((b) => b.kind === "remote")) return;
|
|
614
|
+
const known = knownDriveSlugs(host);
|
|
615
|
+
if (!known) return;
|
|
616
|
+
const names = (slug, served) => served === slug || served.startsWith(`${slug}-`) && /^[0-9a-f]{8}$/.test(served.slice(slug.length + 1));
|
|
617
|
+
for (const slug of placed) {
|
|
618
|
+
if (known.some((served) => names(slug, served))) continue;
|
|
619
|
+
ctx.addIssue({
|
|
620
|
+
code: "custom",
|
|
621
|
+
path: [
|
|
622
|
+
"reactor",
|
|
623
|
+
"placement",
|
|
624
|
+
"drives",
|
|
625
|
+
slug
|
|
626
|
+
],
|
|
627
|
+
message: `placement.drives.${slug} names no drive this host links to or declares (${[...new Set(known)].join(", ") || "none"}).`
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
/** Resolved-form checks across backends, drives and placement: one base is
|
|
632
|
+
* one remote backend, and a drive placed on a remote is on its switchboard. */
|
|
633
|
+
function refineResolvedReactor(reactor, ctx) {
|
|
634
|
+
const backends = reactor.backends ?? {};
|
|
635
|
+
const baseOf = /* @__PURE__ */ new Map();
|
|
636
|
+
const byBase = /* @__PURE__ */ new Map();
|
|
637
|
+
const linked = /* @__PURE__ */ new Map();
|
|
638
|
+
const link = (slug, base) => linked.set(slug, (linked.get(slug) ?? /* @__PURE__ */ new Set()).add(base));
|
|
639
|
+
for (const [name, backend] of Object.entries(backends)) {
|
|
640
|
+
const url = backend.remote?.url;
|
|
641
|
+
if (backend.kind !== "remote" || typeof url !== "string") continue;
|
|
642
|
+
const home = switchboardOfDrive(url);
|
|
643
|
+
if (!home) continue;
|
|
644
|
+
baseOf.set(name, home.base);
|
|
645
|
+
link(home.slug, home.base);
|
|
646
|
+
const first = byBase.get(home.base);
|
|
647
|
+
if (first === void 0) {
|
|
648
|
+
byBase.set(home.base, name);
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
ctx.addIssue({
|
|
652
|
+
code: "custom",
|
|
653
|
+
path: [
|
|
654
|
+
"backends",
|
|
655
|
+
name,
|
|
656
|
+
"remote",
|
|
657
|
+
"url"
|
|
658
|
+
],
|
|
659
|
+
message: `backends "${first}" and "${name}" both open drives on the same switchboard (${home.base}). Keep "${first}", and list the second drive under reactor.drives with its remote.url instead.`
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
const kept = /* @__PURE__ */ new Set();
|
|
663
|
+
(Array.isArray(reactor.drives) ? reactor.drives : []).forEach((drive, index) => {
|
|
664
|
+
if (!drive.remote) {
|
|
665
|
+
kept.add(drive.slug);
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
const at = switchboardOfDrive(drive.remote.url);
|
|
669
|
+
if (at || drive.remote.url === "") {
|
|
670
|
+
if (at) link(drive.slug, at.base);
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
ctx.addIssue({
|
|
674
|
+
code: "custom",
|
|
675
|
+
path: [
|
|
676
|
+
"drives",
|
|
677
|
+
index,
|
|
678
|
+
"remote",
|
|
679
|
+
"url"
|
|
680
|
+
],
|
|
681
|
+
message: `remote.url must be a switchboard drive address (<switchboard>/d/<slug>), not ${drive.remote.url}: sync needs the drive. Use url: switchboard.drives.<slug>.url, or url: { $output: { host: "switchboard", path: ["drives", "<slug>", "url"] } }.`
|
|
682
|
+
});
|
|
683
|
+
});
|
|
684
|
+
const nameOf = (base) => byBase.get(base) ?? base;
|
|
685
|
+
for (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {
|
|
686
|
+
const at = [
|
|
687
|
+
"placement",
|
|
688
|
+
"drives",
|
|
689
|
+
slug
|
|
690
|
+
];
|
|
691
|
+
const on = [...linked.get(slug) ?? []];
|
|
692
|
+
if (on.length > 0 && kept.has(slug)) {
|
|
693
|
+
ctx.addIssue({
|
|
694
|
+
code: "custom",
|
|
695
|
+
path: at,
|
|
696
|
+
message: `Drive "${slug}" is both this reactor's own drive and on ${on.map(nameOf).join(" and ")}. Rename one, or link only one.`
|
|
697
|
+
});
|
|
698
|
+
continue;
|
|
699
|
+
}
|
|
700
|
+
if (on.length > 1) {
|
|
701
|
+
ctx.addIssue({
|
|
702
|
+
code: "custom",
|
|
703
|
+
path: at,
|
|
704
|
+
message: `Drive "${slug}" is on both ${on.map(nameOf).join(" and ")}. Rename one, or link only one.`
|
|
705
|
+
});
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
const base = baseOf.get(name);
|
|
709
|
+
if (base === void 0) continue;
|
|
710
|
+
if (on.length === 0) {
|
|
711
|
+
if (!kept.has(slug)) continue;
|
|
712
|
+
ctx.addIssue({
|
|
713
|
+
code: "custom",
|
|
714
|
+
path: at,
|
|
715
|
+
message: `placement.drives.${slug} opens drive "${slug}" on "${name}", but this reactor keeps that drive itself. Only a drive on a switchboard can open there without a copy.`
|
|
716
|
+
});
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
if (on[0] === base) continue;
|
|
720
|
+
ctx.addIssue({
|
|
721
|
+
code: "custom",
|
|
722
|
+
path: at,
|
|
723
|
+
message: `placement.drives.${slug} opens drive "${slug}" on "${name}" (${base}), but the drive is on ${on[0]}. Place it on the backend for that switchboard.`
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
}
|
|
542
727
|
/**
|
|
543
728
|
* Builds the host schema set. "allow" (declared form) accepts `T | Token` in
|
|
544
729
|
* every token-able field; "forbid" (resolved form) accepts `T` only.
|
|
545
730
|
*/
|
|
546
731
|
function buildHostSchemas(tokenField) {
|
|
732
|
+
const resolved = tokenField === FORBID_TOKENS;
|
|
547
733
|
const reactorBackendSchema = z.strictObject({
|
|
548
734
|
kind: reactorBackendKindSchema,
|
|
549
735
|
storage: z.strictObject({
|
|
@@ -564,12 +750,24 @@ function buildHostSchemas(tokenField) {
|
|
|
564
750
|
/** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */
|
|
565
751
|
dynamic: z.boolean().optional()
|
|
566
752
|
}).optional(),
|
|
567
|
-
remote: z.strictObject({ url: tokenField.any(
|
|
753
|
+
remote: z.strictObject({ url: tokenField.any(originOrUrlSchema) }).optional()
|
|
568
754
|
}).superRefine((backend, ctx) => {
|
|
569
755
|
if (backend.kind === "remote" && !backend.remote) ctx.addIssue({
|
|
570
756
|
code: "custom",
|
|
571
757
|
path: ["remote", "url"],
|
|
572
|
-
message:
|
|
758
|
+
message: `a "remote" backend needs remote.url, a switchboard drive address: ${useDriveUrl()}.`
|
|
759
|
+
});
|
|
760
|
+
const url = backend.remote?.url;
|
|
761
|
+
const graphqlRef = resolved ? void 0 : endpointsGraphqlRef(url);
|
|
762
|
+
if (graphqlRef) ctx.addIssue({
|
|
763
|
+
code: "custom",
|
|
764
|
+
path: ["remote", "url"],
|
|
765
|
+
message: `remote.url reads ${graphqlRef.host}'s endpoints.graphql; it must be a switchboard drive address (<switchboard>/d/<slug>): sync needs the drive. Use ${useDriveUrl(graphqlRef.host, graphqlRef.member)}.`
|
|
766
|
+
});
|
|
767
|
+
if (resolved && typeof url === "string" && !switchboardOfDrive(url)) ctx.addIssue({
|
|
768
|
+
code: "custom",
|
|
769
|
+
path: ["remote", "url"],
|
|
770
|
+
message: `remote.url must be a switchboard drive address (<switchboard>/d/<slug>), not ${url}: sync needs the drive. Use ${useDriveUrl()}.`
|
|
573
771
|
});
|
|
574
772
|
const store = backend.storage;
|
|
575
773
|
const storeDir = store?.kind === "path" ? store.dataDir : void 0;
|
|
@@ -582,7 +780,13 @@ function buildHostSchemas(tokenField) {
|
|
|
582
780
|
});
|
|
583
781
|
const reactorSchema = z.strictObject({
|
|
584
782
|
backends: z.record(z.string(), reactorBackendSchema).optional(),
|
|
585
|
-
placement: z.strictObject({
|
|
783
|
+
placement: z.strictObject({
|
|
784
|
+
primary: z.string().optional(),
|
|
785
|
+
/** Declared drive slug → backend name. A local backend keeps a
|
|
786
|
+
* synced copy; the drive's own remote backend opens it there with
|
|
787
|
+
* no copy. An unlisted drive keeps a synced copy. */
|
|
788
|
+
drives: z.record(z.string().min(1), z.string().min(1)).optional()
|
|
789
|
+
}).optional(),
|
|
586
790
|
protocol: reactorProtocolSchema.optional(),
|
|
587
791
|
/** DEPRECATED (dies in R2): workflows become a listed plugin. */
|
|
588
792
|
workflows: z.boolean().optional(),
|
|
@@ -593,6 +797,21 @@ function buildHostSchemas(tokenField) {
|
|
|
593
797
|
}).optional(),
|
|
594
798
|
namespace: z.string().min(1).optional(),
|
|
595
799
|
drives: tokenField.any(z.array(buildDriveDeclarationSchema(tokenField.any))).optional()
|
|
800
|
+
}).superRefine((reactor, ctx) => {
|
|
801
|
+
const backends = reactor.backends ?? {};
|
|
802
|
+
for (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {
|
|
803
|
+
if (Object.hasOwn(backends, name)) continue;
|
|
804
|
+
ctx.addIssue({
|
|
805
|
+
code: "custom",
|
|
806
|
+
path: [
|
|
807
|
+
"placement",
|
|
808
|
+
"drives",
|
|
809
|
+
slug
|
|
810
|
+
],
|
|
811
|
+
message: `placement.drives.${slug} names backend "${name}", which is not in backends (${Object.keys(backends).join(", ") || "none"}).`
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
if (resolved) refineResolvedReactor(reactor, ctx);
|
|
596
815
|
});
|
|
597
816
|
/** Common runner options; runner modules extend it with their own. */
|
|
598
817
|
const runnerBaseSchema = z.looseObject({
|
|
@@ -621,14 +840,14 @@ function buildHostSchemas(tokenField) {
|
|
|
621
840
|
childWrapperSchema,
|
|
622
841
|
childrenSchema,
|
|
623
842
|
reactorHostSchema: z.strictObject({
|
|
624
|
-
name:
|
|
843
|
+
name: hostNameSchema,
|
|
625
844
|
runner: runnerBaseSchema,
|
|
626
845
|
config: z.looseObject({}).optional(),
|
|
627
846
|
profile: profileSchema.optional(),
|
|
628
847
|
reactor: reactorSchema.optional()
|
|
629
848
|
}),
|
|
630
849
|
compoundHostSchema: z.strictObject({
|
|
631
|
-
name:
|
|
850
|
+
name: hostNameSchema,
|
|
632
851
|
runner: runnerBaseSchema,
|
|
633
852
|
children: childrenSchema,
|
|
634
853
|
config: z.looseObject({}).optional(),
|
|
@@ -647,6 +866,13 @@ function buildHostSchemas(tokenField) {
|
|
|
647
866
|
function makeHostSchemas(options) {
|
|
648
867
|
return buildHostSchemas(options.tokens === "allow" ? ALLOW_TOKENS : FORBID_TOKENS);
|
|
649
868
|
}
|
|
869
|
+
/** Adds the host-level placement key check to a runner's declared schema. */
|
|
870
|
+
function withPlacementKeys(schema) {
|
|
871
|
+
if (!(schema instanceof z.ZodType)) return schema;
|
|
872
|
+
return schema.superRefine((host, ctx) => {
|
|
873
|
+
if (typeof host === "object" && host !== null && "reactor" in host) refineDeclaredPlacementKeys(host, ctx);
|
|
874
|
+
});
|
|
875
|
+
}
|
|
650
876
|
/**
|
|
651
877
|
* One runner definition, two schemas (3.5): `build` runs over the DECLARED
|
|
652
878
|
* set (tokens allowed; its z.input types host files) and the RESOLVED set
|
|
@@ -657,7 +883,7 @@ function makeHostSchemas(options) {
|
|
|
657
883
|
*/
|
|
658
884
|
function defineHostSchemas(build) {
|
|
659
885
|
return {
|
|
660
|
-
declaredHostSchema: build(declaredSchemas),
|
|
886
|
+
declaredHostSchema: withPlacementKeys(build(declaredSchemas)),
|
|
661
887
|
hostSchema: build(resolvedSchemas)
|
|
662
888
|
};
|
|
663
889
|
}
|
|
@@ -1286,7 +1512,11 @@ function checkReactor(reactor, base, found) {
|
|
|
1286
1512
|
const producer = typeof host === "string" ? host : "switchboard";
|
|
1287
1513
|
found.push({
|
|
1288
1514
|
path: `${base}reactor.backends.${name}.remote.host`,
|
|
1289
|
-
message: `remote: { host } was removed; use remote: { url: ${producer}.
|
|
1515
|
+
message: `remote: { host } was removed; use a drive address: remote: { url: ${producer}.drives.<slug>.url } with ${producer} from ../${producer}/outputs.js, or remote: { url: ${outputToken(producer, [
|
|
1516
|
+
"drives",
|
|
1517
|
+
"<slug>",
|
|
1518
|
+
"url"
|
|
1519
|
+
])} }.`
|
|
1290
1520
|
});
|
|
1291
1521
|
}
|
|
1292
1522
|
}
|
|
@@ -1981,7 +2211,7 @@ function hostSchemaIssues(runner, schema, specifier, host, options = {}) {
|
|
|
1981
2211
|
schemaIssues: result.error.issues.map((issue) => {
|
|
1982
2212
|
const element = describeMapElements(host, issue.path);
|
|
1983
2213
|
const dotted = (issue.path.map(String).join(".") || "<root>") + (element ? ` (${element})` : "");
|
|
1984
|
-
const message = tokenKeyOf(valueAt(host, issue.path)) ? "this field does not take an output token (it is not token-able); spell the value literally." : issue.message;
|
|
2214
|
+
const message = issue.code !== "custom" && tokenKeyOf(valueAt(host, issue.path)) ? "this field does not take an output token (it is not token-able); spell the value literally." : issue.message;
|
|
1985
2215
|
return {
|
|
1986
2216
|
path: formatPath(issue.path.filter((key) => typeof key === "string" || typeof key === "number")),
|
|
1987
2217
|
message: element ? `${message} (${element})` : message,
|
|
@@ -2404,7 +2634,7 @@ const runRecordMemberSchema = z.strictObject({
|
|
|
2404
2634
|
});
|
|
2405
2635
|
const runRecordSchema = z.strictObject({
|
|
2406
2636
|
version: z.literal(2),
|
|
2407
|
-
host:
|
|
2637
|
+
host: hostNameSchema,
|
|
2408
2638
|
projectName: z.string(),
|
|
2409
2639
|
kind: runnerKindSchema,
|
|
2410
2640
|
verb: z.string().min(1),
|
|
@@ -2420,7 +2650,12 @@ const runRecordSchema = z.strictObject({
|
|
|
2420
2650
|
//#endregion
|
|
2421
2651
|
//#region src/run-record.ts
|
|
2422
2652
|
const runDir = (projectDir, env = process.env) => path.join(resolvePhDir(projectDir, env), "run");
|
|
2423
|
-
|
|
2653
|
+
function recordPath(projectDir, hostName, env) {
|
|
2654
|
+
const dir = runDir(projectDir, env);
|
|
2655
|
+
const file = path.resolve(dir, `${hostName}.json`);
|
|
2656
|
+
if (!hostNameSchema.safeParse(hostName).success || path.dirname(file) !== path.resolve(dir)) throw new Error(`"${hostName}" can't name a run record. ${HOST_NAME_MESSAGE}`);
|
|
2657
|
+
return file;
|
|
2658
|
+
}
|
|
2424
2659
|
function readRunRecord(projectDir, hostName, env = process.env) {
|
|
2425
2660
|
let raw;
|
|
2426
2661
|
try {
|
|
@@ -2868,6 +3103,6 @@ async function prepareMember(projectRoot, key, member) {
|
|
|
2868
3103
|
};
|
|
2869
3104
|
}
|
|
2870
3105
|
//#endregion
|
|
2871
|
-
export { resolveHostOutputs as $,
|
|
3106
|
+
export { resolveHostOutputs as $, envTokenSchema as $t, findNonStaticValue as A, defineHostSchemas as At, ONE_SHOT_VERBS as B, reactorHostSchema as Bt, writeRunRecord as C, pluginEntrySchema as Cn, HOST_NAME_PATTERN as Ct, OUTPUTS_FILE as D, runObserveHookSequential as Dn, compoundWiringSchema as Dt, HostLoadError as E, runObserveHook as En, compoundHostSchema as Et, probeHostsFolder as F, makeHostSchemas as Ft, kindShapeIssues as G, runnerKindSchema as Gt, getVerb as H, reactorSchema as Ht, readOutputsFileHash as I, originOrUrlSchema as It, resolveRunnerModule as J, drivesSchema as Jt, knownVerbIssues as K, buildDriveDeclarationSchema as Kt, scanHostImports as L, profileSchema as Lt, lintHostImports as M, emittedHostSchemas as Mt, lintOutputsFile as N, genericCompoundHostSchema as Nt, computeOutputsHash as O, runProvideHook as On, declaredGenericCompoundHostSchema as Ot, loadHost as P, hostNameSchema as Pt, describeMapElements as Q, concatTokenSchema as Qt, stripComments as R, reactorBackendKindSchema as Rt, readRunRecord as S, pluginEntryObjectSchema as Sn, HOST_NAME_MESSAGE as St, runRecordSchema as T, resolveOrder as Tn, childrenSchema as Tt, hostSchemaIssues as U, refineStartOrder as Ut, RunnerError as V, reactorProtocolSchema as Vt, isSchemaLike as W, runnerBaseSchema as Wt, validateHost as X, TOKEN_ESCAPE_KEY as Xt, validateDeclaredHost as Y, projectDriveIdWith as Yt, TokenResolutionError as Z, TOKEN_KEYS as Zt, clearRunRecord as _, entryActiveForVerb as _n, formatPath as _t, takesCspRegistrySync as a, keyTokenSchema as an, isBuiltinEnvName as at, probeRun as b, normalizePluginEntries as bn, unwrapEscapes as bt, compoundOutputSource as c, ref as cn, checkOutputPaths as ct, producerOutputsSchemas as d, tokenable as dn, outputRefsOf as dt, envTokenable as en, unsetEnvMessage as et, runRecordOutputSource as f, CONNECT_PLUGIN_OWNED_SLICES as fn, outputSitesOf as ft, applyChildWrapper as g, PluginError as gn, describeToken as gt, resolveUserDataPlaceholders as h, resolvePluginContributions as hn, collectTokenSites as ht, runCompound as i, itemTokenSchema as in, BUILTIN_ENV_NAMES as it, lintHostImportGraph as j, emitHostJsonSchema as jt, describeHostOutputs as k, runTransformHook as kn, declaredHostSchemas as kt, loadProducers as l, tokenKeyOf as ln, checkTokenSites as lt, defaultUserDataDir as m, resolveHostPlugins as mn, schemaAtPath as mt, memberVerbOf as n, forbidRef as nn, memberForRef as nt, runnerHandleSchema as o, mapTokenSchema as on, substituteBuiltinEnv as ot, runnerOutputsSchema as p, findDeadConnectConfig as pn, refKey as pt, listVerbs as q, driveDeclarationSchema as qt, prepareMember as r, isToken as rn, planCompound as rt, toStartedHandle as s, outputTokenSchema as sn, findRemovedForms as st, compoundStartVerb as t, findToken as tn, PlanError as tt, processResolveEnv as u, tokenSchema as un, envSitesOf as ut, isPidAlive as v, hostTypeSatisfies as vn, isPlainObject as vt, runRecordMemberSchema as w, registerHostType as wn, childWrapperSchema as wt, readProjectName as x, normalizePluginEntry as xn, HOST_NAME_MAX_LENGTH as xt, listRunRecords as y, mergeContributions as yn, renderTokens as yt, CONNECT_RUNNER as z, reactorBackendSchema as zt };
|
|
2872
3107
|
|
|
2873
|
-
//# sourceMappingURL=compound-
|
|
3108
|
+
//# sourceMappingURL=compound-C7GuPnTP.mjs.map
|