@bigbinary/neeto-playwright-commons 4.10.0 → 4.11.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.
Files changed (3) hide show
  1. package/index.d.ts +24 -1
  2. package/index.js +1589 -27
  3. package/package.json +2 -1
package/index.js CHANGED
@@ -19,6 +19,7 @@ import { parse as parse$1 } from 'node-html-parser';
19
19
  import { Jimp } from 'jimp';
20
20
  import jsQRModule from 'jsqr';
21
21
  import { globSync } from 'node:fs';
22
+ import { createPrivateKey } from 'node:crypto';
22
23
  import customParseFormat from 'dayjs/plugin/customParseFormat.js';
23
24
  import timezone from 'dayjs/plugin/timezone.js';
24
25
  import utc from 'dayjs/plugin/utc.js';
@@ -5038,10 +5039,10 @@ var Hook = { Collection };
5038
5039
  // pkg/dist-src/defaults.js
5039
5040
 
5040
5041
  // pkg/dist-src/version.js
5041
- var VERSION$3 = "0.0.0-development";
5042
+ var VERSION$7 = "0.0.0-development";
5042
5043
 
5043
5044
  // pkg/dist-src/defaults.js
5044
- var userAgent = `octokit-endpoint.js/${VERSION$3} ${getUserAgent()}`;
5045
+ var userAgent = `octokit-endpoint.js/${VERSION$7} ${getUserAgent()}`;
5045
5046
  var DEFAULTS = {
5046
5047
  method: "GET",
5047
5048
  baseUrl: "https://api.github.com",
@@ -5746,12 +5747,12 @@ class RequestError extends Error {
5746
5747
  // pkg/dist-src/index.js
5747
5748
 
5748
5749
  // pkg/dist-src/version.js
5749
- var VERSION$2 = "10.0.8";
5750
+ var VERSION$6 = "10.0.8";
5750
5751
 
5751
5752
  // pkg/dist-src/defaults.js
5752
5753
  var defaults_default = {
5753
5754
  headers: {
5754
- "user-agent": `octokit-request.js/${VERSION$2} ${getUserAgent()}`
5755
+ "user-agent": `octokit-request.js/${VERSION$6} ${getUserAgent()}`
5755
5756
  }
5756
5757
  };
5757
5758
 
@@ -5936,7 +5937,7 @@ var request = withDefaults$1(endpoint, defaults_default);
5936
5937
  // pkg/dist-src/index.js
5937
5938
 
5938
5939
  // pkg/dist-src/version.js
5939
- var VERSION$1 = "0.0.0-development";
5940
+ var VERSION$5 = "0.0.0-development";
5940
5941
 
5941
5942
  // pkg/dist-src/error.js
5942
5943
  function _buildMessageForResponseErrors(data) {
@@ -6038,7 +6039,7 @@ function withDefaults(request2, newDefaults) {
6038
6039
  // pkg/dist-src/index.js
6039
6040
  withDefaults(request, {
6040
6041
  headers: {
6041
- "user-agent": `octokit-graphql.js/${VERSION$1} ${getUserAgent()}`
6042
+ "user-agent": `octokit-graphql.js/${VERSION$5} ${getUserAgent()}`
6042
6043
  },
6043
6044
  method: "POST",
6044
6045
  url: "/graphql"
@@ -6057,7 +6058,7 @@ var jwtRE = new RegExp(`^${b64url}${sep}${b64url}${sep}${b64url}$`);
6057
6058
  var isJWT = jwtRE.test.bind(jwtRE);
6058
6059
 
6059
6060
  // pkg/dist-src/auth.js
6060
- async function auth(token) {
6061
+ async function auth$4(token) {
6061
6062
  const isApp = isJWT(token);
6062
6063
  const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
6063
6064
  const isUserToServer = token.startsWith("ghu_");
@@ -6078,7 +6079,7 @@ function withAuthorizationPrefix(token) {
6078
6079
  }
6079
6080
 
6080
6081
  // pkg/dist-src/hook.js
6081
- async function hook(token, request, route, parameters) {
6082
+ async function hook$4(token, request, route, parameters) {
6082
6083
  const endpoint = request.endpoint.merge(
6083
6084
  route,
6084
6085
  parameters
@@ -6098,12 +6099,12 @@ var createTokenAuth = function createTokenAuth2(token) {
6098
6099
  );
6099
6100
  }
6100
6101
  token = token.replace(/^(token|bearer) +/i, "");
6101
- return Object.assign(auth.bind(null, token), {
6102
- hook: hook.bind(null, token)
6102
+ return Object.assign(auth$4.bind(null, token), {
6103
+ hook: hook$4.bind(null, token)
6103
6104
  });
6104
6105
  };
6105
6106
 
6106
- const VERSION = "7.0.6";
6107
+ const VERSION$4 = "7.0.6";
6107
6108
 
6108
6109
  const noop = () => {
6109
6110
  };
@@ -6124,9 +6125,9 @@ function createLogger(logger = {}) {
6124
6125
  }
6125
6126
  return logger;
6126
6127
  }
6127
- const userAgentTrail = `octokit-core.js/${VERSION} ${getUserAgent()}`;
6128
+ const userAgentTrail = `octokit-core.js/${VERSION$4} ${getUserAgent()}`;
6128
6129
  class Octokit {
6129
- static VERSION = VERSION;
6130
+ static VERSION = VERSION$4;
6130
6131
  static defaults(defaults) {
6131
6132
  const OctokitWithDefaults = class extends this {
6132
6133
  constructor(...args) {
@@ -6238,17 +6239,1579 @@ class Octokit {
6238
6239
  auth;
6239
6240
  }
6240
6241
 
6242
+ // pkg/dist-src/version.js
6243
+ function requestToOAuthBaseUrl$1(request) {
6244
+ const endpointDefaults = request.endpoint.DEFAULTS;
6245
+ return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", "");
6246
+ }
6247
+ async function oauthRequest$1(request, route, parameters) {
6248
+ const withOAuthParameters = {
6249
+ baseUrl: requestToOAuthBaseUrl$1(request),
6250
+ headers: {
6251
+ accept: "application/json"
6252
+ },
6253
+ ...parameters
6254
+ };
6255
+ const response = await request(route, withOAuthParameters);
6256
+ if ("error" in response.data) {
6257
+ const error = new RequestError(
6258
+ `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`,
6259
+ 400,
6260
+ {
6261
+ request: request.endpoint.merge(
6262
+ route,
6263
+ withOAuthParameters
6264
+ )
6265
+ }
6266
+ );
6267
+ error.response = response;
6268
+ throw error;
6269
+ }
6270
+ return response;
6271
+ }
6272
+ async function createDeviceCode(options) {
6273
+ const request$1 = options.request || request;
6274
+ const parameters = {
6275
+ client_id: options.clientId
6276
+ };
6277
+ if ("scopes" in options && Array.isArray(options.scopes)) {
6278
+ parameters.scope = options.scopes.join(" ");
6279
+ }
6280
+ return oauthRequest$1(request$1, "POST /login/device/code", parameters);
6281
+ }
6282
+ async function exchangeDeviceCode(options) {
6283
+ const request$1 = options.request || request;
6284
+ const response = await oauthRequest$1(
6285
+ request$1,
6286
+ "POST /login/oauth/access_token",
6287
+ {
6288
+ client_id: options.clientId,
6289
+ device_code: options.code,
6290
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code"
6291
+ }
6292
+ );
6293
+ const authentication = {
6294
+ clientType: options.clientType,
6295
+ clientId: options.clientId,
6296
+ token: response.data.access_token,
6297
+ scopes: response.data.scope.split(/\s+/).filter(Boolean)
6298
+ };
6299
+ if ("clientSecret" in options) {
6300
+ authentication.clientSecret = options.clientSecret;
6301
+ }
6302
+ if (options.clientType === "github-app") {
6303
+ if ("refresh_token" in response.data) {
6304
+ const apiTimeInMs = new Date(response.headers.date).getTime();
6305
+ authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2(
6306
+ apiTimeInMs,
6307
+ response.data.expires_in
6308
+ ), authentication.refreshTokenExpiresAt = toTimestamp2(
6309
+ apiTimeInMs,
6310
+ response.data.refresh_token_expires_in
6311
+ );
6312
+ }
6313
+ delete authentication.scopes;
6314
+ }
6315
+ return { ...response, authentication };
6316
+ }
6317
+ function toTimestamp2(apiTimeInMs, expirationInSeconds) {
6318
+ return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
6319
+ }
6320
+
6321
+ // pkg/dist-src/index.js
6322
+ async function getOAuthAccessToken(state, options) {
6323
+ const cachedAuthentication = getCachedAuthentication(state, options.auth);
6324
+ if (cachedAuthentication) return cachedAuthentication;
6325
+ const { data: verification } = await createDeviceCode({
6326
+ clientType: state.clientType,
6327
+ clientId: state.clientId,
6328
+ request: options.request || state.request,
6329
+ // @ts-expect-error the extra code to make TS happy is not worth it
6330
+ scopes: options.auth.scopes || state.scopes
6331
+ });
6332
+ await state.onVerification(verification);
6333
+ const authentication = await waitForAccessToken(
6334
+ options.request || state.request,
6335
+ state.clientId,
6336
+ state.clientType,
6337
+ verification
6338
+ );
6339
+ state.authentication = authentication;
6340
+ return authentication;
6341
+ }
6342
+ function getCachedAuthentication(state, auth2) {
6343
+ if (auth2.refresh === true) return false;
6344
+ if (!state.authentication) return false;
6345
+ if (state.clientType === "github-app") {
6346
+ return state.authentication;
6347
+ }
6348
+ const authentication = state.authentication;
6349
+ const newScope = ("scopes" in auth2 && auth2.scopes || state.scopes).join(
6350
+ " "
6351
+ );
6352
+ const currentScope = authentication.scopes.join(" ");
6353
+ return newScope === currentScope ? authentication : false;
6354
+ }
6355
+ async function wait(seconds) {
6356
+ await new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
6357
+ }
6358
+ async function waitForAccessToken(request, clientId, clientType, verification) {
6359
+ try {
6360
+ const options = {
6361
+ clientId,
6362
+ request,
6363
+ code: verification.device_code
6364
+ };
6365
+ const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({
6366
+ ...options,
6367
+ clientType: "oauth-app"
6368
+ }) : await exchangeDeviceCode({
6369
+ ...options,
6370
+ clientType: "github-app"
6371
+ });
6372
+ return {
6373
+ type: "token",
6374
+ tokenType: "oauth",
6375
+ ...authentication
6376
+ };
6377
+ } catch (error) {
6378
+ if (!error.response) throw error;
6379
+ const errorType = error.response.data.error;
6380
+ if (errorType === "authorization_pending") {
6381
+ await wait(verification.interval);
6382
+ return waitForAccessToken(request, clientId, clientType, verification);
6383
+ }
6384
+ if (errorType === "slow_down") {
6385
+ await wait(verification.interval + 7);
6386
+ return waitForAccessToken(request, clientId, clientType, verification);
6387
+ }
6388
+ throw error;
6389
+ }
6390
+ }
6391
+
6392
+ // pkg/dist-src/auth.js
6393
+ async function auth$3(state, authOptions) {
6394
+ return getOAuthAccessToken(state, {
6395
+ auth: authOptions
6396
+ });
6397
+ }
6398
+
6399
+ // pkg/dist-src/hook.js
6400
+ async function hook$3(state, request, route, parameters) {
6401
+ let endpoint = request.endpoint.merge(
6402
+ route,
6403
+ parameters
6404
+ );
6405
+ if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint.url)) {
6406
+ return request(endpoint);
6407
+ }
6408
+ const { token } = await getOAuthAccessToken(state, {
6409
+ request,
6410
+ auth: { type: "oauth" }
6411
+ });
6412
+ endpoint.headers.authorization = `token ${token}`;
6413
+ return request(endpoint);
6414
+ }
6415
+
6416
+ // pkg/dist-src/version.js
6417
+ var VERSION$3 = "0.0.0-development";
6418
+
6419
+ // pkg/dist-src/index.js
6420
+ function createOAuthDeviceAuth(options) {
6421
+ const requestWithDefaults = options.request || request.defaults({
6422
+ headers: {
6423
+ "user-agent": `octokit-auth-oauth-device.js/${VERSION$3} ${getUserAgent()}`
6424
+ }
6425
+ });
6426
+ const { request: request$1 = requestWithDefaults, ...otherOptions } = options;
6427
+ const state = options.clientType === "github-app" ? {
6428
+ ...otherOptions,
6429
+ clientType: "github-app",
6430
+ request: request$1
6431
+ } : {
6432
+ ...otherOptions,
6433
+ clientType: "oauth-app",
6434
+ request: request$1,
6435
+ scopes: options.scopes || []
6436
+ };
6437
+ if (!options.clientId) {
6438
+ throw new Error(
6439
+ '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)'
6440
+ );
6441
+ }
6442
+ if (!options.onVerification) {
6443
+ throw new Error(
6444
+ '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)'
6445
+ );
6446
+ }
6447
+ return Object.assign(auth$3.bind(null, state), {
6448
+ hook: hook$3.bind(null, state)
6449
+ });
6450
+ }
6451
+
6452
+ // pkg/dist-src/version.js
6453
+ function requestToOAuthBaseUrl(request) {
6454
+ const endpointDefaults = request.endpoint.DEFAULTS;
6455
+ return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", "");
6456
+ }
6457
+ async function oauthRequest(request, route, parameters) {
6458
+ const withOAuthParameters = {
6459
+ baseUrl: requestToOAuthBaseUrl(request),
6460
+ headers: {
6461
+ accept: "application/json"
6462
+ },
6463
+ ...parameters
6464
+ };
6465
+ const response = await request(route, withOAuthParameters);
6466
+ if ("error" in response.data) {
6467
+ const error = new RequestError(
6468
+ `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`,
6469
+ 400,
6470
+ {
6471
+ request: request.endpoint.merge(
6472
+ route,
6473
+ withOAuthParameters
6474
+ )
6475
+ }
6476
+ );
6477
+ error.response = response;
6478
+ throw error;
6479
+ }
6480
+ return response;
6481
+ }
6482
+ async function exchangeWebFlowCode(options) {
6483
+ const request$1 = options.request || request;
6484
+ const response = await oauthRequest(
6485
+ request$1,
6486
+ "POST /login/oauth/access_token",
6487
+ {
6488
+ client_id: options.clientId,
6489
+ client_secret: options.clientSecret,
6490
+ code: options.code,
6491
+ redirect_uri: options.redirectUrl
6492
+ }
6493
+ );
6494
+ const authentication = {
6495
+ clientType: options.clientType,
6496
+ clientId: options.clientId,
6497
+ clientSecret: options.clientSecret,
6498
+ token: response.data.access_token,
6499
+ scopes: response.data.scope.split(/\s+/).filter(Boolean)
6500
+ };
6501
+ if (options.clientType === "github-app") {
6502
+ if ("refresh_token" in response.data) {
6503
+ const apiTimeInMs = new Date(response.headers.date).getTime();
6504
+ authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp(
6505
+ apiTimeInMs,
6506
+ response.data.expires_in
6507
+ ), authentication.refreshTokenExpiresAt = toTimestamp(
6508
+ apiTimeInMs,
6509
+ response.data.refresh_token_expires_in
6510
+ );
6511
+ }
6512
+ delete authentication.scopes;
6513
+ }
6514
+ return { ...response, authentication };
6515
+ }
6516
+ function toTimestamp(apiTimeInMs, expirationInSeconds) {
6517
+ return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
6518
+ }
6519
+ async function checkToken(options) {
6520
+ const request$1 = options.request || request;
6521
+ const response = await request$1("POST /applications/{client_id}/token", {
6522
+ headers: {
6523
+ authorization: `basic ${btoa(
6524
+ `${options.clientId}:${options.clientSecret}`
6525
+ )}`
6526
+ },
6527
+ client_id: options.clientId,
6528
+ access_token: options.token
6529
+ });
6530
+ const authentication = {
6531
+ clientType: options.clientType,
6532
+ clientId: options.clientId,
6533
+ clientSecret: options.clientSecret,
6534
+ token: options.token,
6535
+ scopes: response.data.scopes
6536
+ };
6537
+ if (response.data.expires_at)
6538
+ authentication.expiresAt = response.data.expires_at;
6539
+ if (options.clientType === "github-app") {
6540
+ delete authentication.scopes;
6541
+ }
6542
+ return { ...response, authentication };
6543
+ }
6544
+ async function refreshToken(options) {
6545
+ const request$1 = options.request || request;
6546
+ const response = await oauthRequest(
6547
+ request$1,
6548
+ "POST /login/oauth/access_token",
6549
+ {
6550
+ client_id: options.clientId,
6551
+ client_secret: options.clientSecret,
6552
+ grant_type: "refresh_token",
6553
+ refresh_token: options.refreshToken
6554
+ }
6555
+ );
6556
+ const apiTimeInMs = new Date(response.headers.date).getTime();
6557
+ const authentication = {
6558
+ clientType: "github-app",
6559
+ clientId: options.clientId,
6560
+ clientSecret: options.clientSecret,
6561
+ token: response.data.access_token,
6562
+ refreshToken: response.data.refresh_token,
6563
+ expiresAt: toTimestamp3(apiTimeInMs, response.data.expires_in),
6564
+ refreshTokenExpiresAt: toTimestamp3(
6565
+ apiTimeInMs,
6566
+ response.data.refresh_token_expires_in
6567
+ )
6568
+ };
6569
+ return { ...response, authentication };
6570
+ }
6571
+ function toTimestamp3(apiTimeInMs, expirationInSeconds) {
6572
+ return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
6573
+ }
6574
+ async function resetToken(options) {
6575
+ const request$1 = options.request || request;
6576
+ const auth = btoa(`${options.clientId}:${options.clientSecret}`);
6577
+ const response = await request$1(
6578
+ "PATCH /applications/{client_id}/token",
6579
+ {
6580
+ headers: {
6581
+ authorization: `basic ${auth}`
6582
+ },
6583
+ client_id: options.clientId,
6584
+ access_token: options.token
6585
+ }
6586
+ );
6587
+ const authentication = {
6588
+ clientType: options.clientType,
6589
+ clientId: options.clientId,
6590
+ clientSecret: options.clientSecret,
6591
+ token: response.data.token,
6592
+ scopes: response.data.scopes
6593
+ };
6594
+ if (response.data.expires_at)
6595
+ authentication.expiresAt = response.data.expires_at;
6596
+ if (options.clientType === "github-app") {
6597
+ delete authentication.scopes;
6598
+ }
6599
+ return { ...response, authentication };
6600
+ }
6601
+ async function deleteToken(options) {
6602
+ const request$1 = options.request || request;
6603
+ const auth = btoa(`${options.clientId}:${options.clientSecret}`);
6604
+ return request$1(
6605
+ "DELETE /applications/{client_id}/token",
6606
+ {
6607
+ headers: {
6608
+ authorization: `basic ${auth}`
6609
+ },
6610
+ client_id: options.clientId,
6611
+ access_token: options.token
6612
+ }
6613
+ );
6614
+ }
6615
+ async function deleteAuthorization(options) {
6616
+ const request$1 = options.request || request;
6617
+ const auth = btoa(`${options.clientId}:${options.clientSecret}`);
6618
+ return request$1(
6619
+ "DELETE /applications/{client_id}/grant",
6620
+ {
6621
+ headers: {
6622
+ authorization: `basic ${auth}`
6623
+ },
6624
+ client_id: options.clientId,
6625
+ access_token: options.token
6626
+ }
6627
+ );
6628
+ }
6629
+
6630
+ // pkg/dist-src/index.js
6631
+
6632
+ // pkg/dist-src/version.js
6633
+ var VERSION$2 = "0.0.0-development";
6634
+ async function getAuthentication(state) {
6635
+ if ("code" in state.strategyOptions) {
6636
+ const { authentication } = await exchangeWebFlowCode({
6637
+ clientId: state.clientId,
6638
+ clientSecret: state.clientSecret,
6639
+ clientType: state.clientType,
6640
+ onTokenCreated: state.onTokenCreated,
6641
+ ...state.strategyOptions,
6642
+ request: state.request
6643
+ });
6644
+ return {
6645
+ type: "token",
6646
+ tokenType: "oauth",
6647
+ ...authentication
6648
+ };
6649
+ }
6650
+ if ("onVerification" in state.strategyOptions) {
6651
+ const deviceAuth = createOAuthDeviceAuth({
6652
+ clientType: state.clientType,
6653
+ clientId: state.clientId,
6654
+ onTokenCreated: state.onTokenCreated,
6655
+ ...state.strategyOptions,
6656
+ request: state.request
6657
+ });
6658
+ const authentication = await deviceAuth({
6659
+ type: "oauth"
6660
+ });
6661
+ return {
6662
+ clientSecret: state.clientSecret,
6663
+ ...authentication
6664
+ };
6665
+ }
6666
+ if ("token" in state.strategyOptions) {
6667
+ return {
6668
+ type: "token",
6669
+ tokenType: "oauth",
6670
+ clientId: state.clientId,
6671
+ clientSecret: state.clientSecret,
6672
+ clientType: state.clientType,
6673
+ onTokenCreated: state.onTokenCreated,
6674
+ ...state.strategyOptions
6675
+ };
6676
+ }
6677
+ throw new Error("[@octokit/auth-oauth-user] Invalid strategy options");
6678
+ }
6679
+ async function auth$2(state, options = {}) {
6680
+ if (!state.authentication) {
6681
+ state.authentication = state.clientType === "oauth-app" ? await getAuthentication(state) : await getAuthentication(state);
6682
+ }
6683
+ if (state.authentication.invalid) {
6684
+ throw new Error("[@octokit/auth-oauth-user] Token is invalid");
6685
+ }
6686
+ const currentAuthentication = state.authentication;
6687
+ if ("expiresAt" in currentAuthentication) {
6688
+ if (options.type === "refresh" || new Date(currentAuthentication.expiresAt) < /* @__PURE__ */ new Date()) {
6689
+ const { authentication } = await refreshToken({
6690
+ clientId: state.clientId,
6691
+ clientSecret: state.clientSecret,
6692
+ refreshToken: currentAuthentication.refreshToken,
6693
+ request: state.request
6694
+ });
6695
+ state.authentication = {
6696
+ tokenType: "oauth",
6697
+ type: "token",
6698
+ ...authentication
6699
+ };
6700
+ }
6701
+ }
6702
+ if (options.type === "refresh") {
6703
+ if (state.clientType === "oauth-app") {
6704
+ throw new Error(
6705
+ "[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens"
6706
+ );
6707
+ }
6708
+ if (!currentAuthentication.hasOwnProperty("expiresAt")) {
6709
+ throw new Error("[@octokit/auth-oauth-user] Refresh token missing");
6710
+ }
6711
+ await state.onTokenCreated?.(state.authentication, {
6712
+ type: options.type
6713
+ });
6714
+ }
6715
+ if (options.type === "check" || options.type === "reset") {
6716
+ const method = options.type === "check" ? checkToken : resetToken;
6717
+ try {
6718
+ const { authentication } = await method({
6719
+ // @ts-expect-error making TS happy would require unnecessary code so no
6720
+ clientType: state.clientType,
6721
+ clientId: state.clientId,
6722
+ clientSecret: state.clientSecret,
6723
+ token: state.authentication.token,
6724
+ request: state.request
6725
+ });
6726
+ state.authentication = {
6727
+ tokenType: "oauth",
6728
+ type: "token",
6729
+ // @ts-expect-error TBD
6730
+ ...authentication
6731
+ };
6732
+ if (options.type === "reset") {
6733
+ await state.onTokenCreated?.(state.authentication, {
6734
+ type: options.type
6735
+ });
6736
+ }
6737
+ return state.authentication;
6738
+ } catch (error) {
6739
+ if (error.status === 404) {
6740
+ error.message = "[@octokit/auth-oauth-user] Token is invalid";
6741
+ state.authentication.invalid = true;
6742
+ }
6743
+ throw error;
6744
+ }
6745
+ }
6746
+ if (options.type === "delete" || options.type === "deleteAuthorization") {
6747
+ const method = options.type === "delete" ? deleteToken : deleteAuthorization;
6748
+ try {
6749
+ await method({
6750
+ // @ts-expect-error making TS happy would require unnecessary code so no
6751
+ clientType: state.clientType,
6752
+ clientId: state.clientId,
6753
+ clientSecret: state.clientSecret,
6754
+ token: state.authentication.token,
6755
+ request: state.request
6756
+ });
6757
+ } catch (error) {
6758
+ if (error.status !== 404) throw error;
6759
+ }
6760
+ state.authentication.invalid = true;
6761
+ return state.authentication;
6762
+ }
6763
+ return state.authentication;
6764
+ }
6765
+
6766
+ // pkg/dist-src/requires-basic-auth.js
6767
+ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/;
6768
+ function requiresBasicAuth(url) {
6769
+ return url && ROUTES_REQUIRING_BASIC_AUTH.test(url);
6770
+ }
6771
+
6772
+ // pkg/dist-src/hook.js
6773
+ async function hook$2(state, request, route, parameters = {}) {
6774
+ const endpoint = request.endpoint.merge(
6775
+ route,
6776
+ parameters
6777
+ );
6778
+ if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint.url)) {
6779
+ return request(endpoint);
6780
+ }
6781
+ if (requiresBasicAuth(endpoint.url)) {
6782
+ const credentials = btoa(`${state.clientId}:${state.clientSecret}`);
6783
+ endpoint.headers.authorization = `basic ${credentials}`;
6784
+ return request(endpoint);
6785
+ }
6786
+ const { token } = state.clientType === "oauth-app" ? await auth$2({ ...state, request }) : await auth$2({ ...state, request });
6787
+ endpoint.headers.authorization = "token " + token;
6788
+ return request(endpoint);
6789
+ }
6790
+
6791
+ // pkg/dist-src/index.js
6792
+ function createOAuthUserAuth({
6793
+ clientId,
6794
+ clientSecret,
6795
+ clientType = "oauth-app",
6796
+ request: request$1 = request.defaults({
6797
+ headers: {
6798
+ "user-agent": `octokit-auth-oauth-app.js/${VERSION$2} ${getUserAgent()}`
6799
+ }
6800
+ }),
6801
+ onTokenCreated,
6802
+ ...strategyOptions
6803
+ }) {
6804
+ const state = Object.assign({
6805
+ clientType,
6806
+ clientId,
6807
+ clientSecret,
6808
+ onTokenCreated,
6809
+ strategyOptions,
6810
+ request: request$1
6811
+ });
6812
+ return Object.assign(auth$2.bind(null, state), {
6813
+ // @ts-expect-error not worth the extra code needed to appease TS
6814
+ hook: hook$2.bind(null, state)
6815
+ });
6816
+ }
6817
+ createOAuthUserAuth.VERSION = VERSION$2;
6818
+
6819
+ // pkg/dist-src/index.js
6820
+ async function auth$1(state, authOptions) {
6821
+ if (authOptions.type === "oauth-app") {
6822
+ return {
6823
+ type: "oauth-app",
6824
+ clientId: state.clientId,
6825
+ clientSecret: state.clientSecret,
6826
+ clientType: state.clientType,
6827
+ headers: {
6828
+ authorization: `basic ${btoa(
6829
+ `${state.clientId}:${state.clientSecret}`
6830
+ )}`
6831
+ }
6832
+ };
6833
+ }
6834
+ if ("factory" in authOptions) {
6835
+ const { type, ...options } = {
6836
+ ...authOptions,
6837
+ ...state
6838
+ };
6839
+ return authOptions.factory(options);
6840
+ }
6841
+ const common = {
6842
+ clientId: state.clientId,
6843
+ clientSecret: state.clientSecret,
6844
+ request: state.request,
6845
+ ...authOptions
6846
+ };
6847
+ const userAuth = state.clientType === "oauth-app" ? await createOAuthUserAuth({
6848
+ ...common,
6849
+ clientType: state.clientType
6850
+ }) : await createOAuthUserAuth({
6851
+ ...common,
6852
+ clientType: state.clientType
6853
+ });
6854
+ return userAuth();
6855
+ }
6856
+ async function hook$1(state, request2, route, parameters) {
6857
+ let endpoint = request2.endpoint.merge(
6858
+ route,
6859
+ parameters
6860
+ );
6861
+ if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint.url)) {
6862
+ return request2(endpoint);
6863
+ }
6864
+ if (state.clientType === "github-app" && !requiresBasicAuth(endpoint.url)) {
6865
+ throw new Error(
6866
+ `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint.method} ${endpoint.url}" is not supported.`
6867
+ );
6868
+ }
6869
+ const credentials = btoa(`${state.clientId}:${state.clientSecret}`);
6870
+ endpoint.headers.authorization = `basic ${credentials}`;
6871
+ try {
6872
+ return await request2(endpoint);
6873
+ } catch (error) {
6874
+ if (error.status !== 401) throw error;
6875
+ error.message = `[@octokit/auth-oauth-app] "${endpoint.method} ${endpoint.url}" does not support clientId/clientSecret basic authentication.`;
6876
+ throw error;
6877
+ }
6878
+ }
6879
+
6880
+ // pkg/dist-src/version.js
6881
+ var VERSION$1 = "0.0.0-development";
6882
+ function createOAuthAppAuth(options) {
6883
+ const state = Object.assign(
6884
+ {
6885
+ request: request.defaults({
6886
+ headers: {
6887
+ "user-agent": `octokit-auth-oauth-app.js/${VERSION$1} ${getUserAgent()}`
6888
+ }
6889
+ }),
6890
+ clientType: "oauth-app"
6891
+ },
6892
+ options
6893
+ );
6894
+ return Object.assign(auth$1.bind(null, state), {
6895
+ hook: hook$1.bind(null, state)
6896
+ });
6897
+ }
6898
+
6899
+ // we don't @ts-check here because it chokes on atob and btoa which are available in all modern JS runtime environments
6900
+
6901
+ /**
6902
+ * @param {string} privateKey
6903
+ * @returns {boolean}
6904
+ */
6905
+ function isPkcs1(privateKey) {
6906
+ return privateKey.includes("-----BEGIN RSA PRIVATE KEY-----");
6907
+ }
6908
+
6909
+ /**
6910
+ * @param {string} privateKey
6911
+ * @returns {boolean}
6912
+ */
6913
+ function isOpenSsh(privateKey) {
6914
+ return privateKey.includes("-----BEGIN OPENSSH PRIVATE KEY-----");
6915
+ }
6916
+
6917
+ /**
6918
+ * @param {string} str
6919
+ * @returns {ArrayBuffer}
6920
+ */
6921
+ function string2ArrayBuffer(str) {
6922
+ const buf = new ArrayBuffer(str.length);
6923
+ const bufView = new Uint8Array(buf);
6924
+ for (let i = 0, strLen = str.length; i < strLen; i++) {
6925
+ bufView[i] = str.charCodeAt(i);
6926
+ }
6927
+ return buf;
6928
+ }
6929
+
6930
+ /**
6931
+ * @param {string} pem
6932
+ * @returns {ArrayBuffer}
6933
+ */
6934
+ function getDERfromPEM(pem) {
6935
+ const pemB64 = pem
6936
+ .trim()
6937
+ .split("\n")
6938
+ .slice(1, -1) // Remove the --- BEGIN / END PRIVATE KEY ---
6939
+ .join("");
6940
+
6941
+ const decoded = atob(pemB64);
6942
+ return string2ArrayBuffer(decoded);
6943
+ }
6944
+
6945
+ /**
6946
+ * @param {import('../internals').Header} header
6947
+ * @param {import('../internals').Payload} payload
6948
+ * @returns {string}
6949
+ */
6950
+ function getEncodedMessage(header, payload) {
6951
+ return `${base64encodeJSON(header)}.${base64encodeJSON(payload)}`;
6952
+ }
6953
+
6954
+ /**
6955
+ * @param {ArrayBuffer} buffer
6956
+ * @returns {string}
6957
+ */
6958
+ function base64encode(buffer) {
6959
+ var binary = "";
6960
+ var bytes = new Uint8Array(buffer);
6961
+ var len = bytes.byteLength;
6962
+ for (var i = 0; i < len; i++) {
6963
+ binary += String.fromCharCode(bytes[i]);
6964
+ }
6965
+
6966
+ return fromBase64(btoa(binary));
6967
+ }
6968
+
6969
+ /**
6970
+ * @param {string} base64
6971
+ * @returns {string}
6972
+ */
6973
+ function fromBase64(base64) {
6974
+ return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
6975
+ }
6976
+
6977
+ /**
6978
+ * @param {Record<string,unknown>} obj
6979
+ * @returns {string}
6980
+ */
6981
+ function base64encodeJSON(obj) {
6982
+ return fromBase64(btoa(JSON.stringify(obj)));
6983
+ }
6984
+
6985
+ const { subtle } = globalThis.crypto;
6986
+
6987
+ // no-op, unfortunately there is no way to transform from PKCS8 or OpenSSH to PKCS1 with WebCrypto
6988
+ function convertPrivateKey(privateKey) {
6989
+ return privateKey;
6990
+ }
6991
+
6992
+ // we don't @ts-check here because it chokes crypto which is a global API in modern JS runtime environments
6993
+
6994
+
6995
+ /**
6996
+ * @param {import('../internals').GetTokenOptions} options
6997
+ * @returns {Promise<string>}
6998
+ */
6999
+ async function getToken({ privateKey, payload }) {
7000
+ const convertedPrivateKey = convertPrivateKey(privateKey);
7001
+
7002
+ // WebCrypto only supports PKCS#8, unfortunately
7003
+ /* c8 ignore start */
7004
+ if (isPkcs1(convertedPrivateKey)) {
7005
+ throw new Error(
7006
+ "[universal-github-app-jwt] Private Key is in PKCS#1 format, but only PKCS#8 is supported. See https://github.com/gr2m/universal-github-app-jwt#private-key-formats"
7007
+ );
7008
+ }
7009
+ /* c8 ignore stop */
7010
+
7011
+ // WebCrypto does not support OpenSSH, unfortunately
7012
+ if (isOpenSsh(convertedPrivateKey)) {
7013
+ throw new Error(
7014
+ "[universal-github-app-jwt] Private Key is in OpenSSH format, but only PKCS#8 is supported. See https://github.com/gr2m/universal-github-app-jwt#private-key-formats"
7015
+ );
7016
+ }
7017
+
7018
+ const algorithm = {
7019
+ name: "RSASSA-PKCS1-v1_5",
7020
+ hash: { name: "SHA-256" },
7021
+ };
7022
+
7023
+ /** @type {import('../internals').Header} */
7024
+ const header = { alg: "RS256", typ: "JWT" };
7025
+
7026
+ const privateKeyDER = getDERfromPEM(convertedPrivateKey);
7027
+ const importedKey = await subtle.importKey(
7028
+ "pkcs8",
7029
+ privateKeyDER,
7030
+ algorithm,
7031
+ false,
7032
+ ["sign"]
7033
+ );
7034
+
7035
+ const encodedMessage = getEncodedMessage(header, payload);
7036
+ const encodedMessageArrBuf = string2ArrayBuffer(encodedMessage);
7037
+
7038
+ const signatureArrBuf = await subtle.sign(
7039
+ algorithm.name,
7040
+ importedKey,
7041
+ encodedMessageArrBuf
7042
+ );
7043
+
7044
+ const encodedSignature = base64encode(signatureArrBuf);
7045
+
7046
+ return `${encodedMessage}.${encodedSignature}`;
7047
+ }
7048
+
7049
+ // @ts-check
7050
+
7051
+
7052
+ /**
7053
+ * @param {import(".").Options} options
7054
+ * @returns {Promise<import(".").Result>}
7055
+ */
7056
+ async function githubAppJwt({
7057
+ id,
7058
+ privateKey,
7059
+ now = Math.floor(Date.now() / 1000),
7060
+ }) {
7061
+ // Private keys are often times configured as environment variables, in which case line breaks are escaped using `\\n`.
7062
+ // Replace these here for convenience.
7063
+ const privateKeyWithNewlines = privateKey.replace(/\\n/g, '\n');
7064
+
7065
+ // When creating a JSON Web Token, it sets the "issued at time" (iat) to 30s
7066
+ // in the past as we have seen people running situations where the GitHub API
7067
+ // claimed the iat would be in future. It turned out the clocks on the
7068
+ // different machine were not in sync.
7069
+ const nowWithSafetyMargin = now - 30;
7070
+ const expiration = nowWithSafetyMargin + 60 * 10; // JWT expiration time (10 minute maximum)
7071
+
7072
+ const payload = {
7073
+ iat: nowWithSafetyMargin, // Issued at time
7074
+ exp: expiration,
7075
+ iss: id,
7076
+ };
7077
+
7078
+ const token = await getToken({
7079
+ privateKey: privateKeyWithNewlines,
7080
+ payload,
7081
+ });
7082
+
7083
+ return {
7084
+ appId: id,
7085
+ expiration,
7086
+ token,
7087
+ };
7088
+ }
7089
+
7090
+ /**
7091
+ * toad-cache
7092
+ *
7093
+ * @copyright 2024 Igor Savin <kibertoad@gmail.com>
7094
+ * @license MIT
7095
+ * @version 3.7.0
7096
+ */
7097
+ class LruObject {
7098
+ constructor(max = 1000, ttlInMsecs = 0) {
7099
+ if (isNaN(max) || max < 0) {
7100
+ throw new Error('Invalid max value')
7101
+ }
7102
+
7103
+ if (isNaN(ttlInMsecs) || ttlInMsecs < 0) {
7104
+ throw new Error('Invalid ttl value')
7105
+ }
7106
+
7107
+ this.first = null;
7108
+ this.items = Object.create(null);
7109
+ this.last = null;
7110
+ this.size = 0;
7111
+ this.max = max;
7112
+ this.ttl = ttlInMsecs;
7113
+ }
7114
+
7115
+ bumpLru(item) {
7116
+ if (this.last === item) {
7117
+ return // Item is already the last one, no need to bump
7118
+ }
7119
+
7120
+ const last = this.last;
7121
+ const next = item.next;
7122
+ const prev = item.prev;
7123
+
7124
+ if (this.first === item) {
7125
+ this.first = next;
7126
+ }
7127
+
7128
+ item.next = null;
7129
+ item.prev = last;
7130
+ last.next = item;
7131
+
7132
+ if (prev !== null) {
7133
+ prev.next = next;
7134
+ }
7135
+
7136
+ if (next !== null) {
7137
+ next.prev = prev;
7138
+ }
7139
+
7140
+ this.last = item;
7141
+ }
7142
+
7143
+ clear() {
7144
+ this.items = Object.create(null);
7145
+ this.first = null;
7146
+ this.last = null;
7147
+ this.size = 0;
7148
+ }
7149
+
7150
+ delete(key) {
7151
+ if (Object.prototype.hasOwnProperty.call(this.items, key)) {
7152
+ const item = this.items[key];
7153
+
7154
+ delete this.items[key];
7155
+ this.size--;
7156
+
7157
+ if (item.prev !== null) {
7158
+ item.prev.next = item.next;
7159
+ }
7160
+
7161
+ if (item.next !== null) {
7162
+ item.next.prev = item.prev;
7163
+ }
7164
+
7165
+ if (this.first === item) {
7166
+ this.first = item.next;
7167
+ }
7168
+
7169
+ if (this.last === item) {
7170
+ this.last = item.prev;
7171
+ }
7172
+ }
7173
+ }
7174
+
7175
+ deleteMany(keys) {
7176
+ for (var i = 0; i < keys.length; i++) {
7177
+ this.delete(keys[i]);
7178
+ }
7179
+ }
7180
+
7181
+ evict() {
7182
+ if (this.size > 0) {
7183
+ const item = this.first;
7184
+
7185
+ delete this.items[item.key];
7186
+
7187
+ if (--this.size === 0) {
7188
+ this.first = null;
7189
+ this.last = null;
7190
+ } else {
7191
+ this.first = item.next;
7192
+ this.first.prev = null;
7193
+ }
7194
+ }
7195
+ }
7196
+
7197
+ expiresAt(key) {
7198
+ if (Object.prototype.hasOwnProperty.call(this.items, key)) {
7199
+ return this.items[key].expiry
7200
+ }
7201
+ }
7202
+
7203
+ get(key) {
7204
+ if (Object.prototype.hasOwnProperty.call(this.items, key)) {
7205
+ const item = this.items[key];
7206
+
7207
+ // Item has already expired
7208
+ if (this.ttl > 0 && item.expiry <= Date.now()) {
7209
+ this.delete(key);
7210
+ return
7211
+ }
7212
+
7213
+ // Item is still fresh
7214
+ this.bumpLru(item);
7215
+ return item.value
7216
+ }
7217
+ }
7218
+
7219
+ getMany(keys) {
7220
+ const result = [];
7221
+
7222
+ for (var i = 0; i < keys.length; i++) {
7223
+ result.push(this.get(keys[i]));
7224
+ }
7225
+
7226
+ return result
7227
+ }
7228
+
7229
+ keys() {
7230
+ return Object.keys(this.items)
7231
+ }
7232
+
7233
+ set(key, value) {
7234
+ // Replace existing item
7235
+ if (Object.prototype.hasOwnProperty.call(this.items, key)) {
7236
+ const item = this.items[key];
7237
+ item.value = value;
7238
+
7239
+ item.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl;
7240
+
7241
+ if (this.last !== item) {
7242
+ this.bumpLru(item);
7243
+ }
7244
+
7245
+ return
7246
+ }
7247
+
7248
+ // Add new item
7249
+ if (this.max > 0 && this.size === this.max) {
7250
+ this.evict();
7251
+ }
7252
+
7253
+ const item = {
7254
+ expiry: this.ttl > 0 ? Date.now() + this.ttl : this.ttl,
7255
+ key: key,
7256
+ prev: this.last,
7257
+ next: null,
7258
+ value,
7259
+ };
7260
+ this.items[key] = item;
7261
+
7262
+ if (++this.size === 1) {
7263
+ this.first = item;
7264
+ } else {
7265
+ this.last.next = item;
7266
+ }
7267
+
7268
+ this.last = item;
7269
+ }
7270
+ }
7271
+
7272
+ // pkg/dist-src/index.js
7273
+ async function getAppAuthentication({
7274
+ appId,
7275
+ privateKey,
7276
+ timeDifference,
7277
+ createJwt
7278
+ }) {
7279
+ try {
7280
+ if (createJwt) {
7281
+ const { jwt, expiresAt } = await createJwt(appId, timeDifference);
7282
+ return {
7283
+ type: "app",
7284
+ token: jwt,
7285
+ appId,
7286
+ expiresAt
7287
+ };
7288
+ }
7289
+ const authOptions = {
7290
+ id: appId,
7291
+ privateKey
7292
+ };
7293
+ if (timeDifference) {
7294
+ Object.assign(authOptions, {
7295
+ now: Math.floor(Date.now() / 1e3) + timeDifference
7296
+ });
7297
+ }
7298
+ const appAuthentication = await githubAppJwt(authOptions);
7299
+ return {
7300
+ type: "app",
7301
+ token: appAuthentication.token,
7302
+ appId: appAuthentication.appId,
7303
+ expiresAt: new Date(appAuthentication.expiration * 1e3).toISOString()
7304
+ };
7305
+ } catch (error) {
7306
+ if (privateKey === "-----BEGIN RSA PRIVATE KEY-----") {
7307
+ throw new Error(
7308
+ "The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'"
7309
+ );
7310
+ } else {
7311
+ throw error;
7312
+ }
7313
+ }
7314
+ }
7315
+ function getCache() {
7316
+ return new LruObject(
7317
+ // cache max. 15000 tokens, that will use less than 10mb memory
7318
+ 15e3,
7319
+ // Cache for 1 minute less than GitHub expiry
7320
+ 1e3 * 60 * 59
7321
+ );
7322
+ }
7323
+ async function get(cache, options) {
7324
+ const cacheKey = optionsToCacheKey(options);
7325
+ const result = await cache.get(cacheKey);
7326
+ if (!result) {
7327
+ return;
7328
+ }
7329
+ const [
7330
+ token,
7331
+ createdAt,
7332
+ expiresAt,
7333
+ repositorySelection,
7334
+ permissionsString,
7335
+ singleFileName
7336
+ ] = result.split("|");
7337
+ const permissions = options.permissions || permissionsString.split(/,/).reduce((permissions2, string) => {
7338
+ if (/!$/.test(string)) {
7339
+ permissions2[string.slice(0, -1)] = "write";
7340
+ } else {
7341
+ permissions2[string] = "read";
7342
+ }
7343
+ return permissions2;
7344
+ }, {});
7345
+ return {
7346
+ token,
7347
+ createdAt,
7348
+ expiresAt,
7349
+ permissions,
7350
+ repositoryIds: options.repositoryIds,
7351
+ repositoryNames: options.repositoryNames,
7352
+ singleFileName,
7353
+ repositorySelection
7354
+ };
7355
+ }
7356
+ async function set(cache, options, data) {
7357
+ const key = optionsToCacheKey(options);
7358
+ const permissionsString = options.permissions ? "" : Object.keys(data.permissions).map(
7359
+ (name) => `${name}${data.permissions[name] === "write" ? "!" : ""}`
7360
+ ).join(",");
7361
+ const value = [
7362
+ data.token,
7363
+ data.createdAt,
7364
+ data.expiresAt,
7365
+ data.repositorySelection,
7366
+ permissionsString,
7367
+ data.singleFileName
7368
+ ].join("|");
7369
+ await cache.set(key, value);
7370
+ }
7371
+ function optionsToCacheKey({
7372
+ installationId,
7373
+ permissions = {},
7374
+ repositoryIds = [],
7375
+ repositoryNames = []
7376
+ }) {
7377
+ const permissionsString = Object.keys(permissions).sort().map((name) => permissions[name] === "read" ? name : `${name}!`).join(",");
7378
+ const repositoryIdsString = repositoryIds.sort().join(",");
7379
+ const repositoryNamesString = repositoryNames.join(",");
7380
+ return [
7381
+ installationId,
7382
+ repositoryIdsString,
7383
+ repositoryNamesString,
7384
+ permissionsString
7385
+ ].filter(Boolean).join("|");
7386
+ }
7387
+
7388
+ // pkg/dist-src/to-token-authentication.js
7389
+ function toTokenAuthentication({
7390
+ installationId,
7391
+ token,
7392
+ createdAt,
7393
+ expiresAt,
7394
+ repositorySelection,
7395
+ permissions,
7396
+ repositoryIds,
7397
+ repositoryNames,
7398
+ singleFileName
7399
+ }) {
7400
+ return Object.assign(
7401
+ {
7402
+ type: "token",
7403
+ tokenType: "installation",
7404
+ token,
7405
+ installationId,
7406
+ permissions,
7407
+ createdAt,
7408
+ expiresAt,
7409
+ repositorySelection
7410
+ },
7411
+ repositoryIds ? { repositoryIds } : null,
7412
+ repositoryNames ? { repositoryNames } : null,
7413
+ singleFileName ? { singleFileName } : null
7414
+ );
7415
+ }
7416
+
7417
+ // pkg/dist-src/get-installation-authentication.js
7418
+ async function getInstallationAuthentication(state, options, customRequest) {
7419
+ const installationId = Number(options.installationId || state.installationId);
7420
+ if (!installationId) {
7421
+ throw new Error(
7422
+ "[@octokit/auth-app] installationId option is required for installation authentication."
7423
+ );
7424
+ }
7425
+ if (options.factory) {
7426
+ const { type, factory, oauthApp, ...factoryAuthOptions } = {
7427
+ ...state,
7428
+ ...options
7429
+ };
7430
+ return factory(factoryAuthOptions);
7431
+ }
7432
+ const request = customRequest || state.request;
7433
+ return getInstallationAuthenticationConcurrently(
7434
+ state,
7435
+ { ...options, installationId },
7436
+ request
7437
+ );
7438
+ }
7439
+ var pendingPromises = /* @__PURE__ */ new Map();
7440
+ function getInstallationAuthenticationConcurrently(state, options, request) {
7441
+ const cacheKey = optionsToCacheKey(options);
7442
+ if (pendingPromises.has(cacheKey)) {
7443
+ return pendingPromises.get(cacheKey);
7444
+ }
7445
+ const promise = getInstallationAuthenticationImpl(
7446
+ state,
7447
+ options,
7448
+ request
7449
+ ).finally(() => pendingPromises.delete(cacheKey));
7450
+ pendingPromises.set(cacheKey, promise);
7451
+ return promise;
7452
+ }
7453
+ async function getInstallationAuthenticationImpl(state, options, request) {
7454
+ if (!options.refresh) {
7455
+ const result = await get(state.cache, options);
7456
+ if (result) {
7457
+ const {
7458
+ token: token2,
7459
+ createdAt: createdAt2,
7460
+ expiresAt: expiresAt2,
7461
+ permissions: permissions2,
7462
+ repositoryIds: repositoryIds2,
7463
+ repositoryNames: repositoryNames2,
7464
+ singleFileName: singleFileName2,
7465
+ repositorySelection: repositorySelection2
7466
+ } = result;
7467
+ return toTokenAuthentication({
7468
+ installationId: options.installationId,
7469
+ token: token2,
7470
+ createdAt: createdAt2,
7471
+ expiresAt: expiresAt2,
7472
+ permissions: permissions2,
7473
+ repositorySelection: repositorySelection2,
7474
+ repositoryIds: repositoryIds2,
7475
+ repositoryNames: repositoryNames2,
7476
+ singleFileName: singleFileName2
7477
+ });
7478
+ }
7479
+ }
7480
+ const appAuthentication = await getAppAuthentication(state);
7481
+ const payload = {
7482
+ installation_id: options.installationId,
7483
+ mediaType: {
7484
+ previews: ["machine-man"]
7485
+ },
7486
+ headers: {
7487
+ authorization: `bearer ${appAuthentication.token}`
7488
+ }
7489
+ };
7490
+ if (options.repositoryIds) {
7491
+ Object.assign(payload, { repository_ids: options.repositoryIds });
7492
+ }
7493
+ if (options.repositoryNames) {
7494
+ Object.assign(payload, {
7495
+ repositories: options.repositoryNames
7496
+ });
7497
+ }
7498
+ if (options.permissions) {
7499
+ Object.assign(payload, { permissions: options.permissions });
7500
+ }
7501
+ const {
7502
+ data: {
7503
+ token,
7504
+ expires_at: expiresAt,
7505
+ repositories,
7506
+ permissions: permissionsOptional,
7507
+ repository_selection: repositorySelectionOptional,
7508
+ single_file: singleFileName
7509
+ }
7510
+ } = await request(
7511
+ "POST /app/installations/{installation_id}/access_tokens",
7512
+ payload
7513
+ );
7514
+ const permissions = permissionsOptional || {};
7515
+ const repositorySelection = repositorySelectionOptional || "all";
7516
+ const repositoryIds = repositories ? repositories.map((r) => r.id) : void 0;
7517
+ const repositoryNames = repositories ? repositories.map((repo) => repo.name) : void 0;
7518
+ const createdAt = (/* @__PURE__ */ new Date()).toISOString();
7519
+ const cacheOptions = {
7520
+ token,
7521
+ createdAt,
7522
+ expiresAt,
7523
+ repositorySelection,
7524
+ permissions};
7525
+ if (singleFileName) {
7526
+ Object.assign(payload, { singleFileName });
7527
+ }
7528
+ await set(state.cache, options, cacheOptions);
7529
+ const cacheData = {
7530
+ installationId: options.installationId,
7531
+ token,
7532
+ createdAt,
7533
+ expiresAt,
7534
+ repositorySelection,
7535
+ permissions,
7536
+ repositoryIds,
7537
+ repositoryNames
7538
+ };
7539
+ if (singleFileName) {
7540
+ Object.assign(cacheData, { singleFileName });
7541
+ }
7542
+ return toTokenAuthentication(cacheData);
7543
+ }
7544
+
7545
+ // pkg/dist-src/auth.js
7546
+ async function auth(state, authOptions) {
7547
+ switch (authOptions.type) {
7548
+ case "app":
7549
+ return getAppAuthentication(state);
7550
+ case "oauth-app":
7551
+ return state.oauthApp({ type: "oauth-app" });
7552
+ case "installation":
7553
+ return getInstallationAuthentication(state, {
7554
+ ...authOptions,
7555
+ type: "installation"
7556
+ });
7557
+ case "oauth-user":
7558
+ return state.oauthApp(authOptions);
7559
+ default:
7560
+ throw new Error(`Invalid auth type: ${authOptions.type}`);
7561
+ }
7562
+ }
7563
+
7564
+ // pkg/dist-src/requires-app-auth.js
7565
+ var PATHS = [
7566
+ "/app",
7567
+ "/app/hook/config",
7568
+ "/app/hook/deliveries",
7569
+ "/app/hook/deliveries/{delivery_id}",
7570
+ "/app/hook/deliveries/{delivery_id}/attempts",
7571
+ "/app/installations",
7572
+ "/app/installations/{installation_id}",
7573
+ "/app/installations/{installation_id}/access_tokens",
7574
+ "/app/installations/{installation_id}/suspended",
7575
+ "/app/installation-requests",
7576
+ "/marketplace_listing/accounts/{account_id}",
7577
+ "/marketplace_listing/plan",
7578
+ "/marketplace_listing/plans",
7579
+ "/marketplace_listing/plans/{plan_id}/accounts",
7580
+ "/marketplace_listing/stubbed/accounts/{account_id}",
7581
+ "/marketplace_listing/stubbed/plan",
7582
+ "/marketplace_listing/stubbed/plans",
7583
+ "/marketplace_listing/stubbed/plans/{plan_id}/accounts",
7584
+ "/orgs/{org}/installation",
7585
+ "/repos/{owner}/{repo}/installation",
7586
+ "/users/{username}/installation",
7587
+ "/enterprises/{enterprise}/installation"
7588
+ ];
7589
+ function routeMatcher(paths) {
7590
+ const regexes = paths.map(
7591
+ (p) => p.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/")
7592
+ );
7593
+ const regex = `^(?:${regexes.map((r) => `(?:${r})`).join("|")})$`;
7594
+ return new RegExp(regex, "i");
7595
+ }
7596
+ var REGEX = routeMatcher(PATHS);
7597
+ function requiresAppAuth(url) {
7598
+ return !!url && REGEX.test(url.split("?")[0]);
7599
+ }
7600
+
7601
+ // pkg/dist-src/hook.js
7602
+ var FIVE_SECONDS_IN_MS = 5 * 1e3;
7603
+ function isNotTimeSkewError(error) {
7604
+ return !(error.message.match(
7605
+ /'Expiration time' claim \('exp'\) is too far in the future/
7606
+ ) || error.message.match(
7607
+ /'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/
7608
+ ) || error.message.match(
7609
+ /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/
7610
+ ));
7611
+ }
7612
+ async function hook(state, request, route, parameters) {
7613
+ const endpoint = request.endpoint.merge(route, parameters);
7614
+ const url = endpoint.url;
7615
+ if (/\/login\/oauth\/access_token$/.test(url)) {
7616
+ return request(endpoint);
7617
+ }
7618
+ if (requiresAppAuth(url.replace(request.endpoint.DEFAULTS.baseUrl, ""))) {
7619
+ const { token: token2 } = await getAppAuthentication(state);
7620
+ endpoint.headers.authorization = `bearer ${token2}`;
7621
+ let response;
7622
+ try {
7623
+ response = await request(endpoint);
7624
+ } catch (error) {
7625
+ if (isNotTimeSkewError(error)) {
7626
+ throw error;
7627
+ }
7628
+ if (typeof error.response.headers.date === "undefined") {
7629
+ throw error;
7630
+ }
7631
+ const diff = Math.floor(
7632
+ (Date.parse(error.response.headers.date) - Date.parse((/* @__PURE__ */ new Date()).toString())) / 1e3
7633
+ );
7634
+ state.log.warn(error.message);
7635
+ state.log.warn(
7636
+ `[@octokit/auth-app] GitHub API time and system time are different by ${diff} seconds. Retrying request with the difference accounted for.`
7637
+ );
7638
+ const { token: token3 } = await getAppAuthentication({
7639
+ ...state,
7640
+ timeDifference: diff
7641
+ });
7642
+ endpoint.headers.authorization = `bearer ${token3}`;
7643
+ return request(endpoint);
7644
+ }
7645
+ return response;
7646
+ }
7647
+ if (requiresBasicAuth(url)) {
7648
+ const authentication = await state.oauthApp({ type: "oauth-app" });
7649
+ endpoint.headers.authorization = authentication.headers.authorization;
7650
+ return request(endpoint);
7651
+ }
7652
+ const { token, createdAt } = await getInstallationAuthentication(
7653
+ state,
7654
+ // @ts-expect-error TBD
7655
+ {},
7656
+ request.defaults({ baseUrl: endpoint.baseUrl })
7657
+ );
7658
+ endpoint.headers.authorization = `token ${token}`;
7659
+ return sendRequestWithRetries(
7660
+ state,
7661
+ request,
7662
+ endpoint,
7663
+ createdAt
7664
+ );
7665
+ }
7666
+ async function sendRequestWithRetries(state, request, options, createdAt, retries = 0) {
7667
+ const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt);
7668
+ try {
7669
+ return await request(options);
7670
+ } catch (error) {
7671
+ if (error.status !== 401) {
7672
+ throw error;
7673
+ }
7674
+ if (timeSinceTokenCreationInMs >= FIVE_SECONDS_IN_MS) {
7675
+ if (retries > 0) {
7676
+ error.message = `After ${retries} retries within ${timeSinceTokenCreationInMs / 1e3}s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`;
7677
+ }
7678
+ throw error;
7679
+ }
7680
+ ++retries;
7681
+ const awaitTime = retries * 1e3;
7682
+ state.log.warn(
7683
+ `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)`
7684
+ );
7685
+ await new Promise((resolve) => setTimeout(resolve, awaitTime));
7686
+ return sendRequestWithRetries(state, request, options, createdAt, retries);
7687
+ }
7688
+ }
7689
+
7690
+ // pkg/dist-src/version.js
7691
+ var VERSION = "8.2.0";
7692
+ function createAppAuth(options) {
7693
+ if (!options.appId) {
7694
+ throw new Error("[@octokit/auth-app] appId option is required");
7695
+ }
7696
+ if (!options.privateKey && !options.createJwt) {
7697
+ throw new Error("[@octokit/auth-app] privateKey option is required");
7698
+ } else if (options.privateKey && options.createJwt) {
7699
+ throw new Error(
7700
+ "[@octokit/auth-app] privateKey and createJwt options are mutually exclusive"
7701
+ );
7702
+ }
7703
+ if ("installationId" in options && !options.installationId) {
7704
+ throw new Error(
7705
+ "[@octokit/auth-app] installationId is set to a falsy value"
7706
+ );
7707
+ }
7708
+ const log = options.log || {};
7709
+ if (typeof log.warn !== "function") {
7710
+ log.warn = console.warn.bind(console);
7711
+ }
7712
+ const request$1 = options.request || request.defaults({
7713
+ headers: {
7714
+ "user-agent": `octokit-auth-app.js/${VERSION} ${getUserAgent()}`
7715
+ }
7716
+ });
7717
+ const state = Object.assign(
7718
+ {
7719
+ request: request$1,
7720
+ cache: getCache()
7721
+ },
7722
+ options,
7723
+ options.installationId ? { installationId: Number(options.installationId) } : {},
7724
+ {
7725
+ log,
7726
+ oauthApp: createOAuthAppAuth({
7727
+ clientType: "github-app",
7728
+ clientId: options.clientId || "",
7729
+ clientSecret: options.clientSecret || "",
7730
+ request: request$1
7731
+ })
7732
+ }
7733
+ );
7734
+ return Object.assign(auth.bind(null, state), {
7735
+ hook: hook.bind(null, state)
7736
+ });
7737
+ }
7738
+
7739
+ const PEM_PATTERN = /(-----BEGIN [A-Z ]+-----)([\s\S]*?)(-----END [A-Z ]+-----)/;
7740
+ const PEM_LINE_LENGTH = 64;
7741
+ const GITHUB_BOT_ENV_VARIABLES = [
7742
+ "GITHUB_BOT_APP_ID",
7743
+ "GITHUB_BOT_PRIVATE_KEY",
7744
+ "GITHUB_BOT_INSTALLATION_ID",
7745
+ ];
7746
+ let cachedAppAuth;
7747
+ // Secret stores hold the key with \n escapes, with spaces, or base64-encoded.
7748
+ const readPrivateKey = (rawKey) => {
7749
+ const unescaped = rawKey.replace(/\\n/g, "\n");
7750
+ const decoded = unescaped.includes("-----BEGIN")
7751
+ ? unescaped
7752
+ : Buffer.from(rawKey.replace(/\s/g, ""), "base64").toString("utf-8");
7753
+ const pem = decoded.match(PEM_PATTERN);
7754
+ if (!pem) {
7755
+ throw new Error("ENV variable GITHUB_BOT_PRIVATE_KEY is not a PEM key or a base64 encoded PEM key");
7756
+ }
7757
+ const [, begin, body, end] = pem;
7758
+ const lines = body.replace(/\s/g, "").match(new RegExp(`.{1,${PEM_LINE_LENGTH}}`, "g")) ??
7759
+ [];
7760
+ return [begin, ...lines, end, ""].join("\n");
7761
+ };
7762
+ // The auth client holds the token cache, so it must be reused across calls.
7763
+ const getAppAuth = () => {
7764
+ if (cachedAppAuth)
7765
+ return cachedAppAuth;
7766
+ const appId = process.env.GITHUB_BOT_APP_ID;
7767
+ const privateKey = process.env.GITHUB_BOT_PRIVATE_KEY;
7768
+ const installationId = process.env.GITHUB_BOT_INSTALLATION_ID;
7769
+ if (!appId || !privateKey || !installationId) {
7770
+ throw new Error("ENV variables GITHUB_BOT_APP_ID, GITHUB_BOT_PRIVATE_KEY and GITHUB_BOT_INSTALLATION_ID are not properly configured. Set all three, or set only GITHUB_TOKEN");
7771
+ }
7772
+ // createAppAuth needs a PKCS#8 key, and the bundled JWT signer does not convert the PKCS#1 key that GitHub issues.
7773
+ const privateKeyPkcs8 = createPrivateKey(readPrivateKey(privateKey)).export({
7774
+ type: "pkcs8",
7775
+ format: "pem",
7776
+ });
7777
+ cachedAppAuth = createAppAuth({
7778
+ appId: appId.trim(),
7779
+ privateKey: privateKeyPkcs8,
7780
+ installationId: installationId.trim(),
7781
+ });
7782
+ return cachedAppAuth;
7783
+ };
7784
+ const getGithubToken = async ({ forceRefresh = false, } = {}) => {
7785
+ const isGithubBotConfigured = GITHUB_BOT_ENV_VARIABLES.some(name => process.env[name]);
7786
+ const githubToken = process.env.GITHUB_TOKEN;
7787
+ if (!isGithubBotConfigured && githubToken)
7788
+ return githubToken;
7789
+ const { token } = await getAppAuth()({
7790
+ type: "installation",
7791
+ refresh: forceRefresh,
7792
+ });
7793
+ return token;
7794
+ };
7795
+
6241
7796
  const issueStatusCache = new Map();
6242
- let octokit;
6243
- const getOctokit = () => (octokit ??= new Octokit({ auth: process.env.GITHUB_TOKEN }));
6244
7797
  const fetchIsIssueOpen = async (owner, repo, issueNumber) => {
6245
- const { data } = await getOctokit().request("GET /repos/{owner}/{repo}/issues/{issue_number}", {
7798
+ const requestIssue = (auth) => new Octokit({ auth }).request("GET /repos/{owner}/{repo}/issues/{issue_number}", {
6246
7799
  owner,
6247
7800
  repo,
6248
7801
  issue_number: issueNumber,
6249
7802
  headers: { "X-GitHub-Api-Version": "2022-11-28" },
6250
7803
  });
6251
- return data.state === "open";
7804
+ try {
7805
+ const { data } = await requestIssue(await getGithubToken());
7806
+ return data.state === "open";
7807
+ }
7808
+ catch (error) {
7809
+ // 401 means the cached token was revoked — mint a fresh one and retry once.
7810
+ if (error.status !== 401)
7811
+ throw error;
7812
+ const { data } = await requestIssue(await getGithubToken({ forceRefresh: true }));
7813
+ return data.state === "open";
7814
+ }
6252
7815
  };
6253
7816
  const isIssueOpen = (issueLink) => {
6254
7817
  const [owner, repo, ...rest] = (issueLink.split(/[?#]/)[0].split("github.com/").at(-1) ?? "")
@@ -10717,9 +12280,7 @@ class NeetoAuthServer {
10717
12280
  log$1("Already set up, skipping.");
10718
12281
  return;
10719
12282
  }
10720
- if (!process.env.GITHUB_TOKEN) {
10721
- throw new Error("[NeetoAuth] GITHUB_TOKEN is not set. Cannot clone neeto-auth-web.");
10722
- }
12283
+ const githubToken = await getGithubToken();
10723
12284
  if (fs.existsSync(CONFIG$1.DIR)) {
10724
12285
  // We hold the setup lock and the port is free, so anything using this directory is an orphan.
10725
12286
  log$1("Found an incomplete previous setup — killing any lingering " +
@@ -10730,7 +12291,7 @@ class NeetoAuthServer {
10730
12291
  }
10731
12292
  log$1("Running first-time setup...");
10732
12293
  try {
10733
- await this.runSetupScript();
12294
+ await this.runSetupScript(githubToken);
10734
12295
  fs.writeFileSync(CONFIG$1.SETUP_COMPLETE_MARKER, "");
10735
12296
  }
10736
12297
  catch {
@@ -10739,11 +12300,11 @@ class NeetoAuthServer {
10739
12300
  log$1("Setup complete.");
10740
12301
  };
10741
12302
  // Async, not execSync: a blocked event loop stops proper-lockfile refreshing the lock.
10742
- runSetupScript = () => new Promise((resolve, reject) => {
12303
+ runSetupScript = (githubToken) => new Promise((resolve, reject) => {
10743
12304
  const setupScript = path.join(SCRIPTS_DIR$1, "setup.sh");
10744
12305
  const child = spawn("bash", [setupScript, CONFIG$1.DIR], {
10745
12306
  stdio: "inherit",
10746
- env: this.serverEnv,
12307
+ env: { ...this.serverEnv, GITHUB_TOKEN: githubToken },
10747
12308
  });
10748
12309
  child.on("error", reject);
10749
12310
  child.on("exit", code => code === 0
@@ -10934,7 +12495,7 @@ class NeetoChatWidget {
10934
12495
  getLogContent = () => existsSync(CONFIG.LOG)
10935
12496
  ? readFileSync(CONFIG.LOG, "utf-8")
10936
12497
  : "<no log file>";
10937
- ensureSetup = () => {
12498
+ ensureSetup = async () => {
10938
12499
  if (existsSync(CONFIG.WEBPACK_DEV_FILE)) {
10939
12500
  this.patchWebpackPublicPath();
10940
12501
  log("Already set up, skipping.");
@@ -10942,12 +12503,13 @@ class NeetoChatWidget {
10942
12503
  }
10943
12504
  existsSync(CONFIG.DIR) &&
10944
12505
  rmSync(CONFIG.DIR, { force: true, recursive: true });
12506
+ const githubToken = await getGithubToken();
10945
12507
  const setupScript = path.join(SCRIPTS_DIR, "setup.sh");
10946
12508
  log("Running first-time setup...");
10947
12509
  try {
10948
12510
  execSync(`bash "${setupScript}" "${CONFIG.DIR}"`, {
10949
12511
  stdio: "inherit",
10950
- env: this.serverEnv,
12512
+ env: { ...this.serverEnv, GITHUB_TOKEN: githubToken },
10951
12513
  });
10952
12514
  }
10953
12515
  catch {
@@ -11033,7 +12595,7 @@ class NeetoChatWidget {
11033
12595
  log("Server already running.");
11034
12596
  return;
11035
12597
  }
11036
- this.ensureSetup();
12598
+ await this.ensureSetup();
11037
12599
  log("Starting server...");
11038
12600
  this.logStream = createWriteStream(CONFIG.LOG);
11039
12601
  this.process = spawn("yarn", ["start"], {
@@ -11528,4 +13090,4 @@ class InboundEmailApis {
11528
13090
  };
11529
13091
  }
11530
13092
 
11531
- export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_DEFAULTS, LOGIN_SELECTORS, LOGIN_STRATEGIES, LOGIN_TIMEOUT, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OTP_FETCH_TIMEOUT, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
13093
+ export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_DEFAULTS, LOGIN_SELECTORS, LOGIN_STRATEGIES, LOGIN_TIMEOUT, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OTP_FETCH_TIMEOUT, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGithubToken, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };