@things-factory/help 10.1.283 → 10.1.291

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.
Files changed (52) hide show
  1. package/dist-client/bootstrap.js +9 -0
  2. package/dist-client/guide/deep-find.d.ts +4 -0
  3. package/dist-client/guide/deep-find.js +29 -0
  4. package/dist-client/guide/guide-anchors.d.ts +33 -0
  5. package/dist-client/guide/guide-anchors.js +29 -0
  6. package/dist-client/guide/guide-api.d.ts +24 -0
  7. package/dist-client/guide/guide-api.js +23 -0
  8. package/dist-client/guide/guide-progress.d.ts +37 -0
  9. package/dist-client/guide/guide-progress.js +51 -0
  10. package/dist-client/guide/guide-recorder.d.ts +9 -0
  11. package/dist-client/guide/guide-recorder.js +94 -0
  12. package/dist-client/guide/guide-runner.d.ts +18 -0
  13. package/dist-client/guide/guide-runner.js +191 -0
  14. package/dist-client/guide/guide-words.d.ts +8 -0
  15. package/dist-client/guide/guide-words.js +21 -0
  16. package/dist-client/guide/ox-guide-overlay.d.ts +30 -0
  17. package/dist-client/guide/ox-guide-overlay.js +273 -0
  18. package/dist-client/guide/ox-guide-recorder-bar.d.ts +10 -0
  19. package/dist-client/guide/ox-guide-recorder-bar.js +92 -0
  20. package/dist-client/index.d.ts +4 -0
  21. package/dist-client/index.js +4 -0
  22. package/dist-client/pages/guide-editor.d.ts +36 -0
  23. package/dist-client/pages/guide-editor.js +339 -0
  24. package/dist-client/pages/guide-list.d.ts +45 -0
  25. package/dist-client/pages/guide-list.js +74 -0
  26. package/dist-client/route.js +6 -0
  27. package/dist-server/index.d.ts +2 -0
  28. package/dist-server/index.js +8 -1
  29. package/dist-server/role-tasks.d.ts +2 -0
  30. package/dist-server/role-tasks.js +11 -0
  31. package/dist-server/service/guide/guide-conditions.d.ts +21 -0
  32. package/dist-server/service/guide/guide-conditions.js +27 -0
  33. package/dist-server/service/guide/guide-resolver.d.ts +12 -0
  34. package/dist-server/service/guide/guide-resolver.js +142 -0
  35. package/dist-server/service/guide/guide-rules.d.ts +12 -0
  36. package/dist-server/service/guide/guide-rules.js +30 -0
  37. package/dist-server/service/guide/guide-types.d.ts +14 -0
  38. package/dist-server/service/guide/guide-types.js +43 -0
  39. package/dist-server/service/guide/guide.d.ts +24 -0
  40. package/dist-server/service/guide/guide.js +90 -0
  41. package/dist-server/service/guide/index.d.ts +4 -0
  42. package/dist-server/service/guide/index.js +8 -0
  43. package/dist-server/service/index.d.ts +7 -0
  44. package/dist-server/service/index.js +15 -0
  45. package/package.json +15 -3
  46. package/things-factory.config.js +3 -1
  47. package/translations/en.json +74 -2
  48. package/translations/es.json +73 -1
  49. package/translations/ja.json +74 -2
  50. package/translations/ko.json +74 -2
  51. package/translations/ms.json +73 -1
  52. package/translations/zh.json +73 -1
@@ -0,0 +1,339 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@operato/input/ox-select.js';
4
+ import '@operato/popup/ox-popup-list.js';
5
+ import { css, html, nothing } from 'lit';
6
+ import { customElement, state } from 'lit/decorators.js';
7
+ import { i18next, localize } from '@operato/i18n';
8
+ import { notify } from '@operato/layout';
9
+ import { OxPrompt } from '@operato/popup/ox-prompt.js';
10
+ import { navigate, PageView } from '@operato/shell';
11
+ import { ButtonStyles, DocumentPageStyles, FormFieldStyles } from '@operato/styles';
12
+ import { guideAnchor } from '../guide/guide-anchors.js';
13
+ import { guideApi } from '../guide/guide-api.js';
14
+ import { brokenSteps, moveStep } from '../guide/guide-progress.js';
15
+ import { RECORDED_KEY, startRecording } from '../guide/guide-recorder.js';
16
+ import { startGuide } from '../guide/guide-runner.js';
17
+ import { anchorLabel, defaultStepText, pageLabel, reasonOf, t } from '../guide/guide-words.js';
18
+ const EMPTY = { name: '', opening: '', condition: '', steps: [] };
19
+ /* The form while the writer records - the editor is left for the recorded screens and opened again. */
20
+ const DRAFT_KEY = 'guide.editor-draft';
21
+ /**
22
+ * 화면 안내 작성 — the guide's name, its opening sentence, its steps and its completion check (ADR-0212 decision 7). The
23
+ * steps are recorded by doing the work once; the writer rewrites each sentence, adds steps that only explain, and tries
24
+ * the guide in a preview, which records nothing.
25
+ */
26
+ let GuideEditor = class GuideEditor extends localize(i18next)(PageView) {
27
+ constructor() {
28
+ super(...arguments);
29
+ this.form = { ...EMPTY };
30
+ this.conditions = [];
31
+ this.busy = false;
32
+ }
33
+ static { this.styles = [
34
+ FormFieldStyles,
35
+ ButtonStyles,
36
+ DocumentPageStyles,
37
+ css `
38
+ .form {
39
+ display: grid;
40
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
41
+ gap: var(--spacing-medium, 8px) var(--spacing-large, 12px);
42
+ }
43
+ .form .wide {
44
+ grid-column: 1 / -1;
45
+ }
46
+ label {
47
+ display: flex;
48
+ flex-direction: column;
49
+ gap: 2px;
50
+ }
51
+ textarea {
52
+ display: block;
53
+ width: 100%;
54
+ box-sizing: border-box;
55
+ min-height: 56px;
56
+ /* A step of several lines shows whole - the box grows with its words. */
57
+ field-sizing: content;
58
+ max-height: 240px;
59
+ font-family: inherit;
60
+ }
61
+ .hint {
62
+ font-size: var(--ui-t-small, 12px);
63
+ color: var(--ui-muted, var(--md-sys-color-on-surface-variant));
64
+ }
65
+ ol.steps {
66
+ list-style: none;
67
+ margin: 0;
68
+ padding: 0;
69
+ display: flex;
70
+ flex-direction: column;
71
+ gap: var(--spacing-medium, 8px);
72
+ }
73
+ ol.steps li {
74
+ display: grid;
75
+ grid-template-columns: 28px 1fr auto;
76
+ gap: var(--spacing-small, 4px) var(--spacing-medium, 8px);
77
+ align-items: start;
78
+ padding: var(--spacing-medium, 8px);
79
+ border: 1px solid var(--ui-line-soft, var(--md-sys-color-outline-variant));
80
+ border-radius: var(--border-radius, 6px);
81
+ }
82
+ ol.steps li.broken {
83
+ border-color: var(--md-sys-color-error, #b3261e);
84
+ }
85
+ .number {
86
+ font-weight: 600;
87
+ padding-top: 2px;
88
+ }
89
+ .where {
90
+ display: flex;
91
+ flex-wrap: wrap;
92
+ gap: var(--spacing-small, 4px) var(--spacing-medium, 8px);
93
+ font-size: var(--ui-t-small, 12px);
94
+ color: var(--ui-muted, var(--md-sys-color-on-surface-variant));
95
+ }
96
+ .where .broken {
97
+ color: var(--md-sys-color-error, #b3261e);
98
+ font-weight: 600;
99
+ }
100
+ .tools {
101
+ display: flex;
102
+ gap: 2px;
103
+ }
104
+ .tools button {
105
+ border: 0;
106
+ background: none;
107
+ padding: 2px;
108
+ cursor: pointer;
109
+ color: var(--ui-muted, var(--md-sys-color-on-surface-variant));
110
+ }
111
+ .tools button:disabled {
112
+ opacity: 0.35;
113
+ cursor: default;
114
+ }
115
+ .empty {
116
+ color: var(--ui-muted, var(--md-sys-color-on-surface-variant));
117
+ }
118
+ `
119
+ ]; }
120
+ get context() {
121
+ const actions = [
122
+ { id: 'record', title: t('guide.button.record'), icon: 'radio_button_checked', action: () => this.record() },
123
+ { id: 'add-explanation', title: t('guide.button.add-explanation'), icon: 'notes', disabled: !this.form.steps.length, disabledTitle: t('guide.text.explanation-needs-step'), action: () => this.addExplanation() },
124
+ { id: 'preview', title: t('guide.button.preview'), icon: 'play_arrow', disabled: !this.form.steps.length, disabledTitle: t('guide.text.preview-needs-step'), action: () => this.preview() },
125
+ ...(this.guideId ? [{ id: 'delete', title: t('guide.button.delete'), icon: 'delete_outline', emphasis: { danger: true }, action: () => this.deleteGuide() }] : []),
126
+ { id: 'save', title: t('guide.button.save'), icon: 'save', emphasis: { raised: true }, disabled: this.busy, action: () => this.save() }
127
+ ];
128
+ return {
129
+ title: this.guideId ? `${t('guide.title.edit')} · ${this.form.name}` : t('guide.title.new'),
130
+ frame: 'document',
131
+ menu: 'announcement-list',
132
+ actions
133
+ };
134
+ }
135
+ async pageUpdated(changes, lifecycle) {
136
+ if (!this.active || !(changes.active || changes.params))
137
+ return;
138
+ const id = lifecycle?.params?.id || undefined;
139
+ const recorded = this.takeRecorded();
140
+ if (`${id}` === this.address && !recorded)
141
+ return;
142
+ this.address = `${id}`;
143
+ try {
144
+ this.conditions = await guideApi.conditions();
145
+ const draft = this.takeDraft();
146
+ if (draft && draft.id === id)
147
+ this.form = draft.form;
148
+ else if (id) {
149
+ const one = await guideApi.one(id);
150
+ this.form = one ? { name: one.name, opening: one.opening, condition: one.condition ?? '', steps: one.steps ?? [] } : { ...EMPTY };
151
+ }
152
+ else
153
+ this.form = { ...EMPTY };
154
+ this.guideId = id;
155
+ if (recorded?.length) {
156
+ this.form = { ...this.form, steps: [...this.form.steps, ...recorded.map(step => ({ ...step, text: defaultStepText(step.anchor) }))] };
157
+ notify({ message: t('guide.text.recorded-added', { n: recorded.length }), level: 'info' });
158
+ }
159
+ }
160
+ catch (error) {
161
+ notify({ message: reasonOf(error), level: 'error' });
162
+ }
163
+ this.updateContext();
164
+ }
165
+ render() {
166
+ const form = this.form;
167
+ const broken = new Set(brokenSteps(form.steps, guideAnchor));
168
+ const set = (patch) => {
169
+ this.form = { ...this.form, ...patch };
170
+ this.updateContext();
171
+ };
172
+ return html `<div class="page">
173
+ <section class="page-section">
174
+ <header class="page-section-header"><h3>${t('guide.text.section-guide')}</h3></header>
175
+ <div class="form">
176
+ <label
177
+ >${t('guide.field.name')}
178
+ <input .value=${form.name} maxlength="100" @input=${(e) => set({ name: e.target.value })} />
179
+ <span class="hint">${t('guide.text.name-hint')}</span>
180
+ </label>
181
+ <label
182
+ >${t('guide.field.condition')}
183
+ <ox-select
184
+ .value=${form.condition}
185
+ aria-label=${t('guide.field.condition')}
186
+ @change=${(e) => {
187
+ e.stopPropagation();
188
+ set({ condition: String(e.detail ?? '') });
189
+ }}
190
+ >
191
+ <span slot="label">${form.condition ? (this.conditions.find(one => one.id === form.condition)?.label ?? form.condition) : t('guide.text.no-condition')}</span>
192
+ <ox-popup-list align-left nowrap with-search>
193
+ <div option value="">${t('guide.text.no-condition')}</div>
194
+ ${this.conditions.map(one => html `<div option value=${one.id}>${one.label}</div>`)}
195
+ </ox-popup-list>
196
+ </ox-select>
197
+ <span class="hint">${t('guide.text.condition-hint')}</span>
198
+ </label>
199
+ <label class="wide"
200
+ >${t('guide.field.opening')}
201
+ <textarea .value=${form.opening} maxlength="300" placeholder=${t('guide.text.opening-placeholder')} @input=${(e) => set({ opening: e.target.value })}></textarea>
202
+ <span class="hint">${t('guide.text.opening-hint')}</span>
203
+ </label>
204
+ </div>
205
+ </section>
206
+
207
+ <section class="page-section">
208
+ <header class="page-section-header"><h3>${t('guide.text.section-steps')}</h3></header>
209
+ ${broken.size ? html `<p class="hint">${t('guide.text.broken-steps', { n: broken.size })}</p>` : nothing}
210
+ ${form.steps.length
211
+ ? html `<ol class="steps">
212
+ ${form.steps.map((step, index) => this.renderStep(step, index, broken.has(index), set))}
213
+ </ol>`
214
+ : html `<p class="empty">${t('guide.text.steps-empty')}</p>`}
215
+ </section>
216
+ </div>`;
217
+ }
218
+ renderStep(step, index, broken, set) {
219
+ const steps = this.form.steps;
220
+ const change = (patch) => set({ steps: steps.map((one, at) => (at === index ? { ...one, ...patch } : one)) });
221
+ return html `<li class=${broken ? 'broken' : ''}>
222
+ <span class="number">${index + 1}</span>
223
+ <div>
224
+ <div class="where">
225
+ <span>${t('guide.field.page')}: ${pageLabel(step.page)}</span>
226
+ ${broken
227
+ ? html `<span class="broken">${t('guide.text.broken-step')}</span>`
228
+ : html `<span>${step.anchor ? `${t('guide.field.anchor')}: ${anchorLabel(step.anchor)}` : t('guide.text.explanation-step')}</span>`}
229
+ </div>
230
+ <textarea .value=${step.text} maxlength="300" placeholder=${t('guide.text.step-placeholder')} aria-label=${t('guide.field.step-text')} @input=${(e) => change({ text: e.target.value })}></textarea>
231
+ </div>
232
+ <div class="tools">
233
+ <button ?disabled=${index === 0} aria-label=${t('guide.button.move-up')} @click=${() => set({ steps: moveStep(steps, index, -1) })}><md-icon>arrow_upward</md-icon></button>
234
+ <button ?disabled=${index === steps.length - 1} aria-label=${t('guide.button.move-down')} @click=${() => set({ steps: moveStep(steps, index, 1) })}><md-icon>arrow_downward</md-icon></button>
235
+ <button aria-label=${t('guide.button.remove-step')} @click=${() => set({ steps: steps.filter((_one, at) => at !== index) })}><md-icon>close</md-icon></button>
236
+ </div>
237
+ </li>`;
238
+ }
239
+ takeRecorded() {
240
+ try {
241
+ const kept = sessionStorage.getItem(RECORDED_KEY);
242
+ sessionStorage.removeItem(RECORDED_KEY);
243
+ return kept ? JSON.parse(kept) : undefined;
244
+ }
245
+ catch {
246
+ return undefined;
247
+ }
248
+ }
249
+ takeDraft() {
250
+ try {
251
+ const kept = sessionStorage.getItem(DRAFT_KEY);
252
+ sessionStorage.removeItem(DRAFT_KEY);
253
+ return kept ? JSON.parse(kept) : undefined;
254
+ }
255
+ catch {
256
+ return undefined;
257
+ }
258
+ }
259
+ record() {
260
+ try {
261
+ sessionStorage.setItem(DRAFT_KEY, JSON.stringify({ id: this.guideId, form: this.form }));
262
+ }
263
+ catch {
264
+ /* the form is lost on return */
265
+ }
266
+ startRecording(this.guideId ? `guide-editor?id=${this.guideId}` : 'guide-editor');
267
+ notify({ message: t('guide.text.recording-started'), level: 'info' });
268
+ }
269
+ /** A step that only explains, on the page of the step before it. */
270
+ addExplanation() {
271
+ const last = this.form.steps[this.form.steps.length - 1];
272
+ if (!last)
273
+ return;
274
+ this.form = { ...this.form, steps: [...this.form.steps, { page: last.page, text: '' }] };
275
+ this.updateContext();
276
+ }
277
+ preview() {
278
+ const { name, opening, condition, steps } = this.form;
279
+ void startGuide({ id: this.guideId, name, opening, condition: condition || null, steps });
280
+ }
281
+ async save() {
282
+ if (this.busy)
283
+ return;
284
+ this.busy = true;
285
+ this.updateContext();
286
+ try {
287
+ const { name, opening, condition, steps } = this.form;
288
+ const saved = await guideApi.save({ name, opening, condition: condition || null, steps }, this.guideId);
289
+ notify({ message: t('guide.text.saved'), level: 'info' });
290
+ if (!this.guideId) {
291
+ this.address = `${saved.id}`;
292
+ this.guideId = saved.id;
293
+ navigate(`guide-editor?id=${saved.id}`);
294
+ }
295
+ }
296
+ catch (error) {
297
+ notify({ message: reasonOf(error), level: 'error' });
298
+ }
299
+ finally {
300
+ this.busy = false;
301
+ this.updateContext();
302
+ }
303
+ }
304
+ async deleteGuide() {
305
+ if (!this.guideId)
306
+ return;
307
+ const ok = await OxPrompt.open({ type: 'warning', title: t('guide.button.delete'), text: t('guide.text.delete-confirm'), confirmButton: { text: t('guide.button.delete') }, cancelButton: { text: t('guide.button.cancel') } });
308
+ if (!ok)
309
+ return;
310
+ try {
311
+ await guideApi.remove(this.guideId);
312
+ navigate('guide-list');
313
+ }
314
+ catch (error) {
315
+ notify({ message: reasonOf(error), level: 'error' });
316
+ }
317
+ }
318
+ };
319
+ __decorate([
320
+ state(),
321
+ __metadata("design:type", Object)
322
+ ], GuideEditor.prototype, "form", void 0);
323
+ __decorate([
324
+ state(),
325
+ __metadata("design:type", String)
326
+ ], GuideEditor.prototype, "guideId", void 0);
327
+ __decorate([
328
+ state(),
329
+ __metadata("design:type", Array)
330
+ ], GuideEditor.prototype, "conditions", void 0);
331
+ __decorate([
332
+ state(),
333
+ __metadata("design:type", Object)
334
+ ], GuideEditor.prototype, "busy", void 0);
335
+ GuideEditor = __decorate([
336
+ customElement('guide-editor')
337
+ ], GuideEditor);
338
+ export { GuideEditor };
339
+ //# sourceMappingURL=guide-editor.js.map
@@ -0,0 +1,45 @@
1
+ import '@operato/data-grist/ox-grist.js';
2
+ import { PageView } from '@operato/shell';
3
+ declare const GuideList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
4
+ /**
5
+ * 화면 안내 — the guides of the domain for their writers (ADR-0212 decision 7). A row opens in the editor; an
6
+ * announcement carries one to its people.
7
+ */
8
+ export declare class GuideList extends GuideList_base {
9
+ static styles: import("lit").CSSResult[];
10
+ gristConfig: any;
11
+ private grist;
12
+ get context(): {
13
+ title: string;
14
+ menu: string;
15
+ actions: {
16
+ id: string;
17
+ title: string;
18
+ icon: string;
19
+ emphasis: {
20
+ raised: boolean;
21
+ };
22
+ action: () => Promise<boolean>;
23
+ }[];
24
+ };
25
+ render(): import("lit-html").TemplateResult<1>;
26
+ pageUpdated(changes: any): Promise<void>;
27
+ pageInitialized(): Promise<void>;
28
+ fetchHandler(): Promise<{
29
+ total: number;
30
+ records: {
31
+ stepCount: number;
32
+ conditionLabel: string;
33
+ id: string;
34
+ name: string;
35
+ opening: string;
36
+ steps: import("../index.js").GuideStep[];
37
+ condition?: string | null;
38
+ updatedAt?: string;
39
+ updater?: {
40
+ name?: string;
41
+ } | null;
42
+ }[];
43
+ }>;
44
+ }
45
+ export {};
@@ -0,0 +1,74 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/data-grist/ox-grist.js';
3
+ import { html } from 'lit';
4
+ import { customElement, query, state } from 'lit/decorators.js';
5
+ import { DataGrist } from '@operato/data-grist';
6
+ import { i18next, localize } from '@operato/i18n';
7
+ import { navigate, PageView } from '@operato/shell';
8
+ import { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
9
+ import { isMobileDevice } from '@operato/utils';
10
+ import { guideApi } from '../guide/guide-api.js';
11
+ import { t } from '../guide/guide-words.js';
12
+ /**
13
+ * 화면 안내 — the guides of the domain for their writers (ADR-0212 decision 7). A row opens in the editor; an
14
+ * announcement carries one to its people.
15
+ */
16
+ let GuideList = class GuideList extends localize(i18next)(PageView) {
17
+ static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, ScrollbarStyles]; }
18
+ get context() {
19
+ return {
20
+ title: t('guide.title.list'),
21
+ /* Opened from 공지 관리 - announcements carry guides to their people; the menu marks 공지사항. */
22
+ menu: 'announcement-list',
23
+ actions: [{ id: 'new-guide', title: t('guide.button.new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('guide-editor') }]
24
+ };
25
+ }
26
+ render() {
27
+ return html `<ox-grist class="page-fill" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>`;
28
+ }
29
+ async pageUpdated(changes) {
30
+ if (this.active && changes.active && this.gristConfig)
31
+ this.grist?.fetch();
32
+ }
33
+ async pageInitialized() {
34
+ const readonly = (type, name, header, width, extra = {}) => ({ type, name, header, width, ...extra, record: { editable: false, ...extra.record } });
35
+ this.gristConfig = {
36
+ rows: { appendable: false, selectable: false, handlers: { click: (_c, _d, _col, record) => record?.id && navigate(`guide-editor?id=${record.id}`) } },
37
+ pagination: { infinite: true },
38
+ emptyNote: { title: t('guide.text.list-empty'), description: t('guide.text.list-empty-description') },
39
+ list: { fields: ['name', 'opening'], details: ['stepCount', 'conditionLabel'] },
40
+ columns: [
41
+ readonly('string', 'name', t('guide.field.name'), 240),
42
+ readonly('string', 'opening', t('guide.field.opening'), 360),
43
+ readonly('integer', 'stepCount', t('guide.field.step-count'), 80, { record: { align: 'right' } }),
44
+ readonly('string', 'conditionLabel', t('guide.field.condition'), 280),
45
+ readonly('string', 'updatedAt', t('guide.field.updated-at'), 140, {
46
+ record: { renderer: (value) => (value ? new Date(value).toLocaleString(i18next.language, { dateStyle: 'medium', timeStyle: 'short' }) : '') }
47
+ })
48
+ ]
49
+ };
50
+ }
51
+ async fetchHandler() {
52
+ const [rows, conditions] = await Promise.all([guideApi.list(), guideApi.conditions()]);
53
+ const labels = new Map(conditions.map(one => [one.id, one.label]));
54
+ const records = rows.map(row => ({
55
+ ...row,
56
+ stepCount: row.steps?.length ?? 0,
57
+ conditionLabel: row.condition ? (labels.get(row.condition) ?? row.condition) : t('guide.text.no-condition')
58
+ }));
59
+ return { total: records.length, records };
60
+ }
61
+ };
62
+ __decorate([
63
+ state(),
64
+ __metadata("design:type", Object)
65
+ ], GuideList.prototype, "gristConfig", void 0);
66
+ __decorate([
67
+ query('ox-grist'),
68
+ __metadata("design:type", DataGrist)
69
+ ], GuideList.prototype, "grist", void 0);
70
+ GuideList = __decorate([
71
+ customElement('guide-list')
72
+ ], GuideList);
73
+ export { GuideList };
74
+ //# sourceMappingURL=guide-list.js.map
@@ -3,6 +3,12 @@ export default function route(page) {
3
3
  case 'help':
4
4
  import('@operato/help/ox-help-home.js');
5
5
  return page;
6
+ case 'guide-list':
7
+ import('./pages/guide-list.js');
8
+ return page;
9
+ case 'guide-editor':
10
+ import('./pages/guide-editor.js');
11
+ return page;
6
12
  }
7
13
  }
8
14
  //# sourceMappingURL=route.js.map
@@ -2,3 +2,5 @@ import './routes.js';
2
2
  export * from './help-index.js';
3
3
  export { helpIndex, searchHelp, readHelp } from './help-store.js';
4
4
  export { registerHelpSource, invalidateHelpSource, type HelpSource } from './help-sources.js';
5
+ export * from './service/index.js';
6
+ export { ROLE_TASKS as GUIDE_ROLE_TASKS } from './role-tasks.js';
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invalidateHelpSource = exports.registerHelpSource = exports.readHelp = exports.searchHelp = exports.helpIndex = void 0;
3
+ exports.GUIDE_ROLE_TASKS = exports.invalidateHelpSource = exports.registerHelpSource = exports.readHelp = exports.searchHelp = exports.helpIndex = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  require("./routes.js");
6
+ const auth_base_1 = require("@things-factory/auth-base");
7
+ const role_tasks_js_1 = require("./role-tasks.js");
8
+ for (const task of role_tasks_js_1.ROLE_TASKS)
9
+ (0, auth_base_1.registerRoleTask)(task);
6
10
  tslib_1.__exportStar(require("./help-index.js"), exports);
7
11
  var help_store_js_1 = require("./help-store.js");
8
12
  Object.defineProperty(exports, "helpIndex", { enumerable: true, get: function () { return help_store_js_1.helpIndex; } });
@@ -11,4 +15,7 @@ Object.defineProperty(exports, "readHelp", { enumerable: true, get: function ()
11
15
  var help_sources_js_1 = require("./help-sources.js");
12
16
  Object.defineProperty(exports, "registerHelpSource", { enumerable: true, get: function () { return help_sources_js_1.registerHelpSource; } });
13
17
  Object.defineProperty(exports, "invalidateHelpSource", { enumerable: true, get: function () { return help_sources_js_1.invalidateHelpSource; } });
18
+ tslib_1.__exportStar(require("./service/index.js"), exports);
19
+ var role_tasks_js_2 = require("./role-tasks.js");
20
+ Object.defineProperty(exports, "GUIDE_ROLE_TASKS", { enumerable: true, get: function () { return role_tasks_js_2.ROLE_TASKS; } });
14
21
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import type { RoleTask } from '@things-factory/auth-base';
2
+ export declare const ROLE_TASKS: RoleTask[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /*
3
+ * The work this module names, for the seats applications build (ADR-0139 decision 11): writing screen guides
4
+ * (ADR-0212 decision 7). Reading one is no task - the people an announcement leads through it read its steps.
5
+ *
6
+ * Data only - `server/index.ts` registers it - so an application's tests read it without starting the framework.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ROLE_TASKS = void 0;
10
+ exports.ROLE_TASKS = [{ id: 'guide.writing', grants: [{ category: 'guide', axes: ['mutation'] }] }];
11
+ //# sourceMappingURL=role-tasks.js.map
@@ -0,0 +1,21 @@
1
+ import type { EntityManager } from 'typeorm';
2
+ export interface GuideConditionInput {
3
+ domain: {
4
+ id: string;
5
+ };
6
+ userId: string;
7
+ tx?: EntityManager;
8
+ }
9
+ export interface GuideCondition {
10
+ /** `<module>.<what is true>` - `asset.keeps-computer`. */
11
+ id: string;
12
+ /** A translation key of the declaring module - 「본인이 관리하는 사용 중인 컴퓨터가 1건 이상 등록됨」. */
13
+ labelKey: string;
14
+ check(input: GuideConditionInput): Promise<boolean>;
15
+ }
16
+ /** What a module calls at load. Declaring the same id again replaces it. */
17
+ export declare function registerGuideCondition(condition: GuideCondition): void;
18
+ export declare function guideCondition(id: string): GuideCondition | undefined;
19
+ export declare function guideConditions(): GuideCondition[];
20
+ /** Whether the person has done what the condition asks. No condition: nothing to check here - the guide is done by its last step. */
21
+ export declare function conditionMet(id: string | null | undefined, input: GuideConditionInput): Promise<boolean>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerGuideCondition = registerGuideCondition;
4
+ exports.guideCondition = guideCondition;
5
+ exports.guideConditions = guideConditions;
6
+ exports.conditionMet = conditionMet;
7
+ const CONDITIONS = new Map();
8
+ /** What a module calls at load. Declaring the same id again replaces it. */
9
+ function registerGuideCondition(condition) {
10
+ CONDITIONS.set(condition.id, condition);
11
+ }
12
+ function guideCondition(id) {
13
+ return CONDITIONS.get(id);
14
+ }
15
+ function guideConditions() {
16
+ return [...CONDITIONS.values()];
17
+ }
18
+ /** Whether the person has done what the condition asks. No condition: nothing to check here - the guide is done by its last step. */
19
+ async function conditionMet(id, input) {
20
+ if (!id)
21
+ return true;
22
+ const condition = CONDITIONS.get(id);
23
+ if (!condition)
24
+ return false;
25
+ return (await condition.check(input)) === true;
26
+ }
27
+ //# sourceMappingURL=guide-conditions.js.map
@@ -0,0 +1,12 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Guide } from './guide';
3
+ import { GuideConditionChoice, GuideInput } from './guide-types';
4
+ export declare class GuideResolver {
5
+ guide(id: string, context: ResolverContext): Promise<Guide | null>;
6
+ guides(context: ResolverContext): Promise<Guide[]>;
7
+ guideConditions(context: ResolverContext): Promise<GuideConditionChoice[]>;
8
+ guideMet(id: string, context: ResolverContext): Promise<boolean>;
9
+ saveGuide(input: GuideInput, id: string, context: ResolverContext): Promise<Guide>;
10
+ deleteGuide(id: string, context: ResolverContext): Promise<boolean>;
11
+ updater(one: Guide): Promise<User | null>;
12
+ }