@adobe/spacecat-shared-tier-client 1.3.7 → 1.3.8
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/tier-client.js +0 -8
- package/test/tier-client.test.js +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-tier-client-v1.3.8](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-tier-client-v1.3.7...@adobe/spacecat-shared-tier-client-v1.3.8) (2025-11-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove instanceof check ([#1191](https://github.com/adobe/spacecat-shared/issues/1191)) ([c2bf75d](https://github.com/adobe/spacecat-shared/commit/c2bf75d44003e1d0c25bea75640559cd46794301))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-tier-client-v1.3.7](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-tier-client-v1.3.6...@adobe/spacecat-shared-tier-client-v1.3.7) (2025-11-28)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/tier-client.js
CHANGED
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { isNonEmptyObject, hasText } from '@adobe/spacecat-shared-utils';
|
|
14
14
|
import {
|
|
15
|
-
Site,
|
|
16
15
|
Entitlement as EntitlementModel,
|
|
17
|
-
Organization,
|
|
18
16
|
} from '@adobe/spacecat-shared-data-access';
|
|
19
17
|
/**
|
|
20
18
|
* TierClient provides methods to manage entitlements and site enrollments.
|
|
@@ -28,9 +26,6 @@ class TierClient {
|
|
|
28
26
|
* @returns {TierClient} TierClient instance for organization operations.
|
|
29
27
|
*/
|
|
30
28
|
static createForOrg(context, organization, productCode) {
|
|
31
|
-
if (!(organization.entityName === Organization.ENTITY_NAME)) {
|
|
32
|
-
throw new Error('Entity must be an instance of Organization');
|
|
33
|
-
}
|
|
34
29
|
if (!hasText(productCode)) {
|
|
35
30
|
throw new Error('Product code is required');
|
|
36
31
|
}
|
|
@@ -48,9 +43,6 @@ class TierClient {
|
|
|
48
43
|
* @returns {TierClient} TierClient instance for site operations.
|
|
49
44
|
*/
|
|
50
45
|
static async createForSite(context, site, productCode) {
|
|
51
|
-
if (!(site.entityName === Site.ENTITY_NAME)) {
|
|
52
|
-
throw new Error('Entity must be an instance of Site');
|
|
53
|
-
}
|
|
54
46
|
if (!hasText(productCode)) {
|
|
55
47
|
throw new Error('Product code is required');
|
|
56
48
|
}
|
package/test/tier-client.test.js
CHANGED
|
@@ -147,13 +147,16 @@ describe('TierClient', () => {
|
|
|
147
147
|
expect(client.createEntitlement).to.be.a('function');
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
it('should
|
|
151
|
-
|
|
150
|
+
it('should allow null organization (validation removed)', () => {
|
|
151
|
+
const client = TierClient.createForOrg(mockContext, null, productCode);
|
|
152
|
+
expect(client).to.be.an('object');
|
|
153
|
+
expect(client.createEntitlement).to.be.a('function');
|
|
152
154
|
});
|
|
153
155
|
|
|
154
|
-
it('should
|
|
156
|
+
it('should allow organization without getId (validation removed)', () => {
|
|
155
157
|
const invalidOrg = { name: 'test' };
|
|
156
|
-
|
|
158
|
+
const client = TierClient.createForOrg(mockContext, invalidOrg, productCode);
|
|
159
|
+
expect(client).to.be.an('object');
|
|
157
160
|
});
|
|
158
161
|
|
|
159
162
|
it('should throw error when context is invalid', () => {
|
|
@@ -204,7 +207,7 @@ describe('TierClient', () => {
|
|
|
204
207
|
|
|
205
208
|
it('should throw error when site has no getId method', async () => {
|
|
206
209
|
const invalidSite = { name: 'test' };
|
|
207
|
-
await expect(TierClient.createForSite(mockContext, invalidSite, productCode)).to.be.rejectedWith('
|
|
210
|
+
await expect(TierClient.createForSite(mockContext, invalidSite, productCode)).to.be.rejectedWith('site.getOrganizationId is not a function');
|
|
208
211
|
});
|
|
209
212
|
|
|
210
213
|
it('should throw error when context is invalid', async () => {
|