@ancha-labs/cli 0.4.12 → 0.4.13

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/lib/mcp-entry.mjs CHANGED
@@ -3129,9 +3129,9 @@ var require_timestamp = __commonJS({
3129
3129
  const match = str.match(timestamp2.test);
3130
3130
  if (!match)
3131
3131
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
3132
- const [, year, month, day6, hour2, minute, second] = match.map(Number);
3132
+ const [, year, month, day7, hour2, minute, second] = match.map(Number);
3133
3133
  const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
3134
- let date9 = Date.UTC(year, month - 1, day6, hour2 || 0, minute || 0, second || 0, millisec);
3134
+ let date9 = Date.UTC(year, month - 1, day7, hour2 || 0, minute || 0, second || 0, millisec);
3135
3135
  const tz = match[8];
3136
3136
  if (tz && tz !== "Z") {
3137
3137
  let d = parseSexagesimal(tz, false);
@@ -23260,10 +23260,10 @@ function compactTypeUnion(schema) {
23260
23260
  var FOLDABLE_KEYS = /* @__PURE__ */ new Set(["type", "properties", "required", "additionalProperties"]);
23261
23261
  var UNION_KEYS = ["oneOf", "anyOf"];
23262
23262
  function undeclaredConstraint(member) {
23263
- const extra = member.additionalProperties;
23264
- if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null)
23263
+ const extra2 = member.additionalProperties;
23264
+ if (extra2 === void 0 || extra2 === false || typeof extra2 !== "object" || extra2 === null)
23265
23265
  return null;
23266
- return Object.keys(extra).length ? extra : null;
23266
+ return Object.keys(extra2).length ? extra2 : null;
23267
23267
  }
23268
23268
  function foldObjects(members2) {
23269
23269
  const objects = [];
@@ -32068,11 +32068,11 @@ var Protocol = class {
32068
32068
  this._onerror(error62);
32069
32069
  };
32070
32070
  const _onmessage = this._transport?.onmessage;
32071
- this._transport.onmessage = (message4, extra) => {
32072
- _onmessage?.(message4, extra);
32071
+ this._transport.onmessage = (message4, extra2) => {
32072
+ _onmessage?.(message4, extra2);
32073
32073
  if (isJSONRPCResultResponse(message4) || isJSONRPCErrorResponse(message4)) this._onresponse(message4);
32074
- else if (isJSONRPCRequest(message4)) this._onrequest(message4, extra);
32075
- else if (isJSONRPCNotification(message4)) this._onnotification(message4, extra);
32074
+ else if (isJSONRPCRequest(message4)) this._onrequest(message4, extra2);
32075
+ else if (isJSONRPCNotification(message4)) this._onnotification(message4, extra2);
32076
32076
  else this._onerror(/* @__PURE__ */ new Error(`Unknown message type: ${JSON.stringify(message4)}`));
32077
32077
  };
32078
32078
  transport.setSupportedProtocolVersions?.(this._supportedProtocolVersions);
@@ -32110,12 +32110,12 @@ var Protocol = class {
32110
32110
  * an override that consumes only what it owns and falls through to base
32111
32111
  * dispatch for everything else.
32112
32112
  */
32113
- _onnotification(rawNotification, extra) {
32113
+ _onnotification(rawNotification, extra2) {
32114
32114
  const { message: notification } = liftWireOnlyMaterial(rawNotification, "notification");
32115
32115
  const codec2 = this._negotiatedWireCodec();
32116
- if (extra?.classification === void 0 && this._shouldDropInbound(rawNotification) === "drop") return;
32117
- if (extra?.classification !== void 0) {
32118
- const classified = classifiedWireEra(extra.classification);
32116
+ if (extra2?.classification === void 0 && this._shouldDropInbound(rawNotification) === "drop") return;
32117
+ if (extra2?.classification !== void 0) {
32118
+ const classified = classifiedWireEra(extra2.classification);
32119
32119
  if (classified !== codec2.era) {
32120
32120
  this._onerror(/* @__PURE__ */ new Error(`Era mismatch on inbound notification '${notification.method}': classified as ${classified} but this instance serves ${codec2.era}`));
32121
32121
  return;
@@ -32127,10 +32127,10 @@ var Protocol = class {
32127
32127
  if (handler === void 0 && fallback === void 0) return;
32128
32128
  Promise.resolve().then(() => handler === void 0 ? fallback(notification) : handler(notification, codec2)).catch((error62) => this._onerror(/* @__PURE__ */ new Error(`Uncaught error in notification handler: ${error62}`)));
32129
32129
  }
32130
- _onrequest(rawRequest, extra) {
32130
+ _onrequest(rawRequest, extra2) {
32131
32131
  const { message: request, lifted } = liftWireOnlyMaterial(rawRequest, "request");
32132
32132
  const codec2 = this._negotiatedWireCodec();
32133
- if (extra?.classification === void 0 && this._shouldDropInbound(rawRequest) === "drop") {
32133
+ if (extra2?.classification === void 0 && this._shouldDropInbound(rawRequest) === "drop") {
32134
32134
  this._onerror(/* @__PURE__ */ new Error(`Dropped inbound request '${rawRequest.method}': not servable on this connection's protocol era`));
32135
32135
  return;
32136
32136
  }
@@ -32147,11 +32147,11 @@ var Protocol = class {
32147
32147
  };
32148
32148
  capturedTransport?.send(errorResponse).catch((error62) => this._onerror(/* @__PURE__ */ new Error(`Failed to send an error response: ${error62}`)));
32149
32149
  };
32150
- if (extra?.classification !== void 0) {
32151
- const classified = classifiedWireEra(extra.classification);
32150
+ if (extra2?.classification !== void 0) {
32151
+ const classified = classifiedWireEra(extra2.classification);
32152
32152
  if (classified !== codec2.era) {
32153
32153
  this._onerror(/* @__PURE__ */ new Error(`Era mismatch on inbound request '${request.method}': classified as ${classified} but this instance serves ${codec2.era}`));
32154
- const requested = extra.classification.revision ?? classified;
32154
+ const requested = extra2.classification.revision ?? classified;
32155
32155
  sendErrorResponse(ProtocolErrorCode.UnsupportedProtocolVersion, `Unsupported protocol version: ${requested}`, {
32156
32156
  supported: this._supportedProtocolVersions,
32157
32157
  requested
@@ -32205,9 +32205,9 @@ var Protocol = class {
32205
32205
  }),
32206
32206
  notify: sendNotification
32207
32207
  },
32208
- http: extra?.authInfo ? { authInfo: extra.authInfo } : void 0
32208
+ http: extra2?.authInfo ? { authInfo: extra2.authInfo } : void 0
32209
32209
  };
32210
- const ctx = this.buildContext(baseCtx, extra);
32210
+ const ctx = this.buildContext(baseCtx, extra2);
32211
32211
  Promise.resolve().then(() => handler(request, ctx)).then(async (result) => {
32212
32212
  if (abortController.signal.aborted) return;
32213
32213
  let encoded;
@@ -39944,8 +39944,8 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
39944
39944
  if (!matches) return false;
39945
39945
  const year = +matches[1];
39946
39946
  const month = +matches[2];
39947
- const day6 = +matches[3];
39948
- return month >= 1 && month <= 12 && day6 >= 1 && day6 <= (month === 2 && isLeapYear(year) ? 29 : DAYS2[month]);
39947
+ const day7 = +matches[3];
39948
+ return month >= 1 && month <= 12 && day7 >= 1 && day7 <= (month === 2 && isLeapYear(year) ? 29 : DAYS2[month]);
39949
39949
  }
39950
39950
  function compareDate(d1, d2) {
39951
39951
  if (!(d1 && d2)) return void 0;
@@ -43174,7 +43174,7 @@ var Client = class extends Protocol {
43174
43174
  * `setNotificationHandler` / `fallbackNotificationHandler` instead of
43175
43175
  * being silently swallowed.
43176
43176
  */
43177
- _onnotification(raw, extra) {
43177
+ _onnotification(raw, extra2) {
43178
43178
  const evicted = Object.hasOwn(LIST_CHANGED_EVICTIONS, raw.method) ? LIST_CHANGED_EVICTIONS[raw.method] : void 0;
43179
43179
  if (raw.method === "notifications/resources/updated") {
43180
43180
  const uri = raw.params?.uri;
@@ -43200,7 +43200,7 @@ var Client = class extends Protocol {
43200
43200
  return;
43201
43201
  }
43202
43202
  }
43203
- super._onnotification(raw, extra);
43203
+ super._onnotification(raw, extra2);
43204
43204
  }
43205
43205
  /**
43206
43206
  * Transport-level demux for `subscriptions/listen` responses. A JSON-RPC
@@ -48165,11 +48165,11 @@ var Protocol2 = class {
48165
48165
  this._onerror(error62);
48166
48166
  };
48167
48167
  const _onmessage = this._transport?.onmessage;
48168
- this._transport.onmessage = (message4, extra) => {
48169
- _onmessage?.(message4, extra);
48168
+ this._transport.onmessage = (message4, extra2) => {
48169
+ _onmessage?.(message4, extra2);
48170
48170
  if (isJSONRPCResultResponse2(message4) || isJSONRPCErrorResponse2(message4)) this._onresponse(message4);
48171
- else if (isJSONRPCRequest2(message4)) this._onrequest(message4, extra);
48172
- else if (isJSONRPCNotification2(message4)) this._onnotification(message4, extra);
48171
+ else if (isJSONRPCRequest2(message4)) this._onrequest(message4, extra2);
48172
+ else if (isJSONRPCNotification2(message4)) this._onnotification(message4, extra2);
48173
48173
  else this._onerror(/* @__PURE__ */ new Error(`Unknown message type: ${JSON.stringify(message4)}`));
48174
48174
  };
48175
48175
  transport.setSupportedProtocolVersions?.(this._supportedProtocolVersions);
@@ -48207,12 +48207,12 @@ var Protocol2 = class {
48207
48207
  * an override that consumes only what it owns and falls through to base
48208
48208
  * dispatch for everything else.
48209
48209
  */
48210
- _onnotification(rawNotification, extra) {
48210
+ _onnotification(rawNotification, extra2) {
48211
48211
  const { message: notification } = liftWireOnlyMaterial2(rawNotification, "notification");
48212
48212
  const codec2 = this._negotiatedWireCodec();
48213
- if (extra?.classification === void 0 && this._shouldDropInbound(rawNotification) === "drop") return;
48214
- if (extra?.classification !== void 0) {
48215
- const classified = classifiedWireEra2(extra.classification);
48213
+ if (extra2?.classification === void 0 && this._shouldDropInbound(rawNotification) === "drop") return;
48214
+ if (extra2?.classification !== void 0) {
48215
+ const classified = classifiedWireEra2(extra2.classification);
48216
48216
  if (classified !== codec2.era) {
48217
48217
  this._onerror(/* @__PURE__ */ new Error(`Era mismatch on inbound notification '${notification.method}': classified as ${classified} but this instance serves ${codec2.era}`));
48218
48218
  return;
@@ -48224,10 +48224,10 @@ var Protocol2 = class {
48224
48224
  if (handler === void 0 && fallback === void 0) return;
48225
48225
  Promise.resolve().then(() => handler === void 0 ? fallback(notification) : handler(notification, codec2)).catch((error62) => this._onerror(/* @__PURE__ */ new Error(`Uncaught error in notification handler: ${error62}`)));
48226
48226
  }
48227
- _onrequest(rawRequest, extra) {
48227
+ _onrequest(rawRequest, extra2) {
48228
48228
  const { message: request, lifted } = liftWireOnlyMaterial2(rawRequest, "request");
48229
48229
  const codec2 = this._negotiatedWireCodec();
48230
- if (extra?.classification === void 0 && this._shouldDropInbound(rawRequest) === "drop") {
48230
+ if (extra2?.classification === void 0 && this._shouldDropInbound(rawRequest) === "drop") {
48231
48231
  this._onerror(/* @__PURE__ */ new Error(`Dropped inbound request '${rawRequest.method}': not servable on this connection's protocol era`));
48232
48232
  return;
48233
48233
  }
@@ -48244,11 +48244,11 @@ var Protocol2 = class {
48244
48244
  };
48245
48245
  capturedTransport?.send(errorResponse).catch((error62) => this._onerror(/* @__PURE__ */ new Error(`Failed to send an error response: ${error62}`)));
48246
48246
  };
48247
- if (extra?.classification !== void 0) {
48248
- const classified = classifiedWireEra2(extra.classification);
48247
+ if (extra2?.classification !== void 0) {
48248
+ const classified = classifiedWireEra2(extra2.classification);
48249
48249
  if (classified !== codec2.era) {
48250
48250
  this._onerror(/* @__PURE__ */ new Error(`Era mismatch on inbound request '${request.method}': classified as ${classified} but this instance serves ${codec2.era}`));
48251
- const requested = extra.classification.revision ?? classified;
48251
+ const requested = extra2.classification.revision ?? classified;
48252
48252
  sendErrorResponse(ProtocolErrorCode2.UnsupportedProtocolVersion, `Unsupported protocol version: ${requested}`, {
48253
48253
  supported: this._supportedProtocolVersions,
48254
48254
  requested
@@ -48302,9 +48302,9 @@ var Protocol2 = class {
48302
48302
  }),
48303
48303
  notify: sendNotification
48304
48304
  },
48305
- http: extra?.authInfo ? { authInfo: extra.authInfo } : void 0
48305
+ http: extra2?.authInfo ? { authInfo: extra2.authInfo } : void 0
48306
48306
  };
48307
- const ctx = this.buildContext(baseCtx, extra);
48307
+ const ctx = this.buildContext(baseCtx, extra2);
48308
48308
  Promise.resolve().then(() => handler(request, ctx)).then(async (result) => {
48309
48309
  if (abortController.signal.aborted) return;
48310
48310
  let encoded;
@@ -55916,8 +55916,8 @@ var require_formats2 = /* @__PURE__ */ __commonJSMin2(((exports) => {
55916
55916
  if (!matches) return false;
55917
55917
  const year = +matches[1];
55918
55918
  const month = +matches[2];
55919
- const day6 = +matches[3];
55920
- return month >= 1 && month <= 12 && day6 >= 1 && day6 <= (month === 2 && isLeapYear(year) ? 29 : DAYS2[month]);
55919
+ const day7 = +matches[3];
55920
+ return month >= 1 && month <= 12 && day7 >= 1 && day7 <= (month === 2 && isLeapYear(year) ? 29 : DAYS2[month]);
55921
55921
  }
55922
55922
  function compareDate(d1, d2) {
55923
55923
  if (!(d1 && d2)) return void 0;
@@ -56259,20 +56259,20 @@ var PerRequestHTTPServerTransport = class {
56259
56259
  * transport is closed before a response was produced (for example because
56260
56260
  * the client disconnected).
56261
56261
  */
56262
- async handleMessage(message4, extra) {
56262
+ async handleMessage(message4, extra2) {
56263
56263
  if (this._used) throw new Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");
56264
56264
  if (!this._started || this.onmessage === void 0) throw new Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");
56265
56265
  if (this._closed) throw new Error("PerRequestHTTPServerTransport is closed");
56266
56266
  this._used = true;
56267
- const signal = extra?.request?.signal;
56267
+ const signal = extra2?.request?.signal;
56268
56268
  if (signal?.aborted) {
56269
56269
  await this.close();
56270
56270
  throw new SdkError2(SdkErrorCode2.ConnectionClosed, "The request was aborted before it could be handled");
56271
56271
  }
56272
56272
  const messageExtra = {
56273
56273
  classification: this._classification,
56274
- ...extra?.request !== void 0 && { request: extra.request },
56275
- ...extra?.authInfo !== void 0 && { authInfo: extra.authInfo }
56274
+ ...extra2?.request !== void 0 && { request: extra2.request },
56275
+ ...extra2?.authInfo !== void 0 && { authInfo: extra2.authInfo }
56276
56276
  };
56277
56277
  if (isJSONRPCRequest2(message4)) {
56278
56278
  this._requestId = message4.id;
@@ -57347,6 +57347,7 @@ var EXECUTION_SUPPORT = {
57347
57347
  "test.timeout": all,
57348
57348
  "checks.state": all,
57349
57349
  "checks.trace": all,
57350
+ "checks.answer": all,
57350
57351
  "checks.process": all,
57351
57352
  "checks.judge": sceneOnly,
57352
57353
  "agent.input.command": all,
@@ -57385,6 +57386,97 @@ var EXECUTION_SUPPORT = {
57385
57386
  "--bundle-file": { local: false, container: false, managed: false, "cloud-vm": true, reason: "files a cloud run carries besides the project and its tests" }
57386
57387
  };
57387
57388
 
57389
+ // packages/core/src/answer.ts
57390
+ var SYMBOLS = "$\u20AC\xA3\xA5\u20B9\u20A9\u20BD\u20BA\u20AA\u20AB\u0E3F\u20B1\u20A6\u20B4\u20B8\u20A1\u20B2\u20B5\u20AD\xA2";
57391
+ var CODES = [
57392
+ "USD",
57393
+ "EUR",
57394
+ "GBP",
57395
+ "JPY",
57396
+ "CNY",
57397
+ "RMB",
57398
+ "CAD",
57399
+ "AUD",
57400
+ "NZD",
57401
+ "CHF",
57402
+ "HKD",
57403
+ "SGD",
57404
+ "INR",
57405
+ "KRW",
57406
+ "MXN",
57407
+ "BRL",
57408
+ "ZAR",
57409
+ "SEK",
57410
+ "NOK",
57411
+ "DKK",
57412
+ "PLN",
57413
+ "CZK",
57414
+ "HUF",
57415
+ "RON",
57416
+ "BGN",
57417
+ "ISK",
57418
+ "ILS",
57419
+ "AED",
57420
+ "SAR",
57421
+ "QAR",
57422
+ "KWD",
57423
+ "BHD",
57424
+ "OMR",
57425
+ "TRY",
57426
+ "RUB",
57427
+ "UAH",
57428
+ "THB",
57429
+ "PHP",
57430
+ "IDR",
57431
+ "MYR",
57432
+ "TWD",
57433
+ "VND",
57434
+ "PKR",
57435
+ "BDT",
57436
+ "LKR",
57437
+ "NGN",
57438
+ "KES",
57439
+ "EGP",
57440
+ "MAD",
57441
+ "ARS",
57442
+ "CLP",
57443
+ "COP",
57444
+ "PEN"
57445
+ ];
57446
+ var CURRENCY = `(?:${CODES.join("|")}|[A-Z]{0,2}[${SYMBOLS}])`;
57447
+ var NUMBER = new RegExp(
57448
+ String.raw`(?<![\p{L}\p{N}_.,]|\p{L}[-−–+/_])(?<open>\()?(?<sign>[-−–+])?(?:(?<before>${CURRENCY})[ \u00A0]?)?(?<minus>[-−–])?(?<inner>\()?` + String.raw`(?<digits>\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?)(?!\p{N}|[eE][-+]?\d|,\d{3}|\.\d)` + String.raw`(?:[ \u00A0]?(?<after>${CODES.join("|")}|[${SYMBOLS}]))?(?<close>\))?`,
57449
+ "gu"
57450
+ );
57451
+ function readNumbers(text12) {
57452
+ const numbers2 = [];
57453
+ for (const match of text12.normalize("NFKC").matchAll(NUMBER)) {
57454
+ const { open: open2, sign, before, minus, inner, digits, after, close } = match.groups;
57455
+ const parenthesized = (open2 !== void 0 || inner !== void 0) && close !== void 0;
57456
+ const amount2 = before !== void 0 || after !== void 0 || /[,.]/.test(digits);
57457
+ const negative = sign !== void 0 && sign !== "+" || minus !== void 0 || parenthesized && amount2;
57458
+ const value2 = Number(digits.replaceAll(",", ""));
57459
+ numbers2.push({
57460
+ value: negative && value2 !== 0 ? -value2 : value2,
57461
+ decimals: digits.split(".")[1]?.length ?? 0,
57462
+ text: match[0].trim(),
57463
+ ...parenthesized && !amount2 && !negative && { either: true }
57464
+ });
57465
+ }
57466
+ return numbers2;
57467
+ }
57468
+ var AnswerNumberSchema = external_exports.strictObject({
57469
+ value: external_exports.union([external_exports.number(), external_exports.string().refine((text12) => readNumbers(text12).length === 1, 'a number, or one number written as text, e.g. "1,240.00" or "(300.00)"')]).describe('The number the answer must state: a number, or one number as text ("1,240.00") to keep its decimal places'),
57470
+ tolerance: external_exports.number().nonnegative().optional().describe("How far the stated number may be from value; default: half the last decimal place of value (1200.00 \u2192 0.005, 1240.5 \u2192 0.05, 1200 \u2192 0.5)")
57471
+ });
57472
+ var texts = external_exports.union([external_exports.string().min(1), external_exports.array(external_exports.string().min(1)).min(1)]);
57473
+ var AnswerCheckSchema = external_exports.strictObject({
57474
+ contains: texts.optional().describe("Text the final answer must contain, each piece"),
57475
+ not_contains: texts.optional().describe("Text the final answer must not contain"),
57476
+ numbers: external_exports.array(AnswerNumberSchema).min(1).optional().describe("Numbers the final answer must state, each within its tolerance; thousands separators, currency codes and symbols, minus signs and parentheses for negatives are read"),
57477
+ case: external_exports.enum(["insensitive", "sensitive"]).optional().describe("How contains and not_contains compare letters; default insensitive")
57478
+ }).describe("Checks the agent's final answer (what it posts to ANCHA_DONE_URL, its HTTP reply, or the last block it prints on stdout): the text and numbers it states");
57479
+
57388
57480
  // packages/core/src/duration.ts
57389
57481
  var DURATION_RE = /^(-?)(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;
57390
57482
  var MS_PER = { d: 864e5, h: 36e5, m: 6e4, s: 1e3, ms: 1 };
@@ -57914,7 +58006,7 @@ var AccountsSchema = external_exports.strictObject({
57914
58006
  github: refUse.optional().describe("Their GitHub identity, from seed.github.users"),
57915
58007
  pagerduty: refUse.optional().describe("Their PagerDuty user, from seed.pagerduty.users"),
57916
58008
  gmail: external_exports.email().optional().describe("Their mailbox, an address in seed.gmail.mailboxes: mail delivered there reaches them and they reply from it")
57917
- }).refine((accounts) => Object.values(accounts).some((account2) => account2 !== void 0), "a person needs at least one account").describe("Who this person is in each tool");
58009
+ }).refine((accounts) => Object.values(accounts).some((account3) => account3 !== void 0), "a person needs at least one account").describe("Who this person is in each tool");
57918
58010
  var PERSON_ACTIONS = ["slack.post", "github.comment", "github.open_issue", "github.approve", "github.pr_merge", "gmail.reply"];
57919
58011
  var WORK_ACTIONS = ["slack.post", "github.comment", "github.open_issue", "github.approve", "github.pr_merge"];
57920
58012
  var WorkSchema = external_exports.strictObject({
@@ -58071,7 +58163,7 @@ var SalesforceSeedSchema = external_exports.strictObject({
58071
58163
  if (members2.has(key2)) ctx.addIssue({ code: "custom", path: ["campaignMembers", index], message: "duplicate campaign membership" });
58072
58164
  members2.add(key2);
58073
58165
  }
58074
- for (const account2 of seed2.access.deniedAccountIds) if (!byType.Account.has(account2)) ctx.addIssue({ code: "custom", path: ["access", "deniedAccountIds"], message: "denied account must exist" });
58166
+ for (const account3 of seed2.access.deniedAccountIds) if (!byType.Account.has(account3)) ctx.addIssue({ code: "custom", path: ["access", "deniedAccountIds"], message: "denied account must exist" });
58075
58167
  });
58076
58168
  var salesforceStarterSeed = {
58077
58169
  org: { id: "00D000000000001AAA", name: "Acme", currency: "USD", timezone: "America/Los_Angeles" },
@@ -59035,7 +59127,7 @@ var GmailThreadCheckSchema = external_exports.strictObject({
59035
59127
  drafts_lte: external_exports.number().int().min(0).optional().describe("At most this many drafts in the thread"),
59036
59128
  messages_gte: external_exports.number().int().min(1).optional().describe("At least this many messages in the thread, drafts included")
59037
59129
  }).refine((check3) => check3.label !== void 0 || check3.drafts_gte !== void 0 || check3.drafts_lte !== void 0 || check3.messages_gte !== void 0, "give label, drafts_gte, drafts_lte or messages_gte").refine((check3) => check3.present === void 0 || check3.label !== void 0, "present applies to label");
59038
- var texts = external_exports.union([external_exports.string().min(1), external_exports.array(external_exports.string().min(1)).min(1)]).transform((value2) => Array.isArray(value2) ? value2 : [value2]);
59130
+ var texts2 = external_exports.union([external_exports.string().min(1), external_exports.array(external_exports.string().min(1)).min(1)]).transform((value2) => Array.isArray(value2) ? value2 : [value2]);
59039
59131
  var GmailMessageCheckSchema = external_exports.strictObject({
59040
59132
  mailbox: address.optional().describe("Whose mailbox; defaults to the agent's"),
59041
59133
  label: external_exports.string().min(1).max(225).optional().describe("A system label id (SENT, DRAFT, INBOX ...) or a label name the message has"),
@@ -59044,10 +59136,10 @@ var GmailMessageCheckSchema = external_exports.strictObject({
59044
59136
  in_thread_of: ref7.optional().describe("The ref of a seeded message or a gmail.send: the message is in its thread"),
59045
59137
  count: external_exports.number().int().positive().optional().describe("Exact number of matching messages"),
59046
59138
  recipients: external_exports.array(address).min(1).optional().describe("Exact set of To, Cc and Bcc addresses"),
59047
- subject_contains: texts.optional().describe("Text the subject contains, ignoring case; a list must all appear"),
59048
- text_contains: texts.optional().describe("Text the body contains, ignoring case; a list must all appear"),
59139
+ subject_contains: texts2.optional().describe("Text the subject contains, ignoring case; a list must all appear"),
59140
+ text_contains: texts2.optional().describe("Text the body contains, ignoring case; a list must all appear"),
59049
59141
  attachment_name_contains: external_exports.string().min(1).optional().describe("Text an attachment's file name contains, ignoring case"),
59050
- attachment_contains: texts.optional().describe("Text one attachment's content contains, ignoring case; a list must all appear in it"),
59142
+ attachment_contains: texts2.optional().describe("Text one attachment's content contains, ignoring case; a list must all appear in it"),
59051
59143
  exists: external_exports.boolean().default(true).describe("false asserts no message matches")
59052
59144
  });
59053
59145
  var draft = message.omit({ from: true, labels: true }).extend({ at: when.default("0s") });
@@ -60658,6 +60750,16 @@ var attribute = external_exports.strictObject({
60658
60750
  currency: external_exports.string().regex(/^[A-Z]{3}$/).optional()
60659
60751
  });
60660
60752
  var values = external_exports.record(slug, external_exports.union([external_exports.string().max(5e3), external_exports.number(), external_exports.boolean(), external_exports.array(external_exports.union([external_exports.string().max(500), external_exports.number()])).max(100), external_exports.null()]));
60753
+ var ATTIO_STANDARD_ATTRIBUTES = {
60754
+ people: ["record_id", "name", "email_addresses", "phone_numbers", "job_title", "description", "company", "created_at", "created_by"],
60755
+ companies: ["record_id", "name", "domains", "description", "categories", "team", "created_at", "created_by"],
60756
+ deals: ["record_id", "name", "stage", "owner", "value", "associated_people", "associated_company", "created_at", "created_by"]
60757
+ };
60758
+ var STANDARD_LOOKUPS = {
60759
+ people: { company: { target: "companies" } },
60760
+ companies: { team: { target: "people" } },
60761
+ deals: { owner: { target: "member" }, associated_people: { target: "people" }, associated_company: { target: "companies" } }
60762
+ };
60661
60763
  var AttioSeedSchema = external_exports.strictObject({
60662
60764
  workspace: external_exports.strictObject({ name: external_exports.string().min(1).max(100), slug: external_exports.string().regex(/^[a-z0-9-]{2,40}$/) }),
60663
60765
  members: external_exports.array(external_exports.strictObject({ ref: ref11, first_name: external_exports.string().min(1).max(100), last_name: external_exports.string().max(100), email: external_exports.string().regex(EMAIL5), access_level: external_exports.enum(["admin", "member", "suspended"]).default("member") })).min(1).max(200),
@@ -60701,11 +60803,34 @@ var AttioSeedSchema = external_exports.strictObject({
60701
60803
  recordObject.set(r.ref, object3);
60702
60804
  });
60703
60805
  const lists = /* @__PURE__ */ new Set();
60806
+ const emails = new Set(seed2.members.map((m) => m.email.toLowerCase()));
60807
+ const lookupOf = (a) => a.type === "select" || a.type === "status" ? { options: a.options } : a.type === "record-reference" ? { target: a.target } : a.type === "actor-reference" ? { target: "member" } : {};
60808
+ const named2 = (given, attributes, standard, path2) => {
60809
+ for (const [slug3, value2] of Object.entries(given)) {
60810
+ const custom3 = attributes.find((a) => a.api_slug === slug3);
60811
+ if (custom3 === void 0 && !Object.hasOwn(standard, slug3)) {
60812
+ issue2([...path2, slug3], `no attribute "${slug3}"`);
60813
+ continue;
60814
+ }
60815
+ const { options, target } = custom3 === void 0 ? standard[slug3] : lookupOf(custom3);
60816
+ for (const item2 of Array.isArray(value2) ? value2 : [value2]) {
60817
+ if (typeof item2 !== "string") continue;
60818
+ if (options !== void 0 && !options.includes(item2)) issue2([...path2, slug3], `"${item2}" is not an option of ${slug3}`);
60819
+ if (target === "member" && !members2.has(item2) && !emails.has(item2.toLowerCase())) issue2([...path2, slug3], `unknown member ${item2}`);
60820
+ else if (target !== void 0 && target !== "member" && recordObject.get(item2) !== target) issue2([...path2, slug3], `${item2} is not a ${target} record`);
60821
+ }
60822
+ }
60823
+ };
60824
+ for (const object3 of ["people", "companies", "deals"]) {
60825
+ const standard = { ...Object.fromEntries(ATTIO_STANDARD_ATTRIBUTES[object3].map((slug3) => [slug3, {}])), ...STANDARD_LOOKUPS[object3], ...object3 === "deals" && { stage: { options: seed2.deal_stages } } };
60826
+ seed2.records[object3].forEach((r, i) => named2(r.values, seed2.attributes[object3] ?? [], standard, ["records", object3, i, "values"]));
60827
+ }
60704
60828
  seed2.lists.forEach((l, i) => {
60705
60829
  if (lists.has(l.api_slug)) issue2(["lists", i, "api_slug"], "duplicate list slug");
60706
60830
  lists.add(l.api_slug);
60707
60831
  l.entries.forEach((e, j) => {
60708
60832
  if (recordObject.get(e.record) !== l.parent_object) issue2(["lists", i, "entries", j, "record"], `${e.record} is not a ${l.parent_object} record`);
60833
+ named2(e.values, l.attributes, {}, ["lists", i, "entries", j, "values"]);
60709
60834
  });
60710
60835
  });
60711
60836
  seed2.notes.forEach((n, i) => {
@@ -64566,10 +64691,10 @@ var unitOf = (value2) => {
64566
64691
  return UNITS[text12] ?? UNITS[text12.toLowerCase()] ?? null;
64567
64692
  };
64568
64693
  function addMonths(ms, months) {
64569
- const date9 = new Date(ms), day6 = date9.getUTCDate();
64694
+ const date9 = new Date(ms), day7 = date9.getUTCDate();
64570
64695
  const target = new Date(utc(date9.getUTCFullYear(), date9.getUTCMonth() + months, 1, date9.getUTCHours(), date9.getUTCMinutes(), date9.getUTCSeconds(), date9.getUTCMilliseconds()));
64571
64696
  const last = new Date(utc(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
64572
- target.setUTCDate(Math.min(day6, last));
64697
+ target.setUTCDate(Math.min(day7, last));
64573
64698
  return target.getTime();
64574
64699
  }
64575
64700
  function monthsBetween(a, b) {
@@ -64706,14 +64831,14 @@ function parseWithFormat(text12, format) {
64706
64831
  });
64707
64832
  if (mo < 0) return null;
64708
64833
  if (pm !== null) h = h % 12 + (pm ? 12 : 0);
64709
- const day6 = validDay(y, mo, d);
64710
- if (day6 === null) return null;
64834
+ const day7 = validDay(y, mo, d);
64835
+ if (day7 === null) return null;
64711
64836
  const timed2 = parts.some((token) => /^[Hhms]/.test(token));
64712
- return formulaDate(day6 + h * 36e5 + mi * 6e4 + s * 1e3, !timed2);
64837
+ return formulaDate(day7 + h * 36e5 + mi * 6e4 + s * 1e3, !timed2);
64713
64838
  }
64714
64839
  var isWorkday = (ms) => {
64715
- const day6 = new Date(ms).getUTCDay();
64716
- return day6 !== 0 && day6 !== 6;
64840
+ const day7 = new Date(ms).getUTCDay();
64841
+ return day7 !== 0 && day7 !== 6;
64717
64842
  };
64718
64843
  var startOfDay = (ms) => Math.floor(ms / 864e5) * 864e5;
64719
64844
  var text1 = (fn) => ({ min: 1, max: 1, run: (args) => fn(formulaText(args[0])) });
@@ -64940,8 +65065,8 @@ var FUNCTIONS = {
64940
65065
  WEEKDAY: { min: 1, max: 2, run: (args) => {
64941
65066
  const date9 = dateArg(args[0]);
64942
65067
  if (date9 === null || isFormulaError(date9)) return date9;
64943
- const monday = args[1] !== void 0 && formulaText(args[1]).toLowerCase() === "monday", day6 = new Date(date9.ms).getUTCDay();
64944
- return monday ? (day6 + 6) % 7 : day6;
65068
+ const monday = args[1] !== void 0 && formulaText(args[1]).toLowerCase() === "monday", day7 = new Date(date9.ms).getUTCDay();
65069
+ return monday ? (day7 + 6) % 7 : day7;
64945
65070
  } },
64946
65071
  WEEKNUM: { min: 1, max: 2, run: (args) => {
64947
65072
  const date9 = dateArg(args[0]);
@@ -65595,7 +65720,9 @@ var day5 = external_exports.string().refine(
65595
65720
  "expected YYYY-MM-DD or an offset in days from the start of the test, e.g. -30d"
65596
65721
  );
65597
65722
  var external = text11.optional();
65723
+ var named = external_exports.union([id8, text11]).describe("internal ID or name");
65598
65724
  var custom2 = external_exports.record(external_exports.string().regex(/^cust(?:entity|body|col|item)[a-z0-9_]+$/), external_exports.union([external_exports.string().max(4e3), external_exports.number(), external_exports.boolean(), external_exports.null()])).optional();
65725
+ var extra = external_exports.record(external_exports.string().min(1).max(200), external_exports.json()).optional().describe("other fields by NetSuite field ID, served as given; totals and the books never read them");
65599
65726
  var address5 = external_exports.strictObject({
65600
65727
  label: text11.optional(),
65601
65728
  addressee: text11.optional(),
@@ -65624,7 +65751,9 @@ var entity = {
65624
65751
  comments: long.optional(),
65625
65752
  externalId: external,
65626
65753
  addresses: external_exports.array(address5).max(50).default([]),
65627
- custom: custom2
65754
+ custom: custom2,
65755
+ extra,
65756
+ subsidiary: named.optional()
65628
65757
  };
65629
65758
  var itemLine = external_exports.strictObject({
65630
65759
  item: id8,
@@ -65635,13 +65764,32 @@ var itemLine = external_exports.strictObject({
65635
65764
  department: id8.optional(),
65636
65765
  class: id8.optional(),
65637
65766
  closed: external_exports.boolean().default(false),
65638
- custom: custom2
65767
+ custom: custom2,
65768
+ extra
65639
65769
  });
65640
- var expenseLine = external_exports.strictObject({ account: id8, amount: positive, memo: long.optional(), ...segments, closed: external_exports.boolean().default(false), custom: custom2 });
65770
+ var expenseLine = external_exports.strictObject({ account: id8, amount: positive, memo: long.optional(), ...segments, closed: external_exports.boolean().default(false), custom: custom2, extra });
65641
65771
  var application = external_exports.strictObject({ doc: id8, line: external_exports.number().int().nonnegative().optional(), amount: positive });
65642
- var tx = { id: id8, tranId: text11.optional(), date: day5, memo: long.optional(), externalId: external, ...segments, custom: custom2 };
65643
- var shipLine = external_exports.strictObject({ item: id8, quantity: external_exports.number().positive(), location: id8.optional() });
65644
- var NetsuiteSeedSchema = external_exports.strictObject({
65772
+ var tx = {
65773
+ id: id8,
65774
+ tranId: text11.optional(),
65775
+ date: day5,
65776
+ memo: long.optional(),
65777
+ externalId: external,
65778
+ ...segments,
65779
+ custom: custom2,
65780
+ extra,
65781
+ subsidiary: named.optional().describe("internal ID or name; else the customer's or vendor's"),
65782
+ currency: id8.optional().describe("else the customer's or vendor's"),
65783
+ exchangeRate: external_exports.number().positive().optional().describe("to the base currency; else 1")
65784
+ };
65785
+ var shipLine = external_exports.strictObject({ item: id8, quantity: external_exports.number().positive(), location: id8.optional(), extra });
65786
+ var plainRecord = external_exports.strictObject({
65787
+ type: external_exports.string().regex(/^[A-Za-z][A-Za-z0-9_]{0,99}$/).describe("the REST record type, e.g. customrecord_portfolio_kpi or project"),
65788
+ id: external_exports.union([id8, external_exports.string().regex(/^\d{1,10}$/).transform(Number).pipe(id8)]).describe("internal ID, unique within the type"),
65789
+ externalId: external,
65790
+ fields: external_exports.record(external_exports.string().min(1).max(200), external_exports.json()).default({}).describe("field ID \u2192 value as given: text, number, boolean, null, { id, refName }, objects, sublists")
65791
+ });
65792
+ var NetsuiteSeedFieldsSchema = external_exports.strictObject({
65645
65793
  /** The account ID in NetSuite's realm form: 1234567 for production, 1234567_SB1 for a sandbox. */
65646
65794
  account: external_exports.strictObject({ id: external_exports.string().regex(/^\d{4,10}(?:_SB\d{1,2})?$/), company: text11 }).default({ id: "7654321", company: "Acme" }),
65647
65795
  /** The agent's integration record for OAuth 2.0: its redirect URIs, whether it is a public client (PKCE, one-time refresh tokens), and the refresh token lifetime. */
@@ -65674,18 +65822,19 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65674
65822
  /** Accounting periods through this month (YYYY-MM, or -1m for the month before the scene's) are closed: no posting into them. */
65675
65823
  closedThrough: external_exports.string().regex(/^(?:\d{4}-(?:0[1-9]|1[0-2])|-\d+m)$/).optional()
65676
65824
  }).default({ reconcile: "full", billApproval: true, approveBills: true, salesOrderApproval: false, purchaseOrderApproval: false, returnApproval: false }),
65677
- subsidiaries: external_exports.array(external_exports.strictObject({ id: id8, name: text11, legalName: text11.optional(), country: external_exports.string().regex(/^[A-Z]{2}$/).default("US") })).min(1).max(50).default([{ id: 1, name: "Acme", country: "US" }]),
65678
- currencies: external_exports.array(external_exports.strictObject({ id: id8, name: text11, symbol: external_exports.string().regex(/^[A-Z]{3}$/), exchangeRate: external_exports.number().positive().default(1) })).min(1).max(50).default([{ id: 1, name: "US Dollar", symbol: "USD", exchangeRate: 1 }]),
65825
+ subsidiaries: external_exports.array(external_exports.strictObject({ id: id8, name: text11, legalName: text11.optional(), country: external_exports.string().regex(/^[A-Z]{2}$/).default("US"), extra })).min(1).max(50).default([{ id: 1, name: "Acme", country: "US" }]),
65826
+ currencies: external_exports.array(external_exports.strictObject({ id: id8, name: text11, symbol: external_exports.string().regex(/^[A-Z]{3}$/), exchangeRate: external_exports.number().positive().default(1), extra })).min(1).max(50).default([{ id: 1, name: "US Dollar", symbol: "USD", exchangeRate: 1 }]),
65679
65827
  terms: external_exports.array(external_exports.strictObject({
65680
65828
  id: id8,
65681
65829
  name: text11,
65682
65830
  days: external_exports.number().int().min(0).max(365),
65683
65831
  discountPercent: external_exports.number().min(0).max(100).optional(),
65684
- discountDays: external_exports.number().int().min(0).max(365).optional()
65832
+ discountDays: external_exports.number().int().min(0).max(365).optional(),
65833
+ extra
65685
65834
  })).max(50).default([{ id: 1, name: "Net 15", days: 15 }, { id: 2, name: "Net 30", days: 30 }, { id: 3, name: "Due on receipt", days: 0 }]),
65686
- departments: external_exports.array(external_exports.strictObject({ id: id8, name: text11, parent: id8.optional(), inactive: external_exports.boolean().default(false) })).max(500).default([]),
65687
- locations: external_exports.array(external_exports.strictObject({ id: id8, name: text11, parent: id8.optional(), inactive: external_exports.boolean().default(false), address: address5.omit({ defaultBilling: true, defaultShipping: true }).optional() })).max(500).default([]),
65688
- classes: external_exports.array(external_exports.strictObject({ id: id8, name: text11, parent: id8.optional(), inactive: external_exports.boolean().default(false) })).max(500).default([]),
65835
+ departments: external_exports.array(external_exports.strictObject({ id: id8, name: text11, parent: id8.optional(), inactive: external_exports.boolean().default(false), extra })).max(500).default([]),
65836
+ locations: external_exports.array(external_exports.strictObject({ id: id8, name: text11, parent: id8.optional(), inactive: external_exports.boolean().default(false), address: address5.omit({ defaultBilling: true, defaultShipping: true }).optional(), extra })).max(500).default([]),
65837
+ classes: external_exports.array(external_exports.strictObject({ id: id8, name: text11, parent: id8.optional(), inactive: external_exports.boolean().default(false), extra })).max(500).default([]),
65689
65838
  accounts: external_exports.array(external_exports.strictObject({
65690
65839
  id: id8,
65691
65840
  number: external_exports.string().max(60).optional(),
@@ -65695,12 +65844,13 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65695
65844
  description: long.optional(),
65696
65845
  inactive: external_exports.boolean().default(false),
65697
65846
  useMatchBankData: external_exports.boolean().default(true),
65698
- externalId: external
65847
+ externalId: external,
65848
+ extra
65699
65849
  })).max(500).default([]),
65700
65850
  /** Expense report categories and the account each one posts to. */
65701
- expenseCategories: external_exports.array(external_exports.strictObject({ id: id8, name: text11, account: id8, inactive: external_exports.boolean().default(false) })).max(200).default([]),
65851
+ expenseCategories: external_exports.array(external_exports.strictObject({ id: id8, name: text11, account: id8, inactive: external_exports.boolean().default(false), extra })).max(200).default([]),
65702
65852
  /** Exchange rates by date: one transaction currency against the base currency. */
65703
- currencyRates: external_exports.array(external_exports.strictObject({ id: id8, currency: id8, rate: external_exports.number().positive(), date: day5 })).max(5e3).default([]),
65853
+ currencyRates: external_exports.array(external_exports.strictObject({ id: id8, currency: id8, rate: external_exports.number().positive(), date: day5, extra })).max(5e3).default([]),
65704
65854
  customers: external_exports.array(external_exports.strictObject({
65705
65855
  ...entity,
65706
65856
  companyName: text11.optional(),
@@ -65725,7 +65875,8 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65725
65875
  inactive: external_exports.boolean().default(false),
65726
65876
  comments: long.optional(),
65727
65877
  externalId: external,
65728
- custom: custom2
65878
+ custom: custom2,
65879
+ extra
65729
65880
  })).max(5e3).default([]),
65730
65881
  employees: external_exports.array(external_exports.strictObject({
65731
65882
  id: id8,
@@ -65742,7 +65893,9 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65742
65893
  purchaseLimit: money6.optional(),
65743
65894
  inactive: external_exports.boolean().default(false),
65744
65895
  externalId: external,
65745
- custom: custom2
65896
+ custom: custom2,
65897
+ extra,
65898
+ subsidiary: named.optional()
65746
65899
  })).max(5e3).default([]),
65747
65900
  items: external_exports.array(external_exports.strictObject({
65748
65901
  id: id8,
@@ -65762,6 +65915,7 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65762
65915
  inactive: external_exports.boolean().default(false),
65763
65916
  externalId: external,
65764
65917
  custom: custom2,
65918
+ extra,
65765
65919
  /** An inventory item's opening quantity by location, at a unit cost (its cost if left out). */
65766
65920
  onHand: external_exports.array(external_exports.strictObject({ location: id8, quantity: external_exports.number().min(0), unitCost: money6.optional() })).max(100).default([])
65767
65921
  })).max(5e3).default([]),
@@ -65824,19 +65978,20 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65824
65978
  apply: external_exports.array(application).max(500).default([])
65825
65979
  })).max(5e3).default([]),
65826
65980
  vendorPayments: external_exports.array(external_exports.strictObject({ ...tx, vendor: id8, amount: money6.refine((v) => v >= 0, "must be nonnegative"), apAcct: id8.optional(), credit: external_exports.array(application).max(500).default([]), account: id8.optional(), apply: external_exports.array(application).max(500).default([]) })).max(5e3).default([]),
65827
- journalEntries: external_exports.array(external_exports.strictObject({ ...tx, currency: id8.optional(), exchangeRate: external_exports.number().positive().optional(), approval: external_exports.enum(["pending", "approved"]).optional(), lines: external_exports.array(external_exports.strictObject({
65981
+ journalEntries: external_exports.array(external_exports.strictObject({ ...tx, approval: external_exports.enum(["pending", "approved"]).optional(), lines: external_exports.array(external_exports.strictObject({
65828
65982
  account: id8,
65829
65983
  debit: positive.optional(),
65830
65984
  credit: positive.optional(),
65831
65985
  memo: long.optional(),
65832
65986
  entity: id8.optional(),
65833
- ...segments
65987
+ ...segments,
65988
+ extra
65834
65989
  })).min(2).max(500) })).max(5e3).default([]),
65835
65990
  expenseReports: external_exports.array(external_exports.strictObject({
65836
65991
  ...tx,
65837
65992
  employee: id8,
65838
65993
  status: external_exports.enum(["inProgress", "pendingSupervisor", "pendingAccounting", "approved", "rejected"]).default("pendingSupervisor"),
65839
- expenses: external_exports.array(external_exports.strictObject({ category: id8, amount: positive, date: day5.optional(), memo: long.optional(), ...segments })).min(1).max(500)
65994
+ expenses: external_exports.array(external_exports.strictObject({ category: id8, amount: positive, date: day5.optional(), memo: long.optional(), ...segments, extra })).min(1).max(500)
65840
65995
  })).max(5e3).default([]),
65841
65996
  bankingTransactions: external_exports.array(external_exports.strictObject({
65842
65997
  id: id8,
@@ -65845,7 +66000,8 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65845
66000
  date: day5,
65846
66001
  amount: money6.refine((v) => v !== 0, "must be nonzero"),
65847
66002
  memo: long.optional(),
65848
- reference: text11.optional()
66003
+ reference: text11.optional(),
66004
+ extra
65849
66005
  })).max(5e3).default([]),
65850
66006
  bankRecSuggestions: external_exports.array(external_exports.strictObject({
65851
66007
  id: id8,
@@ -65890,8 +66046,15 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65890
66046
  size: external_exports.number().int().min(0).optional(),
65891
66047
  /** Records the file is attached to. */
65892
66048
  attachedTo: external_exports.array(external_exports.strictObject({ type: external_exports.string().max(60), id: id8 })).max(50).default([])
65893
- })).max(5e3).default([])
65894
- }).superRefine((seed2, ctx) => checkSeed(seed2, (path2, message4) => ctx.addIssue({ code: "custom", path: path2, message: message4 })));
66049
+ })).max(5e3).default([]),
66050
+ /** Records of every other type, kept and served as given: REST (list, get, create, update, delete, eid:), SuiteQL and the metadata catalog. */
66051
+ records: external_exports.array(plainRecord).max(1e5).default([]).describe("records of other types (customrecord_*, project, timeBill...), served as given")
66052
+ });
66053
+ var NetsuiteSeedSchema = NetsuiteSeedFieldsSchema.superRefine((seed2, ctx) => {
66054
+ const issue2 = (path2, message4) => ctx.addIssue({ code: "custom", path: path2, message: message4 });
66055
+ checkSeed(seed2, issue2);
66056
+ checkRecords(seed2, issue2);
66057
+ });
65895
66058
  var ITEM_USE = {
65896
66059
  serviceSaleItem: { sale: true, purchase: false },
65897
66060
  servicePurchaseItem: { sale: false, purchase: true },
@@ -65904,7 +66067,74 @@ var ITEM_USE = {
65904
66067
  otherChargeResaleItem: { sale: true, purchase: true },
65905
66068
  inventoryItem: { sale: true, purchase: true, inventory: true }
65906
66069
  };
65907
- function checkSeed(seed2, issue2) {
66070
+ var NETSUITE_LISTED_PROBLEMS = 50;
66071
+ var words = (name3) => name3.replace(/[A-Z]/g, (c) => ` ${c.toLowerCase()}`);
66072
+ var singular = (name3) => words(name3).replace(/ies$/, "y").replace(/s$/, "");
66073
+ var pathParts = (path2) => path2.flatMap((part) => typeof part === "number" ? [part] : part.split(".").flatMap((piece2) => {
66074
+ const m = /^(\w+)\[(\d+)\]$/.exec(piece2);
66075
+ return m ? [m[1], Number(m[2])] : [piece2];
66076
+ }));
66077
+ function recordNamer(seed2) {
66078
+ const symbols = new Map(seed2.currencies.map((c) => [c.id, c.symbol ?? c.name]));
66079
+ const parties = /* @__PURE__ */ new Map();
66080
+ const person3 = (e) => [e.firstName, e.lastName].filter(Boolean).join(" ");
66081
+ for (const c of seed2.customers) parties.set(c.id, { kind: "customer", name: c.companyName ?? person3(c), currency: c.currency });
66082
+ for (const v of seed2.vendors) parties.set(v.id, { kind: "vendor", name: v.companyName, currency: v.currency });
66083
+ for (const e of seed2.employees) parties.set(e.id, { kind: "employee", name: person3(e) });
66084
+ const record4 = (path2) => {
66085
+ const [list, index] = pathParts(path2);
66086
+ const rows = typeof list === "string" ? seed2[list] : void 0;
66087
+ return Array.isArray(rows) && typeof index === "number" && rows[index] && typeof rows[index] === "object" ? { list, row: rows[index] } : void 0;
66088
+ };
66089
+ const party2 = (row) => {
66090
+ for (const kind of ["customer", "vendor", "employee", "entity"]) if (typeof row[kind] === "number") return { id: row[kind], ...parties.get(row[kind]) };
66091
+ return void 0;
66092
+ };
66093
+ const currency = (path2) => {
66094
+ const found = record4(path2), id10 = netsuiteListId(seed2.currencies, found?.row.currency) ?? netsuiteListId(seed2.currencies, found && parties.get(party2(found.row)?.id ?? -1)?.currency) ?? seed2.currencies[0]?.id;
66095
+ return (id10 === void 0 ? void 0 : symbols.get(id10)) ?? "USD";
66096
+ };
66097
+ const label5 = (path2) => {
66098
+ const found = record4(path2);
66099
+ if (!found) return void 0;
66100
+ const { list, row } = found, id10 = row.id === void 0 ? "" : `id ${String(row.id)}`;
66101
+ const name3 = row.companyName ?? (row.firstName !== void 0 ? person3(row) : void 0) ?? row.name ?? row.displayName ?? row.title;
66102
+ if (list === "accounts") return `${[row.number, row.name].filter(Boolean).join(" ")} (${id10})`;
66103
+ if (list === "items") return `${String(row.itemId ?? name3 ?? singular(list))} (${id10})`;
66104
+ if (["customers", "vendors", "contacts", "employees"].includes(list)) {
66105
+ return `${String(row.entityId ?? name3 ?? singular(list))} (${[id10, row.externalId !== void 0 && `external ID ${String(row.externalId)}`].filter(Boolean).join(", ")})`;
66106
+ }
66107
+ if ("date" in row || "tranId" in row) {
66108
+ const who = party2(row);
66109
+ return `${String(row.tranId ?? row.externalId ?? singular(list).trim())} (${[id10, who && `${who.kind ?? "entity"} ${who.id}${who.name ? ` ${who.name}` : ""}`].filter(Boolean).join(", ")})`;
66110
+ }
66111
+ return name3 !== void 0 || id10 ? `${name3 ?? singular(list).trim()}${id10 ? ` (${id10})` : ""}` : void 0;
66112
+ };
66113
+ const value2 = (path2) => {
66114
+ let at = seed2;
66115
+ for (const part of pathParts(path2)) at = at && typeof at === "object" ? at[part] : void 0;
66116
+ return typeof at === "number" || typeof at === "string" ? at : void 0;
66117
+ };
66118
+ const money8 = (path2, amount2) => {
66119
+ const cents3 = Math.round(Math.abs(amount2) * 100), whole = Math.floor(cents3 / 100).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
66120
+ return `${currency(path2)} ${amount2 < 0 ? "-" : ""}${whole}.${String(cents3 % 100).padStart(2, "0")}`;
66121
+ };
66122
+ return { label: label5, value: value2, money: money8 };
66123
+ }
66124
+ function checkSeed(seed2, report) {
66125
+ const named2 = recordNamer(seed2), found = [], money8 = named2.money;
66126
+ const issue2 = (path2, message4) => {
66127
+ const label5 = named2.label(path2), value2 = /^(missing|duplicate)\b/.test(message4) ? named2.value(path2) : void 0;
66128
+ found.push({ path: path2, message: `${label5 ? `${label5}: ` : ""}${message4}${value2 === void 0 ? "" : ` ${value2}`}` });
66129
+ };
66130
+ try {
66131
+ books(seed2, issue2, money8);
66132
+ } finally {
66133
+ for (const problem of found.slice(0, NETSUITE_LISTED_PROBLEMS)) report(problem.path, problem.message);
66134
+ if (found.length > NETSUITE_LISTED_PROBLEMS) report([], `and ${found.length - NETSUITE_LISTED_PROBLEMS} more problems`);
66135
+ }
66136
+ }
66137
+ function books(seed2, issue2, money8) {
65908
66138
  if (seed2.integration.customerCreditLimitHandlingOverride && !seed2.policy.allowCustomerCreditLimitHandlingOverride) issue2(["integration", "customerCreditLimitHandlingOverride"], "credit handling override requires policy permission");
65909
66139
  const round2 = (v) => Math.sign(v) * Math.round(Number(`${Math.abs(v).toFixed(10)}e2`)) / 100 || 0;
65910
66140
  const accountById = new Map(seed2.accounts.map((a) => [a.id, a])), itemById = new Map(seed2.items.map((i) => [i.id, i]));
@@ -65924,14 +66154,17 @@ function checkSeed(seed2, issue2) {
65924
66154
  const categories = ids(seed2.expenseCategories, "expenseCategories"), folders = ids(seed2.folders, "folders");
65925
66155
  ids(seed2.currencyRates, "currencyRates");
65926
66156
  ids(seed2.files, "files");
65927
- void subsidiaries;
65928
- const account2 = (value2, path2, types, label5 = "account") => {
66157
+ const subsidiaryOf = (value2) => netsuiteListId(seed2.subsidiaries, value2), currencyOf = (value2) => netsuiteListId(seed2.currencies, value2);
66158
+ const known = (value2, path2, what) => {
66159
+ if (value2 !== void 0 && (what === "subsidiary" ? subsidiaryOf : currencyOf)(value2) === void 0) issue2(path2, `missing ${what}`);
66160
+ };
66161
+ const account3 = (value2, path2, types, label5 = "account") => {
65929
66162
  if (value2 === void 0) return void 0;
65930
- const known = accountById.get(value2);
65931
- if (!known) issue2(path2, "missing account");
65932
- else if (known.inactive) issue2(path2, "inactive account");
65933
- else if (types && !types.includes(known.type)) issue2(path2, `${label5} must be ${types.join(" or ")}`);
65934
- return known;
66163
+ const known2 = accountById.get(value2);
66164
+ if (!known2) issue2(path2, "missing account");
66165
+ else if (known2.inactive) issue2(path2, "inactive account");
66166
+ else if (types && !types.includes(known2.type)) issue2(path2, `${label5} must be ${types.join(" or ")}`);
66167
+ return known2;
65935
66168
  };
65936
66169
  const segment = (record4, path2) => {
65937
66170
  if (record4.department !== void 0 && !departments.has(record4.department)) issue2([...path2, "department"], "missing department");
@@ -65962,7 +66195,7 @@ function checkSeed(seed2, issue2) {
65962
66195
  }
65963
66196
  }
65964
66197
  }
65965
- for (const [index, c] of seed2.expenseCategories.entries()) account2(c.account, ["expenseCategories", index, "account"]);
66198
+ for (const [index, c] of seed2.expenseCategories.entries()) account3(c.account, ["expenseCategories", index, "account"]);
65966
66199
  for (const [index, r] of seed2.currencyRates.entries()) if (!currencies.has(r.currency)) issue2(["currencyRates", index, "currency"], "missing currency");
65967
66200
  const customers = new Set(seed2.customers.map((c) => c.id)), vendors = new Set(seed2.vendors.map((v) => v.id)), employees = new Set(seed2.employees.map((e) => e.id)), entities = /* @__PURE__ */ new Set();
65968
66201
  for (const [name3, list] of [["customers", seed2.customers], ["vendors", seed2.vendors], ["contacts", seed2.contacts], ["employees", seed2.employees]]) for (const [index, e] of list.entries()) {
@@ -65972,9 +66205,13 @@ function checkSeed(seed2, issue2) {
65972
66205
  for (const [index, c] of seed2.customers.entries()) {
65973
66206
  if (c.isPerson ? !c.firstName || !c.lastName : !c.companyName) issue2(["customers", index], c.isPerson ? "a person needs firstName and lastName" : "a company needs companyName");
65974
66207
  if (c.salesRep !== void 0 && !employees.has(c.salesRep)) issue2(["customers", index, "salesRep"], "missing employee");
65975
- if (c.currency !== void 0 && !currencies.has(c.currency)) issue2(["customers", index, "currency"], "missing currency");
66208
+ known(c.currency, ["customers", index, "currency"], "currency");
66209
+ known(c.subsidiary, ["customers", index, "subsidiary"], "subsidiary");
66210
+ }
66211
+ for (const [index, v] of seed2.vendors.entries()) {
66212
+ known(v.currency, ["vendors", index, "currency"], "currency");
66213
+ known(v.subsidiary, ["vendors", index, "subsidiary"], "subsidiary");
65976
66214
  }
65977
- for (const [index, v] of seed2.vendors.entries()) if (v.currency !== void 0 && !currencies.has(v.currency)) issue2(["vendors", index, "currency"], "missing currency");
65978
66215
  for (const [list, name3] of [[seed2.customers, "customers"], [seed2.vendors, "vendors"]]) for (const [index, e] of list.entries()) {
65979
66216
  if (e.terms !== void 0 && !terms.has(e.terms)) issue2([name3, index, "terms"], "missing term");
65980
66217
  if (e.addresses.filter((a) => a.defaultBilling).length > 1 || e.addresses.filter((a) => a.defaultShipping).length > 1) issue2([name3, index, "addresses"], "one default billing and one default shipping address");
@@ -65982,14 +66219,15 @@ function checkSeed(seed2, issue2) {
65982
66219
  for (const [index, c] of seed2.contacts.entries()) if (c.company !== void 0 && !customers.has(c.company) && !vendors.has(c.company)) issue2(["contacts", index, "company"], "missing customer or vendor");
65983
66220
  for (const [index, e] of seed2.employees.entries()) {
65984
66221
  if (e.supervisor !== void 0 && (!employees.has(e.supervisor) || e.supervisor === e.id)) issue2(["employees", index, "supervisor"], "missing employee");
66222
+ known(e.subsidiary, ["employees", index, "subsidiary"], "subsidiary");
65985
66223
  segment(e, ["employees", index]);
65986
66224
  }
65987
66225
  for (const [index, item2] of seed2.items.entries()) {
65988
66226
  const use = ITEM_USE[item2.type], path2 = ["items", index];
65989
- account2(item2.incomeAccount, [...path2, "incomeAccount"]);
65990
- account2(item2.expenseAccount, [...path2, "expenseAccount"]);
65991
- account2(item2.assetAccount, [...path2, "assetAccount"], ["OthCurrAsset"]);
65992
- account2(item2.cogsAccount, [...path2, "cogsAccount"], ["COGS", "Expense"]);
66227
+ account3(item2.incomeAccount, [...path2, "incomeAccount"]);
66228
+ account3(item2.expenseAccount, [...path2, "expenseAccount"]);
66229
+ account3(item2.assetAccount, [...path2, "assetAccount"], ["OthCurrAsset"]);
66230
+ account3(item2.cogsAccount, [...path2, "cogsAccount"], ["COGS", "Expense"]);
65993
66231
  if (item2.vendor !== void 0 && !vendors.has(item2.vendor)) issue2([...path2, "vendor"], "missing vendor");
65994
66232
  if (use.inventory && (item2.assetAccount === void 0 || item2.cogsAccount === void 0)) issue2(path2, "an inventory item needs assetAccount and cogsAccount");
65995
66233
  if (!use.inventory && item2.onHand.length) issue2([...path2, "onHand"], "only inventory items keep quantities");
@@ -66033,6 +66271,25 @@ function checkSeed(seed2, issue2) {
66033
66271
  txIds.set(t.id, name3);
66034
66272
  }
66035
66273
  for (const name3 of transactions) for (const [index, t] of seed2[name3].entries()) segment(t, [name3, index]);
66274
+ const homes = /* @__PURE__ */ new Map();
66275
+ for (const e of [...seed2.customers, ...seed2.vendors]) homes.set(e.id, { subsidiary: subsidiaryOf(e.subsidiary), currency: currencyOf(e.currency) });
66276
+ for (const e of seed2.employees) homes.set(e.id, { subsidiary: subsidiaryOf(e.subsidiary) });
66277
+ const places = /* @__PURE__ */ new Map();
66278
+ for (const name3 of transactions) for (const [index, t] of seed2[name3].entries()) {
66279
+ known(t.subsidiary, [name3, index, "subsidiary"], "subsidiary");
66280
+ known(t.currency, [name3, index, "currency"], "currency");
66281
+ const home = homes.get(t.customer ?? t.vendor ?? t.employee ?? 0);
66282
+ places.set(t.id, { subsidiary: subsidiaryOf(t.subsidiary) ?? home?.subsidiary ?? seed2.subsidiaries[0]?.id, currency: currencyOf(t.currency) ?? home?.currency ?? seed2.currencies[0]?.id });
66283
+ }
66284
+ const symbol2 = (currency) => seed2.currencies.find((c) => c.id === currency)?.symbol ?? String(currency);
66285
+ const subsidiaryName = (subsidiary) => seed2.subsidiaries.find((c) => c.id === subsidiary)?.name ?? String(subsidiary);
66286
+ const sameBooks = (payment, doc, path2, label5, what) => {
66287
+ const here = places.get(payment), there = places.get(doc);
66288
+ if (!here || !there) return;
66289
+ if (there.currency !== here.currency) issue2(path2, `${label5} ${doc} is in ${symbol2(there.currency)}, the ${what} in ${symbol2(here.currency)}`);
66290
+ else if (there.subsidiary !== here.subsidiary) issue2(path2, `${label5} ${doc} is in subsidiary ${subsidiaryName(there.subsidiary)}, the ${what} in ${subsidiaryName(here.subsidiary)}`);
66291
+ };
66292
+ const KIND = { creditMemos: "credit memo", customerPayments: "payment", vendorPayments: "bill payment", vendorCredits: "bill credit", customerRefunds: "refund" };
66036
66293
  const lines = (name3, index, list, want) => list.forEach((line2, i) => {
66037
66294
  const item2 = itemById.get(line2.item);
66038
66295
  if (!item2) issue2([name3, index, "lines", i, "item"], "missing item");
@@ -66064,7 +66321,8 @@ function checkSeed(seed2, issue2) {
66064
66321
  if (lines2[0]?.pending) issue2(path2, "order is pending approval");
66065
66322
  for (const [i, l] of list.entries()) {
66066
66323
  const open3 = lines2.find((o) => o.item === l.item && o.quantity - o.shipped >= l.quantity - 1e-9);
66067
- if (!open3) issue2([name3, index, "lines", i, "quantity"], "quantity exceeds what remains on the order");
66324
+ const left = Math.max(0, ...lines2.filter((o) => o.item === l.item).map((o) => o.quantity - o.shipped));
66325
+ if (!open3) issue2([name3, index, "lines", i, "quantity"], `quantity exceeds what remains on the order: ${l.quantity} against ${left} remaining`);
66068
66326
  else open3.shipped += l.quantity;
66069
66327
  if (!(who === "customer" ? needsShipping : needsReceipt)(l.item)) issue2([name3, index, "lines", i, "item"], "item is not shipped or received");
66070
66328
  if (itemById.get(l.item)?.type === "inventoryItem" && l.location === void 0 && !seed2.locations.length) issue2([name3, index, "lines", i, "location"], "inventory moves need a location");
@@ -66090,7 +66348,8 @@ function checkSeed(seed2, issue2) {
66090
66348
  }
66091
66349
  const room = (l) => ((who === "customer" ? needsShipping : needsReceipt)(l.item) ? l.shipped : l.quantity) - l.billed;
66092
66350
  const open3 = lines2.find((l) => l.item === line2.item && room(l) >= line2.quantity - 1e-9);
66093
- if (!open3) issue2([name3, index, "lines", i, "quantity"], `quantity exceeds a remaining ${label5} line`);
66351
+ const left = Math.max(0, ...lines2.filter((l) => l.item === line2.item).map(room));
66352
+ if (!open3) issue2([name3, index, "lines", i, "quantity"], `quantity exceeds a remaining ${label5} line: ${line2.quantity} against ${left} remaining`);
66094
66353
  else open3.billed += line2.quantity;
66095
66354
  }
66096
66355
  };
@@ -66101,14 +66360,14 @@ function checkSeed(seed2, issue2) {
66101
66360
  if (!t.lines.length && !t.expenses.length) issue2(["purchaseOrders", index], "an order needs at least one item or expense line");
66102
66361
  if (t.employee !== void 0 && !employees.has(t.employee)) issue2(["purchaseOrders", index, "employee"], "missing employee");
66103
66362
  lines("purchaseOrders", index, t.lines, "purchase");
66104
- t.expenses.forEach((line2, i) => account2(line2.account, ["purchaseOrders", index, "expenses", i, "account"]));
66363
+ t.expenses.forEach((line2, i) => account3(line2.account, ["purchaseOrders", index, "expenses", i, "account"]));
66105
66364
  }
66106
66365
  for (const name3 of ["vendorBills", "vendorCredits"]) for (const [index, t] of seed2[name3].entries()) {
66107
66366
  if (!vendors.has(t.vendor)) issue2([name3, index, "vendor"], "missing vendor");
66108
66367
  if (!t.expenses.length && !t.lines.length) issue2([name3, index], "needs at least one expense or item line");
66109
66368
  t.expenses.forEach((line2, i) => {
66110
- const known = account2(line2.account, [name3, index, "expenses", i, "account"]);
66111
- if (known?.type === "AcctRec" || known?.type === "AcctPay") issue2([name3, index, "expenses", i, "account"], "expense account cannot be receivables or payables");
66369
+ const known2 = account3(line2.account, [name3, index, "expenses", i, "account"]);
66370
+ if (known2?.type === "AcctRec" || known2?.type === "AcctPay") issue2([name3, index, "expenses", i, "account"], "expense account cannot be receivables or payables");
66112
66371
  });
66113
66372
  lines(name3, index, t.lines, "purchase");
66114
66373
  }
@@ -66131,6 +66390,7 @@ function checkSeed(seed2, issue2) {
66131
66390
  const line2 = a.line === void 0 ? void 0 : candidates.find((l) => l.line === a.line);
66132
66391
  const key2 = `${a.doc}:${a.line === void 0 ? "auto" : line2?.line}`;
66133
66392
  if ((a.line === void 0 ? !candidates.length : !line2) || seen.has(key2) || journal.approval === "pending") issue2(path2, "invalid journal application line");
66393
+ else sameBooks(t.id, a.doc, path2, "journal entry", KIND[name3]);
66134
66394
  seen.add(key2);
66135
66395
  continue;
66136
66396
  }
@@ -66142,6 +66402,7 @@ function checkSeed(seed2, issue2) {
66142
66402
  continue;
66143
66403
  }
66144
66404
  if (doc.owner !== owner) issue2(path2, `${label5} belongs to another ${"vendor" in t ? "vendor" : "customer"}`);
66405
+ else sameBooks(t.id, a.doc, path2, label5, KIND[name3]);
66145
66406
  if (doc.approved === false) issue2(path2, `${label5} is not approved`);
66146
66407
  applied.set(a.doc, (applied.get(a.doc) ?? 0) + a.amount);
66147
66408
  }
@@ -66167,18 +66428,20 @@ function checkSeed(seed2, issue2) {
66167
66428
  continue;
66168
66429
  }
66169
66430
  if (doc.owner !== t.customer) issue2(path2, "credit belongs to another customer");
66431
+ else sameBooks(t.id, a.doc, path2, seed2.creditMemos.some((c) => c.id === a.doc) ? "credit memo" : "payment", "refund");
66170
66432
  spent.set(a.doc, (spent.get(a.doc) ?? 0) + a.amount);
66171
66433
  }
66172
66434
  if (!customers.has(t.customer)) issue2(["customerRefunds", index, "customer"], "missing customer");
66173
- account2(t.account, ["customerRefunds", index, "account"], ["Bank"], "refund account");
66435
+ account3(t.account, ["customerRefunds", index, "account"], ["Bank"], "refund account");
66174
66436
  }
66175
66437
  for (const [id10, amount2] of applied) if (round2(amount2) > (totals.get(id10) ?? 0) + 1e-9) {
66176
- const name3 = seed2.invoices.some((t) => t.id === id10) ? "invoices" : "vendorBills";
66177
- issue2([name3, seed2[name3].findIndex((t) => t.id === id10)], `${name3 === "invoices" ? "invoice" : "vendor bill"} is over-applied`);
66438
+ const name3 = seed2.invoices.some((t) => t.id === id10) ? "invoices" : "vendorBills", path2 = [name3, seed2[name3].findIndex((t) => t.id === id10)], total = totals.get(id10) ?? 0;
66439
+ issue2(path2, `${name3 === "invoices" ? "invoice" : "vendor bill"} is over-applied: applications total ${money8(path2, round2(amount2))} against a total of ${money8(path2, total)} (over by ${money8(path2, round2(amount2 - total))})`);
66178
66440
  }
66179
66441
  for (const name3 of ["creditMemos", "customerPayments", "vendorCredits", "vendorPayments"]) for (const [index, t] of seed2[name3].entries()) {
66180
66442
  const total = ("amount" in t ? t.amount : totals.get(t.id) ?? 0) + ("credit" in t ? t.credit.reduce((sum, a) => sum + a.amount, 0) : 0);
66181
- if (round2(spent.get(t.id) ?? 0) > total + 1e-9) issue2([name3, index, "apply"], `applies more than the ${name3 === "creditMemos" ? "credit memo" : name3 === "vendorCredits" ? "bill credit" : "payment"}`);
66443
+ const used2 = round2(spent.get(t.id) ?? 0), path2 = [name3, index, "apply"];
66444
+ if (used2 > total + 1e-9) issue2(path2, `applies more than the ${name3 === "creditMemos" ? "credit memo" : name3 === "vendorCredits" ? "bill credit" : "payment"}: ${money8(path2, used2)} against ${money8(path2, round2(total))} (over by ${money8(path2, round2(used2 - total))})`);
66182
66445
  }
66183
66446
  const open2 = [];
66184
66447
  const ar = seed2.accounts.find((a) => a.type === "AcctRec" && !a.inactive)?.id, ap = seed2.accounts.find((a) => a.type === "AcctPay" && !a.inactive)?.id;
@@ -66209,7 +66472,7 @@ function checkSeed(seed2, issue2) {
66209
66472
  if (!extended2) continue;
66210
66473
  const owner = "customer" in t ? t.customer : t.vendor, control = "arAcct" in t ? t.arAcct : "apAcct" in t ? t.apAcct : void 0;
66211
66474
  const acct = control ?? ("customer" in t ? ar : ap) ?? 0;
66212
- if (control !== void 0) account2(control, [name3, index, "customer" in t ? "arAcct" : "apAcct"], ["customer" in t ? "AcctRec" : "AcctPay"]);
66475
+ if (control !== void 0) account3(control, [name3, index, "customer" in t ? "arAcct" : "apAcct"], ["customer" in t ? "AcctRec" : "AcctPay"]);
66213
66476
  let gross = 0, credit = 0;
66214
66477
  const before = new Map(used);
66215
66478
  for (const [role2, list] of [["debt", t.apply], ["credit", "credit" in t ? t.credit : []]]) {
@@ -66226,23 +66489,23 @@ function checkSeed(seed2, issue2) {
66226
66489
  seen.add(key2);
66227
66490
  const amount2 = round2((used.get(key2) ?? 0) + a.amount);
66228
66491
  used.set(key2, amount2);
66229
- if (amount2 > item2.amount + 4e-3) issue2(path2, "application exceeds the open line amount");
66492
+ if (amount2 > item2.amount + 4e-3) issue2(path2, `application exceeds the open line amount: ${money8(path2, amount2)} applied against ${money8(path2, item2.amount)} open`);
66230
66493
  if (role2 === "debt") gross += a.amount;
66231
66494
  else credit += a.amount;
66232
66495
  }
66233
66496
  }
66234
66497
  const cash = "amount" in t ? t.amount : totals.get(t.id) ?? 0;
66235
- if (credit > gross + 4e-3 || gross > cash + credit + 4e-3 || cash === 0 && !(gross > 0 && round2(gross) === round2(credit))) issue2([name3, index], "application requires cash or matching selected credits");
66498
+ if (credit > gross + 4e-3 || gross > cash + credit + 4e-3 || cash === 0 && !(gross > 0 && round2(gross) === round2(credit))) issue2([name3, index], `application requires cash or matching selected credits: applies ${money8([name3, index], round2(gross))} with ${money8([name3, index], cash)} in cash and ${money8([name3, index], round2(credit))} in credits`);
66236
66499
  }
66237
66500
  for (const [index, t] of seed2.customerPayments.entries()) {
66238
66501
  if (!customers.has(t.customer)) issue2(["customerPayments", index, "customer"], "missing customer");
66239
- account2(t.account, ["customerPayments", index, "account"], ["Bank", "OthCurrAsset"], "payment account");
66502
+ account3(t.account, ["customerPayments", index, "account"], ["Bank", "OthCurrAsset"], "payment account");
66240
66503
  }
66241
- for (const [index, t] of seed2.cashSales.entries()) account2(t.account, ["cashSales", index, "account"], ["Bank", "OthCurrAsset"], "deposit account");
66504
+ for (const [index, t] of seed2.cashSales.entries()) account3(t.account, ["cashSales", index, "account"], ["Bank", "OthCurrAsset"], "deposit account");
66242
66505
  const refunded = /* @__PURE__ */ new Map();
66243
66506
  if (seed2.cashRefunds.length && !seed2.accounts.some((a) => a.type === "Bank" && !a.inactive)) issue2(["cashRefunds"], "cash refunds require an active bank account");
66244
66507
  for (const [index, t] of seed2.cashRefunds.entries()) {
66245
- account2(t.account, ["cashRefunds", index, "account"], ["Bank"], "refund account");
66508
+ account3(t.account, ["cashRefunds", index, "account"], ["Bank"], "refund account");
66246
66509
  if (t.cashSale === void 0) continue;
66247
66510
  const sale = seed2.cashSales.find((s) => s.id === t.cashSale);
66248
66511
  if (!sale || sale.customer !== t.customer) {
@@ -66252,34 +66515,35 @@ function checkSeed(seed2, issue2) {
66252
66515
  for (const line2 of t.lines) {
66253
66516
  const key2 = `${sale.id}:${line2.item}`, quantity = (refunded.get(key2) ?? 0) + line2.quantity;
66254
66517
  refunded.set(key2, quantity);
66255
- if (quantity > sale.lines.filter((l) => l.item === line2.item).reduce((s, l) => s + l.quantity, 0)) issue2(["cashRefunds", index, "lines"], "refund exceeds the cash sale quantity");
66518
+ const sold = sale.lines.filter((l) => l.item === line2.item).reduce((s, l) => s + l.quantity, 0);
66519
+ if (quantity > sold) issue2(["cashRefunds", index, "lines"], `refund exceeds the cash sale quantity: ${quantity} refunded against ${sold} sold`);
66256
66520
  }
66257
66521
  }
66258
66522
  for (const [index, t] of seed2.customerDeposits.entries()) {
66259
66523
  if (!customers.has(t.customer)) issue2(["customerDeposits", index, "customer"], "missing customer");
66260
- account2(t.account, ["customerDeposits", index, "account"], ["Bank", "OthCurrAsset"], "deposit account");
66524
+ account3(t.account, ["customerDeposits", index, "account"], ["Bank", "OthCurrAsset"], "deposit account");
66261
66525
  if (t.salesOrder !== void 0 && !seed2.salesOrders.some((o) => o.id === t.salesOrder && o.customer === t.customer)) issue2(["customerDeposits", index, "salesOrder"], "missing sales order of this customer");
66262
66526
  }
66263
66527
  for (const [index, t] of seed2.vendorPayments.entries()) {
66264
66528
  if (!vendors.has(t.vendor) && !employees.has(t.vendor)) issue2(["vendorPayments", index, "vendor"], "missing vendor or employee");
66265
- account2(t.account, ["vendorPayments", index, "account"], ["Bank"], "payment account");
66529
+ account3(t.account, ["vendorPayments", index, "account"], ["Bank"], "payment account");
66266
66530
  }
66267
66531
  for (const [index, t] of seed2.journalEntries.entries()) {
66268
- if (t.currency !== void 0 && !currencies.has(t.currency)) issue2(["journalEntries", index, "currency"], "missing currency");
66269
66532
  t.lines.forEach((line2, i) => {
66270
- const known = account2(line2.account, ["journalEntries", index, "lines", i, "account"]);
66271
- const named = line2.entity !== void 0 && (customers.has(line2.entity) || vendors.has(line2.entity) || employees.has(line2.entity));
66272
- if (line2.entity !== void 0 && !named) issue2(["journalEntries", index, "lines", i, "entity"], "missing customer, vendor or employee");
66273
- else if ((known?.type === "AcctRec" || known?.type === "AcctPay") && line2.entity === void 0) issue2(["journalEntries", index, "lines", i, "entity"], "a receivables or payables line names its customer, vendor or employee");
66274
- else if (known?.type === "AcctRec" && line2.entity !== void 0 && !customers.has(line2.entity)) issue2(["journalEntries", index, "lines", i, "entity"], "a receivables line names a customer");
66275
- else if (known?.type === "AcctPay" && line2.entity !== void 0 && customers.has(line2.entity)) issue2(["journalEntries", index, "lines", i, "entity"], "a payables line names a vendor or employee");
66533
+ const known2 = account3(line2.account, ["journalEntries", index, "lines", i, "account"]);
66534
+ const named2 = line2.entity !== void 0 && (customers.has(line2.entity) || vendors.has(line2.entity) || employees.has(line2.entity));
66535
+ if (line2.entity !== void 0 && !named2) issue2(["journalEntries", index, "lines", i, "entity"], "missing customer, vendor or employee");
66536
+ else if ((known2?.type === "AcctRec" || known2?.type === "AcctPay") && line2.entity === void 0) issue2(["journalEntries", index, "lines", i, "entity"], "a receivables or payables line names its customer, vendor or employee");
66537
+ else if (known2?.type === "AcctRec" && line2.entity !== void 0 && !customers.has(line2.entity)) issue2(["journalEntries", index, "lines", i, "entity"], "a receivables line names a customer");
66538
+ else if (known2?.type === "AcctPay" && line2.entity !== void 0 && customers.has(line2.entity)) issue2(["journalEntries", index, "lines", i, "entity"], "a payables line names a vendor or employee");
66276
66539
  const party2 = seed2.customers.find((e) => e.id === line2.entity) ?? seed2.vendors.find((e) => e.id === line2.entity);
66277
- if (named && ["AcctRec", "AcctPay"].includes(known?.type ?? "") && (party2?.currency ?? seed2.currencies[0]?.id) !== (t.currency ?? seed2.currencies[0]?.id)) issue2(["journalEntries", index, "lines", i, "entity"], "journal currency must match the named entity currency");
66540
+ if (named2 && ["AcctRec", "AcctPay"].includes(known2?.type ?? "") && (currencyOf(party2?.currency) ?? seed2.currencies[0]?.id) !== (currencyOf(t.currency) ?? seed2.currencies[0]?.id)) issue2(["journalEntries", index, "lines", i, "entity"], "journal currency must match the named entity currency");
66278
66541
  if (line2.debit === void 0 === (line2.credit === void 0)) issue2(["journalEntries", index, "lines", i], "a line has a debit or a credit");
66279
66542
  segment(line2, ["journalEntries", index, "lines", i]);
66280
66543
  });
66281
66544
  const debit = t.lines.reduce((sum, l) => sum + (l.debit ?? 0), 0), credit = t.lines.reduce((sum, l) => sum + (l.credit ?? 0), 0);
66282
- if (Math.abs(debit - credit) > 5e-3) issue2(["journalEntries", index, "lines"], "debits and credits differ");
66545
+ const path2 = ["journalEntries", index, "lines"];
66546
+ if (Math.abs(debit - credit) > 5e-3) issue2(path2, `debits and credits differ: debits ${money8(path2, round2(debit))}, credits ${money8(path2, round2(credit))} (off by ${money8(path2, round2(Math.abs(debit - credit)))})`);
66283
66547
  }
66284
66548
  for (const [index, t] of seed2.expenseReports.entries()) {
66285
66549
  if (!employees.has(t.employee)) issue2(["expenseReports", index, "employee"], "missing employee");
@@ -66297,10 +66561,7 @@ function checkSeed(seed2, issue2) {
66297
66561
  const customs = (name3, list, prefix2) => list.forEach((record4, index) => {
66298
66562
  for (const [key2, value2] of Object.entries(record4.custom ?? {})) {
66299
66563
  const field2 = fieldById.get(key2), path2 = [name3, index, "custom", key2];
66300
- if (!field2) {
66301
- issue2(path2, "undeclared custom field");
66302
- continue;
66303
- }
66564
+ if (!field2) continue;
66304
66565
  if (!key2.startsWith(prefix2)) issue2(path2, `${prefix2} fields belong here`);
66305
66566
  if (value2 === null) continue;
66306
66567
  const ok = field2.type === "checkbox" ? typeof value2 === "boolean" : ["integer", "decimal", "currency"].includes(field2.type) ? typeof value2 === "number" : field2.type === "select" ? typeof value2 === "number" && (!field2.options || field2.options.some((o) => o.id === value2)) : typeof value2 === "string";
@@ -66319,7 +66580,7 @@ function checkSeed(seed2, issue2) {
66319
66580
  const imported = ids(seed2.bankingTransactions, "bankingTransactions");
66320
66581
  ids(seed2.bankRecSuggestions, "bankRecSuggestions");
66321
66582
  for (const [i, b] of seed2.bankingTransactions.entries()) {
66322
- account2(b.account, ["bankingTransactions", i, "account"], ["Bank", "CredCard"]);
66583
+ account3(b.account, ["bankingTransactions", i, "account"], ["Bank", "CredCard"]);
66323
66584
  if (b.subsidiary !== void 0 && !subsidiaries.has(b.subsidiary)) issue2(["bankingTransactions", i, "subsidiary"], "missing subsidiary");
66324
66585
  }
66325
66586
  for (const [i, b] of seed2.bankRecSuggestions.entries()) {
@@ -66339,6 +66600,72 @@ function checkSeed(seed2, issue2) {
66339
66600
  }
66340
66601
  void items;
66341
66602
  }
66603
+ function netsuiteListId(list, value2) {
66604
+ if (value2 !== null && typeof value2 === "object" && !Array.isArray(value2)) {
66605
+ const reference = value2;
66606
+ return reference.id !== void 0 && reference.id !== null && reference.id !== "" ? netsuiteListId(list, reference.id) : netsuiteListId(list, reference.refName);
66607
+ }
66608
+ if (typeof value2 === "number") return list.some((entry2) => entry2.id === value2) ? value2 : void 0;
66609
+ if (typeof value2 !== "string" || value2.trim() === "") return void 0;
66610
+ const key2 = value2.trim().toLowerCase(), leaf = key2.split(" : ").at(-1);
66611
+ const found = list.find((entry2) => entry2.name.toLowerCase() === key2 || entry2.symbol?.toLowerCase() === key2) ?? list.find((entry2) => entry2.name.toLowerCase() === leaf);
66612
+ return found?.id ?? (/^\d{1,10}$/.test(key2) ? netsuiteListId(list, Number(key2)) : void 0);
66613
+ }
66614
+ var NETSUITE_SEED_LISTS = {
66615
+ customer: "customers",
66616
+ vendor: "vendors",
66617
+ contact: "contacts",
66618
+ employee: "employees",
66619
+ account: "accounts",
66620
+ subsidiary: "subsidiaries",
66621
+ currency: "currencies",
66622
+ term: "terms",
66623
+ department: "departments",
66624
+ location: "locations",
66625
+ classification: "classes",
66626
+ expenseCategory: "expenseCategories",
66627
+ currencyRate: "currencyRates",
66628
+ bankingTransaction: "bankingTransactions",
66629
+ bankRecSuggestion: "bankRecSuggestions",
66630
+ estimate: "estimates",
66631
+ salesOrder: "salesOrders",
66632
+ itemFulfillment: "itemFulfillments",
66633
+ invoice: "invoices",
66634
+ cashSale: "cashSales",
66635
+ cashRefund: "cashRefunds",
66636
+ creditMemo: "creditMemos",
66637
+ customerPayment: "customerPayments",
66638
+ customerDeposit: "customerDeposits",
66639
+ customerRefund: "customerRefunds",
66640
+ purchaseOrder: "purchaseOrders",
66641
+ itemReceipt: "itemReceipts",
66642
+ vendorBill: "vendorBills",
66643
+ vendorCredit: "vendorCredits",
66644
+ vendorPayment: "vendorPayments",
66645
+ journalEntry: "journalEntries",
66646
+ expenseReport: "expenseReports",
66647
+ ...Object.fromEntries(NETSUITE_ITEM_TYPES.map((type) => [type, "items"]))
66648
+ };
66649
+ function netsuiteSeedList(seed2, type) {
66650
+ const list = NETSUITE_SEED_LISTS[type];
66651
+ if (list === void 0) return [];
66652
+ return list === "items" ? seed2.items.filter((item2) => item2.type === type) : seed2[list];
66653
+ }
66654
+ function checkRecords(seed2, issue2) {
66655
+ const seen = /* @__PURE__ */ new Map();
66656
+ for (const [index, record4] of seed2.records.entries()) {
66657
+ const key2 = record4.type.toLowerCase(), ids = seen.get(key2) ?? /* @__PURE__ */ new Set();
66658
+ if (ids.has(record4.id)) issue2(["records", index, "id"], `duplicate ID ${record4.id} for ${record4.type}`);
66659
+ ids.add(record4.id);
66660
+ seen.set(key2, ids);
66661
+ }
66662
+ for (const key2 of seen.keys()) {
66663
+ const modeled = netsuiteRecordTypes.find((type) => type.toLowerCase() === key2);
66664
+ if (modeled === void 0 || !netsuiteSeedList(seed2, modeled).length) continue;
66665
+ const index = seed2.records.findIndex((record4) => record4.type.toLowerCase() === key2);
66666
+ issue2(["records", index, "type"], `${modeled} records are also in ${NETSUITE_SEED_LISTS[modeled]}: keep the type in one of the two`);
66667
+ }
66668
+ }
66342
66669
  var netsuiteStarterSeed = {
66343
66670
  account: { id: "7654321", company: "Acme" },
66344
66671
  policy: { billApproval: true, approveBills: true, salesOrderApproval: false },
@@ -66404,10 +66731,11 @@ var netsuiteStarterSeed = {
66404
66731
  };
66405
66732
  var NetsuiteRecordCheckSchema = external_exports.strictObject({
66406
66733
  type: external_exports.enum(netsuiteRecordTypes),
66407
- id: id8,
66734
+ id: id8.optional(),
66735
+ externalId: text11.optional(),
66408
66736
  fields: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
66409
66737
  apply: external_exports.array(application).optional()
66410
- });
66738
+ }).refine((check3) => check3.id === void 0 !== (check3.externalId === void 0), { message: "name the record with id or with externalId, not both", path: ["id"] });
66411
66739
  var NetsuiteUnchangedCheckSchema = external_exports.strictObject({ types: external_exports.array(external_exports.enum(netsuiteRecordTypes)).min(1) });
66412
66740
  var NetsuiteCountCheckSchema = external_exports.strictObject({ type: external_exports.enum(netsuiteRecordTypes), count: external_exports.number().int().min(0) });
66413
66741
 
@@ -66681,6 +67009,7 @@ var CheckSchema = external_exports.union([
66681
67009
  external_exports.strictObject({ id: external_exports.string(), state: StateCheckSchema }),
66682
67010
  external_exports.strictObject({ id: external_exports.string(), trace: TraceCheckSchema }),
66683
67011
  external_exports.strictObject({ id: external_exports.string(), judge: external_exports.string() }),
67012
+ external_exports.strictObject({ id: external_exports.string(), answer: AnswerCheckSchema }),
66684
67013
  ...ProcessCheckSchemas
66685
67014
  ]);
66686
67015
  var SceneSchema = external_exports.strictObject({
@@ -66721,7 +67050,7 @@ var metric = new RegExp(`^(avg|sum|min|max):([A-Za-z_][A-Za-z0-9_.]*)\\{([^{}]+)
66721
67050
 
66722
67051
  // packages/core/src/scene/load.ts
66723
67052
  var import_yaml = __toESM(require_dist3(), 1);
66724
- var CHECK_KINDS = ["state", "trace", "judge", ...PROCESS_CHECK_KINDS];
67053
+ var CHECK_KINDS = ["state", "trace", "judge", "answer", ...PROCESS_CHECK_KINDS];
66725
67054
  var ChecksSchema = external_exports.array(CheckSchema);
66726
67055
 
66727
67056
  // packages/core/src/addresses.ts
@@ -66767,6 +67096,58 @@ var WorldFileSchema = external_exports.strictObject({ version: external_exports.
66767
67096
  var BODY_KEYS = Object.keys(body2);
66768
67097
  var FILE_KEYS = ["version", "id", ...BODY_KEYS];
66769
67098
 
67099
+ // packages/core/src/datasets/netsuite-pe/generate.ts
67100
+ var ACCOUNTS = [
67101
+ { id: 1, number: "1000", name: "Operating Checking", type: "Bank" },
67102
+ { id: 2, number: "1010", name: "Payroll Checking", type: "Bank" },
67103
+ { id: 3, number: "1020", name: "Lockbox Collections", type: "Bank" },
67104
+ { id: 4, number: "1050", name: "Operating Account EUR", type: "Bank" },
67105
+ { id: 5, number: "1100", name: "Accounts Receivable", type: "AcctRec" },
67106
+ { id: 6, number: "1200", name: "Undeposited Funds", type: "OthCurrAsset" },
67107
+ { id: 7, number: "1300", name: "Inventory Asset", type: "OthCurrAsset" },
67108
+ { id: 8, number: "1400", name: "Prepaid Expenses", type: "OthCurrAsset" },
67109
+ { id: 9, number: "1500", name: "Machinery & Equipment", type: "FixedAsset" },
67110
+ { id: 10, number: "1590", name: "Accumulated Depreciation", type: "FixedAsset" },
67111
+ { id: 11, number: "2000", name: "Accounts Payable", type: "AcctPay" },
67112
+ { id: 12, number: "2050", name: "Inventory Received Not Billed", type: "OthCurrLiab" },
67113
+ { id: 13, number: "2100", name: "Accrued Expenses", type: "OthCurrLiab" },
67114
+ { id: 14, number: "2150", name: "Accrued Payroll", type: "OthCurrLiab" },
67115
+ { id: 15, number: "2200", name: "Customer Deposits", type: "OthCurrLiab" },
67116
+ { id: 16, number: "2500", name: "Revolving Credit Facility", type: "LongTermLiab" },
67117
+ { id: 17, number: "3000", name: "Retained Earnings", type: "Equity" },
67118
+ { id: 18, number: "4000", name: "Product Sales", type: "Income" },
67119
+ { id: 19, number: "4100", name: "Service Revenue", type: "Income" },
67120
+ { id: 20, number: "5000", name: "Cost of Goods Sold", type: "COGS" },
67121
+ { id: 21, number: "5100", name: "Purchase Price Variance", type: "COGS" },
67122
+ { id: 22, number: "6000", name: "Salaries & Wages", type: "Expense" },
67123
+ { id: 23, number: "6050", name: "Temporary Labor", type: "Expense" },
67124
+ { id: 24, number: "6100", name: "Rent", type: "Expense" },
67125
+ { id: 25, number: "6150", name: "Sales Commissions", type: "Expense" },
67126
+ { id: 26, number: "6200", name: "Utilities", type: "Expense" },
67127
+ { id: 27, number: "6300", name: "Freight & Logistics", type: "Expense" },
67128
+ { id: 28, number: "6400", name: "Professional Fees", type: "Expense" },
67129
+ { id: 29, number: "6500", name: "Software & IT", type: "Expense" },
67130
+ { id: 30, number: "6600", name: "Travel", type: "Expense" },
67131
+ { id: 31, number: "6650", name: "Meals", type: "Expense" },
67132
+ { id: 32, number: "6680", name: "Mileage", type: "Expense" },
67133
+ { id: 33, number: "6700", name: "Insurance", type: "Expense" },
67134
+ { id: 34, number: "6800", name: "Repairs & Maintenance", type: "Expense" },
67135
+ { id: 35, number: "6900", name: "Bank Fees", type: "Expense" },
67136
+ { id: 36, number: "6950", name: "Depreciation", type: "Expense" },
67137
+ { id: 37, number: "6970", name: "Management Fees", type: "Expense" },
67138
+ { id: 38, number: "7100", name: "Interest Expense", type: "OthExpense" }
67139
+ ];
67140
+ var account2 = (number6) => ACCOUNTS.find((a) => a.number === number6).id;
67141
+ var SUB = { holdings: 1, flow: 2, kell: 3, europe: 4 };
67142
+ var SEGMENT_SUBSIDIARY = { 1: SUB.flow, 2: SUB.kell, 3: SUB.europe };
67143
+ var CATEGORIES = [
67144
+ { id: 1, name: "Travel", account: account2("6600") },
67145
+ { id: 2, name: "Meals", account: account2("6650") },
67146
+ { id: 3, name: "Lodging", account: account2("6600") },
67147
+ { id: 4, name: "Mileage", account: account2("6680") },
67148
+ { id: 5, name: "Supplies", account: account2("6800") }
67149
+ ];
67150
+
66770
67151
  // packages/core/src/test-file.ts
66771
67152
  var StartSchema = external_exports.strictObject({
66772
67153
  message: external_exports.strictObject({ ref: external_exports.string().min(1).optional(), from: external_exports.string().min(1), in: external_exports.string().min(1), text: external_exports.string().min(1), thread_of: external_exports.string().min(1).optional() }).optional(),
@@ -66809,6 +67190,10 @@ var TestFileDocument = external_exports.strictObject({
66809
67190
  pass: SceneSchema.shape.pass
66810
67191
  });
66811
67192
 
67193
+ // packages/core/src/world/file-check.ts
67194
+ var WORLD_FILE_WARN_BYTES = 16 * 1024 * 1024;
67195
+ var WORLD_BUNDLE_FILE_MAX_BYTES = 32 * 1024 * 1024;
67196
+
66812
67197
  // packages/core/src/test-data/schema.ts
66813
67198
  var id9 = external_exports.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
66814
67199
  var version3 = external_exports.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/, "use an exact version, such as 1.0.0");
@@ -67268,6 +67653,23 @@ var SandboxConfigurationSchema = external_exports.strictObject({
67268
67653
  datasets: external_exports.array(DatasetSchema)
67269
67654
  });
67270
67655
 
67656
+ // packages/core/src/tools/netsuite-records.ts
67657
+ var NAMED_TARGETS = {
67658
+ ...Object.fromEntries(netsuiteRecordTypes.map((type) => [type.toLowerCase(), type])),
67659
+ class: "classification",
67660
+ terms: "term",
67661
+ entity: "entity",
67662
+ company: "entity",
67663
+ item: "item",
67664
+ transaction: "transaction",
67665
+ createdfrom: "transaction",
67666
+ salesrep: "employee",
67667
+ supervisor: "employee",
67668
+ postingperiod: "accountingPeriod"
67669
+ };
67670
+ var TRANSACTIONS = new Set(NETSUITE_TRANSACTION_TYPES);
67671
+ var ITEMS = new Set(NETSUITE_ITEM_TYPES);
67672
+
67271
67673
  // backend/src/mcp/configuration.ts
67272
67674
  function validateMcpConnection(connection) {
67273
67675
  let url3;