@coffer-org/plugin-telegram 2.2.2 → 2.2.3

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.
Files changed (2) hide show
  1. package/dist/schema.js +29 -11
  2. package/package.json +4 -4
package/dist/schema.js CHANGED
@@ -6426,15 +6426,23 @@ function check(raw) {
6426
6426
  const required = o.required ?? false;
6427
6427
  const multiple = o.multiple ?? false;
6428
6428
  const slots = o.slots && o.slots.length > 0 ? o.slots : [""];
6429
+ const contentFields = o.fields?.length ? o.fields : [string({
6430
+ key: "text",
6431
+ label: "core.fields.text"
6432
+ })];
6433
+ const contentKeys = /* @__PURE__ */ new Set();
6434
+ for (const f of contentFields) {
6435
+ if (contentKeys.has(f.key)) throw new Error(`[field.check] duplicate content field '${f.key}'`);
6436
+ if (/^check\d+$/.test(f.key)) throw new Error(`[field.check] content field '${f.key}' is reserved for checkbox slots`);
6437
+ if (!multiple && (f.type.virtual || f.type.columns)) throw new Error(`[field.check] single content field '${f.key}' must be a scalar stored field`);
6438
+ contentKeys.add(f.key);
6439
+ }
6440
+ const checkFields = slots.map((label, i) => boolean({
6441
+ key: `check${i}`,
6442
+ label: label || "core.fields.check"
6443
+ }));
6429
6444
  if (multiple) {
6430
- const fields = slots.map((label, i) => boolean({
6431
- key: `check${i}`,
6432
- label: label || "core.fields.check"
6433
- }));
6434
- fields.push(string({
6435
- key: "text",
6436
- label: "core.fields.text"
6437
- }));
6445
+ const fields = [...checkFields, ...contentFields];
6438
6446
  return group({
6439
6447
  key: o.key,
6440
6448
  label: o.label ?? o.key,
@@ -6444,8 +6452,12 @@ function check(raw) {
6444
6452
  view: { kind: "checklist" }
6445
6453
  });
6446
6454
  }
6447
- const shape = { text: string$1() };
6448
- const columns = { text: "text" };
6455
+ const shape = {};
6456
+ const columns = {};
6457
+ for (const f of contentFields) {
6458
+ shape[f.key] = f.type.zod;
6459
+ columns[f.key] = f.type.column;
6460
+ }
6449
6461
  slots.forEach((_, i) => {
6450
6462
  shape[`check${i}`] = boolean$1();
6451
6463
  columns[`check${i}`] = "boolean";
@@ -6471,7 +6483,13 @@ function check(raw) {
6471
6483
  required,
6472
6484
  prim: "check",
6473
6485
  column: "text",
6474
- hints: { slots },
6486
+ hints: {
6487
+ slots,
6488
+ fields: contentFields.map((f) => ({
6489
+ key: f.key,
6490
+ ...toClient(f.type)
6491
+ }))
6492
+ },
6475
6493
  columns,
6476
6494
  zod: optionalize(s, required)
6477
6495
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffer-org/plugin-telegram",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"
@@ -25,9 +25,9 @@
25
25
  "test": "node --import tsx --test \"src/runtime/*.test.ts\""
26
26
  },
27
27
  "dependencies": {
28
- "@coffer-org/plugin-orchestrator": "^2.3.0",
29
- "@coffer-org/sdk": "^2.1.2",
30
- "@coffer-org/server": "^2.3.0",
28
+ "@coffer-org/plugin-orchestrator": "^2.3.3",
29
+ "@coffer-org/sdk": "^2.1.3",
30
+ "@coffer-org/server": "^2.5.2",
31
31
  "input": "^1.0.1",
32
32
  "teleproto": "^1.228.1"
33
33
  },