@cogenta/commerce 0.2.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/permissions.d.ts +8 -0
- package/dist/admin/permissions.d.ts.map +1 -1
- package/dist/admin/permissions.js +1 -0
- package/dist/admin/permissions.js.map +1 -1
- package/dist/admin/router.d.ts +47 -5
- package/dist/admin/router.d.ts.map +1 -1
- package/dist/admin/router.js +942 -24
- package/dist/admin/router.js.map +1 -1
- package/dist/cart/store.d.ts +23 -0
- package/dist/cart/store.d.ts.map +1 -1
- package/dist/cart/store.js +49 -2
- package/dist/cart/store.js.map +1 -1
- package/dist/catalog/csv.d.ts +29 -0
- package/dist/catalog/csv.d.ts.map +1 -0
- package/dist/catalog/csv.js +396 -0
- package/dist/catalog/csv.js.map +1 -0
- package/dist/catalog/store.d.ts +24 -4
- package/dist/catalog/store.d.ts.map +1 -1
- package/dist/catalog/store.js +238 -11
- package/dist/catalog/store.js.map +1 -1
- package/dist/catalog/types.d.ts +92 -0
- package/dist/catalog/types.d.ts.map +1 -1
- package/dist/catalog/types.js +20 -0
- package/dist/catalog/types.js.map +1 -1
- package/dist/coupon/store.d.ts +63 -5
- package/dist/coupon/store.d.ts.map +1 -1
- package/dist/coupon/store.js +140 -7
- package/dist/coupon/store.js.map +1 -1
- package/dist/customer/store.d.ts +17 -0
- package/dist/customer/store.d.ts.map +1 -1
- package/dist/customer/store.js +26 -0
- package/dist/customer/store.js.map +1 -1
- package/dist/index.d.ts +18 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/invoice/credit-note.d.ts +45 -0
- package/dist/invoice/credit-note.d.ts.map +1 -0
- package/dist/invoice/credit-note.js +109 -0
- package/dist/invoice/credit-note.js.map +1 -0
- package/dist/invoice/sequence.d.ts +21 -0
- package/dist/invoice/sequence.d.ts.map +1 -0
- package/dist/invoice/sequence.js +64 -0
- package/dist/invoice/sequence.js.map +1 -0
- package/dist/invoice/store.d.ts +23 -1
- package/dist/invoice/store.d.ts.map +1 -1
- package/dist/invoice/store.js +23 -56
- package/dist/invoice/store.js.map +1 -1
- package/dist/order/csv.d.ts +24 -0
- package/dist/order/csv.d.ts.map +1 -0
- package/dist/order/csv.js +42 -0
- package/dist/order/csv.js.map +1 -0
- package/dist/order/notify.d.ts +65 -0
- package/dist/order/notify.d.ts.map +1 -0
- package/dist/order/notify.js +180 -0
- package/dist/order/notify.js.map +1 -0
- package/dist/order/store.d.ts +58 -1
- package/dist/order/store.d.ts.map +1 -1
- package/dist/order/store.js +145 -10
- package/dist/order/store.js.map +1 -1
- package/dist/order/types.d.ts +35 -1
- package/dist/order/types.d.ts.map +1 -1
- package/dist/order/types.js +2 -0
- package/dist/order/types.js.map +1 -1
- package/dist/payment/paypal.d.ts +9 -0
- package/dist/payment/paypal.d.ts.map +1 -0
- package/dist/payment/paypal.js +583 -0
- package/dist/payment/paypal.js.map +1 -0
- package/dist/payment/registry.d.ts +15 -6
- package/dist/payment/registry.d.ts.map +1 -1
- package/dist/payment/registry.js +17 -6
- package/dist/payment/registry.js.map +1 -1
- package/dist/payment/types.d.ts +6 -0
- package/dist/payment/types.d.ts.map +1 -1
- package/dist/shipping/store.d.ts +29 -3
- package/dist/shipping/store.d.ts.map +1 -1
- package/dist/shipping/store.js +68 -4
- package/dist/shipping/store.js.map +1 -1
- package/dist/subscription/renewal-notifier.d.ts +17 -0
- package/dist/subscription/renewal-notifier.d.ts.map +1 -0
- package/dist/subscription/renewal-notifier.js +33 -0
- package/dist/subscription/renewal-notifier.js.map +1 -0
- package/dist/subscription/store.d.ts +126 -3
- package/dist/subscription/store.d.ts.map +1 -1
- package/dist/subscription/store.js +348 -8
- package/dist/subscription/store.js.map +1 -1
- package/dist/tables.d.ts +17 -0
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +273 -0
- package/dist/tables.js.map +1 -1
- package/dist/tax/store.d.ts +20 -0
- package/dist/tax/store.d.ts.map +1 -1
- package/dist/tax/store.js +51 -7
- package/dist/tax/store.js.map +1 -1
- package/package.json +3 -2
package/dist/tables.js
CHANGED
|
@@ -17,16 +17,37 @@ export const TABLES = {
|
|
|
17
17
|
orders: 'cogenta_commerce_orders',
|
|
18
18
|
orderLines: 'cogenta_commerce_order_lines',
|
|
19
19
|
orderEvents: 'cogenta_commerce_order_events',
|
|
20
|
+
orderEmails: 'cogenta_commerce_order_emails',
|
|
20
21
|
payments: 'cogenta_commerce_payments',
|
|
21
22
|
refunds: 'cogenta_commerce_refunds',
|
|
22
23
|
taxRules: 'cogenta_commerce_tax_rules',
|
|
23
24
|
shippingMethods: 'cogenta_commerce_shipping_methods',
|
|
24
25
|
coupons: 'cogenta_commerce_coupons',
|
|
25
26
|
couponRedemptions: 'cogenta_commerce_coupon_redemptions',
|
|
27
|
+
// Fiche 53 task 2: a coupon's own restriction and per-customer counters.
|
|
28
|
+
couponRestrictions: 'cogenta_commerce_coupon_restrictions',
|
|
29
|
+
couponCustomerRedemptions: 'cogenta_commerce_coupon_customer_redemptions',
|
|
26
30
|
invoices: 'cogenta_commerce_invoices',
|
|
27
31
|
invoiceSequences: 'cogenta_commerce_invoice_sequences',
|
|
32
|
+
creditNotes: 'cogenta_commerce_credit_notes',
|
|
28
33
|
subscriptions: 'cogenta_commerce_subscriptions',
|
|
29
34
|
subscriptionCycles: 'cogenta_commerce_subscription_cycles',
|
|
35
|
+
// Fiche 53 task 3: one open dunning cycle per subscription.
|
|
36
|
+
subscriptionDunning: 'cogenta_commerce_subscription_dunning',
|
|
37
|
+
// Fiche 53 task 5: which billing period a renewal notice was already sent
|
|
38
|
+
// for, so a repeated run never sends the same notice twice.
|
|
39
|
+
subscriptionRenewalNotices: 'cogenta_commerce_subscription_renewal_notices',
|
|
40
|
+
/** A product's link to a term of a taxonomy the *site* declares (ADR-0022,
|
|
41
|
+
* fiche 51 task 3) — not a foreign key for the same reason `content_ref` on
|
|
42
|
+
* `products` is not one: the term table is named after a taxonomy this
|
|
43
|
+
* package cannot know. A join row rather than a column on `products` because
|
|
44
|
+
* a product may carry more than one term, the same "many" a `f.taxonomy`
|
|
45
|
+
* field defaults to on a collection. */
|
|
46
|
+
productTerms: 'cogenta_commerce_product_terms',
|
|
47
|
+
/** Append-only. Every write that moves `on_hand` — a sale, a restock, a
|
|
48
|
+
* stock take — leaves one row here and never edits or removes an earlier
|
|
49
|
+
* one; the row is the audit trail, not a cache of the current count. */
|
|
50
|
+
stockMovements: 'cogenta_commerce_stock_movements',
|
|
30
51
|
};
|
|
31
52
|
/** `varchar` on Postgres/MySQL, `text` on SQLite — encapsulated once, here. */
|
|
32
53
|
function textColumn(dialect, length) {
|
|
@@ -162,6 +183,24 @@ export async function ensureCommerceTables(db) {
|
|
|
162
183
|
shipping_region ${t64},
|
|
163
184
|
shipping_method_id ${t64},
|
|
164
185
|
shipping_method_label ${t255},
|
|
186
|
+
-- Structured delivery address (fiche 52 task 1) — the constat that
|
|
187
|
+
-- opened this fiche: shipping_country/shipping_region alone (above)
|
|
188
|
+
-- were the tax/rate *zone*, never a real address a courier can print on
|
|
189
|
+
-- a label. All six nullable: an order placed before this address ever
|
|
190
|
+
-- existed, or one nobody ever filled in, still reads back fine.
|
|
191
|
+
shipping_address_line1 ${t255},
|
|
192
|
+
shipping_address_line2 ${t255},
|
|
193
|
+
shipping_city ${t255},
|
|
194
|
+
shipping_postal_code ${t64},
|
|
195
|
+
shipping_recipient ${t255},
|
|
196
|
+
shipping_phone ${t64},
|
|
197
|
+
-- Shipment tracking (fiche 52 task 4). Set together, by setTracking(),
|
|
198
|
+
-- once goods actually leave — never guessed from the status alone,
|
|
199
|
+
-- because "shipped" and "we know how" are two different facts.
|
|
200
|
+
tracking_carrier ${t64},
|
|
201
|
+
tracking_number ${t255},
|
|
202
|
+
tracking_url ${t1024},
|
|
203
|
+
shipped_at ${t64},
|
|
165
204
|
placed_at ${t64} not null,
|
|
166
205
|
updated_at ${t64} not null,
|
|
167
206
|
-- Set when a subscription cycle produced this order, null otherwise.
|
|
@@ -197,6 +236,23 @@ export async function ensureCommerceTables(db) {
|
|
|
197
236
|
note ${t1024}
|
|
198
237
|
)`);
|
|
199
238
|
await db.query(sql `
|
|
239
|
+
create table if not exists ${identifier(TABLES.orderEmails, d)} (
|
|
240
|
+
id ${t64} not null primary key,
|
|
241
|
+
order_id ${t64} not null,
|
|
242
|
+
-- 'confirmation' | 'shipment' (order/notify.ts's OrderEmailKind) — a
|
|
243
|
+
-- closed vocabulary kept as free text, the same choice this whole
|
|
244
|
+
-- package makes for every other status/kind column.
|
|
245
|
+
kind ${t64} not null,
|
|
246
|
+
to_email ${t255} not null,
|
|
247
|
+
-- 'pending' | 'sent' | 'failed' — 'failed' is retried by flushDue()
|
|
248
|
+
-- until MAX_ATTEMPTS, never resurrected after.
|
|
249
|
+
status ${t64} not null,
|
|
250
|
+
attempts ${int} not null,
|
|
251
|
+
last_error ${t1024},
|
|
252
|
+
created_at ${t64} not null,
|
|
253
|
+
sent_at ${t64}
|
|
254
|
+
)`);
|
|
255
|
+
await db.query(sql `
|
|
200
256
|
create table if not exists ${identifier(TABLES.payments, d)} (
|
|
201
257
|
id ${t64} not null primary key,
|
|
202
258
|
order_id ${t64} not null,
|
|
@@ -274,9 +330,23 @@ export async function ensureCommerceTables(db) {
|
|
|
274
330
|
-- Null means unlimited. Zero means exhausted, not unlimited.
|
|
275
331
|
max_redemptions ${int},
|
|
276
332
|
redemptions ${int} not null,
|
|
333
|
+
-- Fiche 53 task 2. Null means no per-customer cap. Enforced against
|
|
334
|
+
-- ${identifier(TABLES.couponCustomerRedemptions, d)}, never against this
|
|
335
|
+
-- column's own value — it only ever records the *limit*, never a count.
|
|
336
|
+
max_redemptions_per_customer ${int},
|
|
277
337
|
active ${bool} not null,
|
|
278
338
|
created_at ${t64} not null
|
|
279
339
|
)`);
|
|
340
|
+
// A database whose `coupons` table predates the per-customer cap: `create
|
|
341
|
+
// table if not exists` above is a no-op for it, so the column is added the
|
|
342
|
+
// same way every other in-place table growth in this codebase is
|
|
343
|
+
// (`menu-tables.ts`'s `location` column). Failure means the column already
|
|
344
|
+
// exists — the only realistic cause once this function has already run
|
|
345
|
+
// against this table — so it is swallowed exactly like the index
|
|
346
|
+
// statements below.
|
|
347
|
+
await db
|
|
348
|
+
.query(sql `alter table ${identifier(TABLES.coupons, d)} add column ${identifier('max_redemptions_per_customer', d)} ${int}`)
|
|
349
|
+
.catch(() => undefined);
|
|
280
350
|
await db.query(sql `
|
|
281
351
|
create table if not exists ${identifier(TABLES.couponRedemptions, d)} (
|
|
282
352
|
id ${t64} not null primary key,
|
|
@@ -285,6 +355,31 @@ export async function ensureCommerceTables(db) {
|
|
|
285
355
|
customer_id ${t64},
|
|
286
356
|
at ${t64} not null
|
|
287
357
|
)`);
|
|
358
|
+
// One row per product a coupon is restricted to. No rows at all means
|
|
359
|
+
// unrestricted — the common case, and the reason this is a join table
|
|
360
|
+
// rather than a nullable column on `coupons` (a coupon can name several
|
|
361
|
+
// products, and a nullable single column could only ever name one).
|
|
362
|
+
await db.query(sql `
|
|
363
|
+
create table if not exists ${identifier(TABLES.couponRestrictions, d)} (
|
|
364
|
+
id ${t64} not null primary key,
|
|
365
|
+
code ${t64} not null,
|
|
366
|
+
product_id ${t64} not null,
|
|
367
|
+
created_at ${t64} not null
|
|
368
|
+
)`);
|
|
369
|
+
// The atomic per-customer counter `redeem()` claims against (fiche 53 task
|
|
370
|
+
// 2). Deliberately not a `count(*)` over `couponRedemptions` at redemption
|
|
371
|
+
// time — a guarded single-row `UPDATE` is what stays atomic on Postgres,
|
|
372
|
+
// MySQL/MariaDB and SQLite alike (the same reasoning as the stock guard in
|
|
373
|
+
// `catalog/store.ts`), and an aggregate query is not a single row.
|
|
374
|
+
await db.query(sql `
|
|
375
|
+
create table if not exists ${identifier(TABLES.couponCustomerRedemptions, d)} (
|
|
376
|
+
code ${t64} not null,
|
|
377
|
+
customer_id ${t64} not null,
|
|
378
|
+
count ${int} not null,
|
|
379
|
+
created_at ${t64} not null,
|
|
380
|
+
updated_at ${t64} not null,
|
|
381
|
+
primary key (code, customer_id)
|
|
382
|
+
)`);
|
|
288
383
|
await db.query(sql `
|
|
289
384
|
create table if not exists ${identifier(TABLES.invoices, d)} (
|
|
290
385
|
id ${t64} not null primary key,
|
|
@@ -307,6 +402,23 @@ export async function ensureCommerceTables(db) {
|
|
|
307
402
|
next_seq ${int} not null
|
|
308
403
|
)`);
|
|
309
404
|
await db.query(sql `
|
|
405
|
+
create table if not exists ${identifier(TABLES.creditNotes, d)} (
|
|
406
|
+
id ${t64} not null primary key,
|
|
407
|
+
order_id ${t64} not null,
|
|
408
|
+
-- One credit note per refund, never per order: an order can be
|
|
409
|
+
-- refunded in several instalments, and each one gets its own
|
|
410
|
+
-- sequential, never-reused number (fiche 52 task 6).
|
|
411
|
+
refund_id ${t64} not null unique,
|
|
412
|
+
series ${t64} not null,
|
|
413
|
+
seq ${int} not null,
|
|
414
|
+
number ${t64} not null unique,
|
|
415
|
+
issued_at ${t64} not null,
|
|
416
|
+
currency ${t8} not null,
|
|
417
|
+
amount_minor ${int} not null,
|
|
418
|
+
reason ${t1024},
|
|
419
|
+
document text not null
|
|
420
|
+
)`);
|
|
421
|
+
await db.query(sql `
|
|
310
422
|
create table if not exists ${identifier(TABLES.subscriptions, d)} (
|
|
311
423
|
id ${t64} not null primary key,
|
|
312
424
|
customer_id ${t64} not null,
|
|
@@ -343,7 +455,149 @@ export async function ensureCommerceTables(db) {
|
|
|
343
455
|
status ${t64} not null,
|
|
344
456
|
created_at ${t64} not null
|
|
345
457
|
)`);
|
|
458
|
+
// Fiche 53 task 3: at most one open dunning cycle per subscription — the
|
|
459
|
+
// primary key is the whole guard against tracking two at once. `period_key`
|
|
460
|
+
// is carried, not reinvented: it is the exact value `billOne` already
|
|
461
|
+
// claimed for the order this cycle is trying to collect, so this table
|
|
462
|
+
// never becomes a second source of truth about which period is which.
|
|
463
|
+
// `next_retry_at` doubles as the compare-and-set field `runDunning` claims
|
|
464
|
+
// against (same shape as `SCHEDULED_TASK_CLAIMS_TABLE` in
|
|
465
|
+
// `@cogenta/schema`): null means either "claimed and being processed right
|
|
466
|
+
// now" (transient) or "exhausted" (terminal, `suspended_at` tells the two
|
|
467
|
+
// apart) — and either way the due-query (`next_retry_at <= now`) simply
|
|
468
|
+
// never matches null, so a claimed-but-not-yet-resolved row can never be
|
|
469
|
+
// picked up twice.
|
|
470
|
+
await db.query(sql `
|
|
471
|
+
create table if not exists ${identifier(TABLES.subscriptionDunning, d)} (
|
|
472
|
+
subscription_id ${t64} not null primary key,
|
|
473
|
+
order_id ${t64} not null,
|
|
474
|
+
period_key ${t255} not null,
|
|
475
|
+
failure_count ${int} not null,
|
|
476
|
+
first_failed_at ${t64} not null,
|
|
477
|
+
next_retry_at ${t64},
|
|
478
|
+
last_reason ${t1024},
|
|
479
|
+
suspended_at ${t64},
|
|
480
|
+
created_at ${t64} not null,
|
|
481
|
+
updated_at ${t64} not null
|
|
482
|
+
)`);
|
|
483
|
+
// Fiche 53 task 5: one row per (subscription, upcoming period) once a
|
|
484
|
+
// renewal notice has actually been sent for it — the insert itself is the
|
|
485
|
+
// claim (a duplicate insert hits the primary key and is swallowed by
|
|
486
|
+
// `sendRenewalNotices`), so a rerun never notifies a subscriber twice for
|
|
487
|
+
// the same renewal.
|
|
488
|
+
await db.query(sql `
|
|
489
|
+
create table if not exists ${identifier(TABLES.subscriptionRenewalNotices, d)} (
|
|
490
|
+
subscription_id ${t64} not null,
|
|
491
|
+
period_key ${t255} not null,
|
|
492
|
+
sent_at ${t64} not null,
|
|
493
|
+
primary key (subscription_id, period_key)
|
|
494
|
+
)`);
|
|
495
|
+
// Columns added to `orders` after it first shipped (fiche 52 tasks 1 and
|
|
496
|
+
// 4). The `create table` above already declares them, which covers a fresh
|
|
497
|
+
// install; a site whose `cogenta_commerce_orders` predates this fiche needs
|
|
498
|
+
// them added in place. Same idiom as `menu-tables.ts`'s `location` column
|
|
499
|
+
// and `theme-store.ts`'s `active_theme`: `alter table … add column`,
|
|
500
|
+
// failure swallowed unconditionally. On a table this function already
|
|
501
|
+
// created, the only realistic failure is "column already exists" — nothing
|
|
502
|
+
// destructive is attempted, and every added column is nullable, so no
|
|
503
|
+
// existing row is affected either way. This is deliberately outside
|
|
504
|
+
// contract A's up/down migration engine (see this file's own header
|
|
505
|
+
// comment) — there is no "down" for an additive, nullable column.
|
|
506
|
+
const ordersTable = identifier(TABLES.orders, d);
|
|
507
|
+
const orderColumnStatements = [
|
|
508
|
+
sql `alter table ${ordersTable} add column shipping_address_line1 ${t255}`,
|
|
509
|
+
sql `alter table ${ordersTable} add column shipping_address_line2 ${t255}`,
|
|
510
|
+
sql `alter table ${ordersTable} add column shipping_city ${t255}`,
|
|
511
|
+
sql `alter table ${ordersTable} add column shipping_postal_code ${t64}`,
|
|
512
|
+
sql `alter table ${ordersTable} add column shipping_recipient ${t255}`,
|
|
513
|
+
sql `alter table ${ordersTable} add column shipping_phone ${t64}`,
|
|
514
|
+
sql `alter table ${ordersTable} add column tracking_carrier ${t64}`,
|
|
515
|
+
sql `alter table ${ordersTable} add column tracking_number ${t255}`,
|
|
516
|
+
sql `alter table ${ordersTable} add column tracking_url ${t1024}`,
|
|
517
|
+
sql `alter table ${ordersTable} add column shipped_at ${t64}`,
|
|
518
|
+
];
|
|
519
|
+
for (const statement of orderColumnStatements) {
|
|
520
|
+
await db.query(statement).catch(() => undefined);
|
|
521
|
+
}
|
|
522
|
+
await db.query(sql `
|
|
523
|
+
create table if not exists ${identifier(TABLES.productTerms, d)} (
|
|
524
|
+
id ${t64} not null primary key,
|
|
525
|
+
product_id ${t64} not null,
|
|
526
|
+
-- Names a taxonomy the *site* declares (ADR-0022) and a term inside it —
|
|
527
|
+
-- neither is a foreign key here, for the same reason content_ref is not
|
|
528
|
+
-- one on products: the term table belongs to a schema this package
|
|
529
|
+
-- cannot know.
|
|
530
|
+
taxonomy ${t64} not null,
|
|
531
|
+
term_id ${t64} not null,
|
|
532
|
+
created_at ${t64} not null
|
|
533
|
+
)`);
|
|
534
|
+
await db.query(sql `
|
|
535
|
+
create table if not exists ${identifier(TABLES.stockMovements, d)} (
|
|
536
|
+
id ${t64} not null primary key,
|
|
537
|
+
variant_id ${t64} not null,
|
|
538
|
+
-- Positive for stock added, negative for stock taken. Never rewritten:
|
|
539
|
+
-- a mistake is corrected by a further movement, never by editing this
|
|
540
|
+
-- row (fiche 51 task 4's "append-only, jamais modifiable").
|
|
541
|
+
delta ${int} not null,
|
|
542
|
+
-- The absolute count this movement left the variant at — read back
|
|
543
|
+
-- without summing the whole history for a variant that has moved many
|
|
544
|
+
-- times.
|
|
545
|
+
balance_after ${int} not null,
|
|
546
|
+
reason ${t64} not null,
|
|
547
|
+
actor_id ${t64},
|
|
548
|
+
-- Names what caused the movement (an order id, most often), when there
|
|
549
|
+
-- is one. Free-form on purpose: a movement caused by a stock take has
|
|
550
|
+
-- no such thing.
|
|
551
|
+
reference_id ${t64},
|
|
552
|
+
note ${t1024},
|
|
553
|
+
created_at ${t64} not null
|
|
554
|
+
)`);
|
|
346
555
|
await ensureIndexes(db);
|
|
556
|
+
await ensureColumns(db);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Columns added after this package's first release, on tables that already
|
|
560
|
+
* existed (fiche 51 tasks 4 and 5) — same pattern as `menu-tables.ts`'s own
|
|
561
|
+
* `location` column: `create table if not exists` above is a no-op on a
|
|
562
|
+
* database that already has `variants`, so the column is added here instead,
|
|
563
|
+
* and a failure is swallowed because the only realistic cause on a table this
|
|
564
|
+
* function has already run against is "the column is already there".
|
|
565
|
+
*/
|
|
566
|
+
async function ensureColumns(db) {
|
|
567
|
+
const d = db.dialect;
|
|
568
|
+
const products = identifier(TABLES.products, d);
|
|
569
|
+
const variants = identifier(TABLES.variants, d);
|
|
570
|
+
const int = integerColumn();
|
|
571
|
+
const statements = [
|
|
572
|
+
// Task 4: a variant with no threshold set (the default, and every
|
|
573
|
+
// variant created before this column existed) is never "low stock" —
|
|
574
|
+
// absence means "not watched", not "watched at zero".
|
|
575
|
+
sql `alter table ${variants} add column ${identifier('low_stock_threshold', d)} ${int}`,
|
|
576
|
+
// Task 5: the "was" price shown struck through, and the window during
|
|
577
|
+
// which it applies. All three null together means "no promotion" — the
|
|
578
|
+
// state every variant is already in.
|
|
579
|
+
sql `alter table ${variants} add column ${identifier('compare_at_price_minor', d)} ${int}`,
|
|
580
|
+
sql `alter table ${variants} add column ${identifier('sale_starts_at', d)} ${textColumn(d, 64)}`,
|
|
581
|
+
sql `alter table ${variants} add column ${identifier('sale_ends_at', d)} ${textColumn(d, 64)}`,
|
|
582
|
+
// Task 5: physical dimensions, in millimetres — integers for the same
|
|
583
|
+
// reason weight_grams already is (no decimal column means the same thing
|
|
584
|
+
// on all three dialects, ADR-0006).
|
|
585
|
+
sql `alter table ${variants} add column ${identifier('width_mm', d)} ${int}`,
|
|
586
|
+
sql `alter table ${variants} add column ${identifier('height_mm', d)} ${int}`,
|
|
587
|
+
sql `alter table ${variants} add column ${identifier('depth_mm', d)} ${int}`,
|
|
588
|
+
// A product's own photos, direct on the commercial record — bare `text`
|
|
589
|
+
// rather than `textColumn`'s `varchar(n)`: this is a JSON-encoded array
|
|
590
|
+
// of media ids (`catalog/store.ts`'s `decodeProduct`/`toStringArray`),
|
|
591
|
+
// the same unbounded-length choice `invoices.document` already made for
|
|
592
|
+
// its own JSON blob, and no dialect gives an array column the same
|
|
593
|
+
// meaning on all three (ADR-0006).
|
|
594
|
+
sql `alter table ${products} add column ${identifier('image_media_ids', d)} text`,
|
|
595
|
+
// A variant's own single photo — one id, never a list (see `types.ts`).
|
|
596
|
+
sql `alter table ${variants} add column ${identifier('image_media_id', d)} ${textColumn(d, 64)}`,
|
|
597
|
+
];
|
|
598
|
+
for (const statement of statements) {
|
|
599
|
+
await db.query(statement).catch(() => undefined);
|
|
600
|
+
}
|
|
347
601
|
}
|
|
348
602
|
/**
|
|
349
603
|
* Indexes for the reads this package actually performs.
|
|
@@ -365,6 +619,12 @@ async function ensureIndexes(db) {
|
|
|
365
619
|
['cogenta_commerce_payments_order', TABLES.payments, 'order_id'],
|
|
366
620
|
['cogenta_commerce_refunds_payment', TABLES.refunds, 'payment_id'],
|
|
367
621
|
['cogenta_commerce_cycles_subscription', TABLES.subscriptionCycles, 'subscription_id'],
|
|
622
|
+
['cogenta_commerce_coupon_restrictions_code', TABLES.couponRestrictions, 'code'],
|
|
623
|
+
['cogenta_commerce_dunning_next_retry', TABLES.subscriptionDunning, 'next_retry_at'],
|
|
624
|
+
['cogenta_commerce_order_emails_order', TABLES.orderEmails, 'order_id'],
|
|
625
|
+
['cogenta_commerce_credit_notes_order', TABLES.creditNotes, 'order_id'],
|
|
626
|
+
['cogenta_commerce_product_terms_product', TABLES.productTerms, 'product_id'],
|
|
627
|
+
['cogenta_commerce_stock_movements_variant', TABLES.stockMovements, 'variant_id'],
|
|
368
628
|
];
|
|
369
629
|
for (const [name, table, column] of wanted) {
|
|
370
630
|
const statement = sql `create index ${identifier(name, d)} on ${identifier(table, d)} (${identifier(column, d)})`;
|
|
@@ -379,5 +639,18 @@ async function ensureIndexes(db) {
|
|
|
379
639
|
// rather than here.
|
|
380
640
|
}
|
|
381
641
|
}
|
|
642
|
+
// A product cannot carry the same term twice — the write side (`setProductTerms`)
|
|
643
|
+
// already guarantees this by replacing the whole set, but the constraint is
|
|
644
|
+
// what actually protects the data on a caller this package does not control.
|
|
645
|
+
const productTermsUnique = identifier('cogenta_commerce_product_terms_unique', d);
|
|
646
|
+
const productTermsTable = identifier(TABLES.productTerms, d);
|
|
647
|
+
try {
|
|
648
|
+
await db.query(d === 'mysql'
|
|
649
|
+
? sql `create unique index ${productTermsUnique} on ${productTermsTable} (${identifier('product_id', d)}, ${identifier('taxonomy', d)}, ${identifier('term_id', d)})`
|
|
650
|
+
: sql `create unique index if not exists ${productTermsUnique} on ${productTermsTable} (${identifier('product_id', d)}, ${identifier('taxonomy', d)}, ${identifier('term_id', d)})`);
|
|
651
|
+
}
|
|
652
|
+
catch {
|
|
653
|
+
// Already there.
|
|
654
|
+
}
|
|
382
655
|
}
|
|
383
656
|
//# sourceMappingURL=tables.js.map
|
package/dist/tables.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,GAAG,EACH,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,QAAQ,EAAE,2BAA2B;IACrC,QAAQ,EAAE,2BAA2B;IACrC,SAAS,EAAE,4BAA4B;IACvC,KAAK,EAAE,wBAAwB;IAC/B,SAAS,EAAE,6BAA6B;IACxC,MAAM,EAAE,yBAAyB;IACjC,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,+BAA+B;IAC5C,QAAQ,EAAE,2BAA2B;IACrC,OAAO,EAAE,0BAA0B;IACnC,QAAQ,EAAE,4BAA4B;IACtC,eAAe,EAAE,mCAAmC;IACpD,OAAO,EAAE,0BAA0B;IACnC,iBAAiB,EAAE,qCAAqC;IACxD,QAAQ,EAAE,2BAA2B;IACrC,gBAAgB,EAAE,oCAAoC;IACtD,aAAa,EAAE,gCAAgC;IAC/C,kBAAkB,EAAE,sCAAsC;CAClD,CAAA;AAEV,+EAA+E;AAC/E,SAAS,UAAU,CAAC,OAAwB,EAAE,MAAc;IAC1D,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,CAAA;AACxE,CAAC;AAED,SAAS,aAAa,CAAC,OAAwB;IAC7C,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,aAAa;IACpB,OAAO,S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F,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IAC5D,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,KAAK,CACZ,CAAC,KAAK,OAAO;YACX,CAAC,CAAC,GAAG,CAAA,uBAAuB,kBAAkB,OAAO,iBAAiB,KAAK,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG;YACpK,CAAC,CAAC,GAAG,CAAA,qCAAqC,kBAAkB,OAAO,iBAAiB,KAAK,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CACrL,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB;IACnB,CAAC;AACH,CAAC"}
|
package/dist/tax/store.d.ts
CHANGED
|
@@ -46,8 +46,28 @@ export interface TaxOutcome {
|
|
|
46
46
|
readonly includedInPrice: boolean;
|
|
47
47
|
readonly ruleName: string | null;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Fiche feedback: a rule had no edit path — only create and delete existed,
|
|
51
|
+
* so fixing a typo'd rate meant deleting and recreating it (losing its
|
|
52
|
+
* `createdAt`, and the priority ordering an operator may have built around
|
|
53
|
+
* that timestamp). Every field absent from the patch is left exactly as
|
|
54
|
+
* saved; `country`/`region` are tri-state — `null` clears them back to
|
|
55
|
+
* "anywhere"/"no region", matching what `undefined` already means at
|
|
56
|
+
* `createRule()` time.
|
|
57
|
+
*/
|
|
58
|
+
export interface UpdateTaxRuleInput {
|
|
59
|
+
readonly country?: string | null;
|
|
60
|
+
readonly region?: string | null;
|
|
61
|
+
readonly taxCategory?: string;
|
|
62
|
+
readonly name?: string;
|
|
63
|
+
readonly rateBp?: number;
|
|
64
|
+
readonly includedInPrice?: boolean;
|
|
65
|
+
readonly priority?: number;
|
|
66
|
+
readonly active?: boolean;
|
|
67
|
+
}
|
|
49
68
|
export interface TaxStore {
|
|
50
69
|
createRule(input: CreateTaxRuleInput): Promise<TaxRule>;
|
|
70
|
+
updateRule(id: string, patch: UpdateTaxRuleInput): Promise<TaxRule>;
|
|
51
71
|
deleteRule(id: string): Promise<void>;
|
|
52
72
|
listRules(): Promise<readonly TaxRule[]>;
|
|
53
73
|
/** The one rule that applies, or null when nothing does. */
|
package/dist/tax/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/tax/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAA0B,MAAM,eAAe,CAAA;AAKzF;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,C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GED
|
@@ -40,18 +40,28 @@ function specificity(rule, zone) {
|
|
|
40
40
|
}
|
|
41
41
|
return rule.country === null ? 0 : 1;
|
|
42
42
|
}
|
|
43
|
+
function assertRateBp(rateBp) {
|
|
44
|
+
if (!Number.isInteger(rateBp) || rateBp < 0 || rateBp > 100_000) {
|
|
45
|
+
throw new CogentaError({
|
|
46
|
+
code: 'COMMERCE_TAX_RULE_INVALID',
|
|
47
|
+
message: `A tax rate must be a whole number of basis points between 0 and 100000, got ${String(rateBp)}.`,
|
|
48
|
+
hint: '20 % is 2000 basis points. 5.5 % is 550.',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function taxRuleNotFound(id) {
|
|
53
|
+
return new CogentaError({
|
|
54
|
+
code: 'COMMERCE_TAX_RULE_UNKNOWN',
|
|
55
|
+
message: `No tax rule with id "${id}".`,
|
|
56
|
+
hint: 'Check the id against the admin\'s "Taxes" screen.',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
43
59
|
export function createTaxStore(db, now = Date.now) {
|
|
44
60
|
const d = db.dialect;
|
|
45
61
|
const table = identifier(TABLES.taxRules, d);
|
|
46
62
|
return {
|
|
47
63
|
createRule: async (input) => {
|
|
48
|
-
|
|
49
|
-
throw new CogentaError({
|
|
50
|
-
code: 'COMMERCE_TAX_RULE_INVALID',
|
|
51
|
-
message: `A tax rate must be a whole number of basis points between 0 and 100000, got ${String(input.rateBp)}.`,
|
|
52
|
-
hint: '20 % is 2000 basis points. 5.5 % is 550.',
|
|
53
|
-
});
|
|
54
|
-
}
|
|
64
|
+
assertRateBp(input.rateBp);
|
|
55
65
|
const id = newId(now);
|
|
56
66
|
await db.query(sql `
|
|
57
67
|
insert into ${table} (id, country, region, tax_category, name, rate_bp, included_in_price, priority, active, created_at)
|
|
@@ -70,6 +80,40 @@ export function createTaxStore(db, now = Date.now) {
|
|
|
70
80
|
}
|
|
71
81
|
return decode(row);
|
|
72
82
|
},
|
|
83
|
+
updateRule: async (id, patch) => {
|
|
84
|
+
const existing = await db.query(sql `select * from ${table} where id = ${id}`);
|
|
85
|
+
const row = existing.rows[0];
|
|
86
|
+
if (row === undefined)
|
|
87
|
+
throw taxRuleNotFound(id);
|
|
88
|
+
const current = decode(row);
|
|
89
|
+
if (patch.rateBp !== undefined)
|
|
90
|
+
assertRateBp(patch.rateBp);
|
|
91
|
+
const country = patch.country === undefined ? current.country : (patch.country?.toUpperCase() ?? null);
|
|
92
|
+
const region = patch.region === undefined ? current.region : (patch.region ?? null);
|
|
93
|
+
const taxCategory = patch.taxCategory ?? current.taxCategory;
|
|
94
|
+
const name = patch.name ?? current.name;
|
|
95
|
+
const rateBp = patch.rateBp ?? current.rateBp;
|
|
96
|
+
const includedInPrice = patch.includedInPrice ?? current.includedInPrice;
|
|
97
|
+
const priority = patch.priority ?? current.priority;
|
|
98
|
+
const active = patch.active ?? current.active;
|
|
99
|
+
await db.query(sql `
|
|
100
|
+
update ${table}
|
|
101
|
+
set country = ${country}, region = ${region}, tax_category = ${taxCategory},
|
|
102
|
+
name = ${name}, rate_bp = ${rateBp}, included_in_price = ${fromBool(includedInPrice, d)},
|
|
103
|
+
priority = ${priority}, active = ${fromBool(active, d)}
|
|
104
|
+
where id = ${id}`);
|
|
105
|
+
return {
|
|
106
|
+
...current,
|
|
107
|
+
country,
|
|
108
|
+
region,
|
|
109
|
+
taxCategory,
|
|
110
|
+
name,
|
|
111
|
+
rateBp,
|
|
112
|
+
includedInPrice,
|
|
113
|
+
priority,
|
|
114
|
+
active,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
73
117
|
deleteRule: async (id) => {
|
|
74
118
|
await db.query(sql `delete from ${table} where id = ${id}`);
|
|
75
119
|
},
|
package/dist/tax/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/tax/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,UAAU,EAAE,KAAK,EAAE,G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payments, tax, shipping, coupons, invoices and subscriptions.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"directory": "packages/commerce"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@cogenta/core": "0.
|
|
30
|
+
"@cogenta/core": "0.8.0",
|
|
31
|
+
"@cogenta/channels": "0.3.4"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"typescript": "^7.0.2",
|