@apito-io/js-admin-sdk 2.7.0 → 3.1.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 +23 -12
- package/dist/index.d.mts +76 -40
- package/dist/index.d.ts +76 -40
- package/dist/index.js +31 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/client.test.ts +9 -9
- package/src/client.ts +218 -57
- package/src/index.ts +8 -3
- package/src/types.ts +55 -24
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -145,33 +145,44 @@ const relatedUsers = await client.getRelationDocuments('todo-123', {
|
|
|
145
145
|
});
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
###
|
|
148
|
+
### Project users (system GraphQL)
|
|
149
149
|
|
|
150
|
-
These calls use the
|
|
150
|
+
These calls use the admin client and system GraphQL endpoint. They mirror the Go SDK. Pass `projectId`; on Pro/SaaS engines each user may include `tenant_id`.
|
|
151
151
|
|
|
152
152
|
| Method | Description |
|
|
153
153
|
|--------|-------------|
|
|
154
|
-
| `
|
|
154
|
+
| `searchUsers(projectId, limit?, offset?)` | List project end-users (`email`, `phone`, optional `tenant_id`). |
|
|
155
155
|
| `searchTenantsByDomain(projectId, domain)` | Exact domain lookup in project scope; returns `{ tenant }` (null if no match). |
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
156
|
+
| `createUser(projectId, params)` | Create a local-password user; `params`: `{ password, role?, email?, phone? }`. |
|
|
157
|
+
| `loginUser(params)` | General: `{ projectId, password, email? or phone? }`. Google: **`googleOAuthState(projectId)`** then **`loginUser({ projectId, authMethod: 'google', code, state })`**. |
|
|
158
|
+
| `googleOAuthState(projectId)` | Returns **`{ state }`** for the Google authorize URL. |
|
|
159
|
+
| `updateUser(userId, params)` | Mutate `email`, `phone`, and/or `role` only. |
|
|
160
|
+
| `resetUserPassword(userId, password)` | Admin password reset. |
|
|
161
|
+
| `deleteUser(userId)` | Remove a project user. |
|
|
162
|
+
|
|
163
|
+
### Files (REST)
|
|
164
|
+
|
|
165
|
+
REST base is derived from `baseURL` by stripping `/graphql`, or set `restBaseURL` on the client config.
|
|
166
|
+
|
|
167
|
+
| Method | Description |
|
|
168
|
+
|--------|-------------|
|
|
169
|
+
| `uploadFile(params)` | POST `/files/upload` (multipart). |
|
|
170
|
+
| `listFiles(fileType?, limit?, offset?)` | GET `/files/list`. |
|
|
171
|
+
| `deleteFiles(ids)` | POST `/files/delete`. |
|
|
161
172
|
|
|
162
173
|
On the engine system GraphQL API, `createTenant` accepts an optional `domain`; when set, the domain must be unused in the project (otherwise the mutation fails). `updateTenant` enforces the same when setting `domain` to a non-empty value. Call those mutations via `executeGraphQL` if needed.
|
|
163
174
|
|
|
164
175
|
```javascript
|
|
165
176
|
const projectId = 'your-project-id';
|
|
166
177
|
|
|
167
|
-
const { users, count } = await client.
|
|
178
|
+
const { users, count } = await client.searchUsers(projectId, 50, 0);
|
|
168
179
|
console.log(
|
|
169
180
|
'users:',
|
|
170
181
|
count,
|
|
171
182
|
users.map((u) => u.email || u.phone || u.id),
|
|
172
183
|
);
|
|
173
184
|
|
|
174
|
-
const login = await client.
|
|
185
|
+
const login = await client.loginUser({
|
|
175
186
|
projectId,
|
|
176
187
|
password: 'your-password',
|
|
177
188
|
email: 'user@example.com', // use phone: '+15551234567' when project is phone mode
|
|
@@ -181,7 +192,7 @@ if (login.token) {
|
|
|
181
192
|
}
|
|
182
193
|
```
|
|
183
194
|
|
|
184
|
-
Runnable
|
|
195
|
+
Runnable samples: `examples/users`, `examples/files` (set `APITO_BASE_URL`, `APITO_API_KEY`, `APITO_PROJECT_ID`).
|
|
185
196
|
|
|
186
197
|
### Typed Operations
|
|
187
198
|
|
|
@@ -374,7 +385,7 @@ npm start
|
|
|
374
385
|
Pro tenant-user listing (optional `APITO_TENANT_EMAIL` / `APITO_TENANT_PHONE` + `APITO_TENANT_PASSWORD` for login):
|
|
375
386
|
|
|
376
387
|
```bash
|
|
377
|
-
cd examples/
|
|
388
|
+
cd examples/users
|
|
378
389
|
npm install
|
|
379
390
|
APITO_BASE_URL=http://localhost:5050/system/graphql APITO_API_KEY=... APITO_PROJECT_ID=... npm start
|
|
380
391
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -69,56 +69,77 @@ interface CreateAndUpdateRequest {
|
|
|
69
69
|
singlePageData?: boolean;
|
|
70
70
|
forceUpdate?: boolean;
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
73
|
-
interface
|
|
72
|
+
/** Project end-user from engine system DB (table project_users). */
|
|
73
|
+
interface User {
|
|
74
74
|
id: string;
|
|
75
75
|
email?: string;
|
|
76
76
|
phone?: string;
|
|
77
77
|
role: string;
|
|
78
|
-
tenant_id
|
|
78
|
+
tenant_id?: string;
|
|
79
79
|
provider?: string;
|
|
80
80
|
status?: string;
|
|
81
81
|
created_at?: string;
|
|
82
82
|
updated_at?: string;
|
|
83
83
|
}
|
|
84
|
-
/** Login via system GraphQL `
|
|
85
|
-
interface
|
|
84
|
+
/** 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`). */
|
|
85
|
+
interface LoginUserParams {
|
|
86
86
|
projectId: string;
|
|
87
|
-
/** Required for general (password) login. */
|
|
88
87
|
password?: string;
|
|
89
88
|
email?: string;
|
|
90
89
|
phone?: string;
|
|
91
|
-
/** `general` (default) or `google`. */
|
|
92
90
|
authMethod?: string;
|
|
93
|
-
/** Google authorization code (with `authMethod: 'google'`). */
|
|
94
91
|
code?: string;
|
|
95
|
-
/** OAuth state from `tenantGoogleOAuthState` or callback (with `authMethod: 'google'`). */
|
|
96
92
|
state?: string;
|
|
97
93
|
}
|
|
98
|
-
interface
|
|
94
|
+
interface GoogleOAuthStateResponse {
|
|
99
95
|
state: string;
|
|
100
96
|
}
|
|
101
|
-
interface
|
|
97
|
+
interface CreateUserParams {
|
|
102
98
|
password: string;
|
|
103
99
|
role?: string;
|
|
104
100
|
email?: string;
|
|
105
101
|
phone?: string;
|
|
106
102
|
}
|
|
107
|
-
/** Optional fields for `
|
|
108
|
-
interface
|
|
103
|
+
/** Optional fields for `updateUser`; omitted keys are not sent. */
|
|
104
|
+
interface UpdateUserParams {
|
|
109
105
|
email?: string;
|
|
110
106
|
phone?: string;
|
|
111
|
-
password?: string;
|
|
112
107
|
role?: string;
|
|
113
108
|
}
|
|
114
|
-
interface
|
|
109
|
+
interface LoginUserResponse {
|
|
115
110
|
token: string;
|
|
116
|
-
user?:
|
|
111
|
+
user?: User;
|
|
117
112
|
}
|
|
118
|
-
interface
|
|
119
|
-
users:
|
|
113
|
+
interface UsersResponse {
|
|
114
|
+
users: User[];
|
|
120
115
|
count: number;
|
|
121
116
|
}
|
|
117
|
+
interface File {
|
|
118
|
+
id: string;
|
|
119
|
+
file_type: string;
|
|
120
|
+
file_name: string;
|
|
121
|
+
file_extension?: string;
|
|
122
|
+
content_type?: string;
|
|
123
|
+
size: number;
|
|
124
|
+
url: string;
|
|
125
|
+
created_by?: string;
|
|
126
|
+
created_at?: string;
|
|
127
|
+
}
|
|
128
|
+
interface FilesListResponse {
|
|
129
|
+
files: File[];
|
|
130
|
+
total: number;
|
|
131
|
+
}
|
|
132
|
+
interface UploadFileParams {
|
|
133
|
+
fileName: string;
|
|
134
|
+
content: Uint8Array | ArrayBuffer;
|
|
135
|
+
fileType?: string;
|
|
136
|
+
}
|
|
137
|
+
interface DeleteFilesResponse {
|
|
138
|
+
success: boolean;
|
|
139
|
+
deleted_ids: string[];
|
|
140
|
+
storage_failed?: string[];
|
|
141
|
+
message?: string;
|
|
142
|
+
}
|
|
122
143
|
/** One SaaS catalog tenant row from searchTenantsByDomain. */
|
|
123
144
|
interface TenantCatalogSearchRow {
|
|
124
145
|
id: string;
|
|
@@ -132,6 +153,8 @@ interface TenantByDomainResponse {
|
|
|
132
153
|
}
|
|
133
154
|
interface ClientConfig {
|
|
134
155
|
baseURL: string;
|
|
156
|
+
/** REST base (e.g. http://host:5050/system); derived from baseURL when omitted */
|
|
157
|
+
restBaseURL?: string;
|
|
135
158
|
apiKey: string;
|
|
136
159
|
timeout?: number;
|
|
137
160
|
httpClient?: any;
|
|
@@ -159,13 +182,17 @@ interface InjectedDBOperationInterface {
|
|
|
159
182
|
}): Promise<GraphQLResponse>;
|
|
160
183
|
/** @param token Legacy; ignored. Auth uses client API key. */
|
|
161
184
|
generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
185
|
+
loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
|
|
186
|
+
googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
|
|
187
|
+
searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
|
|
165
188
|
searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
189
|
+
createUser(projectId: string, params: CreateUserParams): Promise<User>;
|
|
190
|
+
updateUser(userId: string, params: UpdateUserParams): Promise<User>;
|
|
191
|
+
resetUserPassword(userId: string, password: string): Promise<boolean>;
|
|
192
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
193
|
+
uploadFile(params: UploadFileParams): Promise<File>;
|
|
194
|
+
listFiles(fileType?: string, limit?: number, offset?: number): Promise<FilesListResponse>;
|
|
195
|
+
deleteFiles(ids: string[]): Promise<DeleteFilesResponse>;
|
|
169
196
|
getSingleResource(model: string, id: string, singlePageData?: boolean): Promise<DefaultDocumentStructure>;
|
|
170
197
|
searchResources(model: string, filter?: Record<string, any>, aggregate?: boolean): Promise<SearchResult>;
|
|
171
198
|
getRelationDocuments(id: string, connection: Record<string, any>): Promise<SearchResult>;
|
|
@@ -203,6 +230,7 @@ declare class ValidationError extends ApitoError {
|
|
|
203
230
|
declare class ApitoClient implements InjectedDBOperationInterface {
|
|
204
231
|
private httpClient;
|
|
205
232
|
private baseURL;
|
|
233
|
+
private restBaseURL;
|
|
206
234
|
private apiKey;
|
|
207
235
|
private tenantId?;
|
|
208
236
|
constructor(config: ClientConfig);
|
|
@@ -222,36 +250,44 @@ declare class ApitoClient implements InjectedDBOperationInterface {
|
|
|
222
250
|
* @param role Optional token role; if omitted/empty, the engine defaults to `admin`.
|
|
223
251
|
*/
|
|
224
252
|
generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
|
|
253
|
+
private authHeaders;
|
|
254
|
+
private executeREST;
|
|
225
255
|
/**
|
|
226
|
-
*
|
|
256
|
+
* Project user login (system GraphQL `loginUser`). Password path: pass `password` and `email` or `phone` per project Authentication settings. Google OAuth path: `authMethod: 'google'` with `code` and `state` from the redirect; call `googleOAuthState(projectId)` before opening Google to obtain `state`.
|
|
227
257
|
*/
|
|
228
|
-
|
|
258
|
+
loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
|
|
229
259
|
/**
|
|
230
|
-
* Signed OAuth state for
|
|
260
|
+
* Signed OAuth state for Google login (system query `googleOAuthState`). Use in the authorize URL together with project `google_client_id` and the configured redirect URI.
|
|
231
261
|
*/
|
|
232
|
-
|
|
233
|
-
state: string;
|
|
234
|
-
}>;
|
|
262
|
+
googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
|
|
235
263
|
/**
|
|
236
|
-
* Search
|
|
264
|
+
* Search project end-users.
|
|
237
265
|
*/
|
|
238
|
-
|
|
266
|
+
searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
|
|
239
267
|
/**
|
|
240
268
|
* Resolve the single SaaS catalog tenant for an exact domain match in the project (`tenant` null if none).
|
|
241
269
|
*/
|
|
242
270
|
searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
|
|
243
271
|
/**
|
|
244
|
-
* Create a
|
|
272
|
+
* Create a project user (local password). Use `email` and/or `phone` per engine validation for the project identifier mode.
|
|
245
273
|
*/
|
|
246
|
-
|
|
274
|
+
createUser(projectId: string, params: CreateUserParams): Promise<User>;
|
|
247
275
|
/**
|
|
248
|
-
* Update a
|
|
276
|
+
* Update a project user. Project scope is implied by the API key. Only include fields to change.
|
|
249
277
|
*/
|
|
250
|
-
|
|
278
|
+
updateUser(userId: string, params: UpdateUserParams): Promise<User>;
|
|
279
|
+
/** Set a new password for a project user (admin mutation resetUserPassword). */
|
|
280
|
+
resetUserPassword(userId: string, password: string): Promise<boolean>;
|
|
251
281
|
/**
|
|
252
|
-
* Delete a
|
|
282
|
+
* Delete a project user by id. Project scope is implied by the API key.
|
|
253
283
|
*/
|
|
254
|
-
|
|
284
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
285
|
+
/** Upload a file via POST /system/files/upload. */
|
|
286
|
+
uploadFile(params: UploadFileParams): Promise<File>;
|
|
287
|
+
/** List files via GET /system/files/list. */
|
|
288
|
+
listFiles(fileType?: string, limit?: number, offset?: number): Promise<FilesListResponse>;
|
|
289
|
+
/** Delete files via POST /system/files/delete. */
|
|
290
|
+
deleteFiles(ids: string[]): Promise<DeleteFilesResponse>;
|
|
255
291
|
/**
|
|
256
292
|
* Get a single resource by model and ID
|
|
257
293
|
*/
|
|
@@ -319,10 +355,10 @@ declare class TypedOperations {
|
|
|
319
355
|
/**
|
|
320
356
|
* Apito JavaScript internal SDK version (kept in sync with package.json for releases)
|
|
321
357
|
*/
|
|
322
|
-
declare const Version = "
|
|
358
|
+
declare const Version = "3.1.0";
|
|
323
359
|
/**
|
|
324
360
|
* GetVersion returns the current version of the SDK
|
|
325
361
|
*/
|
|
326
362
|
declare function getVersion(): string;
|
|
327
363
|
|
|
328
|
-
export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type
|
|
364
|
+
export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type CreateUserParams, type DefaultDocumentStructure, type DeleteFilesResponse, type File, type FilesListResponse, type Filter, type GoogleOAuthStateResponse, GraphQLError, type GraphQLErrorLocation, type GraphQLResponse, type InjectedDBOperationInterface, type LoginUserParams, type LoginUserResponse, type MetaField, type RequestOptions, type SearchOptions, type SearchResult, type TenantByDomainResponse, type TenantCatalogSearchRow, type TypedDocumentStructure, TypedOperations, type TypedSearchResult, type UpdateUserParams, type UploadFileParams, type User, type UsersResponse, ValidationError, Version, createClient, ApitoClient as default, getVersion };
|
package/dist/index.d.ts
CHANGED
|
@@ -69,56 +69,77 @@ interface CreateAndUpdateRequest {
|
|
|
69
69
|
singlePageData?: boolean;
|
|
70
70
|
forceUpdate?: boolean;
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
73
|
-
interface
|
|
72
|
+
/** Project end-user from engine system DB (table project_users). */
|
|
73
|
+
interface User {
|
|
74
74
|
id: string;
|
|
75
75
|
email?: string;
|
|
76
76
|
phone?: string;
|
|
77
77
|
role: string;
|
|
78
|
-
tenant_id
|
|
78
|
+
tenant_id?: string;
|
|
79
79
|
provider?: string;
|
|
80
80
|
status?: string;
|
|
81
81
|
created_at?: string;
|
|
82
82
|
updated_at?: string;
|
|
83
83
|
}
|
|
84
|
-
/** Login via system GraphQL `
|
|
85
|
-
interface
|
|
84
|
+
/** 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`). */
|
|
85
|
+
interface LoginUserParams {
|
|
86
86
|
projectId: string;
|
|
87
|
-
/** Required for general (password) login. */
|
|
88
87
|
password?: string;
|
|
89
88
|
email?: string;
|
|
90
89
|
phone?: string;
|
|
91
|
-
/** `general` (default) or `google`. */
|
|
92
90
|
authMethod?: string;
|
|
93
|
-
/** Google authorization code (with `authMethod: 'google'`). */
|
|
94
91
|
code?: string;
|
|
95
|
-
/** OAuth state from `tenantGoogleOAuthState` or callback (with `authMethod: 'google'`). */
|
|
96
92
|
state?: string;
|
|
97
93
|
}
|
|
98
|
-
interface
|
|
94
|
+
interface GoogleOAuthStateResponse {
|
|
99
95
|
state: string;
|
|
100
96
|
}
|
|
101
|
-
interface
|
|
97
|
+
interface CreateUserParams {
|
|
102
98
|
password: string;
|
|
103
99
|
role?: string;
|
|
104
100
|
email?: string;
|
|
105
101
|
phone?: string;
|
|
106
102
|
}
|
|
107
|
-
/** Optional fields for `
|
|
108
|
-
interface
|
|
103
|
+
/** Optional fields for `updateUser`; omitted keys are not sent. */
|
|
104
|
+
interface UpdateUserParams {
|
|
109
105
|
email?: string;
|
|
110
106
|
phone?: string;
|
|
111
|
-
password?: string;
|
|
112
107
|
role?: string;
|
|
113
108
|
}
|
|
114
|
-
interface
|
|
109
|
+
interface LoginUserResponse {
|
|
115
110
|
token: string;
|
|
116
|
-
user?:
|
|
111
|
+
user?: User;
|
|
117
112
|
}
|
|
118
|
-
interface
|
|
119
|
-
users:
|
|
113
|
+
interface UsersResponse {
|
|
114
|
+
users: User[];
|
|
120
115
|
count: number;
|
|
121
116
|
}
|
|
117
|
+
interface File {
|
|
118
|
+
id: string;
|
|
119
|
+
file_type: string;
|
|
120
|
+
file_name: string;
|
|
121
|
+
file_extension?: string;
|
|
122
|
+
content_type?: string;
|
|
123
|
+
size: number;
|
|
124
|
+
url: string;
|
|
125
|
+
created_by?: string;
|
|
126
|
+
created_at?: string;
|
|
127
|
+
}
|
|
128
|
+
interface FilesListResponse {
|
|
129
|
+
files: File[];
|
|
130
|
+
total: number;
|
|
131
|
+
}
|
|
132
|
+
interface UploadFileParams {
|
|
133
|
+
fileName: string;
|
|
134
|
+
content: Uint8Array | ArrayBuffer;
|
|
135
|
+
fileType?: string;
|
|
136
|
+
}
|
|
137
|
+
interface DeleteFilesResponse {
|
|
138
|
+
success: boolean;
|
|
139
|
+
deleted_ids: string[];
|
|
140
|
+
storage_failed?: string[];
|
|
141
|
+
message?: string;
|
|
142
|
+
}
|
|
122
143
|
/** One SaaS catalog tenant row from searchTenantsByDomain. */
|
|
123
144
|
interface TenantCatalogSearchRow {
|
|
124
145
|
id: string;
|
|
@@ -132,6 +153,8 @@ interface TenantByDomainResponse {
|
|
|
132
153
|
}
|
|
133
154
|
interface ClientConfig {
|
|
134
155
|
baseURL: string;
|
|
156
|
+
/** REST base (e.g. http://host:5050/system); derived from baseURL when omitted */
|
|
157
|
+
restBaseURL?: string;
|
|
135
158
|
apiKey: string;
|
|
136
159
|
timeout?: number;
|
|
137
160
|
httpClient?: any;
|
|
@@ -159,13 +182,17 @@ interface InjectedDBOperationInterface {
|
|
|
159
182
|
}): Promise<GraphQLResponse>;
|
|
160
183
|
/** @param token Legacy; ignored. Auth uses client API key. */
|
|
161
184
|
generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
185
|
+
loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
|
|
186
|
+
googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
|
|
187
|
+
searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
|
|
165
188
|
searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
189
|
+
createUser(projectId: string, params: CreateUserParams): Promise<User>;
|
|
190
|
+
updateUser(userId: string, params: UpdateUserParams): Promise<User>;
|
|
191
|
+
resetUserPassword(userId: string, password: string): Promise<boolean>;
|
|
192
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
193
|
+
uploadFile(params: UploadFileParams): Promise<File>;
|
|
194
|
+
listFiles(fileType?: string, limit?: number, offset?: number): Promise<FilesListResponse>;
|
|
195
|
+
deleteFiles(ids: string[]): Promise<DeleteFilesResponse>;
|
|
169
196
|
getSingleResource(model: string, id: string, singlePageData?: boolean): Promise<DefaultDocumentStructure>;
|
|
170
197
|
searchResources(model: string, filter?: Record<string, any>, aggregate?: boolean): Promise<SearchResult>;
|
|
171
198
|
getRelationDocuments(id: string, connection: Record<string, any>): Promise<SearchResult>;
|
|
@@ -203,6 +230,7 @@ declare class ValidationError extends ApitoError {
|
|
|
203
230
|
declare class ApitoClient implements InjectedDBOperationInterface {
|
|
204
231
|
private httpClient;
|
|
205
232
|
private baseURL;
|
|
233
|
+
private restBaseURL;
|
|
206
234
|
private apiKey;
|
|
207
235
|
private tenantId?;
|
|
208
236
|
constructor(config: ClientConfig);
|
|
@@ -222,36 +250,44 @@ declare class ApitoClient implements InjectedDBOperationInterface {
|
|
|
222
250
|
* @param role Optional token role; if omitted/empty, the engine defaults to `admin`.
|
|
223
251
|
*/
|
|
224
252
|
generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
|
|
253
|
+
private authHeaders;
|
|
254
|
+
private executeREST;
|
|
225
255
|
/**
|
|
226
|
-
*
|
|
256
|
+
* Project user login (system GraphQL `loginUser`). Password path: pass `password` and `email` or `phone` per project Authentication settings. Google OAuth path: `authMethod: 'google'` with `code` and `state` from the redirect; call `googleOAuthState(projectId)` before opening Google to obtain `state`.
|
|
227
257
|
*/
|
|
228
|
-
|
|
258
|
+
loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
|
|
229
259
|
/**
|
|
230
|
-
* Signed OAuth state for
|
|
260
|
+
* Signed OAuth state for Google login (system query `googleOAuthState`). Use in the authorize URL together with project `google_client_id` and the configured redirect URI.
|
|
231
261
|
*/
|
|
232
|
-
|
|
233
|
-
state: string;
|
|
234
|
-
}>;
|
|
262
|
+
googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
|
|
235
263
|
/**
|
|
236
|
-
* Search
|
|
264
|
+
* Search project end-users.
|
|
237
265
|
*/
|
|
238
|
-
|
|
266
|
+
searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
|
|
239
267
|
/**
|
|
240
268
|
* Resolve the single SaaS catalog tenant for an exact domain match in the project (`tenant` null if none).
|
|
241
269
|
*/
|
|
242
270
|
searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
|
|
243
271
|
/**
|
|
244
|
-
* Create a
|
|
272
|
+
* Create a project user (local password). Use `email` and/or `phone` per engine validation for the project identifier mode.
|
|
245
273
|
*/
|
|
246
|
-
|
|
274
|
+
createUser(projectId: string, params: CreateUserParams): Promise<User>;
|
|
247
275
|
/**
|
|
248
|
-
* Update a
|
|
276
|
+
* Update a project user. Project scope is implied by the API key. Only include fields to change.
|
|
249
277
|
*/
|
|
250
|
-
|
|
278
|
+
updateUser(userId: string, params: UpdateUserParams): Promise<User>;
|
|
279
|
+
/** Set a new password for a project user (admin mutation resetUserPassword). */
|
|
280
|
+
resetUserPassword(userId: string, password: string): Promise<boolean>;
|
|
251
281
|
/**
|
|
252
|
-
* Delete a
|
|
282
|
+
* Delete a project user by id. Project scope is implied by the API key.
|
|
253
283
|
*/
|
|
254
|
-
|
|
284
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
285
|
+
/** Upload a file via POST /system/files/upload. */
|
|
286
|
+
uploadFile(params: UploadFileParams): Promise<File>;
|
|
287
|
+
/** List files via GET /system/files/list. */
|
|
288
|
+
listFiles(fileType?: string, limit?: number, offset?: number): Promise<FilesListResponse>;
|
|
289
|
+
/** Delete files via POST /system/files/delete. */
|
|
290
|
+
deleteFiles(ids: string[]): Promise<DeleteFilesResponse>;
|
|
255
291
|
/**
|
|
256
292
|
* Get a single resource by model and ID
|
|
257
293
|
*/
|
|
@@ -319,10 +355,10 @@ declare class TypedOperations {
|
|
|
319
355
|
/**
|
|
320
356
|
* Apito JavaScript internal SDK version (kept in sync with package.json for releases)
|
|
321
357
|
*/
|
|
322
|
-
declare const Version = "
|
|
358
|
+
declare const Version = "3.1.0";
|
|
323
359
|
/**
|
|
324
360
|
* GetVersion returns the current version of the SDK
|
|
325
361
|
*/
|
|
326
362
|
declare function getVersion(): string;
|
|
327
363
|
|
|
328
|
-
export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type
|
|
364
|
+
export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type CreateUserParams, type DefaultDocumentStructure, type DeleteFilesResponse, type File, type FilesListResponse, type Filter, type GoogleOAuthStateResponse, GraphQLError, type GraphQLErrorLocation, type GraphQLResponse, type InjectedDBOperationInterface, type LoginUserParams, type LoginUserResponse, type MetaField, type RequestOptions, type SearchOptions, type SearchResult, type TenantByDomainResponse, type TenantCatalogSearchRow, type TypedDocumentStructure, TypedOperations, type TypedSearchResult, type UpdateUserParams, type UploadFileParams, type User, type UsersResponse, ValidationError, Version, createClient, ApitoClient as default, getVersion };
|