@molda-org/orders-fulfillment 0.1.0-next.5 → 0.1.0-next.6
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 +147 -0
- package/dist/index.js +26 -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,147 @@
|
|
|
1
|
+
import type { MoldaModuleDefinition, MoldaModuleShape } from '@molda-org/module-contracts';
|
|
2
|
+
import { type ModuleRepository } from '@molda-org/module-runtime';
|
|
3
|
+
export type OrdersFulfillmentAction = 'placeOrder' | 'updateOrderStatus' | 'assignFulfillment' | 'confirmHandoff';
|
|
4
|
+
export type OrdersFulfillmentView = 'orders' | 'ordersByStatus' | 'fulfillmentQueue';
|
|
5
|
+
export type OrdersFulfillmentHook = 'useOrders' | 'useOrder' | 'useFulfillmentQueue';
|
|
6
|
+
export interface OrdersFulfillmentModuleShape extends MoldaModuleShape<'orders-fulfillment', OrdersFulfillmentAction, OrdersFulfillmentView, OrdersFulfillmentHook> {
|
|
7
|
+
readonly stage: 'initial';
|
|
8
|
+
readonly category: 'commerce';
|
|
9
|
+
readonly purpose: 'Order capture, immutable line snapshots, lifecycle, fulfillment assignment, and handoff evidence.';
|
|
10
|
+
}
|
|
11
|
+
export type OrdersFulfillmentModule = MoldaModuleDefinition<OrdersFulfillmentModuleShape>;
|
|
12
|
+
export declare const OrdersFulfillmentActionIds: readonly ["placeOrder", "updateOrderStatus", "assignFulfillment", "confirmHandoff"];
|
|
13
|
+
export declare const OrdersFulfillmentViewIds: readonly ["orders", "ordersByStatus", "fulfillmentQueue"];
|
|
14
|
+
export declare const OrdersFulfillmentHookIds: readonly ["useOrders", "useOrder", "useFulfillmentQueue"];
|
|
15
|
+
export declare const OrdersFulfillmentSpecification: {
|
|
16
|
+
readonly id: "orders-fulfillment";
|
|
17
|
+
readonly version: "1.0.0";
|
|
18
|
+
readonly actions: {
|
|
19
|
+
readonly placeOrder: {
|
|
20
|
+
readonly kind: "create";
|
|
21
|
+
readonly collection: "orders";
|
|
22
|
+
readonly permission: "place.order";
|
|
23
|
+
readonly event: "place.order";
|
|
24
|
+
};
|
|
25
|
+
readonly updateOrderStatus: {
|
|
26
|
+
readonly kind: "update";
|
|
27
|
+
readonly collection: "orders";
|
|
28
|
+
readonly permission: "update.order.status";
|
|
29
|
+
readonly event: "update.order.status";
|
|
30
|
+
};
|
|
31
|
+
readonly assignFulfillment: {
|
|
32
|
+
readonly kind: "upsert";
|
|
33
|
+
readonly collection: "fulfillment-assignments";
|
|
34
|
+
readonly permission: "assign.fulfillment";
|
|
35
|
+
readonly event: "assign.fulfillment";
|
|
36
|
+
};
|
|
37
|
+
readonly confirmHandoff: {
|
|
38
|
+
readonly kind: "transition";
|
|
39
|
+
readonly collection: "orders";
|
|
40
|
+
readonly permission: "confirm.handoff";
|
|
41
|
+
readonly event: "confirm.handoff";
|
|
42
|
+
readonly status: "handed-off";
|
|
43
|
+
readonly allowedFrom: readonly ["ready"];
|
|
44
|
+
readonly confirmation: "required";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
readonly views: {
|
|
48
|
+
readonly orders: {
|
|
49
|
+
readonly kind: "list";
|
|
50
|
+
readonly collection: "orders";
|
|
51
|
+
readonly permission: "orders.read";
|
|
52
|
+
};
|
|
53
|
+
readonly ordersByStatus: {
|
|
54
|
+
readonly kind: "list";
|
|
55
|
+
readonly collection: "orders";
|
|
56
|
+
readonly permission: "orders.by.status.read";
|
|
57
|
+
};
|
|
58
|
+
readonly fulfillmentQueue: {
|
|
59
|
+
readonly kind: "list";
|
|
60
|
+
readonly collection: "fulfillment-assignments";
|
|
61
|
+
readonly permission: "fulfillment.queue.read";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly migrations: readonly [{
|
|
65
|
+
readonly version: 1;
|
|
66
|
+
readonly description: "Create orders-fulfillment collections and indexes";
|
|
67
|
+
}];
|
|
68
|
+
readonly fixtures: readonly [{
|
|
69
|
+
readonly id: "orders-fulfillment-baseline";
|
|
70
|
+
readonly description: "Deterministic orders-fulfillment production-case fixture";
|
|
71
|
+
}];
|
|
72
|
+
};
|
|
73
|
+
export declare const OrdersFulfillmentBlueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
|
|
74
|
+
[k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
75
|
+
id: string;
|
|
76
|
+
data: Record<string, unknown>;
|
|
77
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
78
|
+
data: Record<string, unknown>;
|
|
79
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
80
|
+
id: string;
|
|
81
|
+
expectedRevision: number;
|
|
82
|
+
patch: Record<string, unknown>;
|
|
83
|
+
reason?: string | undefined;
|
|
84
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
85
|
+
id: string;
|
|
86
|
+
expectedRevision: number;
|
|
87
|
+
patch: Record<string, unknown>;
|
|
88
|
+
}, import("@molda-org/module-runtime").ModuleRecord<{
|
|
89
|
+
[x: string]: unknown;
|
|
90
|
+
}>>;
|
|
91
|
+
}, {
|
|
92
|
+
[k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
93
|
+
id: string;
|
|
94
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
95
|
+
limit: number;
|
|
96
|
+
equals?: Record<string, unknown> | undefined;
|
|
97
|
+
}, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
|
|
98
|
+
}>;
|
|
99
|
+
export declare function createOrdersFulfillmentService(repository: ModuleRepository): {
|
|
100
|
+
blueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
|
|
101
|
+
[k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
102
|
+
id: string;
|
|
103
|
+
data: Record<string, unknown>;
|
|
104
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
105
|
+
data: Record<string, unknown>;
|
|
106
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
107
|
+
id: string;
|
|
108
|
+
expectedRevision: number;
|
|
109
|
+
patch: Record<string, unknown>;
|
|
110
|
+
reason?: string | undefined;
|
|
111
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
112
|
+
id: string;
|
|
113
|
+
expectedRevision: number;
|
|
114
|
+
patch: Record<string, unknown>;
|
|
115
|
+
}, import("@molda-org/module-runtime").ModuleRecord<{
|
|
116
|
+
[x: string]: unknown;
|
|
117
|
+
}>>;
|
|
118
|
+
}, {
|
|
119
|
+
[k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
120
|
+
id: string;
|
|
121
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
122
|
+
limit: number;
|
|
123
|
+
equals?: Record<string, unknown> | undefined;
|
|
124
|
+
}, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
|
|
125
|
+
}>;
|
|
126
|
+
executeAction<TKey extends string>(actionId: TKey, unsafeInput: {
|
|
127
|
+
id: string;
|
|
128
|
+
data: Record<string, unknown>;
|
|
129
|
+
} | {
|
|
130
|
+
data: Record<string, unknown>;
|
|
131
|
+
} | {
|
|
132
|
+
id: string;
|
|
133
|
+
expectedRevision: number;
|
|
134
|
+
patch: Record<string, unknown>;
|
|
135
|
+
reason?: string | undefined;
|
|
136
|
+
} | {
|
|
137
|
+
id: string;
|
|
138
|
+
expectedRevision: number;
|
|
139
|
+
patch: Record<string, unknown>;
|
|
140
|
+
}, invocation: import("@molda-org/module-runtime").ModuleActionInvocation): Promise<import("@molda-org/module-runtime").ModuleActionExecution<never>>;
|
|
141
|
+
executeView<TKey extends string>(viewId: TKey, unsafeInput: {
|
|
142
|
+
id: string;
|
|
143
|
+
} | {
|
|
144
|
+
limit: number;
|
|
145
|
+
equals?: Record<string, unknown> | undefined;
|
|
146
|
+
}, context: import("@molda-org/module-runtime").ModuleExecutionContext): Promise<never>;
|
|
147
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createResourceModuleService, defineResourceModule, } from '@molda-org/module-runtime';
|
|
2
|
+
export const OrdersFulfillmentActionIds = ["placeOrder", "updateOrderStatus", "assignFulfillment", "confirmHandoff"];
|
|
3
|
+
export const OrdersFulfillmentViewIds = ["orders", "ordersByStatus", "fulfillmentQueue"];
|
|
4
|
+
export const OrdersFulfillmentHookIds = ["useOrders", "useOrder", "useFulfillmentQueue"];
|
|
5
|
+
export const OrdersFulfillmentSpecification = {
|
|
6
|
+
id: 'orders-fulfillment',
|
|
7
|
+
version: '1.0.0',
|
|
8
|
+
actions: {
|
|
9
|
+
placeOrder: { kind: 'create', collection: 'orders', permission: 'place.order', event: 'place.order' },
|
|
10
|
+
updateOrderStatus: { kind: 'update', collection: 'orders', permission: 'update.order.status', event: 'update.order.status' },
|
|
11
|
+
assignFulfillment: { kind: 'upsert', collection: 'fulfillment-assignments', permission: 'assign.fulfillment', event: 'assign.fulfillment' },
|
|
12
|
+
confirmHandoff: { kind: 'transition', collection: 'orders', permission: 'confirm.handoff', event: 'confirm.handoff', status: 'handed-off', allowedFrom: ["ready"], confirmation: 'required' },
|
|
13
|
+
},
|
|
14
|
+
views: {
|
|
15
|
+
orders: { kind: 'list', collection: 'orders', permission: 'orders.read' },
|
|
16
|
+
ordersByStatus: { kind: 'list', collection: 'orders', permission: 'orders.by.status.read' },
|
|
17
|
+
fulfillmentQueue: { kind: 'list', collection: 'fulfillment-assignments', permission: 'fulfillment.queue.read' },
|
|
18
|
+
},
|
|
19
|
+
migrations: [{ version: 1, description: 'Create orders-fulfillment collections and indexes' }],
|
|
20
|
+
fixtures: [{ id: 'orders-fulfillment-baseline', description: 'Deterministic orders-fulfillment production-case fixture' }],
|
|
21
|
+
};
|
|
22
|
+
export const OrdersFulfillmentBlueprint = defineResourceModule(OrdersFulfillmentSpecification);
|
|
23
|
+
export function createOrdersFulfillmentService(repository) {
|
|
24
|
+
return createResourceModuleService(OrdersFulfillmentSpecification, repository);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,GAGrB,MAAM,2BAA2B,CAAC;AAcnC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,YAAY,EAAC,mBAAmB,EAAC,mBAAmB,EAAC,gBAAgB,CAAU,CAAC;AAC3H,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAQ,EAAC,gBAAgB,EAAC,kBAAkB,CAAU,CAAC;AAChG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,WAAW,EAAC,UAAU,EAAC,qBAAqB,CAAU,CAAC;AAEhG,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,EAAE,EAAE,oBAAoB;IACxB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE;QACP,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;QACrG,iBAAiB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ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.
|
|
3
|
+
"version": "0.1.0-next.6",
|
|
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.6",
|
|
20
|
+
"@molda-org/module-runtime": "0.1.0-next.6"
|
|
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 OrdersFulfillmentAction = 'placeOrder' | 'updateOrderStatus' | 'assignFulfillment' | 'confirmHandoff';
|
|
4
|
-
export type OrdersFulfillmentView = 'orders' | 'ordersByStatus' | 'fulfillmentQueue';
|
|
5
|
-
export type OrdersFulfillmentHook = 'useCart' | 'useCheckout' | 'useCustomerOrders';
|
|
6
|
-
|
|
7
|
-
export interface OrdersFulfillmentModuleShape
|
|
8
|
-
extends MoldaModuleShape<
|
|
9
|
-
'orders-fulfillment',
|
|
10
|
-
OrdersFulfillmentAction,
|
|
11
|
-
OrdersFulfillmentView,
|
|
12
|
-
OrdersFulfillmentHook
|
|
13
|
-
> {
|
|
14
|
-
readonly stage: 'initial';
|
|
15
|
-
readonly category: 'commerce';
|
|
16
|
-
readonly purpose: 'Cart, checkout, order lifecycle, pickup, delivery, tracking, and handoff.';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type OrdersFulfillmentModule = MoldaModuleDefinition<OrdersFulfillmentModuleShape>;
|
|
20
|
-
|