kinde-testkit 0.6.0 → 0.7.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/CHANGELOG.md +19 -0
- package/README.md +89 -3
- package/dist/chunk-2QJ7DTNL.js +72 -0
- package/dist/chunk-2QJ7DTNL.js.map +1 -0
- package/dist/chunk-33AHOLUN.js +183 -0
- package/dist/chunk-33AHOLUN.js.map +1 -0
- package/dist/chunk-JTAB2S44.js +3697 -0
- package/dist/chunk-JTAB2S44.js.map +1 -0
- package/dist/cli.js +50 -3561
- package/dist/cli.js.map +1 -0
- package/dist/cypress.cjs +286 -17
- package/dist/cypress.d.cts +2 -96
- package/dist/cypress.d.ts +3 -96
- package/dist/cypress.js +2 -3303
- package/dist/cypress.js.map +1 -1
- package/dist/handle-E_BhdHx8.d.ts +33 -0
- package/dist/handle-estfqypp.d.cts +32 -0
- package/dist/index.cjs +286 -17
- package/dist/index.d.cts +7 -607
- package/dist/index.d.ts +8 -607
- package/dist/index.js +51 -3577
- package/dist/index.js.map +1 -1
- package/dist/jest.cjs +286 -17
- package/dist/jest.d.cts +5 -555
- package/dist/jest.d.ts +6 -555
- package/dist/jest.js +4 -3373
- package/dist/jest.js.map +1 -1
- package/dist/playwright.d.ts +2 -54
- package/dist/server-B9fBcnyQ.d.ts +194 -0
- package/dist/server-CTBJXMac.d.cts +588 -0
- package/dist/vitest.d.ts +6 -555
- package/dist/vitest.js +5 -3376
- package/dist/vitest.js.map +1 -1
- package/dist/webhooks-DJyCsbdF.d.ts +397 -0
- package/package.json +3 -2
- package/dist/cypress-support.d.ts +0 -98
- package/dist/cypress.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/jest.cjs.map +0 -1
package/dist/jest.d.ts
CHANGED
|
@@ -1,557 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
emailVerified: boolean;
|
|
7
|
-
givenName: string | null;
|
|
8
|
-
familyName: string | null;
|
|
9
|
-
picture: string | null;
|
|
10
|
-
claims: Record<string, unknown>;
|
|
11
|
-
}
|
|
12
|
-
interface KindeOrganization {
|
|
13
|
-
code: string;
|
|
14
|
-
name: string;
|
|
15
|
-
metadata: Record<string, unknown>;
|
|
16
|
-
}
|
|
17
|
-
interface KindeRole {
|
|
18
|
-
id: string;
|
|
19
|
-
key: string;
|
|
20
|
-
name: string;
|
|
21
|
-
}
|
|
22
|
-
interface KindeApplication {
|
|
23
|
-
clientId: string;
|
|
24
|
-
clientSecret: string | null;
|
|
25
|
-
name: string;
|
|
26
|
-
organizationCode: string | null;
|
|
27
|
-
scopes: string[] | null;
|
|
28
|
-
permissions: string[] | null;
|
|
29
|
-
audience: string[] | null;
|
|
30
|
-
}
|
|
31
|
-
interface KindeMembership {
|
|
32
|
-
userId: string;
|
|
33
|
-
organizationCode: string;
|
|
34
|
-
roles: string[];
|
|
35
|
-
permissions: string[];
|
|
36
|
-
}
|
|
37
|
-
interface AuthenticatedScenario {
|
|
38
|
-
kind: "authenticated";
|
|
39
|
-
user: KindeUser;
|
|
40
|
-
organization: KindeOrganization | null;
|
|
41
|
-
roles: string[];
|
|
42
|
-
permissions: string[];
|
|
43
|
-
claims: Record<string, unknown>;
|
|
44
|
-
}
|
|
45
|
-
interface UnauthenticatedScenario {
|
|
46
|
-
kind: "unauthenticated";
|
|
47
|
-
}
|
|
48
|
-
type Scenario = AuthenticatedScenario | UnauthenticatedScenario;
|
|
49
|
-
interface KindePrincipal {
|
|
50
|
-
type: "user" | "machine";
|
|
51
|
-
subject: string;
|
|
52
|
-
issuer: string;
|
|
53
|
-
organization: {
|
|
54
|
-
code: string;
|
|
55
|
-
} | null;
|
|
56
|
-
roles: string[];
|
|
57
|
-
permissions: string[];
|
|
58
|
-
claims: Record<string, unknown>;
|
|
59
|
-
}
|
|
60
|
-
type InvalidTokenKind = "expired" | "wrong-issuer" | "wrong-audience" | "missing-subject" | "missing-organization" | "missing-permissions" | "future-iat" | "bad-signature" | "unknown-key" | "unsigned";
|
|
61
|
-
type Duration = number | `${number}${"s" | "m" | "h" | "d"}`;
|
|
62
|
-
interface KindeTokenOptions {
|
|
63
|
-
subject?: string;
|
|
64
|
-
organizationCode?: string | null;
|
|
65
|
-
permissions?: string[];
|
|
66
|
-
roles?: Array<string | KindeRole>;
|
|
67
|
-
scopes?: string[];
|
|
68
|
-
featureFlags?: Record<string, {
|
|
69
|
-
t: "b" | "s" | "i";
|
|
70
|
-
v: boolean | string | number;
|
|
71
|
-
}>;
|
|
72
|
-
claims?: Record<string, unknown>;
|
|
73
|
-
authMethods?: string[];
|
|
74
|
-
authTime?: number;
|
|
75
|
-
clientId?: string;
|
|
76
|
-
audience?: string[];
|
|
77
|
-
expiresIn?: Duration;
|
|
78
|
-
invalid?: InvalidTokenKind;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
interface KindeTestkitOptions {
|
|
82
|
-
issuer?: string;
|
|
83
|
-
audience?: string | string[];
|
|
84
|
-
clientId?: string;
|
|
85
|
-
accessTokenExpiresIn?: Duration;
|
|
86
|
-
idTokenExpiresIn?: Duration;
|
|
87
|
-
now?: () => number;
|
|
88
|
-
}
|
|
89
|
-
type ScenarioTokenOverrides = Pick<KindeTokenOptions, "expiresIn" | "invalid" | "scopes" | "featureFlags" | "claims" | "authMethods" | "authTime" | "clientId" | "audience">;
|
|
90
|
-
interface M2MTokenOptions {
|
|
91
|
-
clientId?: string;
|
|
92
|
-
organizationCode?: string | null;
|
|
93
|
-
scopes?: string[];
|
|
94
|
-
grantedScopes?: string[];
|
|
95
|
-
audience?: string[];
|
|
96
|
-
permissions?: string[];
|
|
97
|
-
claims?: Record<string, unknown>;
|
|
98
|
-
expiresIn?: Duration;
|
|
99
|
-
invalid?: InvalidTokenKind;
|
|
100
|
-
}
|
|
101
|
-
interface IdTokenOptions {
|
|
102
|
-
expiresIn?: Duration;
|
|
103
|
-
authMethods?: string[];
|
|
104
|
-
authTime?: number;
|
|
105
|
-
clientId?: string;
|
|
106
|
-
nonce?: string;
|
|
107
|
-
}
|
|
108
|
-
/** Receives every token the testkit signs, for coverage and the dashboard. */
|
|
109
|
-
interface TokenObserver {
|
|
110
|
-
accessToken?(payload: Record<string, unknown>, invalid: InvalidTokenKind | undefined, token: string): void;
|
|
111
|
-
idToken?(payload: Record<string, unknown>, token: string): void;
|
|
112
|
-
anonymous?(): void;
|
|
113
|
-
}
|
|
114
|
-
declare class KindeTestkit {
|
|
115
|
-
private observers;
|
|
116
|
-
/** Calls the observer for every token signed from now on. Returns a function that stops it. */
|
|
117
|
-
observe(observer: TokenObserver): () => void;
|
|
118
|
-
private signAccess;
|
|
119
|
-
readonly issuer: string;
|
|
120
|
-
readonly audience: string[];
|
|
121
|
-
readonly clientId: string;
|
|
122
|
-
private readonly accessTokenExpiresIn;
|
|
123
|
-
private readonly idTokenExpiresIn;
|
|
124
|
-
private readonly clock;
|
|
125
|
-
private readonly signingKey;
|
|
126
|
-
private strangerKey;
|
|
127
|
-
static create(options?: KindeTestkitOptions): Promise<KindeTestkit>;
|
|
128
|
-
private constructor();
|
|
129
|
-
get jwksUri(): string;
|
|
130
|
-
get keyId(): string;
|
|
131
|
-
get accessTokenLifetime(): number;
|
|
132
|
-
verify(token: string): Promise<JWTPayload>;
|
|
133
|
-
jwks(): {
|
|
134
|
-
keys: JWK[];
|
|
135
|
-
};
|
|
136
|
-
token(options?: KindeTokenOptions): Promise<string>;
|
|
137
|
-
m2mToken(options?: M2MTokenOptions): Promise<string>;
|
|
138
|
-
tokenFor(scenario: Scenario, overrides?: ScenarioTokenOverrides): Promise<string | null>;
|
|
139
|
-
idTokenFor(scenario: Scenario, options?: IdTokenOptions): Promise<string | null>;
|
|
140
|
-
headersFor(scenario: Scenario, overrides?: ScenarioTokenOverrides): Promise<Record<string, string>>;
|
|
141
|
-
principalFor(scenario: Scenario): KindePrincipal | null;
|
|
142
|
-
signPayload(payload: Record<string, unknown>, invalid?: "bad-signature" | "unknown-key" | "unsigned"): Promise<string>;
|
|
143
|
-
private sign;
|
|
144
|
-
private stranger;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
interface TestkitSeed {
|
|
148
|
-
issuer?: string;
|
|
149
|
-
audience?: string | string[];
|
|
150
|
-
clientId?: string;
|
|
151
|
-
users?: Array<{
|
|
152
|
-
id: string;
|
|
153
|
-
email?: string | null;
|
|
154
|
-
emailVerified?: boolean;
|
|
155
|
-
givenName?: string | null;
|
|
156
|
-
familyName?: string | null;
|
|
157
|
-
picture?: string | null;
|
|
158
|
-
claims?: Record<string, unknown>;
|
|
159
|
-
properties?: Record<string, string | number | boolean>;
|
|
160
|
-
}>;
|
|
161
|
-
organizations?: Array<{
|
|
162
|
-
code: string;
|
|
163
|
-
name?: string;
|
|
164
|
-
metadata?: Record<string, unknown>;
|
|
165
|
-
}>;
|
|
166
|
-
memberships?: Array<{
|
|
167
|
-
user: string;
|
|
168
|
-
organization: string;
|
|
169
|
-
roles?: string[];
|
|
170
|
-
permissions?: string[];
|
|
171
|
-
}>;
|
|
172
|
-
webhooks?: Array<{
|
|
173
|
-
url: string;
|
|
174
|
-
events?: string[];
|
|
175
|
-
}>;
|
|
176
|
-
roles?: Array<{
|
|
177
|
-
key: string;
|
|
178
|
-
name?: string;
|
|
179
|
-
description?: string;
|
|
180
|
-
permissions?: string[];
|
|
181
|
-
isDefault?: boolean;
|
|
182
|
-
}>;
|
|
183
|
-
featureFlags?: Array<{
|
|
184
|
-
key: string;
|
|
185
|
-
name?: string;
|
|
186
|
-
type?: "boolean" | "string" | "integer";
|
|
187
|
-
value: boolean | string | number;
|
|
188
|
-
organizations?: Record<string, boolean | string | number>;
|
|
189
|
-
}>;
|
|
190
|
-
plans?: Array<{
|
|
191
|
-
key: string;
|
|
192
|
-
name?: string;
|
|
193
|
-
subscribers?: string[];
|
|
194
|
-
entitlements?: Array<{
|
|
195
|
-
featureKey: string;
|
|
196
|
-
featureName?: string;
|
|
197
|
-
priceName?: string;
|
|
198
|
-
fixedCharge?: number | null;
|
|
199
|
-
unitAmount?: number | null;
|
|
200
|
-
limitMax?: number | null;
|
|
201
|
-
limitMin?: number | null;
|
|
202
|
-
}>;
|
|
203
|
-
}>;
|
|
204
|
-
permissions?: Array<{
|
|
205
|
-
key: string;
|
|
206
|
-
name?: string;
|
|
207
|
-
description?: string;
|
|
208
|
-
}>;
|
|
209
|
-
applications?: Array<{
|
|
210
|
-
clientId: string;
|
|
211
|
-
clientSecret?: string;
|
|
212
|
-
name?: string;
|
|
213
|
-
organization?: string;
|
|
214
|
-
scopes?: string[];
|
|
215
|
-
permissions?: string[];
|
|
216
|
-
audience?: string | string[];
|
|
217
|
-
}>;
|
|
218
|
-
}
|
|
219
|
-
interface ResolvedSeed {
|
|
220
|
-
users: KindeUser[];
|
|
221
|
-
organizations: KindeOrganization[];
|
|
222
|
-
memberships: KindeMembership[];
|
|
223
|
-
applications: KindeApplication[];
|
|
224
|
-
webhooks: Array<{
|
|
225
|
-
url: string;
|
|
226
|
-
events?: string[];
|
|
227
|
-
}>;
|
|
228
|
-
roles: SeedRole[];
|
|
229
|
-
permissions: SeedPermission[];
|
|
230
|
-
featureFlags: SeedFeatureFlag[];
|
|
231
|
-
plans: SeedPlan[];
|
|
232
|
-
userProperties: Record<string, Record<string, string | number | boolean>>;
|
|
233
|
-
}
|
|
234
|
-
interface SeedFeatureFlag {
|
|
235
|
-
id: string;
|
|
236
|
-
key: string;
|
|
237
|
-
name: string;
|
|
238
|
-
type: "boolean" | "string" | "integer";
|
|
239
|
-
value: boolean | string | number;
|
|
240
|
-
organizations: Record<string, boolean | string | number>;
|
|
241
|
-
}
|
|
242
|
-
interface SeedPlan {
|
|
243
|
-
key: string;
|
|
244
|
-
name: string;
|
|
245
|
-
subscribers: string[];
|
|
246
|
-
subscribedOn: string;
|
|
247
|
-
entitlements: Array<{
|
|
248
|
-
id: string;
|
|
249
|
-
featureKey: string;
|
|
250
|
-
featureName: string;
|
|
251
|
-
priceName: string;
|
|
252
|
-
fixedCharge: number | null;
|
|
253
|
-
unitAmount: number | null;
|
|
254
|
-
limitMax: number | null;
|
|
255
|
-
limitMin: number | null;
|
|
256
|
-
}>;
|
|
257
|
-
}
|
|
258
|
-
interface SeedRole {
|
|
259
|
-
id: string;
|
|
260
|
-
key: string;
|
|
261
|
-
name: string;
|
|
262
|
-
description: string | null;
|
|
263
|
-
isDefault: boolean;
|
|
264
|
-
permissions: string[];
|
|
265
|
-
}
|
|
266
|
-
interface SeedPermission {
|
|
267
|
-
id: string;
|
|
268
|
-
key: string;
|
|
269
|
-
name: string;
|
|
270
|
-
description: string | null;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
interface UserMeta {
|
|
274
|
-
providedId: string | null;
|
|
275
|
-
isSuspended: boolean;
|
|
276
|
-
isPasswordResetRequested: boolean;
|
|
277
|
-
createdOn: string;
|
|
278
|
-
totalSignIns: number;
|
|
279
|
-
lastSignedIn: string | null;
|
|
280
|
-
}
|
|
281
|
-
interface OrganizationMeta {
|
|
282
|
-
externalId: string | null;
|
|
283
|
-
handle: string;
|
|
284
|
-
createdOn: string;
|
|
285
|
-
isAllowRegistrations: boolean;
|
|
286
|
-
}
|
|
287
|
-
declare class Directory {
|
|
288
|
-
readonly seed: ResolvedSeed;
|
|
289
|
-
private readonly userMeta;
|
|
290
|
-
private readonly orgMeta;
|
|
291
|
-
private snapshot;
|
|
292
|
-
constructor(seed: ResolvedSeed);
|
|
293
|
-
restore(): void;
|
|
294
|
-
/** Replaces the whole seed with another resolved seed, and makes it the state reset() returns to. */
|
|
295
|
-
load(next: ResolvedSeed): void;
|
|
296
|
-
user(id: string): KindeUser | undefined;
|
|
297
|
-
meta(user: KindeUser): UserMeta;
|
|
298
|
-
isSuspended(userId: string): boolean;
|
|
299
|
-
recordSignIn(user: KindeUser, organizationCode: string | null): void;
|
|
300
|
-
createUser(input: {
|
|
301
|
-
email?: string | null;
|
|
302
|
-
givenName?: string | null;
|
|
303
|
-
familyName?: string | null;
|
|
304
|
-
picture?: string | null;
|
|
305
|
-
providedId?: string | null;
|
|
306
|
-
}): KindeUser;
|
|
307
|
-
deleteUser(id: string): boolean;
|
|
308
|
-
organization(code: string): KindeOrganization | undefined;
|
|
309
|
-
orgInfo(org: KindeOrganization): OrganizationMeta;
|
|
310
|
-
createOrganization(input: {
|
|
311
|
-
name: string;
|
|
312
|
-
externalId?: string | null;
|
|
313
|
-
handle?: string | null;
|
|
314
|
-
}): KindeOrganization;
|
|
315
|
-
deleteOrganization(code: string): boolean;
|
|
316
|
-
membership(userId: string, organizationCode: string): KindeMembership | undefined;
|
|
317
|
-
addMembership(userId: string, organizationCode: string, roles?: string[], permissions?: string[]): KindeMembership;
|
|
318
|
-
removeMembership(userId: string, organizationCode: string): boolean;
|
|
319
|
-
role(idOrKey: string): SeedRole | undefined;
|
|
320
|
-
permission(idOrKey: string): SeedPermission | undefined;
|
|
321
|
-
ensureRole(key: string, extra?: Partial<Omit<SeedRole, "id" | "key">>): SeedRole;
|
|
322
|
-
ensurePermission(key: string, extra?: Partial<Omit<SeedPermission, "id" | "key">>): SeedPermission;
|
|
323
|
-
deleteRole(id: string): SeedRole | undefined;
|
|
324
|
-
deletePermission(id: string): SeedPermission | undefined;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
interface FailureRule {
|
|
328
|
-
path: string;
|
|
329
|
-
method?: string;
|
|
330
|
-
status?: number;
|
|
331
|
-
delayMs?: number;
|
|
332
|
-
hang?: boolean;
|
|
333
|
-
times?: number;
|
|
334
|
-
retryAfter?: number;
|
|
335
|
-
}
|
|
336
|
-
interface ActiveFailure {
|
|
337
|
-
id: string;
|
|
338
|
-
path: string;
|
|
339
|
-
method: string | null;
|
|
340
|
-
status: number | null;
|
|
341
|
-
delayMs: number;
|
|
342
|
-
hang: boolean;
|
|
343
|
-
remaining: number | null;
|
|
344
|
-
retryAfter: number;
|
|
345
|
-
hits: number;
|
|
346
|
-
}
|
|
347
|
-
declare class FailureInjector {
|
|
348
|
-
private rules;
|
|
349
|
-
private nextId;
|
|
350
|
-
add(rule: FailureRule): ActiveFailure;
|
|
351
|
-
remove(id: string): boolean;
|
|
352
|
-
clear(): void;
|
|
353
|
-
list(): ActiveFailure[];
|
|
354
|
-
take(method: string, path: string): ActiveFailure | null;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
type WebhookInvalidKind = "bad-signature" | "unknown-key" | "unsigned" | "stale";
|
|
358
|
-
type WebhookSource = "admin" | "api" | "user";
|
|
359
|
-
interface WebhookEndpointInput {
|
|
360
|
-
url: string;
|
|
361
|
-
events?: string[];
|
|
362
|
-
}
|
|
363
|
-
interface WebhookEndpoint {
|
|
364
|
-
id: string;
|
|
365
|
-
url: string;
|
|
366
|
-
events: string[] | null;
|
|
367
|
-
}
|
|
368
|
-
interface SendWebhookOptions {
|
|
369
|
-
type: string;
|
|
370
|
-
data?: Record<string, unknown>;
|
|
371
|
-
user?: string;
|
|
372
|
-
organization?: string;
|
|
373
|
-
role?: string;
|
|
374
|
-
permission?: string;
|
|
375
|
-
source?: WebhookSource;
|
|
376
|
-
ipAddress?: string;
|
|
377
|
-
to?: string;
|
|
378
|
-
duplicate?: number;
|
|
379
|
-
delayMs?: number;
|
|
380
|
-
invalid?: WebhookInvalidKind;
|
|
381
|
-
}
|
|
382
|
-
interface WebhookAttempt {
|
|
383
|
-
attempt: number;
|
|
384
|
-
status: number | null;
|
|
385
|
-
error: string | null;
|
|
386
|
-
durationMs: number;
|
|
387
|
-
}
|
|
388
|
-
interface WebhookDelivery {
|
|
389
|
-
webhookId: string;
|
|
390
|
-
eventId: string;
|
|
391
|
-
type: string;
|
|
392
|
-
url: string;
|
|
393
|
-
copy: number;
|
|
394
|
-
delivered: boolean;
|
|
395
|
-
attempts: WebhookAttempt[];
|
|
396
|
-
payload: Record<string, unknown>;
|
|
397
|
-
}
|
|
398
|
-
interface WebhookOptions {
|
|
399
|
-
retryDelaysMs?: number[];
|
|
400
|
-
timeoutMs?: number;
|
|
401
|
-
}
|
|
402
|
-
declare class WebhookDispatcher {
|
|
403
|
-
private readonly testkit;
|
|
404
|
-
private readonly seed;
|
|
405
|
-
private endpoints;
|
|
406
|
-
private seededEndpoints;
|
|
407
|
-
private log;
|
|
408
|
-
private nextEndpoint;
|
|
409
|
-
private readonly retryDelaysMs;
|
|
410
|
-
private readonly timeoutMs;
|
|
411
|
-
/** Set by the server to record coverage. */
|
|
412
|
-
observe: (id: string) => void;
|
|
413
|
-
constructor(testkit: KindeTestkit, seed: ResolvedSeed, endpoints?: WebhookEndpointInput[], options?: WebhookOptions);
|
|
414
|
-
addEndpoint(input: WebhookEndpointInput): WebhookEndpoint;
|
|
415
|
-
/** Replaces the endpoints that came from the seed, as when a new seed is loaded. */
|
|
416
|
-
replaceSeededEndpoints(endpoints: WebhookEndpointInput[]): void;
|
|
417
|
-
removeEndpoint(id: string): boolean;
|
|
418
|
-
listEndpoints(): WebhookEndpoint[];
|
|
419
|
-
deliveries(): WebhookDelivery[];
|
|
420
|
-
reset(): void;
|
|
421
|
-
buildEvent(options: SendWebhookOptions): Record<string, unknown>;
|
|
422
|
-
send(options: SendWebhookOptions): Promise<WebhookDelivery[]>;
|
|
423
|
-
private deliver;
|
|
424
|
-
private buildData;
|
|
425
|
-
emit(type: string, data: Record<string, unknown>, source?: WebhookSource): void;
|
|
426
|
-
userEventData(user: KindeUser): Record<string, unknown>;
|
|
427
|
-
emitForUser(type: "user.created" | "user.authenticated", user: KindeUser): void;
|
|
428
|
-
private userData;
|
|
429
|
-
private userPayload;
|
|
430
|
-
private organizationData;
|
|
431
|
-
private namedData;
|
|
432
|
-
private requireUser;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
interface RequestEntry {
|
|
436
|
-
at: string;
|
|
437
|
-
method: string;
|
|
438
|
-
path: string;
|
|
439
|
-
status: number;
|
|
440
|
-
durationMs: number;
|
|
441
|
-
injected: boolean;
|
|
442
|
-
}
|
|
443
|
-
interface TokenEntry {
|
|
444
|
-
at: string;
|
|
445
|
-
kind: "access" | "m2m" | "id";
|
|
446
|
-
subject: string | null;
|
|
447
|
-
organization: string | null;
|
|
448
|
-
permissions: string[];
|
|
449
|
-
roles: string[];
|
|
450
|
-
invalid: InvalidTokenKind | null;
|
|
451
|
-
expiresAt: string | null;
|
|
452
|
-
claims: Record<string, unknown>;
|
|
453
|
-
token: string;
|
|
454
|
-
}
|
|
455
|
-
/** Keeps the latest requests and tokens for the dashboard and `kinde-testkit inspect --requests`. */
|
|
456
|
-
declare class ActivityLog {
|
|
457
|
-
private requestLog;
|
|
458
|
-
private tokenLog;
|
|
459
|
-
request(entry: Omit<RequestEntry, "at" | "path"> & {
|
|
460
|
-
path: string;
|
|
461
|
-
query: URLSearchParams;
|
|
462
|
-
}): void;
|
|
463
|
-
token(kind: TokenEntry["kind"], claims: Record<string, unknown>, invalid: InvalidTokenKind | undefined, token: string): void;
|
|
464
|
-
requests(): RequestEntry[];
|
|
465
|
-
tokens(): TokenEntry[];
|
|
466
|
-
reset(): void;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
interface CoverageItem {
|
|
470
|
-
id: string;
|
|
471
|
-
label: string;
|
|
472
|
-
hint: string;
|
|
473
|
-
}
|
|
474
|
-
interface CoverageGroupResult {
|
|
475
|
-
name: string;
|
|
476
|
-
covered: number;
|
|
477
|
-
total: number;
|
|
478
|
-
items: Array<CoverageItem & {
|
|
479
|
-
covered: boolean;
|
|
480
|
-
count: number;
|
|
481
|
-
}>;
|
|
482
|
-
}
|
|
483
|
-
interface CoverageReport {
|
|
484
|
-
covered: number;
|
|
485
|
-
total: number;
|
|
486
|
-
groups: CoverageGroupResult[];
|
|
487
|
-
}
|
|
488
|
-
interface CoverageSnapshot {
|
|
489
|
-
version: 1;
|
|
490
|
-
hits: Record<string, number>;
|
|
491
|
-
}
|
|
492
|
-
/** Records which authentication scenarios the testkit produced during a test run. */
|
|
493
|
-
declare class CoverageRecorder {
|
|
494
|
-
private hits;
|
|
495
|
-
private userOrganizations;
|
|
496
|
-
private organizationUsers;
|
|
497
|
-
private organizationPermissionSets;
|
|
498
|
-
hit(id: string): void;
|
|
499
|
-
/** Called for every access token the testkit signs. */
|
|
500
|
-
observeAccessToken(payload: Record<string, unknown>, invalid: InvalidTokenKind | undefined): void;
|
|
501
|
-
report(): CoverageReport;
|
|
502
|
-
snapshot(): CoverageSnapshot;
|
|
503
|
-
reset(): void;
|
|
504
|
-
/** Writes this run's snapshot to the coverage folder, so separate test files can be merged. */
|
|
505
|
-
write(directory?: string): string;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
interface StartKindeTestkitOptions {
|
|
509
|
-
port?: number;
|
|
510
|
-
host?: string;
|
|
511
|
-
issuer?: string;
|
|
512
|
-
audience?: string | string[];
|
|
513
|
-
clientId?: string;
|
|
514
|
-
/** A seed object, or the path of a JSON, YAML, JavaScript or TypeScript seed file. */
|
|
515
|
-
seed?: TestkitSeed | string;
|
|
516
|
-
allowPublic?: boolean;
|
|
517
|
-
/** Write this run's authentication coverage to a folder when the testkit closes. */
|
|
518
|
-
coverage?: boolean | {
|
|
519
|
-
directory?: string;
|
|
520
|
-
};
|
|
521
|
-
webhooks?: WebhookOptions;
|
|
522
|
-
https?: boolean | {
|
|
523
|
-
certDirectory?: string;
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
interface KindeTestAuth {
|
|
528
|
-
token: string | null;
|
|
529
|
-
headers: Record<string, string>;
|
|
530
|
-
principal: KindePrincipal | null;
|
|
531
|
-
request: {
|
|
532
|
-
headers: Record<string, string>;
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
declare function kindeTest(options: {
|
|
536
|
-
scenario: Scenario;
|
|
537
|
-
testkit?: KindeTestkit;
|
|
538
|
-
token?: ScenarioTokenOverrides;
|
|
539
|
-
}): Promise<KindeTestAuth>;
|
|
540
|
-
interface KindeTestkitHandle {
|
|
541
|
-
readonly url: string;
|
|
542
|
-
readonly issuer: string;
|
|
543
|
-
readonly jwksUri: string;
|
|
544
|
-
readonly testkit: KindeTestkit;
|
|
545
|
-
readonly failures: FailureInjector;
|
|
546
|
-
readonly webhooks: WebhookDispatcher;
|
|
547
|
-
readonly directory: Directory;
|
|
548
|
-
readonly coverage: CoverageRecorder;
|
|
549
|
-
readonly activity: ActivityLog;
|
|
550
|
-
readonly certificatePath: string | null;
|
|
551
|
-
auth(scenario: Scenario, token?: ScenarioTokenOverrides): Promise<KindeTestAuth>;
|
|
552
|
-
loadSeed(seed: TestkitSeed): void;
|
|
553
|
-
reset(): void;
|
|
554
|
-
}
|
|
1
|
+
import { a as KindeTestkitHandle } from './handle-E_BhdHx8.js';
|
|
2
|
+
export { K as KindeTestAuth, k as kindeTest } from './handle-E_BhdHx8.js';
|
|
3
|
+
import { S as StartKindeTestkitOptions } from './server-B9fBcnyQ.js';
|
|
4
|
+
import './webhooks-DJyCsbdF.js';
|
|
5
|
+
import 'jose';
|
|
555
6
|
|
|
556
7
|
type Hook = (fn: () => Promise<void>, timeout?: number) => void;
|
|
557
8
|
/**
|
|
@@ -564,4 +15,4 @@ declare function useKindeTestkit(options?: StartKindeTestkitOptions, hooks?: {
|
|
|
564
15
|
afterAll: Hook;
|
|
565
16
|
}): KindeTestkitHandle;
|
|
566
17
|
|
|
567
|
-
export {
|
|
18
|
+
export { KindeTestkitHandle, useKindeTestkit };
|