@coffer-org/plugin-documents 3.1.0 → 3.1.2
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/index.js +1 -1
- package/dist/personal_document/index.js +1 -1
- package/dist/schema.js +25 -5
- package/locales/en.json +62 -0
- package/locales/ru.json +62 -0
- package/locales/uk.json +62 -0
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export default defineShelf({
|
|
|
10
10
|
},
|
|
11
11
|
fields: [
|
|
12
12
|
field.title({ key: 'name', label: 'core.fields.name' }),
|
|
13
|
-
field.
|
|
13
|
+
field.avatar({ key: 'logo', label: 'documents.personal_document.fields.logo', role: 'avatar' }),
|
|
14
14
|
field.text({ key: 'description', label: 'documents.personal_document.fields.description', rules: { max: 1000 } }),
|
|
15
15
|
field.string({ key: 'surname', label: 'documents.personal_document.fields.surname', rules: { max: 100 } }),
|
|
16
16
|
field.string({ key: 'given_names', label: 'documents.personal_document.fields.given_names', rules: { max: 200 } }),
|
package/dist/schema.js
CHANGED
|
@@ -4946,7 +4946,8 @@ function source(raw) {
|
|
|
4946
4946
|
hints: {
|
|
4947
4947
|
ext,
|
|
4948
4948
|
maxBytes,
|
|
4949
|
-
noEditControl: true
|
|
4949
|
+
noEditControl: true,
|
|
4950
|
+
...o.key ? { fileName: o.key } : {}
|
|
4950
4951
|
},
|
|
4951
4952
|
zod: optionalize(s, required)
|
|
4952
4953
|
});
|
|
@@ -6425,10 +6426,27 @@ function select(raw) {
|
|
|
6425
6426
|
zod: optionalize(s, required)
|
|
6426
6427
|
}, o.multiple ?? false));
|
|
6427
6428
|
}
|
|
6429
|
+
/**
|
|
6430
|
+
* Reject anything beyond a flat equality map: an operator key (`$in`, `$and`, …), an
|
|
6431
|
+
* object-valued entry (which is how a nested operator like `{ type: { $in: [...] } }`
|
|
6432
|
+
* would smuggle itself in), or an explicit `undefined` value all throw, naming the
|
|
6433
|
+
* offending key. `undefined` is rejected alongside objects because it would otherwise
|
|
6434
|
+
* slip through every later layer unnoticed: `Condition` types it as a valid value,
|
|
6435
|
+
* `conditionKeys` skips it so compose validates nothing against the target shelf, and
|
|
6436
|
+
* the picker's query-string builder turns it into the literal string `'undefined'`
|
|
6437
|
+
* (an empty picker with no error anywhere).
|
|
6438
|
+
*/
|
|
6439
|
+
function assertFlatEqualityFilter(filter) {
|
|
6440
|
+
for (const [key, value] of Object.entries(filter)) {
|
|
6441
|
+
if (key.startsWith("$")) throw new Error(`[relation] filter key '${key}' is an operator — only flat equality is allowed here`);
|
|
6442
|
+
if (value === void 0 || value !== null && typeof value === "object") throw new Error(`[relation] filter key '${key}' has a non-scalar value — only flat equality is allowed here`);
|
|
6443
|
+
}
|
|
6444
|
+
}
|
|
6428
6445
|
function relation(raw) {
|
|
6429
6446
|
const o = normalizeOpts(raw);
|
|
6430
6447
|
const required = o.required ?? false;
|
|
6431
6448
|
const multi = o.multiple ?? false;
|
|
6449
|
+
if (raw.options.filter) assertFlatEqualityFilter(raw.options.filter);
|
|
6432
6450
|
let s;
|
|
6433
6451
|
if (multi) s = unknown().superRefine((raw, ctx) => {
|
|
6434
6452
|
const arr = jsonValue(raw);
|
|
@@ -6450,7 +6468,8 @@ function relation(raw) {
|
|
|
6450
6468
|
},
|
|
6451
6469
|
relation: {
|
|
6452
6470
|
library: raw.options.library,
|
|
6453
|
-
shelf: raw.options.shelf
|
|
6471
|
+
shelf: raw.options.shelf,
|
|
6472
|
+
...raw.options.filter && { filter: raw.options.filter }
|
|
6454
6473
|
},
|
|
6455
6474
|
...multi && { json: true },
|
|
6456
6475
|
zod: optionalize(s, required)
|
|
@@ -7977,9 +7996,10 @@ var personal_document_default = defineShelf({
|
|
|
7977
7996
|
key: "name",
|
|
7978
7997
|
label: "core.fields.name"
|
|
7979
7998
|
}),
|
|
7980
|
-
field.
|
|
7999
|
+
field.avatar({
|
|
7981
8000
|
key: "logo",
|
|
7982
|
-
label: "documents.personal_document.fields.logo"
|
|
8001
|
+
label: "documents.personal_document.fields.logo",
|
|
8002
|
+
role: "avatar"
|
|
7983
8003
|
}),
|
|
7984
8004
|
field.text({
|
|
7985
8005
|
key: "description",
|
|
@@ -8168,7 +8188,7 @@ nationality — ISO alpha-2. variants — given/family name per language (field.
|
|
|
8168
8188
|
var src_default = definePlugin({
|
|
8169
8189
|
id: "documents",
|
|
8170
8190
|
version: "1.0.0",
|
|
8171
|
-
dependsOn: ["people"],
|
|
8191
|
+
dependsOn: ["people", "things"],
|
|
8172
8192
|
libraries: [{
|
|
8173
8193
|
meta: defineLibrary({
|
|
8174
8194
|
id: "documents",
|
package/locales/en.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"documents": {
|
|
3
|
+
"plugin": {
|
|
4
|
+
"label": "Documents",
|
|
5
|
+
"description": "Personal documents and identity."
|
|
6
|
+
},
|
|
7
|
+
"library": {
|
|
8
|
+
"label": "Documents"
|
|
9
|
+
},
|
|
10
|
+
"person_identity": {
|
|
11
|
+
"label": "Identity",
|
|
12
|
+
"fields": {
|
|
13
|
+
"nationality": "Nationality",
|
|
14
|
+
"variants": "Variants (languages)"
|
|
15
|
+
},
|
|
16
|
+
"variants": {
|
|
17
|
+
"lang": "Language",
|
|
18
|
+
"name": "First name",
|
|
19
|
+
"surname": "Last name"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"personal_document": {
|
|
23
|
+
"label": "Document",
|
|
24
|
+
"fields": {
|
|
25
|
+
"logo": "Front side",
|
|
26
|
+
"description": "Description",
|
|
27
|
+
"surname": "Surname",
|
|
28
|
+
"given_names": "Given names",
|
|
29
|
+
"sex": "Sex",
|
|
30
|
+
"birth_date": "Date of birth",
|
|
31
|
+
"nationality": "Nationality",
|
|
32
|
+
"number": "Document number",
|
|
33
|
+
"record_no": "Record No.",
|
|
34
|
+
"issued": "Date of issue",
|
|
35
|
+
"expires": "Expiry date",
|
|
36
|
+
"authority": "Issuing authority",
|
|
37
|
+
"storage": "Storage location",
|
|
38
|
+
"mrz": "MRZ (machine-readable zone)",
|
|
39
|
+
"owner": "Owner",
|
|
40
|
+
"photos": "Other photos",
|
|
41
|
+
"notes": "Notes",
|
|
42
|
+
"tags": "Tags"
|
|
43
|
+
},
|
|
44
|
+
"options": {
|
|
45
|
+
"sex": {
|
|
46
|
+
"M": "Male",
|
|
47
|
+
"F": "Female"
|
|
48
|
+
},
|
|
49
|
+
"type": {
|
|
50
|
+
"P": "Passport",
|
|
51
|
+
"PA": "Passport (biometric)",
|
|
52
|
+
"TP": "Temporary protection",
|
|
53
|
+
"ID": "ID card",
|
|
54
|
+
"DL": "Driver's licence",
|
|
55
|
+
"BR": "Birth certificate",
|
|
56
|
+
"MC": "Medical card / policy",
|
|
57
|
+
"OT": "Other"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
package/locales/ru.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"documents": {
|
|
3
|
+
"plugin": {
|
|
4
|
+
"label": "Документы",
|
|
5
|
+
"description": "Личные документы и идентичность."
|
|
6
|
+
},
|
|
7
|
+
"library": {
|
|
8
|
+
"label": "Документы"
|
|
9
|
+
},
|
|
10
|
+
"person_identity": {
|
|
11
|
+
"label": "Идентичность",
|
|
12
|
+
"fields": {
|
|
13
|
+
"nationality": "Гражданство",
|
|
14
|
+
"variants": "Варианты (языки)"
|
|
15
|
+
},
|
|
16
|
+
"variants": {
|
|
17
|
+
"lang": "Язык",
|
|
18
|
+
"name": "Имя",
|
|
19
|
+
"surname": "Фамилия"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"personal_document": {
|
|
23
|
+
"label": "Документ",
|
|
24
|
+
"fields": {
|
|
25
|
+
"logo": "Лицевая сторона",
|
|
26
|
+
"description": "Описание",
|
|
27
|
+
"surname": "Фамилия",
|
|
28
|
+
"given_names": "Имя и отчество",
|
|
29
|
+
"sex": "Пол",
|
|
30
|
+
"birth_date": "Дата рождения",
|
|
31
|
+
"nationality": "Гражданство",
|
|
32
|
+
"number": "Номер документа",
|
|
33
|
+
"record_no": "Запись №",
|
|
34
|
+
"issued": "Выдан",
|
|
35
|
+
"expires": "Действителен до",
|
|
36
|
+
"authority": "Кем выдан",
|
|
37
|
+
"storage": "Место хранения",
|
|
38
|
+
"mrz": "MRZ (строка)",
|
|
39
|
+
"owner": "Владелец",
|
|
40
|
+
"photos": "Другие фото",
|
|
41
|
+
"notes": "Заметки",
|
|
42
|
+
"tags": "Теги"
|
|
43
|
+
},
|
|
44
|
+
"options": {
|
|
45
|
+
"sex": {
|
|
46
|
+
"M": "Мужской",
|
|
47
|
+
"F": "Женский"
|
|
48
|
+
},
|
|
49
|
+
"type": {
|
|
50
|
+
"P": "Паспорт",
|
|
51
|
+
"PA": "Паспорт (биометрический)",
|
|
52
|
+
"TP": "Временная защита",
|
|
53
|
+
"ID": "ID-карта",
|
|
54
|
+
"DL": "Водительское удостоверение",
|
|
55
|
+
"BR": "Свидетельство о рождении",
|
|
56
|
+
"MC": "Медицинская карта / полис",
|
|
57
|
+
"OT": "Другое"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
package/locales/uk.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"documents": {
|
|
3
|
+
"plugin": {
|
|
4
|
+
"label": "Документи",
|
|
5
|
+
"description": "Особисті документи та ідентичність."
|
|
6
|
+
},
|
|
7
|
+
"library": {
|
|
8
|
+
"label": "Документи"
|
|
9
|
+
},
|
|
10
|
+
"person_identity": {
|
|
11
|
+
"label": "Ідентичність",
|
|
12
|
+
"fields": {
|
|
13
|
+
"nationality": "Громадянство",
|
|
14
|
+
"variants": "Варіанти (мови)"
|
|
15
|
+
},
|
|
16
|
+
"variants": {
|
|
17
|
+
"lang": "Мова",
|
|
18
|
+
"name": "Ім'я",
|
|
19
|
+
"surname": "Прізвище"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"personal_document": {
|
|
23
|
+
"label": "Документ",
|
|
24
|
+
"fields": {
|
|
25
|
+
"logo": "Лицьова сторона",
|
|
26
|
+
"description": "Опис",
|
|
27
|
+
"surname": "Прізвище",
|
|
28
|
+
"given_names": "Ім'я та по батькові",
|
|
29
|
+
"sex": "Стать",
|
|
30
|
+
"birth_date": "Дата народження",
|
|
31
|
+
"nationality": "Громадянство",
|
|
32
|
+
"number": "Номер документа",
|
|
33
|
+
"record_no": "Запис №",
|
|
34
|
+
"issued": "Виданий",
|
|
35
|
+
"expires": "Дійсний до",
|
|
36
|
+
"authority": "Ким виданий",
|
|
37
|
+
"storage": "Де зберігається",
|
|
38
|
+
"mrz": "MRZ (машиночитаємий рядок)",
|
|
39
|
+
"owner": "Власник",
|
|
40
|
+
"photos": "Інші фото",
|
|
41
|
+
"notes": "Нотатки",
|
|
42
|
+
"tags": "Теги"
|
|
43
|
+
},
|
|
44
|
+
"options": {
|
|
45
|
+
"sex": {
|
|
46
|
+
"M": "Чоловіча",
|
|
47
|
+
"F": "Жіноча"
|
|
48
|
+
},
|
|
49
|
+
"type": {
|
|
50
|
+
"P": "Паспорт",
|
|
51
|
+
"PA": "Паспорт (біометричний)",
|
|
52
|
+
"TP": "Тимчасовий захист",
|
|
53
|
+
"ID": "ID-картка",
|
|
54
|
+
"DL": "Посвідчення водія",
|
|
55
|
+
"BR": "Свідоцтво про народження",
|
|
56
|
+
"MC": "Медична картка / полюс",
|
|
57
|
+
"OT": "Інше"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffer-org/plugin-documents",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
-
"seed"
|
|
10
|
+
"seed",
|
|
11
|
+
"locales"
|
|
11
12
|
],
|
|
12
13
|
"exports": {
|
|
13
14
|
".": {
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"postpack": "node ../../scripts/swap-exports.mjs src"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@coffer-org/plugin-people": "^3.1.
|
|
29
|
+
"@coffer-org/plugin-people": "^3.1.2",
|
|
29
30
|
"@coffer-org/sdk": "^3.0.0",
|
|
30
31
|
"@coffer-org/server": "^3.0.0"
|
|
31
32
|
},
|