@deuriib/better-dgii-ecf 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.es.md +159 -0
- package/README.md +196 -2
- package/dist/client.cjs +11 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +31 -0
- package/dist/client.d.ts +31 -0
- package/dist/client.js +9 -0
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +1337 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +1307 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-BVYTmUJU.d.cts +1058 -0
- package/dist/plugin-BVYTmUJU.d.ts +1058 -0
- package/package.json +89 -4
|
@@ -0,0 +1,1058 @@
|
|
|
1
|
+
import * as _deuriib_dgii_ecf from '@deuriib/dgii-ecf';
|
|
2
|
+
import { Environment, P12ReaderData, ECF } from '@deuriib/dgii-ecf';
|
|
3
|
+
import * as better_auth from 'better-auth';
|
|
4
|
+
import { User, Session } from 'better-auth';
|
|
5
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
6
|
+
import { DBFieldAttribute } from '@better-auth/core/db';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Taxpayer id (RNC / cédula) handling for the DGII e-CF services.
|
|
10
|
+
*
|
|
11
|
+
* Two things are deliberately kept apart:
|
|
12
|
+
*
|
|
13
|
+
* - **Normalization** is unconditional. DGII accepts the identifier with or
|
|
14
|
+
* without separators, and a database that stores `1-31-12345-6` while the
|
|
15
|
+
* organization field stores `131123456` must not produce a mismatch.
|
|
16
|
+
* - **Validation** is a policy. The only rule enforced by default is the
|
|
17
|
+
* documented shape: 9 digits for an RNC, 11 for a cédula. Anything stricter
|
|
18
|
+
* (a check digit, an allow-list of registered taxpayers) is the host's call,
|
|
19
|
+
* so it is injected rather than assumed.
|
|
20
|
+
*/
|
|
21
|
+
/** Strip the separators a human types so comparison and storage are stable. */
|
|
22
|
+
declare const normalizeTaxPayerId: (value: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* True when the value is a syntactically valid DGII identifier.
|
|
25
|
+
*
|
|
26
|
+
* The input is expected to be already normalized; call
|
|
27
|
+
* {@link normalizeTaxPayerId} first when it comes from user input.
|
|
28
|
+
*/
|
|
29
|
+
declare const isTaxPayerIdShape: (value: string) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Custom validation hook. Return `true` to accept, or a string to accept with
|
|
32
|
+
* a normalized replacement (for example an alias resolved to its canonical
|
|
33
|
+
* RNC). Returning `false` rejects.
|
|
34
|
+
*/
|
|
35
|
+
type TaxPayerIdValidator = (taxPayerId: string) => boolean | string | Promise<boolean | string>;
|
|
36
|
+
/** How strictly a resolved taxpayer id is checked. Defaults to `format`. */
|
|
37
|
+
type TaxPayerIdValidation = 'format' | 'off' | TaxPayerIdValidator;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Everything a resolver needs to answer "which credentials / which client /
|
|
41
|
+
* which environment applies to this call".
|
|
42
|
+
*
|
|
43
|
+
* It carries no request body: resolvers run after the taxpayer id and the
|
|
44
|
+
* organization have been resolved and authorized, so a resolver cannot be used
|
|
45
|
+
* to widen the scope it is given.
|
|
46
|
+
*/
|
|
47
|
+
interface DgiiEcfScope {
|
|
48
|
+
/** Canonical taxpayer id (RNC / cédula) the call is acting for. */
|
|
49
|
+
readonly taxPayerId: string;
|
|
50
|
+
/** Organization in scope, when the call resolved one. */
|
|
51
|
+
readonly organizationId: string | null;
|
|
52
|
+
/** Authenticated user making the call. */
|
|
53
|
+
readonly userId: string;
|
|
54
|
+
/** DGII environment the call targets. */
|
|
55
|
+
readonly environment: Environment;
|
|
56
|
+
}
|
|
57
|
+
/** Resolver for the PKCS#12 key material the DGII SDK signs with. */
|
|
58
|
+
type DgiiEcfCredentialsResolver = (scope: DgiiEcfScope) => P12ReaderData | null | Promise<P12ReaderData | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Resolver for a fully built DGII client.
|
|
61
|
+
*
|
|
62
|
+
* Use it when credentials live in an HSM, a KMS-backed signer or a sidecar, or
|
|
63
|
+
* when the host already pools clients and wants to keep owning their lifecycle.
|
|
64
|
+
* When it is provided, the plugin caches nothing.
|
|
65
|
+
*/
|
|
66
|
+
type DgiiEcfClientResolver = (scope: DgiiEcfScope) => ECF | null | Promise<ECF | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Resolver for the taxpayer id, used when the request does not name one and
|
|
69
|
+
* the organization has no stored value.
|
|
70
|
+
*
|
|
71
|
+
* It receives the session so a single-tenant or user-scoped mapping is possible
|
|
72
|
+
* (`user -> RNC`), and its result is authorized like any other source.
|
|
73
|
+
*/
|
|
74
|
+
type DgiiEcfTaxPayerIdResolver = (context: {
|
|
75
|
+
readonly user: User;
|
|
76
|
+
readonly session: Session;
|
|
77
|
+
readonly organizationId: string | null;
|
|
78
|
+
}) => string | null | Promise<string | null>;
|
|
79
|
+
/** Custom authorization decision. Returning `true` allows, `false` denies. */
|
|
80
|
+
type DgiiEcfAuthorizer = (context: {
|
|
81
|
+
readonly user: User;
|
|
82
|
+
readonly session: Session;
|
|
83
|
+
readonly taxPayerId: string;
|
|
84
|
+
readonly organizationId: string | null;
|
|
85
|
+
/** Organization's stored taxpayer id, when one was resolved. */
|
|
86
|
+
readonly organizationTaxPayerId: string | null;
|
|
87
|
+
/** Which source produced the taxpayer id for this call. */
|
|
88
|
+
readonly source: DgiiEcfTaxPayerIdSource;
|
|
89
|
+
}) => boolean | Promise<boolean>;
|
|
90
|
+
/** Where the taxpayer id for a call came from. */
|
|
91
|
+
type DgiiEcfTaxPayerIdSource = 'request' | 'organization' | 'resolver';
|
|
92
|
+
interface DgiiEcfOrganizationOptions {
|
|
93
|
+
/**
|
|
94
|
+
* Organization field holding the taxpayer id. Defaults to `taxPayerId`,
|
|
95
|
+
* matching the field this package exports for `organization({ schema })`.
|
|
96
|
+
*/
|
|
97
|
+
field?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Register the field on the `organization` model from this plugin (and let
|
|
100
|
+
* Better Auth's CLI migration create it).
|
|
101
|
+
*
|
|
102
|
+
* Defaults to `false`, because the supported way to make the field writable
|
|
103
|
+
* is the organization plugin's own `additionalFields` — declare it there and
|
|
104
|
+
* `organization.update` persists it. Enable this only for read-only setups
|
|
105
|
+
* where the value is written by another system; `organization.update` will
|
|
106
|
+
* not accept a field it does not know about.
|
|
107
|
+
*/
|
|
108
|
+
extendSchema?: boolean;
|
|
109
|
+
}
|
|
110
|
+
interface DgiiEcfPersistenceOptions {
|
|
111
|
+
/**
|
|
112
|
+
* Persist submissions so retries are replay-safe across restarts and the
|
|
113
|
+
* audit trail survives. Defaults to `true`; the table is part of the plugin
|
|
114
|
+
* schema, so the Better Auth CLI creates it with the rest of the schema.
|
|
115
|
+
*/
|
|
116
|
+
enabled?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Store the successful DGII response body on the record so an idempotent
|
|
119
|
+
* replay can return the original answer. Defaults to `true`; disable it when
|
|
120
|
+
* the response must not be retained.
|
|
121
|
+
*/
|
|
122
|
+
storeResponses?: boolean;
|
|
123
|
+
/** Values longer than this are truncated before storage. Defaults to 8192. */
|
|
124
|
+
maxResponseLength?: number;
|
|
125
|
+
}
|
|
126
|
+
interface DgiiEcfClientCacheOptions {
|
|
127
|
+
/** Maximum number of cached clients. Defaults to 50. */
|
|
128
|
+
maxSize?: number;
|
|
129
|
+
/** How long a cached client is reused. Defaults to 10 minutes. */
|
|
130
|
+
ttlMs?: number;
|
|
131
|
+
}
|
|
132
|
+
interface DgiiEcfStatusOptions {
|
|
133
|
+
/**
|
|
134
|
+
* API key for the DGII status service (`statusecf.dgii.gov.do`). The status
|
|
135
|
+
* endpoints fail with `DGII_STATUS_API_KEY_REQUIRED` when it is absent.
|
|
136
|
+
*/
|
|
137
|
+
apiKey?: string;
|
|
138
|
+
}
|
|
139
|
+
interface DgiiEcfOptions {
|
|
140
|
+
/**
|
|
141
|
+
* DGII environment, or a function returning one per scope. Defaults to
|
|
142
|
+
* `Environment.Dev` — the certification environments are opt-in so a
|
|
143
|
+
* misconfigured deployment cannot issue real fiscal documents.
|
|
144
|
+
*/
|
|
145
|
+
environment?: Environment | ((scope: Omit<DgiiEcfScope, 'environment'>) => Environment | Promise<Environment>);
|
|
146
|
+
/**
|
|
147
|
+
* Resolve the PKCS#12 key material per taxpayer. Required unless `getClient`
|
|
148
|
+
* is provided. The plugin never accepts key material over HTTP.
|
|
149
|
+
*/
|
|
150
|
+
credentials?: DgiiEcfCredentialsResolver;
|
|
151
|
+
/** Provide a ready-made DGII client per scope. Disables the plugin's cache. */
|
|
152
|
+
getClient?: DgiiEcfClientResolver;
|
|
153
|
+
/** Fallback taxpayer id mapping when neither the request nor the org has one. */
|
|
154
|
+
resolveTaxPayerId?: DgiiEcfTaxPayerIdResolver;
|
|
155
|
+
/** Replace the built-in authorization policy entirely. */
|
|
156
|
+
authorize?: DgiiEcfAuthorizer;
|
|
157
|
+
/** Organization integration knobs. */
|
|
158
|
+
organization?: DgiiEcfOrganizationOptions;
|
|
159
|
+
/** Roles allowed to perform DGII operations. Defaults to owner and admin. */
|
|
160
|
+
roles?: string[];
|
|
161
|
+
/**
|
|
162
|
+
* Allow a request-supplied taxpayer id when no organization is in scope.
|
|
163
|
+
*
|
|
164
|
+
* Only meaningful while the organization plugin is installed: without it there
|
|
165
|
+
* is no tenant model to check against, so request-supplied ids are accepted
|
|
166
|
+
* (this is the documented single-tenant mode) and this flag changes nothing.
|
|
167
|
+
*/
|
|
168
|
+
allowUntrustedTaxPayerId?: boolean;
|
|
169
|
+
/** Taxpayer id validation policy. Defaults to `format`. */
|
|
170
|
+
validateTaxPayerId?: TaxPayerIdValidation;
|
|
171
|
+
/** Submission persistence and idempotency. */
|
|
172
|
+
persistence?: DgiiEcfPersistenceOptions;
|
|
173
|
+
/** Client cache sizing. Ignored when `getClient` is provided. */
|
|
174
|
+
clientCache?: DgiiEcfClientCacheOptions;
|
|
175
|
+
/** DGII status service configuration. */
|
|
176
|
+
status?: DgiiEcfStatusOptions;
|
|
177
|
+
/** Request timeout forwarded to the DGII SDK. Defaults to the SDK's value. */
|
|
178
|
+
timeoutMs?: number;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Submission persistence: the audit trail and the replay guard.
|
|
183
|
+
*
|
|
184
|
+
* Two problems are solved by the same row:
|
|
185
|
+
*
|
|
186
|
+
* 1. **Replay safety.** The DGII SDK keeps its idempotency markers in memory, so
|
|
187
|
+
* a restart or a second instance loses them and a retried POST can submit the
|
|
188
|
+
* same fiscal document twice. The row makes the guard durable.
|
|
189
|
+
* 2. **Audit.** Who submitted what, under which taxpayer, with which track id
|
|
190
|
+
* and what DGII answered. Fiscal operations need that trail.
|
|
191
|
+
*
|
|
192
|
+
* Only derived data is stored: the SHA-256 of the signed document, never the
|
|
193
|
+
* document, and never key material or a bearer token.
|
|
194
|
+
*/
|
|
195
|
+
/** Model key of the table this plugin owns. */
|
|
196
|
+
declare const SUBMISSION_MODEL = "dgiiEcfSubmission";
|
|
197
|
+
type SubmissionStatus = 'pending' | 'succeeded' | 'failed';
|
|
198
|
+
interface SubmissionRecord extends Record<string, unknown> {
|
|
199
|
+
id: string;
|
|
200
|
+
organizationId?: string | null;
|
|
201
|
+
taxPayerId: string;
|
|
202
|
+
userId: string;
|
|
203
|
+
environment: string;
|
|
204
|
+
operation: string;
|
|
205
|
+
status: SubmissionStatus;
|
|
206
|
+
idempotencyKey?: string | null;
|
|
207
|
+
encf?: string | null;
|
|
208
|
+
trackId?: string | null;
|
|
209
|
+
documentHash?: string | null;
|
|
210
|
+
errorCode?: string | null;
|
|
211
|
+
response?: string | null;
|
|
212
|
+
createdAt?: Date | string;
|
|
213
|
+
updatedAt?: Date | string;
|
|
214
|
+
}
|
|
215
|
+
interface BeginSubmissionInput {
|
|
216
|
+
readonly organizationId: string | null;
|
|
217
|
+
readonly taxPayerId: string;
|
|
218
|
+
readonly userId: string;
|
|
219
|
+
readonly environment: string;
|
|
220
|
+
readonly operation: string;
|
|
221
|
+
readonly idempotencyKey: string;
|
|
222
|
+
readonly encf: string | null;
|
|
223
|
+
readonly documentHash: string | null;
|
|
224
|
+
}
|
|
225
|
+
interface ListSubmissionsInput {
|
|
226
|
+
readonly organizationId: string | null;
|
|
227
|
+
readonly taxPayerId: string | null;
|
|
228
|
+
readonly limit: number;
|
|
229
|
+
}
|
|
230
|
+
interface DgiiEcfSubmissionStore {
|
|
231
|
+
readonly enabled: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* A previously recorded submission for the same taxpayer and replay key.
|
|
234
|
+
*
|
|
235
|
+
* Returns the record whatever its status: the caller decides what a `pending`
|
|
236
|
+
* or `failed` record means for the attempt it is about to make.
|
|
237
|
+
*/
|
|
238
|
+
findReplay(taxPayerId: string, idempotencyKey: string): Promise<SubmissionRecord | null>;
|
|
239
|
+
/** Record the attempt before it is transmitted; `null` when persistence is off. */
|
|
240
|
+
begin(input: BeginSubmissionInput): Promise<string | null>;
|
|
241
|
+
/** Finish a recorded attempt, whatever its outcome. */
|
|
242
|
+
complete(id: string | null, outcome: {
|
|
243
|
+
status: Exclude<SubmissionStatus, 'pending'>;
|
|
244
|
+
trackId?: string | null;
|
|
245
|
+
response?: unknown;
|
|
246
|
+
errorCode?: string | null;
|
|
247
|
+
}): Promise<void>;
|
|
248
|
+
/** Audit listing for the organization (or taxpayer) in scope. */
|
|
249
|
+
list(input: ListSubmissionsInput): Promise<SubmissionRecord[]>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Supplies the DGII client for a resolved scope.
|
|
254
|
+
*
|
|
255
|
+
* The plugin owns no key material of its own: the host resolves it per
|
|
256
|
+
* taxpayer, over a callback that never sees the HTTP request. That is the whole
|
|
257
|
+
* security model — a browser can call these endpoints, but it can never supply,
|
|
258
|
+
* read or influence which certificate signs a document.
|
|
259
|
+
*/
|
|
260
|
+
interface DgiiEcfClientProvider {
|
|
261
|
+
/** The client for this scope, or an `APIError` when none can be built. */
|
|
262
|
+
get(scope: DgiiEcfScope): Promise<ECF>;
|
|
263
|
+
/** Drop cached clients, all of them or only one taxpayer's. */
|
|
264
|
+
invalidate(taxPayerId?: string): void;
|
|
265
|
+
/** Number of cached clients; always 0 when `getClient` is configured. */
|
|
266
|
+
readonly size: number;
|
|
267
|
+
/**
|
|
268
|
+
* True when the plugin builds the `ECF` instances (the `credentials` mode).
|
|
269
|
+
*
|
|
270
|
+
* The status endpoints use it to decide whether the plugin's own
|
|
271
|
+
* `status.apiKey` is the authority: a host that supplies its own client kept
|
|
272
|
+
* the status key to itself too, so the plugin must not demand one.
|
|
273
|
+
*/
|
|
274
|
+
readonly constructsClients: boolean;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Fragments to drop into `organization({ schema })`.
|
|
279
|
+
*
|
|
280
|
+
* Exported so an application declares the field exactly once, with exactly the
|
|
281
|
+
* definition this plugin expects. This is the supported way to make the value
|
|
282
|
+
* *writable*: the organization plugin builds its create/update schemas from its
|
|
283
|
+
* own `additionalFields`, so a field registered only by this plugin's schema is
|
|
284
|
+
* readable but not accepted by `organization.update`.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```ts
|
|
288
|
+
* organization({ schema: { organization: dgiiEcfOrganizationSchema() } })
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
declare const dgiiEcfOrganizationSchema: (field?: string) => {
|
|
292
|
+
additionalFields: Record<string, DBFieldAttribute>;
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Better Auth plugin wiring the DGII e-CF SDK into an authenticated API.
|
|
296
|
+
*
|
|
297
|
+
* Three responsibilities, and deliberately no fourth:
|
|
298
|
+
*
|
|
299
|
+
* 1. **Identity** — decide *which* taxpayer a call acts for: the request, the
|
|
300
|
+
* organization, or a server-side mapping, authorized in that order.
|
|
301
|
+
* 2. **Credentials** — resolve key material per taxpayer through a server-side
|
|
302
|
+
* callback, so no certificate or bearer token ever reaches a browser.
|
|
303
|
+
* 3. **Durability** — record submissions, so a retry is replay-safe across
|
|
304
|
+
* restarts and the fiscal audit trail survives the process.
|
|
305
|
+
*
|
|
306
|
+
* Document *content* stays the host's job: the plugin signs and transmits XML,
|
|
307
|
+
* it does not model invoices.
|
|
308
|
+
*/
|
|
309
|
+
declare const dgiiEcf: (options?: DgiiEcfOptions) => {
|
|
310
|
+
id: "dgii-ecf";
|
|
311
|
+
$ERROR_CODES: {
|
|
312
|
+
DGII_SESSION_REQUIRED: better_auth.RawError<"DGII_SESSION_REQUIRED">;
|
|
313
|
+
DGII_TAXPAYER_ID_REQUIRED: better_auth.RawError<"DGII_TAXPAYER_ID_REQUIRED">;
|
|
314
|
+
DGII_TAXPAYER_ID_INVALID: better_auth.RawError<"DGII_TAXPAYER_ID_INVALID">;
|
|
315
|
+
DGII_TAXPAYER_ID_MISMATCH: better_auth.RawError<"DGII_TAXPAYER_ID_MISMATCH">;
|
|
316
|
+
DGII_TAXPAYER_ID_FORBIDDEN: better_auth.RawError<"DGII_TAXPAYER_ID_FORBIDDEN">;
|
|
317
|
+
DGII_ORGANIZATION_NOT_FOUND: better_auth.RawError<"DGII_ORGANIZATION_NOT_FOUND">;
|
|
318
|
+
DGII_ORGANIZATION_REQUIRED: better_auth.RawError<"DGII_ORGANIZATION_REQUIRED">;
|
|
319
|
+
DGII_NOT_A_MEMBER: better_auth.RawError<"DGII_NOT_A_MEMBER">;
|
|
320
|
+
DGII_INSUFFICIENT_ROLE: better_auth.RawError<"DGII_INSUFFICIENT_ROLE">;
|
|
321
|
+
DGII_CREDENTIALS_UNAVAILABLE: better_auth.RawError<"DGII_CREDENTIALS_UNAVAILABLE">;
|
|
322
|
+
DGII_CLIENT_NOT_CONFIGURED: better_auth.RawError<"DGII_CLIENT_NOT_CONFIGURED">;
|
|
323
|
+
DGII_STATUS_API_KEY_REQUIRED: better_auth.RawError<"DGII_STATUS_API_KEY_REQUIRED">;
|
|
324
|
+
DGII_DOCUMENT_UNREADABLE: better_auth.RawError<"DGII_DOCUMENT_UNREADABLE">;
|
|
325
|
+
DGII_SIGNING_FAILED: better_auth.RawError<"DGII_SIGNING_FAILED">;
|
|
326
|
+
DGII_REQUEST_FAILED: better_auth.RawError<"DGII_REQUEST_FAILED">;
|
|
327
|
+
DGII_SUBMISSION_NOT_FOUND: better_auth.RawError<"DGII_SUBMISSION_NOT_FOUND">;
|
|
328
|
+
DGII_PERSISTENCE_UNAVAILABLE: better_auth.RawError<"DGII_PERSISTENCE_UNAVAILABLE">;
|
|
329
|
+
DGII_IDEMPOTENCY_IN_FLIGHT: better_auth.RawError<"DGII_IDEMPOTENCY_IN_FLIGHT">;
|
|
330
|
+
};
|
|
331
|
+
schema: better_auth.BetterAuthPluginDBSchema;
|
|
332
|
+
endpoints: {
|
|
333
|
+
dgiiEcfResolveTaxPayer: better_auth.StrictEndpoint<"/dgii-ecf/taxpayer", {
|
|
334
|
+
method: "GET";
|
|
335
|
+
query: better_auth.ZodObject<{
|
|
336
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
337
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
338
|
+
}, zod_v4_core.$strip>;
|
|
339
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
340
|
+
session: {
|
|
341
|
+
session: Record<string, any> & {
|
|
342
|
+
id: string;
|
|
343
|
+
createdAt: Date;
|
|
344
|
+
updatedAt: Date;
|
|
345
|
+
userId: string;
|
|
346
|
+
expiresAt: Date;
|
|
347
|
+
token: string;
|
|
348
|
+
ipAddress?: string | null | undefined;
|
|
349
|
+
userAgent?: string | null | undefined;
|
|
350
|
+
};
|
|
351
|
+
user: Record<string, any> & {
|
|
352
|
+
id: string;
|
|
353
|
+
createdAt: Date;
|
|
354
|
+
updatedAt: Date;
|
|
355
|
+
email: string;
|
|
356
|
+
emailVerified: boolean;
|
|
357
|
+
name: string;
|
|
358
|
+
image?: string | null | undefined;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
}>>[];
|
|
362
|
+
}, {
|
|
363
|
+
taxPayerId: string;
|
|
364
|
+
organizationId: string | null;
|
|
365
|
+
organizationTaxPayerId: string | null;
|
|
366
|
+
source: DgiiEcfTaxPayerIdSource;
|
|
367
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
368
|
+
}>;
|
|
369
|
+
dgiiEcfAuthenticate: better_auth.StrictEndpoint<"/dgii-ecf/authenticate", {
|
|
370
|
+
method: "POST";
|
|
371
|
+
body: better_auth.ZodObject<{
|
|
372
|
+
buyerHost: better_auth.ZodOptional<better_auth.ZodString>;
|
|
373
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
374
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
375
|
+
}, zod_v4_core.$strip>;
|
|
376
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
377
|
+
session: {
|
|
378
|
+
session: Record<string, any> & {
|
|
379
|
+
id: string;
|
|
380
|
+
createdAt: Date;
|
|
381
|
+
updatedAt: Date;
|
|
382
|
+
userId: string;
|
|
383
|
+
expiresAt: Date;
|
|
384
|
+
token: string;
|
|
385
|
+
ipAddress?: string | null | undefined;
|
|
386
|
+
userAgent?: string | null | undefined;
|
|
387
|
+
};
|
|
388
|
+
user: Record<string, any> & {
|
|
389
|
+
id: string;
|
|
390
|
+
createdAt: Date;
|
|
391
|
+
updatedAt: Date;
|
|
392
|
+
email: string;
|
|
393
|
+
emailVerified: boolean;
|
|
394
|
+
name: string;
|
|
395
|
+
image?: string | null | undefined;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
}>>[];
|
|
399
|
+
}, {
|
|
400
|
+
issuedAt: string;
|
|
401
|
+
expiresAt: string;
|
|
402
|
+
taxPayerId: string;
|
|
403
|
+
organizationId: string | null;
|
|
404
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
405
|
+
}>;
|
|
406
|
+
dgiiEcfSendDocument: better_auth.StrictEndpoint<"/dgii-ecf/documents", {
|
|
407
|
+
method: "POST";
|
|
408
|
+
body: better_auth.ZodObject<{
|
|
409
|
+
buyerHost: better_auth.ZodOptional<better_auth.ZodString>;
|
|
410
|
+
xml: better_auth.ZodString;
|
|
411
|
+
fileName: better_auth.ZodOptional<better_auth.ZodString>;
|
|
412
|
+
sign: better_auth.ZodOptional<better_auth.ZodBoolean>;
|
|
413
|
+
idempotencyKey: better_auth.ZodOptional<better_auth.ZodString>;
|
|
414
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
415
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
416
|
+
}, zod_v4_core.$strip>;
|
|
417
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
418
|
+
session: {
|
|
419
|
+
session: Record<string, any> & {
|
|
420
|
+
id: string;
|
|
421
|
+
createdAt: Date;
|
|
422
|
+
updatedAt: Date;
|
|
423
|
+
userId: string;
|
|
424
|
+
expiresAt: Date;
|
|
425
|
+
token: string;
|
|
426
|
+
ipAddress?: string | null | undefined;
|
|
427
|
+
userAgent?: string | null | undefined;
|
|
428
|
+
};
|
|
429
|
+
user: Record<string, any> & {
|
|
430
|
+
id: string;
|
|
431
|
+
createdAt: Date;
|
|
432
|
+
updatedAt: Date;
|
|
433
|
+
email: string;
|
|
434
|
+
emailVerified: boolean;
|
|
435
|
+
name: string;
|
|
436
|
+
image?: string | null | undefined;
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
}>>[];
|
|
440
|
+
}, {
|
|
441
|
+
submissionId: string | null;
|
|
442
|
+
replayed: boolean;
|
|
443
|
+
result: _deuriib_dgii_ecf.InvoiceResponse | _deuriib_dgii_ecf.InvoiceSummaryResponse;
|
|
444
|
+
taxPayerId: string;
|
|
445
|
+
organizationId: string | null;
|
|
446
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
447
|
+
}>;
|
|
448
|
+
dgiiEcfSendElectronicDocument: better_auth.StrictEndpoint<"/dgii-ecf/documents/electronic", {
|
|
449
|
+
method: "POST";
|
|
450
|
+
body: better_auth.ZodObject<{
|
|
451
|
+
buyerHost: better_auth.ZodOptional<better_auth.ZodString>;
|
|
452
|
+
xml: better_auth.ZodString;
|
|
453
|
+
fileName: better_auth.ZodOptional<better_auth.ZodString>;
|
|
454
|
+
sign: better_auth.ZodOptional<better_auth.ZodBoolean>;
|
|
455
|
+
idempotencyKey: better_auth.ZodOptional<better_auth.ZodString>;
|
|
456
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
457
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
458
|
+
}, zod_v4_core.$strip>;
|
|
459
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
460
|
+
session: {
|
|
461
|
+
session: Record<string, any> & {
|
|
462
|
+
id: string;
|
|
463
|
+
createdAt: Date;
|
|
464
|
+
updatedAt: Date;
|
|
465
|
+
userId: string;
|
|
466
|
+
expiresAt: Date;
|
|
467
|
+
token: string;
|
|
468
|
+
ipAddress?: string | null | undefined;
|
|
469
|
+
userAgent?: string | null | undefined;
|
|
470
|
+
};
|
|
471
|
+
user: Record<string, any> & {
|
|
472
|
+
id: string;
|
|
473
|
+
createdAt: Date;
|
|
474
|
+
updatedAt: Date;
|
|
475
|
+
email: string;
|
|
476
|
+
emailVerified: boolean;
|
|
477
|
+
name: string;
|
|
478
|
+
image?: string | null | undefined;
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
}>>[];
|
|
482
|
+
}, {
|
|
483
|
+
submissionId: string | null;
|
|
484
|
+
replayed: boolean;
|
|
485
|
+
result: _deuriib_dgii_ecf.InvoiceResponse;
|
|
486
|
+
taxPayerId: string;
|
|
487
|
+
organizationId: string | null;
|
|
488
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
489
|
+
}>;
|
|
490
|
+
dgiiEcfSendSummary: better_auth.StrictEndpoint<"/dgii-ecf/documents/summary", {
|
|
491
|
+
method: "POST";
|
|
492
|
+
body: better_auth.ZodObject<{
|
|
493
|
+
xml: better_auth.ZodString;
|
|
494
|
+
fileName: better_auth.ZodOptional<better_auth.ZodString>;
|
|
495
|
+
sign: better_auth.ZodOptional<better_auth.ZodBoolean>;
|
|
496
|
+
idempotencyKey: better_auth.ZodOptional<better_auth.ZodString>;
|
|
497
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
498
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
499
|
+
}, zod_v4_core.$strip>;
|
|
500
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
501
|
+
session: {
|
|
502
|
+
session: Record<string, any> & {
|
|
503
|
+
id: string;
|
|
504
|
+
createdAt: Date;
|
|
505
|
+
updatedAt: Date;
|
|
506
|
+
userId: string;
|
|
507
|
+
expiresAt: Date;
|
|
508
|
+
token: string;
|
|
509
|
+
ipAddress?: string | null | undefined;
|
|
510
|
+
userAgent?: string | null | undefined;
|
|
511
|
+
};
|
|
512
|
+
user: Record<string, any> & {
|
|
513
|
+
id: string;
|
|
514
|
+
createdAt: Date;
|
|
515
|
+
updatedAt: Date;
|
|
516
|
+
email: string;
|
|
517
|
+
emailVerified: boolean;
|
|
518
|
+
name: string;
|
|
519
|
+
image?: string | null | undefined;
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
}>>[];
|
|
523
|
+
}, {
|
|
524
|
+
submissionId: string | null;
|
|
525
|
+
replayed: boolean;
|
|
526
|
+
result: _deuriib_dgii_ecf.InvoiceSummaryResponse;
|
|
527
|
+
taxPayerId: string;
|
|
528
|
+
organizationId: string | null;
|
|
529
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
530
|
+
}>;
|
|
531
|
+
dgiiEcfSendCommercialApproval: better_auth.StrictEndpoint<"/dgii-ecf/documents/commercial-approval", {
|
|
532
|
+
method: "POST";
|
|
533
|
+
body: better_auth.ZodObject<{
|
|
534
|
+
buyerHost: better_auth.ZodOptional<better_auth.ZodString>;
|
|
535
|
+
xml: better_auth.ZodString;
|
|
536
|
+
fileName: better_auth.ZodOptional<better_auth.ZodString>;
|
|
537
|
+
sign: better_auth.ZodOptional<better_auth.ZodBoolean>;
|
|
538
|
+
idempotencyKey: better_auth.ZodOptional<better_auth.ZodString>;
|
|
539
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
540
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
541
|
+
}, zod_v4_core.$strip>;
|
|
542
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
543
|
+
session: {
|
|
544
|
+
session: Record<string, any> & {
|
|
545
|
+
id: string;
|
|
546
|
+
createdAt: Date;
|
|
547
|
+
updatedAt: Date;
|
|
548
|
+
userId: string;
|
|
549
|
+
expiresAt: Date;
|
|
550
|
+
token: string;
|
|
551
|
+
ipAddress?: string | null | undefined;
|
|
552
|
+
userAgent?: string | null | undefined;
|
|
553
|
+
};
|
|
554
|
+
user: Record<string, any> & {
|
|
555
|
+
id: string;
|
|
556
|
+
createdAt: Date;
|
|
557
|
+
updatedAt: Date;
|
|
558
|
+
email: string;
|
|
559
|
+
emailVerified: boolean;
|
|
560
|
+
name: string;
|
|
561
|
+
image?: string | null | undefined;
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
}>>[];
|
|
565
|
+
}, {
|
|
566
|
+
submissionId: string | null;
|
|
567
|
+
replayed: boolean;
|
|
568
|
+
result: _deuriib_dgii_ecf.CommercialApprovalResponse | _deuriib_dgii_ecf.B2BCommercialApprovalResponse;
|
|
569
|
+
taxPayerId: string;
|
|
570
|
+
organizationId: string | null;
|
|
571
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
572
|
+
}>;
|
|
573
|
+
dgiiEcfVoidENCF: better_auth.StrictEndpoint<"/dgii-ecf/documents/void-range", {
|
|
574
|
+
method: "POST";
|
|
575
|
+
body: better_auth.ZodObject<{
|
|
576
|
+
xml: better_auth.ZodString;
|
|
577
|
+
fileName: better_auth.ZodOptional<better_auth.ZodString>;
|
|
578
|
+
sign: better_auth.ZodOptional<better_auth.ZodBoolean>;
|
|
579
|
+
idempotencyKey: better_auth.ZodOptional<better_auth.ZodString>;
|
|
580
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
581
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
582
|
+
}, zod_v4_core.$strip>;
|
|
583
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
584
|
+
session: {
|
|
585
|
+
session: Record<string, any> & {
|
|
586
|
+
id: string;
|
|
587
|
+
createdAt: Date;
|
|
588
|
+
updatedAt: Date;
|
|
589
|
+
userId: string;
|
|
590
|
+
expiresAt: Date;
|
|
591
|
+
token: string;
|
|
592
|
+
ipAddress?: string | null | undefined;
|
|
593
|
+
userAgent?: string | null | undefined;
|
|
594
|
+
};
|
|
595
|
+
user: Record<string, any> & {
|
|
596
|
+
id: string;
|
|
597
|
+
createdAt: Date;
|
|
598
|
+
updatedAt: Date;
|
|
599
|
+
email: string;
|
|
600
|
+
emailVerified: boolean;
|
|
601
|
+
name: string;
|
|
602
|
+
image?: string | null | undefined;
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
}>>[];
|
|
606
|
+
}, {
|
|
607
|
+
submissionId: string | null;
|
|
608
|
+
replayed: boolean;
|
|
609
|
+
result: _deuriib_dgii_ecf.VoidNCFResponse;
|
|
610
|
+
taxPayerId: string;
|
|
611
|
+
organizationId: string | null;
|
|
612
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
613
|
+
}>;
|
|
614
|
+
dgiiEcfReconcileSubmission: better_auth.StrictEndpoint<"/dgii-ecf/documents/reconcile", {
|
|
615
|
+
method: "POST";
|
|
616
|
+
body: better_auth.ZodObject<{
|
|
617
|
+
xml: better_auth.ZodString;
|
|
618
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
619
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
620
|
+
}, zod_v4_core.$strip>;
|
|
621
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
622
|
+
session: {
|
|
623
|
+
session: Record<string, any> & {
|
|
624
|
+
id: string;
|
|
625
|
+
createdAt: Date;
|
|
626
|
+
updatedAt: Date;
|
|
627
|
+
userId: string;
|
|
628
|
+
expiresAt: Date;
|
|
629
|
+
token: string;
|
|
630
|
+
ipAddress?: string | null | undefined;
|
|
631
|
+
userAgent?: string | null | undefined;
|
|
632
|
+
};
|
|
633
|
+
user: Record<string, any> & {
|
|
634
|
+
id: string;
|
|
635
|
+
createdAt: Date;
|
|
636
|
+
updatedAt: Date;
|
|
637
|
+
email: string;
|
|
638
|
+
emailVerified: boolean;
|
|
639
|
+
name: string;
|
|
640
|
+
image?: string | null | undefined;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
}>>[];
|
|
644
|
+
}, {
|
|
645
|
+
result: _deuriib_dgii_ecf.ReconciliationResult;
|
|
646
|
+
taxPayerId: string;
|
|
647
|
+
organizationId: string | null;
|
|
648
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
649
|
+
}>;
|
|
650
|
+
dgiiEcfTrackStatus: better_auth.StrictEndpoint<"/dgii-ecf/tracks", {
|
|
651
|
+
method: "GET";
|
|
652
|
+
query: better_auth.ZodObject<{
|
|
653
|
+
trackId: better_auth.ZodString;
|
|
654
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
655
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
656
|
+
}, zod_v4_core.$strip>;
|
|
657
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
658
|
+
session: {
|
|
659
|
+
session: Record<string, any> & {
|
|
660
|
+
id: string;
|
|
661
|
+
createdAt: Date;
|
|
662
|
+
updatedAt: Date;
|
|
663
|
+
userId: string;
|
|
664
|
+
expiresAt: Date;
|
|
665
|
+
token: string;
|
|
666
|
+
ipAddress?: string | null | undefined;
|
|
667
|
+
userAgent?: string | null | undefined;
|
|
668
|
+
};
|
|
669
|
+
user: Record<string, any> & {
|
|
670
|
+
id: string;
|
|
671
|
+
createdAt: Date;
|
|
672
|
+
updatedAt: Date;
|
|
673
|
+
email: string;
|
|
674
|
+
emailVerified: boolean;
|
|
675
|
+
name: string;
|
|
676
|
+
image?: string | null | undefined;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
}>>[];
|
|
680
|
+
}, {
|
|
681
|
+
result: _deuriib_dgii_ecf.TrackingStatusResponse;
|
|
682
|
+
taxPayerId: string;
|
|
683
|
+
organizationId: string | null;
|
|
684
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
685
|
+
}>;
|
|
686
|
+
dgiiEcfInquiryStatus: better_auth.StrictEndpoint<"/dgii-ecf/inquiries/status", {
|
|
687
|
+
method: "POST";
|
|
688
|
+
body: better_auth.ZodObject<{
|
|
689
|
+
ncf: better_auth.ZodString;
|
|
690
|
+
buyerTaxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
691
|
+
securityCode: better_auth.ZodOptional<better_auth.ZodString>;
|
|
692
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
693
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
694
|
+
}, zod_v4_core.$strip>;
|
|
695
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
696
|
+
session: {
|
|
697
|
+
session: Record<string, any> & {
|
|
698
|
+
id: string;
|
|
699
|
+
createdAt: Date;
|
|
700
|
+
updatedAt: Date;
|
|
701
|
+
userId: string;
|
|
702
|
+
expiresAt: Date;
|
|
703
|
+
token: string;
|
|
704
|
+
ipAddress?: string | null | undefined;
|
|
705
|
+
userAgent?: string | null | undefined;
|
|
706
|
+
};
|
|
707
|
+
user: Record<string, any> & {
|
|
708
|
+
id: string;
|
|
709
|
+
createdAt: Date;
|
|
710
|
+
updatedAt: Date;
|
|
711
|
+
email: string;
|
|
712
|
+
emailVerified: boolean;
|
|
713
|
+
name: string;
|
|
714
|
+
image?: string | null | undefined;
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
}>>[];
|
|
718
|
+
}, {
|
|
719
|
+
result: _deuriib_dgii_ecf.InquiryStatusResponse;
|
|
720
|
+
taxPayerId: string;
|
|
721
|
+
organizationId: string | null;
|
|
722
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
723
|
+
}>;
|
|
724
|
+
dgiiEcfTrackStatuses: better_auth.StrictEndpoint<"/dgii-ecf/inquiries/tracks", {
|
|
725
|
+
method: "POST";
|
|
726
|
+
body: better_auth.ZodObject<{
|
|
727
|
+
encf: better_auth.ZodString;
|
|
728
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
729
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
730
|
+
}, zod_v4_core.$strip>;
|
|
731
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
732
|
+
session: {
|
|
733
|
+
session: Record<string, any> & {
|
|
734
|
+
id: string;
|
|
735
|
+
createdAt: Date;
|
|
736
|
+
updatedAt: Date;
|
|
737
|
+
userId: string;
|
|
738
|
+
expiresAt: Date;
|
|
739
|
+
token: string;
|
|
740
|
+
ipAddress?: string | null | undefined;
|
|
741
|
+
userAgent?: string | null | undefined;
|
|
742
|
+
};
|
|
743
|
+
user: Record<string, any> & {
|
|
744
|
+
id: string;
|
|
745
|
+
createdAt: Date;
|
|
746
|
+
updatedAt: Date;
|
|
747
|
+
email: string;
|
|
748
|
+
emailVerified: boolean;
|
|
749
|
+
name: string;
|
|
750
|
+
image?: string | null | undefined;
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
}>>[];
|
|
754
|
+
}, {
|
|
755
|
+
result: _deuriib_dgii_ecf.SummaryTrackingStatusResponse[];
|
|
756
|
+
taxPayerId: string;
|
|
757
|
+
organizationId: string | null;
|
|
758
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
759
|
+
}>;
|
|
760
|
+
dgiiEcfSummaryInvoiceInquiry: better_auth.StrictEndpoint<"/dgii-ecf/inquiries/summary", {
|
|
761
|
+
method: "POST";
|
|
762
|
+
body: better_auth.ZodObject<{
|
|
763
|
+
encf: better_auth.ZodString;
|
|
764
|
+
securityCode: better_auth.ZodString;
|
|
765
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
766
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
767
|
+
}, zod_v4_core.$strip>;
|
|
768
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
769
|
+
session: {
|
|
770
|
+
session: Record<string, any> & {
|
|
771
|
+
id: string;
|
|
772
|
+
createdAt: Date;
|
|
773
|
+
updatedAt: Date;
|
|
774
|
+
userId: string;
|
|
775
|
+
expiresAt: Date;
|
|
776
|
+
token: string;
|
|
777
|
+
ipAddress?: string | null | undefined;
|
|
778
|
+
userAgent?: string | null | undefined;
|
|
779
|
+
};
|
|
780
|
+
user: Record<string, any> & {
|
|
781
|
+
id: string;
|
|
782
|
+
createdAt: Date;
|
|
783
|
+
updatedAt: Date;
|
|
784
|
+
email: string;
|
|
785
|
+
emailVerified: boolean;
|
|
786
|
+
name: string;
|
|
787
|
+
image?: string | null | undefined;
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
}>>[];
|
|
791
|
+
}, {
|
|
792
|
+
result: _deuriib_dgii_ecf.InquiryInvoiceSummary;
|
|
793
|
+
taxPayerId: string;
|
|
794
|
+
organizationId: string | null;
|
|
795
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
796
|
+
}>;
|
|
797
|
+
dgiiEcfCustomerDirectory: better_auth.StrictEndpoint<"/dgii-ecf/directories/customers", {
|
|
798
|
+
method: "GET";
|
|
799
|
+
query: better_auth.ZodObject<{
|
|
800
|
+
rnc: better_auth.ZodOptional<better_auth.ZodString>;
|
|
801
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
802
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
803
|
+
}, zod_v4_core.$strip>;
|
|
804
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
805
|
+
session: {
|
|
806
|
+
session: Record<string, any> & {
|
|
807
|
+
id: string;
|
|
808
|
+
createdAt: Date;
|
|
809
|
+
updatedAt: Date;
|
|
810
|
+
userId: string;
|
|
811
|
+
expiresAt: Date;
|
|
812
|
+
token: string;
|
|
813
|
+
ipAddress?: string | null | undefined;
|
|
814
|
+
userAgent?: string | null | undefined;
|
|
815
|
+
};
|
|
816
|
+
user: Record<string, any> & {
|
|
817
|
+
id: string;
|
|
818
|
+
createdAt: Date;
|
|
819
|
+
updatedAt: Date;
|
|
820
|
+
email: string;
|
|
821
|
+
emailVerified: boolean;
|
|
822
|
+
name: string;
|
|
823
|
+
image?: string | null | undefined;
|
|
824
|
+
};
|
|
825
|
+
};
|
|
826
|
+
}>>[];
|
|
827
|
+
}, {
|
|
828
|
+
result: _deuriib_dgii_ecf.ServiceDirectoryResponse[];
|
|
829
|
+
taxPayerId: string;
|
|
830
|
+
organizationId: string | null;
|
|
831
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
832
|
+
}>;
|
|
833
|
+
dgiiEcfDirectoryListing: better_auth.StrictEndpoint<"/dgii-ecf/directories/all", {
|
|
834
|
+
method: "GET";
|
|
835
|
+
query: better_auth.ZodObject<{
|
|
836
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
837
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
838
|
+
}, zod_v4_core.$strip>;
|
|
839
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
840
|
+
session: {
|
|
841
|
+
session: Record<string, any> & {
|
|
842
|
+
id: string;
|
|
843
|
+
createdAt: Date;
|
|
844
|
+
updatedAt: Date;
|
|
845
|
+
userId: string;
|
|
846
|
+
expiresAt: Date;
|
|
847
|
+
token: string;
|
|
848
|
+
ipAddress?: string | null | undefined;
|
|
849
|
+
userAgent?: string | null | undefined;
|
|
850
|
+
};
|
|
851
|
+
user: Record<string, any> & {
|
|
852
|
+
id: string;
|
|
853
|
+
createdAt: Date;
|
|
854
|
+
updatedAt: Date;
|
|
855
|
+
email: string;
|
|
856
|
+
emailVerified: boolean;
|
|
857
|
+
name: string;
|
|
858
|
+
image?: string | null | undefined;
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
}>>[];
|
|
862
|
+
}, {
|
|
863
|
+
result: _deuriib_dgii_ecf.ServiceDirectoryResponse[];
|
|
864
|
+
taxPayerId: string;
|
|
865
|
+
organizationId: string | null;
|
|
866
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
867
|
+
}>;
|
|
868
|
+
dgiiEcfServiceStatus: better_auth.StrictEndpoint<"/dgii-ecf/service-status", {
|
|
869
|
+
method: "GET";
|
|
870
|
+
query: better_auth.ZodObject<{
|
|
871
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
872
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
873
|
+
}, zod_v4_core.$strip>;
|
|
874
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
875
|
+
session: {
|
|
876
|
+
session: Record<string, any> & {
|
|
877
|
+
id: string;
|
|
878
|
+
createdAt: Date;
|
|
879
|
+
updatedAt: Date;
|
|
880
|
+
userId: string;
|
|
881
|
+
expiresAt: Date;
|
|
882
|
+
token: string;
|
|
883
|
+
ipAddress?: string | null | undefined;
|
|
884
|
+
userAgent?: string | null | undefined;
|
|
885
|
+
};
|
|
886
|
+
user: Record<string, any> & {
|
|
887
|
+
id: string;
|
|
888
|
+
createdAt: Date;
|
|
889
|
+
updatedAt: Date;
|
|
890
|
+
email: string;
|
|
891
|
+
emailVerified: boolean;
|
|
892
|
+
name: string;
|
|
893
|
+
image?: string | null | undefined;
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
}>>[];
|
|
897
|
+
}, {
|
|
898
|
+
services: _deuriib_dgii_ecf.ServiceStatusEntry[];
|
|
899
|
+
taxPayerId: string;
|
|
900
|
+
organizationId: string | null;
|
|
901
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
902
|
+
}>;
|
|
903
|
+
dgiiEcfMaintenanceWindows: better_auth.StrictEndpoint<"/dgii-ecf/maintenance-windows", {
|
|
904
|
+
method: "GET";
|
|
905
|
+
query: better_auth.ZodObject<{
|
|
906
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
907
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
908
|
+
}, zod_v4_core.$strip>;
|
|
909
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
910
|
+
session: {
|
|
911
|
+
session: Record<string, any> & {
|
|
912
|
+
id: string;
|
|
913
|
+
createdAt: Date;
|
|
914
|
+
updatedAt: Date;
|
|
915
|
+
userId: string;
|
|
916
|
+
expiresAt: Date;
|
|
917
|
+
token: string;
|
|
918
|
+
ipAddress?: string | null | undefined;
|
|
919
|
+
userAgent?: string | null | undefined;
|
|
920
|
+
};
|
|
921
|
+
user: Record<string, any> & {
|
|
922
|
+
id: string;
|
|
923
|
+
createdAt: Date;
|
|
924
|
+
updatedAt: Date;
|
|
925
|
+
email: string;
|
|
926
|
+
emailVerified: boolean;
|
|
927
|
+
name: string;
|
|
928
|
+
image?: string | null | undefined;
|
|
929
|
+
};
|
|
930
|
+
};
|
|
931
|
+
}>>[];
|
|
932
|
+
}, {
|
|
933
|
+
windows: _deuriib_dgii_ecf.MaintenanceWindow[];
|
|
934
|
+
taxPayerId: string;
|
|
935
|
+
organizationId: string | null;
|
|
936
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
937
|
+
}>;
|
|
938
|
+
dgiiEcfServiceAvailability: better_auth.StrictEndpoint<"/dgii-ecf/service-availability", {
|
|
939
|
+
method: "GET";
|
|
940
|
+
query: better_auth.ZodObject<{
|
|
941
|
+
environment: better_auth.ZodEnum<{
|
|
942
|
+
precertification: "precertification";
|
|
943
|
+
production: "production";
|
|
944
|
+
certification: "certification";
|
|
945
|
+
}>;
|
|
946
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
947
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
948
|
+
}, zod_v4_core.$strip>;
|
|
949
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
950
|
+
session: {
|
|
951
|
+
session: Record<string, any> & {
|
|
952
|
+
id: string;
|
|
953
|
+
createdAt: Date;
|
|
954
|
+
updatedAt: Date;
|
|
955
|
+
userId: string;
|
|
956
|
+
expiresAt: Date;
|
|
957
|
+
token: string;
|
|
958
|
+
ipAddress?: string | null | undefined;
|
|
959
|
+
userAgent?: string | null | undefined;
|
|
960
|
+
};
|
|
961
|
+
user: Record<string, any> & {
|
|
962
|
+
id: string;
|
|
963
|
+
createdAt: Date;
|
|
964
|
+
updatedAt: Date;
|
|
965
|
+
email: string;
|
|
966
|
+
emailVerified: boolean;
|
|
967
|
+
name: string;
|
|
968
|
+
image?: string | null | undefined;
|
|
969
|
+
};
|
|
970
|
+
};
|
|
971
|
+
}>>[];
|
|
972
|
+
}, {
|
|
973
|
+
environmentChecked: "precertification" | "production" | "certification";
|
|
974
|
+
estado: _deuriib_dgii_ecf.ServiceAvailability;
|
|
975
|
+
taxPayerId: string;
|
|
976
|
+
organizationId: string | null;
|
|
977
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
978
|
+
}>;
|
|
979
|
+
dgiiEcfListSubmissions: better_auth.StrictEndpoint<"/dgii-ecf/submissions", {
|
|
980
|
+
method: "GET";
|
|
981
|
+
query: better_auth.ZodObject<{
|
|
982
|
+
limit: better_auth.ZodOptional<better_auth.ZodCoercedNumber<unknown>>;
|
|
983
|
+
status: better_auth.ZodOptional<better_auth.ZodEnum<{
|
|
984
|
+
pending: "pending";
|
|
985
|
+
succeeded: "succeeded";
|
|
986
|
+
failed: "failed";
|
|
987
|
+
}>>;
|
|
988
|
+
taxPayerId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
989
|
+
organizationId: better_auth.ZodOptional<better_auth.ZodString>;
|
|
990
|
+
}, zod_v4_core.$strip>;
|
|
991
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
992
|
+
session: {
|
|
993
|
+
session: Record<string, any> & {
|
|
994
|
+
id: string;
|
|
995
|
+
createdAt: Date;
|
|
996
|
+
updatedAt: Date;
|
|
997
|
+
userId: string;
|
|
998
|
+
expiresAt: Date;
|
|
999
|
+
token: string;
|
|
1000
|
+
ipAddress?: string | null | undefined;
|
|
1001
|
+
userAgent?: string | null | undefined;
|
|
1002
|
+
};
|
|
1003
|
+
user: Record<string, any> & {
|
|
1004
|
+
id: string;
|
|
1005
|
+
createdAt: Date;
|
|
1006
|
+
updatedAt: Date;
|
|
1007
|
+
email: string;
|
|
1008
|
+
emailVerified: boolean;
|
|
1009
|
+
name: string;
|
|
1010
|
+
image?: string | null | undefined;
|
|
1011
|
+
};
|
|
1012
|
+
};
|
|
1013
|
+
}>>[];
|
|
1014
|
+
}, {
|
|
1015
|
+
submissions: {
|
|
1016
|
+
id: string;
|
|
1017
|
+
operation: string;
|
|
1018
|
+
status: SubmissionStatus;
|
|
1019
|
+
taxPayerId: string;
|
|
1020
|
+
organizationId: string | null;
|
|
1021
|
+
environment: string;
|
|
1022
|
+
encf: string | null;
|
|
1023
|
+
trackId: string | null;
|
|
1024
|
+
documentHash: string | null;
|
|
1025
|
+
errorCode: string | null;
|
|
1026
|
+
createdAt: string | Date | null;
|
|
1027
|
+
}[];
|
|
1028
|
+
taxPayerId: string;
|
|
1029
|
+
organizationId: string | null;
|
|
1030
|
+
environment: _deuriib_dgii_ecf.Environment;
|
|
1031
|
+
}>;
|
|
1032
|
+
};
|
|
1033
|
+
rateLimit: {
|
|
1034
|
+
window: number;
|
|
1035
|
+
max: number;
|
|
1036
|
+
pathMatcher: (path: string) => boolean;
|
|
1037
|
+
}[];
|
|
1038
|
+
} & {
|
|
1039
|
+
clientProvider: DgiiEcfClientProvider;
|
|
1040
|
+
};
|
|
1041
|
+
/**
|
|
1042
|
+
* Public type of the plugin.
|
|
1043
|
+
*
|
|
1044
|
+
* `ReturnType` rather than an interface on purpose: an explicit interface would
|
|
1045
|
+
* widen `endpoints` to an index signature and destroy the client-side inference
|
|
1046
|
+
* that makes a renamed path a compile error.
|
|
1047
|
+
*/
|
|
1048
|
+
type DgiiEcfPlugin = ReturnType<typeof dgiiEcf>;
|
|
1049
|
+
|
|
1050
|
+
declare module '@better-auth/core' {
|
|
1051
|
+
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
1052
|
+
'dgii-ecf': {
|
|
1053
|
+
creator: typeof dgiiEcf;
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
export { type DgiiEcfPlugin as D, SUBMISSION_MODEL as S, type TaxPayerIdValidation as T, type DgiiEcfAuthorizer as a, type DgiiEcfClientCacheOptions as b, type DgiiEcfClientProvider as c, type DgiiEcfClientResolver as d, type DgiiEcfCredentialsResolver as e, type DgiiEcfOptions as f, type DgiiEcfOrganizationOptions as g, type DgiiEcfPersistenceOptions as h, type DgiiEcfScope as i, type DgiiEcfStatusOptions as j, type DgiiEcfSubmissionStore as k, type DgiiEcfTaxPayerIdResolver as l, type DgiiEcfTaxPayerIdSource as m, type SubmissionRecord as n, type SubmissionStatus as o, type TaxPayerIdValidator as p, dgiiEcf as q, dgiiEcfOrganizationSchema as r, isTaxPayerIdShape as s, normalizeTaxPayerId as t };
|