@empiricalrun/playwright-utils 0.34.1 → 0.34.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,11 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.34.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 2c88e44: fix: delete behavior in postgres client
8
+
3
9
  ## 0.34.1
4
10
 
5
11
  ### Patch Changes
@@ -10,7 +10,7 @@ export declare class PostgresClient {
10
10
  constructor();
11
11
  get(name: string, options?: GetOptions): Promise<PostgresDatabase>;
12
12
  private getConnectionUri;
13
- delete(projectId: string): Promise<void>;
13
+ delete(name: string): Promise<void>;
14
14
  query<T = Record<string, unknown>>(connectionUri: string, sql: string): Promise<T[]>;
15
15
  execute(connectionUri: string, sql: string): Promise<{
16
16
  statement: string;
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAgDA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAqB;;IAW7B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAqD1D,gBAAgB;IAwBxB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBxC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,CAAC,EAAE,CAAC;IAWT,OAAO,CACX,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAsBrD,OAAO,CAAC,eAAe;CAsBxB"}
1
+ {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAgDA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAqB;;IAW7B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAqD1D,gBAAgB;IAwBxB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCnC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,CAAC,EAAE,CAAC;IAWT,OAAO,CACX,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAsBrD,OAAO,CAAC,eAAe;CAsBxB"}
package/dist/postgres.js CHANGED
@@ -66,16 +66,29 @@ class PostgresClient {
66
66
  }
67
67
  return response.data.uri;
68
68
  }
69
- async delete(projectId) {
70
- const response = await this.client.request("/api/neon/proxy", {
69
+ async delete(name) {
70
+ const listResponse = await this.client.request("/api/neon/proxy", {
71
+ method: "POST",
72
+ body: {
73
+ action: "list",
74
+ },
75
+ });
76
+ if (listResponse.error) {
77
+ throw new Error(`Postgres list failed: ${listResponse.error}`);
78
+ }
79
+ const project = listResponse.data.projects.find((p) => p.name === name);
80
+ if (!project) {
81
+ return;
82
+ }
83
+ const deleteResponse = await this.client.request("/api/neon/proxy", {
71
84
  method: "POST",
72
85
  body: {
73
86
  action: "delete",
74
- projectId,
87
+ projectId: project.id,
75
88
  },
76
89
  });
77
- if (response.error) {
78
- throw new Error(`Postgres delete failed: ${response.error}`);
90
+ if (deleteResponse.error) {
91
+ throw new Error(`Postgres delete failed: ${deleteResponse.error}`);
79
92
  }
80
93
  }
81
94
  async query(connectionUri, sql) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.34.1",
3
+ "version": "0.34.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"