@coffer-org/plugin-transit 3.0.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/bus_route/index.js +2 -1
- package/dist/schema.js +30 -6
- package/locales/en.json +33 -0
- package/locales/ru.json +33 -0
- package/locales/uk.json +33 -0
- package/package.json +3 -2
package/dist/bus_route/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export default defineShelf({
|
|
|
10
10
|
},
|
|
11
11
|
fields: [
|
|
12
12
|
field.title({ key: 'name', label: 'core.fields.name' }),
|
|
13
|
+
field.text({ key: 'description', label: 'transit.bus_route.fields.description', rules: { max: 1000 } }),
|
|
13
14
|
field.int({ key: 'route_number', label: 'transit.bus_route.fields.route_number' }),
|
|
14
15
|
field.string({ key: 'from', label: 'transit.bus_route.fields.from', rules: { max: 100 } }),
|
|
15
16
|
field.string({ key: 'to', label: 'transit.bus_route.fields.to', rules: { max: 100 } }),
|
|
@@ -17,7 +18,7 @@ export default defineShelf({
|
|
|
17
18
|
field.time({ key: 'weekday_times', label: 'transit.bus_route.fields.weekday_times', multiple: true }),
|
|
18
19
|
field.time({ key: 'saturday_times', label: 'transit.bus_route.fields.saturday_times', multiple: true }),
|
|
19
20
|
field.time({ key: 'sunday_times', label: 'transit.bus_route.fields.sunday_times', multiple: true }),
|
|
20
|
-
field.text({ key: 'notes', label: 'transit.bus_route.fields.notes', rules: { max: 500 } }),
|
|
21
21
|
field.tags({ key: 'tags', label: 'transit.bus_route.fields.tags' }),
|
|
22
|
+
field.text({ key: 'notes', label: 'transit.bus_route.fields.notes', rules: { max: 500 } }),
|
|
22
23
|
],
|
|
23
24
|
});
|
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)
|
|
@@ -7987,6 +8006,11 @@ var bus_route_default = defineShelf({
|
|
|
7987
8006
|
key: "name",
|
|
7988
8007
|
label: "core.fields.name"
|
|
7989
8008
|
}),
|
|
8009
|
+
field.text({
|
|
8010
|
+
key: "description",
|
|
8011
|
+
label: "transit.bus_route.fields.description",
|
|
8012
|
+
rules: { max: 1e3 }
|
|
8013
|
+
}),
|
|
7990
8014
|
field.int({
|
|
7991
8015
|
key: "route_number",
|
|
7992
8016
|
label: "transit.bus_route.fields.route_number"
|
|
@@ -8021,14 +8045,14 @@ var bus_route_default = defineShelf({
|
|
|
8021
8045
|
label: "transit.bus_route.fields.sunday_times",
|
|
8022
8046
|
multiple: true
|
|
8023
8047
|
}),
|
|
8048
|
+
field.tags({
|
|
8049
|
+
key: "tags",
|
|
8050
|
+
label: "transit.bus_route.fields.tags"
|
|
8051
|
+
}),
|
|
8024
8052
|
field.text({
|
|
8025
8053
|
key: "notes",
|
|
8026
8054
|
label: "transit.bus_route.fields.notes",
|
|
8027
8055
|
rules: { max: 500 }
|
|
8028
|
-
}),
|
|
8029
|
-
field.tags({
|
|
8030
|
-
key: "tags",
|
|
8031
|
-
label: "transit.bus_route.fields.tags"
|
|
8032
8056
|
})
|
|
8033
8057
|
]
|
|
8034
8058
|
});
|
package/locales/en.json
ADDED
|
@@ -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
|
+
}
|
package/locales/ru.json
ADDED
|
@@ -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/locales/uk.json
ADDED
|
@@ -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