@antelopejs/dms 0.18.1 → 0.19.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 +78 -0
- package/README.md +2 -2
- package/bin/control/backend.mjs +1 -1
- package/bin/control/base.mjs +24 -9
- package/bin/control/base.test.mjs +88 -0
- package/bin/control/browser-client.mjs +1 -1
- package/bin/control/commands-stack.mjs +3 -1
- package/bin/control/commands-verify.mjs +5 -23
- package/bin/control/consumer-install.test.mjs +73 -0
- package/bin/control/database.mjs +66 -0
- package/bin/control/doctor.mjs +7 -0
- package/bin/control/frontend-check.mjs +2 -1
- package/bin/control/frontend-mode.test.mjs +24 -0
- package/bin/control/identity.mjs +45 -16
- package/bin/control/journey.mjs +31 -3
- package/bin/control/journey.test.mjs +207 -2
- package/bin/control/launch.mjs +123 -0
- package/bin/control/module-root.mjs +40 -0
- package/bin/control/module-root.test.mjs +67 -0
- package/bin/control/mongo-server.test.mjs +91 -0
- package/bin/control/mongo.mjs +125 -12
- package/bin/control/options.mjs +1 -0
- package/bin/control/pid-reuse.test.mjs +278 -0
- package/bin/control/processes.mjs +91 -29
- package/bin/control/renderer.test.mjs +1 -1
- package/bin/control/run-copy.mjs +6 -1
- package/bin/control/run-state.mjs +4 -1
- package/bin/control/stack.mjs +78 -165
- package/bin/control/verify/behaviour.test.mjs +36 -23
- package/bin/control/verify/decode.mjs +1 -15
- package/bin/control/verify/decode.test.mjs +1 -14
- package/bin/control/verify/emit.mjs +11 -11
- package/bin/control/verify/formal.mjs +28 -14
- package/bin/control/verify/formal.test.mjs +15 -0
- package/bin/control/verify/types.mjs +1 -1
- package/bin/control/verify/verdict.mjs +9 -42
- package/bin/dms-control.mjs +4 -3
- package/dist/db/models/userNotifications.model.js +14 -8
- package/dist/db/models/userNotifications.model.js.map +1 -1
- package/dist/pages/public/auth/not-a-member.d.ts +9 -0
- package/dist/pages/public/auth/not-a-member.js +27 -0
- package/dist/pages/public/auth/not-a-member.js.map +1 -0
- package/dist/pages/public/index.d.ts +1 -0
- package/dist/pages/public/index.js +1 -0
- package/dist/pages/public/index.js.map +1 -1
- package/dist/routes/auth/oauth/identity-resolution.js +10 -0
- package/dist/routes/auth/oauth/identity-resolution.js.map +1 -1
- package/dist/routes/onboarding.js +1 -5
- package/dist/routes/onboarding.js.map +1 -1
- package/dist/utils/ensure-default-tenant.js +23 -3
- package/dist/utils/ensure-default-tenant.js.map +1 -1
- package/frontend-vue/layers/dms-auth/app/build/utils/noWorkspaceRoute.ts +19 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +4 -6
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/not-a-member.vue +21 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/oauth-complete.vue +2 -4
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-en-GB.json +6 -0
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-fr-FR.json +6 -0
- package/frontend-vue/layers/dms-core/app/types/live.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +9 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +7 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +23 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +21 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/accessibilityPreferences.ts +1 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +8 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +35 -7
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +51 -8
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/utils/reducedMotion.ts +22 -0
- package/package.json +4 -4
- package/skills/dms-pages/REFERENCE.md +1 -1
- package/bin/control/verify/publish.mjs +0 -186
|
@@ -83,6 +83,7 @@ function holdLease(claimed, renewEveryMs) {
|
|
|
83
83
|
const timer = setInterval(() => {
|
|
84
84
|
renewal = renewal.then(renew);
|
|
85
85
|
}, renewEveryMs);
|
|
86
|
+
timer.unref();
|
|
86
87
|
return {
|
|
87
88
|
async stopRenewing() {
|
|
88
89
|
clearInterval(timer);
|
|
@@ -129,7 +130,7 @@ function createStaleWatch(staleAfterMs) {
|
|
|
129
130
|
},
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
|
-
async function advanceLease(watch, renewEveryMs) {
|
|
133
|
+
async function advanceLease(watch, renewEveryMs, signal) {
|
|
133
134
|
const tenant = await (0, interface_database_decorators_1.GetModel)(db_1.TenantModel).get(constants_1.DEFAULT_TENANT_ID);
|
|
134
135
|
if (!tenant?.provisioningPending)
|
|
135
136
|
return true;
|
|
@@ -139,7 +140,26 @@ async function advanceLease(watch, renewEveryMs) {
|
|
|
139
140
|
const claimed = await swapLease(tenant.provisioningRevision ?? NO_REVISION, {
|
|
140
141
|
provisioningHolder: holderName(),
|
|
141
142
|
});
|
|
142
|
-
|
|
143
|
+
if (claimed === undefined)
|
|
144
|
+
return false;
|
|
145
|
+
if (signal.aborted) {
|
|
146
|
+
await swapLease(claimed, { provisioningHolder: null });
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
return provisionUnderLease(claimed, renewEveryMs);
|
|
150
|
+
}
|
|
151
|
+
async function untilAborted(work, signal) {
|
|
152
|
+
let onAbort = () => undefined;
|
|
153
|
+
const aborted = new Promise((resolve) => {
|
|
154
|
+
onAbort = () => resolve(false);
|
|
155
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
156
|
+
});
|
|
157
|
+
try {
|
|
158
|
+
return await Promise.race([work, aborted]);
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
signal.removeEventListener("abort", onAbort);
|
|
162
|
+
}
|
|
143
163
|
}
|
|
144
164
|
function holderName() {
|
|
145
165
|
return `${(0, node_os_1.hostname)()}:${process.pid}`;
|
|
@@ -149,7 +169,7 @@ async function provisionDefaultTenant(signal = new AbortController().signal, lea
|
|
|
149
169
|
const watch = createStaleWatch(staleAfterMs);
|
|
150
170
|
while (!signal.aborted) {
|
|
151
171
|
try {
|
|
152
|
-
if (await advanceLease(watch, renewEveryMs))
|
|
172
|
+
if (await untilAborted(advanceLease(watch, renewEveryMs, signal), signal))
|
|
153
173
|
return;
|
|
154
174
|
}
|
|
155
175
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-default-tenant.js","sourceRoot":"","sources":["../../src/utils/ensure-default-tenant.ts"],"names":[],"mappings":";;AAuCA,8DAiBC;
|
|
1
|
+
{"version":3,"file":"ensure-default-tenant.js","sourceRoot":"","sources":["../../src/utils/ensure-default-tenant.ts"],"names":[],"mappings":";;AAuCA,8DAiBC;AAqMD,wDAmBC;AAhRD,6CAAyC;AACzC,qCAAmC;AACnC,mDAA2D;AAC3D,gEAA6D;AAC7D,6FAAqE;AACrE,mEAG6C;AAC7C,qDAAwE;AACxE,uFAAgF;AAChF,sCAGmB;AAKnB,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,SAAS,EAAW,CAAC;AAEjD,SAAS,kBAAkB;IACzB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,OAAO;QACL,GAAG,EAAE,6BAAiB;QACtB,IAAI,EAAE,+BAAmB;QACzB,mBAAmB,EAAE,IAAI;QACzB,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;KACf,CAAC;AACJ,CAAC;AASM,KAAK,UAAU,yBAAyB;IAC7C,MAAM,OAAO,GAAG,IAAA,wCAAQ,EAAC,gBAAW,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,6BAAiB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AAC;QACT,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,GAAG,IAAA,kBAAQ,GAAE,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AACxC,CAAC;AAoBM,KAAK,UAAU,sBAAsB,CAC1C,SAAsB,IAAI,eAAe,EAAE,CAAC,MAAM,EAClD,QAAiC,IAAA,mCAA0B,GAAE;IAE7D,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,KAAK,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,IAAI,MAAM,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;gBACvE,OAAO;QACX,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,MAAM,EAAE,CAAC;YACf,iBAAO,CAAC,IAAI,CACV,mBAAmB,6BAAiB,oCAAoC,EACxE,KAAK,CACN,CAAC;QACJ,CAAC;QACD,MAAM,IAAA,qBAAK,EAAC,WAAW,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACzE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hasDmsPage,
|
|
3
|
+
type LocationQueryRaw,
|
|
4
|
+
type RouteLocationRaw,
|
|
5
|
+
} from "#dms/frontend-module";
|
|
6
|
+
|
|
7
|
+
const NO_WORKSPACE_PATH = "/auth/no-workspace";
|
|
8
|
+
const NOT_A_MEMBER_PATH = "/auth/not-a-member";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Where a sign-in that found no workspace for the account goes: the page a
|
|
12
|
+
* module serves on `/auth/no-workspace`, handed the tenant assignment in
|
|
13
|
+
* `query`, or else the core screen, which needs no token.
|
|
14
|
+
*/
|
|
15
|
+
export function noWorkspaceRoute(query: LocationQueryRaw): RouteLocationRaw {
|
|
16
|
+
return hasDmsPage(NO_WORKSPACE_PATH)
|
|
17
|
+
? { path: NO_WORKSPACE_PATH, query }
|
|
18
|
+
: { path: NOT_A_MEMBER_PATH };
|
|
19
|
+
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
useLocalizedSchema,
|
|
17
17
|
} from "#dms-core/app/composables/useFormValidation";
|
|
18
18
|
import { ACCOUNTS_LIST_ROUTE } from "../../utils/accountsFlow";
|
|
19
|
+
import { noWorkspaceRoute } from "../../build/utils/noWorkspaceRoute";
|
|
19
20
|
import { isObject } from "#dms-core/app/utils/type-check";
|
|
20
21
|
|
|
21
22
|
const route = useDmsRoute();
|
|
@@ -71,12 +72,9 @@ async function handleTwoFactorRedirect(response: TwoFactorRequiredResponse) {
|
|
|
71
72
|
async function handleTenantAssignmentRedirect(
|
|
72
73
|
response: TenantAssignmentRequiredResponse,
|
|
73
74
|
) {
|
|
74
|
-
await navigateDms(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
token: response.tenant_assignment_token,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
75
|
+
await navigateDms(
|
|
76
|
+
noWorkspaceRoute({ token: response.tenant_assignment_token }),
|
|
77
|
+
);
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
async function onSubmit(payload: FormSubmitEvent<Schema>) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import StageCard from "#dms-layout/app/entries/components/layout/StageCard";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<StageCard
|
|
7
|
+
icon="i-ph-buildings"
|
|
8
|
+
tone="neutral"
|
|
9
|
+
:title="$t('page.no_workspace.title')"
|
|
10
|
+
:description="$t('page.no_workspace.description')"
|
|
11
|
+
>
|
|
12
|
+
<UButton
|
|
13
|
+
:label="$t('page.no_workspace.back_to_sign_in')"
|
|
14
|
+
leading-icon="i-ph-arrow-left"
|
|
15
|
+
to="/auth"
|
|
16
|
+
size="lg"
|
|
17
|
+
class="mt-[22px] justify-center"
|
|
18
|
+
block
|
|
19
|
+
/>
|
|
20
|
+
</StageCard>
|
|
21
|
+
</template>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { type OAuthHandoff, sanitizeRedirectPath } from "../../../shared/oauth";
|
|
3
|
+
import { noWorkspaceRoute } from "../../build/utils/noWorkspaceRoute";
|
|
3
4
|
|
|
4
5
|
const OAUTH_FAILED_KEY = "error.oauth.failed";
|
|
5
6
|
const IN_FLIGHT_COMPLETION_KEY = "__dmsInFlightOAuthCompletion";
|
|
@@ -35,10 +36,7 @@ const HANDOFF_ACTIONS: HandoffActions = {
|
|
|
35
36
|
),
|
|
36
37
|
"no-workspace": (handoff) =>
|
|
37
38
|
navigateDms(
|
|
38
|
-
{
|
|
39
|
-
path: "/auth/no-workspace",
|
|
40
|
-
query: { token: handoff.token, provider: handoff.provider },
|
|
41
|
-
},
|
|
39
|
+
noWorkspaceRoute({ token: handoff.token, provider: handoff.provider }),
|
|
42
40
|
REPLACE,
|
|
43
41
|
),
|
|
44
42
|
none: () => usePostLoginRedirect(redirect.value, REPLACE),
|
|
@@ -97,6 +97,11 @@
|
|
|
97
97
|
"account_removed": "Account removed",
|
|
98
98
|
"remove_account": "Remove {name} from this list"
|
|
99
99
|
},
|
|
100
|
+
"no_workspace": {
|
|
101
|
+
"title": "No workspace for this account",
|
|
102
|
+
"description": "You signed in, but your account is not a member of any workspace. Ask a workspace owner to invite you, then sign in again.",
|
|
103
|
+
"back_to_sign_in": "Back to sign in"
|
|
104
|
+
},
|
|
100
105
|
"settings": {
|
|
101
106
|
"sessions": {
|
|
102
107
|
"title": "Sessions",
|
|
@@ -445,6 +450,7 @@
|
|
|
445
450
|
"linking_disabled": "An account already exists with this e-mail address. Sign in with your password.",
|
|
446
451
|
"account_not_validated": "An account already exists with this e-mail address but is not validated. Validate it before linking this provider.",
|
|
447
452
|
"registration_disabled": "No account matches this identity and provider sign-up is disabled.",
|
|
453
|
+
"platform_not_onboarded": "Sign-up opens once the platform administrator has finished setting up this instance.",
|
|
448
454
|
"identity_already_linked": "This provider account is already linked to another user.",
|
|
449
455
|
"user_not_created": "Account creation failed.",
|
|
450
456
|
"jwt_secret_missing": "Provider sign-in is not configured on this instance.",
|
|
@@ -97,6 +97,11 @@
|
|
|
97
97
|
"account_removed": "Compte supprimé",
|
|
98
98
|
"remove_account": "Retirer {name} de cette liste"
|
|
99
99
|
},
|
|
100
|
+
"no_workspace": {
|
|
101
|
+
"title": "Aucun espace de travail pour ce compte",
|
|
102
|
+
"description": "Vous êtes connecté, mais votre compte n'est membre d'aucun espace de travail. Demandez au propriétaire d'un espace de travail de vous inviter, puis reconnectez-vous.",
|
|
103
|
+
"back_to_sign_in": "Retour à la connexion"
|
|
104
|
+
},
|
|
100
105
|
"settings": {
|
|
101
106
|
"sessions": {
|
|
102
107
|
"title": "Sessions",
|
|
@@ -445,6 +450,7 @@
|
|
|
445
450
|
"linking_disabled": "Un compte existe déjà avec cette adresse e-mail. Connectez-vous avec votre mot de passe.",
|
|
446
451
|
"account_not_validated": "Un compte existe déjà avec cette adresse e-mail mais n'est pas validé. Validez-le avant de lier ce fournisseur.",
|
|
447
452
|
"registration_disabled": "Aucun compte n'est associé à cette identité et l'inscription par fournisseur est désactivée.",
|
|
453
|
+
"platform_not_onboarded": "L'inscription ouvrira quand l'administrateur de la plateforme aura terminé la configuration de cette instance.",
|
|
448
454
|
"identity_already_linked": "Ce compte fournisseur est déjà lié à un autre utilisateur.",
|
|
449
455
|
"user_not_created": "La création du compte a échoué.",
|
|
450
456
|
"jwt_secret_missing": "La connexion par fournisseur n'est pas configurée sur cette instance.",
|
|
@@ -49,6 +49,8 @@ export type PageLiveNoteInput = string | PageLiveNote;
|
|
|
49
49
|
* holds its rows while its page is live.
|
|
50
50
|
*/
|
|
51
51
|
export interface TableViewLiveHoldOptions {
|
|
52
|
+
/** While its rows are on screen or scrolled past. Defaults to true. */
|
|
53
|
+
whileOnScreen?: boolean;
|
|
52
54
|
/** While one of its rows is open in the side panel. */
|
|
53
55
|
whileRowOpen?: boolean;
|
|
54
56
|
/** While the user has scrolled its first row out of view. */
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getCurrentInstance,
|
|
4
|
+
toRaw,
|
|
5
|
+
type AppContext,
|
|
6
|
+
type Component,
|
|
7
|
+
} from "vue";
|
|
3
8
|
import {
|
|
4
9
|
formBusInjectionKey,
|
|
5
10
|
formErrorsInjectionKey,
|
|
@@ -60,7 +65,8 @@ interface DynamicDrawerProps {
|
|
|
60
65
|
color?: ContainerColor;
|
|
61
66
|
/**
|
|
62
67
|
* What the component that opened the drawer provides (`useDrawer` passes
|
|
63
|
-
* it): the drawer and its body inject it as if rendered in its tree
|
|
68
|
+
* it): the drawer and its body inject it as if rendered in its tree, the
|
|
69
|
+
* values as provided, not the reactive wrappers the overlay passes.
|
|
64
70
|
*/
|
|
65
71
|
callerProvides?: object;
|
|
66
72
|
}
|
|
@@ -98,7 +104,7 @@ const drawerInstance = getCurrentInstance() as {
|
|
|
98
104
|
provides: AppContext["provides"];
|
|
99
105
|
} | null;
|
|
100
106
|
if (drawerInstance && props.callerProvides) {
|
|
101
|
-
drawerInstance.provides = Object.create(props.callerProvides);
|
|
107
|
+
drawerInstance.provides = Object.create(toRaw(props.callerProvides));
|
|
102
108
|
|
|
103
109
|
for (const key of NUXT_UI_FORM_KEYS) provide(key, undefined);
|
|
104
110
|
}
|
|
@@ -72,6 +72,8 @@ export interface LiveGate {
|
|
|
72
72
|
lastReadAt: ComputedRef<number>;
|
|
73
73
|
/** Refetches now and forgets what was missed. */
|
|
74
74
|
catchUp(): void;
|
|
75
|
+
/** The block may be stale with no event for it (see LiveSubscription). */
|
|
76
|
+
owe(): void;
|
|
75
77
|
/** Records a read the caller makes itself (see LiveSubscription). */
|
|
76
78
|
acknowledge(): void;
|
|
77
79
|
/**
|
|
@@ -138,6 +140,11 @@ export function useLiveGate(refresh: () => void): LiveGate {
|
|
|
138
140
|
if (subscription) subscription.catchUp();
|
|
139
141
|
else refreshUngated();
|
|
140
142
|
},
|
|
143
|
+
owe: () => {
|
|
144
|
+
const subscription = resolve();
|
|
145
|
+
if (subscription) subscription.owe();
|
|
146
|
+
else refreshUngated();
|
|
147
|
+
},
|
|
141
148
|
acknowledge: () => resolve()?.acknowledge(),
|
|
142
149
|
setHeld: (isHeld) => resolve()?.setHeld(isHeld),
|
|
143
150
|
};
|
|
@@ -47,6 +47,12 @@ export interface LiveSubscription {
|
|
|
47
47
|
readonly lastReadAt: Readonly<Ref<number>>;
|
|
48
48
|
/** Reads now, whatever the state, and forgets what was missed. */
|
|
49
49
|
catchUp(): void;
|
|
50
|
+
/**
|
|
51
|
+
* The block may be stale with no event to show for it: reads as soon as it
|
|
52
|
+
* may, now on a live page, else once paused or held ends, and counts
|
|
53
|
+
* nothing missed.
|
|
54
|
+
*/
|
|
55
|
+
owe(): void;
|
|
50
56
|
/**
|
|
51
57
|
* Records a read the block made by itself (one the user asked for): it
|
|
52
58
|
* forgets what was missed, and a waiting trailing read is dropped.
|
|
@@ -54,7 +60,7 @@ export interface LiveSubscription {
|
|
|
54
60
|
acknowledge(): void;
|
|
55
61
|
/**
|
|
56
62
|
* Holds the block alone while the page stays live: its events are counted,
|
|
57
|
-
* not read. Released on a live page, it reads once if it missed any.
|
|
63
|
+
* not read. Released on a live page, it reads once if it missed any or owes a read.
|
|
58
64
|
*/
|
|
59
65
|
setHeld(isHeld: boolean): void;
|
|
60
66
|
unsubscribe(): void;
|
|
@@ -120,6 +126,8 @@ interface SubscriberState {
|
|
|
120
126
|
/** The events the trailing call stands for, counted if the page pauses first. */
|
|
121
127
|
pendingEvents: Array<object | undefined>;
|
|
122
128
|
isHeld: boolean;
|
|
129
|
+
/** A read is owed that no missed event stands for (see `owe`). */
|
|
130
|
+
isOwed: boolean;
|
|
123
131
|
}
|
|
124
132
|
|
|
125
133
|
class PageLive implements PageLiveController {
|
|
@@ -230,6 +238,7 @@ class PageLive implements PageLiveController {
|
|
|
230
238
|
timer: null,
|
|
231
239
|
pendingEvents: [],
|
|
232
240
|
isHeld: false,
|
|
241
|
+
isOwed: false,
|
|
233
242
|
};
|
|
234
243
|
this.subscribers.add(state);
|
|
235
244
|
return {
|
|
@@ -237,6 +246,7 @@ class PageLive implements PageLiveController {
|
|
|
237
246
|
missed: state.tally.total,
|
|
238
247
|
lastReadAt: readonly(state.lastRunAt),
|
|
239
248
|
catchUp: () => this.catchUp(state),
|
|
249
|
+
owe: () => this.owe(state),
|
|
240
250
|
acknowledge: () => {
|
|
241
251
|
state.tally.reset();
|
|
242
252
|
this.markRead(state);
|
|
@@ -283,7 +293,7 @@ class PageLive implements PageLiveController {
|
|
|
283
293
|
this.detail.value = null;
|
|
284
294
|
this.updatedAt.value = Date.now();
|
|
285
295
|
for (const state of this.subscribers) {
|
|
286
|
-
if (state.isHeld || state
|
|
296
|
+
if (state.isHeld || !isBehind(state)) continue;
|
|
287
297
|
this.catchUp(state);
|
|
288
298
|
}
|
|
289
299
|
}
|
|
@@ -304,7 +314,7 @@ class PageLive implements PageLiveController {
|
|
|
304
314
|
if (state.isHeld === isHeld) return;
|
|
305
315
|
state.isHeld = isHeld;
|
|
306
316
|
if (isHeld) this.flushPending(state, false);
|
|
307
|
-
else if (!this.paused.value && state
|
|
317
|
+
else if (!this.paused.value && isBehind(state)) {
|
|
308
318
|
this.catchUp(state);
|
|
309
319
|
}
|
|
310
320
|
}
|
|
@@ -318,6 +328,11 @@ class PageLive implements PageLiveController {
|
|
|
318
328
|
else this.triggerDirect(state, event);
|
|
319
329
|
}
|
|
320
330
|
|
|
331
|
+
private owe(state: SubscriberState): void {
|
|
332
|
+
if (this.paused.value || state.isHeld || state.timer) state.isOwed = true;
|
|
333
|
+
else this.run(state);
|
|
334
|
+
}
|
|
335
|
+
|
|
321
336
|
private triggerDirect(
|
|
322
337
|
state: SubscriberState,
|
|
323
338
|
event: Parameters<LiveSubscription["trigger"]>[0],
|
|
@@ -354,6 +369,7 @@ class PageLive implements PageLiveController {
|
|
|
354
369
|
|
|
355
370
|
private markRead(state: SubscriberState): void {
|
|
356
371
|
clearTimer(state);
|
|
372
|
+
state.isOwed = false;
|
|
357
373
|
state.lastRunAt.value = Date.now();
|
|
358
374
|
this.updatedAt.value = state.lastRunAt.value;
|
|
359
375
|
}
|
|
@@ -368,6 +384,10 @@ class PageLive implements PageLiveController {
|
|
|
368
384
|
}
|
|
369
385
|
}
|
|
370
386
|
|
|
387
|
+
function isBehind(state: SubscriberState): boolean {
|
|
388
|
+
return state.isOwed || state.tally.total.value > 0;
|
|
389
|
+
}
|
|
390
|
+
|
|
371
391
|
function clearTimer(state: SubscriberState): void {
|
|
372
392
|
if (state.timer) clearTimeout(state.timer);
|
|
373
393
|
state.timer = null;
|
|
@@ -44,9 +44,10 @@ export function usePageDataRefresh(source: PageDataRefreshSource): void {
|
|
|
44
44
|
};
|
|
45
45
|
watch(
|
|
46
46
|
source.pageTopics,
|
|
47
|
-
(topics) => {
|
|
47
|
+
(topics, previous) => {
|
|
48
48
|
unsubscribeAll();
|
|
49
49
|
unsubscribes = topics.map((topic) => source.subscribe(topic, onEvent));
|
|
50
|
+
if (previous && topics.length > 0) gate.owe();
|
|
50
51
|
},
|
|
51
52
|
{ immediate: true },
|
|
52
53
|
);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { usePageLive } from "../../../composables/live/usePageLive";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
useUserRealtime,
|
|
4
|
+
type RealtimeTopicHandler,
|
|
5
|
+
} from "#dms-core/app/composables/realtime/useUserRealtime";
|
|
3
6
|
import type { RealtimePresenceMap } from "./tableViewTypes";
|
|
4
7
|
import type { TableViewScope } from "./tableViewScope";
|
|
5
8
|
|
|
@@ -51,13 +54,19 @@ export function useTableViewRowRealtime<T extends Data>(
|
|
|
51
54
|
data.value = { ...data.value, results: next };
|
|
52
55
|
};
|
|
53
56
|
|
|
57
|
+
let rowReadCount = 0;
|
|
58
|
+
const appliedRowReads = new Map<string, number>();
|
|
59
|
+
|
|
54
60
|
const patchRowLocal = async (id: string) => {
|
|
55
61
|
if (!data.value?.results) return;
|
|
56
62
|
const idx = data.value.results.findIndex((row) => getRowId(row) === id);
|
|
57
63
|
if (idx === -1) return;
|
|
64
|
+
rowReadCount += 1;
|
|
65
|
+
const read = rowReadCount;
|
|
58
66
|
try {
|
|
59
67
|
const fresh = await tableRows.getRow(id);
|
|
60
|
-
if (!fresh) return;
|
|
68
|
+
if (!fresh || read < (appliedRowReads.get(id) ?? 0)) return;
|
|
69
|
+
appliedRowReads.set(id, read);
|
|
61
70
|
const next = [...data.value.results];
|
|
62
71
|
next[idx] = fresh;
|
|
63
72
|
data.value = { ...data.value, results: next };
|
|
@@ -81,6 +90,7 @@ export function useTableViewRowEvents<T extends Data>(
|
|
|
81
90
|
scope: Pick<
|
|
82
91
|
TableViewScope<T>,
|
|
83
92
|
| "configuration"
|
|
93
|
+
| "listState"
|
|
84
94
|
| "rowRealtime"
|
|
85
95
|
| "rowCommands"
|
|
86
96
|
| "refresh"
|
|
@@ -89,6 +99,7 @@ export function useTableViewRowEvents<T extends Data>(
|
|
|
89
99
|
>,
|
|
90
100
|
) {
|
|
91
101
|
const { REALTIME_EVENT_TYPE } = scope.configuration;
|
|
102
|
+
const { isListLoading } = scope.listState;
|
|
92
103
|
const { removeRowsLocal, patchRowLocal, realtimeRowTopic } =
|
|
93
104
|
scope.rowRealtime;
|
|
94
105
|
const { deselectRows } = scope.rowCommands;
|
|
@@ -115,6 +126,10 @@ export function useTableViewRowEvents<T extends Data>(
|
|
|
115
126
|
]);
|
|
116
127
|
return;
|
|
117
128
|
}
|
|
129
|
+
if (isListLoading.value) {
|
|
130
|
+
await refreshAll();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
118
133
|
await Promise.all([
|
|
119
134
|
...ids.map((id) => patchRowLocal(id)),
|
|
120
135
|
refreshCounts(),
|
|
@@ -148,5 +163,9 @@ export function useTableViewRowEvents<T extends Data>(
|
|
|
148
163
|
}
|
|
149
164
|
void handler(ids);
|
|
150
165
|
});
|
|
166
|
+
|
|
167
|
+
watch(useUserRealtime().pageTopics, (topics) => {
|
|
168
|
+
if (realtimeRowTopic.value && topics.length > 0) liveGate.owe();
|
|
169
|
+
});
|
|
151
170
|
return {};
|
|
152
171
|
}
|
|
@@ -124,14 +124,15 @@ function useLocalHold(
|
|
|
124
124
|
const target = tableElement();
|
|
125
125
|
return target instanceof HTMLElement ? target : null;
|
|
126
126
|
};
|
|
127
|
+
const holdsOnScreen = !!holdOptions && holdOptions.whileOnScreen !== false;
|
|
127
128
|
const isScrolled = useScrolledPastTop(element, !!holdOptions?.whileScrolled);
|
|
128
|
-
const isReached = useTableReached(element,
|
|
129
|
+
const isReached = useTableReached(element, holdsOnScreen);
|
|
129
130
|
const reasons: Array<[LocalHoldReason, boolean, () => boolean]> = [
|
|
130
131
|
["rowOpen", !!holdOptions?.whileRowOpen, signals.isRowOpen ?? NEVER],
|
|
131
132
|
["searching", !!holdOptions?.whileSearching, signals.isSearching ?? NEVER],
|
|
132
133
|
["sorted", !!holdOptions?.whileSorted, signals.isSorted ?? NEVER],
|
|
133
134
|
["scrolled", !!holdOptions?.whileScrolled, () => isScrolled.value],
|
|
134
|
-
["reading",
|
|
135
|
+
["reading", holdsOnScreen, () => isReached.value],
|
|
135
136
|
];
|
|
136
137
|
return computed(
|
|
137
138
|
() =>
|
|
@@ -143,7 +144,7 @@ function useLocalHold(
|
|
|
143
144
|
/**
|
|
144
145
|
* The `liveHold` of a table view: while its live page is paused, while its
|
|
145
146
|
* rows are on screen or scrolled past (rows landing at the top would move
|
|
146
|
-
* them) — or, with `whileRowOpen` / `whileSearching` / `whileSorted` /
|
|
147
|
+
* them; not with `whileOnScreen: false`) — or, with `whileRowOpen` / `whileSearching` / `whileSorted` /
|
|
147
148
|
* `whileScrolled`, saying so, while the user reads a row, searches, sorts or
|
|
148
149
|
* scrolled down — the table keeps its rows: the gate requests nothing on its events and counts them, and a
|
|
149
150
|
* source route is told the moment they were frozen, so the user's own
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* `auto` follows the operating system's `prefers-reduced-motion`; `on` and
|
|
4
4
|
* `off` pin the choice whatever the system says.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
isObject,
|
|
8
|
-
isString,
|
|
9
|
-
isFunction,
|
|
10
|
-
} from "../../../../dms-core/app/utils/type-check";
|
|
6
|
+
import { isObject, isString } from "../../../../dms-core/app/utils/type-check";
|
|
11
7
|
export type ReduceMotionPreference = "auto" | "on" | "off";
|
|
12
8
|
|
|
13
9
|
export interface AccessibilityPreferences {
|
|
@@ -124,19 +120,3 @@ export function reduceMotionFromClasses(
|
|
|
124
120
|
if (classList.contains(ACCESSIBILITY_HTML_CLASSES.fullMotion)) return "off";
|
|
125
121
|
return "auto";
|
|
126
122
|
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Whether the page should skip JavaScript-driven motion right now: the
|
|
130
|
-
* `<html>` class when the user pinned a choice, the system otherwise. Always
|
|
131
|
-
* false on the server, which renders no animation.
|
|
132
|
-
*/
|
|
133
|
-
export function isReducedMotionActive(): boolean {
|
|
134
|
-
const classList = globalThis.document?.documentElement?.classList;
|
|
135
|
-
if (!classList) return false;
|
|
136
|
-
const systemPrefersReduced =
|
|
137
|
-
isFunction(matchMedia) && matchMedia(REDUCED_MOTION_QUERY).matches;
|
|
138
|
-
return resolveReducedMotion(
|
|
139
|
-
reduceMotionFromClasses(classList),
|
|
140
|
-
systemPrefersReduced,
|
|
141
|
-
);
|
|
142
|
-
}
|
|
@@ -369,14 +369,18 @@ function readsRouteSource(options: Record<string, unknown>): boolean {
|
|
|
369
369
|
return isRecord(source) && isString(source.fetchUrl);
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
/**
|
|
373
|
-
|
|
372
|
+
/**
|
|
373
|
+
* Whether a resource form was serialized with its fields and the URL of the
|
|
374
|
+
* record it reads, and saves nowhere: drawn like a `Form`, its `fetchUrl`
|
|
375
|
+
* checked by {@link OPTION_RULES} like any other block's URL.
|
|
376
|
+
*/
|
|
377
|
+
function readsSerializedForm(
|
|
374
378
|
blockType: PreviewBlockType,
|
|
375
379
|
options: Record<string, unknown>,
|
|
376
380
|
): boolean {
|
|
377
381
|
return (
|
|
378
382
|
blockType.componentName === "dms-form" &&
|
|
379
|
-
options.fetchUrl
|
|
383
|
+
isString(options.fetchUrl) &&
|
|
380
384
|
Array.isArray(options.fields) &&
|
|
381
385
|
!options.submitUrl
|
|
382
386
|
);
|
|
@@ -396,7 +400,7 @@ function issueFor(
|
|
|
396
400
|
if (
|
|
397
401
|
match.blockType.needsController &&
|
|
398
402
|
!readsRouteSource(options) &&
|
|
399
|
-
!
|
|
403
|
+
!readsSerializedForm(match.blockType, options)
|
|
400
404
|
) {
|
|
401
405
|
return { key: "needs_backend", name: match.name };
|
|
402
406
|
}
|
|
@@ -16,17 +16,45 @@ export const EXTERNAL_LINK_ATTRIBUTES = {
|
|
|
16
16
|
rel: "noopener noreferrer",
|
|
17
17
|
} as const;
|
|
18
18
|
|
|
19
|
+
function pathOnThisSite(to: string): string {
|
|
20
|
+
const url = new URL(to, window.location.href);
|
|
21
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isPlainClick(event: MouseEvent): boolean {
|
|
25
|
+
return !(
|
|
26
|
+
event.defaultPrevented ||
|
|
27
|
+
event.button !== 0 ||
|
|
28
|
+
event.altKey ||
|
|
29
|
+
event.ctrlKey ||
|
|
30
|
+
event.metaKey ||
|
|
31
|
+
event.shiftKey
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
/**
|
|
20
36
|
* Props for a `UButton` (or `ULink`) following `to`, its page tokens
|
|
21
37
|
* (`{{params.X}}`, `{{query.X}}`) filled: an external target opens in a new
|
|
22
|
-
* tab, the others navigate in place.
|
|
38
|
+
* tab, the others navigate in place. A DMS route keeps its `href` for a new
|
|
39
|
+
* tab, but a plain click goes through `navigateDms`, read against the page
|
|
40
|
+
* on screen, so a link that changes only the query (`?status=pending` or a
|
|
41
|
+
* full path) stays in the browser: Nuxt UI's Inertia link, which
|
|
42
|
+
* `external` turns off, would ask the server for the page.
|
|
23
43
|
*/
|
|
24
|
-
export function buttonLinkProps(
|
|
25
|
-
declared: string | undefined,
|
|
26
|
-
): Record<string, string> {
|
|
44
|
+
export function buttonLinkProps(declared: string | undefined) {
|
|
27
45
|
const to = pageLink(declared);
|
|
28
46
|
if (!to) return {};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
const kind = linkKind(to);
|
|
48
|
+
if (kind === "external") return { to, ...EXTERNAL_LINK_ATTRIBUTES };
|
|
49
|
+
if (kind === "anchor") return { to };
|
|
50
|
+
return {
|
|
51
|
+
to,
|
|
52
|
+
external: true,
|
|
53
|
+
noRel: true,
|
|
54
|
+
onClick: (event: MouseEvent) => {
|
|
55
|
+
if (!isPlainClick(event)) return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
void navigateDms(pathOnThisSite(to));
|
|
58
|
+
},
|
|
59
|
+
};
|
|
32
60
|
}
|