@things-factory/inquiry 10.1.253 → 10.1.254
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-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/client/bootstrap.ts +0 -27
- package/client/components/inquiry-thread.ts +0 -277
- package/client/components/inquiry-todo.ts +0 -36
- package/client/components/inquiry-writer.ts +0 -212
- package/client/index.ts +0 -2
- package/client/inquiry-watch.ts +0 -45
- package/client/pages/inquiry-list.ts +0 -218
- package/client/route.ts +0 -8
- package/client/tsconfig.json +0 -13
- package/client/utils/inquiry-api.ts +0 -103
- package/client/utils/inquiry-badge.ts +0 -46
- package/client/utils/inquiry-words.ts +0 -26
- package/server/attachment-reader.ts +0 -18
- package/server/index.ts +0 -18
- package/server/inquiry-activity.ts +0 -35
- package/server/role-tasks.ts +0 -13
- package/server/service/index.ts +0 -19
- package/server/service/inquiry/index.ts +0 -5
- package/server/service/inquiry/inquiry-resolver.ts +0 -321
- package/server/service/inquiry/inquiry-rules.ts +0 -173
- package/server/service/inquiry/inquiry-service.ts +0 -143
- package/server/service/inquiry/inquiry-types.ts +0 -45
- package/server/service/inquiry/inquiry.ts +0 -180
- package/server/tsconfig.json +0 -11
- package/test/inquiry-persistence.test.ts +0 -218
- package/test/inquiry-rules.test.ts +0 -121
- package/test/open-doors.test.ts +0 -44
- package/test/translations.test.ts +0 -53
- package/test/writer-popup-standard.test.ts +0 -40
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Every word inquiries say is in every language the module ships - the keys are strings, so neither tsc nor eslint sees
|
|
3
|
-
* one with no entry. Covers the screens' words, the codes drawn into words (kinds, states, visibility, scopes, moves),
|
|
4
|
-
* the refusals the server says (`inquiry.refusal.<code>`) and the task's words.
|
|
5
|
-
*/
|
|
6
|
-
import { readFileSync, readdirSync } from 'fs'
|
|
7
|
-
import { join } from 'path'
|
|
8
|
-
|
|
9
|
-
const ROOT = join(__dirname, '..')
|
|
10
|
-
const LANGUAGES = ['ko', 'en', 'ja', 'zh', 'es', 'ms']
|
|
11
|
-
|
|
12
|
-
const sources = (dir: string): string[] =>
|
|
13
|
-
readdirSync(dir, { withFileTypes: true }).flatMap(entry => (entry.isDirectory() ? sources(join(dir, entry.name)) : /\.ts$/.test(entry.name) && !/\.test\.ts$/.test(entry.name) ? [join(dir, entry.name)] : []))
|
|
14
|
-
|
|
15
|
-
const text = [...sources(join(ROOT, 'client')), ...sources(join(ROOT, 'server'))].map(file => readFileSync(file, 'utf8')).join('\n')
|
|
16
|
-
const locale = (lang: string): Record<string, string> => JSON.parse(readFileSync(join(ROOT, 'translations', `${lang}.json`), 'utf8'))
|
|
17
|
-
const codes = (name: string) => [...new RegExp(`${name} = \\[([^\\]]*)\\]`).exec(text)![1].matchAll(/'([A-Z_]+)'/g)].map(match => match[1])
|
|
18
|
-
|
|
19
|
-
/* a task id is a name, not a word */
|
|
20
|
-
const used = new Set<string>([...text.matchAll(/'(inquiry\.[a-z0-9.-]+[a-z0-9])'/g)].map(match => match[1]).filter(key => key !== 'inquiry.answering'))
|
|
21
|
-
for (const code of codes('INQUIRY_KINDS')) {
|
|
22
|
-
used.add(`inquiry.kind.${code}`)
|
|
23
|
-
used.add(`inquiry.text.kind-hint-${code.toLowerCase()}`)
|
|
24
|
-
used.add(`inquiry.text.body-placeholder-${code.toLowerCase()}`)
|
|
25
|
-
}
|
|
26
|
-
for (const code of codes('INQUIRY_STATUSES')) used.add(`inquiry.status.${code}`)
|
|
27
|
-
for (const code of codes('INQUIRY_STATUSES').filter(code => code !== 'RECEIVED')) used.add(`inquiry.move.${code}`)
|
|
28
|
-
for (const code of codes('INQUIRY_VISIBILITIES')) used.add(`inquiry.visibility.${code}`)
|
|
29
|
-
for (const scope of ['all', 'mine', 'handlers-turn']) used.add(`inquiry.scope.${scope}`)
|
|
30
|
-
for (const kind of ['received', 'replied', 'answered', 'moved', 'asker-replied']) used.add(`inquiry.notice.${kind}-subject`)
|
|
31
|
-
/* The refusals: those the doors name and those the rules return. */
|
|
32
|
-
for (const [, code] of text.matchAll(/refuse\(context, '([a-z-]+)'/g)) used.add(`inquiry.refusal.${code}`)
|
|
33
|
-
const rules = readFileSync(join(ROOT, 'server/service/inquiry/inquiry-rules.ts'), 'utf8')
|
|
34
|
-
for (const [, code] of rules.matchAll(/return '([a-z-]+)'/g)) if (!['asker', 'handler'].includes(code)) used.add(`inquiry.refusal.${code}`)
|
|
35
|
-
used.add('task.inquiry.answering.name')
|
|
36
|
-
used.add('task.inquiry.answering.description')
|
|
37
|
-
|
|
38
|
-
test('the floor - the parser found the words', () => {
|
|
39
|
-
expect(used.size).toBeGreaterThan(80)
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
test.each(LANGUAGES)('★ every key inquiries name is in %s', lang => {
|
|
43
|
-
const words = locale(lang)
|
|
44
|
-
expect([...used].filter(key => !(key in words))).toEqual([])
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
test.each(LANGUAGES)('a placeholder said in Korean is said in %s too, in the house braces', lang => {
|
|
48
|
-
const ko = locale('ko')
|
|
49
|
-
const words = locale(lang)
|
|
50
|
-
const holes = (said: string) => [...said.matchAll(/\{(\w+)\}/g)].map(match => match[1]).sort()
|
|
51
|
-
expect(Object.keys(ko).filter(key => key in words && holes(ko[key]).join() !== holes(words[key]).join())).toEqual([])
|
|
52
|
-
expect(Object.values(words).filter(said => said.includes('{{'))).toEqual([])
|
|
53
|
-
})
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The writer keeps the house shape of a popup (operato-application design/ui/page-standard.md sections 7, 8), as the
|
|
6
|
-
* user management popups do: only the body scrolls, the one way out and the one main action sit in the shared
|
|
7
|
-
* `ox-popup-actions` row, fields are labels above native inputs, and one-of-several is `ox-input-select-buttons`.
|
|
8
|
-
*/
|
|
9
|
-
const source = readFileSync(path.join(__dirname, '..', 'client', 'components', 'inquiry-writer.ts'), 'utf-8')
|
|
10
|
-
|
|
11
|
-
describe('inquiry-writer', () => {
|
|
12
|
-
it('uses the shared popup styles', () => {
|
|
13
|
-
for (const style of ['CommonPopupStyles', 'PopupBodyStyles', 'FormFieldStyles', 'PopupFieldStyles'])
|
|
14
|
-
expect(source.includes(style)).toBe(true)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('scrolls its body only and ends in the shared action row', () => {
|
|
18
|
-
expect(source.includes('<div class="body">')).toBe(true)
|
|
19
|
-
expect(source.includes("import '@operato/popup/ox-popup-actions.js'")).toBe(true)
|
|
20
|
-
expect((source.match(/<ox-popup-actions>/g) || []).length).toBe(1)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('has exactly one way out and one main action', () => {
|
|
24
|
-
expect((source.match(/slot="cancel"/g) || []).length).toBe(1)
|
|
25
|
-
expect((source.match(/slot="confirm"/g) || []).length).toBe(1)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('picks the kind with the shared select buttons, not buttons of its own', () => {
|
|
29
|
-
expect(source.includes('<ox-input-select-buttons')).toBe(true)
|
|
30
|
-
expect(/aria-pressed|class="kinds"|class="buttons"/.test(source)).toBe(false)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('draws no Material field, checkbox or raised button', () => {
|
|
34
|
-
expect(/<md-(filled|outlined)-text-field|<md-checkbox|<md-elevated-button/.test(source)).toBe(false)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('writes no font size of its own', () => {
|
|
38
|
-
expect(/font-size:\s*[\d.]+(rem|px|em)/.test(source)).toBe(false)
|
|
39
|
-
})
|
|
40
|
-
})
|