@molda-org/reservations 0.1.0-next.5 → 0.1.0-next.7
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 +161 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +14 -6
- package/index.d.ts +0 -20
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { MoldaModuleDefinition, MoldaModuleShape } from '@molda-org/module-contracts';
|
|
2
|
+
import { type ModuleRepository } from '@molda-org/module-runtime';
|
|
3
|
+
export type ReservationsAction = 'createReservation' | 'confirmReservation' | 'rescheduleReservation' | 'cancelReservation' | 'markNoShow';
|
|
4
|
+
export type ReservationsView = 'todaysReservations' | 'availableSlots' | 'cancelledReservations' | 'customerReservationHistory';
|
|
5
|
+
export type ReservationsHook = 'useReservations' | 'useReservation' | 'useAvailableSlots';
|
|
6
|
+
export interface ReservationsModuleShape extends MoldaModuleShape<'reservations', ReservationsAction, ReservationsView, ReservationsHook> {
|
|
7
|
+
readonly stage: 'initial';
|
|
8
|
+
readonly category: 'operations';
|
|
9
|
+
readonly purpose: 'Reservation lifecycle, capacity holds, confirmation, rescheduling, cancellation, and no-show evidence.';
|
|
10
|
+
}
|
|
11
|
+
export type ReservationsModule = MoldaModuleDefinition<ReservationsModuleShape>;
|
|
12
|
+
export declare const ReservationsActionIds: readonly ["createReservation", "confirmReservation", "rescheduleReservation", "cancelReservation", "markNoShow"];
|
|
13
|
+
export declare const ReservationsViewIds: readonly ["todaysReservations", "availableSlots", "cancelledReservations", "customerReservationHistory"];
|
|
14
|
+
export declare const ReservationsHookIds: readonly ["useReservations", "useReservation", "useAvailableSlots"];
|
|
15
|
+
export declare const ReservationsSpecification: {
|
|
16
|
+
readonly id: "reservations";
|
|
17
|
+
readonly version: "1.0.0";
|
|
18
|
+
readonly actions: {
|
|
19
|
+
readonly createReservation: {
|
|
20
|
+
readonly kind: "create";
|
|
21
|
+
readonly collection: "reservations";
|
|
22
|
+
readonly permission: "create.reservation";
|
|
23
|
+
readonly event: "create.reservation";
|
|
24
|
+
};
|
|
25
|
+
readonly confirmReservation: {
|
|
26
|
+
readonly kind: "transition";
|
|
27
|
+
readonly collection: "reservations";
|
|
28
|
+
readonly permission: "confirm.reservation";
|
|
29
|
+
readonly event: "confirm.reservation";
|
|
30
|
+
readonly status: "confirmed";
|
|
31
|
+
readonly allowedFrom: readonly ["pending"];
|
|
32
|
+
readonly confirmation: "required";
|
|
33
|
+
};
|
|
34
|
+
readonly rescheduleReservation: {
|
|
35
|
+
readonly kind: "update";
|
|
36
|
+
readonly collection: "reservations";
|
|
37
|
+
readonly permission: "reschedule.reservation";
|
|
38
|
+
readonly event: "reschedule.reservation";
|
|
39
|
+
};
|
|
40
|
+
readonly cancelReservation: {
|
|
41
|
+
readonly kind: "transition";
|
|
42
|
+
readonly collection: "reservations";
|
|
43
|
+
readonly permission: "cancel.reservation";
|
|
44
|
+
readonly event: "cancel.reservation";
|
|
45
|
+
readonly status: "cancelled";
|
|
46
|
+
readonly allowedFrom: readonly ["pending", "confirmed"];
|
|
47
|
+
readonly confirmation: "required";
|
|
48
|
+
};
|
|
49
|
+
readonly markNoShow: {
|
|
50
|
+
readonly kind: "transition";
|
|
51
|
+
readonly collection: "reservations";
|
|
52
|
+
readonly permission: "mark.no.show";
|
|
53
|
+
readonly event: "mark.no.show";
|
|
54
|
+
readonly status: "no-show";
|
|
55
|
+
readonly allowedFrom: readonly ["confirmed"];
|
|
56
|
+
readonly confirmation: "required";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly views: {
|
|
60
|
+
readonly todaysReservations: {
|
|
61
|
+
readonly kind: "list";
|
|
62
|
+
readonly collection: "reservations";
|
|
63
|
+
readonly permission: "todays.reservations.read";
|
|
64
|
+
};
|
|
65
|
+
readonly availableSlots: {
|
|
66
|
+
readonly kind: "list";
|
|
67
|
+
readonly collection: "available-slots";
|
|
68
|
+
readonly permission: "available.slots.read";
|
|
69
|
+
};
|
|
70
|
+
readonly cancelledReservations: {
|
|
71
|
+
readonly kind: "list";
|
|
72
|
+
readonly collection: "reservations";
|
|
73
|
+
readonly permission: "cancelled.reservations.read";
|
|
74
|
+
};
|
|
75
|
+
readonly customerReservationHistory: {
|
|
76
|
+
readonly kind: "list";
|
|
77
|
+
readonly collection: "reservations";
|
|
78
|
+
readonly permission: "customer.reservation.history.read";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly migrations: readonly [{
|
|
82
|
+
readonly version: 1;
|
|
83
|
+
readonly description: "Create reservations collections and indexes";
|
|
84
|
+
}];
|
|
85
|
+
readonly fixtures: readonly [{
|
|
86
|
+
readonly id: "reservations-baseline";
|
|
87
|
+
readonly description: "Deterministic reservations production-case fixture";
|
|
88
|
+
}];
|
|
89
|
+
};
|
|
90
|
+
export declare const ReservationsBlueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
|
|
91
|
+
[k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
92
|
+
id: string;
|
|
93
|
+
data: Record<string, unknown>;
|
|
94
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
95
|
+
data: Record<string, unknown>;
|
|
96
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
97
|
+
id: string;
|
|
98
|
+
expectedRevision: number;
|
|
99
|
+
patch: Record<string, unknown>;
|
|
100
|
+
reason?: string | undefined;
|
|
101
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
102
|
+
id: string;
|
|
103
|
+
expectedRevision: number;
|
|
104
|
+
patch: Record<string, unknown>;
|
|
105
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>>;
|
|
106
|
+
}, {
|
|
107
|
+
[k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
108
|
+
id: string;
|
|
109
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
110
|
+
limit: number;
|
|
111
|
+
equals?: Record<string, unknown> | undefined;
|
|
112
|
+
}, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
|
|
113
|
+
}>;
|
|
114
|
+
export declare function createReservationsService(repository: ModuleRepository): {
|
|
115
|
+
blueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
|
|
116
|
+
[k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
117
|
+
id: string;
|
|
118
|
+
data: Record<string, unknown>;
|
|
119
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
120
|
+
data: Record<string, unknown>;
|
|
121
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
122
|
+
id: string;
|
|
123
|
+
expectedRevision: number;
|
|
124
|
+
patch: Record<string, unknown>;
|
|
125
|
+
reason?: string | undefined;
|
|
126
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
127
|
+
id: string;
|
|
128
|
+
expectedRevision: number;
|
|
129
|
+
patch: Record<string, unknown>;
|
|
130
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>>;
|
|
131
|
+
}, {
|
|
132
|
+
[k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
133
|
+
id: string;
|
|
134
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
135
|
+
limit: number;
|
|
136
|
+
equals?: Record<string, unknown> | undefined;
|
|
137
|
+
}, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
|
|
138
|
+
}>;
|
|
139
|
+
executeAction<TKey extends string>(actionId: TKey, unsafeInput: {
|
|
140
|
+
id: string;
|
|
141
|
+
data: Record<string, unknown>;
|
|
142
|
+
} | {
|
|
143
|
+
data: Record<string, unknown>;
|
|
144
|
+
} | {
|
|
145
|
+
id: string;
|
|
146
|
+
expectedRevision: number;
|
|
147
|
+
patch: Record<string, unknown>;
|
|
148
|
+
reason?: string | undefined;
|
|
149
|
+
} | {
|
|
150
|
+
id: string;
|
|
151
|
+
expectedRevision: number;
|
|
152
|
+
patch: Record<string, unknown>;
|
|
153
|
+
}, invocation: import("@molda-org/module-runtime").ModuleActionInvocation): Promise<import("@molda-org/module-runtime").ModuleActionExecution<never>>;
|
|
154
|
+
executeView<TKey extends string>(viewId: TKey, unsafeInput: {
|
|
155
|
+
id: string;
|
|
156
|
+
} | {
|
|
157
|
+
limit: number;
|
|
158
|
+
equals?: Record<string, unknown> | undefined;
|
|
159
|
+
}, context: import("@molda-org/module-runtime").ModuleExecutionContext): Promise<never>;
|
|
160
|
+
};
|
|
161
|
+
export declare function createReservationsRuntimeModule(repository: ModuleRepository): import("@molda-org/module-runtime").ResourceModuleContribution;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createResourceModuleContribution, createResourceModuleService, defineResourceModule, } from '@molda-org/module-runtime';
|
|
2
|
+
export const ReservationsActionIds = ["createReservation", "confirmReservation", "rescheduleReservation", "cancelReservation", "markNoShow"];
|
|
3
|
+
export const ReservationsViewIds = ["todaysReservations", "availableSlots", "cancelledReservations", "customerReservationHistory"];
|
|
4
|
+
export const ReservationsHookIds = ["useReservations", "useReservation", "useAvailableSlots"];
|
|
5
|
+
export const ReservationsSpecification = {
|
|
6
|
+
id: 'reservations',
|
|
7
|
+
version: '1.0.0',
|
|
8
|
+
actions: {
|
|
9
|
+
createReservation: { kind: 'create', collection: 'reservations', permission: 'create.reservation', event: 'create.reservation' },
|
|
10
|
+
confirmReservation: { kind: 'transition', collection: 'reservations', permission: 'confirm.reservation', event: 'confirm.reservation', status: 'confirmed', allowedFrom: ["pending"], confirmation: 'required' },
|
|
11
|
+
rescheduleReservation: { kind: 'update', collection: 'reservations', permission: 'reschedule.reservation', event: 'reschedule.reservation' },
|
|
12
|
+
cancelReservation: { kind: 'transition', collection: 'reservations', permission: 'cancel.reservation', event: 'cancel.reservation', status: 'cancelled', allowedFrom: ["pending", "confirmed"], confirmation: 'required' },
|
|
13
|
+
markNoShow: { kind: 'transition', collection: 'reservations', permission: 'mark.no.show', event: 'mark.no.show', status: 'no-show', allowedFrom: ["confirmed"], confirmation: 'required' },
|
|
14
|
+
},
|
|
15
|
+
views: {
|
|
16
|
+
todaysReservations: { kind: 'list', collection: 'reservations', permission: 'todays.reservations.read' },
|
|
17
|
+
availableSlots: { kind: 'list', collection: 'available-slots', permission: 'available.slots.read' },
|
|
18
|
+
cancelledReservations: { kind: 'list', collection: 'reservations', permission: 'cancelled.reservations.read' },
|
|
19
|
+
customerReservationHistory: { kind: 'list', collection: 'reservations', permission: 'customer.reservation.history.read' },
|
|
20
|
+
},
|
|
21
|
+
migrations: [{ version: 1, description: 'Create reservations collections and indexes' }],
|
|
22
|
+
fixtures: [{ id: 'reservations-baseline', description: 'Deterministic reservations production-case fixture' }],
|
|
23
|
+
};
|
|
24
|
+
export const ReservationsBlueprint = defineResourceModule(ReservationsSpecification);
|
|
25
|
+
export function createReservationsService(repository) {
|
|
26
|
+
return createResourceModuleService(ReservationsSpecification, repository);
|
|
27
|
+
}
|
|
28
|
+
export function createReservationsRuntimeModule(repository) {
|
|
29
|
+
return createResourceModuleContribution(ReservationsSpecification, repository);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.7",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"types": "./index.d.ts",
|
|
6
5
|
"exports": {
|
|
7
6
|
".": {
|
|
8
|
-
"types": "./index.d.ts"
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"
|
|
12
|
+
"dist"
|
|
13
13
|
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
17
|
+
},
|
|
14
18
|
"dependencies": {
|
|
15
|
-
"@molda-org/module-contracts": "0.1.0-next.
|
|
16
|
-
"@molda-org/module-runtime": "0.1.0-next.
|
|
19
|
+
"@molda-org/module-contracts": "0.1.0-next.7",
|
|
20
|
+
"@molda-org/module-runtime": "0.1.0-next.7"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "22.19.19",
|
|
24
|
+
"typescript": "5.9.3"
|
|
17
25
|
},
|
|
18
26
|
"publishConfig": {
|
|
19
27
|
"access": "public",
|
package/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { MoldaModuleDefinition, MoldaModuleShape } from '@molda-org/module-contracts';
|
|
2
|
-
|
|
3
|
-
export type ReservationsAction = 'createReservation' | 'confirmReservation' | 'rescheduleReservation' | 'cancelReservation' | 'markNoShow';
|
|
4
|
-
export type ReservationsView = 'todaysReservations' | 'availableSlots' | 'cancelledReservations' | 'customerReservationHistory';
|
|
5
|
-
export type ReservationsHook = 'useReservations' | 'useCreateReservation' | 'useCancelReservation';
|
|
6
|
-
|
|
7
|
-
export interface ReservationsModuleShape
|
|
8
|
-
extends MoldaModuleShape<
|
|
9
|
-
'reservations',
|
|
10
|
-
ReservationsAction,
|
|
11
|
-
ReservationsView,
|
|
12
|
-
ReservationsHook
|
|
13
|
-
> {
|
|
14
|
-
readonly stage: 'initial';
|
|
15
|
-
readonly category: 'operations';
|
|
16
|
-
readonly purpose: 'Reservation lifecycle, recurrence, capacity, waitlists, deposits, and reminders.';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type ReservationsModule = MoldaModuleDefinition<ReservationsModuleShape>;
|
|
20
|
-
|