@resolveio/server-lib 22.3.202 → 22.3.203

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.3.202",
3
+ "version": "22.3.203",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -251,8 +251,8 @@ function buildResolveIORunnerQaEnvScript(options) {
251
251
  'resolveio_qa_scan_inline_node_script() {',
252
252
  ' local script_file="$1"',
253
253
  ' [ -f "$script_file" ] || return 0',
254
- " if grep -Eiq \"networkidle0|networkidle2|page\\.waitForTimeout|page\\.waitForEvent|page\\.\\$x|require\\([\\\"']puppeteer[\\\"']\\)|puppeteer browsers install|npx puppeteer|playwright install\" \"$script_file\"; then",
255
- ' echo "ResolveIO QA command guard: refusing fragile/forbidden browser QA script. Use the shared QA helpers, domcontentloaded plus concrete DOM assertions, puppeteer-core from staged NODE_PATH, and delay(ms) instead of networkidle*/waitForTimeout/page.\\$x/browser installs." >&2',
254
+ " if grep -Eiq \"puppeteer browsers install|npx puppeteer|playwright install\" \"$script_file\"; then",
255
+ ' echo "ResolveIO QA command guard: refusing browser install/download commands. Use the staged browser executable from PUPPETEER_EXECUTABLE_PATH/CHROME_BIN." >&2',
256
256
  ' exit 86',
257
257
  ' fi',
258
258
  '}',
@@ -1307,7 +1307,7 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
1307
1307
  'function preserveExistingSeedResult(reason) {',
1308
1308
  ' const existing = readJsonIfExists(resultPath);',
1309
1309
  ' const status = String(existing && existing.status || "").toLowerCase();',
1310
- ' const desiredProfile = shouldSeedBillingDashboardFixtures() ? "billing_inventory" : "live_context";',
1310
+ ' const desiredProfile = desiredSeedProfile();',
1311
1311
  ' if (existing && existing.profile && existing.profile !== desiredProfile) return;',
1312
1312
  ' if (existing && existing.profile === "billing_inventory" && shouldSeedBillingDashboardFixtures() && !(existing.selected && existing.selected.qa_billing_fixture)) {',
1313
1313
  ' return;',
@@ -1666,12 +1666,31 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
1666
1666
  ' .slice(0, 20);',
1667
1667
  '}',
1668
1668
  '',
1669
+ 'function desiredSeedProfile() {',
1670
+ ' if (shouldSeedPricingImportFixtures()) return "pricing_import";',
1671
+ ' if (shouldSeedBillingDashboardFixtures()) return "billing_inventory";',
1672
+ ' return "live_context";',
1673
+ '}',
1674
+ '',
1669
1675
  'function shouldSeedBillingDashboardFixtures() {',
1676
+ ' const force = process.env.RESOLVEIO_QA_FORCE_BILLING_FIXTURES || process.env.RESOLVEIO_SUPPORT_QA_FORCE_BILLING_FIXTURES || process.env.RESOLVEIO_RUNNER_QA_FORCE_BILLING_FIXTURES || "";',
1677
+ ' if (/^(true|1|yes|on)$/i.test(force)) return true;',
1678
+ ' if (shouldSeedPricingImportFixtures()) return false;',
1670
1679
  ' const explicit = process.env.RESOLVEIO_QA_INCLUDE_BILLING_FIXTURES || process.env.RESOLVEIO_SUPPORT_QA_INCLUDE_BILLING_FIXTURES || process.env.RESOLVEIO_RUNNER_QA_INCLUDE_BILLING_FIXTURES || "";',
1671
1680
  ' if (/^(true|1|yes|on)$/i.test(explicit)) return true;',
1672
1681
  ' if (/^(false|0|no|off)$/i.test(explicit)) return false;',
1673
1682
  ' const text = readSeedHintText();',
1674
- ' return /\\b(invoice|invoicing|billing|billable|tax|taxes|surcharge|pricing|line\\s*item|line\\s*items|inventory|checkout|check\\s*out|pick\\s*ticket)\\b/i.test(text);',
1683
+ ' return /\\b(invoice|invoicing|billing|billable|tax|taxes|surcharge|inventory|checkout|check\\s*out|pick\\s*ticket)\\b/i.test(text);',
1684
+ '}',
1685
+ '',
1686
+ 'function shouldSeedPricingImportFixtures() {',
1687
+ ' const explicit = process.env.RESOLVEIO_QA_INCLUDE_PRICING_IMPORT_FIXTURES || process.env.RESOLVEIO_SUPPORT_QA_INCLUDE_PRICING_IMPORT_FIXTURES || process.env.RESOLVEIO_RUNNER_QA_INCLUDE_PRICING_IMPORT_FIXTURES || "";',
1688
+ ' if (/^(true|1|yes|on)$/i.test(explicit)) return true;',
1689
+ ' if (/^(false|0|no|off)$/i.test(explicit)) return false;',
1690
+ ' const text = readSeedHintText();',
1691
+ ' const pricingSurface = /\\b(pricing|price|gross\\s+price|production\\s+price|manage\\s+pricing)\\b/i.test(text);',
1692
+ ' const importSurface = /\\b(import|upload|template|spreadsheet|xlsx|excel|attached\\s+template)\\b/i.test(text);',
1693
+ ' return pricingSurface && importSurface;',
1675
1694
  '}',
1676
1695
  '',
1677
1696
  'function identifierQuery(identifiers) {',
@@ -2130,7 +2149,8 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
2130
2149
  '',
2131
2150
  'async function seedBillingInventory(sourceDb, targetDb) {',
2132
2151
  ' const includeBillingFixtures = shouldSeedBillingDashboardFixtures();',
2133
- ' const summary = { profile: includeBillingFixtures ? "billing_inventory" : "live_context", collections: {}, selected: {}, notes: [] };',
2152
+ ' const includePricingImportFixtures = includeBillingFixtures || shouldSeedPricingImportFixtures();',
2153
+ ' const summary = { profile: desiredSeedProfile(), collections: {}, selected: {}, notes: [] };',
2134
2154
  ' const identifiers = extractSeedIdentifiers();',
2135
2155
  ' summary.selected.seed_identifiers = identifiers;',
2136
2156
  ' const qaIdentityUsers = await copyQaIdentityUsers(sourceDb, targetDb, summary);',
@@ -2138,9 +2158,12 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
2138
2158
  ' const ticketAssetContextDocs = await copyTicketAssetContext(sourceDb, targetDb, summary);',
2139
2159
  ' const productionInterchangeablesContextDocs = await copyProductionInterchangeablesContext(sourceDb, targetDb, summary);',
2140
2160
  ' if (!includeBillingFixtures) {',
2141
- ' summary.notes.push("Using live-context seed profile: billing dashboard fixtures are disabled because ticket context does not mention billing, invoices, taxes, inventory, pricing, surcharges, checkout, or pick tickets.");',
2161
+ ' summary.notes.push("Billing dashboard fixtures are disabled because ticket context does not require billing, invoices, taxes, inventory, surcharges, checkout, or pick tickets.");',
2142
2162
  ' await cleanupSyntheticBillingDashboardQaFixtures(targetDb, summary);',
2143
2163
  ' }',
2164
+ ' if (includePricingImportFixtures && !includeBillingFixtures) {',
2165
+ ' summary.notes.push("Using pricing-import seed profile: pricing records are copied without synthetic billing dashboard invoice fixtures.");',
2166
+ ' }',
2144
2167
  ' const billableDeliveryQuery = { $and: [',
2145
2168
  ' { $or: [{ type: "Delivery" }, { type: "Pickup" }] },',
2146
2169
  ' { $or: [{ consignment: { $exists: false } }, { consignment: false }] },',
@@ -2206,15 +2229,21 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
2206
2229
  ' ] }, summary, 40, { updatedAt: -1 });',
2207
2230
  ' summary.selected.service_or_surcharge_items = copiedServiceItems.map((doc) => doc._id);',
2208
2231
  '',
2209
- ' if (includeBillingFixtures) {',
2210
- ' await copyQuery(sourceDb, targetDb, "sales-taxes", {}, summary, 80, { updatedAt: -1 });',
2211
- ' await copyQuery(sourceDb, targetDb, "state-counties", {}, summary, 80, { updatedAt: -1 });',
2212
- ' await copyQuery(sourceDb, targetDb, "accounting-codes", {}, summary, 80, { updatedAt: -1 });',
2232
+ ' if (includePricingImportFixtures) {',
2213
2233
  ' await copyQuery(sourceDb, targetDb, "pricing-items", { $or: [',
2234
+ ' { id_item: { $in: unique([...itemIds, ...copiedItems.map((doc) => doc._id), ...copiedServiceItems.map((doc) => doc._id)]) } },',
2235
+ ' { id_chemical: { $in: unique([...itemIds, ...copiedChemicals.map((doc) => doc._id)]) } },',
2236
+ ' { id_customer: { $in: customerIds } },',
2214
2237
  ' { sub_type: { $in: ["misc", "service"] } },',
2215
2238
  ' { id_item: { $in: copiedServiceItems.map((doc) => doc._id) } },',
2216
2239
  ' { name: /surcharge|fuel|delivery|service|misc/i }',
2217
2240
  ' ] }, summary, 80, { updatedAt: -1 });',
2241
+ ' }',
2242
+ '',
2243
+ ' if (includeBillingFixtures) {',
2244
+ ' await copyQuery(sourceDb, targetDb, "sales-taxes", {}, summary, 80, { updatedAt: -1 });',
2245
+ ' await copyQuery(sourceDb, targetDb, "state-counties", {}, summary, 80, { updatedAt: -1 });',
2246
+ ' await copyQuery(sourceDb, targetDb, "accounting-codes", {}, summary, 80, { updatedAt: -1 });',
2218
2247
  ' await ensureBillingSurchargePricingFixtures(targetDb, summary, copiedServiceItems, customerIds);',
2219
2248
  ' await ensureBillingDashboardQaFixtures(targetDb, summary, customerIds, yardIds, copiedServiceItems);',
2220
2249
  '',