@wayai/cli 0.3.225 → 0.3.227
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/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34728,7 +34728,7 @@ Files in "${safe(productionId)}":`);
|
|
|
34728
34728
|
const reasons = [
|
|
34729
34729
|
...desired.stops.map((stop) => describeStop(stop)),
|
|
34730
34730
|
...limited,
|
|
34731
|
-
...conflicts.map((c) => `${c.fileType}/${c.path}: production's copy differs from its source (${c.what}). It was edited after it moved, so it is not overwritten.
|
|
34731
|
+
...conflicts.map((c) => `${c.fileType}/${c.path}: production's copy differs from its source (${c.what}). It was edited after it moved, or created there by someone else, so it is not overwritten. Move or remove it in production to move its source.`)
|
|
34732
34732
|
];
|
|
34733
34733
|
const result = {
|
|
34734
34734
|
production: productionId,
|
|
@@ -34775,7 +34775,16 @@ Dry run: nothing written (${writes === 0 ? "nothing to write" : `${writes} write
|
|
|
34775
34775
|
}
|
|
34776
34776
|
}
|
|
34777
34777
|
}
|
|
34778
|
-
for (const file of creates
|
|
34778
|
+
for (const [written, file] of creates.entries()) {
|
|
34779
|
+
try {
|
|
34780
|
+
await kb.putFile(productionId, file, await bodyBytes(reader, file), { createOnly: true });
|
|
34781
|
+
} catch (err) {
|
|
34782
|
+
if (!(err instanceof ApiError && err.status === 412)) throw err;
|
|
34783
|
+
throw expected(
|
|
34784
|
+
`${safe(file.fileType)}/${safe(file.path)}: a file was created at this path in "${safe(productionId)}" while the migration ran, so it was not written (the file there is kept). ${written} of ${creates.length} file(s) were written before it. Run the migration again: it writes only what has not moved, and stops before any write while the file at this path differs from its source.`
|
|
34785
|
+
);
|
|
34786
|
+
}
|
|
34787
|
+
}
|
|
34779
34788
|
io.log(
|
|
34780
34789
|
`
|
|
34781
34790
|
Done: ${toWrite.length} file type(s) written, ${toPromote.length} promoted, ${creates.length} file(s) written. The preview holds none of these files: copy them with \`${refreshPreviewCommand(opts.orgId, opts.base)}\`.`
|
|
@@ -34787,6 +34796,7 @@ var init_migrate2 = __esm({
|
|
|
34787
34796
|
"src/knowledge/migrate.ts"() {
|
|
34788
34797
|
"use strict";
|
|
34789
34798
|
init_resource_files();
|
|
34799
|
+
init_api_client();
|
|
34790
34800
|
init_expected();
|
|
34791
34801
|
init_terminal_output();
|
|
34792
34802
|
init_utils();
|
|
@@ -35207,13 +35217,13 @@ function knowledgeBase(client) {
|
|
|
35207
35217
|
// `requestRaw`: the page is read whole, `{ data: … }`, as WayAI's copy of its answer declares it
|
|
35208
35218
|
// (`@wayai/core/contracts` `rekorFileSnapshotAnswerSchema`).
|
|
35209
35219
|
snapshotPage: (preview, cursor) => pacer.run(() => client.requestRaw("POST", `/v1/${baseSeg(preview)}/files/snapshot`, cursor === void 0 ? {} : { cursor })),
|
|
35210
|
-
async putFile(base, file, bytes) {
|
|
35220
|
+
async putFile(base, file, bytes, { createOnly }) {
|
|
35211
35221
|
await pacer.run(
|
|
35212
35222
|
() => client.upload(
|
|
35213
35223
|
`/v1/${baseSeg(base)}/files/${typeSeg(file.fileType)}/${pathSegments(file.path)}`,
|
|
35214
35224
|
bytes,
|
|
35215
35225
|
file.contentType,
|
|
35216
|
-
fileWriteHeaders({ label: MIGRATION_LABEL, metadata: file.metadata })
|
|
35226
|
+
fileWriteHeaders({ createOnly, label: MIGRATION_LABEL, metadata: file.metadata })
|
|
35217
35227
|
)
|
|
35218
35228
|
);
|
|
35219
35229
|
}
|
|
@@ -35951,7 +35961,10 @@ migrate: move knowledge resources into the organization's knowledge base.
|
|
|
35951
35961
|
|
|
35952
35962
|
Without --hub, it moves the organization's knowledge resources; with --hub, that hub's own
|
|
35953
35963
|
(read from its production hub), once the organization's have moved. Each resource becomes a
|
|
35954
|
-
file type, its files keep their paths, and each described folder gains an _index.md.
|
|
35964
|
+
file type, its files keep their paths, and each described folder gains an _index.md. Files are
|
|
35965
|
+
written create-only: one created at its path while it runs is kept, and the run stops there,
|
|
35966
|
+
naming it. A re-run writes what is left once that file matches its source or is moved or
|
|
35967
|
+
removed; until then it stops before any write, naming it.
|
|
35955
35968
|
|
|
35956
35969
|
--base The knowledge base: its production base, or the preview its file types are
|
|
35957
35970
|
written in. File types are written in the preview and promoted; files are
|