@w6w/embed 0.2.30 → 0.2.31
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/{CreateFunctionModal-CCYi9deY.js → CreateFunctionModal-glk2zg1r.js} +28 -27
- package/dist/{CreateFunctionModal-CCYi9deY.js.map → CreateFunctionModal-glk2zg1r.js.map} +1 -1
- package/dist/{DocumentFormModal-B3VudaLb.js → DocumentFormModal-Cw85R4wk.js} +2 -2
- package/dist/{DocumentFormModal-B3VudaLb.js.map → DocumentFormModal-Cw85R4wk.js.map} +1 -1
- package/dist/{ImportSpecModal-C-B8Jwxk.js → ImportSpecModal-fU5RsVTa.js} +2 -2
- package/dist/{ImportSpecModal-C-B8Jwxk.js.map → ImportSpecModal-fU5RsVTa.js.map} +1 -1
- package/dist/{WorkflowEditor-8NAcpjO_.js → WorkflowEditor-B-Wc_r4X.js} +5 -5
- package/dist/{WorkflowEditor-8NAcpjO_.js.map → WorkflowEditor-B-Wc_r4X.js.map} +1 -1
- package/dist/callable-record-Bhxim8C1.js +14 -0
- package/dist/callable-record-Bhxim8C1.js.map +1 -0
- package/dist/callables-B49tS2vv.js +297 -0
- package/dist/callables-B49tS2vv.js.map +1 -0
- package/dist/{document-sources-DNmBojx6.js → document-sources-Khcw2zB5.js} +16 -16
- package/dist/document-sources-Khcw2zB5.js.map +1 -0
- package/dist/draft.mjs +1 -1
- package/dist/editor/WorkflowInputsModal.d.ts +12 -0
- package/dist/editor/WorkflowVariablesEditor.d.ts +1 -1
- package/dist/{editor-tools-BIAW-wzt.js → editor-tools-Ch1cAE4F.js} +423 -366
- package/dist/editor-tools-Ch1cAE4F.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +81 -80
- package/dist/editors.mjs.map +1 -1
- package/dist/endpoints-zOuwci2U.js +136 -0
- package/dist/endpoints-zOuwci2U.js.map +1 -0
- package/dist/fields-CXHRR5eK.js +28 -0
- package/dist/fields-CXHRR5eK.js.map +1 -0
- package/dist/forms.mjs +1 -1
- package/dist/index.mjs +91 -91
- package/dist/index.mjs.map +1 -1
- package/dist/lib/callable-duplicate.d.ts +26 -0
- package/dist/lib/variable-preview.d.ts +6 -0
- package/dist/lib.mjs +41 -40
- package/dist/lib.mjs.map +1 -1
- package/dist/lists/CallableKindList.d.ts +4 -1
- package/dist/lists/CallableRowParts.d.ts +5 -0
- package/dist/lists/CredentialDetail.d.ts +2 -0
- package/dist/lists/CredentialFields.d.ts +1 -1
- package/dist/lists/EndpointList.d.ts +2 -1
- package/dist/lists/WorkflowList.d.ts +2 -1
- package/dist/lists.mjs +1509 -1421
- package/dist/lists.mjs.map +1 -1
- package/dist/rail.mjs +1 -1
- package/dist/repos/callables.d.ts +23 -0
- package/dist/repos/fields.d.ts +4 -1
- package/dist/repos.mjs +242 -239
- package/dist/settings-rail-BjsTjg2u.js +22 -0
- package/dist/settings-rail-BjsTjg2u.js.map +1 -0
- package/dist/{spec-import-FygyV8sy.js → spec-import-CGPqUUjN.js} +2 -2
- package/dist/{spec-import-FygyV8sy.js.map → spec-import-CGPqUUjN.js.map} +1 -1
- package/dist/{use-callable-draft-DCauHt5o.js → use-callable-draft-DjW7_9qb.js} +8 -7
- package/dist/{use-callable-draft-DCauHt5o.js.map → use-callable-draft-DjW7_9qb.js.map} +1 -1
- package/package.json +3 -3
- package/src/styles.css +165 -10
- package/dist/callables-tOlflvbl.js +0 -151
- package/dist/callables-tOlflvbl.js.map +0 -1
- package/dist/document-sources-DNmBojx6.js.map +0 -1
- package/dist/editor-tools-BIAW-wzt.js.map +0 -1
- package/dist/endpoints-DArAqoLT.js +0 -233
- package/dist/endpoints-DArAqoLT.js.map +0 -1
- package/dist/fields-DvS8XZFc.js +0 -21
- package/dist/fields-DvS8XZFc.js.map +0 -1
- package/dist/settings-rail--GdRMusb.js +0 -33
- package/dist/settings-rail--GdRMusb.js.map +0 -1
package/src/styles.css
CHANGED
|
@@ -444,30 +444,131 @@
|
|
|
444
444
|
gap: var(--w6w-sp-2);
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
/*
|
|
448
|
-
|
|
447
|
+
/* The Workflow inputs modal: one row per variable — key | type | default | required | remove —
|
|
448
|
+
with the header row on the same columns so each label sits over its cell. */
|
|
449
449
|
.w6w-embed-root .workflow-variable-row,
|
|
450
450
|
.w6w-embed-root .workflow-variable-head {
|
|
451
451
|
display: grid;
|
|
452
|
-
grid-template-columns: minmax(
|
|
452
|
+
grid-template-columns: minmax(9rem, 1fr) 7rem minmax(0, 1.6fr) 4.5rem auto;
|
|
453
453
|
gap: var(--w6w-sp-2);
|
|
454
454
|
align-items: center;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
-
.w6w-embed-root .workflow-variable-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
457
|
+
.w6w-embed-root .workflow-variable-list {
|
|
458
|
+
list-style: none;
|
|
459
|
+
margin: 0;
|
|
460
|
+
padding: 0;
|
|
461
|
+
display: flex;
|
|
462
|
+
flex-direction: column;
|
|
463
|
+
gap: var(--w6w-sp-2);
|
|
462
464
|
}
|
|
463
465
|
|
|
464
|
-
.w6w-embed-root .workflow-variable-
|
|
466
|
+
.w6w-embed-root .workflow-variable-list > li {
|
|
465
467
|
display: flex;
|
|
466
468
|
flex-direction: column;
|
|
467
469
|
gap: var(--w6w-sp-1);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/* Boxed like every other text field: borderless, a key was hard to tell from a label. */
|
|
473
|
+
.w6w-embed-root .workflow-variable-row > input[type="text"],
|
|
474
|
+
.w6w-embed-root .workflow-variable-row > select {
|
|
475
|
+
padding: var(--w6w-sp-1-5) var(--w6w-sp-2);
|
|
476
|
+
background: var(--panel-2);
|
|
477
|
+
border: 1px solid var(--border);
|
|
478
|
+
border-radius: 8px;
|
|
479
|
+
color: var(--text);
|
|
480
|
+
font-size: 14px;
|
|
481
|
+
font-family: inherit;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.w6w-embed-root .workflow-variable-row > input.workflow-variable-key {
|
|
485
|
+
font-family: var(--w6w-font-mono);
|
|
486
|
+
font-size: 13px;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.w6w-embed-root .workflow-variable-row > input[type="text"]:focus,
|
|
490
|
+
.w6w-embed-root .workflow-variable-row > select:focus {
|
|
491
|
+
outline: none;
|
|
492
|
+
border-color: var(--accent);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.w6w-embed-root .workflow-variable-row > .workflow-variable-required {
|
|
496
|
+
justify-self: center;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.w6w-embed-root .workflow-variable-head > span:nth-child(4) {
|
|
500
|
+
text-align: center;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/* The Data rail's read-only list of inputs: key, type and required on one line, the default
|
|
504
|
+
under it. "Edit inputs" sits on the heading row. */
|
|
505
|
+
.w6w-embed-root .rail-section-head {
|
|
506
|
+
display: flex;
|
|
507
|
+
align-items: center;
|
|
508
|
+
justify-content: space-between;
|
|
509
|
+
gap: var(--w6w-sp-2);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.w6w-embed-root .rail-section-head h4 {
|
|
513
|
+
margin: 0;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.w6w-embed-root .rail-section-head .btn {
|
|
517
|
+
padding: var(--w6w-sp-1) var(--w6w-sp-2);
|
|
518
|
+
font-size: var(--w6w-fs-xs);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.w6w-embed-root .rail-input-list {
|
|
522
|
+
list-style: none;
|
|
523
|
+
margin: var(--w6w-sp-2) 0 0;
|
|
524
|
+
padding: 0;
|
|
525
|
+
display: flex;
|
|
526
|
+
flex-direction: column;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.w6w-embed-root .rail-input-list > li {
|
|
530
|
+
display: flex;
|
|
531
|
+
flex-direction: column;
|
|
532
|
+
gap: 2px;
|
|
533
|
+
padding: var(--w6w-sp-1-5) 0;
|
|
534
|
+
border-bottom: 1px solid var(--border);
|
|
468
535
|
min-width: 0;
|
|
469
536
|
}
|
|
470
537
|
|
|
538
|
+
.w6w-embed-root .rail-input-list > li:last-child {
|
|
539
|
+
border-bottom: none;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.w6w-embed-root .rail-input-line {
|
|
543
|
+
display: flex;
|
|
544
|
+
align-items: baseline;
|
|
545
|
+
gap: var(--w6w-sp-2);
|
|
546
|
+
min-width: 0;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.w6w-embed-root .rail-input-key {
|
|
550
|
+
min-width: 0;
|
|
551
|
+
overflow: hidden;
|
|
552
|
+
text-overflow: ellipsis;
|
|
553
|
+
white-space: nowrap;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.w6w-embed-root .rail-input-req {
|
|
557
|
+
margin-left: auto;
|
|
558
|
+
flex-shrink: 0;
|
|
559
|
+
font-size: var(--w6w-fs-xs);
|
|
560
|
+
color: var(--muted);
|
|
561
|
+
border: 1px solid var(--border);
|
|
562
|
+
border-radius: 4px;
|
|
563
|
+
padding: 0 var(--w6w-sp-1);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.w6w-embed-root .rail-input-default {
|
|
567
|
+
overflow: hidden;
|
|
568
|
+
text-overflow: ellipsis;
|
|
569
|
+
white-space: nowrap;
|
|
570
|
+
}
|
|
571
|
+
|
|
471
572
|
/* key | label | type | required | remove (Functions/Endpoints input editor). */
|
|
472
573
|
.w6w-embed-root .list li.input-list-row,
|
|
473
574
|
.w6w-embed-root .input-list-head {
|
|
@@ -486,7 +587,7 @@
|
|
|
486
587
|
max-width: 100%;
|
|
487
588
|
}
|
|
488
589
|
|
|
489
|
-
.w6w-embed-root .workflow-variable-row > input,
|
|
590
|
+
.w6w-embed-root .workflow-variable-row > input[type="text"],
|
|
490
591
|
.w6w-embed-root .workflow-variable-row > select {
|
|
491
592
|
width: 100%;
|
|
492
593
|
}
|
|
@@ -1038,6 +1139,60 @@
|
|
|
1038
1139
|
padding: var(--w6w-sp-3);
|
|
1039
1140
|
}
|
|
1040
1141
|
|
|
1142
|
+
/* ── CredentialDetail ── */
|
|
1143
|
+
.w6w-embed-root .w6w-embed-cred-head {
|
|
1144
|
+
display: flex;
|
|
1145
|
+
flex-direction: column;
|
|
1146
|
+
align-items: flex-start;
|
|
1147
|
+
gap: var(--w6w-sp-2);
|
|
1148
|
+
}
|
|
1149
|
+
.w6w-embed-root .w6w-embed-cred-head > p {
|
|
1150
|
+
margin: 0;
|
|
1151
|
+
}
|
|
1152
|
+
.w6w-embed-root .w6w-embed-cred-title {
|
|
1153
|
+
display: flex;
|
|
1154
|
+
align-items: center;
|
|
1155
|
+
gap: var(--w6w-sp-2);
|
|
1156
|
+
}
|
|
1157
|
+
.w6w-embed-root .w6w-embed-cred-title h2 {
|
|
1158
|
+
margin: 0;
|
|
1159
|
+
}
|
|
1160
|
+
/* The non-secret facts: label column, value column, values wrap rather than overflow. */
|
|
1161
|
+
.w6w-embed-root .w6w-embed-cred-facts {
|
|
1162
|
+
display: grid;
|
|
1163
|
+
grid-template-columns: max-content minmax(0, 1fr);
|
|
1164
|
+
gap: var(--w6w-sp-1) var(--w6w-sp-4);
|
|
1165
|
+
margin: 0;
|
|
1166
|
+
font-size: 0.85em;
|
|
1167
|
+
width: 100%;
|
|
1168
|
+
}
|
|
1169
|
+
.w6w-embed-root .w6w-embed-cred-facts > div {
|
|
1170
|
+
display: contents;
|
|
1171
|
+
}
|
|
1172
|
+
.w6w-embed-root .w6w-embed-cred-facts dt {
|
|
1173
|
+
color: var(--muted);
|
|
1174
|
+
}
|
|
1175
|
+
.w6w-embed-root .w6w-embed-cred-facts dd {
|
|
1176
|
+
margin: 0;
|
|
1177
|
+
overflow-wrap: anywhere;
|
|
1178
|
+
}
|
|
1179
|
+
.w6w-embed-root .w6w-embed-cred-actions {
|
|
1180
|
+
display: flex;
|
|
1181
|
+
flex-wrap: wrap;
|
|
1182
|
+
gap: var(--w6w-sp-2);
|
|
1183
|
+
}
|
|
1184
|
+
.w6w-embed-root .w6w-embed-cred-replace {
|
|
1185
|
+
display: flex;
|
|
1186
|
+
flex-direction: column;
|
|
1187
|
+
gap: var(--w6w-sp-2);
|
|
1188
|
+
margin-top: var(--w6w-sp-3);
|
|
1189
|
+
padding-top: var(--w6w-sp-3);
|
|
1190
|
+
border-top: 1px solid var(--border);
|
|
1191
|
+
}
|
|
1192
|
+
.w6w-embed-root .w6w-embed-cred-replace > p {
|
|
1193
|
+
margin: 0;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1041
1196
|
.w6w-embed-root .w6w-embed-conn-list {
|
|
1042
1197
|
list-style: none;
|
|
1043
1198
|
margin: 0;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { useQueryClient as a, useMutation as l, useQuery as f } from "@tanstack/react-query";
|
|
2
|
-
import { u as s } from "./client-context-CX61Bgw-.js";
|
|
3
|
-
const y = {
|
|
4
|
-
function: (e) => ["function", e],
|
|
5
|
-
endpoint: (e) => ["endpoint", e],
|
|
6
|
-
workflow: (e) => ["workflow", e]
|
|
7
|
-
};
|
|
8
|
-
function w(e, n) {
|
|
9
|
-
return y[e](n);
|
|
10
|
-
}
|
|
11
|
-
function C(e, n, t) {
|
|
12
|
-
e.invalidateQueries({ queryKey: n }), e.invalidateQueries({ queryKey: t });
|
|
13
|
-
}
|
|
14
|
-
const c = {
|
|
15
|
-
function: "functions",
|
|
16
|
-
endpoint: "endpoints",
|
|
17
|
-
workflow: "workflows"
|
|
18
|
-
}, d = {
|
|
19
|
-
function: () => ["functions"],
|
|
20
|
-
endpoint: () => ["endpoints"],
|
|
21
|
-
workflow: (e) => ["workflows", e]
|
|
22
|
-
};
|
|
23
|
-
function Q(e) {
|
|
24
|
-
return c[e];
|
|
25
|
-
}
|
|
26
|
-
function b(e, n) {
|
|
27
|
-
const t = c[e];
|
|
28
|
-
return n === void 0 ? t : `${t}/${n}`;
|
|
29
|
-
}
|
|
30
|
-
function p(e, n) {
|
|
31
|
-
return `/${c[e]}/${n}`;
|
|
32
|
-
}
|
|
33
|
-
function S(e, n) {
|
|
34
|
-
return `${b(e, n)}/history`;
|
|
35
|
-
}
|
|
36
|
-
function u(e, n) {
|
|
37
|
-
return d[e](n);
|
|
38
|
-
}
|
|
39
|
-
function h(e, n, t) {
|
|
40
|
-
switch (n) {
|
|
41
|
-
case "function":
|
|
42
|
-
return e.console.functions.list();
|
|
43
|
-
case "endpoint":
|
|
44
|
-
return e.console.endpoints.list();
|
|
45
|
-
case "workflow":
|
|
46
|
-
return e.workflows.list({ project: t });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function k(e, n, t) {
|
|
50
|
-
switch (n) {
|
|
51
|
-
case "function":
|
|
52
|
-
return e.console.functions.get(t);
|
|
53
|
-
case "endpoint":
|
|
54
|
-
return e.console.endpoints.get(t);
|
|
55
|
-
case "workflow":
|
|
56
|
-
return e.console.workflows.get(t);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function m(e, n, t, o) {
|
|
60
|
-
switch (n) {
|
|
61
|
-
case "function":
|
|
62
|
-
return e.console.functions.upsert(t).then((r) => ({ id: r.id, key: r.key }));
|
|
63
|
-
case "endpoint":
|
|
64
|
-
return e.console.endpoints.upsert(t).then((r) => ({ id: r.endpoint.id, key: r.endpoint.key }));
|
|
65
|
-
case "workflow": {
|
|
66
|
-
const r = o == null ? void 0 : o.project;
|
|
67
|
-
return r ? e.console.workflows.upsert(t, { project: r }).then((i) => ({
|
|
68
|
-
id: i.workflow.id,
|
|
69
|
-
key: i.workflow.key ?? ""
|
|
70
|
-
})) : Promise.reject(new Error("No project selected yet."));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function q(e, n, t) {
|
|
75
|
-
switch (n) {
|
|
76
|
-
case "function":
|
|
77
|
-
case "endpoint":
|
|
78
|
-
return e.request({
|
|
79
|
-
method: "POST",
|
|
80
|
-
path: `${p(n, encodeURIComponent(t))}/archive`
|
|
81
|
-
});
|
|
82
|
-
case "workflow":
|
|
83
|
-
return e.console.workflows.archive(t);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function v(e, n, t) {
|
|
87
|
-
switch (n) {
|
|
88
|
-
case "function":
|
|
89
|
-
case "endpoint":
|
|
90
|
-
return e.request({ method: "DELETE", path: p(n, encodeURIComponent(t)) });
|
|
91
|
-
case "workflow":
|
|
92
|
-
return e.console.workflows.delete(t);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function L(e, n = !0, t) {
|
|
96
|
-
const o = s();
|
|
97
|
-
return f({
|
|
98
|
-
queryKey: u(e, t),
|
|
99
|
-
queryFn: () => h(o, e, t),
|
|
100
|
-
enabled: n
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function R(e, n, t = !0) {
|
|
104
|
-
const o = s();
|
|
105
|
-
return f({
|
|
106
|
-
queryKey: w(e, n),
|
|
107
|
-
queryFn: () => k(o, e, n),
|
|
108
|
-
enabled: t
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function $(e, n) {
|
|
112
|
-
const t = s(), o = a();
|
|
113
|
-
return l({
|
|
114
|
-
mutationFn: (r) => m(t, e, r, n),
|
|
115
|
-
onSuccess: (r) => C(o, u(e), w(e, r.id))
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function g(e) {
|
|
119
|
-
const n = s(), t = a();
|
|
120
|
-
return l({
|
|
121
|
-
mutationFn: (o) => q(n, e, o),
|
|
122
|
-
onSuccess: () => t.invalidateQueries({ queryKey: u(e) })
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function F(e) {
|
|
126
|
-
const n = s(), t = a();
|
|
127
|
-
return l({
|
|
128
|
-
mutationFn: (o) => v(n, e, o),
|
|
129
|
-
onSuccess: () => t.invalidateQueries({ queryKey: u(e) })
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
export {
|
|
133
|
-
w as a,
|
|
134
|
-
q as b,
|
|
135
|
-
u as c,
|
|
136
|
-
Q as d,
|
|
137
|
-
S as e,
|
|
138
|
-
p as f,
|
|
139
|
-
b as g,
|
|
140
|
-
v as h,
|
|
141
|
-
C as i,
|
|
142
|
-
k as j,
|
|
143
|
-
g as k,
|
|
144
|
-
h as l,
|
|
145
|
-
L as m,
|
|
146
|
-
F as n,
|
|
147
|
-
$ as o,
|
|
148
|
-
m as s,
|
|
149
|
-
R as u
|
|
150
|
-
};
|
|
151
|
-
//# sourceMappingURL=callables-tOlflvbl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callables-tOlflvbl.js","sources":["../src/lib/callable-kind.ts","../src/lib/save-invalidation.ts","../src/repos/callables.ts"],"sourcesContent":["/**\n * The three callable kinds and the single-resource query key per kind.\n *\n * Moved verbatim out of Studio's `repos/callables.ts` (`CallableKind`, `callableKey` and the one\n * pure table `callableKey` closes over, `RESOURCE_KEY`) so `repos/versions.ts` — which ships in\n * this package for all three kind arms — can invalidate a definition by key without importing a\n * Studio module. `repos/callables.ts` imports these from `@w6w/embed/repos` and does NOT re-export\n * them. No React, no client: loadable by `node --test`.\n */\n\n/** The three kinds the callable repos are total over. */\nexport type CallableKind = \"function\" | \"endpoint\" | \"workflow\";\n\n/** The single-resource key's own prefix — byte-identical to `functionKey`/`endpointKey`/\n * `workflowKey`. */\nconst RESOURCE_KEY: Record<CallableKind, (id: string) => readonly unknown[]> = {\n function: (id) => [\"function\", id],\n endpoint: (id) => [\"endpoint\", id],\n workflow: (id) => [\"workflow\", id],\n};\n\n/** `GET /<coll>/:id`'s own query key — the literal `lib/save-invalidation.ts` invalidates. */\nexport function callableKey(kind: CallableKind, id: string): readonly unknown[] {\n return RESOURCE_KEY[kind](id);\n}\n","/**\n * Shared invalidation for a whole-definition save (T3.1.1). `useSaveFunctionMutation` and\n * `useSaveEndpointMutation` (`src/repos/functions.ts`, `src/repos/endpoints.ts`) both route their\n * `onSuccess` through this one helper rather than inlining the two `invalidateQueries` calls at\n * each site — so a save invalidates the LIST key (both list pages and the editor depend on it)\n * *and* the saved resource's own single-resource key (`functionKey(id)` / `endpointKey(id)`),\n * never just the list.\n *\n * No value imports on purpose: `node --test` throws `ERR_UNKNOWN_FILE_EXTENSION` on anything that\n * reaches the `@w6w/ui` / `Layout.tsx` import graph, and `src/repos/*.ts` reaches it through\n * `../api/apiClient.tsx` (JSX). This module has none of that, so it is loadable by `node --test`\n * directly — see `src/lib/alias-rail.ts`'s docstring for the same reasoning.\n */\n\nexport interface QueryInvalidator {\n invalidateQueries(filters: { queryKey: readonly unknown[] }): unknown;\n}\n\n/**\n * Invalidate the list key, then the saved resource's own key. List first: both keys are\n * invalidated regardless of order, but the order is asserted (see the unit test) so a future edit\n * that drops one call is a diff a reviewer can spot in a single line.\n */\nexport function invalidateSavedCallable(\n qc: QueryInvalidator,\n listKey: readonly unknown[],\n callableKey: readonly unknown[],\n): void {\n qc.invalidateQueries({ queryKey: listKey });\n qc.invalidateQueries({ queryKey: callableKey });\n}\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type { W6WClient } from \"@w6w/sdk\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\n/**\n * The kind-parametrised resource repo (T4.2.1, `building-blocks.F3.md` §F-3) — ONE module\n * answering \"list / get / save / archive / delete a resource of kind K\" for all three kinds,\n * instead of `functions.ts`/`endpoints.ts`/`workflows.ts` each restating the same five shapes with\n * their own key builder.\n *\n * **Mirrors `src/repos/versions.ts`'s `COLLECTION_PATH: Record<VersionsKind, …>` idiom**: every\n * per-kind fact is a TOTAL `Record` whose arms are all named explicitly, never a string\n * pluralisation rule — a typo'd suffix would silently send one kind's requests at another kind's\n * collection (that module's own docblock gives the reasoning in full). The two tables that are\n * genuinely per-kind *data* — the collection segment and the two query-key shapes — are `Record`s;\n * the three calls whose SIGNATURE differs per kind (get's return shape, save's envelope key,\n * archive/delete's SDK-vs-escape-hatch split) are `switch`es with every arm named and no\n * `default:`, so a fourth kind is a compile error rather than a silent fall-through.\n *\n * **Query keys are byte-identical to the ones this repo replaces** — `[\"functions\"]`,\n * `[\"function\", id]`, `[\"endpoints\"]`, `[\"endpoint\", id]`, `[\"workflows\", project]`,\n * `[\"workflow\", id]` — because `lib/save-invalidation.ts`, `lib/spec-import-invalidation.ts` and\n * `repos/versions.ts`'s revert arm all invalidate those literals through helpers that take a key,\n * not a hook. A renamed key here would leave a saved resource's page showing its pre-save draft,\n * invisible to `tsc` and to every page guard (this is `spec-import-invalidation.ts`'s own\n * argument, restated for the whole family).\n *\n * `repos/functions.ts` stays as the Function-bound facade over this module — every existing\n * importer (`ui/rail/SettingsTool.tsx`, `ui/rail/AliasesTool.tsx`, `ui/rail/ErrorHandlingTool.tsx`,\n * `components/TargetSelector.tsx`, `components/FunctionIdentityModal.tsx`, `api/w6wApiFacade.tsx`)\n * keeps its import and its call shape; only where the code lives changed.\n */\nimport { type CallableKind, callableKey } from \"../lib/callable-kind.ts\";\nimport { invalidateSavedCallable } from \"../lib/save-invalidation.ts\";\n\n/** `<coll>` — the wire contract's own path segment per kind, every arm named explicitly\n * (never derived by string pluralisation), mirroring `versions.ts`'s `COLLECTION_PATH`. */\nconst COLLECTION_PATH: Record<CallableKind, \"functions\" | \"endpoints\" | \"workflows\"> = {\n function: \"functions\",\n endpoint: \"endpoints\",\n workflow: \"workflows\",\n};\n\n/**\n * The LIST query key per kind — byte-identical to `functionsKey`, `endpointsKey` and\n * `workflowsKey(project)`. A function per kind, not a literal, because the Workflow arm is\n * genuinely project-scoped (`repos/workflows.ts`'s own note: `[\"workflows\", undefined]` and\n * `[\"workflows\", \"prj_x\"]` are DIFFERENT cache entries, deliberately).\n */\nconst LIST_KEY: Record<CallableKind, (project?: string) => readonly unknown[]> = {\n function: () => [\"functions\"],\n endpoint: () => [\"endpoints\"],\n workflow: (project) => [\"workflows\", project],\n};\n\n/**\n * The structural minimum every list row of every kind satisfies — what the shared list chrome\n * (`pages/CallablePage.tsx`) renders and the Settings rail reads by id. Kind-specific widening\n * (`archivedAt`, an Endpoint's `status`/`incomplete`) stays in the kind's own facade, which is\n * where the comment explaining \"the SDK does not know this column yet\" belongs.\n */\nexport interface CallableRow {\n id: string;\n /** `null` for a Workflow that has no key of its own yet (`WorkflowSummary`'s own\n * type) — never coerced to `\"\"` here, so the list renders exactly what the server sent. */\n key: string | null;\n displayName?: string | null;\n description?: string | null;\n archivedAt?: string | null;\n}\n\n/** `<coll>` for a kind — the wire segment AND (studio mirrors the wire) the route segment. */\nexport function callableCollection(kind: CallableKind): string {\n return COLLECTION_PATH[kind];\n}\n\n/** The studio route for a kind, or for one of its resources: `\"functions\"`, `\"functions/fn_x\"`. */\nexport function callableRoute(kind: CallableKind, id?: string): string {\n const collection = COLLECTION_PATH[kind];\n return id === undefined ? collection : `${collection}/${id}`;\n}\n\n/** The wire path for one resource: `/functions/fn_x`. */\nexport function callablePath(kind: CallableKind, id: string): string {\n return `/${COLLECTION_PATH[kind]}/${id}`;\n}\n\n/** The studio route for one resource's History tab/page (T2.3.1/T2.4.1):\n * `\"functions/fn_x/history\"`. A sibling of {@link callableRoute}, not a\n * hand-written string per call site. */\nexport function callableHistoryRoute(kind: CallableKind, id: string): string {\n return `${callableRoute(kind, id)}/history`;\n}\n\n/** `GET /<coll>`'s own query key — the literal `lib/spec-import-invalidation.ts` invalidates. */\nexport function callableListKey(kind: CallableKind, project?: string): readonly unknown[] {\n return LIST_KEY[kind](project);\n}\n\n/**\n * `GET /<coll>`. A `switch`, not a table: the three SDK calls return three different summary\n * types, and the union is what the shared chrome consumes structurally.\n */\nexport function listCallables(\n client: W6WClient,\n kind: CallableKind,\n project?: string,\n): Promise<CallableRow[]> {\n switch (kind) {\n case \"function\":\n return client.console.functions.list();\n case \"endpoint\":\n return client.console.endpoints.list();\n case \"workflow\":\n return client.workflows.list({ project });\n }\n}\n\n/**\n * `GET /<coll>/:id`, each arm returning exactly what that kind's existing repo function returns —\n * Function's `{...function, valid}` splice, Endpoint's `{endpoint, invokeUrl, …}` envelope,\n * Workflow's three-field body — never re-shaped here. The return type is the honest `unknown`:\n * the per-kind reader in the kind's own facade is what narrows it.\n */\nexport function getCallable(client: W6WClient, kind: CallableKind, id: string): Promise<unknown> {\n switch (kind) {\n case \"function\":\n return client.console.functions.get(id);\n case \"endpoint\":\n return client.console.endpoints.get(id);\n case \"workflow\":\n return client.console.workflows.get(id);\n }\n}\n\n/**\n * `POST /<coll>`, normalised to the one thing EVERY caller of a save needs — the saved resource's\n * id and key, for the invalidation below and for a create modal's own \"created\" callback. The two\n * envelopes (`{endpoint: {id, key}}`, `{workflow: {id, key}}`) and the flat one (`{id, key}`) are\n * unwrapped in the arm that knows its own shape, so no caller outside this module ever has to.\n *\n * Workflow refuses without a `project` for the same reason `repos/workflows.ts`'s own save does:\n * a missing project on a WRITE lands the definition in the account's default project instead of\n * the one the operator is looking at.\n */\nexport function saveCallable(\n client: W6WClient,\n kind: CallableKind,\n definition: unknown,\n options?: { project?: string },\n): Promise<{ id: string; key: string }> {\n switch (kind) {\n case \"function\":\n return client.console.functions\n .upsert(definition as never)\n .then((saved) => ({ id: saved.id, key: saved.key }));\n case \"endpoint\":\n return client.console.endpoints\n .upsert(definition as never)\n .then((saved) => ({ id: saved.endpoint.id, key: saved.endpoint.key }));\n case \"workflow\": {\n const project = options?.project;\n if (!project) return Promise.reject(new Error(\"No project selected yet.\"));\n return client.console.workflows.upsert(definition, { project }).then((saved) => ({\n id: saved.workflow.id,\n key: saved.workflow.key ?? \"\",\n }));\n }\n }\n}\n\n/**\n * `POST /<coll>/:id/archive`. Function and Endpoint go through the plain `apiClient.request()`\n * escape hatch (T4.1.1/A7/D-I0-7: no typed `@w6w/sdk` method exists, and adding one would drag\n * `packages/wrappers` into this task's scope for an internal route); Workflow keeps the typed\n * `console.workflows.archive` it has had since the rail's DangerZone landed.\n */\nexport function archiveCallable(\n client: W6WClient,\n kind: CallableKind,\n id: string,\n): Promise<unknown> {\n switch (kind) {\n case \"function\":\n case \"endpoint\":\n return client.request({\n method: \"POST\",\n path: `${callablePath(kind, encodeURIComponent(id))}/archive`,\n });\n case \"workflow\":\n return client.console.workflows.archive(id);\n }\n}\n\n/** `DELETE /<coll>/:id` — same split, and the same reasoning, as {@link archiveCallable}. */\nexport function deleteCallable(\n client: W6WClient,\n kind: CallableKind,\n id: string,\n): Promise<unknown> {\n switch (kind) {\n case \"function\":\n case \"endpoint\":\n return client.request({ method: \"DELETE\", path: callablePath(kind, encodeURIComponent(id)) });\n case \"workflow\":\n return client.console.workflows.delete(id);\n }\n}\n\n/**\n * `useQuery` over {@link listCallables}, keyed by {@link callableListKey}. Generic over the row\n * type so a kind's own facade can narrow it to that kind's widened summary (Function's\n * `archivedAt`, Endpoint's `status`/`incomplete`) without a cast at the call site.\n */\nexport function useCallableListQuery<Row extends CallableRow = CallableRow>(\n kind: CallableKind,\n enabled = true,\n project?: string,\n) {\n const apiClient = useEmbedClient();\n return useQuery<Row[]>({\n queryKey: callableListKey(kind, project),\n queryFn: () => listCallables(apiClient, kind, project) as Promise<Row[]>,\n enabled,\n });\n}\n\n/** `useQuery` over {@link getCallable}, keyed by {@link callableKey}. */\nexport function useCallableQuery<Def = unknown>(kind: CallableKind, id: string, enabled = true) {\n const apiClient = useEmbedClient();\n return useQuery<Def>({\n queryKey: callableKey(kind, id),\n queryFn: () => getCallable(apiClient, kind, id) as Promise<Def>,\n enabled,\n });\n}\n\n/**\n * `useMutation` over {@link saveCallable}. `onSuccess` routes through the SAME\n * `invalidateSavedCallable` helper every save in studio already uses, with the SAME two keys —\n * the list AND the saved resource — so the Function arm's invalidation is the one\n * `repos/functions.ts` performs today, byte for byte.\n */\nexport function useSaveCallableMutation(kind: CallableKind, options?: { project?: string }) {\n const apiClient = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (definition: unknown) => saveCallable(apiClient, kind, definition, options),\n onSuccess: (saved) =>\n invalidateSavedCallable(qc, callableListKey(kind), callableKey(kind, saved.id)),\n });\n}\n\n/** `useMutation` over {@link archiveCallable} — the list key, so the row's archived badge\n * refreshes and the rail's Delete control appears in Archive's place. */\nexport function useArchiveCallableMutation(kind: CallableKind) {\n const apiClient = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (id: string) => archiveCallable(apiClient, kind, id),\n onSuccess: () => qc.invalidateQueries({ queryKey: callableListKey(kind) }),\n });\n}\n\n/** `useMutation` over {@link deleteCallable}. */\nexport function useDeleteCallableMutation(kind: CallableKind) {\n const apiClient = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (id: string) => deleteCallable(apiClient, kind, id),\n onSuccess: () => qc.invalidateQueries({ queryKey: callableListKey(kind) }),\n });\n}\n"],"names":["RESOURCE_KEY","id","callableKey","kind","invalidateSavedCallable","qc","listKey","COLLECTION_PATH","LIST_KEY","project","callableCollection","callableRoute","collection","callablePath","callableHistoryRoute","callableListKey","listCallables","client","getCallable","saveCallable","definition","options","saved","archiveCallable","deleteCallable","useCallableListQuery","enabled","apiClient","useEmbedClient","useQuery","useCallableQuery","useSaveCallableMutation","useQueryClient","useMutation","useArchiveCallableMutation","useDeleteCallableMutation"],"mappings":";;AAeA,MAAMA,IAAyE;AAAA,EAC7E,UAAU,CAACC,MAAO,CAAC,YAAYA,CAAE;AAAA,EACjC,UAAU,CAACA,MAAO,CAAC,YAAYA,CAAE;AAAA,EACjC,UAAU,CAACA,MAAO,CAAC,YAAYA,CAAE;AACnC;AAGO,SAASC,EAAYC,GAAoBF,GAAgC;AAC9E,SAAOD,EAAaG,CAAI,EAAEF,CAAE;AAC9B;ACDO,SAASG,EACdC,GACAC,GACAJ,GACM;AACN,EAAAG,EAAG,kBAAkB,EAAE,UAAUC,EAAA,CAAS,GAC1CD,EAAG,kBAAkB,EAAE,UAAUH,EAAA,CAAa;AAChD;ACMA,MAAMK,IAAiF;AAAA,EACrF,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;A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1E;AACH;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-sources-DNmBojx6.js","sources":["../src/lib/workflow-variables.ts","../src/lib/starting-data.ts","../src/lib/code-rail.ts","../src/lib/error-handler-self.ts","../src/lib/document-sources.ts"],"sourcesContent":["/**\n * The pure decisions behind a workflow's `variables` list (T1.1.5) — the\n * Variables tab's authoring surface and the run page's generated-form\n * projection. `variables` rides inside the workflow **definition**\n * (`w6w-workflow/packages/types/mod.ts:170`), the same JSON document that\n * already carries `steps`, so there is no column, no migration and no server\n * change behind it.\n *\n * Pure, React-free, `.ts`, **no value import of `@w6w/ui`** — studio's\n * `test:unit` is a bare `node --test` with no jsx loader\n * (`studio/package.json:17`), so a value import of the barrel (which\n * re-exports `.tsx`) kills the test. Same shape as `workflow-settings.ts`'s\n * reader/writer discipline and `input-seeding.ts`'s pure-module docstring\n * rule.\n *\n * The row type is defined **locally**, structurally identical to\n * `WorkflowVariable` (`w6w-workflow/packages/types/mod.ts:40-45`: `key`,\n * `type?`, `required?`, `default?`), so no cast is needed at the `.tsx`\n * boundary in either direction.\n */\n\n/** One row of a workflow's declared `variables` list. */\nexport interface WorkflowVariableRow {\n key: string;\n type?: \"string\" | \"number\" | \"boolean\" | \"object\" | \"array\";\n required?: boolean;\n default?: unknown;\n}\n\n/** The declared type union `WorkflowVariable.type` accepts. */\nconst VARIABLE_TYPES = new Set([\"string\", \"number\", \"boolean\", \"object\", \"array\"]);\n\n/**\n * Read a workflow definition's `variables` field as an array of rows.\n *\n * Takes `unknown` because the source is `JSON.parse`d and the `</>` editor\n * lets an author type anything: a non-array reads as no variables, and a\n * non-object array entry is dropped rather than crashing the tab. **Never\n * sorts, never de-dups, never re-orders** — declaration order *is*\n * resolution order (D-5) and `resolveVariables` iterates the array in order\n * (`w6w-workflow/packages/engine/src/run.ts:70-83`), so two rows sharing a\n * key both survive, in the order they were declared.\n */\nexport function readVariables(raw: unknown): WorkflowVariableRow[] {\n if (!Array.isArray(raw)) return [];\n const out: WorkflowVariableRow[] = [];\n for (const entry of raw) {\n if (typeof entry !== \"object\" || entry === null || Array.isArray(entry)) continue;\n const e = entry as Record<string, unknown>;\n const row: WorkflowVariableRow = { key: typeof e.key === \"string\" ? e.key : \"\" };\n if (typeof e.type === \"string\" && VARIABLE_TYPES.has(e.type)) {\n row.type = e.type as WorkflowVariableRow[\"type\"];\n }\n if (typeof e.required === \"boolean\") row.required = e.required;\n if (e.default !== undefined) row.default = e.default;\n out.push(row);\n }\n return out;\n}\n\n/**\n * The rows ready to write back into the definition's `variables` field.\n *\n * Mirrors `workflow-settings.ts`'s \"default written as absent\" rule, but here\n * it applies to a row's **optional flags, not the value**: `required` is\n * omitted when `false` and `type` is omitted when unset, so opening the tab\n * and touching nothing does not rewrite a legacy definition into\n * `{required:false,type:undefined}` rows. `default` is user data and is kept\n * **verbatim** — including `false`, `0`, `\"\"` and `null` — never dropped as\n * an optimisation (a \"drop falsy\" implementation would lose a `false`\n * default, which is exactly the case the tests pin).\n *\n * Returns `undefined` for an empty array (never `[]`) so the caller\n * (`patchMeta`, via `JSON.stringify`) drops the key entirely — which matters\n * beyond hygiene here: `draftFromWorkflowVariables`\n * (`server/packages/api/mcp/tool-schema.ts:310-326`) treats `undefined` and\n * `length === 0` identically (pass-through), so `[]` and absent already agree\n * on the wire; this just keeps the definition itself from growing an empty\n * `\"variables\": []` on the first open of the tab.\n */\nexport function variablesForSave(rows: WorkflowVariableRow[]): WorkflowVariableRow[] | undefined {\n if (rows.length === 0) return undefined;\n return rows.map((r) => {\n const out: WorkflowVariableRow = { key: r.key };\n if (r.type !== undefined) out.type = r.type;\n if (r.required) out.required = true;\n if (r.default !== undefined) out.default = r.default;\n return out;\n });\n}\n\n/**\n * Every index whose `key` repeats an earlier row's key. `resolveVariables`\n * writes `vars[v.key]` in a loop with no duplicate check (`run.ts:74-80`), so\n * a later row silently wins — this is informational only (the tab marks the\n * row; nothing here blocks a save), never de-duping or rejecting.\n */\nexport function duplicateKeyIndexes(rows: WorkflowVariableRow[]): number[] {\n const seen = new Set<string>();\n const out: number[] = [];\n rows.forEach((r, i) => {\n if (seen.has(r.key)) out.push(i);\n else seen.add(r.key);\n });\n return out;\n}\n\n/**\n * The `var.*` names to offer row `index`'s expression rail: the keys of\n * rows **strictly above** it, then `projectVars`, deduped, with blanks\n * dropped. Declaration order is resolution order (D-5), so a row can only\n * reference a variable declared earlier than itself — offering a row at or\n * below `index` would suggest a forward reference the engine rejects\n * (T2.1.1). This is the offered rail only; it is not validation.\n */\nexport function varsRailFor(\n rows: WorkflowVariableRow[],\n index: number,\n projectVars: string[],\n): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const k of [...rows.slice(0, index).map((r) => r.key), ...projectVars]) {\n if (k === \"\" || seen.has(k)) continue;\n seen.add(k);\n out.push(k);\n }\n return out;\n}\n\n/** `true` if `v` is an `ExprValue` envelope — the two-key check `@w6w/ui`'s\n * `isExprValue` (`ui/src/types.ts:301-309`) makes, re-implemented locally\n * because this module cannot import `@w6w/ui` at value level (see the\n * module docstring). Mirrors `trigger-preview.ts:102-119`'s sanctioned\n * pattern for the same constraint — this is not duplication. */\nexport function isExprDefault(v: unknown): boolean {\n return (\n typeof v === \"object\" &&\n v !== null &&\n !Array.isArray(v) &&\n (v as { type?: unknown }).type === \"expr\" &&\n Array.isArray((v as { parts?: unknown }).parts)\n );\n}\n\n/** One field the run page's generated form fills — structurally assignable\n * to `@w6w/ui/flow`'s `TriggerFieldDef` (all fields optional) with no cast. */\nexport interface RunFormField {\n key: string;\n type?: WorkflowVariableRow[\"type\"];\n default?: unknown;\n required?: boolean;\n}\n\n/**\n * Project a workflow's declared variables into the run page's form fields.\n *\n * A row whose `default` is an `ExprValue` envelope is a server-side\n * computation (its value is resolved at run time, not authored on the\n * client), so it is emitted with **`default` dropped and `required: false`**\n * — never as a value `ui`'s `seedValues` would `String(...)` the envelope\n * into — and its key is listed in `computed` so the host can label the field\n * \"computed at run time\" and post nothing for it. A row with a blank/missing\n * key is dropped, mirroring `@w6w/ui`'s `fieldsToParams`, which does the same\n * before turning field definitions into a fillable form.\n */\nexport function runFormFields(rows: WorkflowVariableRow[]): {\n fields: RunFormField[];\n computed: string[];\n} {\n const fields: RunFormField[] = [];\n const computed: string[] = [];\n for (const r of rows) {\n if (r.key.trim() === \"\") continue;\n if (isExprDefault(r.default)) {\n fields.push({ key: r.key, type: r.type, required: false });\n computed.push(r.key);\n continue;\n }\n fields.push({ key: r.key, type: r.type, default: r.default, required: r.required });\n }\n return { fields, computed };\n}\n","/**\n * The pure decisions behind a workflow's **Starting data** (`Workflow.initialState`,\n * core/rfcs/workflow.md; ruling R8): a literal JSON object that seeds the run's\n * state tree. It rides inside the workflow definition as a top-level key, the\n * same way `variables` does, so the Settings tab only reads and writes that key.\n *\n * Seed layering (R2', later wins): project variables → starting data → the\n * workflow's own / the caller's variables.\n *\n * Pure, React-free, `.ts`, **no value import of `@w6w/ui`** — the same header\n * rule as `workflow-variables.ts` (studio's `test:unit` has no jsx loader).\n */\nimport { STATE_LIMITS } from \"@w6w/expr\";\nimport type { WorkflowVariableRow } from \"./workflow-variables.ts\";\n\n/** Why a Starting data draft cannot be saved. */\nexport type StartingDataProblem = \"invalid_json\" | \"not_object\" | \"too_large\";\n\n/** The outcome of reading a Starting data draft for save. `value: undefined` drops the key. */\nexport type StartingDataForSave =\n | { ok: true; value: Record<string, unknown> | undefined }\n | { ok: false; reason: StartingDataProblem };\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return v !== null && typeof v === \"object\" && !Array.isArray(v);\n}\n\n/**\n * Read a definition's `initialState` field. Takes `unknown` because the source is\n * `JSON.parse`d and the `</>` editor lets an author type anything: only a plain\n * object counts; anything else reads as \"no starting data\".\n */\nexport function readStartingData(raw: unknown): Record<string, unknown> | undefined {\n return isPlainObject(raw) ? raw : undefined;\n}\n\n/**\n * Turn the tab's JSON text into the value `patchMeta({ initialState })` saves.\n * Blank text and `{}` both mean \"no starting data\" (`value: undefined`, so the\n * key is dropped from the definition). Anything but a plain object is refused,\n * as is an object whose serialised form exceeds `STATE_LIMITS.initialChars`\n * (measured exactly as the server measures it: `JSON.stringify(v).length`).\n */\nexport function startingDataForSave(text: string): StartingDataForSave {\n if (text.trim() === \"\") return { ok: true, value: undefined };\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n return { ok: false, reason: \"invalid_json\" };\n }\n if (!isPlainObject(parsed)) return { ok: false, reason: \"not_object\" };\n if (JSON.stringify(parsed).length > STATE_LIMITS.initialChars) {\n return { ok: false, reason: \"too_large\" };\n }\n if (Object.keys(parsed).length === 0) return { ok: true, value: undefined };\n return { ok: true, value: parsed };\n}\n\n/**\n * The declared variable keys that are also top-level keys of the starting data —\n * on those keys the variable's value wins (R2'). Variable declaration order, no\n * duplicates, no empty keys.\n */\nexport function startingDataCollisions(\n initial: Record<string, unknown> | undefined,\n variables: readonly WorkflowVariableRow[],\n): string[] {\n if (!initial) return [];\n const out: string[] = [];\n for (const v of variables) {\n if (v.key === \"\" || out.includes(v.key)) continue;\n if (Object.hasOwn(initial, v.key)) out.push(v.key);\n }\n return out;\n}\n","/**\n * Pure decisions behind the right rail's Code tool (`src/ui/rail/CodeTool.tsx`).\n * Split out so `node --test` can gate them directly — mirrors\n * `src/lib/alias-rail.ts`'s own reason for existing: `node --test` throws\n * `ERR_UNKNOWN_FILE_EXTENSION` on any `@w6w/ui`-adjacent import, and\n * `src/ui/workspace.tsx` sits one hop from that barrel through `Layout.tsx`'s\n * import graph. So this module declares its own structural mirror of\n * `WorkspaceCallable` instead of importing it.\n */\nimport type { SnippetCallable, SnippetInput } from \"./sdk-snippets.ts\";\n\n/** Structural mirror of T2.1.2's widened `WorkspaceCallable` (`src/ui/workspace.tsx`). */\nexport type RailCallable =\n | { kind: \"function\"; id: string; key?: string; inputs?: readonly SnippetInput[]; alias?: string }\n | {\n kind: \"endpoint\";\n id: string;\n key?: string;\n invokeUrl?: string;\n invokeUrlByKey?: string;\n urlForm?: \"id\" | \"key\";\n alias?: string;\n inputs?: readonly SnippetInput[];\n }\n | { kind: \"workflow\"; id: string; label?: string; key?: string }\n | { kind: \"connection\"; id: string; action?: string; params?: readonly SnippetInput[] }\n | null;\n\n/**\n * Is a \"Call from code\" panel meaningful for this context? Mirrors\n * `alias-rail.ts`'s `targetForCallable` fail-closed shape exactly (its own\n * comment: *\"'connection' and no resource at all both fail closed to null —\n * house style\"*) — a bare `\"connection\"` (no `action`) and `null` both answer `false`.\n */\nexport function isAvailable(ctx: RailCallable): boolean {\n if (!ctx) return false;\n switch (ctx.kind) {\n case \"function\":\n case \"endpoint\":\n case \"workflow\":\n return true;\n // A bare connection has no snippet; only the action page (which names one) does.\n case \"connection\":\n return !!ctx.action;\n default:\n return false;\n }\n}\n\n/**\n * The widened-union -> `SnippetCallable` conversion `CodeTool.Panel` hands to\n * `CallFromCodeBody`. `null` for a context this tool has no snippet for\n * (a connection without an `action`, or no resource at all) — defensive, since `isAvailable`\n * already keeps the tool off the strip for those.\n *\n * The one easy-to-miss field: `WorkspaceCallable`'s `label` maps to\n * `SnippetCallable`'s `workflow` arm's `displayName` — NOT the same field\n * name. A naive `{...ctx}` spread compiles (both optional) but silently\n * drops the label everywhere it matters, never caught by `tsc`.\n */\nexport function toSnippetCallable(ctx: RailCallable): SnippetCallable | null {\n if (!ctx) return null;\n switch (ctx.kind) {\n case \"function\":\n return { kind: \"function\", id: ctx.id, key: ctx.key, inputs: ctx.inputs, alias: ctx.alias };\n case \"endpoint\":\n return {\n kind: \"endpoint\",\n id: ctx.id,\n key: ctx.key,\n invokeUrl: ctx.invokeUrl,\n invokeUrlByKey: ctx.invokeUrlByKey,\n urlForm: ctx.urlForm,\n alias: ctx.alias,\n inputs: ctx.inputs,\n };\n case \"workflow\":\n return { kind: \"workflow\", id: ctx.id, displayName: ctx.label, key: ctx.key };\n case \"connection\":\n return ctx.action\n ? { kind: \"connection\", id: ctx.id, action: ctx.action, params: ctx.params }\n : null;\n default:\n return null;\n }\n}\n","/**\n * The authoring-time half of the error-handler recursion guard. The server\n * compares resolved values at dispatch time; this small, pure decision keeps\n * the rail from creating the known-identical no-adapter case in the first\n * place without losing an adapter imported or authored elsewhere.\n */\nexport type ErrorHandlerSelfDecision = \"allow\" | \"warn\" | \"block\";\n\nexport interface ErrorHandlerSelfInput {\n resource: { kind: string; id: string };\n target: { kind: string; id: string };\n hasAdapter: boolean;\n}\n\n/**\n * Only Function and Workflow targets can re-enter the currently edited\n * resource. Actions are always allowed. A self-target with no adapter passes\n * the failed input through unchanged, so it is refused; an adapter is kept\n * and called out because only the runtime can determine its resolved values.\n */\nexport function errorHandlerSelfDecision({\n resource,\n target,\n hasAdapter,\n}: ErrorHandlerSelfInput): ErrorHandlerSelfDecision {\n const selfTarget =\n (target.kind === \"function\" || target.kind === \"workflow\") &&\n target.kind === resource.kind &&\n target.id === resource.id;\n if (!selfTarget) return \"allow\";\n return hasAdapter ? \"warn\" : \"block\";\n}\n","/**\n * Pure `Doc[]` → `ExpressionOptions` projections for the ƒx picker's\n * Documents group — extracted out of `ExpressionScope.tsx` so studio's\n * Node-native `test:unit` runner (globbed to `src/lib/__tests__/`,\n * `src/api/__tests__/` and `src/repos/__tests__/` only — `.ai/PLANNER.md`\n * fact 10) can reach it. No React, no import from `src/ui/` — `@w6w/ui`'s\n * `ExpressionDocumentSource` interface is not imported either (it is not\n * exported from `@w6w/ui`'s barrel, D-P3): the object literals returned below\n * are structurally identical to it, so TypeScript carries the shape without a\n * type import.\n *\n * ## The gate — mirrors the engine's own, bit-for-bit\n *\n * A document contributes field data **iff**: `doc.format === \"json\"` AND\n * `JSON.parse(doc.content)` succeeds into a plain object, OR\n * `doc.format === \"yaml\"` AND npm `yaml`'s `parse(doc.content)` succeeds into\n * a plain object — where *plain object* means\n * `typeof v === \"object\" && v !== null && !Array.isArray(v)`. This mirrors\n * the engine's own gate (`documentsSeed` /\n * `packages/server/packages/api/run-seed.ts`, read-only, out of scope)\n * bit-for-bit for each format: `format === \"json\"` or `format === \"yaml\"`,\n * then a `try/catch` parse, falling back to the raw content string on either\n * a non-matching format or a throw. Reproduced here so the picker never\n * offers a ref the run scope itself would refuse to resolve\n * (`render_ref_unresolved`) — `text`/`markdown`/`html` documents, and a\n * `json`/`yaml` document whose parse throws or yields a non-plain-object, are\n * excluded.\n *\n * The two parsers are not identical for every input — `@std/yaml` (server,\n * `{ schema: \"core\" }`) and npm `yaml` (here) diverge on tab-indented content\n * and on an unresolvable custom tag (`!!js/function`), both accepted, tested\n * debt (D-3). Every other input, including a plain JSON object (JSON is a\n * subset of YAML), agrees between the two.\n *\n * Field keys are enumerated RAW and UNFILTERED by {@link projectDocumentSources}\n * — arbitrary user-authored JSON keys (which can contain `.`/`{`/`}`/\n * whitespace) reach the modal; `isRefSafeKey` filters them exactly once, at\n * the modal's render site (`ExpressionEditorModal.tsx`), never here\n * (`building-blocks.md`: \"enumerate raw at the source, filter once at the\n * single render site\").\n */\nimport type { Doc } from \"@w6w/sdk\";\nimport { parse as parseYaml } from \"yaml\";\n\n/** One document's contribution to `ExpressionOptions.documents` — structurally\n * identical to `@w6w/ui`'s (unexported) `ExpressionDocumentSource`. */\nexport interface DocumentSource {\n key: string;\n fields?: { key: string }[];\n}\n\n/**\n * `doc`'s parsed content when the gate holds, else `null`. The one place both\n * functions below apply the gate, so they cannot silently disagree on it.\n */\nfunction gatedFields(doc: Doc): Record<string, unknown> | null {\n let parsed: unknown;\n if (doc.format === \"json\") {\n try {\n parsed = JSON.parse(doc.content);\n } catch {\n return null;\n }\n } else if (doc.format === \"yaml\") {\n try {\n parsed = parseYaml(doc.content);\n } catch {\n return null;\n }\n } else {\n return null;\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return null;\n return parsed as Record<string, unknown>;\n}\n\n/**\n * The `ExpressionOptions.documents` array: `{ key }` for every document, plus\n * `fields` (raw, unfiltered top-level keys) when the gate holds AND the\n * parsed object has at least one key. `fields` is OMITTED (not `[]`) both\n * when the gate fails and when it holds but yields zero keys — a consumer\n * must be able to tell \"nothing declared\" from \"declared none\".\n */\nexport function projectDocumentSources(docs: Doc[]): DocumentSource[] {\n return docs.map((d) => {\n const parsed = gatedFields(d);\n if (!parsed) return { key: d.key };\n const keys = Object.keys(parsed);\n return keys.length > 0 ? { key: d.key, fields: keys.map((key) => ({ key })) } : { key: d.key };\n });\n}\n\n/**\n * The `sampleValues` entries the ƒx Result preview substitutes for document\n * refs: `documents.<key>` → the document's raw content, for every document\n * (unconditional, exactly as before this project), PLUS `documents.<key>.<field>`\n * → the field's own parsed value, for the gated set only. Without the second\n * half, every field ref this project newly makes pickable would preview as\n * the empty string (`renderResult` does an exact flat-key lookup).\n */\nexport function documentSampleValues(docs: Doc[]): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const d of docs) {\n out[`documents.${d.key}`] = d.content;\n const parsed = gatedFields(d);\n if (!parsed) continue;\n for (const [key, value] of Object.entries(parsed)) {\n out[`documents.${d.key}.${key}`] = value;\n }\n }\n return out;\n}\n"],"names":["VARIABLE_TYPES","readVariables","raw","out","entry","e","row","variablesForSave","rows","r","duplicateKeyIndexes","seen","i","varsRailFor","index","projectVars","k","isExprDefault","v","runFormFields","fields","computed","isPlainObject","readStartingData","startingDataForSave","text","parsed","STATE_LIMITS","startingDataCollisions","initial","variables","isAvailable","ctx","toSnippetCallable","errorHandlerSelfDecision","resource","target","hasAdapter","gatedFields","doc","parseYaml","projectDocumentSources","docs","d","keys","key","documentSampleValues","value"],"mappings":";;AA8BA,MAAMA,wBAAqB,IAAI,CAAC,UAAU,UAAU,WAAW,UAAU,OAAO,CAAC;AAa1E,SAASC,EAAcC,GAAqC;AACjE,MAAI,CAAC,MAAM,QAAQA,CAAG,UAAU,CAAA;AAChC,QAAMC,IAA6B,CAAA;AACnC,aAAWC,KAASF,GAAK;AACvB,QAAI,OAAOE,KAAU,YAAYA,MAAU,QAAQ,MAAM,QAAQA,CAAK,EAAG;AACzE,UAAMC,IAAID,GACJE,IAA2B,EA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