kinde-testkit 0.5.0 → 0.6.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.
@@ -0,0 +1,98 @@
1
+ interface FailureRule {
2
+ path: string;
3
+ method?: string;
4
+ status?: number;
5
+ delayMs?: number;
6
+ hang?: boolean;
7
+ times?: number;
8
+ retryAfter?: number;
9
+ }
10
+ interface ActiveFailure {
11
+ id: string;
12
+ path: string;
13
+ method: string | null;
14
+ status: number | null;
15
+ delayMs: number;
16
+ hang: boolean;
17
+ remaining: number | null;
18
+ retryAfter: number;
19
+ hits: number;
20
+ }
21
+
22
+ type WebhookInvalidKind = "bad-signature" | "unknown-key" | "unsigned" | "stale";
23
+ type WebhookSource = "admin" | "api" | "user";
24
+ interface SendWebhookOptions {
25
+ type: string;
26
+ data?: Record<string, unknown>;
27
+ user?: string;
28
+ organization?: string;
29
+ role?: string;
30
+ permission?: string;
31
+ source?: WebhookSource;
32
+ ipAddress?: string;
33
+ to?: string;
34
+ duplicate?: number;
35
+ delayMs?: number;
36
+ invalid?: WebhookInvalidKind;
37
+ }
38
+ interface WebhookAttempt {
39
+ attempt: number;
40
+ status: number | null;
41
+ error: string | null;
42
+ durationMs: number;
43
+ }
44
+ interface WebhookDelivery {
45
+ webhookId: string;
46
+ eventId: string;
47
+ type: string;
48
+ url: string;
49
+ copy: number;
50
+ delivered: boolean;
51
+ attempts: WebhookAttempt[];
52
+ payload: Record<string, unknown>;
53
+ }
54
+
55
+ interface KindeSignInOptions {
56
+ /** Active organization, for users in more than one. */
57
+ org?: string;
58
+ /** Your app's login route. Default /api/auth/login, as in Kinde's Next.js SDK. */
59
+ loginPath?: string;
60
+ }
61
+ interface KindeSignOutOptions {
62
+ /** Your app's logout route. Default /api/auth/logout. */
63
+ logoutPath?: string;
64
+ }
65
+ interface KindeTokenRequest {
66
+ user?: string;
67
+ organization?: string;
68
+ subject?: string;
69
+ permissions?: string[];
70
+ roles?: string[];
71
+ expiresIn?: string | number;
72
+ invalid?: string;
73
+ m2m?: boolean;
74
+ clientId?: string;
75
+ scopes?: string[];
76
+ }
77
+ declare global {
78
+ namespace Cypress {
79
+ interface Chainable<Subject = any> {
80
+ /** Signs a seeded user in through your app's login route, with requests instead of the sign-in page. */
81
+ kindeSignIn(user: string, options?: KindeSignInOptions): Chainable<void>;
82
+ /** Opens your app's logout route. */
83
+ kindeSignOut(options?: KindeSignOutOptions): Chainable<void>;
84
+ /** Mints an access token from the testkit. */
85
+ kindeToken(options: KindeTokenRequest): Chainable<string>;
86
+ /** Makes a testkit endpoint fail, slow down or hang until the test ends. */
87
+ kindeInjectFailure(rule: FailureRule): Chainable<ActiveFailure>;
88
+ /** Removes the failures this test added. */
89
+ kindeClearFailures(): Chainable<void>;
90
+ /** Sends a signed webhook and yields the deliveries. */
91
+ kindeSendWebhook(options: SendWebhookOptions): Chainable<WebhookDelivery[]>;
92
+ /** Clears sessions, failures, webhook deliveries and Management API changes. */
93
+ kindeReset(): Chainable<void>;
94
+ }
95
+ }
96
+ }
97
+
98
+ export type { KindeSignInOptions, KindeSignOutOptions, KindeTokenRequest };
@@ -0,0 +1,119 @@
1
+ // src/sign-in-flow.ts
2
+ function appLoginUrl(loginPath, options) {
3
+ const params = new URLSearchParams({ login_hint: options.user });
4
+ if (options.org) params.set("org_code", options.org);
5
+ return `${loginPath}${loginPath.includes("?") ? "&" : "?"}${params}`;
6
+ }
7
+ function readSignInRequest(html) {
8
+ const match = /name="request" value="([^"]+)"/.exec(html);
9
+ if (!match) {
10
+ throw new Error("The page is not the kinde-testkit sign-in page. Check that the app's KINDE_ISSUER_URL points at the testkit.");
11
+ }
12
+ return decodeEntities(match[1]);
13
+ }
14
+ function signInForm(request, options) {
15
+ const form = { request, email: options.user };
16
+ if (options.org) form.org = options.org;
17
+ return form;
18
+ }
19
+ function signInFailure(status, html, options) {
20
+ if (status === 200 && html.includes("Choose an organization")) {
21
+ return new Error(`${options.user} belongs to more than one organization. Pass one with { org: "org_..." }.`);
22
+ }
23
+ const alert = /role="alert"[^>]*>([\s\S]*?)<\//.exec(html)?.[1];
24
+ const text = alert ? decodeEntities(alert.replace(/<[^>]+>/g, "")).trim() : `the sign-in page answered ${status}`;
25
+ return new Error(`kinde-testkit refused the sign-in: ${text}`);
26
+ }
27
+ function resolveLocation(location2, from) {
28
+ return new URL(location2, from).toString();
29
+ }
30
+ function decodeEntities(value) {
31
+ return value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
32
+ }
33
+
34
+ // src/cypress-support.ts
35
+ var injected = [];
36
+ function issuer() {
37
+ const url = Cypress.env("KINDE_TESTKIT_URL") ?? Cypress.env("KINDE_ISSUER_URL");
38
+ if (!url) {
39
+ throw new Error(
40
+ "kinde-testkit does not know where the issuer is. Call setupKindeTestkit(on, config) from setupNodeEvents in cypress.config, or set env KINDE_TESTKIT_URL."
41
+ );
42
+ }
43
+ return url.replace(/\/+$/, "");
44
+ }
45
+ function appBase() {
46
+ const base = Cypress.config("baseUrl");
47
+ if (!base) throw new Error("Set baseUrl in cypress.config so kinde-testkit can find your app's login route.");
48
+ return base.replace(/\/+$/, "");
49
+ }
50
+ function location(response, from) {
51
+ const header = response.headers.location;
52
+ const value = Array.isArray(header) ? header[0] : header;
53
+ if (!value) throw new Error(`Expected a redirect from ${from}, got ${response.status}.`);
54
+ return resolveLocation(value, from);
55
+ }
56
+ function control(method, path, body) {
57
+ return cy.request({ method, url: `${issuer()}${path}`, body, failOnStatusCode: false, log: false }).then((response) => {
58
+ if (response.status >= 400 && response.status !== 404) {
59
+ throw new Error(response.body?.error_description ?? `kinde-testkit answered ${response.status} for ${path}.`);
60
+ }
61
+ return response.body;
62
+ });
63
+ }
64
+ Cypress.Commands.add("kindeSignIn", (user, options = {}) => {
65
+ const signIn = { user, org: options.org };
66
+ const start = `${appBase()}${appLoginUrl(options.loginPath ?? "/api/auth/login", signIn)}`;
67
+ Cypress.log({ name: "kindeSignIn", message: options.org ? `${user} in ${options.org}` : user });
68
+ return cy.request({ url: start, followRedirect: false, log: false }).then((response) => {
69
+ const signInPage = location(response, start);
70
+ if (!signInPage.startsWith(issuer())) {
71
+ throw new Error(`Expected the login route to redirect to kinde-testkit at ${issuer()}, but it went to ${signInPage}. Check the app's KINDE_ISSUER_URL.`);
72
+ }
73
+ return cy.request({ url: signInPage, log: false });
74
+ }).then(
75
+ (page) => cy.request({
76
+ method: "POST",
77
+ url: `${issuer()}/oauth2/auth/login`,
78
+ form: true,
79
+ body: signInForm(readSignInRequest(page.body), signIn),
80
+ followRedirect: false,
81
+ failOnStatusCode: false,
82
+ log: false
83
+ })
84
+ ).then((response) => {
85
+ if (response.status !== 302 && response.status !== 303) throw signInFailure(response.status, String(response.body), signIn);
86
+ return cy.visit(location(response, `${issuer()}/oauth2/auth/login`));
87
+ });
88
+ });
89
+ Cypress.Commands.add("kindeSignOut", (options = {}) => {
90
+ return cy.visit(`${appBase()}${options.logoutPath ?? "/api/auth/logout"}`);
91
+ });
92
+ Cypress.Commands.add("kindeToken", (options) => {
93
+ return control("POST", "/testkit/token", options).then((body) => body.access_token);
94
+ });
95
+ Cypress.Commands.add("kindeInjectFailure", (rule) => {
96
+ return control("POST", "/testkit/failures", rule).then((failure) => {
97
+ injected.push(failure.id);
98
+ return failure;
99
+ });
100
+ });
101
+ function clearInjected() {
102
+ const ids = injected.splice(0, injected.length);
103
+ let chain = cy.wrap(null, { log: false });
104
+ for (const id of ids) chain = chain.then(() => control("DELETE", `/testkit/failures/${encodeURIComponent(id)}`));
105
+ return chain.then(() => void 0);
106
+ }
107
+ Cypress.Commands.add("kindeClearFailures", () => clearInjected());
108
+ Cypress.Commands.add("kindeSendWebhook", (options) => {
109
+ return control("POST", "/testkit/webhooks", options);
110
+ });
111
+ Cypress.Commands.add("kindeReset", () => {
112
+ injected.length = 0;
113
+ return control("POST", "/testkit/reset").then(() => void 0);
114
+ });
115
+ afterEach(() => {
116
+ if (injected.length > 0) return clearInjected();
117
+ return void 0;
118
+ });
119
+ //# sourceMappingURL=cypress-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sign-in-flow.ts","../src/cypress-support.ts"],"sourcesContent":["/**\n * Steps for signing in through the testkit with plain HTTP requests instead of a browser page.\n * The Cypress commands use these. No Node APIs here, because Cypress bundles this file for the browser.\n */\n\nexport interface RequestSignInOptions {\n /** Email address or ID of the user. */\n user: string;\n /** Active organization, for users in more than one. */\n org?: string;\n}\n\n/** The app's login route, with the hints the testkit sign-in page reads. */\nexport function appLoginUrl(loginPath: string, options: RequestSignInOptions): string {\n const params = new URLSearchParams({ login_hint: options.user });\n if (options.org) params.set(\"org_code\", options.org);\n return `${loginPath}${loginPath.includes(\"?\") ? \"&\" : \"?\"}${params}`;\n}\n\n/** Reads the hidden request field from the testkit sign-in page. */\nexport function readSignInRequest(html: string): string {\n const match = /name=\"request\" value=\"([^\"]+)\"/.exec(html);\n if (!match) {\n throw new Error(\"The page is not the kinde-testkit sign-in page. Check that the app's KINDE_ISSUER_URL points at the testkit.\");\n }\n return decodeEntities(match[1]!);\n}\n\n/** The form the sign-in page posts to /oauth2/auth/login. */\nexport function signInForm(request: string, options: RequestSignInOptions): Record<string, string> {\n const form: Record<string, string> = { request, email: options.user };\n if (options.org) form.org = options.org;\n return form;\n}\n\n/** Explains why the testkit did not redirect back to the app after the form was posted. */\nexport function signInFailure(status: number, html: string, options: RequestSignInOptions): Error {\n if (status === 200 && html.includes(\"Choose an organization\")) {\n return new Error(`${options.user} belongs to more than one organization. Pass one with { org: \"org_...\" }.`);\n }\n const alert = /role=\"alert\"[^>]*>([\\s\\S]*?)<\\//.exec(html)?.[1];\n const text = alert ? decodeEntities(alert.replace(/<[^>]+>/g, \"\")).trim() : `the sign-in page answered ${status}`;\n return new Error(`kinde-testkit refused the sign-in: ${text}`);\n}\n\n/** Resolves a Location header, which can be relative, against the URL that sent it. */\nexport function resolveLocation(location: string, from: string): string {\n return new URL(location, from).toString();\n}\n\nfunction decodeEntities(value: string): string {\n return value\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&quot;/g, '\"')\n .replace(/&#39;/g, \"'\")\n .replace(/&amp;/g, \"&\");\n}\n","/**\n * Cypress commands for kinde-testkit. Import this file from cypress/support/e2e.ts:\n *\n * import \"kinde-testkit/cypress/support\";\n *\n * Runs in the browser, so it calls the testkit with cy.request and never imports Node code.\n */\nimport { appLoginUrl, readSignInRequest, resolveLocation, signInFailure, signInForm, type RequestSignInOptions } from \"./sign-in-flow.js\";\nimport type { ActiveFailure, FailureRule } from \"./failures.js\";\nimport type { SendWebhookOptions, WebhookDelivery } from \"./webhooks.js\";\n\nexport interface KindeSignInOptions {\n /** Active organization, for users in more than one. */\n org?: string;\n /** Your app's login route. Default /api/auth/login, as in Kinde's Next.js SDK. */\n loginPath?: string;\n}\n\nexport interface KindeSignOutOptions {\n /** Your app's logout route. Default /api/auth/logout. */\n logoutPath?: string;\n}\n\nexport interface KindeTokenRequest {\n user?: string;\n organization?: string;\n subject?: string;\n permissions?: string[];\n roles?: string[];\n expiresIn?: string | number;\n invalid?: string;\n m2m?: boolean;\n clientId?: string;\n scopes?: string[];\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Cypress {\n // Matches Cypress's own declaration so the two merge.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n interface Chainable<Subject = any> {\n /** Signs a seeded user in through your app's login route, with requests instead of the sign-in page. */\n kindeSignIn(user: string, options?: KindeSignInOptions): Chainable<void>;\n /** Opens your app's logout route. */\n kindeSignOut(options?: KindeSignOutOptions): Chainable<void>;\n /** Mints an access token from the testkit. */\n kindeToken(options: KindeTokenRequest): Chainable<string>;\n /** Makes a testkit endpoint fail, slow down or hang until the test ends. */\n kindeInjectFailure(rule: FailureRule): Chainable<ActiveFailure>;\n /** Removes the failures this test added. */\n kindeClearFailures(): Chainable<void>;\n /** Sends a signed webhook and yields the deliveries. */\n kindeSendWebhook(options: SendWebhookOptions): Chainable<WebhookDelivery[]>;\n /** Clears sessions, failures, webhook deliveries and Management API changes. */\n kindeReset(): Chainable<void>;\n }\n }\n}\n\ninterface CyResponse<T = unknown> {\n status: number;\n body: T;\n headers: Record<string, string | string[]>;\n}\n\ninterface CyRequestOptions {\n method?: string;\n url: string;\n body?: unknown;\n form?: boolean;\n followRedirect?: boolean;\n failOnStatusCode?: boolean;\n log?: boolean;\n}\n\ninterface CyChain<T = unknown> {\n then<R>(fn: (value: T) => R): CyChain<R extends CyChain<infer U> ? U : R>;\n}\n\ninterface Cy {\n request<T = unknown>(options: CyRequestOptions): CyChain<CyResponse<T>>;\n visit(url: string): CyChain;\n wrap<T>(value: T, options?: { log?: boolean }): CyChain<T>;\n url(): CyChain<string>;\n}\n\ninterface CypressStatic {\n env(name: string): unknown;\n config(name: string): unknown;\n Commands: { add(name: string, fn: (...args: never[]) => unknown): void };\n log(options: { name: string; message: string }): void;\n}\n\ndeclare const cy: Cy;\ndeclare const Cypress: CypressStatic;\ndeclare const afterEach: (fn: () => unknown) => void;\n\nconst injected: string[] = [];\n\nfunction issuer(): string {\n const url = (Cypress.env(\"KINDE_TESTKIT_URL\") as string | undefined) ?? (Cypress.env(\"KINDE_ISSUER_URL\") as string | undefined);\n if (!url) {\n throw new Error(\n 'kinde-testkit does not know where the issuer is. Call setupKindeTestkit(on, config) from setupNodeEvents in cypress.config, or set env KINDE_TESTKIT_URL.',\n );\n }\n return url.replace(/\\/+$/, \"\");\n}\n\nfunction appBase(): string {\n const base = Cypress.config(\"baseUrl\") as string | null;\n if (!base) throw new Error(\"Set baseUrl in cypress.config so kinde-testkit can find your app's login route.\");\n return base.replace(/\\/+$/, \"\");\n}\n\nfunction location(response: CyResponse, from: string): string {\n const header = response.headers.location;\n const value = Array.isArray(header) ? header[0] : header;\n if (!value) throw new Error(`Expected a redirect from ${from}, got ${response.status}.`);\n return resolveLocation(value, from);\n}\n\nfunction control<T>(method: string, path: string, body?: unknown): CyChain<T> {\n return cy\n .request<T & { error_description?: string }>({ method, url: `${issuer()}${path}`, body, failOnStatusCode: false, log: false })\n .then((response) => {\n if (response.status >= 400 && response.status !== 404) {\n throw new Error(response.body?.error_description ?? `kinde-testkit answered ${response.status} for ${path}.`);\n }\n return response.body as T;\n }) as CyChain<T>;\n}\n\nCypress.Commands.add(\"kindeSignIn\", (user: string, options: KindeSignInOptions = {}) => {\n const signIn: RequestSignInOptions = { user, org: options.org };\n const start = `${appBase()}${appLoginUrl(options.loginPath ?? \"/api/auth/login\", signIn)}`;\n Cypress.log({ name: \"kindeSignIn\", message: options.org ? `${user} in ${options.org}` : user });\n return cy\n .request({ url: start, followRedirect: false, log: false })\n .then((response) => {\n const signInPage = location(response, start);\n if (!signInPage.startsWith(issuer())) {\n throw new Error(`Expected the login route to redirect to kinde-testkit at ${issuer()}, but it went to ${signInPage}. Check the app's KINDE_ISSUER_URL.`);\n }\n return cy.request<string>({ url: signInPage, log: false });\n })\n .then((page) =>\n cy.request<string>({\n method: \"POST\",\n url: `${issuer()}/oauth2/auth/login`,\n form: true,\n body: signInForm(readSignInRequest(page.body), signIn),\n followRedirect: false,\n failOnStatusCode: false,\n log: false,\n }),\n )\n .then((response) => {\n if (response.status !== 302 && response.status !== 303) throw signInFailure(response.status, String(response.body), signIn);\n return cy.visit(location(response, `${issuer()}/oauth2/auth/login`));\n });\n});\n\nCypress.Commands.add(\"kindeSignOut\", (options: KindeSignOutOptions = {}) => {\n return cy.visit(`${appBase()}${options.logoutPath ?? \"/api/auth/logout\"}`);\n});\n\nCypress.Commands.add(\"kindeToken\", (options: KindeTokenRequest) => {\n return control<{ access_token: string }>(\"POST\", \"/testkit/token\", options).then((body) => body.access_token);\n});\n\nCypress.Commands.add(\"kindeInjectFailure\", (rule: FailureRule) => {\n return control<ActiveFailure>(\"POST\", \"/testkit/failures\", rule).then((failure) => {\n injected.push(failure.id);\n return failure;\n });\n});\n\nfunction clearInjected(): CyChain<void> {\n const ids = injected.splice(0, injected.length);\n let chain: CyChain<unknown> = cy.wrap(null, { log: false });\n for (const id of ids) chain = chain.then(() => control(\"DELETE\", `/testkit/failures/${encodeURIComponent(id)}`));\n return chain.then(() => undefined);\n}\n\nCypress.Commands.add(\"kindeClearFailures\", () => clearInjected());\n\nCypress.Commands.add(\"kindeSendWebhook\", (options: SendWebhookOptions) => {\n return control<WebhookDelivery[]>(\"POST\", \"/testkit/webhooks\", options);\n});\n\nCypress.Commands.add(\"kindeReset\", () => {\n injected.length = 0;\n return control(\"POST\", \"/testkit/reset\").then(() => undefined);\n});\n\nafterEach(() => {\n if (injected.length > 0) return clearInjected();\n return undefined;\n});\n"],"mappings":";AAaO,SAAS,YAAY,WAAmB,SAAuC;AACpF,QAAM,SAAS,IAAI,gBAAgB,EAAE,YAAY,QAAQ,KAAK,CAAC;AAC/D,MAAI,QAAQ,IAAK,QAAO,IAAI,YAAY,QAAQ,GAAG;AACnD,SAAO,GAAG,SAAS,GAAG,UAAU,SAAS,GAAG,IAAI,MAAM,GAAG,GAAG,MAAM;AACpE;AAGO,SAAS,kBAAkB,MAAsB;AACtD,QAAM,QAAQ,iCAAiC,KAAK,IAAI;AACxD,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,8GAA8G;AAAA,EAChI;AACA,SAAO,eAAe,MAAM,CAAC,CAAE;AACjC;AAGO,SAAS,WAAW,SAAiB,SAAuD;AACjG,QAAM,OAA+B,EAAE,SAAS,OAAO,QAAQ,KAAK;AACpE,MAAI,QAAQ,IAAK,MAAK,MAAM,QAAQ;AACpC,SAAO;AACT;AAGO,SAAS,cAAc,QAAgB,MAAc,SAAsC;AAChG,MAAI,WAAW,OAAO,KAAK,SAAS,wBAAwB,GAAG;AAC7D,WAAO,IAAI,MAAM,GAAG,QAAQ,IAAI,2EAA2E;AAAA,EAC7G;AACA,QAAM,QAAQ,kCAAkC,KAAK,IAAI,IAAI,CAAC;AAC9D,QAAM,OAAO,QAAQ,eAAe,MAAM,QAAQ,YAA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