@rex0220/formula-authoring-tools 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /*! @rex0220/formula-authoring-tools 0.2.1 (c) rex0220. MIT License. 計算式エンジンと計算式プラグインのコードは利用者の計算式プラグインプラグインの zip から読む(このファイルには含まれない)。commit f2e46ef. */
2
+ /*! @rex0220/formula-authoring-tools 0.3.1 (c) rex0220. MIT License. 計算式エンジンと計算式プラグインのコードは利用者の計算式プラグインプラグインの zip から読む(このファイルには含まれない)。commit 3788114. */
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.1","pluginId":"dhgihghfgfmibkdldkeibboabfnmdpke","minPluginVersion":101,"supportedApiVersions":[1],"commit":"f2e46ef","builtAt":"2026-10-18T03:55:45.474Z","mode":"build"}');
358
+ if (true) return JSON.parse('{"toolsVersion":"0.3.1","pluginId":"dhgihghfgfmibkdldkeibboabfnmdpke","minPluginVersion":101,"supportedApiVersions":[1],"commit":"3788114","builtAt":"2026-10-18T08:08:27.541Z","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
  }
@@ -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,3028 @@ 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
+ type: "SPACER",
3619
+ elementId: "sp1",
3620
+ size: {
3621
+ width: "458",
3622
+ height: "163"
3623
+ }
3624
+ }
3625
+ ]
3626
+ },
3627
+ {
3628
+ type: "ROW",
3629
+ fields: [
3630
+ {
3631
+ type: "RICH_TEXT",
3632
+ code: "リッチ1",
3633
+ size: {
3634
+ width: "250",
3635
+ innerHeight: "125"
3636
+ }
3637
+ },
3638
+ {
3639
+ type: "RICH_TEXT",
3640
+ code: "リッチ2",
3641
+ size: {
3642
+ width: "250",
3643
+ innerHeight: "125"
3644
+ }
3645
+ }
3646
+ ]
3647
+ },
3648
+ {
3649
+ type: "ROW",
3650
+ fields: [
3651
+ {
3652
+ type: "NUMBER",
3653
+ code: "数値1",
3654
+ size: {
3655
+ width: "250"
3656
+ }
3657
+ },
3658
+ {
3659
+ type: "NUMBER",
3660
+ code: "数値2",
3661
+ size: {
3662
+ width: "250"
3663
+ }
3664
+ }
3665
+ ]
3666
+ },
3667
+ {
3668
+ type: "ROW",
3669
+ fields: [
3670
+ {
3671
+ type: "CALC",
3672
+ code: "計算1",
3673
+ size: {
3674
+ width: "250"
3675
+ }
3676
+ },
3677
+ {
3678
+ type: "CALC",
3679
+ code: "計算2",
3680
+ size: {
3681
+ width: "250"
3682
+ }
3683
+ }
3684
+ ]
3685
+ },
3686
+ {
3687
+ type: "ROW",
3688
+ fields: [
3689
+ {
3690
+ type: "RADIO_BUTTON",
3691
+ code: "ラジオ1",
3692
+ size: {
3693
+ width: "250"
3694
+ }
3695
+ },
3696
+ {
3697
+ type: "RADIO_BUTTON",
3698
+ code: "ラジオ2",
3699
+ size: {
3700
+ width: "250"
3701
+ }
3702
+ }
3703
+ ]
3704
+ },
3705
+ {
3706
+ type: "ROW",
3707
+ fields: [
3708
+ {
3709
+ type: "CHECK_BOX",
3710
+ code: "チェック1",
3711
+ size: {
3712
+ width: "250"
3713
+ }
3714
+ },
3715
+ {
3716
+ type: "CHECK_BOX",
3717
+ code: "チェック2",
3718
+ size: {
3719
+ width: "250"
3720
+ }
3721
+ }
3722
+ ]
3723
+ },
3724
+ {
3725
+ type: "ROW",
3726
+ fields: [
3727
+ {
3728
+ type: "MULTI_SELECT",
3729
+ code: "複数選択1",
3730
+ size: {
3731
+ width: "250"
3732
+ }
3733
+ },
3734
+ {
3735
+ type: "MULTI_SELECT",
3736
+ code: "複数選択2",
3737
+ size: {
3738
+ width: "250"
3739
+ }
3740
+ }
3741
+ ]
3742
+ },
3743
+ {
3744
+ type: "ROW",
3745
+ fields: [
3746
+ {
3747
+ type: "DROP_DOWN",
3748
+ code: "ドロップダウン1",
3749
+ size: {
3750
+ width: "250"
3751
+ }
3752
+ },
3753
+ {
3754
+ type: "DROP_DOWN",
3755
+ code: "ドロップダウン2",
3756
+ size: {
3757
+ width: "250"
3758
+ }
3759
+ }
3760
+ ]
3761
+ },
3762
+ {
3763
+ type: "ROW",
3764
+ fields: [
3765
+ {
3766
+ type: "DATE",
3767
+ code: "日付1",
3768
+ size: {
3769
+ width: "250"
3770
+ }
3771
+ },
3772
+ {
3773
+ type: "DATE",
3774
+ code: "日付2",
3775
+ size: {
3776
+ width: "250"
3777
+ }
3778
+ }
3779
+ ]
3780
+ },
3781
+ {
3782
+ type: "ROW",
3783
+ fields: [
3784
+ {
3785
+ type: "TIME",
3786
+ code: "時刻1",
3787
+ size: {
3788
+ width: "250"
3789
+ }
3790
+ },
3791
+ {
3792
+ type: "TIME",
3793
+ code: "時刻2",
3794
+ size: {
3795
+ width: "250"
3796
+ }
3797
+ }
3798
+ ]
3799
+ },
3800
+ {
3801
+ type: "ROW",
3802
+ fields: [
3803
+ {
3804
+ type: "DATETIME",
3805
+ code: "日時1",
3806
+ size: {
3807
+ width: "250"
3808
+ }
3809
+ },
3810
+ {
3811
+ type: "DATETIME",
3812
+ code: "日時2",
3813
+ size: {
3814
+ width: "250"
3815
+ }
3816
+ }
3817
+ ]
3818
+ },
3819
+ {
3820
+ type: "ROW",
3821
+ fields: [
3822
+ {
3823
+ type: "HR",
3824
+ elementId: "",
3825
+ size: {
3826
+ width: "600"
3827
+ }
3828
+ }
3829
+ ]
3830
+ },
3831
+ {
3832
+ type: "ROW",
3833
+ fields: [
3834
+ {
3835
+ type: "FILE",
3836
+ code: "添付1",
3837
+ size: {
3838
+ width: "250"
3839
+ }
3840
+ },
3841
+ {
3842
+ type: "FILE",
3843
+ code: "添付2",
3844
+ size: {
3845
+ width: "250"
3846
+ }
3847
+ }
3848
+ ]
3849
+ },
3850
+ {
3851
+ type: "ROW",
3852
+ fields: [
3853
+ {
3854
+ type: "LINK",
3855
+ code: "リンク1",
3856
+ size: {
3857
+ width: "250"
3858
+ }
3859
+ },
3860
+ {
3861
+ type: "LINK",
3862
+ code: "リンク2",
3863
+ size: {
3864
+ width: "250"
3865
+ }
3866
+ }
3867
+ ]
3868
+ },
3869
+ {
3870
+ type: "ROW",
3871
+ fields: [
3872
+ {
3873
+ type: "USER_SELECT",
3874
+ code: "ユーザー1",
3875
+ size: {
3876
+ width: "250"
3877
+ }
3878
+ },
3879
+ {
3880
+ type: "USER_SELECT",
3881
+ code: "ユーザー2",
3882
+ size: {
3883
+ width: "250"
3884
+ }
3885
+ }
3886
+ ]
3887
+ },
3888
+ {
3889
+ type: "ROW",
3890
+ fields: [
3891
+ {
3892
+ type: "ORGANIZATION_SELECT",
3893
+ code: "組織1",
3894
+ size: {
3895
+ width: "250"
3896
+ }
3897
+ },
3898
+ {
3899
+ type: "ORGANIZATION_SELECT",
3900
+ code: "組織2",
3901
+ size: {
3902
+ width: "250"
3903
+ }
3904
+ }
3905
+ ]
3906
+ },
3907
+ {
3908
+ type: "ROW",
3909
+ fields: [
3910
+ {
3911
+ type: "GROUP_SELECT",
3912
+ code: "グループ1",
3913
+ size: {
3914
+ width: "250"
3915
+ }
3916
+ },
3917
+ {
3918
+ type: "GROUP_SELECT",
3919
+ code: "グループ2",
3920
+ size: {
3921
+ width: "250"
3922
+ }
3923
+ }
3924
+ ]
3925
+ },
3926
+ {
3927
+ type: "GROUP",
3928
+ code: "グループ枠1",
3929
+ layout: [
3930
+ {
3931
+ type: "ROW",
3932
+ fields: [
3933
+ {
3934
+ type: "SINGLE_LINE_TEXT",
3935
+ code: "枠内文字列1",
3936
+ size: {
3937
+ width: "250"
3938
+ }
3939
+ },
3940
+ {
3941
+ type: "NUMBER",
3942
+ code: "枠内数値1",
3943
+ size: {
3944
+ width: "250"
3945
+ }
3946
+ }
3947
+ ]
3948
+ }
3949
+ ]
3950
+ },
3951
+ {
3952
+ type: "ROW",
3953
+ fields: [
3954
+ {
3955
+ type: "SPACER",
3956
+ elementId: "",
3957
+ size: {
3958
+ width: "600",
3959
+ height: "20"
3960
+ }
3961
+ }
3962
+ ]
3963
+ },
3964
+ {
3965
+ type: "SUBTABLE",
3966
+ code: "テーブル1",
3967
+ fields: [
3968
+ {
3969
+ type: "SINGLE_LINE_TEXT",
3970
+ code: "T1_文字列",
3971
+ size: {
3972
+ width: "150"
3973
+ }
3974
+ },
3975
+ {
3976
+ type: "MULTI_LINE_TEXT",
3977
+ code: "T1_文字列複数行",
3978
+ size: {
3979
+ width: "150",
3980
+ innerHeight: "125"
3981
+ }
3982
+ },
3983
+ {
3984
+ type: "RICH_TEXT",
3985
+ code: "T1_リッチ",
3986
+ size: {
3987
+ width: "150",
3988
+ innerHeight: "125"
3989
+ }
3990
+ },
3991
+ {
3992
+ type: "NUMBER",
3993
+ code: "T1_数値",
3994
+ size: {
3995
+ width: "150"
3996
+ }
3997
+ },
3998
+ {
3999
+ type: "CALC",
4000
+ code: "T1_計算",
4001
+ size: {
4002
+ width: "150"
4003
+ }
4004
+ },
4005
+ {
4006
+ type: "RADIO_BUTTON",
4007
+ code: "T1_ラジオ",
4008
+ size: {
4009
+ width: "227"
4010
+ }
4011
+ },
4012
+ {
4013
+ type: "CHECK_BOX",
4014
+ code: "T1_チェック",
4015
+ size: {
4016
+ width: "227"
4017
+ }
4018
+ },
4019
+ {
4020
+ type: "MULTI_SELECT",
4021
+ code: "T1_複数選択",
4022
+ size: {
4023
+ width: "150"
4024
+ }
4025
+ },
4026
+ {
4027
+ type: "DROP_DOWN",
4028
+ code: "T1_ドロップダウン",
4029
+ size: {
4030
+ width: "158"
4031
+ }
4032
+ },
4033
+ {
4034
+ type: "DATE",
4035
+ code: "T1_日付",
4036
+ size: {
4037
+ width: "150"
4038
+ }
4039
+ },
4040
+ {
4041
+ type: "TIME",
4042
+ code: "T1_時刻",
4043
+ size: {
4044
+ width: "150"
4045
+ }
4046
+ },
4047
+ {
4048
+ type: "DATETIME",
4049
+ code: "T1_日時",
4050
+ size: {
4051
+ width: "150"
4052
+ }
4053
+ },
4054
+ {
4055
+ type: "FILE",
4056
+ code: "T1_添付",
4057
+ size: {
4058
+ width: "150"
4059
+ }
4060
+ },
4061
+ {
4062
+ type: "LINK",
4063
+ code: "T1_リンク",
4064
+ size: {
4065
+ width: "150"
4066
+ }
4067
+ },
4068
+ {
4069
+ type: "USER_SELECT",
4070
+ code: "T1_ユーザー",
4071
+ size: {
4072
+ width: "150"
4073
+ }
4074
+ },
4075
+ {
4076
+ type: "ORGANIZATION_SELECT",
4077
+ code: "T1_組織",
4078
+ size: {
4079
+ width: "150"
4080
+ }
4081
+ },
4082
+ {
4083
+ type: "GROUP_SELECT",
4084
+ code: "T1_グループ",
4085
+ size: {
4086
+ width: "150"
4087
+ }
4088
+ }
4089
+ ]
4090
+ },
4091
+ {
4092
+ type: "SUBTABLE",
4093
+ code: "テーブル2",
4094
+ fields: [
4095
+ {
4096
+ type: "SINGLE_LINE_TEXT",
4097
+ code: "T2_文字列",
4098
+ size: {
4099
+ width: "150"
4100
+ }
4101
+ },
4102
+ {
4103
+ type: "MULTI_LINE_TEXT",
4104
+ code: "T2_文字列複数行",
4105
+ size: {
4106
+ width: "150",
4107
+ innerHeight: "125"
4108
+ }
4109
+ },
4110
+ {
4111
+ type: "RICH_TEXT",
4112
+ code: "T2_リッチ",
4113
+ size: {
4114
+ width: "150",
4115
+ innerHeight: "125"
4116
+ }
4117
+ },
4118
+ {
4119
+ type: "NUMBER",
4120
+ code: "T2_数値",
4121
+ size: {
4122
+ width: "150"
4123
+ }
4124
+ },
4125
+ {
4126
+ type: "CALC",
4127
+ code: "T2_計算",
4128
+ size: {
4129
+ width: "150"
4130
+ }
4131
+ },
4132
+ {
4133
+ type: "RADIO_BUTTON",
4134
+ code: "T2_ラジオ",
4135
+ size: {
4136
+ width: "227"
4137
+ }
4138
+ },
4139
+ {
4140
+ type: "CHECK_BOX",
4141
+ code: "T2_チェック",
4142
+ size: {
4143
+ width: "227"
4144
+ }
4145
+ },
4146
+ {
4147
+ type: "MULTI_SELECT",
4148
+ code: "T2_複数選択",
4149
+ size: {
4150
+ width: "150"
4151
+ }
4152
+ },
4153
+ {
4154
+ type: "DROP_DOWN",
4155
+ code: "T2_ドロップダウン",
4156
+ size: {
4157
+ width: "158"
4158
+ }
4159
+ },
4160
+ {
4161
+ type: "DATE",
4162
+ code: "T2_日付",
4163
+ size: {
4164
+ width: "150"
4165
+ }
4166
+ },
4167
+ {
4168
+ type: "TIME",
4169
+ code: "T2_時刻",
4170
+ size: {
4171
+ width: "150"
4172
+ }
4173
+ },
4174
+ {
4175
+ type: "DATETIME",
4176
+ code: "T2_日時",
4177
+ size: {
4178
+ width: "150"
4179
+ }
4180
+ },
4181
+ {
4182
+ type: "FILE",
4183
+ code: "T2_添付",
4184
+ size: {
4185
+ width: "150"
4186
+ }
4187
+ },
4188
+ {
4189
+ type: "LINK",
4190
+ code: "T2_リンク",
4191
+ size: {
4192
+ width: "150"
4193
+ }
4194
+ },
4195
+ {
4196
+ type: "USER_SELECT",
4197
+ code: "T2_ユーザー",
4198
+ size: {
4199
+ width: "150"
4200
+ }
4201
+ },
4202
+ {
4203
+ type: "ORGANIZATION_SELECT",
4204
+ code: "T2_組織",
4205
+ size: {
4206
+ width: "150"
4207
+ }
4208
+ },
4209
+ {
4210
+ type: "GROUP_SELECT",
4211
+ code: "T2_グループ",
4212
+ size: {
4213
+ width: "150"
4214
+ }
4215
+ }
4216
+ ]
4217
+ },
4218
+ {
4219
+ type: "ROW",
4220
+ fields: [
4221
+ {
4222
+ type: "RECORD_NUMBER",
4223
+ code: "レコード番号",
4224
+ size: {
4225
+ width: "250"
4226
+ }
4227
+ },
4228
+ {
4229
+ type: "CREATOR",
4230
+ code: "作成者",
4231
+ size: {
4232
+ width: "250"
4233
+ }
4234
+ }
4235
+ ]
4236
+ },
4237
+ {
4238
+ type: "ROW",
4239
+ fields: [
4240
+ {
4241
+ type: "CREATED_TIME",
4242
+ code: "作成日時",
4243
+ size: {
4244
+ width: "250"
4245
+ }
4246
+ },
4247
+ {
4248
+ type: "MODIFIER",
4249
+ code: "更新者",
4250
+ size: {
4251
+ width: "250"
4252
+ }
4253
+ }
4254
+ ]
4255
+ },
4256
+ {
4257
+ type: "ROW",
4258
+ fields: [
4259
+ {
4260
+ type: "UPDATED_TIME",
4261
+ code: "更新日時",
4262
+ size: {
4263
+ width: "250"
4264
+ }
4265
+ }
4266
+ ]
4267
+ }
4268
+ ],
4269
+ views: {
4270
+ "(作業者が自分)": {
4271
+ type: "LIST",
4272
+ name: "(作業者が自分)",
4273
+ id: "16550400",
4274
+ filterCond: "作業者 in (LOGINUSER())",
4275
+ sort: "レコード番号 desc",
4276
+ index: "0",
4277
+ fields: [
4278
+ "レコード番号",
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
+ "リンク2",
4307
+ "ユーザー1",
4308
+ "ユーザー2",
4309
+ "組織1",
4310
+ "組織2",
4311
+ "グループ1",
4312
+ "グループ2",
4313
+ "枠内文字列1",
4314
+ "枠内数値1",
4315
+ "ステータス",
4316
+ "作業者"
4317
+ ],
4318
+ builtinType: "ASSIGNEE"
4319
+ }
4320
+ }
4321
+ };
4322
+
4323
+ // src/sample-app/record-1.json
4324
+ var record_1_default = {
4325
+ tool: "formula-authoring record",
4326
+ fetchedAt: "2026-01-15T00:00:00.000Z",
4327
+ baseUrl: "https://example.cybozu.com",
4328
+ appId: 4329,
4329
+ id: 1,
4330
+ record: {
4331
+ チェック2: {
4332
+ type: "CHECK_BOX",
4333
+ value: [
4334
+ "甲"
4335
+ ]
4336
+ },
4337
+ レコード番号: {
4338
+ type: "RECORD_NUMBER",
4339
+ value: "1"
4340
+ },
4341
+ ドロップダウン2: {
4342
+ type: "DROP_DOWN",
4343
+ value: "乙"
4344
+ },
4345
+ ユーザー2: {
4346
+ type: "USER_SELECT",
4347
+ value: [
4348
+ {
4349
+ code: "demo_user01",
4350
+ name: "架空 社長"
4351
+ },
4352
+ {
4353
+ code: "demo_user02",
4354
+ name: "架空 営業部長"
4355
+ }
4356
+ ]
4357
+ },
4358
+ 組織1: {
4359
+ type: "ORGANIZATION_SELECT",
4360
+ value: [
4361
+ {
4362
+ code: "demo_hq",
4363
+ name: "架空本社"
4364
+ }
4365
+ ]
4366
+ },
4367
+ ドロップダウン1: {
4368
+ type: "DROP_DOWN",
4369
+ value: "A"
4370
+ },
4371
+ 更新者: {
4372
+ type: "MODIFIER",
4373
+ value: {
4374
+ code: "demo_user02",
4375
+ name: "架空 営業部長"
4376
+ }
4377
+ },
4378
+ ユーザー1: {
4379
+ type: "USER_SELECT",
4380
+ value: [
4381
+ {
4382
+ code: "demo_user01",
4383
+ name: "架空 社長"
4384
+ }
4385
+ ]
4386
+ },
4387
+ 組織2: {
4388
+ type: "ORGANIZATION_SELECT",
4389
+ value: [
4390
+ {
4391
+ code: "demo_sales",
4392
+ name: "架空営業部"
4393
+ }
4394
+ ]
4395
+ },
4396
+ テーブル2: {
4397
+ type: "SUBTABLE",
4398
+ value: [
4399
+ {
4400
+ id: "7727389",
4401
+ value: {
4402
+ T2_複数選択: {
4403
+ type: "MULTI_SELECT",
4404
+ value: [
4405
+ "B"
4406
+ ]
4407
+ },
4408
+ T2_文字列複数行: {
4409
+ type: "MULTI_LINE_TEXT",
4410
+ value: "T2 行 1\n2 行目"
4411
+ },
4412
+ T2_リンク: {
4413
+ type: "LINK",
4414
+ value: "https://example.com/"
4415
+ },
4416
+ T2_リッチ: {
4417
+ type: "RICH_TEXT",
4418
+ value: "<div>T2 行 1</div>"
4419
+ },
4420
+ T2_文字列: {
4421
+ type: "SINGLE_LINE_TEXT",
4422
+ value: "T2 行 1"
4423
+ },
4424
+ T2_チェック: {
4425
+ type: "CHECK_BOX",
4426
+ value: [
4427
+ "A"
4428
+ ]
4429
+ },
4430
+ T2_ユーザー: {
4431
+ type: "USER_SELECT",
4432
+ value: [
4433
+ {
4434
+ code: "demo_user01",
4435
+ name: "架空 社長"
4436
+ }
4437
+ ]
4438
+ },
4439
+ T2_グループ: {
4440
+ type: "GROUP_SELECT",
4441
+ value: [
4442
+ {
4443
+ code: "demo_managers",
4444
+ name: "架空管理職"
4445
+ }
4446
+ ]
4447
+ },
4448
+ T2_日付: {
4449
+ type: "DATE",
4450
+ value: "2026-02-01"
4451
+ },
4452
+ T2_数値: {
4453
+ type: "NUMBER",
4454
+ value: "10"
4455
+ },
4456
+ T2_ドロップダウン: {
4457
+ type: "DROP_DOWN",
4458
+ value: "C"
4459
+ },
4460
+ T2_組織: {
4461
+ type: "ORGANIZATION_SELECT",
4462
+ value: [
4463
+ {
4464
+ code: "demo_hq",
4465
+ name: "架空本社"
4466
+ }
4467
+ ]
4468
+ },
4469
+ T2_計算: {
4470
+ type: "CALC",
4471
+ value: "20"
4472
+ },
4473
+ T2_ラジオ: {
4474
+ type: "RADIO_BUTTON",
4475
+ value: "A"
4476
+ },
4477
+ T2_日時: {
4478
+ type: "DATETIME",
4479
+ value: "2026-02-01T00:30:00Z"
4480
+ },
4481
+ T2_添付: {
4482
+ type: "FILE",
4483
+ value: []
4484
+ },
4485
+ T2_時刻: {
4486
+ type: "TIME",
4487
+ value: "09:30"
4488
+ }
4489
+ }
4490
+ },
4491
+ {
4492
+ id: "7727392",
4493
+ value: {
4494
+ T2_複数選択: {
4495
+ type: "MULTI_SELECT",
4496
+ value: [
4497
+ "B"
4498
+ ]
4499
+ },
4500
+ T2_文字列複数行: {
4501
+ type: "MULTI_LINE_TEXT",
4502
+ value: "T2 行 2\n2 行目"
4503
+ },
4504
+ T2_リンク: {
4505
+ type: "LINK",
4506
+ value: "https://example.com/"
4507
+ },
4508
+ T2_リッチ: {
4509
+ type: "RICH_TEXT",
4510
+ value: "<div>T2 行 2</div>"
4511
+ },
4512
+ T2_文字列: {
4513
+ type: "SINGLE_LINE_TEXT",
4514
+ value: "T2 行 2"
4515
+ },
4516
+ T2_チェック: {
4517
+ type: "CHECK_BOX",
4518
+ value: [
4519
+ "A"
4520
+ ]
4521
+ },
4522
+ T2_ユーザー: {
4523
+ type: "USER_SELECT",
4524
+ value: [
4525
+ {
4526
+ code: "demo_user01",
4527
+ name: "架空 社長"
4528
+ }
4529
+ ]
4530
+ },
4531
+ T2_グループ: {
4532
+ type: "GROUP_SELECT",
4533
+ value: [
4534
+ {
4535
+ code: "demo_managers",
4536
+ name: "架空管理職"
4537
+ }
4538
+ ]
4539
+ },
4540
+ T2_日付: {
4541
+ type: "DATE",
4542
+ value: "2026-02-02"
4543
+ },
4544
+ T2_数値: {
4545
+ type: "NUMBER",
4546
+ value: "20"
4547
+ },
4548
+ T2_ドロップダウン: {
4549
+ type: "DROP_DOWN",
4550
+ value: "B"
4551
+ },
4552
+ T2_組織: {
4553
+ type: "ORGANIZATION_SELECT",
4554
+ value: [
4555
+ {
4556
+ code: "demo_hq",
4557
+ name: "架空本社"
4558
+ }
4559
+ ]
4560
+ },
4561
+ T2_計算: {
4562
+ type: "CALC",
4563
+ value: "40"
4564
+ },
4565
+ T2_ラジオ: {
4566
+ type: "RADIO_BUTTON",
4567
+ value: "A"
4568
+ },
4569
+ T2_日時: {
4570
+ type: "DATETIME",
4571
+ value: "2026-02-02T00:30:00Z"
4572
+ },
4573
+ T2_添付: {
4574
+ type: "FILE",
4575
+ value: []
4576
+ },
4577
+ T2_時刻: {
4578
+ type: "TIME",
4579
+ value: "09:30"
4580
+ }
4581
+ }
4582
+ }
4583
+ ]
4584
+ },
4585
+ ステータス: {
4586
+ type: "STATUS",
4587
+ value: "未処理"
4588
+ },
4589
+ グループ1: {
4590
+ type: "GROUP_SELECT",
4591
+ value: [
4592
+ {
4593
+ code: "demo_managers",
4594
+ name: "架空管理職"
4595
+ }
4596
+ ]
4597
+ },
4598
+ テーブル1: {
4599
+ type: "SUBTABLE",
4600
+ value: [
4601
+ {
4602
+ id: "7727380",
4603
+ value: {
4604
+ T1_ユーザー: {
4605
+ type: "USER_SELECT",
4606
+ value: [
4607
+ {
4608
+ code: "demo_user01",
4609
+ name: "架空 社長"
4610
+ }
4611
+ ]
4612
+ },
4613
+ T1_文字列複数行: {
4614
+ type: "MULTI_LINE_TEXT",
4615
+ value: "行 1\n2 行目"
4616
+ },
4617
+ T1_ラジオ: {
4618
+ type: "RADIO_BUTTON",
4619
+ value: "A"
4620
+ },
4621
+ T1_複数選択: {
4622
+ type: "MULTI_SELECT",
4623
+ value: [
4624
+ "B"
4625
+ ]
4626
+ },
4627
+ T1_日付: {
4628
+ type: "DATE",
4629
+ value: "2026-01-10"
4630
+ },
4631
+ T1_ドロップダウン: {
4632
+ type: "DROP_DOWN",
4633
+ value: "A"
4634
+ },
4635
+ T1_リッチ: {
4636
+ type: "RICH_TEXT",
4637
+ value: "<div>行 1</div>"
4638
+ },
4639
+ T1_数値: {
4640
+ type: "NUMBER",
4641
+ value: "100"
4642
+ },
4643
+ T1_組織: {
4644
+ type: "ORGANIZATION_SELECT",
4645
+ value: [
4646
+ {
4647
+ code: "demo_hq",
4648
+ name: "架空本社"
4649
+ }
4650
+ ]
4651
+ },
4652
+ T1_リンク: {
4653
+ type: "LINK",
4654
+ value: "https://example.com/"
4655
+ },
4656
+ T1_文字列: {
4657
+ type: "SINGLE_LINE_TEXT",
4658
+ value: "行 1"
4659
+ },
4660
+ T1_計算: {
4661
+ type: "CALC",
4662
+ value: "200"
4663
+ },
4664
+ T1_添付: {
4665
+ type: "FILE",
4666
+ value: []
4667
+ },
4668
+ T1_日時: {
4669
+ type: "DATETIME",
4670
+ value: "2026-01-10T00:30:00Z"
4671
+ },
4672
+ T1_グループ: {
4673
+ type: "GROUP_SELECT",
4674
+ value: [
4675
+ {
4676
+ code: "demo_managers",
4677
+ name: "架空管理職"
4678
+ }
4679
+ ]
4680
+ },
4681
+ T1_チェック: {
4682
+ type: "CHECK_BOX",
4683
+ value: [
4684
+ "A"
4685
+ ]
4686
+ },
4687
+ T1_時刻: {
4688
+ type: "TIME",
4689
+ value: "09:30"
4690
+ }
4691
+ }
4692
+ },
4693
+ {
4694
+ id: "7727383",
4695
+ value: {
4696
+ T1_ユーザー: {
4697
+ type: "USER_SELECT",
4698
+ value: [
4699
+ {
4700
+ code: "demo_user01",
4701
+ name: "架空 社長"
4702
+ }
4703
+ ]
4704
+ },
4705
+ T1_文字列複数行: {
4706
+ type: "MULTI_LINE_TEXT",
4707
+ value: "行 2\n2 行目"
4708
+ },
4709
+ T1_ラジオ: {
4710
+ type: "RADIO_BUTTON",
4711
+ value: "A"
4712
+ },
4713
+ T1_複数選択: {
4714
+ type: "MULTI_SELECT",
4715
+ value: [
4716
+ "B"
4717
+ ]
4718
+ },
4719
+ T1_日付: {
4720
+ type: "DATE",
4721
+ value: "2026-01-20"
4722
+ },
4723
+ T1_ドロップダウン: {
4724
+ type: "DROP_DOWN",
4725
+ value: "B"
4726
+ },
4727
+ T1_リッチ: {
4728
+ type: "RICH_TEXT",
4729
+ value: "<div>行 2</div>"
4730
+ },
4731
+ T1_数値: {
4732
+ type: "NUMBER",
4733
+ value: "200"
4734
+ },
4735
+ T1_組織: {
4736
+ type: "ORGANIZATION_SELECT",
4737
+ value: [
4738
+ {
4739
+ code: "demo_hq",
4740
+ name: "架空本社"
4741
+ }
4742
+ ]
4743
+ },
4744
+ T1_リンク: {
4745
+ type: "LINK",
4746
+ value: "https://example.com/"
4747
+ },
4748
+ T1_文字列: {
4749
+ type: "SINGLE_LINE_TEXT",
4750
+ value: "行 2"
4751
+ },
4752
+ T1_計算: {
4753
+ type: "CALC",
4754
+ value: "400"
4755
+ },
4756
+ T1_添付: {
4757
+ type: "FILE",
4758
+ value: []
4759
+ },
4760
+ T1_日時: {
4761
+ type: "DATETIME",
4762
+ value: "2026-01-20T00:30:00Z"
4763
+ },
4764
+ T1_グループ: {
4765
+ type: "GROUP_SELECT",
4766
+ value: [
4767
+ {
4768
+ code: "demo_managers",
4769
+ name: "架空管理職"
4770
+ }
4771
+ ]
4772
+ },
4773
+ T1_チェック: {
4774
+ type: "CHECK_BOX",
4775
+ value: [
4776
+ "A"
4777
+ ]
4778
+ },
4779
+ T1_時刻: {
4780
+ type: "TIME",
4781
+ value: "09:30"
4782
+ }
4783
+ }
4784
+ },
4785
+ {
4786
+ id: "7727386",
4787
+ value: {
4788
+ T1_ユーザー: {
4789
+ type: "USER_SELECT",
4790
+ value: [
4791
+ {
4792
+ code: "demo_user01",
4793
+ name: "架空 社長"
4794
+ }
4795
+ ]
4796
+ },
4797
+ T1_文字列複数行: {
4798
+ type: "MULTI_LINE_TEXT",
4799
+ value: "行 3\n2 行目"
4800
+ },
4801
+ T1_ラジオ: {
4802
+ type: "RADIO_BUTTON",
4803
+ value: "A"
4804
+ },
4805
+ T1_複数選択: {
4806
+ type: "MULTI_SELECT",
4807
+ value: [
4808
+ "B"
4809
+ ]
4810
+ },
4811
+ T1_日付: {
4812
+ type: "DATE",
4813
+ value: "2026-01-30"
4814
+ },
4815
+ T1_ドロップダウン: {
4816
+ type: "DROP_DOWN",
4817
+ value: "A"
4818
+ },
4819
+ T1_リッチ: {
4820
+ type: "RICH_TEXT",
4821
+ value: "<div>行 3</div>"
4822
+ },
4823
+ T1_数値: {
4824
+ type: "NUMBER",
4825
+ value: "300"
4826
+ },
4827
+ T1_組織: {
4828
+ type: "ORGANIZATION_SELECT",
4829
+ value: [
4830
+ {
4831
+ code: "demo_hq",
4832
+ name: "架空本社"
4833
+ }
4834
+ ]
4835
+ },
4836
+ T1_リンク: {
4837
+ type: "LINK",
4838
+ value: "https://example.com/"
4839
+ },
4840
+ T1_文字列: {
4841
+ type: "SINGLE_LINE_TEXT",
4842
+ value: "行 3"
4843
+ },
4844
+ T1_計算: {
4845
+ type: "CALC",
4846
+ value: "600"
4847
+ },
4848
+ T1_添付: {
4849
+ type: "FILE",
4850
+ value: []
4851
+ },
4852
+ T1_日時: {
4853
+ type: "DATETIME",
4854
+ value: "2026-01-30T00:30:00Z"
4855
+ },
4856
+ T1_グループ: {
4857
+ type: "GROUP_SELECT",
4858
+ value: [
4859
+ {
4860
+ code: "demo_managers",
4861
+ name: "架空管理職"
4862
+ }
4863
+ ]
4864
+ },
4865
+ T1_チェック: {
4866
+ type: "CHECK_BOX",
4867
+ value: [
4868
+ "A"
4869
+ ]
4870
+ },
4871
+ T1_時刻: {
4872
+ type: "TIME",
4873
+ value: "09:30"
4874
+ }
4875
+ }
4876
+ }
4877
+ ]
4878
+ },
4879
+ ラジオ1: {
4880
+ type: "RADIO_BUTTON",
4881
+ value: "B"
4882
+ },
4883
+ グループ2: {
4884
+ type: "GROUP_SELECT",
4885
+ value: [
4886
+ {
4887
+ code: "demo_approvers",
4888
+ name: "架空承認者"
4889
+ }
4890
+ ]
4891
+ },
4892
+ ラジオ2: {
4893
+ type: "RADIO_BUTTON",
4894
+ value: "乙"
4895
+ },
4896
+ リッチ1: {
4897
+ type: "RICH_TEXT",
4898
+ value: "<div><b>太字</b>と<i>斜体</i></div>"
4899
+ },
4900
+ 時刻2: {
4901
+ type: "TIME",
4902
+ value: "17:45"
4903
+ },
4904
+ カテゴリー: {
4905
+ type: "CATEGORY",
4906
+ value: []
4907
+ },
4908
+ 時刻1: {
4909
+ type: "TIME",
4910
+ value: "09:30"
4911
+ },
4912
+ リンク1: {
4913
+ type: "LINK",
4914
+ value: "https://example.com/sample"
4915
+ },
4916
+ リッチ2: {
4917
+ type: "RICH_TEXT",
4918
+ value: "<div>リッチ 2</div>"
4919
+ },
4920
+ リンク2: {
4921
+ type: "LINK",
4922
+ value: "sample@example.com"
4923
+ },
4924
+ 計算2: {
4925
+ type: "CALC",
4926
+ value: "-75"
4927
+ },
4928
+ 計算1: {
4929
+ type: "CALC",
4930
+ value: "1290.78"
4931
+ },
4932
+ 複数選択2: {
4933
+ type: "MULTI_SELECT",
4934
+ value: [
4935
+ "丙"
4936
+ ]
4937
+ },
4938
+ 日時1: {
4939
+ type: "DATETIME",
4940
+ value: "2026-01-15T00:30:00Z"
4941
+ },
4942
+ 複数選択1: {
4943
+ type: "MULTI_SELECT",
4944
+ value: [
4945
+ "A",
4946
+ "B"
4947
+ ]
4948
+ },
4949
+ 日時2: {
4950
+ type: "DATETIME",
4951
+ value: "2026-03-31T08:45:00Z"
4952
+ },
4953
+ 枠内数値1: {
4954
+ type: "NUMBER",
4955
+ value: "42"
4956
+ },
4957
+ 作業者: {
4958
+ type: "STATUS_ASSIGNEE",
4959
+ value: []
4960
+ },
4961
+ 作成者: {
4962
+ type: "CREATOR",
4963
+ value: {
4964
+ code: "demo_user01",
4965
+ name: "架空 社長"
4966
+ }
4967
+ },
4968
+ $revision: {
4969
+ type: "__REVISION__",
4970
+ value: "2"
4971
+ },
4972
+ 文字列2: {
4973
+ type: "SINGLE_LINE_TEXT",
4974
+ value: "サンプル文字列 2"
4975
+ },
4976
+ 文字列1: {
4977
+ type: "SINGLE_LINE_TEXT",
4978
+ value: "サンプル文字列 1"
4979
+ },
4980
+ 更新日時: {
4981
+ type: "UPDATED_TIME",
4982
+ value: "2026-01-15T00:00:00Z"
4983
+ },
4984
+ 添付1: {
4985
+ type: "FILE",
4986
+ value: []
4987
+ },
4988
+ 添付2: {
4989
+ type: "FILE",
4990
+ value: []
4991
+ },
4992
+ 文字列複数行2: {
4993
+ type: "MULTI_LINE_TEXT",
4994
+ value: "複数行 2"
4995
+ },
4996
+ 日付1: {
4997
+ type: "DATE",
4998
+ value: "2026-01-15"
4999
+ },
5000
+ 枠内文字列1: {
5001
+ type: "SINGLE_LINE_TEXT",
5002
+ value: "枠の中の文字列"
5003
+ },
5004
+ 文字列複数行1: {
5005
+ type: "MULTI_LINE_TEXT",
5006
+ value: "1 行目\n2 行目\n3 行目"
5007
+ },
5008
+ 日付2: {
5009
+ type: "DATE",
5010
+ value: "2026-03-31"
5011
+ },
5012
+ 数値2: {
5013
+ type: "NUMBER",
5014
+ value: "56.78"
5015
+ },
5016
+ 数値1: {
5017
+ type: "NUMBER",
5018
+ value: "1234"
5019
+ },
5020
+ チェック1: {
5021
+ type: "CHECK_BOX",
5022
+ value: [
5023
+ "A",
5024
+ "C"
5025
+ ]
5026
+ },
5027
+ 作成日時: {
5028
+ type: "CREATED_TIME",
5029
+ value: "2026-01-15T00:00:00Z"
5030
+ },
5031
+ $id: {
5032
+ type: "__ID__",
5033
+ value: "1"
5034
+ }
5035
+ }
5036
+ };
5037
+
5038
+ // src/sample-app/record-2.json
5039
+ var record_2_default = {
5040
+ tool: "formula-authoring record",
5041
+ fetchedAt: "2026-01-15T00:00:00.000Z",
5042
+ baseUrl: "https://example.cybozu.com",
5043
+ appId: 4329,
5044
+ id: 2,
5045
+ record: {
5046
+ チェック2: {
5047
+ type: "CHECK_BOX",
5048
+ value: []
5049
+ },
5050
+ レコード番号: {
5051
+ type: "RECORD_NUMBER",
5052
+ value: "2"
5053
+ },
5054
+ ドロップダウン2: {
5055
+ type: "DROP_DOWN",
5056
+ value: "丙"
5057
+ },
5058
+ ユーザー2: {
5059
+ type: "USER_SELECT",
5060
+ value: []
5061
+ },
5062
+ 組織1: {
5063
+ type: "ORGANIZATION_SELECT",
5064
+ value: []
5065
+ },
5066
+ ドロップダウン1: {
5067
+ type: "DROP_DOWN",
5068
+ value: null
5069
+ },
5070
+ 更新者: {
5071
+ type: "MODIFIER",
5072
+ value: {
5073
+ code: "demo_user02",
5074
+ name: "架空 営業部長"
5075
+ }
5076
+ },
5077
+ ユーザー1: {
5078
+ type: "USER_SELECT",
5079
+ value: []
5080
+ },
5081
+ 組織2: {
5082
+ type: "ORGANIZATION_SELECT",
5083
+ value: []
5084
+ },
5085
+ テーブル2: {
5086
+ type: "SUBTABLE",
5087
+ value: []
5088
+ },
5089
+ ステータス: {
5090
+ type: "STATUS",
5091
+ value: "未処理"
5092
+ },
5093
+ グループ1: {
5094
+ type: "GROUP_SELECT",
5095
+ value: []
5096
+ },
5097
+ テーブル1: {
5098
+ type: "SUBTABLE",
5099
+ value: [
5100
+ {
5101
+ id: "7727396",
5102
+ value: {
5103
+ T1_ユーザー: {
5104
+ type: "USER_SELECT",
5105
+ value: []
5106
+ },
5107
+ T1_文字列複数行: {
5108
+ type: "MULTI_LINE_TEXT",
5109
+ value: "\n2 行目"
5110
+ },
5111
+ T1_ラジオ: {
5112
+ type: "RADIO_BUTTON",
5113
+ value: "A"
5114
+ },
5115
+ T1_複数選択: {
5116
+ type: "MULTI_SELECT",
5117
+ value: [
5118
+ "B"
5119
+ ]
5120
+ },
5121
+ T1_日付: {
5122
+ type: "DATE",
5123
+ value: "2026-02-28"
5124
+ },
5125
+ T1_ドロップダウン: {
5126
+ type: "DROP_DOWN",
5127
+ value: null
5128
+ },
5129
+ T1_リッチ: {
5130
+ type: "RICH_TEXT",
5131
+ value: "<div></div>"
5132
+ },
5133
+ T1_数値: {
5134
+ type: "NUMBER",
5135
+ value: "0"
5136
+ },
5137
+ T1_組織: {
5138
+ type: "ORGANIZATION_SELECT",
5139
+ value: []
5140
+ },
5141
+ T1_リンク: {
5142
+ type: "LINK",
5143
+ value: "https://example.com/"
5144
+ },
5145
+ T1_文字列: {
5146
+ type: "SINGLE_LINE_TEXT",
5147
+ value: ""
5148
+ },
5149
+ T1_計算: {
5150
+ type: "CALC",
5151
+ value: "0"
5152
+ },
5153
+ T1_添付: {
5154
+ type: "FILE",
5155
+ value: []
5156
+ },
5157
+ T1_日時: {
5158
+ type: "DATETIME",
5159
+ value: "2026-02-28T00:30:00Z"
5160
+ },
5161
+ T1_グループ: {
5162
+ type: "GROUP_SELECT",
5163
+ value: []
5164
+ },
5165
+ T1_チェック: {
5166
+ type: "CHECK_BOX",
5167
+ value: [
5168
+ "A"
5169
+ ]
5170
+ },
5171
+ T1_時刻: {
5172
+ type: "TIME",
5173
+ value: "09:30"
5174
+ }
5175
+ }
5176
+ }
5177
+ ]
5178
+ },
5179
+ ラジオ1: {
5180
+ type: "RADIO_BUTTON",
5181
+ value: "C"
5182
+ },
5183
+ グループ2: {
5184
+ type: "GROUP_SELECT",
5185
+ value: []
5186
+ },
5187
+ ラジオ2: {
5188
+ type: "RADIO_BUTTON",
5189
+ value: "甲"
5190
+ },
5191
+ リッチ1: {
5192
+ type: "RICH_TEXT",
5193
+ value: ""
5194
+ },
5195
+ 時刻2: {
5196
+ type: "TIME",
5197
+ value: "23:59"
5198
+ },
5199
+ カテゴリー: {
5200
+ type: "CATEGORY",
5201
+ value: []
5202
+ },
5203
+ 時刻1: {
5204
+ type: "TIME",
5205
+ value: "00:00"
5206
+ },
5207
+ リンク1: {
5208
+ type: "LINK",
5209
+ value: ""
5210
+ },
5211
+ リッチ2: {
5212
+ type: "RICH_TEXT",
5213
+ value: ""
5214
+ },
5215
+ リンク2: {
5216
+ type: "LINK",
5217
+ value: ""
5218
+ },
5219
+ 計算2: {
5220
+ type: "CALC",
5221
+ value: "-306"
5222
+ },
5223
+ 計算1: {
5224
+ type: "CALC",
5225
+ value: "-12.345"
5226
+ },
5227
+ 複数選択2: {
5228
+ type: "MULTI_SELECT",
5229
+ value: []
5230
+ },
5231
+ 日時1: {
5232
+ type: "DATETIME",
5233
+ value: "2026-12-31T14:59:00Z"
5234
+ },
5235
+ 複数選択1: {
5236
+ type: "MULTI_SELECT",
5237
+ value: []
5238
+ },
5239
+ 日時2: {
5240
+ type: "DATETIME",
5241
+ value: ""
5242
+ },
5243
+ 枠内数値1: {
5244
+ type: "NUMBER",
5245
+ value: ""
5246
+ },
5247
+ 作業者: {
5248
+ type: "STATUS_ASSIGNEE",
5249
+ value: []
5250
+ },
5251
+ 作成者: {
5252
+ type: "CREATOR",
5253
+ value: {
5254
+ code: "demo_user01",
5255
+ name: "架空 社長"
5256
+ }
5257
+ },
5258
+ $revision: {
5259
+ type: "__REVISION__",
5260
+ value: "2"
5261
+ },
5262
+ 文字列2: {
5263
+ type: "SINGLE_LINE_TEXT",
5264
+ value: ""
5265
+ },
5266
+ 文字列1: {
5267
+ type: "SINGLE_LINE_TEXT",
5268
+ value: "端の値"
5269
+ },
5270
+ 更新日時: {
5271
+ type: "UPDATED_TIME",
5272
+ value: "2026-01-15T00:00:00Z"
5273
+ },
5274
+ 添付1: {
5275
+ type: "FILE",
5276
+ value: []
5277
+ },
5278
+ 添付2: {
5279
+ type: "FILE",
5280
+ value: []
5281
+ },
5282
+ 文字列複数行2: {
5283
+ type: "MULTI_LINE_TEXT",
5284
+ value: ""
5285
+ },
5286
+ 日付1: {
5287
+ type: "DATE",
5288
+ value: "2026-02-28"
5289
+ },
5290
+ 枠内文字列1: {
5291
+ type: "SINGLE_LINE_TEXT",
5292
+ value: ""
5293
+ },
5294
+ 文字列複数行1: {
5295
+ type: "MULTI_LINE_TEXT",
5296
+ value: "1\n\n3\n"
5297
+ },
5298
+ 日付2: {
5299
+ type: "DATE",
5300
+ value: "2026-12-31"
5301
+ },
5302
+ 数値2: {
5303
+ type: "NUMBER",
5304
+ value: "-12.345"
5305
+ },
5306
+ 数値1: {
5307
+ type: "NUMBER",
5308
+ value: "0"
5309
+ },
5310
+ チェック1: {
5311
+ type: "CHECK_BOX",
5312
+ value: []
5313
+ },
5314
+ 作成日時: {
5315
+ type: "CREATED_TIME",
5316
+ value: "2026-01-15T00:00:00Z"
5317
+ },
5318
+ $id: {
5319
+ type: "__ID__",
5320
+ value: "2"
5321
+ }
5322
+ }
5323
+ };
5324
+
5325
+ // src/sample-app/record-3.json
5326
+ var record_3_default = {
5327
+ tool: "formula-authoring record",
5328
+ fetchedAt: "2026-01-15T00:00:00.000Z",
5329
+ baseUrl: "https://example.cybozu.com",
5330
+ appId: 4329,
5331
+ id: 3,
5332
+ record: {
5333
+ チェック2: {
5334
+ type: "CHECK_BOX",
5335
+ value: []
5336
+ },
5337
+ レコード番号: {
5338
+ type: "RECORD_NUMBER",
5339
+ value: "3"
5340
+ },
5341
+ ドロップダウン2: {
5342
+ type: "DROP_DOWN",
5343
+ value: null
5344
+ },
5345
+ ユーザー2: {
5346
+ type: "USER_SELECT",
5347
+ value: []
5348
+ },
5349
+ 組織1: {
5350
+ type: "ORGANIZATION_SELECT",
5351
+ value: []
5352
+ },
5353
+ ドロップダウン1: {
5354
+ type: "DROP_DOWN",
5355
+ value: null
5356
+ },
5357
+ 更新者: {
5358
+ type: "MODIFIER",
5359
+ value: {
5360
+ code: "demo_user02",
5361
+ name: "架空 営業部長"
5362
+ }
5363
+ },
5364
+ ユーザー1: {
5365
+ type: "USER_SELECT",
5366
+ value: []
5367
+ },
5368
+ 組織2: {
5369
+ type: "ORGANIZATION_SELECT",
5370
+ value: []
5371
+ },
5372
+ テーブル2: {
5373
+ type: "SUBTABLE",
5374
+ value: []
5375
+ },
5376
+ ステータス: {
5377
+ type: "STATUS",
5378
+ value: "未処理"
5379
+ },
5380
+ グループ1: {
5381
+ type: "GROUP_SELECT",
5382
+ value: []
5383
+ },
5384
+ テーブル1: {
5385
+ type: "SUBTABLE",
5386
+ value: []
5387
+ },
5388
+ ラジオ1: {
5389
+ type: "RADIO_BUTTON",
5390
+ value: "A"
5391
+ },
5392
+ グループ2: {
5393
+ type: "GROUP_SELECT",
5394
+ value: []
5395
+ },
5396
+ ラジオ2: {
5397
+ type: "RADIO_BUTTON",
5398
+ value: "甲"
5399
+ },
5400
+ リッチ1: {
5401
+ type: "RICH_TEXT",
5402
+ value: ""
5403
+ },
5404
+ 時刻2: {
5405
+ type: "TIME",
5406
+ value: null
5407
+ },
5408
+ カテゴリー: {
5409
+ type: "CATEGORY",
5410
+ value: []
5411
+ },
5412
+ 時刻1: {
5413
+ type: "TIME",
5414
+ value: null
5415
+ },
5416
+ リンク1: {
5417
+ type: "LINK",
5418
+ value: ""
5419
+ },
5420
+ リッチ2: {
5421
+ type: "RICH_TEXT",
5422
+ value: ""
5423
+ },
5424
+ リンク2: {
5425
+ type: "LINK",
5426
+ value: ""
5427
+ },
5428
+ 計算2: {
5429
+ type: "CALC",
5430
+ value: "0"
5431
+ },
5432
+ 計算1: {
5433
+ type: "CALC",
5434
+ value: "0"
5435
+ },
5436
+ 複数選択2: {
5437
+ type: "MULTI_SELECT",
5438
+ value: []
5439
+ },
5440
+ 日時1: {
5441
+ type: "DATETIME",
5442
+ value: ""
5443
+ },
5444
+ 複数選択1: {
5445
+ type: "MULTI_SELECT",
5446
+ value: []
5447
+ },
5448
+ 日時2: {
5449
+ type: "DATETIME",
5450
+ value: ""
5451
+ },
5452
+ 枠内数値1: {
5453
+ type: "NUMBER",
5454
+ value: ""
5455
+ },
5456
+ 作業者: {
5457
+ type: "STATUS_ASSIGNEE",
5458
+ value: []
5459
+ },
5460
+ 作成者: {
5461
+ type: "CREATOR",
5462
+ value: {
5463
+ code: "demo_user01",
5464
+ name: "架空 社長"
5465
+ }
5466
+ },
5467
+ $revision: {
5468
+ type: "__REVISION__",
5469
+ value: "2"
5470
+ },
5471
+ 文字列2: {
5472
+ type: "SINGLE_LINE_TEXT",
5473
+ value: ""
5474
+ },
5475
+ 文字列1: {
5476
+ type: "SINGLE_LINE_TEXT",
5477
+ value: "空のレコード"
5478
+ },
5479
+ 更新日時: {
5480
+ type: "UPDATED_TIME",
5481
+ value: "2026-01-15T00:00:00Z"
5482
+ },
5483
+ 添付1: {
5484
+ type: "FILE",
5485
+ value: []
5486
+ },
5487
+ 添付2: {
5488
+ type: "FILE",
5489
+ value: []
5490
+ },
5491
+ 文字列複数行2: {
5492
+ type: "MULTI_LINE_TEXT",
5493
+ value: ""
5494
+ },
5495
+ 日付1: {
5496
+ type: "DATE",
5497
+ value: null
5498
+ },
5499
+ 枠内文字列1: {
5500
+ type: "SINGLE_LINE_TEXT",
5501
+ value: ""
5502
+ },
5503
+ 文字列複数行1: {
5504
+ type: "MULTI_LINE_TEXT",
5505
+ value: ""
5506
+ },
5507
+ 日付2: {
5508
+ type: "DATE",
5509
+ value: null
5510
+ },
5511
+ 数値2: {
5512
+ type: "NUMBER",
5513
+ value: ""
5514
+ },
5515
+ 数値1: {
5516
+ type: "NUMBER",
5517
+ value: ""
5518
+ },
5519
+ チェック1: {
5520
+ type: "CHECK_BOX",
5521
+ value: []
5522
+ },
5523
+ 作成日時: {
5524
+ type: "CREATED_TIME",
5525
+ value: "2026-01-15T00:00:00Z"
5526
+ },
5527
+ $id: {
5528
+ type: "__ID__",
5529
+ value: "3"
5530
+ }
5531
+ }
5532
+ };
5533
+
5534
+ // src/sample-app.ts
5535
+ var LABELS = {
5536
+ 1: "典型(全項目に値)",
5537
+ 2: "端(0・負の小数・改行・未選択・月末と年末の日付)",
5538
+ 3: "空(ほぼ全部空)"
5539
+ };
5540
+ function sampleRecord(data, id) {
5541
+ 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)`);
5542
+ return { id, label: LABELS[id] ?? "", record: data.record };
5543
+ }
5544
+ var SAMPLE_APP = {
5545
+ fields: fields_default,
5546
+ records: [sampleRecord(record_1_default, 1), sampleRecord(record_2_default, 2), sampleRecord(record_3_default, 3)]
5547
+ };
5548
+ function sampleApp() {
5549
+ return structuredClone(SAMPLE_APP);
5550
+ }
5551
+ function spacerIds(layout) {
5552
+ const out = [];
5553
+ for (const row of layout) {
5554
+ if (row.type === "GROUP" && Array.isArray(row.layout)) {
5555
+ out.push(...spacerIds(row.layout));
5556
+ continue;
5557
+ }
5558
+ for (const f of row.fields ?? []) if (f.type === "SPACER" && typeof f.elementId === "string" && f.elementId) out.push(f.elementId);
5559
+ }
5560
+ return out;
5561
+ }
5562
+ var tableRows = (record, code) => {
5563
+ const v = record[code]?.value;
5564
+ return Array.isArray(v) ? v.length : 0;
5565
+ };
5566
+ function describeSampleApp(targetTypes) {
5567
+ const { fields, records } = SAMPLE_APP;
5568
+ const tables = Object.values(fields.properties).filter((p) => p.type === "SUBTABLE").map((p) => p.code).sort();
5569
+ const lines = [
5570
+ `サンプルアプリ「${fields.appName}」(try / fml_try の試し計算に使う架空のアプリ。接続先 ${fields.baseUrl}。利用者のアプリではない)`,
5571
+ summarizeFields(fields),
5572
+ "",
5573
+ "項目(1 項目 1 行。○ = 計算式を設定できる型。テーブルの子は T1_ / T2_ の接頭辞):",
5574
+ listFields(fields, { targetTypes }),
5575
+ "",
5576
+ `スペース項目(要素 ID。as に要素 ID か SPACER。レコードに値は無く、式の返り値をそのまま返す): ${spacerIds(fields.layout).join(", ") || "無し"}`,
5577
+ "レコード(try の records で選ぶ。既定は 3 件とも):",
5578
+ ...records.map((r) => ` ${r.id}: ${r.label}。${tables.map((t) => `${t} ${tableRows(r.record, t)} 行`).join("、")}`),
5579
+ "ユーザー・組織・グループの値は既定のテストデータ(架空の 10 人。demo_user01 …)のコード"
5580
+ ];
5581
+ return lines.join("\n");
5582
+ }
5583
+
2562
5584
  // src/normalize/policy.ts
2563
5585
  import { existsSync as existsSync7, readFileSync as readFileSync9, statSync as statSync5 } from "node:fs";
2564
5586
  import path12 from "node:path";
@@ -2568,10 +5590,10 @@ var POLICY_FILE = path12.join("policy", "authoring-policy.json");
2568
5590
  var MAX_POLICY_BYTES = 64 * 1024;
2569
5591
  var FUNCTION_NAME = /^[A-Z][A-Z0-9_]{0,40}$/;
2570
5592
  var DEFAULT_POLICY = { allowFunctions: [], allowMiscChanges: false };
2571
- function parsePolicy(text, file) {
5593
+ function parsePolicy(text2, file) {
2572
5594
  let raw;
2573
5595
  try {
2574
- raw = JSON.parse(text.replace(/^/, ""));
5596
+ raw = JSON.parse(text2.replace(/^/, ""));
2575
5597
  } catch (e) {
2576
5598
  throw new PolicyError(`${file} を JSON として読めない: ${e instanceof Error ? e.message : String(e)}`);
2577
5599
  }
@@ -2674,9 +5696,9 @@ var isPlain = (v) => !!v && typeof v === "object" && !Array.isArray(v);
2674
5696
  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
5697
  function codesInStrings(scan, userInfoFns) {
2676
5698
  const out = [];
2677
- for (const { text, call } of scan.stringArgs) {
5699
+ for (const { text: text2, call } of scan.stringArgs) {
2678
5700
  if (!userInfoFns.includes(call)) continue;
2679
- for (const c of text.split(",")) {
5701
+ for (const c of text2.split(",")) {
2680
5702
  const t = c.trim();
2681
5703
  if (t && !t.startsWith("#") && !UINFO_OPTIONS.has(t) && /^[^\s"]{1,128}$/.test(t) && !out.includes(t)) out.push(t);
2682
5704
  }
@@ -2809,7 +5831,7 @@ async function normalizeSettings(input) {
2809
5831
  for (const r of rows) {
2810
5832
  const where = `${file} ${r.fieldcode}`;
2811
5833
  const t = typeOf(r);
2812
- if (r.formulaSet && r.formulaSet.trim() && !targetTypes.has(t)) findings.error("field.type", where, `${t} の項目には計算式を設定できない`);
5834
+ if (r.formulaSet && r.formulaSet.trim() && !targetTypes.has(t) && !isSpacerRow(r) && !isHeaderRow(r)) findings.error("field.type", where, `${t} の項目には計算式を設定できない`);
2813
5835
  if (r.edit && (isHeaderRow(r) || isSpacerRow(r) || isGroupRow(r))) findings.error("field.flag", where, `${t} に「編集」は付けられない`);
2814
5836
  if (r.hide && (isHeaderRow(r) || isSpacerRow(r))) findings.error("field.flag", where, `${t} に「非表示」は付けられない`);
2815
5837
  if (r.state && r.formulaSet && isLookupRow(r)) findings.warning("field.lookup", where, "ルックアップ項目に計算式(ルックアップの値を上書きする)");
@@ -2993,7 +6015,7 @@ function calcSettings(input) {
2993
6015
  engine.setContext({ appId: input.appId, mobile: !!input.mobile, loginUser, lookupTargets: targets.lookupTargets, relatedTargets: targets.relatedTargets, usersInfo: table, usersOrigin: table ? input.usersOrigin : { kind: "none" } });
2994
6016
  const needs = normalized.contextNeeds;
2995
6017
  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)`);
6018
+ 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
6019
  if (needs.login.length && !loginUser) throw new InputError(`ログインユーザーを使う項目(${needs.login.join(", ")})があるが、ユーザーが決まらない(--user <code>。既定の authoring が ${input.usersOrigin.kind === "file" ? input.usersOrigin.file : "テストデータ"} に居ない)`);
2998
6020
  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
6021
  for (const l of needs.related) if (!(l.arg in targets.relatedTargets)) throw new InputError(`${l.fieldcode} の RELATED_GETID(${l.arg}): ${l.arg} は関連レコード一覧でないか、参照先のアプリを参照する権限が無い`);
@@ -3038,44 +6060,764 @@ function calcSettings(input) {
3038
6060
  results.push({ id, lines, changed: lines.filter((l) => l.changed).length, errors, sinks, failed: sinks.length > 0 });
3039
6061
  }
3040
6062
  engine.clearSinkCalls();
3041
- const text = [notice, contextLine];
6063
+ const text2 = [notice, contextLine];
3042
6064
  for (const res of results) {
3043
- text.push(`レコード ${res.id}: 計算対象 ${res.lines.length} 項目、変わる ${res.changed}${res.errors.length ? `、エラー ${res.errors.length}` : ""}`);
6065
+ text2.push(`レコード ${res.id}: 計算対象 ${res.lines.length} 項目、変わる ${res.changed}${res.errors.length ? `、エラー ${res.errors.length}` : ""}`);
3044
6066
  for (const l of res.lines) {
3045
6067
  const marks = l.marks.length ? ` [${l.marks.join("、")}]` : "";
3046
6068
  if (isTable(l.before) && isTable(l.after)) {
3047
6069
  const rows = Math.max(l.before.length, l.after.length);
3048
- text.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: テーブル ${l.before.length} 行 → ${l.after.length} 行${marks}`);
6070
+ text2.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: テーブル ${l.before.length} 行 → ${l.after.length} 行${marks}`);
3049
6071
  for (let i = 0; i < rows; i++) {
3050
6072
  if (i >= l.after.length) {
3051
- text.push(` 行 ${i + 1}(削除)`);
6073
+ text2.push(` 行 ${i + 1}(削除)`);
3052
6074
  continue;
3053
6075
  }
3054
6076
  const av = l.after[i]?.value ?? {};
3055
6077
  if (i >= l.before.length) {
3056
6078
  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("、") || "(空)"}`);
6079
+ text2.push(` 行 ${i + 1}(追加): ${cells2.join("、") || "(空)"}`);
3058
6080
  continue;
3059
6081
  }
3060
6082
  const bv = l.before[i]?.value ?? {};
3061
6083
  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("、")}`);
6084
+ if (cells.length) text2.push(` 行 ${i + 1}: ${cells.join("、")}`);
3063
6085
  }
3064
6086
  continue;
3065
6087
  }
3066
- text.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: ${short(l.before)} → ${short(l.after)}${marks}`);
6088
+ text2.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: ${short(l.before)} → ${short(l.after)}${marks}`);
3067
6089
  }
3068
- for (const e of res.errors) text.push(` ! ${e.fieldcode}(${e.phases.join(", ")}): ${e.message}`);
3069
- if (res.failed) text.push(" ! このレコードの結果は採らない(実行時の sink)");
6090
+ for (const e of res.errors) text2.push(` ! ${e.fieldcode}(${e.phases.join(", ")}): ${e.message}`);
6091
+ if (res.failed) text2.push(" ! このレコードの結果は採らない(実行時の sink)");
3070
6092
  }
3071
6093
  let summary = "";
3072
6094
  if (results.length > 1) {
3073
6095
  const changedRecords = results.filter((r) => r.changed > 0).length;
3074
6096
  const changedFields = new Set(results.flatMap((r) => r.lines.filter((l) => l.changed).map((l) => l.fieldcode)));
3075
6097
  summary = `入力した ${results.length} 件中 ${changedRecords} 件の模擬差分。変わる項目: ${[...changedFields].join(", ") || "なし"}(この件数は入力したレコードとこの文脈でのもの。アプリ全体の件数ではない)`;
3076
- text.push(summary);
6098
+ text2.push(summary);
6099
+ }
6100
+ return { contextLine, notice, records: results, summary, text: text2.join("\n") };
6101
+ }
6102
+
6103
+ // src/commands/try-data.ts
6104
+ var TRY_MAX_EXTRA_FIELDS = 20;
6105
+ var TRY_MAX_DATA = 5;
6106
+ var TRY_MAX_TABLE_ROWS = 20;
6107
+ var TRY_MAX_OPTIONS = 50;
6108
+ var TRY_MAX_VALUE_CHARS = 2e3;
6109
+ var TYPE_ALIASES = {
6110
+ TEXT: "SINGLE_LINE_TEXT",
6111
+ STRING: "SINGLE_LINE_TEXT",
6112
+ TEXTAREA: "MULTI_LINE_TEXT",
6113
+ MULTILINE: "MULTI_LINE_TEXT",
6114
+ RICH: "RICH_TEXT",
6115
+ NUM: "NUMBER",
6116
+ DROPDOWN: "DROP_DOWN",
6117
+ RADIO: "RADIO_BUTTON",
6118
+ CHECKBOX: "CHECK_BOX",
6119
+ MULTISELECT: "MULTI_SELECT",
6120
+ USER: "USER_SELECT",
6121
+ ORG: "ORGANIZATION_SELECT",
6122
+ ORGANIZATION: "ORGANIZATION_SELECT",
6123
+ URL: "LINK",
6124
+ TABLE: "SUBTABLE"
6125
+ };
6126
+ var EXTRA_TYPES = [
6127
+ "SINGLE_LINE_TEXT",
6128
+ "MULTI_LINE_TEXT",
6129
+ "RICH_TEXT",
6130
+ "NUMBER",
6131
+ "DATE",
6132
+ "DATETIME",
6133
+ "TIME",
6134
+ "DROP_DOWN",
6135
+ "RADIO_BUTTON",
6136
+ "CHECK_BOX",
6137
+ "MULTI_SELECT",
6138
+ "USER_SELECT",
6139
+ "ORGANIZATION_SELECT",
6140
+ "GROUP_SELECT",
6141
+ "LINK",
6142
+ "SUBTABLE"
6143
+ ];
6144
+ var CHOICE_TYPES = /* @__PURE__ */ new Set(["DROP_DOWN", "RADIO_BUTTON", "CHECK_BOX", "MULTI_SELECT"]);
6145
+ var CODE_RE = /^[\p{L}_・$¥][\p{L}\p{N}_・$¥]{0,127}$/u;
6146
+ function canonicalType(type) {
6147
+ const upper = String(type).trim().toUpperCase();
6148
+ return TYPE_ALIASES[upper] ?? upper;
6149
+ }
6150
+ function propertyOf(code, type, label, options) {
6151
+ const base = { type, code, label, noLabel: false, required: false };
6152
+ const opts = options ? { options: Object.fromEntries(options.map((o, i) => [o, { label: o, index: String(i) }])) } : {};
6153
+ switch (type) {
6154
+ case "NUMBER":
6155
+ return { ...base, minValue: "", maxValue: "", digit: false, unique: false, defaultValue: "", displayScale: "", unit: "", unitPosition: "BEFORE" };
6156
+ case "SINGLE_LINE_TEXT":
6157
+ return { ...base, minLength: "", maxLength: "", expression: "", hideExpression: false, unique: false, defaultValue: "" };
6158
+ case "LINK":
6159
+ return { ...base, protocol: "WEB", minLength: "", maxLength: "", unique: false, defaultValue: "" };
6160
+ case "MULTI_LINE_TEXT":
6161
+ case "RICH_TEXT":
6162
+ return { ...base, defaultValue: "" };
6163
+ case "DATE":
6164
+ case "DATETIME":
6165
+ return { ...base, unique: false, defaultValue: "", defaultNowValue: false };
6166
+ case "TIME":
6167
+ return { ...base, defaultValue: "", defaultNowValue: false };
6168
+ case "DROP_DOWN":
6169
+ return { ...base, ...opts, defaultValue: "" };
6170
+ case "RADIO_BUTTON":
6171
+ return { ...base, ...opts, defaultValue: options?.[0] ?? "", align: "HORIZONTAL" };
6172
+ case "CHECK_BOX":
6173
+ case "MULTI_SELECT":
6174
+ return { ...base, ...opts, defaultValue: [], align: "HORIZONTAL" };
6175
+ case "USER_SELECT":
6176
+ case "ORGANIZATION_SELECT":
6177
+ case "GROUP_SELECT":
6178
+ return { ...base, entities: [], defaultValue: [] };
6179
+ case "SUBTABLE":
6180
+ return { type, code, label, noLabel: false, fields: {} };
6181
+ default:
6182
+ throw new InputError(`項目 ${code} の型 ${type} は足せない(${EXTRA_TYPES.join(", ")})`);
6183
+ }
6184
+ }
6185
+ function layoutTableOf(layout, code) {
6186
+ for (const row of layout) {
6187
+ if (row.type === "SUBTABLE" && row.code === code) return row;
6188
+ if (row.type === "GROUP" && Array.isArray(row.layout)) {
6189
+ const hit = layoutTableOf(row.layout, code);
6190
+ if (hit) return hit;
6191
+ }
6192
+ }
6193
+ return void 0;
6194
+ }
6195
+ var sizeOf = (type) => type === "MULTI_LINE_TEXT" || type === "RICH_TEXT" ? { width: "250", innerHeight: "125" } : { width: "200" };
6196
+ function allCodesOf(fields) {
6197
+ const codes = /* @__PURE__ */ new Set();
6198
+ for (const p of Object.values(fields.properties)) {
6199
+ codes.add(p.code);
6200
+ for (const c of Object.values(p.fields ?? {})) codes.add(c.code);
6201
+ }
6202
+ return codes;
6203
+ }
6204
+ function checkOptions(def, type, where) {
6205
+ if (!CHOICE_TYPES.has(type)) {
6206
+ if (def.options !== void 0) throw new InputError(`${where}: ${type} に options は付けない`);
6207
+ return void 0;
6208
+ }
6209
+ if (!Array.isArray(def.options) || !def.options.length) throw new InputError(`${where}: ${type} には options(選択肢の配列)が要る`);
6210
+ if (def.options.length > TRY_MAX_OPTIONS) throw new InputError(`${where}: options は ${TRY_MAX_OPTIONS} 個まで`);
6211
+ const seen = /* @__PURE__ */ new Set();
6212
+ for (const o of def.options) {
6213
+ if (typeof o !== "string" || !o.trim() || [...o].length > 100) throw new InputError(`${where}: options は空でない文字列(100 文字まで): ${JSON.stringify(o)}`);
6214
+ if (seen.has(o)) throw new InputError(`${where}: options が重複: ${o}`);
6215
+ seen.add(o);
6216
+ }
6217
+ return def.options;
6218
+ }
6219
+ function extendFields(fields, defs) {
6220
+ const out = structuredClone(fields);
6221
+ const codes = allCodesOf(out);
6222
+ const added = [];
6223
+ let count = 0;
6224
+ const describe = (type, options, children) => `${type}${options ? `: ${options.join(" / ")}` : ""}${children ? `: ${children.join(", ")}` : ""}`;
6225
+ const takeCode = (def, where) => {
6226
+ if (typeof def.code !== "string" || !CODE_RE.test(def.code)) throw new InputError(`${where}: code はフィールドコード(文字・数字・_ で、数字で始まらない。128 文字まで): ${JSON.stringify(def.code)}`);
6227
+ if (codes.has(def.code)) throw new InputError(`${where}: ${def.code} は既にある項目(標本の項目と重ならないコードにする)`);
6228
+ if (++count > TRY_MAX_EXTRA_FIELDS) throw new InputError(`足す項目は ${TRY_MAX_EXTRA_FIELDS} 個まで(テーブルの子も数える)`);
6229
+ codes.add(def.code);
6230
+ return def.code;
6231
+ };
6232
+ const labelOf = (def, where) => {
6233
+ if (def.label !== void 0 && (typeof def.label !== "string" || [...def.label].length > 128)) throw new InputError(`${where}: label は 128 文字まで`);
6234
+ return def.label ?? def.code;
6235
+ };
6236
+ defs.forEach((def, i) => {
6237
+ const where = `fields[${i}]`;
6238
+ if (!def || typeof def !== "object") throw new InputError(`${where}: 項目はオブジェクト({ code, type, options?, table?, fields? })`);
6239
+ const type = canonicalType(def.type ?? "");
6240
+ if (!EXTRA_TYPES.includes(type)) throw new InputError(`${where}: 型 ${JSON.stringify(def.type)} は足せない(${EXTRA_TYPES.join(", ")})`);
6241
+ if (def.table !== void 0 && type === "SUBTABLE") throw new InputError(`${where}: テーブルの中にテーブルは置けない(table と type SUBTABLE は一緒に書かない)`);
6242
+ if (def.fields !== void 0 && type !== "SUBTABLE") throw new InputError(`${where}: fields(子)は type SUBTABLE のときだけ`);
6243
+ const code = takeCode(def, where);
6244
+ const label = labelOf(def, where);
6245
+ const options = checkOptions(def, type, where);
6246
+ if (def.table !== void 0) {
6247
+ const parent = out.properties[def.table];
6248
+ if (!parent || parent.type !== "SUBTABLE") throw new InputError(`${where}: table ${JSON.stringify(def.table)} はテーブルでない(標本のテーブル1 / テーブル2 か、先に足したテーブル)`);
6249
+ parent.fields ??= {};
6250
+ parent.fields[code] = propertyOf(code, type, label, options);
6251
+ const slot = layoutTableOf(out.layout, def.table);
6252
+ if (!slot) throw new InputError(`${where}: テーブル ${def.table} がレイアウトに無い`);
6253
+ slot.fields ??= [];
6254
+ slot.fields.push({ type, code, size: sizeOf(type) });
6255
+ added.push(`${code}(${describe(type, options)}。${def.table} の子)`);
6256
+ return;
6257
+ }
6258
+ if (type === "SUBTABLE") {
6259
+ if (!Array.isArray(def.fields) || !def.fields.length) throw new InputError(`${where}: SUBTABLE には fields(子の配列。1 つ以上)が要る`);
6260
+ const table = propertyOf(code, type, label, void 0);
6261
+ const slot = { type: "SUBTABLE", code, fields: [] };
6262
+ const names = [];
6263
+ def.fields.forEach((child, j) => {
6264
+ const cw = `${where}.fields[${j}]`;
6265
+ if (!child || typeof child !== "object") throw new InputError(`${cw}: 子はオブジェクト({ code, type, options? })`);
6266
+ const ct = canonicalType(child.type ?? "");
6267
+ if (!EXTRA_TYPES.includes(ct) || ct === "SUBTABLE") throw new InputError(`${cw}: 型 ${JSON.stringify(child.type)} はテーブルの子にできない`);
6268
+ if (child.table !== void 0 || child.fields !== void 0) throw new InputError(`${cw}: 子に table / fields は書けない`);
6269
+ const cc = takeCode(child, cw);
6270
+ table.fields[cc] = propertyOf(cc, ct, labelOf(child, cw), checkOptions(child, ct, cw));
6271
+ slot.fields.push({ type: ct, code: cc, size: sizeOf(ct) });
6272
+ names.push(cc);
6273
+ });
6274
+ out.properties[code] = table;
6275
+ out.layout.push(slot);
6276
+ added.push(`${code}(${describe(type, void 0, names)})`);
6277
+ return;
6278
+ }
6279
+ out.properties[code] = propertyOf(code, type, label, options);
6280
+ out.layout.push({ type: "ROW", fields: [{ type, code, size: sizeOf(type) }] });
6281
+ added.push(`${code}(${describe(type, options)})`);
6282
+ });
6283
+ return { fields: out, added };
6284
+ }
6285
+ function normalizeDefaults(fields) {
6286
+ const out = structuredClone(fields);
6287
+ const fix = (p) => {
6288
+ if (p.type === "SUBTABLE") {
6289
+ for (const c of Object.values(p.fields ?? {})) fix(c);
6290
+ return;
6291
+ }
6292
+ 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;
6293
+ const arrayType = /^(CHECK_BOX|MULTI_SELECT|USER_SELECT|ORGANIZATION_SELECT|GROUP_SELECT)$/.test(p.type);
6294
+ if (arrayType) {
6295
+ if (!Array.isArray(p.defaultValue)) p.defaultValue = [];
6296
+ } else if (p.defaultValue === void 0 || p.defaultValue === null) p.defaultValue = "";
6297
+ };
6298
+ for (const p of Object.values(out.properties)) fix(p);
6299
+ return out;
6300
+ }
6301
+ function emptyValueOf(type) {
6302
+ switch (type) {
6303
+ case "CHECK_BOX":
6304
+ case "MULTI_SELECT":
6305
+ case "USER_SELECT":
6306
+ case "ORGANIZATION_SELECT":
6307
+ case "GROUP_SELECT":
6308
+ case "FILE":
6309
+ case "STATUS_ASSIGNEE":
6310
+ case "CATEGORY":
6311
+ case "SUBTABLE":
6312
+ return [];
6313
+ case "CREATOR":
6314
+ case "MODIFIER":
6315
+ return { code: "", name: "" };
6316
+ default:
6317
+ return "";
6318
+ }
6319
+ }
6320
+ var NO_VALUE_TYPES = /* @__PURE__ */ new Set(["GROUP", "REFERENCE_TABLE", "LABEL", "SPACER", "HR"]);
6321
+ function emptyRecordOf(fields, id) {
6322
+ const rec = { $id: { type: "__ID__", value: id }, $revision: { type: "__REVISION__", value: "1" } };
6323
+ for (const p of Object.values(fields.properties)) {
6324
+ if (NO_VALUE_TYPES.has(p.type)) continue;
6325
+ const value = p.type === "RECORD_NUMBER" ? id : p.type === "CREATED_TIME" || p.type === "UPDATED_TIME" ? "2026-01-15T00:00:00Z" : emptyValueOf(p.type);
6326
+ rec[p.code] = { type: p.type, value };
6327
+ }
6328
+ return rec;
6329
+ }
6330
+ function fillMissing(fields, record) {
6331
+ const out = structuredClone(record);
6332
+ for (const p of Object.values(fields.properties)) {
6333
+ if (NO_VALUE_TYPES.has(p.type)) continue;
6334
+ if (!(p.code in out)) out[p.code] = { type: p.type, value: emptyValueOf(p.type) };
6335
+ if (p.type === "SUBTABLE") {
6336
+ const rows = out[p.code].value;
6337
+ if (Array.isArray(rows)) {
6338
+ for (const row of rows) {
6339
+ row.value ??= {};
6340
+ 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) };
6341
+ }
6342
+ }
6343
+ }
6344
+ }
6345
+ return out;
6346
+ }
6347
+ var NUMBER_RE = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
6348
+ var DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
6349
+ var TIME_RE = /^\d{2}:\d{2}$/;
6350
+ var DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(Z|[+-]\d{2}:\d{2})$/;
6351
+ var isEmpty = (v) => v === "" || v === null || v === void 0;
6352
+ function text(v, where) {
6353
+ if (isEmpty(v)) return "";
6354
+ if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
6355
+ const s = String(v);
6356
+ if ([...s].length > TRY_MAX_VALUE_CHARS) throw new InputError(`${where}: 文字列は ${TRY_MAX_VALUE_CHARS} 文字まで`);
6357
+ return s;
6358
+ }
6359
+ throw new InputError(`${where}: 文字列を書く(${JSON.stringify(v).slice(0, 40)})`);
6360
+ }
6361
+ function codeList(v, where, kind, users) {
6362
+ if (isEmpty(v)) return [];
6363
+ const list = Array.isArray(v) ? v : [v];
6364
+ const table = kind === "org" ? users?.orgCodes : kind === "group" ? users?.groupCodes : users?.userCodes;
6365
+ return list.map((e, i) => {
6366
+ const code = typeof e === "string" ? e : e && typeof e === "object" && typeof e.code === "string" ? e.code : void 0;
6367
+ if (code === void 0 || !code.trim() || [...code].length > 128) throw new InputError(`${where}[${i}]: コード(文字列)か { code, name? } を書く`);
6368
+ const given = e && typeof e === "object" ? e.name : void 0;
6369
+ const name = typeof given === "string" ? given : typeof table?.[code]?.name === "string" ? String(table[code].name) : code;
6370
+ return { code, name };
6371
+ });
6372
+ }
6373
+ function stringList(v, where, options) {
6374
+ if (isEmpty(v)) return [];
6375
+ const list = Array.isArray(v) ? v : [v];
6376
+ return list.map((e, i) => {
6377
+ if (typeof e !== "string") throw new InputError(`${where}[${i}]: 文字列を書く`);
6378
+ if (options && !(e in options)) throw new InputError(`${where}[${i}]: 選択肢に無い値 ${JSON.stringify(e)}(${Object.keys(options).join(" / ")})`);
6379
+ return e;
6380
+ });
6381
+ }
6382
+ function convertValue(prop, v, where, users) {
6383
+ const options = prop.options;
6384
+ switch (prop.type) {
6385
+ case "NUMBER": {
6386
+ if (isEmpty(v)) return "";
6387
+ if (typeof v === "number") {
6388
+ if (!Number.isFinite(v)) throw new InputError(`${where}: NUMBER は有限の数`);
6389
+ return String(v);
6390
+ }
6391
+ if (typeof v === "string" && NUMBER_RE.test(v.trim())) return v.trim();
6392
+ throw new InputError(`${where}: NUMBER は数か数字の文字列(${JSON.stringify(v).slice(0, 40)})`);
6393
+ }
6394
+ case "SINGLE_LINE_TEXT":
6395
+ case "MULTI_LINE_TEXT":
6396
+ case "RICH_TEXT":
6397
+ case "LINK":
6398
+ case "CALC":
6399
+ case "STATUS":
6400
+ case "RECORD_NUMBER":
6401
+ case "__ID__":
6402
+ case "__REVISION__":
6403
+ return text(v, where);
6404
+ case "DATE": {
6405
+ const s = text(v, where);
6406
+ if (s && !DATE_RE.test(s)) throw new InputError(`${where}: DATE は "YYYY-MM-DD"(${JSON.stringify(s)})`);
6407
+ return s;
6408
+ }
6409
+ case "TIME": {
6410
+ const s = text(v, where);
6411
+ if (s && !TIME_RE.test(s)) throw new InputError(`${where}: TIME は "HH:mm"(${JSON.stringify(s)})`);
6412
+ return s;
6413
+ }
6414
+ case "DATETIME":
6415
+ case "CREATED_TIME":
6416
+ case "UPDATED_TIME": {
6417
+ const s = text(v, where);
6418
+ if (s && !DATETIME_RE.test(s)) throw new InputError(`${where}: ${prop.type} は "YYYY-MM-DDTHH:mm:ssZ"(${JSON.stringify(s)})`);
6419
+ return s;
6420
+ }
6421
+ case "DROP_DOWN":
6422
+ case "RADIO_BUTTON": {
6423
+ const s = text(v, where);
6424
+ if (s && options && !(s in options)) throw new InputError(`${where}: 選択肢に無い値 ${JSON.stringify(s)}(${Object.keys(options).join(" / ")})`);
6425
+ return s;
6426
+ }
6427
+ case "CHECK_BOX":
6428
+ case "MULTI_SELECT":
6429
+ return stringList(v, where, options);
6430
+ case "CATEGORY":
6431
+ return stringList(v, where, void 0);
6432
+ case "USER_SELECT":
6433
+ case "STATUS_ASSIGNEE":
6434
+ return codeList(v, where, "user", users);
6435
+ case "ORGANIZATION_SELECT":
6436
+ return codeList(v, where, "org", users);
6437
+ case "GROUP_SELECT":
6438
+ return codeList(v, where, "group", users);
6439
+ case "CREATOR":
6440
+ case "MODIFIER": {
6441
+ const one = codeList(v, where, "user", users);
6442
+ if (one.length !== 1) throw new InputError(`${where}: ${prop.type} はユーザーのコード 1 つ`);
6443
+ return one[0];
6444
+ }
6445
+ case "FILE": {
6446
+ if (isEmpty(v)) return [];
6447
+ const list = Array.isArray(v) ? v : [v];
6448
+ return list.map((e, i) => {
6449
+ const name = typeof e === "string" ? e : e && typeof e === "object" && typeof e.name === "string" ? e.name : void 0;
6450
+ if (name === void 0 || !name.trim() || [...name].length > 255) throw new InputError(`${where}[${i}]: ファイルは名前(文字列)か { name, size? }`);
6451
+ const size = e && typeof e === "object" && e.size !== void 0 ? String(e.size) : "0";
6452
+ return { contentType: "application/octet-stream", fileKey: "", name, size };
6453
+ });
6454
+ }
6455
+ case "SUBTABLE":
6456
+ throw new InputError(`${where}: テーブルは行の配列([{ 子のコード: 値, … }])`);
6457
+ default:
6458
+ if (NO_VALUE_TYPES.has(prop.type)) throw new InputError(`${where}: ${prop.type} は値を持たない`);
6459
+ throw new InputError(`${where}: 型 ${prop.type} の値は書けない`);
6460
+ }
6461
+ }
6462
+ function applyData(fields, base, data, where, users) {
6463
+ if (!data || typeof data !== "object" || Array.isArray(data)) throw new InputError(`${where}: レコードはオブジェクト({ 項目コード: 値, … })`);
6464
+ const rec = fillMissing(fields, base);
6465
+ const children = /* @__PURE__ */ new Map();
6466
+ for (const p of Object.values(fields.properties)) for (const c of Object.values(p.fields ?? {})) children.set(c.code, p.code);
6467
+ for (const [code, v] of Object.entries(data)) {
6468
+ const w = `${where}.${code}`;
6469
+ const prop = fields.properties[code];
6470
+ if (!prop) {
6471
+ if (children.has(code)) throw new InputError(`${w}: テーブルの子はテーブルの行の中に書く(${children.get(code)}: [{ ${code}: … }])`);
6472
+ throw new InputError(`${w}: 無い項目(標本に無ければ fields で足す。項目の一覧は describe)`);
6473
+ }
6474
+ if (NO_VALUE_TYPES.has(prop.type)) throw new InputError(`${w}: ${prop.type} は値を持たない`);
6475
+ if (prop.type === "SUBTABLE") {
6476
+ if (isEmpty(v)) {
6477
+ rec[code] = { type: "SUBTABLE", value: [] };
6478
+ continue;
6479
+ }
6480
+ if (!Array.isArray(v)) throw new InputError(`${w}: テーブルは行の配列([{ 子のコード: 値, … }])`);
6481
+ if (v.length > TRY_MAX_TABLE_ROWS) throw new InputError(`${w}: テーブルの行は ${TRY_MAX_TABLE_ROWS} 行まで`);
6482
+ const kids = prop.fields ?? {};
6483
+ const rows = v.map((row, i) => {
6484
+ const rw = `${w}[${i}]`;
6485
+ if (!row || typeof row !== "object" || Array.isArray(row)) throw new InputError(`${rw}: 行はオブジェクト({ 子のコード: 値, … })`);
6486
+ const value = {};
6487
+ for (const c of Object.values(kids)) value[c.code] = { type: c.type, value: emptyValueOf(c.type) };
6488
+ for (const [cc, cv] of Object.entries(row)) {
6489
+ const child = kids[cc];
6490
+ if (!child) throw new InputError(`${rw}.${cc}: テーブル ${code} に無い子(${Object.keys(kids).join(", ")})`);
6491
+ value[cc] = { type: child.type, value: convertValue(child, cv, `${rw}.${cc}`, users) };
6492
+ }
6493
+ return { id: String(i + 1), value };
6494
+ });
6495
+ rec[code] = { type: "SUBTABLE", value: rows };
6496
+ continue;
6497
+ }
6498
+ rec[code] = { type: prop.type, value: convertValue(prop, v, w, users) };
6499
+ }
6500
+ return rec;
6501
+ }
6502
+ function checkDataList(data) {
6503
+ if (!Array.isArray(data)) throw new InputError("data はレコード({ 項目コード: 値 })の配列");
6504
+ if (!data.length) throw new InputError("data が空");
6505
+ if (data.length > TRY_MAX_DATA) throw new InputError(`data は ${TRY_MAX_DATA} 件まで`);
6506
+ const bytes = Buffer.byteLength(JSON.stringify(data), "utf8");
6507
+ if (bytes > 64 * 1024) throw new InputError(`data が大きすぎる(${bytes.toLocaleString()} バイト。64 KiB まで)`);
6508
+ return data;
6509
+ }
6510
+
6511
+ // src/commands/try.ts
6512
+ var TRY_MAX_FORMULAS = 10;
6513
+ var TRY_MAX_FORMULA_CHARS = 4e3;
6514
+ var TRY_DEFAULT_AS = "TEXT";
6515
+ var TRY_OWN_RULES = /* @__PURE__ */ new Set(["misc.changed", "fieldno.screen", "size.bytes", "schema.derived"]);
6516
+ var isTable2 = (v) => Array.isArray(v) && v.every((r) => r && typeof r === "object" && "value" in r);
6517
+ function spacersOf(fields) {
6518
+ const out = [];
6519
+ const walk = (rows) => {
6520
+ for (const row of rows) {
6521
+ if (row.type === "GROUP" && Array.isArray(row.layout)) {
6522
+ walk(row.layout);
6523
+ continue;
6524
+ }
6525
+ for (const f of row.fields ?? []) if (f.type === "SPACER" && typeof f.elementId === "string" && f.elementId) out.push(f.elementId);
6526
+ }
6527
+ };
6528
+ walk(fields.layout);
6529
+ return out;
6530
+ }
6531
+ function resolveTryTarget(fields, targetTypes, as, table, referenced = /* @__PURE__ */ new Set()) {
6532
+ const props = fields.properties;
6533
+ const tables = Object.values(props).filter((p) => p.type === "SUBTABLE").map((p) => p.code).sort();
6534
+ const want = (as ?? TRY_DEFAULT_AS).trim();
6535
+ if (!want) throw new InputError("as が空(型 NUMBER / TEXT / DATE … か項目コード)");
6536
+ const upper = want.toUpperCase();
6537
+ const spacers = spacersOf(fields);
6538
+ const spacer = upper === "SPACER" || upper === "SPACE" ? spacers[0] : spacers.find((id) => id === want || `(${id})` === want);
6539
+ if (upper === "SPACER" || upper === "SPACE" || spacer !== void 0) {
6540
+ if (table !== void 0) throw new InputError("スペース項目はテーブルの中に置けない(table を外す)");
6541
+ if (spacer === void 0) throw new InputError("サンプルアプリに要素 ID のあるスペース項目が無い");
6542
+ return { code: `(${spacer})`, type: "SPACER", elementId: spacer };
6543
+ }
6544
+ const type = TYPE_ALIASES[upper] ?? (targetTypes.has(upper) ? upper : void 0);
6545
+ let scope = props;
6546
+ let tableCode;
6547
+ if (table !== void 0) {
6548
+ const t = props[table];
6549
+ if (!t || t.type !== "SUBTABLE") throw new InputError(`table ${JSON.stringify(table)} はサンプルアプリのテーブルでない(${tables.join(" / ")})`);
6550
+ scope = t.fields ?? {};
6551
+ tableCode = table;
6552
+ }
6553
+ const byCode = (code, p, inTable) => {
6554
+ if (!targetTypes.has(p.type)) throw new InputError(`${code} の型 ${p.type} には計算式を設定できない(使える型: ${[...targetTypes].join(", ")})`);
6555
+ return { code, type: p.type, ...inTable ? { table: inTable } : {} };
6556
+ };
6557
+ if (Object.prototype.hasOwnProperty.call(scope, want)) return byCode(want, scope[want], tableCode);
6558
+ if (tableCode === void 0) {
6559
+ for (const t of tables) {
6560
+ const child = props[t].fields?.[want];
6561
+ if (child) return byCode(want, child, t);
6562
+ }
6563
+ }
6564
+ if (!type) {
6565
+ const all2 = /* @__PURE__ */ new Set();
6566
+ for (const p of Object.values(props)) {
6567
+ all2.add(p.type);
6568
+ for (const c of Object.values(p.fields ?? {})) all2.add(c.type);
6569
+ }
6570
+ if (all2.has(upper)) throw new InputError(`${upper} の項目には計算式を設定できない(使える型: ${[...targetTypes].join(", ")})`);
6571
+ throw new InputError(`as ${JSON.stringify(want)} は型でも項目コードでもない(型: ${[...targetTypes].join(", ")}。項目は try --describe / fml_try の describe で)`);
6572
+ }
6573
+ 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));
6574
+ if (!candidates.length) throw new InputError(`${tableCode ? `テーブル ${tableCode} の中` : "サンプルアプリ"}に ${type} の項目が無い`);
6575
+ const free = candidates.find((p) => !referenced.has(p.code)) ?? candidates[0];
6576
+ return { code: free.code, type, ...tableCode ? { table: tableCode } : {} };
6577
+ }
6578
+ function buildTryEnvelope(engine, fields, code, formula, lang) {
6579
+ const api = engine.api;
6580
+ const source = api.defaultSource(lang);
6581
+ return {
6582
+ date: "2026-01-15 00:00:00",
6583
+ pluginName: "計算式プラグイン",
6584
+ pluginID: api.pluginId,
6585
+ PluginVersion: engine.source.pluginVersion,
6586
+ appId: fields.appId,
6587
+ appName: fields.appName,
6588
+ ...source,
6589
+ toolEnable: true,
6590
+ pluginMiscInfo: { ...source.pluginMiscInfo, circular_refer: true },
6591
+ pluginInfos: [{ fieldcode: code, state: true, formulaSet: formula, edit: false, hide: false, rank: "" }]
6592
+ };
6593
+ }
6594
+ function normalizedMarks(n, code) {
6595
+ const scan = n.scans.get(code);
6596
+ if (!scan) return [];
6597
+ const used = Object.keys(scan.functions);
6598
+ const marks = [];
6599
+ if (used.some((f) => /^(UINFO|OINFO|GINFO|OUSERS|GUSERS)$/.test(f))) marks.push("ユーザー情報は既定のテストデータ(架空)で計算(実機では変わる)");
6600
+ if (used.includes("EV_INFO")) marks.push("イベントに依る");
6601
+ if (used.some((f) => /^(RAND|RANDBETWEEN|NOW|TODAY|UUID)$/.test(f))) marks.push("再計算で変わる");
6602
+ return marks;
6603
+ }
6604
+ function plain(v) {
6605
+ try {
6606
+ const s = JSON.stringify(v);
6607
+ return s === void 0 ? v === void 0 ? null : String(v) : JSON.parse(s);
6608
+ } catch {
6609
+ return String(v);
6610
+ }
6611
+ }
6612
+ function rawValueOf(engine, pp, record, formula, target, evType, event) {
6613
+ const api = engine.api;
6614
+ const run = (kf2) => {
6615
+ try {
6616
+ return plain(quiet(() => kf2.dq(formula)));
6617
+ } catch {
6618
+ return null;
6619
+ }
6620
+ };
6621
+ const kf = api.createRunner(pp, record, evType ?? "allUpdate", event);
6622
+ if (!target.table) {
6623
+ kf.initTableInfo("");
6624
+ return run(kf);
6625
+ }
6626
+ const rows = record[target.table];
6627
+ const list = Array.isArray(rows?.value) ? rows.value : [];
6628
+ kf.initTableInfo(target.table);
6629
+ return list.map((_r, i) => {
6630
+ kf.currRow(i);
6631
+ return run(kf);
6632
+ });
6633
+ }
6634
+ var short2 = (v) => {
6635
+ const s = JSON.stringify(v);
6636
+ return s === void 0 ? "undefined" : [...s].length > 200 ? [...s].slice(0, 200).join("") + "…" : s;
6637
+ };
6638
+ async function trySettings(input) {
6639
+ const { engine } = input;
6640
+ const api = engine.api;
6641
+ const lang = input.lang ?? "ja";
6642
+ if (!Array.isArray(input.formulas) || !input.formulas.length) throw new InputError("式が無い(formulas)");
6643
+ if (input.formulas.length > TRY_MAX_FORMULAS) throw new InputError(`式は 1 回 ${TRY_MAX_FORMULAS} 個まで(${input.formulas.length})`);
6644
+ const app = sampleApp();
6645
+ const source = input.appFields ? "app" : "sample";
6646
+ let fields = input.appFields ? normalizeDefaults(input.appFields) : app.fields;
6647
+ let extraFields = [];
6648
+ if (input.fields !== void 0) {
6649
+ if (!Array.isArray(input.fields)) throw new InputError("fields は項目({ code, type, options?, table?, fields? })の配列");
6650
+ const ext = extendFields(fields, input.fields);
6651
+ fields = ext.fields;
6652
+ extraFields = ext.added;
6653
+ }
6654
+ const picked = [];
6655
+ if (input.appFields) {
6656
+ if (input.records !== void 0) throw new InputError("appFields(利用者のアプリの項目定義)のときは標本のレコード(records)は使えない(data で架空の値を書く)");
6657
+ if (input.data === void 0) throw new InputError("appFields(利用者のアプリの項目定義)には data(架空の値のレコード)が要る");
6658
+ } else {
6659
+ const ids2 = input.records === void 0 ? input.data === void 0 ? app.records.map((r) => r.id) : [] : [...new Set(input.records)];
6660
+ if (!ids2.length && input.data === void 0) throw new InputError("records が空(1〜3)");
6661
+ for (const id of ids2) if (!app.records.some((r) => r.id === id)) throw new InputError(`records は 1〜${app.records.length}(${id})`);
6662
+ for (const id of ids2) {
6663
+ const r = app.records.find((x) => x.id === id);
6664
+ picked.push({ id: String(id), label: r.label, record: extraFields.length ? fillMissing(fields, r.record) : r.record });
6665
+ }
6666
+ }
6667
+ if (input.data !== void 0) {
6668
+ const list = checkDataList(input.data);
6669
+ let base;
6670
+ if (input.appFields) base = emptyRecordOf(fields, "0");
6671
+ else {
6672
+ const b = input.base ?? 3;
6673
+ const br = app.records.find((x) => x.id === b);
6674
+ if (!br) throw new InputError(`base は標本のレコードの番号(1〜${app.records.length}): ${b}`);
6675
+ base = br.record;
6676
+ }
6677
+ list.forEach((d, i) => {
6678
+ const id = `d${i + 1}`;
6679
+ const rec = applyData(fields, base, d, `data[${i}]`, input.usersInfo);
6680
+ rec.$id = { type: "__ID__", value: String(100 + i + 1) };
6681
+ if (fields.properties["レコード番号"]?.type === "RECORD_NUMBER" && input.appFields) rec["レコード番号"] = { type: "RECORD_NUMBER", value: String(100 + i + 1) };
6682
+ picked.push({ id, label: `架空の値(${Object.keys(d).join(", ") || "空"})`, record: rec });
6683
+ });
6684
+ }
6685
+ if (!picked.length) throw new InputError("計算するレコードが無い(records か data)");
6686
+ const targetTypes = new Set(api.TARGET_TYPES);
6687
+ const policy = { ...input.policy ?? DEFAULT_POLICY, allowMiscChanges: true };
6688
+ let contextLine = "";
6689
+ let calcNotice = "";
6690
+ const results = [];
6691
+ for (let i = 0; i < input.formulas.length; i++) {
6692
+ const f = input.formulas[i];
6693
+ const where = `try[${i + 1}]`;
6694
+ const res = { index: i + 1, formula: typeof f?.formula === "string" ? f.formula : "", status: "ok", findings: [], values: [], marks: [] };
6695
+ results.push(res);
6696
+ const fail = (rule, message) => {
6697
+ res.status = "invalid";
6698
+ res.findings.push({ level: "error", rule, where, message });
6699
+ };
6700
+ if (!f || typeof f.formula !== "string" || !f.formula.trim()) {
6701
+ fail("try.formula", "式が空");
6702
+ continue;
6703
+ }
6704
+ if ([...f.formula].length > TRY_MAX_FORMULA_CHARS) {
6705
+ fail("try.formula", `式が長すぎる(${TRY_MAX_FORMULA_CHARS} 文字まで)`);
6706
+ continue;
6707
+ }
6708
+ let target;
6709
+ const referenced = scanFormula(api.stripFormula(f.formula)).identifiers;
6710
+ try {
6711
+ target = resolveTryTarget(fields, targetTypes, f.as, f.table, referenced);
6712
+ } catch (e) {
6713
+ if (e instanceof InputError) {
6714
+ fail("try.target", e.message);
6715
+ continue;
6716
+ }
6717
+ throw e;
6718
+ }
6719
+ res.target = target;
6720
+ 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 で式が使わない項目を選ぶ)` });
6721
+ const envelope = buildTryEnvelope(engine, fields, target.code, f.formula, lang);
6722
+ const n = await normalizeSettings({
6723
+ settingsText: JSON.stringify(envelope),
6724
+ settingsFile: where,
6725
+ fields,
6726
+ engine,
6727
+ policy,
6728
+ lang,
6729
+ usersInfo: input.usersInfo,
6730
+ usersLabel: input.usersLabel,
6731
+ usersOrigin: input.usersOrigin.kind === "none" ? void 0 : input.usersOrigin
6732
+ });
6733
+ res.findings.push(...n.findings.items.filter((x) => !TRY_OWN_RULES.has(x.rule)));
6734
+ if (n.findings.hasErrors || !n.saved) {
6735
+ res.status = "invalid";
6736
+ continue;
6737
+ }
6738
+ const stripped = String(n.saved.pluginFields[0]?.formula ?? "");
6739
+ const records = picked.map((r) => ({ id: r.id, record: structuredClone(r.record), fileAppId: fields.appId }));
6740
+ let c;
6741
+ try {
6742
+ c = calcSettings({
6743
+ normalized: n,
6744
+ engine,
6745
+ fields,
6746
+ appId: fields.appId,
6747
+ records,
6748
+ evType: input.evType,
6749
+ event: input.event,
6750
+ mobile: input.mobile,
6751
+ user: input.user,
6752
+ usersInfo: input.usersInfo,
6753
+ usersOrigin: input.usersOrigin,
6754
+ allowDefaultBaseUrl: true
6755
+ });
6756
+ } catch (e) {
6757
+ if (e instanceof InputError) {
6758
+ fail("calc.context", e.message);
6759
+ continue;
6760
+ }
6761
+ throw e;
6762
+ }
6763
+ contextLine ||= c.contextLine;
6764
+ calcNotice ||= c.notice;
6765
+ if (target.type === "SPACER") {
6766
+ for (const r of c.records) {
6767
+ const src = picked.find((p) => p.id === r.id);
6768
+ engine.clearSinkCalls();
6769
+ const raw = src ? rawValueOf(engine, n.saved.pluginPP, structuredClone(src.record), stripped, target, input.evType, input.event) : null;
6770
+ const v = { record: r.id, value: raw };
6771
+ if (engine.sinkCalls().length) {
6772
+ v.failed = true;
6773
+ v.error = `実行時の sink が呼ばれた: ${engine.sinkCalls().map((s) => `${s.sink} ${s.detail}`.trim()).join(", ")}`;
6774
+ res.status = "failed";
6775
+ }
6776
+ engine.clearSinkCalls();
6777
+ res.values.push(v);
6778
+ }
6779
+ res.marks = [...normalizedMarks(n, target.code), "スペース項目(返り値をそのまま。表示は実機で)"];
6780
+ continue;
6781
+ }
6782
+ const lineCode = target.table ?? target.code;
6783
+ for (const r of c.records) {
6784
+ const line = r.lines.find((l) => l.fieldcode === lineCode);
6785
+ let value = line?.after;
6786
+ if (target.table && isTable2(value)) value = value.map((row) => row.value?.[target.code]?.value);
6787
+ 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}`);
6788
+ const v = { record: r.id, value, ...errs.length ? { error: errs.join(" / ") } : {}, ...r.failed ? { failed: true } : {} };
6789
+ if (!r.failed && !errs.length) {
6790
+ const src = picked.find((p) => p.id === r.id);
6791
+ engine.clearSinkCalls();
6792
+ const raw = src ? rawValueOf(engine, n.saved.pluginPP, structuredClone(src.record), stripped, target, input.evType, input.event) : void 0;
6793
+ if (engine.sinkCalls().length) {
6794
+ v.failed = true;
6795
+ v.error = `実行時の sink が呼ばれた(生の値の評価): ${engine.sinkCalls().map((s) => `${s.sink} ${s.detail}`.trim()).join(", ")}`;
6796
+ } else if (raw !== void 0 && JSON.stringify(raw) !== JSON.stringify(value)) v.raw = raw;
6797
+ engine.clearSinkCalls();
6798
+ }
6799
+ res.values.push(v);
6800
+ if (line) res.marks = line.marks;
6801
+ if (v.failed) res.status = "failed";
6802
+ }
3077
6803
  }
3078
- return { contextLine, notice, records: results, summary, text: text.join("\n") };
6804
+ const okCount = results.filter((r) => r.status === "ok").length;
6805
+ const ids = picked.map((r) => r.id);
6806
+ const appLabel = source === "sample" ? `サンプルアプリ「${fields.appName}」` : `アプリ ${fields.appId}「${fields.appName}」の項目定義(値は架空)`;
6807
+ const summary = `試し計算 ${results.length} 式: ok ${okCount}${results.length - okCount ? `、エラー ${results.length - okCount}` : ""}(${appLabel}、レコード ${ids.join(", ")})`;
6808
+ if (!contextLine) contextLine = `文脈: アプリ ${fields.appId}(計算していない式だけ)`;
6809
+ const notice = `${source === "sample" ? "サンプルアプリ(架空)での模擬。利用者のアプリ・レコードは使っていない" : "利用者のアプリの項目定義に架空の値を当てた模擬。レコードは更新していない"}${calcNotice ? `。${calcNotice}` : ""}`;
6810
+ const text2 = [summary, notice, contextLine];
6811
+ if (extraFields.length) text2.push(`足した項目(架空): ${extraFields.join("、")}`);
6812
+ for (const r of picked) if (r.id.startsWith("d")) text2.push(`レコード ${r.id}: ${r.label}`);
6813
+ for (const r of results) {
6814
+ const head = r.target ? `${r.target.type === "SPACER" ? `スペース項目 ${r.target.elementId}` : r.target.code}(${r.target.type}${r.target.table ? `。${r.target.table} の中` : ""})← ` : "";
6815
+ text2.push(`[${r.index}] ${head}${r.formula.replace(/\s*\n\s*/g, " ")}`);
6816
+ 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)" : ""}`);
6817
+ if (r.marks.length) text2.push(` 印: ${r.marks.join("、")}`);
6818
+ for (const f of r.findings) if (f.level !== "info") text2.push(` ${f.level === "error" ? "エラー" : "警告"} ${f.rule}: ${f.message}`);
6819
+ }
6820
+ 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
6821
  }
3080
6822
 
3081
6823
  // src/worker/eval-run.ts
@@ -3100,6 +6842,31 @@ async function runEvalJob(job) {
3100
6842
  if (job.baseUrl) engine.setContext({ baseUrl: job.baseUrl });
3101
6843
  const usersInfo = buildUsersInfo(job.usersSource);
3102
6844
  const usersLabel = job.usersOrigin.kind === "file" ? job.usersOrigin.file : "既定のテストデータ(架空)";
6845
+ if (job.kind === "try") {
6846
+ if (!job.try) throw new InputError("try の仕事に式が無い(try.formulas)");
6847
+ const t = job.try;
6848
+ const r = await trySettings({
6849
+ engine,
6850
+ formulas: t.formulas,
6851
+ records: t.records,
6852
+ fields: t.fields,
6853
+ data: t.data,
6854
+ base: t.base,
6855
+ appFields: t.appFields,
6856
+ evType: t.evType,
6857
+ event: t.event,
6858
+ mobile: t.mobile,
6859
+ user: t.user,
6860
+ usersInfo,
6861
+ usersOrigin: job.usersOrigin,
6862
+ usersLabel,
6863
+ policy: job.policy,
6864
+ lang: job.lang
6865
+ });
6866
+ const warnings = r.results.reduce((n, x) => n + x.findings.filter((f) => f.level === "warning").length, 0);
6867
+ return { normalize: { summary: r.summary, hasErrors: r.results.some((x) => x.status !== "ok"), warnings, findings: [] }, try: r, engineWarnings: [...engine.warnings] };
6868
+ }
6869
+ if (job.settingsText === void 0 || job.settingsFile === void 0 || !job.fields) throw new InputError(`${job.kind} の仕事に設定か項目定義が無い(settingsText / settingsFile / fields)`);
3103
6870
  const res = await normalizeSettings({
3104
6871
  settingsText: job.settingsText,
3105
6872
  settingsFile: job.settingsFile,
@@ -3241,6 +7008,16 @@ var USAGE = `使い方: npx @rex0220/formula-authoring-tools <command> [options]
3241
7008
  calc <settings.json> --app N (--id R | --records R1,R2,…) [--fields fields/N.json] [--users <f>] [--user <code>]
3242
7009
  [--event <種別>] [--action A --status S --next-status T] [--mobile] [--timeout 秒]
3243
7010
  取得済みのレコード(records/)に設定を当てた模擬(更新しない)。評価は Worker で動かし、既定 60 秒で止める
7011
+ try "<式>" [--as <型 | 項目コード>] [--table <テーブル>] [--records 1,2,3] [--users <f>] [--user <code>]
7012
+ [--event <種別>] [--action A --status S --next-status T] [--mobile] [--timeout 秒]
7013
+ [--fields '<JSON>'] [--data '<JSON>'] [--base 3] [--app N]
7014
+ 同梱のサンプルアプリ(全項目タイプ × 2、テーブル 2 つ、レコード 3 件 = 典型 / 端 / 空)に 1 行だけの設定を組んで
7015
+ 検査と模擬の計算(関数の使い方や式の断片を確かめる。利用者のアプリは使わない)。--as は型(NUMBER / TEXT / DATE …。
7016
+ 既定 TEXT = 文字列 1 行)か項目コード、テーブルの中で計算するなら --table テーブル1。スペース項目は --as sp1(返り値をそのまま)。
7017
+ --fields '[{"code":"単価","type":"NUMBER"},{"code":"分類","type":"DROP_DOWN","options":["明細","小計"]}]' で項目を足す、
7018
+ --data '[{"単価":100,"テーブル1":[{"T1_数値":1}]}]' で架空の値のレコード(土台は --base の標本。既定 3 = 空)、
7019
+ --app N で利用者のアプリの項目定義(fields/N.json かアプリのフォルダー)に --data の架空の値を当てる
7020
+ try --describe サンプルアプリの項目(1 項目 1 行。○ = 計算式を設定できる型)とレコード 3 件の形
3244
7021
  help
3245
7022
 
3246
7023
  kintone の接続のファイル(FORMULA_KINTONE_CONFIG があるとき。kSQL の ksql.config.json と同じ形。複数のドメイン・アプリ):
@@ -3366,13 +7143,13 @@ function trustedBaseUrl(folder, flags) {
3366
7143
  throw e;
3367
7144
  }
3368
7145
  }
3369
- function writeText(file, text, roots, op, opt = {}) {
7146
+ function writeText(file, text2, roots, op, opt = {}) {
3370
7147
  const abs = resolveWrite(file, roots, W.root);
3371
7148
  allow(abs, op);
3372
7149
  mkdirSync2(path14.dirname(abs), { recursive: true });
3373
7150
  if (opt.exclusive) {
3374
7151
  try {
3375
- const { cleanup } = writeNewFile(abs, text, () => {
7152
+ const { cleanup } = writeNewFile(abs, text2, () => {
3376
7153
  if (resolveWrite(file, roots, W.root) !== abs) throw new InputError(`書く先のフォルダーが途中で変わった(symlink など): ${shown(abs)}`);
3377
7154
  allow(abs, op);
3378
7155
  });
@@ -3383,7 +7160,7 @@ function writeText(file, text, roots, op, opt = {}) {
3383
7160
  }
3384
7161
  } else {
3385
7162
  if (existsSync9(abs) && !opt.force) throw new InputError(`${shown(abs)} は既にある(上書きするなら --force)`);
3386
- writeFileSync3(abs, text, opt.mode !== void 0 ? { mode: opt.mode } : void 0);
7163
+ writeFileSync3(abs, text2, opt.mode !== void 0 ? { mode: opt.mode } : void 0);
3387
7164
  }
3388
7165
  if (opt.mode !== void 0) chmodSync(abs, opt.mode);
3389
7166
  return abs;
@@ -3667,6 +7444,78 @@ async function cmdCalc(positional, flags) {
3667
7444
  console.log(outcome.calc.text);
3668
7445
  return outcome.calc.failed ? 1 : 0;
3669
7446
  }
7447
+ async function cmdTry(positional, flags) {
7448
+ if (has(flags, "describe")) {
7449
+ let targetTypes;
7450
+ try {
7451
+ targetTypes = new Set((await engineOf()).api.TARGET_TYPES);
7452
+ } catch {
7453
+ targetTypes = void 0;
7454
+ }
7455
+ console.log(describeSampleApp(targetTypes));
7456
+ return 0;
7457
+ }
7458
+ const formula = positional[1];
7459
+ if (!formula) throw new UsageError('try "<式>" [--as <型 | 項目コード>] [--table <テーブル>](または try --describe)');
7460
+ let records;
7461
+ const recordsFlag = str(flags, "records");
7462
+ if (recordsFlag) {
7463
+ records = recordsFlag.split(",").map((x) => x.trim()).filter(Boolean).map((x) => {
7464
+ if (!/^[1-9]$/.test(x)) throw new UsageError(`--records はサンプルレコードの番号(1〜3。カンマ区切り): ${x}`);
7465
+ return Number(x);
7466
+ });
7467
+ }
7468
+ const { src, origin } = usersSourceOf(str(flags, "users"));
7469
+ const jsonFlag = (k) => {
7470
+ const v = str(flags, k);
7471
+ if (v === void 0) return void 0;
7472
+ if (Buffer.byteLength(v, "utf8") > 64 * 1024) throw new UsageError(`--${k} は 64 KiB まで`);
7473
+ try {
7474
+ return JSON.parse(v);
7475
+ } catch (e) {
7476
+ throw new UsageError(`--${k} が JSON として読めない: ${e instanceof Error ? e.message : String(e)}`);
7477
+ }
7478
+ };
7479
+ const fieldsDef = jsonFlag("fields");
7480
+ const data = jsonFlag("data");
7481
+ const base = intFlag(flags, "base", false);
7482
+ let appFields;
7483
+ let baseUrl;
7484
+ const app = intFlag(flags, "app", false);
7485
+ if (app !== void 0) {
7486
+ const ctx = context(flags);
7487
+ const rel = ctx.def ? path14.join(existingAppDir(ctx, app), "fields.json") : path14.join("fields", `${app}.json`);
7488
+ appFields = readFieldsFile(existingFile(rel, `fields --app ${app}${profileFlag(ctx)}`));
7489
+ baseUrl = trustedBaseUrl(ctx.def ? { profile: ctx.def.profile } : null, flags);
7490
+ } else if (has(flags, "profile")) throw new UsageError("--profile は --app(利用者のアプリの項目定義)と一緒に使う");
7491
+ const job = {
7492
+ kind: "try",
7493
+ pluginZip: pluginZipPath(authOpt()),
7494
+ devPluginDir: W.env.FORMULA_ALLOW_DEV_PLUGIN === "1" ? formulaProdDir(W.env) : void 0,
7495
+ baseUrl,
7496
+ usersSource: src,
7497
+ usersOrigin: origin,
7498
+ policy: loadPolicy(W.root),
7499
+ lang: str(flags, "lang"),
7500
+ try: {
7501
+ formulas: [{ formula, as: str(flags, "as"), table: str(flags, "table") }],
7502
+ records,
7503
+ fields: fieldsDef,
7504
+ data,
7505
+ base,
7506
+ appFields,
7507
+ evType: str(flags, "event"),
7508
+ 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,
7509
+ mobile: has(flags, "mobile"),
7510
+ user: str(flags, "user")
7511
+ }
7512
+ };
7513
+ const outcome = await runEval(job, { timeoutSec: timeoutOf(flags), inline: inline() });
7514
+ for (const w of outcome.engineWarnings) console.log(`注意: ${w}`);
7515
+ if (!outcome.try) throw new Error("try の結果が無い(tools の誤り)");
7516
+ console.log(outcome.try.text);
7517
+ return outcome.try.results.every((r) => r.status === "ok") ? 0 : 1;
7518
+ }
3670
7519
  async function cmdUsers(flags) {
3671
7520
  if (has(flags, "summary")) {
3672
7521
  const { src, origin } = usersSourceOf(str(flags, "users"));
@@ -3795,6 +7644,8 @@ async function main(argv) {
3795
7644
  return await cmdNormalize(positional, flags);
3796
7645
  case "calc":
3797
7646
  return await cmdCalc(positional, flags);
7647
+ case "try":
7648
+ return await cmdTry(positional, flags);
3798
7649
  case "take":
3799
7650
  return await cmdTake(flags);
3800
7651
  case "edit":