@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/src/types.ts CHANGED
@@ -86,29 +86,110 @@ export interface CreateAndUpdateRequest {
86
86
  forceUpdate?: boolean;
87
87
  }
88
88
 
89
- /** Tenant catalog user from engine system DB (pro_tenant_users). */
90
- export interface TenantUser {
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: string;
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
- export interface TenantLoginResponse {
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?: TenantUser;
133
+ user?: User;
105
134
  }
106
135
 
107
- export interface TenantUsersResponse {
108
- users: TenantUser[];
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
- loginTenantUser(username: string, password: string, projectId: string): Promise<TenantLoginResponse>;
162
- loginTenantUserGoogle(projectId: string, idToken: string): Promise<TenantLoginResponse>;
163
- searchTenantUsers(projectId: string, limit?: number, offset?: number): Promise<TenantUsersResponse>;
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
- createTenantUser(
166
- projectId: string,
167
- username: string,
168
- email: string,
169
- password: string,
170
- role: string
171
- ): Promise<TenantUser>;
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>;
package/src/version.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Apito JavaScript internal SDK version (kept in sync with package.json for releases)
3
3
  */
4
- export const Version = '2.5.0';
4
+ export const Version = '3.0.0';
5
5
 
6
6
  /**
7
7
  * GetVersion returns the current version of the SDK