@porulle/core 0.7.0 → 0.8.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/dist/auth/setup.d.ts.map +1 -1
- package/dist/auth/setup.js +1 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +5 -0
- package/dist/config/types.d.ts +17 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/generated/plugin-manifest.d.ts +3 -0
- package/dist/generated/plugin-manifest.d.ts.map +1 -1
- package/dist/generated/plugin-manifest.js +1 -0
- package/dist/hooks/checkout.d.ts.map +1 -1
- package/dist/hooks/checkout.js +16 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/interfaces/rest/index.d.ts.map +1 -1
- package/dist/interfaces/rest/index.js +12 -0
- package/dist/interfaces/rest/routes/admin/staff.d.ts +12 -0
- package/dist/interfaces/rest/routes/admin/staff.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/admin/staff.js +172 -0
- package/dist/interfaces/rest/routes/analytics.d.ts +5 -0
- package/dist/interfaces/rest/routes/analytics.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/analytics.js +24 -0
- package/dist/interfaces/rest/routes/carts.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/carts.js +39 -2
- package/dist/interfaces/rest/routes/catalog.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/catalog.js +17 -1
- package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/checkout.js +17 -0
- package/dist/interfaces/rest/routes/documents.d.ts +10 -0
- package/dist/interfaces/rest/routes/documents.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/documents.js +40 -0
- package/dist/interfaces/rest/routes/orders.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/orders.js +98 -1
- package/dist/interfaces/rest/routes/pricing.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/pricing.js +36 -1
- package/dist/interfaces/rest/routes/settings.d.ts +5 -0
- package/dist/interfaces/rest/routes/settings.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/settings.js +50 -0
- package/dist/interfaces/rest/routes/shipping.d.ts +5 -0
- package/dist/interfaces/rest/routes/shipping.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/shipping.js +68 -0
- package/dist/interfaces/rest/routes/tax.d.ts +5 -0
- package/dist/interfaces/rest/routes/tax.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/tax.js +68 -0
- package/dist/interfaces/rest/schemas/admin-staff.d.ts +899 -0
- package/dist/interfaces/rest/schemas/admin-staff.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/admin-staff.js +98 -0
- package/dist/interfaces/rest/schemas/analytics.d.ts +252 -0
- package/dist/interfaces/rest/schemas/analytics.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/analytics.js +33 -0
- package/dist/interfaces/rest/schemas/carts.d.ts +656 -0
- package/dist/interfaces/rest/schemas/carts.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/carts.js +38 -0
- package/dist/interfaces/rest/schemas/catalog.d.ts +1218 -1
- package/dist/interfaces/rest/schemas/catalog.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/catalog.js +48 -0
- package/dist/interfaces/rest/schemas/checkout.d.ts +2 -0
- package/dist/interfaces/rest/schemas/checkout.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/checkout.js +4 -0
- package/dist/interfaces/rest/schemas/customer-portal.d.ts +35 -0
- package/dist/interfaces/rest/schemas/customer-portal.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/documents.d.ts +509 -0
- package/dist/interfaces/rest/schemas/documents.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/documents.js +65 -0
- package/dist/interfaces/rest/schemas/orders.d.ts +3110 -43
- package/dist/interfaces/rest/schemas/orders.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/orders.js +233 -0
- package/dist/interfaces/rest/schemas/pricing.d.ts +405 -0
- package/dist/interfaces/rest/schemas/pricing.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/pricing.js +70 -0
- package/dist/interfaces/rest/schemas/responses.d.ts +156 -0
- package/dist/interfaces/rest/schemas/responses.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/search.d.ts +17 -0
- package/dist/interfaces/rest/schemas/search.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/settings.d.ts +397 -0
- package/dist/interfaces/rest/schemas/settings.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/settings.js +79 -0
- package/dist/interfaces/rest/schemas/shipping.d.ts +1093 -0
- package/dist/interfaces/rest/schemas/shipping.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/shipping.js +146 -0
- package/dist/interfaces/rest/schemas/tax.d.ts +1074 -0
- package/dist/interfaces/rest/schemas/tax.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/tax.js +132 -0
- package/dist/kernel/database/schema.d.ts +4 -0
- package/dist/kernel/database/schema.d.ts.map +1 -1
- package/dist/kernel/database/schema.js +8 -0
- package/dist/kernel/hooks/types.d.ts +1 -1
- package/dist/kernel/hooks/types.d.ts.map +1 -1
- package/dist/kernel/plugin/manifest.d.ts +23 -0
- package/dist/kernel/plugin/manifest.d.ts.map +1 -1
- package/dist/kernel/plugin/manifest.js +17 -2
- package/dist/modules/analytics/module.d.ts.map +1 -1
- package/dist/modules/analytics/module.js +6 -0
- package/dist/modules/analytics/reports.d.ts +58 -0
- package/dist/modules/analytics/reports.d.ts.map +1 -0
- package/dist/modules/analytics/reports.js +249 -0
- package/dist/modules/analytics/service.d.ts +10 -0
- package/dist/modules/analytics/service.d.ts.map +1 -1
- package/dist/modules/analytics/service.js +14 -0
- package/dist/modules/cart/repository/index.d.ts +7 -0
- package/dist/modules/cart/repository/index.d.ts.map +1 -1
- package/dist/modules/cart/repository/index.js +25 -1
- package/dist/modules/cart/schema.d.ts +17 -0
- package/dist/modules/cart/schema.d.ts.map +1 -1
- package/dist/modules/cart/schema.js +2 -0
- package/dist/modules/cart/schemas.d.ts +1 -0
- package/dist/modules/cart/schemas.d.ts.map +1 -1
- package/dist/modules/cart/schemas.js +1 -0
- package/dist/modules/cart/service.d.ts +32 -0
- package/dist/modules/cart/service.d.ts.map +1 -1
- package/dist/modules/cart/service.js +58 -0
- package/dist/modules/catalog/entity-service.d.ts +21 -0
- package/dist/modules/catalog/entity-service.d.ts.map +1 -1
- package/dist/modules/catalog/entity-service.js +132 -3
- package/dist/modules/catalog/schema.d.ts +34 -0
- package/dist/modules/catalog/schema.d.ts.map +1 -1
- package/dist/modules/catalog/schema.js +5 -0
- package/dist/modules/catalog/schemas.d.ts +3 -0
- package/dist/modules/catalog/schemas.d.ts.map +1 -1
- package/dist/modules/catalog/schemas.js +3 -0
- package/dist/modules/catalog/service.d.ts +36 -0
- package/dist/modules/catalog/service.d.ts.map +1 -1
- package/dist/modules/catalog/service.js +6 -0
- package/dist/modules/documents/module.d.ts +7 -0
- package/dist/modules/documents/module.d.ts.map +1 -0
- package/dist/modules/documents/module.js +12 -0
- package/dist/modules/documents/pdf.d.ts +25 -0
- package/dist/modules/documents/pdf.d.ts.map +1 -0
- package/dist/modules/documents/pdf.js +80 -0
- package/dist/modules/documents/render.d.ts +32 -0
- package/dist/modules/documents/render.d.ts.map +1 -0
- package/dist/modules/documents/render.js +190 -0
- package/dist/modules/documents/repository/index.d.ts +25 -0
- package/dist/modules/documents/repository/index.d.ts.map +1 -0
- package/dist/modules/documents/repository/index.js +47 -0
- package/dist/modules/documents/schema.d.ts +214 -0
- package/dist/modules/documents/schema.d.ts.map +1 -0
- package/dist/modules/documents/schema.js +42 -0
- package/dist/modules/documents/service.d.ts +51 -0
- package/dist/modules/documents/service.d.ts.map +1 -0
- package/dist/modules/documents/service.js +119 -0
- package/dist/modules/fulfillment/service.d.ts +18 -0
- package/dist/modules/fulfillment/service.d.ts.map +1 -1
- package/dist/modules/fulfillment/service.js +85 -1
- package/dist/modules/orders/repository/index.d.ts +18 -1
- package/dist/modules/orders/repository/index.d.ts.map +1 -1
- package/dist/modules/orders/repository/index.js +86 -1
- package/dist/modules/orders/schema.d.ts +374 -0
- package/dist/modules/orders/schema.d.ts.map +1 -1
- package/dist/modules/orders/schema.js +52 -1
- package/dist/modules/orders/service.d.ts +86 -1
- package/dist/modules/orders/service.d.ts.map +1 -1
- package/dist/modules/orders/service.js +447 -20
- package/dist/modules/pricing/repository/index.d.ts +5 -0
- package/dist/modules/pricing/repository/index.d.ts.map +1 -1
- package/dist/modules/pricing/repository/index.js +19 -0
- package/dist/modules/pricing/service.d.ts +18 -0
- package/dist/modules/pricing/service.d.ts.map +1 -1
- package/dist/modules/pricing/service.js +38 -0
- package/dist/modules/settings/module.d.ts +6 -0
- package/dist/modules/settings/module.d.ts.map +1 -0
- package/dist/modules/settings/module.js +11 -0
- package/dist/modules/settings/repository/index.d.ts +16 -0
- package/dist/modules/settings/repository/index.d.ts.map +1 -0
- package/dist/modules/settings/repository/index.js +41 -0
- package/dist/modules/settings/schema.d.ts +121 -0
- package/dist/modules/settings/schema.d.ts.map +1 -0
- package/dist/modules/settings/schema.js +24 -0
- package/dist/modules/settings/service.d.ts +26 -0
- package/dist/modules/settings/service.d.ts.map +1 -0
- package/dist/modules/settings/service.js +51 -0
- package/dist/modules/shipping/calculator.d.ts +5 -0
- package/dist/modules/shipping/calculator.d.ts.map +1 -1
- package/dist/modules/shipping/calculator.js +10 -0
- package/dist/modules/shipping/module.d.ts +5 -1
- package/dist/modules/shipping/module.d.ts.map +1 -1
- package/dist/modules/shipping/module.js +4 -1
- package/dist/modules/shipping/repository/index.d.ts +27 -2
- package/dist/modules/shipping/repository/index.d.ts.map +1 -1
- package/dist/modules/shipping/repository/index.js +105 -1
- package/dist/modules/shipping/schema.d.ts +419 -0
- package/dist/modules/shipping/schema.d.ts.map +1 -0
- package/dist/modules/shipping/schema.js +56 -0
- package/dist/modules/shipping/service.d.ts +54 -0
- package/dist/modules/shipping/service.d.ts.map +1 -1
- package/dist/modules/shipping/service.js +161 -2
- package/dist/modules/tax/adapter.d.ts +13 -0
- package/dist/modules/tax/adapter.d.ts.map +1 -1
- package/dist/modules/tax/module.d.ts +5 -1
- package/dist/modules/tax/module.d.ts.map +1 -1
- package/dist/modules/tax/module.js +4 -1
- package/dist/modules/tax/repository/index.d.ts +38 -2
- package/dist/modules/tax/repository/index.d.ts.map +1 -1
- package/dist/modules/tax/repository/index.js +138 -1
- package/dist/modules/tax/schema.d.ts +355 -0
- package/dist/modules/tax/schema.d.ts.map +1 -0
- package/dist/modules/tax/schema.js +55 -0
- package/dist/modules/tax/service.d.ts +60 -1
- package/dist/modules/tax/service.d.ts.map +1 -1
- package/dist/modules/tax/service.js +227 -2
- package/dist/runtime/kernel-modules.d.ts +15 -2
- package/dist/runtime/kernel-modules.d.ts.map +1 -1
- package/dist/runtime/kernel-modules.js +4 -0
- package/dist/runtime/kernel-types.d.ts +5 -1
- package/dist/runtime/kernel-types.d.ts.map +1 -1
- package/dist/runtime/kernel-types.js +2 -0
- package/dist/runtime/server.js +1 -1
- package/dist/test-utils/create-plugin-test-app.d.ts +3 -0
- package/dist/test-utils/create-plugin-test-app.d.ts.map +1 -1
- package/dist/test-utils/create-plugin-test-app.js +15 -3
- package/dist/test-utils/rest-api-test-utils.d.ts.map +1 -1
- package/dist/test-utils/rest-api-test-utils.js +6 -0
- package/package.json +3 -3
- package/src/auth/setup.ts +1 -0
- package/src/config/defaults.ts +5 -0
- package/src/config/types.ts +17 -1
- package/src/generated/plugin-capabilities.d.ts +1 -0
- package/src/generated/plugin-manifest.ts +1 -0
- package/src/generated/plugin-repositories.d.ts +1 -0
- package/src/hooks/checkout.ts +25 -3
- package/src/index.ts +1 -0
- package/src/interfaces/rest/index.ts +12 -0
- package/src/interfaces/rest/routes/admin/staff.ts +218 -0
- package/src/interfaces/rest/routes/analytics.ts +33 -0
- package/src/interfaces/rest/routes/carts.ts +52 -2
- package/src/interfaces/rest/routes/catalog.ts +34 -0
- package/src/interfaces/rest/routes/checkout.ts +22 -0
- package/src/interfaces/rest/routes/documents.ts +61 -0
- package/src/interfaces/rest/routes/orders.ts +137 -1
- package/src/interfaces/rest/routes/pricing.ts +44 -1
- package/src/interfaces/rest/routes/settings.ts +61 -0
- package/src/interfaces/rest/routes/shipping.ts +92 -0
- package/src/interfaces/rest/routes/tax.ts +90 -0
- package/src/interfaces/rest/schemas/admin-staff.ts +110 -0
- package/src/interfaces/rest/schemas/analytics.ts +39 -0
- package/src/interfaces/rest/schemas/carts.ts +40 -0
- package/src/interfaces/rest/schemas/catalog.ts +53 -0
- package/src/interfaces/rest/schemas/checkout.ts +4 -0
- package/src/interfaces/rest/schemas/documents.ts +72 -0
- package/src/interfaces/rest/schemas/orders.ts +257 -0
- package/src/interfaces/rest/schemas/pricing.ts +75 -0
- package/src/interfaces/rest/schemas/settings.ts +93 -0
- package/src/interfaces/rest/schemas/shipping.ts +164 -0
- package/src/interfaces/rest/schemas/tax.ts +148 -0
- package/src/kernel/database/schema.ts +12 -0
- package/src/kernel/hooks/types.ts +1 -0
- package/src/kernel/plugin/manifest.ts +38 -2
- package/src/modules/analytics/module.ts +10 -0
- package/src/modules/analytics/reports.ts +311 -0
- package/src/modules/analytics/service.ts +23 -0
- package/src/modules/cart/repository/index.ts +30 -1
- package/src/modules/cart/schema.ts +2 -0
- package/src/modules/cart/schemas.ts +1 -0
- package/src/modules/cart/service.ts +101 -0
- package/src/modules/catalog/entity-service.ts +168 -3
- package/src/modules/catalog/schema.ts +5 -0
- package/src/modules/catalog/schemas.ts +3 -0
- package/src/modules/catalog/service.ts +30 -0
- package/src/modules/documents/module.ts +19 -0
- package/src/modules/documents/pdf.ts +101 -0
- package/src/modules/documents/render.ts +231 -0
- package/src/modules/documents/repository/index.ts +68 -0
- package/src/modules/documents/schema.ts +44 -0
- package/src/modules/documents/service.ts +176 -0
- package/src/modules/fulfillment/service.ts +139 -1
- package/src/modules/orders/repository/index.ts +127 -1
- package/src/modules/orders/schema.ts +54 -1
- package/src/modules/orders/service.ts +654 -22
- package/src/modules/pricing/repository/index.ts +34 -0
- package/src/modules/pricing/service.ts +71 -0
- package/src/modules/settings/module.ts +18 -0
- package/src/modules/settings/repository/index.ts +59 -0
- package/src/modules/settings/schema.ts +25 -0
- package/src/modules/settings/service.ts +82 -0
- package/src/modules/shipping/calculator.ts +27 -0
- package/src/modules/shipping/module.ts +6 -2
- package/src/modules/shipping/repository/index.ts +136 -2
- package/src/modules/shipping/schema.ts +58 -0
- package/src/modules/shipping/service.ts +260 -1
- package/src/modules/tax/adapter.ts +9 -0
- package/src/modules/tax/module.ts +6 -2
- package/src/modules/tax/repository/index.ts +169 -2
- package/src/modules/tax/schema.ts +57 -0
- package/src/modules/tax/service.ts +313 -2
- package/src/runtime/kernel-modules.ts +4 -0
- package/src/runtime/kernel-types.ts +6 -0
- package/src/runtime/server.ts +1 -1
- package/src/test-utils/create-plugin-test-app.ts +17 -4
- package/src/test-utils/rest-api-test-utils.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-staff.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/rest/schemas/admin-staff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAGnD,eAAO,MAAM,qBAAqB;;;iBAGF,CAAC;AAEjC,eAAO,MAAM,qBAAqB;;;iBAGF,CAAC;AAEjC,eAAO,MAAM,yBAAyB;;iBAEF,CAAC;AAQrC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASzB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAY3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAY3B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASpC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAU3B,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
+
import { errorResponses } from "./shared.js";
|
|
3
|
+
export const CreateStaffBodySchema = z.object({
|
|
4
|
+
userId: z.string().min(1).openapi({ example: "user_abc123", description: "Better Auth user id of an existing user" }),
|
|
5
|
+
role: z.string().min(1).openapi({ example: "manager" }),
|
|
6
|
+
}).openapi("CreateStaffRequest");
|
|
7
|
+
export const InviteStaffBodySchema = z.object({
|
|
8
|
+
email: z.email().openapi({ example: "newhire@example.com" }),
|
|
9
|
+
role: z.string().min(1).openapi({ example: "manager" }),
|
|
10
|
+
}).openapi("InviteStaffRequest");
|
|
11
|
+
export const UpdateStaffRoleBodySchema = z.object({
|
|
12
|
+
role: z.string().min(1).openapi({ example: "admin" }),
|
|
13
|
+
}).openapi("UpdateStaffRoleRequest");
|
|
14
|
+
const MemberIdParam = z.object({
|
|
15
|
+
id: z.string().min(1).openapi({ example: "mem_abc123" }),
|
|
16
|
+
});
|
|
17
|
+
const DataResponse = z.object({ data: z.any() }).openapi("AdminStaffResponse");
|
|
18
|
+
export const listStaffRoute = createRoute({
|
|
19
|
+
method: "get",
|
|
20
|
+
path: "/staff",
|
|
21
|
+
tags: ["Admin"],
|
|
22
|
+
summary: "List staff members with their roles",
|
|
23
|
+
responses: {
|
|
24
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Staff members" },
|
|
25
|
+
...errorResponses,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export const createStaffRoute = createRoute({
|
|
29
|
+
method: "post",
|
|
30
|
+
path: "/staff",
|
|
31
|
+
tags: ["Admin"],
|
|
32
|
+
summary: "Add an existing user as a staff member with a role",
|
|
33
|
+
request: {
|
|
34
|
+
body: { content: { "application/json": { schema: CreateStaffBodySchema } }, required: true },
|
|
35
|
+
},
|
|
36
|
+
responses: {
|
|
37
|
+
201: { content: { "application/json": { schema: DataResponse } }, description: "Staff member created." },
|
|
38
|
+
...errorResponses,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
export const inviteStaffRoute = createRoute({
|
|
42
|
+
method: "post",
|
|
43
|
+
path: "/staff/invitations",
|
|
44
|
+
tags: ["Admin"],
|
|
45
|
+
summary: "Invite a teammate by email with a role",
|
|
46
|
+
request: {
|
|
47
|
+
body: { content: { "application/json": { schema: InviteStaffBodySchema } }, required: true },
|
|
48
|
+
},
|
|
49
|
+
responses: {
|
|
50
|
+
201: { content: { "application/json": { schema: DataResponse } }, description: "Invitation created." },
|
|
51
|
+
...errorResponses,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
export const listStaffInvitationsRoute = createRoute({
|
|
55
|
+
method: "get",
|
|
56
|
+
path: "/staff/invitations",
|
|
57
|
+
tags: ["Admin"],
|
|
58
|
+
summary: "List pending staff invitations",
|
|
59
|
+
responses: {
|
|
60
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Invitations" },
|
|
61
|
+
...errorResponses,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
export const listStaffRolesRoute = createRoute({
|
|
65
|
+
method: "get",
|
|
66
|
+
path: "/staff/roles",
|
|
67
|
+
tags: ["Admin"],
|
|
68
|
+
summary: "Role → permission mapping staff roles resolve to",
|
|
69
|
+
responses: {
|
|
70
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Roles" },
|
|
71
|
+
...errorResponses,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
export const updateStaffRoleRoute = createRoute({
|
|
75
|
+
method: "patch",
|
|
76
|
+
path: "/staff/{id}",
|
|
77
|
+
tags: ["Admin"],
|
|
78
|
+
summary: "Change a staff member's role",
|
|
79
|
+
request: {
|
|
80
|
+
params: MemberIdParam,
|
|
81
|
+
body: { content: { "application/json": { schema: UpdateStaffRoleBodySchema } }, required: true },
|
|
82
|
+
},
|
|
83
|
+
responses: {
|
|
84
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Role updated." },
|
|
85
|
+
...errorResponses,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
export const revokeStaffRoute = createRoute({
|
|
89
|
+
method: "delete",
|
|
90
|
+
path: "/staff/{id}",
|
|
91
|
+
tags: ["Admin"],
|
|
92
|
+
summary: "Revoke a staff member's membership",
|
|
93
|
+
request: { params: MemberIdParam },
|
|
94
|
+
responses: {
|
|
95
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Membership revoked." },
|
|
96
|
+
...errorResponses,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const listReportsRoute: {
|
|
3
|
+
method: "get";
|
|
4
|
+
path: "/reports";
|
|
5
|
+
tags: string[];
|
|
6
|
+
summary: string;
|
|
7
|
+
responses: {
|
|
8
|
+
400: {
|
|
9
|
+
readonly content: {
|
|
10
|
+
readonly "application/json": {
|
|
11
|
+
readonly schema: z.ZodObject<{
|
|
12
|
+
error: z.ZodObject<{
|
|
13
|
+
code: z.ZodString;
|
|
14
|
+
message: z.ZodString;
|
|
15
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
+
path: z.ZodString;
|
|
18
|
+
message: z.ZodString;
|
|
19
|
+
code: z.ZodString;
|
|
20
|
+
}, z.core.$strip>>>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly description: "Business logic error.";
|
|
27
|
+
};
|
|
28
|
+
401: {
|
|
29
|
+
readonly content: {
|
|
30
|
+
readonly "application/json": {
|
|
31
|
+
readonly schema: z.ZodObject<{
|
|
32
|
+
error: z.ZodObject<{
|
|
33
|
+
code: z.ZodString;
|
|
34
|
+
message: z.ZodString;
|
|
35
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
|
+
path: z.ZodString;
|
|
38
|
+
message: z.ZodString;
|
|
39
|
+
code: z.ZodString;
|
|
40
|
+
}, z.core.$strip>>>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly description: "Authentication required.";
|
|
47
|
+
};
|
|
48
|
+
403: {
|
|
49
|
+
readonly content: {
|
|
50
|
+
readonly "application/json": {
|
|
51
|
+
readonly schema: z.ZodObject<{
|
|
52
|
+
error: z.ZodObject<{
|
|
53
|
+
code: z.ZodString;
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
path: z.ZodString;
|
|
58
|
+
message: z.ZodString;
|
|
59
|
+
code: z.ZodString;
|
|
60
|
+
}, z.core.$strip>>>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly description: "Insufficient permissions.";
|
|
67
|
+
};
|
|
68
|
+
404: {
|
|
69
|
+
readonly content: {
|
|
70
|
+
readonly "application/json": {
|
|
71
|
+
readonly schema: z.ZodObject<{
|
|
72
|
+
error: z.ZodObject<{
|
|
73
|
+
code: z.ZodString;
|
|
74
|
+
message: z.ZodString;
|
|
75
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
+
path: z.ZodString;
|
|
78
|
+
message: z.ZodString;
|
|
79
|
+
code: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>>;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
readonly description: "Resource not found.";
|
|
87
|
+
};
|
|
88
|
+
422: {
|
|
89
|
+
readonly content: {
|
|
90
|
+
readonly "application/json": {
|
|
91
|
+
readonly schema: z.ZodObject<{
|
|
92
|
+
error: z.ZodObject<{
|
|
93
|
+
code: z.ZodString;
|
|
94
|
+
message: z.ZodString;
|
|
95
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
97
|
+
path: z.ZodString;
|
|
98
|
+
message: z.ZodString;
|
|
99
|
+
code: z.ZodString;
|
|
100
|
+
}, z.core.$strip>>>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
readonly description: "Validation error.";
|
|
107
|
+
};
|
|
108
|
+
200: {
|
|
109
|
+
content: {
|
|
110
|
+
"application/json": {
|
|
111
|
+
schema: z.ZodObject<{
|
|
112
|
+
data: z.ZodAny;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
description: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
} & {
|
|
120
|
+
getRoutingPath(): "/reports";
|
|
121
|
+
};
|
|
122
|
+
export declare const getReportRoute: {
|
|
123
|
+
method: "get";
|
|
124
|
+
path: "/reports/{name}";
|
|
125
|
+
tags: string[];
|
|
126
|
+
summary: string;
|
|
127
|
+
request: {
|
|
128
|
+
params: z.ZodObject<{
|
|
129
|
+
name: z.ZodString;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
query: z.ZodObject<{
|
|
132
|
+
date: z.ZodOptional<z.ZodString>;
|
|
133
|
+
from: z.ZodOptional<z.ZodString>;
|
|
134
|
+
to: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
};
|
|
137
|
+
responses: {
|
|
138
|
+
400: {
|
|
139
|
+
readonly content: {
|
|
140
|
+
readonly "application/json": {
|
|
141
|
+
readonly schema: z.ZodObject<{
|
|
142
|
+
error: z.ZodObject<{
|
|
143
|
+
code: z.ZodString;
|
|
144
|
+
message: z.ZodString;
|
|
145
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
147
|
+
path: z.ZodString;
|
|
148
|
+
message: z.ZodString;
|
|
149
|
+
code: z.ZodString;
|
|
150
|
+
}, z.core.$strip>>>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
readonly description: "Business logic error.";
|
|
157
|
+
};
|
|
158
|
+
401: {
|
|
159
|
+
readonly content: {
|
|
160
|
+
readonly "application/json": {
|
|
161
|
+
readonly schema: z.ZodObject<{
|
|
162
|
+
error: z.ZodObject<{
|
|
163
|
+
code: z.ZodString;
|
|
164
|
+
message: z.ZodString;
|
|
165
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
167
|
+
path: z.ZodString;
|
|
168
|
+
message: z.ZodString;
|
|
169
|
+
code: z.ZodString;
|
|
170
|
+
}, z.core.$strip>>>;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
}, z.core.$strip>;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
readonly description: "Authentication required.";
|
|
177
|
+
};
|
|
178
|
+
403: {
|
|
179
|
+
readonly content: {
|
|
180
|
+
readonly "application/json": {
|
|
181
|
+
readonly schema: z.ZodObject<{
|
|
182
|
+
error: z.ZodObject<{
|
|
183
|
+
code: z.ZodString;
|
|
184
|
+
message: z.ZodString;
|
|
185
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
187
|
+
path: z.ZodString;
|
|
188
|
+
message: z.ZodString;
|
|
189
|
+
code: z.ZodString;
|
|
190
|
+
}, z.core.$strip>>>;
|
|
191
|
+
}, z.core.$strip>>;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
readonly description: "Insufficient permissions.";
|
|
197
|
+
};
|
|
198
|
+
404: {
|
|
199
|
+
readonly content: {
|
|
200
|
+
readonly "application/json": {
|
|
201
|
+
readonly schema: z.ZodObject<{
|
|
202
|
+
error: z.ZodObject<{
|
|
203
|
+
code: z.ZodString;
|
|
204
|
+
message: z.ZodString;
|
|
205
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
206
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
207
|
+
path: z.ZodString;
|
|
208
|
+
message: z.ZodString;
|
|
209
|
+
code: z.ZodString;
|
|
210
|
+
}, z.core.$strip>>>;
|
|
211
|
+
}, z.core.$strip>>;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
readonly description: "Resource not found.";
|
|
217
|
+
};
|
|
218
|
+
422: {
|
|
219
|
+
readonly content: {
|
|
220
|
+
readonly "application/json": {
|
|
221
|
+
readonly schema: z.ZodObject<{
|
|
222
|
+
error: z.ZodObject<{
|
|
223
|
+
code: z.ZodString;
|
|
224
|
+
message: z.ZodString;
|
|
225
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
226
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
227
|
+
path: z.ZodString;
|
|
228
|
+
message: z.ZodString;
|
|
229
|
+
code: z.ZodString;
|
|
230
|
+
}, z.core.$strip>>>;
|
|
231
|
+
}, z.core.$strip>>;
|
|
232
|
+
}, z.core.$strip>;
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
readonly description: "Validation error.";
|
|
237
|
+
};
|
|
238
|
+
200: {
|
|
239
|
+
content: {
|
|
240
|
+
"application/json": {
|
|
241
|
+
schema: z.ZodObject<{
|
|
242
|
+
data: z.ZodAny;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
description: string;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
} & {
|
|
250
|
+
getRoutingPath(): "/reports/:name";
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/rest/schemas/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAiBnD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS3B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUzB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
+
import { errorResponses } from "./shared.js";
|
|
3
|
+
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
4
|
+
const ReportParamsSchema = z.object({
|
|
5
|
+
name: z.string().regex(/^[a-z][a-z0-9-]*$/).openapi({ example: "daily-journal" }),
|
|
6
|
+
});
|
|
7
|
+
const ReportQuerySchema = z.object({
|
|
8
|
+
date: z.string().regex(DATE).optional().openapi({ description: "Local calendar date (single-day reports)." }),
|
|
9
|
+
from: z.string().regex(DATE).optional().openapi({ description: "Local range start, inclusive." }),
|
|
10
|
+
to: z.string().regex(DATE).optional().openapi({ description: "Local range end, inclusive." }),
|
|
11
|
+
});
|
|
12
|
+
const DataResponse = z.object({ data: z.any() }).openapi("AnalyticsReportResponse");
|
|
13
|
+
export const listReportsRoute = createRoute({
|
|
14
|
+
method: "get",
|
|
15
|
+
path: "/reports",
|
|
16
|
+
tags: ["Analytics"],
|
|
17
|
+
summary: "List the canned retail reports",
|
|
18
|
+
responses: {
|
|
19
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Available reports." },
|
|
20
|
+
...errorResponses,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const getReportRoute = createRoute({
|
|
24
|
+
method: "get",
|
|
25
|
+
path: "/reports/{name}",
|
|
26
|
+
tags: ["Analytics"],
|
|
27
|
+
summary: "Run a canned retail report (calendar math in the store's timezone)",
|
|
28
|
+
request: { params: ReportParamsSchema, query: ReportQuerySchema },
|
|
29
|
+
responses: {
|
|
30
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Report result." },
|
|
31
|
+
...errorResponses,
|
|
32
|
+
},
|
|
33
|
+
});
|