@flashbacktech/flashbackclient 0.0.38 → 0.0.39
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/api/client.d.ts +4 -4
- package/dist/api/client.js +4 -7
- package/dist/api/interfaces.d.ts +4 -4
- package/dist/api/types.d.ts +12 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse,
|
|
1
|
+
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse } from './types';
|
|
2
2
|
import { IApiClient, ProviderType } from './interfaces';
|
|
3
3
|
export declare class ApiClient implements IApiClient {
|
|
4
4
|
private baseURL;
|
|
@@ -10,9 +10,9 @@ export declare class ApiClient implements IApiClient {
|
|
|
10
10
|
private authenticateGoogle;
|
|
11
11
|
private authenticateGithub;
|
|
12
12
|
createStorageUnit: (data: CreateUnitRequest) => Promise<CreateUnitResponse>;
|
|
13
|
-
getStorageUnits: () => Promise<
|
|
13
|
+
getStorageUnits: () => Promise<GetUnitsResponse>;
|
|
14
14
|
createRepo: (data: CreateRepoRequest) => Promise<CreateRepoResponse>;
|
|
15
|
-
getRepos: () => Promise<
|
|
15
|
+
getRepos: () => Promise<GetReposResponse>;
|
|
16
16
|
createRepoKey: (data: CreateRepoKeyRequest) => Promise<CreateRepoKeyResponse>;
|
|
17
|
-
getRepoKeys: (repoId: string) => Promise<
|
|
17
|
+
getRepoKeys: (repoId: string) => Promise<GetRepoKeysResponse>;
|
|
18
18
|
}
|
package/dist/api/client.js
CHANGED
|
@@ -76,14 +76,11 @@ class ApiClient {
|
|
|
76
76
|
method: 'GET',
|
|
77
77
|
headers: this.headers,
|
|
78
78
|
});
|
|
79
|
-
console.log('Response status:', response.status, response.ok);
|
|
80
|
-
const text = await response.text(); // Get raw response text
|
|
81
|
-
console.log('Response body:', text);
|
|
82
79
|
if (!response.ok) {
|
|
83
80
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
84
81
|
}
|
|
85
|
-
const ret =
|
|
86
|
-
return ret;
|
|
82
|
+
const ret = await response.json();
|
|
83
|
+
return { success: true, units: ret };
|
|
87
84
|
};
|
|
88
85
|
this.createRepo = async (data) => {
|
|
89
86
|
const response = await fetch(`${this.baseURL}/repo`, {
|
|
@@ -106,7 +103,7 @@ class ApiClient {
|
|
|
106
103
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
107
104
|
}
|
|
108
105
|
const ret = await response.json();
|
|
109
|
-
return ret;
|
|
106
|
+
return { success: true, repos: ret };
|
|
110
107
|
};
|
|
111
108
|
this.createRepoKey = async (data) => {
|
|
112
109
|
const response = await fetch(`${this.baseURL}/repo/${data.repoId}/apikey`, {
|
|
@@ -129,7 +126,7 @@ class ApiClient {
|
|
|
129
126
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
130
127
|
}
|
|
131
128
|
const ret = await response.json();
|
|
132
|
-
return ret;
|
|
129
|
+
return { success: true, keys: ret };
|
|
133
130
|
};
|
|
134
131
|
this.baseURL = baseURL;
|
|
135
132
|
this.headers = {
|
package/dist/api/interfaces.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse } from "./types";
|
|
2
2
|
export declare enum ProviderType {
|
|
3
3
|
GOOGLE = "GOOGLE",
|
|
4
4
|
GITHUB = "GITHUB",
|
|
@@ -7,9 +7,9 @@ export declare enum ProviderType {
|
|
|
7
7
|
export interface IApiClient {
|
|
8
8
|
authenticate(token: string, provider: ProviderType): Promise<any>;
|
|
9
9
|
createStorageUnit(data: CreateUnitRequest): Promise<CreateUnitResponse>;
|
|
10
|
-
getStorageUnits(): Promise<
|
|
10
|
+
getStorageUnits(): Promise<GetUnitsResponse>;
|
|
11
11
|
createRepo(data: CreateRepoRequest): Promise<CreateRepoResponse>;
|
|
12
|
-
getRepos(): Promise<
|
|
12
|
+
getRepos(): Promise<GetReposResponse>;
|
|
13
13
|
createRepoKey(data: CreateRepoKeyRequest): Promise<CreateRepoKeyResponse>;
|
|
14
|
-
getRepoKeys(repoId: string): Promise<
|
|
14
|
+
getRepoKeys(repoId: string): Promise<GetRepoKeysResponse>;
|
|
15
15
|
}
|
package/dist/api/types.d.ts
CHANGED
|
@@ -75,3 +75,15 @@ export interface StorageUnit {
|
|
|
75
75
|
endpoint?: string;
|
|
76
76
|
regionId?: string;
|
|
77
77
|
}
|
|
78
|
+
export interface GetUnitsResponse {
|
|
79
|
+
success: boolean;
|
|
80
|
+
units: StorageUnit[];
|
|
81
|
+
}
|
|
82
|
+
export interface GetReposResponse {
|
|
83
|
+
success: boolean;
|
|
84
|
+
repos: StorageRepo[];
|
|
85
|
+
}
|
|
86
|
+
export interface GetRepoKeysResponse {
|
|
87
|
+
success: boolean;
|
|
88
|
+
keys: ApiKey[];
|
|
89
|
+
}
|