@powerhousedao/host-core 6.2.3-dev.79 → 6.2.3-dev.81
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
|
@@ -9,9 +9,21 @@ import { ArrayMapToken, ConcatToken, EnvToken, ItemToken, KeyToken, MapToken, Ou
|
|
|
9
9
|
* `config` is runner-defined.
|
|
10
10
|
*
|
|
11
11
|
* Token-able fields (typed-host-configs 3.5): `reactor.backends.*.remote.url`
|
|
12
|
-
* (required), `reactor.drives` (whole list, e.g. `$map`),
|
|
12
|
+
* (required, a switchboard drive address), `reactor.drives` (whole list, e.g. `$map`),
|
|
13
13
|
* `reactor.drives[].remote.url` and `storage.dataDir` (`$env` only). Their z.input admits tokens, their z.output is the resolved type.
|
|
14
14
|
*/
|
|
15
|
+
/** A host's `name` keys its run record, `.ph/run/<name>.json`, so it must be
|
|
16
|
+
* one safe path segment. */
|
|
17
|
+
declare const HOST_NAME_PATTERN: RegExp;
|
|
18
|
+
declare const HOST_NAME_MAX_LENGTH = 128;
|
|
19
|
+
declare 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.";
|
|
20
|
+
declare const hostNameSchema: z.ZodString;
|
|
21
|
+
/**
|
|
22
|
+
* A URL, or one written against the page origin (`${origin}/graphql`): the
|
|
23
|
+
* browser resolves the placeholder when it loads Connect's config, for a
|
|
24
|
+
* member whose own server proxies the switchboard's paths.
|
|
25
|
+
*/
|
|
26
|
+
declare const originOrUrlSchema: z.ZodUnion<readonly [z.ZodURL, z.ZodString]>;
|
|
15
27
|
declare const profileSchema: z.ZodObject<{
|
|
16
28
|
appId: z.ZodOptional<z.ZodString>;
|
|
17
29
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -95,7 +107,7 @@ declare function buildHostSchemas(tokenField: FieldWrappers): {
|
|
|
95
107
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
96
108
|
}, z.core.$strict>>;
|
|
97
109
|
remote: z.ZodOptional<z.ZodObject<{
|
|
98
|
-
url: TokenableSchema<z.ZodURL
|
|
110
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
99
111
|
}, z.core.$strict>>;
|
|
100
112
|
}, z.core.$strict>;
|
|
101
113
|
reactorSchema: z.ZodObject<{
|
|
@@ -124,11 +136,12 @@ declare function buildHostSchemas(tokenField: FieldWrappers): {
|
|
|
124
136
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
125
137
|
}, z.core.$strict>>;
|
|
126
138
|
remote: z.ZodOptional<z.ZodObject<{
|
|
127
|
-
url: TokenableSchema<z.ZodURL
|
|
139
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
128
140
|
}, z.core.$strict>>;
|
|
129
141
|
}, z.core.$strict>>>;
|
|
130
142
|
placement: z.ZodOptional<z.ZodObject<{
|
|
131
143
|
primary: z.ZodOptional<z.ZodString>;
|
|
144
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
132
145
|
}, z.core.$strict>>;
|
|
133
146
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
134
147
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -224,11 +237,12 @@ declare function buildHostSchemas(tokenField: FieldWrappers): {
|
|
|
224
237
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
225
238
|
}, z.core.$strict>>;
|
|
226
239
|
remote: z.ZodOptional<z.ZodObject<{
|
|
227
|
-
url: TokenableSchema<z.ZodURL
|
|
240
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
228
241
|
}, z.core.$strict>>;
|
|
229
242
|
}, z.core.$strict>>>;
|
|
230
243
|
placement: z.ZodOptional<z.ZodObject<{
|
|
231
244
|
primary: z.ZodOptional<z.ZodString>;
|
|
245
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
232
246
|
}, z.core.$strict>>;
|
|
233
247
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
234
248
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -313,11 +327,12 @@ declare function buildHostSchemas(tokenField: FieldWrappers): {
|
|
|
313
327
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
314
328
|
}, z.core.$strict>>;
|
|
315
329
|
remote: z.ZodOptional<z.ZodObject<{
|
|
316
|
-
url: TokenableSchema<z.ZodURL
|
|
330
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
317
331
|
}, z.core.$strict>>;
|
|
318
332
|
}, z.core.$strict>>>;
|
|
319
333
|
placement: z.ZodOptional<z.ZodObject<{
|
|
320
334
|
primary: z.ZodOptional<z.ZodString>;
|
|
335
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
321
336
|
}, z.core.$strict>>;
|
|
322
337
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
323
338
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -408,11 +423,12 @@ declare function buildHostSchemas(tokenField: FieldWrappers): {
|
|
|
408
423
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
409
424
|
}, z.core.$strict>>;
|
|
410
425
|
remote: z.ZodOptional<z.ZodObject<{
|
|
411
|
-
url: TokenableSchema<z.ZodURL
|
|
426
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
412
427
|
}, z.core.$strict>>;
|
|
413
428
|
}, z.core.$strict>>>;
|
|
414
429
|
placement: z.ZodOptional<z.ZodObject<{
|
|
415
430
|
primary: z.ZodOptional<z.ZodString>;
|
|
431
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
416
432
|
}, z.core.$strict>>;
|
|
417
433
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
418
434
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -511,11 +527,12 @@ declare function buildHostSchemas(tokenField: FieldWrappers): {
|
|
|
511
527
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
512
528
|
}, z.core.$strict>>;
|
|
513
529
|
remote: z.ZodOptional<z.ZodObject<{
|
|
514
|
-
url: TokenableSchema<z.ZodURL
|
|
530
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
515
531
|
}, z.core.$strict>>;
|
|
516
532
|
}, z.core.$strict>>>;
|
|
517
533
|
placement: z.ZodOptional<z.ZodObject<{
|
|
518
534
|
primary: z.ZodOptional<z.ZodString>;
|
|
535
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
519
536
|
}, z.core.$strict>>;
|
|
520
537
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
521
538
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -618,7 +635,7 @@ declare const declaredSchemas: {
|
|
|
618
635
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
619
636
|
}, z.core.$strict>>;
|
|
620
637
|
remote: z.ZodOptional<z.ZodObject<{
|
|
621
|
-
url: TokenableSchema<z.ZodURL
|
|
638
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
622
639
|
}, z.core.$strict>>;
|
|
623
640
|
}, z.core.$strict>;
|
|
624
641
|
reactorSchema: z.ZodObject<{
|
|
@@ -647,11 +664,12 @@ declare const declaredSchemas: {
|
|
|
647
664
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
648
665
|
}, z.core.$strict>>;
|
|
649
666
|
remote: z.ZodOptional<z.ZodObject<{
|
|
650
|
-
url: TokenableSchema<z.ZodURL
|
|
667
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
651
668
|
}, z.core.$strict>>;
|
|
652
669
|
}, z.core.$strict>>>;
|
|
653
670
|
placement: z.ZodOptional<z.ZodObject<{
|
|
654
671
|
primary: z.ZodOptional<z.ZodString>;
|
|
672
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
655
673
|
}, z.core.$strict>>;
|
|
656
674
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
657
675
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -747,11 +765,12 @@ declare const declaredSchemas: {
|
|
|
747
765
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
748
766
|
}, z.core.$strict>>;
|
|
749
767
|
remote: z.ZodOptional<z.ZodObject<{
|
|
750
|
-
url: TokenableSchema<z.ZodURL
|
|
768
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
751
769
|
}, z.core.$strict>>;
|
|
752
770
|
}, z.core.$strict>>>;
|
|
753
771
|
placement: z.ZodOptional<z.ZodObject<{
|
|
754
772
|
primary: z.ZodOptional<z.ZodString>;
|
|
773
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
755
774
|
}, z.core.$strict>>;
|
|
756
775
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
757
776
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -836,11 +855,12 @@ declare const declaredSchemas: {
|
|
|
836
855
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
837
856
|
}, z.core.$strict>>;
|
|
838
857
|
remote: z.ZodOptional<z.ZodObject<{
|
|
839
|
-
url: TokenableSchema<z.ZodURL
|
|
858
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
840
859
|
}, z.core.$strict>>;
|
|
841
860
|
}, z.core.$strict>>>;
|
|
842
861
|
placement: z.ZodOptional<z.ZodObject<{
|
|
843
862
|
primary: z.ZodOptional<z.ZodString>;
|
|
863
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
844
864
|
}, z.core.$strict>>;
|
|
845
865
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
846
866
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -931,11 +951,12 @@ declare const declaredSchemas: {
|
|
|
931
951
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
932
952
|
}, z.core.$strict>>;
|
|
933
953
|
remote: z.ZodOptional<z.ZodObject<{
|
|
934
|
-
url: TokenableSchema<z.ZodURL
|
|
954
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
935
955
|
}, z.core.$strict>>;
|
|
936
956
|
}, z.core.$strict>>>;
|
|
937
957
|
placement: z.ZodOptional<z.ZodObject<{
|
|
938
958
|
primary: z.ZodOptional<z.ZodString>;
|
|
959
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
939
960
|
}, z.core.$strict>>;
|
|
940
961
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
941
962
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1034,11 +1055,12 @@ declare const declaredSchemas: {
|
|
|
1034
1055
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1035
1056
|
}, z.core.$strict>>;
|
|
1036
1057
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1037
|
-
url: TokenableSchema<z.ZodURL
|
|
1058
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1038
1059
|
}, z.core.$strict>>;
|
|
1039
1060
|
}, z.core.$strict>>>;
|
|
1040
1061
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1041
1062
|
primary: z.ZodOptional<z.ZodString>;
|
|
1063
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1042
1064
|
}, z.core.$strict>>;
|
|
1043
1065
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1044
1066
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1123,7 +1145,7 @@ declare const reactorBackendSchema: z.ZodObject<{
|
|
|
1123
1145
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1124
1146
|
}, z.core.$strict>>;
|
|
1125
1147
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1126
|
-
url: TokenableSchema<z.ZodURL
|
|
1148
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1127
1149
|
}, z.core.$strict>>;
|
|
1128
1150
|
}, z.core.$strict>;
|
|
1129
1151
|
declare const reactorSchema: z.ZodObject<{
|
|
@@ -1152,11 +1174,12 @@ declare const reactorSchema: z.ZodObject<{
|
|
|
1152
1174
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1153
1175
|
}, z.core.$strict>>;
|
|
1154
1176
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1155
|
-
url: TokenableSchema<z.ZodURL
|
|
1177
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1156
1178
|
}, z.core.$strict>>;
|
|
1157
1179
|
}, z.core.$strict>>>;
|
|
1158
1180
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1159
1181
|
primary: z.ZodOptional<z.ZodString>;
|
|
1182
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1160
1183
|
}, z.core.$strict>>;
|
|
1161
1184
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1162
1185
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1252,11 +1275,12 @@ declare const childWrapperSchema: z.ZodObject<{
|
|
|
1252
1275
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1253
1276
|
}, z.core.$strict>>;
|
|
1254
1277
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1255
|
-
url: TokenableSchema<z.ZodURL
|
|
1278
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1256
1279
|
}, z.core.$strict>>;
|
|
1257
1280
|
}, z.core.$strict>>>;
|
|
1258
1281
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1259
1282
|
primary: z.ZodOptional<z.ZodString>;
|
|
1283
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1260
1284
|
}, z.core.$strict>>;
|
|
1261
1285
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1262
1286
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1341,11 +1365,12 @@ declare const childrenSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
1341
1365
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1342
1366
|
}, z.core.$strict>>;
|
|
1343
1367
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1344
|
-
url: TokenableSchema<z.ZodURL
|
|
1368
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1345
1369
|
}, z.core.$strict>>;
|
|
1346
1370
|
}, z.core.$strict>>>;
|
|
1347
1371
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1348
1372
|
primary: z.ZodOptional<z.ZodString>;
|
|
1373
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1349
1374
|
}, z.core.$strict>>;
|
|
1350
1375
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1351
1376
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1436,11 +1461,12 @@ declare const reactorHostSchema: z.ZodObject<{
|
|
|
1436
1461
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1437
1462
|
}, z.core.$strict>>;
|
|
1438
1463
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1439
|
-
url: TokenableSchema<z.ZodURL
|
|
1464
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1440
1465
|
}, z.core.$strict>>;
|
|
1441
1466
|
}, z.core.$strict>>>;
|
|
1442
1467
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1443
1468
|
primary: z.ZodOptional<z.ZodString>;
|
|
1469
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1444
1470
|
}, z.core.$strict>>;
|
|
1445
1471
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1446
1472
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1539,11 +1565,12 @@ declare const compoundHostSchema: z.ZodObject<{
|
|
|
1539
1565
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1540
1566
|
}, z.core.$strict>>;
|
|
1541
1567
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1542
|
-
url: TokenableSchema<z.ZodURL
|
|
1568
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1543
1569
|
}, z.core.$strict>>;
|
|
1544
1570
|
}, z.core.$strict>>>;
|
|
1545
1571
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1546
1572
|
primary: z.ZodOptional<z.ZodString>;
|
|
1573
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1547
1574
|
}, z.core.$strict>>;
|
|
1548
1575
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1549
1576
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1650,11 +1677,12 @@ declare const genericCompoundHostSchema: z.ZodObject<{
|
|
|
1650
1677
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1651
1678
|
}, z.core.$strict>>;
|
|
1652
1679
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1653
|
-
url: TokenableSchema<z.ZodURL
|
|
1680
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1654
1681
|
}, z.core.$strict>>;
|
|
1655
1682
|
}, z.core.$strict>>>;
|
|
1656
1683
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1657
1684
|
primary: z.ZodOptional<z.ZodString>;
|
|
1685
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1658
1686
|
}, z.core.$strict>>;
|
|
1659
1687
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1660
1688
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1765,11 +1793,12 @@ declare const declaredGenericCompoundHostSchema: z.ZodObject<{
|
|
|
1765
1793
|
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1766
1794
|
}, z.core.$strict>>;
|
|
1767
1795
|
remote: z.ZodOptional<z.ZodObject<{
|
|
1768
|
-
url: TokenableSchema<z.ZodURL
|
|
1796
|
+
url: TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
|
|
1769
1797
|
}, z.core.$strict>>;
|
|
1770
1798
|
}, z.core.$strict>>>;
|
|
1771
1799
|
placement: z.ZodOptional<z.ZodObject<{
|
|
1772
1800
|
primary: z.ZodOptional<z.ZodString>;
|
|
1801
|
+
drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1773
1802
|
}, z.core.$strict>>;
|
|
1774
1803
|
protocol: z.ZodOptional<z.ZodObject<{
|
|
1775
1804
|
featureFlags: z.ZodOptional<z.ZodObject<{
|
|
@@ -1948,6 +1977,7 @@ type RunnerVerb<O = unknown> = (host: O, ctx: RunnerContext) => Promise<unknown>
|
|
|
1948
1977
|
interface HostSchemaIssue {
|
|
1949
1978
|
path: PropertyKey[];
|
|
1950
1979
|
message: string;
|
|
1980
|
+
code?: string;
|
|
1951
1981
|
}
|
|
1952
1982
|
/** zod-shaped structurally, so a runner may bring its own zod instance. */
|
|
1953
1983
|
interface HostSchemaLike<O = unknown> {
|
|
@@ -2156,6 +2186,6 @@ interface RunCompoundResult {
|
|
|
2156
2186
|
}
|
|
2157
2187
|
declare function runCompound(hostInput: HostDefinition, ctx: RunnerContext, options: RunCompoundOptions): Promise<RunCompoundResult>;
|
|
2158
2188
|
//#endregion
|
|
2159
|
-
export {
|
|
2189
|
+
export { HostSchemas as $, envTokenSchema as $t, knownVerbIssues as A, reactorSchema as At, envSitesOf as B, OutputPath as Bt, RunnerVerb as C, makeHostSchemas as Ct, hostSchemaIssues as D, reactorBackendSchema as Dt, getVerb as E, reactorBackendKindSchema as Et, DeclaredIssue as F, ConcatToken as Ft, ChildWrapper as G, TOKEN_KEYS as Gt, outputSitesOf as H, RecordMapToken as Ht, OutputRef as I, EnvToken as It, CompoundWiring as J, TokenFor as Jt, CompoundHost as K, Template as Kt, OutputsSchemaLookup as L, ItemToken as Lt, resolveRunnerModule as M, runnerBaseSchema as Mt, validateDeclaredHost as N, runnerKindSchema as Nt, isSchemaLike as O, reactorHostSchema as Ot, validateHost as P, ArrayMapToken as Pt, HostDefinition as Q, concatTokenSchema as Qt, checkOutputPaths as R, KeyToken as Rt, RunnerModule as S, hostNameSchema as St, ValidateHostOptions as T, profileSchema as Tt, refKey as U, RefFn as Ut, outputRefsOf as V, OutputToken as Vt, schemaAtPath as W, TOKEN_ESCAPE_KEY as Wt, HOST_NAME_MESSAGE as X, TokenMode as Xt, HOST_NAME_MAX_LENGTH as Y, TokenKey as Yt, HOST_NAME_PATTERN as Z, TokenableSchema as Zt, HostSchemaLike as _, declaredHostSchemas as _t, RunnerHandleData as a, keyTokenSchema as an, ReactorHostInput as at, RunnerError as b, emittedHostSchemas as bt, toStartedHandle as c, ref as cn, ReactorRemoteConfig as ct, BootCheckContext as d, tokenable as dn, RunnerKind as dt, envTokenable as en, Profile as et, BootIssue as f, childWrapperSchema as ft, HostSchemaIssues as g, declaredGenericCompoundHostSchema as gt, HostSchemaIssue as h, compoundWiringSchema as ht, RunnerHandle as i, itemTokenSchema as in, ReactorHost as it, listVerbs as j, refineStartOrder as jt, kindShapeIssues as k, reactorProtocolSchema as kt, MemberDraft as l, tokenKeyOf as ln, ReactorStorageConfig as lt, DeclaredHostOptions as m, compoundHostSchema as mt, RunCompoundResult as n, forbidRef as nn, ReactorBackendKind as nt, StartedHandle as o, mapTokenSchema as on, ReactorPackageConfig as ot, CONNECT_RUNNER as p, childrenSchema as pt, CompoundHostInput as q, Token as qt, runCompound as r, isToken as rn, ReactorConfig as rt, runnerHandleSchema as s, outputTokenSchema as sn, ReactorProtocol as st, RunCompoundOptions as t, findToken as tn, ReactorBackend as tt, applyChildWrapper as u, tokenSchema as un, RunnerBase as ut, ONE_SHOT_VERBS as v, defineHostSchemas as vt, SchemaIssue as w, originOrUrlSchema as wt, RunnerIssue as x, genericCompoundHostSchema as xt, RunnerContext as y, emitHostJsonSchema as yt, checkTokenSites as z, MapToken as zt };
|
|
2160
2190
|
export {};
|
|
2161
|
-
//# sourceMappingURL=compound-
|
|
2191
|
+
//# sourceMappingURL=compound-fPleFc-P.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compound-fPleFc-P.d.mts","names":[],"sources":["../src/host-schemas.ts","../src/resolve/declared.ts","../src/runner-resolver.ts","../src/child-wrapper.ts","../src/runner-handle.ts","../src/compound.ts"],"mappings":";;;;;;;;;;;;;;;;cA2Ba,mBAAiB;cACjB;cACA;cAEA,gBAAc,EAAA;;;;;;cAWd,mBAAiB,EAAA,mBAAA,EAAA,QAAA,EAAA;cAOjB,eAAa,EAAA;;;;;GAKxB,EAAA,KAAA;cAEW,uBAAqB,EAAA;;;;;;;;;;;;;;;GAWhC,EAAA,KAAA;cAEW,kBAAgB,EAAA;;;;KACjB,aAAa,EAAE,aAAa;cAE3B,0BAAwB,EAAA;;;;;;;;cAiBxB,sBAAoB,EAAA;;;;GAY/B,EAAA,KAAA;;;;iBAKc,iBACd;EAAQ,UAAU;EAAyB,SAAS;GACpD,KAAK,EAAE;;;UAyBC;EACR,MAAM,UAAU,EAAE,SAAS,QAAQ,MAAM,gBAAgB;EACzD,MAAM,UAAU,EAAE,SAAS,QAAQ,MAAM,gBAAgB,GAAG;;;;;;iBAwOrD,iBAAiB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;UCYtD;EACR;EACA,QAAQ;EACR;EACA,MAAM;EACN;EACA,QAAQ;;;EAGR,SAAS;;UAiCM;;EAEf;;EAEA,cAAc;;;EAGd;;EAEA,QAAQ;;UAGO;EACf,SAAS;;;EAGT,gBAAgB;;;;EAIhB,eAAe,iCAAiC;;iBAsB5B,YACpB,WAAW,gBACX,KAAK,eACL,SAAS,qBACR,QAAQ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pluginEntrySchema } from "./plugins.mjs";
|
|
2
|
+
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";
|
|
3
|
+
import { isOriginPlaceholderUrl } from "@powerhousedao/shared/connect/origin-placeholder";
|
|
2
4
|
import { z } from "zod";
|
|
3
|
-
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";
|
|
4
5
|
//#region src/drive-schema.ts
|
|
5
6
|
/**
|
|
6
7
|
* The schema half of drives.ts, zod only so `./schema` stays neutral.
|
|
@@ -51,9 +52,21 @@ function projectDriveIdWith(sha256Hex, projectRoot, slug) {
|
|
|
51
52
|
* `config` is runner-defined.
|
|
52
53
|
*
|
|
53
54
|
* Token-able fields (typed-host-configs 3.5): `reactor.backends.*.remote.url`
|
|
54
|
-
* (required), `reactor.drives` (whole list, e.g. `$map`),
|
|
55
|
+
* (required, a switchboard drive address), `reactor.drives` (whole list, e.g. `$map`),
|
|
55
56
|
* `reactor.drives[].remote.url` and `storage.dataDir` (`$env` only). Their z.input admits tokens, their z.output is the resolved type.
|
|
56
57
|
*/
|
|
58
|
+
/** A host's `name` keys its run record, `.ph/run/<name>.json`, so it must be
|
|
59
|
+
* one safe path segment. */
|
|
60
|
+
const HOST_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
61
|
+
const HOST_NAME_MAX_LENGTH = 128;
|
|
62
|
+
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.";
|
|
63
|
+
const hostNameSchema = z.string().min(1).max(128, HOST_NAME_MESSAGE).regex(HOST_NAME_PATTERN, HOST_NAME_MESSAGE);
|
|
64
|
+
/**
|
|
65
|
+
* A URL, or one written against the page origin (`${origin}/graphql`): the
|
|
66
|
+
* browser resolves the placeholder when it loads Connect's config, for a
|
|
67
|
+
* member whose own server proxies the switchboard's paths.
|
|
68
|
+
*/
|
|
69
|
+
const originOrUrlSchema = z.union([z.url(), z.string().refine(isOriginPlaceholderUrl, { message: "a URL, or ${origin}/<path> for a proxied sibling" })]);
|
|
57
70
|
const profileSchema = z.strictObject({
|
|
58
71
|
appId: z.string().min(1).optional(),
|
|
59
72
|
name: z.string().min(1).optional(),
|
|
@@ -136,11 +149,184 @@ const FORBID_TOKENS = {
|
|
|
136
149
|
any: (schema) => z.union([schema]),
|
|
137
150
|
env: (schema) => z.union([schema])
|
|
138
151
|
};
|
|
152
|
+
/** The replacement a non-drive `remote.url` message names. */
|
|
153
|
+
function useDriveUrl(host = "switchboard", member) {
|
|
154
|
+
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"] } } }`;
|
|
155
|
+
}
|
|
156
|
+
/** The `$output` of a declared `remote.url` that reads `endpoints.graphql`. */
|
|
157
|
+
function endpointsGraphqlRef(url) {
|
|
158
|
+
if (typeof url !== "object" || url === null || !("$output" in url)) return;
|
|
159
|
+
const ref = url.$output;
|
|
160
|
+
if (typeof ref !== "object" || ref === null) return void 0;
|
|
161
|
+
const { host, member, path } = ref;
|
|
162
|
+
if (typeof host !== "string" || !Array.isArray(path)) return void 0;
|
|
163
|
+
if (path.join(".") !== "endpoints.graphql") return void 0;
|
|
164
|
+
return {
|
|
165
|
+
host,
|
|
166
|
+
...typeof member === "string" ? { member } : {}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/** The slug a drive link names: a `drives.<slug>.url` token's slug or a
|
|
170
|
+
* literal address's served slug; undefined when only runtime knows it. */
|
|
171
|
+
function linkedSlug(url) {
|
|
172
|
+
if (typeof url === "string") return switchboardOfDrive(url)?.slug;
|
|
173
|
+
const ref = typeof url === "object" && url !== null && "$output" in url ? url.$output : void 0;
|
|
174
|
+
const path = Array.isArray(ref?.path) ? ref.path : [];
|
|
175
|
+
return path.length === 3 && path[0] === "drives" && typeof path[1] === "string" && path[2] === "url" ? path[1] : void 0;
|
|
176
|
+
}
|
|
177
|
+
/** The drives a declared host names (home drives, `reactor.drives`, plugin
|
|
178
|
+
* `config.drive` links), or undefined when one is known only at runtime. */
|
|
179
|
+
function knownDriveSlugs(host) {
|
|
180
|
+
const reactor = host.reactor ?? {};
|
|
181
|
+
const slugs = [];
|
|
182
|
+
for (const backend of Object.values(reactor.backends ?? {})) {
|
|
183
|
+
if (backend.kind !== "remote") continue;
|
|
184
|
+
const slug = linkedSlug(backend.remote?.url);
|
|
185
|
+
if (slug === void 0) return void 0;
|
|
186
|
+
slugs.push(slug);
|
|
187
|
+
}
|
|
188
|
+
if (reactor.drives !== void 0) {
|
|
189
|
+
if (!Array.isArray(reactor.drives)) return void 0;
|
|
190
|
+
for (const drive of reactor.drives) if (typeof drive.slug === "string") slugs.push(drive.slug);
|
|
191
|
+
}
|
|
192
|
+
const plugins = Array.isArray(host.runner?.plugins) ? host.runner.plugins : [];
|
|
193
|
+
for (const entry of plugins) {
|
|
194
|
+
const config = typeof entry === "object" && entry !== null && "config" in entry ? entry.config : void 0;
|
|
195
|
+
if (typeof config !== "object" || config === null) continue;
|
|
196
|
+
if (!("drive" in config) || config.drive === void 0) continue;
|
|
197
|
+
const slug = linkedSlug(config.drive);
|
|
198
|
+
if (slug === void 0) return void 0;
|
|
199
|
+
slugs.push(slug);
|
|
200
|
+
}
|
|
201
|
+
return slugs;
|
|
202
|
+
}
|
|
203
|
+
/** Declared form, at host level so plugin drives are seen: a placement key
|
|
204
|
+
* must name a drive the host names, when every drive is knowable. A host
|
|
205
|
+
* with no remote backend is not checked: its plugins may contribute drives
|
|
206
|
+
* (a switchboard's workflows drive) that no field names. */
|
|
207
|
+
function refineDeclaredPlacementKeys(host, ctx) {
|
|
208
|
+
const placed = Object.keys(host.reactor?.placement?.drives ?? {});
|
|
209
|
+
if (placed.length === 0) return;
|
|
210
|
+
if (!Object.values(host.reactor?.backends ?? {}).some((b) => b.kind === "remote")) return;
|
|
211
|
+
const known = knownDriveSlugs(host);
|
|
212
|
+
if (!known) return;
|
|
213
|
+
const names = (slug, served) => served === slug || served.startsWith(`${slug}-`) && /^[0-9a-f]{8}$/.test(served.slice(slug.length + 1));
|
|
214
|
+
for (const slug of placed) {
|
|
215
|
+
if (known.some((served) => names(slug, served))) continue;
|
|
216
|
+
ctx.addIssue({
|
|
217
|
+
code: "custom",
|
|
218
|
+
path: [
|
|
219
|
+
"reactor",
|
|
220
|
+
"placement",
|
|
221
|
+
"drives",
|
|
222
|
+
slug
|
|
223
|
+
],
|
|
224
|
+
message: `placement.drives.${slug} names no drive this host links to or declares (${[...new Set(known)].join(", ") || "none"}).`
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/** Resolved-form checks across backends, drives and placement: one base is
|
|
229
|
+
* one remote backend, and a drive placed on a remote is on its switchboard. */
|
|
230
|
+
function refineResolvedReactor(reactor, ctx) {
|
|
231
|
+
const backends = reactor.backends ?? {};
|
|
232
|
+
const baseOf = /* @__PURE__ */ new Map();
|
|
233
|
+
const byBase = /* @__PURE__ */ new Map();
|
|
234
|
+
const linked = /* @__PURE__ */ new Map();
|
|
235
|
+
const link = (slug, base) => linked.set(slug, (linked.get(slug) ?? /* @__PURE__ */ new Set()).add(base));
|
|
236
|
+
for (const [name, backend] of Object.entries(backends)) {
|
|
237
|
+
const url = backend.remote?.url;
|
|
238
|
+
if (backend.kind !== "remote" || typeof url !== "string") continue;
|
|
239
|
+
const home = switchboardOfDrive(url);
|
|
240
|
+
if (!home) continue;
|
|
241
|
+
baseOf.set(name, home.base);
|
|
242
|
+
link(home.slug, home.base);
|
|
243
|
+
const first = byBase.get(home.base);
|
|
244
|
+
if (first === void 0) {
|
|
245
|
+
byBase.set(home.base, name);
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
ctx.addIssue({
|
|
249
|
+
code: "custom",
|
|
250
|
+
path: [
|
|
251
|
+
"backends",
|
|
252
|
+
name,
|
|
253
|
+
"remote",
|
|
254
|
+
"url"
|
|
255
|
+
],
|
|
256
|
+
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.`
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
const kept = /* @__PURE__ */ new Set();
|
|
260
|
+
(Array.isArray(reactor.drives) ? reactor.drives : []).forEach((drive, index) => {
|
|
261
|
+
if (!drive.remote) {
|
|
262
|
+
kept.add(drive.slug);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const at = switchboardOfDrive(drive.remote.url);
|
|
266
|
+
if (at || drive.remote.url === "") {
|
|
267
|
+
if (at) link(drive.slug, at.base);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
ctx.addIssue({
|
|
271
|
+
code: "custom",
|
|
272
|
+
path: [
|
|
273
|
+
"drives",
|
|
274
|
+
index,
|
|
275
|
+
"remote",
|
|
276
|
+
"url"
|
|
277
|
+
],
|
|
278
|
+
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"] } }.`
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
const nameOf = (base) => byBase.get(base) ?? base;
|
|
282
|
+
for (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {
|
|
283
|
+
const at = [
|
|
284
|
+
"placement",
|
|
285
|
+
"drives",
|
|
286
|
+
slug
|
|
287
|
+
];
|
|
288
|
+
const on = [...linked.get(slug) ?? []];
|
|
289
|
+
if (on.length > 0 && kept.has(slug)) {
|
|
290
|
+
ctx.addIssue({
|
|
291
|
+
code: "custom",
|
|
292
|
+
path: at,
|
|
293
|
+
message: `Drive "${slug}" is both this reactor's own drive and on ${on.map(nameOf).join(" and ")}. Rename one, or link only one.`
|
|
294
|
+
});
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (on.length > 1) {
|
|
298
|
+
ctx.addIssue({
|
|
299
|
+
code: "custom",
|
|
300
|
+
path: at,
|
|
301
|
+
message: `Drive "${slug}" is on both ${on.map(nameOf).join(" and ")}. Rename one, or link only one.`
|
|
302
|
+
});
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
const base = baseOf.get(name);
|
|
306
|
+
if (base === void 0) continue;
|
|
307
|
+
if (on.length === 0) {
|
|
308
|
+
if (!kept.has(slug)) continue;
|
|
309
|
+
ctx.addIssue({
|
|
310
|
+
code: "custom",
|
|
311
|
+
path: at,
|
|
312
|
+
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.`
|
|
313
|
+
});
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
if (on[0] === base) continue;
|
|
317
|
+
ctx.addIssue({
|
|
318
|
+
code: "custom",
|
|
319
|
+
path: at,
|
|
320
|
+
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.`
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
139
324
|
/**
|
|
140
325
|
* Builds the host schema set. "allow" (declared form) accepts `T | Token` in
|
|
141
326
|
* every token-able field; "forbid" (resolved form) accepts `T` only.
|
|
142
327
|
*/
|
|
143
328
|
function buildHostSchemas(tokenField) {
|
|
329
|
+
const resolved = tokenField === FORBID_TOKENS;
|
|
144
330
|
const reactorBackendSchema = z.strictObject({
|
|
145
331
|
kind: reactorBackendKindSchema,
|
|
146
332
|
storage: z.strictObject({
|
|
@@ -161,12 +347,24 @@ function buildHostSchemas(tokenField) {
|
|
|
161
347
|
/** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */
|
|
162
348
|
dynamic: z.boolean().optional()
|
|
163
349
|
}).optional(),
|
|
164
|
-
remote: z.strictObject({ url: tokenField.any(
|
|
350
|
+
remote: z.strictObject({ url: tokenField.any(originOrUrlSchema) }).optional()
|
|
165
351
|
}).superRefine((backend, ctx) => {
|
|
166
352
|
if (backend.kind === "remote" && !backend.remote) ctx.addIssue({
|
|
167
353
|
code: "custom",
|
|
168
354
|
path: ["remote", "url"],
|
|
169
|
-
message:
|
|
355
|
+
message: `a "remote" backend needs remote.url, a switchboard drive address: ${useDriveUrl()}.`
|
|
356
|
+
});
|
|
357
|
+
const url = backend.remote?.url;
|
|
358
|
+
const graphqlRef = resolved ? void 0 : endpointsGraphqlRef(url);
|
|
359
|
+
if (graphqlRef) ctx.addIssue({
|
|
360
|
+
code: "custom",
|
|
361
|
+
path: ["remote", "url"],
|
|
362
|
+
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)}.`
|
|
363
|
+
});
|
|
364
|
+
if (resolved && typeof url === "string" && !switchboardOfDrive(url)) ctx.addIssue({
|
|
365
|
+
code: "custom",
|
|
366
|
+
path: ["remote", "url"],
|
|
367
|
+
message: `remote.url must be a switchboard drive address (<switchboard>/d/<slug>), not ${url}: sync needs the drive. Use ${useDriveUrl()}.`
|
|
170
368
|
});
|
|
171
369
|
const store = backend.storage;
|
|
172
370
|
const storeDir = store?.kind === "path" ? store.dataDir : void 0;
|
|
@@ -179,7 +377,13 @@ function buildHostSchemas(tokenField) {
|
|
|
179
377
|
});
|
|
180
378
|
const reactorSchema = z.strictObject({
|
|
181
379
|
backends: z.record(z.string(), reactorBackendSchema).optional(),
|
|
182
|
-
placement: z.strictObject({
|
|
380
|
+
placement: z.strictObject({
|
|
381
|
+
primary: z.string().optional(),
|
|
382
|
+
/** Declared drive slug → backend name. A local backend keeps a
|
|
383
|
+
* synced copy; the drive's own remote backend opens it there with
|
|
384
|
+
* no copy. An unlisted drive keeps a synced copy. */
|
|
385
|
+
drives: z.record(z.string().min(1), z.string().min(1)).optional()
|
|
386
|
+
}).optional(),
|
|
183
387
|
protocol: reactorProtocolSchema.optional(),
|
|
184
388
|
/** DEPRECATED (dies in R2): workflows become a listed plugin. */
|
|
185
389
|
workflows: z.boolean().optional(),
|
|
@@ -190,6 +394,21 @@ function buildHostSchemas(tokenField) {
|
|
|
190
394
|
}).optional(),
|
|
191
395
|
namespace: z.string().min(1).optional(),
|
|
192
396
|
drives: tokenField.any(z.array(buildDriveDeclarationSchema(tokenField.any))).optional()
|
|
397
|
+
}).superRefine((reactor, ctx) => {
|
|
398
|
+
const backends = reactor.backends ?? {};
|
|
399
|
+
for (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {
|
|
400
|
+
if (Object.hasOwn(backends, name)) continue;
|
|
401
|
+
ctx.addIssue({
|
|
402
|
+
code: "custom",
|
|
403
|
+
path: [
|
|
404
|
+
"placement",
|
|
405
|
+
"drives",
|
|
406
|
+
slug
|
|
407
|
+
],
|
|
408
|
+
message: `placement.drives.${slug} names backend "${name}", which is not in backends (${Object.keys(backends).join(", ") || "none"}).`
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
if (resolved) refineResolvedReactor(reactor, ctx);
|
|
193
412
|
});
|
|
194
413
|
/** Common runner options; runner modules extend it with their own. */
|
|
195
414
|
const runnerBaseSchema = z.looseObject({
|
|
@@ -218,14 +437,14 @@ function buildHostSchemas(tokenField) {
|
|
|
218
437
|
childWrapperSchema,
|
|
219
438
|
childrenSchema,
|
|
220
439
|
reactorHostSchema: z.strictObject({
|
|
221
|
-
name:
|
|
440
|
+
name: hostNameSchema,
|
|
222
441
|
runner: runnerBaseSchema,
|
|
223
442
|
config: z.looseObject({}).optional(),
|
|
224
443
|
profile: profileSchema.optional(),
|
|
225
444
|
reactor: reactorSchema.optional()
|
|
226
445
|
}),
|
|
227
446
|
compoundHostSchema: z.strictObject({
|
|
228
|
-
name:
|
|
447
|
+
name: hostNameSchema,
|
|
229
448
|
runner: runnerBaseSchema,
|
|
230
449
|
children: childrenSchema,
|
|
231
450
|
config: z.looseObject({}).optional(),
|
|
@@ -244,6 +463,13 @@ function buildHostSchemas(tokenField) {
|
|
|
244
463
|
function makeHostSchemas(options) {
|
|
245
464
|
return buildHostSchemas(options.tokens === "allow" ? ALLOW_TOKENS : FORBID_TOKENS);
|
|
246
465
|
}
|
|
466
|
+
/** Adds the host-level placement key check to a runner's declared schema. */
|
|
467
|
+
function withPlacementKeys(schema) {
|
|
468
|
+
if (!(schema instanceof z.ZodType)) return schema;
|
|
469
|
+
return schema.superRefine((host, ctx) => {
|
|
470
|
+
if (typeof host === "object" && host !== null && "reactor" in host) refineDeclaredPlacementKeys(host, ctx);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
247
473
|
/**
|
|
248
474
|
* One runner definition, two schemas (3.5): `build` runs over the DECLARED
|
|
249
475
|
* set (tokens allowed; its z.input types host files) and the RESOLVED set
|
|
@@ -254,7 +480,7 @@ function makeHostSchemas(options) {
|
|
|
254
480
|
*/
|
|
255
481
|
function defineHostSchemas(build) {
|
|
256
482
|
return {
|
|
257
|
-
declaredHostSchema: build(declaredSchemas),
|
|
483
|
+
declaredHostSchema: withPlacementKeys(build(declaredSchemas)),
|
|
258
484
|
hostSchema: build(resolvedSchemas)
|
|
259
485
|
};
|
|
260
486
|
}
|
|
@@ -316,6 +542,6 @@ function substituteValue(value, env) {
|
|
|
316
542
|
return value;
|
|
317
543
|
}
|
|
318
544
|
//#endregion
|
|
319
|
-
export {
|
|
545
|
+
export { projectDriveIdWith as A, keyTokenSchema as B, reactorSchema as C, buildDriveDeclarationSchema as D, runnerKindSchema as E, envTokenable as F, tokenSchema as G, outputTokenSchema as H, findToken as I, tokenable as K, forbidRef as L, TOKEN_KEYS as M, concatTokenSchema as N, driveDeclarationSchema as O, envTokenSchema as P, isToken as R, reactorProtocolSchema as S, runnerBaseSchema as T, ref as U, mapTokenSchema as V, tokenKeyOf as W, makeHostSchemas as _, HOST_NAME_PATTERN as a, reactorBackendSchema as b, compoundHostSchema as c, declaredHostSchemas as d, defineHostSchemas as f, hostNameSchema as g, genericCompoundHostSchema as h, HOST_NAME_MESSAGE as i, TOKEN_ESCAPE_KEY as j, drivesSchema as k, compoundWiringSchema as l, emittedHostSchemas as m, substituteBuiltinEnv as n, childWrapperSchema as o, emitHostJsonSchema as p, HOST_NAME_MAX_LENGTH as r, childrenSchema as s, isBuiltinEnvName as t, declaredGenericCompoundHostSchema as u, profileSchema as v, refineStartOrder as w, reactorHostSchema as x, reactorBackendKindSchema as y, itemTokenSchema as z };
|
|
320
546
|
|
|
321
|
-
//# sourceMappingURL=env-substitution-
|
|
547
|
+
//# sourceMappingURL=env-substitution-CzlXbvQJ.mjs.map
|