@ketvietlab/ketsuite 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +3 -0
- package/dist/deployment.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/account_staff_channel/channel-routes.d.ts.map +1 -1
- package/dist/modules/account_staff_channel/channel-routes.js +1 -12
- package/dist/modules/account_staff_channel/channel-routes.js.map +1 -1
- package/dist/modules/attendance/channel-routes.d.ts.map +1 -1
- package/dist/modules/attendance/channel-routes.js +1 -12
- package/dist/modules/attendance/channel-routes.js.map +1 -1
- package/dist/modules/backend/design/client/table-selection.d.mts +3 -3
- package/dist/modules/backend/design/client/table-selection.d.mts.map +1 -1
- package/dist/modules/backend/design/client/table-selection.mjs +1 -1
- package/dist/modules/backend/design/client/table-selection.mjs.map +3 -3
- package/dist/modules/backend/design/content.css +43 -0
- package/dist/modules/backend/design/forms.css +22 -0
- package/dist/modules/backend/design/responsive.css +0 -5
- package/dist/modules/backend/forms.d.ts +38 -1
- package/dist/modules/backend/forms.d.ts.map +1 -1
- package/dist/modules/backend/forms.js +29 -0
- package/dist/modules/backend/forms.js.map +1 -1
- package/dist/modules/backend/index.d.ts +3 -2
- package/dist/modules/backend/index.d.ts.map +1 -1
- package/dist/modules/backend/index.js +2 -2
- package/dist/modules/backend/index.js.map +1 -1
- package/dist/modules/backend/messages.d.ts.map +1 -1
- package/dist/modules/backend/messages.js +40 -2
- package/dist/modules/backend/messages.js.map +1 -1
- package/dist/modules/channel_api/core.d.ts +30 -0
- package/dist/modules/channel_api/core.d.ts.map +1 -1
- package/dist/modules/channel_api/core.js +28 -0
- package/dist/modules/channel_api/core.js.map +1 -1
- package/dist/modules/crm_staff_channel/channel-routes.d.ts.map +1 -1
- package/dist/modules/crm_staff_channel/channel-routes.js +1 -12
- package/dist/modules/crm_staff_channel/channel-routes.js.map +1 -1
- package/dist/modules/flow/membership.d.ts.map +1 -1
- package/dist/modules/flow/membership.js +7 -1
- package/dist/modules/flow/membership.js.map +1 -1
- package/dist/modules/flow/operations.d.ts +10 -4
- package/dist/modules/flow/operations.d.ts.map +1 -1
- package/dist/modules/flow/operations.js +10 -4
- package/dist/modules/flow/operations.js.map +1 -1
- package/dist/modules/flow_staff_channel/channel-routes.d.ts.map +1 -1
- package/dist/modules/flow_staff_channel/channel-routes.js +1 -20
- package/dist/modules/flow_staff_channel/channel-routes.js.map +1 -1
- package/dist/modules/hospitality_core/messages.d.ts.map +1 -1
- package/dist/modules/hospitality_core/messages.js +44 -0
- package/dist/modules/hospitality_core/messages.js.map +1 -1
- package/dist/modules/hospitality_core/night-audit.d.ts.map +1 -1
- package/dist/modules/hospitality_core/night-audit.js +7 -0
- package/dist/modules/hospitality_core/night-audit.js.map +1 -1
- package/dist/modules/hospitality_core/operations.d.ts.map +1 -1
- package/dist/modules/hospitality_core/operations.js +150 -40
- package/dist/modules/hospitality_core/operations.js.map +1 -1
- package/dist/modules/hospitality_core/routes.d.ts.map +1 -1
- package/dist/modules/hospitality_core/routes.js +24 -2
- package/dist/modules/hospitality_core/routes.js.map +1 -1
- package/dist/modules/hospitality_core/screens/check-out-prep.d.ts +46 -0
- package/dist/modules/hospitality_core/screens/check-out-prep.d.ts.map +1 -0
- package/dist/modules/hospitality_core/screens/check-out-prep.js +133 -0
- package/dist/modules/hospitality_core/screens/check-out-prep.js.map +1 -0
- package/dist/modules/hospitality_core/screens/folio-detail.d.ts.map +1 -1
- package/dist/modules/hospitality_core/screens/folio-detail.js +2 -4
- package/dist/modules/hospitality_core/screens/folio-detail.js.map +1 -1
- package/dist/modules/hospitality_core/screens/index.d.ts +2 -0
- package/dist/modules/hospitality_core/screens/index.d.ts.map +1 -1
- package/dist/modules/hospitality_core/screens/index.js +1 -0
- package/dist/modules/hospitality_core/screens/index.js.map +1 -1
- package/dist/modules/hospitality_core/screens/reservation-detail.d.ts.map +1 -1
- package/dist/modules/hospitality_core/screens/reservation-detail.js +8 -1
- package/dist/modules/hospitality_core/screens/reservation-detail.js.map +1 -1
- package/dist/modules/hospitality_core/screens/shared.d.ts +12 -0
- package/dist/modules/hospitality_core/screens/shared.d.ts.map +1 -1
- package/dist/modules/hospitality_core/screens/shared.js +25 -4
- package/dist/modules/hospitality_core/screens/shared.js.map +1 -1
- package/dist/modules/hospitality_core/services.d.ts +48 -0
- package/dist/modules/hospitality_core/services.d.ts.map +1 -1
- package/dist/modules/hospitality_core/services.js +70 -0
- package/dist/modules/hospitality_core/services.js.map +1 -1
- package/dist/modules/hospitality_staff_channel/channel-routes.d.ts.map +1 -1
- package/dist/modules/hospitality_staff_channel/channel-routes.js +1 -12
- package/dist/modules/hospitality_staff_channel/channel-routes.js.map +1 -1
- package/dist/modules/inventory_staff_channel/channel-routes.d.ts.map +1 -1
- package/dist/modules/inventory_staff_channel/channel-routes.js +1 -12
- package/dist/modules/inventory_staff_channel/channel-routes.js.map +1 -1
- package/dist/modules/purchase_staff_channel/order-routes.d.ts.map +1 -1
- package/dist/modules/purchase_staff_channel/order-routes.js +1 -12
- package/dist/modules/purchase_staff_channel/order-routes.js.map +1 -1
- package/dist/modules/quality_staff_channel/channel-routes.d.ts.map +1 -1
- package/dist/modules/quality_staff_channel/channel-routes.js +1 -12
- package/dist/modules/quality_staff_channel/channel-routes.js.map +1 -1
- package/dist/modules/sale/functions.d.ts.map +1 -1
- package/dist/modules/sale/functions.js +27 -17
- package/dist/modules/sale/functions.js.map +1 -1
- package/dist/modules/sale_staff_channel/channel-routes.d.ts.map +1 -1
- package/dist/modules/sale_staff_channel/channel-routes.js +1 -12
- package/dist/modules/sale_staff_channel/channel-routes.js.map +1 -1
- package/dist/modules/sale_staff_channel/order-routes.d.ts.map +1 -1
- package/dist/modules/sale_staff_channel/order-routes.js +1 -12
- package/dist/modules/sale_staff_channel/order-routes.js.map +1 -1
- package/dist/modules/stock_staff_channel/operation-routes.d.ts.map +1 -1
- package/dist/modules/stock_staff_channel/operation-routes.js +1 -12
- package/dist/modules/stock_staff_channel/operation-routes.js.map +1 -1
- package/dist/modules/user_backend/messages.d.ts +4 -0
- package/dist/modules/user_backend/messages.d.ts.map +1 -1
- package/dist/modules/user_backend/messages.js +4 -0
- package/dist/modules/user_backend/messages.js.map +1 -1
- package/dist/modules/user_backend/routes.d.ts.map +1 -1
- package/dist/modules/user_backend/routes.js +28 -1
- package/dist/modules/user_backend/routes.js.map +1 -1
- package/dist/modules/user_backend/screens/user-form.d.ts +1 -0
- package/dist/modules/user_backend/screens/user-form.d.ts.map +1 -1
- package/dist/modules/user_backend/screens/user-form.js +28 -0
- package/dist/modules/user_backend/screens/user-form.js.map +1 -1
- package/dist/modules/website/cms.d.ts.map +1 -1
- package/dist/modules/website/cms.js +283 -6
- package/dist/modules/website/cms.js.map +1 -1
- package/dist/modules/website/index.d.ts.map +1 -1
- package/dist/modules/website/index.js +12 -0
- package/dist/modules/website/index.js.map +1 -1
- package/dist/modules/website/media-usage.d.ts +38 -0
- package/dist/modules/website/media-usage.d.ts.map +1 -0
- package/dist/modules/website/media-usage.js +87 -0
- package/dist/modules/website/media-usage.js.map +1 -0
- package/dist/modules/website/paths.js +1 -1
- package/dist/modules/website/paths.js.map +1 -1
- package/dist/modules/website/sections.d.ts.map +1 -1
- package/dist/modules/website/sections.js +12 -1
- package/dist/modules/website/sections.js.map +1 -1
- package/dist/modules/website_backend/index.js +138 -0
- package/dist/modules/website_backend/index.js.map +1 -1
- package/dist/modules/website_backend/menus.d.ts.map +1 -1
- package/dist/modules/website_backend/menus.js +11 -0
- package/dist/modules/website_backend/menus.js.map +1 -1
- package/dist/modules/website_backend/routes.d.ts.map +1 -1
- package/dist/modules/website_backend/routes.js +414 -31
- package/dist/modules/website_backend/routes.js.map +1 -1
- package/dist/modules/website_backend/screens/index.d.ts +98 -6
- package/dist/modules/website_backend/screens/index.d.ts.map +1 -1
- package/dist/modules/website_backend/screens/index.js +600 -154
- package/dist/modules/website_backend/screens/index.js.map +1 -1
- package/dist/modules/website_backend/screens/page-frame.d.ts +3 -1
- package/dist/modules/website_backend/screens/page-frame.d.ts.map +1 -1
- package/dist/modules/website_backend/screens/page-frame.js +1 -1
- package/dist/modules/website_backend/screens/page-frame.js.map +1 -1
- package/dist/modules/website_menu/functions.d.ts.map +1 -1
- package/dist/modules/website_menu/functions.js +51 -0
- package/dist/modules/website_menu/functions.js.map +1 -1
- package/dist/modules/website_menu/index.js +2 -0
- package/dist/modules/website_menu/index.js.map +1 -1
- package/dist/modules/website_search/functions.d.ts.map +1 -1
- package/dist/modules/website_search/functions.js +10 -120
- package/dist/modules/website_search/functions.js.map +1 -1
- package/dist/modules/website_search/index.js +2 -0
- package/dist/modules/website_search/index.js.map +1 -1
- package/dist/modules/website_search/jobs.d.ts +3 -0
- package/dist/modules/website_search/jobs.d.ts.map +1 -0
- package/dist/modules/website_search/jobs.js +101 -0
- package/dist/modules/website_search/jobs.js.map +1 -0
- package/dist/modules/website_search/rebuild.d.ts +33 -0
- package/dist/modules/website_search/rebuild.d.ts.map +1 -0
- package/dist/modules/website_search/rebuild.js +125 -0
- package/dist/modules/website_search/rebuild.js.map +1 -0
- package/dist/permission-catalogue.d.ts.map +1 -1
- package/dist/permission-catalogue.js +14 -1
- package/dist/permission-catalogue.js.map +1 -1
- package/dist/scaffold/index.js +1 -1
- package/dist/ui/chrome.d.ts +8 -0
- package/dist/ui/chrome.d.ts.map +1 -1
- package/dist/ui/chrome.js +9 -1
- package/dist/ui/chrome.js.map +1 -1
- package/dist/ui/client/table-selection-view.d.ts.map +1 -1
- package/dist/ui/client/table-selection-view.js +67 -5
- package/dist/ui/client/table-selection-view.js.map +1 -1
- package/dist/ui/form.d.ts +2 -0
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +1 -0
- package/dist/ui/form.js.map +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/state.d.ts +20 -1
- package/dist/ui/state.d.ts.map +1 -1
- package/dist/ui/state.js +17 -0
- package/dist/ui/state.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineFn, desc, eq, from, like, likeLiteral } from '@ketvietlab/ketjs';
|
|
2
|
+
import { indexEffects, isCurrent, rebuildPass, servedSite, stateFor } from './rebuild.js';
|
|
2
3
|
/**
|
|
3
4
|
* Building and reading the index.
|
|
4
5
|
*
|
|
@@ -7,8 +8,6 @@ import { asc, defineFn, deleteFrom, desc, eq, from, gt, inArray, isNotNull, ne }
|
|
|
7
8
|
* builder, not a new source of truth. And a stale index degrades the search
|
|
8
9
|
* rather than answering wrongly: callers are told, and can fall back.
|
|
9
10
|
*/
|
|
10
|
-
/** How many entries one rebuild pass reads. A pass is meant to fit in a request. */
|
|
11
|
-
const BATCH = 200;
|
|
12
11
|
/** How many passes `searchIndexed` will run itself before answering degraded. */
|
|
13
12
|
const INLINE_PASSES = 3;
|
|
14
13
|
const MAX_TERM = 100;
|
|
@@ -21,119 +20,6 @@ const term = (value) => String(value ?? '')
|
|
|
21
20
|
.trim()
|
|
22
21
|
.toLocaleLowerCase()
|
|
23
22
|
.slice(0, MAX_TERM);
|
|
24
|
-
/** The site a visitor is actually being served, and the set it is serving. */
|
|
25
|
-
const servedSite = async (ctx, siteId) => {
|
|
26
|
-
const Site = ctx.table('website.Site');
|
|
27
|
-
return ctx.db.one(from(Site).where(eq(Site.id, siteId), eq(Site.active, true)));
|
|
28
|
-
};
|
|
29
|
-
const stateFor = async (ctx, siteId) => {
|
|
30
|
-
const State = ctx.table('website_search.SearchIndexState');
|
|
31
|
-
return ctx.db.one(from(State).where(eq(State.siteId, siteId)));
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* An index is current when it was built for the publication now active — or,
|
|
35
|
-
* for a site that publishes one page at a time, when it has completed at all
|
|
36
|
-
* and nothing has been published since it finished.
|
|
37
|
-
*/
|
|
38
|
-
const isCurrent = (state, site) => {
|
|
39
|
-
if (state?.state !== 'ready')
|
|
40
|
-
return false;
|
|
41
|
-
return String(state.publicationId ?? '') === String(site.activePublicationId ?? '');
|
|
42
|
-
};
|
|
43
|
-
const documentOf = (entry, revision) => ({
|
|
44
|
-
id: `${String(entry.siteId)}:${String(entry.id)}`,
|
|
45
|
-
siteId: entry.siteId,
|
|
46
|
-
entryId: entry.id,
|
|
47
|
-
type: entry.type,
|
|
48
|
-
path: entry.path,
|
|
49
|
-
title: revision.title,
|
|
50
|
-
excerpt: revision.excerpt ?? null,
|
|
51
|
-
haystack: `${String(revision.title)}\n${String(revision.excerpt ?? '')}`.toLocaleLowerCase(),
|
|
52
|
-
publishedAt: entry.publishedAt ?? null,
|
|
53
|
-
});
|
|
54
|
-
const indexEffects = [
|
|
55
|
-
'read:website.Site',
|
|
56
|
-
'read:website.Entry',
|
|
57
|
-
'read:website.EntryRevision',
|
|
58
|
-
'read:website_search.SearchDocument',
|
|
59
|
-
'write:website_search.SearchDocument',
|
|
60
|
-
'read:website_search.SearchIndexState',
|
|
61
|
-
'write:website_search.SearchIndexState',
|
|
62
|
-
];
|
|
63
|
-
/**
|
|
64
|
-
* One pass of a rebuild.
|
|
65
|
-
*
|
|
66
|
-
* Checkpointed on the entry path, which is stable and unique per site, so a
|
|
67
|
-
* pass that stops halfway resumes where it left off rather than starting again.
|
|
68
|
-
* Returns whether there is more to do.
|
|
69
|
-
*/
|
|
70
|
-
const rebuildPass = async (ctx, site) => {
|
|
71
|
-
const siteId = site.id;
|
|
72
|
-
const existing = await stateFor(ctx, siteId);
|
|
73
|
-
const target = String(site.activePublicationId ?? '');
|
|
74
|
-
const fresh = existing?.state !== 'building' || String(existing.publicationId ?? '') !== target;
|
|
75
|
-
const cursor = fresh ? '' : String(existing?.cursor ?? '');
|
|
76
|
-
const now = new Date().toISOString();
|
|
77
|
-
if (fresh) {
|
|
78
|
-
// A rebuild for a different publication starts clean: leftovers from the
|
|
79
|
-
// previous one describe pages that may no longer be served.
|
|
80
|
-
const Document = ctx.table('website_search.SearchDocument');
|
|
81
|
-
await ctx.db.del(deleteFrom(Document).where(eq(Document.siteId, siteId)));
|
|
82
|
-
const row = {
|
|
83
|
-
id: String(siteId),
|
|
84
|
-
siteId,
|
|
85
|
-
publicationId: site.activePublicationId ?? null,
|
|
86
|
-
state: 'building',
|
|
87
|
-
cursor: '',
|
|
88
|
-
documentCount: 0,
|
|
89
|
-
startedAt: now,
|
|
90
|
-
completedAt: null,
|
|
91
|
-
};
|
|
92
|
-
if (existing)
|
|
93
|
-
await ctx.db.update('website_search.SearchIndexState', { id: String(siteId) }, row);
|
|
94
|
-
else
|
|
95
|
-
await ctx.db.insert('website_search.SearchIndexState', row);
|
|
96
|
-
}
|
|
97
|
-
// The same publication gate the reader and the sitemap apply, so the index
|
|
98
|
-
// can never offer a page the reader would refuse.
|
|
99
|
-
const Entry = ctx.table('website.Entry');
|
|
100
|
-
let query = from(Entry)
|
|
101
|
-
.where(eq(Entry.siteId, siteId), isNotNull(Entry.publishedRevisionId), ne(Entry.status, 'trash'))
|
|
102
|
-
.orderBy(asc(Entry.path))
|
|
103
|
-
.limit(BATCH + 1);
|
|
104
|
-
if (cursor)
|
|
105
|
-
query = query.where(gt(Entry.path, cursor));
|
|
106
|
-
const scanned = await ctx.db.all(query);
|
|
107
|
-
const batch = scanned.slice(0, BATCH);
|
|
108
|
-
const more = scanned.length > BATCH;
|
|
109
|
-
if (batch.length) {
|
|
110
|
-
const Revision = ctx.table('website.EntryRevision');
|
|
111
|
-
const revisions = new Map();
|
|
112
|
-
const ids = batch.map((entry) => entry.publishedRevisionId);
|
|
113
|
-
for (const revision of await ctx.db.all(from(Revision)
|
|
114
|
-
.select(Revision.id, Revision.entryId, Revision.title, Revision.excerpt)
|
|
115
|
-
.where(inArray(Revision.id, ids))))
|
|
116
|
-
revisions.set(String(revision.id), revision);
|
|
117
|
-
for (const entry of batch) {
|
|
118
|
-
const revision = revisions.get(String(entry.publishedRevisionId));
|
|
119
|
-
if (!revision || revision.entryId !== entry.id)
|
|
120
|
-
continue;
|
|
121
|
-
const document = documentOf(entry, revision);
|
|
122
|
-
const inserted = await ctx.db.insertIfAbsent('website_search.SearchDocument', document);
|
|
123
|
-
if (!('dryRun' in inserted) && !inserted.inserted)
|
|
124
|
-
await ctx.db.update('website_search.SearchDocument', { id: document.id }, document);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const state = await stateFor(ctx, siteId);
|
|
128
|
-
const written = Number(state?.documentCount ?? 0) + batch.length;
|
|
129
|
-
await ctx.db.update('website_search.SearchIndexState', { id: String(siteId) }, {
|
|
130
|
-
state: more ? 'building' : 'ready',
|
|
131
|
-
cursor: more ? String(batch[batch.length - 1]?.path ?? '') : null,
|
|
132
|
-
documentCount: written,
|
|
133
|
-
completedAt: more ? null : new Date().toISOString(),
|
|
134
|
-
});
|
|
135
|
-
return { done: !more, written: batch.length };
|
|
136
|
-
};
|
|
137
23
|
export const functions = {
|
|
138
24
|
/**
|
|
139
25
|
* Rebuild the index for a site, one pass at a time.
|
|
@@ -217,10 +103,14 @@ export const functions = {
|
|
|
217
103
|
}
|
|
218
104
|
const Document = ctx.table('website_search.SearchDocument');
|
|
219
105
|
const paging = page(args.limit, args.offset);
|
|
220
|
-
|
|
221
|
-
|
|
106
|
+
// Both sides are already lowercased, so a case-sensitive LIKE is the
|
|
107
|
+
// cheaper operator and means the same thing.
|
|
108
|
+
const matching = from(Document)
|
|
109
|
+
.where(eq(Document.siteId, args.siteId))
|
|
110
|
+
.where(like(Document.haystack, `%${likeLiteral(needle)}%`, true));
|
|
111
|
+
const rows = await ctx.db.all(matching.orderBy(desc(Document.publishedAt)).limit(paging.limit).offset(paging.offset));
|
|
222
112
|
return {
|
|
223
|
-
hits:
|
|
113
|
+
hits: rows.map((row) => ({
|
|
224
114
|
id: row.entryId,
|
|
225
115
|
type: row.type,
|
|
226
116
|
path: row.path,
|
|
@@ -228,7 +118,7 @@ export const functions = {
|
|
|
228
118
|
excerpt: row.excerpt ?? null,
|
|
229
119
|
publishedAt: row.publishedAt ?? null,
|
|
230
120
|
})),
|
|
231
|
-
total:
|
|
121
|
+
total: await ctx.db.count(matching),
|
|
232
122
|
// The visitor gets an answer either way; the caller gets to say so.
|
|
233
123
|
stale: !isCurrent(state, site),
|
|
234
124
|
indexed: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../../../packages/ketsuite/src/modules/website_search/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAA;AAGzG;;;;;;;GAOG;AAEH,oFAAoF;AACpF,MAAM,KAAK,GAAG,GAAG,CAAA;AAEjB,iFAAiF;AACjF,MAAM,aAAa,GAAG,CAAC,CAAA;AAEvB,MAAM,QAAQ,GAAG,GAAG,CAAA;AACpB,MAAM,QAAQ,GAAG,CAAC,CAAA;AAElB,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,MAAe,EAAE,EAAE,CAAC,CAAC;IACjD,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC;IAC/E,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC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MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;iBAC5B,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;iBACvC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;YACnE,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAC3B,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CACvF,CAAA;YACD,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBACvB,EAAE,EAAE,GAAG,CAAC,OAAO;oBACf,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,IAAI;oBAC5B,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,IAAI;iBACrC,CAAC,CAAC;gBACH,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;gBACnC,oEAAoE;gBACpE,KAAK,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC;gBAC9B,OAAO,EAAE,IAAI;aACd,CAAA;QACH,CAAC;KACF,CAAC;CACH,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { defineModule } from '@ketvietlab/ketjs';
|
|
|
2
2
|
import { fills } from './fills.js';
|
|
3
3
|
import { functions } from './functions.js';
|
|
4
4
|
import { islands } from './islands.js';
|
|
5
|
+
import { jobs } from './jobs.js';
|
|
5
6
|
import { models } from './models.js';
|
|
6
7
|
export default defineModule({
|
|
7
8
|
name: 'website_search',
|
|
@@ -27,5 +28,6 @@ export default defineModule({
|
|
|
27
28
|
functions,
|
|
28
29
|
islands,
|
|
29
30
|
models,
|
|
31
|
+
jobs,
|
|
30
32
|
});
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/ketsuite/src/modules/website_search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,IAAI,GAAG,CAAC,WAAW,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IAC7C,QAAQ,EAAE;QACR,EAAE,EAAE;YACF,WAAW,EAAE,UAAU;YACvB,aAAa,EAAE,2CAA2C;YAC1D,cAAc,EAAE,SAAS;SAC1B;QACD,EAAE,EAAE;YACF,WAAW,EAAE,QAAQ;YACrB,aAAa,EAAE,mCAAmC;YAClD,cAAc,EAAE,SAAS;SAC1B;KACF;IACD,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,KAAK;IACL,SAAS;IACT,OAAO;IACP,MAAM;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/ketsuite/src/modules/website_search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,IAAI,GAAG,CAAC,WAAW,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IAC7C,QAAQ,EAAE;QACR,EAAE,EAAE;YACF,WAAW,EAAE,UAAU;YACvB,aAAa,EAAE,2CAA2C;YAC1D,cAAc,EAAE,SAAS;SAC1B;QACD,EAAE,EAAE;YACF,WAAW,EAAE,QAAQ;YACrB,aAAa,EAAE,mCAAmC;YAClD,cAAc,EAAE,SAAS;SAC1B;KACF;IACD,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,KAAK;IACL,SAAS;IACT,OAAO;IACP,MAAM;IACN,IAAI;CACL,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../../../../packages/ketsuite/src/modules/website_search/jobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,OAAO,EAAO,MAAM,mBAAmB,CAAA;AAwB1D,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAsFxC,CAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { defineJob, eq, from } from '@ketvietlab/ketjs';
|
|
2
|
+
import { isCurrent, rebuildPass, stateFor } from './rebuild.js';
|
|
3
|
+
/**
|
|
4
|
+
* Keeping the index level with what is being served.
|
|
5
|
+
*
|
|
6
|
+
* `reindexSite` says in its own comment that it exists "so an operator or a job
|
|
7
|
+
* can drive a long rebuild", and there was no job — so between publications the
|
|
8
|
+
* index only caught up through `searchIndexed`, three passes at a time, paid
|
|
9
|
+
* for by whichever visitors happened to search first. They also got `stale`
|
|
10
|
+
* results while they paid. That is a sound fallback and a poor schedule.
|
|
11
|
+
*/
|
|
12
|
+
/** How many rebuild passes one run spends before handing the rest on. */
|
|
13
|
+
const PASSES_PER_RUN = 10;
|
|
14
|
+
const dayStamp = (now) => now.toISOString().slice(0, 10);
|
|
15
|
+
/** The sites a rebuild could apply to: the ones actually being served. */
|
|
16
|
+
const servedSites = async (ctx) => {
|
|
17
|
+
const Site = ctx.table('website.Site');
|
|
18
|
+
return ctx.db.all(from(Site).where(eq(Site.active, true)));
|
|
19
|
+
};
|
|
20
|
+
export const jobs = {
|
|
21
|
+
indexSweep: defineJob({
|
|
22
|
+
input: {},
|
|
23
|
+
idempotent: true,
|
|
24
|
+
crossCompany: true,
|
|
25
|
+
/**
|
|
26
|
+
* `every`, not `dailyAt`: an index is behind or it is not, and that has no
|
|
27
|
+
* opinion about what time it is anywhere. An hour is short enough that a
|
|
28
|
+
* publication is searchable well before anyone notices, and long enough
|
|
29
|
+
* that a site nobody edits costs one query an hour.
|
|
30
|
+
*/
|
|
31
|
+
schedule: { every: '1h' },
|
|
32
|
+
effects: ['read:website.Site', 'enqueue:website_search.rebuildStale'],
|
|
33
|
+
handler: async (ctx) => {
|
|
34
|
+
const now = new Date();
|
|
35
|
+
const companies = new Set();
|
|
36
|
+
for (const site of await servedSites(ctx)) {
|
|
37
|
+
const company = site.companyId == null ? '' : String(site.companyId);
|
|
38
|
+
if (company)
|
|
39
|
+
companies.add(company);
|
|
40
|
+
}
|
|
41
|
+
// One job per legal entity, keyed on the hour: a sweep retried after a
|
|
42
|
+
// worker restart finds this hour's job already queued rather than
|
|
43
|
+
// queueing a second one behind it.
|
|
44
|
+
const stamp = `${dayStamp(now)}T${String(now.getUTCHours()).padStart(2, '0')}`;
|
|
45
|
+
for (const company of [...companies].sort())
|
|
46
|
+
await ctx.jobs.enqueue('website_search.rebuildStale', { pass: 1 }, { company, uniqueKey: `website_search.sweep:${company}:${stamp}:1` });
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
rebuildStale: defineJob({
|
|
50
|
+
input: { pass: 'int?' },
|
|
51
|
+
idempotent: true,
|
|
52
|
+
effects: [
|
|
53
|
+
'read:website.Site',
|
|
54
|
+
'read:website.Entry',
|
|
55
|
+
'read:website.EntryRevision',
|
|
56
|
+
'read:website.Publication',
|
|
57
|
+
'read:website_search.SearchDocument',
|
|
58
|
+
'write:website_search.SearchDocument',
|
|
59
|
+
'read:website_search.SearchIndexState',
|
|
60
|
+
'write:website_search.SearchIndexState',
|
|
61
|
+
'enqueue:website_search.rebuildStale',
|
|
62
|
+
],
|
|
63
|
+
handler: async (ctx, args) => {
|
|
64
|
+
const now = new Date();
|
|
65
|
+
const pass = Number.isInteger(Number(args.pass)) ? Math.max(Number(args.pass), 1) : 1;
|
|
66
|
+
let budget = PASSES_PER_RUN;
|
|
67
|
+
let unfinished = false;
|
|
68
|
+
for (const site of await servedSites(ctx)) {
|
|
69
|
+
if (budget === 0) {
|
|
70
|
+
// Sites this run never reached.
|
|
71
|
+
unfinished = true;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
// The same passes the screen and the visitor path drive - a job
|
|
75
|
+
// context cannot reach a declared function, so this is the import
|
|
76
|
+
// rather than the call, and the behaviour is identical either way.
|
|
77
|
+
if (isCurrent(await stateFor(ctx, site.id), site))
|
|
78
|
+
continue;
|
|
79
|
+
let done = false;
|
|
80
|
+
while (!done && budget > 0) {
|
|
81
|
+
done = (await rebuildPass(ctx, site)).done;
|
|
82
|
+
budget -= 1;
|
|
83
|
+
}
|
|
84
|
+
if (!done)
|
|
85
|
+
unfinished = true;
|
|
86
|
+
}
|
|
87
|
+
// A backlog is finished by another run rather than by a longer one, so a
|
|
88
|
+
// first build over a large site cannot hold a worker slot long enough to
|
|
89
|
+
// be killed and retried from the beginning.
|
|
90
|
+
//
|
|
91
|
+
// The company is in the key because a unique job key is unique per
|
|
92
|
+
// tenant, not per company: without it two companies both needing a
|
|
93
|
+
// second pass in the same hour would collide and one would never run.
|
|
94
|
+
if (unfinished) {
|
|
95
|
+
const stamp = `${dayStamp(now)}T${String(now.getUTCHours()).padStart(2, '0')}`;
|
|
96
|
+
await ctx.jobs.enqueue('website_search.rebuildStale', { pass: pass + 1 }, { uniqueKey: `website_search.sweep:${ctx.scope.company ?? ''}:${stamp}:${pass + 1}` });
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../../../../../../packages/ketsuite/src/modules/website_search/jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE/D;;;;;;;;GAQG;AAEH,yEAAyE;AACzE,MAAM,cAAc,GAAG,EAAE,CAAA;AAEzB,MAAM,QAAQ,GAAG,CAAC,GAAS,EAAU,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAEtE,0EAA0E;AAC1E,MAAM,WAAW,GAAG,KAAK,EAAE,GAAQ,EAAkB,EAAE;IACrD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IACtC,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAA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AAC,CAAA;gBACb,CAAC;gBACD,IAAI,CAAC,IAAI;oBAAE,UAAU,GAAG,IAAI,CAAA;YAC9B,CAAC;YACD,yEAAyE;YACzE,yEAAyE;YACzE,4CAA4C;YAC5C,EAAE;YACF,mEAAmE;YACnE,mEAAmE;YACnE,sEAAsE;YACtE,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,KAAK,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;gBAC9E,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CACpB,6BAA6B,EAC7B,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,EAAE,EAClB,EAAE,SAAS,EAAE,wBAAwB,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,EAAE,CACtF,CAAA;YACH,CAAC;QACH,CAAC;KACF,CAAC;CACH,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Ctx, Row } from '@ketvietlab/ketjs';
|
|
2
|
+
/**
|
|
3
|
+
* Building the index, kept apart from reading it.
|
|
4
|
+
*
|
|
5
|
+
* A job cannot reach a declared function - a JobContext has no `call` - so the
|
|
6
|
+
* passes have to be an ordinary import, the way `website_form` keeps its purge.
|
|
7
|
+
* Separating them says the same thing the model does: the index is derived, and
|
|
8
|
+
* building it is not the same act as answering with it.
|
|
9
|
+
*/
|
|
10
|
+
/** How many entries one rebuild pass reads. A pass is meant to fit in a request. */
|
|
11
|
+
export declare const BATCH = 200;
|
|
12
|
+
export declare const indexEffects: string[];
|
|
13
|
+
/** The site a visitor is actually being served, and the set it is serving. */
|
|
14
|
+
export declare const servedSite: (ctx: Ctx, siteId: unknown) => Promise<Row | null>;
|
|
15
|
+
export declare const stateFor: (ctx: Ctx, siteId: unknown) => Promise<Row | null>;
|
|
16
|
+
/**
|
|
17
|
+
* An index is current when it was built for the publication now active — or,
|
|
18
|
+
* for a site that publishes one page at a time, when it has completed at all
|
|
19
|
+
* and nothing has been published since it finished.
|
|
20
|
+
*/
|
|
21
|
+
export declare const isCurrent: (state: Row | null, site: Row) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* One pass of a rebuild.
|
|
24
|
+
*
|
|
25
|
+
* Checkpointed on the entry path, which is stable and unique per site, so a
|
|
26
|
+
* pass that stops halfway resumes where it left off rather than starting again.
|
|
27
|
+
* Returns whether there is more to do.
|
|
28
|
+
*/
|
|
29
|
+
export declare const rebuildPass: (ctx: Ctx, site: Row) => Promise<{
|
|
30
|
+
done: boolean;
|
|
31
|
+
written: number;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=rebuild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rebuild.d.ts","sourceRoot":"","sources":["../../../../../../packages/ketsuite/src/modules/website_search/rebuild.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAEjD;;;;;;;GAOG;AAEH,oFAAoF;AACpF,eAAO,MAAM,KAAK,MAAM,CAAA;AAExB,eAAO,MAAM,YAAY,UAQxB,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,UAAU,QAAe,GAAG,UAAU,OAAO,KAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAG9E,CAAA;AAED,eAAO,MAAM,QAAQ,QAAe,GAAG,UAAU,OAAO,KAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAG5E,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,GAAG,GAAG,IAAI,QAAQ,GAAG,KAAG,OAGxD,CAAA;AAcD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,QAAe,GAAG,QAAQ,GAAG,KAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAsEjG,CAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { asc, deleteFrom, eq, from, gt, inArray, isNotNull, ne } from '@ketvietlab/ketjs';
|
|
2
|
+
/**
|
|
3
|
+
* Building the index, kept apart from reading it.
|
|
4
|
+
*
|
|
5
|
+
* A job cannot reach a declared function - a JobContext has no `call` - so the
|
|
6
|
+
* passes have to be an ordinary import, the way `website_form` keeps its purge.
|
|
7
|
+
* Separating them says the same thing the model does: the index is derived, and
|
|
8
|
+
* building it is not the same act as answering with it.
|
|
9
|
+
*/
|
|
10
|
+
/** How many entries one rebuild pass reads. A pass is meant to fit in a request. */
|
|
11
|
+
export const BATCH = 200;
|
|
12
|
+
export const indexEffects = [
|
|
13
|
+
'read:website.Site',
|
|
14
|
+
'read:website.Entry',
|
|
15
|
+
'read:website.EntryRevision',
|
|
16
|
+
'read:website_search.SearchDocument',
|
|
17
|
+
'write:website_search.SearchDocument',
|
|
18
|
+
'read:website_search.SearchIndexState',
|
|
19
|
+
'write:website_search.SearchIndexState',
|
|
20
|
+
];
|
|
21
|
+
/** The site a visitor is actually being served, and the set it is serving. */
|
|
22
|
+
export const servedSite = async (ctx, siteId) => {
|
|
23
|
+
const Site = ctx.table('website.Site');
|
|
24
|
+
return ctx.db.one(from(Site).where(eq(Site.id, siteId), eq(Site.active, true)));
|
|
25
|
+
};
|
|
26
|
+
export const stateFor = async (ctx, siteId) => {
|
|
27
|
+
const State = ctx.table('website_search.SearchIndexState');
|
|
28
|
+
return ctx.db.one(from(State).where(eq(State.siteId, siteId)));
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* An index is current when it was built for the publication now active — or,
|
|
32
|
+
* for a site that publishes one page at a time, when it has completed at all
|
|
33
|
+
* and nothing has been published since it finished.
|
|
34
|
+
*/
|
|
35
|
+
export const isCurrent = (state, site) => {
|
|
36
|
+
if (state?.state !== 'ready')
|
|
37
|
+
return false;
|
|
38
|
+
return String(state.publicationId ?? '') === String(site.activePublicationId ?? '');
|
|
39
|
+
};
|
|
40
|
+
const documentOf = (entry, revision) => ({
|
|
41
|
+
id: `${String(entry.siteId)}:${String(entry.id)}`,
|
|
42
|
+
siteId: entry.siteId,
|
|
43
|
+
entryId: entry.id,
|
|
44
|
+
type: entry.type,
|
|
45
|
+
path: entry.path,
|
|
46
|
+
title: revision.title,
|
|
47
|
+
excerpt: revision.excerpt ?? null,
|
|
48
|
+
haystack: `${String(revision.title)}\n${String(revision.excerpt ?? '')}`.toLocaleLowerCase(),
|
|
49
|
+
publishedAt: entry.publishedAt ?? null,
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* One pass of a rebuild.
|
|
53
|
+
*
|
|
54
|
+
* Checkpointed on the entry path, which is stable and unique per site, so a
|
|
55
|
+
* pass that stops halfway resumes where it left off rather than starting again.
|
|
56
|
+
* Returns whether there is more to do.
|
|
57
|
+
*/
|
|
58
|
+
export const rebuildPass = async (ctx, site) => {
|
|
59
|
+
const siteId = site.id;
|
|
60
|
+
const existing = await stateFor(ctx, siteId);
|
|
61
|
+
const target = String(site.activePublicationId ?? '');
|
|
62
|
+
const fresh = existing?.state !== 'building' || String(existing.publicationId ?? '') !== target;
|
|
63
|
+
const cursor = fresh ? '' : String(existing?.cursor ?? '');
|
|
64
|
+
const now = new Date().toISOString();
|
|
65
|
+
if (fresh) {
|
|
66
|
+
// A rebuild for a different publication starts clean: leftovers from the
|
|
67
|
+
// previous one describe pages that may no longer be served.
|
|
68
|
+
const Document = ctx.table('website_search.SearchDocument');
|
|
69
|
+
await ctx.db.del(deleteFrom(Document).where(eq(Document.siteId, siteId)));
|
|
70
|
+
const row = {
|
|
71
|
+
id: String(siteId),
|
|
72
|
+
siteId,
|
|
73
|
+
publicationId: site.activePublicationId ?? null,
|
|
74
|
+
state: 'building',
|
|
75
|
+
cursor: '',
|
|
76
|
+
documentCount: 0,
|
|
77
|
+
startedAt: now,
|
|
78
|
+
completedAt: null,
|
|
79
|
+
};
|
|
80
|
+
if (existing)
|
|
81
|
+
await ctx.db.update('website_search.SearchIndexState', { id: String(siteId) }, row);
|
|
82
|
+
else
|
|
83
|
+
await ctx.db.insert('website_search.SearchIndexState', row);
|
|
84
|
+
}
|
|
85
|
+
// The same publication gate the reader and the sitemap apply, so the index
|
|
86
|
+
// can never offer a page the reader would refuse.
|
|
87
|
+
const Entry = ctx.table('website.Entry');
|
|
88
|
+
let query = from(Entry)
|
|
89
|
+
.where(eq(Entry.siteId, siteId), isNotNull(Entry.publishedRevisionId), ne(Entry.status, 'trash'))
|
|
90
|
+
.orderBy(asc(Entry.path))
|
|
91
|
+
.limit(BATCH + 1);
|
|
92
|
+
if (cursor)
|
|
93
|
+
query = query.where(gt(Entry.path, cursor));
|
|
94
|
+
const scanned = await ctx.db.all(query);
|
|
95
|
+
const batch = scanned.slice(0, BATCH);
|
|
96
|
+
const more = scanned.length > BATCH;
|
|
97
|
+
if (batch.length) {
|
|
98
|
+
const Revision = ctx.table('website.EntryRevision');
|
|
99
|
+
const revisions = new Map();
|
|
100
|
+
const ids = batch.map((entry) => entry.publishedRevisionId);
|
|
101
|
+
for (const revision of await ctx.db.all(from(Revision)
|
|
102
|
+
.select(Revision.id, Revision.entryId, Revision.title, Revision.excerpt)
|
|
103
|
+
.where(inArray(Revision.id, ids))))
|
|
104
|
+
revisions.set(String(revision.id), revision);
|
|
105
|
+
for (const entry of batch) {
|
|
106
|
+
const revision = revisions.get(String(entry.publishedRevisionId));
|
|
107
|
+
if (!revision || revision.entryId !== entry.id)
|
|
108
|
+
continue;
|
|
109
|
+
const document = documentOf(entry, revision);
|
|
110
|
+
const inserted = await ctx.db.insertIfAbsent('website_search.SearchDocument', document);
|
|
111
|
+
if (!('dryRun' in inserted) && !inserted.inserted)
|
|
112
|
+
await ctx.db.update('website_search.SearchDocument', { id: document.id }, document);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const state = await stateFor(ctx, siteId);
|
|
116
|
+
const written = Number(state?.documentCount ?? 0) + batch.length;
|
|
117
|
+
await ctx.db.update('website_search.SearchIndexState', { id: String(siteId) }, {
|
|
118
|
+
state: more ? 'building' : 'ready',
|
|
119
|
+
cursor: more ? String(batch[batch.length - 1]?.path ?? '') : null,
|
|
120
|
+
documentCount: written,
|
|
121
|
+
completedAt: more ? null : new Date().toISOString(),
|
|
122
|
+
});
|
|
123
|
+
return { done: !more, written: batch.length };
|
|
124
|
+
};
|
|
125
|
+
//# sourceMappingURL=rebuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rebuild.js","sourceRoot":"","sources":["../../../../../../../packages/ketsuite/src/modules/website_search/rebuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAA;AAGzF;;;;;;;GAOG;AAEH,oFAAoF;AACpF,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,mBAAmB;IACnB,oBAAoB;IACpB,4BAA4B;IAC5B,oCAAoC;IACpC,qCAAqC;IACrC,sCAAsC;IACtC,uCAAuC;CACxC,CAAA;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,GAAQ,EAAE,MAAe,EAAuB,EAAE;IACjF,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IACtC,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;AACjF,CAAC,CAAA;AAED,MAAM,CAAC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,CAAC,MAAM,CAAC,iCAAiC,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE;QAC7E,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO;QAClC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;QACjE,aAAa,EAAE,OAAO;QACtB,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAC7C,CAAC,CAAA;IACT,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAA;AAC/C,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-catalogue.d.ts","sourceRoot":"","sources":["../../../../packages/ketsuite/src/permission-catalogue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAIrB,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"permission-catalogue.d.ts","sourceRoot":"","sources":["../../../../packages/ketsuite/src/permission-catalogue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAIrB,MAAM,mBAAmB,CAAA;AAq9C1B,+FAA+F;AAC/F,eAAO,MAAM,yBAAyB,EA0CjC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;AAEzC,eAAO,MAAM,6BAA6B,mBAAsC,CAAA"}
|
|
@@ -482,6 +482,7 @@ const sources = {
|
|
|
482
482
|
cancelReservation: ['approve', 'approve', 'hospitality_core.domain-policy'],
|
|
483
483
|
checkIn: ['operate', 'operate'],
|
|
484
484
|
checkOut: ['operate', 'operate'],
|
|
485
|
+
checkOutReadiness: ['read', ['view', 'operate']],
|
|
485
486
|
cleaningTaskSummary: ['operate', ['operate', 'housekeeping-attend', 'housekeeping-supervise']],
|
|
486
487
|
completeCleaningTask: ['approve', ['approve', 'housekeeping-attend'], 'hospitality_core.domain-policy'],
|
|
487
488
|
confirmStayNotice: ['approve', ['approve', 'compliance-operate'], 'hospitality_core.domain-policy'],
|
|
@@ -1332,6 +1333,7 @@ const sources = {
|
|
|
1332
1333
|
addMenuItem: ['configure', 'configure', 'website.configuration-audit'],
|
|
1333
1334
|
listMenu: ['read', 'view'],
|
|
1334
1335
|
preflightMenu: ['read', 'view'],
|
|
1336
|
+
moveMenuItem: ['configure', 'configure', 'website.configuration-audit'],
|
|
1335
1337
|
removeMenuItem: ['configure', 'configure', 'website.configuration-audit'],
|
|
1336
1338
|
snapshotMenu: ['configure', 'configure', 'website.configuration-audit'],
|
|
1337
1339
|
},
|
|
@@ -1370,6 +1372,7 @@ const sources = {
|
|
|
1370
1372
|
countPages: ['read', 'view'],
|
|
1371
1373
|
createPreviewToken: ['sensitive', 'sensitive', 'website.sensitive-data'],
|
|
1372
1374
|
deleteMediaMetadata: ['configure', 'configure', 'website.configuration-audit'],
|
|
1375
|
+
deleteDomain: ['configure', 'configure', 'website.configuration-audit'],
|
|
1373
1376
|
deleteTerm: ['configure', 'configure', 'website.configuration-audit'],
|
|
1374
1377
|
diffRevisions: ['read', 'view'],
|
|
1375
1378
|
getEntry: ['read', 'view'],
|
|
@@ -1377,8 +1380,10 @@ const sources = {
|
|
|
1377
1380
|
getTaxonomyTerm: ['read', 'view'],
|
|
1378
1381
|
listDomains: ['read', 'view'],
|
|
1379
1382
|
listEntries: ['read', 'view'],
|
|
1383
|
+
listEntryTerms: ['read', 'view'],
|
|
1380
1384
|
listMedia: ['read', 'view'],
|
|
1381
1385
|
listPages: ['read', 'view'],
|
|
1386
|
+
mediaUsage: ['read', 'view'],
|
|
1382
1387
|
listRedirects: ['read', 'view'],
|
|
1383
1388
|
listRevisions: ['read', 'view'],
|
|
1384
1389
|
listSiteMembers: ['read', 'view'],
|
|
@@ -1393,6 +1398,7 @@ const sources = {
|
|
|
1393
1398
|
publishPage: ['configure', 'configure', 'website.configuration-audit'],
|
|
1394
1399
|
removeSiteMember: ['security', 'security', 'website.security-audit'],
|
|
1395
1400
|
restoreRevision: ['operate', 'operate'],
|
|
1401
|
+
unpublishEntry: ['configure', 'configure', 'website.configuration-audit'],
|
|
1396
1402
|
revokePreviewTokens: ['sensitive', 'sensitive', 'website.sensitive-data'],
|
|
1397
1403
|
saveDomain: ['configure', 'configure', 'website.configuration-audit'],
|
|
1398
1404
|
saveEntry: ['configure', 'configure', 'website.configuration-audit'],
|
|
@@ -1402,6 +1408,9 @@ const sources = {
|
|
|
1402
1408
|
saveSite: ['configure', 'configure', 'website.configuration-audit'],
|
|
1403
1409
|
saveSiteMember: ['configure', 'configure', 'website.configuration-audit'],
|
|
1404
1410
|
saveTerm: ['configure', 'configure', 'website.configuration-audit'],
|
|
1411
|
+
trashEntry: ['configure', 'configure', 'website.configuration-audit'],
|
|
1412
|
+
unassignTerm: ['configure', 'configure', 'website.configuration-audit'],
|
|
1413
|
+
untrashEntry: ['configure', 'configure', 'website.configuration-audit'],
|
|
1405
1414
|
},
|
|
1406
1415
|
exemptions: {
|
|
1407
1416
|
authenticateCustomer: ['anonymous', 'declared-public-or-cryptographic-realm-boundary'],
|
|
@@ -1449,7 +1458,11 @@ const capabilityLabels = {
|
|
|
1449
1458
|
'night-audit': { en: 'Run night audit', vi: 'Chạy kiểm toán đêm' },
|
|
1450
1459
|
'order-operate': { en: 'Operate orders', vi: 'Vận hành đơn hàng' },
|
|
1451
1460
|
operate: { en: 'Operate', vi: 'Vận hành' },
|
|
1452
|
-
|
|
1461
|
+
// Not "read every project" — that is the grant row this capability hands out,
|
|
1462
|
+
// and holding the capability without a row of your own reads nothing. The
|
|
1463
|
+
// label said otherwise, which would have told a role screen that ticking this
|
|
1464
|
+
// box opens the projects; it opens the ability to open them for somebody.
|
|
1465
|
+
'project-access': { en: 'Administer project access', vi: 'Quản trị quyền đọc dự án' },
|
|
1453
1466
|
'project-delete': { en: 'Delete projects for good', vi: 'Xóa hẳn dự án' },
|
|
1454
1467
|
'property-reference': { en: 'Reference properties', vi: 'Tham chiếu cơ sở lưu trú' },
|
|
1455
1468
|
reconcile: { en: 'Reconcile', vi: 'Đối soát' },
|