@abpjs/tenant-management 3.0.0 → 3.2.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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for proxy models (v3.2.0)
3
+ * Tests the new typed DTOs for Tenant Management API
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for TenantService (v3.2.0)
3
+ * Tests the typed proxy service for Tenant Management API
4
+ */
5
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,7 +1,28 @@
1
1
  /**
2
2
  * @abpjs/tenant-management
3
3
  * ABP Framework Tenant Management module for React
4
- * Translated from @abp/ng.tenant-management v3.0.0
4
+ * Translated from @abp/ng.tenant-management v3.2.0
5
+ *
6
+ * Changes in v3.2.0:
7
+ * - Added proxy submodule with typed DTOs and TenantService
8
+ * - Added GetTenantsInput interface for tenant list queries
9
+ * - Added TenantCreateDto interface for creating tenants
10
+ * - Added TenantUpdateDto interface for updating tenants
11
+ * - Added TenantDto interface for tenant responses
12
+ * - Added TenantCreateOrUpdateDtoBase base interface
13
+ * - Added TenantService with typed CRUD operations (create, delete, get, getList, update)
14
+ * - Added TenantService.deleteDefaultConnectionString method
15
+ * - Added TenantService.getDefaultConnectionString method
16
+ * - Added TenantService.updateDefaultConnectionString method
17
+ * - Updated TenantManagement.State to use PagedResultDto<TenantDto> and TenantDto
18
+ * - Deprecated TenantManagement.Response (use PagedResultDto<TenantDto> instead)
19
+ * - Deprecated TenantManagement.Item (use TenantDto instead)
20
+ * - Deprecated TenantManagement.AddRequest (use TenantCreateDto instead)
21
+ * - Deprecated TenantManagement.UpdateRequest (use TenantUpdateDto instead)
22
+ * - Deprecated TenantManagement.DefaultConnectionStringRequest (use TenantService methods instead)
23
+ *
24
+ * Changes in v3.1.0:
25
+ * - Version bump only (dependency updates to @abp/ng.feature-management v3.1.0, @abp/ng.theme.shared v3.1.0)
5
26
  *
6
27
  * Changes in v3.0.0:
7
28
  * - Added config subpackage with route providers and policy names
@@ -51,6 +72,7 @@
51
72
  export * from './config';
52
73
  export * from './enums';
53
74
  export * from './models';
75
+ export * from './proxy';
54
76
  export * from './services';
55
77
  export * from './hooks';
56
78
  export * from './constants';
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ __export(index_exports, {
26
26
  TenantManagementModal: () => TenantManagementModal,
27
27
  TenantManagementService: () => TenantManagementService,
28
28
  TenantManagementStateService: () => TenantManagementStateService,
29
+ TenantService: () => TenantService,
29
30
  configureRoutes: () => configureRoutes,
30
31
  eTenantManagementComponents: () => eTenantManagementComponents,
31
32
  eTenantManagementPolicyNames: () => eTenantManagementPolicyNames,
@@ -104,6 +105,113 @@ var eTenantManagementComponents = {
104
105
  Tenants: "TenantManagement.TenantsComponent"
105
106
  };
106
107
 
108
+ // src/proxy/tenant.service.ts
109
+ var TenantService = class {
110
+ constructor(restService) {
111
+ /**
112
+ * The API name used for REST requests.
113
+ * Defaults to 'default' for the main API.
114
+ */
115
+ this.apiName = "default";
116
+ /**
117
+ * Create a new tenant.
118
+ * @param input - The tenant creation data including admin credentials
119
+ * @returns Promise resolving to the created tenant DTO
120
+ */
121
+ this.create = (input) => {
122
+ return this.restService.request({
123
+ method: "POST",
124
+ url: "/api/multi-tenancy/tenants",
125
+ body: input
126
+ });
127
+ };
128
+ /**
129
+ * Delete a tenant by ID.
130
+ * @param id - The tenant ID to delete
131
+ * @returns Promise resolving when deletion is complete
132
+ */
133
+ this.delete = (id) => {
134
+ return this.restService.request({
135
+ method: "DELETE",
136
+ url: `/api/multi-tenancy/tenants/${id}`
137
+ });
138
+ };
139
+ /**
140
+ * Delete the default connection string for a tenant.
141
+ * This will cause the tenant to use the shared/host database.
142
+ * @param id - The tenant ID
143
+ * @returns Promise resolving when deletion is complete
144
+ */
145
+ this.deleteDefaultConnectionString = (id) => {
146
+ return this.restService.request({
147
+ method: "DELETE",
148
+ url: `/api/multi-tenancy/tenants/${id}/default-connection-string`
149
+ });
150
+ };
151
+ /**
152
+ * Get a tenant by ID.
153
+ * @param id - The tenant ID
154
+ * @returns Promise resolving to the tenant DTO
155
+ */
156
+ this.get = (id) => {
157
+ return this.restService.request({
158
+ method: "GET",
159
+ url: `/api/multi-tenancy/tenants/${id}`
160
+ });
161
+ };
162
+ /**
163
+ * Get the default connection string for a tenant.
164
+ * @param id - The tenant ID
165
+ * @returns Promise resolving to the connection string (empty if using shared database)
166
+ */
167
+ this.getDefaultConnectionString = (id) => {
168
+ return this.restService.request({
169
+ method: "GET",
170
+ url: `/api/multi-tenancy/tenants/${id}/default-connection-string`
171
+ });
172
+ };
173
+ /**
174
+ * Get a paginated list of tenants.
175
+ * @param input - The query parameters including filter, pagination, and sorting
176
+ * @returns Promise resolving to a paged result of tenant DTOs
177
+ */
178
+ this.getList = (input) => {
179
+ return this.restService.request({
180
+ method: "GET",
181
+ url: "/api/multi-tenancy/tenants",
182
+ params: input
183
+ });
184
+ };
185
+ /**
186
+ * Update a tenant.
187
+ * @param id - The tenant ID to update
188
+ * @param input - The update data (currently only name can be updated)
189
+ * @returns Promise resolving to the updated tenant DTO
190
+ */
191
+ this.update = (id, input) => {
192
+ return this.restService.request({
193
+ method: "PUT",
194
+ url: `/api/multi-tenancy/tenants/${id}`,
195
+ body: input
196
+ });
197
+ };
198
+ /**
199
+ * Update the default connection string for a tenant.
200
+ * @param id - The tenant ID
201
+ * @param defaultConnectionString - The new connection string
202
+ * @returns Promise resolving when update is complete
203
+ */
204
+ this.updateDefaultConnectionString = (id, defaultConnectionString) => {
205
+ return this.restService.request({
206
+ method: "PUT",
207
+ url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
208
+ params: { defaultConnectionString }
209
+ });
210
+ };
211
+ this.restService = restService;
212
+ }
213
+ };
214
+
107
215
  // src/services/tenant-management.service.ts
108
216
  var TenantManagementService = class {
109
217
  constructor(rest) {
@@ -985,6 +1093,7 @@ TenantManagementModal.componentKey = eTenantManagementComponents.Tenants;
985
1093
  TenantManagementModal,
986
1094
  TenantManagementService,
987
1095
  TenantManagementStateService,
1096
+ TenantService,
988
1097
  configureRoutes,
989
1098
  eTenantManagementComponents,
990
1099
  eTenantManagementPolicyNames,
package/dist/index.mjs CHANGED
@@ -66,6 +66,113 @@ var eTenantManagementComponents = {
66
66
  Tenants: "TenantManagement.TenantsComponent"
67
67
  };
68
68
 
69
+ // src/proxy/tenant.service.ts
70
+ var TenantService = class {
71
+ constructor(restService) {
72
+ /**
73
+ * The API name used for REST requests.
74
+ * Defaults to 'default' for the main API.
75
+ */
76
+ this.apiName = "default";
77
+ /**
78
+ * Create a new tenant.
79
+ * @param input - The tenant creation data including admin credentials
80
+ * @returns Promise resolving to the created tenant DTO
81
+ */
82
+ this.create = (input) => {
83
+ return this.restService.request({
84
+ method: "POST",
85
+ url: "/api/multi-tenancy/tenants",
86
+ body: input
87
+ });
88
+ };
89
+ /**
90
+ * Delete a tenant by ID.
91
+ * @param id - The tenant ID to delete
92
+ * @returns Promise resolving when deletion is complete
93
+ */
94
+ this.delete = (id) => {
95
+ return this.restService.request({
96
+ method: "DELETE",
97
+ url: `/api/multi-tenancy/tenants/${id}`
98
+ });
99
+ };
100
+ /**
101
+ * Delete the default connection string for a tenant.
102
+ * This will cause the tenant to use the shared/host database.
103
+ * @param id - The tenant ID
104
+ * @returns Promise resolving when deletion is complete
105
+ */
106
+ this.deleteDefaultConnectionString = (id) => {
107
+ return this.restService.request({
108
+ method: "DELETE",
109
+ url: `/api/multi-tenancy/tenants/${id}/default-connection-string`
110
+ });
111
+ };
112
+ /**
113
+ * Get a tenant by ID.
114
+ * @param id - The tenant ID
115
+ * @returns Promise resolving to the tenant DTO
116
+ */
117
+ this.get = (id) => {
118
+ return this.restService.request({
119
+ method: "GET",
120
+ url: `/api/multi-tenancy/tenants/${id}`
121
+ });
122
+ };
123
+ /**
124
+ * Get the default connection string for a tenant.
125
+ * @param id - The tenant ID
126
+ * @returns Promise resolving to the connection string (empty if using shared database)
127
+ */
128
+ this.getDefaultConnectionString = (id) => {
129
+ return this.restService.request({
130
+ method: "GET",
131
+ url: `/api/multi-tenancy/tenants/${id}/default-connection-string`
132
+ });
133
+ };
134
+ /**
135
+ * Get a paginated list of tenants.
136
+ * @param input - The query parameters including filter, pagination, and sorting
137
+ * @returns Promise resolving to a paged result of tenant DTOs
138
+ */
139
+ this.getList = (input) => {
140
+ return this.restService.request({
141
+ method: "GET",
142
+ url: "/api/multi-tenancy/tenants",
143
+ params: input
144
+ });
145
+ };
146
+ /**
147
+ * Update a tenant.
148
+ * @param id - The tenant ID to update
149
+ * @param input - The update data (currently only name can be updated)
150
+ * @returns Promise resolving to the updated tenant DTO
151
+ */
152
+ this.update = (id, input) => {
153
+ return this.restService.request({
154
+ method: "PUT",
155
+ url: `/api/multi-tenancy/tenants/${id}`,
156
+ body: input
157
+ });
158
+ };
159
+ /**
160
+ * Update the default connection string for a tenant.
161
+ * @param id - The tenant ID
162
+ * @param defaultConnectionString - The new connection string
163
+ * @returns Promise resolving when update is complete
164
+ */
165
+ this.updateDefaultConnectionString = (id, defaultConnectionString) => {
166
+ return this.restService.request({
167
+ method: "PUT",
168
+ url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
169
+ params: { defaultConnectionString }
170
+ });
171
+ };
172
+ this.restService = restService;
173
+ }
174
+ };
175
+
69
176
  // src/services/tenant-management.service.ts
70
177
  var TenantManagementService = class {
71
178
  constructor(rest) {
@@ -952,6 +1059,7 @@ export {
952
1059
  TenantManagementModal,
953
1060
  TenantManagementService,
954
1061
  TenantManagementStateService,
1062
+ TenantService,
955
1063
  configureRoutes,
956
1064
  eTenantManagementComponents,
957
1065
  eTenantManagementPolicyNames,
@@ -1,25 +1,29 @@
1
1
  /**
2
2
  * Tenant Management module type definitions
3
- * Translated from @abp/ng.tenant-management v2.4.0
3
+ * Translated from @abp/ng.tenant-management v3.2.0
4
4
  */
5
- import type { ABP } from '@abpjs/core';
5
+ import type { ABP, PagedResultDto } from '@abpjs/core';
6
+ import type { TenantDto } from '../proxy/models';
6
7
  /**
7
8
  * TenantManagement namespace containing all tenant-related types
8
9
  */
9
10
  export declare namespace TenantManagement {
10
11
  /**
11
12
  * State interface for tenant management store
13
+ * @since 3.2.0 - Uses PagedResultDto<TenantDto> and TenantDto instead of legacy types
12
14
  */
13
15
  interface State {
14
- result: Response;
15
- selectedItem: Item;
16
+ result: PagedResultDto<TenantDto>;
17
+ selectedItem: TenantDto;
16
18
  }
17
19
  /**
18
20
  * API response for tenant list (paginated)
21
+ * @deprecated To be deleted in v4.0. Use PagedResultDto<TenantDto> from @abpjs/core instead.
19
22
  */
20
23
  type Response = ABP.PagedResponse<Item>;
21
24
  /**
22
25
  * Single tenant item
26
+ * @deprecated To be deleted in v4.0. Use TenantDto from '@abpjs/tenant-management/proxy' instead.
23
27
  */
24
28
  interface Item {
25
29
  id: string;
@@ -28,6 +32,7 @@ export declare namespace TenantManagement {
28
32
  /**
29
33
  * Request payload for creating a new tenant
30
34
  * @since 2.4.0 Added adminEmailAddress and adminPassword fields
35
+ * @deprecated To be deleted in v4.0. Use TenantCreateDto from '@abpjs/tenant-management/proxy' instead.
31
36
  */
32
37
  interface AddRequest {
33
38
  /** Admin email address for the new tenant */
@@ -40,6 +45,7 @@ export declare namespace TenantManagement {
40
45
  /**
41
46
  * Request payload for updating an existing tenant
42
47
  * @since 2.4.0 No longer extends AddRequest (only id and name needed for update)
48
+ * @deprecated To be deleted in v4.0. Use TenantUpdateDto from '@abpjs/tenant-management/proxy' instead.
43
49
  */
44
50
  interface UpdateRequest {
45
51
  /** Tenant ID */
@@ -49,6 +55,7 @@ export declare namespace TenantManagement {
49
55
  }
50
56
  /**
51
57
  * Request payload for updating tenant's default connection string
58
+ * @deprecated To be deleted in v4.0. Use TenantService.updateDefaultConnectionString instead.
52
59
  */
53
60
  interface DefaultConnectionStringRequest {
54
61
  id: string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Proxy module exports for Tenant Management
3
+ * Translated from @abp/ng.tenant-management v3.2.0 lib/proxy/index.d.ts
4
+ *
5
+ * This module provides typed proxy services and DTOs for the Tenant Management API.
6
+ * @since 3.2.0
7
+ */
8
+ export * from './models';
9
+ export * from './tenant.service';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Proxy models for Tenant Management module
3
+ * Translated from @abp/ng.tenant-management v3.2.0 lib/proxy/models.d.ts
4
+ *
5
+ * These are the typed DTOs for the Tenant Management API.
6
+ * @since 3.2.0
7
+ */
8
+ import type { ExtensibleEntityDto, ExtensibleObject, PagedAndSortedResultRequestDto } from '@abpjs/core';
9
+ /**
10
+ * Input parameters for getting a list of tenants.
11
+ * Extends PagedAndSortedResultRequestDto for pagination and sorting.
12
+ * @since 3.2.0
13
+ */
14
+ export interface GetTenantsInput extends PagedAndSortedResultRequestDto {
15
+ /** Filter string to search tenants by name */
16
+ filter: string;
17
+ }
18
+ /**
19
+ * Base DTO for tenant create and update operations.
20
+ * Extends ExtensibleObject for extra properties support.
21
+ * @since 3.2.0
22
+ */
23
+ export interface TenantCreateOrUpdateDtoBase extends ExtensibleObject {
24
+ /** The name of the tenant */
25
+ name: string;
26
+ }
27
+ /**
28
+ * DTO for creating a new tenant.
29
+ * Extends TenantCreateOrUpdateDtoBase with admin credentials.
30
+ * @since 3.2.0
31
+ */
32
+ export interface TenantCreateDto extends TenantCreateOrUpdateDtoBase {
33
+ /** Admin email address for the new tenant */
34
+ adminEmailAddress: string;
35
+ /** Admin password for the new tenant */
36
+ adminPassword: string;
37
+ }
38
+ /**
39
+ * DTO for updating an existing tenant.
40
+ * Extends TenantCreateOrUpdateDtoBase (only name is updatable).
41
+ * @since 3.2.0
42
+ */
43
+ export interface TenantUpdateDto extends TenantCreateOrUpdateDtoBase {
44
+ }
45
+ /**
46
+ * DTO representing a tenant entity.
47
+ * Extends ExtensibleEntityDto with string ID.
48
+ * @since 3.2.0
49
+ */
50
+ export interface TenantDto extends ExtensibleEntityDto<string> {
51
+ /** The name of the tenant */
52
+ name: string;
53
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Tenant Service - Typed proxy service for Tenant Management API
3
+ * Translated from @abp/ng.tenant-management v3.2.0 lib/proxy/tenant.service.d.ts
4
+ *
5
+ * This service provides strongly-typed API methods for tenant management operations.
6
+ * It replaces the legacy TenantManagementService with modern proxy patterns.
7
+ *
8
+ * @since 3.2.0
9
+ */
10
+ import { RestService, PagedResultDto } from '@abpjs/core';
11
+ import type { GetTenantsInput, TenantCreateDto, TenantDto, TenantUpdateDto } from './models';
12
+ /**
13
+ * Typed proxy service for Tenant Management API operations.
14
+ * Provides CRUD operations for tenants with strongly-typed request/response DTOs.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { TenantService } from '@abpjs/tenant-management';
19
+ * import { getRestService } from '@abpjs/core';
20
+ *
21
+ * const tenantService = new TenantService(getRestService());
22
+ *
23
+ * // Get list of tenants
24
+ * const result = await tenantService.getList({ filter: '', maxResultCount: 10, skipCount: 0 });
25
+ *
26
+ * // Create a new tenant
27
+ * const tenant = await tenantService.create({
28
+ * name: 'MyTenant',
29
+ * adminEmailAddress: 'admin@mytenant.com',
30
+ * adminPassword: 'SecurePassword123!'
31
+ * });
32
+ *
33
+ * // Update a tenant
34
+ * await tenantService.update(tenant.id, { name: 'UpdatedName' });
35
+ *
36
+ * // Delete a tenant
37
+ * await tenantService.delete(tenant.id);
38
+ * ```
39
+ *
40
+ * @since 3.2.0
41
+ */
42
+ export declare class TenantService {
43
+ private restService;
44
+ /**
45
+ * The API name used for REST requests.
46
+ * Defaults to 'default' for the main API.
47
+ */
48
+ apiName: string;
49
+ constructor(restService: RestService);
50
+ /**
51
+ * Create a new tenant.
52
+ * @param input - The tenant creation data including admin credentials
53
+ * @returns Promise resolving to the created tenant DTO
54
+ */
55
+ create: (input: TenantCreateDto) => Promise<TenantDto>;
56
+ /**
57
+ * Delete a tenant by ID.
58
+ * @param id - The tenant ID to delete
59
+ * @returns Promise resolving when deletion is complete
60
+ */
61
+ delete: (id: string) => Promise<void>;
62
+ /**
63
+ * Delete the default connection string for a tenant.
64
+ * This will cause the tenant to use the shared/host database.
65
+ * @param id - The tenant ID
66
+ * @returns Promise resolving when deletion is complete
67
+ */
68
+ deleteDefaultConnectionString: (id: string) => Promise<void>;
69
+ /**
70
+ * Get a tenant by ID.
71
+ * @param id - The tenant ID
72
+ * @returns Promise resolving to the tenant DTO
73
+ */
74
+ get: (id: string) => Promise<TenantDto>;
75
+ /**
76
+ * Get the default connection string for a tenant.
77
+ * @param id - The tenant ID
78
+ * @returns Promise resolving to the connection string (empty if using shared database)
79
+ */
80
+ getDefaultConnectionString: (id: string) => Promise<string>;
81
+ /**
82
+ * Get a paginated list of tenants.
83
+ * @param input - The query parameters including filter, pagination, and sorting
84
+ * @returns Promise resolving to a paged result of tenant DTOs
85
+ */
86
+ getList: (input: GetTenantsInput) => Promise<PagedResultDto<TenantDto>>;
87
+ /**
88
+ * Update a tenant.
89
+ * @param id - The tenant ID to update
90
+ * @param input - The update data (currently only name can be updated)
91
+ * @returns Promise resolving to the updated tenant DTO
92
+ */
93
+ update: (id: string, input: TenantUpdateDto) => Promise<TenantDto>;
94
+ /**
95
+ * Update the default connection string for a tenant.
96
+ * @param id - The tenant ID
97
+ * @param defaultConnectionString - The new connection string
98
+ * @returns Promise resolving when update is complete
99
+ */
100
+ updateDefaultConnectionString: (id: string, defaultConnectionString: string) => Promise<void>;
101
+ }
@@ -1,2 +1,3 @@
1
1
  export { TenantManagementService } from './tenant-management.service';
2
2
  export { TenantManagementStateService, getTenantManagementStateService, } from './tenant-management-state.service';
3
+ export { TenantService } from '../proxy/tenant.service';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/tenant-management",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "ABP Framework tenant-management components for React - translated from @abp/ng.tenant-management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -23,11 +23,11 @@
23
23
  "dependencies": {
24
24
  "@chakra-ui/react": "^3.2.0",
25
25
  "@emotion/react": "^11.11.0",
26
- "@abpjs/core": "3.0.0",
27
- "@abpjs/theme-shared": "3.0.0"
26
+ "@abpjs/core": "3.2.0",
27
+ "@abpjs/theme-shared": "3.2.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@abp/ng.tenant-management": "3.0.0",
30
+ "@abp/ng.tenant-management": "3.2.0",
31
31
  "@testing-library/jest-dom": "^6.4.0",
32
32
  "@testing-library/react": "^14.2.0",
33
33
  "@types/react": "^18.2.0",