@coffer-org/plugin-telegram 2.3.0 → 3.0.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.
Files changed (2) hide show
  1. package/dist/schema.js +55 -2
  2. package/package.json +4 -4
package/dist/schema.js CHANGED
@@ -6074,6 +6074,15 @@ function wrapKey(opts, meta) {
6074
6074
  ...m,
6075
6075
  hidden: opts.hidden
6076
6076
  };
6077
+ if (opts.derive) m = {
6078
+ ...m,
6079
+ derive: opts.derive,
6080
+ derived: true,
6081
+ hints: {
6082
+ ...m.hints,
6083
+ noEditControl: true
6084
+ }
6085
+ };
6077
6086
  if (opts.key) return {
6078
6087
  key: opts.key,
6079
6088
  type: m
@@ -6596,6 +6605,47 @@ function measured(raw) {
6596
6605
  zod: optionalize(s, required)
6597
6606
  });
6598
6607
  }
6608
+ function unit(raw) {
6609
+ const o = normalizeOpts(raw);
6610
+ const required = o.required ?? false;
6611
+ const units = resolveUnits(o.options);
6612
+ const s = string$1(reqErr()).refine((v) => units.some((u) => u.value === v), { message: vmsg("measured_unit") });
6613
+ return wrapKey(o, {
6614
+ kind: "unit",
6615
+ label: o.label ?? "",
6616
+ required,
6617
+ prim: "select",
6618
+ column: "text",
6619
+ hints: { source: typeof o.options === "string" ? o.options : null },
6620
+ options: units.map((u) => ({
6621
+ value: u.value,
6622
+ title: u.label
6623
+ })),
6624
+ zod: optionalize(s, required)
6625
+ });
6626
+ }
6627
+ function amount(raw) {
6628
+ const o = normalizeOpts(raw);
6629
+ const required = o.required ?? false;
6630
+ const cfg = o.config ?? {};
6631
+ let s = number(typeErr());
6632
+ if (cfg.min != null) s = s.min(cfg.min, { message: vmsg("min", { min: cfg.min }) });
6633
+ if (cfg.max != null) s = s.max(cfg.max, { message: vmsg("max", { max: cfg.max }) });
6634
+ return wrapKey(o, {
6635
+ kind: "amount",
6636
+ label: o.label ?? "",
6637
+ required,
6638
+ prim: "number",
6639
+ column: "real",
6640
+ hints: {
6641
+ unitFrom: o.unitFrom,
6642
+ min: cfg.min,
6643
+ max: cfg.max,
6644
+ step: cfg.step ?? "any"
6645
+ },
6646
+ zod: optionalize(s, required)
6647
+ });
6648
+ }
6599
6649
  function money(raw) {
6600
6650
  const o = normalizeOpts(raw);
6601
6651
  const required = o.required ?? false;
@@ -7073,6 +7123,8 @@ var PRIMITIVES = {
7073
7123
  json,
7074
7124
  check,
7075
7125
  measured,
7126
+ unit,
7127
+ amount,
7076
7128
  money,
7077
7129
  code,
7078
7130
  geo,
@@ -7118,7 +7170,7 @@ var field = new Proxy({}, {
7118
7170
  has: (_t, k) => k in composedField()
7119
7171
  });
7120
7172
  function toClient(field) {
7121
- const { kind, label, required, prim, hints, options, relation, virtual, json, hidden } = field;
7173
+ const { kind, label, required, prim, hints, options, relation, virtual, json, hidden, derived } = field;
7122
7174
  return {
7123
7175
  kind,
7124
7176
  label,
@@ -7129,7 +7181,8 @@ function toClient(field) {
7129
7181
  relation,
7130
7182
  virtual,
7131
7183
  json,
7132
- hidden
7184
+ hidden,
7185
+ derived
7133
7186
  };
7134
7187
  }
7135
7188
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffer-org/plugin-telegram",
3
- "version": "2.3.0",
3
+ "version": "3.0.0",
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.4.0",
29
- "@coffer-org/sdk": "^2.2.1",
30
- "@coffer-org/server": "^2.7.0",
28
+ "@coffer-org/plugin-orchestrator": "^3.0.0",
29
+ "@coffer-org/sdk": "^3.0.0",
30
+ "@coffer-org/server": "^3.0.0",
31
31
  "input": "^1.0.1",
32
32
  "teleproto": "^1.228.1"
33
33
  },