@coffer-org/plugin-transit 3.1.0 → 3.1.1

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/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)
@@ -0,0 +1,33 @@
1
+ {
2
+ "transit": {
3
+ "plugin": {
4
+ "label": "Transit",
5
+ "description": "Public transport routes and schedules."
6
+ },
7
+ "library": {
8
+ "label": "Transit"
9
+ },
10
+ "settings": {
11
+ "label": "Sync settings",
12
+ "caldav_calendar": "Calendar URL",
13
+ "caldav_url": "CalDAV server URL",
14
+ "caldav_username": "Username",
15
+ "caldav_password": "Password"
16
+ },
17
+ "bus_route": {
18
+ "label": "Route",
19
+ "fields": {
20
+ "description": "Description",
21
+ "route_number": "Route No.",
22
+ "from": "From",
23
+ "to": "To",
24
+ "stop": "Stop",
25
+ "weekday_times": "Weekdays",
26
+ "saturday_times": "Saturday",
27
+ "sunday_times": "Sunday",
28
+ "notes": "Notes",
29
+ "tags": "Tags"
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "transit": {
3
+ "plugin": {
4
+ "label": "Транспорт",
5
+ "description": "Маршруты общественного транспорта и расписания."
6
+ },
7
+ "library": {
8
+ "label": "Транспорт"
9
+ },
10
+ "settings": {
11
+ "label": "Настройки синхронизации",
12
+ "caldav_calendar": "URL календаря",
13
+ "caldav_url": "URL CalDAV-сервера",
14
+ "caldav_username": "Имя пользователя",
15
+ "caldav_password": "Пароль"
16
+ },
17
+ "bus_route": {
18
+ "label": "Маршрут",
19
+ "fields": {
20
+ "description": "Описание",
21
+ "route_number": "Маршрут №",
22
+ "from": "Откуда",
23
+ "to": "Куда",
24
+ "stop": "Остановка",
25
+ "weekday_times": "Будни",
26
+ "saturday_times": "Суббота",
27
+ "sunday_times": "Воскресенье",
28
+ "notes": "Заметки",
29
+ "tags": "Теги"
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "transit": {
3
+ "plugin": {
4
+ "label": "Транспорт",
5
+ "description": "Маршрути громадського транспорту та розклади."
6
+ },
7
+ "library": {
8
+ "label": "Транспорт"
9
+ },
10
+ "settings": {
11
+ "label": "Налаштування синхронізації",
12
+ "caldav_calendar": "URL календаря",
13
+ "caldav_url": "URL CalDAV-сервера",
14
+ "caldav_username": "Ім'я користувача",
15
+ "caldav_password": "Пароль"
16
+ },
17
+ "bus_route": {
18
+ "label": "Маршрут",
19
+ "fields": {
20
+ "description": "Опис",
21
+ "route_number": "Маршрут №",
22
+ "from": "Звідки",
23
+ "to": "Куди",
24
+ "stop": "Зупинка",
25
+ "weekday_times": "Будні",
26
+ "saturday_times": "Субота",
27
+ "sunday_times": "Неділя",
28
+ "notes": "Нотатки",
29
+ "tags": "Теги"
30
+ }
31
+ }
32
+ }
33
+ }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@coffer-org/plugin-transit",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"
7
7
  },
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "locales"
10
11
  ],
11
12
  "exports": {
12
13
  ".": {