@porulle/core 0.6.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.
Files changed (301) hide show
  1. package/dist/auth/setup.d.ts.map +1 -1
  2. package/dist/auth/setup.js +1 -0
  3. package/dist/config/defaults.d.ts.map +1 -1
  4. package/dist/config/defaults.js +5 -0
  5. package/dist/config/types.d.ts +17 -1
  6. package/dist/config/types.d.ts.map +1 -1
  7. package/dist/generated/plugin-manifest.d.ts +3 -0
  8. package/dist/generated/plugin-manifest.d.ts.map +1 -1
  9. package/dist/generated/plugin-manifest.js +1 -0
  10. package/dist/hooks/checkout.d.ts.map +1 -1
  11. package/dist/hooks/checkout.js +16 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -0
  15. package/dist/interfaces/rest/index.d.ts.map +1 -1
  16. package/dist/interfaces/rest/index.js +12 -0
  17. package/dist/interfaces/rest/routes/admin/staff.d.ts +12 -0
  18. package/dist/interfaces/rest/routes/admin/staff.d.ts.map +1 -0
  19. package/dist/interfaces/rest/routes/admin/staff.js +172 -0
  20. package/dist/interfaces/rest/routes/analytics.d.ts +5 -0
  21. package/dist/interfaces/rest/routes/analytics.d.ts.map +1 -0
  22. package/dist/interfaces/rest/routes/analytics.js +24 -0
  23. package/dist/interfaces/rest/routes/carts.d.ts.map +1 -1
  24. package/dist/interfaces/rest/routes/carts.js +39 -2
  25. package/dist/interfaces/rest/routes/catalog.d.ts.map +1 -1
  26. package/dist/interfaces/rest/routes/catalog.js +17 -1
  27. package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
  28. package/dist/interfaces/rest/routes/checkout.js +17 -0
  29. package/dist/interfaces/rest/routes/documents.d.ts +10 -0
  30. package/dist/interfaces/rest/routes/documents.d.ts.map +1 -0
  31. package/dist/interfaces/rest/routes/documents.js +40 -0
  32. package/dist/interfaces/rest/routes/orders.d.ts.map +1 -1
  33. package/dist/interfaces/rest/routes/orders.js +122 -1
  34. package/dist/interfaces/rest/routes/pricing.d.ts.map +1 -1
  35. package/dist/interfaces/rest/routes/pricing.js +36 -1
  36. package/dist/interfaces/rest/routes/settings.d.ts +5 -0
  37. package/dist/interfaces/rest/routes/settings.d.ts.map +1 -0
  38. package/dist/interfaces/rest/routes/settings.js +50 -0
  39. package/dist/interfaces/rest/routes/shipping.d.ts +5 -0
  40. package/dist/interfaces/rest/routes/shipping.d.ts.map +1 -0
  41. package/dist/interfaces/rest/routes/shipping.js +68 -0
  42. package/dist/interfaces/rest/routes/tax.d.ts +5 -0
  43. package/dist/interfaces/rest/routes/tax.d.ts.map +1 -0
  44. package/dist/interfaces/rest/routes/tax.js +68 -0
  45. package/dist/interfaces/rest/schemas/admin-staff.d.ts +899 -0
  46. package/dist/interfaces/rest/schemas/admin-staff.d.ts.map +1 -0
  47. package/dist/interfaces/rest/schemas/admin-staff.js +98 -0
  48. package/dist/interfaces/rest/schemas/analytics.d.ts +252 -0
  49. package/dist/interfaces/rest/schemas/analytics.d.ts.map +1 -0
  50. package/dist/interfaces/rest/schemas/analytics.js +33 -0
  51. package/dist/interfaces/rest/schemas/carts.d.ts +656 -0
  52. package/dist/interfaces/rest/schemas/carts.d.ts.map +1 -1
  53. package/dist/interfaces/rest/schemas/carts.js +38 -0
  54. package/dist/interfaces/rest/schemas/catalog.d.ts +1230 -2
  55. package/dist/interfaces/rest/schemas/catalog.d.ts.map +1 -1
  56. package/dist/interfaces/rest/schemas/catalog.js +48 -0
  57. package/dist/interfaces/rest/schemas/checkout.d.ts +2 -0
  58. package/dist/interfaces/rest/schemas/checkout.d.ts.map +1 -1
  59. package/dist/interfaces/rest/schemas/checkout.js +4 -0
  60. package/dist/interfaces/rest/schemas/customer-portal.d.ts +35 -0
  61. package/dist/interfaces/rest/schemas/customer-portal.d.ts.map +1 -1
  62. package/dist/interfaces/rest/schemas/documents.d.ts +509 -0
  63. package/dist/interfaces/rest/schemas/documents.d.ts.map +1 -0
  64. package/dist/interfaces/rest/schemas/documents.js +65 -0
  65. package/dist/interfaces/rest/schemas/orders.d.ts +4467 -7
  66. package/dist/interfaces/rest/schemas/orders.d.ts.map +1 -1
  67. package/dist/interfaces/rest/schemas/orders.js +330 -0
  68. package/dist/interfaces/rest/schemas/pricing.d.ts +405 -0
  69. package/dist/interfaces/rest/schemas/pricing.d.ts.map +1 -1
  70. package/dist/interfaces/rest/schemas/pricing.js +70 -0
  71. package/dist/interfaces/rest/schemas/responses.d.ts +156 -0
  72. package/dist/interfaces/rest/schemas/responses.d.ts.map +1 -1
  73. package/dist/interfaces/rest/schemas/search.d.ts +17 -0
  74. package/dist/interfaces/rest/schemas/search.d.ts.map +1 -1
  75. package/dist/interfaces/rest/schemas/settings.d.ts +397 -0
  76. package/dist/interfaces/rest/schemas/settings.d.ts.map +1 -0
  77. package/dist/interfaces/rest/schemas/settings.js +79 -0
  78. package/dist/interfaces/rest/schemas/shipping.d.ts +1093 -0
  79. package/dist/interfaces/rest/schemas/shipping.d.ts.map +1 -0
  80. package/dist/interfaces/rest/schemas/shipping.js +146 -0
  81. package/dist/interfaces/rest/schemas/tax.d.ts +1074 -0
  82. package/dist/interfaces/rest/schemas/tax.d.ts.map +1 -0
  83. package/dist/interfaces/rest/schemas/tax.js +132 -0
  84. package/dist/kernel/database/schema.d.ts +4 -0
  85. package/dist/kernel/database/schema.d.ts.map +1 -1
  86. package/dist/kernel/database/schema.js +8 -0
  87. package/dist/kernel/error-mapper.d.ts.map +1 -1
  88. package/dist/kernel/error-mapper.js +1 -0
  89. package/dist/kernel/errors.d.ts +5 -0
  90. package/dist/kernel/errors.d.ts.map +1 -1
  91. package/dist/kernel/errors.js +9 -0
  92. package/dist/kernel/hooks/types.d.ts +1 -1
  93. package/dist/kernel/hooks/types.d.ts.map +1 -1
  94. package/dist/kernel/plugin/manifest.d.ts +23 -0
  95. package/dist/kernel/plugin/manifest.d.ts.map +1 -1
  96. package/dist/kernel/plugin/manifest.js +17 -2
  97. package/dist/modules/analytics/module.d.ts.map +1 -1
  98. package/dist/modules/analytics/module.js +6 -0
  99. package/dist/modules/analytics/reports.d.ts +58 -0
  100. package/dist/modules/analytics/reports.d.ts.map +1 -0
  101. package/dist/modules/analytics/reports.js +249 -0
  102. package/dist/modules/analytics/service.d.ts +10 -0
  103. package/dist/modules/analytics/service.d.ts.map +1 -1
  104. package/dist/modules/analytics/service.js +14 -0
  105. package/dist/modules/cart/repository/index.d.ts +7 -0
  106. package/dist/modules/cart/repository/index.d.ts.map +1 -1
  107. package/dist/modules/cart/repository/index.js +25 -1
  108. package/dist/modules/cart/schema.d.ts +17 -0
  109. package/dist/modules/cart/schema.d.ts.map +1 -1
  110. package/dist/modules/cart/schema.js +2 -0
  111. package/dist/modules/cart/schemas.d.ts +1 -0
  112. package/dist/modules/cart/schemas.d.ts.map +1 -1
  113. package/dist/modules/cart/schemas.js +1 -0
  114. package/dist/modules/cart/service.d.ts +32 -0
  115. package/dist/modules/cart/service.d.ts.map +1 -1
  116. package/dist/modules/cart/service.js +58 -0
  117. package/dist/modules/catalog/entity-service.d.ts +21 -0
  118. package/dist/modules/catalog/entity-service.d.ts.map +1 -1
  119. package/dist/modules/catalog/entity-service.js +151 -6
  120. package/dist/modules/catalog/schema.d.ts +34 -0
  121. package/dist/modules/catalog/schema.d.ts.map +1 -1
  122. package/dist/modules/catalog/schema.js +5 -0
  123. package/dist/modules/catalog/schemas.d.ts +15 -1
  124. package/dist/modules/catalog/schemas.d.ts.map +1 -1
  125. package/dist/modules/catalog/schemas.js +17 -1
  126. package/dist/modules/catalog/service.d.ts +43 -1
  127. package/dist/modules/catalog/service.d.ts.map +1 -1
  128. package/dist/modules/catalog/service.js +6 -0
  129. package/dist/modules/documents/module.d.ts +7 -0
  130. package/dist/modules/documents/module.d.ts.map +1 -0
  131. package/dist/modules/documents/module.js +12 -0
  132. package/dist/modules/documents/pdf.d.ts +25 -0
  133. package/dist/modules/documents/pdf.d.ts.map +1 -0
  134. package/dist/modules/documents/pdf.js +80 -0
  135. package/dist/modules/documents/render.d.ts +32 -0
  136. package/dist/modules/documents/render.d.ts.map +1 -0
  137. package/dist/modules/documents/render.js +190 -0
  138. package/dist/modules/documents/repository/index.d.ts +25 -0
  139. package/dist/modules/documents/repository/index.d.ts.map +1 -0
  140. package/dist/modules/documents/repository/index.js +47 -0
  141. package/dist/modules/documents/schema.d.ts +214 -0
  142. package/dist/modules/documents/schema.d.ts.map +1 -0
  143. package/dist/modules/documents/schema.js +42 -0
  144. package/dist/modules/documents/service.d.ts +51 -0
  145. package/dist/modules/documents/service.d.ts.map +1 -0
  146. package/dist/modules/documents/service.js +119 -0
  147. package/dist/modules/fulfillment/service.d.ts +18 -0
  148. package/dist/modules/fulfillment/service.d.ts.map +1 -1
  149. package/dist/modules/fulfillment/service.js +85 -1
  150. package/dist/modules/media/service.d.ts +18 -0
  151. package/dist/modules/media/service.d.ts.map +1 -1
  152. package/dist/modules/media/service.js +26 -0
  153. package/dist/modules/orders/repository/index.d.ts +18 -1
  154. package/dist/modules/orders/repository/index.d.ts.map +1 -1
  155. package/dist/modules/orders/repository/index.js +86 -1
  156. package/dist/modules/orders/schema.d.ts +374 -0
  157. package/dist/modules/orders/schema.d.ts.map +1 -1
  158. package/dist/modules/orders/schema.js +52 -1
  159. package/dist/modules/orders/service.d.ts +102 -2
  160. package/dist/modules/orders/service.d.ts.map +1 -1
  161. package/dist/modules/orders/service.js +494 -23
  162. package/dist/modules/pricing/repository/index.d.ts +5 -0
  163. package/dist/modules/pricing/repository/index.d.ts.map +1 -1
  164. package/dist/modules/pricing/repository/index.js +19 -0
  165. package/dist/modules/pricing/service.d.ts +18 -0
  166. package/dist/modules/pricing/service.d.ts.map +1 -1
  167. package/dist/modules/pricing/service.js +57 -1
  168. package/dist/modules/settings/module.d.ts +6 -0
  169. package/dist/modules/settings/module.d.ts.map +1 -0
  170. package/dist/modules/settings/module.js +11 -0
  171. package/dist/modules/settings/repository/index.d.ts +16 -0
  172. package/dist/modules/settings/repository/index.d.ts.map +1 -0
  173. package/dist/modules/settings/repository/index.js +41 -0
  174. package/dist/modules/settings/schema.d.ts +121 -0
  175. package/dist/modules/settings/schema.d.ts.map +1 -0
  176. package/dist/modules/settings/schema.js +24 -0
  177. package/dist/modules/settings/service.d.ts +26 -0
  178. package/dist/modules/settings/service.d.ts.map +1 -0
  179. package/dist/modules/settings/service.js +51 -0
  180. package/dist/modules/shipping/calculator.d.ts +5 -0
  181. package/dist/modules/shipping/calculator.d.ts.map +1 -1
  182. package/dist/modules/shipping/calculator.js +10 -0
  183. package/dist/modules/shipping/module.d.ts +5 -1
  184. package/dist/modules/shipping/module.d.ts.map +1 -1
  185. package/dist/modules/shipping/module.js +4 -1
  186. package/dist/modules/shipping/repository/index.d.ts +27 -2
  187. package/dist/modules/shipping/repository/index.d.ts.map +1 -1
  188. package/dist/modules/shipping/repository/index.js +105 -1
  189. package/dist/modules/shipping/schema.d.ts +419 -0
  190. package/dist/modules/shipping/schema.d.ts.map +1 -0
  191. package/dist/modules/shipping/schema.js +56 -0
  192. package/dist/modules/shipping/service.d.ts +54 -0
  193. package/dist/modules/shipping/service.d.ts.map +1 -1
  194. package/dist/modules/shipping/service.js +161 -2
  195. package/dist/modules/tax/adapter.d.ts +13 -0
  196. package/dist/modules/tax/adapter.d.ts.map +1 -1
  197. package/dist/modules/tax/module.d.ts +5 -1
  198. package/dist/modules/tax/module.d.ts.map +1 -1
  199. package/dist/modules/tax/module.js +4 -1
  200. package/dist/modules/tax/repository/index.d.ts +38 -2
  201. package/dist/modules/tax/repository/index.d.ts.map +1 -1
  202. package/dist/modules/tax/repository/index.js +138 -1
  203. package/dist/modules/tax/schema.d.ts +355 -0
  204. package/dist/modules/tax/schema.d.ts.map +1 -0
  205. package/dist/modules/tax/schema.js +55 -0
  206. package/dist/modules/tax/service.d.ts +60 -1
  207. package/dist/modules/tax/service.d.ts.map +1 -1
  208. package/dist/modules/tax/service.js +227 -2
  209. package/dist/runtime/kernel-modules.d.ts +15 -2
  210. package/dist/runtime/kernel-modules.d.ts.map +1 -1
  211. package/dist/runtime/kernel-modules.js +4 -0
  212. package/dist/runtime/kernel-types.d.ts +5 -1
  213. package/dist/runtime/kernel-types.d.ts.map +1 -1
  214. package/dist/runtime/kernel-types.js +2 -0
  215. package/dist/runtime/server.d.ts.map +1 -1
  216. package/dist/runtime/server.js +35 -3
  217. package/dist/test-utils/create-plugin-test-app.d.ts +3 -0
  218. package/dist/test-utils/create-plugin-test-app.d.ts.map +1 -1
  219. package/dist/test-utils/create-plugin-test-app.js +15 -3
  220. package/dist/test-utils/rest-api-test-utils.d.ts.map +1 -1
  221. package/dist/test-utils/rest-api-test-utils.js +6 -0
  222. package/package.json +3 -3
  223. package/src/auth/setup.ts +1 -0
  224. package/src/config/defaults.ts +5 -0
  225. package/src/config/types.ts +17 -1
  226. package/src/generated/plugin-capabilities.d.ts +1 -0
  227. package/src/generated/plugin-manifest.ts +1 -0
  228. package/src/generated/plugin-repositories.d.ts +1 -0
  229. package/src/hooks/checkout.ts +25 -3
  230. package/src/index.ts +1 -0
  231. package/src/interfaces/rest/index.ts +12 -0
  232. package/src/interfaces/rest/routes/admin/staff.ts +218 -0
  233. package/src/interfaces/rest/routes/analytics.ts +33 -0
  234. package/src/interfaces/rest/routes/carts.ts +52 -2
  235. package/src/interfaces/rest/routes/catalog.ts +34 -0
  236. package/src/interfaces/rest/routes/checkout.ts +22 -0
  237. package/src/interfaces/rest/routes/documents.ts +61 -0
  238. package/src/interfaces/rest/routes/orders.ts +172 -1
  239. package/src/interfaces/rest/routes/pricing.ts +44 -1
  240. package/src/interfaces/rest/routes/settings.ts +61 -0
  241. package/src/interfaces/rest/routes/shipping.ts +92 -0
  242. package/src/interfaces/rest/routes/tax.ts +90 -0
  243. package/src/interfaces/rest/schemas/admin-staff.ts +110 -0
  244. package/src/interfaces/rest/schemas/analytics.ts +39 -0
  245. package/src/interfaces/rest/schemas/carts.ts +40 -0
  246. package/src/interfaces/rest/schemas/catalog.ts +53 -0
  247. package/src/interfaces/rest/schemas/checkout.ts +4 -0
  248. package/src/interfaces/rest/schemas/documents.ts +72 -0
  249. package/src/interfaces/rest/schemas/orders.ts +361 -0
  250. package/src/interfaces/rest/schemas/pricing.ts +75 -0
  251. package/src/interfaces/rest/schemas/settings.ts +93 -0
  252. package/src/interfaces/rest/schemas/shipping.ts +164 -0
  253. package/src/interfaces/rest/schemas/tax.ts +148 -0
  254. package/src/kernel/database/schema.ts +12 -0
  255. package/src/kernel/error-mapper.ts +1 -0
  256. package/src/kernel/errors.ts +11 -0
  257. package/src/kernel/hooks/types.ts +1 -0
  258. package/src/kernel/plugin/manifest.ts +38 -2
  259. package/src/modules/analytics/module.ts +10 -0
  260. package/src/modules/analytics/reports.ts +311 -0
  261. package/src/modules/analytics/service.ts +23 -0
  262. package/src/modules/cart/repository/index.ts +30 -1
  263. package/src/modules/cart/schema.ts +2 -0
  264. package/src/modules/cart/schemas.ts +1 -0
  265. package/src/modules/cart/service.ts +101 -0
  266. package/src/modules/catalog/entity-service.ts +195 -6
  267. package/src/modules/catalog/schema.ts +5 -0
  268. package/src/modules/catalog/schemas.ts +18 -1
  269. package/src/modules/catalog/service.ts +32 -2
  270. package/src/modules/documents/module.ts +19 -0
  271. package/src/modules/documents/pdf.ts +101 -0
  272. package/src/modules/documents/render.ts +231 -0
  273. package/src/modules/documents/repository/index.ts +68 -0
  274. package/src/modules/documents/schema.ts +44 -0
  275. package/src/modules/documents/service.ts +176 -0
  276. package/src/modules/fulfillment/service.ts +139 -1
  277. package/src/modules/media/service.ts +40 -0
  278. package/src/modules/orders/repository/index.ts +127 -1
  279. package/src/modules/orders/schema.ts +54 -1
  280. package/src/modules/orders/service.ts +739 -24
  281. package/src/modules/pricing/repository/index.ts +34 -0
  282. package/src/modules/pricing/service.ts +100 -1
  283. package/src/modules/settings/module.ts +18 -0
  284. package/src/modules/settings/repository/index.ts +59 -0
  285. package/src/modules/settings/schema.ts +25 -0
  286. package/src/modules/settings/service.ts +82 -0
  287. package/src/modules/shipping/calculator.ts +27 -0
  288. package/src/modules/shipping/module.ts +6 -2
  289. package/src/modules/shipping/repository/index.ts +136 -2
  290. package/src/modules/shipping/schema.ts +58 -0
  291. package/src/modules/shipping/service.ts +260 -1
  292. package/src/modules/tax/adapter.ts +9 -0
  293. package/src/modules/tax/module.ts +6 -2
  294. package/src/modules/tax/repository/index.ts +169 -2
  295. package/src/modules/tax/schema.ts +57 -0
  296. package/src/modules/tax/service.ts +313 -2
  297. package/src/runtime/kernel-modules.ts +4 -0
  298. package/src/runtime/kernel-types.ts +6 -0
  299. package/src/runtime/server.ts +36 -3
  300. package/src/test-utils/create-plugin-test-app.ts +17 -4
  301. package/src/test-utils/rest-api-test-utils.ts +6 -0
@@ -0,0 +1,509 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const EmailInvoiceBodySchema: z.ZodObject<{
3
+ to: z.ZodEmail;
4
+ }, z.core.$strip>;
5
+ export declare const invoicePdfRoute: {
6
+ method: "get";
7
+ path: "/{id}/invoice.pdf";
8
+ tags: string[];
9
+ summary: string;
10
+ request: {
11
+ params: z.ZodObject<{
12
+ id: z.ZodUUID;
13
+ }, z.core.$strip>;
14
+ };
15
+ responses: {
16
+ 400: {
17
+ readonly content: {
18
+ readonly "application/json": {
19
+ readonly schema: z.ZodObject<{
20
+ error: z.ZodObject<{
21
+ code: z.ZodString;
22
+ message: z.ZodString;
23
+ details: z.ZodOptional<z.ZodObject<{
24
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
25
+ path: z.ZodString;
26
+ message: z.ZodString;
27
+ code: z.ZodString;
28
+ }, z.core.$strip>>>;
29
+ }, z.core.$strip>>;
30
+ }, z.core.$strip>;
31
+ }, z.core.$strip>;
32
+ };
33
+ };
34
+ readonly description: "Business logic error.";
35
+ };
36
+ 401: {
37
+ readonly content: {
38
+ readonly "application/json": {
39
+ readonly schema: z.ZodObject<{
40
+ error: z.ZodObject<{
41
+ code: z.ZodString;
42
+ message: z.ZodString;
43
+ details: z.ZodOptional<z.ZodObject<{
44
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
45
+ path: z.ZodString;
46
+ message: z.ZodString;
47
+ code: z.ZodString;
48
+ }, z.core.$strip>>>;
49
+ }, z.core.$strip>>;
50
+ }, z.core.$strip>;
51
+ }, z.core.$strip>;
52
+ };
53
+ };
54
+ readonly description: "Authentication required.";
55
+ };
56
+ 403: {
57
+ readonly content: {
58
+ readonly "application/json": {
59
+ readonly schema: z.ZodObject<{
60
+ error: z.ZodObject<{
61
+ code: z.ZodString;
62
+ message: z.ZodString;
63
+ details: z.ZodOptional<z.ZodObject<{
64
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
65
+ path: z.ZodString;
66
+ message: z.ZodString;
67
+ code: z.ZodString;
68
+ }, z.core.$strip>>>;
69
+ }, z.core.$strip>>;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>;
72
+ };
73
+ };
74
+ readonly description: "Insufficient permissions.";
75
+ };
76
+ 404: {
77
+ readonly content: {
78
+ readonly "application/json": {
79
+ readonly schema: z.ZodObject<{
80
+ error: z.ZodObject<{
81
+ code: z.ZodString;
82
+ message: z.ZodString;
83
+ details: z.ZodOptional<z.ZodObject<{
84
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
85
+ path: z.ZodString;
86
+ message: z.ZodString;
87
+ code: z.ZodString;
88
+ }, z.core.$strip>>>;
89
+ }, z.core.$strip>>;
90
+ }, z.core.$strip>;
91
+ }, z.core.$strip>;
92
+ };
93
+ };
94
+ readonly description: "Resource not found.";
95
+ };
96
+ 422: {
97
+ readonly content: {
98
+ readonly "application/json": {
99
+ readonly schema: z.ZodObject<{
100
+ error: z.ZodObject<{
101
+ code: z.ZodString;
102
+ message: z.ZodString;
103
+ details: z.ZodOptional<z.ZodObject<{
104
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
105
+ path: z.ZodString;
106
+ message: z.ZodString;
107
+ code: z.ZodString;
108
+ }, z.core.$strip>>>;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$strip>;
111
+ }, z.core.$strip>;
112
+ };
113
+ };
114
+ readonly description: "Validation error.";
115
+ };
116
+ 200: {
117
+ content: {
118
+ "application/pdf": {
119
+ schema: z.ZodAny;
120
+ };
121
+ };
122
+ description: string;
123
+ };
124
+ };
125
+ } & {
126
+ getRoutingPath(): "/:id/invoice.pdf";
127
+ };
128
+ export declare const invoiceHtmlRoute: {
129
+ method: "get";
130
+ path: "/{id}/invoice.html";
131
+ tags: string[];
132
+ summary: string;
133
+ request: {
134
+ params: z.ZodObject<{
135
+ id: z.ZodUUID;
136
+ }, z.core.$strip>;
137
+ };
138
+ responses: {
139
+ 400: {
140
+ readonly content: {
141
+ readonly "application/json": {
142
+ readonly schema: z.ZodObject<{
143
+ error: z.ZodObject<{
144
+ code: z.ZodString;
145
+ message: z.ZodString;
146
+ details: z.ZodOptional<z.ZodObject<{
147
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
148
+ path: z.ZodString;
149
+ message: z.ZodString;
150
+ code: z.ZodString;
151
+ }, z.core.$strip>>>;
152
+ }, z.core.$strip>>;
153
+ }, z.core.$strip>;
154
+ }, z.core.$strip>;
155
+ };
156
+ };
157
+ readonly description: "Business logic error.";
158
+ };
159
+ 401: {
160
+ readonly content: {
161
+ readonly "application/json": {
162
+ readonly schema: z.ZodObject<{
163
+ error: z.ZodObject<{
164
+ code: z.ZodString;
165
+ message: z.ZodString;
166
+ details: z.ZodOptional<z.ZodObject<{
167
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
+ path: z.ZodString;
169
+ message: z.ZodString;
170
+ code: z.ZodString;
171
+ }, z.core.$strip>>>;
172
+ }, z.core.$strip>>;
173
+ }, z.core.$strip>;
174
+ }, z.core.$strip>;
175
+ };
176
+ };
177
+ readonly description: "Authentication required.";
178
+ };
179
+ 403: {
180
+ readonly content: {
181
+ readonly "application/json": {
182
+ readonly schema: z.ZodObject<{
183
+ error: z.ZodObject<{
184
+ code: z.ZodString;
185
+ message: z.ZodString;
186
+ details: z.ZodOptional<z.ZodObject<{
187
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
188
+ path: z.ZodString;
189
+ message: z.ZodString;
190
+ code: z.ZodString;
191
+ }, z.core.$strip>>>;
192
+ }, z.core.$strip>>;
193
+ }, z.core.$strip>;
194
+ }, z.core.$strip>;
195
+ };
196
+ };
197
+ readonly description: "Insufficient permissions.";
198
+ };
199
+ 404: {
200
+ readonly content: {
201
+ readonly "application/json": {
202
+ readonly schema: z.ZodObject<{
203
+ error: z.ZodObject<{
204
+ code: z.ZodString;
205
+ message: z.ZodString;
206
+ details: z.ZodOptional<z.ZodObject<{
207
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
208
+ path: z.ZodString;
209
+ message: z.ZodString;
210
+ code: z.ZodString;
211
+ }, z.core.$strip>>>;
212
+ }, z.core.$strip>>;
213
+ }, z.core.$strip>;
214
+ }, z.core.$strip>;
215
+ };
216
+ };
217
+ readonly description: "Resource not found.";
218
+ };
219
+ 422: {
220
+ readonly content: {
221
+ readonly "application/json": {
222
+ readonly schema: z.ZodObject<{
223
+ error: z.ZodObject<{
224
+ code: z.ZodString;
225
+ message: z.ZodString;
226
+ details: z.ZodOptional<z.ZodObject<{
227
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
228
+ path: z.ZodString;
229
+ message: z.ZodString;
230
+ code: z.ZodString;
231
+ }, z.core.$strip>>>;
232
+ }, z.core.$strip>>;
233
+ }, z.core.$strip>;
234
+ }, z.core.$strip>;
235
+ };
236
+ };
237
+ readonly description: "Validation error.";
238
+ };
239
+ 200: {
240
+ content: {
241
+ "text/html": {
242
+ schema: z.ZodString;
243
+ };
244
+ };
245
+ description: string;
246
+ };
247
+ };
248
+ } & {
249
+ getRoutingPath(): "/:id/invoice.html";
250
+ };
251
+ export declare const receiptHtmlRoute: {
252
+ method: "get";
253
+ path: "/{id}/receipt.html";
254
+ tags: string[];
255
+ summary: string;
256
+ request: {
257
+ params: z.ZodObject<{
258
+ id: z.ZodUUID;
259
+ }, z.core.$strip>;
260
+ };
261
+ responses: {
262
+ 400: {
263
+ readonly content: {
264
+ readonly "application/json": {
265
+ readonly schema: z.ZodObject<{
266
+ error: z.ZodObject<{
267
+ code: z.ZodString;
268
+ message: z.ZodString;
269
+ details: z.ZodOptional<z.ZodObject<{
270
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
271
+ path: z.ZodString;
272
+ message: z.ZodString;
273
+ code: z.ZodString;
274
+ }, z.core.$strip>>>;
275
+ }, z.core.$strip>>;
276
+ }, z.core.$strip>;
277
+ }, z.core.$strip>;
278
+ };
279
+ };
280
+ readonly description: "Business logic error.";
281
+ };
282
+ 401: {
283
+ readonly content: {
284
+ readonly "application/json": {
285
+ readonly schema: z.ZodObject<{
286
+ error: z.ZodObject<{
287
+ code: z.ZodString;
288
+ message: z.ZodString;
289
+ details: z.ZodOptional<z.ZodObject<{
290
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
291
+ path: z.ZodString;
292
+ message: z.ZodString;
293
+ code: z.ZodString;
294
+ }, z.core.$strip>>>;
295
+ }, z.core.$strip>>;
296
+ }, z.core.$strip>;
297
+ }, z.core.$strip>;
298
+ };
299
+ };
300
+ readonly description: "Authentication required.";
301
+ };
302
+ 403: {
303
+ readonly content: {
304
+ readonly "application/json": {
305
+ readonly schema: z.ZodObject<{
306
+ error: z.ZodObject<{
307
+ code: z.ZodString;
308
+ message: z.ZodString;
309
+ details: z.ZodOptional<z.ZodObject<{
310
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
311
+ path: z.ZodString;
312
+ message: z.ZodString;
313
+ code: z.ZodString;
314
+ }, z.core.$strip>>>;
315
+ }, z.core.$strip>>;
316
+ }, z.core.$strip>;
317
+ }, z.core.$strip>;
318
+ };
319
+ };
320
+ readonly description: "Insufficient permissions.";
321
+ };
322
+ 404: {
323
+ readonly content: {
324
+ readonly "application/json": {
325
+ readonly schema: z.ZodObject<{
326
+ error: z.ZodObject<{
327
+ code: z.ZodString;
328
+ message: z.ZodString;
329
+ details: z.ZodOptional<z.ZodObject<{
330
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
331
+ path: z.ZodString;
332
+ message: z.ZodString;
333
+ code: z.ZodString;
334
+ }, z.core.$strip>>>;
335
+ }, z.core.$strip>>;
336
+ }, z.core.$strip>;
337
+ }, z.core.$strip>;
338
+ };
339
+ };
340
+ readonly description: "Resource not found.";
341
+ };
342
+ 422: {
343
+ readonly content: {
344
+ readonly "application/json": {
345
+ readonly schema: z.ZodObject<{
346
+ error: z.ZodObject<{
347
+ code: z.ZodString;
348
+ message: z.ZodString;
349
+ details: z.ZodOptional<z.ZodObject<{
350
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
351
+ path: z.ZodString;
352
+ message: z.ZodString;
353
+ code: z.ZodString;
354
+ }, z.core.$strip>>>;
355
+ }, z.core.$strip>>;
356
+ }, z.core.$strip>;
357
+ }, z.core.$strip>;
358
+ };
359
+ };
360
+ readonly description: "Validation error.";
361
+ };
362
+ 200: {
363
+ content: {
364
+ "text/html": {
365
+ schema: z.ZodString;
366
+ };
367
+ };
368
+ description: string;
369
+ };
370
+ };
371
+ } & {
372
+ getRoutingPath(): "/:id/receipt.html";
373
+ };
374
+ export declare const emailInvoiceRoute: {
375
+ method: "post";
376
+ path: "/{id}/invoice/email";
377
+ tags: string[];
378
+ summary: string;
379
+ request: {
380
+ params: z.ZodObject<{
381
+ id: z.ZodUUID;
382
+ }, z.core.$strip>;
383
+ body: {
384
+ content: {
385
+ "application/json": {
386
+ schema: z.ZodObject<{
387
+ to: z.ZodEmail;
388
+ }, z.core.$strip>;
389
+ };
390
+ };
391
+ required: true;
392
+ };
393
+ };
394
+ responses: {
395
+ 400: {
396
+ readonly content: {
397
+ readonly "application/json": {
398
+ readonly schema: z.ZodObject<{
399
+ error: z.ZodObject<{
400
+ code: z.ZodString;
401
+ message: z.ZodString;
402
+ details: z.ZodOptional<z.ZodObject<{
403
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
404
+ path: z.ZodString;
405
+ message: z.ZodString;
406
+ code: z.ZodString;
407
+ }, z.core.$strip>>>;
408
+ }, z.core.$strip>>;
409
+ }, z.core.$strip>;
410
+ }, z.core.$strip>;
411
+ };
412
+ };
413
+ readonly description: "Business logic error.";
414
+ };
415
+ 401: {
416
+ readonly content: {
417
+ readonly "application/json": {
418
+ readonly schema: z.ZodObject<{
419
+ error: z.ZodObject<{
420
+ code: z.ZodString;
421
+ message: z.ZodString;
422
+ details: z.ZodOptional<z.ZodObject<{
423
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
424
+ path: z.ZodString;
425
+ message: z.ZodString;
426
+ code: z.ZodString;
427
+ }, z.core.$strip>>>;
428
+ }, z.core.$strip>>;
429
+ }, z.core.$strip>;
430
+ }, z.core.$strip>;
431
+ };
432
+ };
433
+ readonly description: "Authentication required.";
434
+ };
435
+ 403: {
436
+ readonly content: {
437
+ readonly "application/json": {
438
+ readonly schema: z.ZodObject<{
439
+ error: z.ZodObject<{
440
+ code: z.ZodString;
441
+ message: z.ZodString;
442
+ details: z.ZodOptional<z.ZodObject<{
443
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
444
+ path: z.ZodString;
445
+ message: z.ZodString;
446
+ code: z.ZodString;
447
+ }, z.core.$strip>>>;
448
+ }, z.core.$strip>>;
449
+ }, z.core.$strip>;
450
+ }, z.core.$strip>;
451
+ };
452
+ };
453
+ readonly description: "Insufficient permissions.";
454
+ };
455
+ 404: {
456
+ readonly content: {
457
+ readonly "application/json": {
458
+ readonly schema: z.ZodObject<{
459
+ error: z.ZodObject<{
460
+ code: z.ZodString;
461
+ message: z.ZodString;
462
+ details: z.ZodOptional<z.ZodObject<{
463
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
464
+ path: z.ZodString;
465
+ message: z.ZodString;
466
+ code: z.ZodString;
467
+ }, z.core.$strip>>>;
468
+ }, z.core.$strip>>;
469
+ }, z.core.$strip>;
470
+ }, z.core.$strip>;
471
+ };
472
+ };
473
+ readonly description: "Resource not found.";
474
+ };
475
+ 422: {
476
+ readonly content: {
477
+ readonly "application/json": {
478
+ readonly schema: z.ZodObject<{
479
+ error: z.ZodObject<{
480
+ code: z.ZodString;
481
+ message: z.ZodString;
482
+ details: z.ZodOptional<z.ZodObject<{
483
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
484
+ path: z.ZodString;
485
+ message: z.ZodString;
486
+ code: z.ZodString;
487
+ }, z.core.$strip>>>;
488
+ }, z.core.$strip>>;
489
+ }, z.core.$strip>;
490
+ }, z.core.$strip>;
491
+ };
492
+ };
493
+ readonly description: "Validation error.";
494
+ };
495
+ 200: {
496
+ content: {
497
+ "application/json": {
498
+ schema: z.ZodObject<{
499
+ data: z.ZodAny;
500
+ }, z.core.$strip>;
501
+ };
502
+ };
503
+ description: string;
504
+ };
505
+ };
506
+ } & {
507
+ getRoutingPath(): "/:id/invoice/email";
508
+ };
509
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/rest/schemas/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAOnD,eAAO,MAAM,sBAAsB;;iBAEF,CAAC;AAIlC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa1B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa5B,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { z, createRoute } from "@hono/zod-openapi";
2
+ import { errorResponses } from "./shared.js";
3
+ const IdParam = z.object({
4
+ id: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
5
+ });
6
+ export const EmailInvoiceBodySchema = z.object({
7
+ to: z.email().openapi({ example: "customer@example.com" }),
8
+ }).openapi("EmailInvoiceRequest");
9
+ const DataResponse = z.object({ data: z.any() }).openapi("DocumentActionResponse");
10
+ export const invoicePdfRoute = createRoute({
11
+ method: "get",
12
+ path: "/{id}/invoice.pdf",
13
+ tags: ["Documents"],
14
+ summary: "Render the order's invoice as PDF (issues a fiscal invoice number on first render)",
15
+ request: { params: IdParam },
16
+ responses: {
17
+ 200: {
18
+ content: { "application/pdf": { schema: z.any().openapi({ type: "string", format: "binary" }) } },
19
+ description: "The rendered PDF invoice.",
20
+ },
21
+ ...errorResponses,
22
+ },
23
+ });
24
+ export const invoiceHtmlRoute = createRoute({
25
+ method: "get",
26
+ path: "/{id}/invoice.html",
27
+ tags: ["Documents"],
28
+ summary: "Render the order's invoice as HTML",
29
+ request: { params: IdParam },
30
+ responses: {
31
+ 200: {
32
+ content: { "text/html": { schema: z.string() } },
33
+ description: "The rendered HTML invoice.",
34
+ },
35
+ ...errorResponses,
36
+ },
37
+ });
38
+ export const receiptHtmlRoute = createRoute({
39
+ method: "get",
40
+ path: "/{id}/receipt.html",
41
+ tags: ["Documents"],
42
+ summary: "Render the order's receipt as HTML",
43
+ request: { params: IdParam },
44
+ responses: {
45
+ 200: {
46
+ content: { "text/html": { schema: z.string() } },
47
+ description: "The rendered HTML receipt.",
48
+ },
49
+ ...errorResponses,
50
+ },
51
+ });
52
+ export const emailInvoiceRoute = createRoute({
53
+ method: "post",
54
+ path: "/{id}/invoice/email",
55
+ tags: ["Documents"],
56
+ summary: "Email the order's invoice via the configured email adapter",
57
+ request: {
58
+ params: IdParam,
59
+ body: { content: { "application/json": { schema: EmailInvoiceBodySchema } }, required: true },
60
+ },
61
+ responses: {
62
+ 200: { content: { "application/json": { schema: DataResponse } }, description: "Invoice emailed." },
63
+ ...errorResponses,
64
+ },
65
+ });