@rex0220/formula-authoring-tools 0.2.0 → 0.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/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /*! @rex0220/formula-authoring-tools 0.2.0 (c) rex0220. MIT License. 計算式エンジンと計算式プラグインのコードは利用者の計算式プラグインプラグインの zip から読む(このファイルには含まれない)。commit 1e50847. */
2
+ /*! @rex0220/formula-authoring-tools 0.3.0 (c) rex0220. MIT License. 計算式エンジンと計算式プラグインのコードは利用者の計算式プラグインプラグインの zip から読む(このファイルには含まれない)。commit cfbd850. */
3
3
 
4
4
  // src/cli.ts
5
5
  import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync2, realpathSync as realpathSync5, writeFileSync as writeFileSync3 } from "node:fs";
@@ -135,12 +135,12 @@ var KINTONE_HOST_SUFFIXES = [".cybozu.com", ".kintone.com", ".cybozu.cn"];
135
135
  var KintoneUrlError = class extends Error {
136
136
  };
137
137
  function normalizeKintoneBaseUrl(raw) {
138
- const text = String(raw ?? "").trim();
138
+ const text2 = String(raw ?? "").trim();
139
139
  let u2;
140
140
  try {
141
- u2 = new URL(text);
141
+ u2 = new URL(text2);
142
142
  } catch {
143
- throw new KintoneUrlError(`kintone の URL として読めない: ${text.slice(0, 80)}`);
143
+ throw new KintoneUrlError(`kintone の URL として読めない: ${text2.slice(0, 80)}`);
144
144
  }
145
145
  if (u2.protocol !== "https:") throw new KintoneUrlError("kintone の URL は https で始める");
146
146
  if (u2.username || u2.password) throw new KintoneUrlError("kintone の URL にユーザー名やパスワード(@)を入れない");
@@ -171,9 +171,9 @@ function unquote(raw) {
171
171
  if (value.length >= 2 && (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'"))) return value.slice(1, -1);
172
172
  return value;
173
173
  }
174
- function parseDotEnv(text) {
174
+ function parseDotEnv(text2) {
175
175
  const out = {};
176
- for (const raw of text.split(/\r?\n/)) {
176
+ for (const raw of text2.split(/\r?\n/)) {
177
177
  const line = raw.trim();
178
178
  if (!line || line.startsWith("#")) continue;
179
179
  const m = line.match(/^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);
@@ -355,7 +355,7 @@ function devMeta() {
355
355
  return { toolsVersion: pkg.version, pluginId: FORMULA_PLUGIN_ID, minPluginVersion: MIN_PLUGIN_VERSION, supportedApiVersions: [...SUPPORTED_API_VERSIONS], commit: gitCommit(AUTHORING_ROOT), builtAt: "", mode: "dev" };
356
356
  }
357
357
  function toolsMeta() {
358
- if (true) return JSON.parse('{"toolsVersion":"0.2.0","pluginId":"dhgihghfgfmibkdldkeibboabfnmdpke","minPluginVersion":101,"supportedApiVersions":[1],"commit":"1e50847","builtAt":"2026-10-18T02:11:59.644Z","mode":"build"}');
358
+ if (true) return JSON.parse('{"toolsVersion":"0.3.0","pluginId":"dhgihghfgfmibkdldkeibboabfnmdpke","minPluginVersion":101,"supportedApiVersions":[1],"commit":"cfbd850","builtAt":"2026-10-18T05:24:49.527Z","mode":"build"}');
359
359
  return devMeta();
360
360
  }
361
361
 
@@ -942,11 +942,11 @@ function jsonDiff(a, b, pathStr, out) {
942
942
  a.forEach((x, i) => jsonDiff(x, b[i], `${pathStr}[${i}]`, out));
943
943
  return;
944
944
  }
945
- const short2 = (v) => {
945
+ const short3 = (v) => {
946
946
  const s = JSON.stringify(v);
947
947
  return s === void 0 ? "undefined" : s.length > 100 ? s.slice(0, 100) + "…" : s;
948
948
  };
949
- out.push(`${pathStr}: ${short2(a)} → ${short2(b)}`);
949
+ out.push(`${pathStr}: ${short3(a)} → ${short3(b)}`);
950
950
  }
951
951
  function readTextLimited(file, maxBytes = MAX_INPUT_BYTES) {
952
952
  const size = statSync3(file).size;
@@ -1086,11 +1086,11 @@ function createRestClient(auth, fetchImpl = fetch) {
1086
1086
  setQuery(url, params);
1087
1087
  if (url.origin !== baseUrl || url.username || url.password) throw new NotAllowedError(`送信先が kintone の接続先と違うので送らない: ${url.origin}`);
1088
1088
  const res = await fetchImpl(url.href, { method: "GET", headers });
1089
- const text = await readCapped(res, RECEIVE_LIMITS[api], apiPath);
1089
+ const text2 = await readCapped(res, RECEIVE_LIMITS[api], apiPath);
1090
1090
  if (!res.ok) {
1091
1091
  let code;
1092
1092
  try {
1093
- const body = JSON.parse(text);
1093
+ const body = JSON.parse(text2);
1094
1094
  code = typeof body.code === "string" ? body.code.slice(0, 40) : void 0;
1095
1095
  } catch {
1096
1096
  }
@@ -1098,9 +1098,9 @@ function createRestClient(auth, fetchImpl = fetch) {
1098
1098
  throw new RestError(`kintone ${apiPath} が HTTP ${res.status}${code ? ` ${code}` : ""}${hint}`, res.status, code, apiPath);
1099
1099
  }
1100
1100
  try {
1101
- return JSON.parse(text);
1101
+ return JSON.parse(text2);
1102
1102
  } catch {
1103
- throw new RestError(`kintone ${apiPath} の応答が JSON でない${text ? "" : "(本文が空)"}`, res.status, "ResponseError", apiPath);
1103
+ throw new RestError(`kintone ${apiPath} の応答が JSON でない${text2 ? "" : "(本文が空)"}`, res.status, "ResponseError", apiPath);
1104
1104
  }
1105
1105
  },
1106
1106
  async getUser(api, params) {
@@ -1111,18 +1111,18 @@ function createRestClient(auth, fetchImpl = fetch) {
1111
1111
  setQuery(url, params);
1112
1112
  if (url.origin !== baseUrl || url.username || url.password) throw new NotAllowedError(`送信先が kintone の接続先と違うので送らない: ${url.origin}`);
1113
1113
  const res = await fetchImpl(url.href, { method: "GET", headers });
1114
- const text = await readCapped(res, USER_API_RECEIVE_LIMIT, apiPath);
1114
+ const text2 = await readCapped(res, USER_API_RECEIVE_LIMIT, apiPath);
1115
1115
  if (!res.ok) {
1116
1116
  let code;
1117
1117
  try {
1118
- code = typeof JSON.parse(text).code === "string" ? JSON.parse(text).code.slice(0, 40) : void 0;
1118
+ code = typeof JSON.parse(text2).code === "string" ? JSON.parse(text2).code.slice(0, 40) : void 0;
1119
1119
  } catch {
1120
1120
  }
1121
1121
  const hint = res.status === 401 ? "(認証情報を確かめる。cybozu.com 共通の API トークンかログインユーザー。アプリの API トークンでは呼べない)" : res.status === 403 ? "(アクセス権が無い)" : res.status === 400 ? "(パラメーターの誤り。--only-referenced なら、式が参照しているコードが存在しないかもしれない)" : "";
1122
1122
  throw new RestError(`cybozu.com ${apiPath} が HTTP ${res.status}${code ? ` ${code}` : ""}${hint}`, res.status, code, apiPath);
1123
1123
  }
1124
1124
  try {
1125
- return JSON.parse(text);
1125
+ return JSON.parse(text2);
1126
1126
  } catch {
1127
1127
  throw new RestError(`cybozu.com ${apiPath} の応答が JSON でない`, res.status, "ResponseError", apiPath);
1128
1128
  }
@@ -1401,7 +1401,7 @@ function authFor(set, profile, appId) {
1401
1401
  if (value === void 0) throw new ConnectionError(`profile「${profile.profile}」の tokenMap に APP${appId} が無い(そのアプリの API トークンを足す)`, "no-token");
1402
1402
  if (value.startsWith("env:")) {
1403
1403
  const token = nonblank(held.env[value.slice(4)]);
1404
- if (!token) throw new ConnectionError(`profile「${profile.profile}」の APP${appId} のトークンの環境変数が無い(設定した後、print-craft を再接続する。Desktop は起動し直す)`, "env-missing");
1404
+ if (!token) throw new ConnectionError(`profile「${profile.profile}」の APP${appId} のトークンの環境変数が無い(環境変数を置いてから実行し直す。MCP なら再接続する: Claude Code は /mcp、Desktop は起動し直す)`, "env-missing");
1405
1405
  return { baseUrl: profile.baseUrl, token };
1406
1406
  }
1407
1407
  return { baseUrl: profile.baseUrl, token: value };
@@ -1714,14 +1714,14 @@ function placeNew(tmp, target, link = linkSync) {
1714
1714
  throw e;
1715
1715
  }
1716
1716
  }
1717
- function writeNewFile(target, text, recheck = () => {
1717
+ function writeNewFile(target, text2, recheck = () => {
1718
1718
  }) {
1719
1719
  const tmp = tempPathFor(target);
1720
1720
  let placed = false;
1721
1721
  let failure;
1722
1722
  try {
1723
1723
  recheck();
1724
- writeFileSync2(tmp, text, { encoding: "utf8", flag: "wx" });
1724
+ writeFileSync2(tmp, text2, { encoding: "utf8", flag: "wx" });
1725
1725
  recheck();
1726
1726
  placeNew(tmp, target);
1727
1727
  placed = true;
@@ -1884,7 +1884,7 @@ function summarizeFields(file) {
1884
1884
  // src/scan.ts
1885
1885
  var IDENT = /[A-Za-z0-9_$\u0080-￿]/;
1886
1886
  var KEYWORDS = /* @__PURE__ */ new Set(["true", "false", "TRUE", "FALSE", "null"]);
1887
- function scanFormula(text) {
1887
+ function scanFormula(text2) {
1888
1888
  const functions = {};
1889
1889
  const identifiers = /* @__PURE__ */ new Set();
1890
1890
  const strings = [];
@@ -1893,24 +1893,24 @@ function scanFormula(text) {
1893
1893
  const calls = [];
1894
1894
  let depth = 0;
1895
1895
  let i = 0;
1896
- const n = text.length;
1896
+ const n = text2.length;
1897
1897
  while (i < n) {
1898
- const ch = text[i];
1898
+ const ch = text2[i];
1899
1899
  if (ch === '"') {
1900
1900
  let j = i + 1;
1901
1901
  let s = "";
1902
1902
  let closed = false;
1903
1903
  while (j < n) {
1904
- if (text[j] === "\\" && text[j + 1] === '"') {
1904
+ if (text2[j] === "\\" && text2[j + 1] === '"') {
1905
1905
  s += '\\"';
1906
1906
  j += 2;
1907
1907
  continue;
1908
1908
  }
1909
- if (text[j] === '"') {
1909
+ if (text2[j] === '"') {
1910
1910
  closed = true;
1911
1911
  break;
1912
1912
  }
1913
- s += text[j];
1913
+ s += text2[j];
1914
1914
  j++;
1915
1915
  }
1916
1916
  if (!closed) problems.push(`閉じていない文字列(${i} 文字目から)`);
@@ -1937,11 +1937,11 @@ function scanFormula(text) {
1937
1937
  }
1938
1938
  if (IDENT.test(ch)) {
1939
1939
  let j = i;
1940
- while (j < n && IDENT.test(text[j])) j++;
1941
- const word = text.slice(i, j);
1940
+ while (j < n && IDENT.test(text2[j])) j++;
1941
+ const word = text2.slice(i, j);
1942
1942
  let k = j;
1943
- while (k < n && (text[k] === " " || text[k] === " ")) k++;
1944
- if (text[k] === "(") {
1943
+ while (k < n && (text2[k] === " " || text2[k] === " ")) k++;
1944
+ if (text2[k] === "(") {
1945
1945
  functions[word] = (functions[word] ?? 0) + 1;
1946
1946
  depth++;
1947
1947
  calls.push(word);
@@ -1958,11 +1958,11 @@ function scanFormula(text) {
1958
1958
  if (depth > 0) problems.push(`閉じていない ( が ${depth} 個`);
1959
1959
  return { functions, identifiers, strings, stringArgs, problems };
1960
1960
  }
1961
- function staticArgsOf(text, fn) {
1961
+ function staticArgsOf(text2, fn) {
1962
1962
  const out = [];
1963
1963
  const re = new RegExp(`(?<![A-Za-z0-9_$\\u0080-\\uFFFF])${fn}\\s*\\(\\s*([A-Za-z0-9_$\\u0080-\\uFFFF]+)\\s*[,)]`, "g");
1964
1964
  let m;
1965
- while (m = re.exec(text)) out.push(m[1]);
1965
+ while (m = re.exec(text2)) out.push(m[1]);
1966
1966
  return out;
1967
1967
  }
1968
1968
 
@@ -2300,9 +2300,9 @@ async function pullUsers(client, opt = {}) {
2300
2300
  }
2301
2301
  var USER_INFO_FUNCTIONS = { UINFO: "users", OINFO: "orgs", OUSERS: "orgs", GINFO: "groups", GUSERS: "groups" };
2302
2302
  var CALL_RE = /(?<![A-Za-z0-9_$\u0080-\uFFFF])(UINFO|OINFO|GINFO|OUSERS|GUSERS)\s*\(\s*("(?:\\"|[^"])*"|[^,()]*)/g;
2303
- function scanUserInfoCalls(text) {
2303
+ function scanUserInfoCalls(text2) {
2304
2304
  const out = { users: [], orgs: [], groups: [], dynamic: [] };
2305
- for (const m of text.matchAll(CALL_RE)) {
2305
+ for (const m of text2.matchAll(CALL_RE)) {
2306
2306
  const fn = m[1];
2307
2307
  const arg = m[2].trim();
2308
2308
  const kind = USER_INFO_FUNCTIONS[fn];
@@ -2449,15 +2449,15 @@ function readInbox(src) {
2449
2449
  } finally {
2450
2450
  if (fd !== void 0) closeSync2(fd);
2451
2451
  }
2452
- const text = bytes.toString("utf8");
2452
+ const text2 = bytes.toString("utf8");
2453
2453
  let data;
2454
2454
  try {
2455
- data = JSON.parse(text);
2455
+ data = JSON.parse(text2);
2456
2456
  } catch (e) {
2457
2457
  return { reason: `JSON として読めない${jsonErrorWhere(e)}(中身は返さない)` };
2458
2458
  }
2459
2459
  if (!data || typeof data !== "object" || Array.isArray(data)) return { reason: "JSON の最上位がオブジェクトでない" };
2460
- return { text, data };
2460
+ return { text: text2, data };
2461
2461
  }
2462
2462
  function takeInbox(cwdIn, mode2, profile) {
2463
2463
  const connections = requireProfiles(mode2, "take");
@@ -2559,6 +2559,3008 @@ function takeInbox(cwdIn, mode2, profile) {
2559
2559
  return result;
2560
2560
  }
2561
2561
 
2562
+ // src/sample-app/fields.json
2563
+ var fields_default = {
2564
+ tool: "formula-authoring fields",
2565
+ fetchedAt: "2026-01-15T00:00:00.000Z",
2566
+ baseUrl: "https://example.cybozu.com",
2567
+ appId: 4329,
2568
+ appName: "計算式サンプル",
2569
+ preview: false,
2570
+ lang: "ja",
2571
+ revision: "1",
2572
+ properties: {
2573
+ チェック2: {
2574
+ type: "CHECK_BOX",
2575
+ code: "チェック2",
2576
+ label: "チェック2",
2577
+ noLabel: false,
2578
+ required: false,
2579
+ options: {
2580
+ 甲: {
2581
+ label: "甲",
2582
+ index: "0"
2583
+ },
2584
+ 乙: {
2585
+ label: "乙",
2586
+ index: "1"
2587
+ },
2588
+ 丙: {
2589
+ label: "丙",
2590
+ index: "2"
2591
+ }
2592
+ },
2593
+ defaultValue: [],
2594
+ align: "HORIZONTAL"
2595
+ },
2596
+ レコード番号: {
2597
+ type: "RECORD_NUMBER",
2598
+ code: "レコード番号",
2599
+ label: "レコード番号",
2600
+ noLabel: false
2601
+ },
2602
+ ドロップダウン2: {
2603
+ type: "DROP_DOWN",
2604
+ code: "ドロップダウン2",
2605
+ label: "ドロップダウン2",
2606
+ noLabel: false,
2607
+ required: false,
2608
+ options: {
2609
+ 甲: {
2610
+ label: "甲",
2611
+ index: "0"
2612
+ },
2613
+ 乙: {
2614
+ label: "乙",
2615
+ index: "1"
2616
+ },
2617
+ 丙: {
2618
+ label: "丙",
2619
+ index: "2"
2620
+ }
2621
+ },
2622
+ defaultValue: ""
2623
+ },
2624
+ ユーザー2: {
2625
+ type: "USER_SELECT",
2626
+ code: "ユーザー2",
2627
+ label: "ユーザー2",
2628
+ noLabel: false,
2629
+ required: false,
2630
+ entities: [],
2631
+ defaultValue: []
2632
+ },
2633
+ 組織1: {
2634
+ type: "ORGANIZATION_SELECT",
2635
+ code: "組織1",
2636
+ label: "組織1",
2637
+ noLabel: false,
2638
+ required: false,
2639
+ entities: [],
2640
+ defaultValue: []
2641
+ },
2642
+ ドロップダウン1: {
2643
+ type: "DROP_DOWN",
2644
+ code: "ドロップダウン1",
2645
+ label: "ドロップダウン1",
2646
+ noLabel: false,
2647
+ required: false,
2648
+ options: {
2649
+ A: {
2650
+ label: "A",
2651
+ index: "0"
2652
+ },
2653
+ B: {
2654
+ label: "B",
2655
+ index: "1"
2656
+ },
2657
+ C: {
2658
+ label: "C",
2659
+ index: "2"
2660
+ }
2661
+ },
2662
+ defaultValue: ""
2663
+ },
2664
+ 更新者: {
2665
+ type: "MODIFIER",
2666
+ code: "更新者",
2667
+ label: "更新者",
2668
+ noLabel: false
2669
+ },
2670
+ ユーザー1: {
2671
+ type: "USER_SELECT",
2672
+ code: "ユーザー1",
2673
+ label: "ユーザー1",
2674
+ noLabel: false,
2675
+ required: false,
2676
+ entities: [],
2677
+ defaultValue: []
2678
+ },
2679
+ 組織2: {
2680
+ type: "ORGANIZATION_SELECT",
2681
+ code: "組織2",
2682
+ label: "組織2",
2683
+ noLabel: false,
2684
+ required: false,
2685
+ entities: [],
2686
+ defaultValue: []
2687
+ },
2688
+ テーブル2: {
2689
+ type: "SUBTABLE",
2690
+ code: "テーブル2",
2691
+ noLabel: false,
2692
+ label: "テーブル2",
2693
+ fields: {
2694
+ T2_複数選択: {
2695
+ type: "MULTI_SELECT",
2696
+ code: "T2_複数選択",
2697
+ label: "T2_複数選択",
2698
+ noLabel: false,
2699
+ required: false,
2700
+ options: {
2701
+ A: {
2702
+ label: "A",
2703
+ index: "0"
2704
+ },
2705
+ B: {
2706
+ label: "B",
2707
+ index: "1"
2708
+ },
2709
+ C: {
2710
+ label: "C",
2711
+ index: "2"
2712
+ }
2713
+ },
2714
+ defaultValue: []
2715
+ },
2716
+ T2_文字列複数行: {
2717
+ type: "MULTI_LINE_TEXT",
2718
+ code: "T2_文字列複数行",
2719
+ label: "T2_文字列複数行",
2720
+ noLabel: false,
2721
+ required: false,
2722
+ defaultValue: ""
2723
+ },
2724
+ T2_リンク: {
2725
+ type: "LINK",
2726
+ code: "T2_リンク",
2727
+ label: "T2_リンク",
2728
+ noLabel: false,
2729
+ required: false,
2730
+ protocol: "WEB",
2731
+ minLength: "",
2732
+ maxLength: "",
2733
+ unique: false,
2734
+ defaultValue: ""
2735
+ },
2736
+ T2_リッチ: {
2737
+ type: "RICH_TEXT",
2738
+ code: "T2_リッチ",
2739
+ label: "T2_リッチ",
2740
+ noLabel: false,
2741
+ required: false,
2742
+ defaultValue: ""
2743
+ },
2744
+ T2_文字列: {
2745
+ type: "SINGLE_LINE_TEXT",
2746
+ code: "T2_文字列",
2747
+ label: "T2_文字列",
2748
+ noLabel: false,
2749
+ required: false,
2750
+ minLength: "",
2751
+ maxLength: "",
2752
+ expression: "",
2753
+ hideExpression: false,
2754
+ unique: false,
2755
+ defaultValue: ""
2756
+ },
2757
+ T2_チェック: {
2758
+ type: "CHECK_BOX",
2759
+ code: "T2_チェック",
2760
+ label: "T2_チェック",
2761
+ noLabel: false,
2762
+ required: false,
2763
+ options: {
2764
+ A: {
2765
+ label: "A",
2766
+ index: "0"
2767
+ },
2768
+ B: {
2769
+ label: "B",
2770
+ index: "1"
2771
+ },
2772
+ C: {
2773
+ label: "C",
2774
+ index: "2"
2775
+ }
2776
+ },
2777
+ defaultValue: [],
2778
+ align: "HORIZONTAL"
2779
+ },
2780
+ T2_ユーザー: {
2781
+ type: "USER_SELECT",
2782
+ code: "T2_ユーザー",
2783
+ label: "T2_ユーザー",
2784
+ noLabel: false,
2785
+ required: false,
2786
+ entities: [],
2787
+ defaultValue: []
2788
+ },
2789
+ T2_グループ: {
2790
+ type: "GROUP_SELECT",
2791
+ code: "T2_グループ",
2792
+ label: "T2_グループ",
2793
+ noLabel: false,
2794
+ required: false,
2795
+ entities: [],
2796
+ defaultValue: []
2797
+ },
2798
+ T2_日付: {
2799
+ type: "DATE",
2800
+ code: "T2_日付",
2801
+ label: "T2_日付",
2802
+ noLabel: false,
2803
+ required: false,
2804
+ unique: false,
2805
+ defaultValue: "",
2806
+ defaultNowValue: false
2807
+ },
2808
+ T2_数値: {
2809
+ type: "NUMBER",
2810
+ code: "T2_数値",
2811
+ label: "T2_数値",
2812
+ noLabel: false,
2813
+ required: false,
2814
+ minValue: "",
2815
+ maxValue: "",
2816
+ digit: false,
2817
+ unique: false,
2818
+ defaultValue: "",
2819
+ displayScale: "",
2820
+ unit: "",
2821
+ unitPosition: "BEFORE"
2822
+ },
2823
+ T2_ドロップダウン: {
2824
+ type: "DROP_DOWN",
2825
+ code: "T2_ドロップダウン",
2826
+ label: "T2_ドロップダウン",
2827
+ noLabel: false,
2828
+ required: false,
2829
+ options: {
2830
+ A: {
2831
+ label: "A",
2832
+ index: "0"
2833
+ },
2834
+ B: {
2835
+ label: "B",
2836
+ index: "1"
2837
+ },
2838
+ C: {
2839
+ label: "C",
2840
+ index: "2"
2841
+ }
2842
+ },
2843
+ defaultValue: ""
2844
+ },
2845
+ T2_組織: {
2846
+ type: "ORGANIZATION_SELECT",
2847
+ code: "T2_組織",
2848
+ label: "T2_組織",
2849
+ noLabel: false,
2850
+ required: false,
2851
+ entities: [],
2852
+ defaultValue: []
2853
+ },
2854
+ T2_計算: {
2855
+ type: "CALC",
2856
+ code: "T2_計算",
2857
+ label: "T2_計算",
2858
+ noLabel: false,
2859
+ required: false,
2860
+ expression: "T2_数値 * 2",
2861
+ format: "NUMBER",
2862
+ displayScale: "",
2863
+ hideExpression: false,
2864
+ unit: "",
2865
+ unitPosition: "BEFORE"
2866
+ },
2867
+ T2_ラジオ: {
2868
+ type: "RADIO_BUTTON",
2869
+ code: "T2_ラジオ",
2870
+ label: "T2_ラジオ",
2871
+ noLabel: false,
2872
+ required: true,
2873
+ options: {
2874
+ A: {
2875
+ label: "A",
2876
+ index: "0"
2877
+ },
2878
+ B: {
2879
+ label: "B",
2880
+ index: "1"
2881
+ },
2882
+ C: {
2883
+ label: "C",
2884
+ index: "2"
2885
+ }
2886
+ },
2887
+ defaultValue: "A",
2888
+ align: "HORIZONTAL"
2889
+ },
2890
+ T2_日時: {
2891
+ type: "DATETIME",
2892
+ code: "T2_日時",
2893
+ label: "T2_日時",
2894
+ noLabel: false,
2895
+ required: false,
2896
+ unique: false,
2897
+ defaultValue: "",
2898
+ defaultNowValue: false
2899
+ },
2900
+ T2_添付: {
2901
+ type: "FILE",
2902
+ code: "T2_添付",
2903
+ label: "T2_添付",
2904
+ noLabel: false,
2905
+ required: false,
2906
+ thumbnailSize: "50"
2907
+ },
2908
+ T2_時刻: {
2909
+ type: "TIME",
2910
+ code: "T2_時刻",
2911
+ label: "T2_時刻",
2912
+ noLabel: false,
2913
+ required: false,
2914
+ defaultValue: "",
2915
+ defaultNowValue: false
2916
+ }
2917
+ }
2918
+ },
2919
+ ステータス: {
2920
+ type: "STATUS",
2921
+ code: "ステータス",
2922
+ label: "ステータス",
2923
+ enabled: true
2924
+ },
2925
+ グループ1: {
2926
+ type: "GROUP_SELECT",
2927
+ code: "グループ1",
2928
+ label: "グループ1",
2929
+ noLabel: false,
2930
+ required: false,
2931
+ entities: [],
2932
+ defaultValue: []
2933
+ },
2934
+ テーブル1: {
2935
+ type: "SUBTABLE",
2936
+ code: "テーブル1",
2937
+ noLabel: false,
2938
+ label: "テーブル1",
2939
+ fields: {
2940
+ T1_ユーザー: {
2941
+ type: "USER_SELECT",
2942
+ code: "T1_ユーザー",
2943
+ label: "T1_ユーザー",
2944
+ noLabel: false,
2945
+ required: false,
2946
+ entities: [],
2947
+ defaultValue: []
2948
+ },
2949
+ T1_文字列複数行: {
2950
+ type: "MULTI_LINE_TEXT",
2951
+ code: "T1_文字列複数行",
2952
+ label: "T1_文字列複数行",
2953
+ noLabel: false,
2954
+ required: false,
2955
+ defaultValue: ""
2956
+ },
2957
+ T1_ラジオ: {
2958
+ type: "RADIO_BUTTON",
2959
+ code: "T1_ラジオ",
2960
+ label: "T1_ラジオ",
2961
+ noLabel: false,
2962
+ required: true,
2963
+ options: {
2964
+ A: {
2965
+ label: "A",
2966
+ index: "0"
2967
+ },
2968
+ B: {
2969
+ label: "B",
2970
+ index: "1"
2971
+ },
2972
+ C: {
2973
+ label: "C",
2974
+ index: "2"
2975
+ }
2976
+ },
2977
+ defaultValue: "A",
2978
+ align: "HORIZONTAL"
2979
+ },
2980
+ T1_複数選択: {
2981
+ type: "MULTI_SELECT",
2982
+ code: "T1_複数選択",
2983
+ label: "T1_複数選択",
2984
+ noLabel: false,
2985
+ required: false,
2986
+ options: {
2987
+ A: {
2988
+ label: "A",
2989
+ index: "0"
2990
+ },
2991
+ B: {
2992
+ label: "B",
2993
+ index: "1"
2994
+ },
2995
+ C: {
2996
+ label: "C",
2997
+ index: "2"
2998
+ }
2999
+ },
3000
+ defaultValue: []
3001
+ },
3002
+ T1_日付: {
3003
+ type: "DATE",
3004
+ code: "T1_日付",
3005
+ label: "T1_日付",
3006
+ noLabel: false,
3007
+ required: false,
3008
+ unique: false,
3009
+ defaultValue: "",
3010
+ defaultNowValue: false
3011
+ },
3012
+ T1_ドロップダウン: {
3013
+ type: "DROP_DOWN",
3014
+ code: "T1_ドロップダウン",
3015
+ label: "T1_ドロップダウン",
3016
+ noLabel: false,
3017
+ required: false,
3018
+ options: {
3019
+ A: {
3020
+ label: "A",
3021
+ index: "0"
3022
+ },
3023
+ B: {
3024
+ label: "B",
3025
+ index: "1"
3026
+ },
3027
+ C: {
3028
+ label: "C",
3029
+ index: "2"
3030
+ }
3031
+ },
3032
+ defaultValue: ""
3033
+ },
3034
+ T1_リッチ: {
3035
+ type: "RICH_TEXT",
3036
+ code: "T1_リッチ",
3037
+ label: "T1_リッチ",
3038
+ noLabel: false,
3039
+ required: false,
3040
+ defaultValue: ""
3041
+ },
3042
+ T1_数値: {
3043
+ type: "NUMBER",
3044
+ code: "T1_数値",
3045
+ label: "T1_数値",
3046
+ noLabel: false,
3047
+ required: false,
3048
+ minValue: "",
3049
+ maxValue: "",
3050
+ digit: false,
3051
+ unique: false,
3052
+ defaultValue: "",
3053
+ displayScale: "",
3054
+ unit: "",
3055
+ unitPosition: "BEFORE"
3056
+ },
3057
+ T1_組織: {
3058
+ type: "ORGANIZATION_SELECT",
3059
+ code: "T1_組織",
3060
+ label: "T1_組織",
3061
+ noLabel: false,
3062
+ required: false,
3063
+ entities: [],
3064
+ defaultValue: []
3065
+ },
3066
+ T1_リンク: {
3067
+ type: "LINK",
3068
+ code: "T1_リンク",
3069
+ label: "T1_リンク",
3070
+ noLabel: false,
3071
+ required: false,
3072
+ protocol: "WEB",
3073
+ minLength: "",
3074
+ maxLength: "",
3075
+ unique: false,
3076
+ defaultValue: ""
3077
+ },
3078
+ T1_文字列: {
3079
+ type: "SINGLE_LINE_TEXT",
3080
+ code: "T1_文字列",
3081
+ label: "T1_文字列",
3082
+ noLabel: false,
3083
+ required: false,
3084
+ minLength: "",
3085
+ maxLength: "",
3086
+ expression: "",
3087
+ hideExpression: false,
3088
+ unique: false,
3089
+ defaultValue: ""
3090
+ },
3091
+ T1_計算: {
3092
+ type: "CALC",
3093
+ code: "T1_計算",
3094
+ label: "T1_計算",
3095
+ noLabel: false,
3096
+ required: false,
3097
+ expression: "T1_数値 * 2",
3098
+ format: "NUMBER",
3099
+ displayScale: "",
3100
+ hideExpression: false,
3101
+ unit: "",
3102
+ unitPosition: "BEFORE"
3103
+ },
3104
+ T1_添付: {
3105
+ type: "FILE",
3106
+ code: "T1_添付",
3107
+ label: "T1_添付",
3108
+ noLabel: false,
3109
+ required: false,
3110
+ thumbnailSize: "50"
3111
+ },
3112
+ T1_日時: {
3113
+ type: "DATETIME",
3114
+ code: "T1_日時",
3115
+ label: "T1_日時",
3116
+ noLabel: false,
3117
+ required: false,
3118
+ unique: false,
3119
+ defaultValue: "",
3120
+ defaultNowValue: false
3121
+ },
3122
+ T1_グループ: {
3123
+ type: "GROUP_SELECT",
3124
+ code: "T1_グループ",
3125
+ label: "T1_グループ",
3126
+ noLabel: false,
3127
+ required: false,
3128
+ entities: [],
3129
+ defaultValue: []
3130
+ },
3131
+ T1_チェック: {
3132
+ type: "CHECK_BOX",
3133
+ code: "T1_チェック",
3134
+ label: "T1_チェック",
3135
+ noLabel: false,
3136
+ required: false,
3137
+ options: {
3138
+ A: {
3139
+ label: "A",
3140
+ index: "0"
3141
+ },
3142
+ B: {
3143
+ label: "B",
3144
+ index: "1"
3145
+ },
3146
+ C: {
3147
+ label: "C",
3148
+ index: "2"
3149
+ }
3150
+ },
3151
+ defaultValue: [],
3152
+ align: "HORIZONTAL"
3153
+ },
3154
+ T1_時刻: {
3155
+ type: "TIME",
3156
+ code: "T1_時刻",
3157
+ label: "T1_時刻",
3158
+ noLabel: false,
3159
+ required: false,
3160
+ defaultValue: "",
3161
+ defaultNowValue: false
3162
+ }
3163
+ }
3164
+ },
3165
+ ラジオ1: {
3166
+ type: "RADIO_BUTTON",
3167
+ code: "ラジオ1",
3168
+ label: "ラジオ1",
3169
+ noLabel: false,
3170
+ required: true,
3171
+ options: {
3172
+ A: {
3173
+ label: "A",
3174
+ index: "0"
3175
+ },
3176
+ B: {
3177
+ label: "B",
3178
+ index: "1"
3179
+ },
3180
+ C: {
3181
+ label: "C",
3182
+ index: "2"
3183
+ }
3184
+ },
3185
+ defaultValue: "A",
3186
+ align: "HORIZONTAL"
3187
+ },
3188
+ グループ2: {
3189
+ type: "GROUP_SELECT",
3190
+ code: "グループ2",
3191
+ label: "グループ2",
3192
+ noLabel: false,
3193
+ required: false,
3194
+ entities: [],
3195
+ defaultValue: []
3196
+ },
3197
+ ラジオ2: {
3198
+ type: "RADIO_BUTTON",
3199
+ code: "ラジオ2",
3200
+ label: "ラジオ2",
3201
+ noLabel: false,
3202
+ required: true,
3203
+ options: {
3204
+ 甲: {
3205
+ label: "甲",
3206
+ index: "0"
3207
+ },
3208
+ 乙: {
3209
+ label: "乙",
3210
+ index: "1"
3211
+ },
3212
+ 丙: {
3213
+ label: "丙",
3214
+ index: "2"
3215
+ }
3216
+ },
3217
+ defaultValue: "甲",
3218
+ align: "HORIZONTAL"
3219
+ },
3220
+ リッチ1: {
3221
+ type: "RICH_TEXT",
3222
+ code: "リッチ1",
3223
+ label: "リッチ1",
3224
+ noLabel: false,
3225
+ required: false,
3226
+ defaultValue: ""
3227
+ },
3228
+ 時刻2: {
3229
+ type: "TIME",
3230
+ code: "時刻2",
3231
+ label: "時刻2",
3232
+ noLabel: false,
3233
+ required: false,
3234
+ defaultValue: "",
3235
+ defaultNowValue: false
3236
+ },
3237
+ カテゴリー: {
3238
+ type: "CATEGORY",
3239
+ code: "カテゴリー",
3240
+ label: "カテゴリー",
3241
+ enabled: true
3242
+ },
3243
+ 時刻1: {
3244
+ type: "TIME",
3245
+ code: "時刻1",
3246
+ label: "時刻1",
3247
+ noLabel: false,
3248
+ required: false,
3249
+ defaultValue: "",
3250
+ defaultNowValue: false
3251
+ },
3252
+ リンク1: {
3253
+ type: "LINK",
3254
+ code: "リンク1",
3255
+ label: "リンク1(Web)",
3256
+ noLabel: false,
3257
+ required: false,
3258
+ protocol: "WEB",
3259
+ minLength: "",
3260
+ maxLength: "",
3261
+ unique: false,
3262
+ defaultValue: ""
3263
+ },
3264
+ リッチ2: {
3265
+ type: "RICH_TEXT",
3266
+ code: "リッチ2",
3267
+ label: "リッチ2",
3268
+ noLabel: false,
3269
+ required: false,
3270
+ defaultValue: ""
3271
+ },
3272
+ リンク2: {
3273
+ type: "LINK",
3274
+ code: "リンク2",
3275
+ label: "リンク2(メール)",
3276
+ noLabel: false,
3277
+ required: false,
3278
+ protocol: "MAIL",
3279
+ minLength: "",
3280
+ maxLength: "",
3281
+ unique: false,
3282
+ defaultValue: ""
3283
+ },
3284
+ 計算2: {
3285
+ type: "CALC",
3286
+ code: "計算2",
3287
+ label: "計算2(日付の差の日数)",
3288
+ noLabel: false,
3289
+ required: false,
3290
+ expression: "(日付1 - 日付2) / 86400",
3291
+ format: "NUMBER",
3292
+ displayScale: "",
3293
+ hideExpression: false,
3294
+ unit: "",
3295
+ unitPosition: "BEFORE"
3296
+ },
3297
+ 計算1: {
3298
+ type: "CALC",
3299
+ code: "計算1",
3300
+ label: "計算1",
3301
+ noLabel: false,
3302
+ required: false,
3303
+ expression: "数値1 + 数値2",
3304
+ format: "NUMBER",
3305
+ displayScale: "",
3306
+ hideExpression: false,
3307
+ unit: "",
3308
+ unitPosition: "BEFORE"
3309
+ },
3310
+ 複数選択2: {
3311
+ type: "MULTI_SELECT",
3312
+ code: "複数選択2",
3313
+ label: "複数選択2",
3314
+ noLabel: false,
3315
+ required: false,
3316
+ options: {
3317
+ 甲: {
3318
+ label: "甲",
3319
+ index: "0"
3320
+ },
3321
+ 乙: {
3322
+ label: "乙",
3323
+ index: "1"
3324
+ },
3325
+ 丙: {
3326
+ label: "丙",
3327
+ index: "2"
3328
+ }
3329
+ },
3330
+ defaultValue: []
3331
+ },
3332
+ 日時1: {
3333
+ type: "DATETIME",
3334
+ code: "日時1",
3335
+ label: "日時1",
3336
+ noLabel: false,
3337
+ required: false,
3338
+ unique: false,
3339
+ defaultValue: "",
3340
+ defaultNowValue: false
3341
+ },
3342
+ 複数選択1: {
3343
+ type: "MULTI_SELECT",
3344
+ code: "複数選択1",
3345
+ label: "複数選択1",
3346
+ noLabel: false,
3347
+ required: false,
3348
+ options: {
3349
+ A: {
3350
+ label: "A",
3351
+ index: "0"
3352
+ },
3353
+ B: {
3354
+ label: "B",
3355
+ index: "1"
3356
+ },
3357
+ C: {
3358
+ label: "C",
3359
+ index: "2"
3360
+ }
3361
+ },
3362
+ defaultValue: []
3363
+ },
3364
+ 日時2: {
3365
+ type: "DATETIME",
3366
+ code: "日時2",
3367
+ label: "日時2",
3368
+ noLabel: false,
3369
+ required: false,
3370
+ unique: false,
3371
+ defaultValue: "",
3372
+ defaultNowValue: false
3373
+ },
3374
+ 枠内数値1: {
3375
+ type: "NUMBER",
3376
+ code: "枠内数値1",
3377
+ label: "枠内数値1",
3378
+ noLabel: false,
3379
+ required: false,
3380
+ minValue: "",
3381
+ maxValue: "",
3382
+ digit: false,
3383
+ unique: false,
3384
+ defaultValue: "",
3385
+ displayScale: "",
3386
+ unit: "",
3387
+ unitPosition: "BEFORE"
3388
+ },
3389
+ 作業者: {
3390
+ type: "STATUS_ASSIGNEE",
3391
+ code: "作業者",
3392
+ label: "作業者",
3393
+ enabled: true
3394
+ },
3395
+ 作成者: {
3396
+ type: "CREATOR",
3397
+ code: "作成者",
3398
+ label: "作成者",
3399
+ noLabel: false
3400
+ },
3401
+ 文字列2: {
3402
+ type: "SINGLE_LINE_TEXT",
3403
+ code: "文字列2",
3404
+ label: "文字列2",
3405
+ noLabel: false,
3406
+ required: false,
3407
+ minLength: "",
3408
+ maxLength: "",
3409
+ expression: "",
3410
+ hideExpression: false,
3411
+ unique: false,
3412
+ defaultValue: ""
3413
+ },
3414
+ 文字列1: {
3415
+ type: "SINGLE_LINE_TEXT",
3416
+ code: "文字列1",
3417
+ label: "文字列1",
3418
+ noLabel: false,
3419
+ required: false,
3420
+ minLength: "",
3421
+ maxLength: "",
3422
+ expression: "",
3423
+ hideExpression: false,
3424
+ unique: false,
3425
+ defaultValue: ""
3426
+ },
3427
+ 更新日時: {
3428
+ type: "UPDATED_TIME",
3429
+ code: "更新日時",
3430
+ label: "更新日時",
3431
+ noLabel: false
3432
+ },
3433
+ 添付1: {
3434
+ type: "FILE",
3435
+ code: "添付1",
3436
+ label: "添付1",
3437
+ noLabel: false,
3438
+ required: false,
3439
+ thumbnailSize: "50"
3440
+ },
3441
+ 添付2: {
3442
+ type: "FILE",
3443
+ code: "添付2",
3444
+ label: "添付2",
3445
+ noLabel: false,
3446
+ required: false,
3447
+ thumbnailSize: "50"
3448
+ },
3449
+ 文字列複数行2: {
3450
+ type: "MULTI_LINE_TEXT",
3451
+ code: "文字列複数行2",
3452
+ label: "文字列複数行2",
3453
+ noLabel: false,
3454
+ required: false,
3455
+ defaultValue: ""
3456
+ },
3457
+ グループ枠1: {
3458
+ type: "GROUP",
3459
+ code: "グループ枠1",
3460
+ label: "グループ枠1",
3461
+ noLabel: false,
3462
+ openGroup: true
3463
+ },
3464
+ 日付1: {
3465
+ type: "DATE",
3466
+ code: "日付1",
3467
+ label: "日付1",
3468
+ noLabel: false,
3469
+ required: false,
3470
+ unique: false,
3471
+ defaultValue: "",
3472
+ defaultNowValue: false
3473
+ },
3474
+ 枠内文字列1: {
3475
+ type: "SINGLE_LINE_TEXT",
3476
+ code: "枠内文字列1",
3477
+ label: "枠内文字列1",
3478
+ noLabel: false,
3479
+ required: false,
3480
+ minLength: "",
3481
+ maxLength: "",
3482
+ expression: "",
3483
+ hideExpression: false,
3484
+ unique: false,
3485
+ defaultValue: ""
3486
+ },
3487
+ 文字列複数行1: {
3488
+ type: "MULTI_LINE_TEXT",
3489
+ code: "文字列複数行1",
3490
+ label: "文字列複数行1",
3491
+ noLabel: false,
3492
+ required: false,
3493
+ defaultValue: ""
3494
+ },
3495
+ 日付2: {
3496
+ type: "DATE",
3497
+ code: "日付2",
3498
+ label: "日付2",
3499
+ noLabel: false,
3500
+ required: false,
3501
+ unique: false,
3502
+ defaultValue: "",
3503
+ defaultNowValue: false
3504
+ },
3505
+ 数値2: {
3506
+ type: "NUMBER",
3507
+ code: "数値2",
3508
+ label: "数値2",
3509
+ noLabel: false,
3510
+ required: false,
3511
+ minValue: "",
3512
+ maxValue: "",
3513
+ digit: true,
3514
+ unique: false,
3515
+ defaultValue: "",
3516
+ displayScale: "2",
3517
+ unit: "",
3518
+ unitPosition: "BEFORE"
3519
+ },
3520
+ 数値1: {
3521
+ type: "NUMBER",
3522
+ code: "数値1",
3523
+ label: "数値1",
3524
+ noLabel: false,
3525
+ required: false,
3526
+ minValue: "",
3527
+ maxValue: "",
3528
+ digit: false,
3529
+ unique: false,
3530
+ defaultValue: "",
3531
+ displayScale: "",
3532
+ unit: "",
3533
+ unitPosition: "BEFORE"
3534
+ },
3535
+ チェック1: {
3536
+ type: "CHECK_BOX",
3537
+ code: "チェック1",
3538
+ label: "チェック1",
3539
+ noLabel: false,
3540
+ required: false,
3541
+ options: {
3542
+ A: {
3543
+ label: "A",
3544
+ index: "0"
3545
+ },
3546
+ B: {
3547
+ label: "B",
3548
+ index: "1"
3549
+ },
3550
+ C: {
3551
+ label: "C",
3552
+ index: "2"
3553
+ }
3554
+ },
3555
+ defaultValue: [],
3556
+ align: "HORIZONTAL"
3557
+ },
3558
+ 作成日時: {
3559
+ type: "CREATED_TIME",
3560
+ code: "作成日時",
3561
+ label: "作成日時",
3562
+ noLabel: false
3563
+ }
3564
+ },
3565
+ layout: [
3566
+ {
3567
+ type: "ROW",
3568
+ fields: [
3569
+ {
3570
+ type: "LABEL",
3571
+ label: "計算式プラグインのサンプルアプリ&#xff08;全項目タイプ × 2、テーブル 2 つ&#xff09;",
3572
+ elementId: "",
3573
+ size: {
3574
+ width: "600"
3575
+ }
3576
+ }
3577
+ ]
3578
+ },
3579
+ {
3580
+ type: "ROW",
3581
+ fields: [
3582
+ {
3583
+ type: "SINGLE_LINE_TEXT",
3584
+ code: "文字列1",
3585
+ size: {
3586
+ width: "250"
3587
+ }
3588
+ },
3589
+ {
3590
+ type: "SINGLE_LINE_TEXT",
3591
+ code: "文字列2",
3592
+ size: {
3593
+ width: "250"
3594
+ }
3595
+ }
3596
+ ]
3597
+ },
3598
+ {
3599
+ type: "ROW",
3600
+ fields: [
3601
+ {
3602
+ type: "MULTI_LINE_TEXT",
3603
+ code: "文字列複数行1",
3604
+ size: {
3605
+ width: "250",
3606
+ innerHeight: "125"
3607
+ }
3608
+ },
3609
+ {
3610
+ type: "MULTI_LINE_TEXT",
3611
+ code: "文字列複数行2",
3612
+ size: {
3613
+ width: "250",
3614
+ innerHeight: "125"
3615
+ }
3616
+ }
3617
+ ]
3618
+ },
3619
+ {
3620
+ type: "ROW",
3621
+ fields: [
3622
+ {
3623
+ type: "RICH_TEXT",
3624
+ code: "リッチ1",
3625
+ size: {
3626
+ width: "250",
3627
+ innerHeight: "125"
3628
+ }
3629
+ },
3630
+ {
3631
+ type: "RICH_TEXT",
3632
+ code: "リッチ2",
3633
+ size: {
3634
+ width: "250",
3635
+ innerHeight: "125"
3636
+ }
3637
+ }
3638
+ ]
3639
+ },
3640
+ {
3641
+ type: "ROW",
3642
+ fields: [
3643
+ {
3644
+ type: "NUMBER",
3645
+ code: "数値1",
3646
+ size: {
3647
+ width: "250"
3648
+ }
3649
+ },
3650
+ {
3651
+ type: "NUMBER",
3652
+ code: "数値2",
3653
+ size: {
3654
+ width: "250"
3655
+ }
3656
+ }
3657
+ ]
3658
+ },
3659
+ {
3660
+ type: "ROW",
3661
+ fields: [
3662
+ {
3663
+ type: "CALC",
3664
+ code: "計算1",
3665
+ size: {
3666
+ width: "250"
3667
+ }
3668
+ },
3669
+ {
3670
+ type: "CALC",
3671
+ code: "計算2",
3672
+ size: {
3673
+ width: "250"
3674
+ }
3675
+ }
3676
+ ]
3677
+ },
3678
+ {
3679
+ type: "ROW",
3680
+ fields: [
3681
+ {
3682
+ type: "RADIO_BUTTON",
3683
+ code: "ラジオ1",
3684
+ size: {
3685
+ width: "250"
3686
+ }
3687
+ },
3688
+ {
3689
+ type: "RADIO_BUTTON",
3690
+ code: "ラジオ2",
3691
+ size: {
3692
+ width: "250"
3693
+ }
3694
+ }
3695
+ ]
3696
+ },
3697
+ {
3698
+ type: "ROW",
3699
+ fields: [
3700
+ {
3701
+ type: "CHECK_BOX",
3702
+ code: "チェック1",
3703
+ size: {
3704
+ width: "250"
3705
+ }
3706
+ },
3707
+ {
3708
+ type: "CHECK_BOX",
3709
+ code: "チェック2",
3710
+ size: {
3711
+ width: "250"
3712
+ }
3713
+ }
3714
+ ]
3715
+ },
3716
+ {
3717
+ type: "ROW",
3718
+ fields: [
3719
+ {
3720
+ type: "MULTI_SELECT",
3721
+ code: "複数選択1",
3722
+ size: {
3723
+ width: "250"
3724
+ }
3725
+ },
3726
+ {
3727
+ type: "MULTI_SELECT",
3728
+ code: "複数選択2",
3729
+ size: {
3730
+ width: "250"
3731
+ }
3732
+ }
3733
+ ]
3734
+ },
3735
+ {
3736
+ type: "ROW",
3737
+ fields: [
3738
+ {
3739
+ type: "DROP_DOWN",
3740
+ code: "ドロップダウン1",
3741
+ size: {
3742
+ width: "250"
3743
+ }
3744
+ },
3745
+ {
3746
+ type: "DROP_DOWN",
3747
+ code: "ドロップダウン2",
3748
+ size: {
3749
+ width: "250"
3750
+ }
3751
+ }
3752
+ ]
3753
+ },
3754
+ {
3755
+ type: "ROW",
3756
+ fields: [
3757
+ {
3758
+ type: "DATE",
3759
+ code: "日付1",
3760
+ size: {
3761
+ width: "250"
3762
+ }
3763
+ },
3764
+ {
3765
+ type: "DATE",
3766
+ code: "日付2",
3767
+ size: {
3768
+ width: "250"
3769
+ }
3770
+ }
3771
+ ]
3772
+ },
3773
+ {
3774
+ type: "ROW",
3775
+ fields: [
3776
+ {
3777
+ type: "TIME",
3778
+ code: "時刻1",
3779
+ size: {
3780
+ width: "250"
3781
+ }
3782
+ },
3783
+ {
3784
+ type: "TIME",
3785
+ code: "時刻2",
3786
+ size: {
3787
+ width: "250"
3788
+ }
3789
+ }
3790
+ ]
3791
+ },
3792
+ {
3793
+ type: "ROW",
3794
+ fields: [
3795
+ {
3796
+ type: "DATETIME",
3797
+ code: "日時1",
3798
+ size: {
3799
+ width: "250"
3800
+ }
3801
+ },
3802
+ {
3803
+ type: "DATETIME",
3804
+ code: "日時2",
3805
+ size: {
3806
+ width: "250"
3807
+ }
3808
+ }
3809
+ ]
3810
+ },
3811
+ {
3812
+ type: "ROW",
3813
+ fields: [
3814
+ {
3815
+ type: "HR",
3816
+ elementId: "",
3817
+ size: {
3818
+ width: "600"
3819
+ }
3820
+ }
3821
+ ]
3822
+ },
3823
+ {
3824
+ type: "ROW",
3825
+ fields: [
3826
+ {
3827
+ type: "FILE",
3828
+ code: "添付1",
3829
+ size: {
3830
+ width: "250"
3831
+ }
3832
+ },
3833
+ {
3834
+ type: "FILE",
3835
+ code: "添付2",
3836
+ size: {
3837
+ width: "250"
3838
+ }
3839
+ }
3840
+ ]
3841
+ },
3842
+ {
3843
+ type: "ROW",
3844
+ fields: [
3845
+ {
3846
+ type: "LINK",
3847
+ code: "リンク1",
3848
+ size: {
3849
+ width: "250"
3850
+ }
3851
+ },
3852
+ {
3853
+ type: "LINK",
3854
+ code: "リンク2",
3855
+ size: {
3856
+ width: "250"
3857
+ }
3858
+ }
3859
+ ]
3860
+ },
3861
+ {
3862
+ type: "ROW",
3863
+ fields: [
3864
+ {
3865
+ type: "USER_SELECT",
3866
+ code: "ユーザー1",
3867
+ size: {
3868
+ width: "250"
3869
+ }
3870
+ },
3871
+ {
3872
+ type: "USER_SELECT",
3873
+ code: "ユーザー2",
3874
+ size: {
3875
+ width: "250"
3876
+ }
3877
+ }
3878
+ ]
3879
+ },
3880
+ {
3881
+ type: "ROW",
3882
+ fields: [
3883
+ {
3884
+ type: "ORGANIZATION_SELECT",
3885
+ code: "組織1",
3886
+ size: {
3887
+ width: "250"
3888
+ }
3889
+ },
3890
+ {
3891
+ type: "ORGANIZATION_SELECT",
3892
+ code: "組織2",
3893
+ size: {
3894
+ width: "250"
3895
+ }
3896
+ }
3897
+ ]
3898
+ },
3899
+ {
3900
+ type: "ROW",
3901
+ fields: [
3902
+ {
3903
+ type: "GROUP_SELECT",
3904
+ code: "グループ1",
3905
+ size: {
3906
+ width: "250"
3907
+ }
3908
+ },
3909
+ {
3910
+ type: "GROUP_SELECT",
3911
+ code: "グループ2",
3912
+ size: {
3913
+ width: "250"
3914
+ }
3915
+ }
3916
+ ]
3917
+ },
3918
+ {
3919
+ type: "GROUP",
3920
+ code: "グループ枠1",
3921
+ layout: [
3922
+ {
3923
+ type: "ROW",
3924
+ fields: [
3925
+ {
3926
+ type: "SINGLE_LINE_TEXT",
3927
+ code: "枠内文字列1",
3928
+ size: {
3929
+ width: "250"
3930
+ }
3931
+ },
3932
+ {
3933
+ type: "NUMBER",
3934
+ code: "枠内数値1",
3935
+ size: {
3936
+ width: "250"
3937
+ }
3938
+ }
3939
+ ]
3940
+ }
3941
+ ]
3942
+ },
3943
+ {
3944
+ type: "ROW",
3945
+ fields: [
3946
+ {
3947
+ type: "SPACER",
3948
+ elementId: "",
3949
+ size: {
3950
+ width: "600",
3951
+ height: "20"
3952
+ }
3953
+ }
3954
+ ]
3955
+ },
3956
+ {
3957
+ type: "SUBTABLE",
3958
+ code: "テーブル1",
3959
+ fields: [
3960
+ {
3961
+ type: "SINGLE_LINE_TEXT",
3962
+ code: "T1_文字列",
3963
+ size: {
3964
+ width: "150"
3965
+ }
3966
+ },
3967
+ {
3968
+ type: "MULTI_LINE_TEXT",
3969
+ code: "T1_文字列複数行",
3970
+ size: {
3971
+ width: "150",
3972
+ innerHeight: "125"
3973
+ }
3974
+ },
3975
+ {
3976
+ type: "RICH_TEXT",
3977
+ code: "T1_リッチ",
3978
+ size: {
3979
+ width: "150",
3980
+ innerHeight: "125"
3981
+ }
3982
+ },
3983
+ {
3984
+ type: "NUMBER",
3985
+ code: "T1_数値",
3986
+ size: {
3987
+ width: "150"
3988
+ }
3989
+ },
3990
+ {
3991
+ type: "CALC",
3992
+ code: "T1_計算",
3993
+ size: {
3994
+ width: "150"
3995
+ }
3996
+ },
3997
+ {
3998
+ type: "RADIO_BUTTON",
3999
+ code: "T1_ラジオ",
4000
+ size: {
4001
+ width: "150"
4002
+ }
4003
+ },
4004
+ {
4005
+ type: "CHECK_BOX",
4006
+ code: "T1_チェック",
4007
+ size: {
4008
+ width: "150"
4009
+ }
4010
+ },
4011
+ {
4012
+ type: "MULTI_SELECT",
4013
+ code: "T1_複数選択",
4014
+ size: {
4015
+ width: "150"
4016
+ }
4017
+ },
4018
+ {
4019
+ type: "DROP_DOWN",
4020
+ code: "T1_ドロップダウン",
4021
+ size: {
4022
+ width: "150"
4023
+ }
4024
+ },
4025
+ {
4026
+ type: "DATE",
4027
+ code: "T1_日付",
4028
+ size: {
4029
+ width: "150"
4030
+ }
4031
+ },
4032
+ {
4033
+ type: "TIME",
4034
+ code: "T1_時刻",
4035
+ size: {
4036
+ width: "150"
4037
+ }
4038
+ },
4039
+ {
4040
+ type: "DATETIME",
4041
+ code: "T1_日時",
4042
+ size: {
4043
+ width: "150"
4044
+ }
4045
+ },
4046
+ {
4047
+ type: "FILE",
4048
+ code: "T1_添付",
4049
+ size: {
4050
+ width: "150"
4051
+ }
4052
+ },
4053
+ {
4054
+ type: "LINK",
4055
+ code: "T1_リンク",
4056
+ size: {
4057
+ width: "150"
4058
+ }
4059
+ },
4060
+ {
4061
+ type: "USER_SELECT",
4062
+ code: "T1_ユーザー",
4063
+ size: {
4064
+ width: "150"
4065
+ }
4066
+ },
4067
+ {
4068
+ type: "ORGANIZATION_SELECT",
4069
+ code: "T1_組織",
4070
+ size: {
4071
+ width: "150"
4072
+ }
4073
+ },
4074
+ {
4075
+ type: "GROUP_SELECT",
4076
+ code: "T1_グループ",
4077
+ size: {
4078
+ width: "150"
4079
+ }
4080
+ }
4081
+ ]
4082
+ },
4083
+ {
4084
+ type: "SUBTABLE",
4085
+ code: "テーブル2",
4086
+ fields: [
4087
+ {
4088
+ type: "SINGLE_LINE_TEXT",
4089
+ code: "T2_文字列",
4090
+ size: {
4091
+ width: "150"
4092
+ }
4093
+ },
4094
+ {
4095
+ type: "MULTI_LINE_TEXT",
4096
+ code: "T2_文字列複数行",
4097
+ size: {
4098
+ width: "150",
4099
+ innerHeight: "125"
4100
+ }
4101
+ },
4102
+ {
4103
+ type: "RICH_TEXT",
4104
+ code: "T2_リッチ",
4105
+ size: {
4106
+ width: "150",
4107
+ innerHeight: "125"
4108
+ }
4109
+ },
4110
+ {
4111
+ type: "NUMBER",
4112
+ code: "T2_数値",
4113
+ size: {
4114
+ width: "150"
4115
+ }
4116
+ },
4117
+ {
4118
+ type: "CALC",
4119
+ code: "T2_計算",
4120
+ size: {
4121
+ width: "150"
4122
+ }
4123
+ },
4124
+ {
4125
+ type: "RADIO_BUTTON",
4126
+ code: "T2_ラジオ",
4127
+ size: {
4128
+ width: "150"
4129
+ }
4130
+ },
4131
+ {
4132
+ type: "CHECK_BOX",
4133
+ code: "T2_チェック",
4134
+ size: {
4135
+ width: "150"
4136
+ }
4137
+ },
4138
+ {
4139
+ type: "MULTI_SELECT",
4140
+ code: "T2_複数選択",
4141
+ size: {
4142
+ width: "150"
4143
+ }
4144
+ },
4145
+ {
4146
+ type: "DROP_DOWN",
4147
+ code: "T2_ドロップダウン",
4148
+ size: {
4149
+ width: "150"
4150
+ }
4151
+ },
4152
+ {
4153
+ type: "DATE",
4154
+ code: "T2_日付",
4155
+ size: {
4156
+ width: "150"
4157
+ }
4158
+ },
4159
+ {
4160
+ type: "TIME",
4161
+ code: "T2_時刻",
4162
+ size: {
4163
+ width: "150"
4164
+ }
4165
+ },
4166
+ {
4167
+ type: "DATETIME",
4168
+ code: "T2_日時",
4169
+ size: {
4170
+ width: "150"
4171
+ }
4172
+ },
4173
+ {
4174
+ type: "FILE",
4175
+ code: "T2_添付",
4176
+ size: {
4177
+ width: "150"
4178
+ }
4179
+ },
4180
+ {
4181
+ type: "LINK",
4182
+ code: "T2_リンク",
4183
+ size: {
4184
+ width: "150"
4185
+ }
4186
+ },
4187
+ {
4188
+ type: "USER_SELECT",
4189
+ code: "T2_ユーザー",
4190
+ size: {
4191
+ width: "150"
4192
+ }
4193
+ },
4194
+ {
4195
+ type: "ORGANIZATION_SELECT",
4196
+ code: "T2_組織",
4197
+ size: {
4198
+ width: "150"
4199
+ }
4200
+ },
4201
+ {
4202
+ type: "GROUP_SELECT",
4203
+ code: "T2_グループ",
4204
+ size: {
4205
+ width: "150"
4206
+ }
4207
+ }
4208
+ ]
4209
+ },
4210
+ {
4211
+ type: "ROW",
4212
+ fields: [
4213
+ {
4214
+ type: "RECORD_NUMBER",
4215
+ code: "レコード番号",
4216
+ size: {
4217
+ width: "250"
4218
+ }
4219
+ },
4220
+ {
4221
+ type: "CREATOR",
4222
+ code: "作成者",
4223
+ size: {
4224
+ width: "250"
4225
+ }
4226
+ }
4227
+ ]
4228
+ },
4229
+ {
4230
+ type: "ROW",
4231
+ fields: [
4232
+ {
4233
+ type: "CREATED_TIME",
4234
+ code: "作成日時",
4235
+ size: {
4236
+ width: "250"
4237
+ }
4238
+ },
4239
+ {
4240
+ type: "MODIFIER",
4241
+ code: "更新者",
4242
+ size: {
4243
+ width: "250"
4244
+ }
4245
+ }
4246
+ ]
4247
+ },
4248
+ {
4249
+ type: "ROW",
4250
+ fields: [
4251
+ {
4252
+ type: "UPDATED_TIME",
4253
+ code: "更新日時",
4254
+ size: {
4255
+ width: "250"
4256
+ }
4257
+ }
4258
+ ]
4259
+ }
4260
+ ],
4261
+ views: {
4262
+ "(作業者が自分)": {
4263
+ type: "LIST",
4264
+ name: "(作業者が自分)",
4265
+ id: "16550400",
4266
+ filterCond: "作業者 in (LOGINUSER())",
4267
+ sort: "レコード番号 desc",
4268
+ index: "0",
4269
+ fields: [
4270
+ "レコード番号",
4271
+ "文字列1",
4272
+ "文字列2",
4273
+ "文字列複数行1",
4274
+ "文字列複数行2",
4275
+ "リッチ1",
4276
+ "リッチ2",
4277
+ "数値1",
4278
+ "数値2",
4279
+ "計算1",
4280
+ "計算2",
4281
+ "ラジオ1",
4282
+ "ラジオ2",
4283
+ "チェック1",
4284
+ "チェック2",
4285
+ "複数選択1",
4286
+ "複数選択2",
4287
+ "ドロップダウン1",
4288
+ "ドロップダウン2",
4289
+ "日付1",
4290
+ "日付2",
4291
+ "時刻1",
4292
+ "時刻2",
4293
+ "日時1",
4294
+ "日時2",
4295
+ "添付1",
4296
+ "添付2",
4297
+ "リンク1",
4298
+ "リンク2",
4299
+ "ユーザー1",
4300
+ "ユーザー2",
4301
+ "組織1",
4302
+ "組織2",
4303
+ "グループ1",
4304
+ "グループ2",
4305
+ "枠内文字列1",
4306
+ "枠内数値1",
4307
+ "ステータス",
4308
+ "作業者"
4309
+ ],
4310
+ builtinType: "ASSIGNEE"
4311
+ }
4312
+ }
4313
+ };
4314
+
4315
+ // src/sample-app/record-1.json
4316
+ var record_1_default = {
4317
+ tool: "formula-authoring record",
4318
+ fetchedAt: "2026-01-15T00:00:00.000Z",
4319
+ baseUrl: "https://example.cybozu.com",
4320
+ appId: 4329,
4321
+ id: 1,
4322
+ record: {
4323
+ チェック2: {
4324
+ type: "CHECK_BOX",
4325
+ value: [
4326
+ "甲"
4327
+ ]
4328
+ },
4329
+ レコード番号: {
4330
+ type: "RECORD_NUMBER",
4331
+ value: "1"
4332
+ },
4333
+ ドロップダウン2: {
4334
+ type: "DROP_DOWN",
4335
+ value: "乙"
4336
+ },
4337
+ ユーザー2: {
4338
+ type: "USER_SELECT",
4339
+ value: [
4340
+ {
4341
+ code: "demo_user01",
4342
+ name: "架空 社長"
4343
+ },
4344
+ {
4345
+ code: "demo_user02",
4346
+ name: "架空 営業部長"
4347
+ }
4348
+ ]
4349
+ },
4350
+ 組織1: {
4351
+ type: "ORGANIZATION_SELECT",
4352
+ value: [
4353
+ {
4354
+ code: "demo_hq",
4355
+ name: "架空本社"
4356
+ }
4357
+ ]
4358
+ },
4359
+ ドロップダウン1: {
4360
+ type: "DROP_DOWN",
4361
+ value: "A"
4362
+ },
4363
+ 更新者: {
4364
+ type: "MODIFIER",
4365
+ value: {
4366
+ code: "demo_user02",
4367
+ name: "架空 営業部長"
4368
+ }
4369
+ },
4370
+ ユーザー1: {
4371
+ type: "USER_SELECT",
4372
+ value: [
4373
+ {
4374
+ code: "demo_user01",
4375
+ name: "架空 社長"
4376
+ }
4377
+ ]
4378
+ },
4379
+ 組織2: {
4380
+ type: "ORGANIZATION_SELECT",
4381
+ value: [
4382
+ {
4383
+ code: "demo_sales",
4384
+ name: "架空営業部"
4385
+ }
4386
+ ]
4387
+ },
4388
+ テーブル2: {
4389
+ type: "SUBTABLE",
4390
+ value: [
4391
+ {
4392
+ id: "7727389",
4393
+ value: {
4394
+ T2_複数選択: {
4395
+ type: "MULTI_SELECT",
4396
+ value: [
4397
+ "B"
4398
+ ]
4399
+ },
4400
+ T2_文字列複数行: {
4401
+ type: "MULTI_LINE_TEXT",
4402
+ value: "T2 行 1\n2 行目"
4403
+ },
4404
+ T2_リンク: {
4405
+ type: "LINK",
4406
+ value: "https://example.com/"
4407
+ },
4408
+ T2_リッチ: {
4409
+ type: "RICH_TEXT",
4410
+ value: "<div>T2 行 1</div>"
4411
+ },
4412
+ T2_文字列: {
4413
+ type: "SINGLE_LINE_TEXT",
4414
+ value: "T2 行 1"
4415
+ },
4416
+ T2_チェック: {
4417
+ type: "CHECK_BOX",
4418
+ value: [
4419
+ "A"
4420
+ ]
4421
+ },
4422
+ T2_ユーザー: {
4423
+ type: "USER_SELECT",
4424
+ value: [
4425
+ {
4426
+ code: "demo_user01",
4427
+ name: "架空 社長"
4428
+ }
4429
+ ]
4430
+ },
4431
+ T2_グループ: {
4432
+ type: "GROUP_SELECT",
4433
+ value: [
4434
+ {
4435
+ code: "demo_managers",
4436
+ name: "架空管理職"
4437
+ }
4438
+ ]
4439
+ },
4440
+ T2_日付: {
4441
+ type: "DATE",
4442
+ value: "2026-02-01"
4443
+ },
4444
+ T2_数値: {
4445
+ type: "NUMBER",
4446
+ value: "10"
4447
+ },
4448
+ T2_ドロップダウン: {
4449
+ type: "DROP_DOWN",
4450
+ value: "C"
4451
+ },
4452
+ T2_組織: {
4453
+ type: "ORGANIZATION_SELECT",
4454
+ value: [
4455
+ {
4456
+ code: "demo_hq",
4457
+ name: "架空本社"
4458
+ }
4459
+ ]
4460
+ },
4461
+ T2_計算: {
4462
+ type: "CALC",
4463
+ value: "20"
4464
+ },
4465
+ T2_ラジオ: {
4466
+ type: "RADIO_BUTTON",
4467
+ value: "A"
4468
+ },
4469
+ T2_日時: {
4470
+ type: "DATETIME",
4471
+ value: "2026-02-01T00:30:00Z"
4472
+ },
4473
+ T2_添付: {
4474
+ type: "FILE",
4475
+ value: []
4476
+ },
4477
+ T2_時刻: {
4478
+ type: "TIME",
4479
+ value: "09:30"
4480
+ }
4481
+ }
4482
+ },
4483
+ {
4484
+ id: "7727392",
4485
+ value: {
4486
+ T2_複数選択: {
4487
+ type: "MULTI_SELECT",
4488
+ value: [
4489
+ "B"
4490
+ ]
4491
+ },
4492
+ T2_文字列複数行: {
4493
+ type: "MULTI_LINE_TEXT",
4494
+ value: "T2 行 2\n2 行目"
4495
+ },
4496
+ T2_リンク: {
4497
+ type: "LINK",
4498
+ value: "https://example.com/"
4499
+ },
4500
+ T2_リッチ: {
4501
+ type: "RICH_TEXT",
4502
+ value: "<div>T2 行 2</div>"
4503
+ },
4504
+ T2_文字列: {
4505
+ type: "SINGLE_LINE_TEXT",
4506
+ value: "T2 行 2"
4507
+ },
4508
+ T2_チェック: {
4509
+ type: "CHECK_BOX",
4510
+ value: [
4511
+ "A"
4512
+ ]
4513
+ },
4514
+ T2_ユーザー: {
4515
+ type: "USER_SELECT",
4516
+ value: [
4517
+ {
4518
+ code: "demo_user01",
4519
+ name: "架空 社長"
4520
+ }
4521
+ ]
4522
+ },
4523
+ T2_グループ: {
4524
+ type: "GROUP_SELECT",
4525
+ value: [
4526
+ {
4527
+ code: "demo_managers",
4528
+ name: "架空管理職"
4529
+ }
4530
+ ]
4531
+ },
4532
+ T2_日付: {
4533
+ type: "DATE",
4534
+ value: "2026-02-02"
4535
+ },
4536
+ T2_数値: {
4537
+ type: "NUMBER",
4538
+ value: "20"
4539
+ },
4540
+ T2_ドロップダウン: {
4541
+ type: "DROP_DOWN",
4542
+ value: "B"
4543
+ },
4544
+ T2_組織: {
4545
+ type: "ORGANIZATION_SELECT",
4546
+ value: [
4547
+ {
4548
+ code: "demo_hq",
4549
+ name: "架空本社"
4550
+ }
4551
+ ]
4552
+ },
4553
+ T2_計算: {
4554
+ type: "CALC",
4555
+ value: "40"
4556
+ },
4557
+ T2_ラジオ: {
4558
+ type: "RADIO_BUTTON",
4559
+ value: "A"
4560
+ },
4561
+ T2_日時: {
4562
+ type: "DATETIME",
4563
+ value: "2026-02-02T00:30:00Z"
4564
+ },
4565
+ T2_添付: {
4566
+ type: "FILE",
4567
+ value: []
4568
+ },
4569
+ T2_時刻: {
4570
+ type: "TIME",
4571
+ value: "09:30"
4572
+ }
4573
+ }
4574
+ }
4575
+ ]
4576
+ },
4577
+ ステータス: {
4578
+ type: "STATUS",
4579
+ value: "未処理"
4580
+ },
4581
+ グループ1: {
4582
+ type: "GROUP_SELECT",
4583
+ value: [
4584
+ {
4585
+ code: "demo_managers",
4586
+ name: "架空管理職"
4587
+ }
4588
+ ]
4589
+ },
4590
+ テーブル1: {
4591
+ type: "SUBTABLE",
4592
+ value: [
4593
+ {
4594
+ id: "7727380",
4595
+ value: {
4596
+ T1_ユーザー: {
4597
+ type: "USER_SELECT",
4598
+ value: [
4599
+ {
4600
+ code: "demo_user01",
4601
+ name: "架空 社長"
4602
+ }
4603
+ ]
4604
+ },
4605
+ T1_文字列複数行: {
4606
+ type: "MULTI_LINE_TEXT",
4607
+ value: "行 1\n2 行目"
4608
+ },
4609
+ T1_ラジオ: {
4610
+ type: "RADIO_BUTTON",
4611
+ value: "A"
4612
+ },
4613
+ T1_複数選択: {
4614
+ type: "MULTI_SELECT",
4615
+ value: [
4616
+ "B"
4617
+ ]
4618
+ },
4619
+ T1_日付: {
4620
+ type: "DATE",
4621
+ value: "2026-01-10"
4622
+ },
4623
+ T1_ドロップダウン: {
4624
+ type: "DROP_DOWN",
4625
+ value: "A"
4626
+ },
4627
+ T1_リッチ: {
4628
+ type: "RICH_TEXT",
4629
+ value: "<div>行 1</div>"
4630
+ },
4631
+ T1_数値: {
4632
+ type: "NUMBER",
4633
+ value: "100"
4634
+ },
4635
+ T1_組織: {
4636
+ type: "ORGANIZATION_SELECT",
4637
+ value: [
4638
+ {
4639
+ code: "demo_hq",
4640
+ name: "架空本社"
4641
+ }
4642
+ ]
4643
+ },
4644
+ T1_リンク: {
4645
+ type: "LINK",
4646
+ value: "https://example.com/"
4647
+ },
4648
+ T1_文字列: {
4649
+ type: "SINGLE_LINE_TEXT",
4650
+ value: "行 1"
4651
+ },
4652
+ T1_計算: {
4653
+ type: "CALC",
4654
+ value: "200"
4655
+ },
4656
+ T1_添付: {
4657
+ type: "FILE",
4658
+ value: []
4659
+ },
4660
+ T1_日時: {
4661
+ type: "DATETIME",
4662
+ value: "2026-01-10T00:30:00Z"
4663
+ },
4664
+ T1_グループ: {
4665
+ type: "GROUP_SELECT",
4666
+ value: [
4667
+ {
4668
+ code: "demo_managers",
4669
+ name: "架空管理職"
4670
+ }
4671
+ ]
4672
+ },
4673
+ T1_チェック: {
4674
+ type: "CHECK_BOX",
4675
+ value: [
4676
+ "A"
4677
+ ]
4678
+ },
4679
+ T1_時刻: {
4680
+ type: "TIME",
4681
+ value: "09:30"
4682
+ }
4683
+ }
4684
+ },
4685
+ {
4686
+ id: "7727383",
4687
+ value: {
4688
+ T1_ユーザー: {
4689
+ type: "USER_SELECT",
4690
+ value: [
4691
+ {
4692
+ code: "demo_user01",
4693
+ name: "架空 社長"
4694
+ }
4695
+ ]
4696
+ },
4697
+ T1_文字列複数行: {
4698
+ type: "MULTI_LINE_TEXT",
4699
+ value: "行 2\n2 行目"
4700
+ },
4701
+ T1_ラジオ: {
4702
+ type: "RADIO_BUTTON",
4703
+ value: "A"
4704
+ },
4705
+ T1_複数選択: {
4706
+ type: "MULTI_SELECT",
4707
+ value: [
4708
+ "B"
4709
+ ]
4710
+ },
4711
+ T1_日付: {
4712
+ type: "DATE",
4713
+ value: "2026-01-20"
4714
+ },
4715
+ T1_ドロップダウン: {
4716
+ type: "DROP_DOWN",
4717
+ value: "B"
4718
+ },
4719
+ T1_リッチ: {
4720
+ type: "RICH_TEXT",
4721
+ value: "<div>行 2</div>"
4722
+ },
4723
+ T1_数値: {
4724
+ type: "NUMBER",
4725
+ value: "200"
4726
+ },
4727
+ T1_組織: {
4728
+ type: "ORGANIZATION_SELECT",
4729
+ value: [
4730
+ {
4731
+ code: "demo_hq",
4732
+ name: "架空本社"
4733
+ }
4734
+ ]
4735
+ },
4736
+ T1_リンク: {
4737
+ type: "LINK",
4738
+ value: "https://example.com/"
4739
+ },
4740
+ T1_文字列: {
4741
+ type: "SINGLE_LINE_TEXT",
4742
+ value: "行 2"
4743
+ },
4744
+ T1_計算: {
4745
+ type: "CALC",
4746
+ value: "400"
4747
+ },
4748
+ T1_添付: {
4749
+ type: "FILE",
4750
+ value: []
4751
+ },
4752
+ T1_日時: {
4753
+ type: "DATETIME",
4754
+ value: "2026-01-20T00:30:00Z"
4755
+ },
4756
+ T1_グループ: {
4757
+ type: "GROUP_SELECT",
4758
+ value: [
4759
+ {
4760
+ code: "demo_managers",
4761
+ name: "架空管理職"
4762
+ }
4763
+ ]
4764
+ },
4765
+ T1_チェック: {
4766
+ type: "CHECK_BOX",
4767
+ value: [
4768
+ "A"
4769
+ ]
4770
+ },
4771
+ T1_時刻: {
4772
+ type: "TIME",
4773
+ value: "09:30"
4774
+ }
4775
+ }
4776
+ },
4777
+ {
4778
+ id: "7727386",
4779
+ value: {
4780
+ T1_ユーザー: {
4781
+ type: "USER_SELECT",
4782
+ value: [
4783
+ {
4784
+ code: "demo_user01",
4785
+ name: "架空 社長"
4786
+ }
4787
+ ]
4788
+ },
4789
+ T1_文字列複数行: {
4790
+ type: "MULTI_LINE_TEXT",
4791
+ value: "行 3\n2 行目"
4792
+ },
4793
+ T1_ラジオ: {
4794
+ type: "RADIO_BUTTON",
4795
+ value: "A"
4796
+ },
4797
+ T1_複数選択: {
4798
+ type: "MULTI_SELECT",
4799
+ value: [
4800
+ "B"
4801
+ ]
4802
+ },
4803
+ T1_日付: {
4804
+ type: "DATE",
4805
+ value: "2026-01-30"
4806
+ },
4807
+ T1_ドロップダウン: {
4808
+ type: "DROP_DOWN",
4809
+ value: "A"
4810
+ },
4811
+ T1_リッチ: {
4812
+ type: "RICH_TEXT",
4813
+ value: "<div>行 3</div>"
4814
+ },
4815
+ T1_数値: {
4816
+ type: "NUMBER",
4817
+ value: "300"
4818
+ },
4819
+ T1_組織: {
4820
+ type: "ORGANIZATION_SELECT",
4821
+ value: [
4822
+ {
4823
+ code: "demo_hq",
4824
+ name: "架空本社"
4825
+ }
4826
+ ]
4827
+ },
4828
+ T1_リンク: {
4829
+ type: "LINK",
4830
+ value: "https://example.com/"
4831
+ },
4832
+ T1_文字列: {
4833
+ type: "SINGLE_LINE_TEXT",
4834
+ value: "行 3"
4835
+ },
4836
+ T1_計算: {
4837
+ type: "CALC",
4838
+ value: "600"
4839
+ },
4840
+ T1_添付: {
4841
+ type: "FILE",
4842
+ value: []
4843
+ },
4844
+ T1_日時: {
4845
+ type: "DATETIME",
4846
+ value: "2026-01-30T00:30:00Z"
4847
+ },
4848
+ T1_グループ: {
4849
+ type: "GROUP_SELECT",
4850
+ value: [
4851
+ {
4852
+ code: "demo_managers",
4853
+ name: "架空管理職"
4854
+ }
4855
+ ]
4856
+ },
4857
+ T1_チェック: {
4858
+ type: "CHECK_BOX",
4859
+ value: [
4860
+ "A"
4861
+ ]
4862
+ },
4863
+ T1_時刻: {
4864
+ type: "TIME",
4865
+ value: "09:30"
4866
+ }
4867
+ }
4868
+ }
4869
+ ]
4870
+ },
4871
+ ラジオ1: {
4872
+ type: "RADIO_BUTTON",
4873
+ value: "B"
4874
+ },
4875
+ グループ2: {
4876
+ type: "GROUP_SELECT",
4877
+ value: [
4878
+ {
4879
+ code: "demo_approvers",
4880
+ name: "架空承認者"
4881
+ }
4882
+ ]
4883
+ },
4884
+ ラジオ2: {
4885
+ type: "RADIO_BUTTON",
4886
+ value: "乙"
4887
+ },
4888
+ リッチ1: {
4889
+ type: "RICH_TEXT",
4890
+ value: "<div><b>太字</b>と<i>斜体</i></div>"
4891
+ },
4892
+ 時刻2: {
4893
+ type: "TIME",
4894
+ value: "17:45"
4895
+ },
4896
+ カテゴリー: {
4897
+ type: "CATEGORY",
4898
+ value: []
4899
+ },
4900
+ 時刻1: {
4901
+ type: "TIME",
4902
+ value: "09:30"
4903
+ },
4904
+ リンク1: {
4905
+ type: "LINK",
4906
+ value: "https://example.com/sample"
4907
+ },
4908
+ リッチ2: {
4909
+ type: "RICH_TEXT",
4910
+ value: "<div>リッチ 2</div>"
4911
+ },
4912
+ リンク2: {
4913
+ type: "LINK",
4914
+ value: "sample@example.com"
4915
+ },
4916
+ 計算2: {
4917
+ type: "CALC",
4918
+ value: "-75"
4919
+ },
4920
+ 計算1: {
4921
+ type: "CALC",
4922
+ value: "1290.78"
4923
+ },
4924
+ 複数選択2: {
4925
+ type: "MULTI_SELECT",
4926
+ value: [
4927
+ "丙"
4928
+ ]
4929
+ },
4930
+ 日時1: {
4931
+ type: "DATETIME",
4932
+ value: "2026-01-15T00:30:00Z"
4933
+ },
4934
+ 複数選択1: {
4935
+ type: "MULTI_SELECT",
4936
+ value: [
4937
+ "A",
4938
+ "B"
4939
+ ]
4940
+ },
4941
+ 日時2: {
4942
+ type: "DATETIME",
4943
+ value: "2026-03-31T08:45:00Z"
4944
+ },
4945
+ 枠内数値1: {
4946
+ type: "NUMBER",
4947
+ value: "42"
4948
+ },
4949
+ 作業者: {
4950
+ type: "STATUS_ASSIGNEE",
4951
+ value: []
4952
+ },
4953
+ 作成者: {
4954
+ type: "CREATOR",
4955
+ value: {
4956
+ code: "demo_user01",
4957
+ name: "架空 社長"
4958
+ }
4959
+ },
4960
+ $revision: {
4961
+ type: "__REVISION__",
4962
+ value: "2"
4963
+ },
4964
+ 文字列2: {
4965
+ type: "SINGLE_LINE_TEXT",
4966
+ value: "サンプル文字列 2"
4967
+ },
4968
+ 文字列1: {
4969
+ type: "SINGLE_LINE_TEXT",
4970
+ value: "サンプル文字列 1"
4971
+ },
4972
+ 更新日時: {
4973
+ type: "UPDATED_TIME",
4974
+ value: "2026-01-15T00:00:00Z"
4975
+ },
4976
+ 添付1: {
4977
+ type: "FILE",
4978
+ value: []
4979
+ },
4980
+ 添付2: {
4981
+ type: "FILE",
4982
+ value: []
4983
+ },
4984
+ 文字列複数行2: {
4985
+ type: "MULTI_LINE_TEXT",
4986
+ value: "複数行 2"
4987
+ },
4988
+ 日付1: {
4989
+ type: "DATE",
4990
+ value: "2026-01-15"
4991
+ },
4992
+ 枠内文字列1: {
4993
+ type: "SINGLE_LINE_TEXT",
4994
+ value: "枠の中の文字列"
4995
+ },
4996
+ 文字列複数行1: {
4997
+ type: "MULTI_LINE_TEXT",
4998
+ value: "1 行目\n2 行目\n3 行目"
4999
+ },
5000
+ 日付2: {
5001
+ type: "DATE",
5002
+ value: "2026-03-31"
5003
+ },
5004
+ 数値2: {
5005
+ type: "NUMBER",
5006
+ value: "56.78"
5007
+ },
5008
+ 数値1: {
5009
+ type: "NUMBER",
5010
+ value: "1234"
5011
+ },
5012
+ チェック1: {
5013
+ type: "CHECK_BOX",
5014
+ value: [
5015
+ "A",
5016
+ "C"
5017
+ ]
5018
+ },
5019
+ 作成日時: {
5020
+ type: "CREATED_TIME",
5021
+ value: "2026-01-15T00:00:00Z"
5022
+ },
5023
+ $id: {
5024
+ type: "__ID__",
5025
+ value: "1"
5026
+ }
5027
+ }
5028
+ };
5029
+
5030
+ // src/sample-app/record-2.json
5031
+ var record_2_default = {
5032
+ tool: "formula-authoring record",
5033
+ fetchedAt: "2026-01-15T00:00:00.000Z",
5034
+ baseUrl: "https://example.cybozu.com",
5035
+ appId: 4329,
5036
+ id: 2,
5037
+ record: {
5038
+ チェック2: {
5039
+ type: "CHECK_BOX",
5040
+ value: []
5041
+ },
5042
+ レコード番号: {
5043
+ type: "RECORD_NUMBER",
5044
+ value: "2"
5045
+ },
5046
+ ドロップダウン2: {
5047
+ type: "DROP_DOWN",
5048
+ value: "丙"
5049
+ },
5050
+ ユーザー2: {
5051
+ type: "USER_SELECT",
5052
+ value: []
5053
+ },
5054
+ 組織1: {
5055
+ type: "ORGANIZATION_SELECT",
5056
+ value: []
5057
+ },
5058
+ ドロップダウン1: {
5059
+ type: "DROP_DOWN",
5060
+ value: null
5061
+ },
5062
+ 更新者: {
5063
+ type: "MODIFIER",
5064
+ value: {
5065
+ code: "demo_user02",
5066
+ name: "架空 営業部長"
5067
+ }
5068
+ },
5069
+ ユーザー1: {
5070
+ type: "USER_SELECT",
5071
+ value: []
5072
+ },
5073
+ 組織2: {
5074
+ type: "ORGANIZATION_SELECT",
5075
+ value: []
5076
+ },
5077
+ テーブル2: {
5078
+ type: "SUBTABLE",
5079
+ value: []
5080
+ },
5081
+ ステータス: {
5082
+ type: "STATUS",
5083
+ value: "未処理"
5084
+ },
5085
+ グループ1: {
5086
+ type: "GROUP_SELECT",
5087
+ value: []
5088
+ },
5089
+ テーブル1: {
5090
+ type: "SUBTABLE",
5091
+ value: [
5092
+ {
5093
+ id: "7727396",
5094
+ value: {
5095
+ T1_ユーザー: {
5096
+ type: "USER_SELECT",
5097
+ value: []
5098
+ },
5099
+ T1_文字列複数行: {
5100
+ type: "MULTI_LINE_TEXT",
5101
+ value: "\n2 行目"
5102
+ },
5103
+ T1_ラジオ: {
5104
+ type: "RADIO_BUTTON",
5105
+ value: "A"
5106
+ },
5107
+ T1_複数選択: {
5108
+ type: "MULTI_SELECT",
5109
+ value: [
5110
+ "B"
5111
+ ]
5112
+ },
5113
+ T1_日付: {
5114
+ type: "DATE",
5115
+ value: "2026-02-28"
5116
+ },
5117
+ T1_ドロップダウン: {
5118
+ type: "DROP_DOWN",
5119
+ value: null
5120
+ },
5121
+ T1_リッチ: {
5122
+ type: "RICH_TEXT",
5123
+ value: "<div></div>"
5124
+ },
5125
+ T1_数値: {
5126
+ type: "NUMBER",
5127
+ value: "0"
5128
+ },
5129
+ T1_組織: {
5130
+ type: "ORGANIZATION_SELECT",
5131
+ value: []
5132
+ },
5133
+ T1_リンク: {
5134
+ type: "LINK",
5135
+ value: "https://example.com/"
5136
+ },
5137
+ T1_文字列: {
5138
+ type: "SINGLE_LINE_TEXT",
5139
+ value: ""
5140
+ },
5141
+ T1_計算: {
5142
+ type: "CALC",
5143
+ value: "0"
5144
+ },
5145
+ T1_添付: {
5146
+ type: "FILE",
5147
+ value: []
5148
+ },
5149
+ T1_日時: {
5150
+ type: "DATETIME",
5151
+ value: "2026-02-28T00:30:00Z"
5152
+ },
5153
+ T1_グループ: {
5154
+ type: "GROUP_SELECT",
5155
+ value: []
5156
+ },
5157
+ T1_チェック: {
5158
+ type: "CHECK_BOX",
5159
+ value: [
5160
+ "A"
5161
+ ]
5162
+ },
5163
+ T1_時刻: {
5164
+ type: "TIME",
5165
+ value: "09:30"
5166
+ }
5167
+ }
5168
+ }
5169
+ ]
5170
+ },
5171
+ ラジオ1: {
5172
+ type: "RADIO_BUTTON",
5173
+ value: "C"
5174
+ },
5175
+ グループ2: {
5176
+ type: "GROUP_SELECT",
5177
+ value: []
5178
+ },
5179
+ ラジオ2: {
5180
+ type: "RADIO_BUTTON",
5181
+ value: "甲"
5182
+ },
5183
+ リッチ1: {
5184
+ type: "RICH_TEXT",
5185
+ value: ""
5186
+ },
5187
+ 時刻2: {
5188
+ type: "TIME",
5189
+ value: "23:59"
5190
+ },
5191
+ カテゴリー: {
5192
+ type: "CATEGORY",
5193
+ value: []
5194
+ },
5195
+ 時刻1: {
5196
+ type: "TIME",
5197
+ value: "00:00"
5198
+ },
5199
+ リンク1: {
5200
+ type: "LINK",
5201
+ value: ""
5202
+ },
5203
+ リッチ2: {
5204
+ type: "RICH_TEXT",
5205
+ value: ""
5206
+ },
5207
+ リンク2: {
5208
+ type: "LINK",
5209
+ value: ""
5210
+ },
5211
+ 計算2: {
5212
+ type: "CALC",
5213
+ value: "-306"
5214
+ },
5215
+ 計算1: {
5216
+ type: "CALC",
5217
+ value: "-12.345"
5218
+ },
5219
+ 複数選択2: {
5220
+ type: "MULTI_SELECT",
5221
+ value: []
5222
+ },
5223
+ 日時1: {
5224
+ type: "DATETIME",
5225
+ value: "2026-12-31T14:59:00Z"
5226
+ },
5227
+ 複数選択1: {
5228
+ type: "MULTI_SELECT",
5229
+ value: []
5230
+ },
5231
+ 日時2: {
5232
+ type: "DATETIME",
5233
+ value: ""
5234
+ },
5235
+ 枠内数値1: {
5236
+ type: "NUMBER",
5237
+ value: ""
5238
+ },
5239
+ 作業者: {
5240
+ type: "STATUS_ASSIGNEE",
5241
+ value: []
5242
+ },
5243
+ 作成者: {
5244
+ type: "CREATOR",
5245
+ value: {
5246
+ code: "demo_user01",
5247
+ name: "架空 社長"
5248
+ }
5249
+ },
5250
+ $revision: {
5251
+ type: "__REVISION__",
5252
+ value: "2"
5253
+ },
5254
+ 文字列2: {
5255
+ type: "SINGLE_LINE_TEXT",
5256
+ value: ""
5257
+ },
5258
+ 文字列1: {
5259
+ type: "SINGLE_LINE_TEXT",
5260
+ value: "端の値"
5261
+ },
5262
+ 更新日時: {
5263
+ type: "UPDATED_TIME",
5264
+ value: "2026-01-15T00:00:00Z"
5265
+ },
5266
+ 添付1: {
5267
+ type: "FILE",
5268
+ value: []
5269
+ },
5270
+ 添付2: {
5271
+ type: "FILE",
5272
+ value: []
5273
+ },
5274
+ 文字列複数行2: {
5275
+ type: "MULTI_LINE_TEXT",
5276
+ value: ""
5277
+ },
5278
+ 日付1: {
5279
+ type: "DATE",
5280
+ value: "2026-02-28"
5281
+ },
5282
+ 枠内文字列1: {
5283
+ type: "SINGLE_LINE_TEXT",
5284
+ value: ""
5285
+ },
5286
+ 文字列複数行1: {
5287
+ type: "MULTI_LINE_TEXT",
5288
+ value: "1\n\n3\n"
5289
+ },
5290
+ 日付2: {
5291
+ type: "DATE",
5292
+ value: "2026-12-31"
5293
+ },
5294
+ 数値2: {
5295
+ type: "NUMBER",
5296
+ value: "-12.345"
5297
+ },
5298
+ 数値1: {
5299
+ type: "NUMBER",
5300
+ value: "0"
5301
+ },
5302
+ チェック1: {
5303
+ type: "CHECK_BOX",
5304
+ value: []
5305
+ },
5306
+ 作成日時: {
5307
+ type: "CREATED_TIME",
5308
+ value: "2026-01-15T00:00:00Z"
5309
+ },
5310
+ $id: {
5311
+ type: "__ID__",
5312
+ value: "2"
5313
+ }
5314
+ }
5315
+ };
5316
+
5317
+ // src/sample-app/record-3.json
5318
+ var record_3_default = {
5319
+ tool: "formula-authoring record",
5320
+ fetchedAt: "2026-01-15T00:00:00.000Z",
5321
+ baseUrl: "https://example.cybozu.com",
5322
+ appId: 4329,
5323
+ id: 3,
5324
+ record: {
5325
+ チェック2: {
5326
+ type: "CHECK_BOX",
5327
+ value: []
5328
+ },
5329
+ レコード番号: {
5330
+ type: "RECORD_NUMBER",
5331
+ value: "3"
5332
+ },
5333
+ ドロップダウン2: {
5334
+ type: "DROP_DOWN",
5335
+ value: null
5336
+ },
5337
+ ユーザー2: {
5338
+ type: "USER_SELECT",
5339
+ value: []
5340
+ },
5341
+ 組織1: {
5342
+ type: "ORGANIZATION_SELECT",
5343
+ value: []
5344
+ },
5345
+ ドロップダウン1: {
5346
+ type: "DROP_DOWN",
5347
+ value: null
5348
+ },
5349
+ 更新者: {
5350
+ type: "MODIFIER",
5351
+ value: {
5352
+ code: "demo_user02",
5353
+ name: "架空 営業部長"
5354
+ }
5355
+ },
5356
+ ユーザー1: {
5357
+ type: "USER_SELECT",
5358
+ value: []
5359
+ },
5360
+ 組織2: {
5361
+ type: "ORGANIZATION_SELECT",
5362
+ value: []
5363
+ },
5364
+ テーブル2: {
5365
+ type: "SUBTABLE",
5366
+ value: []
5367
+ },
5368
+ ステータス: {
5369
+ type: "STATUS",
5370
+ value: "未処理"
5371
+ },
5372
+ グループ1: {
5373
+ type: "GROUP_SELECT",
5374
+ value: []
5375
+ },
5376
+ テーブル1: {
5377
+ type: "SUBTABLE",
5378
+ value: []
5379
+ },
5380
+ ラジオ1: {
5381
+ type: "RADIO_BUTTON",
5382
+ value: "A"
5383
+ },
5384
+ グループ2: {
5385
+ type: "GROUP_SELECT",
5386
+ value: []
5387
+ },
5388
+ ラジオ2: {
5389
+ type: "RADIO_BUTTON",
5390
+ value: "甲"
5391
+ },
5392
+ リッチ1: {
5393
+ type: "RICH_TEXT",
5394
+ value: ""
5395
+ },
5396
+ 時刻2: {
5397
+ type: "TIME",
5398
+ value: null
5399
+ },
5400
+ カテゴリー: {
5401
+ type: "CATEGORY",
5402
+ value: []
5403
+ },
5404
+ 時刻1: {
5405
+ type: "TIME",
5406
+ value: null
5407
+ },
5408
+ リンク1: {
5409
+ type: "LINK",
5410
+ value: ""
5411
+ },
5412
+ リッチ2: {
5413
+ type: "RICH_TEXT",
5414
+ value: ""
5415
+ },
5416
+ リンク2: {
5417
+ type: "LINK",
5418
+ value: ""
5419
+ },
5420
+ 計算2: {
5421
+ type: "CALC",
5422
+ value: "0"
5423
+ },
5424
+ 計算1: {
5425
+ type: "CALC",
5426
+ value: "0"
5427
+ },
5428
+ 複数選択2: {
5429
+ type: "MULTI_SELECT",
5430
+ value: []
5431
+ },
5432
+ 日時1: {
5433
+ type: "DATETIME",
5434
+ value: ""
5435
+ },
5436
+ 複数選択1: {
5437
+ type: "MULTI_SELECT",
5438
+ value: []
5439
+ },
5440
+ 日時2: {
5441
+ type: "DATETIME",
5442
+ value: ""
5443
+ },
5444
+ 枠内数値1: {
5445
+ type: "NUMBER",
5446
+ value: ""
5447
+ },
5448
+ 作業者: {
5449
+ type: "STATUS_ASSIGNEE",
5450
+ value: []
5451
+ },
5452
+ 作成者: {
5453
+ type: "CREATOR",
5454
+ value: {
5455
+ code: "demo_user01",
5456
+ name: "架空 社長"
5457
+ }
5458
+ },
5459
+ $revision: {
5460
+ type: "__REVISION__",
5461
+ value: "2"
5462
+ },
5463
+ 文字列2: {
5464
+ type: "SINGLE_LINE_TEXT",
5465
+ value: ""
5466
+ },
5467
+ 文字列1: {
5468
+ type: "SINGLE_LINE_TEXT",
5469
+ value: "空のレコード"
5470
+ },
5471
+ 更新日時: {
5472
+ type: "UPDATED_TIME",
5473
+ value: "2026-01-15T00:00:00Z"
5474
+ },
5475
+ 添付1: {
5476
+ type: "FILE",
5477
+ value: []
5478
+ },
5479
+ 添付2: {
5480
+ type: "FILE",
5481
+ value: []
5482
+ },
5483
+ 文字列複数行2: {
5484
+ type: "MULTI_LINE_TEXT",
5485
+ value: ""
5486
+ },
5487
+ 日付1: {
5488
+ type: "DATE",
5489
+ value: null
5490
+ },
5491
+ 枠内文字列1: {
5492
+ type: "SINGLE_LINE_TEXT",
5493
+ value: ""
5494
+ },
5495
+ 文字列複数行1: {
5496
+ type: "MULTI_LINE_TEXT",
5497
+ value: ""
5498
+ },
5499
+ 日付2: {
5500
+ type: "DATE",
5501
+ value: null
5502
+ },
5503
+ 数値2: {
5504
+ type: "NUMBER",
5505
+ value: ""
5506
+ },
5507
+ 数値1: {
5508
+ type: "NUMBER",
5509
+ value: ""
5510
+ },
5511
+ チェック1: {
5512
+ type: "CHECK_BOX",
5513
+ value: []
5514
+ },
5515
+ 作成日時: {
5516
+ type: "CREATED_TIME",
5517
+ value: "2026-01-15T00:00:00Z"
5518
+ },
5519
+ $id: {
5520
+ type: "__ID__",
5521
+ value: "3"
5522
+ }
5523
+ }
5524
+ };
5525
+
5526
+ // src/sample-app.ts
5527
+ var LABELS = {
5528
+ 1: "典型(全項目に値)",
5529
+ 2: "端(0・負の小数・改行・未選択・月末と年末の日付)",
5530
+ 3: "空(ほぼ全部空)"
5531
+ };
5532
+ function sampleRecord(data, id) {
5533
+ if (data.appId !== fields_default.appId || data.id !== id || !data.record || typeof data.record !== "object") throw new Error(`サンプルレコード ${id} の形が違う(src/sample-app/record-${id}.json)`);
5534
+ return { id, label: LABELS[id] ?? "", record: data.record };
5535
+ }
5536
+ var SAMPLE_APP = {
5537
+ fields: fields_default,
5538
+ records: [sampleRecord(record_1_default, 1), sampleRecord(record_2_default, 2), sampleRecord(record_3_default, 3)]
5539
+ };
5540
+ function sampleApp() {
5541
+ return structuredClone(SAMPLE_APP);
5542
+ }
5543
+ var tableRows = (record, code) => {
5544
+ const v = record[code]?.value;
5545
+ return Array.isArray(v) ? v.length : 0;
5546
+ };
5547
+ function describeSampleApp(targetTypes) {
5548
+ const { fields, records } = SAMPLE_APP;
5549
+ const tables = Object.values(fields.properties).filter((p) => p.type === "SUBTABLE").map((p) => p.code).sort();
5550
+ const lines = [
5551
+ `サンプルアプリ「${fields.appName}」(try / fml_try の試し計算に使う架空のアプリ。接続先 ${fields.baseUrl}。利用者のアプリではない)`,
5552
+ summarizeFields(fields),
5553
+ "",
5554
+ "項目(1 項目 1 行。○ = 計算式を設定できる型。テーブルの子は T1_ / T2_ の接頭辞):",
5555
+ listFields(fields, { targetTypes }),
5556
+ "",
5557
+ "レコード(try の records で選ぶ。既定は 3 件とも):",
5558
+ ...records.map((r) => ` ${r.id}: ${r.label}。${tables.map((t) => `${t} ${tableRows(r.record, t)} 行`).join("、")}`),
5559
+ "ユーザー・組織・グループの値は既定のテストデータ(架空の 10 人。demo_user01 …)のコード"
5560
+ ];
5561
+ return lines.join("\n");
5562
+ }
5563
+
2562
5564
  // src/normalize/policy.ts
2563
5565
  import { existsSync as existsSync7, readFileSync as readFileSync9, statSync as statSync5 } from "node:fs";
2564
5566
  import path12 from "node:path";
@@ -2568,10 +5570,10 @@ var POLICY_FILE = path12.join("policy", "authoring-policy.json");
2568
5570
  var MAX_POLICY_BYTES = 64 * 1024;
2569
5571
  var FUNCTION_NAME = /^[A-Z][A-Z0-9_]{0,40}$/;
2570
5572
  var DEFAULT_POLICY = { allowFunctions: [], allowMiscChanges: false };
2571
- function parsePolicy(text, file) {
5573
+ function parsePolicy(text2, file) {
2572
5574
  let raw;
2573
5575
  try {
2574
- raw = JSON.parse(text.replace(/^/, ""));
5576
+ raw = JSON.parse(text2.replace(/^/, ""));
2575
5577
  } catch (e) {
2576
5578
  throw new PolicyError(`${file} を JSON として読めない: ${e instanceof Error ? e.message : String(e)}`);
2577
5579
  }
@@ -2674,9 +5676,9 @@ var isPlain = (v) => !!v && typeof v === "object" && !Array.isArray(v);
2674
5676
  var UINFO_OPTIONS = /* @__PURE__ */ new Set(["id", "code", "ctime", "mtime", "valid", "name", "surName", "givenName", "surNameReading", "givenNameReading", "localName", "localNameLocale", "timezone", "locale", "description", "phone", "mobilePhone", "extensionNumber", "email", "callto", "url", "employeeNumber", "birthDate", "joinDate", "groups", "orgs", "primaryOrganization", "sortOrder", "setData", "parentCode", "users", "children"]);
2675
5677
  function codesInStrings(scan, userInfoFns) {
2676
5678
  const out = [];
2677
- for (const { text, call } of scan.stringArgs) {
5679
+ for (const { text: text2, call } of scan.stringArgs) {
2678
5680
  if (!userInfoFns.includes(call)) continue;
2679
- for (const c of text.split(",")) {
5681
+ for (const c of text2.split(",")) {
2680
5682
  const t = c.trim();
2681
5683
  if (t && !t.startsWith("#") && !UINFO_OPTIONS.has(t) && /^[^\s"]{1,128}$/.test(t) && !out.includes(t)) out.push(t);
2682
5684
  }
@@ -2993,7 +5995,7 @@ function calcSettings(input) {
2993
5995
  engine.setContext({ appId: input.appId, mobile: !!input.mobile, loginUser, lookupTargets: targets.lookupTargets, relatedTargets: targets.relatedTargets, usersInfo: table, usersOrigin: table ? input.usersOrigin : { kind: "none" } });
2994
5996
  const needs = normalized.contextNeeds;
2995
5997
  const ctx = engine.context();
2996
- if (needs.appUrl.length && ctx.baseUrl === DEFAULT_CONTEXT_BASE_URL) throw new InputError(`APP_URL を使う項目(${needs.appUrl.join(", ")})があるが、接続先の URL が無い(.env の KINTONE_BASE_URL)`);
5998
+ if (needs.appUrl.length && ctx.baseUrl === DEFAULT_CONTEXT_BASE_URL && !input.allowDefaultBaseUrl) throw new InputError(`APP_URL を使う項目(${needs.appUrl.join(", ")})があるが、接続先の URL が無い(.env の KINTONE_BASE_URL)`);
2997
5999
  if (needs.login.length && !loginUser) throw new InputError(`ログインユーザーを使う項目(${needs.login.join(", ")})があるが、ユーザーが決まらない(--user <code>。既定の authoring が ${input.usersOrigin.kind === "file" ? input.usersOrigin.file : "テストデータ"} に居ない)`);
2998
6000
  for (const l of needs.lookups) if (!(l.arg in targets.lookupTargets)) throw new InputError(`${l.fieldcode} の LOOKUP_GETID(${l.arg}): ${l.arg} はルックアップ項目でないか、参照先のアプリを参照する権限が無い(fields を取り直す)`);
2999
6001
  for (const l of needs.related) if (!(l.arg in targets.relatedTargets)) throw new InputError(`${l.fieldcode} の RELATED_GETID(${l.arg}): ${l.arg} は関連レコード一覧でないか、参照先のアプリを参照する権限が無い`);
@@ -3038,52 +6040,765 @@ function calcSettings(input) {
3038
6040
  results.push({ id, lines, changed: lines.filter((l) => l.changed).length, errors, sinks, failed: sinks.length > 0 });
3039
6041
  }
3040
6042
  engine.clearSinkCalls();
3041
- const text = [notice, contextLine];
6043
+ const text2 = [notice, contextLine];
3042
6044
  for (const res of results) {
3043
- text.push(`レコード ${res.id}: 計算対象 ${res.lines.length} 項目、変わる ${res.changed}${res.errors.length ? `、エラー ${res.errors.length}` : ""}`);
6045
+ text2.push(`レコード ${res.id}: 計算対象 ${res.lines.length} 項目、変わる ${res.changed}${res.errors.length ? `、エラー ${res.errors.length}` : ""}`);
3044
6046
  for (const l of res.lines) {
3045
6047
  const marks = l.marks.length ? ` [${l.marks.join("、")}]` : "";
3046
6048
  if (isTable(l.before) && isTable(l.after)) {
3047
6049
  const rows = Math.max(l.before.length, l.after.length);
3048
- text.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: テーブル ${l.before.length} 行 → ${l.after.length} 行${marks}`);
6050
+ text2.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: テーブル ${l.before.length} 行 → ${l.after.length} 行${marks}`);
3049
6051
  for (let i = 0; i < rows; i++) {
3050
6052
  if (i >= l.after.length) {
3051
- text.push(` 行 ${i + 1}(削除)`);
6053
+ text2.push(` 行 ${i + 1}(削除)`);
3052
6054
  continue;
3053
6055
  }
3054
6056
  const av = l.after[i]?.value ?? {};
3055
6057
  if (i >= l.before.length) {
3056
6058
  const cells2 = Object.keys(av).filter((c) => av[c]?.value !== void 0 && av[c]?.value !== "" && !(Array.isArray(av[c]?.value) && (av[c]?.value).length === 0)).map((c) => `${c} ${short(av[c]?.value)}`);
3057
- text.push(` 行 ${i + 1}(追加): ${cells2.join("、") || "(空)"}`);
6059
+ text2.push(` 行 ${i + 1}(追加): ${cells2.join("、") || "(空)"}`);
3058
6060
  continue;
3059
6061
  }
3060
6062
  const bv = l.before[i]?.value ?? {};
3061
6063
  const cells = [.../* @__PURE__ */ new Set([...Object.keys(bv), ...Object.keys(av)])].filter((c) => JSON.stringify(bv[c]?.value) !== JSON.stringify(av[c]?.value)).map((c) => `${c} ${short(bv[c]?.value)} → ${short(av[c]?.value)}`);
3062
- if (cells.length) text.push(` 行 ${i + 1}: ${cells.join("、")}`);
6064
+ if (cells.length) text2.push(` 行 ${i + 1}: ${cells.join("、")}`);
3063
6065
  }
3064
6066
  continue;
3065
6067
  }
3066
- text.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: ${short(l.before)} → ${short(l.after)}${marks}`);
6068
+ text2.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: ${short(l.before)} → ${short(l.after)}${marks}`);
3067
6069
  }
3068
- for (const e of res.errors) text.push(` ! ${e.fieldcode}(${e.phases.join(", ")}): ${e.message}`);
3069
- if (res.failed) text.push(" ! このレコードの結果は採らない(実行時の sink)");
6070
+ for (const e of res.errors) text2.push(` ! ${e.fieldcode}(${e.phases.join(", ")}): ${e.message}`);
6071
+ if (res.failed) text2.push(" ! このレコードの結果は採らない(実行時の sink)");
3070
6072
  }
3071
6073
  let summary = "";
3072
6074
  if (results.length > 1) {
3073
6075
  const changedRecords = results.filter((r) => r.changed > 0).length;
3074
6076
  const changedFields = new Set(results.flatMap((r) => r.lines.filter((l) => l.changed).map((l) => l.fieldcode)));
3075
6077
  summary = `入力した ${results.length} 件中 ${changedRecords} 件の模擬差分。変わる項目: ${[...changedFields].join(", ") || "なし"}(この件数は入力したレコードとこの文脈でのもの。アプリ全体の件数ではない)`;
3076
- text.push(summary);
6078
+ text2.push(summary);
6079
+ }
6080
+ return { contextLine, notice, records: results, summary, text: text2.join("\n") };
6081
+ }
6082
+
6083
+ // src/commands/try-data.ts
6084
+ var TRY_MAX_EXTRA_FIELDS = 20;
6085
+ var TRY_MAX_DATA = 5;
6086
+ var TRY_MAX_TABLE_ROWS = 20;
6087
+ var TRY_MAX_OPTIONS = 50;
6088
+ var TRY_MAX_VALUE_CHARS = 2e3;
6089
+ var TYPE_ALIASES = {
6090
+ TEXT: "SINGLE_LINE_TEXT",
6091
+ STRING: "SINGLE_LINE_TEXT",
6092
+ TEXTAREA: "MULTI_LINE_TEXT",
6093
+ MULTILINE: "MULTI_LINE_TEXT",
6094
+ RICH: "RICH_TEXT",
6095
+ NUM: "NUMBER",
6096
+ DROPDOWN: "DROP_DOWN",
6097
+ RADIO: "RADIO_BUTTON",
6098
+ CHECKBOX: "CHECK_BOX",
6099
+ MULTISELECT: "MULTI_SELECT",
6100
+ USER: "USER_SELECT",
6101
+ ORG: "ORGANIZATION_SELECT",
6102
+ ORGANIZATION: "ORGANIZATION_SELECT",
6103
+ URL: "LINK",
6104
+ TABLE: "SUBTABLE"
6105
+ };
6106
+ var EXTRA_TYPES = [
6107
+ "SINGLE_LINE_TEXT",
6108
+ "MULTI_LINE_TEXT",
6109
+ "RICH_TEXT",
6110
+ "NUMBER",
6111
+ "DATE",
6112
+ "DATETIME",
6113
+ "TIME",
6114
+ "DROP_DOWN",
6115
+ "RADIO_BUTTON",
6116
+ "CHECK_BOX",
6117
+ "MULTI_SELECT",
6118
+ "USER_SELECT",
6119
+ "ORGANIZATION_SELECT",
6120
+ "GROUP_SELECT",
6121
+ "LINK",
6122
+ "SUBTABLE"
6123
+ ];
6124
+ var CHOICE_TYPES = /* @__PURE__ */ new Set(["DROP_DOWN", "RADIO_BUTTON", "CHECK_BOX", "MULTI_SELECT"]);
6125
+ var CODE_RE = /^[\p{L}_・$¥][\p{L}\p{N}_・$¥]{0,127}$/u;
6126
+ function canonicalType(type) {
6127
+ const upper = String(type).trim().toUpperCase();
6128
+ return TYPE_ALIASES[upper] ?? upper;
6129
+ }
6130
+ function propertyOf(code, type, label, options) {
6131
+ const base = { type, code, label, noLabel: false, required: false };
6132
+ const opts = options ? { options: Object.fromEntries(options.map((o, i) => [o, { label: o, index: String(i) }])) } : {};
6133
+ switch (type) {
6134
+ case "NUMBER":
6135
+ return { ...base, minValue: "", maxValue: "", digit: false, unique: false, defaultValue: "", displayScale: "", unit: "", unitPosition: "BEFORE" };
6136
+ case "SINGLE_LINE_TEXT":
6137
+ return { ...base, minLength: "", maxLength: "", expression: "", hideExpression: false, unique: false, defaultValue: "" };
6138
+ case "LINK":
6139
+ return { ...base, protocol: "WEB", minLength: "", maxLength: "", unique: false, defaultValue: "" };
6140
+ case "MULTI_LINE_TEXT":
6141
+ case "RICH_TEXT":
6142
+ return { ...base, defaultValue: "" };
6143
+ case "DATE":
6144
+ case "DATETIME":
6145
+ return { ...base, unique: false, defaultValue: "", defaultNowValue: false };
6146
+ case "TIME":
6147
+ return { ...base, defaultValue: "", defaultNowValue: false };
6148
+ case "DROP_DOWN":
6149
+ return { ...base, ...opts, defaultValue: "" };
6150
+ case "RADIO_BUTTON":
6151
+ return { ...base, ...opts, defaultValue: options?.[0] ?? "", align: "HORIZONTAL" };
6152
+ case "CHECK_BOX":
6153
+ case "MULTI_SELECT":
6154
+ return { ...base, ...opts, defaultValue: [], align: "HORIZONTAL" };
6155
+ case "USER_SELECT":
6156
+ case "ORGANIZATION_SELECT":
6157
+ case "GROUP_SELECT":
6158
+ return { ...base, entities: [], defaultValue: [] };
6159
+ case "SUBTABLE":
6160
+ return { type, code, label, noLabel: false, fields: {} };
6161
+ default:
6162
+ throw new InputError(`項目 ${code} の型 ${type} は足せない(${EXTRA_TYPES.join(", ")})`);
6163
+ }
6164
+ }
6165
+ function layoutTableOf(layout, code) {
6166
+ for (const row of layout) {
6167
+ if (row.type === "SUBTABLE" && row.code === code) return row;
6168
+ if (row.type === "GROUP" && Array.isArray(row.layout)) {
6169
+ const hit = layoutTableOf(row.layout, code);
6170
+ if (hit) return hit;
6171
+ }
6172
+ }
6173
+ return void 0;
6174
+ }
6175
+ var sizeOf = (type) => type === "MULTI_LINE_TEXT" || type === "RICH_TEXT" ? { width: "250", innerHeight: "125" } : { width: "200" };
6176
+ function allCodesOf(fields) {
6177
+ const codes = /* @__PURE__ */ new Set();
6178
+ for (const p of Object.values(fields.properties)) {
6179
+ codes.add(p.code);
6180
+ for (const c of Object.values(p.fields ?? {})) codes.add(c.code);
6181
+ }
6182
+ return codes;
6183
+ }
6184
+ function checkOptions(def, type, where) {
6185
+ if (!CHOICE_TYPES.has(type)) {
6186
+ if (def.options !== void 0) throw new InputError(`${where}: ${type} に options は付けない`);
6187
+ return void 0;
6188
+ }
6189
+ if (!Array.isArray(def.options) || !def.options.length) throw new InputError(`${where}: ${type} には options(選択肢の配列)が要る`);
6190
+ if (def.options.length > TRY_MAX_OPTIONS) throw new InputError(`${where}: options は ${TRY_MAX_OPTIONS} 個まで`);
6191
+ const seen = /* @__PURE__ */ new Set();
6192
+ for (const o of def.options) {
6193
+ if (typeof o !== "string" || !o.trim() || [...o].length > 100) throw new InputError(`${where}: options は空でない文字列(100 文字まで): ${JSON.stringify(o)}`);
6194
+ if (seen.has(o)) throw new InputError(`${where}: options が重複: ${o}`);
6195
+ seen.add(o);
6196
+ }
6197
+ return def.options;
6198
+ }
6199
+ function extendFields(fields, defs) {
6200
+ const out = structuredClone(fields);
6201
+ const codes = allCodesOf(out);
6202
+ const added = [];
6203
+ let count = 0;
6204
+ const describe = (type, options, children) => `${type}${options ? `: ${options.join(" / ")}` : ""}${children ? `: ${children.join(", ")}` : ""}`;
6205
+ const takeCode = (def, where) => {
6206
+ if (typeof def.code !== "string" || !CODE_RE.test(def.code)) throw new InputError(`${where}: code はフィールドコード(文字・数字・_ で、数字で始まらない。128 文字まで): ${JSON.stringify(def.code)}`);
6207
+ if (codes.has(def.code)) throw new InputError(`${where}: ${def.code} は既にある項目(標本の項目と重ならないコードにする)`);
6208
+ if (++count > TRY_MAX_EXTRA_FIELDS) throw new InputError(`足す項目は ${TRY_MAX_EXTRA_FIELDS} 個まで(テーブルの子も数える)`);
6209
+ codes.add(def.code);
6210
+ return def.code;
6211
+ };
6212
+ const labelOf = (def, where) => {
6213
+ if (def.label !== void 0 && (typeof def.label !== "string" || [...def.label].length > 128)) throw new InputError(`${where}: label は 128 文字まで`);
6214
+ return def.label ?? def.code;
6215
+ };
6216
+ defs.forEach((def, i) => {
6217
+ const where = `fields[${i}]`;
6218
+ if (!def || typeof def !== "object") throw new InputError(`${where}: 項目はオブジェクト({ code, type, options?, table?, fields? })`);
6219
+ const type = canonicalType(def.type ?? "");
6220
+ if (!EXTRA_TYPES.includes(type)) throw new InputError(`${where}: 型 ${JSON.stringify(def.type)} は足せない(${EXTRA_TYPES.join(", ")})`);
6221
+ if (def.table !== void 0 && type === "SUBTABLE") throw new InputError(`${where}: テーブルの中にテーブルは置けない(table と type SUBTABLE は一緒に書かない)`);
6222
+ if (def.fields !== void 0 && type !== "SUBTABLE") throw new InputError(`${where}: fields(子)は type SUBTABLE のときだけ`);
6223
+ const code = takeCode(def, where);
6224
+ const label = labelOf(def, where);
6225
+ const options = checkOptions(def, type, where);
6226
+ if (def.table !== void 0) {
6227
+ const parent = out.properties[def.table];
6228
+ if (!parent || parent.type !== "SUBTABLE") throw new InputError(`${where}: table ${JSON.stringify(def.table)} はテーブルでない(標本のテーブル1 / テーブル2 か、先に足したテーブル)`);
6229
+ parent.fields ??= {};
6230
+ parent.fields[code] = propertyOf(code, type, label, options);
6231
+ const slot = layoutTableOf(out.layout, def.table);
6232
+ if (!slot) throw new InputError(`${where}: テーブル ${def.table} がレイアウトに無い`);
6233
+ slot.fields ??= [];
6234
+ slot.fields.push({ type, code, size: sizeOf(type) });
6235
+ added.push(`${code}(${describe(type, options)}。${def.table} の子)`);
6236
+ return;
6237
+ }
6238
+ if (type === "SUBTABLE") {
6239
+ if (!Array.isArray(def.fields) || !def.fields.length) throw new InputError(`${where}: SUBTABLE には fields(子の配列。1 つ以上)が要る`);
6240
+ const table = propertyOf(code, type, label, void 0);
6241
+ const slot = { type: "SUBTABLE", code, fields: [] };
6242
+ const names = [];
6243
+ def.fields.forEach((child, j) => {
6244
+ const cw = `${where}.fields[${j}]`;
6245
+ if (!child || typeof child !== "object") throw new InputError(`${cw}: 子はオブジェクト({ code, type, options? })`);
6246
+ const ct = canonicalType(child.type ?? "");
6247
+ if (!EXTRA_TYPES.includes(ct) || ct === "SUBTABLE") throw new InputError(`${cw}: 型 ${JSON.stringify(child.type)} はテーブルの子にできない`);
6248
+ if (child.table !== void 0 || child.fields !== void 0) throw new InputError(`${cw}: 子に table / fields は書けない`);
6249
+ const cc = takeCode(child, cw);
6250
+ table.fields[cc] = propertyOf(cc, ct, labelOf(child, cw), checkOptions(child, ct, cw));
6251
+ slot.fields.push({ type: ct, code: cc, size: sizeOf(ct) });
6252
+ names.push(cc);
6253
+ });
6254
+ out.properties[code] = table;
6255
+ out.layout.push(slot);
6256
+ added.push(`${code}(${describe(type, void 0, names)})`);
6257
+ return;
6258
+ }
6259
+ out.properties[code] = propertyOf(code, type, label, options);
6260
+ out.layout.push({ type: "ROW", fields: [{ type, code, size: sizeOf(type) }] });
6261
+ added.push(`${code}(${describe(type, options)})`);
6262
+ });
6263
+ return { fields: out, added };
6264
+ }
6265
+ function normalizeDefaults(fields) {
6266
+ const out = structuredClone(fields);
6267
+ const fix = (p) => {
6268
+ if (p.type === "SUBTABLE") {
6269
+ for (const c of Object.values(p.fields ?? {})) fix(c);
6270
+ return;
6271
+ }
6272
+ if (NO_VALUE_TYPES.has(p.type) || p.type === "CALC" || /^(RECORD_NUMBER|CREATOR|MODIFIER|CREATED_TIME|UPDATED_TIME|STATUS|STATUS_ASSIGNEE|CATEGORY|FILE)$/.test(p.type)) return;
6273
+ const arrayType = /^(CHECK_BOX|MULTI_SELECT|USER_SELECT|ORGANIZATION_SELECT|GROUP_SELECT)$/.test(p.type);
6274
+ if (arrayType) {
6275
+ if (!Array.isArray(p.defaultValue)) p.defaultValue = [];
6276
+ } else if (p.defaultValue === void 0 || p.defaultValue === null) p.defaultValue = "";
6277
+ };
6278
+ for (const p of Object.values(out.properties)) fix(p);
6279
+ return out;
6280
+ }
6281
+ function emptyValueOf(type) {
6282
+ switch (type) {
6283
+ case "CHECK_BOX":
6284
+ case "MULTI_SELECT":
6285
+ case "USER_SELECT":
6286
+ case "ORGANIZATION_SELECT":
6287
+ case "GROUP_SELECT":
6288
+ case "FILE":
6289
+ case "STATUS_ASSIGNEE":
6290
+ case "CATEGORY":
6291
+ case "SUBTABLE":
6292
+ return [];
6293
+ case "CREATOR":
6294
+ case "MODIFIER":
6295
+ return { code: "", name: "" };
6296
+ default:
6297
+ return "";
6298
+ }
6299
+ }
6300
+ var NO_VALUE_TYPES = /* @__PURE__ */ new Set(["GROUP", "REFERENCE_TABLE", "LABEL", "SPACER", "HR"]);
6301
+ function emptyRecordOf(fields, id) {
6302
+ const rec = { $id: { type: "__ID__", value: id }, $revision: { type: "__REVISION__", value: "1" } };
6303
+ for (const p of Object.values(fields.properties)) {
6304
+ if (NO_VALUE_TYPES.has(p.type)) continue;
6305
+ const value = p.type === "RECORD_NUMBER" ? id : p.type === "CREATED_TIME" || p.type === "UPDATED_TIME" ? "2026-01-15T00:00:00Z" : emptyValueOf(p.type);
6306
+ rec[p.code] = { type: p.type, value };
6307
+ }
6308
+ return rec;
6309
+ }
6310
+ function fillMissing(fields, record) {
6311
+ const out = structuredClone(record);
6312
+ for (const p of Object.values(fields.properties)) {
6313
+ if (NO_VALUE_TYPES.has(p.type)) continue;
6314
+ if (!(p.code in out)) out[p.code] = { type: p.type, value: emptyValueOf(p.type) };
6315
+ if (p.type === "SUBTABLE") {
6316
+ const rows = out[p.code].value;
6317
+ if (Array.isArray(rows)) {
6318
+ for (const row of rows) {
6319
+ row.value ??= {};
6320
+ for (const c of Object.values(p.fields ?? {})) if (!(c.code in row.value)) row.value[c.code] = { type: c.type, value: emptyValueOf(c.type) };
6321
+ }
6322
+ }
6323
+ }
6324
+ }
6325
+ return out;
6326
+ }
6327
+ var NUMBER_RE = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
6328
+ var DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
6329
+ var TIME_RE = /^\d{2}:\d{2}$/;
6330
+ var DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(Z|[+-]\d{2}:\d{2})$/;
6331
+ var isEmpty = (v) => v === "" || v === null || v === void 0;
6332
+ function text(v, where) {
6333
+ if (isEmpty(v)) return "";
6334
+ if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
6335
+ const s = String(v);
6336
+ if ([...s].length > TRY_MAX_VALUE_CHARS) throw new InputError(`${where}: 文字列は ${TRY_MAX_VALUE_CHARS} 文字まで`);
6337
+ return s;
6338
+ }
6339
+ throw new InputError(`${where}: 文字列を書く(${JSON.stringify(v).slice(0, 40)})`);
6340
+ }
6341
+ function codeList(v, where, kind, users) {
6342
+ if (isEmpty(v)) return [];
6343
+ const list = Array.isArray(v) ? v : [v];
6344
+ const table = kind === "org" ? users?.orgCodes : kind === "group" ? users?.groupCodes : users?.userCodes;
6345
+ return list.map((e, i) => {
6346
+ const code = typeof e === "string" ? e : e && typeof e === "object" && typeof e.code === "string" ? e.code : void 0;
6347
+ if (code === void 0 || !code.trim() || [...code].length > 128) throw new InputError(`${where}[${i}]: コード(文字列)か { code, name? } を書く`);
6348
+ const given = e && typeof e === "object" ? e.name : void 0;
6349
+ const name = typeof given === "string" ? given : typeof table?.[code]?.name === "string" ? String(table[code].name) : code;
6350
+ return { code, name };
6351
+ });
6352
+ }
6353
+ function stringList(v, where, options) {
6354
+ if (isEmpty(v)) return [];
6355
+ const list = Array.isArray(v) ? v : [v];
6356
+ return list.map((e, i) => {
6357
+ if (typeof e !== "string") throw new InputError(`${where}[${i}]: 文字列を書く`);
6358
+ if (options && !(e in options)) throw new InputError(`${where}[${i}]: 選択肢に無い値 ${JSON.stringify(e)}(${Object.keys(options).join(" / ")})`);
6359
+ return e;
6360
+ });
6361
+ }
6362
+ function convertValue(prop, v, where, users) {
6363
+ const options = prop.options;
6364
+ switch (prop.type) {
6365
+ case "NUMBER": {
6366
+ if (isEmpty(v)) return "";
6367
+ if (typeof v === "number") {
6368
+ if (!Number.isFinite(v)) throw new InputError(`${where}: NUMBER は有限の数`);
6369
+ return String(v);
6370
+ }
6371
+ if (typeof v === "string" && NUMBER_RE.test(v.trim())) return v.trim();
6372
+ throw new InputError(`${where}: NUMBER は数か数字の文字列(${JSON.stringify(v).slice(0, 40)})`);
6373
+ }
6374
+ case "SINGLE_LINE_TEXT":
6375
+ case "MULTI_LINE_TEXT":
6376
+ case "RICH_TEXT":
6377
+ case "LINK":
6378
+ case "CALC":
6379
+ case "STATUS":
6380
+ case "RECORD_NUMBER":
6381
+ case "__ID__":
6382
+ case "__REVISION__":
6383
+ return text(v, where);
6384
+ case "DATE": {
6385
+ const s = text(v, where);
6386
+ if (s && !DATE_RE.test(s)) throw new InputError(`${where}: DATE は "YYYY-MM-DD"(${JSON.stringify(s)})`);
6387
+ return s;
6388
+ }
6389
+ case "TIME": {
6390
+ const s = text(v, where);
6391
+ if (s && !TIME_RE.test(s)) throw new InputError(`${where}: TIME は "HH:mm"(${JSON.stringify(s)})`);
6392
+ return s;
6393
+ }
6394
+ case "DATETIME":
6395
+ case "CREATED_TIME":
6396
+ case "UPDATED_TIME": {
6397
+ const s = text(v, where);
6398
+ if (s && !DATETIME_RE.test(s)) throw new InputError(`${where}: ${prop.type} は "YYYY-MM-DDTHH:mm:ssZ"(${JSON.stringify(s)})`);
6399
+ return s;
6400
+ }
6401
+ case "DROP_DOWN":
6402
+ case "RADIO_BUTTON": {
6403
+ const s = text(v, where);
6404
+ if (s && options && !(s in options)) throw new InputError(`${where}: 選択肢に無い値 ${JSON.stringify(s)}(${Object.keys(options).join(" / ")})`);
6405
+ return s;
6406
+ }
6407
+ case "CHECK_BOX":
6408
+ case "MULTI_SELECT":
6409
+ return stringList(v, where, options);
6410
+ case "CATEGORY":
6411
+ return stringList(v, where, void 0);
6412
+ case "USER_SELECT":
6413
+ case "STATUS_ASSIGNEE":
6414
+ return codeList(v, where, "user", users);
6415
+ case "ORGANIZATION_SELECT":
6416
+ return codeList(v, where, "org", users);
6417
+ case "GROUP_SELECT":
6418
+ return codeList(v, where, "group", users);
6419
+ case "CREATOR":
6420
+ case "MODIFIER": {
6421
+ const one = codeList(v, where, "user", users);
6422
+ if (one.length !== 1) throw new InputError(`${where}: ${prop.type} はユーザーのコード 1 つ`);
6423
+ return one[0];
6424
+ }
6425
+ case "FILE": {
6426
+ if (isEmpty(v)) return [];
6427
+ const list = Array.isArray(v) ? v : [v];
6428
+ return list.map((e, i) => {
6429
+ const name = typeof e === "string" ? e : e && typeof e === "object" && typeof e.name === "string" ? e.name : void 0;
6430
+ if (name === void 0 || !name.trim() || [...name].length > 255) throw new InputError(`${where}[${i}]: ファイルは名前(文字列)か { name, size? }`);
6431
+ const size = e && typeof e === "object" && e.size !== void 0 ? String(e.size) : "0";
6432
+ return { contentType: "application/octet-stream", fileKey: "", name, size };
6433
+ });
6434
+ }
6435
+ case "SUBTABLE":
6436
+ throw new InputError(`${where}: テーブルは行の配列([{ 子のコード: 値, … }])`);
6437
+ default:
6438
+ if (NO_VALUE_TYPES.has(prop.type)) throw new InputError(`${where}: ${prop.type} は値を持たない`);
6439
+ throw new InputError(`${where}: 型 ${prop.type} の値は書けない`);
6440
+ }
6441
+ }
6442
+ function applyData(fields, base, data, where, users) {
6443
+ if (!data || typeof data !== "object" || Array.isArray(data)) throw new InputError(`${where}: レコードはオブジェクト({ 項目コード: 値, … })`);
6444
+ const rec = fillMissing(fields, base);
6445
+ const children = /* @__PURE__ */ new Map();
6446
+ for (const p of Object.values(fields.properties)) for (const c of Object.values(p.fields ?? {})) children.set(c.code, p.code);
6447
+ for (const [code, v] of Object.entries(data)) {
6448
+ const w = `${where}.${code}`;
6449
+ const prop = fields.properties[code];
6450
+ if (!prop) {
6451
+ if (children.has(code)) throw new InputError(`${w}: テーブルの子はテーブルの行の中に書く(${children.get(code)}: [{ ${code}: … }])`);
6452
+ throw new InputError(`${w}: 無い項目(標本に無ければ fields で足す。項目の一覧は describe)`);
6453
+ }
6454
+ if (NO_VALUE_TYPES.has(prop.type)) throw new InputError(`${w}: ${prop.type} は値を持たない`);
6455
+ if (prop.type === "SUBTABLE") {
6456
+ if (isEmpty(v)) {
6457
+ rec[code] = { type: "SUBTABLE", value: [] };
6458
+ continue;
6459
+ }
6460
+ if (!Array.isArray(v)) throw new InputError(`${w}: テーブルは行の配列([{ 子のコード: 値, … }])`);
6461
+ if (v.length > TRY_MAX_TABLE_ROWS) throw new InputError(`${w}: テーブルの行は ${TRY_MAX_TABLE_ROWS} 行まで`);
6462
+ const kids = prop.fields ?? {};
6463
+ const rows = v.map((row, i) => {
6464
+ const rw = `${w}[${i}]`;
6465
+ if (!row || typeof row !== "object" || Array.isArray(row)) throw new InputError(`${rw}: 行はオブジェクト({ 子のコード: 値, … })`);
6466
+ const value = {};
6467
+ for (const c of Object.values(kids)) value[c.code] = { type: c.type, value: emptyValueOf(c.type) };
6468
+ for (const [cc, cv] of Object.entries(row)) {
6469
+ const child = kids[cc];
6470
+ if (!child) throw new InputError(`${rw}.${cc}: テーブル ${code} に無い子(${Object.keys(kids).join(", ")})`);
6471
+ value[cc] = { type: child.type, value: convertValue(child, cv, `${rw}.${cc}`, users) };
6472
+ }
6473
+ return { id: String(i + 1), value };
6474
+ });
6475
+ rec[code] = { type: "SUBTABLE", value: rows };
6476
+ continue;
6477
+ }
6478
+ rec[code] = { type: prop.type, value: convertValue(prop, v, w, users) };
6479
+ }
6480
+ return rec;
6481
+ }
6482
+ function checkDataList(data) {
6483
+ if (!Array.isArray(data)) throw new InputError("data はレコード({ 項目コード: 値 })の配列");
6484
+ if (!data.length) throw new InputError("data が空");
6485
+ if (data.length > TRY_MAX_DATA) throw new InputError(`data は ${TRY_MAX_DATA} 件まで`);
6486
+ const bytes = Buffer.byteLength(JSON.stringify(data), "utf8");
6487
+ if (bytes > 64 * 1024) throw new InputError(`data が大きすぎる(${bytes.toLocaleString()} バイト。64 KiB まで)`);
6488
+ return data;
6489
+ }
6490
+
6491
+ // src/commands/try.ts
6492
+ var TRY_MAX_FORMULAS = 10;
6493
+ var TRY_MAX_FORMULA_CHARS = 4e3;
6494
+ var TRY_DEFAULT_AS = "TEXT";
6495
+ var TRY_OWN_RULES = /* @__PURE__ */ new Set(["misc.changed", "fieldno.screen", "size.bytes", "schema.derived"]);
6496
+ var isTable2 = (v) => Array.isArray(v) && v.every((r) => r && typeof r === "object" && "value" in r);
6497
+ function resolveTryTarget(fields, targetTypes, as, table, referenced = /* @__PURE__ */ new Set()) {
6498
+ const props = fields.properties;
6499
+ const tables = Object.values(props).filter((p) => p.type === "SUBTABLE").map((p) => p.code).sort();
6500
+ const want = (as ?? TRY_DEFAULT_AS).trim();
6501
+ if (!want) throw new InputError("as が空(型 NUMBER / TEXT / DATE … か項目コード)");
6502
+ const upper = want.toUpperCase();
6503
+ const type = TYPE_ALIASES[upper] ?? (targetTypes.has(upper) ? upper : void 0);
6504
+ let scope = props;
6505
+ let tableCode;
6506
+ if (table !== void 0) {
6507
+ const t = props[table];
6508
+ if (!t || t.type !== "SUBTABLE") throw new InputError(`table ${JSON.stringify(table)} はサンプルアプリのテーブルでない(${tables.join(" / ")})`);
6509
+ scope = t.fields ?? {};
6510
+ tableCode = table;
6511
+ }
6512
+ const byCode = (code, p, inTable) => {
6513
+ if (!targetTypes.has(p.type)) throw new InputError(`${code} の型 ${p.type} には計算式を設定できない(使える型: ${[...targetTypes].join(", ")})`);
6514
+ return { code, type: p.type, ...inTable ? { table: inTable } : {} };
6515
+ };
6516
+ if (Object.prototype.hasOwnProperty.call(scope, want)) return byCode(want, scope[want], tableCode);
6517
+ if (tableCode === void 0) {
6518
+ for (const t of tables) {
6519
+ const child = props[t].fields?.[want];
6520
+ if (child) return byCode(want, child, t);
6521
+ }
6522
+ }
6523
+ if (!type) {
6524
+ const all2 = /* @__PURE__ */ new Set();
6525
+ for (const p of Object.values(props)) {
6526
+ all2.add(p.type);
6527
+ for (const c of Object.values(p.fields ?? {})) all2.add(c.type);
6528
+ }
6529
+ if (all2.has(upper)) throw new InputError(`${upper} の項目には計算式を設定できない(使える型: ${[...targetTypes].join(", ")})`);
6530
+ throw new InputError(`as ${JSON.stringify(want)} は型でも項目コードでもない(型: ${[...targetTypes].join(", ")}。項目は try --describe / fml_try の describe で)`);
6531
+ }
6532
+ const candidates = Object.values(scope).filter((p) => p.type === type && !p.lookup).sort((a, b) => a.code.length - b.code.length || (a.code < b.code ? -1 : a.code > b.code ? 1 : 0));
6533
+ if (!candidates.length) throw new InputError(`${tableCode ? `テーブル ${tableCode} の中` : "サンプルアプリ"}に ${type} の項目が無い`);
6534
+ const free = candidates.find((p) => !referenced.has(p.code)) ?? candidates[0];
6535
+ return { code: free.code, type, ...tableCode ? { table: tableCode } : {} };
6536
+ }
6537
+ function buildTryEnvelope(engine, fields, code, formula, lang) {
6538
+ const api = engine.api;
6539
+ const source = api.defaultSource(lang);
6540
+ return {
6541
+ date: "2026-01-15 00:00:00",
6542
+ pluginName: "計算式プラグイン",
6543
+ pluginID: api.pluginId,
6544
+ PluginVersion: engine.source.pluginVersion,
6545
+ appId: fields.appId,
6546
+ appName: fields.appName,
6547
+ ...source,
6548
+ toolEnable: true,
6549
+ pluginMiscInfo: { ...source.pluginMiscInfo, circular_refer: true },
6550
+ pluginInfos: [{ fieldcode: code, state: true, formulaSet: formula, edit: false, hide: false, rank: "" }]
6551
+ };
6552
+ }
6553
+ function plain(v) {
6554
+ try {
6555
+ const s = JSON.stringify(v);
6556
+ return s === void 0 ? v === void 0 ? null : String(v) : JSON.parse(s);
6557
+ } catch {
6558
+ return String(v);
6559
+ }
6560
+ }
6561
+ function rawValueOf(engine, pp, record, formula, target, evType, event) {
6562
+ const api = engine.api;
6563
+ const run = (kf2) => {
6564
+ try {
6565
+ return plain(quiet(() => kf2.dq(formula)));
6566
+ } catch {
6567
+ return null;
6568
+ }
6569
+ };
6570
+ const kf = api.createRunner(pp, record, evType ?? "allUpdate", event);
6571
+ if (!target.table) {
6572
+ kf.initTableInfo("");
6573
+ return run(kf);
6574
+ }
6575
+ const rows = record[target.table];
6576
+ const list = Array.isArray(rows?.value) ? rows.value : [];
6577
+ kf.initTableInfo(target.table);
6578
+ return list.map((_r, i) => {
6579
+ kf.currRow(i);
6580
+ return run(kf);
6581
+ });
6582
+ }
6583
+ var short2 = (v) => {
6584
+ const s = JSON.stringify(v);
6585
+ return s === void 0 ? "undefined" : [...s].length > 200 ? [...s].slice(0, 200).join("") + "…" : s;
6586
+ };
6587
+ async function trySettings(input) {
6588
+ const { engine } = input;
6589
+ const api = engine.api;
6590
+ const lang = input.lang ?? "ja";
6591
+ if (!Array.isArray(input.formulas) || !input.formulas.length) throw new InputError("式が無い(formulas)");
6592
+ if (input.formulas.length > TRY_MAX_FORMULAS) throw new InputError(`式は 1 回 ${TRY_MAX_FORMULAS} 個まで(${input.formulas.length})`);
6593
+ const app = sampleApp();
6594
+ const source = input.appFields ? "app" : "sample";
6595
+ let fields = input.appFields ? normalizeDefaults(input.appFields) : app.fields;
6596
+ let extraFields = [];
6597
+ if (input.fields !== void 0) {
6598
+ if (!Array.isArray(input.fields)) throw new InputError("fields は項目({ code, type, options?, table?, fields? })の配列");
6599
+ const ext = extendFields(fields, input.fields);
6600
+ fields = ext.fields;
6601
+ extraFields = ext.added;
6602
+ }
6603
+ const picked = [];
6604
+ if (input.appFields) {
6605
+ if (input.records !== void 0) throw new InputError("appFields(利用者のアプリの項目定義)のときは標本のレコード(records)は使えない(data で架空の値を書く)");
6606
+ if (input.data === void 0) throw new InputError("appFields(利用者のアプリの項目定義)には data(架空の値のレコード)が要る");
6607
+ } else {
6608
+ const ids2 = input.records === void 0 ? input.data === void 0 ? app.records.map((r) => r.id) : [] : [...new Set(input.records)];
6609
+ if (!ids2.length && input.data === void 0) throw new InputError("records が空(1〜3)");
6610
+ for (const id of ids2) if (!app.records.some((r) => r.id === id)) throw new InputError(`records は 1〜${app.records.length}(${id})`);
6611
+ for (const id of ids2) {
6612
+ const r = app.records.find((x) => x.id === id);
6613
+ picked.push({ id: String(id), label: r.label, record: extraFields.length ? fillMissing(fields, r.record) : r.record });
6614
+ }
6615
+ }
6616
+ if (input.data !== void 0) {
6617
+ const list = checkDataList(input.data);
6618
+ let base;
6619
+ if (input.appFields) base = emptyRecordOf(fields, "0");
6620
+ else {
6621
+ const b = input.base ?? 3;
6622
+ const br = app.records.find((x) => x.id === b);
6623
+ if (!br) throw new InputError(`base は標本のレコードの番号(1〜${app.records.length}): ${b}`);
6624
+ base = br.record;
6625
+ }
6626
+ list.forEach((d, i) => {
6627
+ const id = `d${i + 1}`;
6628
+ const rec = applyData(fields, base, d, `data[${i}]`, input.usersInfo);
6629
+ rec.$id = { type: "__ID__", value: String(100 + i + 1) };
6630
+ if (fields.properties["レコード番号"]?.type === "RECORD_NUMBER" && input.appFields) rec["レコード番号"] = { type: "RECORD_NUMBER", value: String(100 + i + 1) };
6631
+ picked.push({ id, label: `架空の値(${Object.keys(d).join(", ") || "空"})`, record: rec });
6632
+ });
6633
+ }
6634
+ if (!picked.length) throw new InputError("計算するレコードが無い(records か data)");
6635
+ const targetTypes = new Set(api.TARGET_TYPES);
6636
+ const policy = { ...input.policy ?? DEFAULT_POLICY, allowMiscChanges: true };
6637
+ let contextLine = "";
6638
+ let calcNotice = "";
6639
+ const results = [];
6640
+ for (let i = 0; i < input.formulas.length; i++) {
6641
+ const f = input.formulas[i];
6642
+ const where = `try[${i + 1}]`;
6643
+ const res = { index: i + 1, formula: typeof f?.formula === "string" ? f.formula : "", status: "ok", findings: [], values: [], marks: [] };
6644
+ results.push(res);
6645
+ const fail = (rule, message) => {
6646
+ res.status = "invalid";
6647
+ res.findings.push({ level: "error", rule, where, message });
6648
+ };
6649
+ if (!f || typeof f.formula !== "string" || !f.formula.trim()) {
6650
+ fail("try.formula", "式が空");
6651
+ continue;
6652
+ }
6653
+ if ([...f.formula].length > TRY_MAX_FORMULA_CHARS) {
6654
+ fail("try.formula", `式が長すぎる(${TRY_MAX_FORMULA_CHARS} 文字まで)`);
6655
+ continue;
6656
+ }
6657
+ let target;
6658
+ const referenced = scanFormula(api.stripFormula(f.formula)).identifiers;
6659
+ try {
6660
+ target = resolveTryTarget(fields, targetTypes, f.as, f.table, referenced);
6661
+ } catch (e) {
6662
+ if (e instanceof InputError) {
6663
+ fail("try.target", e.message);
6664
+ continue;
6665
+ }
6666
+ throw e;
6667
+ }
6668
+ res.target = target;
6669
+ if (referenced.has(target.code)) res.findings.push({ level: "warning", rule: "try.self-reference", where, message: `対象 ${target.code} を式が参照している(${target.table ? "行ごとに 1 回" : "テーブルの外の項目は 1 段目と 2 段目の 2 回計算されるので、値が 2 回分になる"}。as で式が使わない項目を選ぶ)` });
6670
+ const envelope = buildTryEnvelope(engine, fields, target.code, f.formula, lang);
6671
+ const n = await normalizeSettings({
6672
+ settingsText: JSON.stringify(envelope),
6673
+ settingsFile: where,
6674
+ fields,
6675
+ engine,
6676
+ policy,
6677
+ lang,
6678
+ usersInfo: input.usersInfo,
6679
+ usersLabel: input.usersLabel,
6680
+ usersOrigin: input.usersOrigin.kind === "none" ? void 0 : input.usersOrigin
6681
+ });
6682
+ res.findings.push(...n.findings.items.filter((x) => !TRY_OWN_RULES.has(x.rule)));
6683
+ if (n.findings.hasErrors || !n.saved) {
6684
+ res.status = "invalid";
6685
+ continue;
6686
+ }
6687
+ const stripped = String(n.saved.pluginFields[0]?.formula ?? "");
6688
+ const records = picked.map((r) => ({ id: r.id, record: structuredClone(r.record), fileAppId: fields.appId }));
6689
+ let c;
6690
+ try {
6691
+ c = calcSettings({
6692
+ normalized: n,
6693
+ engine,
6694
+ fields,
6695
+ appId: fields.appId,
6696
+ records,
6697
+ evType: input.evType,
6698
+ event: input.event,
6699
+ mobile: input.mobile,
6700
+ user: input.user,
6701
+ usersInfo: input.usersInfo,
6702
+ usersOrigin: input.usersOrigin,
6703
+ allowDefaultBaseUrl: true
6704
+ });
6705
+ } catch (e) {
6706
+ if (e instanceof InputError) {
6707
+ fail("calc.context", e.message);
6708
+ continue;
6709
+ }
6710
+ throw e;
6711
+ }
6712
+ contextLine ||= c.contextLine;
6713
+ calcNotice ||= c.notice;
6714
+ const lineCode = target.table ?? target.code;
6715
+ for (const r of c.records) {
6716
+ const line = r.lines.find((l) => l.fieldcode === lineCode);
6717
+ let value = line?.after;
6718
+ if (target.table && isTable2(value)) value = value.map((row) => row.value?.[target.code]?.value);
6719
+ const errs = r.errors.filter((e) => e.fieldcode === target.code || e.fieldcode === lineCode || e.fieldcode === "(全体)" || e.fieldcode === "(sink)").map((e) => `${e.phases.join(", ")}: ${e.message}`);
6720
+ const v = { record: r.id, value, ...errs.length ? { error: errs.join(" / ") } : {}, ...r.failed ? { failed: true } : {} };
6721
+ if (!r.failed && !errs.length) {
6722
+ const src = picked.find((p) => p.id === r.id);
6723
+ engine.clearSinkCalls();
6724
+ const raw = src ? rawValueOf(engine, n.saved.pluginPP, structuredClone(src.record), stripped, target, input.evType, input.event) : void 0;
6725
+ if (engine.sinkCalls().length) {
6726
+ v.failed = true;
6727
+ v.error = `実行時の sink が呼ばれた(生の値の評価): ${engine.sinkCalls().map((s) => `${s.sink} ${s.detail}`.trim()).join(", ")}`;
6728
+ } else if (raw !== void 0 && JSON.stringify(raw) !== JSON.stringify(value)) v.raw = raw;
6729
+ engine.clearSinkCalls();
6730
+ }
6731
+ res.values.push(v);
6732
+ if (line) res.marks = line.marks;
6733
+ if (v.failed) res.status = "failed";
6734
+ }
3077
6735
  }
3078
- return { contextLine, notice, records: results, summary, text: text.join("\n") };
6736
+ const okCount = results.filter((r) => r.status === "ok").length;
6737
+ const ids = picked.map((r) => r.id);
6738
+ const appLabel = source === "sample" ? `サンプルアプリ「${fields.appName}」` : `アプリ ${fields.appId}「${fields.appName}」の項目定義(値は架空)`;
6739
+ const summary = `試し計算 ${results.length} 式: ok ${okCount}${results.length - okCount ? `、エラー ${results.length - okCount}` : ""}(${appLabel}、レコード ${ids.join(", ")})`;
6740
+ if (!contextLine) contextLine = `文脈: アプリ ${fields.appId}(計算していない式だけ)`;
6741
+ const notice = `${source === "sample" ? "サンプルアプリ(架空)での模擬。利用者のアプリ・レコードは使っていない" : "利用者のアプリの項目定義に架空の値を当てた模擬。レコードは更新していない"}${calcNotice ? `。${calcNotice}` : ""}`;
6742
+ const text2 = [summary, notice, contextLine];
6743
+ if (extraFields.length) text2.push(`足した項目(架空): ${extraFields.join("、")}`);
6744
+ for (const r of picked) if (r.id.startsWith("d")) text2.push(`レコード ${r.id}: ${r.label}`);
6745
+ for (const r of results) {
6746
+ const head = r.target ? `${r.target.code}(${r.target.type}${r.target.table ? `。${r.target.table} の中` : ""})← ` : "";
6747
+ text2.push(`[${r.index}] ${head}${r.formula.replace(/\s*\n\s*/g, " ")}`);
6748
+ for (const v of r.values) text2.push(` レコード ${v.record}: ${short2(v.value)}${v.raw !== void 0 ? `(生の値 ${short2(v.raw)})` : ""}${v.error ? ` ! ${v.error}` : ""}${v.failed ? " ! 結果を採らない(実行時の sink)" : ""}`);
6749
+ if (r.marks.length) text2.push(` 印: ${r.marks.join("、")}`);
6750
+ for (const f of r.findings) if (f.level !== "info") text2.push(` ${f.level === "error" ? "エラー" : "警告"} ${f.rule}: ${f.message}`);
6751
+ }
6752
+ return { app: { appId: fields.appId, appName: fields.appName, fieldCount: Object.keys(fields.properties).length, source, records: ids, extraFields }, contextLine, notice, results, summary, text: text2.join("\n") };
3079
6753
  }
3080
6754
 
3081
6755
  // src/worker/eval-run.ts
6756
+ function classifyEvalError(e) {
6757
+ const message = String(e?.message ?? e);
6758
+ if (e instanceof InputError) return { kind: "input", name: "InputError", message };
6759
+ if (e instanceof PluginZipError) return { kind: "zip", name: "PluginZipError", message, code: e.code };
6760
+ if (e instanceof UsersDataError) return { kind: "users", name: "UsersDataError", message };
6761
+ if (e instanceof PolicyError) return { kind: "policy", name: "PolicyError", message };
6762
+ return { kind: "other", name: builtinErrorName(e), message };
6763
+ }
6764
+ function builtinErrorName(e) {
6765
+ if (e instanceof TypeError) return "TypeError";
6766
+ if (e instanceof RangeError) return "RangeError";
6767
+ if (e instanceof ReferenceError) return "ReferenceError";
6768
+ if (e instanceof SyntaxError) return "SyntaxError";
6769
+ if (e instanceof URIError) return "URIError";
6770
+ return "Error";
6771
+ }
3082
6772
  async function runEvalJob(job) {
3083
6773
  const engine = await loadEngine({ pluginZip: job.pluginZip, devPluginDir: job.devPluginDir, mode: job.mode, vendorDir: job.vendorDir });
3084
6774
  if (job.baseUrl) engine.setContext({ baseUrl: job.baseUrl });
3085
6775
  const usersInfo = buildUsersInfo(job.usersSource);
3086
6776
  const usersLabel = job.usersOrigin.kind === "file" ? job.usersOrigin.file : "既定のテストデータ(架空)";
6777
+ if (job.kind === "try") {
6778
+ if (!job.try) throw new InputError("try の仕事に式が無い(try.formulas)");
6779
+ const t = job.try;
6780
+ const r = await trySettings({
6781
+ engine,
6782
+ formulas: t.formulas,
6783
+ records: t.records,
6784
+ fields: t.fields,
6785
+ data: t.data,
6786
+ base: t.base,
6787
+ appFields: t.appFields,
6788
+ evType: t.evType,
6789
+ event: t.event,
6790
+ mobile: t.mobile,
6791
+ user: t.user,
6792
+ usersInfo,
6793
+ usersOrigin: job.usersOrigin,
6794
+ usersLabel,
6795
+ policy: job.policy,
6796
+ lang: job.lang
6797
+ });
6798
+ const warnings = r.results.reduce((n, x) => n + x.findings.filter((f) => f.level === "warning").length, 0);
6799
+ return { normalize: { summary: r.summary, hasErrors: r.results.some((x) => x.status !== "ok"), warnings, findings: [] }, try: r, engineWarnings: [...engine.warnings] };
6800
+ }
6801
+ if (job.settingsText === void 0 || job.settingsFile === void 0 || !job.fields) throw new InputError(`${job.kind} の仕事に設定か項目定義が無い(settingsText / settingsFile / fields)`);
3087
6802
  const res = await normalizeSettings({
3088
6803
  settingsText: job.settingsText,
3089
6804
  settingsFile: job.settingsFile,
@@ -3137,10 +6852,12 @@ var EvalTimeoutError = class extends Error {
3137
6852
  var EvalError = class extends Error {
3138
6853
  innerName;
3139
6854
  code;
3140
- constructor(message, innerName, code) {
6855
+ kind;
6856
+ constructor(message, innerName, code, kind = "other") {
3141
6857
  super(message);
3142
6858
  this.innerName = innerName;
3143
6859
  this.code = code;
6860
+ this.kind = kind;
3144
6861
  }
3145
6862
  };
3146
6863
  function workerEntry() {
@@ -3154,7 +6871,14 @@ function workerEntry() {
3154
6871
  }
3155
6872
  async function runEval(job, opt = {}) {
3156
6873
  const timeoutSec = Math.min(Math.max(opt.timeoutSec ?? DEFAULT_TIMEOUT_SEC, 1), MAX_TIMEOUT_SEC);
3157
- if (opt.inline) return runEvalJob(job);
6874
+ if (opt.inline) {
6875
+ try {
6876
+ return await runEvalJob(job);
6877
+ } catch (e) {
6878
+ const c = classifyEvalError(e);
6879
+ throw new EvalError(c.message, c.name, c.code, c.kind);
6880
+ }
6881
+ }
3158
6882
  let entry;
3159
6883
  if (opt.workerFile !== void 0) {
3160
6884
  if (!path13.isAbsolute(opt.workerFile) || !existsSync8(opt.workerFile)) throw new Error(`Worker の入口が無い(絶対パスで指定する): ${opt.workerFile}`);
@@ -3183,10 +6907,10 @@ async function runEval(job, opt = {}) {
3183
6907
  worker.on("message", (m) => {
3184
6908
  finish(() => {
3185
6909
  if (m.ok) resolve(m.outcome);
3186
- else reject(new EvalError(m.error.message, m.error.name, m.error.code));
6910
+ else reject(new EvalError(m.error.message, m.error.name, m.error.code, m.error.kind ?? "other"));
3187
6911
  });
3188
6912
  });
3189
- worker.on("error", (e) => finish(() => reject(e)));
6913
+ worker.on("error", (e) => finish(() => reject(new EvalError(e?.message ?? String(e), builtinErrorName(e), void 0, "other"))));
3190
6914
  worker.on("exit", (code) => finish(() => reject(new Error(`評価の Worker が結果を返さずに終わった(exit ${code})`))));
3191
6915
  });
3192
6916
  }
@@ -3216,6 +6940,16 @@ var USAGE = `使い方: npx @rex0220/formula-authoring-tools <command> [options]
3216
6940
  calc <settings.json> --app N (--id R | --records R1,R2,…) [--fields fields/N.json] [--users <f>] [--user <code>]
3217
6941
  [--event <種別>] [--action A --status S --next-status T] [--mobile] [--timeout 秒]
3218
6942
  取得済みのレコード(records/)に設定を当てた模擬(更新しない)。評価は Worker で動かし、既定 60 秒で止める
6943
+ try "<式>" [--as <型 | 項目コード>] [--table <テーブル>] [--records 1,2,3] [--users <f>] [--user <code>]
6944
+ [--event <種別>] [--action A --status S --next-status T] [--mobile] [--timeout 秒]
6945
+ [--fields '<JSON>'] [--data '<JSON>'] [--base 3] [--app N]
6946
+ 同梱のサンプルアプリ(全項目タイプ × 2、テーブル 2 つ、レコード 3 件 = 典型 / 端 / 空)に 1 行だけの設定を組んで
6947
+ 検査と模擬の計算(関数の使い方や式の断片を確かめる。利用者のアプリは使わない)。--as は型(NUMBER / TEXT / DATE …。
6948
+ 既定 TEXT = 文字列 1 行)か項目コード、テーブルの中で計算するなら --table テーブル1。
6949
+ --fields '[{"code":"単価","type":"NUMBER"},{"code":"分類","type":"DROP_DOWN","options":["明細","小計"]}]' で項目を足す、
6950
+ --data '[{"単価":100,"テーブル1":[{"T1_数値":1}]}]' で架空の値のレコード(土台は --base の標本。既定 3 = 空)、
6951
+ --app N で利用者のアプリの項目定義(fields/N.json かアプリのフォルダー)に --data の架空の値を当てる
6952
+ try --describe サンプルアプリの項目(1 項目 1 行。○ = 計算式を設定できる型)とレコード 3 件の形
3219
6953
  help
3220
6954
 
3221
6955
  kintone の接続のファイル(FORMULA_KINTONE_CONFIG があるとき。kSQL の ksql.config.json と同じ形。複数のドメイン・アプリ):
@@ -3341,13 +7075,13 @@ function trustedBaseUrl(folder, flags) {
3341
7075
  throw e;
3342
7076
  }
3343
7077
  }
3344
- function writeText(file, text, roots, op, opt = {}) {
7078
+ function writeText(file, text2, roots, op, opt = {}) {
3345
7079
  const abs = resolveWrite(file, roots, W.root);
3346
7080
  allow(abs, op);
3347
7081
  mkdirSync2(path14.dirname(abs), { recursive: true });
3348
7082
  if (opt.exclusive) {
3349
7083
  try {
3350
- const { cleanup } = writeNewFile(abs, text, () => {
7084
+ const { cleanup } = writeNewFile(abs, text2, () => {
3351
7085
  if (resolveWrite(file, roots, W.root) !== abs) throw new InputError(`書く先のフォルダーが途中で変わった(symlink など): ${shown(abs)}`);
3352
7086
  allow(abs, op);
3353
7087
  });
@@ -3358,7 +7092,7 @@ function writeText(file, text, roots, op, opt = {}) {
3358
7092
  }
3359
7093
  } else {
3360
7094
  if (existsSync9(abs) && !opt.force) throw new InputError(`${shown(abs)} は既にある(上書きするなら --force)`);
3361
- writeFileSync3(abs, text, opt.mode !== void 0 ? { mode: opt.mode } : void 0);
7095
+ writeFileSync3(abs, text2, opt.mode !== void 0 ? { mode: opt.mode } : void 0);
3362
7096
  }
3363
7097
  if (opt.mode !== void 0) chmodSync(abs, opt.mode);
3364
7098
  return abs;
@@ -3642,6 +7376,78 @@ async function cmdCalc(positional, flags) {
3642
7376
  console.log(outcome.calc.text);
3643
7377
  return outcome.calc.failed ? 1 : 0;
3644
7378
  }
7379
+ async function cmdTry(positional, flags) {
7380
+ if (has(flags, "describe")) {
7381
+ let targetTypes;
7382
+ try {
7383
+ targetTypes = new Set((await engineOf()).api.TARGET_TYPES);
7384
+ } catch {
7385
+ targetTypes = void 0;
7386
+ }
7387
+ console.log(describeSampleApp(targetTypes));
7388
+ return 0;
7389
+ }
7390
+ const formula = positional[1];
7391
+ if (!formula) throw new UsageError('try "<式>" [--as <型 | 項目コード>] [--table <テーブル>](または try --describe)');
7392
+ let records;
7393
+ const recordsFlag = str(flags, "records");
7394
+ if (recordsFlag) {
7395
+ records = recordsFlag.split(",").map((x) => x.trim()).filter(Boolean).map((x) => {
7396
+ if (!/^[1-9]$/.test(x)) throw new UsageError(`--records はサンプルレコードの番号(1〜3。カンマ区切り): ${x}`);
7397
+ return Number(x);
7398
+ });
7399
+ }
7400
+ const { src, origin } = usersSourceOf(str(flags, "users"));
7401
+ const jsonFlag = (k) => {
7402
+ const v = str(flags, k);
7403
+ if (v === void 0) return void 0;
7404
+ if (Buffer.byteLength(v, "utf8") > 64 * 1024) throw new UsageError(`--${k} は 64 KiB まで`);
7405
+ try {
7406
+ return JSON.parse(v);
7407
+ } catch (e) {
7408
+ throw new UsageError(`--${k} が JSON として読めない: ${e instanceof Error ? e.message : String(e)}`);
7409
+ }
7410
+ };
7411
+ const fieldsDef = jsonFlag("fields");
7412
+ const data = jsonFlag("data");
7413
+ const base = intFlag(flags, "base", false);
7414
+ let appFields;
7415
+ let baseUrl;
7416
+ const app = intFlag(flags, "app", false);
7417
+ if (app !== void 0) {
7418
+ const ctx = context(flags);
7419
+ const rel = ctx.def ? path14.join(existingAppDir(ctx, app), "fields.json") : path14.join("fields", `${app}.json`);
7420
+ appFields = readFieldsFile(existingFile(rel, `fields --app ${app}${profileFlag(ctx)}`));
7421
+ baseUrl = trustedBaseUrl(ctx.def ? { profile: ctx.def.profile } : null, flags);
7422
+ } else if (has(flags, "profile")) throw new UsageError("--profile は --app(利用者のアプリの項目定義)と一緒に使う");
7423
+ const job = {
7424
+ kind: "try",
7425
+ pluginZip: pluginZipPath(authOpt()),
7426
+ devPluginDir: W.env.FORMULA_ALLOW_DEV_PLUGIN === "1" ? formulaProdDir(W.env) : void 0,
7427
+ baseUrl,
7428
+ usersSource: src,
7429
+ usersOrigin: origin,
7430
+ policy: loadPolicy(W.root),
7431
+ lang: str(flags, "lang"),
7432
+ try: {
7433
+ formulas: [{ formula, as: str(flags, "as"), table: str(flags, "table") }],
7434
+ records,
7435
+ fields: fieldsDef,
7436
+ data,
7437
+ base,
7438
+ appFields,
7439
+ evType: str(flags, "event"),
7440
+ event: has(flags, "action") || has(flags, "status") || has(flags, "next-status") ? { action: { value: str(flags, "action") ?? "" }, status: { value: str(flags, "status") ?? "" }, nextStatus: { value: str(flags, "next-status") ?? "" } } : void 0,
7441
+ mobile: has(flags, "mobile"),
7442
+ user: str(flags, "user")
7443
+ }
7444
+ };
7445
+ const outcome = await runEval(job, { timeoutSec: timeoutOf(flags), inline: inline() });
7446
+ for (const w of outcome.engineWarnings) console.log(`注意: ${w}`);
7447
+ if (!outcome.try) throw new Error("try の結果が無い(tools の誤り)");
7448
+ console.log(outcome.try.text);
7449
+ return outcome.try.results.every((r) => r.status === "ok") ? 0 : 1;
7450
+ }
3645
7451
  async function cmdUsers(flags) {
3646
7452
  if (has(flags, "summary")) {
3647
7453
  const { src, origin } = usersSourceOf(str(flags, "users"));
@@ -3770,6 +7576,8 @@ async function main(argv) {
3770
7576
  return await cmdNormalize(positional, flags);
3771
7577
  case "calc":
3772
7578
  return await cmdCalc(positional, flags);
7579
+ case "try":
7580
+ return await cmdTry(positional, flags);
3773
7581
  case "take":
3774
7582
  return await cmdTake(flags);
3775
7583
  case "edit":
@@ -3792,13 +7600,18 @@ ${USAGE}`);
3792
7600
  return 1;
3793
7601
  }
3794
7602
  if (e instanceof EvalError) {
3795
- if (["PluginZipError", "InputError", "UsersDataError", "PolicyError", "AuthError"].includes(e.innerName)) {
7603
+ if (e.kind !== "other") {
3796
7604
  console.error(e.message);
3797
7605
  return 1;
3798
7606
  }
3799
- throw new Error(`${e.innerName}: ${e.message}`);
7607
+ console.error(`評価の途中で想定外の誤り(${e.innerName})。誤りの文は値を含みうるので表示しない(FORMULA_DEBUG=1 で表示)。normalize で設定を、version で zip を確かめる`);
7608
+ if (W.env.FORMULA_DEBUG === "1") console.error(e.message);
7609
+ return 1;
3800
7610
  }
3801
- throw e;
7611
+ const name = builtinErrorName(e);
7612
+ console.error(`想定外の誤り(${name})。誤りの文は値を含みうるので表示しない(FORMULA_DEBUG=1 で表示)`);
7613
+ if (W.env.FORMULA_DEBUG === "1") console.error(e instanceof Error ? e.stack ?? e.message : String(e));
7614
+ return 1;
3802
7615
  }
3803
7616
  }
3804
7617
  var invokedRaw = process.argv[1] ? path14.resolve(process.argv[1]) : "";
@@ -3817,6 +7630,9 @@ try {
3817
7630
  if (invoked && (invoked === self || /[\\/]dist[\\/]cli\.mjs$/.test(invoked))) {
3818
7631
  main(process.argv.slice(2)).then((code) => {
3819
7632
  process.exitCode = code;
7633
+ }, (e) => {
7634
+ console.error(`想定外の誤り(${builtinErrorName(e)})`);
7635
+ process.exitCode = 1;
3820
7636
  });
3821
7637
  }
3822
7638
  export {