@chatlychat/cli 0.1.4 → 0.1.5
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/commands/ai.d.ts +4 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +149 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/common.d.ts +79 -0
- package/dist/commands/common.d.ts.map +1 -0
- package/dist/commands/common.js +194 -0
- package/dist/commands/common.js.map +1 -0
- package/dist/commands/config.d.ts +40 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +336 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/insights.d.ts +5 -0
- package/dist/commands/insights.d.ts.map +1 -0
- package/dist/commands/insights.js +277 -0
- package/dist/commands/insights.js.map +1 -0
- package/dist/commands/integrations.d.ts +15 -0
- package/dist/commands/integrations.d.ts.map +1 -0
- package/dist/commands/integrations.js +256 -0
- package/dist/commands/integrations.js.map +1 -0
- package/dist/commands/resources.d.ts +19 -7
- package/dist/commands/resources.d.ts.map +1 -1
- package/dist/commands/resources.js +92 -167
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/workspace-as-code.d.ts +27 -0
- package/dist/commands/workspace-as-code.d.ts.map +1 -0
- package/dist/commands/workspace-as-code.js +377 -0
- package/dist/commands/workspace-as-code.js.map +1 -0
- package/dist/help.d.ts +25 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +104 -8
- package/dist/help.js.map +1 -1
- package/dist/run.d.ts +17 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +88 -41
- package/dist/run.js.map +1 -1
- package/dist/wac/__tests__/wac-fixtures.d.ts +20 -0
- package/dist/wac/__tests__/wac-fixtures.d.ts.map +1 -0
- package/dist/wac/__tests__/wac-fixtures.js +38 -0
- package/dist/wac/__tests__/wac-fixtures.js.map +1 -0
- package/dist/wac/apply.d.ts +113 -0
- package/dist/wac/apply.d.ts.map +1 -0
- package/dist/wac/apply.js +265 -0
- package/dist/wac/apply.js.map +1 -0
- package/dist/wac/diff.d.ts +137 -0
- package/dist/wac/diff.d.ts.map +1 -0
- package/dist/wac/diff.js +413 -0
- package/dist/wac/diff.js.map +1 -0
- package/dist/wac/document.d.ts +110 -0
- package/dist/wac/document.d.ts.map +1 -0
- package/dist/wac/document.js +429 -0
- package/dist/wac/document.js.map +1 -0
- package/dist/wac/render.d.ts +52 -0
- package/dist/wac/render.d.ts.map +1 -0
- package/dist/wac/render.js +156 -0
- package/dist/wac/render.js.map +1 -0
- package/dist/wac/resource-def.d.ts +116 -0
- package/dist/wac/resource-def.d.ts.map +1 -0
- package/dist/wac/resource-def.js +44 -0
- package/dist/wac/resource-def.js.map +1 -0
- package/dist/wac/resources.d.ts +104 -0
- package/dist/wac/resources.d.ts.map +1 -0
- package/dist/wac/resources.js +541 -0
- package/dist/wac/resources.js.map +1 -0
- package/dist/wac/values.d.ts +16 -0
- package/dist/wac/values.d.ts.map +1 -0
- package/dist/wac/values.js +53 -0
- package/dist/wac/values.js.map +1 -0
- package/package.json +2 -1
- package/dist/cli.spec.d.ts +0 -2
- package/dist/cli.spec.d.ts.map +0 -1
- package/dist/cli.spec.js +0 -226
- package/dist/cli.spec.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/wac/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAoB,MAAM,gBAAgB,CAAC;AAmCtF,SAAS,IAAI,CAAC,IAAY,EAAE,EAAU;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,GAAgB,EAChB,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vC,EAAE,CACH,CAAC;QACF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;IACpF,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,+DAA+D,CAAC;IACzE,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The diff. Pure: a document plus the live rows in, a plan out.
|
|
3
|
+
*
|
|
4
|
+
* No transport, no filesystem, no clock, nothing injected. That is not
|
|
5
|
+
* fastidiousness — it is what lets the spec drive this with literal objects,
|
|
6
|
+
* and it is half the proof that `chatly plan` writes nothing: the function
|
|
7
|
+
* that decides what WOULD change has no way to change anything. The other
|
|
8
|
+
* half is a recording transport asserting zero non-GET requests, in
|
|
9
|
+
* `wac.spec.ts`.
|
|
10
|
+
*
|
|
11
|
+
* ═══ WHAT A DIFF MUST NOT DO ══════════════════════════════════════════════
|
|
12
|
+
*
|
|
13
|
+
* Report a change that is not one. A plan that says "3 to change" against a
|
|
14
|
+
* workspace nobody has touched is a plan people stop reading, and then
|
|
15
|
+
* `apply` gets run blind — which is the failure this whole feature exists to
|
|
16
|
+
* prevent. Four rules come out of that:
|
|
17
|
+
*
|
|
18
|
+
* 1. ONLY the fields the document declares are compared. A server field the
|
|
19
|
+
* file says nothing about is unmanaged and is never mentioned. So a
|
|
20
|
+
* document can describe four fields of a bot and leave the other twenty
|
|
21
|
+
* to the dashboard, which is how a team actually works.
|
|
22
|
+
*
|
|
23
|
+
* 2. A field that cannot be READ BACK is never compared. Two kinds, both
|
|
24
|
+
* handled: the ones declared `opaque` (a customer card's `headers` are
|
|
25
|
+
* write-only by design — the read shape returns `headerNames`, names and
|
|
26
|
+
* never values, because that is where the bearer token is), and the ones
|
|
27
|
+
* the server hands back as the literal `__redacted__`, detected at
|
|
28
|
+
* runtime so a field nobody told this file about still cannot produce a
|
|
29
|
+
* phantom change. Each is reported once, as a note, saying it is
|
|
30
|
+
* unknowable rather than unchanged.
|
|
31
|
+
*
|
|
32
|
+
* 3. `undefined` and absent are one state. JSON has no `undefined`, so a key
|
|
33
|
+
* the server omits and a key it sends as `undefined` are the same thing,
|
|
34
|
+
* and only `null` is a value.
|
|
35
|
+
*
|
|
36
|
+
* 4. The live row is PROJECTED into the document's vocabulary first. A bot's
|
|
37
|
+
* `webhookUrl` comes back under `externalAgent`; an email template's
|
|
38
|
+
* customised copy comes back under `override`. Comparing against the
|
|
39
|
+
* un-projected row reports a change on every run, for ever. See
|
|
40
|
+
* `resources.ts`.
|
|
41
|
+
*
|
|
42
|
+
* ═══ AND WHAT IT MUST DO ══════════════════════════════════════════════════
|
|
43
|
+
*
|
|
44
|
+
* Refuse to guess. Two live rows with one natural key, a reference to a bot
|
|
45
|
+
* that neither exists nor is being created, a changed field no route can
|
|
46
|
+
* write — each produces a `blocked` item that `apply` will not touch, with
|
|
47
|
+
* the reason on the line. The alternative in every case is picking one and
|
|
48
|
+
* being wrong silently, which is how the wrong resource gets overwritten.
|
|
49
|
+
*/
|
|
50
|
+
import { type Action, type ResourceDef, type UpdateRoute } from './resources.js';
|
|
51
|
+
import type { DocumentRow, WacDocument } from './document.js';
|
|
52
|
+
export { isRedacted, REDACTED, sameValue } from './values.js';
|
|
53
|
+
export interface FieldChange {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
/** Absent on a create. */
|
|
56
|
+
readonly from?: unknown;
|
|
57
|
+
readonly to: unknown;
|
|
58
|
+
/** The route that would write it. Undefined means nothing can. */
|
|
59
|
+
readonly route: UpdateRoute | undefined;
|
|
60
|
+
}
|
|
61
|
+
export interface PlanItem {
|
|
62
|
+
readonly type: string;
|
|
63
|
+
readonly label: string;
|
|
64
|
+
/** As written in the document, or as the server spells it for an orphan. */
|
|
65
|
+
readonly key: string;
|
|
66
|
+
readonly action: Action;
|
|
67
|
+
/** The server's id, for an update or a prune. */
|
|
68
|
+
readonly liveId: string | undefined;
|
|
69
|
+
readonly changes: ReadonlyArray<FieldChange>;
|
|
70
|
+
/** True of this row but not a change: unreadable fields, full replaces. */
|
|
71
|
+
readonly notes: ReadonlyArray<string>;
|
|
72
|
+
/** Set on `blocked`: why apply will not try. */
|
|
73
|
+
readonly reason: string | undefined;
|
|
74
|
+
readonly row: DocumentRow | undefined;
|
|
75
|
+
/** Wire field → id, for references already resolvable at plan time. */
|
|
76
|
+
readonly resolved: Readonly<Record<string, string>>;
|
|
77
|
+
/** `type/key` for each reference, so apply can skip a failed dependency. */
|
|
78
|
+
readonly dependsOn: ReadonlyArray<string>;
|
|
79
|
+
}
|
|
80
|
+
export interface Plan {
|
|
81
|
+
readonly items: ReadonlyArray<PlanItem>;
|
|
82
|
+
/** File-level observations: an unknown field, a list at its cap. */
|
|
83
|
+
readonly warnings: ReadonlyArray<string>;
|
|
84
|
+
/** Types whose live list may be incomplete, so `--prune` is refused. */
|
|
85
|
+
readonly pruneUnsafe: ReadonlyArray<string>;
|
|
86
|
+
}
|
|
87
|
+
export interface LiveSection {
|
|
88
|
+
/** Every row the list route returned, exactly as it came. */
|
|
89
|
+
readonly rows: ReadonlyArray<Record<string, unknown>>;
|
|
90
|
+
/** The route caps its answer and the answer came back at the cap. */
|
|
91
|
+
readonly possiblyTruncated?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Build the plan.
|
|
95
|
+
*
|
|
96
|
+
* `live` holds only the types the document mentions. A type the file says
|
|
97
|
+
* nothing about is not read, not diffed and not reported: an unmanaged
|
|
98
|
+
* resource is not drift, and reporting it as such would make every plan a
|
|
99
|
+
* wall of noise about the dashboard.
|
|
100
|
+
*/
|
|
101
|
+
export interface PlanOptions {
|
|
102
|
+
/**
|
|
103
|
+
* Treat every unreadable field as changed.
|
|
104
|
+
*
|
|
105
|
+
* `--write-only`. By default a field that cannot be read back is reported
|
|
106
|
+
* as unknowable and left alone, because a diff that says "changed" on every
|
|
107
|
+
* run is a diff nobody reads. This is the escape: you rotated the card's
|
|
108
|
+
* `Authorization` header in the file and need it pushed, and no diff can
|
|
109
|
+
* ever tell you that for you.
|
|
110
|
+
*/
|
|
111
|
+
readonly writeOnly?: boolean;
|
|
112
|
+
}
|
|
113
|
+
export declare function buildPlan(doc: WacDocument, live: ReadonlyMap<string, LiveSection>, opts?: PlanOptions): Plan;
|
|
114
|
+
/**
|
|
115
|
+
* A field the document declares that NO live row carries.
|
|
116
|
+
*
|
|
117
|
+
* This is what stands in for a per-resource field allow-list, and it is
|
|
118
|
+
* better evidence than one: the vocabulary comes from the server on every
|
|
119
|
+
* run, so it cannot drift out of step with an API that shipped a field
|
|
120
|
+
* yesterday. CLAUDE.md's `helpProfile` / `profile` bug — a key zod strips,
|
|
121
|
+
* answering 200 while doing nothing — is exactly what it catches, and
|
|
122
|
+
* `unwritable` in `resources.ts` catches the mirror case (a field the server
|
|
123
|
+
* returns and no write path accepts).
|
|
124
|
+
*
|
|
125
|
+
* Two limits, both reported rather than hidden:
|
|
126
|
+
*
|
|
127
|
+
* - With no live rows there is nothing to compare against, so a brand-new
|
|
128
|
+
* workspace gets no warnings at all.
|
|
129
|
+
* - A legitimately optional field nobody in this workspace has set produces
|
|
130
|
+
* a false positive. That is why it is a warning and not a refusal: being
|
|
131
|
+
* wrong costs one line of output, where refusing wrongly costs a config
|
|
132
|
+
* file that cannot be applied.
|
|
133
|
+
*/
|
|
134
|
+
export declare function vocabularyWarnings(def: ResourceDef, rows: ReadonlyArray<DocumentRow>, liveRows: ReadonlyArray<Record<string, unknown>>): ReadonlyArray<string>;
|
|
135
|
+
/** Counts for the summary line. */
|
|
136
|
+
export declare function tally(plan: Plan): Record<Action, number>;
|
|
137
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/wac/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC7C,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,Q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I,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxD"}
|
package/dist/wac/diff.js
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The diff. Pure: a document plus the live rows in, a plan out.
|
|
3
|
+
*
|
|
4
|
+
* No transport, no filesystem, no clock, nothing injected. That is not
|
|
5
|
+
* fastidiousness — it is what lets the spec drive this with literal objects,
|
|
6
|
+
* and it is half the proof that `chatly plan` writes nothing: the function
|
|
7
|
+
* that decides what WOULD change has no way to change anything. The other
|
|
8
|
+
* half is a recording transport asserting zero non-GET requests, in
|
|
9
|
+
* `wac.spec.ts`.
|
|
10
|
+
*
|
|
11
|
+
* ═══ WHAT A DIFF MUST NOT DO ══════════════════════════════════════════════
|
|
12
|
+
*
|
|
13
|
+
* Report a change that is not one. A plan that says "3 to change" against a
|
|
14
|
+
* workspace nobody has touched is a plan people stop reading, and then
|
|
15
|
+
* `apply` gets run blind — which is the failure this whole feature exists to
|
|
16
|
+
* prevent. Four rules come out of that:
|
|
17
|
+
*
|
|
18
|
+
* 1. ONLY the fields the document declares are compared. A server field the
|
|
19
|
+
* file says nothing about is unmanaged and is never mentioned. So a
|
|
20
|
+
* document can describe four fields of a bot and leave the other twenty
|
|
21
|
+
* to the dashboard, which is how a team actually works.
|
|
22
|
+
*
|
|
23
|
+
* 2. A field that cannot be READ BACK is never compared. Two kinds, both
|
|
24
|
+
* handled: the ones declared `opaque` (a customer card's `headers` are
|
|
25
|
+
* write-only by design — the read shape returns `headerNames`, names and
|
|
26
|
+
* never values, because that is where the bearer token is), and the ones
|
|
27
|
+
* the server hands back as the literal `__redacted__`, detected at
|
|
28
|
+
* runtime so a field nobody told this file about still cannot produce a
|
|
29
|
+
* phantom change. Each is reported once, as a note, saying it is
|
|
30
|
+
* unknowable rather than unchanged.
|
|
31
|
+
*
|
|
32
|
+
* 3. `undefined` and absent are one state. JSON has no `undefined`, so a key
|
|
33
|
+
* the server omits and a key it sends as `undefined` are the same thing,
|
|
34
|
+
* and only `null` is a value.
|
|
35
|
+
*
|
|
36
|
+
* 4. The live row is PROJECTED into the document's vocabulary first. A bot's
|
|
37
|
+
* `webhookUrl` comes back under `externalAgent`; an email template's
|
|
38
|
+
* customised copy comes back under `override`. Comparing against the
|
|
39
|
+
* un-projected row reports a change on every run, for ever. See
|
|
40
|
+
* `resources.ts`.
|
|
41
|
+
*
|
|
42
|
+
* ═══ AND WHAT IT MUST DO ══════════════════════════════════════════════════
|
|
43
|
+
*
|
|
44
|
+
* Refuse to guess. Two live rows with one natural key, a reference to a bot
|
|
45
|
+
* that neither exists nor is being created, a changed field no route can
|
|
46
|
+
* write — each produces a `blocked` item that `apply` will not touch, with
|
|
47
|
+
* the reason on the line. The alternative in every case is picking one and
|
|
48
|
+
* being wrong silently, which is how the wrong resource gets overwritten.
|
|
49
|
+
*/
|
|
50
|
+
import { looksLikeCredential, normalizedKey, projected, routeForField, } from './resources.js';
|
|
51
|
+
import { isRedacted, REDACTED, sameValue } from './values.js';
|
|
52
|
+
export { isRedacted, REDACTED, sameValue } from './values.js';
|
|
53
|
+
function indexLive(def, rows) {
|
|
54
|
+
const byKey = new Map();
|
|
55
|
+
const ambiguous = new Set();
|
|
56
|
+
let keyless = 0;
|
|
57
|
+
for (const raw of rows) {
|
|
58
|
+
const row = projected(def, raw);
|
|
59
|
+
const key = row[def.naturalKey];
|
|
60
|
+
if (typeof key !== 'string' || key.length === 0) {
|
|
61
|
+
keyless += 1;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const norm = normalizedKey(def, key);
|
|
65
|
+
if (byKey.has(norm)) {
|
|
66
|
+
ambiguous.add(norm);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
byKey.set(norm, { ...row, [def.idField]: raw[def.idField] });
|
|
70
|
+
}
|
|
71
|
+
return { byKey, ambiguous, keyless };
|
|
72
|
+
}
|
|
73
|
+
export function buildPlan(doc, live, opts = {}) {
|
|
74
|
+
const items = [];
|
|
75
|
+
const warnings = [];
|
|
76
|
+
const pruneUnsafe = [];
|
|
77
|
+
const known = new Map();
|
|
78
|
+
for (const section of doc.sections) {
|
|
79
|
+
const { def } = section;
|
|
80
|
+
const liveSection = live.get(def.type) ?? { rows: [] };
|
|
81
|
+
const index = indexLive(def, liveSection.rows);
|
|
82
|
+
const ids = new Map();
|
|
83
|
+
for (const [key, row] of index.byKey) {
|
|
84
|
+
const id = row[def.idField];
|
|
85
|
+
ids.set(key, typeof id === 'string' ? id : '');
|
|
86
|
+
}
|
|
87
|
+
known.set(def.type, ids);
|
|
88
|
+
warnings.push(...sectionWarnings(def, section.rows, liveSection, index));
|
|
89
|
+
if (liveSection.possiblyTruncated === true) {
|
|
90
|
+
pruneUnsafe.push(def.type);
|
|
91
|
+
}
|
|
92
|
+
const declared = new Set();
|
|
93
|
+
for (const row of section.rows) {
|
|
94
|
+
const norm = normalizedKey(def, row.key);
|
|
95
|
+
declared.add(norm);
|
|
96
|
+
const item = planRow(def, row, norm, index, known, opts);
|
|
97
|
+
items.push(item);
|
|
98
|
+
if (item.action === 'create') {
|
|
99
|
+
// A later section may reference it; the id is unknown until apply.
|
|
100
|
+
ids.set(norm, null);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (const [key, row] of index.byKey) {
|
|
104
|
+
if (declared.has(key)) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const id = row[def.idField];
|
|
108
|
+
items.push({
|
|
109
|
+
type: def.type,
|
|
110
|
+
label: def.label,
|
|
111
|
+
key: typeof row[def.naturalKey] === 'string' ? String(row[def.naturalKey]) : key,
|
|
112
|
+
action: 'orphan',
|
|
113
|
+
liveId: typeof id === 'string' ? id : undefined,
|
|
114
|
+
changes: [],
|
|
115
|
+
notes: def.remove === null
|
|
116
|
+
? [`\`--prune\` cannot delete this: ${def.removeBlocked ?? 'no DELETE route.'}`]
|
|
117
|
+
: [],
|
|
118
|
+
reason: undefined,
|
|
119
|
+
row: undefined,
|
|
120
|
+
resolved: {},
|
|
121
|
+
dependsOn: [],
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return { items, warnings, pruneUnsafe };
|
|
126
|
+
}
|
|
127
|
+
function planRow(def, row, norm, index, known, opts) {
|
|
128
|
+
const notes = [];
|
|
129
|
+
const resolved = {};
|
|
130
|
+
const dependsOn = [];
|
|
131
|
+
/* ── References first: an unresolvable one blocks the whole row. ────── */
|
|
132
|
+
for (const [wire, ref] of Object.entries(row.refs)) {
|
|
133
|
+
dependsOn.push(`${ref.type}/${ref.key}`);
|
|
134
|
+
const target = known.get(ref.type);
|
|
135
|
+
const normRef = ref.key;
|
|
136
|
+
if (target === undefined || !target.has(normRef)) {
|
|
137
|
+
return blocked(def, row, `names ${ref.type}/${normRef}, which is neither on the server nor created by this ` +
|
|
138
|
+
`plan. Add it under \`resources.${ref.type}\`, or correct the key.`, dependsOn);
|
|
139
|
+
}
|
|
140
|
+
const id = target.get(normRef);
|
|
141
|
+
if (id === null || id === undefined || id === '') {
|
|
142
|
+
notes.push(`${wire} resolves to ${ref.type}/${normRef}, which this plan creates first.`);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
resolved[wire] = id;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (index.ambiguous.has(norm)) {
|
|
149
|
+
return blocked(def, row, `more than one ${def.label} on the server has ${def.naturalKey} "${row.key}", and ` +
|
|
150
|
+
`${def.naturalKey} is what this file matches on. Nothing will be written to either — ` +
|
|
151
|
+
'picking one of two is how the wrong resource gets overwritten. Rename or delete the ' +
|
|
152
|
+
'duplicate first.', dependsOn);
|
|
153
|
+
}
|
|
154
|
+
const liveRow = index.byKey.get(norm);
|
|
155
|
+
if (liveRow === undefined) {
|
|
156
|
+
return planCreate(def, row, notes, resolved, dependsOn);
|
|
157
|
+
}
|
|
158
|
+
return planUpdate(def, row, liveRow, notes, resolved, dependsOn, opts);
|
|
159
|
+
}
|
|
160
|
+
function planCreate(def, row, notes, resolved, dependsOn) {
|
|
161
|
+
if (def.create === null) {
|
|
162
|
+
return blocked(def, row, def.type === 'emailTemplates'
|
|
163
|
+
? `"${row.key}" is not one of the five template kinds. \`chatly email-templates list\` ` +
|
|
164
|
+
'names them, and all five always exist — so a kind that is missing here is a ' +
|
|
165
|
+
'misspelling, not an absence.'
|
|
166
|
+
: `there is no route that creates a ${def.label}.`, dependsOn);
|
|
167
|
+
}
|
|
168
|
+
const changes = Object.entries(row.body)
|
|
169
|
+
.filter(([name]) => !def.opaque.includes(name))
|
|
170
|
+
.map(([name, to]) => ({ name, to, route: undefined }));
|
|
171
|
+
const extra = [...notes];
|
|
172
|
+
for (const field of def.opaque) {
|
|
173
|
+
if (row.body[field] !== undefined) {
|
|
174
|
+
extra.push(`${field} is write-only: sent on this create and never readable afterwards.`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (def.secrets.length > 0) {
|
|
178
|
+
extra.push(`the create response carries a one-time ${def.secrets.join(' / ')} — \`apply\` prints ` +
|
|
179
|
+
'it once and writes it nowhere.');
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
type: def.type,
|
|
183
|
+
label: def.label,
|
|
184
|
+
key: row.key,
|
|
185
|
+
action: 'create',
|
|
186
|
+
liveId: undefined,
|
|
187
|
+
changes,
|
|
188
|
+
notes: extra,
|
|
189
|
+
reason: undefined,
|
|
190
|
+
row,
|
|
191
|
+
resolved,
|
|
192
|
+
dependsOn,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function planUpdate(def, row, liveRow, notes, resolved, dependsOn, opts) {
|
|
196
|
+
const liveIdRaw = liveRow[def.idField];
|
|
197
|
+
const liveId = typeof liveIdRaw === 'string' ? liveIdRaw : undefined;
|
|
198
|
+
if (def.update.length === 0 && def.create?.upsert !== true) {
|
|
199
|
+
return blocked(def, row, `it exists and there is no route that changes a ${def.label} in place.`, dependsOn);
|
|
200
|
+
}
|
|
201
|
+
const changes = [];
|
|
202
|
+
const extra = [...notes];
|
|
203
|
+
const compare = (name, desired) => {
|
|
204
|
+
if (name === def.naturalKey) {
|
|
205
|
+
/*
|
|
206
|
+
* The key is what matched this row; it is not a field to change. A
|
|
207
|
+
* document that renames a key is describing a DIFFERENT resource — the
|
|
208
|
+
* new one is created and the old one shows up as an orphan, which is
|
|
209
|
+
* the honest reading and the only one that works for `bots`, whose
|
|
210
|
+
* PATCH schema has no `slug` at all.
|
|
211
|
+
*/
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const unreadable = def.opaque.includes(name)
|
|
215
|
+
? 'write-only'
|
|
216
|
+
: isRedacted(liveRow[name])
|
|
217
|
+
? `redacted (reads back as \`${REDACTED}\`)`
|
|
218
|
+
: undefined;
|
|
219
|
+
if (unreadable !== undefined) {
|
|
220
|
+
if (opts.writeOnly !== true) {
|
|
221
|
+
extra.push(`${name} is ${unreadable}, so this plan cannot say whether it changed. Left alone ` +
|
|
222
|
+
'unless `--write-only` is passed.');
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
/*
|
|
226
|
+
* `--write-only`: send it, and be honest that this is not a diff. The
|
|
227
|
+
* `from` is undefined because there is nothing to compare against —
|
|
228
|
+
* `render.ts` prints `(unreadable)` rather than inventing a before.
|
|
229
|
+
*/
|
|
230
|
+
changes.push({
|
|
231
|
+
name,
|
|
232
|
+
from: undefined,
|
|
233
|
+
to: desired,
|
|
234
|
+
route: def.create?.upsert === true ? undefined : routeForField(def, name),
|
|
235
|
+
});
|
|
236
|
+
extra.push(`${name} is ${unreadable}; --write-only sends it without a comparison.`);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const current = liveRow[name];
|
|
240
|
+
if (!sameValue(current, desired)) {
|
|
241
|
+
changes.push({
|
|
242
|
+
name,
|
|
243
|
+
from: current,
|
|
244
|
+
to: desired,
|
|
245
|
+
route: def.create?.upsert === true ? undefined : routeForField(def, name),
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
for (const [name, desired] of Object.entries(row.body)) {
|
|
250
|
+
compare(name, desired);
|
|
251
|
+
}
|
|
252
|
+
for (const [wire, id] of Object.entries(resolved)) {
|
|
253
|
+
compare(wire, id);
|
|
254
|
+
}
|
|
255
|
+
if (changes.length === 0) {
|
|
256
|
+
return {
|
|
257
|
+
type: def.type,
|
|
258
|
+
label: def.label,
|
|
259
|
+
key: row.key,
|
|
260
|
+
action: 'noop',
|
|
261
|
+
liveId,
|
|
262
|
+
changes,
|
|
263
|
+
notes: extra,
|
|
264
|
+
reason: undefined,
|
|
265
|
+
row,
|
|
266
|
+
resolved,
|
|
267
|
+
dependsOn,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/*
|
|
271
|
+
* A changed field no route can write.
|
|
272
|
+
*
|
|
273
|
+
* Reported as blocked for the WHOLE row rather than partly applied: a
|
|
274
|
+
* webhook endpoint whose `eventTypes` changed and whose `schemaVersion`
|
|
275
|
+
* also changed would otherwise come out of `apply` having pinned the
|
|
276
|
+
* version and silently kept the old event list, which is a state nobody
|
|
277
|
+
* asked for and nobody can see.
|
|
278
|
+
*/
|
|
279
|
+
if (def.create?.upsert !== true) {
|
|
280
|
+
const unroutable = changes.filter((c) => c.route === undefined);
|
|
281
|
+
if (unroutable.length > 0) {
|
|
282
|
+
return {
|
|
283
|
+
...blocked(def, row, `${unroutable.map((c) => `\`${c.name}\``).join(', ')} changed, and ` +
|
|
284
|
+
(def.updateBlocked ?? `no route can change that on a ${def.label}.`), dependsOn),
|
|
285
|
+
liveId,
|
|
286
|
+
changes,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (def.fullReplace === true) {
|
|
291
|
+
extra.push(`the write REPLACES this ${def.label}: every field the document omits reverts to its ` +
|
|
292
|
+
'default. Declare the whole resource here, not just what you want changed.');
|
|
293
|
+
}
|
|
294
|
+
return {
|
|
295
|
+
type: def.type,
|
|
296
|
+
label: def.label,
|
|
297
|
+
key: row.key,
|
|
298
|
+
action: 'update',
|
|
299
|
+
liveId,
|
|
300
|
+
changes,
|
|
301
|
+
notes: extra,
|
|
302
|
+
reason: undefined,
|
|
303
|
+
row,
|
|
304
|
+
resolved,
|
|
305
|
+
dependsOn,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function blocked(def, row, reason, dependsOn) {
|
|
309
|
+
return {
|
|
310
|
+
type: def.type,
|
|
311
|
+
label: def.label,
|
|
312
|
+
key: row.key,
|
|
313
|
+
action: 'blocked',
|
|
314
|
+
liveId: undefined,
|
|
315
|
+
changes: [],
|
|
316
|
+
notes: [],
|
|
317
|
+
reason,
|
|
318
|
+
row,
|
|
319
|
+
resolved: {},
|
|
320
|
+
dependsOn,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/* ── Warnings ─────────────────────────────────────────────────────────── */
|
|
324
|
+
function sectionWarnings(def, rows, live, index) {
|
|
325
|
+
const out = [];
|
|
326
|
+
if (live.possiblyTruncated === true) {
|
|
327
|
+
out.push(`${def.type}: the list route is @PaginationExempt and answered at its cap, so there may ` +
|
|
328
|
+
'be rows this plan cannot see. `--prune` is refused for this type while that holds — ' +
|
|
329
|
+
'a row past the cap is invisible, not absent.');
|
|
330
|
+
}
|
|
331
|
+
if (index.keyless > 0) {
|
|
332
|
+
out.push(`${def.type}: ${String(index.keyless)} ${def.label}(s) on the server have no ` +
|
|
333
|
+
`\`${def.naturalKey}\`, so this file can neither match nor prune them. They are not ` +
|
|
334
|
+
'listed below at all — give them one in the dashboard to bring them under management.');
|
|
335
|
+
}
|
|
336
|
+
for (const key of index.ambiguous) {
|
|
337
|
+
out.push(`${def.type}: ${def.naturalKey} "${key}" is on more than one ${def.label}` +
|
|
338
|
+
(def.keyEnforced
|
|
339
|
+
? '.'
|
|
340
|
+
: ` — the database does not make \`${def.naturalKey}\` unique for this resource, so ` +
|
|
341
|
+
'only this file does.'));
|
|
342
|
+
}
|
|
343
|
+
out.push(...vocabularyWarnings(def, rows, live.rows));
|
|
344
|
+
return out;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* A field the document declares that NO live row carries.
|
|
348
|
+
*
|
|
349
|
+
* This is what stands in for a per-resource field allow-list, and it is
|
|
350
|
+
* better evidence than one: the vocabulary comes from the server on every
|
|
351
|
+
* run, so it cannot drift out of step with an API that shipped a field
|
|
352
|
+
* yesterday. CLAUDE.md's `helpProfile` / `profile` bug — a key zod strips,
|
|
353
|
+
* answering 200 while doing nothing — is exactly what it catches, and
|
|
354
|
+
* `unwritable` in `resources.ts` catches the mirror case (a field the server
|
|
355
|
+
* returns and no write path accepts).
|
|
356
|
+
*
|
|
357
|
+
* Two limits, both reported rather than hidden:
|
|
358
|
+
*
|
|
359
|
+
* - With no live rows there is nothing to compare against, so a brand-new
|
|
360
|
+
* workspace gets no warnings at all.
|
|
361
|
+
* - A legitimately optional field nobody in this workspace has set produces
|
|
362
|
+
* a false positive. That is why it is a warning and not a refusal: being
|
|
363
|
+
* wrong costs one line of output, where refusing wrongly costs a config
|
|
364
|
+
* file that cannot be applied.
|
|
365
|
+
*/
|
|
366
|
+
export function vocabularyWarnings(def, rows, liveRows) {
|
|
367
|
+
if (liveRows.length === 0 || rows.length === 0) {
|
|
368
|
+
return [];
|
|
369
|
+
}
|
|
370
|
+
const serverFields = new Set();
|
|
371
|
+
for (const raw of liveRows) {
|
|
372
|
+
for (const field of Object.keys(projected(def, raw))) {
|
|
373
|
+
serverFields.add(field);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const unknown = new Set();
|
|
377
|
+
for (const row of rows) {
|
|
378
|
+
for (const field of Object.keys(row.body)) {
|
|
379
|
+
if (serverFields.has(field) || def.opaque.includes(field)) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
// A credential-looking name is write-only by nature, not a typo.
|
|
383
|
+
if (looksLikeCredential(field)) {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
unknown.add(field);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (unknown.size === 0) {
|
|
390
|
+
return [];
|
|
391
|
+
}
|
|
392
|
+
return [
|
|
393
|
+
`${def.type}: ${[...unknown].map((f) => `\`${f}\``).join(', ')} — no ${def.label} on this ` +
|
|
394
|
+
`server carries ${unknown.size === 1 ? 'that field' : 'those fields'}. The API validates ` +
|
|
395
|
+
'with zod and zod STRIPS an unknown key, so a misspelling is a 200 that did nothing. ' +
|
|
396
|
+
`The fields it does return: ${[...serverFields].sort().join(', ')}.`,
|
|
397
|
+
];
|
|
398
|
+
}
|
|
399
|
+
/** Counts for the summary line. */
|
|
400
|
+
export function tally(plan) {
|
|
401
|
+
const out = {
|
|
402
|
+
create: 0,
|
|
403
|
+
update: 0,
|
|
404
|
+
noop: 0,
|
|
405
|
+
orphan: 0,
|
|
406
|
+
blocked: 0,
|
|
407
|
+
};
|
|
408
|
+
for (const item of plan.items) {
|
|
409
|
+
out[item.action] += 1;
|
|
410
|
+
}
|
|
411
|
+
return out;
|
|
412
|
+
}
|
|
413
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/wac/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,aAAa,GAId,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI9D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAyD9D,SAAS,SAAS,CAAC,GAAgB,EAAE,IAA4C;IAC/E,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmC,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,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