@voyantjs/legal 0.2.0 → 0.3.1

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.
Files changed (32) hide show
  1. package/dist/contracts/routes.d.ts +94 -1
  2. package/dist/contracts/routes.d.ts.map +1 -1
  3. package/dist/contracts/routes.js +27 -1
  4. package/dist/contracts/service-contracts.d.ts +1234 -0
  5. package/dist/contracts/service-contracts.d.ts.map +1 -0
  6. package/dist/contracts/service-contracts.js +233 -0
  7. package/dist/contracts/service-series.d.ts +68 -0
  8. package/dist/contracts/service-series.d.ts.map +1 -0
  9. package/dist/contracts/service-series.js +34 -0
  10. package/dist/contracts/service-shared.d.ts +32 -0
  11. package/dist/contracts/service-shared.d.ts.map +1 -0
  12. package/dist/contracts/service-shared.js +142 -0
  13. package/dist/contracts/service-templates.d.ts +434 -0
  14. package/dist/contracts/service-templates.d.ts.map +1 -0
  15. package/dist/contracts/service-templates.js +132 -0
  16. package/dist/contracts/service.d.ts +882 -909
  17. package/dist/contracts/service.d.ts.map +1 -1
  18. package/dist/contracts/service.js +8 -568
  19. package/dist/contracts/validation.d.ts +14 -0
  20. package/dist/contracts/validation.d.ts.map +1 -1
  21. package/dist/contracts/validation.js +16 -0
  22. package/dist/policies/routes.d.ts +2 -2
  23. package/dist/policies/service-core.d.ts +1336 -0
  24. package/dist/policies/service-core.d.ts.map +1 -0
  25. package/dist/policies/service-core.js +357 -0
  26. package/dist/policies/service-shared.d.ts +43 -0
  27. package/dist/policies/service-shared.d.ts.map +1 -0
  28. package/dist/policies/service-shared.js +30 -0
  29. package/dist/policies/service.d.ts +28 -76
  30. package/dist/policies/service.d.ts.map +1 -1
  31. package/dist/policies/service.js +4 -436
  32. package/package.json +6 -6
@@ -0,0 +1,1234 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ import { type ContractListQuery, type CreateContractAttachmentInput, type CreateContractInput, type CreateContractSignatureInput, type UpdateContractAttachmentInput, type UpdateContractInput } from "./service-shared.js";
3
+ export declare const contractRecordsService: {
4
+ listContracts(db: PostgresJsDatabase, query: ContractListQuery): Promise<{
5
+ data: {
6
+ id: string;
7
+ contractNumber: string | null;
8
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
9
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
10
+ title: string;
11
+ templateVersionId: string | null;
12
+ seriesId: string | null;
13
+ personId: string | null;
14
+ organizationId: string | null;
15
+ supplierId: string | null;
16
+ channelId: string | null;
17
+ bookingId: string | null;
18
+ orderId: string | null;
19
+ issuedAt: Date | null;
20
+ sentAt: Date | null;
21
+ executedAt: Date | null;
22
+ expiresAt: Date | null;
23
+ voidedAt: Date | null;
24
+ language: string;
25
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
26
+ renderedBody: string | null;
27
+ variables: unknown;
28
+ metadata: unknown;
29
+ createdAt: Date;
30
+ updatedAt: Date;
31
+ }[];
32
+ total: number;
33
+ limit: number;
34
+ offset: number;
35
+ }>;
36
+ getContractById(db: PostgresJsDatabase, id: string): Promise<{
37
+ id: string;
38
+ contractNumber: string | null;
39
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
40
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
41
+ title: string;
42
+ templateVersionId: string | null;
43
+ seriesId: string | null;
44
+ personId: string | null;
45
+ organizationId: string | null;
46
+ supplierId: string | null;
47
+ channelId: string | null;
48
+ bookingId: string | null;
49
+ orderId: string | null;
50
+ issuedAt: Date | null;
51
+ sentAt: Date | null;
52
+ executedAt: Date | null;
53
+ expiresAt: Date | null;
54
+ voidedAt: Date | null;
55
+ language: string;
56
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
57
+ renderedBody: string | null;
58
+ variables: unknown;
59
+ metadata: unknown;
60
+ createdAt: Date;
61
+ updatedAt: Date;
62
+ } | null>;
63
+ createContract(db: PostgresJsDatabase, data: CreateContractInput): Promise<{
64
+ id: string;
65
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
66
+ createdAt: Date;
67
+ updatedAt: Date;
68
+ organizationId: string | null;
69
+ personId: string | null;
70
+ sentAt: Date | null;
71
+ title: string;
72
+ metadata: unknown;
73
+ supplierId: string | null;
74
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
75
+ language: string;
76
+ contractNumber: string | null;
77
+ templateVersionId: string | null;
78
+ seriesId: string | null;
79
+ channelId: string | null;
80
+ bookingId: string | null;
81
+ orderId: string | null;
82
+ issuedAt: Date | null;
83
+ executedAt: Date | null;
84
+ expiresAt: Date | null;
85
+ voidedAt: Date | null;
86
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
87
+ renderedBody: string | null;
88
+ variables: unknown;
89
+ } | null>;
90
+ updateContract(db: PostgresJsDatabase, id: string, data: UpdateContractInput): Promise<{
91
+ id: string;
92
+ contractNumber: string | null;
93
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
94
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
95
+ title: string;
96
+ templateVersionId: string | null;
97
+ seriesId: string | null;
98
+ personId: string | null;
99
+ organizationId: string | null;
100
+ supplierId: string | null;
101
+ channelId: string | null;
102
+ bookingId: string | null;
103
+ orderId: string | null;
104
+ issuedAt: Date | null;
105
+ sentAt: Date | null;
106
+ executedAt: Date | null;
107
+ expiresAt: Date | null;
108
+ voidedAt: Date | null;
109
+ language: string;
110
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
111
+ renderedBody: string | null;
112
+ variables: unknown;
113
+ metadata: unknown;
114
+ createdAt: Date;
115
+ updatedAt: Date;
116
+ } | null>;
117
+ deleteContract(db: PostgresJsDatabase, id: string): Promise<{
118
+ status: "not_found";
119
+ } | {
120
+ status: "not_draft";
121
+ } | {
122
+ status: "deleted";
123
+ }>;
124
+ issueContract(db: PostgresJsDatabase, contractId: string): Promise<{
125
+ status: "not_found";
126
+ contract?: undefined;
127
+ } | {
128
+ status: "not_draft";
129
+ contract?: undefined;
130
+ } | {
131
+ status: "issued";
132
+ contract: {
133
+ id: string;
134
+ contractNumber: string | null;
135
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
136
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
137
+ title: string;
138
+ templateVersionId: string | null;
139
+ seriesId: string | null;
140
+ personId: string | null;
141
+ organizationId: string | null;
142
+ supplierId: string | null;
143
+ channelId: string | null;
144
+ bookingId: string | null;
145
+ orderId: string | null;
146
+ issuedAt: Date | null;
147
+ sentAt: Date | null;
148
+ executedAt: Date | null;
149
+ expiresAt: Date | null;
150
+ voidedAt: Date | null;
151
+ language: string;
152
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
153
+ renderedBody: string | null;
154
+ variables: unknown;
155
+ metadata: unknown;
156
+ createdAt: Date;
157
+ updatedAt: Date;
158
+ } | null;
159
+ }>;
160
+ sendContract(db: PostgresJsDatabase, contractId: string): Promise<{
161
+ status: "not_found";
162
+ contract?: undefined;
163
+ } | {
164
+ status: "not_issued";
165
+ contract?: undefined;
166
+ } | {
167
+ status: "sent";
168
+ contract: {
169
+ id: string;
170
+ contractNumber: string | null;
171
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
172
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
173
+ title: string;
174
+ templateVersionId: string | null;
175
+ seriesId: string | null;
176
+ personId: string | null;
177
+ organizationId: string | null;
178
+ supplierId: string | null;
179
+ channelId: string | null;
180
+ bookingId: string | null;
181
+ orderId: string | null;
182
+ issuedAt: Date | null;
183
+ sentAt: Date | null;
184
+ executedAt: Date | null;
185
+ expiresAt: Date | null;
186
+ voidedAt: Date | null;
187
+ language: string;
188
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
189
+ renderedBody: string | null;
190
+ variables: unknown;
191
+ metadata: unknown;
192
+ createdAt: Date;
193
+ updatedAt: Date;
194
+ } | null;
195
+ }>;
196
+ voidContract(db: PostgresJsDatabase, contractId: string): Promise<{
197
+ status: "not_found";
198
+ contract?: undefined;
199
+ } | {
200
+ status: "already_void";
201
+ contract?: undefined;
202
+ } | {
203
+ status: "voided";
204
+ contract: {
205
+ id: string;
206
+ contractNumber: string | null;
207
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
208
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
209
+ title: string;
210
+ templateVersionId: string | null;
211
+ seriesId: string | null;
212
+ personId: string | null;
213
+ organizationId: string | null;
214
+ supplierId: string | null;
215
+ channelId: string | null;
216
+ bookingId: string | null;
217
+ orderId: string | null;
218
+ issuedAt: Date | null;
219
+ sentAt: Date | null;
220
+ executedAt: Date | null;
221
+ expiresAt: Date | null;
222
+ voidedAt: Date | null;
223
+ language: string;
224
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
225
+ renderedBody: string | null;
226
+ variables: unknown;
227
+ metadata: unknown;
228
+ createdAt: Date;
229
+ updatedAt: Date;
230
+ } | null;
231
+ }>;
232
+ listSignatures(db: PostgresJsDatabase, contractId: string): Omit<import("drizzle-orm/pg-core").PgSelectBase<"contract_signatures", {
233
+ id: import("drizzle-orm/pg-core").PgColumn<{
234
+ name: string;
235
+ tableName: "contract_signatures";
236
+ dataType: "string";
237
+ columnType: "PgText";
238
+ data: string;
239
+ driverParam: string;
240
+ notNull: true;
241
+ hasDefault: true;
242
+ isPrimaryKey: true;
243
+ isAutoincrement: false;
244
+ hasRuntimeDefault: true;
245
+ enumValues: [string, ...string[]];
246
+ baseColumn: never;
247
+ identity: undefined;
248
+ generated: undefined;
249
+ }, {}, {}>;
250
+ contractId: import("drizzle-orm/pg-core").PgColumn<{
251
+ name: string;
252
+ tableName: "contract_signatures";
253
+ dataType: "string";
254
+ columnType: "PgText";
255
+ data: string;
256
+ driverParam: string;
257
+ notNull: true;
258
+ hasDefault: false;
259
+ isPrimaryKey: false;
260
+ isAutoincrement: false;
261
+ hasRuntimeDefault: false;
262
+ enumValues: [string, ...string[]];
263
+ baseColumn: never;
264
+ identity: undefined;
265
+ generated: undefined;
266
+ }, {}, {}>;
267
+ signerName: import("drizzle-orm/pg-core").PgColumn<{
268
+ name: "signer_name";
269
+ tableName: "contract_signatures";
270
+ dataType: "string";
271
+ columnType: "PgText";
272
+ data: string;
273
+ driverParam: string;
274
+ notNull: true;
275
+ hasDefault: false;
276
+ isPrimaryKey: false;
277
+ isAutoincrement: false;
278
+ hasRuntimeDefault: false;
279
+ enumValues: [string, ...string[]];
280
+ baseColumn: never;
281
+ identity: undefined;
282
+ generated: undefined;
283
+ }, {}, {}>;
284
+ signerEmail: import("drizzle-orm/pg-core").PgColumn<{
285
+ name: "signer_email";
286
+ tableName: "contract_signatures";
287
+ dataType: "string";
288
+ columnType: "PgText";
289
+ data: string;
290
+ driverParam: string;
291
+ notNull: false;
292
+ hasDefault: false;
293
+ isPrimaryKey: false;
294
+ isAutoincrement: false;
295
+ hasRuntimeDefault: false;
296
+ enumValues: [string, ...string[]];
297
+ baseColumn: never;
298
+ identity: undefined;
299
+ generated: undefined;
300
+ }, {}, {}>;
301
+ signerRole: import("drizzle-orm/pg-core").PgColumn<{
302
+ name: "signer_role";
303
+ tableName: "contract_signatures";
304
+ dataType: "string";
305
+ columnType: "PgText";
306
+ data: string;
307
+ driverParam: string;
308
+ notNull: false;
309
+ hasDefault: false;
310
+ isPrimaryKey: false;
311
+ isAutoincrement: false;
312
+ hasRuntimeDefault: false;
313
+ enumValues: [string, ...string[]];
314
+ baseColumn: never;
315
+ identity: undefined;
316
+ generated: undefined;
317
+ }, {}, {}>;
318
+ personId: import("drizzle-orm/pg-core").PgColumn<{
319
+ name: string;
320
+ tableName: "contract_signatures";
321
+ dataType: "string";
322
+ columnType: "PgText";
323
+ data: string;
324
+ driverParam: string;
325
+ notNull: false;
326
+ hasDefault: false;
327
+ isPrimaryKey: false;
328
+ isAutoincrement: false;
329
+ hasRuntimeDefault: false;
330
+ enumValues: [string, ...string[]];
331
+ baseColumn: never;
332
+ identity: undefined;
333
+ generated: undefined;
334
+ }, {}, {}>;
335
+ method: import("drizzle-orm/pg-core").PgColumn<{
336
+ name: "method";
337
+ tableName: "contract_signatures";
338
+ dataType: "string";
339
+ columnType: "PgEnumColumn";
340
+ data: "other" | "manual" | "electronic" | "docusign";
341
+ driverParam: string;
342
+ notNull: true;
343
+ hasDefault: true;
344
+ isPrimaryKey: false;
345
+ isAutoincrement: false;
346
+ hasRuntimeDefault: false;
347
+ enumValues: ["manual", "electronic", "docusign", "other"];
348
+ baseColumn: never;
349
+ identity: undefined;
350
+ generated: undefined;
351
+ }, {}, {}>;
352
+ provider: import("drizzle-orm/pg-core").PgColumn<{
353
+ name: "provider";
354
+ tableName: "contract_signatures";
355
+ dataType: "string";
356
+ columnType: "PgText";
357
+ data: string;
358
+ driverParam: string;
359
+ notNull: false;
360
+ hasDefault: false;
361
+ isPrimaryKey: false;
362
+ isAutoincrement: false;
363
+ hasRuntimeDefault: false;
364
+ enumValues: [string, ...string[]];
365
+ baseColumn: never;
366
+ identity: undefined;
367
+ generated: undefined;
368
+ }, {}, {}>;
369
+ externalReference: import("drizzle-orm/pg-core").PgColumn<{
370
+ name: "external_reference";
371
+ tableName: "contract_signatures";
372
+ dataType: "string";
373
+ columnType: "PgText";
374
+ data: string;
375
+ driverParam: string;
376
+ notNull: false;
377
+ hasDefault: false;
378
+ isPrimaryKey: false;
379
+ isAutoincrement: false;
380
+ hasRuntimeDefault: false;
381
+ enumValues: [string, ...string[]];
382
+ baseColumn: never;
383
+ identity: undefined;
384
+ generated: undefined;
385
+ }, {}, {}>;
386
+ signatureData: import("drizzle-orm/pg-core").PgColumn<{
387
+ name: "signature_data";
388
+ tableName: "contract_signatures";
389
+ dataType: "string";
390
+ columnType: "PgText";
391
+ data: string;
392
+ driverParam: string;
393
+ notNull: false;
394
+ hasDefault: false;
395
+ isPrimaryKey: false;
396
+ isAutoincrement: false;
397
+ hasRuntimeDefault: false;
398
+ enumValues: [string, ...string[]];
399
+ baseColumn: never;
400
+ identity: undefined;
401
+ generated: undefined;
402
+ }, {}, {}>;
403
+ ipAddress: import("drizzle-orm/pg-core").PgColumn<{
404
+ name: "ip_address";
405
+ tableName: "contract_signatures";
406
+ dataType: "string";
407
+ columnType: "PgText";
408
+ data: string;
409
+ driverParam: string;
410
+ notNull: false;
411
+ hasDefault: false;
412
+ isPrimaryKey: false;
413
+ isAutoincrement: false;
414
+ hasRuntimeDefault: false;
415
+ enumValues: [string, ...string[]];
416
+ baseColumn: never;
417
+ identity: undefined;
418
+ generated: undefined;
419
+ }, {}, {}>;
420
+ userAgent: import("drizzle-orm/pg-core").PgColumn<{
421
+ name: "user_agent";
422
+ tableName: "contract_signatures";
423
+ dataType: "string";
424
+ columnType: "PgText";
425
+ data: string;
426
+ driverParam: string;
427
+ notNull: false;
428
+ hasDefault: false;
429
+ isPrimaryKey: false;
430
+ isAutoincrement: false;
431
+ hasRuntimeDefault: false;
432
+ enumValues: [string, ...string[]];
433
+ baseColumn: never;
434
+ identity: undefined;
435
+ generated: undefined;
436
+ }, {}, {}>;
437
+ signedAt: import("drizzle-orm/pg-core").PgColumn<{
438
+ name: "signed_at";
439
+ tableName: "contract_signatures";
440
+ dataType: "date";
441
+ columnType: "PgTimestamp";
442
+ data: Date;
443
+ driverParam: string;
444
+ notNull: true;
445
+ hasDefault: true;
446
+ isPrimaryKey: false;
447
+ isAutoincrement: false;
448
+ hasRuntimeDefault: false;
449
+ enumValues: undefined;
450
+ baseColumn: never;
451
+ identity: undefined;
452
+ generated: undefined;
453
+ }, {}, {}>;
454
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
455
+ name: "metadata";
456
+ tableName: "contract_signatures";
457
+ dataType: "json";
458
+ columnType: "PgJsonb";
459
+ data: unknown;
460
+ driverParam: unknown;
461
+ notNull: false;
462
+ hasDefault: false;
463
+ isPrimaryKey: false;
464
+ isAutoincrement: false;
465
+ hasRuntimeDefault: false;
466
+ enumValues: undefined;
467
+ baseColumn: never;
468
+ identity: undefined;
469
+ generated: undefined;
470
+ }, {}, {}>;
471
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
472
+ name: "created_at";
473
+ tableName: "contract_signatures";
474
+ dataType: "date";
475
+ columnType: "PgTimestamp";
476
+ data: Date;
477
+ driverParam: string;
478
+ notNull: true;
479
+ hasDefault: true;
480
+ isPrimaryKey: false;
481
+ isAutoincrement: false;
482
+ hasRuntimeDefault: false;
483
+ enumValues: undefined;
484
+ baseColumn: never;
485
+ identity: undefined;
486
+ generated: undefined;
487
+ }, {}, {}>;
488
+ }, "single", Record<"contract_signatures", "not-null">, false, "where" | "orderBy", {
489
+ id: string;
490
+ contractId: string;
491
+ signerName: string;
492
+ signerEmail: string | null;
493
+ signerRole: string | null;
494
+ personId: string | null;
495
+ method: "other" | "manual" | "electronic" | "docusign";
496
+ provider: string | null;
497
+ externalReference: string | null;
498
+ signatureData: string | null;
499
+ ipAddress: string | null;
500
+ userAgent: string | null;
501
+ signedAt: Date;
502
+ metadata: unknown;
503
+ createdAt: Date;
504
+ }[], {
505
+ id: import("drizzle-orm/pg-core").PgColumn<{
506
+ name: string;
507
+ tableName: "contract_signatures";
508
+ dataType: "string";
509
+ columnType: "PgText";
510
+ data: string;
511
+ driverParam: string;
512
+ notNull: true;
513
+ hasDefault: true;
514
+ isPrimaryKey: true;
515
+ isAutoincrement: false;
516
+ hasRuntimeDefault: true;
517
+ enumValues: [string, ...string[]];
518
+ baseColumn: never;
519
+ identity: undefined;
520
+ generated: undefined;
521
+ }, {}, {}>;
522
+ contractId: import("drizzle-orm/pg-core").PgColumn<{
523
+ name: string;
524
+ tableName: "contract_signatures";
525
+ dataType: "string";
526
+ columnType: "PgText";
527
+ data: string;
528
+ driverParam: string;
529
+ notNull: true;
530
+ hasDefault: false;
531
+ isPrimaryKey: false;
532
+ isAutoincrement: false;
533
+ hasRuntimeDefault: false;
534
+ enumValues: [string, ...string[]];
535
+ baseColumn: never;
536
+ identity: undefined;
537
+ generated: undefined;
538
+ }, {}, {}>;
539
+ signerName: import("drizzle-orm/pg-core").PgColumn<{
540
+ name: "signer_name";
541
+ tableName: "contract_signatures";
542
+ dataType: "string";
543
+ columnType: "PgText";
544
+ data: string;
545
+ driverParam: string;
546
+ notNull: true;
547
+ hasDefault: false;
548
+ isPrimaryKey: false;
549
+ isAutoincrement: false;
550
+ hasRuntimeDefault: false;
551
+ enumValues: [string, ...string[]];
552
+ baseColumn: never;
553
+ identity: undefined;
554
+ generated: undefined;
555
+ }, {}, {}>;
556
+ signerEmail: import("drizzle-orm/pg-core").PgColumn<{
557
+ name: "signer_email";
558
+ tableName: "contract_signatures";
559
+ dataType: "string";
560
+ columnType: "PgText";
561
+ data: string;
562
+ driverParam: string;
563
+ notNull: false;
564
+ hasDefault: false;
565
+ isPrimaryKey: false;
566
+ isAutoincrement: false;
567
+ hasRuntimeDefault: false;
568
+ enumValues: [string, ...string[]];
569
+ baseColumn: never;
570
+ identity: undefined;
571
+ generated: undefined;
572
+ }, {}, {}>;
573
+ signerRole: import("drizzle-orm/pg-core").PgColumn<{
574
+ name: "signer_role";
575
+ tableName: "contract_signatures";
576
+ dataType: "string";
577
+ columnType: "PgText";
578
+ data: string;
579
+ driverParam: string;
580
+ notNull: false;
581
+ hasDefault: false;
582
+ isPrimaryKey: false;
583
+ isAutoincrement: false;
584
+ hasRuntimeDefault: false;
585
+ enumValues: [string, ...string[]];
586
+ baseColumn: never;
587
+ identity: undefined;
588
+ generated: undefined;
589
+ }, {}, {}>;
590
+ personId: import("drizzle-orm/pg-core").PgColumn<{
591
+ name: string;
592
+ tableName: "contract_signatures";
593
+ dataType: "string";
594
+ columnType: "PgText";
595
+ data: string;
596
+ driverParam: string;
597
+ notNull: false;
598
+ hasDefault: false;
599
+ isPrimaryKey: false;
600
+ isAutoincrement: false;
601
+ hasRuntimeDefault: false;
602
+ enumValues: [string, ...string[]];
603
+ baseColumn: never;
604
+ identity: undefined;
605
+ generated: undefined;
606
+ }, {}, {}>;
607
+ method: import("drizzle-orm/pg-core").PgColumn<{
608
+ name: "method";
609
+ tableName: "contract_signatures";
610
+ dataType: "string";
611
+ columnType: "PgEnumColumn";
612
+ data: "other" | "manual" | "electronic" | "docusign";
613
+ driverParam: string;
614
+ notNull: true;
615
+ hasDefault: true;
616
+ isPrimaryKey: false;
617
+ isAutoincrement: false;
618
+ hasRuntimeDefault: false;
619
+ enumValues: ["manual", "electronic", "docusign", "other"];
620
+ baseColumn: never;
621
+ identity: undefined;
622
+ generated: undefined;
623
+ }, {}, {}>;
624
+ provider: import("drizzle-orm/pg-core").PgColumn<{
625
+ name: "provider";
626
+ tableName: "contract_signatures";
627
+ dataType: "string";
628
+ columnType: "PgText";
629
+ data: string;
630
+ driverParam: string;
631
+ notNull: false;
632
+ hasDefault: false;
633
+ isPrimaryKey: false;
634
+ isAutoincrement: false;
635
+ hasRuntimeDefault: false;
636
+ enumValues: [string, ...string[]];
637
+ baseColumn: never;
638
+ identity: undefined;
639
+ generated: undefined;
640
+ }, {}, {}>;
641
+ externalReference: import("drizzle-orm/pg-core").PgColumn<{
642
+ name: "external_reference";
643
+ tableName: "contract_signatures";
644
+ dataType: "string";
645
+ columnType: "PgText";
646
+ data: string;
647
+ driverParam: string;
648
+ notNull: false;
649
+ hasDefault: false;
650
+ isPrimaryKey: false;
651
+ isAutoincrement: false;
652
+ hasRuntimeDefault: false;
653
+ enumValues: [string, ...string[]];
654
+ baseColumn: never;
655
+ identity: undefined;
656
+ generated: undefined;
657
+ }, {}, {}>;
658
+ signatureData: import("drizzle-orm/pg-core").PgColumn<{
659
+ name: "signature_data";
660
+ tableName: "contract_signatures";
661
+ dataType: "string";
662
+ columnType: "PgText";
663
+ data: string;
664
+ driverParam: string;
665
+ notNull: false;
666
+ hasDefault: false;
667
+ isPrimaryKey: false;
668
+ isAutoincrement: false;
669
+ hasRuntimeDefault: false;
670
+ enumValues: [string, ...string[]];
671
+ baseColumn: never;
672
+ identity: undefined;
673
+ generated: undefined;
674
+ }, {}, {}>;
675
+ ipAddress: import("drizzle-orm/pg-core").PgColumn<{
676
+ name: "ip_address";
677
+ tableName: "contract_signatures";
678
+ dataType: "string";
679
+ columnType: "PgText";
680
+ data: string;
681
+ driverParam: string;
682
+ notNull: false;
683
+ hasDefault: false;
684
+ isPrimaryKey: false;
685
+ isAutoincrement: false;
686
+ hasRuntimeDefault: false;
687
+ enumValues: [string, ...string[]];
688
+ baseColumn: never;
689
+ identity: undefined;
690
+ generated: undefined;
691
+ }, {}, {}>;
692
+ userAgent: import("drizzle-orm/pg-core").PgColumn<{
693
+ name: "user_agent";
694
+ tableName: "contract_signatures";
695
+ dataType: "string";
696
+ columnType: "PgText";
697
+ data: string;
698
+ driverParam: string;
699
+ notNull: false;
700
+ hasDefault: false;
701
+ isPrimaryKey: false;
702
+ isAutoincrement: false;
703
+ hasRuntimeDefault: false;
704
+ enumValues: [string, ...string[]];
705
+ baseColumn: never;
706
+ identity: undefined;
707
+ generated: undefined;
708
+ }, {}, {}>;
709
+ signedAt: import("drizzle-orm/pg-core").PgColumn<{
710
+ name: "signed_at";
711
+ tableName: "contract_signatures";
712
+ dataType: "date";
713
+ columnType: "PgTimestamp";
714
+ data: Date;
715
+ driverParam: string;
716
+ notNull: true;
717
+ hasDefault: true;
718
+ isPrimaryKey: false;
719
+ isAutoincrement: false;
720
+ hasRuntimeDefault: false;
721
+ enumValues: undefined;
722
+ baseColumn: never;
723
+ identity: undefined;
724
+ generated: undefined;
725
+ }, {}, {}>;
726
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
727
+ name: "metadata";
728
+ tableName: "contract_signatures";
729
+ dataType: "json";
730
+ columnType: "PgJsonb";
731
+ data: unknown;
732
+ driverParam: unknown;
733
+ notNull: false;
734
+ hasDefault: false;
735
+ isPrimaryKey: false;
736
+ isAutoincrement: false;
737
+ hasRuntimeDefault: false;
738
+ enumValues: undefined;
739
+ baseColumn: never;
740
+ identity: undefined;
741
+ generated: undefined;
742
+ }, {}, {}>;
743
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
744
+ name: "created_at";
745
+ tableName: "contract_signatures";
746
+ dataType: "date";
747
+ columnType: "PgTimestamp";
748
+ data: Date;
749
+ driverParam: string;
750
+ notNull: true;
751
+ hasDefault: true;
752
+ isPrimaryKey: false;
753
+ isAutoincrement: false;
754
+ hasRuntimeDefault: false;
755
+ enumValues: undefined;
756
+ baseColumn: never;
757
+ identity: undefined;
758
+ generated: undefined;
759
+ }, {}, {}>;
760
+ }>, "where" | "orderBy">;
761
+ signContract(db: PostgresJsDatabase, contractId: string, data: CreateContractSignatureInput): Promise<{
762
+ status: "not_found";
763
+ contract?: undefined;
764
+ signature?: undefined;
765
+ } | {
766
+ status: "not_signable";
767
+ contract?: undefined;
768
+ signature?: undefined;
769
+ } | {
770
+ status: "signed";
771
+ contract: {
772
+ id: string;
773
+ contractNumber: string | null;
774
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
775
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
776
+ title: string;
777
+ templateVersionId: string | null;
778
+ seriesId: string | null;
779
+ personId: string | null;
780
+ organizationId: string | null;
781
+ supplierId: string | null;
782
+ channelId: string | null;
783
+ bookingId: string | null;
784
+ orderId: string | null;
785
+ issuedAt: Date | null;
786
+ sentAt: Date | null;
787
+ executedAt: Date | null;
788
+ expiresAt: Date | null;
789
+ voidedAt: Date | null;
790
+ language: string;
791
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
792
+ renderedBody: string | null;
793
+ variables: unknown;
794
+ metadata: unknown;
795
+ createdAt: Date;
796
+ updatedAt: Date;
797
+ } | null;
798
+ signature: {
799
+ id: string;
800
+ createdAt: Date;
801
+ personId: string | null;
802
+ metadata: unknown;
803
+ contractId: string;
804
+ signerName: string;
805
+ signerEmail: string | null;
806
+ signerRole: string | null;
807
+ method: "other" | "manual" | "electronic" | "docusign";
808
+ provider: string | null;
809
+ externalReference: string | null;
810
+ signatureData: string | null;
811
+ ipAddress: string | null;
812
+ userAgent: string | null;
813
+ signedAt: Date;
814
+ } | null;
815
+ }>;
816
+ executeContract(db: PostgresJsDatabase, contractId: string): Promise<{
817
+ status: "not_found";
818
+ contract?: undefined;
819
+ } | {
820
+ status: "not_signed";
821
+ contract?: undefined;
822
+ } | {
823
+ status: "executed";
824
+ contract: {
825
+ id: string;
826
+ contractNumber: string | null;
827
+ scope: "customer" | "partner" | "supplier" | "other" | "channel";
828
+ status: "draft" | "sent" | "expired" | "issued" | "signed" | "executed" | "void";
829
+ title: string;
830
+ templateVersionId: string | null;
831
+ seriesId: string | null;
832
+ personId: string | null;
833
+ organizationId: string | null;
834
+ supplierId: string | null;
835
+ channelId: string | null;
836
+ bookingId: string | null;
837
+ orderId: string | null;
838
+ issuedAt: Date | null;
839
+ sentAt: Date | null;
840
+ executedAt: Date | null;
841
+ expiresAt: Date | null;
842
+ voidedAt: Date | null;
843
+ language: string;
844
+ renderedBodyFormat: "markdown" | "html" | "lexical_json";
845
+ renderedBody: string | null;
846
+ variables: unknown;
847
+ metadata: unknown;
848
+ createdAt: Date;
849
+ updatedAt: Date;
850
+ } | null;
851
+ }>;
852
+ listAttachments(db: PostgresJsDatabase, contractId: string): Omit<import("drizzle-orm/pg-core").PgSelectBase<"contract_attachments", {
853
+ id: import("drizzle-orm/pg-core").PgColumn<{
854
+ name: string;
855
+ tableName: "contract_attachments";
856
+ dataType: "string";
857
+ columnType: "PgText";
858
+ data: string;
859
+ driverParam: string;
860
+ notNull: true;
861
+ hasDefault: true;
862
+ isPrimaryKey: true;
863
+ isAutoincrement: false;
864
+ hasRuntimeDefault: true;
865
+ enumValues: [string, ...string[]];
866
+ baseColumn: never;
867
+ identity: undefined;
868
+ generated: undefined;
869
+ }, {}, {}>;
870
+ contractId: import("drizzle-orm/pg-core").PgColumn<{
871
+ name: string;
872
+ tableName: "contract_attachments";
873
+ dataType: "string";
874
+ columnType: "PgText";
875
+ data: string;
876
+ driverParam: string;
877
+ notNull: true;
878
+ hasDefault: false;
879
+ isPrimaryKey: false;
880
+ isAutoincrement: false;
881
+ hasRuntimeDefault: false;
882
+ enumValues: [string, ...string[]];
883
+ baseColumn: never;
884
+ identity: undefined;
885
+ generated: undefined;
886
+ }, {}, {}>;
887
+ kind: import("drizzle-orm/pg-core").PgColumn<{
888
+ name: "kind";
889
+ tableName: "contract_attachments";
890
+ dataType: "string";
891
+ columnType: "PgText";
892
+ data: string;
893
+ driverParam: string;
894
+ notNull: true;
895
+ hasDefault: true;
896
+ isPrimaryKey: false;
897
+ isAutoincrement: false;
898
+ hasRuntimeDefault: false;
899
+ enumValues: [string, ...string[]];
900
+ baseColumn: never;
901
+ identity: undefined;
902
+ generated: undefined;
903
+ }, {}, {}>;
904
+ name: import("drizzle-orm/pg-core").PgColumn<{
905
+ name: "name";
906
+ tableName: "contract_attachments";
907
+ dataType: "string";
908
+ columnType: "PgText";
909
+ data: string;
910
+ driverParam: string;
911
+ notNull: true;
912
+ hasDefault: false;
913
+ isPrimaryKey: false;
914
+ isAutoincrement: false;
915
+ hasRuntimeDefault: false;
916
+ enumValues: [string, ...string[]];
917
+ baseColumn: never;
918
+ identity: undefined;
919
+ generated: undefined;
920
+ }, {}, {}>;
921
+ mimeType: import("drizzle-orm/pg-core").PgColumn<{
922
+ name: "mime_type";
923
+ tableName: "contract_attachments";
924
+ dataType: "string";
925
+ columnType: "PgText";
926
+ data: string;
927
+ driverParam: string;
928
+ notNull: false;
929
+ hasDefault: false;
930
+ isPrimaryKey: false;
931
+ isAutoincrement: false;
932
+ hasRuntimeDefault: false;
933
+ enumValues: [string, ...string[]];
934
+ baseColumn: never;
935
+ identity: undefined;
936
+ generated: undefined;
937
+ }, {}, {}>;
938
+ fileSize: import("drizzle-orm/pg-core").PgColumn<{
939
+ name: "file_size";
940
+ tableName: "contract_attachments";
941
+ dataType: "number";
942
+ columnType: "PgInteger";
943
+ data: number;
944
+ driverParam: string | number;
945
+ notNull: false;
946
+ hasDefault: false;
947
+ isPrimaryKey: false;
948
+ isAutoincrement: false;
949
+ hasRuntimeDefault: false;
950
+ enumValues: undefined;
951
+ baseColumn: never;
952
+ identity: undefined;
953
+ generated: undefined;
954
+ }, {}, {}>;
955
+ storageKey: import("drizzle-orm/pg-core").PgColumn<{
956
+ name: "storage_key";
957
+ tableName: "contract_attachments";
958
+ dataType: "string";
959
+ columnType: "PgText";
960
+ data: string;
961
+ driverParam: string;
962
+ notNull: false;
963
+ hasDefault: false;
964
+ isPrimaryKey: false;
965
+ isAutoincrement: false;
966
+ hasRuntimeDefault: false;
967
+ enumValues: [string, ...string[]];
968
+ baseColumn: never;
969
+ identity: undefined;
970
+ generated: undefined;
971
+ }, {}, {}>;
972
+ checksum: import("drizzle-orm/pg-core").PgColumn<{
973
+ name: "checksum";
974
+ tableName: "contract_attachments";
975
+ dataType: "string";
976
+ columnType: "PgText";
977
+ data: string;
978
+ driverParam: string;
979
+ notNull: false;
980
+ hasDefault: false;
981
+ isPrimaryKey: false;
982
+ isAutoincrement: false;
983
+ hasRuntimeDefault: false;
984
+ enumValues: [string, ...string[]];
985
+ baseColumn: never;
986
+ identity: undefined;
987
+ generated: undefined;
988
+ }, {}, {}>;
989
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
990
+ name: "metadata";
991
+ tableName: "contract_attachments";
992
+ dataType: "json";
993
+ columnType: "PgJsonb";
994
+ data: unknown;
995
+ driverParam: unknown;
996
+ notNull: false;
997
+ hasDefault: false;
998
+ isPrimaryKey: false;
999
+ isAutoincrement: false;
1000
+ hasRuntimeDefault: false;
1001
+ enumValues: undefined;
1002
+ baseColumn: never;
1003
+ identity: undefined;
1004
+ generated: undefined;
1005
+ }, {}, {}>;
1006
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
1007
+ name: "created_at";
1008
+ tableName: "contract_attachments";
1009
+ dataType: "date";
1010
+ columnType: "PgTimestamp";
1011
+ data: Date;
1012
+ driverParam: string;
1013
+ notNull: true;
1014
+ hasDefault: true;
1015
+ isPrimaryKey: false;
1016
+ isAutoincrement: false;
1017
+ hasRuntimeDefault: false;
1018
+ enumValues: undefined;
1019
+ baseColumn: never;
1020
+ identity: undefined;
1021
+ generated: undefined;
1022
+ }, {}, {}>;
1023
+ }, "single", Record<"contract_attachments", "not-null">, false, "where" | "orderBy", {
1024
+ id: string;
1025
+ contractId: string;
1026
+ kind: string;
1027
+ name: string;
1028
+ mimeType: string | null;
1029
+ fileSize: number | null;
1030
+ storageKey: string | null;
1031
+ checksum: string | null;
1032
+ metadata: unknown;
1033
+ createdAt: Date;
1034
+ }[], {
1035
+ id: import("drizzle-orm/pg-core").PgColumn<{
1036
+ name: string;
1037
+ tableName: "contract_attachments";
1038
+ dataType: "string";
1039
+ columnType: "PgText";
1040
+ data: string;
1041
+ driverParam: string;
1042
+ notNull: true;
1043
+ hasDefault: true;
1044
+ isPrimaryKey: true;
1045
+ isAutoincrement: false;
1046
+ hasRuntimeDefault: true;
1047
+ enumValues: [string, ...string[]];
1048
+ baseColumn: never;
1049
+ identity: undefined;
1050
+ generated: undefined;
1051
+ }, {}, {}>;
1052
+ contractId: import("drizzle-orm/pg-core").PgColumn<{
1053
+ name: string;
1054
+ tableName: "contract_attachments";
1055
+ dataType: "string";
1056
+ columnType: "PgText";
1057
+ data: string;
1058
+ driverParam: string;
1059
+ notNull: true;
1060
+ hasDefault: false;
1061
+ isPrimaryKey: false;
1062
+ isAutoincrement: false;
1063
+ hasRuntimeDefault: false;
1064
+ enumValues: [string, ...string[]];
1065
+ baseColumn: never;
1066
+ identity: undefined;
1067
+ generated: undefined;
1068
+ }, {}, {}>;
1069
+ kind: import("drizzle-orm/pg-core").PgColumn<{
1070
+ name: "kind";
1071
+ tableName: "contract_attachments";
1072
+ dataType: "string";
1073
+ columnType: "PgText";
1074
+ data: string;
1075
+ driverParam: string;
1076
+ notNull: true;
1077
+ hasDefault: true;
1078
+ isPrimaryKey: false;
1079
+ isAutoincrement: false;
1080
+ hasRuntimeDefault: false;
1081
+ enumValues: [string, ...string[]];
1082
+ baseColumn: never;
1083
+ identity: undefined;
1084
+ generated: undefined;
1085
+ }, {}, {}>;
1086
+ name: import("drizzle-orm/pg-core").PgColumn<{
1087
+ name: "name";
1088
+ tableName: "contract_attachments";
1089
+ dataType: "string";
1090
+ columnType: "PgText";
1091
+ data: string;
1092
+ driverParam: string;
1093
+ notNull: true;
1094
+ hasDefault: false;
1095
+ isPrimaryKey: false;
1096
+ isAutoincrement: false;
1097
+ hasRuntimeDefault: false;
1098
+ enumValues: [string, ...string[]];
1099
+ baseColumn: never;
1100
+ identity: undefined;
1101
+ generated: undefined;
1102
+ }, {}, {}>;
1103
+ mimeType: import("drizzle-orm/pg-core").PgColumn<{
1104
+ name: "mime_type";
1105
+ tableName: "contract_attachments";
1106
+ dataType: "string";
1107
+ columnType: "PgText";
1108
+ data: string;
1109
+ driverParam: string;
1110
+ notNull: false;
1111
+ hasDefault: false;
1112
+ isPrimaryKey: false;
1113
+ isAutoincrement: false;
1114
+ hasRuntimeDefault: false;
1115
+ enumValues: [string, ...string[]];
1116
+ baseColumn: never;
1117
+ identity: undefined;
1118
+ generated: undefined;
1119
+ }, {}, {}>;
1120
+ fileSize: import("drizzle-orm/pg-core").PgColumn<{
1121
+ name: "file_size";
1122
+ tableName: "contract_attachments";
1123
+ dataType: "number";
1124
+ columnType: "PgInteger";
1125
+ data: number;
1126
+ driverParam: string | number;
1127
+ notNull: false;
1128
+ hasDefault: false;
1129
+ isPrimaryKey: false;
1130
+ isAutoincrement: false;
1131
+ hasRuntimeDefault: false;
1132
+ enumValues: undefined;
1133
+ baseColumn: never;
1134
+ identity: undefined;
1135
+ generated: undefined;
1136
+ }, {}, {}>;
1137
+ storageKey: import("drizzle-orm/pg-core").PgColumn<{
1138
+ name: "storage_key";
1139
+ tableName: "contract_attachments";
1140
+ dataType: "string";
1141
+ columnType: "PgText";
1142
+ data: string;
1143
+ driverParam: string;
1144
+ notNull: false;
1145
+ hasDefault: false;
1146
+ isPrimaryKey: false;
1147
+ isAutoincrement: false;
1148
+ hasRuntimeDefault: false;
1149
+ enumValues: [string, ...string[]];
1150
+ baseColumn: never;
1151
+ identity: undefined;
1152
+ generated: undefined;
1153
+ }, {}, {}>;
1154
+ checksum: import("drizzle-orm/pg-core").PgColumn<{
1155
+ name: "checksum";
1156
+ tableName: "contract_attachments";
1157
+ dataType: "string";
1158
+ columnType: "PgText";
1159
+ data: string;
1160
+ driverParam: string;
1161
+ notNull: false;
1162
+ hasDefault: false;
1163
+ isPrimaryKey: false;
1164
+ isAutoincrement: false;
1165
+ hasRuntimeDefault: false;
1166
+ enumValues: [string, ...string[]];
1167
+ baseColumn: never;
1168
+ identity: undefined;
1169
+ generated: undefined;
1170
+ }, {}, {}>;
1171
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
1172
+ name: "metadata";
1173
+ tableName: "contract_attachments";
1174
+ dataType: "json";
1175
+ columnType: "PgJsonb";
1176
+ data: unknown;
1177
+ driverParam: unknown;
1178
+ notNull: false;
1179
+ hasDefault: false;
1180
+ isPrimaryKey: false;
1181
+ isAutoincrement: false;
1182
+ hasRuntimeDefault: false;
1183
+ enumValues: undefined;
1184
+ baseColumn: never;
1185
+ identity: undefined;
1186
+ generated: undefined;
1187
+ }, {}, {}>;
1188
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
1189
+ name: "created_at";
1190
+ tableName: "contract_attachments";
1191
+ dataType: "date";
1192
+ columnType: "PgTimestamp";
1193
+ data: Date;
1194
+ driverParam: string;
1195
+ notNull: true;
1196
+ hasDefault: true;
1197
+ isPrimaryKey: false;
1198
+ isAutoincrement: false;
1199
+ hasRuntimeDefault: false;
1200
+ enumValues: undefined;
1201
+ baseColumn: never;
1202
+ identity: undefined;
1203
+ generated: undefined;
1204
+ }, {}, {}>;
1205
+ }>, "where" | "orderBy">;
1206
+ createAttachment(db: PostgresJsDatabase, contractId: string, data: CreateContractAttachmentInput): Promise<{
1207
+ id: string;
1208
+ name: string;
1209
+ createdAt: Date;
1210
+ kind: string;
1211
+ metadata: unknown;
1212
+ contractId: string;
1213
+ mimeType: string | null;
1214
+ fileSize: number | null;
1215
+ storageKey: string | null;
1216
+ checksum: string | null;
1217
+ } | null>;
1218
+ updateAttachment(db: PostgresJsDatabase, attachmentId: string, data: UpdateContractAttachmentInput): Promise<{
1219
+ id: string;
1220
+ contractId: string;
1221
+ kind: string;
1222
+ name: string;
1223
+ mimeType: string | null;
1224
+ fileSize: number | null;
1225
+ storageKey: string | null;
1226
+ checksum: string | null;
1227
+ metadata: unknown;
1228
+ createdAt: Date;
1229
+ } | null>;
1230
+ deleteAttachment(db: PostgresJsDatabase, attachmentId: string): Promise<{
1231
+ id: string;
1232
+ } | null>;
1233
+ };
1234
+ //# sourceMappingURL=service-contracts.d.ts.map