@coffer-org/plugin-documents 3.1.1 → 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 CHANGED
@@ -5,7 +5,7 @@ import personIdentity from "./person_identity/index.js";
5
5
  export default definePlugin({
6
6
  id: 'documents',
7
7
  version: '1.0.0',
8
- dependsOn: ['people'],
8
+ dependsOn: ['people', 'things'],
9
9
  libraries: [
10
10
  {
11
11
  meta: defineLibrary({
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)
@@ -8169,7 +8188,7 @@ nationality — ISO alpha-2. variants — given/family name per language (field.
8169
8188
  var src_default = definePlugin({
8170
8189
  id: "documents",
8171
8190
  version: "1.0.0",
8172
- dependsOn: ["people"],
8191
+ dependsOn: ["people", "things"],
8173
8192
  libraries: [{
8174
8193
  meta: defineLibrary({
8175
8194
  id: "documents",
@@ -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
+ }
@@ -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
+ }
@@ -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.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.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
  },