@eversa/node 0.0.0-stage → 1.0.0-rc.2

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.js ADDED
@@ -0,0 +1,3166 @@
1
+ import { createHmac, timingSafeEqual } from "node:crypto";
2
+ // src/guard.ts
3
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4
+ const isString = (value) => typeof value === "string";
5
+ const isNumber = (value) => typeof value === "number";
6
+ const isBoolean = (value) => typeof value === "boolean";
7
+ const isNull = (value) => value === null;
8
+ const literal = (...values) => (value) => values.some((known) => known === value);
9
+ /** A public id: its prefix's type, checked against its whole pattern. */
10
+ const id = (_prefix, pattern) => (value) => typeof value === "string" && pattern.test(value);
11
+ const array = (item) => (value) => Array.isArray(value) && value.every((element) => item(element));
12
+ const record = (item) => (value) => isRecord(value) && Object.values(value).every(item);
13
+ const union = (...guards) => (value) => guards.some((guard) => guard(value));
14
+ /** A check named before it is defined, so two schemas may name each other. */
15
+ const lazy = (guard) => (value) => guard()(value);
16
+ const required = (guard) => ({
17
+ guard,
18
+ required: true
19
+ });
20
+ const optional = (guard) => ({
21
+ guard,
22
+ required: false
23
+ });
24
+ /** An object with each field as its check says; a member the check does not name is let through. */
25
+ const object = (fields) => (value) => isRecord(value) && Object.entries(fields).every(([name, field]) => name in value ? field.guard(value[name]) : !field.required);
26
+ // src/generated/guards.ts
27
+ const ValidationFailedProblem = object({
28
+ type: required(literal("https://eversa.app/problems/validation-failed")),
29
+ title: required(isString),
30
+ status: required(literal(422)),
31
+ detail: required(isString),
32
+ errors: required(array(lazy(() => ProblemError)))
33
+ });
34
+ const ProblemError = object({
35
+ code: required(lazy(() => ProblemErrorCode)),
36
+ detail: required(isString),
37
+ pointer: optional(union(isString, isNull)),
38
+ parameter: optional(union(isString, isNull))
39
+ });
40
+ const ProblemErrorCode = union(literal("invalid", "not_found"), isString);
41
+ const MalformedRequestProblem = object({
42
+ type: required(literal("https://eversa.app/problems/malformed-request")),
43
+ title: required(isString),
44
+ status: required(literal(400)),
45
+ detail: required(isString),
46
+ errors: required(array(lazy(() => ProblemError)))
47
+ });
48
+ const InsufficientScopeProblem = object({
49
+ type: required(literal("https://eversa.app/problems/insufficient-scope")),
50
+ title: required(isString),
51
+ status: required(literal(403)),
52
+ detail: required(isString),
53
+ scope: required(lazy(() => Permission))
54
+ });
55
+ const Permission = union(literal("organization:read", "organization:manage", "members:read", "members:manage", "apps:read", "apps:manage", "api_keys:read", "api_keys:manage", "access_reviews:manage", "billing:read", "billing:manage", "properties:read", "properties:write", "applications:read", "applications:write", "decisions:write", "screenings:read", "screenings:write", "reports:read", "documents:read", "documents:read_sensitive", "events:read", "applicants:assist", "webhooks:manage", "privacy:read", "privacy:manage", "messages:read", "messages:write", "eversa:organizations:read", "eversa:organizations:manage", "eversa:staff:manage", "eversa:access_reviews:manage", "eversa:customer_data:read", "eversa:reference_checks:perform", "eversa:subscriptions:read", "eversa:subscriptions:manage", "eversa:prices:manage", "eversa:refunds:issue", "eversa:evidence:open", "eversa:privacy:erase", "eversa:users:find", "eversa:audit:read", "eversa:checks:review"), isString);
56
+ const SessionRequiredProblem = object({
57
+ type: required(literal("https://eversa.app/problems/session-required")),
58
+ title: required(isString),
59
+ status: required(literal(401)),
60
+ detail: required(isString)
61
+ });
62
+ const CheckStatus = literal("queued", "processing", "on_hold", "waiting", "needs_review", "completed", "failed", "canceled");
63
+ const Check$1 = object({
64
+ object: required(literal("check")),
65
+ id: required(id("chk", /^chk_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
66
+ livemode: required(isBoolean),
67
+ screeningId: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
68
+ type: required(union(lazy(() => CheckKind), isString)),
69
+ reference: optional(union(lazy(() => ReferenceKind), isString)),
70
+ status: required(union(lazy(() => CheckStatus), isString)),
71
+ holdReason: optional(lazy(() => HoldReason)),
72
+ result: optional(lazy(() => CheckResult)),
73
+ payer: required(union(lazy(() => PayerKind), isString)),
74
+ price: required(lazy(() => Amount)),
75
+ charges: required(array(lazy(() => CheckCharge$1))),
76
+ consentId: optional(id("cns", /^cns_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
77
+ options: optional(object({
78
+ includeMunicipal: optional(isBoolean),
79
+ depth: optional(union(lazy(() => SearchDepth), isString)),
80
+ jurisdictions: optional(array(lazy(() => Jurisdiction)))
81
+ })),
82
+ attempts: required(isNumber),
83
+ requestedAt: required(isString),
84
+ startedAt: optional(isString),
85
+ completedAt: optional(isString),
86
+ reviewedAt: optional(isString),
87
+ failureNote: optional(isString),
88
+ failureReason: optional(lazy(() => CheckFailureReason)),
89
+ canceled: optional(lazy(() => CheckCanceled)),
90
+ createdAt: required(isString),
91
+ updatedAt: required(isString)
92
+ });
93
+ const CheckCanceled = object({
94
+ at: required(isString),
95
+ by: required(lazy(() => Actor)),
96
+ reason: required(lazy(() => CheckCanceledReason))
97
+ });
98
+ const CheckCanceledReason = union(literal("added_by_mistake", "no_longer_needed", "other", "consent_withdrawn", "consent_expired"), isString);
99
+ const Actor = union(lazy(() => ActorMember), lazy(() => ActorApiKey), lazy(() => ActorApplicant), lazy(() => ActorPerson), lazy(() => ActorPlatform));
100
+ const ActorVia = union(literal("api", "embed", "hosted", "backoffice", "mcp", "system", "assisted"), isString);
101
+ const CheckFailureReason = union(literal("not_configured", "unreachable", "refused", "incomplete", "consent", "stopped", "unstarted", "unknown", "unreadable", "minor", "locked", "review"), isString);
102
+ const Jurisdiction = isString;
103
+ const SearchDepth = literal("standard", "extended");
104
+ const CheckCharge$1 = object({
105
+ attempt: required(isNumber),
106
+ price: required(lazy(() => Amount)),
107
+ chargedAt: required(isString)
108
+ });
109
+ const Amount = object({
110
+ amount: required(isNumber),
111
+ currency: required(lazy(() => Currency))
112
+ });
113
+ const Currency = literal("AED", "AFN", "ALL", "AMD", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLE", "SOS", "SRD", "SSP", "STN", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "UYI", "UYU", "UYW", "UZS", "VED", "VES", "VND", "VUV", "WST", "XAF", "XCD", "XCG", "XOF", "XPF", "YER", "ZAR", "ZMW", "ZWG");
114
+ const PayerKind = literal("organization", "applicant");
115
+ const CheckResult = union(literal("clear", "warning", "alert"), isString);
116
+ const HoldReason = union(literal("identity_unconfirmed", "identity_unverifiable", "source_locked"), isString);
117
+ const ReferenceKind = literal("workplace", "landlord");
118
+ const CheckKind = literal("credit_report", "criminal_record", "civil_records", "reference", "identity");
119
+ const EmploymentType = literal("full_time", "part_time", "contract", "self_employed", "other");
120
+ const RateLimitedProblem = object({
121
+ type: required(literal("https://eversa.app/problems/rate-limited")),
122
+ title: required(isString),
123
+ status: required(literal(429)),
124
+ detail: required(isString)
125
+ });
126
+ const InvalidApiKeyProblem = object({
127
+ type: required(literal("https://eversa.app/problems/invalid-api-key")),
128
+ title: required(isString),
129
+ status: required(literal(401)),
130
+ detail: required(isString)
131
+ });
132
+ const Organization$1 = object({
133
+ object: required(literal("organization")),
134
+ id: required(id("org", /^org_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
135
+ name: required(isString),
136
+ slug: required(isString),
137
+ locale: required(union(lazy(() => OrganizationLocale), isString)),
138
+ createdAt: required(isString),
139
+ updatedAt: required(isString)
140
+ });
141
+ const OrganizationLocale = literal("fr-CA", "en-CA");
142
+ const MemberNotFoundProblem = object({
143
+ type: required(literal("https://eversa.app/problems/member-not-found")),
144
+ title: required(isString),
145
+ status: required(literal(404)),
146
+ detail: required(isString),
147
+ objectId: required(id("usr", /^usr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
148
+ });
149
+ const Member$1 = object({
150
+ object: required(literal("member")),
151
+ id: required(id("usr", /^usr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
152
+ name: required(isString),
153
+ email: optional(isString),
154
+ role: required(union(literal("owner", "admin", "billing", "staff", "agent"), isString)),
155
+ createdAt: required(isString),
156
+ updatedAt: required(isString)
157
+ });
158
+ const MemberList$1 = object({
159
+ object: required(literal("list")),
160
+ data: required(array(lazy(() => Member$1))),
161
+ hasMore: required(isBoolean),
162
+ nextCursor: required(union(id("usr", /^usr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
163
+ });
164
+ const CallingApiKey$1 = object({
165
+ object: required(literal("api_key")),
166
+ id: required(id("key", /^key_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
167
+ kind: required(union(literal("secret", "restricted"), isString)),
168
+ name: required(union(isString, isNull)),
169
+ start: required(isString),
170
+ last4: required(isString),
171
+ scope: required(array(union(literal("organization:read", "organization:manage", "members:read", "members:manage", "apps:read", "apps:manage", "api_keys:read", "api_keys:manage", "access_reviews:manage", "billing:read", "billing:manage", "properties:read", "properties:write", "applications:read", "applications:write", "decisions:write", "screenings:read", "screenings:write", "reports:read", "documents:read", "documents:read_sensitive", "events:read", "applicants:assist", "webhooks:manage", "privacy:read", "privacy:manage", "messages:read", "messages:write"), isString))),
172
+ livemode: required(isBoolean),
173
+ expiresAt: required(union(isString, isNull)),
174
+ createdAt: required(isString),
175
+ updatedAt: required(isString),
176
+ lastUsedAt: required(union(isString, isNull)),
177
+ app: required(id("env", /^env_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
178
+ rateLimit: required(union(lazy(() => KeyRateLimit), isNull))
179
+ });
180
+ const KeyRateLimit = object({
181
+ quota: required(isNumber),
182
+ window: required(isNumber)
183
+ });
184
+ const PersonField = union(literal("name", "prior_names", "date_of_birth", "email", "address", "previous_addresses", "living_arrangement", "residence_duration", "references"), isString);
185
+ const DocumentSubtype = literal("passport", "drivers_licence", "provincial_photo_id", "permanent_resident_card", "work_permit", "study_permit", "other_government_id", "pay_stub", "employment_letter", "bank_statement", "notice_of_assessment", "tax_return", "benefits_statement", "student_financial_aid", "self_employment", "pension", "guarantor_income", "t4_slip", "investment_statement", "scholarship_letter", "transfer_proof", "situation_attestation", "other");
186
+ const DocumentKind = literal("identity", "income", "enrollment", "application_form", "consent", "reference", "other");
187
+ const PerformableBy = literal("applicant", "organization", "either");
188
+ const RequirementAddressee$1 = union(lazy(() => RequirementAddresseeOrganization), lazy(() => RequirementAddresseeApplicant), lazy(() => RequirementAddresseePerson));
189
+ const RequirementStatus = literal("open", "answered", "in_review", "resolved", "expired", "canceled");
190
+ const RequirementParent = union(lazy(() => RequirementParentScreening), lazy(() => RequirementParentApplication));
191
+ const RequirementTransitionRefusedProblem = object({
192
+ type: required(literal("https://eversa.app/problems/requirement-transition-refused")),
193
+ title: required(isString),
194
+ status: required(literal(409)),
195
+ detail: required(isString),
196
+ objectId: required(id("req", /^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
197
+ from: required(union(lazy(() => RequirementStatus), isString)),
198
+ toStatus: required(union(lazy(() => RequirementStatus), isString)),
199
+ allowed: required(array(union(lazy(() => RequirementStatus), isString)))
200
+ });
201
+ const RequirementNotFoundProblem = object({
202
+ type: required(literal("https://eversa.app/problems/requirement-not-found")),
203
+ title: required(isString),
204
+ status: required(literal(404)),
205
+ detail: required(isString),
206
+ objectId: required(id("req", /^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
207
+ });
208
+ const ApplicationNotFoundProblem = object({
209
+ type: required(literal("https://eversa.app/problems/application-not-found")),
210
+ title: required(isString),
211
+ status: required(literal(404)),
212
+ detail: required(isString),
213
+ objectId: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
214
+ });
215
+ const Requirement$1 = object({
216
+ object: required(literal("requirement")),
217
+ id: required(id("req", /^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
218
+ livemode: required(isBoolean),
219
+ parent: required(lazy(() => RequirementParent)),
220
+ kind: required(isString),
221
+ status: required(union(lazy(() => RequirementStatus), isString)),
222
+ requestedBy: required(lazy(() => Actor)),
223
+ addressedTo: required(lazy(() => RequirementAddressee$1)),
224
+ performableBy: required(union(lazy(() => PerformableBy), isString)),
225
+ message: required(isString),
226
+ options: optional(array(object({
227
+ code: required(isString),
228
+ label: required(isString)
229
+ }))),
230
+ documentKinds: optional(array(object({
231
+ kind: required(union(lazy(() => DocumentKind), isString)),
232
+ subtype: optional(union(lazy(() => DocumentSubtype), isString))
233
+ }))),
234
+ checkId: optional(id("chk", /^chk_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
235
+ personFields: optional(array(lazy(() => PersonField))),
236
+ formStep: optional(isString),
237
+ dueAt: optional(isString),
238
+ answer: optional(lazy(() => RequirementAnswer$1)),
239
+ review: optional(lazy(() => RequirementReview)),
240
+ createdAt: required(isString),
241
+ updatedAt: required(isString),
242
+ resolvedAt: optional(isString),
243
+ canceled: optional(object({
244
+ at: required(isString),
245
+ by: required(lazy(() => Actor)),
246
+ reason: required(lazy(() => RequirementCanceledReason)),
247
+ note: optional(isString)
248
+ }))
249
+ });
250
+ const RequirementCanceledReason = union(literal("no_longer_needed", "other", "offer_withdrawn"), isString);
251
+ const RequirementReview = object({
252
+ at: required(isString),
253
+ by: required(lazy(() => Actor)),
254
+ outcome: required(union(lazy(() => RequirementReviewOutcome), isString)),
255
+ note: optional(isString)
256
+ });
257
+ const RequirementReviewOutcome = literal("accepted", "rejected");
258
+ const RequirementAnswer$1 = object({
259
+ at: required(isString),
260
+ by: required(lazy(() => Actor)),
261
+ onBehalf: required(isBoolean),
262
+ evidence: optional(object({
263
+ method: required(union(lazy(() => EvidenceMethod), isString)),
264
+ reference: optional(isString)
265
+ })),
266
+ option: optional(isString),
267
+ note: optional(isString),
268
+ documents: required(array(id("doc", /^doc_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))),
269
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
270
+ offerTermsHash: optional(isString)
271
+ });
272
+ const EvidenceMethod = literal("phone", "email", "in_person", "hosted");
273
+ const DocumentStatus = literal("awaiting_upload", "received", "processing", "in_review", "verified", "rejected", "replaced");
274
+ const ApplicantDepartedProblem = object({
275
+ type: required(literal("https://eversa.app/problems/applicant-departed")),
276
+ title: required(isString),
277
+ status: required(literal(409)),
278
+ detail: required(isString),
279
+ objectId: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
280
+ applicantStatus: required(lazy(() => ApplicantStatus))
281
+ });
282
+ const ApplicantStatus = union(literal("pending", "invited", "in_progress", "submitted", "expired", "withdrawn", "removed", "rejected"), isString);
283
+ const ApplicationEndedProblem = object({
284
+ type: required(literal("https://eversa.app/problems/application-ended")),
285
+ title: required(isString),
286
+ status: required(literal(409)),
287
+ detail: required(isString),
288
+ objectId: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
289
+ applicationStatus: required(union(lazy(() => ApplicationStatus), isString))
290
+ });
291
+ const ApplicationStatus = literal("awaiting_applicants", "awaiting_requirements", "screening", "awaiting_organization", "ready", "offer_pending", "deferred", "accepted", "closed");
292
+ const RequirementNotPerformableProblem = object({
293
+ type: required(literal("https://eversa.app/problems/requirement-not-performable")),
294
+ title: required(isString),
295
+ status: required(literal(409)),
296
+ detail: required(isString),
297
+ objectId: required(id("req", /^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
298
+ kind: required(isString)
299
+ });
300
+ const ApplicationLimitReachedProblem = object({
301
+ type: required(literal("https://eversa.app/problems/application-limit-reached")),
302
+ title: required(isString),
303
+ status: required(literal(409)),
304
+ detail: required(isString),
305
+ objectId: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
306
+ items: required(union(literal("applicants", "documents", "form_documents", "requirements", "decisions"), isString)),
307
+ maximum: required(isNumber)
308
+ });
309
+ const ApplicantNotFoundProblem = object({
310
+ type: required(literal("https://eversa.app/problems/applicant-not-found")),
311
+ title: required(isString),
312
+ status: required(literal(404)),
313
+ detail: required(isString),
314
+ objectId: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
315
+ });
316
+ const ScreeningNotFoundProblem = object({
317
+ type: required(literal("https://eversa.app/problems/screening-not-found")),
318
+ title: required(isString),
319
+ status: required(literal(404)),
320
+ detail: required(isString),
321
+ objectId: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
322
+ });
323
+ const Screening$1 = object({
324
+ object: required(literal("screening")),
325
+ id: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
326
+ livemode: required(isBoolean),
327
+ externalId: optional(isString),
328
+ status: required(union(lazy(() => ScreeningStatus), isString)),
329
+ partial: required(isBoolean),
330
+ mode: required(lazy(() => ScreeningMode)),
331
+ person: required(lazy(() => PersonSummary$1)),
332
+ checks: required(array(lazy(() => Check$1))),
333
+ checkCounts: required(lazy(() => CheckCounts$1)),
334
+ documents: required(array(lazy(() => Document$1))),
335
+ consents: required(array(lazy(() => Consent$1))),
336
+ requirements: required(array(lazy(() => Requirement$1))),
337
+ payer: required(union(lazy(() => PayerKind), isString)),
338
+ amounts: required(lazy(() => Amounts)),
339
+ createdBy: required(lazy(() => Actor)),
340
+ report: required(object({
341
+ status: required(lazy(() => ReportStatus)),
342
+ url: required(isString)
343
+ })),
344
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
345
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
346
+ completedAt: optional(isString),
347
+ identityConfirmed: optional(lazy(() => IdentityConfirmed)),
348
+ signedForm: optional(lazy(() => SignedForm$1)),
349
+ canceled: optional(lazy(() => ScreeningCanceled)),
350
+ metadata: required(lazy(() => Metadata)),
351
+ createdAt: required(isString),
352
+ updatedAt: required(isString)
353
+ });
354
+ const Metadata = record(isString);
355
+ const ScreeningCanceled = object({
356
+ at: required(isString),
357
+ by: required(lazy(() => Actor)),
358
+ reason: required(union(lazy(() => CancelScreeningReason), isString)),
359
+ note: optional(isString)
360
+ });
361
+ const CancelScreeningReason = literal("no_longer_needed", "duplicate", "withdrawn", "other");
362
+ const SignedForm$1 = object({ collectedAt: required(isString) });
363
+ const IdentityConfirmed = object({
364
+ at: required(isString),
365
+ method: required(union(lazy(() => IdentityConfirmationMethod), isString))
366
+ });
367
+ const IdentityConfirmationMethod = literal("government_id_seen", "known_person", "signature_held");
368
+ const ReportStatus = union(literal("pending", "collecting", "partial", "completed", "completed_degraded", "failed"), isString);
369
+ const Amounts = object({
370
+ total: required(lazy(() => Amount)),
371
+ organization: required(lazy(() => Amount)),
372
+ applicant: required(lazy(() => Amount))
373
+ });
374
+ const Consent$1 = object({
375
+ object: required(literal("consent")),
376
+ id: required(id("cns", /^cns_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
377
+ purpose: required(union(lazy(() => ConsentPurpose), isString)),
378
+ status: required(lazy(() => ConsentStatus)),
379
+ personId: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
380
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
381
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
382
+ screeningId: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
383
+ method: required(lazy(() => ConsentMethod)),
384
+ capturedBy: optional(lazy(() => Actor)),
385
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
386
+ grantedAt: required(isString),
387
+ expiresAt: optional(isString),
388
+ withdrawnAt: optional(isString),
389
+ endedAt: optional(isString),
390
+ textVersion: required(isString),
391
+ locale: required(lazy(() => Locale)),
392
+ receipt: optional(object({
393
+ id: required(isString),
394
+ digest: required(isString),
395
+ origin: optional(isString),
396
+ enElected: optional(isBoolean)
397
+ })),
398
+ attestation: optional(object({
399
+ collectedAt: required(isString),
400
+ method: required(union(lazy(() => AttestationMethod), isString)),
401
+ reference: optional(isString)
402
+ })),
403
+ documentId: optional(id("doc", /^doc_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
404
+ createdAt: required(isString),
405
+ updatedAt: required(isString),
406
+ livemode: required(isBoolean)
407
+ });
408
+ const AttestationMethod = literal("written", "electronic", "verbal_recorded");
409
+ const Locale = union(literal("fr-CA", "en-CA"), isString);
410
+ const ConsentMethod = union(literal("self", "assisted", "attested", "uploaded", "representative"), isString);
411
+ const ConsentStatus = union(literal("granted", "withdrawn", "expired", "ended"), isString);
412
+ const ConsentPurpose = literal("credit", "legal", "references", "identity", "application", "data_sharing", "tips", "insurance_quote");
413
+ const Document$1 = object({
414
+ object: required(literal("document")),
415
+ id: required(id("doc", /^doc_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
416
+ livemode: required(isBoolean),
417
+ kind: required(union(lazy(() => DocumentKind), isString)),
418
+ subtype: optional(union(lazy(() => DocumentSubtype), isString)),
419
+ contentType: required(union(lazy(() => DocumentContentType), isString)),
420
+ filename: optional(isString),
421
+ sizeBytes: optional(isNumber),
422
+ pages: optional(isNumber),
423
+ status: required(union(lazy(() => DocumentStatus), isString)),
424
+ provenance: optional(lazy(() => DocumentProvenance$1)),
425
+ review: optional(lazy(() => DocumentReview)),
426
+ replacedById: optional(id("doc", /^doc_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
427
+ upload: optional(lazy(() => DocumentUpload$1)),
428
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
429
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
430
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
431
+ createdAt: required(isString),
432
+ updatedAt: required(isString)
433
+ });
434
+ const DocumentUpload$1 = object({
435
+ method: required(literal("PUT")),
436
+ url: required(isString),
437
+ headers: required(lazy(() => DocumentUploadHeaders)),
438
+ expiresAt: required(isString)
439
+ });
440
+ const DocumentUploadHeaders = object({
441
+ authorization: required(isString),
442
+ "content-type": required(union(lazy(() => DocumentContentType), isString))
443
+ });
444
+ const DocumentContentType = literal("application/pdf", "image/jpeg", "image/png");
445
+ const DocumentReview = object({
446
+ at: required(isString),
447
+ by: required(lazy(() => Actor)),
448
+ outcome: required(union(lazy(() => DocumentReviewOutcome), isString)),
449
+ note: optional(isString)
450
+ });
451
+ const DocumentReviewOutcome = literal("verified", "rejected");
452
+ const DocumentProvenance$1 = object({
453
+ uploadedBy: required(lazy(() => ProvenanceActor)),
454
+ reused: required(isBoolean),
455
+ originalUploadedAt: optional(isString)
456
+ });
457
+ const ProvenanceActor = object({
458
+ type: required(lazy(() => ActorType)),
459
+ via: required(lazy(() => ActorVia))
460
+ });
461
+ const ActorType = union(literal("member", "api_key", "applicant", "person", "platform"), isString);
462
+ const CheckCounts$1 = object({
463
+ total: required(isNumber),
464
+ queued: required(isNumber),
465
+ processing: required(isNumber),
466
+ onHold: required(isNumber),
467
+ waiting: required(isNumber),
468
+ needsReview: required(isNumber),
469
+ completed: required(isNumber),
470
+ failed: required(isNumber),
471
+ canceled: required(isNumber),
472
+ results: optional(object({
473
+ clear: required(isNumber),
474
+ warning: required(isNumber),
475
+ alert: required(isNumber)
476
+ }))
477
+ });
478
+ const PersonSummary$1 = object({
479
+ object: required(literal("person")),
480
+ id: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
481
+ externalId: optional(isString),
482
+ name: optional(lazy(() => Name)),
483
+ email: optional(isString),
484
+ phone: optional(isString)
485
+ });
486
+ const Name = object({
487
+ given: required(isString),
488
+ family: optional(isString),
489
+ additional: optional(isString)
490
+ });
491
+ const ScreeningMode = union(literal("invite", "manual", "pdf"), isString);
492
+ const ScreeningStatus = literal("pending", "processing", "action_required", "completed", "canceled");
493
+ const ScreeningLimitReachedProblem = object({
494
+ type: required(literal("https://eversa.app/problems/screening-limit-reached")),
495
+ title: required(isString),
496
+ status: required(literal(409)),
497
+ detail: required(isString),
498
+ objectId: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
499
+ items: required(union(literal("checks", "documents", "form_documents", "consents", "requirements"), isString)),
500
+ maximum: required(isNumber)
501
+ });
502
+ const CheckTypeNotServedProblem = object({
503
+ type: required(literal("https://eversa.app/problems/check-type-not-served")),
504
+ title: required(isString),
505
+ status: required(literal(409)),
506
+ detail: required(isString),
507
+ checkType: required(union(lazy(() => CheckKind), isString))
508
+ });
509
+ const CheckTypeNotPricedProblem = object({
510
+ type: required(literal("https://eversa.app/problems/check-type-not-priced")),
511
+ title: required(isString),
512
+ status: required(literal(409)),
513
+ detail: required(isString),
514
+ checkType: required(union(lazy(() => CheckKind), isString))
515
+ });
516
+ const PersonNeedsMissingProblem = object({
517
+ type: required(literal("https://eversa.app/problems/person-needs-missing")),
518
+ title: required(isString),
519
+ status: required(literal(422)),
520
+ detail: required(isString),
521
+ missing: required(array(object({
522
+ type: required(union(lazy(() => CheckKind), isString)),
523
+ field: required(lazy(() => PersonKey))
524
+ })))
525
+ });
526
+ const PersonKey = union(literal("id", "external_id", "name", "prior_names", "date_of_birth", "email", "phone", "address", "previous_addresses", "living_arrangement", "residence_duration", "references"), isString);
527
+ const ExternalIdTakenProblem = object({
528
+ type: required(literal("https://eversa.app/problems/external-id-taken")),
529
+ title: required(isString),
530
+ status: required(literal(409)),
531
+ detail: required(isString),
532
+ externalId: required(isString),
533
+ objectType: required(union(literal("person", "property", "application", "applicant", "screening"), isString)),
534
+ objectId: optional(union(isString, isNull))
535
+ });
536
+ const ResidenceDuration = literal("under_1_year", "1_to_2_years", "2_to_5_years", "over_5_years");
537
+ const LivingArrangement = literal("renting", "owned", "parents", "other");
538
+ const ScreeningList$1 = object({
539
+ object: required(literal("list")),
540
+ data: required(array(lazy(() => ScreeningSummary$1))),
541
+ hasMore: required(isBoolean),
542
+ nextCursor: required(union(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
543
+ });
544
+ const ScreeningSummary$1 = object({
545
+ object: required(literal("screening")),
546
+ id: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
547
+ livemode: required(isBoolean),
548
+ externalId: optional(isString),
549
+ status: required(union(lazy(() => ScreeningStatus), isString)),
550
+ partial: required(isBoolean),
551
+ mode: required(lazy(() => ScreeningMode)),
552
+ person: required(lazy(() => PersonSummary$1)),
553
+ checkCounts: required(lazy(() => CheckCounts$1)),
554
+ payer: required(union(lazy(() => PayerKind), isString)),
555
+ amounts: required(lazy(() => Amounts)),
556
+ report: required(object({
557
+ status: required(lazy(() => ReportStatus)),
558
+ url: required(isString)
559
+ })),
560
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
561
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
562
+ completedAt: optional(isString),
563
+ canceled: optional(lazy(() => ScreeningCanceled)),
564
+ metadata: required(lazy(() => Metadata)),
565
+ createdAt: required(isString),
566
+ updatedAt: required(isString),
567
+ checks: required(array(lazy(() => CheckSummary)))
568
+ });
569
+ const CheckSummary = object({
570
+ object: required(literal("check")),
571
+ id: required(id("chk", /^chk_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
572
+ type: required(union(lazy(() => CheckKind), isString)),
573
+ reference: optional(union(lazy(() => ReferenceKind), isString)),
574
+ status: required(union(lazy(() => CheckStatus), isString)),
575
+ result: optional(lazy(() => CheckResult))
576
+ });
577
+ const PersonNotFoundProblem = object({
578
+ type: required(literal("https://eversa.app/problems/person-not-found")),
579
+ title: required(isString),
580
+ status: required(literal(404)),
581
+ detail: required(isString),
582
+ objectId: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
583
+ });
584
+ const EventActor = union(lazy(() => EventActorMember), lazy(() => EventActorApiKey), lazy(() => EventActorApplicant), lazy(() => EventActorPerson), lazy(() => EventActorPlatform));
585
+ const Person$1 = object({
586
+ object: required(literal("person")),
587
+ id: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
588
+ livemode: required(isBoolean),
589
+ externalId: optional(isString),
590
+ name: optional(lazy(() => Name)),
591
+ priorNames: optional(array(object({
592
+ given: required(isString),
593
+ family: optional(isString),
594
+ additional: optional(isString)
595
+ }))),
596
+ dateOfBirth: optional(isString),
597
+ email: optional(isString),
598
+ phone: optional(isString),
599
+ contactUnavailableReason: optional(isString),
600
+ livingArrangement: optional(union(lazy(() => LivingArrangement), isString)),
601
+ movedIn: optional(isString),
602
+ metadata: required(lazy(() => Metadata)),
603
+ createdAt: required(isString),
604
+ updatedAt: required(isString),
605
+ address: optional(lazy(() => PostalAddress$1)),
606
+ residenceDuration: optional(union(lazy(() => ResidenceDuration), isString)),
607
+ previousAddresses: optional(array(lazy(() => AddressPeriod$1))),
608
+ previousAddressUnavailableReason: optional(isString),
609
+ references: required(lazy(() => References$1))
610
+ });
611
+ const AddressPeriod$1 = object({
612
+ address: required(lazy(() => PostalAddress$1)),
613
+ from: optional(isString),
614
+ to: optional(isString)
615
+ });
616
+ const PersonList$1 = object({
617
+ object: required(literal("list")),
618
+ data: required(array(lazy(() => PersonListItem$1))),
619
+ hasMore: required(isBoolean),
620
+ nextCursor: required(union(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
621
+ });
622
+ const PersonListItem$1 = object({
623
+ object: required(literal("person")),
624
+ id: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
625
+ externalId: optional(isString),
626
+ name: optional(lazy(() => Name)),
627
+ email: optional(isString),
628
+ phone: optional(isString),
629
+ createdAt: required(isString),
630
+ updatedAt: required(isString),
631
+ address: optional(lazy(() => PersonListAddress))
632
+ });
633
+ const PersonListAddress = object({ locality: optional(isString) });
634
+ const ConditionCode = literal("guarantor", "co_applicant", "additional_document", "additional_information", "rent_deposit_where_permitted", "start_date", "other");
635
+ const ApplicationType = literal("residential_lease", "employment");
636
+ const ApplicationTypeUnavailableProblem = object({
637
+ type: required(literal("https://eversa.app/problems/application-type-unavailable")),
638
+ title: required(isString),
639
+ status: required(literal(409)),
640
+ detail: required(isString),
641
+ applicationType: required(union(literal("residential_lease", "employment"), isString))
642
+ });
643
+ const PropertyNotFoundProblem = object({
644
+ type: required(literal("https://eversa.app/problems/property-not-found")),
645
+ title: required(isString),
646
+ status: required(literal(404)),
647
+ detail: required(isString),
648
+ objectId: required(id("prop", /^prop_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
649
+ });
650
+ const Property$1 = object({
651
+ object: required(literal("property")),
652
+ id: required(id("prop", /^prop_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
653
+ livemode: required(isBoolean),
654
+ externalId: optional(isString),
655
+ kind: optional(union(lazy(() => PropertyKind), isString)),
656
+ address: required(lazy(() => PostalAddress$1)),
657
+ rent: optional(lazy(() => Amount)),
658
+ isAffordable: optional(isBoolean),
659
+ rooms: optional(isNumber),
660
+ bedrooms: optional(isNumber),
661
+ bathrooms: optional(isNumber),
662
+ floorArea: optional(lazy(() => FloorArea)),
663
+ parkingSpaces: optional(isNumber),
664
+ archivedAt: optional(isString),
665
+ metadata: required(lazy(() => Metadata)),
666
+ createdAt: required(isString),
667
+ updatedAt: required(isString)
668
+ });
669
+ const FloorArea = object({
670
+ value: required(isNumber),
671
+ unit: required(literal("m2"))
672
+ });
673
+ const PostalAddress$1 = object({
674
+ id: required(id("addr", /^addr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
675
+ regionCode: required(isString),
676
+ languageCode: optional(isString),
677
+ postalCode: optional(isString),
678
+ sortingCode: optional(isString),
679
+ administrativeArea: optional(isString),
680
+ locality: optional(isString),
681
+ sublocality: optional(isString),
682
+ addressLines: required(array(isString))
683
+ });
684
+ const PropertyKind = literal("apartment", "house", "condo", "room", "commercial");
685
+ const PaymentProcessorUnavailableProblem = object({
686
+ type: required(literal("https://eversa.app/problems/payment-processor-unavailable")),
687
+ title: required(isString),
688
+ status: required(literal(503)),
689
+ detail: required(isString)
690
+ });
691
+ const ApplicantPaymentStatus = union(literal("not_required", "pending", "processing", "on_hold", "paid", "refunded", "waived"), isString);
692
+ const Applicant$1 = object({
693
+ object: required(literal("applicant")),
694
+ id: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
695
+ livemode: required(isBoolean),
696
+ applicationId: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
697
+ role: required(isString),
698
+ status: required(lazy(() => ApplicantStatus)),
699
+ externalId: optional(isString),
700
+ person: required(lazy(() => PersonSummary$1)),
701
+ invitedBy: optional(lazy(() => Actor)),
702
+ origin: required(lazy(() => ApplicantOrigin)),
703
+ relation: optional(lazy(() => ApplicantRelation)),
704
+ possibleDuplicateOf: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
705
+ mode: required(lazy(() => ScreeningMode)),
706
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
707
+ delivery: required(lazy(() => ApplicantDelivery)),
708
+ screening: required(object({
709
+ id: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
710
+ status: required(union(lazy(() => ScreeningStatus), isString)),
711
+ partial: required(isBoolean)
712
+ })),
713
+ data: optional(lazy(() => ApplicantData$1)),
714
+ documents: required(array(lazy(() => Document$1))),
715
+ consents: required(array(lazy(() => Consent$1))),
716
+ payment: optional(lazy(() => ApplicantPayment)),
717
+ submittedAt: optional(isString),
718
+ removed: optional(object({
719
+ at: required(isString),
720
+ by: required(lazy(() => Actor)),
721
+ reason: required(lazy(() => RemovedReason))
722
+ })),
723
+ createdAt: required(isString),
724
+ updatedAt: required(isString)
725
+ });
726
+ const RemovedReason = union(literal("withdrawn", "replaced", "added_by_mistake", "rejected", "no_longer_needed", "other", "removed_by_applicant", "merged"), isString);
727
+ const ApplicantPayment = object({
728
+ payer: required(union(lazy(() => PayerKind), isString)),
729
+ status: required(lazy(() => ApplicantPaymentStatus)),
730
+ method: required(lazy(() => PaymentMethod)),
731
+ amount: required(lazy(() => Amount))
732
+ });
733
+ const PaymentMethod = union(literal("card", "recorded"), isString);
734
+ const ApplicantData$1 = object({
735
+ situation: optional(union(lazy(() => ApplicantSituation), isString)),
736
+ residenceHistory: optional(array(lazy(() => AddressPeriod$1))),
737
+ employment: optional(array(object({
738
+ employer: required(isString),
739
+ position: optional(isString),
740
+ type: required(union(lazy(() => EmploymentType), isString)),
741
+ since: optional(isString)
742
+ }))),
743
+ income: optional(array(object({
744
+ source: required(union(lazy(() => IncomeSourceType), isString)),
745
+ amount: required(lazy(() => Amount)),
746
+ frequency: required(union(lazy(() => IncomeFrequency), isString)),
747
+ hoursPerWeek: optional(isNumber),
748
+ paidBy: optional(isString),
749
+ verification: required(lazy(() => IncomeVerification))
750
+ }))),
751
+ references: optional(lazy(() => References$1)),
752
+ currentLandlord: optional(object({
753
+ name: required(isString),
754
+ email: optional(isString),
755
+ phone: optional(isString)
756
+ })),
757
+ currentRent: optional(lazy(() => Amount)),
758
+ livingArrangement: optional(union(lazy(() => LivingArrangement), isString)),
759
+ flags: optional(object({
760
+ newcomer: optional(isBoolean),
761
+ retired: optional(isBoolean),
762
+ student: optional(isBoolean)
763
+ })),
764
+ notifyChannels: optional(object({
765
+ email: optional(isBoolean),
766
+ sms: optional(isBoolean)
767
+ })),
768
+ representative: optional(lazy(() => ApplicantRepresentative$1)),
769
+ residency: optional(object({
770
+ status: required(union(lazy(() => ResidencyStatus), isString)),
771
+ timeInCanada: optional(union(lazy(() => TimeInCanada), isString))
772
+ })),
773
+ situationDetails: optional(object({
774
+ salaried: optional(object({
775
+ annualIncome: optional(lazy(() => Amount)),
776
+ employer: required(isString),
777
+ startedOn: required(isString)
778
+ })),
779
+ selfEmployed: optional(object({
780
+ annualNetIncome: optional(lazy(() => Amount)),
781
+ businessName: required(isString),
782
+ startedOn: required(isString)
783
+ })),
784
+ retired: optional(object({
785
+ annualIncome: optional(lazy(() => Amount)),
786
+ savings: required(lazy(() => Amount))
787
+ })),
788
+ student: optional(object({
789
+ school: required(isString),
790
+ studyLoad: required(union(lazy(() => StudyLoad), isString)),
791
+ fundingSources: required(array(union(lazy(() => FundingSource), isString))),
792
+ fundingOther: optional(isString),
793
+ partTimeIncome: optional(lazy(() => Amount))
794
+ })),
795
+ newcomer: optional(object({
796
+ arrivedOn: required(isString),
797
+ annualIncome: optional(lazy(() => Amount)),
798
+ employer: optional(isString)
799
+ })),
800
+ other: optional(object({
801
+ description: required(isString),
802
+ annualIncome: optional(lazy(() => Amount))
803
+ }))
804
+ })),
805
+ custom: optional(lazy(() => CustomBlock))
806
+ });
807
+ const CustomBlock = record(union(isString, isNumber, isBoolean));
808
+ const FundingSource = literal("government_aid", "scholarship", "part_time_work", "family_support", "savings", "other");
809
+ const StudyLoad = literal("full_time", "part_time");
810
+ const TimeInCanada = literal("under_6_months", "6_to_12_months", "1_to_3_years", "over_3_years");
811
+ const ResidencyStatus = literal("citizen_or_permanent_resident", "other");
812
+ const ApplicantRepresentative$1 = object({
813
+ givenName: required(isString),
814
+ familyName: required(isString),
815
+ relationship: required(union(lazy(() => RepresentativeRelationship), isString)),
816
+ phone: optional(isString),
817
+ permitted: required(isBoolean)
818
+ });
819
+ const RepresentativeRelationship = literal("child", "spouse_or_partner", "parent", "other_relative", "friend", "caregiver", "legal_representative", "other");
820
+ const References$1 = object({
821
+ workplace: optional(object({
822
+ name: required(isString),
823
+ email: optional(isString),
824
+ phone: optional(isString),
825
+ companyName: optional(isString),
826
+ jobRole: optional(isString),
827
+ employmentType: optional(union(lazy(() => EmploymentType), isString))
828
+ })),
829
+ landlord: optional(object({
830
+ name: required(isString),
831
+ email: optional(isString),
832
+ phone: optional(isString)
833
+ })),
834
+ workplaceUnavailable: optional(literal(true)),
835
+ workplaceUnavailableReason: optional(isString),
836
+ landlordUnavailable: optional(literal(true)),
837
+ landlordUnavailableReason: optional(isString)
838
+ });
839
+ const IncomeVerification = union(literal("unverified", "pending", "verified", "mismatch"), isString);
840
+ const IncomeFrequency = literal("monthly", "annual", "weekly", "hourly");
841
+ const IncomeSourceType = literal("employment", "self_employment", "benefits", "pension", "student_aid", "support", "other");
842
+ const ApplicantSituation = literal("salaried", "self_employed", "retired", "student", "newcomer", "other");
843
+ const ApplicantDelivery = union(literal("eversa", "organization", "stopped"), isString);
844
+ const ApplicantRelation = union(literal("self", "representative"), isString);
845
+ const ApplicantOrigin = union(literal("entered", "joined"), isString);
846
+ const ApplicationFullProblem = object({
847
+ type: required(literal("https://eversa.app/problems/application-full")),
848
+ title: required(isString),
849
+ status: required(literal(409)),
850
+ detail: required(isString),
851
+ objectId: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
852
+ });
853
+ const Application$1 = object({
854
+ object: required(literal("application")),
855
+ id: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
856
+ livemode: required(isBoolean),
857
+ externalId: optional(isString),
858
+ type: required(union(lazy(() => ApplicationType), isString)),
859
+ template: required(object({
860
+ id: required(id("tpl", /^tpl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
861
+ version: required(isNumber)
862
+ })),
863
+ applicationFee: required(union(lazy(() => ApplicationFee), isNull)),
864
+ status: required(union(lazy(() => ApplicationStatus), isString)),
865
+ summary: required(lazy(() => ApplicationCounts$1)),
866
+ spots: required(lazy(() => Spots)),
867
+ joining: required(lazy(() => Joining)),
868
+ link: optional(lazy(() => ApplicationLink$1)),
869
+ subject: required(lazy(() => Subject$1)),
870
+ data: required(lazy(() => ApplicationData$1)),
871
+ payer: required(union(lazy(() => PayerKind), isString)),
872
+ applicants: required(array(lazy(() => ApplicantSummary$1))),
873
+ decision: optional(lazy(() => Decision$1)),
874
+ previousDecisions: required(array(lazy(() => Decision$1))),
875
+ closed: optional(object({
876
+ reason: required(lazy(() => ApplicationClosedReason)),
877
+ note: optional(isString),
878
+ at: required(isString),
879
+ by: required(lazy(() => Actor))
880
+ })),
881
+ assignee: optional(object({
882
+ userId: required(id("usr", /^usr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
883
+ name: optional(isString)
884
+ })),
885
+ createdBy: required(lazy(() => Actor)),
886
+ amounts: required(lazy(() => Amounts)),
887
+ report: required(object({
888
+ status: required(lazy(() => ReportStatus)),
889
+ url: required(isString)
890
+ })),
891
+ metadata: required(lazy(() => Metadata)),
892
+ createdAt: required(isString),
893
+ updatedAt: required(isString)
894
+ });
895
+ const ApplicationClosedReason = union(literal("withdrawn", "no_longer_needed", "expired", "declined", "offer_declined", "offer_expired", "subject_unavailable", "duplicate", "other"), isString);
896
+ const DecisionFactor = literal("credit_grade", "credit_history", "income_ratio", "income_verification", "employment", "rental_history", "references", "legal_records", "identity", "guarantor", "other");
897
+ const DecisionBasis = literal("human", "automated", "human_reviewed");
898
+ const AdverseNotice$1 = object({
899
+ required: required(literal(true)),
900
+ channels: required(array(lazy(() => InviteChannel))),
901
+ sentAt: optional(isString),
902
+ failedAt: optional(isString)
903
+ });
904
+ const InviteChannel = union(literal("email", "sms"), isString);
905
+ const Offer$1 = object({
906
+ id: required(id("ofr", /^ofr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
907
+ status: required(lazy(() => OfferStatus)),
908
+ withdrawnReason: optional(lazy(() => OfferWithdrawnReason)),
909
+ terms: required(lazy(() => OfferTerms$1)),
910
+ termsVersion: required(isNumber),
911
+ termsHash: required(isString),
912
+ requirementId: required(id("req", /^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
913
+ sentAt: required(isString),
914
+ expiresAt: optional(isString),
915
+ respondedAt: optional(isString),
916
+ respondedBy: optional(lazy(() => Actor)),
917
+ onBehalf: optional(isBoolean),
918
+ evidence: optional(object({
919
+ method: required(union(lazy(() => EvidenceMethod), isString)),
920
+ reference: optional(isString)
921
+ }))
922
+ });
923
+ const OfferTerms$1 = object({
924
+ rent: optional(lazy(() => Amount)),
925
+ lease: optional(lazy(() => OfferLease$1)),
926
+ conditions: required(array(lazy(() => OfferCondition)))
927
+ });
928
+ const OfferCondition = object({
929
+ code: required(union(lazy(() => ConditionCode), isString)),
930
+ note: optional(isString)
931
+ });
932
+ const OfferLease$1 = object({
933
+ startsOn: required(isString),
934
+ endsOn: optional(isString)
935
+ });
936
+ const OfferWithdrawnReason = union(literal("applicant_added", "organization"), isString);
937
+ const OfferStatus = union(literal("pending", "accepted", "declined", "expired", "withdrawn"), isString);
938
+ const ConditionStatus = union(literal("pending", "accepted", "met", "waived"), isString);
939
+ const DeclineReason = literal("credit", "income", "rental_history", "references", "legal_records", "identity", "incomplete", "other");
940
+ const DecisionOutcome = literal("approved", "conditionally_approved", "declined", "deferred");
941
+ const Decision$1 = object({
942
+ id: required(id("dec", /^dec_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
943
+ outcome: required(union(lazy(() => DecisionOutcome), isString)),
944
+ reasons: optional(array(union(lazy(() => DeclineReason), isString))),
945
+ conditions: required(array(object({
946
+ code: required(union(lazy(() => ConditionCode), isString)),
947
+ note: optional(isString),
948
+ status: required(lazy(() => ConditionStatus))
949
+ }))),
950
+ offer: optional(lazy(() => Offer$1)),
951
+ notice: optional(lazy(() => AdverseNotice$1)),
952
+ basis: required(union(lazy(() => DecisionBasis), isString)),
953
+ factors: optional(array(union(lazy(() => DecisionFactor), isString))),
954
+ madeBy: required(lazy(() => Actor)),
955
+ decidedAt: required(isString),
956
+ note: optional(isString),
957
+ supersededAt: optional(isString)
958
+ });
959
+ const ApplicantSummary$1 = object({
960
+ object: required(literal("applicant")),
961
+ id: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
962
+ role: required(isString),
963
+ status: required(lazy(() => ApplicantStatus)),
964
+ person: required(lazy(() => PersonSummary$1))
965
+ });
966
+ const ApplicationData$1 = object({
967
+ household: optional(object({
968
+ occupants: optional(array(object({
969
+ relationship: required(union(lazy(() => Relationship), isString)),
970
+ isMinor: required(isBoolean)
971
+ }))),
972
+ pets: optional(array(object({
973
+ kind: required(union(lazy(() => PetKind), isString)),
974
+ count: required(isNumber)
975
+ }))),
976
+ vehicles: optional(isNumber),
977
+ noticeGiven: optional(isBoolean)
978
+ })),
979
+ desiredMoveIn: optional(isString),
980
+ custom: optional(lazy(() => CustomBlock))
981
+ });
982
+ const PetKind = literal("dog", "cat", "other");
983
+ const Relationship = literal("spouse", "partner", "child", "parent", "roommate", "other");
984
+ const Subject$1 = object({
985
+ type: required(literal("property")),
986
+ property: required(lazy(() => Property$1)),
987
+ snapshotAt: required(isString)
988
+ });
989
+ const ApplicationLink$1 = object({
990
+ url: required(isString),
991
+ guarantorUrl: optional(isString)
992
+ });
993
+ const Joining = object({
994
+ state: required(lazy(() => JoiningState)),
995
+ until: required(isString)
996
+ });
997
+ const JoiningState = union(literal("open", "full", "closed"), isString);
998
+ const Spots = object({
999
+ total: required(isNumber),
1000
+ taken: required(isNumber)
1001
+ });
1002
+ const ApplicationCounts$1 = object({
1003
+ applicants: required(object({
1004
+ active: required(isNumber),
1005
+ submitted: required(isNumber),
1006
+ screened: required(isNumber)
1007
+ })),
1008
+ requirements: required(object({
1009
+ openForApplicants: required(isNumber),
1010
+ openForOrganization: required(isNumber)
1011
+ }))
1012
+ });
1013
+ const ApplicationFee = object({
1014
+ amount: required(lazy(() => Amount)),
1015
+ tax: required(lazy(() => Amount))
1016
+ });
1017
+ const ApplicantTransitionRefusedProblem = object({
1018
+ type: required(literal("https://eversa.app/problems/applicant-transition-refused")),
1019
+ title: required(isString),
1020
+ status: required(literal(409)),
1021
+ detail: required(isString),
1022
+ objectId: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1023
+ from: required(lazy(() => ApplicantStatus)),
1024
+ toStatus: required(lazy(() => ApplicantStatus)),
1025
+ allowed: required(array(lazy(() => ApplicantStatus)))
1026
+ });
1027
+ const PrimaryRequiredProblem = object({
1028
+ type: required(literal("https://eversa.app/problems/primary-required")),
1029
+ title: required(isString),
1030
+ status: required(literal(409)),
1031
+ detail: required(isString),
1032
+ objectId: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1033
+ });
1034
+ const NoInviteChannelProblem = object({
1035
+ type: required(literal("https://eversa.app/problems/no-invite-channel")),
1036
+ title: required(isString),
1037
+ status: required(literal(422)),
1038
+ detail: required(isString),
1039
+ objectId: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1040
+ });
1041
+ const ApplicantRole = literal("primary", "co_applicant", "guarantor");
1042
+ const ApplicantList$1 = object({
1043
+ object: required(literal("list")),
1044
+ data: required(array(lazy(() => Applicant$1))),
1045
+ hasMore: required(isBoolean),
1046
+ nextCursor: required(union(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
1047
+ });
1048
+ const RoleMismatchProblem = object({
1049
+ type: required(literal("https://eversa.app/problems/role-mismatch")),
1050
+ title: required(isString),
1051
+ status: required(literal(422)),
1052
+ detail: required(isString),
1053
+ objectId: required(id("req", /^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1054
+ role: required(union(lazy(() => ApplicantRole), isString))
1055
+ });
1056
+ const CloseReasonRefusedProblem = object({
1057
+ type: required(literal("https://eversa.app/problems/close-reason-refused")),
1058
+ title: required(isString),
1059
+ status: required(literal(409)),
1060
+ detail: required(isString),
1061
+ objectId: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1062
+ reason: required(union(literal("offer_declined", "offer_expired"), isString))
1063
+ });
1064
+ const ApplicationList$1 = object({
1065
+ object: required(literal("list")),
1066
+ data: required(array(lazy(() => ApplicationSummary$1))),
1067
+ hasMore: required(isBoolean),
1068
+ nextCursor: required(union(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
1069
+ });
1070
+ const ApplicationSummary$1 = object({
1071
+ object: required(literal("application")),
1072
+ id: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1073
+ livemode: required(isBoolean),
1074
+ externalId: optional(isString),
1075
+ type: required(union(lazy(() => ApplicationType), isString)),
1076
+ status: required(union(lazy(() => ApplicationStatus), isString)),
1077
+ summary: required(lazy(() => ApplicationCounts$1)),
1078
+ subject: required(lazy(() => Subject$1)),
1079
+ closed: optional(object({
1080
+ reason: required(lazy(() => ApplicationClosedReason)),
1081
+ note: optional(isString),
1082
+ at: required(isString),
1083
+ by: required(lazy(() => Actor))
1084
+ })),
1085
+ assignee: optional(object({
1086
+ userId: required(id("usr", /^usr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1087
+ name: optional(isString)
1088
+ })),
1089
+ amounts: required(lazy(() => Amounts)),
1090
+ metadata: required(lazy(() => Metadata)),
1091
+ createdAt: required(isString),
1092
+ updatedAt: required(isString),
1093
+ applicants: required(array(lazy(() => ApplicantSummary$1)))
1094
+ });
1095
+ const TemplateUnknownProblem = object({
1096
+ type: required(literal("https://eversa.app/problems/template-unknown")),
1097
+ title: required(isString),
1098
+ status: required(literal(422)),
1099
+ detail: required(isString),
1100
+ template: required(id("tpl", /^tpl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1101
+ });
1102
+ const PropertyArchivedProblem = object({
1103
+ type: required(literal("https://eversa.app/problems/property-archived")),
1104
+ title: required(isString),
1105
+ status: required(literal(409)),
1106
+ detail: required(isString),
1107
+ objectId: required(id("prop", /^prop_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1108
+ });
1109
+ const WebhookEndpointDisabledProblem = object({
1110
+ type: required(literal("https://eversa.app/problems/webhook-endpoint-disabled")),
1111
+ title: required(isString),
1112
+ status: required(literal(409)),
1113
+ detail: required(isString),
1114
+ objectId: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1115
+ });
1116
+ const WebhookEndpointNotFoundProblem = object({
1117
+ type: required(literal("https://eversa.app/problems/webhook-endpoint-not-found")),
1118
+ title: required(isString),
1119
+ status: required(literal(404)),
1120
+ detail: required(isString),
1121
+ objectId: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1122
+ });
1123
+ const WebhookDelivery$1 = object({
1124
+ object: required(literal("webhook_delivery")),
1125
+ id: required(id("wd", /^wd_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1126
+ endpointId: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1127
+ webhookId: required(isString),
1128
+ eventId: required(id("evt", /^evt_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1129
+ eventType: required(lazy(() => EventType)),
1130
+ status: required(union(lazy(() => WebhookDeliveryStatus), isString)),
1131
+ attempts: required(isNumber),
1132
+ nextAttemptAt: optional(isString),
1133
+ finishedAt: optional(isString),
1134
+ lastAttempt: optional(lazy(() => WebhookAttempt$1)),
1135
+ createdAt: required(isString),
1136
+ updatedAt: required(isString),
1137
+ livemode: required(isBoolean)
1138
+ });
1139
+ const WebhookAttempt$1 = object({
1140
+ number: required(isNumber),
1141
+ finishedAt: required(isString),
1142
+ responseStatus: optional(isNumber),
1143
+ failure: optional(lazy(() => WebhookAttemptFailure))
1144
+ });
1145
+ const WebhookAttemptFailure = union(literal("refused", "connection", "timeout", "invalid_status"), isString);
1146
+ const WebhookDeliveryStatus = literal("pending", "succeeded", "failed");
1147
+ const EventType = union(literal("application.created", "application.updated", "application.submitted", "application.screening_started", "application.ready", "application.accepted", "application.closed", "application.expired", "applicant.added", "applicant.invited", "applicant.started", "applicant.submitted", "applicant.expired", "applicant.withdrawn", "applicant.removed", "applicant.rejected", "applicant.promoted", "applicant.payment_updated", "applicant.reminded", "applicant.guarantor_requested", "requirement.created", "requirement.answered", "requirement.reviewed", "requirement.resolved", "requirement.expired", "requirement.canceled", "decision.recorded", "decision.updated", "offer.sent", "offer.accepted", "offer.declined", "offer.expired", "offer.withdrawn", "consent.granted", "consent.withdrawn", "consent.expired", "document.added", "document.upload_renewed", "document.received", "document.verified", "document.rejected", "document.deleted", "screening.created", "screening.updated", "screening.completed", "screening.canceled", "check.queued", "check.held", "check.waiting_started", "check.review_started", "check.completed", "check.failed", "check.canceled", "check.retried", "check.findings_opened", "report.partially_completed", "report.completed", "report.completed_degraded", "report.failed", "report.updated", "report.expired", "session.created", "session.opened", "session.submitted", "session.expired", "session.revoked", "invite.canceled", "property.created", "property.updated", "property.archived", "property.unarchived", "template.created", "template.updated", "organization.updated", "screening_settings.updated", "webhook_endpoint.created", "webhook_endpoint.updated", "webhook_endpoint.deleted", "webhook_endpoint.delivery_retried", "webhook_endpoint.tested", "person.updated", "person.erased", "person.messaged", "legal_hold.placed", "legal_hold.released", "legal_hold.ended", "rights_request.received", "rights_request.verified", "rights_request.refused", "rights_request.exported", "rights_request.completed", "rights_request.notice_failed", "rights_request.due_soon", "rights_request.overdue", "confidentiality_incident.reported", "confidentiality_incident.updated"), isString);
1148
+ const WebhookDeliveryPendingProblem = object({
1149
+ type: required(literal("https://eversa.app/problems/webhook-delivery-pending")),
1150
+ title: required(isString),
1151
+ status: required(literal(409)),
1152
+ detail: required(isString),
1153
+ objectId: required(id("wd", /^wd_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1154
+ });
1155
+ const WebhookDeliveryNotFoundProblem = object({
1156
+ type: required(literal("https://eversa.app/problems/webhook-delivery-not-found")),
1157
+ title: required(isString),
1158
+ status: required(literal(404)),
1159
+ detail: required(isString),
1160
+ objectId: required(id("wd", /^wd_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1161
+ });
1162
+ const WebhookDeliveryList$1 = object({
1163
+ object: required(literal("list")),
1164
+ data: required(array(lazy(() => WebhookDelivery$1))),
1165
+ hasMore: required(isBoolean),
1166
+ nextCursor: required(union(id("wd", /^wd_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
1167
+ });
1168
+ const SecretRotationConflictProblem = object({
1169
+ type: required(literal("https://eversa.app/problems/secret-rotation-conflict")),
1170
+ title: required(isString),
1171
+ status: required(literal(409)),
1172
+ detail: required(isString),
1173
+ objectId: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1174
+ });
1175
+ const WebhookEndpointWithSecret$1 = object({
1176
+ object: required(literal("webhook_endpoint")),
1177
+ id: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1178
+ url: required(isString),
1179
+ description: optional(isString),
1180
+ enabledEvents: required(array(union(lazy(() => EnabledEvent), isString))),
1181
+ status: required(union(lazy(() => WebhookEndpointStatus), isString)),
1182
+ apiVersion: required(isString),
1183
+ createdAt: required(isString),
1184
+ updatedAt: required(isString),
1185
+ livemode: required(isBoolean),
1186
+ secret: required(isString)
1187
+ });
1188
+ const WebhookEndpointStatus = literal("enabled", "disabled");
1189
+ const EnabledEvent = literal("application.created", "application.updated", "application.submitted", "application.screening_started", "application.ready", "application.accepted", "application.closed", "application.expired", "applicant.added", "applicant.invited", "applicant.started", "applicant.submitted", "applicant.expired", "applicant.withdrawn", "applicant.removed", "applicant.rejected", "applicant.promoted", "applicant.payment_updated", "requirement.created", "requirement.answered", "requirement.reviewed", "requirement.resolved", "requirement.expired", "requirement.canceled", "decision.recorded", "decision.updated", "offer.sent", "offer.accepted", "offer.declined", "offer.expired", "offer.withdrawn", "consent.granted", "consent.withdrawn", "consent.expired", "document.received", "document.verified", "document.rejected", "screening.created", "screening.updated", "screening.completed", "screening.canceled", "check.queued", "check.held", "check.review_started", "check.completed", "check.failed", "check.canceled", "check.retried", "session.created", "session.opened", "session.submitted", "session.expired", "session.revoked", "invite.canceled", "property.created", "property.updated", "property.archived", "property.unarchived", "template.created", "template.updated", "organization.updated", "screening_settings.updated", "webhook_endpoint.created", "webhook_endpoint.updated", "webhook_endpoint.deleted", "webhook_endpoint.tested", "person.updated", "person.erased", "person.messaged", "legal_hold.placed", "legal_hold.released", "legal_hold.ended", "rights_request.received", "rights_request.verified", "rights_request.refused", "rights_request.exported", "rights_request.completed", "rights_request.notice_failed", "rights_request.due_soon", "rights_request.overdue", "application.*", "applicant.*", "requirement.*", "decision.*", "offer.*", "consent.*", "document.*", "screening.*", "check.*", "report.*", "session.*", "invite.*", "property.*", "template.*", "organization.*", "screening_settings.*", "webhook_endpoint.*", "person.*", "legal_hold.*", "rights_request.*", "*");
1190
+ const DeletedWebhookEndpoint = object({
1191
+ object: required(literal("webhook_endpoint")),
1192
+ id: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1193
+ deleted: required(literal(true))
1194
+ });
1195
+ const WebhookEndpoint$1 = object({
1196
+ object: required(literal("webhook_endpoint")),
1197
+ id: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1198
+ url: required(isString),
1199
+ description: optional(isString),
1200
+ enabledEvents: required(array(union(lazy(() => EnabledEvent), isString))),
1201
+ status: required(union(lazy(() => WebhookEndpointStatus), isString)),
1202
+ apiVersion: required(isString),
1203
+ createdAt: required(isString),
1204
+ updatedAt: required(isString),
1205
+ livemode: required(isBoolean)
1206
+ });
1207
+ const WebhookEndpointList$1 = object({
1208
+ object: required(literal("list")),
1209
+ data: required(array(lazy(() => WebhookEndpoint$1))),
1210
+ hasMore: required(isBoolean),
1211
+ nextCursor: required(union(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
1212
+ });
1213
+ const ApiVersionNotReleasedProblem = object({
1214
+ type: required(literal("https://eversa.app/problems/api-version-not-released")),
1215
+ title: required(isString),
1216
+ status: required(literal(422)),
1217
+ detail: required(isString)
1218
+ });
1219
+ const EventList$1 = object({
1220
+ object: required(literal("list")),
1221
+ data: required(array(lazy(() => Event$1))),
1222
+ hasMore: required(isBoolean),
1223
+ nextCursor: required(union(id("evt", /^evt_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
1224
+ });
1225
+ const Event$1 = object({
1226
+ object: required(literal("event")),
1227
+ id: required(id("evt", /^evt_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1228
+ type: required(lazy(() => EventType)),
1229
+ createdAt: required(isString),
1230
+ livemode: required(isBoolean),
1231
+ actor: required(lazy(() => EventActor)),
1232
+ data: required(lazy(() => EventData$1)),
1233
+ changes: optional(array(isString))
1234
+ });
1235
+ const EventData$1 = union(lazy(() => EventDataApplication), lazy(() => EventDataApplicant), lazy(() => EventDataRequirement), lazy(() => EventDataConsent), lazy(() => EventDataDocument), lazy(() => EventDataScreening), lazy(() => EventDataCheck), lazy(() => EventDataScreeningReport), lazy(() => EventDataApplicationReport), lazy(() => EventDataSession), lazy(() => EventDataProperty), lazy(() => EventDataWebhookEndpoint), lazy(() => EventDataPerson), lazy(() => EventDataLegalHold), lazy(() => EventDataRightsRequest), lazy(() => EventDataConfidentialityIncident), lazy(() => EventDataTemplate), lazy(() => EventDataOrganization), lazy(() => EventDataScreeningSettings));
1236
+ const EventNotFoundProblem = object({
1237
+ type: required(literal("https://eversa.app/problems/event-not-found")),
1238
+ title: required(isString),
1239
+ status: required(literal(404)),
1240
+ detail: required(isString),
1241
+ objectId: required(id("evt", /^evt_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1242
+ });
1243
+ const ConsentNotFoundProblem = object({
1244
+ type: required(literal("https://eversa.app/problems/consent-not-found")),
1245
+ title: required(isString),
1246
+ status: required(literal(404)),
1247
+ detail: required(isString),
1248
+ objectId: required(id("cns", /^cns_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1249
+ });
1250
+ const ContentTooLargeProblem = object({
1251
+ type: required(literal("https://eversa.app/problems/content-too-large")),
1252
+ title: required(isString),
1253
+ status: required(literal(413)),
1254
+ detail: required(isString),
1255
+ maxBytes: required(isNumber)
1256
+ });
1257
+ const ConsentList$1 = object({
1258
+ object: required(literal("list")),
1259
+ data: required(array(lazy(() => Consent$1))),
1260
+ hasMore: required(isBoolean),
1261
+ nextCursor: required(union(id("cns", /^cns_[0-7][0-9a-hjkmnp-tv-z]{25}$/u), isNull))
1262
+ });
1263
+ const UnsupportedMediaTypeProblem = object({
1264
+ type: required(literal("https://eversa.app/problems/unsupported-media-type")),
1265
+ title: required(isString),
1266
+ status: required(literal(415)),
1267
+ detail: required(isString)
1268
+ });
1269
+ const InternalErrorProblem = object({
1270
+ type: required(literal("https://eversa.app/problems/internal-error")),
1271
+ title: required(isString),
1272
+ status: required(literal(500)),
1273
+ detail: required(isString)
1274
+ });
1275
+ const PreconditionFailedProblem = object({
1276
+ type: required(literal("https://eversa.app/problems/precondition-failed")),
1277
+ title: required(isString),
1278
+ status: required(literal(412)),
1279
+ detail: required(isString)
1280
+ });
1281
+ const ObjectBusyProblem = object({
1282
+ type: required(literal("https://eversa.app/problems/object-busy")),
1283
+ title: required(isString),
1284
+ status: required(literal(409)),
1285
+ detail: required(isString)
1286
+ });
1287
+ const InvalidVersionProblem = object({
1288
+ type: required(literal("https://eversa.app/problems/invalid-version")),
1289
+ title: required(isString),
1290
+ status: required(literal(400)),
1291
+ detail: required(isString)
1292
+ });
1293
+ const InvalidTransformProblem = object({
1294
+ type: required(literal("https://eversa.app/problems/invalid-transform")),
1295
+ title: required(isString),
1296
+ status: required(literal(400)),
1297
+ detail: required(isString)
1298
+ });
1299
+ const IdempotencyKeyInvalidProblem = object({
1300
+ type: required(literal("https://eversa.app/problems/idempotency-key-invalid")),
1301
+ title: required(isString),
1302
+ status: required(literal(400)),
1303
+ detail: required(isString)
1304
+ });
1305
+ const IdempotencyKeyInFlightProblem = object({
1306
+ type: required(literal("https://eversa.app/problems/idempotency-key-in-flight")),
1307
+ title: required(isString),
1308
+ status: required(literal(409)),
1309
+ detail: required(isString)
1310
+ });
1311
+ const IdempotencyKeyAnswerWithheldProblem = object({
1312
+ type: required(literal("https://eversa.app/problems/idempotency-key-answer-withheld")),
1313
+ title: required(isString),
1314
+ status: required(literal(409)),
1315
+ detail: required(isString),
1316
+ objectType: optional(isString),
1317
+ objectId: optional(isString)
1318
+ });
1319
+ const IdempotencyKeyReusedProblem = object({
1320
+ type: required(literal("https://eversa.app/problems/idempotency-key-reused")),
1321
+ title: required(isString),
1322
+ status: required(literal(422)),
1323
+ detail: required(isString)
1324
+ });
1325
+ const ActorMember = object({
1326
+ type: required(literal("member")),
1327
+ id: optional(isString),
1328
+ via: required(lazy(() => ActorVia)),
1329
+ name: optional(isString)
1330
+ });
1331
+ const ActorApiKey = object({
1332
+ type: required(literal("api_key")),
1333
+ id: optional(isString),
1334
+ via: required(lazy(() => ActorVia)),
1335
+ name: optional(isString)
1336
+ });
1337
+ const ActorApplicant = object({
1338
+ type: required(literal("applicant")),
1339
+ id: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1340
+ via: required(lazy(() => ActorVia)),
1341
+ name: optional(isString)
1342
+ });
1343
+ const ActorPerson = object({
1344
+ type: required(literal("person")),
1345
+ id: optional(isString),
1346
+ via: required(lazy(() => ActorVia)),
1347
+ name: optional(isString)
1348
+ });
1349
+ const ActorPlatform = object({
1350
+ type: required(literal("platform")),
1351
+ id: optional(isString),
1352
+ via: required(lazy(() => ActorVia)),
1353
+ name: optional(isString)
1354
+ });
1355
+ const RequirementAddresseeOrganization = object({ type: required(literal("organization")) });
1356
+ const RequirementAddresseeApplicant = object({
1357
+ type: required(literal("applicant")),
1358
+ applicantId: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1359
+ });
1360
+ const RequirementAddresseePerson = object({
1361
+ type: required(literal("person")),
1362
+ personId: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1363
+ });
1364
+ const RequirementParentScreening = object({
1365
+ object: required(literal("screening")),
1366
+ id: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1367
+ });
1368
+ const RequirementParentApplication = object({
1369
+ object: required(literal("application")),
1370
+ id: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u))
1371
+ });
1372
+ const EventActorMember = object({
1373
+ type: required(literal("member")),
1374
+ id: optional(isString),
1375
+ via: required(lazy(() => ActorVia))
1376
+ });
1377
+ const EventActorApiKey = object({
1378
+ type: required(literal("api_key")),
1379
+ id: optional(isString),
1380
+ via: required(lazy(() => ActorVia))
1381
+ });
1382
+ const EventActorApplicant = object({
1383
+ type: required(literal("applicant")),
1384
+ id: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1385
+ via: required(lazy(() => ActorVia))
1386
+ });
1387
+ const EventActorPerson = object({
1388
+ type: required(literal("person")),
1389
+ id: optional(isString),
1390
+ via: required(lazy(() => ActorVia))
1391
+ });
1392
+ const EventActorPlatform = object({
1393
+ type: required(literal("platform")),
1394
+ id: optional(isString),
1395
+ via: required(lazy(() => ActorVia))
1396
+ });
1397
+ const EventDataApplication = object({
1398
+ object: required(literal("application")),
1399
+ id: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1400
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1401
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1402
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1403
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1404
+ reference: optional(isString)
1405
+ });
1406
+ const EventDataApplicant = object({
1407
+ object: required(literal("applicant")),
1408
+ id: required(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1409
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1410
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1411
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1412
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1413
+ reference: optional(isString)
1414
+ });
1415
+ const EventDataRequirement = object({
1416
+ object: required(literal("requirement")),
1417
+ id: required(id("req", /^req_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1418
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1419
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1420
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1421
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1422
+ reference: optional(isString)
1423
+ });
1424
+ const EventDataConsent = object({
1425
+ object: required(literal("consent")),
1426
+ id: required(id("cns", /^cns_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1427
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1428
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1429
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1430
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1431
+ reference: optional(isString)
1432
+ });
1433
+ const EventDataDocument = object({
1434
+ object: required(literal("document")),
1435
+ id: required(id("doc", /^doc_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1436
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1437
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1438
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1439
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1440
+ reference: optional(isString)
1441
+ });
1442
+ const EventDataScreening = object({
1443
+ object: required(literal("screening")),
1444
+ id: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1445
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1446
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1447
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1448
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1449
+ reference: optional(isString)
1450
+ });
1451
+ const EventDataCheck = object({
1452
+ object: required(literal("check")),
1453
+ id: required(id("chk", /^chk_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1454
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1455
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1456
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1457
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1458
+ reference: optional(isString)
1459
+ });
1460
+ const EventDataScreeningReport = object({
1461
+ object: required(literal("screening_report")),
1462
+ id: required(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1463
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1464
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1465
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1466
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1467
+ reference: optional(isString)
1468
+ });
1469
+ const EventDataApplicationReport = object({
1470
+ object: required(literal("application_report")),
1471
+ id: required(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1472
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1473
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1474
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1475
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1476
+ reference: optional(isString)
1477
+ });
1478
+ const EventDataSession = object({
1479
+ object: required(literal("session")),
1480
+ id: required(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1481
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1482
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1483
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1484
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1485
+ reference: optional(isString)
1486
+ });
1487
+ const EventDataProperty = object({
1488
+ object: required(literal("property")),
1489
+ id: required(id("prop", /^prop_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1490
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1491
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1492
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1493
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1494
+ reference: optional(isString)
1495
+ });
1496
+ const EventDataWebhookEndpoint = object({
1497
+ object: required(literal("webhook_endpoint")),
1498
+ id: required(id("we", /^we_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1499
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1500
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1501
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1502
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1503
+ reference: optional(isString)
1504
+ });
1505
+ const EventDataPerson = object({
1506
+ object: required(literal("person")),
1507
+ id: required(id("per", /^per_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1508
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1509
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1510
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1511
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1512
+ reference: optional(isString)
1513
+ });
1514
+ const EventDataLegalHold = object({
1515
+ object: required(literal("legal_hold")),
1516
+ id: required(id("hold", /^hold_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1517
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1518
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1519
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1520
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1521
+ reference: optional(isString)
1522
+ });
1523
+ const EventDataRightsRequest = object({
1524
+ object: required(literal("rights_request")),
1525
+ id: required(id("rr", /^rr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1526
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1527
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1528
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1529
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1530
+ reference: optional(isString)
1531
+ });
1532
+ const EventDataConfidentialityIncident = object({
1533
+ object: required(literal("confidentiality_incident")),
1534
+ id: required(id("inc", /^inc_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1535
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1536
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1537
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1538
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1539
+ reference: optional(isString)
1540
+ });
1541
+ const EventDataTemplate = object({
1542
+ object: required(literal("template")),
1543
+ id: required(id("tpl", /^tpl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1544
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1545
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1546
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1547
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1548
+ reference: optional(isString)
1549
+ });
1550
+ const EventDataOrganization = object({
1551
+ object: required(literal("organization")),
1552
+ id: required(id("org", /^org_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1553
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1554
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1555
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1556
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1557
+ reference: optional(isString)
1558
+ });
1559
+ const EventDataScreeningSettings = object({
1560
+ object: required(literal("screening_settings")),
1561
+ id: required(id("env", /^env_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1562
+ applicationId: optional(id("app", /^app_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1563
+ applicantId: optional(id("apl", /^apl_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1564
+ screeningId: optional(id("scr", /^scr_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1565
+ sessionId: optional(id("sess", /^sess_[0-7][0-9a-hjkmnp-tv-z]{25}$/u)),
1566
+ reference: optional(isString)
1567
+ });
1568
+ const Problem$1 = union(lazy(() => ValidationFailedProblem), lazy(() => MalformedRequestProblem), lazy(() => InsufficientScopeProblem), lazy(() => SessionRequiredProblem), lazy(() => RateLimitedProblem), lazy(() => InvalidApiKeyProblem), lazy(() => MemberNotFoundProblem), lazy(() => RequirementTransitionRefusedProblem), lazy(() => RequirementNotFoundProblem), lazy(() => ApplicationNotFoundProblem), lazy(() => ApplicantDepartedProblem), lazy(() => ApplicationEndedProblem), lazy(() => RequirementNotPerformableProblem), lazy(() => ApplicationLimitReachedProblem), lazy(() => ApplicantNotFoundProblem), lazy(() => ScreeningNotFoundProblem), lazy(() => ScreeningLimitReachedProblem), lazy(() => CheckTypeNotServedProblem), lazy(() => CheckTypeNotPricedProblem), lazy(() => PersonNeedsMissingProblem), lazy(() => ExternalIdTakenProblem), lazy(() => PersonNotFoundProblem), lazy(() => ApplicationTypeUnavailableProblem), lazy(() => PropertyNotFoundProblem), lazy(() => PaymentProcessorUnavailableProblem), lazy(() => ApplicationFullProblem), lazy(() => ApplicantTransitionRefusedProblem), lazy(() => PrimaryRequiredProblem), lazy(() => NoInviteChannelProblem), lazy(() => RoleMismatchProblem), lazy(() => CloseReasonRefusedProblem), lazy(() => TemplateUnknownProblem), lazy(() => PropertyArchivedProblem), lazy(() => WebhookEndpointDisabledProblem), lazy(() => WebhookEndpointNotFoundProblem), lazy(() => WebhookDeliveryPendingProblem), lazy(() => WebhookDeliveryNotFoundProblem), lazy(() => SecretRotationConflictProblem), lazy(() => ApiVersionNotReleasedProblem), lazy(() => EventNotFoundProblem), lazy(() => ConsentNotFoundProblem), lazy(() => ContentTooLargeProblem), lazy(() => UnsupportedMediaTypeProblem), lazy(() => InternalErrorProblem), lazy(() => PreconditionFailedProblem), lazy(() => ObjectBusyProblem), lazy(() => InvalidVersionProblem), lazy(() => InvalidTransformProblem), lazy(() => IdempotencyKeyInvalidProblem), lazy(() => IdempotencyKeyInFlightProblem), lazy(() => IdempotencyKeyAnswerWithheldProblem), lazy(() => IdempotencyKeyReusedProblem));
1569
+ // src/generated/names.ts
1570
+ const Check = { fields: {
1571
+ screeningId: "screening_id",
1572
+ holdReason: "hold_reason",
1573
+ charges: ["charges", { items: () => CheckCharge }],
1574
+ consentId: "consent_id",
1575
+ options: ["options", { fields: { includeMunicipal: "include_municipal" } }],
1576
+ requestedAt: "requested_at",
1577
+ startedAt: "started_at",
1578
+ completedAt: "completed_at",
1579
+ reviewedAt: "reviewed_at",
1580
+ failureNote: "failure_note",
1581
+ failureReason: "failure_reason",
1582
+ createdAt: "created_at",
1583
+ updatedAt: "updated_at"
1584
+ } };
1585
+ const CheckCharge = { fields: { chargedAt: "charged_at" } };
1586
+ const Organization = { fields: {
1587
+ createdAt: "created_at",
1588
+ updatedAt: "updated_at"
1589
+ } };
1590
+ const Member = { fields: {
1591
+ createdAt: "created_at",
1592
+ updatedAt: "updated_at"
1593
+ } };
1594
+ const MemberList = { fields: {
1595
+ data: ["data", { items: () => Member }],
1596
+ hasMore: "has_more",
1597
+ nextCursor: "next_cursor"
1598
+ } };
1599
+ const CallingApiKey = { fields: {
1600
+ expiresAt: "expires_at",
1601
+ createdAt: "created_at",
1602
+ updatedAt: "updated_at",
1603
+ lastUsedAt: "last_used_at",
1604
+ rateLimit: "rate_limit"
1605
+ } };
1606
+ const RequirementAddressee = { fields: {
1607
+ applicantId: "applicant_id",
1608
+ personId: "person_id"
1609
+ } };
1610
+ const Requirement = { fields: {
1611
+ requestedBy: "requested_by",
1612
+ addressedTo: ["addressed_to", () => RequirementAddressee],
1613
+ performableBy: "performable_by",
1614
+ documentKinds: "document_kinds",
1615
+ checkId: "check_id",
1616
+ personFields: "person_fields",
1617
+ formStep: "form_step",
1618
+ dueAt: "due_at",
1619
+ answer: ["answer", () => RequirementAnswer],
1620
+ createdAt: "created_at",
1621
+ updatedAt: "updated_at",
1622
+ resolvedAt: "resolved_at"
1623
+ } };
1624
+ const RequirementAnswer = { fields: {
1625
+ onBehalf: "on_behalf",
1626
+ applicantId: "applicant_id",
1627
+ offerTermsHash: "offer_terms_hash"
1628
+ } };
1629
+ const Screening = { fields: {
1630
+ externalId: "external_id",
1631
+ person: ["person", () => PersonSummary],
1632
+ checks: ["checks", { items: () => Check }],
1633
+ checkCounts: ["check_counts", () => CheckCounts],
1634
+ documents: ["documents", { items: () => Document }],
1635
+ consents: ["consents", { items: () => Consent }],
1636
+ requirements: ["requirements", { items: () => Requirement }],
1637
+ createdBy: "created_by",
1638
+ applicationId: "application_id",
1639
+ applicantId: "applicant_id",
1640
+ completedAt: "completed_at",
1641
+ identityConfirmed: "identity_confirmed",
1642
+ signedForm: ["signed_form", () => SignedForm],
1643
+ createdAt: "created_at",
1644
+ updatedAt: "updated_at"
1645
+ } };
1646
+ const SignedForm = { fields: { collectedAt: "collected_at" } };
1647
+ const Consent = { fields: {
1648
+ personId: "person_id",
1649
+ applicantId: "applicant_id",
1650
+ applicationId: "application_id",
1651
+ screeningId: "screening_id",
1652
+ capturedBy: "captured_by",
1653
+ sessionId: "session_id",
1654
+ grantedAt: "granted_at",
1655
+ expiresAt: "expires_at",
1656
+ withdrawnAt: "withdrawn_at",
1657
+ endedAt: "ended_at",
1658
+ textVersion: "text_version",
1659
+ receipt: ["receipt", { fields: { enElected: "en_elected" } }],
1660
+ attestation: ["attestation", { fields: { collectedAt: "collected_at" } }],
1661
+ documentId: "document_id",
1662
+ createdAt: "created_at",
1663
+ updatedAt: "updated_at"
1664
+ } };
1665
+ const Document = { fields: {
1666
+ contentType: "content_type",
1667
+ sizeBytes: "size_bytes",
1668
+ provenance: ["provenance", () => DocumentProvenance],
1669
+ replacedById: "replaced_by_id",
1670
+ upload: ["upload", () => DocumentUpload],
1671
+ applicantId: "applicant_id",
1672
+ applicationId: "application_id",
1673
+ screeningId: "screening_id",
1674
+ createdAt: "created_at",
1675
+ updatedAt: "updated_at"
1676
+ } };
1677
+ const DocumentUpload = { fields: { expiresAt: "expires_at" } };
1678
+ const DocumentProvenance = { fields: {
1679
+ uploadedBy: "uploaded_by",
1680
+ originalUploadedAt: "original_uploaded_at"
1681
+ } };
1682
+ const CheckCounts = { fields: {
1683
+ onHold: "on_hold",
1684
+ needsReview: "needs_review"
1685
+ } };
1686
+ const PersonSummary = { fields: { externalId: "external_id" } };
1687
+ const ScreeningList = { fields: {
1688
+ data: ["data", { items: () => ScreeningSummary }],
1689
+ hasMore: "has_more",
1690
+ nextCursor: "next_cursor"
1691
+ } };
1692
+ const ScreeningSummary = { fields: {
1693
+ externalId: "external_id",
1694
+ person: ["person", () => PersonSummary],
1695
+ checkCounts: ["check_counts", () => CheckCounts],
1696
+ applicationId: "application_id",
1697
+ applicantId: "applicant_id",
1698
+ completedAt: "completed_at",
1699
+ createdAt: "created_at",
1700
+ updatedAt: "updated_at"
1701
+ } };
1702
+ const SearchScreenings = { fields: {
1703
+ checkStatus: "check_status",
1704
+ personId: "person_id",
1705
+ applicationId: "application_id",
1706
+ externalId: "external_id",
1707
+ createdAfter: "created_after",
1708
+ createdBefore: "created_before",
1709
+ updatedAfter: "updated_after",
1710
+ updatedBefore: "updated_before"
1711
+ } };
1712
+ const NewCheckOrder = { fields: { includeMunicipal: "include_municipal" } };
1713
+ const ReferencesInput = { fields: {
1714
+ workplace: ["workplace", { fields: {
1715
+ companyName: "company_name",
1716
+ jobRole: "job_role",
1717
+ employmentType: "employment_type"
1718
+ } }],
1719
+ workplaceUnavailable: "workplace_unavailable",
1720
+ workplaceUnavailableReason: "workplace_unavailable_reason",
1721
+ landlordUnavailable: "landlord_unavailable",
1722
+ landlordUnavailableReason: "landlord_unavailable_reason"
1723
+ } };
1724
+ const PostalAddressInput = { fields: {
1725
+ regionCode: "region_code",
1726
+ languageCode: "language_code",
1727
+ postalCode: "postal_code",
1728
+ sortingCode: "sorting_code",
1729
+ administrativeArea: "administrative_area",
1730
+ addressLines: "address_lines"
1731
+ } };
1732
+ const CreateScreening = { fields: {
1733
+ person: ["person", () => PersonInput],
1734
+ checks: ["checks", { items: () => NewCheckOrder }],
1735
+ externalId: "external_id",
1736
+ consent: ["consent", () => ConsentAttestation],
1737
+ identity: ["identity", () => IdentityAttestation]
1738
+ } };
1739
+ const Person = { fields: {
1740
+ externalId: "external_id",
1741
+ priorNames: "prior_names",
1742
+ dateOfBirth: "date_of_birth",
1743
+ contactUnavailableReason: "contact_unavailable_reason",
1744
+ livingArrangement: "living_arrangement",
1745
+ movedIn: "moved_in",
1746
+ createdAt: "created_at",
1747
+ updatedAt: "updated_at",
1748
+ address: ["address", () => PostalAddress],
1749
+ residenceDuration: "residence_duration",
1750
+ previousAddresses: ["previous_addresses", { items: () => AddressPeriod }],
1751
+ previousAddressUnavailableReason: "previous_address_unavailable_reason",
1752
+ references: ["references", () => References]
1753
+ } };
1754
+ const AddressPeriod = { fields: { address: ["address", () => PostalAddress] } };
1755
+ const PersonList = { fields: {
1756
+ data: ["data", { items: () => PersonListItem }],
1757
+ hasMore: "has_more",
1758
+ nextCursor: "next_cursor"
1759
+ } };
1760
+ const PersonListItem = { fields: {
1761
+ externalId: "external_id",
1762
+ createdAt: "created_at",
1763
+ updatedAt: "updated_at"
1764
+ } };
1765
+ const SearchPersons = { fields: {
1766
+ externalId: "external_id",
1767
+ dateOfBirth: "date_of_birth",
1768
+ createdAfter: "created_after",
1769
+ createdBefore: "created_before",
1770
+ updatedAfter: "updated_after",
1771
+ updatedBefore: "updated_before"
1772
+ } };
1773
+ const Property = { fields: {
1774
+ externalId: "external_id",
1775
+ address: ["address", () => PostalAddress],
1776
+ isAffordable: "is_affordable",
1777
+ floorArea: "floor_area",
1778
+ parkingSpaces: "parking_spaces",
1779
+ archivedAt: "archived_at",
1780
+ createdAt: "created_at",
1781
+ updatedAt: "updated_at"
1782
+ } };
1783
+ const PostalAddress = { fields: {
1784
+ regionCode: "region_code",
1785
+ languageCode: "language_code",
1786
+ postalCode: "postal_code",
1787
+ sortingCode: "sorting_code",
1788
+ administrativeArea: "administrative_area",
1789
+ addressLines: "address_lines"
1790
+ } };
1791
+ const Applicant = { fields: {
1792
+ applicationId: "application_id",
1793
+ externalId: "external_id",
1794
+ person: ["person", () => PersonSummary],
1795
+ invitedBy: "invited_by",
1796
+ possibleDuplicateOf: "possible_duplicate_of",
1797
+ sessionId: "session_id",
1798
+ data: ["data", () => ApplicantData],
1799
+ documents: ["documents", { items: () => Document }],
1800
+ consents: ["consents", { items: () => Consent }],
1801
+ submittedAt: "submitted_at",
1802
+ createdAt: "created_at",
1803
+ updatedAt: "updated_at"
1804
+ } };
1805
+ const ApplicantData = { fields: {
1806
+ residenceHistory: ["residence_history", { items: () => AddressPeriod }],
1807
+ income: ["income", { items: { fields: {
1808
+ hoursPerWeek: "hours_per_week",
1809
+ paidBy: "paid_by"
1810
+ } } }],
1811
+ references: ["references", () => References],
1812
+ currentLandlord: "current_landlord",
1813
+ currentRent: "current_rent",
1814
+ livingArrangement: "living_arrangement",
1815
+ notifyChannels: "notify_channels",
1816
+ representative: ["representative", () => ApplicantRepresentative],
1817
+ residency: ["residency", { fields: { timeInCanada: "time_in_canada" } }],
1818
+ situationDetails: ["situation_details", { fields: {
1819
+ salaried: ["salaried", { fields: {
1820
+ annualIncome: "annual_income",
1821
+ startedOn: "started_on"
1822
+ } }],
1823
+ selfEmployed: ["self_employed", { fields: {
1824
+ annualNetIncome: "annual_net_income",
1825
+ businessName: "business_name",
1826
+ startedOn: "started_on"
1827
+ } }],
1828
+ retired: ["retired", { fields: { annualIncome: "annual_income" } }],
1829
+ student: ["student", { fields: {
1830
+ studyLoad: "study_load",
1831
+ fundingSources: "funding_sources",
1832
+ fundingOther: "funding_other",
1833
+ partTimeIncome: "part_time_income"
1834
+ } }],
1835
+ newcomer: ["newcomer", { fields: {
1836
+ arrivedOn: "arrived_on",
1837
+ annualIncome: "annual_income"
1838
+ } }],
1839
+ other: ["other", { fields: { annualIncome: "annual_income" } }]
1840
+ } }]
1841
+ } };
1842
+ const ApplicantRepresentative = { fields: {
1843
+ givenName: "given_name",
1844
+ familyName: "family_name"
1845
+ } };
1846
+ const References = { fields: {
1847
+ workplace: ["workplace", { fields: {
1848
+ companyName: "company_name",
1849
+ jobRole: "job_role",
1850
+ employmentType: "employment_type"
1851
+ } }],
1852
+ workplaceUnavailable: "workplace_unavailable",
1853
+ workplaceUnavailableReason: "workplace_unavailable_reason",
1854
+ landlordUnavailable: "landlord_unavailable",
1855
+ landlordUnavailableReason: "landlord_unavailable_reason"
1856
+ } };
1857
+ const Application = { fields: {
1858
+ externalId: "external_id",
1859
+ applicationFee: "application_fee",
1860
+ summary: ["summary", () => ApplicationCounts],
1861
+ link: ["link", () => ApplicationLink],
1862
+ subject: ["subject", () => Subject],
1863
+ data: ["data", () => ApplicationData],
1864
+ applicants: ["applicants", { items: () => ApplicantSummary }],
1865
+ decision: ["decision", () => Decision],
1866
+ previousDecisions: ["previous_decisions", { items: () => Decision }],
1867
+ assignee: ["assignee", { fields: { userId: "user_id" } }],
1868
+ createdBy: "created_by",
1869
+ createdAt: "created_at",
1870
+ updatedAt: "updated_at"
1871
+ } };
1872
+ const AdverseNotice = { fields: {
1873
+ sentAt: "sent_at",
1874
+ failedAt: "failed_at"
1875
+ } };
1876
+ const Offer = { fields: {
1877
+ withdrawnReason: "withdrawn_reason",
1878
+ terms: ["terms", () => OfferTerms],
1879
+ termsVersion: "terms_version",
1880
+ termsHash: "terms_hash",
1881
+ requirementId: "requirement_id",
1882
+ sentAt: "sent_at",
1883
+ expiresAt: "expires_at",
1884
+ respondedAt: "responded_at",
1885
+ respondedBy: "responded_by",
1886
+ onBehalf: "on_behalf"
1887
+ } };
1888
+ const OfferTerms = { fields: { lease: ["lease", () => OfferLease] } };
1889
+ const OfferLease = { fields: {
1890
+ startsOn: "starts_on",
1891
+ endsOn: "ends_on"
1892
+ } };
1893
+ const Decision = { fields: {
1894
+ offer: ["offer", () => Offer],
1895
+ notice: ["notice", () => AdverseNotice],
1896
+ madeBy: "made_by",
1897
+ decidedAt: "decided_at",
1898
+ supersededAt: "superseded_at"
1899
+ } };
1900
+ const ApplicantSummary = { fields: { person: ["person", () => PersonSummary] } };
1901
+ const ApplicationData = { fields: {
1902
+ household: ["household", { fields: {
1903
+ occupants: ["occupants", { items: { fields: { isMinor: "is_minor" } } }],
1904
+ noticeGiven: "notice_given"
1905
+ } }],
1906
+ desiredMoveIn: "desired_move_in"
1907
+ } };
1908
+ const Subject = { fields: {
1909
+ property: ["property", () => Property],
1910
+ snapshotAt: "snapshot_at"
1911
+ } };
1912
+ const ApplicationLink = { fields: { guarantorUrl: "guarantor_url" } };
1913
+ const ApplicationCounts = { fields: { requirements: ["requirements", { fields: {
1914
+ openForApplicants: "open_for_applicants",
1915
+ openForOrganization: "open_for_organization"
1916
+ } }] } };
1917
+ const ApplicantList = { fields: {
1918
+ data: ["data", { items: () => Applicant }],
1919
+ hasMore: "has_more",
1920
+ nextCursor: "next_cursor"
1921
+ } };
1922
+ const ApplicantDataInput = { fields: {
1923
+ income: ["income", { items: { fields: {
1924
+ hoursPerWeek: "hours_per_week",
1925
+ paidBy: "paid_by"
1926
+ } } }],
1927
+ currentRent: "current_rent",
1928
+ notifyChannels: "notify_channels",
1929
+ residency: ["residency", { fields: { timeInCanada: "time_in_canada" } }],
1930
+ situationDetails: ["situation_details", { fields: {
1931
+ salaried: ["salaried", { fields: {
1932
+ annualIncome: "annual_income",
1933
+ startedOn: "started_on"
1934
+ } }],
1935
+ selfEmployed: ["self_employed", { fields: {
1936
+ annualNetIncome: "annual_net_income",
1937
+ businessName: "business_name",
1938
+ startedOn: "started_on"
1939
+ } }],
1940
+ retired: ["retired", { fields: { annualIncome: "annual_income" } }],
1941
+ student: ["student", { fields: {
1942
+ studyLoad: "study_load",
1943
+ fundingSources: "funding_sources",
1944
+ fundingOther: "funding_other",
1945
+ partTimeIncome: "part_time_income"
1946
+ } }],
1947
+ newcomer: ["newcomer", { fields: {
1948
+ arrivedOn: "arrived_on",
1949
+ annualIncome: "annual_income"
1950
+ } }],
1951
+ other: ["other", { fields: { annualIncome: "annual_income" } }]
1952
+ } }]
1953
+ } };
1954
+ const PersonInput = { fields: {
1955
+ externalId: "external_id",
1956
+ priorNames: "prior_names",
1957
+ dateOfBirth: "date_of_birth",
1958
+ contactUnavailableReason: "contact_unavailable_reason",
1959
+ address: ["address", () => PostalAddressInput],
1960
+ movedIn: "moved_in",
1961
+ previousAddresses: ["previous_addresses", { items: { fields: { address: ["address", () => PostalAddressInput] } } }],
1962
+ livingArrangement: "living_arrangement",
1963
+ residenceDuration: "residence_duration",
1964
+ previousAddressUnavailableReason: "previous_address_unavailable_reason",
1965
+ references: ["references", () => ReferencesInput]
1966
+ } };
1967
+ const AddApplicant = { fields: {
1968
+ person: ["person", () => PersonInput],
1969
+ data: ["data", () => ApplicantDataInput],
1970
+ externalId: "external_id",
1971
+ requirementId: "requirement_id"
1972
+ } };
1973
+ const ApplicationList = { fields: {
1974
+ data: ["data", { items: () => ApplicationSummary }],
1975
+ hasMore: "has_more",
1976
+ nextCursor: "next_cursor"
1977
+ } };
1978
+ const ApplicationSummary = { fields: {
1979
+ externalId: "external_id",
1980
+ summary: ["summary", () => ApplicationCounts],
1981
+ subject: ["subject", () => Subject],
1982
+ assignee: ["assignee", { fields: { userId: "user_id" } }],
1983
+ createdAt: "created_at",
1984
+ updatedAt: "updated_at",
1985
+ applicants: ["applicants", { items: () => ApplicantSummary }]
1986
+ } };
1987
+ const SearchApplications = { fields: {
1988
+ propertyId: "property_id",
1989
+ personId: "person_id",
1990
+ assigneeUserId: "assignee_user_id",
1991
+ externalId: "external_id",
1992
+ createdAfter: "created_after",
1993
+ createdBefore: "created_before",
1994
+ updatedAfter: "updated_after",
1995
+ updatedBefore: "updated_before"
1996
+ } };
1997
+ const IdentityAttestation = { fields: {
1998
+ confirmedName: "confirmed_name",
1999
+ confirmedAt: "confirmed_at"
2000
+ } };
2001
+ const ConsentAttestation = { fields: { collectedAt: "collected_at" } };
2002
+ const ApplicationDataInput = { fields: {
2003
+ household: ["household", { fields: {
2004
+ occupants: ["occupants", { items: { fields: { isMinor: "is_minor" } } }],
2005
+ noticeGiven: "notice_given"
2006
+ } }],
2007
+ desiredMoveIn: "desired_move_in"
2008
+ } };
2009
+ const CreateApplication = { fields: {
2010
+ data: ["data", () => ApplicationDataInput],
2011
+ residentSpots: "resident_spots",
2012
+ joinUntil: "join_until",
2013
+ externalId: "external_id",
2014
+ applicants: ["applicants", { items: () => InvitedApplicantInput }]
2015
+ } };
2016
+ const InvitedApplicantInput = { fields: {
2017
+ person: ["person", () => PersonInput],
2018
+ data: ["data", () => ApplicantDataInput],
2019
+ externalId: "external_id"
2020
+ } };
2021
+ const WebhookDelivery = { fields: {
2022
+ endpointId: "endpoint_id",
2023
+ webhookId: "webhook_id",
2024
+ eventId: "event_id",
2025
+ eventType: "event_type",
2026
+ nextAttemptAt: "next_attempt_at",
2027
+ finishedAt: "finished_at",
2028
+ lastAttempt: ["last_attempt", () => WebhookAttempt],
2029
+ createdAt: "created_at",
2030
+ updatedAt: "updated_at"
2031
+ } };
2032
+ const WebhookAttempt = { fields: {
2033
+ finishedAt: "finished_at",
2034
+ responseStatus: "response_status"
2035
+ } };
2036
+ const WebhookDeliveryList = { fields: {
2037
+ data: ["data", { items: () => WebhookDelivery }],
2038
+ hasMore: "has_more",
2039
+ nextCursor: "next_cursor"
2040
+ } };
2041
+ const WebhookEndpointWithSecret = { fields: {
2042
+ enabledEvents: "enabled_events",
2043
+ apiVersion: "api_version",
2044
+ createdAt: "created_at",
2045
+ updatedAt: "updated_at"
2046
+ } };
2047
+ const WebhookEndpoint = { fields: {
2048
+ enabledEvents: "enabled_events",
2049
+ apiVersion: "api_version",
2050
+ createdAt: "created_at",
2051
+ updatedAt: "updated_at"
2052
+ } };
2053
+ const UpdateWebhookEndpoint = { fields: { enabledEvents: "enabled_events" } };
2054
+ const WebhookEndpointList = { fields: {
2055
+ data: ["data", { items: () => WebhookEndpoint }],
2056
+ hasMore: "has_more",
2057
+ nextCursor: "next_cursor"
2058
+ } };
2059
+ const CreateWebhookEndpoint = { fields: {
2060
+ enabledEvents: "enabled_events",
2061
+ apiVersion: "api_version"
2062
+ } };
2063
+ const EventList = { fields: {
2064
+ data: ["data", { items: () => Event }],
2065
+ hasMore: "has_more",
2066
+ nextCursor: "next_cursor"
2067
+ } };
2068
+ const Event = { fields: {
2069
+ createdAt: "created_at",
2070
+ data: ["data", () => EventData]
2071
+ } };
2072
+ const EventData = { fields: {
2073
+ applicationId: "application_id",
2074
+ applicantId: "applicant_id",
2075
+ screeningId: "screening_id",
2076
+ sessionId: "session_id"
2077
+ } };
2078
+ const ConsentList = { fields: {
2079
+ data: ["data", { items: () => Consent }],
2080
+ hasMore: "has_more",
2081
+ nextCursor: "next_cursor"
2082
+ } };
2083
+ const Problem = { fields: {
2084
+ objectId: "object_id",
2085
+ toStatus: "to_status",
2086
+ applicantStatus: "applicant_status",
2087
+ applicationStatus: "application_status",
2088
+ checkType: "check_type",
2089
+ externalId: "external_id",
2090
+ objectType: "object_type",
2091
+ applicationType: "application_type",
2092
+ maxBytes: "max_bytes"
2093
+ } };
2094
+ // src/generated/resources.ts
2095
+ /** The API version every request pins in `Eversa-Version`: the reference's own. */
2096
+ const API_VERSION = "2026-10-22";
2097
+ /** Each operation an API key may call, by its operation id. */
2098
+ const OPERATIONS = {
2099
+ listConsents: {
2100
+ method: "GET",
2101
+ path: "/api/consents",
2102
+ query: {
2103
+ screeningId: "screening_id",
2104
+ personId: "person_id",
2105
+ updatedAfter: "updated_after",
2106
+ updatedBefore: "updated_before"
2107
+ },
2108
+ body: null,
2109
+ requestNames: null,
2110
+ idempotencyKey: false,
2111
+ ifMatch: false,
2112
+ response: ConsentList$1,
2113
+ responseNames: ConsentList
2114
+ },
2115
+ retrieveConsent: {
2116
+ method: "GET",
2117
+ path: "/api/consents/{id}",
2118
+ query: {},
2119
+ body: null,
2120
+ requestNames: null,
2121
+ idempotencyKey: false,
2122
+ ifMatch: false,
2123
+ response: Consent$1,
2124
+ responseNames: Consent
2125
+ },
2126
+ retrieveEvent: {
2127
+ method: "GET",
2128
+ path: "/api/events/{id}",
2129
+ query: {},
2130
+ body: null,
2131
+ requestNames: null,
2132
+ idempotencyKey: false,
2133
+ ifMatch: false,
2134
+ response: Event$1,
2135
+ responseNames: Event
2136
+ },
2137
+ listEvents: {
2138
+ method: "GET",
2139
+ path: "/api/events",
2140
+ query: {
2141
+ applicationId: "application_id",
2142
+ applicantId: "applicant_id",
2143
+ screeningId: "screening_id",
2144
+ sessionId: "session_id",
2145
+ createdAfter: "created_after",
2146
+ createdBefore: "created_before"
2147
+ },
2148
+ body: null,
2149
+ requestNames: null,
2150
+ idempotencyKey: false,
2151
+ ifMatch: false,
2152
+ response: EventList$1,
2153
+ responseNames: EventList
2154
+ },
2155
+ listWebhookEndpoints: {
2156
+ method: "GET",
2157
+ path: "/api/webhook-endpoints",
2158
+ query: {},
2159
+ body: null,
2160
+ requestNames: null,
2161
+ idempotencyKey: false,
2162
+ ifMatch: false,
2163
+ response: WebhookEndpointList$1,
2164
+ responseNames: WebhookEndpointList
2165
+ },
2166
+ createWebhookEndpoint: {
2167
+ method: "POST",
2168
+ path: "/api/webhook-endpoints",
2169
+ query: {},
2170
+ body: "application/json",
2171
+ requestNames: CreateWebhookEndpoint,
2172
+ idempotencyKey: true,
2173
+ ifMatch: false,
2174
+ response: WebhookEndpointWithSecret$1,
2175
+ responseNames: WebhookEndpointWithSecret
2176
+ },
2177
+ retrieveWebhookEndpoint: {
2178
+ method: "GET",
2179
+ path: "/api/webhook-endpoints/{id}",
2180
+ query: {},
2181
+ body: null,
2182
+ requestNames: null,
2183
+ idempotencyKey: false,
2184
+ ifMatch: false,
2185
+ response: WebhookEndpoint$1,
2186
+ responseNames: WebhookEndpoint
2187
+ },
2188
+ updateWebhookEndpoint: {
2189
+ method: "PATCH",
2190
+ path: "/api/webhook-endpoints/{id}",
2191
+ query: {},
2192
+ body: "application/merge-patch+json",
2193
+ requestNames: UpdateWebhookEndpoint,
2194
+ idempotencyKey: false,
2195
+ ifMatch: true,
2196
+ response: WebhookEndpoint$1,
2197
+ responseNames: WebhookEndpoint
2198
+ },
2199
+ deleteWebhookEndpoint: {
2200
+ method: "DELETE",
2201
+ path: "/api/webhook-endpoints/{id}",
2202
+ query: {},
2203
+ body: null,
2204
+ requestNames: null,
2205
+ idempotencyKey: false,
2206
+ ifMatch: false,
2207
+ response: DeletedWebhookEndpoint,
2208
+ responseNames: null
2209
+ },
2210
+ rotateWebhookEndpointSecret: {
2211
+ method: "POST",
2212
+ path: "/api/webhook-endpoints/{id}/rotate-secret",
2213
+ query: {},
2214
+ body: null,
2215
+ requestNames: null,
2216
+ idempotencyKey: true,
2217
+ ifMatch: false,
2218
+ response: WebhookEndpointWithSecret$1,
2219
+ responseNames: WebhookEndpointWithSecret
2220
+ },
2221
+ listWebhookDeliveries: {
2222
+ method: "GET",
2223
+ path: "/api/webhook-endpoints/{id}/deliveries",
2224
+ query: { eventId: "event_id" },
2225
+ body: null,
2226
+ requestNames: null,
2227
+ idempotencyKey: false,
2228
+ ifMatch: false,
2229
+ response: WebhookDeliveryList$1,
2230
+ responseNames: WebhookDeliveryList
2231
+ },
2232
+ retryWebhookDelivery: {
2233
+ method: "POST",
2234
+ path: "/api/webhook-endpoints/{id}/deliveries/{delivery_id}/retry",
2235
+ query: {},
2236
+ body: null,
2237
+ requestNames: null,
2238
+ idempotencyKey: true,
2239
+ ifMatch: false,
2240
+ response: WebhookDelivery$1,
2241
+ responseNames: WebhookDelivery
2242
+ },
2243
+ testWebhookEndpoint: {
2244
+ method: "POST",
2245
+ path: "/api/webhook-endpoints/{id}/test",
2246
+ query: {},
2247
+ body: null,
2248
+ requestNames: null,
2249
+ idempotencyKey: true,
2250
+ ifMatch: false,
2251
+ response: WebhookDelivery$1,
2252
+ responseNames: WebhookDelivery
2253
+ },
2254
+ createApplication: {
2255
+ method: "POST",
2256
+ path: "/api/properties/{id}/applications",
2257
+ query: {},
2258
+ body: "application/json",
2259
+ requestNames: CreateApplication,
2260
+ idempotencyKey: true,
2261
+ ifMatch: false,
2262
+ response: Application$1,
2263
+ responseNames: Application
2264
+ },
2265
+ retrieveApplication: {
2266
+ method: "GET",
2267
+ path: "/api/applications/{id}",
2268
+ query: {},
2269
+ body: null,
2270
+ requestNames: null,
2271
+ idempotencyKey: false,
2272
+ ifMatch: false,
2273
+ response: Application$1,
2274
+ responseNames: Application
2275
+ },
2276
+ listApplications: {
2277
+ method: "GET",
2278
+ path: "/api/applications",
2279
+ query: {
2280
+ propertyId: "property_id",
2281
+ personId: "person_id",
2282
+ assigneeUserId: "assignee_user_id",
2283
+ createdAfter: "created_after",
2284
+ createdBefore: "created_before",
2285
+ updatedAfter: "updated_after",
2286
+ updatedBefore: "updated_before"
2287
+ },
2288
+ body: null,
2289
+ requestNames: null,
2290
+ idempotencyKey: false,
2291
+ ifMatch: false,
2292
+ response: ApplicationList$1,
2293
+ responseNames: ApplicationList
2294
+ },
2295
+ searchApplications: {
2296
+ method: "POST",
2297
+ path: "/api/applications/search",
2298
+ query: {},
2299
+ body: "application/json",
2300
+ requestNames: SearchApplications,
2301
+ idempotencyKey: false,
2302
+ ifMatch: false,
2303
+ response: ApplicationList$1,
2304
+ responseNames: ApplicationList
2305
+ },
2306
+ closeApplication: {
2307
+ method: "POST",
2308
+ path: "/api/applications/{id}/close",
2309
+ query: {},
2310
+ body: "application/json",
2311
+ requestNames: null,
2312
+ idempotencyKey: true,
2313
+ ifMatch: false,
2314
+ response: Application$1,
2315
+ responseNames: Application
2316
+ },
2317
+ listApplicants: {
2318
+ method: "GET",
2319
+ path: "/api/applications/{id}/applicants",
2320
+ query: {},
2321
+ body: null,
2322
+ requestNames: null,
2323
+ idempotencyKey: false,
2324
+ ifMatch: false,
2325
+ response: ApplicantList$1,
2326
+ responseNames: ApplicantList
2327
+ },
2328
+ addApplicant: {
2329
+ method: "POST",
2330
+ path: "/api/applications/{id}/applicants",
2331
+ query: {},
2332
+ body: "application/json",
2333
+ requestNames: AddApplicant,
2334
+ idempotencyKey: true,
2335
+ ifMatch: false,
2336
+ response: Applicant$1,
2337
+ responseNames: Applicant
2338
+ },
2339
+ retrieveApplicant: {
2340
+ method: "GET",
2341
+ path: "/api/applications/{id}/applicants/{applicant_id}",
2342
+ query: {},
2343
+ body: null,
2344
+ requestNames: null,
2345
+ idempotencyKey: false,
2346
+ ifMatch: false,
2347
+ response: Applicant$1,
2348
+ responseNames: Applicant
2349
+ },
2350
+ sendApplicantInvite: {
2351
+ method: "POST",
2352
+ path: "/api/applications/{id}/applicants/{applicant_id}/invite",
2353
+ query: {},
2354
+ body: "application/json",
2355
+ requestNames: null,
2356
+ idempotencyKey: true,
2357
+ ifMatch: false,
2358
+ response: Applicant$1,
2359
+ responseNames: Applicant
2360
+ },
2361
+ cancelApplicantInvite: {
2362
+ method: "POST",
2363
+ path: "/api/applications/{id}/applicants/{applicant_id}/invite/cancel",
2364
+ query: {},
2365
+ body: null,
2366
+ requestNames: null,
2367
+ idempotencyKey: true,
2368
+ ifMatch: false,
2369
+ response: Applicant$1,
2370
+ responseNames: Applicant
2371
+ },
2372
+ removeApplicant: {
2373
+ method: "POST",
2374
+ path: "/api/applications/{id}/applicants/{applicant_id}/remove",
2375
+ query: {},
2376
+ body: "application/json",
2377
+ requestNames: null,
2378
+ idempotencyKey: true,
2379
+ ifMatch: false,
2380
+ response: Applicant$1,
2381
+ responseNames: Applicant
2382
+ },
2383
+ retrievePerson: {
2384
+ method: "GET",
2385
+ path: "/api/persons/{id}",
2386
+ query: {},
2387
+ body: null,
2388
+ requestNames: null,
2389
+ idempotencyKey: false,
2390
+ ifMatch: false,
2391
+ response: Person$1,
2392
+ responseNames: Person
2393
+ },
2394
+ listPersons: {
2395
+ method: "GET",
2396
+ path: "/api/persons",
2397
+ query: {
2398
+ createdAfter: "created_after",
2399
+ createdBefore: "created_before",
2400
+ updatedAfter: "updated_after",
2401
+ updatedBefore: "updated_before"
2402
+ },
2403
+ body: null,
2404
+ requestNames: null,
2405
+ idempotencyKey: false,
2406
+ ifMatch: false,
2407
+ response: PersonList$1,
2408
+ responseNames: PersonList
2409
+ },
2410
+ searchPersons: {
2411
+ method: "POST",
2412
+ path: "/api/persons/search",
2413
+ query: {},
2414
+ body: "application/json",
2415
+ requestNames: SearchPersons,
2416
+ idempotencyKey: false,
2417
+ ifMatch: false,
2418
+ response: PersonList$1,
2419
+ responseNames: PersonList
2420
+ },
2421
+ listScreenings: {
2422
+ method: "GET",
2423
+ path: "/api/screenings",
2424
+ query: {
2425
+ checkStatus: "check_status",
2426
+ personId: "person_id",
2427
+ applicationId: "application_id",
2428
+ createdAfter: "created_after",
2429
+ createdBefore: "created_before",
2430
+ updatedAfter: "updated_after",
2431
+ updatedBefore: "updated_before"
2432
+ },
2433
+ body: null,
2434
+ requestNames: null,
2435
+ idempotencyKey: false,
2436
+ ifMatch: false,
2437
+ response: ScreeningList$1,
2438
+ responseNames: ScreeningList
2439
+ },
2440
+ createScreening: {
2441
+ method: "POST",
2442
+ path: "/api/screenings",
2443
+ query: {},
2444
+ body: "application/json",
2445
+ requestNames: CreateScreening,
2446
+ idempotencyKey: true,
2447
+ ifMatch: false,
2448
+ response: Screening$1,
2449
+ responseNames: Screening
2450
+ },
2451
+ retrieveScreening: {
2452
+ method: "GET",
2453
+ path: "/api/screenings/{id}",
2454
+ query: {},
2455
+ body: null,
2456
+ requestNames: null,
2457
+ idempotencyKey: false,
2458
+ ifMatch: false,
2459
+ response: Screening$1,
2460
+ responseNames: Screening
2461
+ },
2462
+ searchScreenings: {
2463
+ method: "POST",
2464
+ path: "/api/screenings/search",
2465
+ query: {},
2466
+ body: "application/json",
2467
+ requestNames: SearchScreenings,
2468
+ idempotencyKey: false,
2469
+ ifMatch: false,
2470
+ response: ScreeningList$1,
2471
+ responseNames: ScreeningList
2472
+ },
2473
+ retrieveCurrentApiKey: {
2474
+ method: "GET",
2475
+ path: "/api/api-keys/current",
2476
+ query: {},
2477
+ body: null,
2478
+ requestNames: null,
2479
+ idempotencyKey: false,
2480
+ ifMatch: false,
2481
+ response: CallingApiKey$1,
2482
+ responseNames: CallingApiKey
2483
+ },
2484
+ listMembers: {
2485
+ method: "GET",
2486
+ path: "/api/members",
2487
+ query: {},
2488
+ body: null,
2489
+ requestNames: null,
2490
+ idempotencyKey: false,
2491
+ ifMatch: false,
2492
+ response: MemberList$1,
2493
+ responseNames: MemberList
2494
+ },
2495
+ retrieveMember: {
2496
+ method: "GET",
2497
+ path: "/api/members/{id}",
2498
+ query: {},
2499
+ body: null,
2500
+ requestNames: null,
2501
+ idempotencyKey: false,
2502
+ ifMatch: false,
2503
+ response: Member$1,
2504
+ responseNames: Member
2505
+ },
2506
+ retrieveOrganization: {
2507
+ method: "GET",
2508
+ path: "/api/organization",
2509
+ query: {},
2510
+ body: null,
2511
+ requestNames: null,
2512
+ idempotencyKey: false,
2513
+ ifMatch: false,
2514
+ response: Organization$1,
2515
+ responseNames: Organization
2516
+ }
2517
+ };
2518
+ /** Each resource of the API, one method per operation. */
2519
+ var EversaResources = class {
2520
+ #call;
2521
+ constructor(call) {
2522
+ this.#call = call;
2523
+ }
2524
+ consents = {
2525
+ /**
2526
+ * List consents
2527
+ *
2528
+ * Your consents, newest first, withdrawn, expired and ended ones included: those of one screening with `screening_id`, or every consent a person gave with `person_id`.
2529
+ */
2530
+ list: (query, options) => this.#call.page(OPERATIONS.listConsents, {
2531
+ query,
2532
+ options
2533
+ }),
2534
+ /**
2535
+ * Retrieve a consent
2536
+ *
2537
+ * What the person consented to, for which purpose, until when, and the record that proves it. A withdrawn consent shows as status `withdrawn`, and one that ended with its screening as status `ended` with `ended_at`.
2538
+ */
2539
+ retrieve: (consentId, options) => this.#call.json(OPERATIONS.retrieveConsent, {
2540
+ path: { id: consentId },
2541
+ options
2542
+ })
2543
+ };
2544
+ events = {
2545
+ /**
2546
+ * Retrieve an event
2547
+ *
2548
+ * One event, with the same body a webhook delivers: the type, when it happened, who acted and the ids of the objects involved. It never carries the object itself.
2549
+ */
2550
+ retrieve: (eventId, options) => this.#call.json(OPERATIONS.retrieveEvent, {
2551
+ path: { id: eventId },
2552
+ options
2553
+ }),
2554
+ /**
2555
+ * List events
2556
+ *
2557
+ * Thirty days of history, newest first. Filter by type or family of types (given once or repeated), by an application, applicant, screening or session id the event carries, or by date. Webhooks deliver the same events.
2558
+ */
2559
+ list: (query, options) => this.#call.page(OPERATIONS.listEvents, {
2560
+ query,
2561
+ options
2562
+ })
2563
+ };
2564
+ webhookEndpoints = {
2565
+ /**
2566
+ * List webhook endpoints
2567
+ *
2568
+ * Your app's endpoints, newest first.
2569
+ */
2570
+ list: (query, options) => this.#call.page(OPERATIONS.listWebhookEndpoints, {
2571
+ query,
2572
+ options
2573
+ }),
2574
+ /**
2575
+ * Create a webhook endpoint
2576
+ *
2577
+ * Starts sending the events it names to the URL, rendered at its `api_version`. The answer is the only one that shows its signing secret.
2578
+ */
2579
+ create: (body, options) => this.#call.json(OPERATIONS.createWebhookEndpoint, {
2580
+ body,
2581
+ options
2582
+ }),
2583
+ /**
2584
+ * Retrieve a webhook endpoint
2585
+ *
2586
+ * Its URL, note, events, status and `api_version`. The signing secret is never shown again.
2587
+ */
2588
+ retrieve: (webhookEndpointId, options) => this.#call.json(OPERATIONS.retrieveWebhookEndpoint, {
2589
+ path: { id: webhookEndpointId },
2590
+ options
2591
+ }),
2592
+ /**
2593
+ * Update a webhook endpoint
2594
+ *
2595
+ * Changes its URL, note, events or status. A disabled endpoint receives nothing.
2596
+ */
2597
+ update: (webhookEndpointId, body, options) => this.#call.json(OPERATIONS.updateWebhookEndpoint, {
2598
+ path: { id: webhookEndpointId },
2599
+ body,
2600
+ options
2601
+ }),
2602
+ /**
2603
+ * Delete a webhook endpoint
2604
+ *
2605
+ * Stops sending events to its URL at once. Its signing secrets and its deliveries are deleted with it, and it cannot be restored.
2606
+ */
2607
+ delete: (webhookEndpointId, options) => this.#call.json(OPERATIONS.deleteWebhookEndpoint, {
2608
+ path: { id: webhookEndpointId },
2609
+ options
2610
+ }),
2611
+ /**
2612
+ * Rotate a webhook endpoint's secret
2613
+ *
2614
+ * A new signing secret, shown in this answer only. For 24 hours each delivery is signed with both, so you can move to the new one without losing a message.
2615
+ */
2616
+ rotateSecret: (webhookEndpointId, options) => this.#call.json(OPERATIONS.rotateWebhookEndpointSecret, {
2617
+ path: { id: webhookEndpointId },
2618
+ options
2619
+ }),
2620
+ /**
2621
+ * List a webhook endpoint's deliveries
2622
+ *
2623
+ * The events sent to the endpoint in the last thirty days, newest first: each delivery's status, how many times it was tried, when it is tried next or when it ended, and its latest try, with the HTTP status your endpoint answered or why it answered none. Filter by status, given once or repeated, or by the event. Nothing your endpoint answered is kept beyond its status.
2624
+ */
2625
+ listWebhookDeliveries: (webhookEndpointId, query, options) => this.#call.page(OPERATIONS.listWebhookDeliveries, {
2626
+ path: { id: webhookEndpointId },
2627
+ query,
2628
+ options
2629
+ }),
2630
+ /**
2631
+ * Send a webhook delivery again
2632
+ *
2633
+ * Sends the delivery's event to the endpoint again, as a new delivery that is tried now and then on the same schedule, eight tries in all. It carries the same `webhook-id`, so a receiver that already handled the event can drop it. Any delivery may be sent again, a succeeded one too. A disabled endpoint answers 409 webhook-endpoint-disabled, and so does a delivery of the event to the endpoint that is still pending, with webhook-delivery-pending. The answer is the new delivery; the retry is kept for Eversa's audit.
2634
+ */
2635
+ retryWebhookDelivery: (webhookEndpointId, deliveryId, options) => this.#call.json(OPERATIONS.retryWebhookDelivery, {
2636
+ path: {
2637
+ id: webhookEndpointId,
2638
+ delivery_id: deliveryId
2639
+ },
2640
+ options
2641
+ }),
2642
+ /**
2643
+ * Send a test event to a webhook endpoint
2644
+ *
2645
+ * Sends a `webhook_endpoint.tested` event to this endpoint alone, whatever events it enabled, so you can check its URL, its TLS and your signature check before a real event depends on them. The event names the endpoint in `data.id` and is in your log like any other; no other endpoint receives it. It is delivered as every event is: signed with each live secret, rendered at the endpoint's `api_version`, tried now and then on the same schedule until your endpoint answers 2xx. The answer is the pending delivery: list the endpoint's deliveries with its `event_id` to see how its try went. A disabled endpoint answers 409 webhook-endpoint-disabled.
2646
+ */
2647
+ test: (webhookEndpointId, options) => this.#call.json(OPERATIONS.testWebhookEndpoint, {
2648
+ path: { id: webhookEndpointId },
2649
+ options
2650
+ })
2651
+ };
2652
+ applications = {
2653
+ /**
2654
+ * Create an application
2655
+ *
2656
+ * Opens a rental application for the property with the applicants Eversa invites and, when you have several, the template to apply. Each applicant gets their own screening. Invited applicants receive the application's link by email and by text message when both are given, unless their invite.delivery is organization. The application gets its link (link.url), which you can read again at any time. An applicant whose data you hold is created with the manual endpoint; add the others with the add-applicant endpoints.
2657
+ */
2658
+ create: (propertyId, body, options) => this.#call.json(OPERATIONS.createApplication, {
2659
+ path: { id: propertyId },
2660
+ body,
2661
+ options
2662
+ }),
2663
+ /**
2664
+ * Retrieve an application
2665
+ *
2666
+ * The application with its status, the counts behind it, the applicants, the requirements, the decision and the link to its report.
2667
+ */
2668
+ retrieve: (applicationId, options) => this.#call.json(OPERATIONS.retrieveApplication, {
2669
+ path: { id: applicationId },
2670
+ options
2671
+ }),
2672
+ /**
2673
+ * List applications
2674
+ *
2675
+ * Newest first. Filter by type, status (given once or repeated), property, person, assignee, the current decision's outcome, creation date, or the date of the last update. To find applications by an applicant's email or your identifier, search them: those are personal information, which a URL would carry into access logs.
2676
+ */
2677
+ list: (query, options) => this.#call.page(OPERATIONS.listApplications, {
2678
+ query,
2679
+ options
2680
+ }),
2681
+ /**
2682
+ * Search applications
2683
+ *
2684
+ * Newest first, filtered by the list's filters and by an applicant's email or your identifier. The criteria travel in the body, so no URL carries them. A search changes nothing: it takes the read permission and no Idempotency-Key.
2685
+ */
2686
+ search: (body, options) => this.#call.json(OPERATIONS.searchApplications, {
2687
+ body,
2688
+ options
2689
+ }),
2690
+ /**
2691
+ * Close an application
2692
+ *
2693
+ * Closes the application without a decision, with a reason. Every applicant's form link and open invite end, checks that have not started are canceled, then each applicant's screening that is not completed, and a pending offer is withdrawn. After the applicant declined the offer, or it lapsed, close with offer_declined or offer_expired; either reason answers close-reason-refused while the current offer is in another state.
2694
+ */
2695
+ close: (applicationId, body, options) => this.#call.json(OPERATIONS.closeApplication, {
2696
+ path: { id: applicationId },
2697
+ body,
2698
+ options
2699
+ })
2700
+ };
2701
+ applicants = {
2702
+ /**
2703
+ * List an application's applicants
2704
+ *
2705
+ * Every applicant on the application, newest first, each as a retrieve shows it, the removed and withdrawn ones included. An application holds at most 20 applicants, and lists them too.
2706
+ */
2707
+ list: (applicationId, query, options) => this.#call.page(OPERATIONS.listApplicants, {
2708
+ path: { id: applicationId },
2709
+ query,
2710
+ options
2711
+ }),
2712
+ /**
2713
+ * Add an applicant
2714
+ *
2715
+ * Adds a co-applicant or a guarantor and invites them: Eversa sends the person the application's link (link.url, or link.guarantor_url for a guarantor) by email and by text message, every channel they have, unless invite.delivery is organization, when you send them that link yourself. A test app sends no text message, so a person added with a test key and a phone alone is told nothing. A co-applicant added where no primary is becomes the primary. Adding once join_until passed moves it 7 days ahead, so they can join. With `requirement_id`, the applicant answers that `guarantor` or `co_applicant` requirement, which resolves; one addressed to an applicant who left (withdrawn, removed or rejected) answers applicant-departed. A guarantor added without `requirement_id` resolves the oldest open guarantor requirement not addressed to an applicant who left, and is added as before when none is open. If an offer is pending, it is withdrawn and the decision is set aside with `superseded_at`; the application then waits on the new applicant. Returns the applicant, at the address `Location` names; the application lists them too.
2716
+ */
2717
+ add: (applicationId, body, options) => this.#call.json(OPERATIONS.addApplicant, {
2718
+ path: { id: applicationId },
2719
+ body,
2720
+ options
2721
+ }),
2722
+ /**
2723
+ * Retrieve an applicant
2724
+ *
2725
+ * The applicant, with their screening, consents, documents and invite. Their application lists them too.
2726
+ */
2727
+ retrieve: (applicationId, applicantId, options) => this.#call.json(OPERATIONS.retrieveApplicant, {
2728
+ path: {
2729
+ id: applicationId,
2730
+ applicant_id: applicantId
2731
+ },
2732
+ options
2733
+ }),
2734
+ /**
2735
+ * Send an applicant invite
2736
+ *
2737
+ * Sends the applicant the application's link again, by email and by text message, to the contact they proved once they hold an account, else to the one you entered; with delivery organization Eversa sends nothing and you send the link yourself. A test app sends no text message, so a person with a phone alone is told nothing under a test key. A setting you leave out keeps its value, except a delivery stopped by a cancel, which a resend that names none resumes as eversa. An `expired` applicant is invited again; an expired primary or co-applicant comes back as the primary where no primary is, and as a co-applicant where another took over. Sending once join_until passed moves it 7 days ahead, so they can join. Answers the applicant.
2738
+ */
2739
+ sendInvite: (applicationId, applicantId, body, options) => this.#call.json(OPERATIONS.sendApplicantInvite, {
2740
+ path: {
2741
+ id: applicationId,
2742
+ applicant_id: applicantId
2743
+ },
2744
+ body,
2745
+ options
2746
+ }),
2747
+ /**
2748
+ * Cancel an applicant invite
2749
+ *
2750
+ * Stops Eversa's messages to the applicant, sent to the wrong address for instance: from now on Eversa sends them nothing (their delivery becomes stopped, or stays organization when you deliver their messages yourself), and you reach them yourself. The applicant keeps their status, and the application's link still opens for anyone who has it; rotate it to stop that. Send the invite again to have Eversa write to them again. This works on an accepted or closed application too. Answers the applicant.
2751
+ */
2752
+ cancelInvite: (applicationId, applicantId, options) => this.#call.json(OPERATIONS.cancelApplicantInvite, {
2753
+ path: {
2754
+ id: applicationId,
2755
+ applicant_id: applicantId
2756
+ },
2757
+ options
2758
+ }),
2759
+ /**
2760
+ * Remove an applicant
2761
+ *
2762
+ * Takes the applicant off the application: they stay listed with status `removed`, or `rejected` when that is the reason given. Their screening is canceled, and so is every check that has not started; completed checks keep their results. Their form's link opens nothing more, and an invite of theirs still open is canceled. A removed primary applicant hands over to the earliest co-applicant, people you entered first; with none, the application stays open with nobody on it, until someone joins. While an approval stands, remove the primary only once another applicant can take over. When the applicant told you they withdraw, record that instead. Answers the applicant.
2763
+ */
2764
+ remove: (applicationId, applicantId, body, options) => this.#call.json(OPERATIONS.removeApplicant, {
2765
+ path: {
2766
+ id: applicationId,
2767
+ applicant_id: applicantId
2768
+ },
2769
+ body,
2770
+ options
2771
+ })
2772
+ };
2773
+ persons = {
2774
+ /**
2775
+ * Retrieve a person
2776
+ *
2777
+ * The person as your organization submitted them.
2778
+ */
2779
+ retrieve: (personId, options) => this.#call.json(OPERATIONS.retrievePerson, {
2780
+ path: { id: personId },
2781
+ options
2782
+ }),
2783
+ /**
2784
+ * List persons
2785
+ *
2786
+ * Newest first, each person as its summary, within the creation and update time ranges given: a create that names a person by id with other fields updates them too, so updated_after finds every change since a time. To find persons by your identifier, email, phone number or name, search them: those are personal information, which a URL would carry into access logs.
2787
+ */
2788
+ list: (query, options) => this.#call.page(OPERATIONS.listPersons, {
2789
+ query,
2790
+ options
2791
+ }),
2792
+ /**
2793
+ * Search persons
2794
+ *
2795
+ * Each person as its summary, filtered by your identifier, email, phone number, name or date of birth, newest first. A name keeps the 25 persons whose name is closest to it (trigram similarity of at least 0.3, accents and case aside) and orders them closest first, so the page's first person is the best match and next_cursor continues down the matches; a name and a date of birth together tell apart two persons of one name. The criteria travel in the body, so no URL carries them. A search changes nothing: it takes the read permission and no Idempotency-Key.
2796
+ */
2797
+ search: (body, options) => this.#call.json(OPERATIONS.searchPersons, {
2798
+ body,
2799
+ options
2800
+ })
2801
+ };
2802
+ screenings = {
2803
+ /**
2804
+ * List screenings
2805
+ *
2806
+ * Newest first. Filter by status (given once or repeated), person, application, creation date, or the date of the last update. To find screenings by the person's email or your identifier, search them: those are personal information, which a URL would carry into access logs.
2807
+ */
2808
+ list: (query, options) => this.#call.page(OPERATIONS.listScreenings, {
2809
+ query,
2810
+ options
2811
+ }),
2812
+ /**
2813
+ * Create a screening
2814
+ *
2815
+ * Orders checks on one person whose data you send, attests that you hold the person's consent under a signed mandate, and records that you confirmed their identity: the name you confirmed, how and when. The checks are queued at once; no invite is sent and no form is opened. `person` must carry every field the check types list under `needs` for the ordered checks, unless another ordered check provides it, counting what Eversa already holds for a person named by `id`, or the request answers 422.
2816
+ */
2817
+ create: (body, options) => this.#call.json(OPERATIONS.createScreening, {
2818
+ body,
2819
+ options
2820
+ }),
2821
+ /**
2822
+ * Retrieve a screening
2823
+ *
2824
+ * The screening with its status, checks, requirements, documents, consents, amounts and the link to its report.
2825
+ */
2826
+ retrieve: (screeningId, options) => this.#call.json(OPERATIONS.retrieveScreening, {
2827
+ path: { id: screeningId },
2828
+ options
2829
+ }),
2830
+ /**
2831
+ * Search screenings
2832
+ *
2833
+ * Newest first, filtered by the list's filters and by the person's email or your identifier. The criteria travel in the body, so no URL carries them. A search changes nothing: it takes the read permission and no Idempotency-Key.
2834
+ */
2835
+ search: (body, options) => this.#call.json(OPERATIONS.searchScreenings, {
2836
+ body,
2837
+ options
2838
+ })
2839
+ };
2840
+ currentApiKey = {
2841
+ /**
2842
+ * Retrieve the current API key
2843
+ *
2844
+ * The key this request is sent with: its kind, its scope, its mode, the app it acts in and how many requests it may send in a window, never its secret. Every key reads itself, whatever its scope: a restricted key's scope is never empty, and any permission of it lets this read through.
2845
+ */
2846
+ retrieve: (options) => this.#call.json(OPERATIONS.retrieveCurrentApiKey, { options }) };
2847
+ members = {
2848
+ /**
2849
+ * List members
2850
+ *
2851
+ * The members of your organization, newest first, with their roles. A member's `id` is what an application's assignee takes. A member's session reads each member's `email` too; a key does not.
2852
+ */
2853
+ list: (query, options) => this.#call.page(OPERATIONS.listMembers, {
2854
+ query,
2855
+ options
2856
+ }),
2857
+ /**
2858
+ * Retrieve a member
2859
+ *
2860
+ * The member of your organization with this user id, such as an application's assignee or the actor of an event, with their role. A member's session reads their `email` too; a key does not.
2861
+ */
2862
+ retrieve: (memberId, options) => this.#call.json(OPERATIONS.retrieveMember, {
2863
+ path: { id: memberId },
2864
+ options
2865
+ })
2866
+ };
2867
+ organization = {
2868
+ /**
2869
+ * Retrieve the organization
2870
+ *
2871
+ * The organization of the request: the one its key's app belongs to, or the one a member's request names. Every role reads it.
2872
+ */
2873
+ retrieve: (options) => this.#call.json(OPERATIONS.retrieveOrganization, { options }) };
2874
+ };
2875
+ // ../versions/src/model/rules/version_header.rule.ts
2876
+ const VERSION_HEADER = "Eversa-Version";
2877
+ // ../../std/http/src/fields.ts
2878
+ /**
2879
+ * The HTTP fields this package reads and writes, as the IANA HTTP Field Name Registry spells them: for a document (the
2880
+ * API reference) and for a header record a client normalizes itself (`Headers`, Effect's response headers).
2881
+ */
2882
+ const FIELD_NAMES = {
2883
+ cacheControl: "Cache-Control",
2884
+ cdnCacheControl: "CDN-Cache-Control",
2885
+ vercelCdnCacheControl: "Vercel-CDN-Cache-Control",
2886
+ vercelCacheTag: "Vercel-Cache-Tag",
2887
+ etag: "ETag",
2888
+ ifMatch: "If-Match",
2889
+ ifNoneMatch: "If-None-Match",
2890
+ contentSecurityPolicy: "Content-Security-Policy",
2891
+ xFrameOptions: "X-Frame-Options",
2892
+ referrerPolicy: "Referrer-Policy",
2893
+ xContentTypeOptions: "X-Content-Type-Options",
2894
+ retryAfter: "Retry-After",
2895
+ idempotencyKey: "Idempotency-Key",
2896
+ idempotentReplayed: "Idempotent-Replayed"
2897
+ };
2898
+ // src/errors.ts
2899
+ /** Every error the SDK throws. */
2900
+ var EversaError = class extends Error {
2901
+ name = "EversaError";
2902
+ };
2903
+ /** The API answered with a problem (RFC 9457): `problem.type` names it. */
2904
+ var EversaApiError = class extends EversaError {
2905
+ name = "EversaApiError";
2906
+ status;
2907
+ /** The problem as the reference describes it, or `undefined` when the body is not one of the reference's problems. */
2908
+ problem;
2909
+ /** The `Request-Id` the API answered: quote it when you report a problem. */
2910
+ requestId;
2911
+ constructor(status, problem, requestId) {
2912
+ super(problem === void 0 ? `Eversa answered ${status}` : `${problem.title}: ${problem.detail}`);
2913
+ this.status = status;
2914
+ this.problem = problem;
2915
+ this.requestId = requestId;
2916
+ }
2917
+ };
2918
+ /** The API could not be reached, or the request was aborted. */
2919
+ var EversaConnectionError = class extends EversaError {
2920
+ name = "EversaConnectionError";
2921
+ };
2922
+ /** The API answered a success the reference does not describe: the SDK and the API disagree on the contract. */
2923
+ var EversaResponseError = class extends EversaError {
2924
+ name = "EversaResponseError";
2925
+ status;
2926
+ /** The body as the API sent it, its members named as on the wire. */
2927
+ body;
2928
+ constructor(status, body) {
2929
+ super(`Eversa answered ${status} with a body the API reference does not describe`);
2930
+ this.status = status;
2931
+ this.body = body;
2932
+ }
2933
+ };
2934
+ /** Whether `error` is the API's problem of type `type`, so its members are typed. */
2935
+ const isProblem = (error, type) => error instanceof EversaApiError && error.problem?.type === type;
2936
+ // src/naming.ts
2937
+ const tables = /* @__PURE__ */ new WeakMap();
2938
+ const tableOf = (fields, direction) => {
2939
+ const known = tables.get(fields);
2940
+ if (known !== void 0) return known[direction];
2941
+ const entries = Object.entries(fields).map(([member, field]) => typeof field === "string" ? [
2942
+ member,
2943
+ field,
2944
+ null
2945
+ ] : [member, ...field]);
2946
+ const built = {
2947
+ toWire: new Map(entries.map(([member, wire, names]) => [member, [wire, names]])),
2948
+ fromWire: new Map(entries.map(([member, wire, names]) => [wire, [member, names]]))
2949
+ };
2950
+ tables.set(fields, built);
2951
+ return built[direction];
2952
+ };
2953
+ const renamed = (names, value, direction) => {
2954
+ if (typeof names === "function") return renamed(names(), value, direction);
2955
+ if (names === null) return value;
2956
+ const { fields, items } = names;
2957
+ if (Array.isArray(value)) return items === void 0 ? value : value.map((item) => renamed(items, item, direction));
2958
+ if (typeof value !== "object" || value === null || fields === void 0) return value;
2959
+ const table = tableOf(fields, direction);
2960
+ return Object.fromEntries(Object.entries(value).map(([name, member]) => {
2961
+ const field = table.get(name);
2962
+ return field === void 0 ? [name, member] : [field[0], renamed(field[1], member, direction)];
2963
+ }));
2964
+ };
2965
+ /** A caller's value with its members named as the wire names them. */
2966
+ const toWire = (names, value) => renamed(names, value, "toWire");
2967
+ /** A value from the wire with its members named as callers name them. */
2968
+ const fromWire = (names, value) => renamed(names, value, "fromWire");
2969
+ // src/page.ts
2970
+ const pagePromise = (first, next) => Object.assign(first, { async *[Symbol.asyncIterator]() {
2971
+ let page = await first;
2972
+ for (;;) {
2973
+ yield* page.data;
2974
+ if (!page.hasMore || page.nextCursor === null) return;
2975
+ page = await next(page.nextCursor);
2976
+ }
2977
+ } });
2978
+ // src/transport.ts
2979
+ /** RFC 9110: these methods mean the same however many times they are sent. */
2980
+ const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
2981
+ "GET",
2982
+ "PUT",
2983
+ "DELETE"
2984
+ ]);
2985
+ /** Answers that mean the request was not acted on and may be tried again. */
2986
+ const TRANSIENT_STATUSES = /* @__PURE__ */ new Set([
2987
+ 502,
2988
+ 503,
2989
+ 504
2990
+ ]);
2991
+ const TOO_MANY_REQUESTS = 429;
2992
+ const MAX_DELAY_MS = 6e4;
2993
+ const backoff = (attempt) => Math.min(500 * 2 ** attempt, 8e3);
2994
+ /**
2995
+ * RFC 9110 section 10.2.3: `Retry-After` in seconds, as the API writes it (`@std/http`); an HTTP date, which it never
2996
+ * writes, falls back to the backoff.
2997
+ */
2998
+ const retryAfter = (response) => {
2999
+ const value = response.headers.get(FIELD_NAMES.retryAfter);
3000
+ return value !== null && /^\d+$/.test(value) ? Math.min(Number(value) * 1e3, MAX_DELAY_MS) : void 0;
3001
+ };
3002
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3003
+ const urlOf = (baseUrl, { path, query }, input) => {
3004
+ const url = new URL(path.replaceAll(/\{([^}]+)\}/g, (_match, name) => {
3005
+ const value = input.path?.[name];
3006
+ if (value === void 0) throw new EversaError(`${path} needs ${name}`);
3007
+ return encodeURIComponent(value);
3008
+ }), baseUrl);
3009
+ for (const [name, value] of Object.entries(input.query ?? {})) {
3010
+ if (value === void 0) continue;
3011
+ for (const item of typeof value === "object" ? value : [value]) url.searchParams.append(query[name] ?? name, String(item));
3012
+ }
3013
+ return url;
3014
+ };
3015
+ const problemOf = async (response) => {
3016
+ const problem = fromWire(Problem, await response.json().catch(() => void 0));
3017
+ return new EversaApiError(response.status, Problem$1(problem) ? problem : void 0, response.headers.get("request-id") ?? void 0);
3018
+ };
3019
+ /** Sends an operation with the key's credentials and the pinned version, retrying only what is safe to retry. */
3020
+ var Caller = class {
3021
+ #apiKey;
3022
+ #baseUrl;
3023
+ #fetch;
3024
+ #maxRetries;
3025
+ constructor(apiKey, options) {
3026
+ if (apiKey === "") throw new EversaError("an API key is required: your secret (sk_) or restricted (rk_) key");
3027
+ this.#apiKey = apiKey;
3028
+ this.#baseUrl = options.baseUrl ?? "https://api.eversa.app";
3029
+ this.#fetch = options.fetch ?? ((request) => fetch(request));
3030
+ this.#maxRetries = options.maxRetries ?? 2;
3031
+ }
3032
+ async json(operation, input) {
3033
+ const response = await this.#send(operation, input);
3034
+ const wire = await response.json();
3035
+ const body = fromWire(operation.responseNames, wire);
3036
+ if ((0, operation.response)(body)) return body;
3037
+ throw new EversaResponseError(response.status, wire);
3038
+ }
3039
+ async binary(operation, input) {
3040
+ return (await this.#send(operation, input)).blob();
3041
+ }
3042
+ page(operation, input) {
3043
+ return pagePromise(this.json(operation, input), (cursor) => this.json(operation, {
3044
+ ...input,
3045
+ query: {
3046
+ ...input.query,
3047
+ cursor
3048
+ }
3049
+ }));
3050
+ }
3051
+ async #send(operation, input) {
3052
+ const headers = new Headers({
3053
+ Authorization: `Bearer ${this.#apiKey}`,
3054
+ [VERSION_HEADER]: API_VERSION,
3055
+ Accept: "application/json"
3056
+ });
3057
+ if (operation.body !== null) headers.set("Content-Type", operation.body);
3058
+ if (operation.idempotencyKey) headers.set(FIELD_NAMES.idempotencyKey, input.options?.idempotencyKey ?? crypto.randomUUID());
3059
+ const ifMatch = input.options?.ifMatch;
3060
+ if (operation.ifMatch && ifMatch !== void 0) headers.set(FIELD_NAMES.ifMatch, ifMatch);
3061
+ const url = urlOf(this.#baseUrl, operation, input);
3062
+ const body = operation.body === null ? null : JSON.stringify(toWire(operation.requestNames, input.body));
3063
+ const signal = input.options?.signal ?? null;
3064
+ const safe = IDEMPOTENT_METHODS.has(operation.method) || headers.has(FIELD_NAMES.idempotencyKey) || headers.has(FIELD_NAMES.ifMatch);
3065
+ for (let attempt = 0;; attempt += 1) {
3066
+ const retries = attempt < this.#maxRetries;
3067
+ const response = await this.#fetch(new Request(url, {
3068
+ method: operation.method,
3069
+ headers,
3070
+ body,
3071
+ signal
3072
+ })).catch((cause) => cause);
3073
+ if (!(response instanceof Response)) {
3074
+ if (!safe || !retries || signal?.aborted === true) throw new EversaConnectionError(`could not reach Eversa at ${url.origin}`, { cause: response });
3075
+ await sleep(backoff(attempt));
3076
+ continue;
3077
+ }
3078
+ if (response.ok) return response;
3079
+ if (!(response.status === TOO_MANY_REQUESTS || safe && TRANSIENT_STATUSES.has(response.status)) || !retries) throw await problemOf(response);
3080
+ await response.body?.cancel();
3081
+ await sleep(retryAfter(response) ?? backoff(attempt));
3082
+ }
3083
+ }
3084
+ };
3085
+ // ../../kit/webhooks/src/standard_webhooks.ts
3086
+ /** The prefix of a signing secret, as Standard Webhooks writes one: `whsec_` and the base64 key. */
3087
+ const SECRET_PREFIX = "whsec_";
3088
+ const keyOf = (secret) => Buffer.from(secret.startsWith(SECRET_PREFIX) ? secret.slice(6) : secret, "base64");
3089
+ /**
3090
+ * Whether a secret holds a key. One that holds none (an unset variable read as "", or `whsec_` alone) signs as anyone
3091
+ * can, so a receiver verifies nothing with it.
3092
+ */
3093
+ const holdsKey = (secret) => keyOf(secret).length > 0;
3094
+ /** One signature, `v1,` and the base64 HMAC-SHA256 of `id.timestamp.body` (Standard Webhooks, "Signature scheme"). */
3095
+ const signature = (secret, { id, timestamp, body }) => `v1,${createHmac("sha256", keyOf(secret)).update(`${id}.${timestamp}.${body}`).digest("base64")}`;
3096
+ /** The names of the headers a delivery is signed with. */
3097
+ const SIGNED_HEADERS = {
3098
+ id: "webhook-id",
3099
+ timestamp: "webhook-timestamp",
3100
+ signature: "webhook-signature"
3101
+ };
3102
+ /**
3103
+ * A receiver's check of a delivery (Standard Webhooks, "Verifying"): one of the signatures in `webhook-signature` is
3104
+ * `secret`'s over the id, the timestamp and the body exactly as received, compared in constant time, and the timestamp
3105
+ * is within `TOLERANCE_SECONDS` of `now`, in seconds since the epoch. A secret that holds no key verifies nothing.
3106
+ */
3107
+ const verify = (secret, headers, body, now) => {
3108
+ const id = headers[SIGNED_HEADERS.id];
3109
+ const timestamp = Number(headers[SIGNED_HEADERS.timestamp]);
3110
+ const sent = headers[SIGNED_HEADERS.signature];
3111
+ if (!holdsKey(secret)) return false;
3112
+ if (id === void 0 || sent === void 0 || !Number.isInteger(timestamp)) return false;
3113
+ if (Math.abs(now - timestamp) > 300) return false;
3114
+ const expected = Buffer.from(signature(secret, {
3115
+ id,
3116
+ timestamp,
3117
+ body
3118
+ }));
3119
+ return sent.split(" ").some((candidate) => {
3120
+ const given = Buffer.from(candidate);
3121
+ return given.length === expected.length && timingSafeEqual(given, expected);
3122
+ });
3123
+ };
3124
+ // src/webhooks.ts
3125
+ /** A webhook delivery whose signature does not check out, or whose body is not an event. */
3126
+ var EversaWebhookError = class extends EversaError {
3127
+ name = "EversaWebhookError";
3128
+ };
3129
+ const headerOf = (headers, name) => {
3130
+ if (headers instanceof Headers) return headers.get(name) ?? void 0;
3131
+ const value = headers[name];
3132
+ return typeof value === "string" ? value : value?.[0];
3133
+ };
3134
+ /**
3135
+ * The event a webhook delivery carries, once one of its signatures is one of `secrets`' (several while a rotated secret
3136
+ * still signs) and it was sent within five minutes, its members in camelCase as every answer's. `body` is the request's
3137
+ * body exactly as received, before any parse. With no secret that holds a key (an unset variable read as "") every
3138
+ * delivery is refused, and the error says so: an empty key is one anyone can sign with.
3139
+ */
3140
+ const unwrap = (body, headers, secrets) => {
3141
+ const given = typeof secrets === "string" ? [secrets] : secrets;
3142
+ if (!given.some(holdsKey)) throw new EversaWebhookError("the webhook's signing secret is empty: pass your endpoint's secret (whsec_...)");
3143
+ const signed = Object.fromEntries(Object.values(SIGNED_HEADERS).flatMap((name) => {
3144
+ const value = headerOf(headers, name);
3145
+ return value === void 0 ? [] : [[name, value]];
3146
+ }));
3147
+ const now = Math.floor(Date.now() / 1e3);
3148
+ if (!given.some((secret) => verify(secret, signed, body, now))) throw new EversaWebhookError("the webhook's signature does not match a secret, or it was sent over 5 minutes ago");
3149
+ const event = fromWire(Event, JSON.parse(body));
3150
+ if (!Event$1(event)) throw new EversaWebhookError("the webhook's body is not an event the API reference describes");
3151
+ return event;
3152
+ };
3153
+ // src/eversa.ts
3154
+ /**
3155
+ * The Eversa API from your server, authenticated with your secret or restricted key: one method per operation of the
3156
+ * public reference, each a promise of the object the API answers.
3157
+ */
3158
+ var Eversa = class extends EversaResources {
3159
+ webhooks = { unwrap };
3160
+ constructor(apiKey, options = {}) {
3161
+ super(new Caller(apiKey, options));
3162
+ }
3163
+ };
3164
+ // src/index.ts
3165
+ var src_default = Eversa;
3166
+ export { API_VERSION, Eversa, EversaApiError, EversaConnectionError, EversaError, EversaResponseError, EversaWebhookError, src_default as default, isProblem };