@porulle/plugin-pos-restaurant 0.11.0 → 0.14.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modifier-validation.d.ts","sourceRoot":"","sources":["../../src/hooks/modifier-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"modifier-validation.d.ts","sourceRoot":"","sources":["../../src/hooks/modifier-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,eAAe;;uBAGhD,OAAO,EAAE;;mBAGjB,MAAM;mBACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAsC3C"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* - Unavailable (86'd) options are rejected
|
|
10
10
|
* - Price adjustments are summed into cart line item metadata
|
|
11
11
|
*/
|
|
12
|
+
import { resolveOrgIdForCommerce } from "@porulle/core";
|
|
12
13
|
export function buildModifierValidationHook(getService) {
|
|
13
14
|
return {
|
|
14
15
|
key: "cart.beforeAddItem",
|
|
@@ -21,8 +22,7 @@ export function buildModifierValidationHook(getService) {
|
|
|
21
22
|
return data;
|
|
22
23
|
if (!data.entityId)
|
|
23
24
|
return data;
|
|
24
|
-
const
|
|
25
|
-
const orgId = resolveOrgId(context.actor);
|
|
25
|
+
const orgId = resolveOrgIdForCommerce(context.actor, context.commerceConfig);
|
|
26
26
|
const service = getService();
|
|
27
27
|
const result = await service.validateModifiers(orgId, data.entityId, modifiers);
|
|
28
28
|
if (!result.ok) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Operational routes: checklists, alerts, recipes, combos, menu availability,
|
|
3
3
|
* analytics, customer favorites.
|
|
4
4
|
*/
|
|
5
|
-
import { router } from "@porulle/core";
|
|
5
|
+
import { requireUserId, router } from "@porulle/core";
|
|
6
6
|
import { z } from "@hono/zod-openapi";
|
|
7
7
|
export function buildChecklistRoutes(service, ctx) {
|
|
8
8
|
const r = router("POS Restaurant Checklists", "/pos/restaurant/checklists", ctx);
|
|
@@ -58,7 +58,7 @@ export function buildChecklistRoutes(service, ctx) {
|
|
|
58
58
|
const result = await service.completeChecklist({
|
|
59
59
|
checklistId: params.id,
|
|
60
60
|
...body,
|
|
61
|
-
operatorId: actor
|
|
61
|
+
operatorId: requireUserId(actor),
|
|
62
62
|
});
|
|
63
63
|
if (!result.ok)
|
|
64
64
|
throw new Error(result.error);
|
|
@@ -98,7 +98,7 @@ export function buildAlertRoutes(service, ctx) {
|
|
|
98
98
|
.summary("Resolve an alert")
|
|
99
99
|
.permission("pos:operate")
|
|
100
100
|
.handler(async ({ params, actor }) => {
|
|
101
|
-
const result = await service.resolveAlert(params.id, actor
|
|
101
|
+
const result = await service.resolveAlert(params.id, requireUserId(actor));
|
|
102
102
|
if (!result.ok)
|
|
103
103
|
throw new Error(result.error);
|
|
104
104
|
return result.value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/plugin-pos-restaurant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@hono/zod-openapi": "^1.2.2",
|
|
21
21
|
"hono": "^4.12.5",
|
|
22
|
-
"@porulle/plugin-pos": "0.
|
|
23
|
-
"@porulle/core": "0.
|
|
22
|
+
"@porulle/plugin-pos": "0.14.0",
|
|
23
|
+
"@porulle/core": "0.14.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^24.5.2",
|
|
27
27
|
"eslint": "^9.39.1",
|
|
28
28
|
"typescript": "5.9.2",
|
|
29
29
|
"vitest": "^3.2.4",
|
|
30
|
-
"@porulle/
|
|
31
|
-
"@porulle/
|
|
30
|
+
"@porulle/eslint-config": "0.1.0",
|
|
31
|
+
"@porulle/typescript-config": "0.1.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* - Price adjustments are summed into cart line item metadata
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { resolveOrgIdForCommerce } from "@porulle/core";
|
|
14
|
+
import type { CommerceConfig } from "@porulle/core";
|
|
13
15
|
import type { ModifierService } from "../services/modifier-service.js";
|
|
14
16
|
|
|
15
17
|
export function buildModifierValidationHook(getService: () => ModifierService) {
|
|
@@ -24,6 +26,7 @@ export function buildModifierValidationHook(getService: () => ModifierService) {
|
|
|
24
26
|
};
|
|
25
27
|
context: {
|
|
26
28
|
actor?: { organizationId?: string | null } | null;
|
|
29
|
+
commerceConfig?: CommerceConfig | null;
|
|
27
30
|
[key: string]: unknown;
|
|
28
31
|
};
|
|
29
32
|
};
|
|
@@ -38,8 +41,7 @@ export function buildModifierValidationHook(getService: () => ModifierService) {
|
|
|
38
41
|
if (!modifiers || modifiers.length === 0) return data;
|
|
39
42
|
if (!data.entityId) return data;
|
|
40
43
|
|
|
41
|
-
const
|
|
42
|
-
const orgId = resolveOrgId(context.actor);
|
|
44
|
+
const orgId = resolveOrgIdForCommerce(context.actor, context.commerceConfig);
|
|
43
45
|
const service = getService();
|
|
44
46
|
|
|
45
47
|
const result = await service.validateModifiers(orgId, data.entityId, modifiers);
|
package/src/routes/operations.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* analytics, customer favorites.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { router } from "@porulle/core";
|
|
6
|
+
import { requireUserId, router } from "@porulle/core";
|
|
7
7
|
import { z } from "@hono/zod-openapi";
|
|
8
8
|
import type { ChecklistService } from "../services/checklist-service.js";
|
|
9
9
|
import type { AlertService } from "../services/alert-service.js";
|
|
@@ -69,7 +69,7 @@ export function buildChecklistRoutes(
|
|
|
69
69
|
const result = await service.completeChecklist({
|
|
70
70
|
checklistId: params.id!,
|
|
71
71
|
...body,
|
|
72
|
-
operatorId: actor
|
|
72
|
+
operatorId: requireUserId(actor),
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
if (!result.ok) throw new Error(result.error);
|
|
@@ -115,7 +115,7 @@ export function buildAlertRoutes(
|
|
|
115
115
|
.summary("Resolve an alert")
|
|
116
116
|
.permission("pos:operate")
|
|
117
117
|
.handler(async ({ params, actor }) => {
|
|
118
|
-
const result = await service.resolveAlert(params.id!, actor
|
|
118
|
+
const result = await service.resolveAlert(params.id!, requireUserId(actor));
|
|
119
119
|
if (!result.ok) throw new Error(result.error);
|
|
120
120
|
return result.value;
|
|
121
121
|
});
|