@chatlychat/cli 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/auth.d.ts +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +40 -3
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/init.d.ts +29 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +176 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/integrations.d.ts +27 -0
- package/dist/commands/integrations.d.ts.map +1 -1
- package/dist/commands/integrations.js +133 -3
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/platform-as-code.d.ts +54 -0
- package/dist/commands/platform-as-code.d.ts.map +1 -0
- package/dist/commands/platform-as-code.js +185 -0
- package/dist/commands/platform-as-code.js.map +1 -0
- package/dist/commands/workspace-as-code.d.ts +65 -11
- package/dist/commands/workspace-as-code.d.ts.map +1 -1
- package/dist/commands/workspace-as-code.js +35 -177
- package/dist/commands/workspace-as-code.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +30 -1
- package/dist/help.js.map +1 -1
- package/dist/init/shared.d.ts +61 -0
- package/dist/init/shared.d.ts.map +1 -0
- package/dist/init/shared.js +110 -0
- package/dist/init/shared.js.map +1 -0
- package/dist/init/templates.d.ts +29 -0
- package/dist/init/templates.d.ts.map +1 -0
- package/dist/init/templates.js +362 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/pac/platform-document.d.ts +65 -0
- package/dist/pac/platform-document.d.ts.map +1 -0
- package/dist/pac/platform-document.js +149 -0
- package/dist/pac/platform-document.js.map +1 -0
- package/dist/pac/platform-live.d.ts +65 -0
- package/dist/pac/platform-live.d.ts.map +1 -0
- package/dist/pac/platform-live.js +263 -0
- package/dist/pac/platform-live.js.map +1 -0
- package/dist/pac/platform-resources.d.ts +141 -0
- package/dist/pac/platform-resources.d.ts.map +1 -0
- package/dist/pac/platform-resources.js +509 -0
- package/dist/pac/platform-resources.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +23 -2
- package/dist/run.js.map +1 -1
- package/dist/wac/apply.d.ts.map +1 -1
- package/dist/wac/apply.js +52 -15
- package/dist/wac/apply.js.map +1 -1
- package/dist/wac/diff-warnings.d.ts +35 -0
- package/dist/wac/diff-warnings.d.ts.map +1 -0
- package/dist/wac/diff-warnings.js +87 -0
- package/dist/wac/diff-warnings.js.map +1 -0
- package/dist/wac/diff.d.ts +40 -70
- package/dist/wac/diff.d.ts.map +1 -1
- package/dist/wac/diff.js +90 -91
- package/dist/wac/diff.js.map +1 -1
- package/dist/wac/document-key.d.ts +30 -0
- package/dist/wac/document-key.d.ts.map +1 -0
- package/dist/wac/document-key.js +80 -0
- package/dist/wac/document-key.js.map +1 -0
- package/dist/wac/document.d.ts +75 -65
- package/dist/wac/document.d.ts.map +1 -1
- package/dist/wac/document.js +60 -46
- package/dist/wac/document.js.map +1 -1
- package/dist/wac/execute.d.ts +25 -0
- package/dist/wac/execute.d.ts.map +1 -0
- package/dist/wac/execute.js +126 -0
- package/dist/wac/execute.js.map +1 -0
- package/dist/wac/load.d.ts +15 -0
- package/dist/wac/load.d.ts.map +1 -0
- package/dist/wac/load.js +91 -0
- package/dist/wac/load.js.map +1 -0
- package/dist/wac/resource-def.d.ts +85 -1
- package/dist/wac/resource-def.d.ts.map +1 -1
- package/dist/wac/resource-def.js +4 -0
- package/dist/wac/resource-def.js.map +1 -1
- package/dist/wac/values.d.ts +7 -0
- package/dist/wac/values.d.ts.map +1 -1
- package/dist/wac/values.js +16 -0
- package/dist/wac/values.js.map +1 -1
- package/package.json +2 -2
package/dist/wac/load.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Getting a document off disk, for both `chatly plan` and
|
|
3
|
+
* `chatly platform plan`.
|
|
4
|
+
*
|
|
5
|
+
* ═══ JSON, NOT YAML ═══════════════════════════════════════════════════════
|
|
6
|
+
*
|
|
7
|
+
* The decision and its reasoning are in `commands/workspace-as-code.ts`'s
|
|
8
|
+
* header and they are unchanged: `yaml` is in the monorepo lockfile only as a
|
|
9
|
+
* transitive devDependency of `lint-staged`, it is not reachable from
|
|
10
|
+
* `apps/cli`, CLAUDE.md §2 forbids adding a dependency to a published CLI
|
|
11
|
+
* without approval, and a hand-rolled YAML subset that is 95% right loads a
|
|
12
|
+
* document meaning something other than what it says — which is worse than
|
|
13
|
+
* one that will not load.
|
|
14
|
+
*
|
|
15
|
+
* So a `.yaml` path is REFUSED with the one-line conversion rather than
|
|
16
|
+
* half-parsed, `--file -` reads stdin, and that makes any converter a pipe.
|
|
17
|
+
* CHT-F04 names the file `chatly.platform.yaml`; this implementation reads
|
|
18
|
+
* `chatly.platform.json`, and when YAML is approved this file is the only one
|
|
19
|
+
* that changes.
|
|
20
|
+
*
|
|
21
|
+
* ═══ WHY IT MOVED HERE ════════════════════════════════════════════════════
|
|
22
|
+
*
|
|
23
|
+
* `chatly platform plan` needs the identical loader with a different default
|
|
24
|
+
* filename and a different schema. The alternative — importing it from
|
|
25
|
+
* `commands/workspace-as-code.ts` — would have one command module depend on
|
|
26
|
+
* another for a filesystem helper, and the YAML refusal is the sort of thing
|
|
27
|
+
* that gets copied and then diverges in one copy. `workspace-as-code.ts`
|
|
28
|
+
* re-exports `loadDocument`, so nothing that imported it from there moved.
|
|
29
|
+
*/
|
|
30
|
+
import { readFileSync } from 'node:fs';
|
|
31
|
+
import { parseDocument } from './document.js';
|
|
32
|
+
import { str } from '../args.js';
|
|
33
|
+
function readFile(path) {
|
|
34
|
+
try {
|
|
35
|
+
// `0` is stdin, so `converter | chatly plan --file -` works.
|
|
36
|
+
return path === '-' ? readFileSync(0, 'utf8') : readFileSync(path, 'utf8');
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
throw new Error(`Cannot read ${path}: ${err instanceof Error ? err.message : String(err)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function findDefault(opts) {
|
|
43
|
+
for (const candidate of opts.defaultFiles) {
|
|
44
|
+
try {
|
|
45
|
+
readFileSync(candidate, 'utf8');
|
|
46
|
+
return candidate;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const names = opts.defaultFiles.join(', ');
|
|
53
|
+
throw new Error(`No document found. Looked for ${names} in this directory.\n` +
|
|
54
|
+
`Pass one with --file, or --file - to read stdin.\n` +
|
|
55
|
+
`There is a worked example at ${opts.docsUrl}`);
|
|
56
|
+
}
|
|
57
|
+
/** Read, refuse YAML, parse as JSON, validate against the schema. */
|
|
58
|
+
export function loadFrom(args, env, opts) {
|
|
59
|
+
const path = str(args.flags, 'file') ?? findDefault(opts);
|
|
60
|
+
const raw = readFile(path);
|
|
61
|
+
if (/\.ya?ml$/i.test(path) || /^\s*(?:version|resources)\s*:/m.test(raw)) {
|
|
62
|
+
/*
|
|
63
|
+
* Refused, not half-parsed.
|
|
64
|
+
*
|
|
65
|
+
* The second half of that test catches a YAML document passed under a
|
|
66
|
+
* `.json` name or through stdin, which is the shape of the mistake
|
|
67
|
+
* somebody makes once. A YAML file handed to `JSON.parse` fails with
|
|
68
|
+
* "Unexpected token v", which sends the reader looking for a syntax error
|
|
69
|
+
* in their own file rather than at the one sentence they need.
|
|
70
|
+
*/
|
|
71
|
+
throw new Error(`${path} looks like YAML, and this CLI reads JSON.\n\n` +
|
|
72
|
+
'YAML needs a parser, and adding a dependency to a published CLI is a decision this\n' +
|
|
73
|
+
'repo does not make casually (CLAUDE.md §2) — `yaml` is in the monorepo lockfile only\n' +
|
|
74
|
+
'as a transitive devDependency of lint-staged, so it is not something we already ship.\n' +
|
|
75
|
+
'A 95%-right hand-rolled YAML subset is worse than no YAML: it loads a document that\n' +
|
|
76
|
+
'means something other than what it says.\n\n' +
|
|
77
|
+
'Convert it and pipe it:\n' +
|
|
78
|
+
` npx js-yaml ${path} | chatly ${opts.command} --file -\n` +
|
|
79
|
+
' python3 -c "import sys,yaml,json;json.dump(yaml.safe_load(sys.stdin),sys.stdout)" \\\n' +
|
|
80
|
+
` < ${path} | chatly ${opts.command} --file -`);
|
|
81
|
+
}
|
|
82
|
+
let parsed;
|
|
83
|
+
try {
|
|
84
|
+
parsed = JSON.parse(raw);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
throw new Error(`${path} is not valid JSON: ${err instanceof Error ? err.message : '?'}`);
|
|
88
|
+
}
|
|
89
|
+
return parseDocument(parsed, env, opts.schema);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/wac/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAyC,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,GAAG,EAAmB,MAAM,YAAY,CAAC;AAalD,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,6DAA6D;QAC7D,OAAO,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAiB;IACpC,KAAK,MAAM,SAAS,IAAI,IAAI,CAA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KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -15,9 +15,36 @@ export interface ResourceRef {
|
|
|
15
15
|
readonly type: string;
|
|
16
16
|
/** The field the API actually reads, which the ref resolves into. */
|
|
17
17
|
readonly wire: string;
|
|
18
|
+
/**
|
|
19
|
+
* The resolved id fills a `{wire}` placeholder in the ROUTE PATH rather
|
|
20
|
+
* than a field in the body.
|
|
21
|
+
*
|
|
22
|
+
* Every workspace-level resource here is reached at a flat collection path
|
|
23
|
+
* and names its parent in the body (`botRoutes` sends `botId`). The
|
|
24
|
+
* Platform API is the opposite shape: a user, a key, a bot credential and a
|
|
25
|
+
* knowledge source all live under
|
|
26
|
+
* `/v1/platform/workspaces/{workspaceId}/…`, and the workspace id is a path
|
|
27
|
+
* segment that no request body accepts.
|
|
28
|
+
*
|
|
29
|
+
* It matters that these are different rather than interchangeable. zod
|
|
30
|
+
* strips an unknown key, so sending `workspaceId` in the body of
|
|
31
|
+
* `POST /v1/platform/workspaces/{id}/users` would be dropped in silence and
|
|
32
|
+
* the route would answer 201 — the failure mode CLAUDE.md names twice. A
|
|
33
|
+
* path ref is therefore excluded from the body AND excluded from the diff:
|
|
34
|
+
* the live row has no such field, so comparing it would report a change on
|
|
35
|
+
* every single run.
|
|
36
|
+
*/
|
|
37
|
+
readonly pathParam?: boolean;
|
|
18
38
|
}
|
|
19
39
|
export interface UpdateRoute {
|
|
20
|
-
|
|
40
|
+
/**
|
|
41
|
+
* `POST` is here for one shape only: a route whose POST ADOPTS an existing
|
|
42
|
+
* resource and merges into it rather than creating a second one.
|
|
43
|
+
* `POST /v1/platform/workspaces/{id}/widget_channel` is the instance —
|
|
44
|
+
* `created: false` is its normal answer. A POST that creates is `create`,
|
|
45
|
+
* not an update route.
|
|
46
|
+
*/
|
|
47
|
+
readonly method: 'PATCH' | 'PUT' | 'POST';
|
|
21
48
|
/** `{id}` is replaced with the encoded live id. */
|
|
22
49
|
readonly path: string;
|
|
23
50
|
/**
|
|
@@ -66,6 +93,12 @@ export interface ResourceDef {
|
|
|
66
93
|
readonly path: string;
|
|
67
94
|
} | null;
|
|
68
95
|
readonly removeBlocked?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Object fields the server MERGES into what it holds (`settings`'
|
|
98
|
+
* `businessHours`, `routing`, `widgetChannel`): compared on the keys the
|
|
99
|
+
* document names, recursively, because a key it omits is kept as stored.
|
|
100
|
+
*/
|
|
101
|
+
readonly mergeFields?: ReadonlyArray<string>;
|
|
69
102
|
/**
|
|
70
103
|
* Fields that are never readable back, so a diff must not claim they
|
|
71
104
|
* changed. Half the answer; the other half is the `__redacted__` sentinel,
|
|
@@ -88,7 +121,58 @@ export interface ResourceDef {
|
|
|
88
121
|
readonly project?: (row: Record<string, unknown>) => Record<string, unknown>;
|
|
89
122
|
/** Document-only keys naming another resource by ITS natural key. */
|
|
90
123
|
readonly references?: Readonly<Record<string, ResourceRef>>;
|
|
124
|
+
/**
|
|
125
|
+
* The rows out of a list response that is not itself the array.
|
|
126
|
+
*
|
|
127
|
+
* Every workspace-level list route answers either a bare array or
|
|
128
|
+
* `{ items, nextCursor }`, which `readLive` handles directly. The Platform
|
|
129
|
+
* API has one list that is neither: a workspace's MEMBERS come back as
|
|
130
|
+
* `users` on `GET /v1/platform/workspaces/{id}` — the detail route — because
|
|
131
|
+
* there is no `…/users` list route at all. Declared rather than special-cased
|
|
132
|
+
* in the reader so the reader stays one loop.
|
|
133
|
+
*/
|
|
134
|
+
readonly rowsFrom?: (response: unknown) => ReadonlyArray<Record<string, unknown>>;
|
|
135
|
+
/**
|
|
136
|
+
* A live row this document can never match, and must not be matched to.
|
|
137
|
+
*
|
|
138
|
+
* `GET /v1/platform/workspaces/{id}/api_keys` keeps a REVOKED key in the
|
|
139
|
+
* list with `revokedAt` set, and so does the bot-credential list. A
|
|
140
|
+
* revoked credential is not a credential: matching a document row to one
|
|
141
|
+
* would report `noop` for a key that authenticates nothing, which is the
|
|
142
|
+
* worst possible answer — the plan would say the workspace matches the file
|
|
143
|
+
* while the deploy pipeline it describes is locked out. Filtered out, so
|
|
144
|
+
* the document's row is a `create` and `apply` mints a live one.
|
|
145
|
+
*
|
|
146
|
+
* It is NOT the same thing as an orphan: a filtered row is invisible, so
|
|
147
|
+
* `--prune` never offers to delete it either, which is right for a row the
|
|
148
|
+
* DELETE route would answer `revoked: false` to.
|
|
149
|
+
*/
|
|
150
|
+
readonly ignoreLive?: (row: Record<string, unknown>) => boolean;
|
|
151
|
+
/**
|
|
152
|
+
* The resource that OWNS this one, for a type whose list route is nested
|
|
153
|
+
* under a parent's id.
|
|
154
|
+
*
|
|
155
|
+
* Present only on the Platform API's resources. Its consequence is that
|
|
156
|
+
* `naturalKey` is a SYNTHETIC field — the parent's key and the child's,
|
|
157
|
+
* joined — because `a@b.c` identifies a user inside one workspace and
|
|
158
|
+
* nothing at all across a document that describes four of them. The reader
|
|
159
|
+
* stamps that field onto every live row it fetches; the parser composes the
|
|
160
|
+
* same value from the document. Neither side ever diffs it, because
|
|
161
|
+
* `diff.ts` skips the natural key.
|
|
162
|
+
*/
|
|
163
|
+
readonly parent?: {
|
|
164
|
+
/** The owning resource type. */
|
|
165
|
+
readonly type: string;
|
|
166
|
+
/** The document key that names the parent (`workspace`). */
|
|
167
|
+
readonly field: string;
|
|
168
|
+
/** The path placeholder the parent's id fills (`workspaceId`). */
|
|
169
|
+
readonly wire: string;
|
|
170
|
+
/** The field that names the child within its parent (`email`, `name`). */
|
|
171
|
+
readonly childKey: string;
|
|
172
|
+
};
|
|
91
173
|
}
|
|
174
|
+
/** The synthetic natural key of a parented resource: `<parent>/<child>`. */
|
|
175
|
+
export declare function addressOf(parentKey: string, childKey: string): string;
|
|
92
176
|
/** The server's spelling of a key, for matching. */
|
|
93
177
|
export declare function normalizedKey(def: ResourceDef, key: string): string;
|
|
94
178
|
/** The live row in the vocabulary the document writes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-def.d.ts","sourceRoot":"","sources":["../../src/wac/resource-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,sCAAsC;AACtC,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"resource-def.d.ts","sourceRoot":"","sources":["../../src/wac/resource-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,sCAAsC;AACtC,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1C,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;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,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEjG;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAKtF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
package/dist/wac/resource-def.js
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* `resources.ts` re-exports everything here, so every importer sees one
|
|
9
9
|
* module.
|
|
10
10
|
*/
|
|
11
|
+
/** The synthetic natural key of a parented resource: `<parent>/<child>`. */
|
|
12
|
+
export function addressOf(parentKey, childKey) {
|
|
13
|
+
return `${parentKey}/${childKey}`;
|
|
14
|
+
}
|
|
11
15
|
/** The server's spelling of a key, for matching. */
|
|
12
16
|
export function normalizedKey(def, key) {
|
|
13
17
|
return def.normalizeKey === undefined ? key : def.normalizeKey(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-def.js","sourceRoot":"","sources":["../../src/wac/resource-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"resource-def.js","sourceRoot":"","sources":["../../src/wac/resource-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoKH,4EAA4E;AAC5E,MAAM,UAAU,SAAS,CAAC,SAAiB,EAAE,QAAgB;IAC3D,OAAO,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC;AACpC,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,aAAa,CAAC,GAAgB,EAAE,GAAW;IACzD,OAAO,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,SAAS,CAAC,GAAgB,EAAE,GAA4B;IACtE,OAAO,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAgB,EAAE,KAAa;IAC3D,OAAO,CACL,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;QAC1D,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAC/C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,qDAAqD,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC"}
|
package/dist/wac/values.d.ts
CHANGED
|
@@ -13,4 +13,11 @@ export declare const REDACTED = "__redacted__";
|
|
|
13
13
|
export declare function sameValue(a: unknown, b: unknown): boolean;
|
|
14
14
|
/** Does this value carry the redaction sentinel anywhere inside it? */
|
|
15
15
|
export declare function isRedacted(value: unknown): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The part of a live value a MERGE-written field describes: the keys the
|
|
18
|
+
* document names, recursively. The server keeps every key the write omits,
|
|
19
|
+
* so an omitted key is not a difference. Arrays are compared whole — a list
|
|
20
|
+
* the document names is the list it wants.
|
|
21
|
+
*/
|
|
22
|
+
export declare function narrowTo(live: unknown, desired: unknown): unknown;
|
|
16
23
|
//# sourceMappingURL=values.d.ts.map
|
package/dist/wac/values.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/wac/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,uEAAuE;AACvE,eAAO,MAAM,QAAQ,iBAAiB,CAAC;AAIvC,iDAAiD;AACjD,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAyBzD;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWlD"}
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/wac/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,uEAAuE;AACvE,eAAO,MAAM,QAAQ,iBAAiB,CAAC;AAIvC,iDAAiD;AACjD,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAyBzD;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWlD;AAQD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAKjE"}
|
package/dist/wac/values.js
CHANGED
|
@@ -50,4 +50,20 @@ export function isRedacted(value) {
|
|
|
50
50
|
}
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
|
+
/* ── Merge-written fields ─────────────────────────────────────────────── */
|
|
54
|
+
function isPlainObject(v) {
|
|
55
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The part of a live value a MERGE-written field describes: the keys the
|
|
59
|
+
* document names, recursively. The server keeps every key the write omits,
|
|
60
|
+
* so an omitted key is not a difference. Arrays are compared whole — a list
|
|
61
|
+
* the document names is the list it wants.
|
|
62
|
+
*/
|
|
63
|
+
export function narrowTo(live, desired) {
|
|
64
|
+
if (!isPlainObject(live) || !isPlainObject(desired)) {
|
|
65
|
+
return live;
|
|
66
|
+
}
|
|
67
|
+
return Object.fromEntries(Object.keys(desired).map((k) => [k, narrowTo(live[k], desired[k])]));
|
|
68
|
+
}
|
|
53
69
|
//# sourceMappingURL=values.js.map
|
package/dist/wac/values.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/wac/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC;AAEvC,6EAA6E;AAE7E,iDAAiD;AACjD,MAAM,UAAU,SAAS,CAAC,CAAU,EAAE,CAAU;IAC9C,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,mEAAmE;IACnE,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;QACvE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;YACpE,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,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AAC,CAAC;AACjG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatlychat/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "The Chatly command line — inspect conversations, send replies, read reports and call any API route from a terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/chatlychat/chatly-cli#readme",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"LICENSE"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@chatlychat/sdk-node": "0.7.
|
|
33
|
+
"@chatlychat/sdk-node": "0.7.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "20.14.10",
|