@abpjs/saas 0.7.2
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/LICENSE +165 -0
- package/README.md +374 -0
- package/dist/index.d.mts +470 -0
- package/dist/index.d.ts +470 -0
- package/dist/index.js +1187 -0
- package/dist/index.mjs +1172 -0
- package/package.json +90 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
import { ABP, RestService } from '@abpjs/core';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SaaS Models
|
|
6
|
+
* Translated from @volo/abp.ng.saas v0.7.2
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Saas namespace containing all models for SaaS management
|
|
11
|
+
*/
|
|
12
|
+
declare namespace Saas {
|
|
13
|
+
/**
|
|
14
|
+
* State interface for SaaS
|
|
15
|
+
*/
|
|
16
|
+
interface State {
|
|
17
|
+
tenants: ABP.PagedResponse<Tenant>;
|
|
18
|
+
editions: ABP.PagedResponse<Edition>;
|
|
19
|
+
usageStatistics: Record<string, number>;
|
|
20
|
+
latestTenants: Tenant[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Tenant interface
|
|
24
|
+
*/
|
|
25
|
+
interface Tenant {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
editionId?: string;
|
|
29
|
+
editionName?: string;
|
|
30
|
+
concurrencyStamp?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Edition interface
|
|
34
|
+
*/
|
|
35
|
+
interface Edition {
|
|
36
|
+
id: string;
|
|
37
|
+
displayName: string;
|
|
38
|
+
concurrencyStamp?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Query parameters for fetching tenants
|
|
42
|
+
*/
|
|
43
|
+
interface TenantsQueryParams extends ABP.PageQueryParams {
|
|
44
|
+
filter?: string;
|
|
45
|
+
editionId?: string;
|
|
46
|
+
getEditionNames?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Query parameters for fetching editions
|
|
50
|
+
*/
|
|
51
|
+
interface EditionsQueryParams extends ABP.PageQueryParams {
|
|
52
|
+
filter?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create tenant request
|
|
56
|
+
*/
|
|
57
|
+
interface CreateTenantRequest {
|
|
58
|
+
name: string;
|
|
59
|
+
editionId?: string;
|
|
60
|
+
adminEmailAddress?: string;
|
|
61
|
+
adminPassword?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Update tenant request
|
|
65
|
+
*/
|
|
66
|
+
interface UpdateTenantRequest {
|
|
67
|
+
id?: string;
|
|
68
|
+
name: string;
|
|
69
|
+
editionId?: string;
|
|
70
|
+
concurrencyStamp?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create edition request
|
|
74
|
+
*/
|
|
75
|
+
interface CreateEditionRequest {
|
|
76
|
+
displayName: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Update edition request
|
|
80
|
+
*/
|
|
81
|
+
interface UpdateEditionRequest {
|
|
82
|
+
id?: string;
|
|
83
|
+
displayName: string;
|
|
84
|
+
concurrencyStamp?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Default connection string request
|
|
88
|
+
*/
|
|
89
|
+
interface DefaultConnectionStringRequest {
|
|
90
|
+
id: string;
|
|
91
|
+
defaultConnectionString: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Paginated response for tenants
|
|
95
|
+
*/
|
|
96
|
+
type TenantsResponse = ABP.PagedResponse<Tenant>;
|
|
97
|
+
/**
|
|
98
|
+
* Paginated response for editions
|
|
99
|
+
*/
|
|
100
|
+
type EditionsResponse = ABP.PagedResponse<Edition>;
|
|
101
|
+
/**
|
|
102
|
+
* Usage statistics response
|
|
103
|
+
*/
|
|
104
|
+
interface UsageStatisticsResponse {
|
|
105
|
+
data: Record<string, number>;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* SaaS Routes
|
|
111
|
+
* Translated from @volo/abp.ng.saas v0.7.2
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Default routes for SaaS module
|
|
116
|
+
*/
|
|
117
|
+
declare const SAAS_ROUTES: {
|
|
118
|
+
routes: ABP.FullRoute[];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* SaaS Service
|
|
123
|
+
* Translated from @volo/abp.ng.saas v0.7.2
|
|
124
|
+
*
|
|
125
|
+
* Provides REST API methods for managing tenants, editions,
|
|
126
|
+
* and connection strings in a multi-tenant SaaS application.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Service for SaaS operations including tenant and edition management.
|
|
131
|
+
* This service wraps all REST API calls for the SaaS module.
|
|
132
|
+
*
|
|
133
|
+
* @since 0.7.2
|
|
134
|
+
*/
|
|
135
|
+
declare class SaasService {
|
|
136
|
+
private restService;
|
|
137
|
+
constructor(restService: RestService);
|
|
138
|
+
/**
|
|
139
|
+
* Get paginated list of tenants
|
|
140
|
+
* @param params Query parameters for filtering and pagination
|
|
141
|
+
* @returns Promise with paginated tenant response
|
|
142
|
+
*/
|
|
143
|
+
getTenants(params?: Saas.TenantsQueryParams): Promise<Saas.TenantsResponse>;
|
|
144
|
+
/**
|
|
145
|
+
* Get a tenant by ID
|
|
146
|
+
* @param id Tenant ID
|
|
147
|
+
* @returns Promise with tenant data
|
|
148
|
+
*/
|
|
149
|
+
getTenantById(id: string): Promise<Saas.Tenant>;
|
|
150
|
+
/**
|
|
151
|
+
* Create a new tenant
|
|
152
|
+
* @param body Tenant creation request
|
|
153
|
+
* @returns Promise with created tenant data
|
|
154
|
+
*/
|
|
155
|
+
createTenant(body: Saas.CreateTenantRequest): Promise<Saas.Tenant>;
|
|
156
|
+
/**
|
|
157
|
+
* Update an existing tenant
|
|
158
|
+
* @param body Tenant update request (must include id)
|
|
159
|
+
* @returns Promise with updated tenant data
|
|
160
|
+
*/
|
|
161
|
+
updateTenant(body: Saas.UpdateTenantRequest): Promise<Saas.Tenant>;
|
|
162
|
+
/**
|
|
163
|
+
* Delete a tenant by ID
|
|
164
|
+
* @param id Tenant ID to delete
|
|
165
|
+
* @returns Promise that resolves when deletion is complete
|
|
166
|
+
*/
|
|
167
|
+
deleteTenant(id: string): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Get the default connection string for a tenant
|
|
170
|
+
* @param id Tenant ID
|
|
171
|
+
* @returns Promise with connection string (empty string if using shared database)
|
|
172
|
+
*/
|
|
173
|
+
getDefaultConnectionString(id: string): Promise<string>;
|
|
174
|
+
/**
|
|
175
|
+
* Update the default connection string for a tenant
|
|
176
|
+
* @param payload Object containing tenant ID and connection string
|
|
177
|
+
* @returns Promise that resolves when update is complete
|
|
178
|
+
*/
|
|
179
|
+
updateDefaultConnectionString(payload: Saas.DefaultConnectionStringRequest): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Delete the default connection string for a tenant (revert to shared database)
|
|
182
|
+
* @param id Tenant ID
|
|
183
|
+
* @returns Promise that resolves when deletion is complete
|
|
184
|
+
*/
|
|
185
|
+
deleteDefaultConnectionString(id: string): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Get paginated list of editions
|
|
188
|
+
* @param params Query parameters for filtering and pagination
|
|
189
|
+
* @returns Promise with paginated editions response
|
|
190
|
+
*/
|
|
191
|
+
getEditions(params?: Saas.EditionsQueryParams): Promise<Saas.EditionsResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* Get an edition by ID
|
|
194
|
+
* @param id Edition ID
|
|
195
|
+
* @returns Promise with edition data
|
|
196
|
+
*/
|
|
197
|
+
getEditionById(id: string): Promise<Saas.Edition>;
|
|
198
|
+
/**
|
|
199
|
+
* Create a new edition
|
|
200
|
+
* @param body Edition creation request
|
|
201
|
+
* @returns Promise with created edition data
|
|
202
|
+
*/
|
|
203
|
+
createEdition(body: Saas.CreateEditionRequest): Promise<Saas.Edition>;
|
|
204
|
+
/**
|
|
205
|
+
* Update an existing edition
|
|
206
|
+
* @param body Edition update request (must include id)
|
|
207
|
+
* @returns Promise with updated edition data
|
|
208
|
+
*/
|
|
209
|
+
updateEdition(body: Saas.UpdateEditionRequest): Promise<Saas.Edition>;
|
|
210
|
+
/**
|
|
211
|
+
* Delete an edition by ID
|
|
212
|
+
* @param id Edition ID to delete
|
|
213
|
+
* @returns Promise that resolves when deletion is complete
|
|
214
|
+
*/
|
|
215
|
+
deleteEdition(id: string): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Get usage statistics for editions
|
|
218
|
+
* @returns Promise with usage statistics data
|
|
219
|
+
*/
|
|
220
|
+
getUsageStatistics(): Promise<Saas.UsageStatisticsResponse>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* useTenants Hook
|
|
225
|
+
* Translated from @volo/abp.ng.saas v0.7.2
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Sort order type for tenant lists
|
|
230
|
+
*/
|
|
231
|
+
type SortOrder$1 = '' | 'asc' | 'desc';
|
|
232
|
+
/**
|
|
233
|
+
* Result from tenant operations
|
|
234
|
+
* @since 0.7.2
|
|
235
|
+
*/
|
|
236
|
+
interface TenantOperationResult<T = void> {
|
|
237
|
+
success: boolean;
|
|
238
|
+
data?: T;
|
|
239
|
+
error?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Return type for useTenants hook
|
|
243
|
+
* @since 0.7.2
|
|
244
|
+
*/
|
|
245
|
+
interface UseTenantsReturn {
|
|
246
|
+
/** List of tenants */
|
|
247
|
+
tenants: Saas.Tenant[];
|
|
248
|
+
/** Total count of tenants */
|
|
249
|
+
totalCount: number;
|
|
250
|
+
/** Currently selected tenant for editing */
|
|
251
|
+
selectedTenant: Saas.Tenant | null;
|
|
252
|
+
/** Loading state */
|
|
253
|
+
isLoading: boolean;
|
|
254
|
+
/** Error message if any */
|
|
255
|
+
error: string | null;
|
|
256
|
+
/** Current sort key */
|
|
257
|
+
sortKey: string;
|
|
258
|
+
/** Current sort order */
|
|
259
|
+
sortOrder: SortOrder$1;
|
|
260
|
+
/** Default connection string for selected tenant */
|
|
261
|
+
defaultConnectionString: string;
|
|
262
|
+
/** Whether the tenant uses shared database */
|
|
263
|
+
useSharedDatabase: boolean;
|
|
264
|
+
/** Fetch all tenants with optional pagination/filtering */
|
|
265
|
+
fetchTenants: (params?: Saas.TenantsQueryParams) => Promise<TenantOperationResult<Saas.TenantsResponse>>;
|
|
266
|
+
/** Get a tenant by ID and set it as selected */
|
|
267
|
+
getTenantById: (id: string) => Promise<TenantOperationResult<Saas.Tenant>>;
|
|
268
|
+
/** Create a new tenant */
|
|
269
|
+
createTenant: (tenant: Saas.CreateTenantRequest) => Promise<TenantOperationResult<Saas.Tenant>>;
|
|
270
|
+
/** Update an existing tenant */
|
|
271
|
+
updateTenant: (tenant: Saas.UpdateTenantRequest) => Promise<TenantOperationResult<Saas.Tenant>>;
|
|
272
|
+
/** Delete a tenant */
|
|
273
|
+
deleteTenant: (id: string) => Promise<TenantOperationResult>;
|
|
274
|
+
/** Get the default connection string for a tenant */
|
|
275
|
+
getDefaultConnectionString: (id: string) => Promise<TenantOperationResult<string>>;
|
|
276
|
+
/** Update the default connection string */
|
|
277
|
+
updateDefaultConnectionString: (payload: Saas.DefaultConnectionStringRequest) => Promise<TenantOperationResult>;
|
|
278
|
+
/** Delete the default connection string (use shared database) */
|
|
279
|
+
deleteDefaultConnectionString: (id: string) => Promise<TenantOperationResult>;
|
|
280
|
+
/** Set the selected tenant */
|
|
281
|
+
setSelectedTenant: (tenant: Saas.Tenant | null) => void;
|
|
282
|
+
/** Set sort key */
|
|
283
|
+
setSortKey: (key: string) => void;
|
|
284
|
+
/** Set sort order */
|
|
285
|
+
setSortOrder: (order: SortOrder$1) => void;
|
|
286
|
+
/** Reset state */
|
|
287
|
+
reset: () => void;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Hook for managing tenants
|
|
291
|
+
*
|
|
292
|
+
* This hook provides all the state and actions needed for tenant management
|
|
293
|
+
* including CRUD operations and connection string management.
|
|
294
|
+
*
|
|
295
|
+
* @since 0.7.2
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```tsx
|
|
299
|
+
* function TenantsPage() {
|
|
300
|
+
* const {
|
|
301
|
+
* tenants,
|
|
302
|
+
* isLoading,
|
|
303
|
+
* fetchTenants,
|
|
304
|
+
* createTenant,
|
|
305
|
+
* deleteTenant,
|
|
306
|
+
* } = useTenants();
|
|
307
|
+
*
|
|
308
|
+
* useEffect(() => {
|
|
309
|
+
* fetchTenants();
|
|
310
|
+
* }, [fetchTenants]);
|
|
311
|
+
*
|
|
312
|
+
* return (
|
|
313
|
+
* <div>
|
|
314
|
+
* {tenants.map(tenant => (
|
|
315
|
+
* <div key={tenant.id}>{tenant.name}</div>
|
|
316
|
+
* ))}
|
|
317
|
+
* </div>
|
|
318
|
+
* );
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
declare function useTenants(): UseTenantsReturn;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* useEditions Hook
|
|
326
|
+
* Translated from @volo/abp.ng.saas v0.7.2
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Sort order type for edition lists
|
|
331
|
+
*/
|
|
332
|
+
type SortOrder = '' | 'asc' | 'desc';
|
|
333
|
+
/**
|
|
334
|
+
* Result from edition operations
|
|
335
|
+
* @since 0.7.2
|
|
336
|
+
*/
|
|
337
|
+
interface EditionOperationResult<T = void> {
|
|
338
|
+
success: boolean;
|
|
339
|
+
data?: T;
|
|
340
|
+
error?: string;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Return type for useEditions hook
|
|
344
|
+
* @since 0.7.2
|
|
345
|
+
*/
|
|
346
|
+
interface UseEditionsReturn {
|
|
347
|
+
/** List of editions */
|
|
348
|
+
editions: Saas.Edition[];
|
|
349
|
+
/** Total count of editions */
|
|
350
|
+
totalCount: number;
|
|
351
|
+
/** Currently selected edition for editing */
|
|
352
|
+
selectedEdition: Saas.Edition | null;
|
|
353
|
+
/** Loading state */
|
|
354
|
+
isLoading: boolean;
|
|
355
|
+
/** Error message if any */
|
|
356
|
+
error: string | null;
|
|
357
|
+
/** Current sort key */
|
|
358
|
+
sortKey: string;
|
|
359
|
+
/** Current sort order */
|
|
360
|
+
sortOrder: SortOrder;
|
|
361
|
+
/** Usage statistics for editions */
|
|
362
|
+
usageStatistics: Record<string, number>;
|
|
363
|
+
/** Fetch all editions with optional pagination/filtering */
|
|
364
|
+
fetchEditions: (params?: Saas.EditionsQueryParams) => Promise<EditionOperationResult<Saas.EditionsResponse>>;
|
|
365
|
+
/** Get an edition by ID and set it as selected */
|
|
366
|
+
getEditionById: (id: string) => Promise<EditionOperationResult<Saas.Edition>>;
|
|
367
|
+
/** Create a new edition */
|
|
368
|
+
createEdition: (edition: Saas.CreateEditionRequest) => Promise<EditionOperationResult<Saas.Edition>>;
|
|
369
|
+
/** Update an existing edition */
|
|
370
|
+
updateEdition: (edition: Saas.UpdateEditionRequest) => Promise<EditionOperationResult<Saas.Edition>>;
|
|
371
|
+
/** Delete an edition */
|
|
372
|
+
deleteEdition: (id: string) => Promise<EditionOperationResult>;
|
|
373
|
+
/** Fetch usage statistics for editions */
|
|
374
|
+
fetchUsageStatistics: () => Promise<EditionOperationResult<Record<string, number>>>;
|
|
375
|
+
/** Set the selected edition */
|
|
376
|
+
setSelectedEdition: (edition: Saas.Edition | null) => void;
|
|
377
|
+
/** Set sort key */
|
|
378
|
+
setSortKey: (key: string) => void;
|
|
379
|
+
/** Set sort order */
|
|
380
|
+
setSortOrder: (order: SortOrder) => void;
|
|
381
|
+
/** Reset state */
|
|
382
|
+
reset: () => void;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Hook for managing editions
|
|
386
|
+
*
|
|
387
|
+
* This hook provides all the state and actions needed for edition management
|
|
388
|
+
* including CRUD operations and usage statistics.
|
|
389
|
+
*
|
|
390
|
+
* @since 0.7.2
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* ```tsx
|
|
394
|
+
* function EditionsPage() {
|
|
395
|
+
* const {
|
|
396
|
+
* editions,
|
|
397
|
+
* isLoading,
|
|
398
|
+
* fetchEditions,
|
|
399
|
+
* createEdition,
|
|
400
|
+
* deleteEdition,
|
|
401
|
+
* } = useEditions();
|
|
402
|
+
*
|
|
403
|
+
* useEffect(() => {
|
|
404
|
+
* fetchEditions();
|
|
405
|
+
* }, [fetchEditions]);
|
|
406
|
+
*
|
|
407
|
+
* return (
|
|
408
|
+
* <div>
|
|
409
|
+
* {editions.map(edition => (
|
|
410
|
+
* <div key={edition.id}>{edition.displayName}</div>
|
|
411
|
+
* ))}
|
|
412
|
+
* </div>
|
|
413
|
+
* );
|
|
414
|
+
* }
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
declare function useEditions(): UseEditionsReturn;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Props for TenantsComponent
|
|
421
|
+
* @since 0.7.2
|
|
422
|
+
*/
|
|
423
|
+
interface TenantsComponentProps {
|
|
424
|
+
/** Callback when a tenant is created */
|
|
425
|
+
onTenantCreated?: (tenant: Saas.Tenant) => void;
|
|
426
|
+
/** Callback when a tenant is updated */
|
|
427
|
+
onTenantUpdated?: (tenant: Saas.Tenant) => void;
|
|
428
|
+
/** Callback when a tenant is deleted */
|
|
429
|
+
onTenantDeleted?: (id: string) => void;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* TenantsComponent - Component for managing tenants
|
|
433
|
+
*
|
|
434
|
+
* Features:
|
|
435
|
+
* - List tenants with pagination
|
|
436
|
+
* - Create, edit, and delete tenants
|
|
437
|
+
* - Manage connection strings
|
|
438
|
+
* - Manage features per tenant
|
|
439
|
+
*
|
|
440
|
+
* @since 0.7.2
|
|
441
|
+
*/
|
|
442
|
+
declare function TenantsComponent({ onTenantCreated, onTenantUpdated, onTenantDeleted, }: TenantsComponentProps): react_jsx_runtime.JSX.Element;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Props for EditionsComponent
|
|
446
|
+
* @since 0.7.2
|
|
447
|
+
*/
|
|
448
|
+
interface EditionsComponentProps {
|
|
449
|
+
/** Callback when an edition is created */
|
|
450
|
+
onEditionCreated?: (edition: Saas.Edition) => void;
|
|
451
|
+
/** Callback when an edition is updated */
|
|
452
|
+
onEditionUpdated?: (edition: Saas.Edition) => void;
|
|
453
|
+
/** Callback when an edition is deleted */
|
|
454
|
+
onEditionDeleted?: (id: string) => void;
|
|
455
|
+
/** Callback when features button is clicked */
|
|
456
|
+
onManageFeatures?: (editionId: string) => void;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* EditionsComponent - Component for managing editions
|
|
460
|
+
*
|
|
461
|
+
* Features:
|
|
462
|
+
* - List editions with pagination
|
|
463
|
+
* - Create, edit, and delete editions
|
|
464
|
+
* - Manage features per edition
|
|
465
|
+
*
|
|
466
|
+
* @since 0.7.2
|
|
467
|
+
*/
|
|
468
|
+
declare function EditionsComponent({ onEditionCreated, onEditionUpdated, onEditionDeleted, onManageFeatures, }: EditionsComponentProps): react_jsx_runtime.JSX.Element;
|
|
469
|
+
|
|
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 };
|