@prisma/credentials-store 6.9.0-dev.4 → 6.9.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -21,8 +21,10 @@ export declare class CredentialsStore {
21
21
  constructor(authFilePathOverride?: string);
22
22
  reloadCredentialsFromDisk(): Promise<void>;
23
23
  storeCredentials(credentials: Credentials): Promise<void>;
24
+ deleteCredentials(workspaceId: string): Promise<void>;
24
25
  getCredentials(): Promise<Credentials[]>;
25
26
  getCredentialsForWorkspace(workspaceId: string): Promise<Credentials | undefined>;
27
+ private writeCredentialsToDisk;
26
28
  }
27
29
 
28
30
  export { }
package/dist/index.d.ts CHANGED
@@ -21,8 +21,10 @@ export declare class CredentialsStore {
21
21
  constructor(authFilePathOverride?: string);
22
22
  reloadCredentialsFromDisk(): Promise<void>;
23
23
  storeCredentials(credentials: Credentials): Promise<void>;
24
+ deleteCredentials(workspaceId: string): Promise<void>;
24
25
  getCredentials(): Promise<Credentials[]>;
25
26
  getCredentialsForWorkspace(workspaceId: string): Promise<Credentials | undefined>;
27
+ private writeCredentialsToDisk;
26
28
  }
27
29
 
28
30
  export { }
package/dist/index.js CHANGED
@@ -56,13 +56,18 @@ var CredentialsStore = class {
56
56
  }
57
57
  async storeCredentials(credentials) {
58
58
  await this.reloadCredentialsFromDisk();
59
- this.loadedCredentials = [
59
+ const updatedCredentials = [
60
60
  ...(this.loadedCredentials || []).filter((c) => c.workspaceId !== credentials.workspaceId),
61
61
  credentials
62
62
  ];
63
- const data = { tokens: this.loadedCredentials };
64
- await (0, import_promises.mkdir)(import_path.default.dirname(this.authFilePath), { recursive: true });
65
- await (0, import_promises.writeFile)(this.authFilePath, JSON.stringify(data, null, 2));
63
+ this.loadedCredentials = updatedCredentials;
64
+ await this.writeCredentialsToDisk(updatedCredentials);
65
+ }
66
+ async deleteCredentials(workspaceId) {
67
+ await this.reloadCredentialsFromDisk();
68
+ const updatedCredentials = (this.loadedCredentials || []).filter((c) => c.workspaceId !== workspaceId);
69
+ this.loadedCredentials = updatedCredentials;
70
+ await this.writeCredentialsToDisk(updatedCredentials);
66
71
  }
67
72
  async getCredentials() {
68
73
  if (this.loadedCredentials === void 0) {
@@ -73,6 +78,11 @@ var CredentialsStore = class {
73
78
  async getCredentialsForWorkspace(workspaceId) {
74
79
  return (await this.getCredentials()).filter((c) => c.workspaceId === workspaceId)[0];
75
80
  }
81
+ async writeCredentialsToDisk(credentials) {
82
+ const data = { tokens: credentials };
83
+ await (0, import_promises.mkdir)(import_path.default.dirname(this.authFilePath), { recursive: true });
84
+ await (0, import_promises.writeFile)(this.authFilePath, JSON.stringify(data, null, 2));
85
+ }
76
86
  };
77
87
  // Annotate the CommonJS export names for ESM import in node:
78
88
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -22,13 +22,18 @@ var CredentialsStore = class {
22
22
  }
23
23
  async storeCredentials(credentials) {
24
24
  await this.reloadCredentialsFromDisk();
25
- this.loadedCredentials = [
25
+ const updatedCredentials = [
26
26
  ...(this.loadedCredentials || []).filter((c) => c.workspaceId !== credentials.workspaceId),
27
27
  credentials
28
28
  ];
29
- const data = { tokens: this.loadedCredentials };
30
- await mkdir(path.dirname(this.authFilePath), { recursive: true });
31
- await writeFile(this.authFilePath, JSON.stringify(data, null, 2));
29
+ this.loadedCredentials = updatedCredentials;
30
+ await this.writeCredentialsToDisk(updatedCredentials);
31
+ }
32
+ async deleteCredentials(workspaceId) {
33
+ await this.reloadCredentialsFromDisk();
34
+ const updatedCredentials = (this.loadedCredentials || []).filter((c) => c.workspaceId !== workspaceId);
35
+ this.loadedCredentials = updatedCredentials;
36
+ await this.writeCredentialsToDisk(updatedCredentials);
32
37
  }
33
38
  async getCredentials() {
34
39
  if (this.loadedCredentials === void 0) {
@@ -39,6 +44,11 @@ var CredentialsStore = class {
39
44
  async getCredentialsForWorkspace(workspaceId) {
40
45
  return (await this.getCredentials()).filter((c) => c.workspaceId === workspaceId)[0];
41
46
  }
47
+ async writeCredentialsToDisk(credentials) {
48
+ const data = { tokens: credentials };
49
+ await mkdir(path.dirname(this.authFilePath), { recursive: true });
50
+ await writeFile(this.authFilePath, JSON.stringify(data, null, 2));
51
+ }
42
52
  };
43
53
  export {
44
54
  CredentialsStore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/credentials-store",
3
- "version": "6.9.0-dev.4",
3
+ "version": "6.9.0-dev.5",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",