@empiricalrun/playwright-utils 0.67.0 → 0.67.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.67.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 510d767: chore: getProxyConfig no longer falls back to the shared proxy password; the static IP proxy now needs the project's Static IP proxy add-on
8
+ - @empiricalrun/cua@0.6.0
9
+ - @empiricalrun/reporter@0.30.3
10
+
11
+ ## 0.67.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 735e68a: chore: getProxyConfig uses per-project authentication credentials; no change required for callers
16
+ - @empiricalrun/cua@0.6.0
17
+ - @empiricalrun/reporter@0.30.3
18
+
3
19
  ## 0.67.0
4
20
 
5
21
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/config/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,KAAK,WAAW,GAAG,WAAW,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/D,KAAK,WAAW,GAAG,YAAY,CAAC;AAOhC,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAM/D"}
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/config/proxy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,KAAK,WAAW,GAAG,WAAW,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/D,KAAK,WAAW,GAAG,YAAY,CAAC;AAiDhC,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAM/D"}
@@ -1,13 +1,53 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getProxyConfig = getProxyConfig;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
4
8
  const proxyEndpoints = {
5
9
  "ap-south-1": "http://prod-proxy-nlb-6b53da958ae0b30e.elb.ap-south-1.amazonaws.com:8080",
6
10
  };
11
+ const DEFAULT_TOKEN_FILE = "/tmp/static-ip-proxy-token";
12
+ function tokenExpiry(token) {
13
+ const [payloadB64] = token.split(".");
14
+ if (!payloadB64) {
15
+ return undefined;
16
+ }
17
+ try {
18
+ const payload = JSON.parse(Buffer.from(payloadB64, "base64").toString("utf8"));
19
+ const exp = payload?.exp;
20
+ return typeof exp === "number" ? exp : undefined;
21
+ }
22
+ catch {
23
+ return undefined;
24
+ }
25
+ }
26
+ function isUnexpiredToken(token) {
27
+ if (!token) {
28
+ return false;
29
+ }
30
+ const exp = tokenExpiry(token);
31
+ return exp !== undefined && exp * 1000 > Date.now();
32
+ }
33
+ function readTokenFile() {
34
+ const path = process.env.EMPIRICAL_STATIC_IP_PROXY_TOKEN_FILE ?? DEFAULT_TOKEN_FILE;
35
+ try {
36
+ return node_fs_1.default.readFileSync(path, "utf8").trim();
37
+ }
38
+ catch {
39
+ return undefined;
40
+ }
41
+ }
42
+ function staticIpProxyToken() {
43
+ return [readTokenFile(), process.env.EMPIRICAL_STATIC_IP_PROXY_TOKEN?.trim()]
44
+ .filter(isUnexpiredToken)
45
+ .at(0);
46
+ }
7
47
  function getProxyConfig(region) {
8
48
  return {
9
49
  server: proxyEndpoints[region],
10
50
  username: "proxyuser",
11
- password: process.env.EMPIRICAL_PROXY_PASSWORD,
51
+ password: staticIpProxyToken(),
12
52
  };
13
53
  }
@@ -1370,26 +1370,6 @@ export interface paths {
1370
1370
  patch?: never;
1371
1371
  trace?: never;
1372
1372
  };
1373
- "/api/v2/slack/channels/{id}/refresh": {
1374
- parameters: {
1375
- query?: never;
1376
- header?: never;
1377
- path?: never;
1378
- cookie?: never;
1379
- };
1380
- get?: never;
1381
- put?: never;
1382
- /**
1383
- * 🤖 Refresh a canonical Slack channel's name
1384
- * @description Re-reads the channel from Slack and stores its current name when it changed. The canonical channel ID is stable, so environment reporter configs are unaffected. Access problems are reported in the validation result rather than as an error.
1385
- */
1386
- post: operations["refreshSlackChannelV2"];
1387
- delete?: never;
1388
- options?: never;
1389
- head?: never;
1390
- patch?: never;
1391
- trace?: never;
1392
- };
1393
1373
  "/api/v2/slack/channels/validate": {
1394
1374
  parameters: {
1395
1375
  query?: never;
@@ -1399,7 +1379,7 @@ export interface paths {
1399
1379
  };
1400
1380
  /**
1401
1381
  * 🤖 Validate canonical Slack channels
1402
- * @description Checks every active channel registered for the scoped project's organization against Slack. Validation is read-only and verifies bot access and the stored channel name.
1382
+ * @description Checks every active channel registered for the scoped project's organization against Slack. Validation is read-only and verifies that the bot can read each channel.
1403
1383
  */
1404
1384
  get: operations["validateSlackChannelsV2"];
1405
1385
  put?: never;
@@ -1654,6 +1634,26 @@ export interface paths {
1654
1634
  patch: operations["updateFile"];
1655
1635
  trace?: never;
1656
1636
  };
1637
+ "/api/infra/static-ips": {
1638
+ parameters: {
1639
+ query?: never;
1640
+ header?: never;
1641
+ path?: never;
1642
+ cookie?: never;
1643
+ };
1644
+ /**
1645
+ * Get static egress IPs for a region
1646
+ * @description Returns the proxy endpoint and the egress IPs to allowlist for the given region. Requires the project's Static IP proxy add-on.
1647
+ */
1648
+ get: operations["getStaticIps"];
1649
+ put?: never;
1650
+ post?: never;
1651
+ delete?: never;
1652
+ options?: never;
1653
+ head?: never;
1654
+ patch?: never;
1655
+ trace?: never;
1656
+ };
1657
1657
  "/api/reporters": {
1658
1658
  parameters: {
1659
1659
  query?: never;
@@ -2019,7 +2019,7 @@ export interface paths {
2019
2019
  patch?: never;
2020
2020
  trace?: never;
2021
2021
  };
2022
- "/api/infra/static-ips": {
2022
+ "/api/playwright-versions": {
2023
2023
  parameters: {
2024
2024
  query?: never;
2025
2025
  header?: never;
@@ -2027,10 +2027,10 @@ export interface paths {
2027
2027
  cookie?: never;
2028
2028
  };
2029
2029
  /**
2030
- * 🤖 Get static egress IPs for a region
2031
- * @description Returns the proxy endpoint and the egress IPs to allowlist for the given region.
2030
+ * 🤖 List supported Playwright versions
2031
+ * @description Returns the static list of supported Playwright versions and the default version. Public read — no authentication required.
2032
2032
  */
2033
- get: operations["getStaticIps"];
2033
+ get: operations["listPlaywrightVersions"];
2034
2034
  put?: never;
2035
2035
  post?: never;
2036
2036
  delete?: never;
@@ -2039,7 +2039,7 @@ export interface paths {
2039
2039
  patch?: never;
2040
2040
  trace?: never;
2041
2041
  };
2042
- "/api/playwright-versions": {
2042
+ "/api/project-addons": {
2043
2043
  parameters: {
2044
2044
  query?: never;
2045
2045
  header?: never;
@@ -2047,10 +2047,10 @@ export interface paths {
2047
2047
  cookie?: never;
2048
2048
  };
2049
2049
  /**
2050
- * 🤖 List supported Playwright versions
2051
- * @description Returns the static list of supported Playwright versions and the default version. Public read — no authentication required.
2050
+ * 🤖 List add-ons for the scoped project
2051
+ * @description Returns every known add-on with its current state, plus the full period history for this project.
2052
2052
  */
2053
- get: operations["listPlaywrightVersions"];
2053
+ get: operations["listProjectAddons"];
2054
2054
  put?: never;
2055
2055
  post?: never;
2056
2056
  delete?: never;
@@ -3478,6 +3478,26 @@ export interface paths {
3478
3478
  patch?: never;
3479
3479
  trace?: never;
3480
3480
  };
3481
+ "/api/environment-variables/resolved": {
3482
+ parameters: {
3483
+ query?: never;
3484
+ header?: never;
3485
+ path?: never;
3486
+ cookie?: never;
3487
+ };
3488
+ /**
3489
+ * ⚙️ Get resolved environment variables
3490
+ * @description Returns the variable values each enabled environment of the scoped project resolves to, the same values a sandbox computer writes into its .env files.
3491
+ */
3492
+ get: operations["getResolvedEnvironmentVariables"];
3493
+ put?: never;
3494
+ post?: never;
3495
+ delete?: never;
3496
+ options?: never;
3497
+ head?: never;
3498
+ patch?: never;
3499
+ trace?: never;
3500
+ };
3481
3501
  "/api/files/loom": {
3482
3502
  parameters: {
3483
3503
  query?: never;
@@ -5526,26 +5546,6 @@ export interface paths {
5526
5546
  patch?: never;
5527
5547
  trace?: never;
5528
5548
  };
5529
- "/api/project-addons": {
5530
- parameters: {
5531
- query?: never;
5532
- header?: never;
5533
- path?: never;
5534
- cookie?: never;
5535
- };
5536
- /**
5537
- * ⚙️ List add-ons for the scoped project
5538
- * @description Returns every known add-on with its current state, plus the full period history for this project.
5539
- */
5540
- get: operations["listProjectAddons"];
5541
- put?: never;
5542
- post?: never;
5543
- delete?: never;
5544
- options?: never;
5545
- head?: never;
5546
- patch?: never;
5547
- trace?: never;
5548
- };
5549
5549
  "/api/project-addons/{addon}/disable": {
5550
5550
  parameters: {
5551
5551
  query?: never;
@@ -13178,6 +13178,24 @@ export interface components {
13178
13178
  is_super_admin: boolean;
13179
13179
  };
13180
13180
  };
13181
+ ResolvedEnvironmentVariables: {
13182
+ /** @description Environment slug. */
13183
+ slug: string;
13184
+ /** @description Variables that apply to the environment, environment-specific values winning over all-environment ones. */
13185
+ variables: {
13186
+ /** @description Variable name. */
13187
+ name: string;
13188
+ /** @description Variable value. */
13189
+ value: string;
13190
+ }[];
13191
+ };
13192
+ ResolvedEnvironmentVariablesResponse: {
13193
+ /** @description Response payload. */
13194
+ data: {
13195
+ /** @description Resolved variables per enabled environment. */
13196
+ environments: components["schemas"]["ResolvedEnvironmentVariables"][];
13197
+ };
13198
+ };
13181
13199
  Resource: {
13182
13200
  /** @description Unique identifier. */
13183
13201
  id: number;
@@ -14089,15 +14107,6 @@ export interface components {
14089
14107
  channels: components["schemas"]["SlackChannelV2"][];
14090
14108
  };
14091
14109
  };
14092
- SlackChannelRefreshV2Response: {
14093
- data: {
14094
- channel: components["schemas"]["ValidatedSlackChannelV2"];
14095
- /** @description Whether the stored channel name was replaced with Slack's current name. */
14096
- renamed: boolean;
14097
- /** @description Channel name stored before the refresh. */
14098
- previous_channel_name: string | null;
14099
- };
14100
- };
14101
14110
  SlackChannelV2: {
14102
14111
  /** @description Canonical Slack channel ID. */
14103
14112
  id: number;
@@ -15437,6 +15446,8 @@ export interface components {
15437
15446
  data: {
15438
15447
  /** @description Resolved environment variables for the run. */
15439
15448
  environment_variables: components["schemas"]["TestRunEnvironmentVariable"][];
15449
+ /** @description Slug of the run's environment, or null when it has none. */
15450
+ environment_slug: string | null;
15440
15451
  };
15441
15452
  };
15442
15453
  TestRunHistoryChartItem: {
@@ -16735,7 +16746,7 @@ export interface components {
16735
16746
  updated_at: string;
16736
16747
  /** @description Live Slack validation result. */
16737
16748
  slack_channel_validation: {
16738
- /** @description Whether the bot can read the channel and its stored name matches Slack. */
16749
+ /** @description Whether the bot can read the channel. */
16739
16750
  ok: boolean;
16740
16751
  /** @description Slack channel ID. */
16741
16752
  channel_id: string;
@@ -16743,10 +16754,6 @@ export interface components {
16743
16754
  can_access: boolean;
16744
16755
  /** @description Whether the bot can read the channel. */
16745
16756
  is_member?: boolean;
16746
- /** @description Current channel name returned by Slack. */
16747
- current_channel_name?: string | null;
16748
- /** @description Whether the stored channel name matches Slack's current name. */
16749
- channel_name_matches?: boolean;
16750
16757
  /** @description Machine-readable validation failure code. */
16751
16758
  error_code?: string;
16752
16759
  /** @description Human-readable validation result. */
@@ -20837,38 +20844,6 @@ export interface operations {
20837
20844
  };
20838
20845
  };
20839
20846
  };
20840
- refreshSlackChannelV2: {
20841
- parameters: {
20842
- query?: never;
20843
- header?: never;
20844
- path: {
20845
- /** @description Canonical Slack channel ID. */
20846
- id: number;
20847
- };
20848
- cookie?: never;
20849
- };
20850
- requestBody?: never;
20851
- responses: {
20852
- /** @description The channel after the refresh, with live validation. */
20853
- 200: {
20854
- headers: {
20855
- [name: string]: unknown;
20856
- };
20857
- content: {
20858
- "application/json": components["schemas"]["SlackChannelRefreshV2Response"];
20859
- };
20860
- };
20861
- /** @description Channel not found in the scoped project's organization. */
20862
- 404: {
20863
- headers: {
20864
- [name: string]: unknown;
20865
- };
20866
- content: {
20867
- "application/json": components["schemas"]["ErrorResponse"];
20868
- };
20869
- };
20870
- };
20871
- };
20872
20847
  validateSlackChannelsV2: {
20873
20848
  parameters: {
20874
20849
  query?: never;
@@ -21539,6 +21514,56 @@ export interface operations {
21539
21514
  };
21540
21515
  };
21541
21516
  };
21517
+ getStaticIps: {
21518
+ parameters: {
21519
+ query: {
21520
+ /** @description Region to look up. One of: ap-south-1. */
21521
+ region: string;
21522
+ };
21523
+ header?: never;
21524
+ path?: never;
21525
+ cookie?: never;
21526
+ };
21527
+ requestBody?: never;
21528
+ responses: {
21529
+ /** @description Static IPs for the region. */
21530
+ 200: {
21531
+ headers: {
21532
+ [name: string]: unknown;
21533
+ };
21534
+ content: {
21535
+ "application/json": components["schemas"]["StaticIpsResponse"];
21536
+ };
21537
+ };
21538
+ /** @description Missing or unknown region, or missing project scope. */
21539
+ 400: {
21540
+ headers: {
21541
+ [name: string]: unknown;
21542
+ };
21543
+ content: {
21544
+ "application/json": components["schemas"]["ErrorResponse"];
21545
+ };
21546
+ };
21547
+ /** @description Project does not have the Static IP proxy add-on. */
21548
+ 403: {
21549
+ headers: {
21550
+ [name: string]: unknown;
21551
+ };
21552
+ content: {
21553
+ "application/json": components["schemas"]["ErrorResponse"];
21554
+ };
21555
+ };
21556
+ /** @description Project not found or not accessible. */
21557
+ 404: {
21558
+ headers: {
21559
+ [name: string]: unknown;
21560
+ };
21561
+ content: {
21562
+ "application/json": components["schemas"]["ErrorResponse"];
21563
+ };
21564
+ };
21565
+ };
21566
+ };
21542
21567
  listReporters: {
21543
21568
  parameters: {
21544
21569
  query?: never;
@@ -22699,7 +22724,7 @@ export interface operations {
22699
22724
  pw_test_id: string;
22700
22725
  /** @description Dry-run this matcher source instead of the groups' matchers: `async ({ testRun, testCase, traceUtils }) => boolean`. */
22701
22726
  source?: string;
22702
- /** @description Only run these groups' matchers. Default: every open group with a matcher. */
22727
+ /** @description Only run these groups' matchers, by label or ID. Default: every open group with a matcher. */
22703
22728
  group_ids?: string[];
22704
22729
  };
22705
22730
  };
@@ -23029,39 +23054,27 @@ export interface operations {
23029
23054
  };
23030
23055
  };
23031
23056
  };
23032
- getStaticIps: {
23057
+ listPlaywrightVersions: {
23033
23058
  parameters: {
23034
- query: {
23035
- /** @description Region to look up. One of: ap-south-1. */
23036
- region: string;
23037
- };
23059
+ query?: never;
23038
23060
  header?: never;
23039
23061
  path?: never;
23040
23062
  cookie?: never;
23041
23063
  };
23042
23064
  requestBody?: never;
23043
23065
  responses: {
23044
- /** @description Static IPs for the region. */
23066
+ /** @description Supported Playwright versions and the default version. */
23045
23067
  200: {
23046
23068
  headers: {
23047
23069
  [name: string]: unknown;
23048
23070
  };
23049
23071
  content: {
23050
- "application/json": components["schemas"]["StaticIpsResponse"];
23051
- };
23052
- };
23053
- /** @description Missing or unknown region. */
23054
- 400: {
23055
- headers: {
23056
- [name: string]: unknown;
23057
- };
23058
- content: {
23059
- "application/json": components["schemas"]["ErrorResponse"];
23072
+ "application/json": components["schemas"]["PlaywrightVersionsResponse"];
23060
23073
  };
23061
23074
  };
23062
23075
  };
23063
23076
  };
23064
- listPlaywrightVersions: {
23077
+ listProjectAddons: {
23065
23078
  parameters: {
23066
23079
  query?: never;
23067
23080
  header?: never;
@@ -23070,13 +23083,31 @@ export interface operations {
23070
23083
  };
23071
23084
  requestBody?: never;
23072
23085
  responses: {
23073
- /** @description Supported Playwright versions and the default version. */
23086
+ /** @description Add-on state and history. */
23074
23087
  200: {
23075
23088
  headers: {
23076
23089
  [name: string]: unknown;
23077
23090
  };
23078
23091
  content: {
23079
- "application/json": components["schemas"]["PlaywrightVersionsResponse"];
23092
+ "application/json": components["schemas"]["ListProjectAddonsResponse"];
23093
+ };
23094
+ };
23095
+ /** @description Missing or invalid project scope. */
23096
+ 400: {
23097
+ headers: {
23098
+ [name: string]: unknown;
23099
+ };
23100
+ content: {
23101
+ "application/json": components["schemas"]["ErrorResponse"];
23102
+ };
23103
+ };
23104
+ /** @description Project not found or not accessible. */
23105
+ 404: {
23106
+ headers: {
23107
+ [name: string]: unknown;
23108
+ };
23109
+ content: {
23110
+ "application/json": components["schemas"]["ErrorResponse"];
23080
23111
  };
23081
23112
  };
23082
23113
  };
@@ -26948,6 +26979,47 @@ export interface operations {
26948
26979
  };
26949
26980
  };
26950
26981
  };
26982
+ getResolvedEnvironmentVariables: {
26983
+ parameters: {
26984
+ query?: {
26985
+ /** @description Environment slug (case-insensitive). Omit to resolve every enabled environment. */
26986
+ environment?: string;
26987
+ };
26988
+ header?: never;
26989
+ path?: never;
26990
+ cookie?: never;
26991
+ };
26992
+ requestBody?: never;
26993
+ responses: {
26994
+ /** @description Resolved variables per environment. */
26995
+ 200: {
26996
+ headers: {
26997
+ [name: string]: unknown;
26998
+ };
26999
+ content: {
27000
+ "application/json": components["schemas"]["ResolvedEnvironmentVariablesResponse"];
27001
+ };
27002
+ };
27003
+ /** @description Invalid request or missing project scope. */
27004
+ 400: {
27005
+ headers: {
27006
+ [name: string]: unknown;
27007
+ };
27008
+ content: {
27009
+ "application/json": components["schemas"]["ErrorResponse"];
27010
+ };
27011
+ };
27012
+ /** @description Project or environment not found. */
27013
+ 404: {
27014
+ headers: {
27015
+ [name: string]: unknown;
27016
+ };
27017
+ content: {
27018
+ "application/json": components["schemas"]["ErrorResponse"];
27019
+ };
27020
+ };
27021
+ };
27022
+ };
26951
27023
  importLoomFile: {
26952
27024
  parameters: {
26953
27025
  query?: never;
@@ -32198,44 +32270,6 @@ export interface operations {
32198
32270
  };
32199
32271
  };
32200
32272
  };
32201
- listProjectAddons: {
32202
- parameters: {
32203
- query?: never;
32204
- header?: never;
32205
- path?: never;
32206
- cookie?: never;
32207
- };
32208
- requestBody?: never;
32209
- responses: {
32210
- /** @description Add-on state and history. */
32211
- 200: {
32212
- headers: {
32213
- [name: string]: unknown;
32214
- };
32215
- content: {
32216
- "application/json": components["schemas"]["ListProjectAddonsResponse"];
32217
- };
32218
- };
32219
- /** @description Missing or invalid project scope. */
32220
- 400: {
32221
- headers: {
32222
- [name: string]: unknown;
32223
- };
32224
- content: {
32225
- "application/json": components["schemas"]["ErrorResponse"];
32226
- };
32227
- };
32228
- /** @description Project not found or not accessible. */
32229
- 404: {
32230
- headers: {
32231
- [name: string]: unknown;
32232
- };
32233
- content: {
32234
- "application/json": components["schemas"]["ErrorResponse"];
32235
- };
32236
- };
32237
- };
32238
- };
32239
32273
  disableProjectAddon: {
32240
32274
  parameters: {
32241
32275
  query?: never;