@apito-io/js-admin-sdk 2.5.0 → 3.0.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.
- package/README.md +40 -12
- package/dist/index.d.mts +126 -22
- package/dist/index.d.ts +126 -22
- package/dist/index.js +78 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/client.test.ts +17 -11
- package/src/client.ts +370 -64
- package/src/index.ts +8 -0
- package/src/types.ts +103 -18
- package/src/version.ts +1 -1
package/src/types.ts
CHANGED
|
@@ -86,29 +86,110 @@ export interface CreateAndUpdateRequest {
|
|
|
86
86
|
forceUpdate?: boolean;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
export interface
|
|
89
|
+
/** Project end-user from engine system DB (table project_users). */
|
|
90
|
+
export interface User {
|
|
91
91
|
id: string;
|
|
92
|
-
username: string;
|
|
93
92
|
email?: string;
|
|
93
|
+
phone?: string;
|
|
94
94
|
role: string;
|
|
95
|
-
tenant_id
|
|
95
|
+
tenant_id?: string;
|
|
96
96
|
provider?: string;
|
|
97
97
|
status?: string;
|
|
98
98
|
created_at?: string;
|
|
99
99
|
updated_at?: string;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
/** Login via system GraphQL `loginUser`. Password path: use `email` or `phone` per project settings. Google OAuth code path: `authMethod: 'google'`, `code`, `state` from redirect (get `state` first via `googleOAuthState`). */
|
|
103
|
+
export interface LoginUserParams {
|
|
104
|
+
projectId: string;
|
|
105
|
+
password?: string;
|
|
106
|
+
email?: string;
|
|
107
|
+
phone?: string;
|
|
108
|
+
authMethod?: string;
|
|
109
|
+
code?: string;
|
|
110
|
+
state?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface GoogleOAuthStateResponse {
|
|
114
|
+
state: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface CreateUserParams {
|
|
118
|
+
password: string;
|
|
119
|
+
role?: string;
|
|
120
|
+
email?: string;
|
|
121
|
+
phone?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Optional fields for `updateUser`; omitted keys are not sent. */
|
|
125
|
+
export interface UpdateUserParams {
|
|
126
|
+
email?: string;
|
|
127
|
+
phone?: string;
|
|
128
|
+
role?: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface LoginUserResponse {
|
|
103
132
|
token: string;
|
|
104
|
-
user?:
|
|
133
|
+
user?: User;
|
|
105
134
|
}
|
|
106
135
|
|
|
107
|
-
export interface
|
|
108
|
-
users:
|
|
136
|
+
export interface UsersResponse {
|
|
137
|
+
users: User[];
|
|
109
138
|
count: number;
|
|
110
139
|
}
|
|
111
140
|
|
|
141
|
+
export interface ProjectStorageSettings {
|
|
142
|
+
use_free_cloud_storage: boolean;
|
|
143
|
+
endpoint?: string | null;
|
|
144
|
+
region?: string | null;
|
|
145
|
+
bucket?: string | null;
|
|
146
|
+
access_key_id?: string | null;
|
|
147
|
+
has_secret_access_key: boolean;
|
|
148
|
+
public_base_url?: string | null;
|
|
149
|
+
force_path_style?: boolean | null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface UpdateProjectStorageInput {
|
|
153
|
+
use_free_cloud_storage?: boolean;
|
|
154
|
+
endpoint?: string;
|
|
155
|
+
region?: string;
|
|
156
|
+
bucket?: string;
|
|
157
|
+
access_key_id?: string;
|
|
158
|
+
secret_access_key?: string;
|
|
159
|
+
public_base_url?: string;
|
|
160
|
+
force_path_style?: boolean;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface SystemFile {
|
|
164
|
+
id: string;
|
|
165
|
+
file_type: string;
|
|
166
|
+
file_name: string;
|
|
167
|
+
file_extension?: string;
|
|
168
|
+
content_type?: string;
|
|
169
|
+
size: number;
|
|
170
|
+
url: string;
|
|
171
|
+
created_by?: string;
|
|
172
|
+
created_at?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface SystemFilesListResponse {
|
|
176
|
+
files: SystemFile[];
|
|
177
|
+
total: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface SystemFileUploadParams {
|
|
181
|
+
fileName: string;
|
|
182
|
+
content: Uint8Array | ArrayBuffer;
|
|
183
|
+
fileType?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface DeleteSystemFilesResponse {
|
|
187
|
+
success: boolean;
|
|
188
|
+
deleted_ids: string[];
|
|
189
|
+
storage_failed?: string[];
|
|
190
|
+
message?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
112
193
|
/** One SaaS catalog tenant row from searchTenantsByDomain. */
|
|
113
194
|
export interface TenantCatalogSearchRow {
|
|
114
195
|
id: string;
|
|
@@ -124,6 +205,8 @@ export interface TenantByDomainResponse {
|
|
|
124
205
|
|
|
125
206
|
export interface ClientConfig {
|
|
126
207
|
baseURL: string;
|
|
208
|
+
/** REST base (e.g. http://host:5050/system); derived from baseURL when omitted */
|
|
209
|
+
restBaseURL?: string;
|
|
127
210
|
apiKey: string;
|
|
128
211
|
timeout?: number;
|
|
129
212
|
httpClient?: any;
|
|
@@ -158,17 +241,19 @@ export interface InjectedDBOperationInterface {
|
|
|
158
241
|
): Promise<GraphQLResponse>;
|
|
159
242
|
/** @param token Legacy; ignored. Auth uses client API key. */
|
|
160
243
|
generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
244
|
+
loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
|
|
245
|
+
googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
|
|
246
|
+
searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
|
|
164
247
|
searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
): Promise<
|
|
248
|
+
createUser(projectId: string, params: CreateUserParams): Promise<User>;
|
|
249
|
+
updateUser(userId: string, params: UpdateUserParams): Promise<User>;
|
|
250
|
+
resetUserPassword(userId: string, password: string): Promise<boolean>;
|
|
251
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
252
|
+
getProjectStorageSettings(projectId: string): Promise<ProjectStorageSettings>;
|
|
253
|
+
updateProjectStorageSettings(input: UpdateProjectStorageInput): Promise<ProjectStorageSettings>;
|
|
254
|
+
uploadSystemFile(params: SystemFileUploadParams): Promise<SystemFile>;
|
|
255
|
+
listSystemFiles(fileType?: string, limit?: number, offset?: number): Promise<SystemFilesListResponse>;
|
|
256
|
+
deleteSystemFiles(ids: string[]): Promise<DeleteSystemFilesResponse>;
|
|
172
257
|
getSingleResource(model: string, id: string, singlePageData?: boolean): Promise<DefaultDocumentStructure>;
|
|
173
258
|
searchResources(model: string, filter?: Record<string, any>, aggregate?: boolean): Promise<SearchResult>;
|
|
174
259
|
getRelationDocuments(id: string, connection: Record<string, any>): Promise<SearchResult>;
|