@coffer-org/plugin-documents 1.2.3 → 1.3.0
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 +55 -10
- package/package.json +3 -3
package/dist/schema.js
CHANGED
|
@@ -4466,7 +4466,15 @@ function jsonRefined(inner, code) {
|
|
|
4466
4466
|
});
|
|
4467
4467
|
}
|
|
4468
4468
|
function optionalize(schema, required) {
|
|
4469
|
-
|
|
4469
|
+
const req = required === true;
|
|
4470
|
+
const pre = (v) => v === "" || v === null ? void 0 : v;
|
|
4471
|
+
if (!req) return preprocess(pre, schema.optional());
|
|
4472
|
+
return preprocess(pre, unknown().superRefine((v, ctx) => {
|
|
4473
|
+
if (v === void 0) ctx.addIssue({
|
|
4474
|
+
code: ZodIssueCode.custom,
|
|
4475
|
+
message: vmsg("required")
|
|
4476
|
+
});
|
|
4477
|
+
}).pipe(schema));
|
|
4470
4478
|
}
|
|
4471
4479
|
//#endregion
|
|
4472
4480
|
//#region ../sdk/src/fields/normalize.ts
|
|
@@ -4575,6 +4583,29 @@ function password(raw) {
|
|
|
4575
4583
|
zod: optionalize(s, required)
|
|
4576
4584
|
});
|
|
4577
4585
|
}
|
|
4586
|
+
/**
|
|
4587
|
+
* Internal API-token list — keyValue-shaped collection (name + write-only
|
|
4588
|
+
* token + timestamps), custom renderer (`kind:'internalApiToken'`, own
|
|
4589
|
+
* create/revoke UI — same trick as url()/perWeekday()). "Internal" = not a
|
|
4590
|
+
* general-purpose field type for plugin modules, only for the core account
|
|
4591
|
+
* settings page. `token` is `kind:'password'` so maskSecrets/preserveTree
|
|
4592
|
+
* already mask/preserve it for free.
|
|
4593
|
+
*/
|
|
4594
|
+
function internalApiToken(o) {
|
|
4595
|
+
return group({
|
|
4596
|
+
key: o.key,
|
|
4597
|
+
label: o.label ?? o.key,
|
|
4598
|
+
multiple: true,
|
|
4599
|
+
rules: { unique: ["name"] },
|
|
4600
|
+
view: { kind: "internalApiToken" },
|
|
4601
|
+
fields: [
|
|
4602
|
+
string({ key: "name" }),
|
|
4603
|
+
password({ key: "token" }),
|
|
4604
|
+
string({ key: "createdAt" }),
|
|
4605
|
+
string({ key: "lastUsedAt" })
|
|
4606
|
+
]
|
|
4607
|
+
});
|
|
4608
|
+
}
|
|
4578
4609
|
var SLUG_RE = /^[a-z0-9-]+$/;
|
|
4579
4610
|
function slug(raw) {
|
|
4580
4611
|
const o = normalizeOpts(raw);
|
|
@@ -5003,7 +5034,8 @@ var presets = {
|
|
|
5003
5034
|
year,
|
|
5004
5035
|
weight,
|
|
5005
5036
|
dimensions,
|
|
5006
|
-
country
|
|
5037
|
+
country,
|
|
5038
|
+
internalApiToken
|
|
5007
5039
|
};
|
|
5008
5040
|
//#endregion
|
|
5009
5041
|
//#region ../../node_modules/iso-639-1/src/data.js
|
|
@@ -6360,20 +6392,21 @@ function check(raw) {
|
|
|
6360
6392
|
const multiple = o.multiple ?? false;
|
|
6361
6393
|
const slots = o.slots && o.slots.length > 0 ? o.slots : [""];
|
|
6362
6394
|
if (multiple) {
|
|
6363
|
-
const fields =
|
|
6364
|
-
key: "text",
|
|
6365
|
-
label: "core.fields.text"
|
|
6366
|
-
})];
|
|
6367
|
-
slots.forEach((label, i) => fields.push(boolean({
|
|
6395
|
+
const fields = slots.map((label, i) => boolean({
|
|
6368
6396
|
key: `check${i}`,
|
|
6369
6397
|
label: label || "core.fields.check"
|
|
6370
|
-
}))
|
|
6398
|
+
}));
|
|
6399
|
+
fields.push(string({
|
|
6400
|
+
key: "text",
|
|
6401
|
+
label: "core.fields.text"
|
|
6402
|
+
}));
|
|
6371
6403
|
return group({
|
|
6372
6404
|
key: o.key,
|
|
6373
6405
|
label: o.label ?? o.key,
|
|
6374
6406
|
multiple: true,
|
|
6375
6407
|
required,
|
|
6376
|
-
fields
|
|
6408
|
+
fields,
|
|
6409
|
+
view: { kind: "checklist" }
|
|
6377
6410
|
});
|
|
6378
6411
|
}
|
|
6379
6412
|
const shape = { text: string$1() };
|
|
@@ -6549,10 +6582,18 @@ function geo(raw) {
|
|
|
6549
6582
|
const rowSchema = object({
|
|
6550
6583
|
lat: number$1().min(-90).max(90),
|
|
6551
6584
|
lng: number$1().min(-180).max(180),
|
|
6552
|
-
label: string$1().
|
|
6585
|
+
label: string$1().nullish()
|
|
6553
6586
|
});
|
|
6554
6587
|
const s = unknown().superRefine((raw, ctx) => {
|
|
6555
6588
|
const parsed = jsonValue(raw);
|
|
6589
|
+
const p = parsed;
|
|
6590
|
+
if (p == null || typeof p === "object" && p.lat == null && p.lng == null) {
|
|
6591
|
+
if (required) ctx.addIssue({
|
|
6592
|
+
code: ZodIssueCode.custom,
|
|
6593
|
+
message: vmsg("required")
|
|
6594
|
+
});
|
|
6595
|
+
return;
|
|
6596
|
+
}
|
|
6556
6597
|
if (typeof parsed === "string") {
|
|
6557
6598
|
ctx.addIssue({
|
|
6558
6599
|
code: ZodIssueCode.custom,
|
|
@@ -6759,6 +6800,9 @@ function avatar(o) {
|
|
|
6759
6800
|
function cover(o) {
|
|
6760
6801
|
return makeFile("cover", o);
|
|
6761
6802
|
}
|
|
6803
|
+
function poster(o) {
|
|
6804
|
+
return makeFile("poster", o);
|
|
6805
|
+
}
|
|
6762
6806
|
function keyValue(raw) {
|
|
6763
6807
|
const o = normalizeOpts(raw);
|
|
6764
6808
|
const valueType = {
|
|
@@ -6912,6 +6956,7 @@ var PRIMITIVES = {
|
|
|
6912
6956
|
media,
|
|
6913
6957
|
avatar,
|
|
6914
6958
|
cover,
|
|
6959
|
+
poster,
|
|
6915
6960
|
embed,
|
|
6916
6961
|
keyValue,
|
|
6917
6962
|
numberRange,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffer-org/plugin-documents",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"postpack": "node ../../scripts/swap-exports.mjs src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@coffer-org/sdk": "^1.
|
|
29
|
-
"@coffer-org/server": "^1.
|
|
28
|
+
"@coffer-org/sdk": "^1.3.0",
|
|
29
|
+
"@coffer-org/server": "^1.3.0"
|
|
30
30
|
},
|
|
31
31
|
"coffer": {
|
|
32
32
|
"schema": "dist/schema.js"
|