@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,397 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const GeneralSettingsPatchSchema: z.ZodObject<{
|
|
3
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4
|
+
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5
|
+
locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export declare const BrandingSettingsPatchSchema: z.ZodObject<{
|
|
8
|
+
storeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
receiptHeader: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
receiptFooter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
logoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
taxId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export declare const PoliciesSettingsPatchSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
18
|
+
export declare const KNOWN_GROUP_SCHEMAS: Record<string, z.ZodTypeAny>;
|
|
19
|
+
export declare const getAllSettingsRoute: {
|
|
20
|
+
method: "get";
|
|
21
|
+
path: "/";
|
|
22
|
+
tags: string[];
|
|
23
|
+
summary: string;
|
|
24
|
+
responses: {
|
|
25
|
+
400: {
|
|
26
|
+
readonly content: {
|
|
27
|
+
readonly "application/json": {
|
|
28
|
+
readonly schema: z.ZodObject<{
|
|
29
|
+
error: z.ZodObject<{
|
|
30
|
+
code: z.ZodString;
|
|
31
|
+
message: z.ZodString;
|
|
32
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
+
path: z.ZodString;
|
|
35
|
+
message: z.ZodString;
|
|
36
|
+
code: z.ZodString;
|
|
37
|
+
}, z.core.$strip>>>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly description: "Business logic error.";
|
|
44
|
+
};
|
|
45
|
+
401: {
|
|
46
|
+
readonly content: {
|
|
47
|
+
readonly "application/json": {
|
|
48
|
+
readonly schema: z.ZodObject<{
|
|
49
|
+
error: z.ZodObject<{
|
|
50
|
+
code: z.ZodString;
|
|
51
|
+
message: z.ZodString;
|
|
52
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
path: z.ZodString;
|
|
55
|
+
message: z.ZodString;
|
|
56
|
+
code: z.ZodString;
|
|
57
|
+
}, z.core.$strip>>>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
readonly description: "Authentication required.";
|
|
64
|
+
};
|
|
65
|
+
403: {
|
|
66
|
+
readonly content: {
|
|
67
|
+
readonly "application/json": {
|
|
68
|
+
readonly schema: z.ZodObject<{
|
|
69
|
+
error: z.ZodObject<{
|
|
70
|
+
code: z.ZodString;
|
|
71
|
+
message: z.ZodString;
|
|
72
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
73
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
|
+
path: z.ZodString;
|
|
75
|
+
message: z.ZodString;
|
|
76
|
+
code: z.ZodString;
|
|
77
|
+
}, z.core.$strip>>>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
readonly description: "Insufficient permissions.";
|
|
84
|
+
};
|
|
85
|
+
404: {
|
|
86
|
+
readonly content: {
|
|
87
|
+
readonly "application/json": {
|
|
88
|
+
readonly schema: z.ZodObject<{
|
|
89
|
+
error: z.ZodObject<{
|
|
90
|
+
code: z.ZodString;
|
|
91
|
+
message: z.ZodString;
|
|
92
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
+
path: z.ZodString;
|
|
95
|
+
message: z.ZodString;
|
|
96
|
+
code: z.ZodString;
|
|
97
|
+
}, z.core.$strip>>>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
readonly description: "Resource not found.";
|
|
104
|
+
};
|
|
105
|
+
422: {
|
|
106
|
+
readonly content: {
|
|
107
|
+
readonly "application/json": {
|
|
108
|
+
readonly schema: z.ZodObject<{
|
|
109
|
+
error: z.ZodObject<{
|
|
110
|
+
code: z.ZodString;
|
|
111
|
+
message: z.ZodString;
|
|
112
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
114
|
+
path: z.ZodString;
|
|
115
|
+
message: z.ZodString;
|
|
116
|
+
code: z.ZodString;
|
|
117
|
+
}, z.core.$strip>>>;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
readonly description: "Validation error.";
|
|
124
|
+
};
|
|
125
|
+
200: {
|
|
126
|
+
content: {
|
|
127
|
+
"application/json": {
|
|
128
|
+
schema: z.ZodObject<{
|
|
129
|
+
data: z.ZodAny;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
description: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
} & {
|
|
137
|
+
getRoutingPath(): "/";
|
|
138
|
+
};
|
|
139
|
+
export declare const getSettingsGroupRoute: {
|
|
140
|
+
method: "get";
|
|
141
|
+
path: "/{group}";
|
|
142
|
+
tags: string[];
|
|
143
|
+
summary: string;
|
|
144
|
+
request: {
|
|
145
|
+
params: z.ZodObject<{
|
|
146
|
+
group: z.ZodString;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
};
|
|
149
|
+
responses: {
|
|
150
|
+
400: {
|
|
151
|
+
readonly content: {
|
|
152
|
+
readonly "application/json": {
|
|
153
|
+
readonly schema: z.ZodObject<{
|
|
154
|
+
error: z.ZodObject<{
|
|
155
|
+
code: z.ZodString;
|
|
156
|
+
message: z.ZodString;
|
|
157
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
159
|
+
path: z.ZodString;
|
|
160
|
+
message: z.ZodString;
|
|
161
|
+
code: z.ZodString;
|
|
162
|
+
}, z.core.$strip>>>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
readonly description: "Business logic error.";
|
|
169
|
+
};
|
|
170
|
+
401: {
|
|
171
|
+
readonly content: {
|
|
172
|
+
readonly "application/json": {
|
|
173
|
+
readonly schema: z.ZodObject<{
|
|
174
|
+
error: z.ZodObject<{
|
|
175
|
+
code: z.ZodString;
|
|
176
|
+
message: z.ZodString;
|
|
177
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
179
|
+
path: z.ZodString;
|
|
180
|
+
message: z.ZodString;
|
|
181
|
+
code: z.ZodString;
|
|
182
|
+
}, z.core.$strip>>>;
|
|
183
|
+
}, z.core.$strip>>;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
readonly description: "Authentication required.";
|
|
189
|
+
};
|
|
190
|
+
403: {
|
|
191
|
+
readonly content: {
|
|
192
|
+
readonly "application/json": {
|
|
193
|
+
readonly schema: z.ZodObject<{
|
|
194
|
+
error: z.ZodObject<{
|
|
195
|
+
code: z.ZodString;
|
|
196
|
+
message: z.ZodString;
|
|
197
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
199
|
+
path: z.ZodString;
|
|
200
|
+
message: z.ZodString;
|
|
201
|
+
code: z.ZodString;
|
|
202
|
+
}, z.core.$strip>>>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
readonly description: "Insufficient permissions.";
|
|
209
|
+
};
|
|
210
|
+
404: {
|
|
211
|
+
readonly content: {
|
|
212
|
+
readonly "application/json": {
|
|
213
|
+
readonly schema: z.ZodObject<{
|
|
214
|
+
error: z.ZodObject<{
|
|
215
|
+
code: z.ZodString;
|
|
216
|
+
message: z.ZodString;
|
|
217
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
219
|
+
path: z.ZodString;
|
|
220
|
+
message: z.ZodString;
|
|
221
|
+
code: z.ZodString;
|
|
222
|
+
}, z.core.$strip>>>;
|
|
223
|
+
}, z.core.$strip>>;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
}, z.core.$strip>;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
readonly description: "Resource not found.";
|
|
229
|
+
};
|
|
230
|
+
422: {
|
|
231
|
+
readonly content: {
|
|
232
|
+
readonly "application/json": {
|
|
233
|
+
readonly schema: z.ZodObject<{
|
|
234
|
+
error: z.ZodObject<{
|
|
235
|
+
code: z.ZodString;
|
|
236
|
+
message: z.ZodString;
|
|
237
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
238
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
239
|
+
path: z.ZodString;
|
|
240
|
+
message: z.ZodString;
|
|
241
|
+
code: z.ZodString;
|
|
242
|
+
}, z.core.$strip>>>;
|
|
243
|
+
}, z.core.$strip>>;
|
|
244
|
+
}, z.core.$strip>;
|
|
245
|
+
}, z.core.$strip>;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
readonly description: "Validation error.";
|
|
249
|
+
};
|
|
250
|
+
200: {
|
|
251
|
+
content: {
|
|
252
|
+
"application/json": {
|
|
253
|
+
schema: z.ZodObject<{
|
|
254
|
+
data: z.ZodAny;
|
|
255
|
+
}, z.core.$strip>;
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
description: string;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
} & {
|
|
262
|
+
getRoutingPath(): "/:group";
|
|
263
|
+
};
|
|
264
|
+
export declare const patchSettingsGroupRoute: {
|
|
265
|
+
method: "patch";
|
|
266
|
+
path: "/{group}";
|
|
267
|
+
tags: string[];
|
|
268
|
+
summary: string;
|
|
269
|
+
request: {
|
|
270
|
+
params: z.ZodObject<{
|
|
271
|
+
group: z.ZodString;
|
|
272
|
+
}, z.core.$strip>;
|
|
273
|
+
body: {
|
|
274
|
+
content: {
|
|
275
|
+
"application/json": {
|
|
276
|
+
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
required: true;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
responses: {
|
|
283
|
+
400: {
|
|
284
|
+
readonly content: {
|
|
285
|
+
readonly "application/json": {
|
|
286
|
+
readonly schema: z.ZodObject<{
|
|
287
|
+
error: z.ZodObject<{
|
|
288
|
+
code: z.ZodString;
|
|
289
|
+
message: z.ZodString;
|
|
290
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
291
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
292
|
+
path: z.ZodString;
|
|
293
|
+
message: z.ZodString;
|
|
294
|
+
code: z.ZodString;
|
|
295
|
+
}, z.core.$strip>>>;
|
|
296
|
+
}, z.core.$strip>>;
|
|
297
|
+
}, z.core.$strip>;
|
|
298
|
+
}, z.core.$strip>;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
readonly description: "Business logic error.";
|
|
302
|
+
};
|
|
303
|
+
401: {
|
|
304
|
+
readonly content: {
|
|
305
|
+
readonly "application/json": {
|
|
306
|
+
readonly schema: z.ZodObject<{
|
|
307
|
+
error: z.ZodObject<{
|
|
308
|
+
code: z.ZodString;
|
|
309
|
+
message: z.ZodString;
|
|
310
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
311
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
312
|
+
path: z.ZodString;
|
|
313
|
+
message: z.ZodString;
|
|
314
|
+
code: z.ZodString;
|
|
315
|
+
}, z.core.$strip>>>;
|
|
316
|
+
}, z.core.$strip>>;
|
|
317
|
+
}, z.core.$strip>;
|
|
318
|
+
}, z.core.$strip>;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
readonly description: "Authentication required.";
|
|
322
|
+
};
|
|
323
|
+
403: {
|
|
324
|
+
readonly content: {
|
|
325
|
+
readonly "application/json": {
|
|
326
|
+
readonly schema: z.ZodObject<{
|
|
327
|
+
error: z.ZodObject<{
|
|
328
|
+
code: z.ZodString;
|
|
329
|
+
message: z.ZodString;
|
|
330
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
331
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
332
|
+
path: z.ZodString;
|
|
333
|
+
message: z.ZodString;
|
|
334
|
+
code: z.ZodString;
|
|
335
|
+
}, z.core.$strip>>>;
|
|
336
|
+
}, z.core.$strip>>;
|
|
337
|
+
}, z.core.$strip>;
|
|
338
|
+
}, z.core.$strip>;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
readonly description: "Insufficient permissions.";
|
|
342
|
+
};
|
|
343
|
+
404: {
|
|
344
|
+
readonly content: {
|
|
345
|
+
readonly "application/json": {
|
|
346
|
+
readonly schema: z.ZodObject<{
|
|
347
|
+
error: z.ZodObject<{
|
|
348
|
+
code: z.ZodString;
|
|
349
|
+
message: z.ZodString;
|
|
350
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
351
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
352
|
+
path: z.ZodString;
|
|
353
|
+
message: z.ZodString;
|
|
354
|
+
code: z.ZodString;
|
|
355
|
+
}, z.core.$strip>>>;
|
|
356
|
+
}, z.core.$strip>>;
|
|
357
|
+
}, z.core.$strip>;
|
|
358
|
+
}, z.core.$strip>;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
readonly description: "Resource not found.";
|
|
362
|
+
};
|
|
363
|
+
422: {
|
|
364
|
+
readonly content: {
|
|
365
|
+
readonly "application/json": {
|
|
366
|
+
readonly schema: z.ZodObject<{
|
|
367
|
+
error: z.ZodObject<{
|
|
368
|
+
code: z.ZodString;
|
|
369
|
+
message: z.ZodString;
|
|
370
|
+
details: z.ZodOptional<z.ZodObject<{
|
|
371
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
372
|
+
path: z.ZodString;
|
|
373
|
+
message: z.ZodString;
|
|
374
|
+
code: z.ZodString;
|
|
375
|
+
}, z.core.$strip>>>;
|
|
376
|
+
}, z.core.$strip>>;
|
|
377
|
+
}, z.core.$strip>;
|
|
378
|
+
}, z.core.$strip>;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
readonly description: "Validation error.";
|
|
382
|
+
};
|
|
383
|
+
200: {
|
|
384
|
+
content: {
|
|
385
|
+
"application/json": {
|
|
386
|
+
schema: z.ZodObject<{
|
|
387
|
+
data: z.ZodAny;
|
|
388
|
+
}, z.core.$strip>;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
description: string;
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
} & {
|
|
395
|
+
getRoutingPath(): "/:group";
|
|
396
|
+
};
|
|
397
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/rest/schemas/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAenD,eAAO,MAAM,0BAA0B;;;;kBAI5B,CAAC;AAEZ,eAAO,MAAM,2BAA2B;;;;;;;;;kBAS7B,CAAC;AAEZ,eAAO,MAAM,2BAA2B,oGAGvC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAI5D,CAAC;AAeF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUhC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAalC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
+
import { errorResponses } from "./shared.js";
|
|
3
|
+
function isValidTimezone(tz) {
|
|
4
|
+
try {
|
|
5
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
// Known typed groups. Every field is optional (PATCH is a partial merge) and
|
|
13
|
+
// nullable (null deletes the key). Unknown groups accept any flat JSON object
|
|
14
|
+
// so plugins can namespace their own settings.
|
|
15
|
+
export const GeneralSettingsPatchSchema = z.object({
|
|
16
|
+
currency: z.string().regex(/^[A-Z]{3}$/, "ISO 4217 uppercase code").nullable().optional(),
|
|
17
|
+
timezone: z.string().refine(isValidTimezone, "Must be a valid IANA timezone (e.g. Asia/Colombo)").nullable().optional(),
|
|
18
|
+
locale: z.string().min(2).nullable().optional(),
|
|
19
|
+
}).strict();
|
|
20
|
+
export const BrandingSettingsPatchSchema = z.object({
|
|
21
|
+
storeName: z.string().nullable().optional(),
|
|
22
|
+
receiptHeader: z.string().nullable().optional(),
|
|
23
|
+
receiptFooter: z.string().nullable().optional(),
|
|
24
|
+
logoUrl: z.string().nullable().optional(),
|
|
25
|
+
address: z.string().nullable().optional(),
|
|
26
|
+
phone: z.string().nullable().optional(),
|
|
27
|
+
email: z.string().nullable().optional(),
|
|
28
|
+
taxId: z.string().nullable().optional(),
|
|
29
|
+
}).strict();
|
|
30
|
+
export const PoliciesSettingsPatchSchema = z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()]));
|
|
31
|
+
export const KNOWN_GROUP_SCHEMAS = {
|
|
32
|
+
general: GeneralSettingsPatchSchema,
|
|
33
|
+
branding: BrandingSettingsPatchSchema,
|
|
34
|
+
policies: PoliciesSettingsPatchSchema,
|
|
35
|
+
};
|
|
36
|
+
const GroupParam = z.object({
|
|
37
|
+
group: z.string().regex(/^[a-z][a-z0-9_-]*$/).openapi({ example: "branding" }),
|
|
38
|
+
});
|
|
39
|
+
const SettingsPatchBodySchema = z
|
|
40
|
+
.record(z.string(), z.unknown())
|
|
41
|
+
.openapi("SettingsPatchRequest", {
|
|
42
|
+
description: "Shallow merge into the group: keys overwrite, null deletes a key. Known groups (general, branding, policies) are validated.",
|
|
43
|
+
});
|
|
44
|
+
const DataResponse = z.object({ data: z.any() }).openapi("SettingsResponse");
|
|
45
|
+
export const getAllSettingsRoute = createRoute({
|
|
46
|
+
method: "get",
|
|
47
|
+
path: "/",
|
|
48
|
+
tags: ["Settings"],
|
|
49
|
+
summary: "Get all settings groups for the organization",
|
|
50
|
+
responses: {
|
|
51
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "All settings groups" },
|
|
52
|
+
...errorResponses,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
export const getSettingsGroupRoute = createRoute({
|
|
56
|
+
method: "get",
|
|
57
|
+
path: "/{group}",
|
|
58
|
+
tags: ["Settings"],
|
|
59
|
+
summary: "Get one settings group",
|
|
60
|
+
request: { params: GroupParam },
|
|
61
|
+
responses: {
|
|
62
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "Settings group (empty object if unset)" },
|
|
63
|
+
...errorResponses,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export const patchSettingsGroupRoute = createRoute({
|
|
67
|
+
method: "patch",
|
|
68
|
+
path: "/{group}",
|
|
69
|
+
tags: ["Settings"],
|
|
70
|
+
summary: "Merge values into a settings group",
|
|
71
|
+
request: {
|
|
72
|
+
params: GroupParam,
|
|
73
|
+
body: { content: { "application/json": { schema: SettingsPatchBodySchema } }, required: true },
|
|
74
|
+
},
|
|
75
|
+
responses: {
|
|
76
|
+
200: { content: { "application/json": { schema: DataResponse } }, description: "The merged group value" },
|
|
77
|
+
...errorResponses,
|
|
78
|
+
},
|
|
79
|
+
});
|