@anybuild-ai/ab 0.7.0 → 0.8.0
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/CHANGELOG.md +19 -0
- package/README.md +102 -3
- package/dist/cli.js +0 -0
- package/dist/commands/api-key.d.ts.map +1 -1
- package/dist/commands/api-key.js +166 -1
- package/dist/commands/api-key.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/mail.d.ts +3 -0
- package/dist/commands/mail.d.ts.map +1 -0
- package/dist/commands/mail.js +99 -0
- package/dist/commands/mail.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +9 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/export/import-batch.d.ts +17 -1
- package/dist/export/import-batch.d.ts.map +1 -1
- package/dist/export/import-batch.js +162 -17
- package/dist/export/import-batch.js.map +1 -1
- package/dist/export/not-exported.d.ts +23 -0
- package/dist/export/not-exported.d.ts.map +1 -0
- package/dist/export/not-exported.js +49 -0
- package/dist/export/not-exported.js.map +1 -0
- package/dist/export/path-based-status.d.ts +3 -2
- package/dist/export/path-based-status.d.ts.map +1 -1
- package/dist/export/path-based-status.js +4 -3
- package/dist/export/path-based-status.js.map +1 -1
- package/dist/export/resource-files.d.ts +21 -0
- package/dist/export/resource-files.d.ts.map +1 -0
- package/dist/export/resource-files.js +62 -0
- package/dist/export/resource-files.js.map +1 -0
- package/dist/export/schema-json.d.ts +7 -1
- package/dist/export/schema-json.d.ts.map +1 -1
- package/dist/export/schema-json.js +105 -1
- package/dist/export/schema-json.js.map +1 -1
- package/dist/export/status.d.ts +2 -0
- package/dist/export/status.d.ts.map +1 -1
- package/dist/export/status.js +58 -15
- package/dist/export/status.js.map +1 -1
- package/dist/export/sync.d.ts.map +1 -1
- package/dist/export/sync.js +39 -0
- package/dist/export/sync.js.map +1 -1
- package/dist/export/types.d.ts +26 -0
- package/dist/export/types.d.ts.map +1 -1
- package/dist/export/working-dirs.d.ts +38 -0
- package/dist/export/working-dirs.d.ts.map +1 -1
- package/dist/export/working-dirs.js +128 -2
- package/dist/export/working-dirs.js.map +1 -1
- package/dist/export/working-tree-validation.d.ts +1 -1
- package/dist/export/working-tree-validation.d.ts.map +1 -1
- package/dist/export/working-tree-validation.js +25 -4
- package/dist/export/working-tree-validation.js.map +1 -1
- package/dist/identity/identity-api.d.ts +2 -0
- package/dist/identity/identity-api.d.ts.map +1 -1
- package/dist/identity/identity-api.js +9 -4
- package/dist/identity/identity-api.js.map +1 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +2 -1
- package/dist/router.js.map +1 -1
- package/package.json +1 -1
- package/dist/api/factory.d.ts +0 -8
- package/dist/api/factory.d.ts.map +0 -1
- package/dist/api/factory.js +0 -9
- package/dist/api/factory.js.map +0 -1
- package/dist/api/index.d.ts +0 -4
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -3
- package/dist/api/index.js.map +0 -1
- package/dist/api/stub.d.ts +0 -7
- package/dist/api/stub.d.ts.map +0 -1
- package/dist/api/stub.js +0 -30
- package/dist/api/stub.js.map +0 -1
- package/dist/api/types.d.ts +0 -16
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js +0 -2
- package/dist/api/types.js.map +0 -1
- package/dist/artifacts/baseline-types.d.ts +0 -10
- package/dist/artifacts/baseline-types.d.ts.map +0 -1
- package/dist/artifacts/baseline-types.js +0 -2
- package/dist/artifacts/baseline-types.js.map +0 -1
- package/dist/artifacts/baseline.d.ts +0 -4
- package/dist/artifacts/baseline.d.ts.map +0 -1
- package/dist/artifacts/baseline.js +0 -55
- package/dist/artifacts/baseline.js.map +0 -1
- package/dist/artifacts/canonical-json.d.ts +0 -3
- package/dist/artifacts/canonical-json.d.ts.map +0 -1
- package/dist/artifacts/canonical-json.js +0 -13
- package/dist/artifacts/canonical-json.js.map +0 -1
- package/dist/artifacts/disk.d.ts +0 -6
- package/dist/artifacts/disk.d.ts.map +0 -1
- package/dist/artifacts/disk.js +0 -45
- package/dist/artifacts/disk.js.map +0 -1
- package/dist/artifacts/hash-content.d.ts +0 -4
- package/dist/artifacts/hash-content.d.ts.map +0 -1
- package/dist/artifacts/hash-content.js +0 -14
- package/dist/artifacts/hash-content.js.map +0 -1
- package/dist/artifacts/locations.d.ts +0 -3
- package/dist/artifacts/locations.d.ts.map +0 -1
- package/dist/artifacts/locations.js +0 -9
- package/dist/artifacts/locations.js.map +0 -1
- package/dist/artifacts/pull.d.ts +0 -4
- package/dist/artifacts/pull.d.ts.map +0 -1
- package/dist/artifacts/pull.js +0 -36
- package/dist/artifacts/pull.js.map +0 -1
- package/dist/artifacts/status.d.ts +0 -7
- package/dist/artifacts/status.d.ts.map +0 -1
- package/dist/artifacts/status.js +0 -47
- package/dist/artifacts/status.js.map +0 -1
- package/dist/export/checksum-diagnostics.d.ts +0 -7
- package/dist/export/checksum-diagnostics.d.ts.map +0 -1
- package/dist/export/checksum-diagnostics.js +0 -43
- package/dist/export/checksum-diagnostics.js.map +0 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AbCliError, CLI_PROGRAM } from "../errors.js";
|
|
2
|
+
import { loadProjectConfigFromCwd } from "../config/project-config.js";
|
|
3
|
+
import { createClientForCwd } from "../http/client.js";
|
|
4
|
+
import { postCli } from "../identity/identity-api.js";
|
|
5
|
+
const USAGE = `Usage:
|
|
6
|
+
${CLI_PROGRAM} mail templates
|
|
7
|
+
${CLI_PROGRAM} mail send-test [<template_id>] --to <address> [--provider <provider_id>] [--locale <tag>]
|
|
8
|
+
|
|
9
|
+
"templates" lists the mail templates the application can use and where each comes from: the application
|
|
10
|
+
(be/mail/templates), the environment, or the built-in default.
|
|
11
|
+
"send-test" sends one template (default mail.test) with its sample values (the file's "variables") through the
|
|
12
|
+
application's provider (be/mail/providers, else the environment default). Push the template or provider first.
|
|
13
|
+
Run this inside a project directory.`;
|
|
14
|
+
function asObject(value, label) {
|
|
15
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
16
|
+
throw new AbCliError("HTTP", `${label} must be a JSON object.`);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
function takeValue(args, flag) {
|
|
21
|
+
const index = args.indexOf(flag);
|
|
22
|
+
if (index < 0) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const value = args[index + 1];
|
|
26
|
+
if (value === undefined || value.startsWith("--")) {
|
|
27
|
+
throw new AbCliError("CONFIG", `${flag} needs a value.\n${USAGE}`);
|
|
28
|
+
}
|
|
29
|
+
args.splice(index, 2);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
async function templatesCommand(args) {
|
|
33
|
+
if (args.length > 0) {
|
|
34
|
+
throw new AbCliError("CONFIG", `"templates" takes no arguments.\n${USAGE}`);
|
|
35
|
+
}
|
|
36
|
+
const project = loadProjectConfigFromCwd();
|
|
37
|
+
const client = await createClientForCwd();
|
|
38
|
+
const result = asObject(await postCli(client, "mail/templates", "Mail templates", { application_id: project.application_id }), "Mail templates");
|
|
39
|
+
const templates = Array.isArray(result.templates) ? result.templates : [];
|
|
40
|
+
for (const item of templates) {
|
|
41
|
+
const row = asObject(item, "Mail template");
|
|
42
|
+
console.log(`${String(row.template_id).padEnd(28)} ${String(row.source).padEnd(12)} ${typeof row.description === "string" ? row.description : ""}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function sendTestCommand(input) {
|
|
46
|
+
const args = input.slice();
|
|
47
|
+
const to = takeValue(args, "--to");
|
|
48
|
+
const provider = takeValue(args, "--provider");
|
|
49
|
+
const locale = takeValue(args, "--locale");
|
|
50
|
+
const unknown = args.filter((arg) => arg.startsWith("--"));
|
|
51
|
+
if (unknown.length > 0) {
|
|
52
|
+
throw new AbCliError("CONFIG", `Unknown option ${unknown.join(", ")}.\n${USAGE}`);
|
|
53
|
+
}
|
|
54
|
+
if (!to) {
|
|
55
|
+
throw new AbCliError("CONFIG", `--to <address> is required.\n${USAGE}`);
|
|
56
|
+
}
|
|
57
|
+
if (args.length > 1) {
|
|
58
|
+
throw new AbCliError("CONFIG", `Give at most one template id.\n${USAGE}`);
|
|
59
|
+
}
|
|
60
|
+
const project = loadProjectConfigFromCwd();
|
|
61
|
+
const client = await createClientForCwd();
|
|
62
|
+
const result = asObject(await postCli(client, "mail/test", "Mail send-test", {
|
|
63
|
+
application_id: project.application_id,
|
|
64
|
+
template: args[0],
|
|
65
|
+
to,
|
|
66
|
+
provider_id: provider,
|
|
67
|
+
locale,
|
|
68
|
+
}), "Mail send-test");
|
|
69
|
+
const rejected = Array.isArray(result.rejected) ? result.rejected : [];
|
|
70
|
+
console.log(`Sent ${String(result.template)} (${String(result.template_source)}) to ${to} with provider ${String(result.provider)} (${String(result.provider_source)}).`);
|
|
71
|
+
if (rejected.length > 0) {
|
|
72
|
+
console.log(`Rejected by the server: ${rejected.join(", ")}`);
|
|
73
|
+
process.exitCode = 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export const mail = async (args) => {
|
|
77
|
+
const [sub, ...rest] = args;
|
|
78
|
+
if (sub === "--help" || sub === "-h") {
|
|
79
|
+
console.log(USAGE);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
if (sub === "templates") {
|
|
84
|
+
await templatesCommand(rest);
|
|
85
|
+
}
|
|
86
|
+
else if (sub === "send-test") {
|
|
87
|
+
await sendTestCommand(rest);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.error(USAGE);
|
|
91
|
+
process.exitCode = 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
console.error(`${CLI_PROGRAM} mail: ${e instanceof Error ? e.message : String(e)}`);
|
|
96
|
+
process.exitCode = 1;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=mail.js.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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAwDjD,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAwDjD,eAAO,MAAM,MAAM,EAAE,cAwDpB,CAAC"}
|
package/dist/commands/status.js
CHANGED
|
@@ -20,7 +20,7 @@ function printDebugChecksums(d) {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
console.log("");
|
|
23
|
-
console.log("Checksums (MD5 hex, utf-8): manifest = .ab/manifest.json. Disk: .json under ui/lit, ui/navigation, ui/portals, be/entities, be/views, be/auto_increments, be/field_types, be/scheduled_jobs, be/scenarios, be/capability_profiles, and be/scenario_tests uses canonical JSON; other files use raw UTF-8. Backend trees (be/plv8, be/node) also show Modified when manifest differs from .ab/file-state.json (new manifest row). Added = on-disk file not listed in manifest.");
|
|
23
|
+
console.log("Checksums (MD5 hex, utf-8): manifest = .ab/manifest.json. Disk: .json under ui/lit, ui/navigation, ui/portals, be/entities, be/views, be/auto_increments, be/field_types, be/scheduled_jobs, be/web_routes, be/mail/templates, be/mail/providers, be/scenarios, be/capability_profiles, and be/scenario_tests uses canonical JSON; other files use raw UTF-8. Backend trees (be/plv8, be/node) also show Modified when manifest differs from .ab/file-state.json (new manifest row). Added = on-disk file not listed in manifest.");
|
|
24
24
|
if (d.modified.length > 0) {
|
|
25
25
|
console.log("");
|
|
26
26
|
console.log("Modified (detail):");
|
|
@@ -66,6 +66,14 @@ export const status = async (args) => {
|
|
|
66
66
|
printSection("Modified", modified);
|
|
67
67
|
printSection("Added", added);
|
|
68
68
|
printSection("Deleted", deleted);
|
|
69
|
+
const notExported = result.notExported ?? [];
|
|
70
|
+
if (notExported.length > 0) {
|
|
71
|
+
console.log("Not exported by the server (on the last pull — not local deletions, push leaves them alone):");
|
|
72
|
+
for (const p of notExported) {
|
|
73
|
+
console.log(` ${p}`);
|
|
74
|
+
}
|
|
75
|
+
console.log(" The server could not export these files; its log has the reason (export_files: skipped …). Fix them on the server, then pull again.");
|
|
76
|
+
}
|
|
69
77
|
if (modified.length > 0 || deleted.length > 0) {
|
|
70
78
|
console.log("");
|
|
71
79
|
console.log(restoreFromServerHintGeneric([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,SAAS,YAAY,CAAC,KAAa,EAAE,KAAe;IAClD,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IACzB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxB,OAAO;IACT,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,CAAoB;IAC/C,IACE,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QACpB,CAAC,CAAC,OAAO,CAAC,MA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,8FAA8F,CAAC,CAAC;YAC5G,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;gBAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACxB,CAAC;YACD,OAAO,CAAC,GAAG,CACT,uIAAuI,CACxI,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CACT,4BAA4B,CAAC;gBAC3B,GAAG,QAAQ,CAAC,GAAG,CAAC,oBAAoB,CAAC;gBACrC,GAAG,OAAO;aACX,CAAC,CACH,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAC1B,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,UAAU,EAAE,CAAC;YAC5B,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACrD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QACD,OAAO,CAAC,KAAK,CACX,GAAG,WAAW,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACvE,CAAC;QACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExportStatusResult } from "./status.js";
|
|
2
|
-
import type { ExportManifestJson, ImportFileItem, ImportFileResult } from "./types.js";
|
|
2
|
+
import type { ExportManifestJson, ImportAffectedFile, ImportFileItem, ImportFileResult } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Build import payload from current tree vs manifest (same rules as `status`).
|
|
5
5
|
*/
|
|
@@ -18,6 +18,22 @@ export type ImportBatchOptions = {
|
|
|
18
18
|
/** Progress line for push/validate when specific paths are requested. */
|
|
19
19
|
export declare function formatImportActionProgress(action: "push" | "validate", onlyPaths: readonly string[] | undefined): string | undefined;
|
|
20
20
|
export declare function applyImportResultsToManifest(manifest: ExportManifestJson, items: ImportFileItem[], results: ImportFileResult[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* The import requests of one push, in dependency order. Each kind goes after the kinds it is checked against (one
|
|
23
|
+
* request per kind where a check needs all files of that kind together): backend code (be/plv8, be/node) in chunks,
|
|
24
|
+
* schema (auto-increments, field types, entities, views), UI files (Lit, Liquid templates) in chunks, navigation,
|
|
25
|
+
* portals, site content, translations, AnyInput profiles, scenarios, scenario tests, scheduled jobs.
|
|
26
|
+
*/
|
|
27
|
+
export declare function planImportBatches(items: ImportFileItem[]): ImportFileItem[][];
|
|
28
|
+
/**
|
|
29
|
+
* Files the push changed on the server without them being pushed (the translation files, after a push that added or
|
|
30
|
+
* retired translatable texts): written where the local copy is unchanged since the last pull, so the next edit starts
|
|
31
|
+
* from the current file. A locally edited copy is left alone, with a note.
|
|
32
|
+
*/
|
|
33
|
+
export declare function writeAffectedFiles(projectRoot: string, before: ExportManifestJson, working: ExportManifestJson, pushedPaths: ReadonlySet<string>, affected: ImportAffectedFile[]): {
|
|
34
|
+
warnings: string[];
|
|
35
|
+
info: string[];
|
|
36
|
+
};
|
|
21
37
|
export declare function runImportValidate(projectRoot: string, options?: ImportBatchOptions): Promise<void>;
|
|
22
38
|
export declare function runImportPush(projectRoot: string, options?: ImportBatchOptions): Promise<void>;
|
|
23
39
|
//# sourceMappingURL=import-batch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-batch.d.ts","sourceRoot":"","sources":["../../src/export/import-batch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import-batch.d.ts","sourceRoot":"","sources":["../../src/export/import-batch.ts"],"names":[],"mappings":"AAiDA,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AASrB,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAwKpB;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,cAAc,EAAE,CAsIlB;AAuCD,mFAAmF;AACnF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,cAAc,EAAE,EACvB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,cAAc,EAAE,CAgClB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2FAA2F;IAC3F,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,uEAAuE;IACvE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,GAAG,UAAU,EAC3B,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACvC,MAAM,GAAG,SAAS,CAcpB;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,gBAAgB,EAAE,GAC1B,IAAI,CA+DN;AA+BD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,EAAE,CA6G7E;AAuFD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,QAAQ,EAAE,kBAAkB,EAAE,GAC7B;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAuCxC;AAiCD,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA8Gf"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname } from "node:path";
|
|
4
4
|
import { stdin, stdout } from "node:process";
|
|
5
|
-
import { canonicalJsonUtf8 } from "./canonical-json.js";
|
|
5
|
+
import { canonicalJsonUtf8, md5HexUtf8CanonicalJson } from "./canonical-json.js";
|
|
6
6
|
import { hasManifestChecksum } from "./checksum.js";
|
|
7
|
+
import { resourcePushFields } from "./resource-files.js";
|
|
7
8
|
import { AbCliError, CLI_PROGRAM } from "../errors.js";
|
|
8
9
|
import { confirmYesNo } from "../io/confirm-yes.js";
|
|
9
10
|
import { logBatchProgress, logProgress } from "../progress.js";
|
|
@@ -13,7 +14,7 @@ import { postImportFiles, zipImportOutcomes, } from "./import-files-api.js";
|
|
|
13
14
|
import { manifestToFileState, writeFileState } from "./file-state.js";
|
|
14
15
|
import { readManifestJson, writeManifestJson } from "./manifest-io.js";
|
|
15
16
|
import { safeProjectFilePath } from "./path-sanitize.js";
|
|
16
|
-
import { pathIsAutoIncrementFile, pathIsCapabilityProfileFile, pathIsFieldTypeFile, pathIsNavigationFile, pathIsPortalFile, pathIsScenarioFile, pathIsScenarioTestFile, pathIsSchemaEntityFile, pathIsSchemaViewFile, pathIsUnderAutoIncrementWorkingTree, pathIsUnderBeWorkingTree, pathIsUnderCanonicalJsonWorkingTree, pathIsUnderCapabilityProfileWorkingTree, pathIsUnderFieldTypeWorkingTree, pathIsUnderNavigationWorkingTree, pathIsUnderScheduledJobWorkingTree, pathIsUnderPortalWorkingTree, pathIsUnderScenarioTestWorkingTree, pathIsUnderScenarioWorkingTree, pathIsUnderSchemaWorkingTree, pathIsUnderUiLitWorkingTree, } from "./working-dirs.js";
|
|
17
|
+
import { pathIsAutoIncrementFile, pathIsCapabilityProfileFile, pathIsFieldTypeFile, pathIsNavigationFile, pathIsPortalFile, pathIsScenarioFile, pathIsScenarioTestFile, pathIsSchemaEntityFile, pathIsSchemaViewFile, pathIsUnderAutoIncrementWorkingTree, isTemplateWorkingTreeFilePath, pathIsUnderBeWorkingTree, pathIsUnderTemplateWorkingTree, pathIsUnderCanonicalJsonWorkingTree, pathIsUnderCapabilityProfileWorkingTree, pathIsUnderFieldTypeWorkingTree, pathIsUnderNavigationWorkingTree, pathIsUnderScheduledJobWorkingTree, pathIsUnderWebRouteWorkingTree, pathIsUnderMailWorkingTree, pathIsUnderPortalWorkingTree, pathIsUnderScenarioTestWorkingTree, pathIsUnderScenarioWorkingTree, pathIsUnderSchemaWorkingTree, pathIsUnderUiContentWorkingTree, pathIsUnderTranslationWorkingTree, pathIsTranslationFile, pathIsUnderUiLitWorkingTree, } from "./working-dirs.js";
|
|
17
18
|
import { computeExportStatus, statusLinePreviousPath, statusLineToDiskPath, } from "./status.js";
|
|
18
19
|
import { parseThingIdFromPlv8Source } from "./be-plv8-identity.js";
|
|
19
20
|
import { isUiWorkingTreeJsPath, isUiWorkingTreeJsonPath, parseCeUuidFromJsSource, } from "./ui-component-identity.js";
|
|
@@ -28,7 +29,8 @@ function normId(id) {
|
|
|
28
29
|
}
|
|
29
30
|
function parseJsIdentityFromSource(source, relPath) {
|
|
30
31
|
const p = normalizeProjectRelativePath(relPath);
|
|
31
|
-
|
|
32
|
+
// backend files and templates carry identity in the same `__meta` block
|
|
33
|
+
if (pathIsUnderBeWorkingTree(p) || pathIsUnderTemplateWorkingTree(p)) {
|
|
32
34
|
return parseThingIdFromPlv8Source(source);
|
|
33
35
|
}
|
|
34
36
|
return parseCeUuidFromJsSource(source);
|
|
@@ -82,6 +84,13 @@ function resolveManifestEntryForModified(manifest, line, projectRoot) {
|
|
|
82
84
|
}
|
|
83
85
|
return e;
|
|
84
86
|
}
|
|
87
|
+
if (isTemplateWorkingTreeFilePath(normDisk)) {
|
|
88
|
+
const e = manifest.files.find((f) => normalizeProjectRelativePath(f.path) === normDisk);
|
|
89
|
+
if (e === undefined) {
|
|
90
|
+
throw new AbCliError("CONFIG", `No manifest entry for modified file at path ${line}`);
|
|
91
|
+
}
|
|
92
|
+
return e;
|
|
93
|
+
}
|
|
85
94
|
if (isUiWorkingTreeJsPath(normDisk)) {
|
|
86
95
|
if (pathIsUnderBeWorkingTree(normDisk)) {
|
|
87
96
|
const e = manifest.files.find((f) => normalizeProjectRelativePath(f.path) === normDisk);
|
|
@@ -159,8 +168,12 @@ export function buildImportFileItems(projectRoot, manifest, status) {
|
|
|
159
168
|
base_checksum: hasManifestChecksum(entry.checksum)
|
|
160
169
|
? entry.checksum
|
|
161
170
|
: undefined,
|
|
171
|
+
...(pathIsTranslationFile(normalizeProjectRelativePath(diskPath)) && hasManifestChecksum(entry.translation_checksum)
|
|
172
|
+
? { base_translation_checksum: entry.translation_checksum }
|
|
173
|
+
: {}),
|
|
162
174
|
content,
|
|
163
175
|
encoding: "utf-8",
|
|
176
|
+
...resourcePushFields(projectRoot, normalizeProjectRelativePath(diskPath)),
|
|
164
177
|
});
|
|
165
178
|
}
|
|
166
179
|
for (const path of buckets.added) {
|
|
@@ -180,6 +193,7 @@ export function buildImportFileItems(projectRoot, manifest, status) {
|
|
|
180
193
|
id: identity.id,
|
|
181
194
|
content,
|
|
182
195
|
encoding: "utf-8",
|
|
196
|
+
...resourcePushFields(projectRoot, p),
|
|
183
197
|
});
|
|
184
198
|
continue;
|
|
185
199
|
}
|
|
@@ -189,7 +203,9 @@ export function buildImportFileItems(projectRoot, manifest, status) {
|
|
|
189
203
|
}
|
|
190
204
|
const defaultType = pathIsUnderBeWorkingTree(p)
|
|
191
205
|
? inferDefaultBeJsTypeForPath(manifest, p)
|
|
192
|
-
:
|
|
206
|
+
: pathIsUnderTemplateWorkingTree(p)
|
|
207
|
+
? "ui"
|
|
208
|
+
: defaultUiType;
|
|
193
209
|
items.push({
|
|
194
210
|
operation: "create",
|
|
195
211
|
path: p,
|
|
@@ -332,6 +348,7 @@ export function applyImportResultsToManifest(manifest, items, results) {
|
|
|
332
348
|
type: item.type,
|
|
333
349
|
timestamp: r.timestamp,
|
|
334
350
|
checksum: r.checksum,
|
|
351
|
+
...(r.translation_checksum ? { translation_checksum: r.translation_checksum } : {}),
|
|
335
352
|
});
|
|
336
353
|
continue;
|
|
337
354
|
}
|
|
@@ -347,6 +364,9 @@ export function applyImportResultsToManifest(manifest, items, results) {
|
|
|
347
364
|
f.path = r.path;
|
|
348
365
|
f.timestamp = r.timestamp;
|
|
349
366
|
f.checksum = r.checksum;
|
|
367
|
+
if (r.translation_checksum) {
|
|
368
|
+
f.translation_checksum = r.translation_checksum;
|
|
369
|
+
}
|
|
350
370
|
}
|
|
351
371
|
}
|
|
352
372
|
let latest = manifest.project.timestamp;
|
|
@@ -364,7 +384,8 @@ function writeAppliedSchemaFiles(projectRoot, items, results) {
|
|
|
364
384
|
if (result.status !== "applied" || item.operation === "delete") {
|
|
365
385
|
continue;
|
|
366
386
|
}
|
|
367
|
-
|
|
387
|
+
// files the server stores in a canonical form come back in that form
|
|
388
|
+
if (!pathIsUnderCanonicalJsonWorkingTree(item.path) && !pathIsUnderTemplateWorkingTree(item.path)) {
|
|
368
389
|
continue;
|
|
369
390
|
}
|
|
370
391
|
if (result.content === undefined) {
|
|
@@ -380,17 +401,31 @@ function writeAppliedSchemaFiles(projectRoot, items, results) {
|
|
|
380
401
|
writeFileSync(abs, body, "utf8");
|
|
381
402
|
}
|
|
382
403
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
404
|
+
/**
|
|
405
|
+
* The import requests of one push, in dependency order. Each kind goes after the kinds it is checked against (one
|
|
406
|
+
* request per kind where a check needs all files of that kind together): backend code (be/plv8, be/node) in chunks,
|
|
407
|
+
* schema (auto-increments, field types, entities, views), UI files (Lit, Liquid templates) in chunks, navigation,
|
|
408
|
+
* portals, site content, translations, AnyInput profiles, scenarios, scenario tests, scheduled jobs.
|
|
409
|
+
*/
|
|
410
|
+
export function planImportBatches(items) {
|
|
388
411
|
const schemaItems = items.filter((item) => pathIsUnderSchemaWorkingTree(item.path));
|
|
389
412
|
const autoIncrementItems = items.filter((item) => pathIsUnderAutoIncrementWorkingTree(item.path));
|
|
390
413
|
const fieldTypeItems = items.filter((item) => pathIsUnderFieldTypeWorkingTree(item.path));
|
|
391
414
|
const scheduledJobItems = items.filter((item) => pathIsUnderScheduledJobWorkingTree(item.path));
|
|
415
|
+
// Web routes after the function code they run (be/node, be/plv8 go in the first batches).
|
|
416
|
+
const webRouteItems = items.filter((item) => pathIsUnderWebRouteWorkingTree(item.path));
|
|
417
|
+
// I7b1: mail templates and providers, after the code that sends them
|
|
418
|
+
const mailItems = items.filter((item) => pathIsUnderMailWorkingTree(item.path));
|
|
392
419
|
const navigationItems = items.filter((item) => pathIsUnderNavigationWorkingTree(item.path));
|
|
393
420
|
const portalItems = items.filter((item) => pathIsUnderPortalWorkingTree(item.path));
|
|
421
|
+
// Site content (page types, composed pages, menus, globals) after portals: the content publish gate checks it
|
|
422
|
+
// against the site's live settings (locales, layout, …), so a portal change in the same push must be live first.
|
|
423
|
+
// One request, because the gate sees only the content of its own request (a menu and the page it links travel
|
|
424
|
+
// together).
|
|
425
|
+
const uiContentItems = items.filter((item) => pathIsUnderUiContentWorkingTree(item.path));
|
|
426
|
+
// Translation files after site content (the content's texts are the terms they translate), in one request: the
|
|
427
|
+
// server publishes the catalogs once, after every translation file of the push is imported.
|
|
428
|
+
const translationItems = items.filter((item) => pathIsUnderTranslationWorkingTree(item.path));
|
|
394
429
|
// AnyInput: profiles before scenarios (a scenario needs its targets' profiles), both after schema; test suites last
|
|
395
430
|
// (they are checked against the scenarios).
|
|
396
431
|
const profileItems = items.filter((item) => pathIsUnderCapabilityProfileWorkingTree(item.path));
|
|
@@ -400,21 +435,37 @@ async function sendImportBatches(projectRoot, items, validateOnly, debug, pushMe
|
|
|
400
435
|
!pathIsUnderAutoIncrementWorkingTree(item.path) &&
|
|
401
436
|
!pathIsUnderFieldTypeWorkingTree(item.path) &&
|
|
402
437
|
!pathIsUnderScheduledJobWorkingTree(item.path) &&
|
|
438
|
+
!pathIsUnderWebRouteWorkingTree(item.path) &&
|
|
439
|
+
!pathIsUnderMailWorkingTree(item.path) &&
|
|
403
440
|
!pathIsUnderNavigationWorkingTree(item.path) &&
|
|
404
441
|
!pathIsUnderPortalWorkingTree(item.path) &&
|
|
442
|
+
!pathIsUnderUiContentWorkingTree(item.path) &&
|
|
443
|
+
!pathIsUnderTranslationWorkingTree(item.path) &&
|
|
405
444
|
!pathIsUnderCapabilityProfileWorkingTree(item.path) &&
|
|
406
445
|
!pathIsUnderScenarioWorkingTree(item.path) &&
|
|
407
446
|
!pathIsUnderScenarioTestWorkingTree(item.path));
|
|
408
|
-
|
|
447
|
+
// All backend before any UI, as the server applies them within one request: function code first (be/plv8, be/node,
|
|
448
|
+
// which schema builds may call), then schema (auto-increments, field types, entities, views), then UI files, which
|
|
449
|
+
// are checked against the built views (a Liquid page's data sources, a site's sitemaps).
|
|
450
|
+
const beCodeItems = otherItems.filter((item) => pathIsUnderBeWorkingTree(item.path));
|
|
451
|
+
const uiItems = otherItems.filter((item) => !pathIsUnderBeWorkingTree(item.path));
|
|
452
|
+
const batches = chunk(beCodeItems, IMPORT_FILES_BATCH_SIZE);
|
|
453
|
+
const schemaBatch = [...autoIncrementItems, ...fieldTypeItems, ...schemaItems];
|
|
454
|
+
if (schemaBatch.length > 0) {
|
|
455
|
+
batches.push(schemaBatch);
|
|
456
|
+
}
|
|
457
|
+
batches.push(...chunk(uiItems, IMPORT_FILES_BATCH_SIZE));
|
|
409
458
|
if (navigationItems.length > 0) {
|
|
410
459
|
batches.push(navigationItems);
|
|
411
460
|
}
|
|
412
461
|
if (portalItems.length > 0) {
|
|
413
462
|
batches.push(portalItems);
|
|
414
463
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
464
|
+
if (uiContentItems.length > 0) {
|
|
465
|
+
batches.push(uiContentItems);
|
|
466
|
+
}
|
|
467
|
+
if (translationItems.length > 0) {
|
|
468
|
+
batches.push(translationItems);
|
|
418
469
|
}
|
|
419
470
|
if (profileItems.length > 0) {
|
|
420
471
|
batches.push(profileItems);
|
|
@@ -428,6 +479,21 @@ async function sendImportBatches(projectRoot, items, validateOnly, debug, pushMe
|
|
|
428
479
|
if (scheduledJobItems.length > 0) {
|
|
429
480
|
batches.push(scheduledJobItems);
|
|
430
481
|
}
|
|
482
|
+
if (webRouteItems.length > 0) {
|
|
483
|
+
batches.push(webRouteItems);
|
|
484
|
+
}
|
|
485
|
+
if (mailItems.length > 0) {
|
|
486
|
+
batches.push(mailItems);
|
|
487
|
+
}
|
|
488
|
+
return batches;
|
|
489
|
+
}
|
|
490
|
+
async function sendImportBatches(projectRoot, items, validateOnly, debug, pushMessage) {
|
|
491
|
+
const project = loadProjectConfig(projectRoot);
|
|
492
|
+
const client = await createClientForProjectRoot(projectRoot);
|
|
493
|
+
const allItems = [];
|
|
494
|
+
const allResults = [];
|
|
495
|
+
const affectedByPath = new Map();
|
|
496
|
+
const batches = planImportBatches(items);
|
|
431
497
|
const batchLabel = validateOnly ? "Validating" : "Uploading";
|
|
432
498
|
if (batches.length > 0) {
|
|
433
499
|
logProgress(`${batchLabel} ${String(items.length)} change(s)…`);
|
|
@@ -472,6 +538,9 @@ async function sendImportBatches(projectRoot, items, validateOnly, debug, pushMe
|
|
|
472
538
|
}
|
|
473
539
|
allItems.push(...batch);
|
|
474
540
|
allResults.push(...response.results);
|
|
541
|
+
for (const file of response.affected_files ?? []) {
|
|
542
|
+
affectedByPath.set(normalizeProjectRelativePath(file.path), file); // a later batch has the newer state
|
|
543
|
+
}
|
|
475
544
|
if (validateOnly) {
|
|
476
545
|
const { failures } = zipImportOutcomes(batch, response.results);
|
|
477
546
|
if (failures.length > 0) {
|
|
@@ -482,7 +551,53 @@ async function sendImportBatches(projectRoot, items, validateOnly, debug, pushMe
|
|
|
482
551
|
}
|
|
483
552
|
}
|
|
484
553
|
}
|
|
485
|
-
return { allItems, allResults };
|
|
554
|
+
return { allItems, allResults, affected: [...affectedByPath.values()] };
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Files the push changed on the server without them being pushed (the translation files, after a push that added or
|
|
558
|
+
* retired translatable texts): written where the local copy is unchanged since the last pull, so the next edit starts
|
|
559
|
+
* from the current file. A locally edited copy is left alone, with a note.
|
|
560
|
+
*/
|
|
561
|
+
export function writeAffectedFiles(projectRoot, before, working, pushedPaths, affected) {
|
|
562
|
+
const warnings = [];
|
|
563
|
+
const info = [];
|
|
564
|
+
for (const file of affected) {
|
|
565
|
+
const p = normalizeProjectRelativePath(file.path);
|
|
566
|
+
if (pushedPaths.has(p)) {
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
const prev = before.files.find((f) => normalizeProjectRelativePath(f.path) === p);
|
|
570
|
+
if (prev !== undefined && prev.checksum === file.checksum) {
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
const abs = safeProjectFilePath(projectRoot, p);
|
|
574
|
+
if (existsSync(abs)) {
|
|
575
|
+
const disk = md5HexUtf8CanonicalJson(readFileSync(abs, "utf8"));
|
|
576
|
+
if (prev === undefined || disk !== prev.checksum) {
|
|
577
|
+
warnings.push(`${p} changed on the server (texts added or removed by this push) and has local edits; it was left as is. Push your edits (new untranslated texts do not make it a conflict), then pull to get the new texts.`);
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
582
|
+
writeFileSync(abs, normalizeExportContentForWrite(file.content, { id: file.id, manifestPath: p, absPath: abs }), "utf8");
|
|
583
|
+
const entry = working.files.find((f) => normalizeProjectRelativePath(f.path) === p);
|
|
584
|
+
const next = {
|
|
585
|
+
id: file.id,
|
|
586
|
+
path: p,
|
|
587
|
+
type: file.type,
|
|
588
|
+
timestamp: file.timestamp,
|
|
589
|
+
checksum: file.checksum,
|
|
590
|
+
...(file.translation_checksum ? { translation_checksum: file.translation_checksum } : {}),
|
|
591
|
+
};
|
|
592
|
+
if (entry === undefined) {
|
|
593
|
+
working.files.push(next);
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
Object.assign(entry, next);
|
|
597
|
+
}
|
|
598
|
+
info.push(`Updated ${p} (texts added or removed by this push).`);
|
|
599
|
+
}
|
|
600
|
+
return { warnings, info };
|
|
486
601
|
}
|
|
487
602
|
function uniqueAppliedMessages(results) {
|
|
488
603
|
const messages = [];
|
|
@@ -558,15 +673,45 @@ export async function runImportPush(projectRoot, options) {
|
|
|
558
673
|
}
|
|
559
674
|
}
|
|
560
675
|
const working = cloneManifest(manifest);
|
|
561
|
-
const { allItems, allResults } = await sendImportBatches(projectRoot, items, false, options?.debug === true, options?.message);
|
|
676
|
+
const { allItems, allResults, affected } = await sendImportBatches(projectRoot, items, false, options?.debug === true, options?.message);
|
|
562
677
|
writeAppliedSchemaFiles(projectRoot, allItems, allResults);
|
|
563
678
|
applyImportResultsToManifest(working, allItems, allResults);
|
|
679
|
+
const affectedNotes = writeAffectedFiles(projectRoot, manifest, working, new Set(allItems.map((item) => normalizeProjectRelativePath(item.path))), affected);
|
|
564
680
|
writeManifestJson(projectRoot, working);
|
|
565
681
|
writeFileState(projectRoot, manifestToFileState(working));
|
|
566
682
|
const appliedCount = allResults.filter(result => result.status === `applied`).length;
|
|
567
683
|
for (const message of uniqueAppliedMessages(allResults)) {
|
|
568
684
|
console.log(`Warning: ${message}`);
|
|
569
685
|
}
|
|
686
|
+
for (const warning of affectedNotes.warnings) {
|
|
687
|
+
console.log(`Warning: ${warning}`);
|
|
688
|
+
}
|
|
689
|
+
const infoLines = [];
|
|
690
|
+
for (const result of allResults) {
|
|
691
|
+
if (result.status !== "applied") {
|
|
692
|
+
continue;
|
|
693
|
+
}
|
|
694
|
+
for (const line of result.info ?? []) {
|
|
695
|
+
if (!infoLines.includes(line)) {
|
|
696
|
+
infoLines.push(line);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
for (const line of infoLines) {
|
|
701
|
+
console.log(line);
|
|
702
|
+
}
|
|
703
|
+
if (options?.debug === true) {
|
|
704
|
+
for (const result of allResults) {
|
|
705
|
+
if (result.status === "applied") {
|
|
706
|
+
for (const note of result.notes ?? []) {
|
|
707
|
+
console.log(note);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
for (const note of affectedNotes.info) {
|
|
712
|
+
console.log(note);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
570
715
|
const { failures } = zipImportOutcomes(allItems, allResults);
|
|
571
716
|
if (failures.length > 0) {
|
|
572
717
|
const committed = appliedCount > 0
|