@adobe/spacecat-shared-data-access 3.61.0 → 3.62.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [@adobe/spacecat-shared-data-access-v3.62.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.61.0...@adobe/spacecat-shared-data-access-v3.62.0) (2026-05-12)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **data-access:** add semrushWorkspaceId attribute to Organization ([#1602](https://github.com/adobe/spacecat-shared/issues/1602)) ([79a5d82](https://github.com/adobe/spacecat-shared/commit/79a5d825c2a3cb436d894f5bea90a0a4e230167b))
|
|
6
|
+
|
|
1
7
|
## [@adobe/spacecat-shared-data-access-v3.61.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.60.0...@adobe/spacecat-shared-data-access-v3.61.0) (2026-05-12)
|
|
2
8
|
|
|
3
9
|
### Features
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ export interface Organization extends BaseModel {
|
|
|
19
19
|
getFulfillableItems(): object;
|
|
20
20
|
getImsOrgId(): string;
|
|
21
21
|
getName(): string;
|
|
22
|
+
getSemrushWorkspaceId(): string;
|
|
22
23
|
getSites(): Promise<Site[]>;
|
|
23
24
|
getProjects(): Promise<Project[]>;
|
|
24
25
|
getEntitlements(): Promise<Entitlement[]>;
|
|
@@ -28,9 +29,12 @@ export interface Organization extends BaseModel {
|
|
|
28
29
|
setFulfillableItems(fulfillableItems: object): Organization;
|
|
29
30
|
setImsOrgId(imsOrgId: string): Organization;
|
|
30
31
|
setName(name: string): Organization;
|
|
32
|
+
setSemrushWorkspaceId(semrushWorkspaceId: string): Organization;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export interface OrganizationCollection extends BaseCollection<Organization> {
|
|
34
36
|
allByImsOrgId(imsOrgId: string): Promise<Organization[]>;
|
|
37
|
+
allBySemrushWorkspaceId(semrushWorkspaceId: string): Promise<Organization[]>;
|
|
35
38
|
findByImsOrgId(imsOrgId: string): Promise<Organization | null>;
|
|
39
|
+
findBySemrushWorkspaceId(semrushWorkspaceId: string): Promise<Organization | null>;
|
|
36
40
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/* c8 ignore start */
|
|
14
14
|
|
|
15
|
-
import { isNonEmptyObject } from '@adobe/spacecat-shared-utils';
|
|
15
|
+
import { hasText, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
|
|
16
16
|
|
|
17
17
|
import { Config, DEFAULT_CONFIG, validateConfiguration } from '../site/config.js';
|
|
18
18
|
import SchemaBuilder from '../base/schema.builder.js';
|
|
@@ -48,6 +48,19 @@ const schema = new SchemaBuilder(Organization, OrganizationCollection)
|
|
|
48
48
|
type: 'any',
|
|
49
49
|
validate: (value) => !value || isNonEmptyObject(value),
|
|
50
50
|
})
|
|
51
|
-
.
|
|
51
|
+
.addAttribute('semrushWorkspaceId', {
|
|
52
|
+
type: 'string',
|
|
53
|
+
// Minimum guard: reject empty / whitespace-only strings. Full format
|
|
54
|
+
// validation deferred until Semrush confirms the workspace-ID format.
|
|
55
|
+
// Use value == null (loose) so undefined and null short-circuit, but
|
|
56
|
+
// empty string ('') falls through to hasText() which rejects it.
|
|
57
|
+
validate: (value) => value == null || hasText(value),
|
|
58
|
+
})
|
|
59
|
+
.addAllIndex(['imsOrgId'])
|
|
60
|
+
// Uniqueness is enforced at the DB level via the UNIQUE constraint on
|
|
61
|
+
// organizations.semrush_workspace_id (mysticat-data-service migration
|
|
62
|
+
// 20260525000000), so findBySemrushWorkspaceId is semantically guaranteed
|
|
63
|
+
// to return at most one row.
|
|
64
|
+
.addAllIndex(['semrushWorkspaceId']);
|
|
52
65
|
|
|
53
66
|
export default schema.build();
|