@antelopejs/dms 0.15.1 → 0.16.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/CHANGELOG.md +31 -0
- package/README.md +36 -26
- package/bin/control/base.mjs +9 -4
- package/bin/control/browser-client.mjs +24 -5
- package/bin/control/browser-wire.mjs +41 -0
- package/bin/control/browser-wire.test.mjs +96 -0
- package/bin/control/browser.mjs +78 -27
- package/bin/control/commands-stack.mjs +58 -8
- package/bin/control/commands-verify.mjs +47 -1
- package/bin/control/doctor.mjs +49 -4
- package/bin/control/failure.mjs +9 -0
- package/bin/control/journey.mjs +158 -30
- package/bin/control/journey.test.mjs +61 -0
- package/bin/control/json.mjs +229 -0
- package/bin/control/json.test.mjs +130 -0
- package/bin/control/mail.mjs +57 -7
- package/bin/control/mail.test.mjs +55 -0
- package/bin/control/mongo.mjs +205 -27
- package/bin/control/mongo.test.mjs +298 -0
- package/bin/control/options.mjs +33 -0
- package/bin/control/processes.mjs +24 -2
- package/bin/control/renderer.mjs +39 -0
- package/bin/control/renderer.test.mjs +324 -0
- package/bin/control/run-state.mjs +119 -6
- package/bin/control/run-state.test.mjs +171 -0
- package/bin/control/session.mjs +30 -14
- package/bin/control/stack.mjs +95 -24
- package/bin/control/tab.mjs +117 -18
- package/bin/control/verify/behaviour.mjs +44 -6
- package/bin/control/verify/behaviour.test.mjs +130 -22
- package/bin/control/verify/decode.mjs +220 -0
- package/bin/control/verify/decode.test.mjs +245 -0
- package/bin/control/verify/doors.mjs +1 -1
- package/bin/control/verify/doors.test.mjs +40 -0
- package/bin/control/verify/emit.mjs +135 -9
- package/bin/control/verify/formal.mjs +61 -10
- package/bin/control/verify/formal.test.mjs +19 -3
- package/bin/control/verify/judgement.mjs +22 -3
- package/bin/control/verify/map.mjs +25 -5
- package/bin/control/verify/publish.mjs +20 -14
- package/bin/control/verify/seeded.mjs +65 -16
- package/bin/control/verify/skill.mjs +27 -6
- package/bin/control/verify/types.mjs +29 -0
- package/bin/control/verify/verdict.mjs +72 -7
- package/bin/dms-control.mjs +8 -28
- package/checks/api-error-presentation.d.mts +61 -0
- package/dist/attachments/access.js +1 -1
- package/dist/attachments/access.js.map +1 -1
- package/dist/attachments/fields.d.ts +2 -2
- package/dist/attachments/fields.js +26 -13
- package/dist/attachments/fields.js.map +1 -1
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.js +1 -0
- package/dist/attachments/index.js.map +1 -1
- package/dist/attachments/read.js.map +1 -1
- package/dist/attachments/save.d.ts +1 -1
- package/dist/attachments/save.js +49 -17
- package/dist/attachments/save.js.map +1 -1
- package/dist/attachments/table-view.d.ts +1 -2
- package/dist/attachments/table-view.js +23 -13
- package/dist/attachments/table-view.js.map +1 -1
- package/dist/automation/events.d.ts +10 -10
- package/dist/automation/index.js +3 -4
- package/dist/automation/index.js.map +1 -1
- package/dist/automation/send-notification.d.ts +2 -2
- package/dist/automation/send-notification.js +4 -6
- package/dist/automation/send-notification.js.map +1 -1
- package/dist/crons/cleanup-user-invites.js.map +1 -1
- package/dist/crons/sweep-expired-sessions.js.map +1 -1
- package/dist/crons/sweep-stale-exports.js.map +1 -1
- package/dist/db/guard-row.d.ts +2 -3
- package/dist/db/guard-row.js +1 -2
- package/dist/db/guard-row.js.map +1 -1
- package/dist/db/models/attachments.model.d.ts +7 -5
- package/dist/db/models/setupToken.model.d.ts +7 -5
- package/dist/db/models/signInAttempts.model.d.ts +7 -5
- package/dist/db/models/systemState.model.d.ts +7 -5
- package/dist/db/models/userEmailChanges.model.d.ts +7 -5
- package/dist/db/models/userKnownDevices.model.d.ts +7 -5
- package/dist/db/models/userNotificationPreferences.model.d.ts +7 -5
- package/dist/db/models/userNotifications.model.d.ts +9 -6
- package/dist/db/models/userNotifications.model.js.map +1 -1
- package/dist/dev/module-update-notifications.js.map +1 -1
- package/dist/hooks/internal/sign-in-monitor.js +6 -6
- package/dist/hooks/internal/sign-in-monitor.js.map +1 -1
- package/dist/implementations/dms/page/controller.d.ts +2 -2
- package/dist/implementations/dms/page/controller.js +3 -1
- package/dist/implementations/dms/page/controller.js.map +1 -1
- package/dist/implementations/dms/page/dynamic-menu.js +3 -2
- package/dist/implementations/dms/page/dynamic-menu.js.map +1 -1
- package/dist/implementations/dms/page/notifications.d.ts +6 -2
- package/dist/implementations/dms/page/notifications.js +1 -0
- package/dist/implementations/dms/page/notifications.js.map +1 -1
- package/dist/implementations/dms/page/preview-pages.js +6 -3
- package/dist/implementations/dms/page/preview-pages.js.map +1 -1
- package/dist/implementations/dms/page/registry.js +10 -4
- package/dist/implementations/dms/page/registry.js.map +1 -1
- package/dist/implementations/dms/permissions.js +12 -12
- package/dist/implementations/dms/permissions.js.map +1 -1
- package/dist/implementations/dms-base/bulk-selection.d.ts +3 -4
- package/dist/implementations/dms-base/bulk-selection.js +18 -6
- package/dist/implementations/dms-base/bulk-selection.js.map +1 -1
- package/dist/implementations/dms-base/filter-tokens.js.map +1 -1
- package/dist/implementations/dms-base/footer-summary.js +44 -27
- package/dist/implementations/dms-base/footer-summary.js.map +1 -1
- package/dist/implementations/dms-base/row-rule-operand.d.ts +6 -0
- package/dist/implementations/dms-base/row-rule-operand.js +41 -0
- package/dist/implementations/dms-base/row-rule-operand.js.map +1 -0
- package/dist/implementations/dms-base/search-route.d.ts +9 -13
- package/dist/implementations/dms-base/search-route.js +7 -6
- package/dist/implementations/dms-base/search-route.js.map +1 -1
- package/dist/implementations/dms-base/services.d.ts +1 -0
- package/dist/implementations/dms-base/services.js +1 -0
- package/dist/implementations/dms-base/services.js.map +1 -1
- package/dist/implementations/dms-base/table-view.d.ts +5 -6
- package/dist/implementations/dms-base/table-view.js +17 -6
- package/dist/implementations/dms-base/table-view.js.map +1 -1
- package/dist/implementations/dms-html-render/index.js +16 -6
- package/dist/implementations/dms-html-render/index.js.map +1 -1
- package/dist/implementations/dms-notifications/delivery-guard.d.ts +3 -2
- package/dist/implementations/dms-notifications/delivery-guard.js.map +1 -1
- package/dist/implementations/dms-notifications/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pages/public/preview/block-types.d.ts +1 -2
- package/dist/pages/public/preview/block-types.js.map +1 -1
- package/dist/pages/settings/overview/account-summary.js +4 -1
- package/dist/pages/settings/overview/account-summary.js.map +1 -1
- package/dist/pages/settings/users/account-activity-feed.js +3 -2
- package/dist/pages/settings/users/account-activity-feed.js.map +1 -1
- package/dist/pages/settings/users/account-credentials.d.ts +1 -1
- package/dist/pages/settings/users/account-credentials.js +1 -2
- package/dist/pages/settings/users/account-credentials.js.map +1 -1
- package/dist/pages/settings/users/account-data-store.d.ts +1 -1
- package/dist/pages/settings/users/account-data-store.js +1 -3
- package/dist/pages/settings/users/account-data-store.js.map +1 -1
- package/dist/pages/settings/users/email-change.d.ts +2 -2
- package/dist/pages/settings/users/email-change.js +2 -3
- package/dist/pages/settings/users/email-change.js.map +1 -1
- package/dist/pages/settings/users/invite-extension-routes.d.ts +2 -2
- package/dist/pages/settings/users/invite-extension-routes.js +11 -4
- package/dist/pages/settings/users/invite-extension-routes.js.map +1 -1
- package/dist/pages/settings/users/invites.d.ts +2 -2
- package/dist/pages/settings/users/member-invite-batch.d.ts +2 -2
- package/dist/pages/settings/users/member-invite-batch.js +7 -3
- package/dist/pages/settings/users/member-invite-batch.js.map +1 -1
- package/dist/pages/settings/users/member-roles-field.js +1 -4
- package/dist/pages/settings/users/member-roles-field.js.map +1 -1
- package/dist/pages/settings/users/members.d.ts +2 -3
- package/dist/pages/settings/users/members.js.map +1 -1
- package/dist/pages/settings/users/notifications.d.ts +2 -3
- package/dist/pages/settings/users/notifications.js +2 -1
- package/dist/pages/settings/users/notifications.js.map +1 -1
- package/dist/pages/settings/users/profile-helpers.d.ts +0 -1
- package/dist/pages/settings/users/profile-helpers.js +0 -17
- package/dist/pages/settings/users/profile-helpers.js.map +1 -1
- package/dist/pages/settings/users/profile.d.ts +3 -4
- package/dist/pages/settings/users/profile.js +12 -12
- package/dist/pages/settings/users/profile.js.map +1 -1
- package/dist/pages/settings/users/region.d.ts +3 -4
- package/dist/pages/settings/users/region.js.map +1 -1
- package/dist/pages/settings/users/regional-preferences.d.ts +8 -1
- package/dist/pages/settings/users/regional-preferences.js +10 -6
- package/dist/pages/settings/users/regional-preferences.js.map +1 -1
- package/dist/pages/settings/users/role-preview.js +3 -2
- package/dist/pages/settings/users/role-preview.js.map +1 -1
- package/dist/pages/settings/users/roles.d.ts +4 -5
- package/dist/pages/settings/users/roles.js.map +1 -1
- package/dist/pages/settings/users/security.d.ts +9 -12
- package/dist/pages/settings/users/security.js +11 -9
- package/dist/pages/settings/users/security.js.map +1 -1
- package/dist/pages/settings/users/two-factor-operations.d.ts +7 -7
- package/dist/pages/settings/users/two-factor-operations.js +5 -7
- package/dist/pages/settings/users/two-factor-operations.js.map +1 -1
- package/dist/realtime/broker.js.map +1 -1
- package/dist/realtime/heartbeat.js.map +1 -1
- package/dist/realtime/redis-broker.js.map +1 -1
- package/dist/realtime/sessions.js.map +1 -1
- package/dist/realtime/sse.js +1 -2
- package/dist/realtime/sse.js.map +1 -1
- package/dist/routes/auth/forgot-password.d.ts +1 -1
- package/dist/routes/auth/forgot-password.js +1 -3
- package/dist/routes/auth/forgot-password.js.map +1 -1
- package/dist/routes/auth/login.d.ts +1 -1
- package/dist/routes/auth/login.js +1 -2
- package/dist/routes/auth/login.js.map +1 -1
- package/dist/routes/auth/logout.d.ts +1 -1
- package/dist/routes/auth/logout.js +1 -2
- package/dist/routes/auth/logout.js.map +1 -1
- package/dist/routes/auth/oauth/providers.js +30 -6
- package/dist/routes/auth/oauth/providers.js.map +1 -1
- package/dist/routes/auth/oauth/state.js +8 -5
- package/dist/routes/auth/oauth/state.js.map +1 -1
- package/dist/routes/auth/oauth/token-exchange.js +8 -1
- package/dist/routes/auth/oauth/token-exchange.js.map +1 -1
- package/dist/routes/auth/refresh.d.ts +1 -1
- package/dist/routes/auth/refresh.js +1 -2
- package/dist/routes/auth/refresh.js.map +1 -1
- package/dist/routes/auth/request-2fa-email.d.ts +1 -1
- package/dist/routes/auth/request-2fa-email.js +1 -2
- package/dist/routes/auth/request-2fa-email.js.map +1 -1
- package/dist/routes/auth/reset-password.d.ts +1 -1
- package/dist/routes/auth/reset-password.js +1 -3
- package/dist/routes/auth/reset-password.js.map +1 -1
- package/dist/routes/auth/session-handoff.d.ts +1 -1
- package/dist/routes/auth/session-handoff.js +1 -2
- package/dist/routes/auth/session-handoff.js.map +1 -1
- package/dist/routes/auth/signup.d.ts +1 -1
- package/dist/routes/auth/signup.js +1 -2
- package/dist/routes/auth/signup.js.map +1 -1
- package/dist/routes/auth/switch-tenant.d.ts +2 -3
- package/dist/routes/auth/switch-tenant.js +3 -2
- package/dist/routes/auth/switch-tenant.js.map +1 -1
- package/dist/routes/auth/validate-forgot-password-token.d.ts +1 -1
- package/dist/routes/auth/validate-forgot-password-token.js +1 -3
- package/dist/routes/auth/validate-forgot-password-token.js.map +1 -1
- package/dist/routes/auth/validate-invite-token.d.ts +1 -1
- package/dist/routes/auth/validate-invite-token.js +1 -3
- package/dist/routes/auth/validate-invite-token.js.map +1 -1
- package/dist/routes/auth/verify-2fa.d.ts +1 -1
- package/dist/routes/auth/verify-2fa.js +1 -2
- package/dist/routes/auth/verify-2fa.js.map +1 -1
- package/dist/routes/auth/verify-email.d.ts +1 -1
- package/dist/routes/auth/verify-email.js +1 -2
- package/dist/routes/auth/verify-email.js.map +1 -1
- package/dist/routes/auth.d.ts +14 -15
- package/dist/routes/auth.js +15 -13
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/files.d.ts +1 -2
- package/dist/routes/files.js.map +1 -1
- package/dist/routes/onboarding.d.ts +1 -2
- package/dist/routes/onboarding.js.map +1 -1
- package/dist/routes/realtime.js +5 -6
- package/dist/routes/realtime.js.map +1 -1
- package/dist/routes/store.d.ts +6 -7
- package/dist/routes/store.js +19 -13
- package/dist/routes/store.js.map +1 -1
- package/dist/store/catalog.d.ts +13 -5
- package/dist/store/catalog.js +19 -9
- package/dist/store/catalog.js.map +1 -1
- package/dist/store/compatibility.d.ts +1 -0
- package/dist/store/compatibility.js +24 -8
- package/dist/store/compatibility.js.map +1 -1
- package/dist/store/frontend-compatibility.js +15 -3
- package/dist/store/frontend-compatibility.js.map +1 -1
- package/dist/store/interfaces.js +35 -13
- package/dist/store/interfaces.js.map +1 -1
- package/dist/store/internal/frontend/frontend-modules.js +7 -3
- package/dist/store/internal/frontend/frontend-modules.js.map +1 -1
- package/dist/store/internal/frontend/frontend-ready.d.ts +2 -1
- package/dist/store/internal/frontend/frontend-ready.js +6 -4
- package/dist/store/internal/frontend/frontend-ready.js.map +1 -1
- package/dist/store/internal/frontend/manifest.js +6 -7
- package/dist/store/internal/frontend/manifest.js.map +1 -1
- package/dist/store/operations.js.map +1 -1
- package/dist/store/registry.js.map +1 -1
- package/dist/store/runtime.d.ts +13 -0
- package/dist/store/runtime.js +9 -1
- package/dist/store/runtime.js.map +1 -1
- package/dist/utils/admin-invite-email.js +3 -1
- package/dist/utils/admin-invite-email.js.map +1 -1
- package/dist/utils/email-subjects.js +3 -1
- package/dist/utils/email-subjects.js.map +1 -1
- package/dist/utils/export-jobs-run.js.map +1 -1
- package/dist/utils/export-jobs.js +3 -9
- package/dist/utils/export-jobs.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/own-value.d.ts +1 -0
- package/dist/utils/own-value.js +7 -0
- package/dist/utils/own-value.js.map +1 -0
- package/dist/utils/row-action-rule-evaluator.js +31 -35
- package/dist/utils/row-action-rule-evaluator.js.map +1 -1
- package/dist/utils/sign-in-country.js +4 -2
- package/dist/utils/sign-in-country.js.map +1 -1
- package/dist/utils/tenant-export-archive.js +9 -14
- package/dist/utils/tenant-export-archive.js.map +1 -1
- package/dist/utils/user-agent.js +2 -1
- package/dist/utils/user-agent.js.map +1 -1
- package/dist/validation/auth.schema.d.ts +10 -10
- package/dist/validation/regional-preferences.schema.d.ts +2 -2
- package/dist/validation/role-editor.schema.d.ts +1 -1
- package/frontend-vue/build/backend-boundary.ts +49 -18
- package/frontend-vue/dms.frontend.ts +8 -12
- package/frontend-vue/layers/dms-auth/server/accounts.ts +44 -3
- package/frontend-vue/layers/dms-auth/server/actions.ts +17 -4
- package/frontend-vue/layers/dms-auth/server/oauth.ts +42 -4
- package/frontend-vue/layers/dms-core/app/types/watch.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +57 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/form/registerFormFunctions.ts +7 -9
- package/frontend-vue/layers/dms-ui/app/entries/composables/form/registerFormFunctions.ts +1 -0
- package/frontend-vue/lazy-plugin.ts +18 -0
- package/frontend-vue/package.json +2 -2
- package/package.json +19 -13
- package/skills/dms-project/SKILL.md +4 -3
|
@@ -9,6 +9,8 @@ import { apiRequest, isOk, onboard } from "./session.mjs";
|
|
|
9
9
|
import { down, freshDatabase, resolutionFolders, up } from "./stack.mjs";
|
|
10
10
|
import { loadSkill, runPrepare } from "./verify/skill.mjs";
|
|
11
11
|
|
|
12
|
+
/** @typedef {import("./options.mjs").Values} Values */
|
|
13
|
+
|
|
12
14
|
const BROWSER_ACTIONS = [...ACTION_NAMES, "login"];
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -20,13 +22,32 @@ export function print(text) {
|
|
|
20
22
|
process.stdout.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The playground and the renderer checkout `up` starts: the options, then
|
|
27
|
+
* the skill's `verify.config.ts`.
|
|
28
|
+
*
|
|
29
|
+
* @param {Pick<Values, "playground" | "renderer" | "skill">} values
|
|
30
|
+
* @param {string} cwd Where the command runs, which finds the skill
|
|
31
|
+
* @returns {Promise<{ playground: string, renderer: string | undefined }>}
|
|
32
|
+
*/
|
|
33
|
+
export async function targetOf(values, cwd) {
|
|
34
|
+
const skill =
|
|
35
|
+
values.playground && values.renderer
|
|
36
|
+
? null
|
|
37
|
+
: await loadSkill(values.skill, cwd).catch(() => null);
|
|
38
|
+
const fromSkill = (/** @type {string | undefined} */ folder) =>
|
|
39
|
+
skill && folder ? resolve(skill.repo, folder) : undefined;
|
|
40
|
+
return {
|
|
41
|
+
playground:
|
|
42
|
+
values.playground ?? fromSkill(skill?.config.playground) ?? "playground",
|
|
43
|
+
renderer: values.renderer ?? fromSkill(skill?.config.renderer),
|
|
44
|
+
};
|
|
28
45
|
}
|
|
29
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @param {Values} values
|
|
49
|
+
* @returns {Promise<number>}
|
|
50
|
+
*/
|
|
30
51
|
async function commandUp(values) {
|
|
31
52
|
const skill = values.skill ? resolve(values.skill) : undefined;
|
|
32
53
|
if (values.prepare) {
|
|
@@ -34,7 +55,7 @@ async function commandUp(values) {
|
|
|
34
55
|
runPrepare(loaded, loaded.repo);
|
|
35
56
|
}
|
|
36
57
|
const state = await up({
|
|
37
|
-
|
|
58
|
+
...(await targetOf(values, process.cwd())),
|
|
38
59
|
runs: values.runs,
|
|
39
60
|
mongoUrl: values["mongo-url"],
|
|
40
61
|
env: values.env,
|
|
@@ -45,6 +66,11 @@ async function commandUp(values) {
|
|
|
45
66
|
return 0;
|
|
46
67
|
}
|
|
47
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} dir
|
|
71
|
+
* @param {Values} values
|
|
72
|
+
* @returns {Promise<number>}
|
|
73
|
+
*/
|
|
48
74
|
async function commandDoctor(dir, values) {
|
|
49
75
|
const state = loadRun(dir);
|
|
50
76
|
const lines = await doctor(state);
|
|
@@ -58,6 +84,11 @@ async function commandDoctor(dir, values) {
|
|
|
58
84
|
return lines.every((line) => line.ok) ? 0 : 1;
|
|
59
85
|
}
|
|
60
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @param {string} dir
|
|
89
|
+
* @param {Values} values
|
|
90
|
+
* @returns {Promise<number>}
|
|
91
|
+
*/
|
|
61
92
|
async function commandOnboard(dir, values) {
|
|
62
93
|
const state = loadRun(dir);
|
|
63
94
|
const answer = await onboard(state, {
|
|
@@ -73,6 +104,7 @@ async function commandOnboard(dir, values) {
|
|
|
73
104
|
return 0;
|
|
74
105
|
}
|
|
75
106
|
|
|
107
|
+
/** @param {Values} values */
|
|
76
108
|
function browserTarget(values) {
|
|
77
109
|
if (!values.role) return undefined;
|
|
78
110
|
const within = values["within-role"]
|
|
@@ -87,6 +119,12 @@ function browserTarget(values) {
|
|
|
87
119
|
};
|
|
88
120
|
}
|
|
89
121
|
|
|
122
|
+
/**
|
|
123
|
+
* @param {string} dir
|
|
124
|
+
* @param {string} action
|
|
125
|
+
* @param {Values} values
|
|
126
|
+
* @returns {Promise<number>}
|
|
127
|
+
*/
|
|
90
128
|
async function commandBrowser(dir, action, values) {
|
|
91
129
|
if (!BROWSER_ACTIONS.includes(action)) {
|
|
92
130
|
print(
|
|
@@ -118,8 +156,16 @@ async function commandBrowser(dir, action, values) {
|
|
|
118
156
|
return 0;
|
|
119
157
|
}
|
|
120
158
|
|
|
159
|
+
/**
|
|
160
|
+
* @param {string} dir
|
|
161
|
+
* @param {string} method
|
|
162
|
+
* @param {string} path
|
|
163
|
+
* @param {Values} values
|
|
164
|
+
* @returns {Promise<number>}
|
|
165
|
+
*/
|
|
121
166
|
async function commandApi(dir, method, path, values) {
|
|
122
167
|
const state = loadRun(dir);
|
|
168
|
+
/** @type {unknown} */
|
|
123
169
|
const body = values.body === undefined ? undefined : JSON.parse(values.body);
|
|
124
170
|
const answer = await apiRequest(state, {
|
|
125
171
|
method: method.toUpperCase(),
|
|
@@ -132,6 +178,10 @@ async function commandApi(dir, method, path, values) {
|
|
|
132
178
|
return isOk(answer) ? 0 : 1;
|
|
133
179
|
}
|
|
134
180
|
|
|
181
|
+
/**
|
|
182
|
+
* @param {string} dir
|
|
183
|
+
* @returns {Promise<number>}
|
|
184
|
+
*/
|
|
135
185
|
async function commandDown(dir) {
|
|
136
186
|
const state = loadRun(dir);
|
|
137
187
|
const lines = await down(state);
|
|
@@ -145,9 +195,9 @@ async function commandDown(dir) {
|
|
|
145
195
|
* Runs a command that drives the product: `up`, `doctor`, `onboard`,
|
|
146
196
|
* `browser`, `api`, `mail`, `down`, and the two services `up` starts.
|
|
147
197
|
*
|
|
148
|
-
* @param {string} command The command
|
|
198
|
+
* @param {string | undefined} command The command
|
|
149
199
|
* @param {string[]} rest Its positional arguments
|
|
150
|
-
* @param {
|
|
200
|
+
* @param {Values} values Its options
|
|
151
201
|
* @returns {Promise<number | undefined>} The exit code, or undefined for a command it does not own; the two services keep the process alive
|
|
152
202
|
*/
|
|
153
203
|
export async function runStackCommand(command, rest, values) {
|
|
@@ -20,6 +20,16 @@ import { runSeededBreaks } from "./verify/seeded.mjs";
|
|
|
20
20
|
import { journeysFile, loadSkill } from "./verify/skill.mjs";
|
|
21
21
|
import { renderVerdict } from "./verify/verdict.mjs";
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {import("./options.mjs").Values} Values
|
|
25
|
+
* @typedef {import("./run-state.mjs").RunState} RunState
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {Values} values The options of the command line
|
|
30
|
+
* @param {RunState} [state] The run, whose skill and checkout are the defaults
|
|
31
|
+
* @returns {ReturnType<typeof loadSkill>} The skill
|
|
32
|
+
*/
|
|
23
33
|
function skillOf(values, state) {
|
|
24
34
|
return loadSkill(
|
|
25
35
|
values.skill ?? state?.skill ?? undefined,
|
|
@@ -27,18 +37,33 @@ function skillOf(values, state) {
|
|
|
27
37
|
);
|
|
28
38
|
}
|
|
29
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @param {Values} values The options of the command line
|
|
42
|
+
* @returns {Promise<number>} The exit code
|
|
43
|
+
*/
|
|
30
44
|
async function commandMap(values) {
|
|
31
45
|
const problems = await checkMap(await skillOf(values));
|
|
32
46
|
for (const problem of problems) print(problem);
|
|
33
47
|
return problems.length === 0 ? 0 : 1;
|
|
34
48
|
}
|
|
35
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @param {Values} values The options of the command line
|
|
52
|
+
* @returns {Promise<number>} The exit code
|
|
53
|
+
*/
|
|
36
54
|
async function commandPlan(values) {
|
|
37
55
|
const plan = planFor(await skillOf(values), values.base);
|
|
38
56
|
print(JSON.stringify(plan, null, 2));
|
|
39
57
|
return plan.unmapped.length === 0 ? 0 : 1;
|
|
40
58
|
}
|
|
41
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @param {string} dir The run root
|
|
62
|
+
* @param {string} feature The feature whose journeys run
|
|
63
|
+
* @param {string[]} ids The journeys to run, or none for all
|
|
64
|
+
* @param {Values} values The options of the command line
|
|
65
|
+
* @returns {Promise<number>} The exit code
|
|
66
|
+
*/
|
|
42
67
|
async function commandJourney(dir, feature, ids, values) {
|
|
43
68
|
const state = loadRun(dir);
|
|
44
69
|
const skill = await skillOf(values, state);
|
|
@@ -61,6 +86,11 @@ async function commandJourney(dir, feature, ids, values) {
|
|
|
61
86
|
return results.every((result) => result.status === "PASS") ? 0 : 1;
|
|
62
87
|
}
|
|
63
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @param {string[]} features The features whose seeded breaks run
|
|
91
|
+
* @param {Values} values The options of the command line
|
|
92
|
+
* @returns {Promise<number>} The exit code
|
|
93
|
+
*/
|
|
64
94
|
async function commandSeeded(features, values) {
|
|
65
95
|
const skill = await skillOf(values);
|
|
66
96
|
const outcomes = runSeededBreaks(skill, features);
|
|
@@ -81,6 +111,11 @@ async function commandSeeded(features, values) {
|
|
|
81
111
|
return outcomes.every((outcome) => outcome.caught) ? 0 : 1;
|
|
82
112
|
}
|
|
83
113
|
|
|
114
|
+
/**
|
|
115
|
+
* @param {string | undefined} patch A patch file, or none for the diff
|
|
116
|
+
* @param {Values} values The options of the command line
|
|
117
|
+
* @returns {Promise<number>} The exit code
|
|
118
|
+
*/
|
|
84
119
|
async function commandDoors(patch, values) {
|
|
85
120
|
const skill = await skillOf(values);
|
|
86
121
|
const doors = flaggedDoors(
|
|
@@ -93,6 +128,11 @@ async function commandDoors(patch, values) {
|
|
|
93
128
|
return 0;
|
|
94
129
|
}
|
|
95
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @param {string} dir The run root
|
|
133
|
+
* @param {Values} values The options of the command line
|
|
134
|
+
* @returns {Promise<number>} The exit code
|
|
135
|
+
*/
|
|
96
136
|
async function commandFormal(dir, values) {
|
|
97
137
|
const state = loadRun(dir);
|
|
98
138
|
const skill = await skillOf(values, state);
|
|
@@ -125,6 +165,12 @@ async function commandFormal(dir, values) {
|
|
|
125
165
|
return 0;
|
|
126
166
|
}
|
|
127
167
|
|
|
168
|
+
/**
|
|
169
|
+
* @param {string} command `verdict` or `publish`
|
|
170
|
+
* @param {string} dir The run root
|
|
171
|
+
* @param {Values} values The options of the command line
|
|
172
|
+
* @returns {Promise<number>} The exit code
|
|
173
|
+
*/
|
|
128
174
|
async function commandJudge(command, dir, values) {
|
|
129
175
|
const pr = Number(values.pr);
|
|
130
176
|
if (!Number.isInteger(pr) || pr <= 0) {
|
|
@@ -159,7 +205,7 @@ async function commandJudge(command, dir, values) {
|
|
|
159
205
|
*
|
|
160
206
|
* @param {string} command The command
|
|
161
207
|
* @param {string[]} rest Its positional arguments
|
|
162
|
-
* @param {
|
|
208
|
+
* @param {Values} values Its options
|
|
163
209
|
* @returns {Promise<number | undefined>} The exit code, or undefined for a command it does not own
|
|
164
210
|
*/
|
|
165
211
|
export function runVerifyCommand(command, rest, values) {
|
package/bin/control/doctor.mjs
CHANGED
|
@@ -3,9 +3,12 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { descendantsOf, isAlive, listenersOf, probe } from "./processes.mjs";
|
|
5
5
|
import { checkoutOf } from "./git.mjs";
|
|
6
|
+
import { stringField } from "./json.mjs";
|
|
6
7
|
import { apiRequest } from "./session.mjs";
|
|
7
8
|
import { packageVersion } from "./stack.mjs";
|
|
8
9
|
|
|
10
|
+
/** @typedef {import("./run-state.mjs").RunState} RunState */
|
|
11
|
+
|
|
9
12
|
const SKIPPED = new Set([
|
|
10
13
|
"node_modules",
|
|
11
14
|
".antelope",
|
|
@@ -16,6 +19,10 @@ const SKIPPED = new Set([
|
|
|
16
19
|
".output",
|
|
17
20
|
]);
|
|
18
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} folder
|
|
24
|
+
* @returns {number}
|
|
25
|
+
*/
|
|
19
26
|
function newestMtime(folder) {
|
|
20
27
|
if (!existsSync(folder)) return 0;
|
|
21
28
|
let newest = 0;
|
|
@@ -30,14 +37,25 @@ function newestMtime(folder) {
|
|
|
30
37
|
return newest;
|
|
31
38
|
}
|
|
32
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} file
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
33
44
|
function mtime(file) {
|
|
34
45
|
return existsSync(file) ? statSync(file).mtimeMs : 0;
|
|
35
46
|
}
|
|
36
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {string} check
|
|
50
|
+
* @param {boolean} ok
|
|
51
|
+
* @param {string} detail
|
|
52
|
+
* @returns {{ check: string, ok: boolean, detail: string }}
|
|
53
|
+
*/
|
|
37
54
|
function line(check, ok, detail) {
|
|
38
55
|
return { check, ok, detail };
|
|
39
56
|
}
|
|
40
57
|
|
|
58
|
+
/** @param {RunState} state */
|
|
41
59
|
function processLines(state) {
|
|
42
60
|
const family = new Set([
|
|
43
61
|
...state.processes.map((record) => record.pid),
|
|
@@ -71,6 +89,10 @@ function processLines(state) {
|
|
|
71
89
|
});
|
|
72
90
|
}
|
|
73
91
|
|
|
92
|
+
/**
|
|
93
|
+
* @param {RunState} state
|
|
94
|
+
* @returns {string}
|
|
95
|
+
*/
|
|
74
96
|
function frontendBackendUrl(state) {
|
|
75
97
|
const frontend = state.processes.find((record) => record.name === "frontend");
|
|
76
98
|
if (!frontend) return "no frontend recorded";
|
|
@@ -88,8 +110,13 @@ function frontendBackendUrl(state) {
|
|
|
88
110
|
return args[args.indexOf("-b") + 1] ?? "no -b";
|
|
89
111
|
}
|
|
90
112
|
|
|
113
|
+
/** @param {RunState} state */
|
|
91
114
|
function versions(state) {
|
|
92
115
|
const require = createRequire(join(state.playground, "package.json"));
|
|
116
|
+
/**
|
|
117
|
+
* @param {string} name
|
|
118
|
+
* @returns {string}
|
|
119
|
+
*/
|
|
93
120
|
const version = (name) => {
|
|
94
121
|
try {
|
|
95
122
|
return packageVersion(require.resolve(`${name}/package.json`));
|
|
@@ -100,10 +127,13 @@ function versions(state) {
|
|
|
100
127
|
return {
|
|
101
128
|
module: `${packageVersion(join(state.moduleRoot, "package.json"))} (${state.moduleRoot})`,
|
|
102
129
|
core: version("@antelopejs/core"),
|
|
103
|
-
dmsFrontend:
|
|
130
|
+
dmsFrontend: state.renderer
|
|
131
|
+
? packageVersion(join(state.renderer, "package.json"))
|
|
132
|
+
: version("@antelopejs/dms-frontend"),
|
|
104
133
|
};
|
|
105
134
|
}
|
|
106
135
|
|
|
136
|
+
/** @param {RunState} state */
|
|
107
137
|
function freshnessLines(state) {
|
|
108
138
|
const moduleDist = join(state.moduleRoot, "dist");
|
|
109
139
|
const playgroundDist = join(state.playground, "dist");
|
|
@@ -116,7 +146,18 @@ function freshnessLines(state) {
|
|
|
116
146
|
newestMtime(join(state.moduleRoot, "frontend-vue")),
|
|
117
147
|
newestMtime(join(state.playground, "frontend-vue")),
|
|
118
148
|
);
|
|
149
|
+
const renderer = state.renderer
|
|
150
|
+
? [
|
|
151
|
+
line(
|
|
152
|
+
"renderer build newer than src",
|
|
153
|
+
newestMtime(join(state.renderer, "dist")) >=
|
|
154
|
+
newestMtime(join(state.renderer, "src")),
|
|
155
|
+
state.renderer,
|
|
156
|
+
),
|
|
157
|
+
]
|
|
158
|
+
: [];
|
|
119
159
|
return [
|
|
160
|
+
...renderer,
|
|
120
161
|
line(
|
|
121
162
|
"module dist newer than src",
|
|
122
163
|
!existsSync(join(state.moduleRoot, "src")) ||
|
|
@@ -138,8 +179,10 @@ function freshnessLines(state) {
|
|
|
138
179
|
];
|
|
139
180
|
}
|
|
140
181
|
|
|
182
|
+
/** @param {RunState} state */
|
|
141
183
|
function headLine(state) {
|
|
142
|
-
const
|
|
184
|
+
const verified = state.renderer ?? state.repo;
|
|
185
|
+
const now = verified ? checkoutOf(verified).head : null;
|
|
143
186
|
return line(
|
|
144
187
|
"checkout HEAD unchanged since up",
|
|
145
188
|
now === state.headSha,
|
|
@@ -147,6 +190,7 @@ function headLine(state) {
|
|
|
147
190
|
);
|
|
148
191
|
}
|
|
149
192
|
|
|
193
|
+
/** @param {RunState} state */
|
|
150
194
|
async function sessionLine(state) {
|
|
151
195
|
if (!state.accounts?.admin)
|
|
152
196
|
return line("admin session", true, "not onboarded yet");
|
|
@@ -158,7 +202,8 @@ async function sessionLine(state) {
|
|
|
158
202
|
});
|
|
159
203
|
return line(
|
|
160
204
|
"admin session valid",
|
|
161
|
-
me.status === 200 &&
|
|
205
|
+
me.status === 200 &&
|
|
206
|
+
stringField(me.body, "email") === state.accounts.admin.email,
|
|
162
207
|
`GET /api/auth/me ${me.status}`,
|
|
163
208
|
);
|
|
164
209
|
}
|
|
@@ -169,7 +214,7 @@ async function sessionLine(state) {
|
|
|
169
214
|
* backend, the builds are newer than their sources, the database is the
|
|
170
215
|
* run's own, and the admin session (once onboarded) is valid.
|
|
171
216
|
*
|
|
172
|
-
* @param {
|
|
217
|
+
* @param {import("./run-state.mjs").RunState} state The run
|
|
173
218
|
* @returns {Promise<{ check: string, ok: boolean, detail: string }[]>} One line per check
|
|
174
219
|
*/
|
|
175
220
|
export async function doctor(state) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a caught value says: the message of an `Error`, else the value as text.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} failure What was thrown or rejected
|
|
5
|
+
* @returns {string} The text
|
|
6
|
+
*/
|
|
7
|
+
export function describeFailure(failure) {
|
|
8
|
+
return failure instanceof Error ? failure.message : String(failure);
|
|
9
|
+
}
|