@stablyai/playwright-test 2.1.2 → 2.1.3-rc.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.
package/dist/index.d.cts CHANGED
@@ -3,14 +3,94 @@ import * as _stablyai_playwright_base from '@stablyai/playwright-base';
3
3
  import { Agent } from '@stablyai/playwright-base';
4
4
  export { AIModel, Agent, GetLocatorsByAIOptions, GetLocatorsByAIResult, ScreenshotPromptOptions, setApiKey } from '@stablyai/playwright-base';
5
5
  import * as _playwright_test from '@playwright/test';
6
- import { defineConfig as defineConfig$1, test as test$1 } from '@playwright/test';
6
+ import { BrowserContext, defineConfig as defineConfig$1, test as test$1 } from '@playwright/test';
7
7
  export * from '@playwright/test';
8
- import { S as StablyNotificationConfig } from './index.d-BjGuH5NO.cjs';
9
- export { N as NotificationResultPolicy, P as ProjectNotificationConfig, a as StablyEmailNotificationConfig, b as StablyReporterOptions, c as StablySlackNotificationConfig, s as stablyReporter } from './index.d-BjGuH5NO.cjs';
8
+ import { S as StablyNotificationConfig } from './index.d-Be6DvZw5.cjs';
9
+ export { N as NotificationResultPolicy, P as ProjectNotificationConfig, a as StablyEmailNotificationConfig, b as StablyReporterOptions, c as StablySlackNotificationConfig, s as stablyReporter } from './index.d-Be6DvZw5.cjs';
10
10
  import 'child_process';
11
11
  import 'stream';
12
12
  import 'fs';
13
13
 
14
+ type PlaywrightCookie = Parameters<BrowserContext["addCookies"]>[0][number];
15
+ type LocalStorageEntry = {
16
+ name: string;
17
+ value: string;
18
+ };
19
+ type StorageOrigin = {
20
+ localStorage: LocalStorageEntry[];
21
+ origin: string;
22
+ };
23
+ /**
24
+ * Playwright-compatible storage state.
25
+ */
26
+ type GoogleStorageState = {
27
+ cookies: PlaywrightCookie[];
28
+ origins: StorageOrigin[];
29
+ };
30
+ /**
31
+ * Input for {@link authWithGoogle}.
32
+ */
33
+ type AuthWithGoogleOptions = {
34
+ /**
35
+ * Browser context where auth state should be applied.
36
+ */
37
+ context: BrowserContext;
38
+ /**
39
+ * Google account email.
40
+ */
41
+ email: string;
42
+ /**
43
+ * Google account password.
44
+ */
45
+ password: string;
46
+ /**
47
+ * TOTP seed/secret used to generate the Google 2FA code.
48
+ */
49
+ otpSecret: string;
50
+ /**
51
+ * Force a cache refresh server-side. Defaults to `false`.
52
+ */
53
+ forceRefresh?: boolean;
54
+ /**
55
+ * Optional API key override. Defaults to the configured Stably API key.
56
+ */
57
+ apiKey?: string;
58
+ };
59
+ /**
60
+ * Signs in a Google test account and applies the authenticated session to a Playwright context.
61
+ *
62
+ * Use this when your test needs to start in an already-authenticated state without
63
+ * manually driving the login UI. After this resolves, cookies and localStorage are
64
+ * applied to the provided context and subsequent pages in that context can continue
65
+ * as an authenticated user.
66
+ *
67
+ * @param options - Google credentials and target Playwright context.
68
+ * @param options.context - Browser context to receive the authenticated session.
69
+ * @param options.email - Google account email.
70
+ * @param options.password - Google account password.
71
+ * @param options.otpSecret - TOTP secret for 2FA. See https://docs.stably.ai/stably2/auth/google-otp-secret-helper.
72
+ * @param options.forceRefresh - Optional flag to force regeneration of session state.
73
+ * @param options.apiKey - Optional Stably API key override.
74
+ *
75
+ * @returns Resolves when auth state has been successfully applied to the context.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * import { test } from "@stablyai/playwright-test";
80
+ *
81
+ * test("opens Google settings as authenticated user", async ({ context, page }) => {
82
+ * await context.authWithGoogle({
83
+ * email: "qa@example.com",
84
+ * password: process.env.GOOGLE_TEST_PASSWORD!,
85
+ * otpSecret: process.env.GOOGLE_TEST_OTP_SECRET!,
86
+ * });
87
+ *
88
+ * await page.goto("https://myaccount.google.com");
89
+ * });
90
+ * ```
91
+ */
92
+ declare function authWithGoogle(options: AuthWithGoogleOptions): Promise<void>;
93
+
14
94
  /**
15
95
  * Get the directory name from an import.meta.url.
16
96
  * This is the ESM equivalent of __dirname.
@@ -119,11 +199,20 @@ declare module "@playwright/test" {
119
199
  interface PlaywrightTestArgs {
120
200
  agent: Agent;
121
201
  }
202
+ interface BrowserContext {
203
+ /**
204
+ * Generates and applies Google auth state to this context.
205
+ *
206
+ * Calls Stably's Google auth-state endpoint and proactively sets cookies and
207
+ * localStorage values on this context.
208
+ */
209
+ authWithGoogle(options: Omit<AuthWithGoogleOptions, "context">): Promise<void>;
210
+ }
122
211
  interface Project {
123
212
  stably?: StablyProjectConfig;
124
213
  }
125
214
  }
126
215
 
127
- export { StablyNotificationConfig, defineConfig, expect, getDirname, getFilename, test };
128
- export type { StablyProjectConfig };
216
+ export { StablyNotificationConfig, authWithGoogle, defineConfig, expect, getDirname, getFilename, test };
217
+ export type { AuthWithGoogleOptions, GoogleStorageState, StablyProjectConfig };
129
218
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;AAsCA;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GA+BG;iBACa,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;AAhCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GAkCG;iBACa,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEzD;QAEM,MAAM,IAAI,EAAE,OAAO;QAyBnB,MAAM,MAAM;AA3DnB;AACA;AACA;iHA+HuD,CAAC;AA7HxD;AACA;AACA;iHAkIW,CAAC;EA7E2D,CAAC;;KAI5D,mBAAmB,GAAG;IAChC,aAAa,CAAC,EAAE,wBAAwB,CAAC;CAC1C,CAAC;AAEF;AArDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GAuDG;QACI,MAAM,YAAY;AAEzB,OAAO,QAAQ,kBAAkB,CAAC;IAEhC,UAAU,iBAAiB;QACzB;AAvDJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;WAyDO;Q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1DJ,KAAM,mBAAmB;oBACb,wBAAwB;;AAG1C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,cAAa,YAAY,SAAAC,cAAyB;AAElD;;;;;;;;;;;;;;;8CAmBgB,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;6DAQE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;;;;;;;;;;;;;8CAqBE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;6DAQE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;eAMH,KAAK;;;;;;;;;gCAYD,IAAI,CAAC,qBAAqB,eAClC,OAAO;;;iBAMD,mBAAmB","names":["playwrightTest","playwrightDefineConfig"]}
package/dist/index.d.mts CHANGED
@@ -3,14 +3,94 @@ import * as _stablyai_playwright_base from '@stablyai/playwright-base';
3
3
  import { Agent } from '@stablyai/playwright-base';
4
4
  export { AIModel, Agent, GetLocatorsByAIOptions, GetLocatorsByAIResult, ScreenshotPromptOptions, setApiKey } from '@stablyai/playwright-base';
5
5
  import * as _playwright_test from '@playwright/test';
6
- import { defineConfig as defineConfig$1, test as test$1 } from '@playwright/test';
6
+ import { BrowserContext, defineConfig as defineConfig$1, test as test$1 } from '@playwright/test';
7
7
  export * from '@playwright/test';
8
- import { S as StablyNotificationConfig } from './index.d-BjGuH5NO.mjs';
9
- export { N as NotificationResultPolicy, P as ProjectNotificationConfig, a as StablyEmailNotificationConfig, b as StablyReporterOptions, c as StablySlackNotificationConfig, s as stablyReporter } from './index.d-BjGuH5NO.mjs';
8
+ import { S as StablyNotificationConfig } from './index.d-Be6DvZw5.mjs';
9
+ export { N as NotificationResultPolicy, P as ProjectNotificationConfig, a as StablyEmailNotificationConfig, b as StablyReporterOptions, c as StablySlackNotificationConfig, s as stablyReporter } from './index.d-Be6DvZw5.mjs';
10
10
  import 'child_process';
11
11
  import 'stream';
12
12
  import 'fs';
13
13
 
14
+ type PlaywrightCookie = Parameters<BrowserContext["addCookies"]>[0][number];
15
+ type LocalStorageEntry = {
16
+ name: string;
17
+ value: string;
18
+ };
19
+ type StorageOrigin = {
20
+ localStorage: LocalStorageEntry[];
21
+ origin: string;
22
+ };
23
+ /**
24
+ * Playwright-compatible storage state.
25
+ */
26
+ type GoogleStorageState = {
27
+ cookies: PlaywrightCookie[];
28
+ origins: StorageOrigin[];
29
+ };
30
+ /**
31
+ * Input for {@link authWithGoogle}.
32
+ */
33
+ type AuthWithGoogleOptions = {
34
+ /**
35
+ * Browser context where auth state should be applied.
36
+ */
37
+ context: BrowserContext;
38
+ /**
39
+ * Google account email.
40
+ */
41
+ email: string;
42
+ /**
43
+ * Google account password.
44
+ */
45
+ password: string;
46
+ /**
47
+ * TOTP seed/secret used to generate the Google 2FA code.
48
+ */
49
+ otpSecret: string;
50
+ /**
51
+ * Force a cache refresh server-side. Defaults to `false`.
52
+ */
53
+ forceRefresh?: boolean;
54
+ /**
55
+ * Optional API key override. Defaults to the configured Stably API key.
56
+ */
57
+ apiKey?: string;
58
+ };
59
+ /**
60
+ * Signs in a Google test account and applies the authenticated session to a Playwright context.
61
+ *
62
+ * Use this when your test needs to start in an already-authenticated state without
63
+ * manually driving the login UI. After this resolves, cookies and localStorage are
64
+ * applied to the provided context and subsequent pages in that context can continue
65
+ * as an authenticated user.
66
+ *
67
+ * @param options - Google credentials and target Playwright context.
68
+ * @param options.context - Browser context to receive the authenticated session.
69
+ * @param options.email - Google account email.
70
+ * @param options.password - Google account password.
71
+ * @param options.otpSecret - TOTP secret for 2FA. See https://docs.stably.ai/stably2/auth/google-otp-secret-helper.
72
+ * @param options.forceRefresh - Optional flag to force regeneration of session state.
73
+ * @param options.apiKey - Optional Stably API key override.
74
+ *
75
+ * @returns Resolves when auth state has been successfully applied to the context.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * import { test } from "@stablyai/playwright-test";
80
+ *
81
+ * test("opens Google settings as authenticated user", async ({ context, page }) => {
82
+ * await context.authWithGoogle({
83
+ * email: "qa@example.com",
84
+ * password: process.env.GOOGLE_TEST_PASSWORD!,
85
+ * otpSecret: process.env.GOOGLE_TEST_OTP_SECRET!,
86
+ * });
87
+ *
88
+ * await page.goto("https://myaccount.google.com");
89
+ * });
90
+ * ```
91
+ */
92
+ declare function authWithGoogle(options: AuthWithGoogleOptions): Promise<void>;
93
+
14
94
  /**
15
95
  * Get the directory name from an import.meta.url.
16
96
  * This is the ESM equivalent of __dirname.
@@ -119,11 +199,20 @@ declare module "@playwright/test" {
119
199
  interface PlaywrightTestArgs {
120
200
  agent: Agent;
121
201
  }
202
+ interface BrowserContext {
203
+ /**
204
+ * Generates and applies Google auth state to this context.
205
+ *
206
+ * Calls Stably's Google auth-state endpoint and proactively sets cookies and
207
+ * localStorage values on this context.
208
+ */
209
+ authWithGoogle(options: Omit<AuthWithGoogleOptions, "context">): Promise<void>;
210
+ }
122
211
  interface Project {
123
212
  stably?: StablyProjectConfig;
124
213
  }
125
214
  }
126
215
 
127
- export { StablyNotificationConfig, defineConfig, expect, getDirname, getFilename, test };
128
- export type { StablyProjectConfig };
216
+ export { StablyNotificationConfig, authWithGoogle, defineConfig, expect, getDirname, getFilename, test };
217
+ export type { AuthWithGoogleOptions, GoogleStorageState, StablyProjectConfig };
129
218
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;AAsCA;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GA+BG;iBACa,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;AAhCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GAkCG;iBACa,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEzD;QAEM,MAAM,IAAI,EAAE,OAAO;QAyBnB,MAAM,MAAM;AA3DnB;AACA;AACA;iHA+HuD,CAAC;AA7HxD;AACA;AACA;iHAkIW,CAAC;EA7E2D,CAAC;;KAI5D,mBAAmB,GAAG;IAChC,aAAa,CAAC,EAAE,wBAAwB,CAAC;CAC1C,CAAC;AAEF;AArDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GAuDG;QACI,MAAM,YAAY;AAEzB,OAAO,QAAQ,kBAAkB,CAAC;IAEhC,UAAU,iBAAiB;QACzB;AAvDJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;WAyDO;QACH,QAAQ,CACN,SAAS,EAAE,MAAM,EAEjB,OAAO,CAAC,EAAE,OAAO,2BAA2B,EAAE,uBAAuB,GACpE;QAEH;AA5DJ;WA8DO;QACH,uBAAuB,CACrB,SAAS,EAAE,MAAM,EAEjB,OAAO,CAAC,EAAE,OAAO,2BAA2B,EAAE,uBAAuB,GACpE;KACJ;IAGD,UAAU,cAAc;QACtB;AAlEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;WAoEO;QACH,QAAQ,CACN,SAAS,EAAE,MAAM,EAEjB,OAAO,CAAC,EAAE,OAAO,2BAA2B,EAAE,uBAAuB,GACpE;QAEH;AAvEJ;WAyEO;QACH,uBAAuB,CACrB,SAAS,EAAE,MAAM,EAEjB,OAAO,CAAC,EAAE,OAAO,2BAA2B,EAAE,uBAAuB,GACpE;KACJ;IAID,UAAU,kBAAkB;QAC1B,KAAK,EAAE,KAAK,CAAC;KACd;IAID,UAAU,OAAO;QACf,MAAM,CAAC,EAAE,mBAAmB,CAAC;KAC9B;CACF;;;;","names":[]}
1
+ {"version":3,"file":"index.d.mts","sources":["../src/auth-with-google.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;AAUA,KAAK,gBAAgB,GAAG,UAAU,CAAC,cAAc;AAEjD,KAAK,iBAAiB;;;;AAKtB,KAAK,aAAa;kBACF,iBAAiB;;;AAIjC;;;AAGM,KAAM,kBAAkB;aACnB,gBAAgB;aAChB,aAAa;;AAGxB;;;AAGM,KAAM,qBAAqB;;;;aAItB,cAAc;;;;;;;;;;;;;;;;;;;;;;AA6JzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,iBAAsB,cAAc,UACzB,qBAAqB,GAC7B,OAAO;;ACzLV;;;;;;;;;;;;;AAaA,iBAAgB,UAAU;AAI1B;;;;;;;;;;AAUA,iBAAgB,WAAW;AAI3B,cAAa,IAAI,SAASA,MA8BxB;AAEF,cAAa,MAAM;;;;gGAwDmB;;;;gGAM5B;;;AA1DJ,KAAM,mBAAmB;oBACb,wBAAwB;;AAG1C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,cAAa,YAAY,SAAAC,cAAyB;AAElD;;;;;;;;;;;;;;;8CAmBgB,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;6DAQE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;;;;;;;;;;;;;8CAqBE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;6DAQE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;eAMH,KAAK;;;;;;;;;gCAYD,IAAI,CAAC,qBAAqB,eAClC,OAAO;;;iBAMD,mBAAmB","names":["playwrightTest","playwrightDefineConfig"]}
package/dist/index.d.ts CHANGED
@@ -3,14 +3,94 @@ import * as _stablyai_playwright_base from '@stablyai/playwright-base';
3
3
  import { Agent } from '@stablyai/playwright-base';
4
4
  export { AIModel, Agent, GetLocatorsByAIOptions, GetLocatorsByAIResult, ScreenshotPromptOptions, setApiKey } from '@stablyai/playwright-base';
5
5
  import * as _playwright_test from '@playwright/test';
6
- import { defineConfig as defineConfig$1, test as test$1 } from '@playwright/test';
6
+ import { BrowserContext, defineConfig as defineConfig$1, test as test$1 } from '@playwright/test';
7
7
  export * from '@playwright/test';
8
- import { S as StablyNotificationConfig } from './index.d-BjGuH5NO.js';
9
- export { N as NotificationResultPolicy, P as ProjectNotificationConfig, a as StablyEmailNotificationConfig, b as StablyReporterOptions, c as StablySlackNotificationConfig, s as stablyReporter } from './index.d-BjGuH5NO.js';
8
+ import { S as StablyNotificationConfig } from './index.d-Be6DvZw5.js';
9
+ export { N as NotificationResultPolicy, P as ProjectNotificationConfig, a as StablyEmailNotificationConfig, b as StablyReporterOptions, c as StablySlackNotificationConfig, s as stablyReporter } from './index.d-Be6DvZw5.js';
10
10
  import 'child_process';
11
11
  import 'stream';
12
12
  import 'fs';
13
13
 
14
+ type PlaywrightCookie = Parameters<BrowserContext["addCookies"]>[0][number];
15
+ type LocalStorageEntry = {
16
+ name: string;
17
+ value: string;
18
+ };
19
+ type StorageOrigin = {
20
+ localStorage: LocalStorageEntry[];
21
+ origin: string;
22
+ };
23
+ /**
24
+ * Playwright-compatible storage state.
25
+ */
26
+ type GoogleStorageState = {
27
+ cookies: PlaywrightCookie[];
28
+ origins: StorageOrigin[];
29
+ };
30
+ /**
31
+ * Input for {@link authWithGoogle}.
32
+ */
33
+ type AuthWithGoogleOptions = {
34
+ /**
35
+ * Browser context where auth state should be applied.
36
+ */
37
+ context: BrowserContext;
38
+ /**
39
+ * Google account email.
40
+ */
41
+ email: string;
42
+ /**
43
+ * Google account password.
44
+ */
45
+ password: string;
46
+ /**
47
+ * TOTP seed/secret used to generate the Google 2FA code.
48
+ */
49
+ otpSecret: string;
50
+ /**
51
+ * Force a cache refresh server-side. Defaults to `false`.
52
+ */
53
+ forceRefresh?: boolean;
54
+ /**
55
+ * Optional API key override. Defaults to the configured Stably API key.
56
+ */
57
+ apiKey?: string;
58
+ };
59
+ /**
60
+ * Signs in a Google test account and applies the authenticated session to a Playwright context.
61
+ *
62
+ * Use this when your test needs to start in an already-authenticated state without
63
+ * manually driving the login UI. After this resolves, cookies and localStorage are
64
+ * applied to the provided context and subsequent pages in that context can continue
65
+ * as an authenticated user.
66
+ *
67
+ * @param options - Google credentials and target Playwright context.
68
+ * @param options.context - Browser context to receive the authenticated session.
69
+ * @param options.email - Google account email.
70
+ * @param options.password - Google account password.
71
+ * @param options.otpSecret - TOTP secret for 2FA. See https://docs.stably.ai/stably2/auth/google-otp-secret-helper.
72
+ * @param options.forceRefresh - Optional flag to force regeneration of session state.
73
+ * @param options.apiKey - Optional Stably API key override.
74
+ *
75
+ * @returns Resolves when auth state has been successfully applied to the context.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * import { test } from "@stablyai/playwright-test";
80
+ *
81
+ * test("opens Google settings as authenticated user", async ({ context, page }) => {
82
+ * await context.authWithGoogle({
83
+ * email: "qa@example.com",
84
+ * password: process.env.GOOGLE_TEST_PASSWORD!,
85
+ * otpSecret: process.env.GOOGLE_TEST_OTP_SECRET!,
86
+ * });
87
+ *
88
+ * await page.goto("https://myaccount.google.com");
89
+ * });
90
+ * ```
91
+ */
92
+ declare function authWithGoogle(options: AuthWithGoogleOptions): Promise<void>;
93
+
14
94
  /**
15
95
  * Get the directory name from an import.meta.url.
16
96
  * This is the ESM equivalent of __dirname.
@@ -119,11 +199,20 @@ declare module "@playwright/test" {
119
199
  interface PlaywrightTestArgs {
120
200
  agent: Agent;
121
201
  }
202
+ interface BrowserContext {
203
+ /**
204
+ * Generates and applies Google auth state to this context.
205
+ *
206
+ * Calls Stably's Google auth-state endpoint and proactively sets cookies and
207
+ * localStorage values on this context.
208
+ */
209
+ authWithGoogle(options: Omit<AuthWithGoogleOptions, "context">): Promise<void>;
210
+ }
122
211
  interface Project {
123
212
  stably?: StablyProjectConfig;
124
213
  }
125
214
  }
126
215
 
127
- export { StablyNotificationConfig, defineConfig, expect, getDirname, getFilename, test };
128
- export type { StablyProjectConfig };
216
+ export { StablyNotificationConfig, authWithGoogle, defineConfig, expect, getDirname, getFilename, test };
217
+ export type { AuthWithGoogleOptions, GoogleStorageState, StablyProjectConfig };
129
218
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;AAsCA;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;GA+BG;iBACa,UAA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C,EAAE,mBAAmB,CAAC;KAC9B;CACF;;;;","names":[]}
1
+ {"version":3,"file":"index.d.ts","sources":["../src/auth-with-google.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;AAUA,KAAK,gBAAgB,GAAG,UAAU,CAAC,cAAc;AAEjD,KAAK,iBAAiB;;;;AAKtB,KAAK,aAAa;kBACF,iBAAiB;;;AAIjC;;;AAGM,KAAM,kBAAkB;aACnB,gBAAgB;aAChB,aAAa;;AAGxB;;;AAGM,KAAM,qBAAqB;;;;aAItB,cAAc;;;;;;;;;;;;;;;;;;;;;;AA6JzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,iBAAsB,cAAc,UACzB,qBAAqB,GAC7B,OAAO;;ACzLV;;;;;;;;;;;;;AAaA,iBAAgB,UAAU;AAI1B;;;;;;;;;;AAUA,iBAAgB,WAAW;AAI3B,cAAa,IAAI,SAASA,MA8BxB;AAEF,cAAa,MAAM;;;;gGAwDmB;;;;gGAM5B;;;AA1DJ,KAAM,mBAAmB;oBACb,wBAAwB;;AAG1C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,cAAa,YAAY,SAAAC,cAAyB;AAElD;;;;;;;;;;;;;;;8CAmBgB,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;6DAQE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;;;;;;;;;;;;;8CAqBE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;;6DAQE,yBAAkC,CAAE,uBAAuB,GACpE,OAAO;;;eAMH,KAAK;;;;;;;;;gCAYD,IAAI,CAAC,qBAAqB,eAClC,OAAO;;;iBAMD,mBAAmB","names":["playwrightTest","playwrightDefineConfig"]}