@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 CHANGED
@@ -145,33 +145,61 @@ const relatedUsers = await client.getRelationDocuments('todo-123', {
145
145
  });
146
146
  ```
147
147
 
148
- ### Pro: tenant catalog users (Apito Pro)
148
+ ### Project users (system GraphQL)
149
149
 
150
- These calls use the same admin client and system GraphQL endpoint as the rest of the SDK. They mirror the Go SDK and require a **Pro** Apito engine. Pass `projectId`; each returned user includes `tenant_id`.
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
- | `searchTenantUsers(projectId, limit?, offset?)` | List users registered for a project. |
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
- | `createTenantUser(projectId, username, email, password, role)` | Create a local-password user in project scope. |
157
- | `loginTenantUser(username, password, projectId)` | Password login in project scope; response may include a tenant-scoped token. |
158
- | `loginTenantUserGoogle(projectId, idToken)` | Google ID token login in project scope. |
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
+ ### Project storage settings (system GraphQL)
164
+
165
+ | Method | Description |
166
+ |--------|-------------|
167
+ | `getProjectStorageSettings(projectId)` | Read S3/storage settings (secrets not returned). |
168
+ | `updateProjectStorageSettings(input)` | Persist storage settings. |
169
+
170
+ ### System files (REST)
171
+
172
+ REST base is derived from `baseURL` by stripping `/graphql`, or set `restBaseURL` on the client config.
173
+
174
+ | Method | Description |
175
+ |--------|-------------|
176
+ | `uploadSystemFile(params)` | POST `/files/upload` (multipart). |
177
+ | `listSystemFiles(fileType?, limit?, offset?)` | GET `/files/list`. |
178
+ | `deleteSystemFiles(ids)` | POST `/files/delete`. |
159
179
 
160
180
  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.
161
181
 
162
182
  ```javascript
163
183
  const projectId = 'your-project-id';
164
184
 
165
- const { users, count } = await client.searchTenantUsers(projectId, 50, 0);
166
- console.log('users:', count, users.map((u) => u.username));
185
+ const { users, count } = await client.searchUsers(projectId, 50, 0);
186
+ console.log(
187
+ 'users:',
188
+ count,
189
+ users.map((u) => u.email || u.phone || u.id),
190
+ );
167
191
 
168
- const login = await client.loginTenantUser('admin', 'your-password', projectId);
192
+ const login = await client.loginUser({
193
+ projectId,
194
+ password: 'your-password',
195
+ email: 'user@example.com', // use phone: '+15551234567' when project is phone mode
196
+ });
169
197
  if (login.token) {
170
198
  console.log('tenant-scoped token:', login.token);
171
199
  }
172
200
  ```
173
201
 
174
- Runnable sample: `examples/tenant_users` (set `APITO_BASE_URL`, `APITO_API_KEY`, `APITO_PROJECT_ID`).
202
+ Runnable samples: `examples/users`, `examples/system_files` (set `APITO_BASE_URL`, `APITO_API_KEY`, `APITO_PROJECT_ID`).
175
203
 
176
204
  ### Typed Operations
177
205
 
@@ -361,10 +389,10 @@ npm install
361
389
  npm start
362
390
  ```
363
391
 
364
- Pro tenant-user listing (optional `APITO_TENANT_USERNAME` / `APITO_TENANT_PASSWORD` for login):
392
+ Pro tenant-user listing (optional `APITO_TENANT_EMAIL` / `APITO_TENANT_PHONE` + `APITO_TENANT_PASSWORD` for login):
365
393
 
366
394
  ```bash
367
- cd examples/tenant_users
395
+ cd examples/users
368
396
  npm install
369
397
  APITO_BASE_URL=http://localhost:5050/system/graphql APITO_API_KEY=... APITO_PROJECT_ID=... npm start
370
398
  ```
package/dist/index.d.mts CHANGED
@@ -69,26 +69,97 @@ interface CreateAndUpdateRequest {
69
69
  singlePageData?: boolean;
70
70
  forceUpdate?: boolean;
71
71
  }
72
- /** Tenant catalog user from engine system DB (pro_tenant_users). */
73
- interface TenantUser {
72
+ /** Project end-user from engine system DB (table project_users). */
73
+ interface User {
74
74
  id: string;
75
- username: string;
76
75
  email?: string;
76
+ phone?: string;
77
77
  role: string;
78
- tenant_id: string;
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
- interface TenantLoginResponse {
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
+ projectId: string;
87
+ password?: string;
88
+ email?: string;
89
+ phone?: string;
90
+ authMethod?: string;
91
+ code?: string;
92
+ state?: string;
93
+ }
94
+ interface GoogleOAuthStateResponse {
95
+ state: string;
96
+ }
97
+ interface CreateUserParams {
98
+ password: string;
99
+ role?: string;
100
+ email?: string;
101
+ phone?: string;
102
+ }
103
+ /** Optional fields for `updateUser`; omitted keys are not sent. */
104
+ interface UpdateUserParams {
105
+ email?: string;
106
+ phone?: string;
107
+ role?: string;
108
+ }
109
+ interface LoginUserResponse {
85
110
  token: string;
86
- user?: TenantUser;
111
+ user?: User;
87
112
  }
88
- interface TenantUsersResponse {
89
- users: TenantUser[];
113
+ interface UsersResponse {
114
+ users: User[];
90
115
  count: number;
91
116
  }
117
+ interface ProjectStorageSettings {
118
+ use_free_cloud_storage: boolean;
119
+ endpoint?: string | null;
120
+ region?: string | null;
121
+ bucket?: string | null;
122
+ access_key_id?: string | null;
123
+ has_secret_access_key: boolean;
124
+ public_base_url?: string | null;
125
+ force_path_style?: boolean | null;
126
+ }
127
+ interface UpdateProjectStorageInput {
128
+ use_free_cloud_storage?: boolean;
129
+ endpoint?: string;
130
+ region?: string;
131
+ bucket?: string;
132
+ access_key_id?: string;
133
+ secret_access_key?: string;
134
+ public_base_url?: string;
135
+ force_path_style?: boolean;
136
+ }
137
+ interface SystemFile {
138
+ id: string;
139
+ file_type: string;
140
+ file_name: string;
141
+ file_extension?: string;
142
+ content_type?: string;
143
+ size: number;
144
+ url: string;
145
+ created_by?: string;
146
+ created_at?: string;
147
+ }
148
+ interface SystemFilesListResponse {
149
+ files: SystemFile[];
150
+ total: number;
151
+ }
152
+ interface SystemFileUploadParams {
153
+ fileName: string;
154
+ content: Uint8Array | ArrayBuffer;
155
+ fileType?: string;
156
+ }
157
+ interface DeleteSystemFilesResponse {
158
+ success: boolean;
159
+ deleted_ids: string[];
160
+ storage_failed?: string[];
161
+ message?: string;
162
+ }
92
163
  /** One SaaS catalog tenant row from searchTenantsByDomain. */
93
164
  interface TenantCatalogSearchRow {
94
165
  id: string;
@@ -102,6 +173,8 @@ interface TenantByDomainResponse {
102
173
  }
103
174
  interface ClientConfig {
104
175
  baseURL: string;
176
+ /** REST base (e.g. http://host:5050/system); derived from baseURL when omitted */
177
+ restBaseURL?: string;
105
178
  apiKey: string;
106
179
  timeout?: number;
107
180
  httpClient?: any;
@@ -129,11 +202,19 @@ interface InjectedDBOperationInterface {
129
202
  }): Promise<GraphQLResponse>;
130
203
  /** @param token Legacy; ignored. Auth uses client API key. */
131
204
  generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
132
- loginTenantUser(username: string, password: string, projectId: string): Promise<TenantLoginResponse>;
133
- loginTenantUserGoogle(projectId: string, idToken: string): Promise<TenantLoginResponse>;
134
- searchTenantUsers(projectId: string, limit?: number, offset?: number): Promise<TenantUsersResponse>;
205
+ loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
206
+ googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
207
+ searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
135
208
  searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
136
- createTenantUser(projectId: string, username: string, email: string, password: string, role: string): Promise<TenantUser>;
209
+ createUser(projectId: string, params: CreateUserParams): Promise<User>;
210
+ updateUser(userId: string, params: UpdateUserParams): Promise<User>;
211
+ resetUserPassword(userId: string, password: string): Promise<boolean>;
212
+ deleteUser(userId: string): Promise<boolean>;
213
+ getProjectStorageSettings(projectId: string): Promise<ProjectStorageSettings>;
214
+ updateProjectStorageSettings(input: UpdateProjectStorageInput): Promise<ProjectStorageSettings>;
215
+ uploadSystemFile(params: SystemFileUploadParams): Promise<SystemFile>;
216
+ listSystemFiles(fileType?: string, limit?: number, offset?: number): Promise<SystemFilesListResponse>;
217
+ deleteSystemFiles(ids: string[]): Promise<DeleteSystemFilesResponse>;
137
218
  getSingleResource(model: string, id: string, singlePageData?: boolean): Promise<DefaultDocumentStructure>;
138
219
  searchResources(model: string, filter?: Record<string, any>, aggregate?: boolean): Promise<SearchResult>;
139
220
  getRelationDocuments(id: string, connection: Record<string, any>): Promise<SearchResult>;
@@ -171,6 +252,7 @@ declare class ValidationError extends ApitoError {
171
252
  declare class ApitoClient implements InjectedDBOperationInterface {
172
253
  private httpClient;
173
254
  private baseURL;
255
+ private restBaseURL;
174
256
  private apiKey;
175
257
  private tenantId?;
176
258
  constructor(config: ClientConfig);
@@ -190,26 +272,48 @@ declare class ApitoClient implements InjectedDBOperationInterface {
190
272
  * @param role Optional token role; if omitted/empty, the engine defaults to `admin`.
191
273
  */
192
274
  generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
275
+ private authHeaders;
276
+ private executeREST;
193
277
  /**
194
- * Tenant catalog login (system GraphQL). Returns a tenant-scoped `ak_` API token on success.
278
+ * 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`.
195
279
  */
196
- loginTenantUser(username: string, password: string, projectId: string): Promise<TenantLoginResponse>;
280
+ loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
197
281
  /**
198
- * Google ID token login for tenant users (project must have google_client_id set).
282
+ * 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.
199
283
  */
200
- loginTenantUserGoogle(projectId: string, idToken: string): Promise<TenantLoginResponse>;
284
+ googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
201
285
  /**
202
- * Search tenant users for a project.
286
+ * Search project end-users.
203
287
  */
204
- searchTenantUsers(projectId: string, limit?: number, offset?: number): Promise<TenantUsersResponse>;
288
+ searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
205
289
  /**
206
290
  * Resolve the single SaaS catalog tenant for an exact domain match in the project (`tenant` null if none).
207
291
  */
208
292
  searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
209
293
  /**
210
- * Create a tenant catalog user (local password).
294
+ * Create a project user (local password). Use `email` and/or `phone` per engine validation for the project identifier mode.
295
+ */
296
+ createUser(projectId: string, params: CreateUserParams): Promise<User>;
297
+ /**
298
+ * Update a project user. Project scope is implied by the API key. Only include fields to change.
299
+ */
300
+ updateUser(userId: string, params: UpdateUserParams): Promise<User>;
301
+ /** Set a new password for a project user (admin mutation resetUserPassword). */
302
+ resetUserPassword(userId: string, password: string): Promise<boolean>;
303
+ /**
304
+ * Delete a project user by id. Project scope is implied by the API key.
211
305
  */
212
- createTenantUser(projectId: string, username: string, email: string, password: string, role: string): Promise<TenantUser>;
306
+ deleteUser(userId: string): Promise<boolean>;
307
+ /** Read project storage settings via getProject. */
308
+ getProjectStorageSettings(projectId: string): Promise<ProjectStorageSettings>;
309
+ /** Persist project storage settings. */
310
+ updateProjectStorageSettings(input: UpdateProjectStorageInput): Promise<ProjectStorageSettings>;
311
+ /** Upload a file via POST /system/files/upload. */
312
+ uploadSystemFile(params: SystemFileUploadParams): Promise<SystemFile>;
313
+ /** List files via GET /system/files/list. */
314
+ listSystemFiles(fileType?: string, limit?: number, offset?: number): Promise<SystemFilesListResponse>;
315
+ /** Delete files via POST /system/files/delete. */
316
+ deleteSystemFiles(ids: string[]): Promise<DeleteSystemFilesResponse>;
213
317
  /**
214
318
  * Get a single resource by model and ID
215
319
  */
@@ -277,10 +381,10 @@ declare class TypedOperations {
277
381
  /**
278
382
  * Apito JavaScript internal SDK version (kept in sync with package.json for releases)
279
383
  */
280
- declare const Version = "2.5.0";
384
+ declare const Version = "3.0.0";
281
385
  /**
282
386
  * GetVersion returns the current version of the SDK
283
387
  */
284
388
  declare function getVersion(): string;
285
389
 
286
- export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type DefaultDocumentStructure, type Filter, GraphQLError, type GraphQLErrorLocation, type GraphQLResponse, type InjectedDBOperationInterface, type MetaField, type RequestOptions, type SearchOptions, type SearchResult, type TenantByDomainResponse, type TenantCatalogSearchRow, type TenantLoginResponse, type TenantUser, type TenantUsersResponse, type TypedDocumentStructure, TypedOperations, type TypedSearchResult, ValidationError, Version, createClient, ApitoClient as default, getVersion };
390
+ export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type CreateUserParams, type DefaultDocumentStructure, type DeleteSystemFilesResponse, type Filter, type GoogleOAuthStateResponse, GraphQLError, type GraphQLErrorLocation, type GraphQLResponse, type InjectedDBOperationInterface, type LoginUserParams, type LoginUserResponse, type MetaField, type ProjectStorageSettings, type RequestOptions, type SearchOptions, type SearchResult, type SystemFile, type SystemFileUploadParams, type SystemFilesListResponse, type TenantByDomainResponse, type TenantCatalogSearchRow, type TypedDocumentStructure, TypedOperations, type TypedSearchResult, type UpdateProjectStorageInput, type UpdateUserParams, type User, type UsersResponse, ValidationError, Version, createClient, ApitoClient as default, getVersion };
package/dist/index.d.ts CHANGED
@@ -69,26 +69,97 @@ interface CreateAndUpdateRequest {
69
69
  singlePageData?: boolean;
70
70
  forceUpdate?: boolean;
71
71
  }
72
- /** Tenant catalog user from engine system DB (pro_tenant_users). */
73
- interface TenantUser {
72
+ /** Project end-user from engine system DB (table project_users). */
73
+ interface User {
74
74
  id: string;
75
- username: string;
76
75
  email?: string;
76
+ phone?: string;
77
77
  role: string;
78
- tenant_id: string;
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
- interface TenantLoginResponse {
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
+ projectId: string;
87
+ password?: string;
88
+ email?: string;
89
+ phone?: string;
90
+ authMethod?: string;
91
+ code?: string;
92
+ state?: string;
93
+ }
94
+ interface GoogleOAuthStateResponse {
95
+ state: string;
96
+ }
97
+ interface CreateUserParams {
98
+ password: string;
99
+ role?: string;
100
+ email?: string;
101
+ phone?: string;
102
+ }
103
+ /** Optional fields for `updateUser`; omitted keys are not sent. */
104
+ interface UpdateUserParams {
105
+ email?: string;
106
+ phone?: string;
107
+ role?: string;
108
+ }
109
+ interface LoginUserResponse {
85
110
  token: string;
86
- user?: TenantUser;
111
+ user?: User;
87
112
  }
88
- interface TenantUsersResponse {
89
- users: TenantUser[];
113
+ interface UsersResponse {
114
+ users: User[];
90
115
  count: number;
91
116
  }
117
+ interface ProjectStorageSettings {
118
+ use_free_cloud_storage: boolean;
119
+ endpoint?: string | null;
120
+ region?: string | null;
121
+ bucket?: string | null;
122
+ access_key_id?: string | null;
123
+ has_secret_access_key: boolean;
124
+ public_base_url?: string | null;
125
+ force_path_style?: boolean | null;
126
+ }
127
+ interface UpdateProjectStorageInput {
128
+ use_free_cloud_storage?: boolean;
129
+ endpoint?: string;
130
+ region?: string;
131
+ bucket?: string;
132
+ access_key_id?: string;
133
+ secret_access_key?: string;
134
+ public_base_url?: string;
135
+ force_path_style?: boolean;
136
+ }
137
+ interface SystemFile {
138
+ id: string;
139
+ file_type: string;
140
+ file_name: string;
141
+ file_extension?: string;
142
+ content_type?: string;
143
+ size: number;
144
+ url: string;
145
+ created_by?: string;
146
+ created_at?: string;
147
+ }
148
+ interface SystemFilesListResponse {
149
+ files: SystemFile[];
150
+ total: number;
151
+ }
152
+ interface SystemFileUploadParams {
153
+ fileName: string;
154
+ content: Uint8Array | ArrayBuffer;
155
+ fileType?: string;
156
+ }
157
+ interface DeleteSystemFilesResponse {
158
+ success: boolean;
159
+ deleted_ids: string[];
160
+ storage_failed?: string[];
161
+ message?: string;
162
+ }
92
163
  /** One SaaS catalog tenant row from searchTenantsByDomain. */
93
164
  interface TenantCatalogSearchRow {
94
165
  id: string;
@@ -102,6 +173,8 @@ interface TenantByDomainResponse {
102
173
  }
103
174
  interface ClientConfig {
104
175
  baseURL: string;
176
+ /** REST base (e.g. http://host:5050/system); derived from baseURL when omitted */
177
+ restBaseURL?: string;
105
178
  apiKey: string;
106
179
  timeout?: number;
107
180
  httpClient?: any;
@@ -129,11 +202,19 @@ interface InjectedDBOperationInterface {
129
202
  }): Promise<GraphQLResponse>;
130
203
  /** @param token Legacy; ignored. Auth uses client API key. */
131
204
  generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
132
- loginTenantUser(username: string, password: string, projectId: string): Promise<TenantLoginResponse>;
133
- loginTenantUserGoogle(projectId: string, idToken: string): Promise<TenantLoginResponse>;
134
- searchTenantUsers(projectId: string, limit?: number, offset?: number): Promise<TenantUsersResponse>;
205
+ loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
206
+ googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
207
+ searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
135
208
  searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
136
- createTenantUser(projectId: string, username: string, email: string, password: string, role: string): Promise<TenantUser>;
209
+ createUser(projectId: string, params: CreateUserParams): Promise<User>;
210
+ updateUser(userId: string, params: UpdateUserParams): Promise<User>;
211
+ resetUserPassword(userId: string, password: string): Promise<boolean>;
212
+ deleteUser(userId: string): Promise<boolean>;
213
+ getProjectStorageSettings(projectId: string): Promise<ProjectStorageSettings>;
214
+ updateProjectStorageSettings(input: UpdateProjectStorageInput): Promise<ProjectStorageSettings>;
215
+ uploadSystemFile(params: SystemFileUploadParams): Promise<SystemFile>;
216
+ listSystemFiles(fileType?: string, limit?: number, offset?: number): Promise<SystemFilesListResponse>;
217
+ deleteSystemFiles(ids: string[]): Promise<DeleteSystemFilesResponse>;
137
218
  getSingleResource(model: string, id: string, singlePageData?: boolean): Promise<DefaultDocumentStructure>;
138
219
  searchResources(model: string, filter?: Record<string, any>, aggregate?: boolean): Promise<SearchResult>;
139
220
  getRelationDocuments(id: string, connection: Record<string, any>): Promise<SearchResult>;
@@ -171,6 +252,7 @@ declare class ValidationError extends ApitoError {
171
252
  declare class ApitoClient implements InjectedDBOperationInterface {
172
253
  private httpClient;
173
254
  private baseURL;
255
+ private restBaseURL;
174
256
  private apiKey;
175
257
  private tenantId?;
176
258
  constructor(config: ClientConfig);
@@ -190,26 +272,48 @@ declare class ApitoClient implements InjectedDBOperationInterface {
190
272
  * @param role Optional token role; if omitted/empty, the engine defaults to `admin`.
191
273
  */
192
274
  generateTenantToken(tenantId: string, duration?: string, role?: string): Promise<string>;
275
+ private authHeaders;
276
+ private executeREST;
193
277
  /**
194
- * Tenant catalog login (system GraphQL). Returns a tenant-scoped `ak_` API token on success.
278
+ * 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`.
195
279
  */
196
- loginTenantUser(username: string, password: string, projectId: string): Promise<TenantLoginResponse>;
280
+ loginUser(params: LoginUserParams): Promise<LoginUserResponse>;
197
281
  /**
198
- * Google ID token login for tenant users (project must have google_client_id set).
282
+ * 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.
199
283
  */
200
- loginTenantUserGoogle(projectId: string, idToken: string): Promise<TenantLoginResponse>;
284
+ googleOAuthState(projectId: string): Promise<GoogleOAuthStateResponse>;
201
285
  /**
202
- * Search tenant users for a project.
286
+ * Search project end-users.
203
287
  */
204
- searchTenantUsers(projectId: string, limit?: number, offset?: number): Promise<TenantUsersResponse>;
288
+ searchUsers(projectId: string, limit?: number, offset?: number): Promise<UsersResponse>;
205
289
  /**
206
290
  * Resolve the single SaaS catalog tenant for an exact domain match in the project (`tenant` null if none).
207
291
  */
208
292
  searchTenantsByDomain(projectId: string, domain: string): Promise<TenantByDomainResponse>;
209
293
  /**
210
- * Create a tenant catalog user (local password).
294
+ * Create a project user (local password). Use `email` and/or `phone` per engine validation for the project identifier mode.
295
+ */
296
+ createUser(projectId: string, params: CreateUserParams): Promise<User>;
297
+ /**
298
+ * Update a project user. Project scope is implied by the API key. Only include fields to change.
299
+ */
300
+ updateUser(userId: string, params: UpdateUserParams): Promise<User>;
301
+ /** Set a new password for a project user (admin mutation resetUserPassword). */
302
+ resetUserPassword(userId: string, password: string): Promise<boolean>;
303
+ /**
304
+ * Delete a project user by id. Project scope is implied by the API key.
211
305
  */
212
- createTenantUser(projectId: string, username: string, email: string, password: string, role: string): Promise<TenantUser>;
306
+ deleteUser(userId: string): Promise<boolean>;
307
+ /** Read project storage settings via getProject. */
308
+ getProjectStorageSettings(projectId: string): Promise<ProjectStorageSettings>;
309
+ /** Persist project storage settings. */
310
+ updateProjectStorageSettings(input: UpdateProjectStorageInput): Promise<ProjectStorageSettings>;
311
+ /** Upload a file via POST /system/files/upload. */
312
+ uploadSystemFile(params: SystemFileUploadParams): Promise<SystemFile>;
313
+ /** List files via GET /system/files/list. */
314
+ listSystemFiles(fileType?: string, limit?: number, offset?: number): Promise<SystemFilesListResponse>;
315
+ /** Delete files via POST /system/files/delete. */
316
+ deleteSystemFiles(ids: string[]): Promise<DeleteSystemFilesResponse>;
213
317
  /**
214
318
  * Get a single resource by model and ID
215
319
  */
@@ -277,10 +381,10 @@ declare class TypedOperations {
277
381
  /**
278
382
  * Apito JavaScript internal SDK version (kept in sync with package.json for releases)
279
383
  */
280
- declare const Version = "2.5.0";
384
+ declare const Version = "3.0.0";
281
385
  /**
282
386
  * GetVersion returns the current version of the SDK
283
387
  */
284
388
  declare function getVersion(): string;
285
389
 
286
- export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type DefaultDocumentStructure, type Filter, GraphQLError, type GraphQLErrorLocation, type GraphQLResponse, type InjectedDBOperationInterface, type MetaField, type RequestOptions, type SearchOptions, type SearchResult, type TenantByDomainResponse, type TenantCatalogSearchRow, type TenantLoginResponse, type TenantUser, type TenantUsersResponse, type TypedDocumentStructure, TypedOperations, type TypedSearchResult, ValidationError, Version, createClient, ApitoClient as default, getVersion };
390
+ export { ApitoClient, ApitoError, type ClientConfig, type ConnectionOptions, type CreateAndUpdateRequest, type CreateUserParams, type DefaultDocumentStructure, type DeleteSystemFilesResponse, type Filter, type GoogleOAuthStateResponse, GraphQLError, type GraphQLErrorLocation, type GraphQLResponse, type InjectedDBOperationInterface, type LoginUserParams, type LoginUserResponse, type MetaField, type ProjectStorageSettings, type RequestOptions, type SearchOptions, type SearchResult, type SystemFile, type SystemFileUploadParams, type SystemFilesListResponse, type TenantByDomainResponse, type TenantCatalogSearchRow, type TypedDocumentStructure, TypedOperations, type TypedSearchResult, type UpdateProjectStorageInput, type UpdateUserParams, type User, type UsersResponse, ValidationError, Version, createClient, ApitoClient as default, getVersion };