@voyantjs/legal 0.1.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.
- package/LICENSE +109 -0
- package/README.md +60 -0
- package/dist/contracts/index.d.ts +13 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +19 -0
- package/dist/contracts/routes.d.ts +1297 -0
- package/dist/contracts/routes.d.ts.map +1 -0
- package/dist/contracts/routes.js +224 -0
- package/dist/contracts/schema.d.ts +1531 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +227 -0
- package/dist/contracts/service.d.ts +1753 -0
- package/dist/contracts/service.d.ts.map +1 -0
- package/dist/contracts/service.js +570 -0
- package/dist/contracts/validation.d.ts +274 -0
- package/dist/contracts/validation.d.ts.map +1 -0
- package/dist/contracts/validation.js +125 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/policies/index.d.ts +16 -0
- package/dist/policies/index.d.ts.map +1 -0
- package/dist/policies/index.js +26 -0
- package/dist/policies/routes.d.ts +916 -0
- package/dist/policies/routes.d.ts.map +1 -0
- package/dist/policies/routes.js +162 -0
- package/dist/policies/schema.d.ts +1176 -0
- package/dist/policies/schema.d.ts.map +1 -0
- package/dist/policies/schema.js +189 -0
- package/dist/policies/service.d.ts +1384 -0
- package/dist/policies/service.d.ts.map +1 -0
- package/dist/policies/service.js +438 -0
- package/dist/policies/validation.d.ts +273 -0
- package/dist/policies/validation.d.ts.map +1 -0
- package/dist/policies/validation.js +140 -0
- package/package.json +83 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const contractScopeSchema: z.ZodEnum<{
|
|
3
|
+
customer: "customer";
|
|
4
|
+
partner: "partner";
|
|
5
|
+
supplier: "supplier";
|
|
6
|
+
other: "other";
|
|
7
|
+
channel: "channel";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const contractStatusSchema: z.ZodEnum<{
|
|
10
|
+
draft: "draft";
|
|
11
|
+
sent: "sent";
|
|
12
|
+
expired: "expired";
|
|
13
|
+
issued: "issued";
|
|
14
|
+
signed: "signed";
|
|
15
|
+
executed: "executed";
|
|
16
|
+
void: "void";
|
|
17
|
+
}>;
|
|
18
|
+
export declare const contractSignatureMethodSchema: z.ZodEnum<{
|
|
19
|
+
other: "other";
|
|
20
|
+
manual: "manual";
|
|
21
|
+
electronic: "electronic";
|
|
22
|
+
docusign: "docusign";
|
|
23
|
+
}>;
|
|
24
|
+
export declare const contractNumberResetStrategySchema: z.ZodEnum<{
|
|
25
|
+
never: "never";
|
|
26
|
+
annual: "annual";
|
|
27
|
+
monthly: "monthly";
|
|
28
|
+
}>;
|
|
29
|
+
export declare const contractBodyFormatSchema: z.ZodEnum<{
|
|
30
|
+
markdown: "markdown";
|
|
31
|
+
html: "html";
|
|
32
|
+
lexical_json: "lexical_json";
|
|
33
|
+
}>;
|
|
34
|
+
export declare const insertContractTemplateSchema: z.ZodObject<{
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
slug: z.ZodString;
|
|
37
|
+
scope: z.ZodEnum<{
|
|
38
|
+
customer: "customer";
|
|
39
|
+
partner: "partner";
|
|
40
|
+
supplier: "supplier";
|
|
41
|
+
other: "other";
|
|
42
|
+
channel: "channel";
|
|
43
|
+
}>;
|
|
44
|
+
language: z.ZodDefault<z.ZodString>;
|
|
45
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
46
|
+
bodyFormat: z.ZodDefault<z.ZodEnum<{
|
|
47
|
+
markdown: "markdown";
|
|
48
|
+
html: "html";
|
|
49
|
+
lexical_json: "lexical_json";
|
|
50
|
+
}>>;
|
|
51
|
+
body: z.ZodString;
|
|
52
|
+
variableSchema: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
53
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const updateContractTemplateSchema: z.ZodObject<{
|
|
56
|
+
name: z.ZodOptional<z.ZodString>;
|
|
57
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
58
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
customer: "customer";
|
|
60
|
+
partner: "partner";
|
|
61
|
+
supplier: "supplier";
|
|
62
|
+
other: "other";
|
|
63
|
+
channel: "channel";
|
|
64
|
+
}>>;
|
|
65
|
+
language: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
66
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
67
|
+
bodyFormat: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
68
|
+
markdown: "markdown";
|
|
69
|
+
html: "html";
|
|
70
|
+
lexical_json: "lexical_json";
|
|
71
|
+
}>>>;
|
|
72
|
+
body: z.ZodOptional<z.ZodString>;
|
|
73
|
+
variableSchema: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
74
|
+
active: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export declare const contractTemplateListQuerySchema: z.ZodObject<{
|
|
77
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
78
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
79
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
customer: "customer";
|
|
81
|
+
partner: "partner";
|
|
82
|
+
supplier: "supplier";
|
|
83
|
+
other: "other";
|
|
84
|
+
channel: "channel";
|
|
85
|
+
}>>;
|
|
86
|
+
language: z.ZodOptional<z.ZodString>;
|
|
87
|
+
active: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
88
|
+
search: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export declare const insertContractTemplateVersionSchema: z.ZodObject<{
|
|
91
|
+
bodyFormat: z.ZodDefault<z.ZodEnum<{
|
|
92
|
+
markdown: "markdown";
|
|
93
|
+
html: "html";
|
|
94
|
+
lexical_json: "lexical_json";
|
|
95
|
+
}>>;
|
|
96
|
+
body: z.ZodString;
|
|
97
|
+
variableSchema: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
98
|
+
changelog: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
99
|
+
createdBy: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
export declare const insertContractNumberSeriesSchema: z.ZodObject<{
|
|
102
|
+
code: z.ZodString;
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
prefix: z.ZodDefault<z.ZodString>;
|
|
105
|
+
separator: z.ZodDefault<z.ZodString>;
|
|
106
|
+
padLength: z.ZodDefault<z.ZodNumber>;
|
|
107
|
+
resetStrategy: z.ZodDefault<z.ZodEnum<{
|
|
108
|
+
never: "never";
|
|
109
|
+
annual: "annual";
|
|
110
|
+
monthly: "monthly";
|
|
111
|
+
}>>;
|
|
112
|
+
scope: z.ZodDefault<z.ZodEnum<{
|
|
113
|
+
customer: "customer";
|
|
114
|
+
partner: "partner";
|
|
115
|
+
supplier: "supplier";
|
|
116
|
+
other: "other";
|
|
117
|
+
channel: "channel";
|
|
118
|
+
}>>;
|
|
119
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export declare const updateContractNumberSeriesSchema: z.ZodObject<{
|
|
122
|
+
code: z.ZodOptional<z.ZodString>;
|
|
123
|
+
name: z.ZodOptional<z.ZodString>;
|
|
124
|
+
prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
125
|
+
separator: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
126
|
+
padLength: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
127
|
+
resetStrategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
128
|
+
never: "never";
|
|
129
|
+
annual: "annual";
|
|
130
|
+
monthly: "monthly";
|
|
131
|
+
}>>>;
|
|
132
|
+
scope: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
133
|
+
customer: "customer";
|
|
134
|
+
partner: "partner";
|
|
135
|
+
supplier: "supplier";
|
|
136
|
+
other: "other";
|
|
137
|
+
channel: "channel";
|
|
138
|
+
}>>>;
|
|
139
|
+
active: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
export declare const insertContractSchema: z.ZodObject<{
|
|
142
|
+
scope: z.ZodEnum<{
|
|
143
|
+
customer: "customer";
|
|
144
|
+
partner: "partner";
|
|
145
|
+
supplier: "supplier";
|
|
146
|
+
other: "other";
|
|
147
|
+
channel: "channel";
|
|
148
|
+
}>;
|
|
149
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
150
|
+
draft: "draft";
|
|
151
|
+
sent: "sent";
|
|
152
|
+
expired: "expired";
|
|
153
|
+
issued: "issued";
|
|
154
|
+
signed: "signed";
|
|
155
|
+
executed: "executed";
|
|
156
|
+
void: "void";
|
|
157
|
+
}>>;
|
|
158
|
+
title: z.ZodString;
|
|
159
|
+
templateVersionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
160
|
+
seriesId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
161
|
+
personId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
162
|
+
organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
163
|
+
supplierId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
164
|
+
channelId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
165
|
+
bookingId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
166
|
+
orderId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
167
|
+
expiresAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
168
|
+
language: z.ZodDefault<z.ZodString>;
|
|
169
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
170
|
+
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
export declare const updateContractSchema: z.ZodObject<{
|
|
173
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
customer: "customer";
|
|
175
|
+
partner: "partner";
|
|
176
|
+
supplier: "supplier";
|
|
177
|
+
other: "other";
|
|
178
|
+
channel: "channel";
|
|
179
|
+
}>>;
|
|
180
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
181
|
+
draft: "draft";
|
|
182
|
+
sent: "sent";
|
|
183
|
+
expired: "expired";
|
|
184
|
+
issued: "issued";
|
|
185
|
+
signed: "signed";
|
|
186
|
+
executed: "executed";
|
|
187
|
+
void: "void";
|
|
188
|
+
}>>>;
|
|
189
|
+
title: z.ZodOptional<z.ZodString>;
|
|
190
|
+
templateVersionId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
191
|
+
seriesId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
192
|
+
personId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
193
|
+
organizationId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
194
|
+
supplierId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
195
|
+
channelId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
196
|
+
bookingId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
197
|
+
orderId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
198
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
199
|
+
language: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
200
|
+
variables: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
201
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
export declare const contractListQuerySchema: z.ZodObject<{
|
|
204
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
205
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
206
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
207
|
+
customer: "customer";
|
|
208
|
+
partner: "partner";
|
|
209
|
+
supplier: "supplier";
|
|
210
|
+
other: "other";
|
|
211
|
+
channel: "channel";
|
|
212
|
+
}>>;
|
|
213
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
214
|
+
draft: "draft";
|
|
215
|
+
sent: "sent";
|
|
216
|
+
expired: "expired";
|
|
217
|
+
issued: "issued";
|
|
218
|
+
signed: "signed";
|
|
219
|
+
executed: "executed";
|
|
220
|
+
void: "void";
|
|
221
|
+
}>>;
|
|
222
|
+
personId: z.ZodOptional<z.ZodString>;
|
|
223
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
224
|
+
supplierId: z.ZodOptional<z.ZodString>;
|
|
225
|
+
bookingId: z.ZodOptional<z.ZodString>;
|
|
226
|
+
orderId: z.ZodOptional<z.ZodString>;
|
|
227
|
+
search: z.ZodOptional<z.ZodString>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
export declare const renderTemplateInputSchema: z.ZodObject<{
|
|
230
|
+
variables: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
231
|
+
bodyFormat: z.ZodOptional<z.ZodEnum<{
|
|
232
|
+
markdown: "markdown";
|
|
233
|
+
html: "html";
|
|
234
|
+
lexical_json: "lexical_json";
|
|
235
|
+
}>>;
|
|
236
|
+
body: z.ZodOptional<z.ZodString>;
|
|
237
|
+
}, z.core.$strip>;
|
|
238
|
+
export declare const insertContractSignatureSchema: z.ZodObject<{
|
|
239
|
+
signerName: z.ZodString;
|
|
240
|
+
signerEmail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
241
|
+
signerRole: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
242
|
+
personId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
243
|
+
method: z.ZodDefault<z.ZodEnum<{
|
|
244
|
+
other: "other";
|
|
245
|
+
manual: "manual";
|
|
246
|
+
electronic: "electronic";
|
|
247
|
+
docusign: "docusign";
|
|
248
|
+
}>>;
|
|
249
|
+
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
250
|
+
externalReference: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
251
|
+
signatureData: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
252
|
+
ipAddress: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
253
|
+
userAgent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
254
|
+
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
255
|
+
}, z.core.$strip>;
|
|
256
|
+
export declare const insertContractAttachmentSchema: z.ZodObject<{
|
|
257
|
+
kind: z.ZodDefault<z.ZodString>;
|
|
258
|
+
name: z.ZodString;
|
|
259
|
+
mimeType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
260
|
+
fileSize: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
261
|
+
storageKey: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
262
|
+
checksum: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
263
|
+
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
264
|
+
}, z.core.$strip>;
|
|
265
|
+
export declare const updateContractAttachmentSchema: z.ZodObject<{
|
|
266
|
+
kind: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
267
|
+
name: z.ZodOptional<z.ZodString>;
|
|
268
|
+
mimeType: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
269
|
+
fileSize: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
|
|
270
|
+
storageKey: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
271
|
+
checksum: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
272
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/contracts/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,mBAAmB;;;;;;EAAkE,CAAA;AAElG,eAAO,MAAM,oBAAoB;;;;;;;;EAQ/B,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;EAAwD,CAAA;AAElG,eAAO,MAAM,iCAAiC;;;;EAAyC,CAAA;AAEvF,eAAO,MAAM,wBAAwB;;;;EAA+C,CAAA;AAyBpF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;iBAA6B,CAAA;AACtE,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;iBAAuC,CAAA;AAEhF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;iBAK1C,CAAA;AAIF,eAAO,MAAM,mCAAmC;;;;;;;;;;iBAM9C,CAAA;AAeF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;iBAAiC,CAAA;AAC9E,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;iBAA2C,CAAA;AAsBxF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAqB,CAAA;AACtD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA+B,CAAA;AAEhE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;iBASlC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;iBAIpC,CAAA;AAkBF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;iBAA8B,CAAA;AAcxE,eAAO,MAAM,8BAA8B;;;;;;;;iBAA+B,CAAA;AAC1E,eAAO,MAAM,8BAA8B;;;;;;;;iBAAyC,CAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const contractScopeSchema = z.enum(["customer", "supplier", "partner", "channel", "other"]);
|
|
3
|
+
export const contractStatusSchema = z.enum([
|
|
4
|
+
"draft",
|
|
5
|
+
"issued",
|
|
6
|
+
"sent",
|
|
7
|
+
"signed",
|
|
8
|
+
"executed",
|
|
9
|
+
"expired",
|
|
10
|
+
"void",
|
|
11
|
+
]);
|
|
12
|
+
export const contractSignatureMethodSchema = z.enum(["manual", "electronic", "docusign", "other"]);
|
|
13
|
+
export const contractNumberResetStrategySchema = z.enum(["never", "annual", "monthly"]);
|
|
14
|
+
export const contractBodyFormatSchema = z.enum(["markdown", "html", "lexical_json"]);
|
|
15
|
+
const paginationSchema = z.object({
|
|
16
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
17
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
18
|
+
});
|
|
19
|
+
// ---------- contract templates ----------
|
|
20
|
+
const contractTemplateCoreSchema = z.object({
|
|
21
|
+
name: z.string().min(1).max(255),
|
|
22
|
+
slug: z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(100)
|
|
26
|
+
.regex(/^[a-z0-9-]+$/, "slug must be kebab-case"),
|
|
27
|
+
scope: contractScopeSchema,
|
|
28
|
+
language: z.string().min(2).max(10).default("en"),
|
|
29
|
+
description: z.string().max(2000).optional().nullable(),
|
|
30
|
+
bodyFormat: contractBodyFormatSchema.default("markdown"),
|
|
31
|
+
body: z.string().min(1),
|
|
32
|
+
variableSchema: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
33
|
+
active: z.boolean().default(true),
|
|
34
|
+
});
|
|
35
|
+
export const insertContractTemplateSchema = contractTemplateCoreSchema;
|
|
36
|
+
export const updateContractTemplateSchema = contractTemplateCoreSchema.partial();
|
|
37
|
+
export const contractTemplateListQuerySchema = paginationSchema.extend({
|
|
38
|
+
scope: contractScopeSchema.optional(),
|
|
39
|
+
language: z.string().optional(),
|
|
40
|
+
active: z.coerce.boolean().optional(),
|
|
41
|
+
search: z.string().optional(),
|
|
42
|
+
});
|
|
43
|
+
// ---------- contract template versions ----------
|
|
44
|
+
export const insertContractTemplateVersionSchema = z.object({
|
|
45
|
+
bodyFormat: contractBodyFormatSchema.default("markdown"),
|
|
46
|
+
body: z.string().min(1),
|
|
47
|
+
variableSchema: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
48
|
+
changelog: z.string().max(2000).optional().nullable(),
|
|
49
|
+
createdBy: z.string().max(255).optional().nullable(),
|
|
50
|
+
});
|
|
51
|
+
// ---------- contract number series ----------
|
|
52
|
+
const contractNumberSeriesCoreSchema = z.object({
|
|
53
|
+
code: z.string().min(1).max(50),
|
|
54
|
+
name: z.string().min(1).max(255),
|
|
55
|
+
prefix: z.string().max(20).default(""),
|
|
56
|
+
separator: z.string().max(5).default(""),
|
|
57
|
+
padLength: z.number().int().min(0).max(12).default(4),
|
|
58
|
+
resetStrategy: contractNumberResetStrategySchema.default("never"),
|
|
59
|
+
scope: contractScopeSchema.default("customer"),
|
|
60
|
+
active: z.boolean().default(true),
|
|
61
|
+
});
|
|
62
|
+
export const insertContractNumberSeriesSchema = contractNumberSeriesCoreSchema;
|
|
63
|
+
export const updateContractNumberSeriesSchema = contractNumberSeriesCoreSchema.partial();
|
|
64
|
+
// ---------- contracts ----------
|
|
65
|
+
const contractCoreSchema = z.object({
|
|
66
|
+
scope: contractScopeSchema,
|
|
67
|
+
status: contractStatusSchema.default("draft"),
|
|
68
|
+
title: z.string().min(1).max(500),
|
|
69
|
+
templateVersionId: z.string().optional().nullable(),
|
|
70
|
+
seriesId: z.string().optional().nullable(),
|
|
71
|
+
personId: z.string().optional().nullable(),
|
|
72
|
+
organizationId: z.string().optional().nullable(),
|
|
73
|
+
supplierId: z.string().optional().nullable(),
|
|
74
|
+
channelId: z.string().optional().nullable(),
|
|
75
|
+
bookingId: z.string().optional().nullable(),
|
|
76
|
+
orderId: z.string().optional().nullable(),
|
|
77
|
+
expiresAt: z.string().optional().nullable(),
|
|
78
|
+
language: z.string().min(2).max(10).default("en"),
|
|
79
|
+
variables: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
80
|
+
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
81
|
+
});
|
|
82
|
+
export const insertContractSchema = contractCoreSchema;
|
|
83
|
+
export const updateContractSchema = contractCoreSchema.partial();
|
|
84
|
+
export const contractListQuerySchema = paginationSchema.extend({
|
|
85
|
+
scope: contractScopeSchema.optional(),
|
|
86
|
+
status: contractStatusSchema.optional(),
|
|
87
|
+
personId: z.string().optional(),
|
|
88
|
+
organizationId: z.string().optional(),
|
|
89
|
+
supplierId: z.string().optional(),
|
|
90
|
+
bookingId: z.string().optional(),
|
|
91
|
+
orderId: z.string().optional(),
|
|
92
|
+
search: z.string().optional(),
|
|
93
|
+
});
|
|
94
|
+
export const renderTemplateInputSchema = z.object({
|
|
95
|
+
variables: z.record(z.string(), z.unknown()),
|
|
96
|
+
bodyFormat: contractBodyFormatSchema.optional(),
|
|
97
|
+
body: z.string().optional(),
|
|
98
|
+
});
|
|
99
|
+
// ---------- contract signatures ----------
|
|
100
|
+
const contractSignatureCoreSchema = z.object({
|
|
101
|
+
signerName: z.string().min(1).max(255),
|
|
102
|
+
signerEmail: z.string().email().optional().nullable(),
|
|
103
|
+
signerRole: z.string().max(255).optional().nullable(),
|
|
104
|
+
personId: z.string().optional().nullable(),
|
|
105
|
+
method: contractSignatureMethodSchema.default("manual"),
|
|
106
|
+
provider: z.string().max(255).optional().nullable(),
|
|
107
|
+
externalReference: z.string().max(255).optional().nullable(),
|
|
108
|
+
signatureData: z.string().optional().nullable(),
|
|
109
|
+
ipAddress: z.string().max(64).optional().nullable(),
|
|
110
|
+
userAgent: z.string().max(500).optional().nullable(),
|
|
111
|
+
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
112
|
+
});
|
|
113
|
+
export const insertContractSignatureSchema = contractSignatureCoreSchema;
|
|
114
|
+
// ---------- contract attachments ----------
|
|
115
|
+
const contractAttachmentCoreSchema = z.object({
|
|
116
|
+
kind: z.string().min(1).max(50).default("appendix"),
|
|
117
|
+
name: z.string().min(1).max(255),
|
|
118
|
+
mimeType: z.string().max(255).optional().nullable(),
|
|
119
|
+
fileSize: z.number().int().min(0).optional().nullable(),
|
|
120
|
+
storageKey: z.string().max(1000).optional().nullable(),
|
|
121
|
+
checksum: z.string().max(255).optional().nullable(),
|
|
122
|
+
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
123
|
+
});
|
|
124
|
+
export const insertContractAttachmentSchema = contractAttachmentCoreSchema;
|
|
125
|
+
export const updateContractAttachmentSchema = contractAttachmentCoreSchema.partial();
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Module } from "@voyantjs/core";
|
|
2
|
+
import type { HonoModule } from "@voyantjs/hono/module";
|
|
3
|
+
export declare const legalLinkable: {
|
|
4
|
+
policy: import("@voyantjs/core").LinkableDefinition;
|
|
5
|
+
policyVersion: import("@voyantjs/core").LinkableDefinition;
|
|
6
|
+
policyAcceptance: import("@voyantjs/core").LinkableDefinition;
|
|
7
|
+
contract: import("@voyantjs/core").LinkableDefinition;
|
|
8
|
+
contractTemplate: import("@voyantjs/core").LinkableDefinition;
|
|
9
|
+
};
|
|
10
|
+
export declare const legalModule: Module;
|
|
11
|
+
export declare const legalHonoModule: HonoModule;
|
|
12
|
+
export * from "./contracts/index.js";
|
|
13
|
+
export * from "./policies/index.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AASvD,eAAO,MAAM,aAAa;;;;;;CAGzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,MAGzB,CAAA;AAUD,eAAO,MAAM,eAAe,EAAE,UAI7B,CAAA;AAED,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { contractsAdminRoutes, contractsPublicRoutes } from "./contracts/routes.js";
|
|
3
|
+
import { policiesAdminRoutes, policiesPublicRoutes } from "./policies/routes.js";
|
|
4
|
+
import { contractsLinkable } from "./contracts/index.js";
|
|
5
|
+
import { policiesLinkable } from "./policies/index.js";
|
|
6
|
+
export const legalLinkable = {
|
|
7
|
+
...contractsLinkable,
|
|
8
|
+
...policiesLinkable,
|
|
9
|
+
};
|
|
10
|
+
export const legalModule = {
|
|
11
|
+
name: "legal",
|
|
12
|
+
linkable: legalLinkable,
|
|
13
|
+
};
|
|
14
|
+
const legalAdminRoutes = new Hono()
|
|
15
|
+
.route("/contracts", contractsAdminRoutes)
|
|
16
|
+
.route("/policies", policiesAdminRoutes);
|
|
17
|
+
const legalPublicRoutes = new Hono()
|
|
18
|
+
.route("/contracts", contractsPublicRoutes)
|
|
19
|
+
.route("/policies", policiesPublicRoutes);
|
|
20
|
+
export const legalHonoModule = {
|
|
21
|
+
module: legalModule,
|
|
22
|
+
adminRoutes: legalAdminRoutes,
|
|
23
|
+
publicRoutes: legalPublicRoutes,
|
|
24
|
+
};
|
|
25
|
+
export * from "./contracts/index.js";
|
|
26
|
+
export * from "./policies/index.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LinkableDefinition } from "@voyantjs/core";
|
|
2
|
+
export type { PoliciesAdminRoutes, PoliciesPublicRoutes } from "./routes.js";
|
|
3
|
+
export declare const policyLinkable: LinkableDefinition;
|
|
4
|
+
export declare const policyVersionLinkable: LinkableDefinition;
|
|
5
|
+
export declare const policyAcceptanceLinkable: LinkableDefinition;
|
|
6
|
+
export declare const policiesLinkable: {
|
|
7
|
+
policy: LinkableDefinition;
|
|
8
|
+
policyVersion: LinkableDefinition;
|
|
9
|
+
policyAcceptance: LinkableDefinition;
|
|
10
|
+
};
|
|
11
|
+
export type { NewPolicy, NewPolicyAcceptance, NewPolicyAssignment, NewPolicyRule, NewPolicyVersion, Policy, PolicyAcceptance, PolicyAssignment, PolicyRule, PolicyVersion, } from "./schema.js";
|
|
12
|
+
export { policies, policyAcceptances, policyAssignments, policyRules, policyVersions, } from "./schema.js";
|
|
13
|
+
export type { CancellationResult, CancellationRule } from "./service.js";
|
|
14
|
+
export { evaluateCancellationPolicy, policiesService } from "./service.js";
|
|
15
|
+
export { evaluateCancellationInputSchema, insertPolicyAcceptanceSchema, insertPolicyAssignmentSchema, insertPolicyRuleSchema, insertPolicySchema, insertPolicyVersionSchema, policyAcceptanceListQuerySchema, policyAcceptanceMethodSchema, policyAssignmentListQuerySchema, policyAssignmentScopeSchema, policyBodyFormatSchema, policyKindSchema, policyListQuerySchema, policyRefundTypeSchema, policyRuleTypeSchema, policyVersionStatusSchema, resolvePolicyInputSchema, updatePolicyAssignmentSchema, updatePolicyRuleSchema, updatePolicySchema, updatePolicyVersionSchema, } from "./validation.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policies/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAE5E,eAAO,MAAM,cAAc,EAAE,kBAK5B,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,kBAKnC,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,kBAKtC,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,4BAA4B,EAC5B,+BAA+B,EAC/B,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const policyLinkable = {
|
|
2
|
+
module: "legal",
|
|
3
|
+
entity: "policy",
|
|
4
|
+
table: "policies",
|
|
5
|
+
idPrefix: "poli",
|
|
6
|
+
};
|
|
7
|
+
export const policyVersionLinkable = {
|
|
8
|
+
module: "legal",
|
|
9
|
+
entity: "policyVersion",
|
|
10
|
+
table: "policy_versions",
|
|
11
|
+
idPrefix: "plvr",
|
|
12
|
+
};
|
|
13
|
+
export const policyAcceptanceLinkable = {
|
|
14
|
+
module: "legal",
|
|
15
|
+
entity: "policyAcceptance",
|
|
16
|
+
table: "policy_acceptances",
|
|
17
|
+
idPrefix: "plac",
|
|
18
|
+
};
|
|
19
|
+
export const policiesLinkable = {
|
|
20
|
+
policy: policyLinkable,
|
|
21
|
+
policyVersion: policyVersionLinkable,
|
|
22
|
+
policyAcceptance: policyAcceptanceLinkable,
|
|
23
|
+
};
|
|
24
|
+
export { policies, policyAcceptances, policyAssignments, policyRules, policyVersions, } from "./schema.js";
|
|
25
|
+
export { evaluateCancellationPolicy, policiesService } from "./service.js";
|
|
26
|
+
export { evaluateCancellationInputSchema, insertPolicyAcceptanceSchema, insertPolicyAssignmentSchema, insertPolicyRuleSchema, insertPolicySchema, insertPolicyVersionSchema, policyAcceptanceListQuerySchema, policyAcceptanceMethodSchema, policyAssignmentListQuerySchema, policyAssignmentScopeSchema, policyBodyFormatSchema, policyKindSchema, policyListQuerySchema, policyRefundTypeSchema, policyRuleTypeSchema, policyVersionStatusSchema, resolvePolicyInputSchema, updatePolicyAssignmentSchema, updatePolicyRuleSchema, updatePolicySchema, updatePolicyVersionSchema, } from "./validation.js";
|