@abpjs/saas 0.7.2 → 2.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/dist/index.d.mts +139 -4
- package/dist/index.d.ts +139 -4
- package/dist/index.js +202 -0
- package/dist/index.mjs +201 -0
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* SaaS Models
|
|
6
|
-
* Translated from @volo/abp.ng.saas
|
|
6
|
+
* Translated from @volo/abp.ng.saas v2.0.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -120,7 +120,7 @@ declare const SAAS_ROUTES: {
|
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* SaaS Service
|
|
123
|
-
* Translated from @volo/abp.ng.saas
|
|
123
|
+
* Translated from @volo/abp.ng.saas v2.0.0
|
|
124
124
|
*
|
|
125
125
|
* Provides REST API methods for managing tenants, editions,
|
|
126
126
|
* and connection strings in a multi-tenant SaaS application.
|
|
@@ -130,7 +130,7 @@ declare const SAAS_ROUTES: {
|
|
|
130
130
|
* Service for SaaS operations including tenant and edition management.
|
|
131
131
|
* This service wraps all REST API calls for the SaaS module.
|
|
132
132
|
*
|
|
133
|
-
* @since 0.
|
|
133
|
+
* @since 2.0.0
|
|
134
134
|
*/
|
|
135
135
|
declare class SaasService {
|
|
136
136
|
private restService;
|
|
@@ -218,6 +218,141 @@ declare class SaasService {
|
|
|
218
218
|
* @returns Promise with usage statistics data
|
|
219
219
|
*/
|
|
220
220
|
getUsageStatistics(): Promise<Saas.UsageStatisticsResponse>;
|
|
221
|
+
/**
|
|
222
|
+
* Get the latest tenants (for dashboard widget)
|
|
223
|
+
* @returns Promise with array of latest tenants
|
|
224
|
+
* @since 2.0.0
|
|
225
|
+
*/
|
|
226
|
+
getLatestTenants(): Promise<Saas.Tenant[]>;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* SaaS State Service
|
|
231
|
+
* Translated from @volo/abp.ng.saas v2.0.0
|
|
232
|
+
*
|
|
233
|
+
* Provides a stateful facade over SaaS operations,
|
|
234
|
+
* maintaining internal state that mirrors the Angular NGXS store pattern.
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* State service for SaaS operations.
|
|
239
|
+
* Provides dispatch methods that execute API operations and update internal state,
|
|
240
|
+
* mirroring the Angular NGXS store pattern.
|
|
241
|
+
*
|
|
242
|
+
* @since 2.0.0
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```tsx
|
|
246
|
+
* const stateService = new SaasStateService(restService);
|
|
247
|
+
*
|
|
248
|
+
* // Dispatch to fetch tenants
|
|
249
|
+
* await stateService.dispatchGetTenants({ maxResultCount: 10 });
|
|
250
|
+
*
|
|
251
|
+
* // Access the result
|
|
252
|
+
* const tenants = stateService.getTenants();
|
|
253
|
+
* const total = stateService.getTenantsTotalCount();
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare class SaasStateService {
|
|
257
|
+
private service;
|
|
258
|
+
private state;
|
|
259
|
+
constructor(rest: RestService);
|
|
260
|
+
/**
|
|
261
|
+
* Get the current list of tenants from state
|
|
262
|
+
*/
|
|
263
|
+
getTenants(): Saas.Tenant[];
|
|
264
|
+
/**
|
|
265
|
+
* Get the latest tenants from state (for dashboard widget)
|
|
266
|
+
* @since 2.0.0
|
|
267
|
+
*/
|
|
268
|
+
getLatestTenants(): Saas.Tenant[];
|
|
269
|
+
/**
|
|
270
|
+
* Get the total count of tenants from state
|
|
271
|
+
*/
|
|
272
|
+
getTenantsTotalCount(): number;
|
|
273
|
+
/**
|
|
274
|
+
* Get the current list of editions from state
|
|
275
|
+
*/
|
|
276
|
+
getEditions(): Saas.Edition[];
|
|
277
|
+
/**
|
|
278
|
+
* Get the total count of editions from state
|
|
279
|
+
*/
|
|
280
|
+
getEditionsTotalCount(): number;
|
|
281
|
+
/**
|
|
282
|
+
* Get the usage statistics from state
|
|
283
|
+
*/
|
|
284
|
+
getUsageStatistics(): Record<string, number>;
|
|
285
|
+
/**
|
|
286
|
+
* Dispatch action to fetch tenants with optional pagination
|
|
287
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
288
|
+
* @returns Promise with the tenants response
|
|
289
|
+
*/
|
|
290
|
+
dispatchGetTenants(params?: Saas.TenantsQueryParams): Promise<Saas.TenantsResponse>;
|
|
291
|
+
/**
|
|
292
|
+
* Dispatch action to fetch a tenant by ID
|
|
293
|
+
* @param id - The tenant ID
|
|
294
|
+
* @returns Promise with the tenant
|
|
295
|
+
*/
|
|
296
|
+
dispatchGetTenantById(id: string): Promise<Saas.Tenant>;
|
|
297
|
+
/**
|
|
298
|
+
* Dispatch action to create a new tenant
|
|
299
|
+
* @param body - The tenant creation request
|
|
300
|
+
* @returns Promise with the created tenant
|
|
301
|
+
*/
|
|
302
|
+
dispatchCreateTenant(body: Saas.CreateTenantRequest): Promise<Saas.Tenant>;
|
|
303
|
+
/**
|
|
304
|
+
* Dispatch action to update a tenant
|
|
305
|
+
* @param body - The tenant update request
|
|
306
|
+
* @returns Promise with the updated tenant
|
|
307
|
+
*/
|
|
308
|
+
dispatchUpdateTenant(body: Saas.UpdateTenantRequest): Promise<Saas.Tenant>;
|
|
309
|
+
/**
|
|
310
|
+
* Dispatch action to delete a tenant
|
|
311
|
+
* @param id - The tenant ID to delete
|
|
312
|
+
* @returns Promise resolving when complete
|
|
313
|
+
*/
|
|
314
|
+
dispatchDeleteTenant(id: string): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Dispatch action to fetch the latest tenants (for dashboard widget)
|
|
317
|
+
* @returns Promise with the latest tenants
|
|
318
|
+
* @since 2.0.0
|
|
319
|
+
*/
|
|
320
|
+
dispatchGetLatestTenants(): Promise<Saas.Tenant[]>;
|
|
321
|
+
/**
|
|
322
|
+
* Dispatch action to fetch editions with optional pagination
|
|
323
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
324
|
+
* @returns Promise with the editions response
|
|
325
|
+
*/
|
|
326
|
+
dispatchGetEditions(params?: Saas.EditionsQueryParams): Promise<Saas.EditionsResponse>;
|
|
327
|
+
/**
|
|
328
|
+
* Dispatch action to fetch an edition by ID
|
|
329
|
+
* @param id - The edition ID
|
|
330
|
+
* @returns Promise with the edition
|
|
331
|
+
*/
|
|
332
|
+
dispatchGetEditionById(id: string): Promise<Saas.Edition>;
|
|
333
|
+
/**
|
|
334
|
+
* Dispatch action to create a new edition
|
|
335
|
+
* @param body - The edition creation request
|
|
336
|
+
* @returns Promise with the created edition
|
|
337
|
+
*/
|
|
338
|
+
dispatchCreateEdition(body: Saas.CreateEditionRequest): Promise<Saas.Edition>;
|
|
339
|
+
/**
|
|
340
|
+
* Dispatch action to update an edition
|
|
341
|
+
* @param body - The edition update request
|
|
342
|
+
* @returns Promise with the updated edition
|
|
343
|
+
*/
|
|
344
|
+
dispatchUpdateEdition(body: Saas.UpdateEditionRequest): Promise<Saas.Edition>;
|
|
345
|
+
/**
|
|
346
|
+
* Dispatch action to delete an edition
|
|
347
|
+
* @param id - The edition ID to delete
|
|
348
|
+
* @returns Promise resolving when complete
|
|
349
|
+
*/
|
|
350
|
+
dispatchDeleteEdition(id: string): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Dispatch action to fetch usage statistics
|
|
353
|
+
* @returns Promise with the usage statistics response
|
|
354
|
+
*/
|
|
355
|
+
dispatchGetUsageStatistics(): Promise<Saas.UsageStatisticsResponse>;
|
|
221
356
|
}
|
|
222
357
|
|
|
223
358
|
/**
|
|
@@ -467,4 +602,4 @@ interface EditionsComponentProps {
|
|
|
467
602
|
*/
|
|
468
603
|
declare function EditionsComponent({ onEditionCreated, onEditionUpdated, onEditionDeleted, onManageFeatures, }: EditionsComponentProps): react_jsx_runtime.JSX.Element;
|
|
469
604
|
|
|
470
|
-
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, useEditions, useTenants };
|
|
605
|
+
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, SaasStateService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, useEditions, useTenants };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* SaaS Models
|
|
6
|
-
* Translated from @volo/abp.ng.saas
|
|
6
|
+
* Translated from @volo/abp.ng.saas v2.0.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -120,7 +120,7 @@ declare const SAAS_ROUTES: {
|
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* SaaS Service
|
|
123
|
-
* Translated from @volo/abp.ng.saas
|
|
123
|
+
* Translated from @volo/abp.ng.saas v2.0.0
|
|
124
124
|
*
|
|
125
125
|
* Provides REST API methods for managing tenants, editions,
|
|
126
126
|
* and connection strings in a multi-tenant SaaS application.
|
|
@@ -130,7 +130,7 @@ declare const SAAS_ROUTES: {
|
|
|
130
130
|
* Service for SaaS operations including tenant and edition management.
|
|
131
131
|
* This service wraps all REST API calls for the SaaS module.
|
|
132
132
|
*
|
|
133
|
-
* @since 0.
|
|
133
|
+
* @since 2.0.0
|
|
134
134
|
*/
|
|
135
135
|
declare class SaasService {
|
|
136
136
|
private restService;
|
|
@@ -218,6 +218,141 @@ declare class SaasService {
|
|
|
218
218
|
* @returns Promise with usage statistics data
|
|
219
219
|
*/
|
|
220
220
|
getUsageStatistics(): Promise<Saas.UsageStatisticsResponse>;
|
|
221
|
+
/**
|
|
222
|
+
* Get the latest tenants (for dashboard widget)
|
|
223
|
+
* @returns Promise with array of latest tenants
|
|
224
|
+
* @since 2.0.0
|
|
225
|
+
*/
|
|
226
|
+
getLatestTenants(): Promise<Saas.Tenant[]>;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* SaaS State Service
|
|
231
|
+
* Translated from @volo/abp.ng.saas v2.0.0
|
|
232
|
+
*
|
|
233
|
+
* Provides a stateful facade over SaaS operations,
|
|
234
|
+
* maintaining internal state that mirrors the Angular NGXS store pattern.
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* State service for SaaS operations.
|
|
239
|
+
* Provides dispatch methods that execute API operations and update internal state,
|
|
240
|
+
* mirroring the Angular NGXS store pattern.
|
|
241
|
+
*
|
|
242
|
+
* @since 2.0.0
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```tsx
|
|
246
|
+
* const stateService = new SaasStateService(restService);
|
|
247
|
+
*
|
|
248
|
+
* // Dispatch to fetch tenants
|
|
249
|
+
* await stateService.dispatchGetTenants({ maxResultCount: 10 });
|
|
250
|
+
*
|
|
251
|
+
* // Access the result
|
|
252
|
+
* const tenants = stateService.getTenants();
|
|
253
|
+
* const total = stateService.getTenantsTotalCount();
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare class SaasStateService {
|
|
257
|
+
private service;
|
|
258
|
+
private state;
|
|
259
|
+
constructor(rest: RestService);
|
|
260
|
+
/**
|
|
261
|
+
* Get the current list of tenants from state
|
|
262
|
+
*/
|
|
263
|
+
getTenants(): Saas.Tenant[];
|
|
264
|
+
/**
|
|
265
|
+
* Get the latest tenants from state (for dashboard widget)
|
|
266
|
+
* @since 2.0.0
|
|
267
|
+
*/
|
|
268
|
+
getLatestTenants(): Saas.Tenant[];
|
|
269
|
+
/**
|
|
270
|
+
* Get the total count of tenants from state
|
|
271
|
+
*/
|
|
272
|
+
getTenantsTotalCount(): number;
|
|
273
|
+
/**
|
|
274
|
+
* Get the current list of editions from state
|
|
275
|
+
*/
|
|
276
|
+
getEditions(): Saas.Edition[];
|
|
277
|
+
/**
|
|
278
|
+
* Get the total count of editions from state
|
|
279
|
+
*/
|
|
280
|
+
getEditionsTotalCount(): number;
|
|
281
|
+
/**
|
|
282
|
+
* Get the usage statistics from state
|
|
283
|
+
*/
|
|
284
|
+
getUsageStatistics(): Record<string, number>;
|
|
285
|
+
/**
|
|
286
|
+
* Dispatch action to fetch tenants with optional pagination
|
|
287
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
288
|
+
* @returns Promise with the tenants response
|
|
289
|
+
*/
|
|
290
|
+
dispatchGetTenants(params?: Saas.TenantsQueryParams): Promise<Saas.TenantsResponse>;
|
|
291
|
+
/**
|
|
292
|
+
* Dispatch action to fetch a tenant by ID
|
|
293
|
+
* @param id - The tenant ID
|
|
294
|
+
* @returns Promise with the tenant
|
|
295
|
+
*/
|
|
296
|
+
dispatchGetTenantById(id: string): Promise<Saas.Tenant>;
|
|
297
|
+
/**
|
|
298
|
+
* Dispatch action to create a new tenant
|
|
299
|
+
* @param body - The tenant creation request
|
|
300
|
+
* @returns Promise with the created tenant
|
|
301
|
+
*/
|
|
302
|
+
dispatchCreateTenant(body: Saas.CreateTenantRequest): Promise<Saas.Tenant>;
|
|
303
|
+
/**
|
|
304
|
+
* Dispatch action to update a tenant
|
|
305
|
+
* @param body - The tenant update request
|
|
306
|
+
* @returns Promise with the updated tenant
|
|
307
|
+
*/
|
|
308
|
+
dispatchUpdateTenant(body: Saas.UpdateTenantRequest): Promise<Saas.Tenant>;
|
|
309
|
+
/**
|
|
310
|
+
* Dispatch action to delete a tenant
|
|
311
|
+
* @param id - The tenant ID to delete
|
|
312
|
+
* @returns Promise resolving when complete
|
|
313
|
+
*/
|
|
314
|
+
dispatchDeleteTenant(id: string): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Dispatch action to fetch the latest tenants (for dashboard widget)
|
|
317
|
+
* @returns Promise with the latest tenants
|
|
318
|
+
* @since 2.0.0
|
|
319
|
+
*/
|
|
320
|
+
dispatchGetLatestTenants(): Promise<Saas.Tenant[]>;
|
|
321
|
+
/**
|
|
322
|
+
* Dispatch action to fetch editions with optional pagination
|
|
323
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
324
|
+
* @returns Promise with the editions response
|
|
325
|
+
*/
|
|
326
|
+
dispatchGetEditions(params?: Saas.EditionsQueryParams): Promise<Saas.EditionsResponse>;
|
|
327
|
+
/**
|
|
328
|
+
* Dispatch action to fetch an edition by ID
|
|
329
|
+
* @param id - The edition ID
|
|
330
|
+
* @returns Promise with the edition
|
|
331
|
+
*/
|
|
332
|
+
dispatchGetEditionById(id: string): Promise<Saas.Edition>;
|
|
333
|
+
/**
|
|
334
|
+
* Dispatch action to create a new edition
|
|
335
|
+
* @param body - The edition creation request
|
|
336
|
+
* @returns Promise with the created edition
|
|
337
|
+
*/
|
|
338
|
+
dispatchCreateEdition(body: Saas.CreateEditionRequest): Promise<Saas.Edition>;
|
|
339
|
+
/**
|
|
340
|
+
* Dispatch action to update an edition
|
|
341
|
+
* @param body - The edition update request
|
|
342
|
+
* @returns Promise with the updated edition
|
|
343
|
+
*/
|
|
344
|
+
dispatchUpdateEdition(body: Saas.UpdateEditionRequest): Promise<Saas.Edition>;
|
|
345
|
+
/**
|
|
346
|
+
* Dispatch action to delete an edition
|
|
347
|
+
* @param id - The edition ID to delete
|
|
348
|
+
* @returns Promise resolving when complete
|
|
349
|
+
*/
|
|
350
|
+
dispatchDeleteEdition(id: string): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Dispatch action to fetch usage statistics
|
|
353
|
+
* @returns Promise with the usage statistics response
|
|
354
|
+
*/
|
|
355
|
+
dispatchGetUsageStatistics(): Promise<Saas.UsageStatisticsResponse>;
|
|
221
356
|
}
|
|
222
357
|
|
|
223
358
|
/**
|
|
@@ -467,4 +602,4 @@ interface EditionsComponentProps {
|
|
|
467
602
|
*/
|
|
468
603
|
declare function EditionsComponent({ onEditionCreated, onEditionUpdated, onEditionDeleted, onManageFeatures, }: EditionsComponentProps): react_jsx_runtime.JSX.Element;
|
|
469
604
|
|
|
470
|
-
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, useEditions, useTenants };
|
|
605
|
+
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, SaasStateService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, useEditions, useTenants };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
EditionsComponent: () => EditionsComponent,
|
|
24
24
|
SAAS_ROUTES: () => SAAS_ROUTES,
|
|
25
25
|
SaasService: () => SaasService,
|
|
26
|
+
SaasStateService: () => SaasStateService,
|
|
26
27
|
TenantsComponent: () => TenantsComponent,
|
|
27
28
|
useEditions: () => useEditions,
|
|
28
29
|
useTenants: () => useTenants
|
|
@@ -227,6 +228,206 @@ var SaasService = class {
|
|
|
227
228
|
url: "/api/saas/editions/statistics/usage-statistic"
|
|
228
229
|
});
|
|
229
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Get the latest tenants (for dashboard widget)
|
|
233
|
+
* @returns Promise with array of latest tenants
|
|
234
|
+
* @since 2.0.0
|
|
235
|
+
*/
|
|
236
|
+
async getLatestTenants() {
|
|
237
|
+
return this.restService.request({
|
|
238
|
+
method: "GET",
|
|
239
|
+
url: "/api/saas/tenants/latest"
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// src/services/saas-state.service.ts
|
|
245
|
+
var SaasStateService = class {
|
|
246
|
+
constructor(rest) {
|
|
247
|
+
this.state = {
|
|
248
|
+
tenants: { items: [], totalCount: 0 },
|
|
249
|
+
editions: { items: [], totalCount: 0 },
|
|
250
|
+
usageStatistics: {},
|
|
251
|
+
latestTenants: []
|
|
252
|
+
};
|
|
253
|
+
this.service = new SaasService(rest);
|
|
254
|
+
}
|
|
255
|
+
// ========================
|
|
256
|
+
// Getter Methods
|
|
257
|
+
// ========================
|
|
258
|
+
/**
|
|
259
|
+
* Get the current list of tenants from state
|
|
260
|
+
*/
|
|
261
|
+
getTenants() {
|
|
262
|
+
return this.state.tenants?.items ?? [];
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get the latest tenants from state (for dashboard widget)
|
|
266
|
+
* @since 2.0.0
|
|
267
|
+
*/
|
|
268
|
+
getLatestTenants() {
|
|
269
|
+
return this.state.latestTenants ?? [];
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Get the total count of tenants from state
|
|
273
|
+
*/
|
|
274
|
+
getTenantsTotalCount() {
|
|
275
|
+
return this.state.tenants?.totalCount ?? 0;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Get the current list of editions from state
|
|
279
|
+
*/
|
|
280
|
+
getEditions() {
|
|
281
|
+
return this.state.editions?.items ?? [];
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Get the total count of editions from state
|
|
285
|
+
*/
|
|
286
|
+
getEditionsTotalCount() {
|
|
287
|
+
return this.state.editions?.totalCount ?? 0;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Get the usage statistics from state
|
|
291
|
+
*/
|
|
292
|
+
getUsageStatistics() {
|
|
293
|
+
return this.state.usageStatistics ?? {};
|
|
294
|
+
}
|
|
295
|
+
// ========================
|
|
296
|
+
// Tenant Dispatch Methods
|
|
297
|
+
// ========================
|
|
298
|
+
/**
|
|
299
|
+
* Dispatch action to fetch tenants with optional pagination
|
|
300
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
301
|
+
* @returns Promise with the tenants response
|
|
302
|
+
*/
|
|
303
|
+
async dispatchGetTenants(params = {}) {
|
|
304
|
+
const response = await this.service.getTenants(params);
|
|
305
|
+
this.state = {
|
|
306
|
+
...this.state,
|
|
307
|
+
tenants: response
|
|
308
|
+
};
|
|
309
|
+
return response;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Dispatch action to fetch a tenant by ID
|
|
313
|
+
* @param id - The tenant ID
|
|
314
|
+
* @returns Promise with the tenant
|
|
315
|
+
*/
|
|
316
|
+
async dispatchGetTenantById(id) {
|
|
317
|
+
const tenant = await this.service.getTenantById(id);
|
|
318
|
+
return tenant;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Dispatch action to create a new tenant
|
|
322
|
+
* @param body - The tenant creation request
|
|
323
|
+
* @returns Promise with the created tenant
|
|
324
|
+
*/
|
|
325
|
+
async dispatchCreateTenant(body) {
|
|
326
|
+
const result = await this.service.createTenant(body);
|
|
327
|
+
await this.dispatchGetTenants();
|
|
328
|
+
return result;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Dispatch action to update a tenant
|
|
332
|
+
* @param body - The tenant update request
|
|
333
|
+
* @returns Promise with the updated tenant
|
|
334
|
+
*/
|
|
335
|
+
async dispatchUpdateTenant(body) {
|
|
336
|
+
const result = await this.service.updateTenant(body);
|
|
337
|
+
await this.dispatchGetTenants();
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Dispatch action to delete a tenant
|
|
342
|
+
* @param id - The tenant ID to delete
|
|
343
|
+
* @returns Promise resolving when complete
|
|
344
|
+
*/
|
|
345
|
+
async dispatchDeleteTenant(id) {
|
|
346
|
+
await this.service.deleteTenant(id);
|
|
347
|
+
await this.dispatchGetTenants();
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Dispatch action to fetch the latest tenants (for dashboard widget)
|
|
351
|
+
* @returns Promise with the latest tenants
|
|
352
|
+
* @since 2.0.0
|
|
353
|
+
*/
|
|
354
|
+
async dispatchGetLatestTenants() {
|
|
355
|
+
const latestTenants = await this.service.getLatestTenants();
|
|
356
|
+
this.state = {
|
|
357
|
+
...this.state,
|
|
358
|
+
latestTenants
|
|
359
|
+
};
|
|
360
|
+
return latestTenants;
|
|
361
|
+
}
|
|
362
|
+
// ========================
|
|
363
|
+
// Edition Dispatch Methods
|
|
364
|
+
// ========================
|
|
365
|
+
/**
|
|
366
|
+
* Dispatch action to fetch editions with optional pagination
|
|
367
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
368
|
+
* @returns Promise with the editions response
|
|
369
|
+
*/
|
|
370
|
+
async dispatchGetEditions(params = {}) {
|
|
371
|
+
const response = await this.service.getEditions(params);
|
|
372
|
+
this.state = {
|
|
373
|
+
...this.state,
|
|
374
|
+
editions: response
|
|
375
|
+
};
|
|
376
|
+
return response;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Dispatch action to fetch an edition by ID
|
|
380
|
+
* @param id - The edition ID
|
|
381
|
+
* @returns Promise with the edition
|
|
382
|
+
*/
|
|
383
|
+
async dispatchGetEditionById(id) {
|
|
384
|
+
const edition = await this.service.getEditionById(id);
|
|
385
|
+
return edition;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Dispatch action to create a new edition
|
|
389
|
+
* @param body - The edition creation request
|
|
390
|
+
* @returns Promise with the created edition
|
|
391
|
+
*/
|
|
392
|
+
async dispatchCreateEdition(body) {
|
|
393
|
+
const result = await this.service.createEdition(body);
|
|
394
|
+
await this.dispatchGetEditions();
|
|
395
|
+
return result;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Dispatch action to update an edition
|
|
399
|
+
* @param body - The edition update request
|
|
400
|
+
* @returns Promise with the updated edition
|
|
401
|
+
*/
|
|
402
|
+
async dispatchUpdateEdition(body) {
|
|
403
|
+
const result = await this.service.updateEdition(body);
|
|
404
|
+
await this.dispatchGetEditions();
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Dispatch action to delete an edition
|
|
409
|
+
* @param id - The edition ID to delete
|
|
410
|
+
* @returns Promise resolving when complete
|
|
411
|
+
*/
|
|
412
|
+
async dispatchDeleteEdition(id) {
|
|
413
|
+
await this.service.deleteEdition(id);
|
|
414
|
+
await this.dispatchGetEditions();
|
|
415
|
+
}
|
|
416
|
+
// ========================
|
|
417
|
+
// Statistics Dispatch Methods
|
|
418
|
+
// ========================
|
|
419
|
+
/**
|
|
420
|
+
* Dispatch action to fetch usage statistics
|
|
421
|
+
* @returns Promise with the usage statistics response
|
|
422
|
+
*/
|
|
423
|
+
async dispatchGetUsageStatistics() {
|
|
424
|
+
const response = await this.service.getUsageStatistics();
|
|
425
|
+
this.state = {
|
|
426
|
+
...this.state,
|
|
427
|
+
usageStatistics: response.data
|
|
428
|
+
};
|
|
429
|
+
return response;
|
|
430
|
+
}
|
|
230
431
|
};
|
|
231
432
|
|
|
232
433
|
// src/hooks/useTenants.ts
|
|
@@ -1181,6 +1382,7 @@ function EditionsComponent({
|
|
|
1181
1382
|
EditionsComponent,
|
|
1182
1383
|
SAAS_ROUTES,
|
|
1183
1384
|
SaasService,
|
|
1385
|
+
SaasStateService,
|
|
1184
1386
|
TenantsComponent,
|
|
1185
1387
|
useEditions,
|
|
1186
1388
|
useTenants
|
package/dist/index.mjs
CHANGED
|
@@ -196,6 +196,206 @@ var SaasService = class {
|
|
|
196
196
|
url: "/api/saas/editions/statistics/usage-statistic"
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Get the latest tenants (for dashboard widget)
|
|
201
|
+
* @returns Promise with array of latest tenants
|
|
202
|
+
* @since 2.0.0
|
|
203
|
+
*/
|
|
204
|
+
async getLatestTenants() {
|
|
205
|
+
return this.restService.request({
|
|
206
|
+
method: "GET",
|
|
207
|
+
url: "/api/saas/tenants/latest"
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/services/saas-state.service.ts
|
|
213
|
+
var SaasStateService = class {
|
|
214
|
+
constructor(rest) {
|
|
215
|
+
this.state = {
|
|
216
|
+
tenants: { items: [], totalCount: 0 },
|
|
217
|
+
editions: { items: [], totalCount: 0 },
|
|
218
|
+
usageStatistics: {},
|
|
219
|
+
latestTenants: []
|
|
220
|
+
};
|
|
221
|
+
this.service = new SaasService(rest);
|
|
222
|
+
}
|
|
223
|
+
// ========================
|
|
224
|
+
// Getter Methods
|
|
225
|
+
// ========================
|
|
226
|
+
/**
|
|
227
|
+
* Get the current list of tenants from state
|
|
228
|
+
*/
|
|
229
|
+
getTenants() {
|
|
230
|
+
return this.state.tenants?.items ?? [];
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Get the latest tenants from state (for dashboard widget)
|
|
234
|
+
* @since 2.0.0
|
|
235
|
+
*/
|
|
236
|
+
getLatestTenants() {
|
|
237
|
+
return this.state.latestTenants ?? [];
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get the total count of tenants from state
|
|
241
|
+
*/
|
|
242
|
+
getTenantsTotalCount() {
|
|
243
|
+
return this.state.tenants?.totalCount ?? 0;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get the current list of editions from state
|
|
247
|
+
*/
|
|
248
|
+
getEditions() {
|
|
249
|
+
return this.state.editions?.items ?? [];
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get the total count of editions from state
|
|
253
|
+
*/
|
|
254
|
+
getEditionsTotalCount() {
|
|
255
|
+
return this.state.editions?.totalCount ?? 0;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get the usage statistics from state
|
|
259
|
+
*/
|
|
260
|
+
getUsageStatistics() {
|
|
261
|
+
return this.state.usageStatistics ?? {};
|
|
262
|
+
}
|
|
263
|
+
// ========================
|
|
264
|
+
// Tenant Dispatch Methods
|
|
265
|
+
// ========================
|
|
266
|
+
/**
|
|
267
|
+
* Dispatch action to fetch tenants with optional pagination
|
|
268
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
269
|
+
* @returns Promise with the tenants response
|
|
270
|
+
*/
|
|
271
|
+
async dispatchGetTenants(params = {}) {
|
|
272
|
+
const response = await this.service.getTenants(params);
|
|
273
|
+
this.state = {
|
|
274
|
+
...this.state,
|
|
275
|
+
tenants: response
|
|
276
|
+
};
|
|
277
|
+
return response;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Dispatch action to fetch a tenant by ID
|
|
281
|
+
* @param id - The tenant ID
|
|
282
|
+
* @returns Promise with the tenant
|
|
283
|
+
*/
|
|
284
|
+
async dispatchGetTenantById(id) {
|
|
285
|
+
const tenant = await this.service.getTenantById(id);
|
|
286
|
+
return tenant;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Dispatch action to create a new tenant
|
|
290
|
+
* @param body - The tenant creation request
|
|
291
|
+
* @returns Promise with the created tenant
|
|
292
|
+
*/
|
|
293
|
+
async dispatchCreateTenant(body) {
|
|
294
|
+
const result = await this.service.createTenant(body);
|
|
295
|
+
await this.dispatchGetTenants();
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Dispatch action to update a tenant
|
|
300
|
+
* @param body - The tenant update request
|
|
301
|
+
* @returns Promise with the updated tenant
|
|
302
|
+
*/
|
|
303
|
+
async dispatchUpdateTenant(body) {
|
|
304
|
+
const result = await this.service.updateTenant(body);
|
|
305
|
+
await this.dispatchGetTenants();
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Dispatch action to delete a tenant
|
|
310
|
+
* @param id - The tenant ID to delete
|
|
311
|
+
* @returns Promise resolving when complete
|
|
312
|
+
*/
|
|
313
|
+
async dispatchDeleteTenant(id) {
|
|
314
|
+
await this.service.deleteTenant(id);
|
|
315
|
+
await this.dispatchGetTenants();
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Dispatch action to fetch the latest tenants (for dashboard widget)
|
|
319
|
+
* @returns Promise with the latest tenants
|
|
320
|
+
* @since 2.0.0
|
|
321
|
+
*/
|
|
322
|
+
async dispatchGetLatestTenants() {
|
|
323
|
+
const latestTenants = await this.service.getLatestTenants();
|
|
324
|
+
this.state = {
|
|
325
|
+
...this.state,
|
|
326
|
+
latestTenants
|
|
327
|
+
};
|
|
328
|
+
return latestTenants;
|
|
329
|
+
}
|
|
330
|
+
// ========================
|
|
331
|
+
// Edition Dispatch Methods
|
|
332
|
+
// ========================
|
|
333
|
+
/**
|
|
334
|
+
* Dispatch action to fetch editions with optional pagination
|
|
335
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
336
|
+
* @returns Promise with the editions response
|
|
337
|
+
*/
|
|
338
|
+
async dispatchGetEditions(params = {}) {
|
|
339
|
+
const response = await this.service.getEditions(params);
|
|
340
|
+
this.state = {
|
|
341
|
+
...this.state,
|
|
342
|
+
editions: response
|
|
343
|
+
};
|
|
344
|
+
return response;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Dispatch action to fetch an edition by ID
|
|
348
|
+
* @param id - The edition ID
|
|
349
|
+
* @returns Promise with the edition
|
|
350
|
+
*/
|
|
351
|
+
async dispatchGetEditionById(id) {
|
|
352
|
+
const edition = await this.service.getEditionById(id);
|
|
353
|
+
return edition;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Dispatch action to create a new edition
|
|
357
|
+
* @param body - The edition creation request
|
|
358
|
+
* @returns Promise with the created edition
|
|
359
|
+
*/
|
|
360
|
+
async dispatchCreateEdition(body) {
|
|
361
|
+
const result = await this.service.createEdition(body);
|
|
362
|
+
await this.dispatchGetEditions();
|
|
363
|
+
return result;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Dispatch action to update an edition
|
|
367
|
+
* @param body - The edition update request
|
|
368
|
+
* @returns Promise with the updated edition
|
|
369
|
+
*/
|
|
370
|
+
async dispatchUpdateEdition(body) {
|
|
371
|
+
const result = await this.service.updateEdition(body);
|
|
372
|
+
await this.dispatchGetEditions();
|
|
373
|
+
return result;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Dispatch action to delete an edition
|
|
377
|
+
* @param id - The edition ID to delete
|
|
378
|
+
* @returns Promise resolving when complete
|
|
379
|
+
*/
|
|
380
|
+
async dispatchDeleteEdition(id) {
|
|
381
|
+
await this.service.deleteEdition(id);
|
|
382
|
+
await this.dispatchGetEditions();
|
|
383
|
+
}
|
|
384
|
+
// ========================
|
|
385
|
+
// Statistics Dispatch Methods
|
|
386
|
+
// ========================
|
|
387
|
+
/**
|
|
388
|
+
* Dispatch action to fetch usage statistics
|
|
389
|
+
* @returns Promise with the usage statistics response
|
|
390
|
+
*/
|
|
391
|
+
async dispatchGetUsageStatistics() {
|
|
392
|
+
const response = await this.service.getUsageStatistics();
|
|
393
|
+
this.state = {
|
|
394
|
+
...this.state,
|
|
395
|
+
usageStatistics: response.data
|
|
396
|
+
};
|
|
397
|
+
return response;
|
|
398
|
+
}
|
|
199
399
|
};
|
|
200
400
|
|
|
201
401
|
// src/hooks/useTenants.ts
|
|
@@ -1166,6 +1366,7 @@ export {
|
|
|
1166
1366
|
EditionsComponent,
|
|
1167
1367
|
SAAS_ROUTES,
|
|
1168
1368
|
SaasService,
|
|
1369
|
+
SaasStateService,
|
|
1169
1370
|
TenantsComponent,
|
|
1170
1371
|
useEditions,
|
|
1171
1372
|
useTenants
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/saas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "ABP Framework SaaS components for React - translated from @volo/abp.ng.saas",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@chakra-ui/react": "^3.2.0",
|
|
29
29
|
"@emotion/react": "^11.11.0",
|
|
30
|
-
"@abpjs/
|
|
31
|
-
"@abpjs/
|
|
32
|
-
"@abpjs/feature-management": "
|
|
30
|
+
"@abpjs/core": "2.0.0",
|
|
31
|
+
"@abpjs/theme-shared": "2.0.0",
|
|
32
|
+
"@abpjs/feature-management": "2.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@volo/abp.ng.saas": "0.
|
|
35
|
+
"@volo/abp.ng.saas": "2.0.0",
|
|
36
36
|
"@testing-library/jest-dom": "^6.9.1",
|
|
37
37
|
"@testing-library/react": "^14.0.0",
|
|
38
38
|
"@testing-library/user-event": "^14.6.1",
|