kinde-testkit 0.5.0 → 0.6.1

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,24 @@
1
+ import { S as StartKindeTestkitOptions } from './server-ciWIscoQ.cjs';
2
+ import 'jose';
3
+
4
+ interface SetupKindeTestkitOptions {
5
+ /**
6
+ * Start a testkit inside the Cypress process. Your app must use the same issuer,
7
+ * so keep the default port 4400 or set KINDE_ISSUER_URL to match.
8
+ * Leave this out to use an issuer you started yourself with `kinde-testkit start`.
9
+ */
10
+ start?: StartKindeTestkitOptions;
11
+ /** The issuer to use when you started it yourself. Default: KINDE_ISSUER_URL, then http://localhost:4400. */
12
+ url?: string;
13
+ }
14
+ interface CypressConfig {
15
+ env: Record<string, unknown>;
16
+ }
17
+ type On = (event: "after:run", handler: (results: any) => void | Promise<void>) => void;
18
+ /**
19
+ * Call from setupNodeEvents in cypress.config.ts. Starts the testkit when asked and tells the
20
+ * kinde-testkit Cypress commands where it is, through Cypress.env("KINDE_TESTKIT_URL").
21
+ */
22
+ declare function setupKindeTestkit<C extends CypressConfig>(on: On, config: C, options?: SetupKindeTestkitOptions): Promise<C>;
23
+
24
+ export { type SetupKindeTestkitOptions, setupKindeTestkit };
@@ -0,0 +1,25 @@
1
+ import { S as StartKindeTestkitOptions } from './server-BiODgeoB.js';
2
+ import './webhooks-DJyCsbdF.js';
3
+ import 'jose';
4
+
5
+ interface SetupKindeTestkitOptions {
6
+ /**
7
+ * Start a testkit inside the Cypress process. Your app must use the same issuer,
8
+ * so keep the default port 4400 or set KINDE_ISSUER_URL to match.
9
+ * Leave this out to use an issuer you started yourself with `kinde-testkit start`.
10
+ */
11
+ start?: StartKindeTestkitOptions;
12
+ /** The issuer to use when you started it yourself. Default: KINDE_ISSUER_URL, then http://localhost:4400. */
13
+ url?: string;
14
+ }
15
+ interface CypressConfig {
16
+ env: Record<string, unknown>;
17
+ }
18
+ type On = (event: "after:run", handler: (results: any) => void | Promise<void>) => void;
19
+ /**
20
+ * Call from setupNodeEvents in cypress.config.ts. Starts the testkit when asked and tells the
21
+ * kinde-testkit Cypress commands where it is, through Cypress.env("KINDE_TESTKIT_URL").
22
+ */
23
+ declare function setupKindeTestkit<C extends CypressConfig>(on: On, config: C, options?: SetupKindeTestkitOptions): Promise<C>;
24
+
25
+ export { type SetupKindeTestkitOptions, setupKindeTestkit };
@@ -0,0 +1,23 @@
1
+ import {
2
+ startKindeTestkit
3
+ } from "./chunk-GCOZVCZY.js";
4
+
5
+ // src/cypress.ts
6
+ async function setupKindeTestkit(on, config, options = {}) {
7
+ let url = options.url ?? config.env.KINDE_TESTKIT_URL ?? process.env.KINDE_ISSUER_URL ?? "http://localhost:4400";
8
+ let running = null;
9
+ if (options.start) {
10
+ running = await startKindeTestkit({ port: 4400, ...options.start });
11
+ url = running.url;
12
+ on("after:run", async () => {
13
+ await running?.close();
14
+ running = null;
15
+ });
16
+ }
17
+ config.env.KINDE_TESTKIT_URL = url.replace(/\/+$/, "");
18
+ return config;
19
+ }
20
+ export {
21
+ setupKindeTestkit
22
+ };
23
+ //# sourceMappingURL=cypress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cypress.ts"],"sourcesContent":["import { startKindeTestkit, type RunningKindeTestkit, type StartKindeTestkitOptions } from \"./server.js\";\n\nexport interface SetupKindeTestkitOptions {\n /**\n * Start a testkit inside the Cypress process. Your app must use the same issuer,\n * so keep the default port 4400 or set KINDE_ISSUER_URL to match.\n * Leave this out to use an issuer you started yourself with `kinde-testkit start`.\n */\n start?: StartKindeTestkitOptions;\n /** The issuer to use when you started it yourself. Default: KINDE_ISSUER_URL, then http://localhost:4400. */\n url?: string;\n}\n\ninterface CypressConfig {\n env: Record<string, unknown>;\n}\n\n// Matches the \"after:run\" overload of Cypress's on(), so Cypress's own on() can be passed in.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype On = (event: \"after:run\", handler: (results: any) => void | Promise<void>) => void;\n\n/**\n * Call from setupNodeEvents in cypress.config.ts. Starts the testkit when asked and tells the\n * kinde-testkit Cypress commands where it is, through Cypress.env(\"KINDE_TESTKIT_URL\").\n */\nexport async function setupKindeTestkit<C extends CypressConfig>(\n on: On,\n config: C,\n options: SetupKindeTestkitOptions = {},\n): Promise<C> {\n let url = options.url ?? (config.env.KINDE_TESTKIT_URL as string | undefined) ?? process.env.KINDE_ISSUER_URL ?? \"http://localhost:4400\";\n let running: RunningKindeTestkit | null = null;\n if (options.start) {\n running = await startKindeTestkit({ port: 4400, ...options.start });\n url = running.url;\n on(\"after:run\", async () => {\n await running?.close();\n running = null;\n });\n }\n config.env.KINDE_TESTKIT_URL = url.replace(/\\/+$/, \"\");\n return config;\n}\n"],"mappings":";;;;;AAyBA,eAAsB,kBACpB,IACA,QACA,UAAoC,CAAC,GACzB;AACZ,MAAI,MAAM,QAAQ,OAAQ,OAAO,IAAI,qBAA4C,QAAQ,IAAI,oBAAoB;AACjH,MAAI,UAAsC;AAC1C,MAAI,QAAQ,OAAO;AACjB,cAAU,MAAM,kBAAkB,EAAE,MAAM,MAAM,GAAG,QAAQ,MAAM,CAAC;AAClE,UAAM,QAAQ;AACd,OAAG,aAAa,YAAY;AAC1B,YAAM,SAAS,MAAM;AACrB,gBAAU;AAAA,IACZ,CAAC;AAAA,EACH;AACA,SAAO,IAAI,oBAAoB,IAAI,QAAQ,QAAQ,EAAE;AACrD,SAAO;AACT;","names":[]}
@@ -0,0 +1,32 @@
1
+ import { x as KindePrincipal, y as KindeTestkit, F as FailureInjector, V as WebhookDispatcher, r as Directory, j as CoverageRecorder, f as ActivityLog, d as Scenario, J as ScenarioTokenOverrides, T as TestkitSeed } from './server-ciWIscoQ.cjs';
2
+
3
+ interface KindeTestAuth {
4
+ token: string | null;
5
+ headers: Record<string, string>;
6
+ principal: KindePrincipal | null;
7
+ request: {
8
+ headers: Record<string, string>;
9
+ };
10
+ }
11
+ declare function kindeTest(options: {
12
+ scenario: Scenario;
13
+ testkit?: KindeTestkit;
14
+ token?: ScenarioTokenOverrides;
15
+ }): Promise<KindeTestAuth>;
16
+ interface KindeTestkitHandle {
17
+ readonly url: string;
18
+ readonly issuer: string;
19
+ readonly jwksUri: string;
20
+ readonly testkit: KindeTestkit;
21
+ readonly failures: FailureInjector;
22
+ readonly webhooks: WebhookDispatcher;
23
+ readonly directory: Directory;
24
+ readonly coverage: CoverageRecorder;
25
+ readonly activity: ActivityLog;
26
+ readonly certificatePath: string | null;
27
+ auth(scenario: Scenario, token?: ScenarioTokenOverrides): Promise<KindeTestAuth>;
28
+ loadSeed(seed: TestkitSeed): void;
29
+ reset(): void;
30
+ }
31
+
32
+ export { type KindeTestAuth as K, type KindeTestkitHandle as a, kindeTest as k };
@@ -0,0 +1,33 @@
1
+ import { n as KindePrincipal, o as KindeTestkit, F as FailureInjector, w as WebhookDispatcher, S as Scenario, r as ScenarioTokenOverrides, T as TestkitSeed } from './webhooks-DJyCsbdF.js';
2
+ import { g as Directory, d as CoverageRecorder, A as ActivityLog } from './server-BiODgeoB.js';
3
+
4
+ interface KindeTestAuth {
5
+ token: string | null;
6
+ headers: Record<string, string>;
7
+ principal: KindePrincipal | null;
8
+ request: {
9
+ headers: Record<string, string>;
10
+ };
11
+ }
12
+ declare function kindeTest(options: {
13
+ scenario: Scenario;
14
+ testkit?: KindeTestkit;
15
+ token?: ScenarioTokenOverrides;
16
+ }): Promise<KindeTestAuth>;
17
+ interface KindeTestkitHandle {
18
+ readonly url: string;
19
+ readonly issuer: string;
20
+ readonly jwksUri: string;
21
+ readonly testkit: KindeTestkit;
22
+ readonly failures: FailureInjector;
23
+ readonly webhooks: WebhookDispatcher;
24
+ readonly directory: Directory;
25
+ readonly coverage: CoverageRecorder;
26
+ readonly activity: ActivityLog;
27
+ readonly certificatePath: string | null;
28
+ auth(scenario: Scenario, token?: ScenarioTokenOverrides): Promise<KindeTestAuth>;
29
+ loadSeed(seed: TestkitSeed): void;
30
+ reset(): void;
31
+ }
32
+
33
+ export { type KindeTestAuth as K, type KindeTestkitHandle as a, kindeTest as k };