pay-lobster 1.0.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/README.md +401 -0
- package/README.md.bak +401 -0
- package/dist/agent.d.ts +132 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +224 -0
- package/dist/agent.js.map +1 -0
- package/dist/analytics.d.ts +120 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +345 -0
- package/dist/analytics.js.map +1 -0
- package/dist/approvals.d.ts +168 -0
- package/dist/approvals.d.ts.map +1 -0
- package/dist/approvals.js +406 -0
- package/dist/approvals.js.map +1 -0
- package/dist/circle-client.d.ts +152 -0
- package/dist/circle-client.d.ts.map +1 -0
- package/dist/circle-client.js +266 -0
- package/dist/circle-client.js.map +1 -0
- package/dist/commission.d.ts +191 -0
- package/dist/commission.d.ts.map +1 -0
- package/dist/commission.js +475 -0
- package/dist/commission.js.map +1 -0
- package/dist/condition-builder.d.ts +98 -0
- package/dist/condition-builder.d.ts.map +1 -0
- package/dist/condition-builder.js +193 -0
- package/dist/condition-builder.js.map +1 -0
- package/dist/contacts.d.ts +179 -0
- package/dist/contacts.d.ts.map +1 -0
- package/dist/contacts.js +445 -0
- package/dist/contacts.js.map +1 -0
- package/dist/easy.d.ts +22 -0
- package/dist/easy.d.ts.map +1 -0
- package/dist/easy.js +40 -0
- package/dist/easy.js.map +1 -0
- package/dist/erc8004/constants.d.ts +152 -0
- package/dist/erc8004/constants.d.ts.map +1 -0
- package/dist/erc8004/constants.js +114 -0
- package/dist/erc8004/constants.js.map +1 -0
- package/dist/erc8004/discovery.d.ts +84 -0
- package/dist/erc8004/discovery.d.ts.map +1 -0
- package/dist/erc8004/discovery.js +217 -0
- package/dist/erc8004/discovery.js.map +1 -0
- package/dist/erc8004/identity.d.ts +91 -0
- package/dist/erc8004/identity.d.ts.map +1 -0
- package/dist/erc8004/identity.js +250 -0
- package/dist/erc8004/identity.js.map +1 -0
- package/dist/erc8004/index.d.ts +147 -0
- package/dist/erc8004/index.d.ts.map +1 -0
- package/dist/erc8004/index.js +225 -0
- package/dist/erc8004/index.js.map +1 -0
- package/dist/erc8004/reputation.d.ts +133 -0
- package/dist/erc8004/reputation.d.ts.map +1 -0
- package/dist/erc8004/reputation.js +277 -0
- package/dist/erc8004/reputation.js.map +1 -0
- package/dist/escrow-templates.d.ts +38 -0
- package/dist/escrow-templates.d.ts.map +1 -0
- package/dist/escrow-templates.js +419 -0
- package/dist/escrow-templates.js.map +1 -0
- package/dist/escrow.d.ts +320 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +854 -0
- package/dist/escrow.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/invoices.d.ts +212 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/invoices.js +393 -0
- package/dist/invoices.js.map +1 -0
- package/dist/notifications.d.ts +141 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +350 -0
- package/dist/notifications.js.map +1 -0
- package/dist/tips.d.ts +171 -0
- package/dist/tips.d.ts.map +1 -0
- package/dist/tips.js +390 -0
- package/dist/tips.js.map +1 -0
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/x402-client.d.ts +127 -0
- package/dist/x402-client.d.ts.map +1 -0
- package/dist/x402-client.js +350 -0
- package/dist/x402-client.js.map +1 -0
- package/dist/x402-server.d.ts +133 -0
- package/dist/x402-server.d.ts.map +1 -0
- package/dist/x402-server.js +330 -0
- package/dist/x402-server.js.map +1 -0
- package/lib/agent.ts +273 -0
- package/lib/analytics.ts +474 -0
- package/lib/analytics.ts.bak +474 -0
- package/lib/approvals.ts +585 -0
- package/lib/approvals.ts.bak +585 -0
- package/lib/circle-client.ts +376 -0
- package/lib/circle-client.ts.bak +376 -0
- package/lib/commission.ts +680 -0
- package/lib/commission.ts.bak +680 -0
- package/lib/condition-builder.ts +223 -0
- package/lib/condition-builder.ts.bak +223 -0
- package/lib/contacts.ts +615 -0
- package/lib/contacts.ts.bak +615 -0
- package/lib/easy.ts +46 -0
- package/lib/easy.ts.bak +352 -0
- package/lib/erc8004/constants.ts +175 -0
- package/lib/erc8004/discovery.ts +299 -0
- package/lib/erc8004/identity.ts +327 -0
- package/lib/erc8004/index.ts +285 -0
- package/lib/erc8004/reputation.ts +368 -0
- package/lib/escrow-templates.ts +462 -0
- package/lib/escrow.ts +1216 -0
- package/lib/index.ts +13 -0
- package/lib/invoices.ts +588 -0
- package/lib/notifications.ts +484 -0
- package/lib/tips.ts +570 -0
- package/lib/types.ts +108 -0
- package/lib/x402-client.ts +471 -0
- package/lib/x402-server.ts +462 -0
- package/package.json +58 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Condition Builder
|
|
3
|
+
*
|
|
4
|
+
* Fluent API for building custom escrow release conditions.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import crypto from 'crypto';
|
|
8
|
+
|
|
9
|
+
export type ConditionType =
|
|
10
|
+
// Real Estate
|
|
11
|
+
| 'inspection' | 'financing' | 'appraisal' | 'title' | 'closing' | 'move_out'
|
|
12
|
+
// Freelance/Milestones
|
|
13
|
+
| 'milestone' | 'delivery' | 'approval' | 'revision'
|
|
14
|
+
// Commerce
|
|
15
|
+
| 'shipping' | 'receipt' | 'verification'
|
|
16
|
+
// Document/Time-based
|
|
17
|
+
| 'document' | 'deadline'
|
|
18
|
+
// Custom
|
|
19
|
+
| 'custom';
|
|
20
|
+
|
|
21
|
+
export interface BuiltCondition {
|
|
22
|
+
id: string;
|
|
23
|
+
description: string;
|
|
24
|
+
type: ConditionType;
|
|
25
|
+
status: 'pending' | 'satisfied' | 'waived' | 'failed';
|
|
26
|
+
deadline?: string;
|
|
27
|
+
releaseAmount?: string;
|
|
28
|
+
releasePercentage?: string;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Fluent builder for escrow conditions
|
|
34
|
+
*/
|
|
35
|
+
export class ConditionBuilder {
|
|
36
|
+
/**
|
|
37
|
+
* Create a milestone condition (with optional partial release)
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ConditionBuilder.milestone('Design approved', 25)
|
|
41
|
+
* // Releases 25% when satisfied
|
|
42
|
+
*/
|
|
43
|
+
static milestone(description: string, releasePercent?: number): BuiltCondition {
|
|
44
|
+
return {
|
|
45
|
+
id: crypto.randomUUID(),
|
|
46
|
+
description,
|
|
47
|
+
type: 'milestone',
|
|
48
|
+
status: 'pending',
|
|
49
|
+
...(releasePercent !== undefined && { releasePercentage: releasePercent.toString() }),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Create an approval condition (requires specific party approval)
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ConditionBuilder.approval('client')
|
|
58
|
+
*/
|
|
59
|
+
static approval(fromRole: string, description?: string): BuiltCondition {
|
|
60
|
+
return {
|
|
61
|
+
id: crypto.randomUUID(),
|
|
62
|
+
description: description || `Approval required from ${fromRole}`,
|
|
63
|
+
type: 'approval',
|
|
64
|
+
status: 'pending',
|
|
65
|
+
metadata: { requiredRole: fromRole },
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Create a deadline condition
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ConditionBuilder.deadline(new Date('2026-03-01'), 'Project completion deadline')
|
|
74
|
+
*/
|
|
75
|
+
static deadline(date: Date, description?: string): BuiltCondition {
|
|
76
|
+
return {
|
|
77
|
+
id: crypto.randomUUID(),
|
|
78
|
+
description: description || `Deadline: ${date.toLocaleDateString()}`,
|
|
79
|
+
type: 'deadline',
|
|
80
|
+
status: 'pending',
|
|
81
|
+
deadline: date.toISOString(),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Create a document requirement condition
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ConditionBuilder.document('Signed contract', 'Contract must be signed and uploaded')
|
|
90
|
+
*/
|
|
91
|
+
static document(requiredDoc: string, description?: string): BuiltCondition {
|
|
92
|
+
return {
|
|
93
|
+
id: crypto.randomUUID(),
|
|
94
|
+
description: description || `Document required: ${requiredDoc}`,
|
|
95
|
+
type: 'document',
|
|
96
|
+
status: 'pending',
|
|
97
|
+
metadata: { requiredDocument: requiredDoc },
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Create a delivery condition
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ConditionBuilder.delivery('Final deliverables submitted')
|
|
106
|
+
*/
|
|
107
|
+
static delivery(description: string, releasePercent?: number): BuiltCondition {
|
|
108
|
+
return {
|
|
109
|
+
id: crypto.randomUUID(),
|
|
110
|
+
description,
|
|
111
|
+
type: 'delivery',
|
|
112
|
+
status: 'pending',
|
|
113
|
+
...(releasePercent !== undefined && { releasePercentage: releasePercent.toString() }),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create a shipping condition
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ConditionBuilder.shipping('Item shipped with tracking')
|
|
122
|
+
*/
|
|
123
|
+
static shipping(description: string): BuiltCondition {
|
|
124
|
+
return {
|
|
125
|
+
id: crypto.randomUUID(),
|
|
126
|
+
description,
|
|
127
|
+
type: 'shipping',
|
|
128
|
+
status: 'pending',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Create a receipt/confirmation condition
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ConditionBuilder.receipt('Buyer confirms receipt of goods')
|
|
137
|
+
*/
|
|
138
|
+
static receipt(description: string): BuiltCondition {
|
|
139
|
+
return {
|
|
140
|
+
id: crypto.randomUUID(),
|
|
141
|
+
description,
|
|
142
|
+
type: 'receipt',
|
|
143
|
+
status: 'pending',
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Create a verification condition
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ConditionBuilder.verification('Both parties confirm deposit')
|
|
152
|
+
*/
|
|
153
|
+
static verification(description: string): BuiltCondition {
|
|
154
|
+
return {
|
|
155
|
+
id: crypto.randomUUID(),
|
|
156
|
+
description,
|
|
157
|
+
type: 'verification',
|
|
158
|
+
status: 'pending',
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Create a custom condition
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ConditionBuilder.custom('SLA requirements met', { slaLevel: 'premium' })
|
|
167
|
+
*/
|
|
168
|
+
static custom(description: string, metadata?: Record<string, any>): BuiltCondition {
|
|
169
|
+
return {
|
|
170
|
+
id: crypto.randomUUID(),
|
|
171
|
+
description,
|
|
172
|
+
type: 'custom',
|
|
173
|
+
status: 'pending',
|
|
174
|
+
metadata,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Create a real estate inspection condition
|
|
180
|
+
*/
|
|
181
|
+
static inspection(description: string, deadlineDays?: number): BuiltCondition {
|
|
182
|
+
const deadline = deadlineDays
|
|
183
|
+
? new Date(Date.now() + deadlineDays * 24 * 60 * 60 * 1000).toISOString()
|
|
184
|
+
: undefined;
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
id: crypto.randomUUID(),
|
|
188
|
+
description,
|
|
189
|
+
type: 'inspection',
|
|
190
|
+
status: 'pending',
|
|
191
|
+
...(deadline && { deadline }),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Create a financing condition
|
|
197
|
+
*/
|
|
198
|
+
static financing(description: string, deadlineDays?: number): BuiltCondition {
|
|
199
|
+
const deadline = deadlineDays
|
|
200
|
+
? new Date(Date.now() + deadlineDays * 24 * 60 * 60 * 1000).toISOString()
|
|
201
|
+
: undefined;
|
|
202
|
+
|
|
203
|
+
return {
|
|
204
|
+
id: crypto.randomUUID(),
|
|
205
|
+
description,
|
|
206
|
+
type: 'financing',
|
|
207
|
+
status: 'pending',
|
|
208
|
+
...(deadline && { deadline }),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Create a title condition
|
|
214
|
+
*/
|
|
215
|
+
static title(description: string): BuiltCondition {
|
|
216
|
+
return {
|
|
217
|
+
id: crypto.randomUUID(),
|
|
218
|
+
description,
|
|
219
|
+
type: 'title',
|
|
220
|
+
status: 'pending',
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Condition Builder
|
|
3
|
+
*
|
|
4
|
+
* Fluent API for building custom escrow release conditions.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import crypto from 'crypto';
|
|
8
|
+
|
|
9
|
+
export type ConditionType =
|
|
10
|
+
// Real Estate
|
|
11
|
+
| 'inspection' | 'financing' | 'appraisal' | 'title' | 'closing' | 'move_out'
|
|
12
|
+
// Freelance/Milestones
|
|
13
|
+
| 'milestone' | 'delivery' | 'approval' | 'revision'
|
|
14
|
+
// Commerce
|
|
15
|
+
| 'shipping' | 'receipt' | 'verification'
|
|
16
|
+
// Document/Time-based
|
|
17
|
+
| 'document' | 'deadline'
|
|
18
|
+
// Custom
|
|
19
|
+
| 'custom';
|
|
20
|
+
|
|
21
|
+
export interface BuiltCondition {
|
|
22
|
+
id: string;
|
|
23
|
+
description: string;
|
|
24
|
+
type: ConditionType;
|
|
25
|
+
status: 'pending' | 'satisfied' | 'waived' | 'failed';
|
|
26
|
+
deadline?: string;
|
|
27
|
+
releaseAmount?: string;
|
|
28
|
+
releasePercentage?: string;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Fluent builder for escrow conditions
|
|
34
|
+
*/
|
|
35
|
+
export class ConditionBuilder {
|
|
36
|
+
/**
|
|
37
|
+
* Create a milestone condition (with optional partial release)
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ConditionBuilder.milestone('Design approved', 25)
|
|
41
|
+
* // Releases 25% when satisfied
|
|
42
|
+
*/
|
|
43
|
+
static milestone(description: string, releasePercent?: number): BuiltCondition {
|
|
44
|
+
return {
|
|
45
|
+
id: crypto.randomUUID(),
|
|
46
|
+
description,
|
|
47
|
+
type: 'milestone',
|
|
48
|
+
status: 'pending',
|
|
49
|
+
...(releasePercent !== undefined && { releasePercentage: releasePercent.toString() }),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Create an approval condition (requires specific party approval)
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ConditionBuilder.approval('client')
|
|
58
|
+
*/
|
|
59
|
+
static approval(fromRole: string, description?: string): BuiltCondition {
|
|
60
|
+
return {
|
|
61
|
+
id: crypto.randomUUID(),
|
|
62
|
+
description: description || `Approval required from ${fromRole}`,
|
|
63
|
+
type: 'approval',
|
|
64
|
+
status: 'pending',
|
|
65
|
+
metadata: { requiredRole: fromRole },
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Create a deadline condition
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ConditionBuilder.deadline(new Date('2026-03-01'), 'Project completion deadline')
|
|
74
|
+
*/
|
|
75
|
+
static deadline(date: Date, description?: string): BuiltCondition {
|
|
76
|
+
return {
|
|
77
|
+
id: crypto.randomUUID(),
|
|
78
|
+
description: description || `Deadline: ${date.toLocaleDateString()}`,
|
|
79
|
+
type: 'deadline',
|
|
80
|
+
status: 'pending',
|
|
81
|
+
deadline: date.toISOString(),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Create a document requirement condition
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ConditionBuilder.document('Signed contract', 'Contract must be signed and uploaded')
|
|
90
|
+
*/
|
|
91
|
+
static document(requiredDoc: string, description?: string): BuiltCondition {
|
|
92
|
+
return {
|
|
93
|
+
id: crypto.randomUUID(),
|
|
94
|
+
description: description || `Document required: ${requiredDoc}`,
|
|
95
|
+
type: 'document',
|
|
96
|
+
status: 'pending',
|
|
97
|
+
metadata: { requiredDocument: requiredDoc },
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Create a delivery condition
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ConditionBuilder.delivery('Final deliverables submitted')
|
|
106
|
+
*/
|
|
107
|
+
static delivery(description: string, releasePercent?: number): BuiltCondition {
|
|
108
|
+
return {
|
|
109
|
+
id: crypto.randomUUID(),
|
|
110
|
+
description,
|
|
111
|
+
type: 'delivery',
|
|
112
|
+
status: 'pending',
|
|
113
|
+
...(releasePercent !== undefined && { releasePercentage: releasePercent.toString() }),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create a shipping condition
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ConditionBuilder.shipping('Item shipped with tracking')
|
|
122
|
+
*/
|
|
123
|
+
static shipping(description: string): BuiltCondition {
|
|
124
|
+
return {
|
|
125
|
+
id: crypto.randomUUID(),
|
|
126
|
+
description,
|
|
127
|
+
type: 'shipping',
|
|
128
|
+
status: 'pending',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Create a receipt/confirmation condition
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ConditionBuilder.receipt('Buyer confirms receipt of goods')
|
|
137
|
+
*/
|
|
138
|
+
static receipt(description: string): BuiltCondition {
|
|
139
|
+
return {
|
|
140
|
+
id: crypto.randomUUID(),
|
|
141
|
+
description,
|
|
142
|
+
type: 'receipt',
|
|
143
|
+
status: 'pending',
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Create a verification condition
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ConditionBuilder.verification('Both parties confirm deposit')
|
|
152
|
+
*/
|
|
153
|
+
static verification(description: string): BuiltCondition {
|
|
154
|
+
return {
|
|
155
|
+
id: crypto.randomUUID(),
|
|
156
|
+
description,
|
|
157
|
+
type: 'verification',
|
|
158
|
+
status: 'pending',
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Create a custom condition
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ConditionBuilder.custom('SLA requirements met', { slaLevel: 'premium' })
|
|
167
|
+
*/
|
|
168
|
+
static custom(description: string, metadata?: Record<string, any>): BuiltCondition {
|
|
169
|
+
return {
|
|
170
|
+
id: crypto.randomUUID(),
|
|
171
|
+
description,
|
|
172
|
+
type: 'custom',
|
|
173
|
+
status: 'pending',
|
|
174
|
+
metadata,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Create a real estate inspection condition
|
|
180
|
+
*/
|
|
181
|
+
static inspection(description: string, deadlineDays?: number): BuiltCondition {
|
|
182
|
+
const deadline = deadlineDays
|
|
183
|
+
? new Date(Date.now() + deadlineDays * 24 * 60 * 60 * 1000).toISOString()
|
|
184
|
+
: undefined;
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
id: crypto.randomUUID(),
|
|
188
|
+
description,
|
|
189
|
+
type: 'inspection',
|
|
190
|
+
status: 'pending',
|
|
191
|
+
...(deadline && { deadline }),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Create a financing condition
|
|
197
|
+
*/
|
|
198
|
+
static financing(description: string, deadlineDays?: number): BuiltCondition {
|
|
199
|
+
const deadline = deadlineDays
|
|
200
|
+
? new Date(Date.now() + deadlineDays * 24 * 60 * 60 * 1000).toISOString()
|
|
201
|
+
: undefined;
|
|
202
|
+
|
|
203
|
+
return {
|
|
204
|
+
id: crypto.randomUUID(),
|
|
205
|
+
description,
|
|
206
|
+
type: 'financing',
|
|
207
|
+
status: 'pending',
|
|
208
|
+
...(deadline && { deadline }),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Create a title condition
|
|
214
|
+
*/
|
|
215
|
+
static title(description: string): BuiltCondition {
|
|
216
|
+
return {
|
|
217
|
+
id: crypto.randomUUID(),
|
|
218
|
+
description,
|
|
219
|
+
type: 'title',
|
|
220
|
+
status: 'pending',
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|