@ancha-labs/cli 0.4.6 → 0.4.7

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
@@ -10409,7 +10409,7 @@ function isValidCIDRv6(value2) {
10409
10409
  const parts = value2.split("/");
10410
10410
  if (parts.length !== 2)
10411
10411
  return false;
10412
- const [address5, prefix2] = parts;
10412
+ const [address6, prefix2] = parts;
10413
10413
  if (!prefix2)
10414
10414
  return false;
10415
10415
  const prefixNum = Number(prefix2);
@@ -10417,7 +10417,7 @@ function isValidCIDRv6(value2) {
10417
10417
  return false;
10418
10418
  if (prefixNum < 0 || prefixNum > 128)
10419
10419
  return false;
10420
- return isValidIPv6(address5);
10420
+ return isValidIPv6(address6);
10421
10421
  }
10422
10422
  var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
10423
10423
  def.pattern ?? (def.pattern = cidrv6);
@@ -35283,8 +35283,8 @@ var require_validate = /* @__PURE__ */ __commonJSMin(((exports) => {
35283
35283
  if (!jsonPointer) return data;
35284
35284
  }
35285
35285
  let expr = data;
35286
- const segments = jsonPointer.split("/");
35287
- for (const segment of segments) if (segment) {
35286
+ const segments2 = jsonPointer.split("/");
35287
+ for (const segment of segments2) if (segment) {
35288
35288
  data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;
35289
35289
  expr = (0, codegen_1._)`${expr} && ${data}`;
35290
35290
  }
@@ -35684,15 +35684,15 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35684
35684
  };
35685
35685
  input2 = input2.slice(0, zoneSeparator);
35686
35686
  }
35687
- const address5 = normalizeIPv6Address(input2);
35688
- if (address5 === void 0) return {
35687
+ const address6 = normalizeIPv6Address(input2);
35688
+ if (address6 === void 0) return {
35689
35689
  host,
35690
35690
  isIPV6: false,
35691
35691
  error: true
35692
35692
  };
35693
35693
  return {
35694
- host: address5 + (zoneIdentifier ? "%" + zoneIdentifier : ""),
35695
- escapedHost: address5 + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
35694
+ host: address6 + (zoneIdentifier ? "%" + zoneIdentifier : ""),
35695
+ escapedHost: address6 + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
35696
35696
  isIPV6: true
35697
35697
  };
35698
35698
  }
@@ -36844,9 +36844,9 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
36844
36844
  const rules = this.RULES.all;
36845
36845
  metaSchema = JSON.parse(JSON.stringify(metaSchema));
36846
36846
  for (const jsonPointer of keywordsJsonPointers) {
36847
- const segments = jsonPointer.split("/").slice(1);
36847
+ const segments2 = jsonPointer.split("/").slice(1);
36848
36848
  let keywords = metaSchema;
36849
- for (const seg of segments) keywords = keywords[seg];
36849
+ for (const seg of segments2) keywords = keywords[seg];
36850
36850
  for (const key2 in rules) {
36851
36851
  const rule = rules[key2];
36852
36852
  if (typeof rule != "object") continue;
@@ -51255,8 +51255,8 @@ var require_validate2 = /* @__PURE__ */ __commonJSMin2(((exports) => {
51255
51255
  if (!jsonPointer) return data;
51256
51256
  }
51257
51257
  let expr = data;
51258
- const segments = jsonPointer.split("/");
51259
- for (const segment of segments) if (segment) {
51258
+ const segments2 = jsonPointer.split("/");
51259
+ for (const segment of segments2) if (segment) {
51260
51260
  data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;
51261
51261
  expr = (0, codegen_1._)`${expr} && ${data}`;
51262
51262
  }
@@ -51656,15 +51656,15 @@ var require_utils2 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
51656
51656
  };
51657
51657
  input2 = input2.slice(0, zoneSeparator);
51658
51658
  }
51659
- const address5 = normalizeIPv6Address(input2);
51660
- if (address5 === void 0) return {
51659
+ const address6 = normalizeIPv6Address(input2);
51660
+ if (address6 === void 0) return {
51661
51661
  host,
51662
51662
  isIPV6: false,
51663
51663
  error: true
51664
51664
  };
51665
51665
  return {
51666
- host: address5 + (zoneIdentifier ? "%" + zoneIdentifier : ""),
51667
- escapedHost: address5 + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
51666
+ host: address6 + (zoneIdentifier ? "%" + zoneIdentifier : ""),
51667
+ escapedHost: address6 + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
51668
51668
  isIPV6: true
51669
51669
  };
51670
51670
  }
@@ -52816,9 +52816,9 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
52816
52816
  const rules = this.RULES.all;
52817
52817
  metaSchema = JSON.parse(JSON.stringify(metaSchema));
52818
52818
  for (const jsonPointer of keywordsJsonPointers) {
52819
- const segments = jsonPointer.split("/").slice(1);
52819
+ const segments2 = jsonPointer.split("/").slice(1);
52820
52820
  let keywords = metaSchema;
52821
- for (const seg of segments) keywords = keywords[seg];
52821
+ for (const seg of segments2) keywords = keywords[seg];
52822
52822
  for (const key2 in rules) {
52823
52823
  const rule = rules[key2];
52824
52824
  if (typeof rule != "object") continue;
@@ -60905,17 +60905,17 @@ var ResendSeedSchema = external_exports.strictObject({
60905
60905
  })).max(1e3).default([])
60906
60906
  }).superRefine((seed2, ctx) => {
60907
60907
  const issue2 = (path2, message4) => ctx.addIssue({ code: "custom", path: path2, message: message4 });
60908
- const segments = /* @__PURE__ */ new Set();
60908
+ const segments2 = /* @__PURE__ */ new Set();
60909
60909
  seed2.segments.forEach((s, i) => {
60910
- if (segments.has(s.ref)) issue2(["segments", i, "ref"], "duplicate segment ref");
60911
- segments.add(s.ref);
60910
+ if (segments2.has(s.ref)) issue2(["segments", i, "ref"], "duplicate segment ref");
60911
+ segments2.add(s.ref);
60912
60912
  });
60913
60913
  const emails = /* @__PURE__ */ new Set();
60914
60914
  seed2.contacts.forEach((c, i) => {
60915
60915
  if (emails.has(c.email.toLowerCase())) issue2(["contacts", i, "email"], "duplicate contact email");
60916
60916
  emails.add(c.email.toLowerCase());
60917
60917
  c.segments.forEach((s, j) => {
60918
- if (!segments.has(s)) issue2(["contacts", i, "segments", j], `unknown segment ${s}`);
60918
+ if (!segments2.has(s)) issue2(["contacts", i, "segments", j], `unknown segment ${s}`);
60919
60919
  });
60920
60920
  });
60921
60921
  const domains = new Set(seed2.domains.map((d) => d.name));
@@ -60929,7 +60929,7 @@ var ResendSeedSchema = external_exports.strictObject({
60929
60929
  });
60930
60930
  seed2.broadcasts.forEach((b, i) => {
60931
60931
  if (b.html === void 0 && b.text === void 0) issue2(["broadcasts", i], "a broadcast needs html or text");
60932
- if (!segments.has(b.segment)) issue2(["broadcasts", i, "segment"], `unknown segment ${b.segment}`);
60932
+ if (!segments2.has(b.segment)) issue2(["broadcasts", i, "segment"], `unknown segment ${b.segment}`);
60933
60933
  if (b.sent_at !== void 0 && b.scheduled_at !== void 0) issue2(["broadcasts", i], "a broadcast is sent or scheduled, not both");
60934
60934
  sender("broadcasts", i, b.from);
60935
60935
  });
@@ -62932,7 +62932,7 @@ var ZendeskSeedSchema = external_exports.strictObject({
62932
62932
  seed2.users.forEach((entry2, i) => {
62933
62933
  if (entry2.organization !== void 0 && !organizations.has(entry2.organization)) issue2(["users", i, "organization"], `${entry2.organization} is not an organization`);
62934
62934
  });
62935
- const agent = (address5) => ["agent", "admin"].includes(people2.get(address5)?.role ?? "");
62935
+ const agent = (address6) => ["agent", "admin"].includes(people2.get(address6)?.role ?? "");
62936
62936
  if (!agent(seed2.apiUser) || people2.get(seed2.apiUser)?.suspended) issue2(["apiUser"], "the API user must be an active agent or admin");
62937
62937
  seed2.groups.forEach((entry2, i) => {
62938
62938
  if (groups.has(entry2.name)) issue2(["groups", i, "name"], "duplicate name");
@@ -65223,8 +65223,81 @@ function airtableStarterSeed() {
65223
65223
  }
65224
65224
 
65225
65225
  // packages/core/src/tools/netsuite.ts
65226
- var NETSUITE_ACCOUNT_TYPES = ["Bank", "AcctRec", "OthCurrAsset", "AcctPay", "OthCurrLiab", "Equity", "Income", "COGS", "Expense"];
65226
+ var NETSUITE_ACCOUNT_TYPES = [
65227
+ "Bank",
65228
+ "AcctRec",
65229
+ "OthCurrAsset",
65230
+ "FixedAsset",
65231
+ "OthAsset",
65232
+ "AcctPay",
65233
+ "CredCard",
65234
+ "OthCurrLiab",
65235
+ "LongTermLiab",
65236
+ "Equity",
65237
+ "Income",
65238
+ "COGS",
65239
+ "Expense",
65240
+ "OthIncome",
65241
+ "OthExpense",
65242
+ "NonPosting",
65243
+ "DeferRevenue",
65244
+ "DeferExpense",
65245
+ "UnbilledRec"
65246
+ ];
65247
+ var NETSUITE_ITEM_TYPES = [
65248
+ "serviceSaleItem",
65249
+ "servicePurchaseItem",
65250
+ "serviceResaleItem",
65251
+ "nonInventorySaleItem",
65252
+ "nonInventoryPurchaseItem",
65253
+ "nonInventoryResaleItem",
65254
+ "otherChargeSaleItem",
65255
+ "otherChargePurchaseItem",
65256
+ "otherChargeResaleItem",
65257
+ "inventoryItem"
65258
+ ];
65259
+ var NETSUITE_TRANSACTION_TYPES = [
65260
+ "estimate",
65261
+ "salesOrder",
65262
+ "itemFulfillment",
65263
+ "invoice",
65264
+ "cashSale",
65265
+ "creditMemo",
65266
+ "customerPayment",
65267
+ "customerDeposit",
65268
+ "depositApplication",
65269
+ "customerRefund",
65270
+ "returnAuthorization",
65271
+ "purchaseOrder",
65272
+ "itemReceipt",
65273
+ "vendorBill",
65274
+ "vendorCredit",
65275
+ "vendorPayment",
65276
+ "vendorReturnAuthorization",
65277
+ "journalEntry",
65278
+ "expenseReport"
65279
+ ];
65280
+ var netsuiteRecordTypes = [
65281
+ "customer",
65282
+ "vendor",
65283
+ "contact",
65284
+ "employee",
65285
+ ...NETSUITE_ITEM_TYPES,
65286
+ "account",
65287
+ "subsidiary",
65288
+ "currency",
65289
+ "term",
65290
+ "department",
65291
+ "location",
65292
+ "classification",
65293
+ "accountingPeriod",
65294
+ "accountingBook",
65295
+ "currencyRate",
65296
+ "expenseCategory",
65297
+ ...NETSUITE_TRANSACTION_TYPES
65298
+ ];
65227
65299
  var text10 = external_exports.string().min(1).max(255);
65300
+ var long = external_exports.string().max(4e3);
65228
65301
  var id7 = external_exports.number().int().positive().max(2e9);
65229
65302
  var money5 = external_exports.number().finite().refine((value2) => Math.round(value2 * 100) === Number((value2 * 100).toFixed(6)), "at most two decimals");
65230
65303
  var positive = money5.refine((value2) => value2 > 0, "must be more than 0");
@@ -65233,78 +65306,289 @@ var day4 = external_exports.string().refine(
65233
65306
  "expected YYYY-MM-DD or an offset in days from the scene start, e.g. -30d"
65234
65307
  );
65235
65308
  var external = text10.optional();
65309
+ 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();
65310
+ var address5 = external_exports.strictObject({
65311
+ label: text10.optional(),
65312
+ addressee: text10.optional(),
65313
+ attention: text10.optional(),
65314
+ addr1: text10,
65315
+ addr2: text10.optional(),
65316
+ city: text10,
65317
+ state: external_exports.string().max(60).optional(),
65318
+ zip: external_exports.string().max(36).optional(),
65319
+ country: external_exports.string().regex(/^[A-Z]{2}$/).default("US"),
65320
+ phone: external_exports.string().max(32).optional(),
65321
+ defaultBilling: external_exports.boolean().default(false),
65322
+ defaultShipping: external_exports.boolean().default(false)
65323
+ });
65324
+ var segments = { department: id7.optional(), location: id7.optional(), class: id7.optional() };
65236
65325
  var entity = {
65237
65326
  id: id7,
65238
65327
  entityId: text10.optional(),
65239
65328
  companyName: text10,
65240
65329
  email: external_exports.email().max(254).optional(),
65241
65330
  phone: external_exports.string().max(32).optional(),
65331
+ fax: external_exports.string().max(32).optional(),
65332
+ url: external_exports.string().max(400).optional(),
65242
65333
  terms: id7.optional(),
65243
65334
  inactive: external_exports.boolean().default(false),
65244
- comments: external_exports.string().max(4e3).optional(),
65245
- externalId: external
65335
+ comments: long.optional(),
65336
+ externalId: external,
65337
+ addresses: external_exports.array(address5).max(50).default([]),
65338
+ custom: custom2
65246
65339
  };
65247
- var itemLine = external_exports.strictObject({ item: id7, quantity: external_exports.number().positive().default(1), rate: money5.optional(), description: external_exports.string().max(4e3).optional() });
65248
- var expenseLine = external_exports.strictObject({ account: id7, amount: positive, memo: external_exports.string().max(4e3).optional() });
65340
+ var itemLine = external_exports.strictObject({
65341
+ item: id7,
65342
+ quantity: external_exports.number().positive().default(1),
65343
+ rate: money5.optional(),
65344
+ description: long.optional(),
65345
+ location: id7.optional(),
65346
+ department: id7.optional(),
65347
+ class: id7.optional(),
65348
+ custom: custom2
65349
+ });
65350
+ var expenseLine = external_exports.strictObject({ account: id7, amount: positive, memo: long.optional(), ...segments, custom: custom2 });
65249
65351
  var application = external_exports.strictObject({ doc: id7, amount: positive });
65250
- var tx = { id: id7, tranId: text10.optional(), date: day4, memo: external_exports.string().max(4e3).optional(), externalId: external };
65352
+ var tx = { id: id7, tranId: text10.optional(), date: day4, memo: long.optional(), externalId: external, ...segments, custom: custom2 };
65353
+ var shipLine = external_exports.strictObject({ item: id7, quantity: external_exports.number().positive(), location: id7.optional() });
65251
65354
  var NetsuiteSeedSchema = external_exports.strictObject({
65252
65355
  /** The account ID in NetSuite's realm form: 1234567 for production, 1234567_SB1 for a sandbox. */
65253
65356
  account: external_exports.strictObject({ id: external_exports.string().regex(/^\d{4,10}(?:_SB\d{1,2})?$/), company: text10 }).default({ id: "7654321", company: "Acme" }),
65357
+ /** 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. */
65358
+ integration: external_exports.strictObject({
65359
+ redirectUris: external_exports.array(external_exports.url({ protocol: /^https?$/ }).max(2e3)).min(1).max(10).default(["https://localhost/netsuite/callback"]),
65360
+ publicClient: external_exports.boolean().default(false),
65361
+ /** 1 to 720 hours; 168 (seven days) for a confidential client and 48 for a public one when absent. */
65362
+ refreshTokenHours: external_exports.number().int().min(1).max(720).optional()
65363
+ }).default({ redirectUris: ["https://localhost/netsuite/callback"], publicClient: false }),
65254
65364
  policy: external_exports.strictObject({
65255
65365
  /** New vendor bills wait for approval, and only an approved bill can be paid. */
65256
65366
  billApproval: external_exports.boolean().default(true),
65257
65367
  /** The integration's role may approve and reject vendor bills. */
65258
65368
  approveBills: external_exports.boolean().default(true),
65259
- /** New sales orders wait for approval before they can be billed. */
65260
- salesOrderApproval: external_exports.boolean().default(false)
65261
- }).default({ billApproval: true, approveBills: true, salesOrderApproval: false }),
65262
- subsidiaries: external_exports.array(external_exports.strictObject({ id: id7, name: text10 })).min(1).max(50).default([{ id: 1, name: "Acme" }]),
65263
- currencies: external_exports.array(external_exports.strictObject({ id: id7, name: text10, symbol: external_exports.string().regex(/^[A-Z]{3}$/) })).min(1).max(50).default([{ id: 1, name: "US Dollar", symbol: "USD" }]),
65264
- terms: external_exports.array(external_exports.strictObject({ id: id7, name: text10, days: external_exports.number().int().min(0).max(365) })).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 }]),
65265
- accounts: external_exports.array(external_exports.strictObject({ id: id7, number: external_exports.string().max(60).optional(), name: text10, type: external_exports.enum(NETSUITE_ACCOUNT_TYPES), inactive: external_exports.boolean().default(false), externalId: external })).max(500).default([]),
65266
- customers: external_exports.array(external_exports.strictObject({ ...entity, creditLimit: money5.optional(), creditHold: external_exports.enum(["AUTO", "ON", "OFF"]).default("AUTO") })).max(5e3).default([]),
65267
- vendors: external_exports.array(external_exports.strictObject(entity)).max(5e3).default([]),
65369
+ /** New sales orders wait for approval before they can be fulfilled or billed. */
65370
+ salesOrderApproval: external_exports.boolean().default(false),
65371
+ /** New purchase orders wait for supervisor approval before they can be received or billed. */
65372
+ purchaseOrderApproval: external_exports.boolean().default(false),
65373
+ /** New return authorizations wait for approval. */
65374
+ returnApproval: external_exports.boolean().default(false),
65375
+ /** Accounting periods through this month (YYYY-MM, or -1m for the month before the scene's) are closed: no posting into them. */
65376
+ closedThrough: external_exports.string().regex(/^(?:\d{4}-(?:0[1-9]|1[0-2])|-\d+m)$/).optional()
65377
+ }).default({ billApproval: true, approveBills: true, salesOrderApproval: false, purchaseOrderApproval: false, returnApproval: false }),
65378
+ subsidiaries: external_exports.array(external_exports.strictObject({ id: id7, name: text10, legalName: text10.optional(), country: external_exports.string().regex(/^[A-Z]{2}$/).default("US") })).min(1).max(50).default([{ id: 1, name: "Acme", country: "US" }]),
65379
+ currencies: external_exports.array(external_exports.strictObject({ id: id7, name: text10, 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 }]),
65380
+ terms: external_exports.array(external_exports.strictObject({
65381
+ id: id7,
65382
+ name: text10,
65383
+ days: external_exports.number().int().min(0).max(365),
65384
+ discountPercent: external_exports.number().min(0).max(100).optional(),
65385
+ discountDays: external_exports.number().int().min(0).max(365).optional()
65386
+ })).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 }]),
65387
+ departments: external_exports.array(external_exports.strictObject({ id: id7, name: text10, parent: id7.optional(), inactive: external_exports.boolean().default(false) })).max(500).default([]),
65388
+ locations: external_exports.array(external_exports.strictObject({ id: id7, name: text10, parent: id7.optional(), inactive: external_exports.boolean().default(false), address: address5.omit({ defaultBilling: true, defaultShipping: true }).optional() })).max(500).default([]),
65389
+ classes: external_exports.array(external_exports.strictObject({ id: id7, name: text10, parent: id7.optional(), inactive: external_exports.boolean().default(false) })).max(500).default([]),
65390
+ accounts: external_exports.array(external_exports.strictObject({
65391
+ id: id7,
65392
+ number: external_exports.string().max(60).optional(),
65393
+ name: text10,
65394
+ type: external_exports.enum(NETSUITE_ACCOUNT_TYPES),
65395
+ parent: id7.optional(),
65396
+ description: long.optional(),
65397
+ inactive: external_exports.boolean().default(false),
65398
+ externalId: external
65399
+ })).max(500).default([]),
65400
+ /** Expense report categories and the account each one posts to. */
65401
+ expenseCategories: external_exports.array(external_exports.strictObject({ id: id7, name: text10, account: id7, inactive: external_exports.boolean().default(false) })).max(200).default([]),
65402
+ /** Exchange rates by date: one transaction currency against the base currency. */
65403
+ currencyRates: external_exports.array(external_exports.strictObject({ id: id7, currency: id7, rate: external_exports.number().positive(), date: day4 })).max(5e3).default([]),
65404
+ customers: external_exports.array(external_exports.strictObject({
65405
+ ...entity,
65406
+ companyName: text10.optional(),
65407
+ isPerson: external_exports.boolean().default(false),
65408
+ firstName: text10.optional(),
65409
+ lastName: text10.optional(),
65410
+ creditLimit: money5.optional(),
65411
+ creditHold: external_exports.enum(["AUTO", "ON", "OFF"]).default("AUTO"),
65412
+ salesRep: id7.optional(),
65413
+ currency: id7.optional()
65414
+ })).max(5e3).default([]),
65415
+ vendors: external_exports.array(external_exports.strictObject({ ...entity, legalName: text10.optional(), accountNumber: external_exports.string().max(99).optional(), is1099Eligible: external_exports.boolean().default(false), currency: id7.optional() })).max(5e3).default([]),
65416
+ contacts: external_exports.array(external_exports.strictObject({
65417
+ id: id7,
65418
+ firstName: text10,
65419
+ lastName: text10.optional(),
65420
+ title: text10.optional(),
65421
+ email: external_exports.email().max(254).optional(),
65422
+ phone: external_exports.string().max(32).optional(),
65423
+ mobilePhone: external_exports.string().max(32).optional(),
65424
+ company: id7.optional(),
65425
+ inactive: external_exports.boolean().default(false),
65426
+ comments: long.optional(),
65427
+ externalId: external,
65428
+ custom: custom2
65429
+ })).max(5e3).default([]),
65430
+ employees: external_exports.array(external_exports.strictObject({
65431
+ id: id7,
65432
+ firstName: text10,
65433
+ lastName: text10,
65434
+ title: text10.optional(),
65435
+ email: external_exports.email().max(254).optional(),
65436
+ phone: external_exports.string().max(32).optional(),
65437
+ supervisor: id7.optional(),
65438
+ ...segments,
65439
+ salesRep: external_exports.boolean().default(false),
65440
+ hireDate: day4.optional(),
65441
+ expenseLimit: money5.optional(),
65442
+ purchaseLimit: money5.optional(),
65443
+ inactive: external_exports.boolean().default(false),
65444
+ externalId: external,
65445
+ custom: custom2
65446
+ })).max(5e3).default([]),
65268
65447
  items: external_exports.array(external_exports.strictObject({
65269
65448
  id: id7,
65449
+ type: external_exports.enum(NETSUITE_ITEM_TYPES).default("serviceSaleItem"),
65270
65450
  itemId: text10,
65271
65451
  displayName: text10.optional(),
65272
- description: external_exports.string().max(4e3).optional(),
65452
+ description: long.optional(),
65453
+ purchaseDescription: long.optional(),
65273
65454
  rate: money5.optional(),
65455
+ cost: money5.optional(),
65274
65456
  incomeAccount: id7.optional(),
65457
+ expenseAccount: id7.optional(),
65458
+ assetAccount: id7.optional(),
65459
+ cogsAccount: id7.optional(),
65460
+ vendor: id7.optional(),
65275
65461
  inactive: external_exports.boolean().default(false),
65276
- externalId: external
65462
+ externalId: external,
65463
+ custom: custom2,
65464
+ /** An inventory item's opening quantity by location, at a unit cost (its cost if left out). */
65465
+ onHand: external_exports.array(external_exports.strictObject({ location: id7, quantity: external_exports.number().min(0), unitCost: money5.optional() })).max(100).default([])
65466
+ })).max(5e3).default([]),
65467
+ estimates: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, terms: id7.optional(), dueDate: day4.optional(), title: text10.optional(), lines: external_exports.array(itemLine).min(1).max(500) })).max(5e3).default([]),
65468
+ salesOrders: external_exports.array(external_exports.strictObject({
65469
+ ...tx,
65470
+ customer: id7,
65471
+ terms: id7.optional(),
65472
+ pendingApproval: external_exports.boolean().default(false),
65473
+ estimate: id7.optional(),
65474
+ salesRep: id7.optional(),
65475
+ lines: external_exports.array(itemLine).min(1).max(500)
65277
65476
  })).max(5e3).default([]),
65278
- salesOrders: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, terms: id7.optional(), pendingApproval: external_exports.boolean().default(false), lines: external_exports.array(itemLine).min(1).max(500) })).max(5e3).default([]),
65477
+ /** A fulfillment ships an order's lines; shipped (the default) moves inventory and posts its cost. */
65478
+ itemFulfillments: external_exports.array(external_exports.strictObject({ ...tx, salesOrder: id7, shipStatus: external_exports.enum(["picked", "packed", "shipped"]).default("shipped"), lines: external_exports.array(shipLine).min(1).max(500) })).max(5e3).default([]),
65279
65479
  /** An invoice billed from a sales order names it in `salesOrder`; its lines bill that order's lines, by item. */
65280
- invoices: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, terms: id7.optional(), dueDate: day4.optional(), salesOrder: id7.optional(), lines: external_exports.array(itemLine).min(1).max(500) })).max(5e3).default([]),
65480
+ invoices: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, terms: id7.optional(), dueDate: day4.optional(), salesOrder: id7.optional(), salesRep: id7.optional(), lines: external_exports.array(itemLine).min(1).max(500) })).max(5e3).default([]),
65481
+ cashSales: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, account: id7.optional(), lines: external_exports.array(itemLine).min(1).max(500) })).max(5e3).default([]),
65281
65482
  creditMemos: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, lines: external_exports.array(itemLine).min(1).max(500), apply: external_exports.array(application).max(500).default([]) })).max(5e3).default([]),
65282
- customerPayments: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, amount: positive, account: id7.optional(), apply: external_exports.array(application).max(500).default([]) })).max(5e3).default([]),
65283
- /** `tranId` on a bill is the vendor's own invoice number. */
65483
+ customerPayments: external_exports.array(external_exports.strictObject({
65484
+ ...tx,
65485
+ customer: id7,
65486
+ amount: positive,
65487
+ account: id7.optional(),
65488
+ checkNumber: external_exports.string().max(60).optional(),
65489
+ apply: external_exports.array(application).max(500).default([])
65490
+ })).max(5e3).default([]),
65491
+ customerDeposits: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, amount: positive, account: id7.optional(), salesOrder: id7.optional() })).max(5e3).default([]),
65492
+ customerRefunds: external_exports.array(external_exports.strictObject({ ...tx, customer: id7, account: id7.optional(), apply: external_exports.array(application).min(1).max(500) })).max(5e3).default([]),
65493
+ purchaseOrders: external_exports.array(external_exports.strictObject({
65494
+ ...tx,
65495
+ vendor: id7,
65496
+ terms: id7.optional(),
65497
+ dueDate: day4.optional(),
65498
+ pendingApproval: external_exports.boolean().default(false),
65499
+ employee: id7.optional(),
65500
+ lines: external_exports.array(itemLine).max(500).default([]),
65501
+ expenses: external_exports.array(expenseLine).max(500).default([])
65502
+ })).max(5e3).default([]),
65503
+ itemReceipts: external_exports.array(external_exports.strictObject({ ...tx, purchaseOrder: id7, lines: external_exports.array(shipLine).min(1).max(500) })).max(5e3).default([]),
65504
+ /** `tranId` on a bill is the vendor's own invoice number; a bill from a purchase order names it and bills its lines by item. */
65284
65505
  vendorBills: external_exports.array(external_exports.strictObject({
65285
65506
  ...tx,
65286
65507
  vendor: id7,
65287
65508
  terms: id7.optional(),
65288
65509
  dueDate: day4.optional(),
65289
65510
  approval: external_exports.enum(["pending", "approved", "rejected"]).optional(),
65511
+ purchaseOrder: id7.optional(),
65290
65512
  expenses: external_exports.array(expenseLine).max(500).default([]),
65291
65513
  lines: external_exports.array(itemLine).max(500).default([])
65292
65514
  })).max(5e3).default([]),
65515
+ vendorCredits: external_exports.array(external_exports.strictObject({
65516
+ ...tx,
65517
+ vendor: id7,
65518
+ expenses: external_exports.array(expenseLine).max(500).default([]),
65519
+ lines: external_exports.array(itemLine).max(500).default([]),
65520
+ apply: external_exports.array(application).max(500).default([])
65521
+ })).max(5e3).default([]),
65293
65522
  vendorPayments: external_exports.array(external_exports.strictObject({ ...tx, vendor: id7, amount: positive, account: id7.optional(), apply: external_exports.array(application).max(500).default([]) })).max(5e3).default([]),
65294
- journalEntries: external_exports.array(external_exports.strictObject({ ...tx, lines: external_exports.array(external_exports.strictObject({ account: id7, debit: positive.optional(), credit: positive.optional(), memo: external_exports.string().max(4e3).optional(), entity: id7.optional() })).min(2).max(500) })).max(5e3).default([])
65295
- }).superRefine((seed2, ctx) => {
65296
- const issue2 = (path2, message4) => ctx.addIssue({ code: "custom", path: path2, message: message4 });
65523
+ journalEntries: external_exports.array(external_exports.strictObject({ ...tx, lines: external_exports.array(external_exports.strictObject({
65524
+ account: id7,
65525
+ debit: positive.optional(),
65526
+ credit: positive.optional(),
65527
+ memo: long.optional(),
65528
+ entity: id7.optional(),
65529
+ ...segments
65530
+ })).min(2).max(500) })).max(5e3).default([]),
65531
+ expenseReports: external_exports.array(external_exports.strictObject({
65532
+ ...tx,
65533
+ employee: id7,
65534
+ status: external_exports.enum(["inProgress", "pendingSupervisor", "pendingAccounting", "approved", "rejected"]).default("pendingSupervisor"),
65535
+ expenses: external_exports.array(external_exports.strictObject({ category: id7, amount: positive, date: day4.optional(), memo: long.optional(), ...segments })).min(1).max(500)
65536
+ })).max(5e3).default([]),
65537
+ /** Custom fields by script ID; the prefix says what they apply to (custentity_ entities, custbody_ transactions, custcol_ transaction lines, custitem_ items). */
65538
+ customFields: external_exports.array(external_exports.strictObject({
65539
+ id: external_exports.string().regex(/^cust(?:entity|body|col|item)[a-z0-9_]+$/),
65540
+ label: text10,
65541
+ type: external_exports.enum(["text", "textArea", "integer", "decimal", "currency", "checkbox", "date", "email", "url", "select"]),
65542
+ /** REST record types the field shows on; every type of its kind if left out. */
65543
+ appliesTo: external_exports.array(external_exports.string()).max(60).optional(),
65544
+ /** A select field lists either these values or records of this type. */
65545
+ options: external_exports.array(external_exports.strictObject({ id: id7, name: text10 })).max(500).optional(),
65546
+ source: external_exports.string().max(60).optional(),
65547
+ mandatory: external_exports.boolean().default(false)
65548
+ })).max(500).default([]),
65549
+ /** Saved searches as ns_listSavedSearches and ns_runSavedSearch see them: NetSuite's filter expression and columns. */
65550
+ savedSearches: external_exports.array(external_exports.strictObject({
65551
+ id: external_exports.string().regex(/^customsearch[a-z0-9_]*$/),
65552
+ internalId: id7,
65553
+ title: text10,
65554
+ type: external_exports.enum(["transaction", "customer", "vendor", "item", "employee", "contact", "account"]),
65555
+ isPublic: external_exports.boolean().default(true),
65556
+ filters: external_exports.array(external_exports.unknown()).max(200).default([]),
65557
+ columns: external_exports.array(external_exports.union([
65558
+ external_exports.string().max(100),
65559
+ external_exports.strictObject({ name: external_exports.string().max(100), summary: external_exports.enum(["group", "count", "sum", "avg", "min", "max"]).optional(), label: text10.optional() })
65560
+ ])).min(1).max(100)
65561
+ })).max(500).default([]),
65562
+ folders: external_exports.array(external_exports.strictObject({ id: id7, name: text10, parent: id7.optional() })).max(1e3).default([]),
65563
+ files: external_exports.array(external_exports.strictObject({
65564
+ id: id7,
65565
+ name: text10,
65566
+ folder: id7,
65567
+ fileType: external_exports.string().regex(/^[A-Z0-9_]+$/).default("PDF"),
65568
+ description: long.optional(),
65569
+ content: external_exports.string().max(1e5).optional(),
65570
+ size: external_exports.number().int().min(0).optional(),
65571
+ /** Records the file is attached to. */
65572
+ attachedTo: external_exports.array(external_exports.strictObject({ type: external_exports.string().max(60), id: id7 })).max(50).default([])
65573
+ })).max(5e3).default([])
65574
+ }).superRefine((seed2, ctx) => checkSeed(seed2, (path2, message4) => ctx.addIssue({ code: "custom", path: path2, message: message4 })));
65575
+ var ITEM_USE = {
65576
+ serviceSaleItem: { sale: true, purchase: false },
65577
+ servicePurchaseItem: { sale: false, purchase: true },
65578
+ serviceResaleItem: { sale: true, purchase: true },
65579
+ nonInventorySaleItem: { sale: true, purchase: false },
65580
+ nonInventoryPurchaseItem: { sale: false, purchase: true },
65581
+ nonInventoryResaleItem: { sale: true, purchase: true },
65582
+ otherChargeSaleItem: { sale: true, purchase: false },
65583
+ otherChargePurchaseItem: { sale: false, purchase: true },
65584
+ otherChargeResaleItem: { sale: true, purchase: true },
65585
+ inventoryItem: { sale: true, purchase: true, inventory: true }
65586
+ };
65587
+ function checkSeed(seed2, issue2) {
65297
65588
  const round2 = (v) => Math.sign(v) * Math.round(Number(`${Math.abs(v).toFixed(10)}e2`)) / 100 || 0;
65298
- const accountById = new Map(seed2.accounts.map((a) => [a.id, a]));
65299
- const itemById = new Map(seed2.items.map((i) => [i.id, i]));
65589
+ const accountById = new Map(seed2.accounts.map((a) => [a.id, a])), itemById = new Map(seed2.items.map((i) => [i.id, i]));
65300
65590
  const itemTotal = (lines2) => round2(lines2.reduce((sum, line2) => sum + round2(line2.quantity * (line2.rate ?? itemById.get(line2.item)?.rate ?? 0)), 0));
65301
- const transactionAccount = (account2, path2) => {
65302
- if (account2 === void 0) return void 0;
65303
- const known = accountById.get(account2);
65304
- if (!known) issue2(path2, "missing account");
65305
- else if (known.inactive) issue2(path2, "inactive account");
65306
- return known;
65307
- };
65591
+ const buyTotal = (lines2) => round2(lines2.reduce((sum, line2) => sum + round2(line2.quantity * (line2.rate ?? itemById.get(line2.item)?.cost ?? itemById.get(line2.item)?.rate ?? 0)), 0));
65308
65592
  const ids = (list, name3) => {
65309
65593
  const seen = /* @__PURE__ */ new Set();
65310
65594
  for (const [index, item2] of list.entries()) {
@@ -65314,16 +65598,81 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65314
65598
  return seen;
65315
65599
  };
65316
65600
  const accounts = ids(seed2.accounts, "accounts"), terms = ids(seed2.terms, "terms"), items = ids(seed2.items, "items");
65317
- ids(seed2.subsidiaries, "subsidiaries");
65318
- ids(seed2.currencies, "currencies");
65319
- const customers = new Set(seed2.customers.map((c) => c.id)), vendors = new Set(seed2.vendors.map((v) => v.id)), entities = /* @__PURE__ */ new Set();
65320
- for (const [name3, list] of [["customers", seed2.customers], ["vendors", seed2.vendors]]) for (const [index, e] of list.entries()) {
65321
- if (entities.has(e.id)) issue2([name3, index, "id"], "customers and vendors share one ID space");
65601
+ const subsidiaries = ids(seed2.subsidiaries, "subsidiaries"), currencies = ids(seed2.currencies, "currencies");
65602
+ const departments = ids(seed2.departments, "departments"), locations = ids(seed2.locations, "locations"), classes = ids(seed2.classes, "classes");
65603
+ const categories = ids(seed2.expenseCategories, "expenseCategories"), folders = ids(seed2.folders, "folders");
65604
+ ids(seed2.currencyRates, "currencyRates");
65605
+ ids(seed2.files, "files");
65606
+ void subsidiaries;
65607
+ const account2 = (value2, path2, types, label5 = "account") => {
65608
+ if (value2 === void 0) return void 0;
65609
+ const known = accountById.get(value2);
65610
+ if (!known) issue2(path2, "missing account");
65611
+ else if (known.inactive) issue2(path2, "inactive account");
65612
+ else if (types && !types.includes(known.type)) issue2(path2, `${label5} must be ${types.join(" or ")}`);
65613
+ return known;
65614
+ };
65615
+ const segment = (record4, path2) => {
65616
+ if (record4.department !== void 0 && !departments.has(record4.department)) issue2([...path2, "department"], "missing department");
65617
+ if (record4.location !== void 0 && !locations.has(record4.location)) issue2([...path2, "location"], "missing location");
65618
+ if (record4.class !== void 0 && !classes.has(record4.class)) issue2([...path2, "class"], "missing class");
65619
+ };
65620
+ for (const [name3, list] of [["departments", seed2.departments], ["locations", seed2.locations], ["classes", seed2.classes]]) {
65621
+ const own2 = new Set(list.map((l) => l.id));
65622
+ for (const [index, l] of list.entries()) if (l.parent !== void 0 && (!own2.has(l.parent) || l.parent === l.id)) issue2([name3, index, "parent"], "missing parent");
65623
+ }
65624
+ for (const [index, a] of seed2.accounts.entries()) if (a.parent !== void 0 && (!accounts.has(a.parent) || a.parent === a.id)) issue2(["accounts", index, "parent"], "missing parent");
65625
+ for (const [index, c] of seed2.expenseCategories.entries()) account2(c.account, ["expenseCategories", index, "account"]);
65626
+ for (const [index, r] of seed2.currencyRates.entries()) if (!currencies.has(r.currency)) issue2(["currencyRates", index, "currency"], "missing currency");
65627
+ 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();
65628
+ for (const [name3, list] of [["customers", seed2.customers], ["vendors", seed2.vendors], ["contacts", seed2.contacts], ["employees", seed2.employees]]) for (const [index, e] of list.entries()) {
65629
+ if (entities.has(e.id)) issue2([name3, index, "id"], "customers, vendors, contacts and employees share one ID space");
65322
65630
  entities.add(e.id);
65323
65631
  }
65324
- for (const [list, name3] of [[seed2.customers, "customers"], [seed2.vendors, "vendors"]]) for (const [index, e] of list.entries()) if (e.terms !== void 0 && !terms.has(e.terms)) issue2([name3, index, "terms"], "missing term");
65325
- for (const [index, item2] of seed2.items.entries()) if (item2.incomeAccount !== void 0 && !accounts.has(item2.incomeAccount)) issue2(["items", index, "incomeAccount"], "missing account");
65326
- const transactions = ["salesOrders", "invoices", "creditMemos", "customerPayments", "vendorBills", "vendorPayments", "journalEntries"];
65632
+ for (const [index, c] of seed2.customers.entries()) {
65633
+ if (c.isPerson ? !c.firstName || !c.lastName : !c.companyName) issue2(["customers", index], c.isPerson ? "a person needs firstName and lastName" : "a company needs companyName");
65634
+ if (c.salesRep !== void 0 && !employees.has(c.salesRep)) issue2(["customers", index, "salesRep"], "missing employee");
65635
+ if (c.currency !== void 0 && !currencies.has(c.currency)) issue2(["customers", index, "currency"], "missing currency");
65636
+ }
65637
+ for (const [index, v] of seed2.vendors.entries()) if (v.currency !== void 0 && !currencies.has(v.currency)) issue2(["vendors", index, "currency"], "missing currency");
65638
+ for (const [list, name3] of [[seed2.customers, "customers"], [seed2.vendors, "vendors"]]) for (const [index, e] of list.entries()) {
65639
+ if (e.terms !== void 0 && !terms.has(e.terms)) issue2([name3, index, "terms"], "missing term");
65640
+ 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");
65641
+ }
65642
+ 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");
65643
+ for (const [index, e] of seed2.employees.entries()) {
65644
+ if (e.supervisor !== void 0 && (!employees.has(e.supervisor) || e.supervisor === e.id)) issue2(["employees", index, "supervisor"], "missing employee");
65645
+ segment(e, ["employees", index]);
65646
+ }
65647
+ for (const [index, item2] of seed2.items.entries()) {
65648
+ const use = ITEM_USE[item2.type], path2 = ["items", index];
65649
+ account2(item2.incomeAccount, [...path2, "incomeAccount"]);
65650
+ account2(item2.expenseAccount, [...path2, "expenseAccount"]);
65651
+ account2(item2.assetAccount, [...path2, "assetAccount"], ["OthCurrAsset"]);
65652
+ account2(item2.cogsAccount, [...path2, "cogsAccount"], ["COGS", "Expense"]);
65653
+ if (item2.vendor !== void 0 && !vendors.has(item2.vendor)) issue2([...path2, "vendor"], "missing vendor");
65654
+ if (use.inventory && (item2.assetAccount === void 0 || item2.cogsAccount === void 0)) issue2(path2, "an inventory item needs assetAccount and cogsAccount");
65655
+ if (!use.inventory && item2.onHand.length) issue2([...path2, "onHand"], "only inventory items keep quantities");
65656
+ for (const [i, h] of item2.onHand.entries()) if (!locations.has(h.location)) issue2([...path2, "onHand", i, "location"], "missing location");
65657
+ }
65658
+ const transactions = [
65659
+ "estimates",
65660
+ "salesOrders",
65661
+ "itemFulfillments",
65662
+ "invoices",
65663
+ "cashSales",
65664
+ "creditMemos",
65665
+ "customerPayments",
65666
+ "customerDeposits",
65667
+ "customerRefunds",
65668
+ "purchaseOrders",
65669
+ "itemReceipts",
65670
+ "vendorBills",
65671
+ "vendorCredits",
65672
+ "vendorPayments",
65673
+ "journalEntries",
65674
+ "expenseReports"
65675
+ ];
65327
65676
  const externalIds = (names) => {
65328
65677
  const seen = /* @__PURE__ */ new Set();
65329
65678
  for (const name3 of names) for (const [index, record4] of seed2[name3].entries()) {
@@ -65333,7 +65682,7 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65333
65682
  seen.add(key2);
65334
65683
  }
65335
65684
  };
65336
- externalIds(["customers", "vendors"]);
65685
+ externalIds(["customers", "vendors", "contacts", "employees"]);
65337
65686
  externalIds(transactions);
65338
65687
  externalIds(["items"]);
65339
65688
  externalIds(["accounts"]);
@@ -65342,114 +65691,217 @@ var NetsuiteSeedSchema = external_exports.strictObject({
65342
65691
  if (txIds.has(t.id)) issue2([name3, index, "id"], "transactions share one ID space");
65343
65692
  txIds.set(t.id, name3);
65344
65693
  }
65345
- const lines = (name3, index, list) => list.forEach((line2, i) => {
65346
- if (!items.has(line2.item)) issue2([name3, index, "lines", i, "item"], "missing item");
65694
+ for (const name3 of transactions) for (const [index, t] of seed2[name3].entries()) segment(t, [name3, index]);
65695
+ const lines = (name3, index, list, want) => list.forEach((line2, i) => {
65696
+ const item2 = itemById.get(line2.item);
65697
+ if (!item2) issue2([name3, index, "lines", i, "item"], "missing item");
65698
+ else if (!ITEM_USE[item2.type][want]) issue2([name3, index, "lines", i, "item"], `item is not for ${want === "sale" ? "sale" : "purchase"}`);
65699
+ if (line2.location !== void 0 && !locations.has(line2.location)) issue2([name3, index, "lines", i, "location"], "missing location");
65347
65700
  });
65348
- for (const name3 of ["salesOrders", "invoices", "creditMemos"]) for (const [index, t] of seed2[name3].entries()) {
65701
+ for (const name3 of ["estimates", "salesOrders", "invoices", "cashSales", "creditMemos"]) for (const [index, t] of seed2[name3].entries()) {
65349
65702
  if (!customers.has(t.customer)) issue2([name3, index, "customer"], "missing customer");
65350
- lines(name3, index, t.lines);
65703
+ lines(name3, index, t.lines, "sale");
65351
65704
  }
65352
- for (const name3 of ["salesOrders", "invoices", "vendorBills"]) for (const [index, t] of seed2[name3].entries()) {
65705
+ for (const name3 of ["estimates", "salesOrders", "invoices", "vendorBills", "purchaseOrders"]) for (const [index, t] of seed2[name3].entries()) {
65353
65706
  if (t.terms !== void 0 && !terms.has(t.terms)) issue2([name3, index, "terms"], "missing term");
65354
65707
  }
65355
- const orderById = new Map(seed2.salesOrders.map((order3) => [order3.id, {
65356
- ...order3,
65357
- lines: order3.lines.map((line2) => ({ ...line2, billed: 0 }))
65358
- }]));
65359
- for (const [index, t] of seed2.invoices.entries()) {
65360
- if (t.salesOrder === void 0) continue;
65361
- const order3 = orderById.get(t.salesOrder), path2 = ["invoices", index, "salesOrder"];
65362
- if (!order3) {
65363
- issue2(path2, "missing sales order");
65364
- continue;
65708
+ for (const [index, t] of seed2.salesOrders.entries()) {
65709
+ if (t.salesRep !== void 0 && !employees.has(t.salesRep)) issue2(["salesOrders", index, "salesRep"], "missing employee");
65710
+ if (t.estimate !== void 0 && !seed2.estimates.some((e) => e.id === t.estimate && e.customer === t.customer)) issue2(["salesOrders", index, "estimate"], "missing estimate of this customer");
65711
+ }
65712
+ const orderLines = /* @__PURE__ */ new Map();
65713
+ for (const o of seed2.salesOrders) orderLines.set(o.id, o.lines.map((l) => ({ item: l.item, quantity: l.quantity, shipped: 0, billed: 0, pending: o.pendingApproval, customer: o.customer })));
65714
+ for (const o of seed2.purchaseOrders) orderLines.set(o.id, o.lines.map((l) => ({ item: l.item, quantity: l.quantity, shipped: 0, billed: 0, pending: o.pendingApproval, vendor: o.vendor })));
65715
+ const needsShipping = (item2) => itemById.get(item2)?.type === "inventoryItem", needsReceipt = needsShipping;
65716
+ const ship = (name3, index, order3, list, who) => {
65717
+ const lines2 = orderLines.get(order3), path2 = [name3, index, who === "customer" ? "salesOrder" : "purchaseOrder"];
65718
+ const kind = who === "customer" ? seed2.salesOrders : seed2.purchaseOrders;
65719
+ if (!lines2 || !kind.some((o) => o.id === order3)) {
65720
+ issue2(path2, `missing ${who === "customer" ? "sales" : "purchase"} order`);
65721
+ return;
65722
+ }
65723
+ if (lines2[0]?.pending) issue2(path2, "order is pending approval");
65724
+ for (const [i, l] of list.entries()) {
65725
+ const open2 = lines2.find((o) => o.item === l.item && o.quantity - o.shipped >= l.quantity - 1e-9);
65726
+ if (!open2) issue2([name3, index, "lines", i, "quantity"], "quantity exceeds what remains on the order");
65727
+ else open2.shipped += l.quantity;
65728
+ if (!(who === "customer" ? needsShipping : needsReceipt)(l.item)) issue2([name3, index, "lines", i, "item"], "item is not shipped or received");
65729
+ 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");
65730
+ if (l.location !== void 0 && !locations.has(l.location)) issue2([name3, index, "lines", i, "location"], "missing location");
65731
+ }
65732
+ };
65733
+ for (const [index, f] of seed2.itemFulfillments.entries()) ship("itemFulfillments", index, f.salesOrder, f.lines, "customer");
65734
+ for (const [index, r] of seed2.itemReceipts.entries()) ship("itemReceipts", index, r.purchaseOrder, r.lines, "vendor");
65735
+ const billFrom = (name3, index, order3, list, who, owner) => {
65736
+ const lines2 = orderLines.get(order3), kind = who === "customer" ? seed2.salesOrders : seed2.purchaseOrders, path2 = [name3, index, who === "customer" ? "salesOrder" : "purchaseOrder"];
65737
+ const label5 = who === "customer" ? "sales order" : "purchase order";
65738
+ if (!lines2 || !kind.some((o) => o.id === order3)) {
65739
+ issue2(path2, `missing ${label5}`);
65740
+ return;
65365
65741
  }
65366
- if (order3.customer !== t.customer) issue2(path2, "sales order belongs to another customer");
65367
- if (order3.pendingApproval) issue2(path2, "sales order is pending approval");
65368
- for (const [i, line2] of t.lines.entries()) {
65369
- if (!order3.lines.some((l) => l.item === line2.item)) {
65370
- issue2(["invoices", index, "lines", i, "item"], "item is not on the sales order");
65742
+ const source = kind.find((o) => o.id === order3);
65743
+ if (("customer" in source ? source.customer : source.vendor) !== owner) issue2(path2, `${label5} belongs to another ${who}`);
65744
+ if (source.pendingApproval) issue2(path2, `${label5} is pending approval`);
65745
+ for (const [i, line2] of list.entries()) {
65746
+ if (!lines2.some((l) => l.item === line2.item)) {
65747
+ issue2([name3, index, "lines", i, "item"], `item is not on the ${label5}`);
65371
65748
  continue;
65372
65749
  }
65373
- const open2 = order3.lines.find((l) => l.item === line2.item && l.quantity - l.billed >= line2.quantity - 1e-9);
65374
- if (!open2) issue2(["invoices", index, "lines", i, "quantity"], "quantity exceeds a remaining sales order line");
65750
+ const room = (l) => ((who === "customer" ? needsShipping : needsReceipt)(l.item) ? l.shipped : l.quantity) - l.billed;
65751
+ const open2 = lines2.find((l) => l.item === line2.item && room(l) >= line2.quantity - 1e-9);
65752
+ if (!open2) issue2([name3, index, "lines", i, "quantity"], `quantity exceeds a remaining ${label5} line`);
65375
65753
  else open2.billed += line2.quantity;
65376
65754
  }
65755
+ };
65756
+ for (const [index, t] of seed2.invoices.entries()) if (t.salesOrder !== void 0) billFrom("invoices", index, t.salesOrder, t.lines, "customer", t.customer);
65757
+ for (const [index, t] of seed2.vendorBills.entries()) if (t.purchaseOrder !== void 0) billFrom("vendorBills", index, t.purchaseOrder, t.lines, "vendor", t.vendor);
65758
+ for (const [index, t] of seed2.purchaseOrders.entries()) {
65759
+ if (!vendors.has(t.vendor)) issue2(["purchaseOrders", index, "vendor"], "missing vendor");
65760
+ if (!t.lines.length && !t.expenses.length) issue2(["purchaseOrders", index], "an order needs at least one item or expense line");
65761
+ if (t.employee !== void 0 && !employees.has(t.employee)) issue2(["purchaseOrders", index, "employee"], "missing employee");
65762
+ lines("purchaseOrders", index, t.lines, "purchase");
65763
+ t.expenses.forEach((line2, i) => account2(line2.account, ["purchaseOrders", index, "expenses", i, "account"]));
65377
65764
  }
65378
- for (const [index, t] of seed2.vendorBills.entries()) {
65379
- if (!vendors.has(t.vendor)) issue2(["vendorBills", index, "vendor"], "missing vendor");
65380
- if (!t.expenses.length && !t.lines.length) issue2(["vendorBills", index], "a bill needs at least one expense or item line");
65765
+ for (const name3 of ["vendorBills", "vendorCredits"]) for (const [index, t] of seed2[name3].entries()) {
65766
+ if (!vendors.has(t.vendor)) issue2([name3, index, "vendor"], "missing vendor");
65767
+ if (!t.expenses.length && !t.lines.length) issue2([name3, index], "needs at least one expense or item line");
65381
65768
  t.expenses.forEach((line2, i) => {
65382
- const path2 = ["vendorBills", index, "expenses", i, "account"], account2 = transactionAccount(line2.account, path2);
65383
- if (account2?.type === "AcctRec" || account2?.type === "AcctPay") issue2(path2, "expense account cannot be receivables or payables");
65769
+ const known = account2(line2.account, [name3, index, "expenses", i, "account"]);
65770
+ if (known?.type === "AcctRec" || known?.type === "AcctPay") issue2([name3, index, "expenses", i, "account"], "expense account cannot be receivables or payables");
65384
65771
  });
65385
- lines("vendorBills", index, t.lines);
65386
- }
65387
- const invoiceById = new Map(seed2.invoices.map((t) => [t.id, t])), billById = new Map(seed2.vendorBills.map((t) => [t.id, t]));
65388
- const invoiceApplied = /* @__PURE__ */ new Map(), billApplied = /* @__PURE__ */ new Map();
65389
- const applies = (name3) => {
65772
+ lines(name3, index, t.lines, "purchase");
65773
+ }
65774
+ const totals = /* @__PURE__ */ new Map();
65775
+ for (const t of seed2.invoices) totals.set(t.id, itemTotal(t.lines));
65776
+ for (const t of seed2.creditMemos) totals.set(t.id, itemTotal(t.lines));
65777
+ for (const t of seed2.vendorBills) totals.set(t.id, round2(buyTotal(t.lines) + t.expenses.reduce((s, e) => s + e.amount, 0)));
65778
+ for (const t of seed2.vendorCredits) totals.set(t.id, round2(buyTotal(t.lines) + t.expenses.reduce((s, e) => s + e.amount, 0)));
65779
+ for (const t of seed2.customerPayments) totals.set(t.id, t.amount);
65780
+ const applied = /* @__PURE__ */ new Map();
65781
+ const applies = (name3, docs, label5) => {
65390
65782
  for (const [index, t] of seed2[name3].entries()) {
65391
- const seen = /* @__PURE__ */ new Set();
65783
+ const owner = "vendor" in t ? t.vendor : t.customer, seen = /* @__PURE__ */ new Set();
65392
65784
  for (const [i, a] of t.apply.entries()) {
65393
- const path2 = [name3, index, "apply", i, "doc"];
65785
+ const path2 = [name3, index, "apply", i, "doc"], doc = docs.get(a.doc);
65394
65786
  if (seen.has(a.doc)) issue2(path2, "duplicate applied document");
65395
65787
  seen.add(a.doc);
65396
- if ("vendor" in t) {
65397
- const bill = billById.get(a.doc);
65398
- if (!bill) {
65399
- issue2(path2, "missing vendor bill");
65400
- continue;
65401
- }
65402
- if (bill.vendor !== t.vendor) issue2(path2, "vendor bill belongs to another vendor");
65403
- if (seed2.policy.billApproval && bill.approval !== "approved") issue2(path2, "vendor bill is not approved");
65404
- billApplied.set(a.doc, (billApplied.get(a.doc) ?? 0) + a.amount);
65405
- } else {
65406
- const invoice = invoiceById.get(a.doc);
65407
- if (!invoice) {
65408
- issue2(path2, "missing invoice");
65409
- continue;
65410
- }
65411
- if (invoice.customer !== t.customer) issue2(path2, "invoice belongs to another customer");
65412
- invoiceApplied.set(a.doc, (invoiceApplied.get(a.doc) ?? 0) + a.amount);
65788
+ if (!doc) {
65789
+ issue2(path2, `missing ${label5}`);
65790
+ continue;
65413
65791
  }
65792
+ if (doc.owner !== owner) issue2(path2, `${label5} belongs to another ${"vendor" in t ? "vendor" : "customer"}`);
65793
+ if (doc.approved === false) issue2(path2, `${label5} is not approved`);
65794
+ applied.set(a.doc, (applied.get(a.doc) ?? 0) + a.amount);
65414
65795
  }
65415
65796
  }
65416
65797
  };
65417
- applies("creditMemos");
65418
- applies("customerPayments");
65419
- applies("vendorPayments");
65420
- for (const [index, t] of seed2.invoices.entries()) {
65421
- if (round2(invoiceApplied.get(t.id) ?? 0) > itemTotal(t.lines) + 1e-9) issue2(["invoices", index], "invoice is over-applied");
65798
+ const invoices = new Map(seed2.invoices.map((t) => [t.id, { owner: t.customer }]));
65799
+ const bills = new Map(seed2.vendorBills.map((t) => [t.id, { owner: t.vendor, approved: !seed2.policy.billApproval || t.approval === "approved" }]));
65800
+ const credits = new Map([...seed2.creditMemos.map((t) => [t.id, { owner: t.customer }]), ...seed2.customerPayments.map((t) => [t.id, { owner: t.customer }])]);
65801
+ applies("creditMemos", invoices, "invoice");
65802
+ applies("customerPayments", invoices, "invoice");
65803
+ applies("vendorPayments", bills, "vendor bill");
65804
+ applies("vendorCredits", bills, "vendor bill");
65805
+ const spent = /* @__PURE__ */ new Map();
65806
+ for (const name3 of ["creditMemos", "customerPayments", "vendorCredits", "vendorPayments"]) for (const t of seed2[name3]) spent.set(t.id, t.apply.reduce((s, a) => s + a.amount, 0));
65807
+ for (const [index, t] of seed2.customerRefunds.entries()) {
65808
+ const seen = /* @__PURE__ */ new Set();
65809
+ for (const [i, a] of t.apply.entries()) {
65810
+ const path2 = ["customerRefunds", index, "apply", i, "doc"], doc = credits.get(a.doc);
65811
+ if (seen.has(a.doc)) issue2(path2, "duplicate applied document");
65812
+ seen.add(a.doc);
65813
+ if (!doc) {
65814
+ issue2(path2, "missing credit memo or payment");
65815
+ continue;
65816
+ }
65817
+ if (doc.owner !== t.customer) issue2(path2, "credit belongs to another customer");
65818
+ spent.set(a.doc, (spent.get(a.doc) ?? 0) + a.amount);
65819
+ }
65820
+ if (!customers.has(t.customer)) issue2(["customerRefunds", index, "customer"], "missing customer");
65821
+ account2(t.account, ["customerRefunds", index, "account"], ["Bank"], "refund account");
65422
65822
  }
65423
- for (const [index, t] of seed2.vendorBills.entries()) {
65424
- const total = round2(itemTotal(t.lines) + t.expenses.reduce((sum, line2) => sum + line2.amount, 0));
65425
- if (round2(billApplied.get(t.id) ?? 0) > total + 1e-9) issue2(["vendorBills", index], "vendor bill is over-applied");
65823
+ for (const [id9, amount2] of applied) if (round2(amount2) > (totals.get(id9) ?? 0) + 1e-9) {
65824
+ const name3 = seed2.invoices.some((t) => t.id === id9) ? "invoices" : "vendorBills";
65825
+ issue2([name3, seed2[name3].findIndex((t) => t.id === id9)], `${name3 === "invoices" ? "invoice" : "vendor bill"} is over-applied`);
65426
65826
  }
65427
- for (const [index, t] of seed2.creditMemos.entries()) {
65428
- if (round2(t.apply.reduce((sum, a) => sum + a.amount, 0)) > itemTotal(t.lines) + 1e-9) issue2(["creditMemos", index, "apply"], "applies more than the credit memo");
65827
+ for (const name3 of ["creditMemos", "customerPayments", "vendorCredits", "vendorPayments"]) for (const [index, t] of seed2[name3].entries()) {
65828
+ const total = "amount" in t ? t.amount : totals.get(t.id) ?? 0;
65829
+ 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"}`);
65429
65830
  }
65430
65831
  for (const [index, t] of seed2.customerPayments.entries()) {
65431
65832
  if (!customers.has(t.customer)) issue2(["customerPayments", index, "customer"], "missing customer");
65432
- const path2 = ["customerPayments", index, "account"], account2 = transactionAccount(t.account, path2);
65433
- if (account2 && account2.type !== "Bank" && account2.type !== "OthCurrAsset") issue2(path2, "payment account must be Bank or OthCurrAsset");
65434
- if (t.apply.reduce((sum, a) => sum + a.amount, 0) > t.amount + 1e-9) issue2(["customerPayments", index, "apply"], "applies more than the payment");
65833
+ account2(t.account, ["customerPayments", index, "account"], ["Bank", "OthCurrAsset"], "payment account");
65834
+ }
65835
+ for (const [index, t] of seed2.cashSales.entries()) account2(t.account, ["cashSales", index, "account"], ["Bank", "OthCurrAsset"], "deposit account");
65836
+ for (const [index, t] of seed2.customerDeposits.entries()) {
65837
+ if (!customers.has(t.customer)) issue2(["customerDeposits", index, "customer"], "missing customer");
65838
+ account2(t.account, ["customerDeposits", index, "account"], ["Bank", "OthCurrAsset"], "deposit account");
65839
+ 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");
65435
65840
  }
65436
65841
  for (const [index, t] of seed2.vendorPayments.entries()) {
65437
65842
  if (!vendors.has(t.vendor)) issue2(["vendorPayments", index, "vendor"], "missing vendor");
65438
- const path2 = ["vendorPayments", index, "account"], account2 = transactionAccount(t.account, path2);
65439
- if (account2 && account2.type !== "Bank") issue2(path2, "payment account must be Bank");
65440
- if (t.apply.reduce((sum, a) => sum + a.amount, 0) > t.amount + 1e-9) issue2(["vendorPayments", index, "apply"], "applies more than the payment");
65843
+ account2(t.account, ["vendorPayments", index, "account"], ["Bank"], "payment account");
65441
65844
  }
65442
65845
  for (const [index, t] of seed2.journalEntries.entries()) {
65443
65846
  t.lines.forEach((line2, i) => {
65444
- const path2 = ["journalEntries", index, "lines", i, "account"], account2 = transactionAccount(line2.account, path2);
65445
- if (account2?.type === "AcctRec" || account2?.type === "AcctPay") issue2(path2, "post receivables and payables with invoices, credit memos, bills and payments");
65446
- if (line2.entity !== void 0 && !entities.has(line2.entity)) issue2(["journalEntries", index, "lines", i, "entity"], "missing customer or vendor");
65847
+ const known = account2(line2.account, ["journalEntries", index, "lines", i, "account"]);
65848
+ const named = line2.entity !== void 0 && (customers.has(line2.entity) || vendors.has(line2.entity) || employees.has(line2.entity));
65849
+ if (line2.entity !== void 0 && !named) issue2(["journalEntries", index, "lines", i, "entity"], "missing customer, vendor or employee");
65850
+ 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");
65851
+ 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");
65852
+ 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");
65447
65853
  if (line2.debit === void 0 === (line2.credit === void 0)) issue2(["journalEntries", index, "lines", i], "a line has a debit or a credit");
65854
+ segment(line2, ["journalEntries", index, "lines", i]);
65448
65855
  });
65449
65856
  const debit = t.lines.reduce((sum, l) => sum + (l.debit ?? 0), 0), credit = t.lines.reduce((sum, l) => sum + (l.credit ?? 0), 0);
65450
65857
  if (Math.abs(debit - credit) > 5e-3) issue2(["journalEntries", index, "lines"], "debits and credits differ");
65451
65858
  }
65452
- });
65859
+ for (const [index, t] of seed2.expenseReports.entries()) {
65860
+ if (!employees.has(t.employee)) issue2(["expenseReports", index, "employee"], "missing employee");
65861
+ t.expenses.forEach((line2, i) => {
65862
+ if (!categories.has(line2.category)) issue2(["expenseReports", index, "expenses", i, "category"], "missing expense category");
65863
+ });
65864
+ }
65865
+ if (seed2.expenseReports.length && !seed2.accounts.some((a) => a.type === "AcctPay")) issue2(["expenseReports"], "expense reports post to an accounts payable account");
65866
+ const fieldById = /* @__PURE__ */ new Map();
65867
+ for (const [index, f] of seed2.customFields.entries()) {
65868
+ if (fieldById.has(f.id)) issue2(["customFields", index, "id"], "duplicate custom field");
65869
+ fieldById.set(f.id, f);
65870
+ if (f.type === "select" && !f.options?.length && !f.source) issue2(["customFields", index], "a select field needs options or a source");
65871
+ }
65872
+ const customs = (name3, list, prefix2) => list.forEach((record4, index) => {
65873
+ for (const [key2, value2] of Object.entries(record4.custom ?? {})) {
65874
+ const field2 = fieldById.get(key2), path2 = [name3, index, "custom", key2];
65875
+ if (!field2) {
65876
+ issue2(path2, "undeclared custom field");
65877
+ continue;
65878
+ }
65879
+ if (!key2.startsWith(prefix2)) issue2(path2, `${prefix2} fields belong here`);
65880
+ if (value2 === null) continue;
65881
+ 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";
65882
+ if (!ok) issue2(path2, `not a ${field2.type} value`);
65883
+ }
65884
+ });
65885
+ for (const name3 of ["customers", "vendors", "contacts", "employees"]) customs(name3, seed2[name3], "custentity");
65886
+ customs("items", seed2.items, "custitem");
65887
+ for (const name3 of transactions) {
65888
+ customs(name3, seed2[name3], "custbody");
65889
+ for (const [index, t] of seed2[name3].entries()) {
65890
+ customs(`${name3}[${index}].lines`, t.lines ?? [], "custcol");
65891
+ customs(`${name3}[${index}].expenses`, t.expenses ?? [], "custcol");
65892
+ }
65893
+ }
65894
+ for (const [index, f] of seed2.folders.entries()) if (f.parent !== void 0 && (!folders.has(f.parent) || f.parent === f.id)) issue2(["folders", index, "parent"], "missing folder");
65895
+ for (const [index, f] of seed2.files.entries()) if (!folders.has(f.folder)) issue2(["files", index, "folder"], "missing folder");
65896
+ const searches = /* @__PURE__ */ new Set(), searchIds = /* @__PURE__ */ new Set();
65897
+ for (const [index, s] of seed2.savedSearches.entries()) {
65898
+ if (searches.has(s.id)) issue2(["savedSearches", index, "id"], "duplicate saved search ID");
65899
+ if (searchIds.has(s.internalId)) issue2(["savedSearches", index, "internalId"], "duplicate internal ID");
65900
+ searches.add(s.id);
65901
+ searchIds.add(s.internalId);
65902
+ }
65903
+ void items;
65904
+ }
65453
65905
  var netsuiteStarterSeed = {
65454
65906
  account: { id: "7654321", company: "Acme" },
65455
65907
  policy: { billApproval: true, approveBills: true, salesOrderApproval: false },
@@ -66297,7 +66749,7 @@ var TOOL_DESCRIPTORS = [
66297
66749
  descriptor("discord", "Discord", "A community server as its bot sees it: channels, messages, threads and reactions", ["Channels", "Messages", "Threads", "Reactions", "Pins", "Members", "Roles", "DMs"], "REST API v10", ["Send Authorization: Bot DISCORD_BOT_TOKEN to DISCORD_API_URL (it ends in /api/v10). Discord publishes no official Node client; the tests use the documented HTTP API.", "What the bot may read and send follows its role and each channel\u2019s permission overwrites (Missing Access, Missing Permissions); IDs are snowflakes on the scene clock.", "REST."]),
66298
66750
  descriptor("sentry", "Sentry", "Issues, error events, triage and releases", ["Organizations", "Projects", "Teams", "Members", "Issues", "Events", "Tags", "Comments", "Releases", "Deploys", "Events query"], "REST API /api/0", ['Call ${SENTRY_API_URL}/api/0/... with Authorization: Bearer SENTRY_AUTH_TOKEN, using the shapes in Sentry\u2019s API docs (Sentry\u2019s generated API client is source-available, so the tests use HTTP). Lists page through the Link header (rel="next", results="true", cursor).', "Issue search covers Sentry\u2019s syntax for status, assignment, level, priority, releases, environments, times, users, error fields and tags; the organization default is is:unresolved issue.priority:[high, medium] over 14 days.", "Client keys point their DSNs at this replica."]),
66299
66751
  descriptor("airtable", "Airtable", "Bases of linked tables: records, views, formulas and comments", ["Bases", "Tables", "Fields", "Records", "Views", "Formulas", "Comments"], "Web API v0", ["Send AIRTABLE_API_KEY (a personal access token) as a Bearer token to AIRTABLE_API_URL (it ends in /v0). The official airtable.js client reads AIRTABLE_API_KEY and AIRTABLE_ENDPOINT_URL by itself; these tests use the documented HTTP API.", "filterByFormula, view filters and formula, count, lookup and rollup fields run on a formula engine; links stay in step on both sides; TODAY() and NOW() follow the scene clock."]),
66300
- descriptor("netsuite", "NetSuite", "Order to cash and procure to pay: customers, vendors, invoices, payments, bills and SuiteQL", ["Customers", "Vendors", "Items", "Sales orders", "Invoices", "Credit memos", "Customer payments", "Vendor bills", "Bill payments", "Journal entries", "SuiteQL"], "SuiteTalk REST record v1 and SuiteQL", ["Point the client at NETSUITE_API_URL instead of https://{account}.suitetalk.api.netsuite.com. Send record requests to NETSUITE_RECORD_URL and SuiteQL queries to NETSUITE_SUITEQL_URL.", "Sign OAuth 1.0 TBA requests with HMAC-SHA256, using NETSUITE_ACCOUNT_ID as the realm and NETSUITE_CONSUMER_KEY, NETSUITE_CONSUMER_SECRET, NETSUITE_TOKEN_ID and NETSUITE_TOKEN_SECRET; or send NETSUITE_ACCESS_TOKEN as a Bearer token.", "POST SuiteQL queries with Prefer: transient and a JSON body containing q. Record creates return 204 with a Location header."])
66752
+ descriptor("netsuite", "NetSuite", "Order to cash and procure to pay: customers, vendors, invoices, payments, bills and SuiteQL", ["Customers", "Vendors", "Items", "Sales orders", "Invoices", "Credit memos", "Customer payments", "Vendor bills", "Bill payments", "Journal entries", "SuiteQL"], "SuiteTalk REST record v1 and SuiteQL", ["Point the client at NETSUITE_API_URL instead of https://{account}.suitetalk.api.netsuite.com. Send record requests to NETSUITE_RECORD_URL and SuiteQL queries to NETSUITE_SUITEQL_URL.", "Sign OAuth 1.0 TBA requests with HMAC-SHA256, using NETSUITE_ACCOUNT_ID as the realm and NETSUITE_CONSUMER_KEY, NETSUITE_CONSUMER_SECRET, NETSUITE_TOKEN_ID and NETSUITE_TOKEN_SECRET; or send NETSUITE_ACCESS_TOKEN as a Bearer token.", "For OAuth 2.0, get tokens from NETSUITE_TOKEN_URL: client credentials with a JWT signed by NETSUITE_PRIVATE_KEY (ES256, kid NETSUITE_CERTIFICATE_ID, iss NETSUITE_CLIENT_ID), or the authorization code grant with NETSUITE_CLIENT_ID and NETSUITE_CLIENT_SECRET.", "POST SuiteQL queries with Prefer: transient and a JSON body containing q. Record creates return 204 with a Location header."])
66301
66753
  ];
66302
66754
  var starterSeeds = {
66303
66755
  slack: slackStarterSeed,
@@ -66358,7 +66810,7 @@ function validateMcpConnection(connection) {
66358
66810
  } catch {
66359
66811
  throw new AnchaError("USAGE", "MCP requires an attempt endpoint URL");
66360
66812
  }
66361
- if (!["http:", "https:"].includes(url3.protocol) || url3.username || url3.password || url3.search || url3.hash || !/\/e\/[^/]+\/mcp\/(slack|github|pagerduty|datadog)$/.test(url3.pathname) || !connection.token || /[\r\n]/.test(connection.token)) {
66813
+ if (!["http:", "https:"].includes(url3.protocol) || url3.username || url3.password || url3.search || url3.hash || !/\/e\/[^/]+\/mcp\/(slack|github|pagerduty|datadog|netsuite)$/.test(url3.pathname) || !connection.token || /[\r\n]/.test(connection.token)) {
66362
66814
  throw new AnchaError("USAGE", "MCP requires an attempt endpoint and its bearer token");
66363
66815
  }
66364
66816
  return url3;