@porulle/plugin-marketplace 0.64.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -11
- package/dist/routes/b2b.d.ts +1 -3
- package/dist/routes/b2b.d.ts.map +1 -1
- package/dist/routes/b2b.js +2 -70
- package/dist/routes/sub-orders.js +3 -3
- package/dist/routes/vendor-portal.js +6 -6
- package/dist/schema.d.ts +0 -194
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +0 -14
- package/dist/schemas/b2b.d.ts +0 -986
- package/dist/schemas/b2b.d.ts.map +1 -1
- package/dist/schemas/b2b.js +1 -184
- package/dist/schemas/commission.d.ts +0 -495
- package/dist/schemas/commission.d.ts.map +1 -1
- package/dist/schemas/commission.js +1 -78
- package/dist/schemas/disputes-returns-reviews.d.ts +0 -1354
- package/dist/schemas/disputes-returns-reviews.d.ts.map +1 -1
- package/dist/schemas/disputes-returns-reviews.js +1 -208
- package/dist/schemas/sub-orders.d.ts +0 -290
- package/dist/schemas/sub-orders.d.ts.map +1 -1
- package/dist/schemas/sub-orders.js +1 -59
- package/dist/schemas/vendor-portal.d.ts +0 -1755
- package/dist/schemas/vendor-portal.d.ts.map +1 -1
- package/dist/schemas/vendor-portal.js +1 -247
- package/dist/schemas/vendors.d.ts +0 -1321
- package/dist/schemas/vendors.d.ts.map +1 -1
- package/dist/schemas/vendors.js +1 -205
- package/dist/services/sub-order.d.ts +1 -31
- package/dist/services/sub-order.d.ts.map +1 -1
- package/dist/services/sub-order.js +14 -22
- package/dist/types.d.ts +0 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -4
- package/package.json +2 -2
- package/src/index.ts +3 -11
- package/src/routes/b2b.ts +1 -76
- package/src/routes/sub-orders.ts +3 -3
- package/src/routes/vendor-portal.ts +6 -6
- package/src/schema.ts +0 -16
- package/src/schemas/b2b.ts +1 -208
- package/src/schemas/commission.ts +1 -86
- package/src/schemas/disputes-returns-reviews.ts +1 -225
- package/src/schemas/sub-orders.ts +1 -65
- package/src/schemas/vendor-portal.ts +1 -269
- package/src/schemas/vendors.ts +1 -222
- package/src/services/sub-order.ts +16 -18
- package/src/types.ts +0 -28
- package/dist/schemas/payouts.d.ts +0 -375
- package/dist/schemas/payouts.d.ts.map +0 -1
- package/dist/schemas/payouts.js +0 -78
- package/dist/services/contract-price.d.ts +0 -64
- package/dist/services/contract-price.d.ts.map +0 -1
- package/dist/services/contract-price.js +0 -57
- package/src/schemas/payouts.ts +0 -90
- package/src/services/contract-price.ts +0 -80
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A production-grade, headless multi-vendor marketplace plugin for [Porulle](../../../README.md). This plugin transforms a single-tenant storefront into a fully operational marketplace where multiple vendors sell through a unified platform — handling everything from vendor onboarding and commission calculations through to dispute resolution and vendor payouts.
|
|
4
4
|
|
|
5
|
-
It is designed for both **B2C marketplaces** (think Amazon, Etsy, Zalando) and **B2B marketplaces** (think Alibaba, Faire, ThomasNet) —
|
|
5
|
+
It is designed for both **B2C marketplaces** (think Amazon, Etsy, Zalando) and **B2B marketplaces** (think Alibaba, Faire, ThomasNet) — B2B RFQ is opt-in and activates only when you need it.
|
|
6
6
|
|
|
7
7
|
## Philosophy
|
|
8
8
|
|
|
@@ -35,23 +35,9 @@ When you need more, you layer it on:
|
|
|
35
35
|
```typescript
|
|
36
36
|
marketplacePlugin({
|
|
37
37
|
defaultCommissionRateBps: 1500, // 15%
|
|
38
|
-
|
|
39
|
-
defaultHoldbackDays: 14,
|
|
40
|
-
vendorApprovalMode: "auto",
|
|
41
|
-
requireVerifiedPurchase: true,
|
|
38
|
+
defaultPayoutMinimumCents: 2500,
|
|
42
39
|
reviewModerationEnabled: true,
|
|
43
|
-
|
|
44
|
-
// B2B features — only activate when you need them
|
|
45
|
-
b2b: {
|
|
46
|
-
rfq: true,
|
|
47
|
-
contractPricing: true,
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
performanceThresholds: {
|
|
51
|
-
minRating: 3.5,
|
|
52
|
-
maxDefectRatePercent: 3,
|
|
53
|
-
maxLateShipmentRatePercent: 8,
|
|
54
|
-
},
|
|
40
|
+
b2b: { rfq: true },
|
|
55
41
|
});
|
|
56
42
|
```
|
|
57
43
|
|
|
@@ -336,7 +322,6 @@ All endpoints are scoped to the authenticated vendor via `actor.vendorId`. Retur
|
|
|
336
322
|
| Group | Endpoints | Enabled by |
|
|
337
323
|
|-------|-----------|------------|
|
|
338
324
|
| RFQ | Create, list, detail, respond, award, close | `b2b.rfq: true` |
|
|
339
|
-
| Contract Pricing | CRUD | `b2b.contractPricing: true` |
|
|
340
325
|
|
|
341
326
|
---
|
|
342
327
|
|
|
@@ -344,43 +329,12 @@ All endpoints are scoped to the authenticated vendor via `actor.vendorId`. Retur
|
|
|
344
329
|
|
|
345
330
|
```typescript
|
|
346
331
|
interface MarketplacePluginOptions {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
vendorApprovalMode?: "manual" | "auto" | "invitation";
|
|
352
|
-
requiredDocuments?: Array<"business_license" | "tax_form" | "bank_proof" | "identity">;
|
|
353
|
-
|
|
354
|
-
// ── Payouts ─────────────────────────────────────────────────
|
|
355
|
-
defaultPayoutSchedule?: "daily" | "weekly" | "biweekly" | "monthly" | "manual";
|
|
356
|
-
defaultPayoutMinimumCents?: number; // Default: 5000 ($50)
|
|
357
|
-
defaultHoldbackDays?: number; // Default: 7
|
|
358
|
-
|
|
359
|
-
// ── Disputes ────────────────────────────────────────────────
|
|
360
|
-
vendorResponseDeadlineDays?: number; // Default: 3
|
|
361
|
-
autoEscalateOnMissedDeadline?: boolean; // Default: true
|
|
362
|
-
|
|
363
|
-
// ── Returns ─────────────────────────────────────────────────
|
|
364
|
-
returnWindowDays?: number; // Default: 30
|
|
365
|
-
autoApproveReturnsOnVendorTimeout?: boolean;
|
|
366
|
-
vendorReturnResponseDays?: number; // Default: 5
|
|
367
|
-
|
|
368
|
-
// ── Reviews ─────────────────────────────────────────────────
|
|
369
|
-
requireVerifiedPurchase?: boolean; // Default: true
|
|
370
|
-
reviewModerationEnabled?: boolean; // Default: false
|
|
371
|
-
|
|
372
|
-
// ── B2B (opt-in) ───────────────────────────────────────────
|
|
332
|
+
defaultCommissionRateBps?: number;
|
|
333
|
+
defaultPayoutMinimumCents?: number;
|
|
334
|
+
vendorResponseDeadlineDays?: number;
|
|
335
|
+
reviewModerationEnabled?: boolean;
|
|
373
336
|
b2b?: {
|
|
374
|
-
rfq?: boolean;
|
|
375
|
-
contractPricing?: boolean; // Default: false
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
// ── Performance Enforcement ─────────────────────────────────
|
|
379
|
-
performanceThresholds?: {
|
|
380
|
-
minRating?: number; // Default: 3.0
|
|
381
|
-
maxDefectRatePercent?: number; // Default: 5
|
|
382
|
-
maxLateShipmentRatePercent?: number; // Default: 10
|
|
383
|
-
maxCancellationRatePercent?: number; // Default: 5
|
|
337
|
+
rfq?: boolean;
|
|
384
338
|
};
|
|
385
339
|
}
|
|
386
340
|
```
|
|
@@ -389,7 +343,7 @@ interface MarketplacePluginOptions {
|
|
|
389
343
|
|
|
390
344
|
## Schema
|
|
391
345
|
|
|
392
|
-
The plugin manages
|
|
346
|
+
The plugin manages 12 PostgreSQL tables:
|
|
393
347
|
|
|
394
348
|
| Table | Purpose |
|
|
395
349
|
|-------|---------|
|
|
@@ -405,7 +359,6 @@ The plugin manages 13 PostgreSQL tables:
|
|
|
405
359
|
| `marketplace_return_requests` | Per-sub-order return/RMA requests |
|
|
406
360
|
| `marketplace_rfq` | Request for Quote (B2B) |
|
|
407
361
|
| `marketplace_rfq_responses` | Vendor bids on RFQs (B2B) |
|
|
408
|
-
| `marketplace_contract_prices` | Negotiated pricing per buyer/vendor/product (B2B) |
|
|
409
362
|
|
|
410
363
|
---
|
|
411
364
|
|
|
@@ -416,7 +369,7 @@ plugin-marketplace/
|
|
|
416
369
|
src/
|
|
417
370
|
index.ts ← Plugin entrypoint, wires services/routes/hooks
|
|
418
371
|
types.ts ← TypeScript types, state machines, options interface
|
|
419
|
-
schema.ts ← All
|
|
372
|
+
schema.ts ← All 12 Drizzle pgTable definitions
|
|
420
373
|
hooks.ts ← Catalog + order lifecycle hooks
|
|
421
374
|
mcp-tools.ts ← 8 AI agent tools
|
|
422
375
|
services/
|
|
@@ -428,7 +381,6 @@ plugin-marketplace/
|
|
|
428
381
|
return.ts ← Return request lifecycle
|
|
429
382
|
review.ts ← Vendor reviews + aggregate ratings
|
|
430
383
|
rfq.ts ← RFQ lifecycle (B2B)
|
|
431
|
-
contract-price.ts ← Negotiated pricing (B2B)
|
|
432
384
|
routes/
|
|
433
385
|
vendors.ts ← Platform admin vendor management
|
|
434
386
|
vendor-portal.ts ← Vendor self-service (scoped by actor.vendorId)
|
|
@@ -436,7 +388,7 @@ plugin-marketplace/
|
|
|
436
388
|
commission.ts ← Commission rules CRUD
|
|
437
389
|
payouts.ts ← Payout management
|
|
438
390
|
disputes-returns-reviews.ts ← Trust & safety
|
|
439
|
-
b2b.ts ← RFQ
|
|
391
|
+
b2b.ts ← RFQ (conditional)
|
|
440
392
|
```
|
|
441
393
|
|
|
442
394
|
### Type Safety
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,wBAAwB,EAAM,MAAM,YAAY,CAAC;AAE/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAwC3D,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,0CAyCvE"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineCommercePlugin } from "@porulle/core";
|
|
2
2
|
import { MARKETPLACE_ANALYTICS_MODELS } from "./analytics-models.js";
|
|
3
|
-
import { vendors, vendorEntities, vendorSubOrders, vendorPayouts, vendorDocuments, commissionRules, vendorBalances, disputes, vendorReviews, returnRequests, rfqs, rfqResponses,
|
|
3
|
+
import { vendors, vendorEntities, vendorSubOrders, vendorPayouts, vendorDocuments, commissionRules, vendorBalances, disputes, vendorReviews, returnRequests, rfqs, rfqResponses, } from "./schema.js";
|
|
4
4
|
import { VendorService } from "./services/vendor.js";
|
|
5
5
|
import { SubOrderService } from "./services/sub-order.js";
|
|
6
6
|
import { CommissionService } from "./services/commission.js";
|
|
@@ -9,7 +9,6 @@ import { DisputeService } from "./services/dispute.js";
|
|
|
9
9
|
import { ReturnService } from "./services/return.js";
|
|
10
10
|
import { ReviewService } from "./services/review.js";
|
|
11
11
|
import { RFQService } from "./services/rfq.js";
|
|
12
|
-
import { ContractPriceService } from "./services/contract-price.js";
|
|
13
12
|
import { buildHooks } from "./hooks.js";
|
|
14
13
|
import { buildVendorRoutes } from "./routes/vendors.js";
|
|
15
14
|
import { buildVendorPortalRoutes } from "./routes/vendor-portal.js";
|
|
@@ -26,10 +25,7 @@ function createServices(db, options, kernelServices) {
|
|
|
26
25
|
const returnSvc = new ReturnService(db);
|
|
27
26
|
const review = new ReviewService(db, options);
|
|
28
27
|
const rfq = options.b2b?.rfq ? new RFQService(db) : undefined;
|
|
29
|
-
const contractPrice = options.b2b?.contractPricing ? new ContractPriceService(db) : undefined;
|
|
30
|
-
// Cancel callback: release inventory on parent order + reverse balance
|
|
31
28
|
const subOrder = new SubOrderService(db, async (sub) => {
|
|
32
|
-
// Release inventory for cancelled vendor's line items
|
|
33
29
|
const inventory = kernelServices?.inventory;
|
|
34
30
|
if (inventory?.release && sub.lineItems) {
|
|
35
31
|
for (const item of sub.lineItems) {
|
|
@@ -41,7 +37,6 @@ function createServices(db, options, kernelServices) {
|
|
|
41
37
|
});
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
|
-
// Reverse balance: debit the sale credit
|
|
45
40
|
if (sub.payoutAmount > 0) {
|
|
46
41
|
await payout.addLedgerEntry({
|
|
47
42
|
vendorId: sub.vendorId,
|
|
@@ -53,7 +48,7 @@ function createServices(db, options, kernelServices) {
|
|
|
53
48
|
});
|
|
54
49
|
}
|
|
55
50
|
});
|
|
56
|
-
return { vendor, subOrder, commission, payout, dispute, return: returnSvc, review, rfq
|
|
51
|
+
return { vendor, subOrder, commission, payout, dispute, return: returnSvc, review, rfq };
|
|
57
52
|
}
|
|
58
53
|
export function marketplacePlugin(options = {}) {
|
|
59
54
|
return defineCommercePlugin({
|
|
@@ -72,7 +67,6 @@ export function marketplacePlugin(options = {}) {
|
|
|
72
67
|
returnRequests,
|
|
73
68
|
rfqs,
|
|
74
69
|
rfqResponses,
|
|
75
|
-
contractPrices,
|
|
76
70
|
}),
|
|
77
71
|
hooks: () => buildHooks(options),
|
|
78
72
|
routes: (ctx) => {
|
|
@@ -87,9 +81,7 @@ export function marketplacePlugin(options = {}) {
|
|
|
87
81
|
...buildCommissionRoutes(services),
|
|
88
82
|
...buildPayoutRoutes(services),
|
|
89
83
|
...buildDisputesReturnsReviewsRoutes(services),
|
|
90
|
-
...(options.b2b?.rfq
|
|
91
|
-
? buildB2BRoutes(services, options)
|
|
92
|
-
: []),
|
|
84
|
+
...(options.b2b?.rfq ? buildB2BRoutes(services, options) : []),
|
|
93
85
|
];
|
|
94
86
|
},
|
|
95
87
|
analyticsModels: () => MARKETPLACE_ANALYTICS_MODELS,
|
package/dist/routes/b2b.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { PluginRouteRegistration } from "@porulle/core";
|
|
2
2
|
import type { RFQService } from "../services/rfq.js";
|
|
3
|
-
import type { ContractPriceService } from "../services/contract-price.js";
|
|
4
3
|
import type { MarketplacePluginOptions } from "../types.js";
|
|
5
4
|
export declare function buildB2BRoutes(services: {
|
|
6
5
|
rfq?: RFQService | undefined;
|
|
7
|
-
|
|
8
|
-
}, options: MarketplacePluginOptions): PluginRouteRegistration[];
|
|
6
|
+
}, _options: MarketplacePluginOptions): PluginRouteRegistration[];
|
|
9
7
|
//# sourceMappingURL=b2b.d.ts.map
|
package/dist/routes/b2b.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b2b.d.ts","sourceRoot":"","sources":["../../src/routes/b2b.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"b2b.d.ts","sourceRoot":"","sources":["../../src/routes/b2b.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAQ5D,wBAAgB,cAAc,CAAC,QAAQ,EAAE;IACvC,GAAG,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAC9B,EAAE,QAAQ,EAAE,wBAAwB,GAAG,uBAAuB,EAAE,CAyFhE"}
|
package/dist/routes/b2b.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { router } from "@porulle/core";
|
|
2
|
-
import { CreateRFQBodySchema, RespondRFQBodySchema, AwardRFQBodySchema,
|
|
2
|
+
import { CreateRFQBodySchema, RespondRFQBodySchema, AwardRFQBodySchema, } from "../schemas/b2b.js";
|
|
3
3
|
import { stripUndefined } from "./util.js";
|
|
4
|
-
export function buildB2BRoutes(services,
|
|
4
|
+
export function buildB2BRoutes(services, _options) {
|
|
5
5
|
const allRoutes = [];
|
|
6
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
7
|
-
// RFQ (Request for Quote)
|
|
8
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
9
6
|
if (services.rfq) {
|
|
10
7
|
const rfqSvc = services.rfq;
|
|
11
8
|
const rfq = router("Marketplace - B2B", "/marketplace/rfq");
|
|
@@ -87,70 +84,5 @@ export function buildB2BRoutes(services, options) {
|
|
|
87
84
|
});
|
|
88
85
|
allRoutes.push(...rfq.routes());
|
|
89
86
|
}
|
|
90
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
91
|
-
// CONTRACT PRICES
|
|
92
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
93
|
-
if (services.contractPrice) {
|
|
94
|
-
const cpSvc = services.contractPrice;
|
|
95
|
-
const cp = router("Marketplace - B2B", "/marketplace/contract-prices");
|
|
96
|
-
cp.get("/")
|
|
97
|
-
.summary("List contract prices")
|
|
98
|
-
.auth()
|
|
99
|
-
.handler(async ({ query }) => {
|
|
100
|
-
return cpSvc.list(stripUndefined({
|
|
101
|
-
vendorId: query.vendorId,
|
|
102
|
-
buyerId: query.buyerId,
|
|
103
|
-
}));
|
|
104
|
-
});
|
|
105
|
-
cp.post("/")
|
|
106
|
-
.summary("Create a contract price")
|
|
107
|
-
.auth()
|
|
108
|
-
.permission("marketplace:admin")
|
|
109
|
-
.input(CreateContractPriceBodySchema)
|
|
110
|
-
.handler(async ({ input }) => {
|
|
111
|
-
const body = input;
|
|
112
|
-
return cpSvc.create(stripUndefined({
|
|
113
|
-
vendorId: body.vendorId,
|
|
114
|
-
buyerId: body.buyerId,
|
|
115
|
-
entityId: body.entityId,
|
|
116
|
-
variantId: body.variantId,
|
|
117
|
-
priceCents: body.priceCents,
|
|
118
|
-
minQuantity: body.minQuantity,
|
|
119
|
-
currency: body.currency,
|
|
120
|
-
validFrom: body.validFrom ? new Date(body.validFrom) : undefined,
|
|
121
|
-
validUntil: body.validUntil ? new Date(body.validUntil) : undefined,
|
|
122
|
-
}));
|
|
123
|
-
});
|
|
124
|
-
cp.patch("/{id}")
|
|
125
|
-
.summary("Update a contract price")
|
|
126
|
-
.auth()
|
|
127
|
-
.permission("marketplace:admin")
|
|
128
|
-
.input(UpdateContractPriceBodySchema)
|
|
129
|
-
.handler(async ({ params, input }) => {
|
|
130
|
-
const body = input;
|
|
131
|
-
const updateData = {};
|
|
132
|
-
if (body.priceCents !== undefined)
|
|
133
|
-
updateData.priceCents = body.priceCents;
|
|
134
|
-
if (body.minQuantity !== undefined)
|
|
135
|
-
updateData.minQuantity = body.minQuantity;
|
|
136
|
-
if (body.validFrom !== undefined)
|
|
137
|
-
updateData.validFrom = body.validFrom ? new Date(body.validFrom) : null;
|
|
138
|
-
if (body.validUntil !== undefined)
|
|
139
|
-
updateData.validUntil = body.validUntil ? new Date(body.validUntil) : null;
|
|
140
|
-
const updated = await cpSvc.update(params.id, updateData);
|
|
141
|
-
if (!updated)
|
|
142
|
-
throw new Error("Contract price not found");
|
|
143
|
-
return updated;
|
|
144
|
-
});
|
|
145
|
-
cp.delete("/{id}")
|
|
146
|
-
.summary("Delete a contract price")
|
|
147
|
-
.auth()
|
|
148
|
-
.permission("marketplace:admin")
|
|
149
|
-
.handler(async ({ params }) => {
|
|
150
|
-
await cpSvc.delete(params.id);
|
|
151
|
-
return { deleted: true };
|
|
152
|
-
});
|
|
153
|
-
allRoutes.push(...cp.routes());
|
|
154
|
-
}
|
|
155
87
|
return allRoutes;
|
|
156
88
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { router } from "@porulle/core";
|
|
1
|
+
import { router, CommerceNotFoundError } from "@porulle/core";
|
|
2
2
|
import { UpdateSubOrderStatusBodySchema } from "../schemas/sub-orders.js";
|
|
3
3
|
import { stripUndefined } from "./util.js";
|
|
4
4
|
export function buildSubOrderRoutes(services) {
|
|
@@ -21,7 +21,7 @@ export function buildSubOrderRoutes(services) {
|
|
|
21
21
|
.handler(async ({ params }) => {
|
|
22
22
|
const subOrder = await services.subOrder.getById(params.id);
|
|
23
23
|
if (!subOrder)
|
|
24
|
-
throw new
|
|
24
|
+
throw new CommerceNotFoundError("Sub-order not found.");
|
|
25
25
|
return subOrder;
|
|
26
26
|
});
|
|
27
27
|
// ─── Force status change ───────────────────────────────────────────────────
|
|
@@ -33,7 +33,7 @@ export function buildSubOrderRoutes(services) {
|
|
|
33
33
|
const body = input;
|
|
34
34
|
const subOrder = await services.subOrder.getById(params.id);
|
|
35
35
|
if (!subOrder)
|
|
36
|
-
throw new
|
|
36
|
+
throw new CommerceNotFoundError("Sub-order not found.");
|
|
37
37
|
// Use cancel() for cancelled status to trigger side effects
|
|
38
38
|
// (inventory release + ledger reversal)
|
|
39
39
|
return body.status === "cancelled"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { router } from "@porulle/core";
|
|
1
|
+
import { router, CommerceNotFoundError } from "@porulle/core";
|
|
2
2
|
import { vendorEntities } from "../schema.js";
|
|
3
3
|
import { eq } from "@porulle/core/drizzle";
|
|
4
4
|
import { UpdateVendorProfileBodySchema, UploadVendorDocumentBodySchema, ShipSubOrderBodySchema, CancelSubOrderBodySchema, RespondToReviewBodySchema, ApproveReturnBodySchema, RejectReturnBodySchema, } from "../schemas/vendor-portal.js";
|
|
@@ -87,7 +87,7 @@ export function buildVendorPortalRoutes(services) {
|
|
|
87
87
|
const vendorId = requireVendorId(actor);
|
|
88
88
|
const subOrder = await services.subOrder.getById(params.subOrderId);
|
|
89
89
|
if (!subOrder)
|
|
90
|
-
throw new
|
|
90
|
+
throw new CommerceNotFoundError("Sub-order not found.");
|
|
91
91
|
if (subOrder.vendorId !== vendorId)
|
|
92
92
|
throw new Error("Forbidden");
|
|
93
93
|
return subOrder;
|
|
@@ -100,7 +100,7 @@ export function buildVendorPortalRoutes(services) {
|
|
|
100
100
|
const vendorId = requireVendorId(actor);
|
|
101
101
|
const subOrder = await services.subOrder.getById(params.subOrderId);
|
|
102
102
|
if (!subOrder)
|
|
103
|
-
throw new
|
|
103
|
+
throw new CommerceNotFoundError("Sub-order not found.");
|
|
104
104
|
if (subOrder.vendorId !== vendorId)
|
|
105
105
|
throw new Error("Forbidden");
|
|
106
106
|
return services.subOrder.confirm(params.subOrderId);
|
|
@@ -115,7 +115,7 @@ export function buildVendorPortalRoutes(services) {
|
|
|
115
115
|
const body = input;
|
|
116
116
|
const subOrder = await services.subOrder.getById(params.subOrderId);
|
|
117
117
|
if (!subOrder)
|
|
118
|
-
throw new
|
|
118
|
+
throw new CommerceNotFoundError("Sub-order not found.");
|
|
119
119
|
if (subOrder.vendorId !== vendorId)
|
|
120
120
|
throw new Error("Forbidden");
|
|
121
121
|
return services.subOrder.ship(params.subOrderId, {
|
|
@@ -131,7 +131,7 @@ export function buildVendorPortalRoutes(services) {
|
|
|
131
131
|
const vendorId = requireVendorId(actor);
|
|
132
132
|
const subOrder = await services.subOrder.getById(params.subOrderId);
|
|
133
133
|
if (!subOrder)
|
|
134
|
-
throw new
|
|
134
|
+
throw new CommerceNotFoundError("Sub-order not found.");
|
|
135
135
|
if (subOrder.vendorId !== vendorId)
|
|
136
136
|
throw new Error("Forbidden");
|
|
137
137
|
return services.subOrder.deliver(params.subOrderId);
|
|
@@ -146,7 +146,7 @@ export function buildVendorPortalRoutes(services) {
|
|
|
146
146
|
const body = input;
|
|
147
147
|
const subOrder = await services.subOrder.getById(params.subOrderId);
|
|
148
148
|
if (!subOrder)
|
|
149
|
-
throw new
|
|
149
|
+
throw new CommerceNotFoundError("Sub-order not found.");
|
|
150
150
|
if (subOrder.vendorId !== vendorId)
|
|
151
151
|
throw new Error("Forbidden");
|
|
152
152
|
return services.subOrder.cancel(params.subOrderId, body.reason);
|
package/dist/schema.d.ts
CHANGED
|
@@ -3058,198 +3058,4 @@ export declare const rfqResponses: import("drizzle-orm/pg-core/table").PgTableWi
|
|
|
3058
3058
|
};
|
|
3059
3059
|
dialect: "pg";
|
|
3060
3060
|
}>;
|
|
3061
|
-
export declare const contractPrices: import("drizzle-orm/pg-core/table").PgTableWithColumns<{
|
|
3062
|
-
name: "marketplace_contract_prices";
|
|
3063
|
-
schema: undefined;
|
|
3064
|
-
columns: {
|
|
3065
|
-
id: import("@porulle/core/drizzle").PgColumn<{
|
|
3066
|
-
name: "id";
|
|
3067
|
-
tableName: "marketplace_contract_prices";
|
|
3068
|
-
dataType: "string";
|
|
3069
|
-
columnType: "PgUUID";
|
|
3070
|
-
data: string;
|
|
3071
|
-
driverParam: string;
|
|
3072
|
-
notNull: true;
|
|
3073
|
-
hasDefault: true;
|
|
3074
|
-
isPrimaryKey: true;
|
|
3075
|
-
isAutoincrement: false;
|
|
3076
|
-
hasRuntimeDefault: false;
|
|
3077
|
-
enumValues: undefined;
|
|
3078
|
-
baseColumn: never;
|
|
3079
|
-
identity: undefined;
|
|
3080
|
-
generated: undefined;
|
|
3081
|
-
}, {}, {}>;
|
|
3082
|
-
vendorId: import("@porulle/core/drizzle").PgColumn<{
|
|
3083
|
-
name: "vendor_id";
|
|
3084
|
-
tableName: "marketplace_contract_prices";
|
|
3085
|
-
dataType: "string";
|
|
3086
|
-
columnType: "PgUUID";
|
|
3087
|
-
data: string;
|
|
3088
|
-
driverParam: string;
|
|
3089
|
-
notNull: true;
|
|
3090
|
-
hasDefault: false;
|
|
3091
|
-
isPrimaryKey: false;
|
|
3092
|
-
isAutoincrement: false;
|
|
3093
|
-
hasRuntimeDefault: false;
|
|
3094
|
-
enumValues: undefined;
|
|
3095
|
-
baseColumn: never;
|
|
3096
|
-
identity: undefined;
|
|
3097
|
-
generated: undefined;
|
|
3098
|
-
}, {}, {}>;
|
|
3099
|
-
buyerId: import("@porulle/core/drizzle").PgColumn<{
|
|
3100
|
-
name: "buyer_id";
|
|
3101
|
-
tableName: "marketplace_contract_prices";
|
|
3102
|
-
dataType: "string";
|
|
3103
|
-
columnType: "PgUUID";
|
|
3104
|
-
data: string;
|
|
3105
|
-
driverParam: string;
|
|
3106
|
-
notNull: true;
|
|
3107
|
-
hasDefault: false;
|
|
3108
|
-
isPrimaryKey: false;
|
|
3109
|
-
isAutoincrement: false;
|
|
3110
|
-
hasRuntimeDefault: false;
|
|
3111
|
-
enumValues: undefined;
|
|
3112
|
-
baseColumn: never;
|
|
3113
|
-
identity: undefined;
|
|
3114
|
-
generated: undefined;
|
|
3115
|
-
}, {}, {}>;
|
|
3116
|
-
entityId: import("@porulle/core/drizzle").PgColumn<{
|
|
3117
|
-
name: "entity_id";
|
|
3118
|
-
tableName: "marketplace_contract_prices";
|
|
3119
|
-
dataType: "string";
|
|
3120
|
-
columnType: "PgUUID";
|
|
3121
|
-
data: string;
|
|
3122
|
-
driverParam: string;
|
|
3123
|
-
notNull: true;
|
|
3124
|
-
hasDefault: false;
|
|
3125
|
-
isPrimaryKey: false;
|
|
3126
|
-
isAutoincrement: false;
|
|
3127
|
-
hasRuntimeDefault: false;
|
|
3128
|
-
enumValues: undefined;
|
|
3129
|
-
baseColumn: never;
|
|
3130
|
-
identity: undefined;
|
|
3131
|
-
generated: undefined;
|
|
3132
|
-
}, {}, {}>;
|
|
3133
|
-
variantId: import("@porulle/core/drizzle").PgColumn<{
|
|
3134
|
-
name: "variant_id";
|
|
3135
|
-
tableName: "marketplace_contract_prices";
|
|
3136
|
-
dataType: "string";
|
|
3137
|
-
columnType: "PgUUID";
|
|
3138
|
-
data: string;
|
|
3139
|
-
driverParam: string;
|
|
3140
|
-
notNull: false;
|
|
3141
|
-
hasDefault: false;
|
|
3142
|
-
isPrimaryKey: false;
|
|
3143
|
-
isAutoincrement: false;
|
|
3144
|
-
hasRuntimeDefault: false;
|
|
3145
|
-
enumValues: undefined;
|
|
3146
|
-
baseColumn: never;
|
|
3147
|
-
identity: undefined;
|
|
3148
|
-
generated: undefined;
|
|
3149
|
-
}, {}, {}>;
|
|
3150
|
-
priceCents: import("@porulle/core/drizzle").PgColumn<{
|
|
3151
|
-
name: "price_cents";
|
|
3152
|
-
tableName: "marketplace_contract_prices";
|
|
3153
|
-
dataType: "number";
|
|
3154
|
-
columnType: "PgInteger";
|
|
3155
|
-
data: number;
|
|
3156
|
-
driverParam: string | number;
|
|
3157
|
-
notNull: true;
|
|
3158
|
-
hasDefault: false;
|
|
3159
|
-
isPrimaryKey: false;
|
|
3160
|
-
isAutoincrement: false;
|
|
3161
|
-
hasRuntimeDefault: false;
|
|
3162
|
-
enumValues: undefined;
|
|
3163
|
-
baseColumn: never;
|
|
3164
|
-
identity: undefined;
|
|
3165
|
-
generated: undefined;
|
|
3166
|
-
}, {}, {}>;
|
|
3167
|
-
minQuantity: import("@porulle/core/drizzle").PgColumn<{
|
|
3168
|
-
name: "min_quantity";
|
|
3169
|
-
tableName: "marketplace_contract_prices";
|
|
3170
|
-
dataType: "number";
|
|
3171
|
-
columnType: "PgInteger";
|
|
3172
|
-
data: number;
|
|
3173
|
-
driverParam: string | number;
|
|
3174
|
-
notNull: true;
|
|
3175
|
-
hasDefault: true;
|
|
3176
|
-
isPrimaryKey: false;
|
|
3177
|
-
isAutoincrement: false;
|
|
3178
|
-
hasRuntimeDefault: false;
|
|
3179
|
-
enumValues: undefined;
|
|
3180
|
-
baseColumn: never;
|
|
3181
|
-
identity: undefined;
|
|
3182
|
-
generated: undefined;
|
|
3183
|
-
}, {}, {}>;
|
|
3184
|
-
currency: import("@porulle/core/drizzle").PgColumn<{
|
|
3185
|
-
name: "currency";
|
|
3186
|
-
tableName: "marketplace_contract_prices";
|
|
3187
|
-
dataType: "string";
|
|
3188
|
-
columnType: "PgText";
|
|
3189
|
-
data: string;
|
|
3190
|
-
driverParam: string;
|
|
3191
|
-
notNull: true;
|
|
3192
|
-
hasDefault: true;
|
|
3193
|
-
isPrimaryKey: false;
|
|
3194
|
-
isAutoincrement: false;
|
|
3195
|
-
hasRuntimeDefault: false;
|
|
3196
|
-
enumValues: [string, ...string[]];
|
|
3197
|
-
baseColumn: never;
|
|
3198
|
-
identity: undefined;
|
|
3199
|
-
generated: undefined;
|
|
3200
|
-
}, {}, {}>;
|
|
3201
|
-
validFrom: import("@porulle/core/drizzle").PgColumn<{
|
|
3202
|
-
name: "valid_from";
|
|
3203
|
-
tableName: "marketplace_contract_prices";
|
|
3204
|
-
dataType: "date";
|
|
3205
|
-
columnType: "PgTimestamp";
|
|
3206
|
-
data: Date;
|
|
3207
|
-
driverParam: string;
|
|
3208
|
-
notNull: false;
|
|
3209
|
-
hasDefault: false;
|
|
3210
|
-
isPrimaryKey: false;
|
|
3211
|
-
isAutoincrement: false;
|
|
3212
|
-
hasRuntimeDefault: false;
|
|
3213
|
-
enumValues: undefined;
|
|
3214
|
-
baseColumn: never;
|
|
3215
|
-
identity: undefined;
|
|
3216
|
-
generated: undefined;
|
|
3217
|
-
}, {}, {}>;
|
|
3218
|
-
validUntil: import("@porulle/core/drizzle").PgColumn<{
|
|
3219
|
-
name: "valid_until";
|
|
3220
|
-
tableName: "marketplace_contract_prices";
|
|
3221
|
-
dataType: "date";
|
|
3222
|
-
columnType: "PgTimestamp";
|
|
3223
|
-
data: Date;
|
|
3224
|
-
driverParam: string;
|
|
3225
|
-
notNull: false;
|
|
3226
|
-
hasDefault: false;
|
|
3227
|
-
isPrimaryKey: false;
|
|
3228
|
-
isAutoincrement: false;
|
|
3229
|
-
hasRuntimeDefault: false;
|
|
3230
|
-
enumValues: undefined;
|
|
3231
|
-
baseColumn: never;
|
|
3232
|
-
identity: undefined;
|
|
3233
|
-
generated: undefined;
|
|
3234
|
-
}, {}, {}>;
|
|
3235
|
-
createdAt: import("@porulle/core/drizzle").PgColumn<{
|
|
3236
|
-
name: "created_at";
|
|
3237
|
-
tableName: "marketplace_contract_prices";
|
|
3238
|
-
dataType: "date";
|
|
3239
|
-
columnType: "PgTimestamp";
|
|
3240
|
-
data: Date;
|
|
3241
|
-
driverParam: string;
|
|
3242
|
-
notNull: true;
|
|
3243
|
-
hasDefault: true;
|
|
3244
|
-
isPrimaryKey: false;
|
|
3245
|
-
isAutoincrement: false;
|
|
3246
|
-
hasRuntimeDefault: false;
|
|
3247
|
-
enumValues: undefined;
|
|
3248
|
-
baseColumn: never;
|
|
3249
|
-
identity: undefined;
|
|
3250
|
-
generated: undefined;
|
|
3251
|
-
}, {}, {}>;
|
|
3252
|
-
};
|
|
3253
|
-
dialect: "pg";
|
|
3254
|
-
}>;
|
|
3255
3061
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAWR,MAAM;wBAAU,MAAM;uBAAS,MAAM;wBAAU,MAAM;6BAChD,MAAM;0BAAY,MAAM;;;;;;;;;;;;;;wBAD7B,MAAM;wBAAU,MAAM;uBAAS,MAAM;wBAAU,MAAM;6BAChD,MAAM;0BAAY,MAAM;;;;;;;;;gCAGrB,MAAM;2BAAa,MAAM;gCAAkB,MAAM;gCACjD,MAAM;uBAAS,MAAM;wBAAU,MAAM;;;;;;;;;;;;;;gCADrC,MAAM;2BAAa,MAAM;gCAAkB,MAAM;gCACjD,MAAM;uBAAS,MAAM;wBAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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.js
CHANGED
|
@@ -209,17 +209,3 @@ export const rfqResponses = pgTable("marketplace_rfq_responses", {
|
|
|
209
209
|
status: text("status").notNull().default("submitted"),
|
|
210
210
|
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
|
|
211
211
|
});
|
|
212
|
-
// ─── Contract Prices (B2B) ───────────────────────────────────────────────────
|
|
213
|
-
export const contractPrices = pgTable("marketplace_contract_prices", {
|
|
214
|
-
id: uuid("id").defaultRandom().primaryKey(),
|
|
215
|
-
vendorId: uuid("vendor_id").notNull().references(() => vendors.id, { onDelete: "cascade" }),
|
|
216
|
-
buyerId: uuid("buyer_id").notNull(),
|
|
217
|
-
entityId: uuid("entity_id").notNull(),
|
|
218
|
-
variantId: uuid("variant_id"),
|
|
219
|
-
priceCents: integer("price_cents").notNull(),
|
|
220
|
-
minQuantity: integer("min_quantity").notNull().default(1),
|
|
221
|
-
currency: text("currency").notNull().default("USD"),
|
|
222
|
-
validFrom: timestamp("valid_from", { withTimezone: true }),
|
|
223
|
-
validUntil: timestamp("valid_until", { withTimezone: true }),
|
|
224
|
-
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
|
|
225
|
-
});
|