@molda-org/reservations 0.1.0-next.2 → 0.1.0-next.21

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.
@@ -0,0 +1,209 @@
1
+ import type { MoldaModuleDefinition, MoldaModuleShape } from '@molda-org/module-contracts';
2
+ import { z } from 'zod';
3
+ import { type ModuleRepository } from '@molda-org/module-runtime';
4
+ export type ReservationsAction = 'createReservation' | 'confirmReservation' | 'rescheduleReservation' | 'cancelReservation' | 'markNoShow';
5
+ export type ReservationsView = 'todaysReservations' | 'availableSlots' | 'cancelledReservations' | 'customerReservationHistory';
6
+ export type ReservationsHook = 'useReservations' | 'useReservation' | 'useAvailableSlots';
7
+ export interface ReservationsModuleShape extends MoldaModuleShape<'reservations', ReservationsAction, ReservationsView, ReservationsHook> {
8
+ readonly stage: 'initial';
9
+ readonly category: 'operations';
10
+ readonly purpose: 'Reservation lifecycle, capacity holds, confirmation, rescheduling, cancellation, and no-show evidence.';
11
+ }
12
+ export type ReservationsModule = MoldaModuleDefinition<ReservationsModuleShape>;
13
+ export declare const ReservationsActionIds: readonly ["createReservation", "confirmReservation", "rescheduleReservation", "cancelReservation", "markNoShow"];
14
+ export declare const ReservationsViewIds: readonly ["todaysReservations", "availableSlots", "cancelledReservations", "customerReservationHistory"];
15
+ export declare const ReservationsHookIds: readonly ["useReservations", "useReservation", "useAvailableSlots"];
16
+ export declare const ReservationsSpecification: {
17
+ readonly id: "reservations";
18
+ readonly version: "1.0.0";
19
+ readonly collections: {
20
+ readonly reservations: z.ZodObject<{
21
+ customerId: z.ZodString;
22
+ resourceId: z.ZodString;
23
+ startsAt: z.ZodString;
24
+ endsAt: z.ZodString;
25
+ status: z.ZodEnum<{
26
+ pending: "pending";
27
+ confirmed: "confirmed";
28
+ cancelled: "cancelled";
29
+ "no-show": "no-show";
30
+ }>;
31
+ transitionReason: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strict>;
33
+ readonly 'available-slots': z.ZodObject<{
34
+ resourceId: z.ZodString;
35
+ startsAt: z.ZodString;
36
+ endsAt: z.ZodString;
37
+ capacity: z.ZodNumber;
38
+ }, z.core.$strict>;
39
+ };
40
+ readonly actions: {
41
+ readonly createReservation: {
42
+ readonly kind: "create";
43
+ readonly collection: "reservations";
44
+ readonly permission: "create.reservation";
45
+ readonly event: "create.reservation";
46
+ readonly confirmation: "required";
47
+ readonly validate: ({ value, transaction }: {
48
+ readonly value: import("@molda-org/module-runtime").ModuleEntityValue;
49
+ readonly current: import("@molda-org/module-runtime").ModuleRecord | null;
50
+ readonly transaction: import("@molda-org/module-runtime").ModuleTransaction;
51
+ }) => Promise<void>;
52
+ };
53
+ readonly confirmReservation: {
54
+ readonly kind: "transition";
55
+ readonly collection: "reservations";
56
+ readonly permission: "confirm.reservation";
57
+ readonly event: "confirm.reservation";
58
+ readonly status: "confirmed";
59
+ readonly allowedFrom: readonly ["pending"];
60
+ readonly confirmation: "required";
61
+ };
62
+ readonly rescheduleReservation: {
63
+ readonly kind: "update";
64
+ readonly collection: "reservations";
65
+ readonly permission: "reschedule.reservation";
66
+ readonly event: "reschedule.reservation";
67
+ readonly confirmation: "required";
68
+ readonly validate: ({ value, current, transaction }: {
69
+ readonly value: import("@molda-org/module-runtime").ModuleEntityValue;
70
+ readonly current: import("@molda-org/module-runtime").ModuleRecord | null;
71
+ readonly transaction: import("@molda-org/module-runtime").ModuleTransaction;
72
+ }) => Promise<void>;
73
+ };
74
+ readonly cancelReservation: {
75
+ readonly kind: "transition";
76
+ readonly collection: "reservations";
77
+ readonly permission: "cancel.reservation";
78
+ readonly event: "cancel.reservation";
79
+ readonly status: "cancelled";
80
+ readonly allowedFrom: readonly ["pending", "confirmed"];
81
+ readonly confirmation: "required";
82
+ };
83
+ readonly markNoShow: {
84
+ readonly kind: "transition";
85
+ readonly collection: "reservations";
86
+ readonly permission: "mark.no.show";
87
+ readonly event: "mark.no.show";
88
+ readonly status: "no-show";
89
+ readonly allowedFrom: readonly ["confirmed"];
90
+ readonly confirmation: "required";
91
+ };
92
+ };
93
+ readonly views: {
94
+ readonly todaysReservations: {
95
+ readonly kind: "list";
96
+ readonly collection: "reservations";
97
+ readonly permission: "todays.reservations.read";
98
+ };
99
+ readonly availableSlots: {
100
+ readonly kind: "list";
101
+ readonly collection: "available-slots";
102
+ readonly permission: "available.slots.read";
103
+ };
104
+ readonly cancelledReservations: {
105
+ readonly kind: "list";
106
+ readonly collection: "reservations";
107
+ readonly permission: "cancelled.reservations.read";
108
+ readonly where: {
109
+ readonly status: "cancelled";
110
+ };
111
+ };
112
+ readonly customerReservationHistory: {
113
+ readonly kind: "list";
114
+ readonly collection: "reservations";
115
+ readonly permission: "customer.reservation.history.read";
116
+ };
117
+ };
118
+ readonly migrations: readonly [{
119
+ readonly version: 1;
120
+ readonly description: "Create reservations collections and indexes";
121
+ }];
122
+ readonly fixtures: readonly [{
123
+ readonly id: "reservations-baseline";
124
+ readonly description: "Deterministic reservations production-case fixture";
125
+ readonly records: readonly [{
126
+ readonly collection: "reservations";
127
+ readonly id: "reservation-fixture";
128
+ readonly value: {
129
+ readonly customerId: "customer-fixture";
130
+ readonly resourceId: "resource-fixture";
131
+ readonly startsAt: "2026-10-01T14:00:00.000Z";
132
+ readonly endsAt: "2026-10-01T15:00:00.000Z";
133
+ readonly status: "confirmed";
134
+ };
135
+ }];
136
+ }];
137
+ };
138
+ export declare const ReservationsBlueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
139
+ [k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
140
+ id: string;
141
+ data: Record<string, unknown>;
142
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
143
+ data: Record<string, unknown>;
144
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
145
+ id: string;
146
+ expectedRevision: number;
147
+ patch: Record<string, unknown>;
148
+ reason?: string | undefined;
149
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
150
+ id: string;
151
+ expectedRevision: number;
152
+ patch: Record<string, unknown>;
153
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>>;
154
+ }, {
155
+ [k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
156
+ id: string;
157
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
158
+ limit: number;
159
+ equals?: Record<string, unknown> | undefined;
160
+ }, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
161
+ }>;
162
+ export declare function createReservationsService(repository: ModuleRepository): {
163
+ blueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
164
+ [k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
165
+ id: string;
166
+ data: Record<string, unknown>;
167
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
168
+ data: Record<string, unknown>;
169
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
170
+ id: string;
171
+ expectedRevision: number;
172
+ patch: Record<string, unknown>;
173
+ reason?: string | undefined;
174
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
175
+ id: string;
176
+ expectedRevision: number;
177
+ patch: Record<string, unknown>;
178
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>>;
179
+ }, {
180
+ [k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
181
+ id: string;
182
+ }, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
183
+ limit: number;
184
+ equals?: Record<string, unknown> | undefined;
185
+ }, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
186
+ }>;
187
+ executeAction<TKey extends string>(actionId: TKey, unsafeInput: {
188
+ id: string;
189
+ data: Record<string, unknown>;
190
+ } | {
191
+ data: Record<string, unknown>;
192
+ } | {
193
+ id: string;
194
+ expectedRevision: number;
195
+ patch: Record<string, unknown>;
196
+ reason?: string | undefined;
197
+ } | {
198
+ id: string;
199
+ expectedRevision: number;
200
+ patch: Record<string, unknown>;
201
+ }, invocation: import("@molda-org/module-runtime").ModuleActionInvocation): Promise<import("@molda-org/module-runtime").ModuleActionExecution<never>>;
202
+ executeView<TKey extends string>(viewId: TKey, unsafeInput: {
203
+ id: string;
204
+ } | {
205
+ limit: number;
206
+ equals?: Record<string, unknown> | undefined;
207
+ }, context: import("@molda-org/module-runtime").ModuleExecutionContext): Promise<never>;
208
+ };
209
+ export declare function createReservationsRuntimeModule(repository: ModuleRepository): import("@molda-org/module-runtime").ResourceModuleContribution;
package/dist/index.js ADDED
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ import { createResourceModuleContribution, createResourceModuleService, defineResourceModule, ModuleConflictError, } from '@molda-org/module-runtime';
3
+ export const ReservationsActionIds = ["createReservation", "confirmReservation", "rescheduleReservation", "cancelReservation", "markNoShow"];
4
+ export const ReservationsViewIds = ["todaysReservations", "availableSlots", "cancelledReservations", "customerReservationHistory"];
5
+ export const ReservationsHookIds = ["useReservations", "useReservation", "useAvailableSlots"];
6
+ export const ReservationsSpecification = {
7
+ id: 'reservations',
8
+ version: '1.0.0',
9
+ collections: {
10
+ 'reservations': z.object({ customerId: z.string().min(1).max(200), resourceId: z.string().min(1).max(200), startsAt: z.string().datetime({ offset: true }), endsAt: z.string().datetime({ offset: true }), status: z.enum(['pending', 'confirmed', 'cancelled', 'no-show']), transitionReason: z.string().max(1_000).optional() }).strict().refine((value) => Date.parse(value.startsAt) < Date.parse(value.endsAt), { message: 'Reservation end must be after start' }),
11
+ 'available-slots': z.object({ resourceId: z.string().min(1).max(200), startsAt: z.string().datetime({ offset: true }), endsAt: z.string().datetime({ offset: true }), capacity: z.number().int().positive() }).strict(),
12
+ },
13
+ actions: {
14
+ createReservation: {
15
+ kind: 'create', collection: 'reservations', permission: 'create.reservation', event: 'create.reservation', confirmation: 'required',
16
+ validate: async ({ value, transaction }) => {
17
+ const reservations = await transaction.list('reservations', { equals: { resourceId: value.resourceId }, limit: 500 });
18
+ const overlaps = reservations.some(({ value: reservation }) => (reservation.status === 'pending' || reservation.status === 'confirmed') &&
19
+ Date.parse(String(value.startsAt)) < Date.parse(String(reservation.endsAt)) &&
20
+ Date.parse(String(value.endsAt)) > Date.parse(String(reservation.startsAt)));
21
+ if (overlaps)
22
+ throw new ModuleConflictError('Reservation overlaps an active reservation for this resource');
23
+ },
24
+ },
25
+ confirmReservation: { kind: 'transition', collection: 'reservations', permission: 'confirm.reservation', event: 'confirm.reservation', status: 'confirmed', allowedFrom: ["pending"], confirmation: 'required' },
26
+ rescheduleReservation: {
27
+ kind: 'update', collection: 'reservations', permission: 'reschedule.reservation', event: 'reschedule.reservation', confirmation: 'required',
28
+ validate: async ({ value, current, transaction }) => {
29
+ if (!current)
30
+ throw new ModuleConflictError('Reservation does not exist');
31
+ for (const field of ['customerId', 'resourceId', 'status']) {
32
+ if (value[field] !== current.value[field])
33
+ throw new ModuleConflictError(`Reservation ${field} is immutable during rescheduling`);
34
+ }
35
+ if (current.value.status !== 'pending' && current.value.status !== 'confirmed') {
36
+ throw new ModuleConflictError('Only active reservations can be rescheduled');
37
+ }
38
+ const reservations = await transaction.list('reservations', { equals: { resourceId: value.resourceId }, limit: 500 });
39
+ const overlaps = reservations.some((reservation) => reservation.id !== current.id &&
40
+ (reservation.value.status === 'pending' || reservation.value.status === 'confirmed') &&
41
+ Date.parse(String(value.startsAt)) < Date.parse(String(reservation.value.endsAt)) &&
42
+ Date.parse(String(value.endsAt)) > Date.parse(String(reservation.value.startsAt)));
43
+ if (overlaps)
44
+ throw new ModuleConflictError('Reservation overlaps an active reservation for this resource');
45
+ },
46
+ },
47
+ cancelReservation: { kind: 'transition', collection: 'reservations', permission: 'cancel.reservation', event: 'cancel.reservation', status: 'cancelled', allowedFrom: ["pending", "confirmed"], confirmation: 'required' },
48
+ markNoShow: { kind: 'transition', collection: 'reservations', permission: 'mark.no.show', event: 'mark.no.show', status: 'no-show', allowedFrom: ["confirmed"], confirmation: 'required' },
49
+ },
50
+ views: {
51
+ todaysReservations: { kind: 'list', collection: 'reservations', permission: 'todays.reservations.read' },
52
+ availableSlots: { kind: 'list', collection: 'available-slots', permission: 'available.slots.read' },
53
+ cancelledReservations: { kind: 'list', collection: 'reservations', permission: 'cancelled.reservations.read', where: { status: 'cancelled' } },
54
+ customerReservationHistory: { kind: 'list', collection: 'reservations', permission: 'customer.reservation.history.read' },
55
+ },
56
+ migrations: [{ version: 1, description: 'Create reservations collections and indexes' }],
57
+ fixtures: [{ id: 'reservations-baseline', description: 'Deterministic reservations production-case fixture', records: [
58
+ { collection: 'reservations', id: 'reservation-fixture', value: { customerId: 'customer-fixture', resourceId: 'resource-fixture', startsAt: '2026-10-01T14:00:00.000Z', endsAt: '2026-10-01T15:00:00.000Z', status: 'confirmed' } },
59
+ ] }],
60
+ };
61
+ export const ReservationsBlueprint = defineResourceModule(ReservationsSpecification);
62
+ export function createReservationsService(repository) {
63
+ return createResourceModuleService(ReservationsSpecification, repository);
64
+ }
65
+ export function createReservationsRuntimeModule(repository) {
66
+ return createResourceModuleContribution(ReservationsSpecification, repository);
67
+ }
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,oBAAoB,EACpB,mBAAmB,GAGpB,MAAM,2BAA2B,CAAC;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}
package/package.json CHANGED
@@ -1,18 +1,29 @@
1
1
  {
2
2
  "name": "@molda-org/reservations",
3
- "version": "0.1.0-next.2",
3
+ "version": "0.1.0-next.21",
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
- "index.d.ts"
12
+ "dist"
13
13
  ],
14
+ "scripts": {
15
+ "build": "tsc -p tsconfig.json",
16
+ "prepack": "npm run build",
17
+ "typecheck": "tsc -p tsconfig.json --noEmit"
18
+ },
14
19
  "dependencies": {
15
- "@molda-org/module-contracts": "0.1.0-next.2"
20
+ "@molda-org/module-contracts": "0.1.0-next.21",
21
+ "@molda-org/module-runtime": "0.1.0-next.21",
22
+ "zod": "4.6.5"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "22.19.19",
26
+ "typescript": "5.9.3"
16
27
  },
17
28
  "publishConfig": {
18
29
  "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
-