@rex0220/formula-authoring-tools 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @rex0220/formula-authoring-tools/core 0.2.1 (c) rex0220. MIT License. 計算式エンジンと計算式プラグインのコードは利用者の計算式プラグインプラグインの zip から読む(このファイルには含まれない)。commit f2e46ef. */
1
+ /*! @rex0220/formula-authoring-tools/core 0.3.0 (c) rex0220. MIT License. 計算式エンジンと計算式プラグインのコードは利用者の計算式プラグインプラグインの zip から読む(このファイルには含まれない)。commit cfbd850. */
2
2
 
3
3
  // src/safe-path.ts
4
4
  import { lstatSync, realpathSync } from "node:fs";
@@ -190,7 +190,7 @@ function devMeta() {
190
190
  return { toolsVersion: pkg.version, pluginId: FORMULA_PLUGIN_ID, minPluginVersion: MIN_PLUGIN_VERSION, supportedApiVersions: [...SUPPORTED_API_VERSIONS], commit: gitCommit(AUTHORING_ROOT), builtAt: "", mode: "dev" };
191
191
  }
192
192
  function toolsMeta() {
193
- 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"}');
193
+ if (true) return JSON.parse('{"toolsVersion":"0.3.0","pluginId":"dhgihghfgfmibkdldkeibboabfnmdpke","minPluginVersion":101,"supportedApiVersions":[1],"commit":"cfbd850","builtAt":"2026-10-18T05:24:49.527Z","mode":"build"}');
194
194
  return devMeta();
195
195
  }
196
196
 
@@ -766,12 +766,12 @@ var KINTONE_HOST_SUFFIXES = [".cybozu.com", ".kintone.com", ".cybozu.cn"];
766
766
  var KintoneUrlError = class extends Error {
767
767
  };
768
768
  function normalizeKintoneBaseUrl(raw) {
769
- const text = String(raw ?? "").trim();
769
+ const text2 = String(raw ?? "").trim();
770
770
  let u2;
771
771
  try {
772
- u2 = new URL(text);
772
+ u2 = new URL(text2);
773
773
  } catch {
774
- throw new KintoneUrlError(`kintone の URL として読めない: ${text.slice(0, 80)}`);
774
+ throw new KintoneUrlError(`kintone の URL として読めない: ${text2.slice(0, 80)}`);
775
775
  }
776
776
  if (u2.protocol !== "https:") throw new KintoneUrlError("kintone の URL は https で始める");
777
777
  if (u2.username || u2.password) throw new KintoneUrlError("kintone の URL にユーザー名やパスワード(@)を入れない");
@@ -810,9 +810,9 @@ function unquote(raw) {
810
810
  if (value.length >= 2 && (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'"))) return value.slice(1, -1);
811
811
  return value;
812
812
  }
813
- function parseDotEnv(text) {
813
+ function parseDotEnv(text2) {
814
814
  const out = {};
815
- for (const raw of text.split(/\r?\n/)) {
815
+ for (const raw of text2.split(/\r?\n/)) {
816
816
  const line = raw.trim();
817
817
  if (!line || line.startsWith("#")) continue;
818
818
  const m = line.match(/^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);
@@ -938,11 +938,11 @@ function jsonDiff(a, b, pathStr, out) {
938
938
  a.forEach((x, i) => jsonDiff(x, b[i], `${pathStr}[${i}]`, out));
939
939
  return;
940
940
  }
941
- const short2 = (v) => {
941
+ const short3 = (v) => {
942
942
  const s = JSON.stringify(v);
943
943
  return s === void 0 ? "undefined" : s.length > 100 ? s.slice(0, 100) + "…" : s;
944
944
  };
945
- out.push(`${pathStr}: ${short2(a)} → ${short2(b)}`);
945
+ out.push(`${pathStr}: ${short3(a)} → ${short3(b)}`);
946
946
  }
947
947
  function readTextLimited(file, maxBytes = MAX_INPUT_BYTES) {
948
948
  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
  }
@@ -1133,7 +1133,7 @@ function createRestClient(auth, fetchImpl = fetch) {
1133
1133
  // src/scan.ts
1134
1134
  var IDENT = /[A-Za-z0-9_$\u0080-￿]/;
1135
1135
  var KEYWORDS = /* @__PURE__ */ new Set(["true", "false", "TRUE", "FALSE", "null"]);
1136
- function scanFormula(text) {
1136
+ function scanFormula(text2) {
1137
1137
  const functions = {};
1138
1138
  const identifiers = /* @__PURE__ */ new Set();
1139
1139
  const strings = [];
@@ -1142,24 +1142,24 @@ function scanFormula(text) {
1142
1142
  const calls = [];
1143
1143
  let depth = 0;
1144
1144
  let i = 0;
1145
- const n = text.length;
1145
+ const n = text2.length;
1146
1146
  while (i < n) {
1147
- const ch = text[i];
1147
+ const ch = text2[i];
1148
1148
  if (ch === '"') {
1149
1149
  let j = i + 1;
1150
1150
  let s = "";
1151
1151
  let closed = false;
1152
1152
  while (j < n) {
1153
- if (text[j] === "\\" && text[j + 1] === '"') {
1153
+ if (text2[j] === "\\" && text2[j + 1] === '"') {
1154
1154
  s += '\\"';
1155
1155
  j += 2;
1156
1156
  continue;
1157
1157
  }
1158
- if (text[j] === '"') {
1158
+ if (text2[j] === '"') {
1159
1159
  closed = true;
1160
1160
  break;
1161
1161
  }
1162
- s += text[j];
1162
+ s += text2[j];
1163
1163
  j++;
1164
1164
  }
1165
1165
  if (!closed) problems.push(`閉じていない文字列(${i} 文字目から)`);
@@ -1186,11 +1186,11 @@ function scanFormula(text) {
1186
1186
  }
1187
1187
  if (IDENT.test(ch)) {
1188
1188
  let j = i;
1189
- while (j < n && IDENT.test(text[j])) j++;
1190
- const word = text.slice(i, j);
1189
+ while (j < n && IDENT.test(text2[j])) j++;
1190
+ const word = text2.slice(i, j);
1191
1191
  let k = j;
1192
- while (k < n && (text[k] === " " || text[k] === " ")) k++;
1193
- if (text[k] === "(") {
1192
+ while (k < n && (text2[k] === " " || text2[k] === " ")) k++;
1193
+ if (text2[k] === "(") {
1194
1194
  functions[word] = (functions[word] ?? 0) + 1;
1195
1195
  depth++;
1196
1196
  calls.push(word);
@@ -1207,11 +1207,11 @@ function scanFormula(text) {
1207
1207
  if (depth > 0) problems.push(`閉じていない ( が ${depth} 個`);
1208
1208
  return { functions, identifiers, strings, stringArgs, problems };
1209
1209
  }
1210
- function staticArgsOf(text, fn) {
1210
+ function staticArgsOf(text2, fn) {
1211
1211
  const out = [];
1212
1212
  const re = new RegExp(`(?<![A-Za-z0-9_$\\u0080-\\uFFFF])${fn}\\s*\\(\\s*([A-Za-z0-9_$\\u0080-\\uFFFF]+)\\s*[,)]`, "g");
1213
1213
  let m;
1214
- while (m = re.exec(text)) out.push(m[1]);
1214
+ while (m = re.exec(text2)) out.push(m[1]);
1215
1215
  return out;
1216
1216
  }
1217
1217
  function scanFormulas(formulas) {
@@ -1717,9 +1717,9 @@ async function pullUsers(client, opt = {}) {
1717
1717
  }
1718
1718
  var USER_INFO_FUNCTIONS = { UINFO: "users", OINFO: "orgs", OUSERS: "orgs", GINFO: "groups", GUSERS: "groups" };
1719
1719
  var CALL_RE = /(?<![A-Za-z0-9_$\u0080-\uFFFF])(UINFO|OINFO|GINFO|OUSERS|GUSERS)\s*\(\s*("(?:\\"|[^"])*"|[^,()]*)/g;
1720
- function scanUserInfoCalls(text) {
1720
+ function scanUserInfoCalls(text2) {
1721
1721
  const out = { users: [], orgs: [], groups: [], dynamic: [] };
1722
- for (const m of text.matchAll(CALL_RE)) {
1722
+ for (const m of text2.matchAll(CALL_RE)) {
1723
1723
  const fn = m[1];
1724
1724
  const arg = m[2].trim();
1725
1725
  const kind = USER_INFO_FUNCTIONS[fn];
@@ -1906,10 +1906,10 @@ var POLICY_FILE = path7.join("policy", "authoring-policy.json");
1906
1906
  var MAX_POLICY_BYTES = 64 * 1024;
1907
1907
  var FUNCTION_NAME = /^[A-Z][A-Z0-9_]{0,40}$/;
1908
1908
  var DEFAULT_POLICY = { allowFunctions: [], allowMiscChanges: false };
1909
- function parsePolicy(text, file) {
1909
+ function parsePolicy(text2, file) {
1910
1910
  let raw;
1911
1911
  try {
1912
- raw = JSON.parse(text.replace(/^/, ""));
1912
+ raw = JSON.parse(text2.replace(/^/, ""));
1913
1913
  } catch (e) {
1914
1914
  throw new PolicyError(`${file} を JSON として読めない: ${e instanceof Error ? e.message : String(e)}`);
1915
1915
  }
@@ -1943,9 +1943,9 @@ var isPlain = (v) => !!v && typeof v === "object" && !Array.isArray(v);
1943
1943
  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"]);
1944
1944
  function codesInStrings(scan, userInfoFns) {
1945
1945
  const out = [];
1946
- for (const { text, call } of scan.stringArgs) {
1946
+ for (const { text: text2, call } of scan.stringArgs) {
1947
1947
  if (!userInfoFns.includes(call)) continue;
1948
- for (const c of text.split(",")) {
1948
+ for (const c of text2.split(",")) {
1949
1949
  const t = c.trim();
1950
1950
  if (t && !t.startsWith("#") && !UINFO_OPTIONS.has(t) && /^[^\s"]{1,128}$/.test(t) && !out.includes(t)) out.push(t);
1951
1951
  }
@@ -2282,7 +2282,7 @@ function calcSettings(input) {
2282
2282
  engine.setContext({ appId: input.appId, mobile: !!input.mobile, loginUser, lookupTargets: targets.lookupTargets, relatedTargets: targets.relatedTargets, usersInfo: table, usersOrigin: table ? input.usersOrigin : { kind: "none" } });
2283
2283
  const needs = normalized.contextNeeds;
2284
2284
  const ctx = engine.context();
2285
- if (needs.appUrl.length && ctx.baseUrl === DEFAULT_CONTEXT_BASE_URL) throw new InputError(`APP_URL を使う項目(${needs.appUrl.join(", ")})があるが、接続先の URL が無い(.env の KINTONE_BASE_URL)`);
2285
+ 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)`);
2286
2286
  if (needs.login.length && !loginUser) throw new InputError(`ログインユーザーを使う項目(${needs.login.join(", ")})があるが、ユーザーが決まらない(--user <code>。既定の authoring が ${input.usersOrigin.kind === "file" ? input.usersOrigin.file : "テストデータ"} に居ない)`);
2287
2287
  for (const l of needs.lookups) if (!(l.arg in targets.lookupTargets)) throw new InputError(`${l.fieldcode} の LOOKUP_GETID(${l.arg}): ${l.arg} はルックアップ項目でないか、参照先のアプリを参照する権限が無い(fields を取り直す)`);
2288
2288
  for (const l of needs.related) if (!(l.arg in targets.relatedTargets)) throw new InputError(`${l.fieldcode} の RELATED_GETID(${l.arg}): ${l.arg} は関連レコード一覧でないか、参照先のアプリを参照する権限が無い`);
@@ -2327,44 +2327,44 @@ function calcSettings(input) {
2327
2327
  results.push({ id, lines, changed: lines.filter((l) => l.changed).length, errors, sinks, failed: sinks.length > 0 });
2328
2328
  }
2329
2329
  engine.clearSinkCalls();
2330
- const text = [notice, contextLine];
2330
+ const text2 = [notice, contextLine];
2331
2331
  for (const res of results) {
2332
- text.push(`レコード ${res.id}: 計算対象 ${res.lines.length} 項目、変わる ${res.changed}${res.errors.length ? `、エラー ${res.errors.length}` : ""}`);
2332
+ text2.push(`レコード ${res.id}: 計算対象 ${res.lines.length} 項目、変わる ${res.changed}${res.errors.length ? `、エラー ${res.errors.length}` : ""}`);
2333
2333
  for (const l of res.lines) {
2334
2334
  const marks = l.marks.length ? ` [${l.marks.join("、")}]` : "";
2335
2335
  if (isTable(l.before) && isTable(l.after)) {
2336
2336
  const rows = Math.max(l.before.length, l.after.length);
2337
- text.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: テーブル ${l.before.length} 行 → ${l.after.length} 行${marks}`);
2337
+ text2.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: テーブル ${l.before.length} 行 → ${l.after.length} 行${marks}`);
2338
2338
  for (let i = 0; i < rows; i++) {
2339
2339
  if (i >= l.after.length) {
2340
- text.push(` 行 ${i + 1}(削除)`);
2340
+ text2.push(` 行 ${i + 1}(削除)`);
2341
2341
  continue;
2342
2342
  }
2343
2343
  const av = l.after[i]?.value ?? {};
2344
2344
  if (i >= l.before.length) {
2345
2345
  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)}`);
2346
- text.push(` 行 ${i + 1}(追加): ${cells2.join("、") || "(空)"}`);
2346
+ text2.push(` 行 ${i + 1}(追加): ${cells2.join("、") || "(空)"}`);
2347
2347
  continue;
2348
2348
  }
2349
2349
  const bv = l.before[i]?.value ?? {};
2350
2350
  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)}`);
2351
- if (cells.length) text.push(` 行 ${i + 1}: ${cells.join("、")}`);
2351
+ if (cells.length) text2.push(` 行 ${i + 1}: ${cells.join("、")}`);
2352
2352
  }
2353
2353
  continue;
2354
2354
  }
2355
- text.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: ${short(l.before)} → ${short(l.after)}${marks}`);
2355
+ text2.push(` ${l.changed ? "★" : " "} ${l.fieldcode}: ${short(l.before)} → ${short(l.after)}${marks}`);
2356
2356
  }
2357
- for (const e of res.errors) text.push(` ! ${e.fieldcode}(${e.phases.join(", ")}): ${e.message}`);
2358
- if (res.failed) text.push(" ! このレコードの結果は採らない(実行時の sink)");
2357
+ for (const e of res.errors) text2.push(` ! ${e.fieldcode}(${e.phases.join(", ")}): ${e.message}`);
2358
+ if (res.failed) text2.push(" ! このレコードの結果は採らない(実行時の sink)");
2359
2359
  }
2360
2360
  let summary = "";
2361
2361
  if (results.length > 1) {
2362
2362
  const changedRecords = results.filter((r) => r.changed > 0).length;
2363
2363
  const changedFields = new Set(results.flatMap((r) => r.lines.filter((l) => l.changed).map((l) => l.fieldcode)));
2364
2364
  summary = `入力した ${results.length} 件中 ${changedRecords} 件の模擬差分。変わる項目: ${[...changedFields].join(", ") || "なし"}(この件数は入力したレコードとこの文脈でのもの。アプリ全体の件数ではない)`;
2365
- text.push(summary);
2365
+ text2.push(summary);
2366
2366
  }
2367
- return { contextLine, notice, records: results, summary, text: text.join("\n") };
2367
+ return { contextLine, notice, records: results, summary, text: text2.join("\n") };
2368
2368
  }
2369
2369
 
2370
2370
  // src/commands/take.ts
@@ -2984,14 +2984,14 @@ function placeNew(tmp, target, link = linkSync) {
2984
2984
  throw e;
2985
2985
  }
2986
2986
  }
2987
- function writeNewFile(target, text, recheck = () => {
2987
+ function writeNewFile(target, text2, recheck = () => {
2988
2988
  }) {
2989
2989
  const tmp = tempPathFor(target);
2990
2990
  let placed = false;
2991
2991
  let failure;
2992
2992
  try {
2993
2993
  recheck();
2994
- writeFileSync2(tmp, text, { encoding: "utf8", flag: "wx" });
2994
+ writeFileSync2(tmp, text2, { encoding: "utf8", flag: "wx" });
2995
2995
  recheck();
2996
2996
  placeNew(tmp, target);
2997
2997
  placed = true;
@@ -3105,15 +3105,15 @@ function readInbox(src) {
3105
3105
  } finally {
3106
3106
  if (fd !== void 0) closeSync2(fd);
3107
3107
  }
3108
- const text = bytes.toString("utf8");
3108
+ const text2 = bytes.toString("utf8");
3109
3109
  let data;
3110
3110
  try {
3111
- data = JSON.parse(text);
3111
+ data = JSON.parse(text2);
3112
3112
  } catch (e) {
3113
3113
  return { reason: `JSON として読めない${jsonErrorWhere(e)}(中身は返さない)` };
3114
3114
  }
3115
3115
  if (!data || typeof data !== "object" || Array.isArray(data)) return { reason: "JSON の最上位がオブジェクトでない" };
3116
- return { text, data };
3116
+ return { text: text2, data };
3117
3117
  }
3118
3118
  function takeInbox(cwdIn, mode, profile) {
3119
3119
  const connections = requireProfiles(mode, "take");
@@ -3215,6 +3215,3680 @@ function takeInbox(cwdIn, mode, profile) {
3215
3215
  return result;
3216
3216
  }
3217
3217
 
3218
+ // src/sample-app/fields.json
3219
+ var fields_default = {
3220
+ tool: "formula-authoring fields",
3221
+ fetchedAt: "2026-01-15T00:00:00.000Z",
3222
+ baseUrl: "https://example.cybozu.com",
3223
+ appId: 4329,
3224
+ appName: "計算式サンプル",
3225
+ preview: false,
3226
+ lang: "ja",
3227
+ revision: "1",
3228
+ properties: {
3229
+ チェック2: {
3230
+ type: "CHECK_BOX",
3231
+ code: "チェック2",
3232
+ label: "チェック2",
3233
+ noLabel: false,
3234
+ required: false,
3235
+ options: {
3236
+ 甲: {
3237
+ label: "甲",
3238
+ index: "0"
3239
+ },
3240
+ 乙: {
3241
+ label: "乙",
3242
+ index: "1"
3243
+ },
3244
+ 丙: {
3245
+ label: "丙",
3246
+ index: "2"
3247
+ }
3248
+ },
3249
+ defaultValue: [],
3250
+ align: "HORIZONTAL"
3251
+ },
3252
+ レコード番号: {
3253
+ type: "RECORD_NUMBER",
3254
+ code: "レコード番号",
3255
+ label: "レコード番号",
3256
+ noLabel: false
3257
+ },
3258
+ ドロップダウン2: {
3259
+ type: "DROP_DOWN",
3260
+ code: "ドロップダウン2",
3261
+ label: "ドロップダウン2",
3262
+ noLabel: false,
3263
+ required: false,
3264
+ options: {
3265
+ 甲: {
3266
+ label: "甲",
3267
+ index: "0"
3268
+ },
3269
+ 乙: {
3270
+ label: "乙",
3271
+ index: "1"
3272
+ },
3273
+ 丙: {
3274
+ label: "丙",
3275
+ index: "2"
3276
+ }
3277
+ },
3278
+ defaultValue: ""
3279
+ },
3280
+ ユーザー2: {
3281
+ type: "USER_SELECT",
3282
+ code: "ユーザー2",
3283
+ label: "ユーザー2",
3284
+ noLabel: false,
3285
+ required: false,
3286
+ entities: [],
3287
+ defaultValue: []
3288
+ },
3289
+ 組織1: {
3290
+ type: "ORGANIZATION_SELECT",
3291
+ code: "組織1",
3292
+ label: "組織1",
3293
+ noLabel: false,
3294
+ required: false,
3295
+ entities: [],
3296
+ defaultValue: []
3297
+ },
3298
+ ドロップダウン1: {
3299
+ type: "DROP_DOWN",
3300
+ code: "ドロップダウン1",
3301
+ label: "ドロップダウン1",
3302
+ noLabel: false,
3303
+ required: false,
3304
+ options: {
3305
+ A: {
3306
+ label: "A",
3307
+ index: "0"
3308
+ },
3309
+ B: {
3310
+ label: "B",
3311
+ index: "1"
3312
+ },
3313
+ C: {
3314
+ label: "C",
3315
+ index: "2"
3316
+ }
3317
+ },
3318
+ defaultValue: ""
3319
+ },
3320
+ 更新者: {
3321
+ type: "MODIFIER",
3322
+ code: "更新者",
3323
+ label: "更新者",
3324
+ noLabel: false
3325
+ },
3326
+ ユーザー1: {
3327
+ type: "USER_SELECT",
3328
+ code: "ユーザー1",
3329
+ label: "ユーザー1",
3330
+ noLabel: false,
3331
+ required: false,
3332
+ entities: [],
3333
+ defaultValue: []
3334
+ },
3335
+ 組織2: {
3336
+ type: "ORGANIZATION_SELECT",
3337
+ code: "組織2",
3338
+ label: "組織2",
3339
+ noLabel: false,
3340
+ required: false,
3341
+ entities: [],
3342
+ defaultValue: []
3343
+ },
3344
+ テーブル2: {
3345
+ type: "SUBTABLE",
3346
+ code: "テーブル2",
3347
+ noLabel: false,
3348
+ label: "テーブル2",
3349
+ fields: {
3350
+ T2_複数選択: {
3351
+ type: "MULTI_SELECT",
3352
+ code: "T2_複数選択",
3353
+ label: "T2_複数選択",
3354
+ noLabel: false,
3355
+ required: false,
3356
+ options: {
3357
+ A: {
3358
+ label: "A",
3359
+ index: "0"
3360
+ },
3361
+ B: {
3362
+ label: "B",
3363
+ index: "1"
3364
+ },
3365
+ C: {
3366
+ label: "C",
3367
+ index: "2"
3368
+ }
3369
+ },
3370
+ defaultValue: []
3371
+ },
3372
+ T2_文字列複数行: {
3373
+ type: "MULTI_LINE_TEXT",
3374
+ code: "T2_文字列複数行",
3375
+ label: "T2_文字列複数行",
3376
+ noLabel: false,
3377
+ required: false,
3378
+ defaultValue: ""
3379
+ },
3380
+ T2_リンク: {
3381
+ type: "LINK",
3382
+ code: "T2_リンク",
3383
+ label: "T2_リンク",
3384
+ noLabel: false,
3385
+ required: false,
3386
+ protocol: "WEB",
3387
+ minLength: "",
3388
+ maxLength: "",
3389
+ unique: false,
3390
+ defaultValue: ""
3391
+ },
3392
+ T2_リッチ: {
3393
+ type: "RICH_TEXT",
3394
+ code: "T2_リッチ",
3395
+ label: "T2_リッチ",
3396
+ noLabel: false,
3397
+ required: false,
3398
+ defaultValue: ""
3399
+ },
3400
+ T2_文字列: {
3401
+ type: "SINGLE_LINE_TEXT",
3402
+ code: "T2_文字列",
3403
+ label: "T2_文字列",
3404
+ noLabel: false,
3405
+ required: false,
3406
+ minLength: "",
3407
+ maxLength: "",
3408
+ expression: "",
3409
+ hideExpression: false,
3410
+ unique: false,
3411
+ defaultValue: ""
3412
+ },
3413
+ T2_チェック: {
3414
+ type: "CHECK_BOX",
3415
+ code: "T2_チェック",
3416
+ label: "T2_チェック",
3417
+ noLabel: false,
3418
+ required: false,
3419
+ options: {
3420
+ A: {
3421
+ label: "A",
3422
+ index: "0"
3423
+ },
3424
+ B: {
3425
+ label: "B",
3426
+ index: "1"
3427
+ },
3428
+ C: {
3429
+ label: "C",
3430
+ index: "2"
3431
+ }
3432
+ },
3433
+ defaultValue: [],
3434
+ align: "HORIZONTAL"
3435
+ },
3436
+ T2_ユーザー: {
3437
+ type: "USER_SELECT",
3438
+ code: "T2_ユーザー",
3439
+ label: "T2_ユーザー",
3440
+ noLabel: false,
3441
+ required: false,
3442
+ entities: [],
3443
+ defaultValue: []
3444
+ },
3445
+ T2_グループ: {
3446
+ type: "GROUP_SELECT",
3447
+ code: "T2_グループ",
3448
+ label: "T2_グループ",
3449
+ noLabel: false,
3450
+ required: false,
3451
+ entities: [],
3452
+ defaultValue: []
3453
+ },
3454
+ T2_日付: {
3455
+ type: "DATE",
3456
+ code: "T2_日付",
3457
+ label: "T2_日付",
3458
+ noLabel: false,
3459
+ required: false,
3460
+ unique: false,
3461
+ defaultValue: "",
3462
+ defaultNowValue: false
3463
+ },
3464
+ T2_数値: {
3465
+ type: "NUMBER",
3466
+ code: "T2_数値",
3467
+ label: "T2_数値",
3468
+ noLabel: false,
3469
+ required: false,
3470
+ minValue: "",
3471
+ maxValue: "",
3472
+ digit: false,
3473
+ unique: false,
3474
+ defaultValue: "",
3475
+ displayScale: "",
3476
+ unit: "",
3477
+ unitPosition: "BEFORE"
3478
+ },
3479
+ T2_ドロップダウン: {
3480
+ type: "DROP_DOWN",
3481
+ code: "T2_ドロップダウン",
3482
+ label: "T2_ドロップダウン",
3483
+ noLabel: false,
3484
+ required: false,
3485
+ options: {
3486
+ A: {
3487
+ label: "A",
3488
+ index: "0"
3489
+ },
3490
+ B: {
3491
+ label: "B",
3492
+ index: "1"
3493
+ },
3494
+ C: {
3495
+ label: "C",
3496
+ index: "2"
3497
+ }
3498
+ },
3499
+ defaultValue: ""
3500
+ },
3501
+ T2_組織: {
3502
+ type: "ORGANIZATION_SELECT",
3503
+ code: "T2_組織",
3504
+ label: "T2_組織",
3505
+ noLabel: false,
3506
+ required: false,
3507
+ entities: [],
3508
+ defaultValue: []
3509
+ },
3510
+ T2_計算: {
3511
+ type: "CALC",
3512
+ code: "T2_計算",
3513
+ label: "T2_計算",
3514
+ noLabel: false,
3515
+ required: false,
3516
+ expression: "T2_数値 * 2",
3517
+ format: "NUMBER",
3518
+ displayScale: "",
3519
+ hideExpression: false,
3520
+ unit: "",
3521
+ unitPosition: "BEFORE"
3522
+ },
3523
+ T2_ラジオ: {
3524
+ type: "RADIO_BUTTON",
3525
+ code: "T2_ラジオ",
3526
+ label: "T2_ラジオ",
3527
+ noLabel: false,
3528
+ required: true,
3529
+ options: {
3530
+ A: {
3531
+ label: "A",
3532
+ index: "0"
3533
+ },
3534
+ B: {
3535
+ label: "B",
3536
+ index: "1"
3537
+ },
3538
+ C: {
3539
+ label: "C",
3540
+ index: "2"
3541
+ }
3542
+ },
3543
+ defaultValue: "A",
3544
+ align: "HORIZONTAL"
3545
+ },
3546
+ T2_日時: {
3547
+ type: "DATETIME",
3548
+ code: "T2_日時",
3549
+ label: "T2_日時",
3550
+ noLabel: false,
3551
+ required: false,
3552
+ unique: false,
3553
+ defaultValue: "",
3554
+ defaultNowValue: false
3555
+ },
3556
+ T2_添付: {
3557
+ type: "FILE",
3558
+ code: "T2_添付",
3559
+ label: "T2_添付",
3560
+ noLabel: false,
3561
+ required: false,
3562
+ thumbnailSize: "50"
3563
+ },
3564
+ T2_時刻: {
3565
+ type: "TIME",
3566
+ code: "T2_時刻",
3567
+ label: "T2_時刻",
3568
+ noLabel: false,
3569
+ required: false,
3570
+ defaultValue: "",
3571
+ defaultNowValue: false
3572
+ }
3573
+ }
3574
+ },
3575
+ ステータス: {
3576
+ type: "STATUS",
3577
+ code: "ステータス",
3578
+ label: "ステータス",
3579
+ enabled: true
3580
+ },
3581
+ グループ1: {
3582
+ type: "GROUP_SELECT",
3583
+ code: "グループ1",
3584
+ label: "グループ1",
3585
+ noLabel: false,
3586
+ required: false,
3587
+ entities: [],
3588
+ defaultValue: []
3589
+ },
3590
+ テーブル1: {
3591
+ type: "SUBTABLE",
3592
+ code: "テーブル1",
3593
+ noLabel: false,
3594
+ label: "テーブル1",
3595
+ fields: {
3596
+ T1_ユーザー: {
3597
+ type: "USER_SELECT",
3598
+ code: "T1_ユーザー",
3599
+ label: "T1_ユーザー",
3600
+ noLabel: false,
3601
+ required: false,
3602
+ entities: [],
3603
+ defaultValue: []
3604
+ },
3605
+ T1_文字列複数行: {
3606
+ type: "MULTI_LINE_TEXT",
3607
+ code: "T1_文字列複数行",
3608
+ label: "T1_文字列複数行",
3609
+ noLabel: false,
3610
+ required: false,
3611
+ defaultValue: ""
3612
+ },
3613
+ T1_ラジオ: {
3614
+ type: "RADIO_BUTTON",
3615
+ code: "T1_ラジオ",
3616
+ label: "T1_ラジオ",
3617
+ noLabel: false,
3618
+ required: true,
3619
+ options: {
3620
+ A: {
3621
+ label: "A",
3622
+ index: "0"
3623
+ },
3624
+ B: {
3625
+ label: "B",
3626
+ index: "1"
3627
+ },
3628
+ C: {
3629
+ label: "C",
3630
+ index: "2"
3631
+ }
3632
+ },
3633
+ defaultValue: "A",
3634
+ align: "HORIZONTAL"
3635
+ },
3636
+ T1_複数選択: {
3637
+ type: "MULTI_SELECT",
3638
+ code: "T1_複数選択",
3639
+ label: "T1_複数選択",
3640
+ noLabel: false,
3641
+ required: false,
3642
+ options: {
3643
+ A: {
3644
+ label: "A",
3645
+ index: "0"
3646
+ },
3647
+ B: {
3648
+ label: "B",
3649
+ index: "1"
3650
+ },
3651
+ C: {
3652
+ label: "C",
3653
+ index: "2"
3654
+ }
3655
+ },
3656
+ defaultValue: []
3657
+ },
3658
+ T1_日付: {
3659
+ type: "DATE",
3660
+ code: "T1_日付",
3661
+ label: "T1_日付",
3662
+ noLabel: false,
3663
+ required: false,
3664
+ unique: false,
3665
+ defaultValue: "",
3666
+ defaultNowValue: false
3667
+ },
3668
+ T1_ドロップダウン: {
3669
+ type: "DROP_DOWN",
3670
+ code: "T1_ドロップダウン",
3671
+ label: "T1_ドロップダウン",
3672
+ noLabel: false,
3673
+ required: false,
3674
+ options: {
3675
+ A: {
3676
+ label: "A",
3677
+ index: "0"
3678
+ },
3679
+ B: {
3680
+ label: "B",
3681
+ index: "1"
3682
+ },
3683
+ C: {
3684
+ label: "C",
3685
+ index: "2"
3686
+ }
3687
+ },
3688
+ defaultValue: ""
3689
+ },
3690
+ T1_リッチ: {
3691
+ type: "RICH_TEXT",
3692
+ code: "T1_リッチ",
3693
+ label: "T1_リッチ",
3694
+ noLabel: false,
3695
+ required: false,
3696
+ defaultValue: ""
3697
+ },
3698
+ T1_数値: {
3699
+ type: "NUMBER",
3700
+ code: "T1_数値",
3701
+ label: "T1_数値",
3702
+ noLabel: false,
3703
+ required: false,
3704
+ minValue: "",
3705
+ maxValue: "",
3706
+ digit: false,
3707
+ unique: false,
3708
+ defaultValue: "",
3709
+ displayScale: "",
3710
+ unit: "",
3711
+ unitPosition: "BEFORE"
3712
+ },
3713
+ T1_組織: {
3714
+ type: "ORGANIZATION_SELECT",
3715
+ code: "T1_組織",
3716
+ label: "T1_組織",
3717
+ noLabel: false,
3718
+ required: false,
3719
+ entities: [],
3720
+ defaultValue: []
3721
+ },
3722
+ T1_リンク: {
3723
+ type: "LINK",
3724
+ code: "T1_リンク",
3725
+ label: "T1_リンク",
3726
+ noLabel: false,
3727
+ required: false,
3728
+ protocol: "WEB",
3729
+ minLength: "",
3730
+ maxLength: "",
3731
+ unique: false,
3732
+ defaultValue: ""
3733
+ },
3734
+ T1_文字列: {
3735
+ type: "SINGLE_LINE_TEXT",
3736
+ code: "T1_文字列",
3737
+ label: "T1_文字列",
3738
+ noLabel: false,
3739
+ required: false,
3740
+ minLength: "",
3741
+ maxLength: "",
3742
+ expression: "",
3743
+ hideExpression: false,
3744
+ unique: false,
3745
+ defaultValue: ""
3746
+ },
3747
+ T1_計算: {
3748
+ type: "CALC",
3749
+ code: "T1_計算",
3750
+ label: "T1_計算",
3751
+ noLabel: false,
3752
+ required: false,
3753
+ expression: "T1_数値 * 2",
3754
+ format: "NUMBER",
3755
+ displayScale: "",
3756
+ hideExpression: false,
3757
+ unit: "",
3758
+ unitPosition: "BEFORE"
3759
+ },
3760
+ T1_添付: {
3761
+ type: "FILE",
3762
+ code: "T1_添付",
3763
+ label: "T1_添付",
3764
+ noLabel: false,
3765
+ required: false,
3766
+ thumbnailSize: "50"
3767
+ },
3768
+ T1_日時: {
3769
+ type: "DATETIME",
3770
+ code: "T1_日時",
3771
+ label: "T1_日時",
3772
+ noLabel: false,
3773
+ required: false,
3774
+ unique: false,
3775
+ defaultValue: "",
3776
+ defaultNowValue: false
3777
+ },
3778
+ T1_グループ: {
3779
+ type: "GROUP_SELECT",
3780
+ code: "T1_グループ",
3781
+ label: "T1_グループ",
3782
+ noLabel: false,
3783
+ required: false,
3784
+ entities: [],
3785
+ defaultValue: []
3786
+ },
3787
+ T1_チェック: {
3788
+ type: "CHECK_BOX",
3789
+ code: "T1_チェック",
3790
+ label: "T1_チェック",
3791
+ noLabel: false,
3792
+ required: false,
3793
+ options: {
3794
+ A: {
3795
+ label: "A",
3796
+ index: "0"
3797
+ },
3798
+ B: {
3799
+ label: "B",
3800
+ index: "1"
3801
+ },
3802
+ C: {
3803
+ label: "C",
3804
+ index: "2"
3805
+ }
3806
+ },
3807
+ defaultValue: [],
3808
+ align: "HORIZONTAL"
3809
+ },
3810
+ T1_時刻: {
3811
+ type: "TIME",
3812
+ code: "T1_時刻",
3813
+ label: "T1_時刻",
3814
+ noLabel: false,
3815
+ required: false,
3816
+ defaultValue: "",
3817
+ defaultNowValue: false
3818
+ }
3819
+ }
3820
+ },
3821
+ ラジオ1: {
3822
+ type: "RADIO_BUTTON",
3823
+ code: "ラジオ1",
3824
+ label: "ラジオ1",
3825
+ noLabel: false,
3826
+ required: true,
3827
+ options: {
3828
+ A: {
3829
+ label: "A",
3830
+ index: "0"
3831
+ },
3832
+ B: {
3833
+ label: "B",
3834
+ index: "1"
3835
+ },
3836
+ C: {
3837
+ label: "C",
3838
+ index: "2"
3839
+ }
3840
+ },
3841
+ defaultValue: "A",
3842
+ align: "HORIZONTAL"
3843
+ },
3844
+ グループ2: {
3845
+ type: "GROUP_SELECT",
3846
+ code: "グループ2",
3847
+ label: "グループ2",
3848
+ noLabel: false,
3849
+ required: false,
3850
+ entities: [],
3851
+ defaultValue: []
3852
+ },
3853
+ ラジオ2: {
3854
+ type: "RADIO_BUTTON",
3855
+ code: "ラジオ2",
3856
+ label: "ラジオ2",
3857
+ noLabel: false,
3858
+ required: true,
3859
+ options: {
3860
+ 甲: {
3861
+ label: "甲",
3862
+ index: "0"
3863
+ },
3864
+ 乙: {
3865
+ label: "乙",
3866
+ index: "1"
3867
+ },
3868
+ 丙: {
3869
+ label: "丙",
3870
+ index: "2"
3871
+ }
3872
+ },
3873
+ defaultValue: "甲",
3874
+ align: "HORIZONTAL"
3875
+ },
3876
+ リッチ1: {
3877
+ type: "RICH_TEXT",
3878
+ code: "リッチ1",
3879
+ label: "リッチ1",
3880
+ noLabel: false,
3881
+ required: false,
3882
+ defaultValue: ""
3883
+ },
3884
+ 時刻2: {
3885
+ type: "TIME",
3886
+ code: "時刻2",
3887
+ label: "時刻2",
3888
+ noLabel: false,
3889
+ required: false,
3890
+ defaultValue: "",
3891
+ defaultNowValue: false
3892
+ },
3893
+ カテゴリー: {
3894
+ type: "CATEGORY",
3895
+ code: "カテゴリー",
3896
+ label: "カテゴリー",
3897
+ enabled: true
3898
+ },
3899
+ 時刻1: {
3900
+ type: "TIME",
3901
+ code: "時刻1",
3902
+ label: "時刻1",
3903
+ noLabel: false,
3904
+ required: false,
3905
+ defaultValue: "",
3906
+ defaultNowValue: false
3907
+ },
3908
+ リンク1: {
3909
+ type: "LINK",
3910
+ code: "リンク1",
3911
+ label: "リンク1(Web)",
3912
+ noLabel: false,
3913
+ required: false,
3914
+ protocol: "WEB",
3915
+ minLength: "",
3916
+ maxLength: "",
3917
+ unique: false,
3918
+ defaultValue: ""
3919
+ },
3920
+ リッチ2: {
3921
+ type: "RICH_TEXT",
3922
+ code: "リッチ2",
3923
+ label: "リッチ2",
3924
+ noLabel: false,
3925
+ required: false,
3926
+ defaultValue: ""
3927
+ },
3928
+ リンク2: {
3929
+ type: "LINK",
3930
+ code: "リンク2",
3931
+ label: "リンク2(メール)",
3932
+ noLabel: false,
3933
+ required: false,
3934
+ protocol: "MAIL",
3935
+ minLength: "",
3936
+ maxLength: "",
3937
+ unique: false,
3938
+ defaultValue: ""
3939
+ },
3940
+ 計算2: {
3941
+ type: "CALC",
3942
+ code: "計算2",
3943
+ label: "計算2(日付の差の日数)",
3944
+ noLabel: false,
3945
+ required: false,
3946
+ expression: "(日付1 - 日付2) / 86400",
3947
+ format: "NUMBER",
3948
+ displayScale: "",
3949
+ hideExpression: false,
3950
+ unit: "",
3951
+ unitPosition: "BEFORE"
3952
+ },
3953
+ 計算1: {
3954
+ type: "CALC",
3955
+ code: "計算1",
3956
+ label: "計算1",
3957
+ noLabel: false,
3958
+ required: false,
3959
+ expression: "数値1 + 数値2",
3960
+ format: "NUMBER",
3961
+ displayScale: "",
3962
+ hideExpression: false,
3963
+ unit: "",
3964
+ unitPosition: "BEFORE"
3965
+ },
3966
+ 複数選択2: {
3967
+ type: "MULTI_SELECT",
3968
+ code: "複数選択2",
3969
+ label: "複数選択2",
3970
+ noLabel: false,
3971
+ required: false,
3972
+ options: {
3973
+ 甲: {
3974
+ label: "甲",
3975
+ index: "0"
3976
+ },
3977
+ 乙: {
3978
+ label: "乙",
3979
+ index: "1"
3980
+ },
3981
+ 丙: {
3982
+ label: "丙",
3983
+ index: "2"
3984
+ }
3985
+ },
3986
+ defaultValue: []
3987
+ },
3988
+ 日時1: {
3989
+ type: "DATETIME",
3990
+ code: "日時1",
3991
+ label: "日時1",
3992
+ noLabel: false,
3993
+ required: false,
3994
+ unique: false,
3995
+ defaultValue: "",
3996
+ defaultNowValue: false
3997
+ },
3998
+ 複数選択1: {
3999
+ type: "MULTI_SELECT",
4000
+ code: "複数選択1",
4001
+ label: "複数選択1",
4002
+ noLabel: false,
4003
+ required: false,
4004
+ options: {
4005
+ A: {
4006
+ label: "A",
4007
+ index: "0"
4008
+ },
4009
+ B: {
4010
+ label: "B",
4011
+ index: "1"
4012
+ },
4013
+ C: {
4014
+ label: "C",
4015
+ index: "2"
4016
+ }
4017
+ },
4018
+ defaultValue: []
4019
+ },
4020
+ 日時2: {
4021
+ type: "DATETIME",
4022
+ code: "日時2",
4023
+ label: "日時2",
4024
+ noLabel: false,
4025
+ required: false,
4026
+ unique: false,
4027
+ defaultValue: "",
4028
+ defaultNowValue: false
4029
+ },
4030
+ 枠内数値1: {
4031
+ type: "NUMBER",
4032
+ code: "枠内数値1",
4033
+ label: "枠内数値1",
4034
+ noLabel: false,
4035
+ required: false,
4036
+ minValue: "",
4037
+ maxValue: "",
4038
+ digit: false,
4039
+ unique: false,
4040
+ defaultValue: "",
4041
+ displayScale: "",
4042
+ unit: "",
4043
+ unitPosition: "BEFORE"
4044
+ },
4045
+ 作業者: {
4046
+ type: "STATUS_ASSIGNEE",
4047
+ code: "作業者",
4048
+ label: "作業者",
4049
+ enabled: true
4050
+ },
4051
+ 作成者: {
4052
+ type: "CREATOR",
4053
+ code: "作成者",
4054
+ label: "作成者",
4055
+ noLabel: false
4056
+ },
4057
+ 文字列2: {
4058
+ type: "SINGLE_LINE_TEXT",
4059
+ code: "文字列2",
4060
+ label: "文字列2",
4061
+ noLabel: false,
4062
+ required: false,
4063
+ minLength: "",
4064
+ maxLength: "",
4065
+ expression: "",
4066
+ hideExpression: false,
4067
+ unique: false,
4068
+ defaultValue: ""
4069
+ },
4070
+ 文字列1: {
4071
+ type: "SINGLE_LINE_TEXT",
4072
+ code: "文字列1",
4073
+ label: "文字列1",
4074
+ noLabel: false,
4075
+ required: false,
4076
+ minLength: "",
4077
+ maxLength: "",
4078
+ expression: "",
4079
+ hideExpression: false,
4080
+ unique: false,
4081
+ defaultValue: ""
4082
+ },
4083
+ 更新日時: {
4084
+ type: "UPDATED_TIME",
4085
+ code: "更新日時",
4086
+ label: "更新日時",
4087
+ noLabel: false
4088
+ },
4089
+ 添付1: {
4090
+ type: "FILE",
4091
+ code: "添付1",
4092
+ label: "添付1",
4093
+ noLabel: false,
4094
+ required: false,
4095
+ thumbnailSize: "50"
4096
+ },
4097
+ 添付2: {
4098
+ type: "FILE",
4099
+ code: "添付2",
4100
+ label: "添付2",
4101
+ noLabel: false,
4102
+ required: false,
4103
+ thumbnailSize: "50"
4104
+ },
4105
+ 文字列複数行2: {
4106
+ type: "MULTI_LINE_TEXT",
4107
+ code: "文字列複数行2",
4108
+ label: "文字列複数行2",
4109
+ noLabel: false,
4110
+ required: false,
4111
+ defaultValue: ""
4112
+ },
4113
+ グループ枠1: {
4114
+ type: "GROUP",
4115
+ code: "グループ枠1",
4116
+ label: "グループ枠1",
4117
+ noLabel: false,
4118
+ openGroup: true
4119
+ },
4120
+ 日付1: {
4121
+ type: "DATE",
4122
+ code: "日付1",
4123
+ label: "日付1",
4124
+ noLabel: false,
4125
+ required: false,
4126
+ unique: false,
4127
+ defaultValue: "",
4128
+ defaultNowValue: false
4129
+ },
4130
+ 枠内文字列1: {
4131
+ type: "SINGLE_LINE_TEXT",
4132
+ code: "枠内文字列1",
4133
+ label: "枠内文字列1",
4134
+ noLabel: false,
4135
+ required: false,
4136
+ minLength: "",
4137
+ maxLength: "",
4138
+ expression: "",
4139
+ hideExpression: false,
4140
+ unique: false,
4141
+ defaultValue: ""
4142
+ },
4143
+ 文字列複数行1: {
4144
+ type: "MULTI_LINE_TEXT",
4145
+ code: "文字列複数行1",
4146
+ label: "文字列複数行1",
4147
+ noLabel: false,
4148
+ required: false,
4149
+ defaultValue: ""
4150
+ },
4151
+ 日付2: {
4152
+ type: "DATE",
4153
+ code: "日付2",
4154
+ label: "日付2",
4155
+ noLabel: false,
4156
+ required: false,
4157
+ unique: false,
4158
+ defaultValue: "",
4159
+ defaultNowValue: false
4160
+ },
4161
+ 数値2: {
4162
+ type: "NUMBER",
4163
+ code: "数値2",
4164
+ label: "数値2",
4165
+ noLabel: false,
4166
+ required: false,
4167
+ minValue: "",
4168
+ maxValue: "",
4169
+ digit: true,
4170
+ unique: false,
4171
+ defaultValue: "",
4172
+ displayScale: "2",
4173
+ unit: "",
4174
+ unitPosition: "BEFORE"
4175
+ },
4176
+ 数値1: {
4177
+ type: "NUMBER",
4178
+ code: "数値1",
4179
+ label: "数値1",
4180
+ noLabel: false,
4181
+ required: false,
4182
+ minValue: "",
4183
+ maxValue: "",
4184
+ digit: false,
4185
+ unique: false,
4186
+ defaultValue: "",
4187
+ displayScale: "",
4188
+ unit: "",
4189
+ unitPosition: "BEFORE"
4190
+ },
4191
+ チェック1: {
4192
+ type: "CHECK_BOX",
4193
+ code: "チェック1",
4194
+ label: "チェック1",
4195
+ noLabel: false,
4196
+ required: false,
4197
+ options: {
4198
+ A: {
4199
+ label: "A",
4200
+ index: "0"
4201
+ },
4202
+ B: {
4203
+ label: "B",
4204
+ index: "1"
4205
+ },
4206
+ C: {
4207
+ label: "C",
4208
+ index: "2"
4209
+ }
4210
+ },
4211
+ defaultValue: [],
4212
+ align: "HORIZONTAL"
4213
+ },
4214
+ 作成日時: {
4215
+ type: "CREATED_TIME",
4216
+ code: "作成日時",
4217
+ label: "作成日時",
4218
+ noLabel: false
4219
+ }
4220
+ },
4221
+ layout: [
4222
+ {
4223
+ type: "ROW",
4224
+ fields: [
4225
+ {
4226
+ type: "LABEL",
4227
+ label: "計算式プラグインのサンプルアプリ&#xff08;全項目タイプ × 2、テーブル 2 つ&#xff09;",
4228
+ elementId: "",
4229
+ size: {
4230
+ width: "600"
4231
+ }
4232
+ }
4233
+ ]
4234
+ },
4235
+ {
4236
+ type: "ROW",
4237
+ fields: [
4238
+ {
4239
+ type: "SINGLE_LINE_TEXT",
4240
+ code: "文字列1",
4241
+ size: {
4242
+ width: "250"
4243
+ }
4244
+ },
4245
+ {
4246
+ type: "SINGLE_LINE_TEXT",
4247
+ code: "文字列2",
4248
+ size: {
4249
+ width: "250"
4250
+ }
4251
+ }
4252
+ ]
4253
+ },
4254
+ {
4255
+ type: "ROW",
4256
+ fields: [
4257
+ {
4258
+ type: "MULTI_LINE_TEXT",
4259
+ code: "文字列複数行1",
4260
+ size: {
4261
+ width: "250",
4262
+ innerHeight: "125"
4263
+ }
4264
+ },
4265
+ {
4266
+ type: "MULTI_LINE_TEXT",
4267
+ code: "文字列複数行2",
4268
+ size: {
4269
+ width: "250",
4270
+ innerHeight: "125"
4271
+ }
4272
+ }
4273
+ ]
4274
+ },
4275
+ {
4276
+ type: "ROW",
4277
+ fields: [
4278
+ {
4279
+ type: "RICH_TEXT",
4280
+ code: "リッチ1",
4281
+ size: {
4282
+ width: "250",
4283
+ innerHeight: "125"
4284
+ }
4285
+ },
4286
+ {
4287
+ type: "RICH_TEXT",
4288
+ code: "リッチ2",
4289
+ size: {
4290
+ width: "250",
4291
+ innerHeight: "125"
4292
+ }
4293
+ }
4294
+ ]
4295
+ },
4296
+ {
4297
+ type: "ROW",
4298
+ fields: [
4299
+ {
4300
+ type: "NUMBER",
4301
+ code: "数値1",
4302
+ size: {
4303
+ width: "250"
4304
+ }
4305
+ },
4306
+ {
4307
+ type: "NUMBER",
4308
+ code: "数値2",
4309
+ size: {
4310
+ width: "250"
4311
+ }
4312
+ }
4313
+ ]
4314
+ },
4315
+ {
4316
+ type: "ROW",
4317
+ fields: [
4318
+ {
4319
+ type: "CALC",
4320
+ code: "計算1",
4321
+ size: {
4322
+ width: "250"
4323
+ }
4324
+ },
4325
+ {
4326
+ type: "CALC",
4327
+ code: "計算2",
4328
+ size: {
4329
+ width: "250"
4330
+ }
4331
+ }
4332
+ ]
4333
+ },
4334
+ {
4335
+ type: "ROW",
4336
+ fields: [
4337
+ {
4338
+ type: "RADIO_BUTTON",
4339
+ code: "ラジオ1",
4340
+ size: {
4341
+ width: "250"
4342
+ }
4343
+ },
4344
+ {
4345
+ type: "RADIO_BUTTON",
4346
+ code: "ラジオ2",
4347
+ size: {
4348
+ width: "250"
4349
+ }
4350
+ }
4351
+ ]
4352
+ },
4353
+ {
4354
+ type: "ROW",
4355
+ fields: [
4356
+ {
4357
+ type: "CHECK_BOX",
4358
+ code: "チェック1",
4359
+ size: {
4360
+ width: "250"
4361
+ }
4362
+ },
4363
+ {
4364
+ type: "CHECK_BOX",
4365
+ code: "チェック2",
4366
+ size: {
4367
+ width: "250"
4368
+ }
4369
+ }
4370
+ ]
4371
+ },
4372
+ {
4373
+ type: "ROW",
4374
+ fields: [
4375
+ {
4376
+ type: "MULTI_SELECT",
4377
+ code: "複数選択1",
4378
+ size: {
4379
+ width: "250"
4380
+ }
4381
+ },
4382
+ {
4383
+ type: "MULTI_SELECT",
4384
+ code: "複数選択2",
4385
+ size: {
4386
+ width: "250"
4387
+ }
4388
+ }
4389
+ ]
4390
+ },
4391
+ {
4392
+ type: "ROW",
4393
+ fields: [
4394
+ {
4395
+ type: "DROP_DOWN",
4396
+ code: "ドロップダウン1",
4397
+ size: {
4398
+ width: "250"
4399
+ }
4400
+ },
4401
+ {
4402
+ type: "DROP_DOWN",
4403
+ code: "ドロップダウン2",
4404
+ size: {
4405
+ width: "250"
4406
+ }
4407
+ }
4408
+ ]
4409
+ },
4410
+ {
4411
+ type: "ROW",
4412
+ fields: [
4413
+ {
4414
+ type: "DATE",
4415
+ code: "日付1",
4416
+ size: {
4417
+ width: "250"
4418
+ }
4419
+ },
4420
+ {
4421
+ type: "DATE",
4422
+ code: "日付2",
4423
+ size: {
4424
+ width: "250"
4425
+ }
4426
+ }
4427
+ ]
4428
+ },
4429
+ {
4430
+ type: "ROW",
4431
+ fields: [
4432
+ {
4433
+ type: "TIME",
4434
+ code: "時刻1",
4435
+ size: {
4436
+ width: "250"
4437
+ }
4438
+ },
4439
+ {
4440
+ type: "TIME",
4441
+ code: "時刻2",
4442
+ size: {
4443
+ width: "250"
4444
+ }
4445
+ }
4446
+ ]
4447
+ },
4448
+ {
4449
+ type: "ROW",
4450
+ fields: [
4451
+ {
4452
+ type: "DATETIME",
4453
+ code: "日時1",
4454
+ size: {
4455
+ width: "250"
4456
+ }
4457
+ },
4458
+ {
4459
+ type: "DATETIME",
4460
+ code: "日時2",
4461
+ size: {
4462
+ width: "250"
4463
+ }
4464
+ }
4465
+ ]
4466
+ },
4467
+ {
4468
+ type: "ROW",
4469
+ fields: [
4470
+ {
4471
+ type: "HR",
4472
+ elementId: "",
4473
+ size: {
4474
+ width: "600"
4475
+ }
4476
+ }
4477
+ ]
4478
+ },
4479
+ {
4480
+ type: "ROW",
4481
+ fields: [
4482
+ {
4483
+ type: "FILE",
4484
+ code: "添付1",
4485
+ size: {
4486
+ width: "250"
4487
+ }
4488
+ },
4489
+ {
4490
+ type: "FILE",
4491
+ code: "添付2",
4492
+ size: {
4493
+ width: "250"
4494
+ }
4495
+ }
4496
+ ]
4497
+ },
4498
+ {
4499
+ type: "ROW",
4500
+ fields: [
4501
+ {
4502
+ type: "LINK",
4503
+ code: "リンク1",
4504
+ size: {
4505
+ width: "250"
4506
+ }
4507
+ },
4508
+ {
4509
+ type: "LINK",
4510
+ code: "リンク2",
4511
+ size: {
4512
+ width: "250"
4513
+ }
4514
+ }
4515
+ ]
4516
+ },
4517
+ {
4518
+ type: "ROW",
4519
+ fields: [
4520
+ {
4521
+ type: "USER_SELECT",
4522
+ code: "ユーザー1",
4523
+ size: {
4524
+ width: "250"
4525
+ }
4526
+ },
4527
+ {
4528
+ type: "USER_SELECT",
4529
+ code: "ユーザー2",
4530
+ size: {
4531
+ width: "250"
4532
+ }
4533
+ }
4534
+ ]
4535
+ },
4536
+ {
4537
+ type: "ROW",
4538
+ fields: [
4539
+ {
4540
+ type: "ORGANIZATION_SELECT",
4541
+ code: "組織1",
4542
+ size: {
4543
+ width: "250"
4544
+ }
4545
+ },
4546
+ {
4547
+ type: "ORGANIZATION_SELECT",
4548
+ code: "組織2",
4549
+ size: {
4550
+ width: "250"
4551
+ }
4552
+ }
4553
+ ]
4554
+ },
4555
+ {
4556
+ type: "ROW",
4557
+ fields: [
4558
+ {
4559
+ type: "GROUP_SELECT",
4560
+ code: "グループ1",
4561
+ size: {
4562
+ width: "250"
4563
+ }
4564
+ },
4565
+ {
4566
+ type: "GROUP_SELECT",
4567
+ code: "グループ2",
4568
+ size: {
4569
+ width: "250"
4570
+ }
4571
+ }
4572
+ ]
4573
+ },
4574
+ {
4575
+ type: "GROUP",
4576
+ code: "グループ枠1",
4577
+ layout: [
4578
+ {
4579
+ type: "ROW",
4580
+ fields: [
4581
+ {
4582
+ type: "SINGLE_LINE_TEXT",
4583
+ code: "枠内文字列1",
4584
+ size: {
4585
+ width: "250"
4586
+ }
4587
+ },
4588
+ {
4589
+ type: "NUMBER",
4590
+ code: "枠内数値1",
4591
+ size: {
4592
+ width: "250"
4593
+ }
4594
+ }
4595
+ ]
4596
+ }
4597
+ ]
4598
+ },
4599
+ {
4600
+ type: "ROW",
4601
+ fields: [
4602
+ {
4603
+ type: "SPACER",
4604
+ elementId: "",
4605
+ size: {
4606
+ width: "600",
4607
+ height: "20"
4608
+ }
4609
+ }
4610
+ ]
4611
+ },
4612
+ {
4613
+ type: "SUBTABLE",
4614
+ code: "テーブル1",
4615
+ fields: [
4616
+ {
4617
+ type: "SINGLE_LINE_TEXT",
4618
+ code: "T1_文字列",
4619
+ size: {
4620
+ width: "150"
4621
+ }
4622
+ },
4623
+ {
4624
+ type: "MULTI_LINE_TEXT",
4625
+ code: "T1_文字列複数行",
4626
+ size: {
4627
+ width: "150",
4628
+ innerHeight: "125"
4629
+ }
4630
+ },
4631
+ {
4632
+ type: "RICH_TEXT",
4633
+ code: "T1_リッチ",
4634
+ size: {
4635
+ width: "150",
4636
+ innerHeight: "125"
4637
+ }
4638
+ },
4639
+ {
4640
+ type: "NUMBER",
4641
+ code: "T1_数値",
4642
+ size: {
4643
+ width: "150"
4644
+ }
4645
+ },
4646
+ {
4647
+ type: "CALC",
4648
+ code: "T1_計算",
4649
+ size: {
4650
+ width: "150"
4651
+ }
4652
+ },
4653
+ {
4654
+ type: "RADIO_BUTTON",
4655
+ code: "T1_ラジオ",
4656
+ size: {
4657
+ width: "150"
4658
+ }
4659
+ },
4660
+ {
4661
+ type: "CHECK_BOX",
4662
+ code: "T1_チェック",
4663
+ size: {
4664
+ width: "150"
4665
+ }
4666
+ },
4667
+ {
4668
+ type: "MULTI_SELECT",
4669
+ code: "T1_複数選択",
4670
+ size: {
4671
+ width: "150"
4672
+ }
4673
+ },
4674
+ {
4675
+ type: "DROP_DOWN",
4676
+ code: "T1_ドロップダウン",
4677
+ size: {
4678
+ width: "150"
4679
+ }
4680
+ },
4681
+ {
4682
+ type: "DATE",
4683
+ code: "T1_日付",
4684
+ size: {
4685
+ width: "150"
4686
+ }
4687
+ },
4688
+ {
4689
+ type: "TIME",
4690
+ code: "T1_時刻",
4691
+ size: {
4692
+ width: "150"
4693
+ }
4694
+ },
4695
+ {
4696
+ type: "DATETIME",
4697
+ code: "T1_日時",
4698
+ size: {
4699
+ width: "150"
4700
+ }
4701
+ },
4702
+ {
4703
+ type: "FILE",
4704
+ code: "T1_添付",
4705
+ size: {
4706
+ width: "150"
4707
+ }
4708
+ },
4709
+ {
4710
+ type: "LINK",
4711
+ code: "T1_リンク",
4712
+ size: {
4713
+ width: "150"
4714
+ }
4715
+ },
4716
+ {
4717
+ type: "USER_SELECT",
4718
+ code: "T1_ユーザー",
4719
+ size: {
4720
+ width: "150"
4721
+ }
4722
+ },
4723
+ {
4724
+ type: "ORGANIZATION_SELECT",
4725
+ code: "T1_組織",
4726
+ size: {
4727
+ width: "150"
4728
+ }
4729
+ },
4730
+ {
4731
+ type: "GROUP_SELECT",
4732
+ code: "T1_グループ",
4733
+ size: {
4734
+ width: "150"
4735
+ }
4736
+ }
4737
+ ]
4738
+ },
4739
+ {
4740
+ type: "SUBTABLE",
4741
+ code: "テーブル2",
4742
+ fields: [
4743
+ {
4744
+ type: "SINGLE_LINE_TEXT",
4745
+ code: "T2_文字列",
4746
+ size: {
4747
+ width: "150"
4748
+ }
4749
+ },
4750
+ {
4751
+ type: "MULTI_LINE_TEXT",
4752
+ code: "T2_文字列複数行",
4753
+ size: {
4754
+ width: "150",
4755
+ innerHeight: "125"
4756
+ }
4757
+ },
4758
+ {
4759
+ type: "RICH_TEXT",
4760
+ code: "T2_リッチ",
4761
+ size: {
4762
+ width: "150",
4763
+ innerHeight: "125"
4764
+ }
4765
+ },
4766
+ {
4767
+ type: "NUMBER",
4768
+ code: "T2_数値",
4769
+ size: {
4770
+ width: "150"
4771
+ }
4772
+ },
4773
+ {
4774
+ type: "CALC",
4775
+ code: "T2_計算",
4776
+ size: {
4777
+ width: "150"
4778
+ }
4779
+ },
4780
+ {
4781
+ type: "RADIO_BUTTON",
4782
+ code: "T2_ラジオ",
4783
+ size: {
4784
+ width: "150"
4785
+ }
4786
+ },
4787
+ {
4788
+ type: "CHECK_BOX",
4789
+ code: "T2_チェック",
4790
+ size: {
4791
+ width: "150"
4792
+ }
4793
+ },
4794
+ {
4795
+ type: "MULTI_SELECT",
4796
+ code: "T2_複数選択",
4797
+ size: {
4798
+ width: "150"
4799
+ }
4800
+ },
4801
+ {
4802
+ type: "DROP_DOWN",
4803
+ code: "T2_ドロップダウン",
4804
+ size: {
4805
+ width: "150"
4806
+ }
4807
+ },
4808
+ {
4809
+ type: "DATE",
4810
+ code: "T2_日付",
4811
+ size: {
4812
+ width: "150"
4813
+ }
4814
+ },
4815
+ {
4816
+ type: "TIME",
4817
+ code: "T2_時刻",
4818
+ size: {
4819
+ width: "150"
4820
+ }
4821
+ },
4822
+ {
4823
+ type: "DATETIME",
4824
+ code: "T2_日時",
4825
+ size: {
4826
+ width: "150"
4827
+ }
4828
+ },
4829
+ {
4830
+ type: "FILE",
4831
+ code: "T2_添付",
4832
+ size: {
4833
+ width: "150"
4834
+ }
4835
+ },
4836
+ {
4837
+ type: "LINK",
4838
+ code: "T2_リンク",
4839
+ size: {
4840
+ width: "150"
4841
+ }
4842
+ },
4843
+ {
4844
+ type: "USER_SELECT",
4845
+ code: "T2_ユーザー",
4846
+ size: {
4847
+ width: "150"
4848
+ }
4849
+ },
4850
+ {
4851
+ type: "ORGANIZATION_SELECT",
4852
+ code: "T2_組織",
4853
+ size: {
4854
+ width: "150"
4855
+ }
4856
+ },
4857
+ {
4858
+ type: "GROUP_SELECT",
4859
+ code: "T2_グループ",
4860
+ size: {
4861
+ width: "150"
4862
+ }
4863
+ }
4864
+ ]
4865
+ },
4866
+ {
4867
+ type: "ROW",
4868
+ fields: [
4869
+ {
4870
+ type: "RECORD_NUMBER",
4871
+ code: "レコード番号",
4872
+ size: {
4873
+ width: "250"
4874
+ }
4875
+ },
4876
+ {
4877
+ type: "CREATOR",
4878
+ code: "作成者",
4879
+ size: {
4880
+ width: "250"
4881
+ }
4882
+ }
4883
+ ]
4884
+ },
4885
+ {
4886
+ type: "ROW",
4887
+ fields: [
4888
+ {
4889
+ type: "CREATED_TIME",
4890
+ code: "作成日時",
4891
+ size: {
4892
+ width: "250"
4893
+ }
4894
+ },
4895
+ {
4896
+ type: "MODIFIER",
4897
+ code: "更新者",
4898
+ size: {
4899
+ width: "250"
4900
+ }
4901
+ }
4902
+ ]
4903
+ },
4904
+ {
4905
+ type: "ROW",
4906
+ fields: [
4907
+ {
4908
+ type: "UPDATED_TIME",
4909
+ code: "更新日時",
4910
+ size: {
4911
+ width: "250"
4912
+ }
4913
+ }
4914
+ ]
4915
+ }
4916
+ ],
4917
+ views: {
4918
+ "(作業者が自分)": {
4919
+ type: "LIST",
4920
+ name: "(作業者が自分)",
4921
+ id: "16550400",
4922
+ filterCond: "作業者 in (LOGINUSER())",
4923
+ sort: "レコード番号 desc",
4924
+ index: "0",
4925
+ fields: [
4926
+ "レコード番号",
4927
+ "文字列1",
4928
+ "文字列2",
4929
+ "文字列複数行1",
4930
+ "文字列複数行2",
4931
+ "リッチ1",
4932
+ "リッチ2",
4933
+ "数値1",
4934
+ "数値2",
4935
+ "計算1",
4936
+ "計算2",
4937
+ "ラジオ1",
4938
+ "ラジオ2",
4939
+ "チェック1",
4940
+ "チェック2",
4941
+ "複数選択1",
4942
+ "複数選択2",
4943
+ "ドロップダウン1",
4944
+ "ドロップダウン2",
4945
+ "日付1",
4946
+ "日付2",
4947
+ "時刻1",
4948
+ "時刻2",
4949
+ "日時1",
4950
+ "日時2",
4951
+ "添付1",
4952
+ "添付2",
4953
+ "リンク1",
4954
+ "リンク2",
4955
+ "ユーザー1",
4956
+ "ユーザー2",
4957
+ "組織1",
4958
+ "組織2",
4959
+ "グループ1",
4960
+ "グループ2",
4961
+ "枠内文字列1",
4962
+ "枠内数値1",
4963
+ "ステータス",
4964
+ "作業者"
4965
+ ],
4966
+ builtinType: "ASSIGNEE"
4967
+ }
4968
+ }
4969
+ };
4970
+
4971
+ // src/sample-app/record-1.json
4972
+ var record_1_default = {
4973
+ tool: "formula-authoring record",
4974
+ fetchedAt: "2026-01-15T00:00:00.000Z",
4975
+ baseUrl: "https://example.cybozu.com",
4976
+ appId: 4329,
4977
+ id: 1,
4978
+ record: {
4979
+ チェック2: {
4980
+ type: "CHECK_BOX",
4981
+ value: [
4982
+ "甲"
4983
+ ]
4984
+ },
4985
+ レコード番号: {
4986
+ type: "RECORD_NUMBER",
4987
+ value: "1"
4988
+ },
4989
+ ドロップダウン2: {
4990
+ type: "DROP_DOWN",
4991
+ value: "乙"
4992
+ },
4993
+ ユーザー2: {
4994
+ type: "USER_SELECT",
4995
+ value: [
4996
+ {
4997
+ code: "demo_user01",
4998
+ name: "架空 社長"
4999
+ },
5000
+ {
5001
+ code: "demo_user02",
5002
+ name: "架空 営業部長"
5003
+ }
5004
+ ]
5005
+ },
5006
+ 組織1: {
5007
+ type: "ORGANIZATION_SELECT",
5008
+ value: [
5009
+ {
5010
+ code: "demo_hq",
5011
+ name: "架空本社"
5012
+ }
5013
+ ]
5014
+ },
5015
+ ドロップダウン1: {
5016
+ type: "DROP_DOWN",
5017
+ value: "A"
5018
+ },
5019
+ 更新者: {
5020
+ type: "MODIFIER",
5021
+ value: {
5022
+ code: "demo_user02",
5023
+ name: "架空 営業部長"
5024
+ }
5025
+ },
5026
+ ユーザー1: {
5027
+ type: "USER_SELECT",
5028
+ value: [
5029
+ {
5030
+ code: "demo_user01",
5031
+ name: "架空 社長"
5032
+ }
5033
+ ]
5034
+ },
5035
+ 組織2: {
5036
+ type: "ORGANIZATION_SELECT",
5037
+ value: [
5038
+ {
5039
+ code: "demo_sales",
5040
+ name: "架空営業部"
5041
+ }
5042
+ ]
5043
+ },
5044
+ テーブル2: {
5045
+ type: "SUBTABLE",
5046
+ value: [
5047
+ {
5048
+ id: "7727389",
5049
+ value: {
5050
+ T2_複数選択: {
5051
+ type: "MULTI_SELECT",
5052
+ value: [
5053
+ "B"
5054
+ ]
5055
+ },
5056
+ T2_文字列複数行: {
5057
+ type: "MULTI_LINE_TEXT",
5058
+ value: "T2 行 1\n2 行目"
5059
+ },
5060
+ T2_リンク: {
5061
+ type: "LINK",
5062
+ value: "https://example.com/"
5063
+ },
5064
+ T2_リッチ: {
5065
+ type: "RICH_TEXT",
5066
+ value: "<div>T2 行 1</div>"
5067
+ },
5068
+ T2_文字列: {
5069
+ type: "SINGLE_LINE_TEXT",
5070
+ value: "T2 行 1"
5071
+ },
5072
+ T2_チェック: {
5073
+ type: "CHECK_BOX",
5074
+ value: [
5075
+ "A"
5076
+ ]
5077
+ },
5078
+ T2_ユーザー: {
5079
+ type: "USER_SELECT",
5080
+ value: [
5081
+ {
5082
+ code: "demo_user01",
5083
+ name: "架空 社長"
5084
+ }
5085
+ ]
5086
+ },
5087
+ T2_グループ: {
5088
+ type: "GROUP_SELECT",
5089
+ value: [
5090
+ {
5091
+ code: "demo_managers",
5092
+ name: "架空管理職"
5093
+ }
5094
+ ]
5095
+ },
5096
+ T2_日付: {
5097
+ type: "DATE",
5098
+ value: "2026-02-01"
5099
+ },
5100
+ T2_数値: {
5101
+ type: "NUMBER",
5102
+ value: "10"
5103
+ },
5104
+ T2_ドロップダウン: {
5105
+ type: "DROP_DOWN",
5106
+ value: "C"
5107
+ },
5108
+ T2_組織: {
5109
+ type: "ORGANIZATION_SELECT",
5110
+ value: [
5111
+ {
5112
+ code: "demo_hq",
5113
+ name: "架空本社"
5114
+ }
5115
+ ]
5116
+ },
5117
+ T2_計算: {
5118
+ type: "CALC",
5119
+ value: "20"
5120
+ },
5121
+ T2_ラジオ: {
5122
+ type: "RADIO_BUTTON",
5123
+ value: "A"
5124
+ },
5125
+ T2_日時: {
5126
+ type: "DATETIME",
5127
+ value: "2026-02-01T00:30:00Z"
5128
+ },
5129
+ T2_添付: {
5130
+ type: "FILE",
5131
+ value: []
5132
+ },
5133
+ T2_時刻: {
5134
+ type: "TIME",
5135
+ value: "09:30"
5136
+ }
5137
+ }
5138
+ },
5139
+ {
5140
+ id: "7727392",
5141
+ value: {
5142
+ T2_複数選択: {
5143
+ type: "MULTI_SELECT",
5144
+ value: [
5145
+ "B"
5146
+ ]
5147
+ },
5148
+ T2_文字列複数行: {
5149
+ type: "MULTI_LINE_TEXT",
5150
+ value: "T2 行 2\n2 行目"
5151
+ },
5152
+ T2_リンク: {
5153
+ type: "LINK",
5154
+ value: "https://example.com/"
5155
+ },
5156
+ T2_リッチ: {
5157
+ type: "RICH_TEXT",
5158
+ value: "<div>T2 行 2</div>"
5159
+ },
5160
+ T2_文字列: {
5161
+ type: "SINGLE_LINE_TEXT",
5162
+ value: "T2 行 2"
5163
+ },
5164
+ T2_チェック: {
5165
+ type: "CHECK_BOX",
5166
+ value: [
5167
+ "A"
5168
+ ]
5169
+ },
5170
+ T2_ユーザー: {
5171
+ type: "USER_SELECT",
5172
+ value: [
5173
+ {
5174
+ code: "demo_user01",
5175
+ name: "架空 社長"
5176
+ }
5177
+ ]
5178
+ },
5179
+ T2_グループ: {
5180
+ type: "GROUP_SELECT",
5181
+ value: [
5182
+ {
5183
+ code: "demo_managers",
5184
+ name: "架空管理職"
5185
+ }
5186
+ ]
5187
+ },
5188
+ T2_日付: {
5189
+ type: "DATE",
5190
+ value: "2026-02-02"
5191
+ },
5192
+ T2_数値: {
5193
+ type: "NUMBER",
5194
+ value: "20"
5195
+ },
5196
+ T2_ドロップダウン: {
5197
+ type: "DROP_DOWN",
5198
+ value: "B"
5199
+ },
5200
+ T2_組織: {
5201
+ type: "ORGANIZATION_SELECT",
5202
+ value: [
5203
+ {
5204
+ code: "demo_hq",
5205
+ name: "架空本社"
5206
+ }
5207
+ ]
5208
+ },
5209
+ T2_計算: {
5210
+ type: "CALC",
5211
+ value: "40"
5212
+ },
5213
+ T2_ラジオ: {
5214
+ type: "RADIO_BUTTON",
5215
+ value: "A"
5216
+ },
5217
+ T2_日時: {
5218
+ type: "DATETIME",
5219
+ value: "2026-02-02T00:30:00Z"
5220
+ },
5221
+ T2_添付: {
5222
+ type: "FILE",
5223
+ value: []
5224
+ },
5225
+ T2_時刻: {
5226
+ type: "TIME",
5227
+ value: "09:30"
5228
+ }
5229
+ }
5230
+ }
5231
+ ]
5232
+ },
5233
+ ステータス: {
5234
+ type: "STATUS",
5235
+ value: "未処理"
5236
+ },
5237
+ グループ1: {
5238
+ type: "GROUP_SELECT",
5239
+ value: [
5240
+ {
5241
+ code: "demo_managers",
5242
+ name: "架空管理職"
5243
+ }
5244
+ ]
5245
+ },
5246
+ テーブル1: {
5247
+ type: "SUBTABLE",
5248
+ value: [
5249
+ {
5250
+ id: "7727380",
5251
+ value: {
5252
+ T1_ユーザー: {
5253
+ type: "USER_SELECT",
5254
+ value: [
5255
+ {
5256
+ code: "demo_user01",
5257
+ name: "架空 社長"
5258
+ }
5259
+ ]
5260
+ },
5261
+ T1_文字列複数行: {
5262
+ type: "MULTI_LINE_TEXT",
5263
+ value: "行 1\n2 行目"
5264
+ },
5265
+ T1_ラジオ: {
5266
+ type: "RADIO_BUTTON",
5267
+ value: "A"
5268
+ },
5269
+ T1_複数選択: {
5270
+ type: "MULTI_SELECT",
5271
+ value: [
5272
+ "B"
5273
+ ]
5274
+ },
5275
+ T1_日付: {
5276
+ type: "DATE",
5277
+ value: "2026-01-10"
5278
+ },
5279
+ T1_ドロップダウン: {
5280
+ type: "DROP_DOWN",
5281
+ value: "A"
5282
+ },
5283
+ T1_リッチ: {
5284
+ type: "RICH_TEXT",
5285
+ value: "<div>行 1</div>"
5286
+ },
5287
+ T1_数値: {
5288
+ type: "NUMBER",
5289
+ value: "100"
5290
+ },
5291
+ T1_組織: {
5292
+ type: "ORGANIZATION_SELECT",
5293
+ value: [
5294
+ {
5295
+ code: "demo_hq",
5296
+ name: "架空本社"
5297
+ }
5298
+ ]
5299
+ },
5300
+ T1_リンク: {
5301
+ type: "LINK",
5302
+ value: "https://example.com/"
5303
+ },
5304
+ T1_文字列: {
5305
+ type: "SINGLE_LINE_TEXT",
5306
+ value: "行 1"
5307
+ },
5308
+ T1_計算: {
5309
+ type: "CALC",
5310
+ value: "200"
5311
+ },
5312
+ T1_添付: {
5313
+ type: "FILE",
5314
+ value: []
5315
+ },
5316
+ T1_日時: {
5317
+ type: "DATETIME",
5318
+ value: "2026-01-10T00:30:00Z"
5319
+ },
5320
+ T1_グループ: {
5321
+ type: "GROUP_SELECT",
5322
+ value: [
5323
+ {
5324
+ code: "demo_managers",
5325
+ name: "架空管理職"
5326
+ }
5327
+ ]
5328
+ },
5329
+ T1_チェック: {
5330
+ type: "CHECK_BOX",
5331
+ value: [
5332
+ "A"
5333
+ ]
5334
+ },
5335
+ T1_時刻: {
5336
+ type: "TIME",
5337
+ value: "09:30"
5338
+ }
5339
+ }
5340
+ },
5341
+ {
5342
+ id: "7727383",
5343
+ value: {
5344
+ T1_ユーザー: {
5345
+ type: "USER_SELECT",
5346
+ value: [
5347
+ {
5348
+ code: "demo_user01",
5349
+ name: "架空 社長"
5350
+ }
5351
+ ]
5352
+ },
5353
+ T1_文字列複数行: {
5354
+ type: "MULTI_LINE_TEXT",
5355
+ value: "行 2\n2 行目"
5356
+ },
5357
+ T1_ラジオ: {
5358
+ type: "RADIO_BUTTON",
5359
+ value: "A"
5360
+ },
5361
+ T1_複数選択: {
5362
+ type: "MULTI_SELECT",
5363
+ value: [
5364
+ "B"
5365
+ ]
5366
+ },
5367
+ T1_日付: {
5368
+ type: "DATE",
5369
+ value: "2026-01-20"
5370
+ },
5371
+ T1_ドロップダウン: {
5372
+ type: "DROP_DOWN",
5373
+ value: "B"
5374
+ },
5375
+ T1_リッチ: {
5376
+ type: "RICH_TEXT",
5377
+ value: "<div>行 2</div>"
5378
+ },
5379
+ T1_数値: {
5380
+ type: "NUMBER",
5381
+ value: "200"
5382
+ },
5383
+ T1_組織: {
5384
+ type: "ORGANIZATION_SELECT",
5385
+ value: [
5386
+ {
5387
+ code: "demo_hq",
5388
+ name: "架空本社"
5389
+ }
5390
+ ]
5391
+ },
5392
+ T1_リンク: {
5393
+ type: "LINK",
5394
+ value: "https://example.com/"
5395
+ },
5396
+ T1_文字列: {
5397
+ type: "SINGLE_LINE_TEXT",
5398
+ value: "行 2"
5399
+ },
5400
+ T1_計算: {
5401
+ type: "CALC",
5402
+ value: "400"
5403
+ },
5404
+ T1_添付: {
5405
+ type: "FILE",
5406
+ value: []
5407
+ },
5408
+ T1_日時: {
5409
+ type: "DATETIME",
5410
+ value: "2026-01-20T00:30:00Z"
5411
+ },
5412
+ T1_グループ: {
5413
+ type: "GROUP_SELECT",
5414
+ value: [
5415
+ {
5416
+ code: "demo_managers",
5417
+ name: "架空管理職"
5418
+ }
5419
+ ]
5420
+ },
5421
+ T1_チェック: {
5422
+ type: "CHECK_BOX",
5423
+ value: [
5424
+ "A"
5425
+ ]
5426
+ },
5427
+ T1_時刻: {
5428
+ type: "TIME",
5429
+ value: "09:30"
5430
+ }
5431
+ }
5432
+ },
5433
+ {
5434
+ id: "7727386",
5435
+ value: {
5436
+ T1_ユーザー: {
5437
+ type: "USER_SELECT",
5438
+ value: [
5439
+ {
5440
+ code: "demo_user01",
5441
+ name: "架空 社長"
5442
+ }
5443
+ ]
5444
+ },
5445
+ T1_文字列複数行: {
5446
+ type: "MULTI_LINE_TEXT",
5447
+ value: "行 3\n2 行目"
5448
+ },
5449
+ T1_ラジオ: {
5450
+ type: "RADIO_BUTTON",
5451
+ value: "A"
5452
+ },
5453
+ T1_複数選択: {
5454
+ type: "MULTI_SELECT",
5455
+ value: [
5456
+ "B"
5457
+ ]
5458
+ },
5459
+ T1_日付: {
5460
+ type: "DATE",
5461
+ value: "2026-01-30"
5462
+ },
5463
+ T1_ドロップダウン: {
5464
+ type: "DROP_DOWN",
5465
+ value: "A"
5466
+ },
5467
+ T1_リッチ: {
5468
+ type: "RICH_TEXT",
5469
+ value: "<div>行 3</div>"
5470
+ },
5471
+ T1_数値: {
5472
+ type: "NUMBER",
5473
+ value: "300"
5474
+ },
5475
+ T1_組織: {
5476
+ type: "ORGANIZATION_SELECT",
5477
+ value: [
5478
+ {
5479
+ code: "demo_hq",
5480
+ name: "架空本社"
5481
+ }
5482
+ ]
5483
+ },
5484
+ T1_リンク: {
5485
+ type: "LINK",
5486
+ value: "https://example.com/"
5487
+ },
5488
+ T1_文字列: {
5489
+ type: "SINGLE_LINE_TEXT",
5490
+ value: "行 3"
5491
+ },
5492
+ T1_計算: {
5493
+ type: "CALC",
5494
+ value: "600"
5495
+ },
5496
+ T1_添付: {
5497
+ type: "FILE",
5498
+ value: []
5499
+ },
5500
+ T1_日時: {
5501
+ type: "DATETIME",
5502
+ value: "2026-01-30T00:30:00Z"
5503
+ },
5504
+ T1_グループ: {
5505
+ type: "GROUP_SELECT",
5506
+ value: [
5507
+ {
5508
+ code: "demo_managers",
5509
+ name: "架空管理職"
5510
+ }
5511
+ ]
5512
+ },
5513
+ T1_チェック: {
5514
+ type: "CHECK_BOX",
5515
+ value: [
5516
+ "A"
5517
+ ]
5518
+ },
5519
+ T1_時刻: {
5520
+ type: "TIME",
5521
+ value: "09:30"
5522
+ }
5523
+ }
5524
+ }
5525
+ ]
5526
+ },
5527
+ ラジオ1: {
5528
+ type: "RADIO_BUTTON",
5529
+ value: "B"
5530
+ },
5531
+ グループ2: {
5532
+ type: "GROUP_SELECT",
5533
+ value: [
5534
+ {
5535
+ code: "demo_approvers",
5536
+ name: "架空承認者"
5537
+ }
5538
+ ]
5539
+ },
5540
+ ラジオ2: {
5541
+ type: "RADIO_BUTTON",
5542
+ value: "乙"
5543
+ },
5544
+ リッチ1: {
5545
+ type: "RICH_TEXT",
5546
+ value: "<div><b>太字</b>と<i>斜体</i></div>"
5547
+ },
5548
+ 時刻2: {
5549
+ type: "TIME",
5550
+ value: "17:45"
5551
+ },
5552
+ カテゴリー: {
5553
+ type: "CATEGORY",
5554
+ value: []
5555
+ },
5556
+ 時刻1: {
5557
+ type: "TIME",
5558
+ value: "09:30"
5559
+ },
5560
+ リンク1: {
5561
+ type: "LINK",
5562
+ value: "https://example.com/sample"
5563
+ },
5564
+ リッチ2: {
5565
+ type: "RICH_TEXT",
5566
+ value: "<div>リッチ 2</div>"
5567
+ },
5568
+ リンク2: {
5569
+ type: "LINK",
5570
+ value: "sample@example.com"
5571
+ },
5572
+ 計算2: {
5573
+ type: "CALC",
5574
+ value: "-75"
5575
+ },
5576
+ 計算1: {
5577
+ type: "CALC",
5578
+ value: "1290.78"
5579
+ },
5580
+ 複数選択2: {
5581
+ type: "MULTI_SELECT",
5582
+ value: [
5583
+ "丙"
5584
+ ]
5585
+ },
5586
+ 日時1: {
5587
+ type: "DATETIME",
5588
+ value: "2026-01-15T00:30:00Z"
5589
+ },
5590
+ 複数選択1: {
5591
+ type: "MULTI_SELECT",
5592
+ value: [
5593
+ "A",
5594
+ "B"
5595
+ ]
5596
+ },
5597
+ 日時2: {
5598
+ type: "DATETIME",
5599
+ value: "2026-03-31T08:45:00Z"
5600
+ },
5601
+ 枠内数値1: {
5602
+ type: "NUMBER",
5603
+ value: "42"
5604
+ },
5605
+ 作業者: {
5606
+ type: "STATUS_ASSIGNEE",
5607
+ value: []
5608
+ },
5609
+ 作成者: {
5610
+ type: "CREATOR",
5611
+ value: {
5612
+ code: "demo_user01",
5613
+ name: "架空 社長"
5614
+ }
5615
+ },
5616
+ $revision: {
5617
+ type: "__REVISION__",
5618
+ value: "2"
5619
+ },
5620
+ 文字列2: {
5621
+ type: "SINGLE_LINE_TEXT",
5622
+ value: "サンプル文字列 2"
5623
+ },
5624
+ 文字列1: {
5625
+ type: "SINGLE_LINE_TEXT",
5626
+ value: "サンプル文字列 1"
5627
+ },
5628
+ 更新日時: {
5629
+ type: "UPDATED_TIME",
5630
+ value: "2026-01-15T00:00:00Z"
5631
+ },
5632
+ 添付1: {
5633
+ type: "FILE",
5634
+ value: []
5635
+ },
5636
+ 添付2: {
5637
+ type: "FILE",
5638
+ value: []
5639
+ },
5640
+ 文字列複数行2: {
5641
+ type: "MULTI_LINE_TEXT",
5642
+ value: "複数行 2"
5643
+ },
5644
+ 日付1: {
5645
+ type: "DATE",
5646
+ value: "2026-01-15"
5647
+ },
5648
+ 枠内文字列1: {
5649
+ type: "SINGLE_LINE_TEXT",
5650
+ value: "枠の中の文字列"
5651
+ },
5652
+ 文字列複数行1: {
5653
+ type: "MULTI_LINE_TEXT",
5654
+ value: "1 行目\n2 行目\n3 行目"
5655
+ },
5656
+ 日付2: {
5657
+ type: "DATE",
5658
+ value: "2026-03-31"
5659
+ },
5660
+ 数値2: {
5661
+ type: "NUMBER",
5662
+ value: "56.78"
5663
+ },
5664
+ 数値1: {
5665
+ type: "NUMBER",
5666
+ value: "1234"
5667
+ },
5668
+ チェック1: {
5669
+ type: "CHECK_BOX",
5670
+ value: [
5671
+ "A",
5672
+ "C"
5673
+ ]
5674
+ },
5675
+ 作成日時: {
5676
+ type: "CREATED_TIME",
5677
+ value: "2026-01-15T00:00:00Z"
5678
+ },
5679
+ $id: {
5680
+ type: "__ID__",
5681
+ value: "1"
5682
+ }
5683
+ }
5684
+ };
5685
+
5686
+ // src/sample-app/record-2.json
5687
+ var record_2_default = {
5688
+ tool: "formula-authoring record",
5689
+ fetchedAt: "2026-01-15T00:00:00.000Z",
5690
+ baseUrl: "https://example.cybozu.com",
5691
+ appId: 4329,
5692
+ id: 2,
5693
+ record: {
5694
+ チェック2: {
5695
+ type: "CHECK_BOX",
5696
+ value: []
5697
+ },
5698
+ レコード番号: {
5699
+ type: "RECORD_NUMBER",
5700
+ value: "2"
5701
+ },
5702
+ ドロップダウン2: {
5703
+ type: "DROP_DOWN",
5704
+ value: "丙"
5705
+ },
5706
+ ユーザー2: {
5707
+ type: "USER_SELECT",
5708
+ value: []
5709
+ },
5710
+ 組織1: {
5711
+ type: "ORGANIZATION_SELECT",
5712
+ value: []
5713
+ },
5714
+ ドロップダウン1: {
5715
+ type: "DROP_DOWN",
5716
+ value: null
5717
+ },
5718
+ 更新者: {
5719
+ type: "MODIFIER",
5720
+ value: {
5721
+ code: "demo_user02",
5722
+ name: "架空 営業部長"
5723
+ }
5724
+ },
5725
+ ユーザー1: {
5726
+ type: "USER_SELECT",
5727
+ value: []
5728
+ },
5729
+ 組織2: {
5730
+ type: "ORGANIZATION_SELECT",
5731
+ value: []
5732
+ },
5733
+ テーブル2: {
5734
+ type: "SUBTABLE",
5735
+ value: []
5736
+ },
5737
+ ステータス: {
5738
+ type: "STATUS",
5739
+ value: "未処理"
5740
+ },
5741
+ グループ1: {
5742
+ type: "GROUP_SELECT",
5743
+ value: []
5744
+ },
5745
+ テーブル1: {
5746
+ type: "SUBTABLE",
5747
+ value: [
5748
+ {
5749
+ id: "7727396",
5750
+ value: {
5751
+ T1_ユーザー: {
5752
+ type: "USER_SELECT",
5753
+ value: []
5754
+ },
5755
+ T1_文字列複数行: {
5756
+ type: "MULTI_LINE_TEXT",
5757
+ value: "\n2 行目"
5758
+ },
5759
+ T1_ラジオ: {
5760
+ type: "RADIO_BUTTON",
5761
+ value: "A"
5762
+ },
5763
+ T1_複数選択: {
5764
+ type: "MULTI_SELECT",
5765
+ value: [
5766
+ "B"
5767
+ ]
5768
+ },
5769
+ T1_日付: {
5770
+ type: "DATE",
5771
+ value: "2026-02-28"
5772
+ },
5773
+ T1_ドロップダウン: {
5774
+ type: "DROP_DOWN",
5775
+ value: null
5776
+ },
5777
+ T1_リッチ: {
5778
+ type: "RICH_TEXT",
5779
+ value: "<div></div>"
5780
+ },
5781
+ T1_数値: {
5782
+ type: "NUMBER",
5783
+ value: "0"
5784
+ },
5785
+ T1_組織: {
5786
+ type: "ORGANIZATION_SELECT",
5787
+ value: []
5788
+ },
5789
+ T1_リンク: {
5790
+ type: "LINK",
5791
+ value: "https://example.com/"
5792
+ },
5793
+ T1_文字列: {
5794
+ type: "SINGLE_LINE_TEXT",
5795
+ value: ""
5796
+ },
5797
+ T1_計算: {
5798
+ type: "CALC",
5799
+ value: "0"
5800
+ },
5801
+ T1_添付: {
5802
+ type: "FILE",
5803
+ value: []
5804
+ },
5805
+ T1_日時: {
5806
+ type: "DATETIME",
5807
+ value: "2026-02-28T00:30:00Z"
5808
+ },
5809
+ T1_グループ: {
5810
+ type: "GROUP_SELECT",
5811
+ value: []
5812
+ },
5813
+ T1_チェック: {
5814
+ type: "CHECK_BOX",
5815
+ value: [
5816
+ "A"
5817
+ ]
5818
+ },
5819
+ T1_時刻: {
5820
+ type: "TIME",
5821
+ value: "09:30"
5822
+ }
5823
+ }
5824
+ }
5825
+ ]
5826
+ },
5827
+ ラジオ1: {
5828
+ type: "RADIO_BUTTON",
5829
+ value: "C"
5830
+ },
5831
+ グループ2: {
5832
+ type: "GROUP_SELECT",
5833
+ value: []
5834
+ },
5835
+ ラジオ2: {
5836
+ type: "RADIO_BUTTON",
5837
+ value: "甲"
5838
+ },
5839
+ リッチ1: {
5840
+ type: "RICH_TEXT",
5841
+ value: ""
5842
+ },
5843
+ 時刻2: {
5844
+ type: "TIME",
5845
+ value: "23:59"
5846
+ },
5847
+ カテゴリー: {
5848
+ type: "CATEGORY",
5849
+ value: []
5850
+ },
5851
+ 時刻1: {
5852
+ type: "TIME",
5853
+ value: "00:00"
5854
+ },
5855
+ リンク1: {
5856
+ type: "LINK",
5857
+ value: ""
5858
+ },
5859
+ リッチ2: {
5860
+ type: "RICH_TEXT",
5861
+ value: ""
5862
+ },
5863
+ リンク2: {
5864
+ type: "LINK",
5865
+ value: ""
5866
+ },
5867
+ 計算2: {
5868
+ type: "CALC",
5869
+ value: "-306"
5870
+ },
5871
+ 計算1: {
5872
+ type: "CALC",
5873
+ value: "-12.345"
5874
+ },
5875
+ 複数選択2: {
5876
+ type: "MULTI_SELECT",
5877
+ value: []
5878
+ },
5879
+ 日時1: {
5880
+ type: "DATETIME",
5881
+ value: "2026-12-31T14:59:00Z"
5882
+ },
5883
+ 複数選択1: {
5884
+ type: "MULTI_SELECT",
5885
+ value: []
5886
+ },
5887
+ 日時2: {
5888
+ type: "DATETIME",
5889
+ value: ""
5890
+ },
5891
+ 枠内数値1: {
5892
+ type: "NUMBER",
5893
+ value: ""
5894
+ },
5895
+ 作業者: {
5896
+ type: "STATUS_ASSIGNEE",
5897
+ value: []
5898
+ },
5899
+ 作成者: {
5900
+ type: "CREATOR",
5901
+ value: {
5902
+ code: "demo_user01",
5903
+ name: "架空 社長"
5904
+ }
5905
+ },
5906
+ $revision: {
5907
+ type: "__REVISION__",
5908
+ value: "2"
5909
+ },
5910
+ 文字列2: {
5911
+ type: "SINGLE_LINE_TEXT",
5912
+ value: ""
5913
+ },
5914
+ 文字列1: {
5915
+ type: "SINGLE_LINE_TEXT",
5916
+ value: "端の値"
5917
+ },
5918
+ 更新日時: {
5919
+ type: "UPDATED_TIME",
5920
+ value: "2026-01-15T00:00:00Z"
5921
+ },
5922
+ 添付1: {
5923
+ type: "FILE",
5924
+ value: []
5925
+ },
5926
+ 添付2: {
5927
+ type: "FILE",
5928
+ value: []
5929
+ },
5930
+ 文字列複数行2: {
5931
+ type: "MULTI_LINE_TEXT",
5932
+ value: ""
5933
+ },
5934
+ 日付1: {
5935
+ type: "DATE",
5936
+ value: "2026-02-28"
5937
+ },
5938
+ 枠内文字列1: {
5939
+ type: "SINGLE_LINE_TEXT",
5940
+ value: ""
5941
+ },
5942
+ 文字列複数行1: {
5943
+ type: "MULTI_LINE_TEXT",
5944
+ value: "1\n\n3\n"
5945
+ },
5946
+ 日付2: {
5947
+ type: "DATE",
5948
+ value: "2026-12-31"
5949
+ },
5950
+ 数値2: {
5951
+ type: "NUMBER",
5952
+ value: "-12.345"
5953
+ },
5954
+ 数値1: {
5955
+ type: "NUMBER",
5956
+ value: "0"
5957
+ },
5958
+ チェック1: {
5959
+ type: "CHECK_BOX",
5960
+ value: []
5961
+ },
5962
+ 作成日時: {
5963
+ type: "CREATED_TIME",
5964
+ value: "2026-01-15T00:00:00Z"
5965
+ },
5966
+ $id: {
5967
+ type: "__ID__",
5968
+ value: "2"
5969
+ }
5970
+ }
5971
+ };
5972
+
5973
+ // src/sample-app/record-3.json
5974
+ var record_3_default = {
5975
+ tool: "formula-authoring record",
5976
+ fetchedAt: "2026-01-15T00:00:00.000Z",
5977
+ baseUrl: "https://example.cybozu.com",
5978
+ appId: 4329,
5979
+ id: 3,
5980
+ record: {
5981
+ チェック2: {
5982
+ type: "CHECK_BOX",
5983
+ value: []
5984
+ },
5985
+ レコード番号: {
5986
+ type: "RECORD_NUMBER",
5987
+ value: "3"
5988
+ },
5989
+ ドロップダウン2: {
5990
+ type: "DROP_DOWN",
5991
+ value: null
5992
+ },
5993
+ ユーザー2: {
5994
+ type: "USER_SELECT",
5995
+ value: []
5996
+ },
5997
+ 組織1: {
5998
+ type: "ORGANIZATION_SELECT",
5999
+ value: []
6000
+ },
6001
+ ドロップダウン1: {
6002
+ type: "DROP_DOWN",
6003
+ value: null
6004
+ },
6005
+ 更新者: {
6006
+ type: "MODIFIER",
6007
+ value: {
6008
+ code: "demo_user02",
6009
+ name: "架空 営業部長"
6010
+ }
6011
+ },
6012
+ ユーザー1: {
6013
+ type: "USER_SELECT",
6014
+ value: []
6015
+ },
6016
+ 組織2: {
6017
+ type: "ORGANIZATION_SELECT",
6018
+ value: []
6019
+ },
6020
+ テーブル2: {
6021
+ type: "SUBTABLE",
6022
+ value: []
6023
+ },
6024
+ ステータス: {
6025
+ type: "STATUS",
6026
+ value: "未処理"
6027
+ },
6028
+ グループ1: {
6029
+ type: "GROUP_SELECT",
6030
+ value: []
6031
+ },
6032
+ テーブル1: {
6033
+ type: "SUBTABLE",
6034
+ value: []
6035
+ },
6036
+ ラジオ1: {
6037
+ type: "RADIO_BUTTON",
6038
+ value: "A"
6039
+ },
6040
+ グループ2: {
6041
+ type: "GROUP_SELECT",
6042
+ value: []
6043
+ },
6044
+ ラジオ2: {
6045
+ type: "RADIO_BUTTON",
6046
+ value: "甲"
6047
+ },
6048
+ リッチ1: {
6049
+ type: "RICH_TEXT",
6050
+ value: ""
6051
+ },
6052
+ 時刻2: {
6053
+ type: "TIME",
6054
+ value: null
6055
+ },
6056
+ カテゴリー: {
6057
+ type: "CATEGORY",
6058
+ value: []
6059
+ },
6060
+ 時刻1: {
6061
+ type: "TIME",
6062
+ value: null
6063
+ },
6064
+ リンク1: {
6065
+ type: "LINK",
6066
+ value: ""
6067
+ },
6068
+ リッチ2: {
6069
+ type: "RICH_TEXT",
6070
+ value: ""
6071
+ },
6072
+ リンク2: {
6073
+ type: "LINK",
6074
+ value: ""
6075
+ },
6076
+ 計算2: {
6077
+ type: "CALC",
6078
+ value: "0"
6079
+ },
6080
+ 計算1: {
6081
+ type: "CALC",
6082
+ value: "0"
6083
+ },
6084
+ 複数選択2: {
6085
+ type: "MULTI_SELECT",
6086
+ value: []
6087
+ },
6088
+ 日時1: {
6089
+ type: "DATETIME",
6090
+ value: ""
6091
+ },
6092
+ 複数選択1: {
6093
+ type: "MULTI_SELECT",
6094
+ value: []
6095
+ },
6096
+ 日時2: {
6097
+ type: "DATETIME",
6098
+ value: ""
6099
+ },
6100
+ 枠内数値1: {
6101
+ type: "NUMBER",
6102
+ value: ""
6103
+ },
6104
+ 作業者: {
6105
+ type: "STATUS_ASSIGNEE",
6106
+ value: []
6107
+ },
6108
+ 作成者: {
6109
+ type: "CREATOR",
6110
+ value: {
6111
+ code: "demo_user01",
6112
+ name: "架空 社長"
6113
+ }
6114
+ },
6115
+ $revision: {
6116
+ type: "__REVISION__",
6117
+ value: "2"
6118
+ },
6119
+ 文字列2: {
6120
+ type: "SINGLE_LINE_TEXT",
6121
+ value: ""
6122
+ },
6123
+ 文字列1: {
6124
+ type: "SINGLE_LINE_TEXT",
6125
+ value: "空のレコード"
6126
+ },
6127
+ 更新日時: {
6128
+ type: "UPDATED_TIME",
6129
+ value: "2026-01-15T00:00:00Z"
6130
+ },
6131
+ 添付1: {
6132
+ type: "FILE",
6133
+ value: []
6134
+ },
6135
+ 添付2: {
6136
+ type: "FILE",
6137
+ value: []
6138
+ },
6139
+ 文字列複数行2: {
6140
+ type: "MULTI_LINE_TEXT",
6141
+ value: ""
6142
+ },
6143
+ 日付1: {
6144
+ type: "DATE",
6145
+ value: null
6146
+ },
6147
+ 枠内文字列1: {
6148
+ type: "SINGLE_LINE_TEXT",
6149
+ value: ""
6150
+ },
6151
+ 文字列複数行1: {
6152
+ type: "MULTI_LINE_TEXT",
6153
+ value: ""
6154
+ },
6155
+ 日付2: {
6156
+ type: "DATE",
6157
+ value: null
6158
+ },
6159
+ 数値2: {
6160
+ type: "NUMBER",
6161
+ value: ""
6162
+ },
6163
+ 数値1: {
6164
+ type: "NUMBER",
6165
+ value: ""
6166
+ },
6167
+ チェック1: {
6168
+ type: "CHECK_BOX",
6169
+ value: []
6170
+ },
6171
+ 作成日時: {
6172
+ type: "CREATED_TIME",
6173
+ value: "2026-01-15T00:00:00Z"
6174
+ },
6175
+ $id: {
6176
+ type: "__ID__",
6177
+ value: "3"
6178
+ }
6179
+ }
6180
+ };
6181
+
6182
+ // src/sample-app.ts
6183
+ var LABELS = {
6184
+ 1: "典型(全項目に値)",
6185
+ 2: "端(0・負の小数・改行・未選択・月末と年末の日付)",
6186
+ 3: "空(ほぼ全部空)"
6187
+ };
6188
+ function sampleRecord(data, id) {
6189
+ 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)`);
6190
+ return { id, label: LABELS[id] ?? "", record: data.record };
6191
+ }
6192
+ var SAMPLE_APP = {
6193
+ fields: fields_default,
6194
+ records: [sampleRecord(record_1_default, 1), sampleRecord(record_2_default, 2), sampleRecord(record_3_default, 3)]
6195
+ };
6196
+ function sampleApp() {
6197
+ return structuredClone(SAMPLE_APP);
6198
+ }
6199
+ var tableRows = (record, code) => {
6200
+ const v = record[code]?.value;
6201
+ return Array.isArray(v) ? v.length : 0;
6202
+ };
6203
+ function describeSampleApp(targetTypes) {
6204
+ const { fields, records } = SAMPLE_APP;
6205
+ const tables = Object.values(fields.properties).filter((p) => p.type === "SUBTABLE").map((p) => p.code).sort();
6206
+ const lines = [
6207
+ `サンプルアプリ「${fields.appName}」(try / fml_try の試し計算に使う架空のアプリ。接続先 ${fields.baseUrl}。利用者のアプリではない)`,
6208
+ summarizeFields(fields),
6209
+ "",
6210
+ "項目(1 項目 1 行。○ = 計算式を設定できる型。テーブルの子は T1_ / T2_ の接頭辞):",
6211
+ listFields(fields, { targetTypes }),
6212
+ "",
6213
+ "レコード(try の records で選ぶ。既定は 3 件とも):",
6214
+ ...records.map((r) => ` ${r.id}: ${r.label}。${tables.map((t) => `${t} ${tableRows(r.record, t)} 行`).join("、")}`),
6215
+ "ユーザー・組織・グループの値は既定のテストデータ(架空の 10 人。demo_user01 …)のコード"
6216
+ ];
6217
+ return lines.join("\n");
6218
+ }
6219
+
6220
+ // src/commands/try-data.ts
6221
+ var TRY_MAX_EXTRA_FIELDS = 20;
6222
+ var TRY_MAX_DATA = 5;
6223
+ var TRY_MAX_TABLE_ROWS = 20;
6224
+ var TRY_MAX_OPTIONS = 50;
6225
+ var TRY_MAX_VALUE_CHARS = 2e3;
6226
+ var TYPE_ALIASES = {
6227
+ TEXT: "SINGLE_LINE_TEXT",
6228
+ STRING: "SINGLE_LINE_TEXT",
6229
+ TEXTAREA: "MULTI_LINE_TEXT",
6230
+ MULTILINE: "MULTI_LINE_TEXT",
6231
+ RICH: "RICH_TEXT",
6232
+ NUM: "NUMBER",
6233
+ DROPDOWN: "DROP_DOWN",
6234
+ RADIO: "RADIO_BUTTON",
6235
+ CHECKBOX: "CHECK_BOX",
6236
+ MULTISELECT: "MULTI_SELECT",
6237
+ USER: "USER_SELECT",
6238
+ ORG: "ORGANIZATION_SELECT",
6239
+ ORGANIZATION: "ORGANIZATION_SELECT",
6240
+ URL: "LINK",
6241
+ TABLE: "SUBTABLE"
6242
+ };
6243
+ var EXTRA_TYPES = [
6244
+ "SINGLE_LINE_TEXT",
6245
+ "MULTI_LINE_TEXT",
6246
+ "RICH_TEXT",
6247
+ "NUMBER",
6248
+ "DATE",
6249
+ "DATETIME",
6250
+ "TIME",
6251
+ "DROP_DOWN",
6252
+ "RADIO_BUTTON",
6253
+ "CHECK_BOX",
6254
+ "MULTI_SELECT",
6255
+ "USER_SELECT",
6256
+ "ORGANIZATION_SELECT",
6257
+ "GROUP_SELECT",
6258
+ "LINK",
6259
+ "SUBTABLE"
6260
+ ];
6261
+ var CHOICE_TYPES = /* @__PURE__ */ new Set(["DROP_DOWN", "RADIO_BUTTON", "CHECK_BOX", "MULTI_SELECT"]);
6262
+ var CODE_RE = /^[\p{L}_・$¥][\p{L}\p{N}_・$¥]{0,127}$/u;
6263
+ function canonicalType(type) {
6264
+ const upper = String(type).trim().toUpperCase();
6265
+ return TYPE_ALIASES[upper] ?? upper;
6266
+ }
6267
+ function propertyOf(code, type, label, options) {
6268
+ const base = { type, code, label, noLabel: false, required: false };
6269
+ const opts = options ? { options: Object.fromEntries(options.map((o, i) => [o, { label: o, index: String(i) }])) } : {};
6270
+ switch (type) {
6271
+ case "NUMBER":
6272
+ return { ...base, minValue: "", maxValue: "", digit: false, unique: false, defaultValue: "", displayScale: "", unit: "", unitPosition: "BEFORE" };
6273
+ case "SINGLE_LINE_TEXT":
6274
+ return { ...base, minLength: "", maxLength: "", expression: "", hideExpression: false, unique: false, defaultValue: "" };
6275
+ case "LINK":
6276
+ return { ...base, protocol: "WEB", minLength: "", maxLength: "", unique: false, defaultValue: "" };
6277
+ case "MULTI_LINE_TEXT":
6278
+ case "RICH_TEXT":
6279
+ return { ...base, defaultValue: "" };
6280
+ case "DATE":
6281
+ case "DATETIME":
6282
+ return { ...base, unique: false, defaultValue: "", defaultNowValue: false };
6283
+ case "TIME":
6284
+ return { ...base, defaultValue: "", defaultNowValue: false };
6285
+ case "DROP_DOWN":
6286
+ return { ...base, ...opts, defaultValue: "" };
6287
+ case "RADIO_BUTTON":
6288
+ return { ...base, ...opts, defaultValue: options?.[0] ?? "", align: "HORIZONTAL" };
6289
+ case "CHECK_BOX":
6290
+ case "MULTI_SELECT":
6291
+ return { ...base, ...opts, defaultValue: [], align: "HORIZONTAL" };
6292
+ case "USER_SELECT":
6293
+ case "ORGANIZATION_SELECT":
6294
+ case "GROUP_SELECT":
6295
+ return { ...base, entities: [], defaultValue: [] };
6296
+ case "SUBTABLE":
6297
+ return { type, code, label, noLabel: false, fields: {} };
6298
+ default:
6299
+ throw new InputError(`項目 ${code} の型 ${type} は足せない(${EXTRA_TYPES.join(", ")})`);
6300
+ }
6301
+ }
6302
+ function layoutTableOf(layout, code) {
6303
+ for (const row of layout) {
6304
+ if (row.type === "SUBTABLE" && row.code === code) return row;
6305
+ if (row.type === "GROUP" && Array.isArray(row.layout)) {
6306
+ const hit = layoutTableOf(row.layout, code);
6307
+ if (hit) return hit;
6308
+ }
6309
+ }
6310
+ return void 0;
6311
+ }
6312
+ var sizeOf = (type) => type === "MULTI_LINE_TEXT" || type === "RICH_TEXT" ? { width: "250", innerHeight: "125" } : { width: "200" };
6313
+ function allCodesOf(fields) {
6314
+ const codes = /* @__PURE__ */ new Set();
6315
+ for (const p of Object.values(fields.properties)) {
6316
+ codes.add(p.code);
6317
+ for (const c of Object.values(p.fields ?? {})) codes.add(c.code);
6318
+ }
6319
+ return codes;
6320
+ }
6321
+ function checkOptions(def, type, where) {
6322
+ if (!CHOICE_TYPES.has(type)) {
6323
+ if (def.options !== void 0) throw new InputError(`${where}: ${type} に options は付けない`);
6324
+ return void 0;
6325
+ }
6326
+ if (!Array.isArray(def.options) || !def.options.length) throw new InputError(`${where}: ${type} には options(選択肢の配列)が要る`);
6327
+ if (def.options.length > TRY_MAX_OPTIONS) throw new InputError(`${where}: options は ${TRY_MAX_OPTIONS} 個まで`);
6328
+ const seen = /* @__PURE__ */ new Set();
6329
+ for (const o of def.options) {
6330
+ if (typeof o !== "string" || !o.trim() || [...o].length > 100) throw new InputError(`${where}: options は空でない文字列(100 文字まで): ${JSON.stringify(o)}`);
6331
+ if (seen.has(o)) throw new InputError(`${where}: options が重複: ${o}`);
6332
+ seen.add(o);
6333
+ }
6334
+ return def.options;
6335
+ }
6336
+ function extendFields(fields, defs) {
6337
+ const out = structuredClone(fields);
6338
+ const codes = allCodesOf(out);
6339
+ const added = [];
6340
+ let count = 0;
6341
+ const describe = (type, options, children) => `${type}${options ? `: ${options.join(" / ")}` : ""}${children ? `: ${children.join(", ")}` : ""}`;
6342
+ const takeCode = (def, where) => {
6343
+ if (typeof def.code !== "string" || !CODE_RE.test(def.code)) throw new InputError(`${where}: code はフィールドコード(文字・数字・_ で、数字で始まらない。128 文字まで): ${JSON.stringify(def.code)}`);
6344
+ if (codes.has(def.code)) throw new InputError(`${where}: ${def.code} は既にある項目(標本の項目と重ならないコードにする)`);
6345
+ if (++count > TRY_MAX_EXTRA_FIELDS) throw new InputError(`足す項目は ${TRY_MAX_EXTRA_FIELDS} 個まで(テーブルの子も数える)`);
6346
+ codes.add(def.code);
6347
+ return def.code;
6348
+ };
6349
+ const labelOf = (def, where) => {
6350
+ if (def.label !== void 0 && (typeof def.label !== "string" || [...def.label].length > 128)) throw new InputError(`${where}: label は 128 文字まで`);
6351
+ return def.label ?? def.code;
6352
+ };
6353
+ defs.forEach((def, i) => {
6354
+ const where = `fields[${i}]`;
6355
+ if (!def || typeof def !== "object") throw new InputError(`${where}: 項目はオブジェクト({ code, type, options?, table?, fields? })`);
6356
+ const type = canonicalType(def.type ?? "");
6357
+ if (!EXTRA_TYPES.includes(type)) throw new InputError(`${where}: 型 ${JSON.stringify(def.type)} は足せない(${EXTRA_TYPES.join(", ")})`);
6358
+ if (def.table !== void 0 && type === "SUBTABLE") throw new InputError(`${where}: テーブルの中にテーブルは置けない(table と type SUBTABLE は一緒に書かない)`);
6359
+ if (def.fields !== void 0 && type !== "SUBTABLE") throw new InputError(`${where}: fields(子)は type SUBTABLE のときだけ`);
6360
+ const code = takeCode(def, where);
6361
+ const label = labelOf(def, where);
6362
+ const options = checkOptions(def, type, where);
6363
+ if (def.table !== void 0) {
6364
+ const parent = out.properties[def.table];
6365
+ if (!parent || parent.type !== "SUBTABLE") throw new InputError(`${where}: table ${JSON.stringify(def.table)} はテーブルでない(標本のテーブル1 / テーブル2 か、先に足したテーブル)`);
6366
+ parent.fields ??= {};
6367
+ parent.fields[code] = propertyOf(code, type, label, options);
6368
+ const slot = layoutTableOf(out.layout, def.table);
6369
+ if (!slot) throw new InputError(`${where}: テーブル ${def.table} がレイアウトに無い`);
6370
+ slot.fields ??= [];
6371
+ slot.fields.push({ type, code, size: sizeOf(type) });
6372
+ added.push(`${code}(${describe(type, options)}。${def.table} の子)`);
6373
+ return;
6374
+ }
6375
+ if (type === "SUBTABLE") {
6376
+ if (!Array.isArray(def.fields) || !def.fields.length) throw new InputError(`${where}: SUBTABLE には fields(子の配列。1 つ以上)が要る`);
6377
+ const table = propertyOf(code, type, label, void 0);
6378
+ const slot = { type: "SUBTABLE", code, fields: [] };
6379
+ const names = [];
6380
+ def.fields.forEach((child, j) => {
6381
+ const cw = `${where}.fields[${j}]`;
6382
+ if (!child || typeof child !== "object") throw new InputError(`${cw}: 子はオブジェクト({ code, type, options? })`);
6383
+ const ct = canonicalType(child.type ?? "");
6384
+ if (!EXTRA_TYPES.includes(ct) || ct === "SUBTABLE") throw new InputError(`${cw}: 型 ${JSON.stringify(child.type)} はテーブルの子にできない`);
6385
+ if (child.table !== void 0 || child.fields !== void 0) throw new InputError(`${cw}: 子に table / fields は書けない`);
6386
+ const cc = takeCode(child, cw);
6387
+ table.fields[cc] = propertyOf(cc, ct, labelOf(child, cw), checkOptions(child, ct, cw));
6388
+ slot.fields.push({ type: ct, code: cc, size: sizeOf(ct) });
6389
+ names.push(cc);
6390
+ });
6391
+ out.properties[code] = table;
6392
+ out.layout.push(slot);
6393
+ added.push(`${code}(${describe(type, void 0, names)})`);
6394
+ return;
6395
+ }
6396
+ out.properties[code] = propertyOf(code, type, label, options);
6397
+ out.layout.push({ type: "ROW", fields: [{ type, code, size: sizeOf(type) }] });
6398
+ added.push(`${code}(${describe(type, options)})`);
6399
+ });
6400
+ return { fields: out, added };
6401
+ }
6402
+ function normalizeDefaults(fields) {
6403
+ const out = structuredClone(fields);
6404
+ const fix = (p) => {
6405
+ if (p.type === "SUBTABLE") {
6406
+ for (const c of Object.values(p.fields ?? {})) fix(c);
6407
+ return;
6408
+ }
6409
+ 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;
6410
+ const arrayType = /^(CHECK_BOX|MULTI_SELECT|USER_SELECT|ORGANIZATION_SELECT|GROUP_SELECT)$/.test(p.type);
6411
+ if (arrayType) {
6412
+ if (!Array.isArray(p.defaultValue)) p.defaultValue = [];
6413
+ } else if (p.defaultValue === void 0 || p.defaultValue === null) p.defaultValue = "";
6414
+ };
6415
+ for (const p of Object.values(out.properties)) fix(p);
6416
+ return out;
6417
+ }
6418
+ function emptyValueOf(type) {
6419
+ switch (type) {
6420
+ case "CHECK_BOX":
6421
+ case "MULTI_SELECT":
6422
+ case "USER_SELECT":
6423
+ case "ORGANIZATION_SELECT":
6424
+ case "GROUP_SELECT":
6425
+ case "FILE":
6426
+ case "STATUS_ASSIGNEE":
6427
+ case "CATEGORY":
6428
+ case "SUBTABLE":
6429
+ return [];
6430
+ case "CREATOR":
6431
+ case "MODIFIER":
6432
+ return { code: "", name: "" };
6433
+ default:
6434
+ return "";
6435
+ }
6436
+ }
6437
+ var NO_VALUE_TYPES = /* @__PURE__ */ new Set(["GROUP", "REFERENCE_TABLE", "LABEL", "SPACER", "HR"]);
6438
+ function emptyRecordOf(fields, id) {
6439
+ const rec = { $id: { type: "__ID__", value: id }, $revision: { type: "__REVISION__", value: "1" } };
6440
+ for (const p of Object.values(fields.properties)) {
6441
+ if (NO_VALUE_TYPES.has(p.type)) continue;
6442
+ const value = p.type === "RECORD_NUMBER" ? id : p.type === "CREATED_TIME" || p.type === "UPDATED_TIME" ? "2026-01-15T00:00:00Z" : emptyValueOf(p.type);
6443
+ rec[p.code] = { type: p.type, value };
6444
+ }
6445
+ return rec;
6446
+ }
6447
+ function fillMissing(fields, record) {
6448
+ const out = structuredClone(record);
6449
+ for (const p of Object.values(fields.properties)) {
6450
+ if (NO_VALUE_TYPES.has(p.type)) continue;
6451
+ if (!(p.code in out)) out[p.code] = { type: p.type, value: emptyValueOf(p.type) };
6452
+ if (p.type === "SUBTABLE") {
6453
+ const rows = out[p.code].value;
6454
+ if (Array.isArray(rows)) {
6455
+ for (const row of rows) {
6456
+ row.value ??= {};
6457
+ 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) };
6458
+ }
6459
+ }
6460
+ }
6461
+ }
6462
+ return out;
6463
+ }
6464
+ var NUMBER_RE = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
6465
+ var DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
6466
+ var TIME_RE = /^\d{2}:\d{2}$/;
6467
+ var DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(Z|[+-]\d{2}:\d{2})$/;
6468
+ var isEmpty = (v) => v === "" || v === null || v === void 0;
6469
+ function text(v, where) {
6470
+ if (isEmpty(v)) return "";
6471
+ if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
6472
+ const s = String(v);
6473
+ if ([...s].length > TRY_MAX_VALUE_CHARS) throw new InputError(`${where}: 文字列は ${TRY_MAX_VALUE_CHARS} 文字まで`);
6474
+ return s;
6475
+ }
6476
+ throw new InputError(`${where}: 文字列を書く(${JSON.stringify(v).slice(0, 40)})`);
6477
+ }
6478
+ function codeList(v, where, kind, users) {
6479
+ if (isEmpty(v)) return [];
6480
+ const list = Array.isArray(v) ? v : [v];
6481
+ const table = kind === "org" ? users?.orgCodes : kind === "group" ? users?.groupCodes : users?.userCodes;
6482
+ return list.map((e, i) => {
6483
+ const code = typeof e === "string" ? e : e && typeof e === "object" && typeof e.code === "string" ? e.code : void 0;
6484
+ if (code === void 0 || !code.trim() || [...code].length > 128) throw new InputError(`${where}[${i}]: コード(文字列)か { code, name? } を書く`);
6485
+ const given = e && typeof e === "object" ? e.name : void 0;
6486
+ const name = typeof given === "string" ? given : typeof table?.[code]?.name === "string" ? String(table[code].name) : code;
6487
+ return { code, name };
6488
+ });
6489
+ }
6490
+ function stringList(v, where, options) {
6491
+ if (isEmpty(v)) return [];
6492
+ const list = Array.isArray(v) ? v : [v];
6493
+ return list.map((e, i) => {
6494
+ if (typeof e !== "string") throw new InputError(`${where}[${i}]: 文字列を書く`);
6495
+ if (options && !(e in options)) throw new InputError(`${where}[${i}]: 選択肢に無い値 ${JSON.stringify(e)}(${Object.keys(options).join(" / ")})`);
6496
+ return e;
6497
+ });
6498
+ }
6499
+ function convertValue(prop, v, where, users) {
6500
+ const options = prop.options;
6501
+ switch (prop.type) {
6502
+ case "NUMBER": {
6503
+ if (isEmpty(v)) return "";
6504
+ if (typeof v === "number") {
6505
+ if (!Number.isFinite(v)) throw new InputError(`${where}: NUMBER は有限の数`);
6506
+ return String(v);
6507
+ }
6508
+ if (typeof v === "string" && NUMBER_RE.test(v.trim())) return v.trim();
6509
+ throw new InputError(`${where}: NUMBER は数か数字の文字列(${JSON.stringify(v).slice(0, 40)})`);
6510
+ }
6511
+ case "SINGLE_LINE_TEXT":
6512
+ case "MULTI_LINE_TEXT":
6513
+ case "RICH_TEXT":
6514
+ case "LINK":
6515
+ case "CALC":
6516
+ case "STATUS":
6517
+ case "RECORD_NUMBER":
6518
+ case "__ID__":
6519
+ case "__REVISION__":
6520
+ return text(v, where);
6521
+ case "DATE": {
6522
+ const s = text(v, where);
6523
+ if (s && !DATE_RE.test(s)) throw new InputError(`${where}: DATE は "YYYY-MM-DD"(${JSON.stringify(s)})`);
6524
+ return s;
6525
+ }
6526
+ case "TIME": {
6527
+ const s = text(v, where);
6528
+ if (s && !TIME_RE.test(s)) throw new InputError(`${where}: TIME は "HH:mm"(${JSON.stringify(s)})`);
6529
+ return s;
6530
+ }
6531
+ case "DATETIME":
6532
+ case "CREATED_TIME":
6533
+ case "UPDATED_TIME": {
6534
+ const s = text(v, where);
6535
+ if (s && !DATETIME_RE.test(s)) throw new InputError(`${where}: ${prop.type} は "YYYY-MM-DDTHH:mm:ssZ"(${JSON.stringify(s)})`);
6536
+ return s;
6537
+ }
6538
+ case "DROP_DOWN":
6539
+ case "RADIO_BUTTON": {
6540
+ const s = text(v, where);
6541
+ if (s && options && !(s in options)) throw new InputError(`${where}: 選択肢に無い値 ${JSON.stringify(s)}(${Object.keys(options).join(" / ")})`);
6542
+ return s;
6543
+ }
6544
+ case "CHECK_BOX":
6545
+ case "MULTI_SELECT":
6546
+ return stringList(v, where, options);
6547
+ case "CATEGORY":
6548
+ return stringList(v, where, void 0);
6549
+ case "USER_SELECT":
6550
+ case "STATUS_ASSIGNEE":
6551
+ return codeList(v, where, "user", users);
6552
+ case "ORGANIZATION_SELECT":
6553
+ return codeList(v, where, "org", users);
6554
+ case "GROUP_SELECT":
6555
+ return codeList(v, where, "group", users);
6556
+ case "CREATOR":
6557
+ case "MODIFIER": {
6558
+ const one = codeList(v, where, "user", users);
6559
+ if (one.length !== 1) throw new InputError(`${where}: ${prop.type} はユーザーのコード 1 つ`);
6560
+ return one[0];
6561
+ }
6562
+ case "FILE": {
6563
+ if (isEmpty(v)) return [];
6564
+ const list = Array.isArray(v) ? v : [v];
6565
+ return list.map((e, i) => {
6566
+ const name = typeof e === "string" ? e : e && typeof e === "object" && typeof e.name === "string" ? e.name : void 0;
6567
+ if (name === void 0 || !name.trim() || [...name].length > 255) throw new InputError(`${where}[${i}]: ファイルは名前(文字列)か { name, size? }`);
6568
+ const size = e && typeof e === "object" && e.size !== void 0 ? String(e.size) : "0";
6569
+ return { contentType: "application/octet-stream", fileKey: "", name, size };
6570
+ });
6571
+ }
6572
+ case "SUBTABLE":
6573
+ throw new InputError(`${where}: テーブルは行の配列([{ 子のコード: 値, … }])`);
6574
+ default:
6575
+ if (NO_VALUE_TYPES.has(prop.type)) throw new InputError(`${where}: ${prop.type} は値を持たない`);
6576
+ throw new InputError(`${where}: 型 ${prop.type} の値は書けない`);
6577
+ }
6578
+ }
6579
+ function applyData(fields, base, data, where, users) {
6580
+ if (!data || typeof data !== "object" || Array.isArray(data)) throw new InputError(`${where}: レコードはオブジェクト({ 項目コード: 値, … })`);
6581
+ const rec = fillMissing(fields, base);
6582
+ const children = /* @__PURE__ */ new Map();
6583
+ for (const p of Object.values(fields.properties)) for (const c of Object.values(p.fields ?? {})) children.set(c.code, p.code);
6584
+ for (const [code, v] of Object.entries(data)) {
6585
+ const w = `${where}.${code}`;
6586
+ const prop = fields.properties[code];
6587
+ if (!prop) {
6588
+ if (children.has(code)) throw new InputError(`${w}: テーブルの子はテーブルの行の中に書く(${children.get(code)}: [{ ${code}: … }])`);
6589
+ throw new InputError(`${w}: 無い項目(標本に無ければ fields で足す。項目の一覧は describe)`);
6590
+ }
6591
+ if (NO_VALUE_TYPES.has(prop.type)) throw new InputError(`${w}: ${prop.type} は値を持たない`);
6592
+ if (prop.type === "SUBTABLE") {
6593
+ if (isEmpty(v)) {
6594
+ rec[code] = { type: "SUBTABLE", value: [] };
6595
+ continue;
6596
+ }
6597
+ if (!Array.isArray(v)) throw new InputError(`${w}: テーブルは行の配列([{ 子のコード: 値, … }])`);
6598
+ if (v.length > TRY_MAX_TABLE_ROWS) throw new InputError(`${w}: テーブルの行は ${TRY_MAX_TABLE_ROWS} 行まで`);
6599
+ const kids = prop.fields ?? {};
6600
+ const rows = v.map((row, i) => {
6601
+ const rw = `${w}[${i}]`;
6602
+ if (!row || typeof row !== "object" || Array.isArray(row)) throw new InputError(`${rw}: 行はオブジェクト({ 子のコード: 値, … })`);
6603
+ const value = {};
6604
+ for (const c of Object.values(kids)) value[c.code] = { type: c.type, value: emptyValueOf(c.type) };
6605
+ for (const [cc, cv] of Object.entries(row)) {
6606
+ const child = kids[cc];
6607
+ if (!child) throw new InputError(`${rw}.${cc}: テーブル ${code} に無い子(${Object.keys(kids).join(", ")})`);
6608
+ value[cc] = { type: child.type, value: convertValue(child, cv, `${rw}.${cc}`, users) };
6609
+ }
6610
+ return { id: String(i + 1), value };
6611
+ });
6612
+ rec[code] = { type: "SUBTABLE", value: rows };
6613
+ continue;
6614
+ }
6615
+ rec[code] = { type: prop.type, value: convertValue(prop, v, w, users) };
6616
+ }
6617
+ return rec;
6618
+ }
6619
+ function checkDataList(data) {
6620
+ if (!Array.isArray(data)) throw new InputError("data はレコード({ 項目コード: 値 })の配列");
6621
+ if (!data.length) throw new InputError("data が空");
6622
+ if (data.length > TRY_MAX_DATA) throw new InputError(`data は ${TRY_MAX_DATA} 件まで`);
6623
+ const bytes = Buffer.byteLength(JSON.stringify(data), "utf8");
6624
+ if (bytes > 64 * 1024) throw new InputError(`data が大きすぎる(${bytes.toLocaleString()} バイト。64 KiB まで)`);
6625
+ return data;
6626
+ }
6627
+
6628
+ // src/commands/try.ts
6629
+ var TRY_MAX_FORMULAS = 10;
6630
+ var TRY_MAX_FORMULA_CHARS = 4e3;
6631
+ var TRY_DEFAULT_AS = "TEXT";
6632
+ var TRY_OWN_RULES = /* @__PURE__ */ new Set(["misc.changed", "fieldno.screen", "size.bytes", "schema.derived"]);
6633
+ var isTable2 = (v) => Array.isArray(v) && v.every((r) => r && typeof r === "object" && "value" in r);
6634
+ function resolveTryTarget(fields, targetTypes, as, table, referenced = /* @__PURE__ */ new Set()) {
6635
+ const props = fields.properties;
6636
+ const tables = Object.values(props).filter((p) => p.type === "SUBTABLE").map((p) => p.code).sort();
6637
+ const want = (as ?? TRY_DEFAULT_AS).trim();
6638
+ if (!want) throw new InputError("as が空(型 NUMBER / TEXT / DATE … か項目コード)");
6639
+ const upper = want.toUpperCase();
6640
+ const type = TYPE_ALIASES[upper] ?? (targetTypes.has(upper) ? upper : void 0);
6641
+ let scope = props;
6642
+ let tableCode;
6643
+ if (table !== void 0) {
6644
+ const t = props[table];
6645
+ if (!t || t.type !== "SUBTABLE") throw new InputError(`table ${JSON.stringify(table)} はサンプルアプリのテーブルでない(${tables.join(" / ")})`);
6646
+ scope = t.fields ?? {};
6647
+ tableCode = table;
6648
+ }
6649
+ const byCode = (code, p, inTable) => {
6650
+ if (!targetTypes.has(p.type)) throw new InputError(`${code} の型 ${p.type} には計算式を設定できない(使える型: ${[...targetTypes].join(", ")})`);
6651
+ return { code, type: p.type, ...inTable ? { table: inTable } : {} };
6652
+ };
6653
+ if (Object.prototype.hasOwnProperty.call(scope, want)) return byCode(want, scope[want], tableCode);
6654
+ if (tableCode === void 0) {
6655
+ for (const t of tables) {
6656
+ const child = props[t].fields?.[want];
6657
+ if (child) return byCode(want, child, t);
6658
+ }
6659
+ }
6660
+ if (!type) {
6661
+ const all2 = /* @__PURE__ */ new Set();
6662
+ for (const p of Object.values(props)) {
6663
+ all2.add(p.type);
6664
+ for (const c of Object.values(p.fields ?? {})) all2.add(c.type);
6665
+ }
6666
+ if (all2.has(upper)) throw new InputError(`${upper} の項目には計算式を設定できない(使える型: ${[...targetTypes].join(", ")})`);
6667
+ throw new InputError(`as ${JSON.stringify(want)} は型でも項目コードでもない(型: ${[...targetTypes].join(", ")}。項目は try --describe / fml_try の describe で)`);
6668
+ }
6669
+ 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));
6670
+ if (!candidates.length) throw new InputError(`${tableCode ? `テーブル ${tableCode} の中` : "サンプルアプリ"}に ${type} の項目が無い`);
6671
+ const free = candidates.find((p) => !referenced.has(p.code)) ?? candidates[0];
6672
+ return { code: free.code, type, ...tableCode ? { table: tableCode } : {} };
6673
+ }
6674
+ function buildTryEnvelope(engine, fields, code, formula, lang) {
6675
+ const api = engine.api;
6676
+ const source = api.defaultSource(lang);
6677
+ return {
6678
+ date: "2026-01-15 00:00:00",
6679
+ pluginName: "計算式プラグイン",
6680
+ pluginID: api.pluginId,
6681
+ PluginVersion: engine.source.pluginVersion,
6682
+ appId: fields.appId,
6683
+ appName: fields.appName,
6684
+ ...source,
6685
+ toolEnable: true,
6686
+ pluginMiscInfo: { ...source.pluginMiscInfo, circular_refer: true },
6687
+ pluginInfos: [{ fieldcode: code, state: true, formulaSet: formula, edit: false, hide: false, rank: "" }]
6688
+ };
6689
+ }
6690
+ function plain(v) {
6691
+ try {
6692
+ const s = JSON.stringify(v);
6693
+ return s === void 0 ? v === void 0 ? null : String(v) : JSON.parse(s);
6694
+ } catch {
6695
+ return String(v);
6696
+ }
6697
+ }
6698
+ function rawValueOf(engine, pp, record, formula, target, evType, event) {
6699
+ const api = engine.api;
6700
+ const run = (kf2) => {
6701
+ try {
6702
+ return plain(quiet(() => kf2.dq(formula)));
6703
+ } catch {
6704
+ return null;
6705
+ }
6706
+ };
6707
+ const kf = api.createRunner(pp, record, evType ?? "allUpdate", event);
6708
+ if (!target.table) {
6709
+ kf.initTableInfo("");
6710
+ return run(kf);
6711
+ }
6712
+ const rows = record[target.table];
6713
+ const list = Array.isArray(rows?.value) ? rows.value : [];
6714
+ kf.initTableInfo(target.table);
6715
+ return list.map((_r, i) => {
6716
+ kf.currRow(i);
6717
+ return run(kf);
6718
+ });
6719
+ }
6720
+ var short2 = (v) => {
6721
+ const s = JSON.stringify(v);
6722
+ return s === void 0 ? "undefined" : [...s].length > 200 ? [...s].slice(0, 200).join("") + "…" : s;
6723
+ };
6724
+ async function trySettings(input) {
6725
+ const { engine } = input;
6726
+ const api = engine.api;
6727
+ const lang = input.lang ?? "ja";
6728
+ if (!Array.isArray(input.formulas) || !input.formulas.length) throw new InputError("式が無い(formulas)");
6729
+ if (input.formulas.length > TRY_MAX_FORMULAS) throw new InputError(`式は 1 回 ${TRY_MAX_FORMULAS} 個まで(${input.formulas.length})`);
6730
+ const app = sampleApp();
6731
+ const source = input.appFields ? "app" : "sample";
6732
+ let fields = input.appFields ? normalizeDefaults(input.appFields) : app.fields;
6733
+ let extraFields = [];
6734
+ if (input.fields !== void 0) {
6735
+ if (!Array.isArray(input.fields)) throw new InputError("fields は項目({ code, type, options?, table?, fields? })の配列");
6736
+ const ext = extendFields(fields, input.fields);
6737
+ fields = ext.fields;
6738
+ extraFields = ext.added;
6739
+ }
6740
+ const picked = [];
6741
+ if (input.appFields) {
6742
+ if (input.records !== void 0) throw new InputError("appFields(利用者のアプリの項目定義)のときは標本のレコード(records)は使えない(data で架空の値を書く)");
6743
+ if (input.data === void 0) throw new InputError("appFields(利用者のアプリの項目定義)には data(架空の値のレコード)が要る");
6744
+ } else {
6745
+ const ids2 = input.records === void 0 ? input.data === void 0 ? app.records.map((r) => r.id) : [] : [...new Set(input.records)];
6746
+ if (!ids2.length && input.data === void 0) throw new InputError("records が空(1〜3)");
6747
+ for (const id of ids2) if (!app.records.some((r) => r.id === id)) throw new InputError(`records は 1〜${app.records.length}(${id})`);
6748
+ for (const id of ids2) {
6749
+ const r = app.records.find((x) => x.id === id);
6750
+ picked.push({ id: String(id), label: r.label, record: extraFields.length ? fillMissing(fields, r.record) : r.record });
6751
+ }
6752
+ }
6753
+ if (input.data !== void 0) {
6754
+ const list = checkDataList(input.data);
6755
+ let base;
6756
+ if (input.appFields) base = emptyRecordOf(fields, "0");
6757
+ else {
6758
+ const b = input.base ?? 3;
6759
+ const br = app.records.find((x) => x.id === b);
6760
+ if (!br) throw new InputError(`base は標本のレコードの番号(1〜${app.records.length}): ${b}`);
6761
+ base = br.record;
6762
+ }
6763
+ list.forEach((d, i) => {
6764
+ const id = `d${i + 1}`;
6765
+ const rec = applyData(fields, base, d, `data[${i}]`, input.usersInfo);
6766
+ rec.$id = { type: "__ID__", value: String(100 + i + 1) };
6767
+ if (fields.properties["レコード番号"]?.type === "RECORD_NUMBER" && input.appFields) rec["レコード番号"] = { type: "RECORD_NUMBER", value: String(100 + i + 1) };
6768
+ picked.push({ id, label: `架空の値(${Object.keys(d).join(", ") || "空"})`, record: rec });
6769
+ });
6770
+ }
6771
+ if (!picked.length) throw new InputError("計算するレコードが無い(records か data)");
6772
+ const targetTypes = new Set(api.TARGET_TYPES);
6773
+ const policy = { ...input.policy ?? DEFAULT_POLICY, allowMiscChanges: true };
6774
+ let contextLine = "";
6775
+ let calcNotice = "";
6776
+ const results = [];
6777
+ for (let i = 0; i < input.formulas.length; i++) {
6778
+ const f = input.formulas[i];
6779
+ const where = `try[${i + 1}]`;
6780
+ const res = { index: i + 1, formula: typeof f?.formula === "string" ? f.formula : "", status: "ok", findings: [], values: [], marks: [] };
6781
+ results.push(res);
6782
+ const fail = (rule, message) => {
6783
+ res.status = "invalid";
6784
+ res.findings.push({ level: "error", rule, where, message });
6785
+ };
6786
+ if (!f || typeof f.formula !== "string" || !f.formula.trim()) {
6787
+ fail("try.formula", "式が空");
6788
+ continue;
6789
+ }
6790
+ if ([...f.formula].length > TRY_MAX_FORMULA_CHARS) {
6791
+ fail("try.formula", `式が長すぎる(${TRY_MAX_FORMULA_CHARS} 文字まで)`);
6792
+ continue;
6793
+ }
6794
+ let target;
6795
+ const referenced = scanFormula(api.stripFormula(f.formula)).identifiers;
6796
+ try {
6797
+ target = resolveTryTarget(fields, targetTypes, f.as, f.table, referenced);
6798
+ } catch (e) {
6799
+ if (e instanceof InputError) {
6800
+ fail("try.target", e.message);
6801
+ continue;
6802
+ }
6803
+ throw e;
6804
+ }
6805
+ res.target = target;
6806
+ 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 で式が使わない項目を選ぶ)` });
6807
+ const envelope = buildTryEnvelope(engine, fields, target.code, f.formula, lang);
6808
+ const n = await normalizeSettings({
6809
+ settingsText: JSON.stringify(envelope),
6810
+ settingsFile: where,
6811
+ fields,
6812
+ engine,
6813
+ policy,
6814
+ lang,
6815
+ usersInfo: input.usersInfo,
6816
+ usersLabel: input.usersLabel,
6817
+ usersOrigin: input.usersOrigin.kind === "none" ? void 0 : input.usersOrigin
6818
+ });
6819
+ res.findings.push(...n.findings.items.filter((x) => !TRY_OWN_RULES.has(x.rule)));
6820
+ if (n.findings.hasErrors || !n.saved) {
6821
+ res.status = "invalid";
6822
+ continue;
6823
+ }
6824
+ const stripped = String(n.saved.pluginFields[0]?.formula ?? "");
6825
+ const records = picked.map((r) => ({ id: r.id, record: structuredClone(r.record), fileAppId: fields.appId }));
6826
+ let c;
6827
+ try {
6828
+ c = calcSettings({
6829
+ normalized: n,
6830
+ engine,
6831
+ fields,
6832
+ appId: fields.appId,
6833
+ records,
6834
+ evType: input.evType,
6835
+ event: input.event,
6836
+ mobile: input.mobile,
6837
+ user: input.user,
6838
+ usersInfo: input.usersInfo,
6839
+ usersOrigin: input.usersOrigin,
6840
+ allowDefaultBaseUrl: true
6841
+ });
6842
+ } catch (e) {
6843
+ if (e instanceof InputError) {
6844
+ fail("calc.context", e.message);
6845
+ continue;
6846
+ }
6847
+ throw e;
6848
+ }
6849
+ contextLine ||= c.contextLine;
6850
+ calcNotice ||= c.notice;
6851
+ const lineCode = target.table ?? target.code;
6852
+ for (const r of c.records) {
6853
+ const line = r.lines.find((l) => l.fieldcode === lineCode);
6854
+ let value = line?.after;
6855
+ if (target.table && isTable2(value)) value = value.map((row) => row.value?.[target.code]?.value);
6856
+ 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}`);
6857
+ const v = { record: r.id, value, ...errs.length ? { error: errs.join(" / ") } : {}, ...r.failed ? { failed: true } : {} };
6858
+ if (!r.failed && !errs.length) {
6859
+ const src = picked.find((p) => p.id === r.id);
6860
+ engine.clearSinkCalls();
6861
+ const raw = src ? rawValueOf(engine, n.saved.pluginPP, structuredClone(src.record), stripped, target, input.evType, input.event) : void 0;
6862
+ if (engine.sinkCalls().length) {
6863
+ v.failed = true;
6864
+ v.error = `実行時の sink が呼ばれた(生の値の評価): ${engine.sinkCalls().map((s) => `${s.sink} ${s.detail}`.trim()).join(", ")}`;
6865
+ } else if (raw !== void 0 && JSON.stringify(raw) !== JSON.stringify(value)) v.raw = raw;
6866
+ engine.clearSinkCalls();
6867
+ }
6868
+ res.values.push(v);
6869
+ if (line) res.marks = line.marks;
6870
+ if (v.failed) res.status = "failed";
6871
+ }
6872
+ }
6873
+ const okCount = results.filter((r) => r.status === "ok").length;
6874
+ const ids = picked.map((r) => r.id);
6875
+ const appLabel = source === "sample" ? `サンプルアプリ「${fields.appName}」` : `アプリ ${fields.appId}「${fields.appName}」の項目定義(値は架空)`;
6876
+ const summary = `試し計算 ${results.length} 式: ok ${okCount}${results.length - okCount ? `、エラー ${results.length - okCount}` : ""}(${appLabel}、レコード ${ids.join(", ")})`;
6877
+ if (!contextLine) contextLine = `文脈: アプリ ${fields.appId}(計算していない式だけ)`;
6878
+ const notice = `${source === "sample" ? "サンプルアプリ(架空)での模擬。利用者のアプリ・レコードは使っていない" : "利用者のアプリの項目定義に架空の値を当てた模擬。レコードは更新していない"}${calcNotice ? `。${calcNotice}` : ""}`;
6879
+ const text2 = [summary, notice, contextLine];
6880
+ if (extraFields.length) text2.push(`足した項目(架空): ${extraFields.join("、")}`);
6881
+ for (const r of picked) if (r.id.startsWith("d")) text2.push(`レコード ${r.id}: ${r.label}`);
6882
+ for (const r of results) {
6883
+ const head = r.target ? `${r.target.code}(${r.target.type}${r.target.table ? `。${r.target.table} の中` : ""})← ` : "";
6884
+ text2.push(`[${r.index}] ${head}${r.formula.replace(/\s*\n\s*/g, " ")}`);
6885
+ 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)" : ""}`);
6886
+ if (r.marks.length) text2.push(` 印: ${r.marks.join("、")}`);
6887
+ for (const f of r.findings) if (f.level !== "info") text2.push(` ${f.level === "error" ? "エラー" : "警告"} ${f.rule}: ${f.message}`);
6888
+ }
6889
+ 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") };
6890
+ }
6891
+
3218
6892
  // src/commands/save.ts
3219
6893
  import { createHash as createHash4 } from "node:crypto";
3220
6894
  import { existsSync as existsSync8, mkdirSync as mkdirSync2, readFileSync as readFileSync10, renameSync as renameSync3, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
@@ -3248,6 +6922,31 @@ async function runEvalJob(job) {
3248
6922
  if (job.baseUrl) engine.setContext({ baseUrl: job.baseUrl });
3249
6923
  const usersInfo = buildUsersInfo(job.usersSource);
3250
6924
  const usersLabel = job.usersOrigin.kind === "file" ? job.usersOrigin.file : "既定のテストデータ(架空)";
6925
+ if (job.kind === "try") {
6926
+ if (!job.try) throw new InputError("try の仕事に式が無い(try.formulas)");
6927
+ const t = job.try;
6928
+ const r = await trySettings({
6929
+ engine,
6930
+ formulas: t.formulas,
6931
+ records: t.records,
6932
+ fields: t.fields,
6933
+ data: t.data,
6934
+ base: t.base,
6935
+ appFields: t.appFields,
6936
+ evType: t.evType,
6937
+ event: t.event,
6938
+ mobile: t.mobile,
6939
+ user: t.user,
6940
+ usersInfo,
6941
+ usersOrigin: job.usersOrigin,
6942
+ usersLabel,
6943
+ policy: job.policy,
6944
+ lang: job.lang
6945
+ });
6946
+ const warnings = r.results.reduce((n, x) => n + x.findings.filter((f) => f.level === "warning").length, 0);
6947
+ return { normalize: { summary: r.summary, hasErrors: r.results.some((x) => x.status !== "ok"), warnings, findings: [] }, try: r, engineWarnings: [...engine.warnings] };
6948
+ }
6949
+ if (job.settingsText === void 0 || job.settingsFile === void 0 || !job.fields) throw new InputError(`${job.kind} の仕事に設定か項目定義が無い(settingsText / settingsFile / fields)`);
3251
6950
  const res = await normalizeSettings({
3252
6951
  settingsText: job.settingsText,
3253
6952
  settingsFile: job.settingsFile,
@@ -3368,8 +7067,8 @@ async function runEval(job, opt = {}) {
3368
7067
  var MAX_SAVE_INPUT_BYTES = 256 * 1024;
3369
7068
  var MAX_UPDATE_ROWS = 50;
3370
7069
  var COMMON_KEYS2 = ["pluginEnable", "pluginProductEnv", "toolEnable", "pluginComment", "pluginDescription", "pluginBtnInfo", "pluginListInfo", "authority", "pluginMiscInfo"];
3371
- function digestOf(text) {
3372
- return createHash4("sha256").update(text).digest("hex");
7070
+ function digestOf(text2) {
7071
+ return createHash4("sha256").update(text2).digest("hex");
3373
7072
  }
3374
7073
  var rel = (root, abs) => path14.relative(root, abs).replace(/\\/g, "/");
3375
7074
  var SaveDenied = class extends Error {
@@ -3377,15 +7076,15 @@ var SaveDenied = class extends Error {
3377
7076
  var ConflictError = class extends Error {
3378
7077
  };
3379
7078
  var isPlainObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
3380
- function parseInput(text, what) {
7079
+ function parseInput(text2, what) {
3381
7080
  try {
3382
- return JSON.parse(text);
7081
+ return JSON.parse(text2);
3383
7082
  } catch (e) {
3384
7083
  throw new InputError(`${what} を JSON として読めない${jsonErrorWhere(e)}(中身は返さない)`);
3385
7084
  }
3386
7085
  }
3387
- function tooLarge(text) {
3388
- return Buffer.byteLength(text, "utf8") > MAX_SAVE_INPUT_BYTES;
7086
+ function tooLarge(text2) {
7087
+ return Buffer.byteLength(text2, "utf8") > MAX_SAVE_INPUT_BYTES;
3389
7088
  }
3390
7089
  function fieldsFileFor(ctx, target, fields, envelope) {
3391
7090
  const folder = appFolderOfFile(ctx.root, target);
@@ -3404,7 +7103,7 @@ function fieldsFileFor(ctx, target, fields, envelope) {
3404
7103
  if (!existsSync8(file)) throw new InputError(`項目定義のファイルが無い: ${rel(ctx.root, file)}(fields コマンドか fml_fields で取る)`);
3405
7104
  return file;
3406
7105
  }
3407
- async function normalizeText(ctx, target, text, fieldsFile) {
7106
+ async function normalizeText(ctx, target, text2, fieldsFile) {
3408
7107
  const job = {
3409
7108
  kind: "normalize",
3410
7109
  pluginZip: ctx.source.pluginZip,
@@ -3412,7 +7111,7 @@ async function normalizeText(ctx, target, text, fieldsFile) {
3412
7111
  mode: ctx.source.mode,
3413
7112
  vendorDir: ctx.source.vendorDir,
3414
7113
  baseUrl: ctx.baseUrl,
3415
- settingsText: text,
7114
+ settingsText: text2,
3416
7115
  settingsFile: rel(ctx.root, target),
3417
7116
  fields: readFieldsFile(fieldsFile),
3418
7117
  usersSource: ctx.usersSource ?? DEFAULT_USERS,
@@ -3422,7 +7121,7 @@ async function normalizeText(ctx, target, text, fieldsFile) {
3422
7121
  };
3423
7122
  return runEval(job, ctx.run);
3424
7123
  }
3425
- function commit(ctx, target, text, mode, recheck) {
7124
+ function commit(ctx, target, text2, mode, recheck) {
3426
7125
  const tmp = tempPathFor(target);
3427
7126
  let lock;
3428
7127
  let digest;
@@ -3435,14 +7134,14 @@ function commit(ctx, target, text, mode, recheck) {
3435
7134
  try {
3436
7135
  checkTarget();
3437
7136
  mkdirSync2(path14.dirname(target), { recursive: true });
3438
- writeFileSync3(tmp, text, { encoding: "utf8", flag: "wx" });
7137
+ writeFileSync3(tmp, text2, { encoding: "utf8", flag: "wx" });
3439
7138
  lock = acquireLock(target);
3440
7139
  checkTarget();
3441
7140
  recheck();
3442
7141
  if (!lock.owned()) throw new ConflictError("ロックを失った(保存が 60 秒より長く止まった)。fml_summary で読み直してやり直す");
3443
7142
  if (mode === "new") withRetry(() => placeNew(tmp, target));
3444
7143
  else withRetry(() => renameSync3(tmp, target));
3445
- digest = digestOf(text);
7144
+ digest = digestOf(text2);
3446
7145
  ctx.afterPlace?.();
3447
7146
  } catch (e) {
3448
7147
  failure = e;
@@ -3534,18 +7233,18 @@ async function saveNewSettings(ctx, opt) {
3534
7233
  return errorResult(ctx.root, target, e);
3535
7234
  }
3536
7235
  if (outcome.normalize.hasErrors || !outcome.normalize.output) return { status: "invalid", code: "NormalizeError", path: rel(ctx.root, target), findings: outcome.normalize.findings, summary: outcome.normalize.summary, message: "normalize のエラーがあるので保存しない" };
3537
- const text = JSON.stringify(outcome.normalize.output, null, 2) + "\n";
7236
+ const text2 = JSON.stringify(outcome.normalize.output, null, 2) + "\n";
3538
7237
  return finish(
3539
7238
  ctx,
3540
7239
  target,
3541
7240
  outcome,
3542
- () => commit(ctx, target, text, "new", () => {
7241
+ () => commit(ctx, target, text2, "new", () => {
3543
7242
  if (existsSync8(target)) throw new ConflictError("確定の直前に同じ名前のファイルができた");
3544
7243
  })
3545
7244
  );
3546
7245
  }
3547
- function parseRows(text, current) {
3548
- const v = parseInput(text, "rows");
7246
+ function parseRows(text2, current) {
7247
+ const v = parseInput(text2, "rows");
3549
7248
  if (!Array.isArray(v)) throw new InputError("rows は行(fieldcode を持つオブジェクト)の配列");
3550
7249
  if (v.length === 0) throw new InputError("rows が空");
3551
7250
  if (v.length > MAX_UPDATE_ROWS) throw new InputError(`rows は 1 回に ${MAX_UPDATE_ROWS} 行まで(${v.length} 行)`);
@@ -3564,8 +7263,8 @@ function parseRows(text, current) {
3564
7263
  });
3565
7264
  return out;
3566
7265
  }
3567
- function parseCommon(text) {
3568
- const v = parseInput(text, "common");
7266
+ function parseCommon(text2) {
7267
+ const v = parseInput(text2, "common");
3569
7268
  if (!isPlainObject2(v)) throw new InputError(`common は共通の設定のキー(${COMMON_KEYS2.join("、")})を持つオブジェクト`);
3570
7269
  const fixed = Object.keys(v).filter((k) => k === "pluginInfos" || ENVELOPE_KEYS2.includes(k));
3571
7270
  if (fixed.length) throw new InputError(`common で変えられないキー: ${fixed.join(", ")}(項目の行は rows、封筒(appId など)は変えない)`);
@@ -3622,14 +7321,14 @@ async function updateFields(ctx, opt) {
3622
7321
  }
3623
7322
  if (outcome.normalize.hasErrors || !outcome.normalize.output) return { status: "invalid", code: "NormalizeError", path: rel(ctx.root, target), findings: outcome.normalize.findings, summary: outcome.normalize.summary, message: "normalize のエラーがあるので保存しない(ファイルは変えていない)" };
3624
7323
  const output = outcome.normalize.output;
3625
- const text = JSON.stringify(output, null, 2) + "\n";
7324
+ const text2 = JSON.stringify(output, null, 2) + "\n";
3626
7325
  const name = rel(ctx.root, target);
3627
7326
  const d = diffSettings(settings, output, { before: `${name}(前)`, after: name });
3628
7327
  return finish(
3629
7328
  ctx,
3630
7329
  target,
3631
7330
  outcome,
3632
- () => commit(ctx, target, text, "replace", () => {
7331
+ () => commit(ctx, target, text2, "replace", () => {
3633
7332
  if (digestOf(readFileSync10(target)) !== opt.expectedDigest) throw new ConflictError("確定の直前にファイルが変わった(digest が違う)。fml_summary で読み直す");
3634
7333
  }),
3635
7334
  { diff: { fields: d.fields, common: d.common } }
@@ -3656,6 +7355,7 @@ export {
3656
7355
  EDIT_RE,
3657
7356
  ENVELOPE_KEYS2 as ENVELOPE_KEYS,
3658
7357
  EVENT_RE,
7358
+ EXTRA_TYPES,
3659
7359
  EvalError,
3660
7360
  EvalTimeoutError,
3661
7361
  FALLBACK_PROFILE,
@@ -3693,11 +7393,21 @@ export {
3693
7393
  ROW_SCREEN_KEYS,
3694
7394
  ROW_SOURCE_KEYS,
3695
7395
  RestError,
7396
+ SAMPLE_APP,
3696
7397
  SENTINEL_USER,
3697
7398
  SHAPE_TEXT_MAX,
3698
7399
  SNAPSHOT_PREFIX,
3699
7400
  SNAPSHOT_RE,
3700
7401
  SUPPORTED_API_VERSIONS,
7402
+ TRY_DEFAULT_AS,
7403
+ TRY_MAX_DATA,
7404
+ TRY_MAX_EXTRA_FIELDS,
7405
+ TRY_MAX_FORMULAS,
7406
+ TRY_MAX_FORMULA_CHARS,
7407
+ TRY_MAX_OPTIONS,
7408
+ TRY_MAX_TABLE_ROWS,
7409
+ TRY_MAX_VALUE_CHARS,
7410
+ TYPE_ALIASES,
3701
7411
  USER_INFO_FUNCTIONS,
3702
7412
  UsersDataError,
3703
7413
  UsersPullError,
@@ -3707,6 +7417,7 @@ export {
3707
7417
  appDirFor,
3708
7418
  appFolderOfFile,
3709
7419
  appFoldersOf,
7420
+ applyData,
3710
7421
  assertAppMark,
3711
7422
  assertChangeAllowed,
3712
7423
  assertInsideWorkspace,
@@ -3715,24 +7426,31 @@ export {
3715
7426
  authFor,
3716
7427
  baseUrlFromEnv,
3717
7428
  bodyOf,
7429
+ buildTryEnvelope,
3718
7430
  buildUsersInfo,
3719
7431
  builtinErrorName,
3720
7432
  calcSettings,
7433
+ canonicalType,
7434
+ checkDataList,
3721
7435
  classOfAppPath,
3722
7436
  classifyEvalError,
3723
7437
  cleanupAll,
3724
7438
  connectionStatusOf,
3725
7439
  contextTargetsOf,
7440
+ convertValue,
3726
7441
  createContext,
3727
7442
  createRestClient,
3728
7443
  defaultPullName,
3729
7444
  defaultUsersInfo,
3730
7445
  describeAuth,
3731
7446
  describeRecord,
7447
+ describeSampleApp,
3732
7448
  diffSettings,
3733
7449
  digestOf,
3734
7450
  editNameOf,
7451
+ emptyRecordOf,
3735
7452
  ensureAppFolder,
7453
+ extendFields,
3736
7454
  fetchFields,
3737
7455
  fetchRecord,
3738
7456
  findAppDir,
@@ -3764,6 +7482,7 @@ export {
3764
7482
  modeOf,
3765
7483
  momentFileOf,
3766
7484
  narrowRecord,
7485
+ normalizeDefaults,
3767
7486
  normalizeKintoneBaseUrl,
3768
7487
  normalizeSettings,
3769
7488
  parsePolicy,
@@ -3787,6 +7506,7 @@ export {
3787
7506
  requireProfiles,
3788
7507
  resolvePluginSources,
3789
7508
  resolveRead,
7509
+ resolveTryTarget,
3790
7510
  resolveWrite,
3791
7511
  resolveWriteDir,
3792
7512
  rowsOf,
@@ -3794,6 +7514,7 @@ export {
3794
7514
  runEvalJob,
3795
7515
  safeFileName,
3796
7516
  sameIdentity,
7517
+ sampleApp,
3797
7518
  saveNewSettings,
3798
7519
  scanFormula,
3799
7520
  scanFormulas,
@@ -3811,6 +7532,7 @@ export {
3811
7532
  takeInbox,
3812
7533
  tempPathFor,
3813
7534
  toolsMeta,
7535
+ trySettings,
3814
7536
  unquote,
3815
7537
  unusedProfileDirs,
3816
7538
  updateFields,