@molda-org/rentals 0.1.0-next.8 → 0.1.0-next.9
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/index.d.ts +22 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MoldaModuleDefinition, MoldaModuleShape } from '@molda-org/module-contracts';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import { type ModuleRepository } from '@molda-org/module-runtime';
|
|
3
4
|
export type RentalsAction = 'createRental' | 'confirmPickup' | 'extendRental' | 'confirmReturn';
|
|
4
5
|
export type RentalsView = 'availableRentals' | 'activeRentals' | 'overdueReturns';
|
|
@@ -15,6 +16,27 @@ export declare const RentalsHookIds: readonly ["useRentalAvailability", "useRent
|
|
|
15
16
|
export declare const RentalsSpecification: {
|
|
16
17
|
readonly id: "rentals";
|
|
17
18
|
readonly version: "1.0.0";
|
|
19
|
+
readonly collections: {
|
|
20
|
+
readonly rentals: z.ZodObject<{
|
|
21
|
+
inventoryId: z.ZodString;
|
|
22
|
+
customerId: z.ZodString;
|
|
23
|
+
startsAt: z.ZodString;
|
|
24
|
+
endsAt: z.ZodString;
|
|
25
|
+
status: z.ZodEnum<{
|
|
26
|
+
reserved: "reserved";
|
|
27
|
+
active: "active";
|
|
28
|
+
overdue: "overdue";
|
|
29
|
+
returned: "returned";
|
|
30
|
+
}>;
|
|
31
|
+
transitionReason: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
readonly 'rental-inventory': z.ZodObject<{
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
available: z.ZodBoolean;
|
|
36
|
+
depositMinor: z.ZodNumber;
|
|
37
|
+
currency: z.ZodString;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
};
|
|
18
40
|
readonly actions: {
|
|
19
41
|
readonly createRental: {
|
|
20
42
|
readonly kind: "create";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { createResourceModuleContribution, createResourceModuleService, defineResourceModule, } from '@molda-org/module-runtime';
|
|
2
3
|
export const RentalsActionIds = ["createRental", "confirmPickup", "extendRental", "confirmReturn"];
|
|
3
4
|
export const RentalsViewIds = ["availableRentals", "activeRentals", "overdueReturns"];
|
|
@@ -5,6 +6,10 @@ export const RentalsHookIds = ["useRentalAvailability", "useRentals", "useOverdu
|
|
|
5
6
|
export const RentalsSpecification = {
|
|
6
7
|
id: 'rentals',
|
|
7
8
|
version: '1.0.0',
|
|
9
|
+
collections: {
|
|
10
|
+
'rentals': z.object({ inventoryId: z.string().min(1).max(200), customerId: z.string().min(1).max(200), startsAt: z.string().datetime({ offset: true }), endsAt: z.string().datetime({ offset: true }), status: z.enum(['reserved', 'active', 'overdue', 'returned']), transitionReason: z.string().max(1_000).optional() }).strict().refine((value) => Date.parse(value.startsAt) < Date.parse(value.endsAt), { message: 'Rental end must be after start' }),
|
|
11
|
+
'rental-inventory': z.object({ name: z.string().min(1).max(200), available: z.boolean(), depositMinor: z.number().int().nonnegative(), currency: z.string().length(3) }).strict(),
|
|
12
|
+
},
|
|
8
13
|
actions: {
|
|
9
14
|
createRental: { kind: 'create', collection: 'rentals', permission: 'create.rental', event: 'create.rental' },
|
|
10
15
|
confirmPickup: { kind: 'transition', collection: 'rentals', permission: 'confirm.pickup', event: 'confirm.pickup', status: 'active', allowedFrom: ["reserved"], confirmation: 'required' },
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,oBAAoB,GAGrB,MAAM,2BAA2B,CAAC;AAcnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,cAAc,EAA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,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,UAA4B;IAC/D,OAAO,2BAA2B,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,UAA4B;IACrE,OAAO,gCAAgC,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;AAC5E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molda-org/rentals",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@molda-org/module-contracts": "0.1.0-next.
|
|
21
|
-
"@molda-org/module-runtime": "0.1.0-next.
|
|
20
|
+
"@molda-org/module-contracts": "0.1.0-next.9",
|
|
21
|
+
"@molda-org/module-runtime": "0.1.0-next.9",
|
|
22
|
+
"zod": "4.6.5"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/node": "22.19.19",
|