@adobe/spacecat-shared-data-access 3.74.2 → 3.75.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 +14 -6
- package/package.json +1 -1
- package/src/models/base/entity.registry.js +3 -0
- package/src/models/brand/brand.collection.js +28 -0
- package/src/models/brand/brand.model.js +44 -0
- package/src/models/brand/brand.schema.js +54 -0
- package/src/models/brand/index.d.ts +29 -0
- package/src/models/brand/index.js +15 -0
- package/src/models/brand-semrush-project/index.d.ts +5 -4
- package/src/models/index.d.ts +1 -0
- package/src/models/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [@adobe/spacecat-shared-data-access-v3.75.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.74.3...@adobe/spacecat-shared-data-access-v3.75.0) (2026-06-15)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **data-access:** add minimal Brand entity for serenity sub-workspace ([#1679](https://github.com/adobe/spacecat-shared/issues/1679)) ([e68d257](https://github.com/adobe/spacecat-shared/commit/e68d2577d51b3a9110477ddcdc5a550f935b7b47))
|
|
6
|
+
|
|
7
|
+
## [@adobe/spacecat-shared-data-access-v3.74.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.74.2...@adobe/spacecat-shared-data-access-v3.74.3) (2026-06-12)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **data-access:** remove stale stash conflict markers in CHANGELOG ([#1669](https://github.com/adobe/spacecat-shared/issues/1669)) ([12229c3](https://github.com/adobe/spacecat-shared/commit/12229c33e6b2ed9731d256d89b580a0ad64d96b3))
|
|
12
|
+
|
|
1
13
|
## [@adobe/spacecat-shared-data-access-v3.74.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.74.1...@adobe/spacecat-shared-data-access-v3.74.2) (2026-06-11)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
|
@@ -3732,18 +3744,14 @@ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
3732
3744
|
|
|
3733
3745
|
* github org ([02f86c3](https://github.com/adobe/spacecat-shared/commit/02f86c351b2b1ab99ce5aca7fd5e6af2246c0efd))
|
|
3734
3746
|
|
|
3735
|
-
|
|
3736
|
-
# [@adobe/spacecat-shared-data-access-v1.6.0](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.5.2...@adobe/spacecat-shared-data-access-v1.6.0) (2024-01-12)
|
|
3747
|
+
# [@adobe/spacecat-shared-data-access-v1.6.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.5.2...@adobe/spacecat-shared-data-access-v1.6.0) (2024-01-12)
|
|
3737
3748
|
|
|
3738
3749
|
|
|
3739
3750
|
### Features
|
|
3740
3751
|
|
|
3741
|
-
* site delivery type ([#77](https://github.com/adobe
|
|
3752
|
+
* site delivery type ([#77](https://github.com/adobe/spacecat-shared/issues/77)) ([005bc38](https://github.com/adobe/spacecat-shared/commit/005bc388ed6ab0f82c8b0f562d4c1f4c0d1e2894))
|
|
3742
3753
|
|
|
3743
|
-
# [@adobe/spacecat-shared-data-access-v1.5.2](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.5.1...@adobe/spacecat-shared-data-access-v1.5.2) (2023-12-30)
|
|
3744
|
-
=======
|
|
3745
3754
|
# [@adobe/spacecat-shared-data-access-v1.5.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.5.1...@adobe/spacecat-shared-data-access-v1.5.2) (2023-12-30)
|
|
3746
|
-
>>>>>>> Stashed changes
|
|
3747
3755
|
|
|
3748
3756
|
|
|
3749
3757
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -35,6 +35,7 @@ import ProjectCollection from '../project/project.collection.js';
|
|
|
35
35
|
import ScrapeJobCollection from '../scrape-job/scrape-job.collection.js';
|
|
36
36
|
import ScrapeUrlCollection from '../scrape-url/scrape-url.collection.js';
|
|
37
37
|
import SiteCandidateCollection from '../site-candidate/site-candidate.collection.js';
|
|
38
|
+
import BrandCollection from '../brand/brand.collection.js';
|
|
38
39
|
import BrandSemrushProjectCollection from '../brand-semrush-project/brand-semrush-project.collection.js';
|
|
39
40
|
import SiteCollection from '../site/site.collection.js';
|
|
40
41
|
import SiteEnrollmentCollection from '../site-enrollment/site-enrollment.collection.js';
|
|
@@ -75,6 +76,7 @@ import OrganizationSchema from '../organization/organization.schema.js';
|
|
|
75
76
|
import ProjectSchema from '../project/project.schema.js';
|
|
76
77
|
import ScrapeJobSchema from '../scrape-job/scrape-job.schema.js';
|
|
77
78
|
import ScrapeUrlSchema from '../scrape-url/scrape-url.schema.js';
|
|
79
|
+
import BrandSchema from '../brand/brand.schema.js';
|
|
78
80
|
import BrandSemrushProjectSchema from '../brand-semrush-project/brand-semrush-project.schema.js';
|
|
79
81
|
import SiteSchema from '../site/site.schema.js';
|
|
80
82
|
import SiteCandidateSchema from '../site-candidate/site-candidate.schema.js';
|
|
@@ -211,6 +213,7 @@ EntityRegistry.registerEntity(OrganizationSchema, OrganizationCollection);
|
|
|
211
213
|
EntityRegistry.registerEntity(ProjectSchema, ProjectCollection);
|
|
212
214
|
EntityRegistry.registerEntity(ScrapeJobSchema, ScrapeJobCollection);
|
|
213
215
|
EntityRegistry.registerEntity(ScrapeUrlSchema, ScrapeUrlCollection);
|
|
216
|
+
EntityRegistry.registerEntity(BrandSchema, BrandCollection);
|
|
214
217
|
EntityRegistry.registerEntity(BrandSemrushProjectSchema, BrandSemrushProjectCollection);
|
|
215
218
|
EntityRegistry.registerEntity(SiteSchema, SiteCollection);
|
|
216
219
|
EntityRegistry.registerEntity(SiteCandidateSchema, SiteCandidateCollection);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import BaseCollection from '../base/base.collection.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* BrandCollection - collection of Brand rows. `findById` (the brand UUID) is
|
|
17
|
+
* the primary access path for serenity dual-mode resolution;
|
|
18
|
+
* `findBySemrushWorkspaceId` (from the addAllIndex below) is used to repair a
|
|
19
|
+
* pointer when a sub-workspace is found to have been deleted out-of-band.
|
|
20
|
+
*
|
|
21
|
+
* @class BrandCollection
|
|
22
|
+
* @extends BaseCollection
|
|
23
|
+
*/
|
|
24
|
+
class BrandCollection extends BaseCollection {
|
|
25
|
+
static COLLECTION_NAME = 'BrandCollection';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default BrandCollection;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import BaseModel from '../base/base.model.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Brand - an Adobe brand, stored in the `brands` table in mysticat-data-service
|
|
17
|
+
* and served over PostgREST. Intentionally minimal: it surfaces only the fields
|
|
18
|
+
* the serenity sub-workspace provisioning flows read/write
|
|
19
|
+
* (`semrushWorkspaceId`, `status`, `name`). Brands are created and fully
|
|
20
|
+
* managed elsewhere (Brandalf sync, onboarding); this entity is a read +
|
|
21
|
+
* targeted-patch surface, not a create surface.
|
|
22
|
+
*
|
|
23
|
+
* `semrushWorkspaceId` is the dual-mode switch: NULL = the brand is not
|
|
24
|
+
* connected to a Semrush sub-workspace (resolves against the org parent
|
|
25
|
+
* workspace — "flat" mode); set = the brand has its own Semrush sub-workspace.
|
|
26
|
+
* Deactivation empties the sub-workspace and clears this pointer (the
|
|
27
|
+
* sub-workspace itself is never deleted). See serenity-docs
|
|
28
|
+
* brand-semrush-provisioning-v2-phase1-sync.md §6.
|
|
29
|
+
*
|
|
30
|
+
* @class Brand
|
|
31
|
+
* @extends BaseModel
|
|
32
|
+
*/
|
|
33
|
+
class Brand extends BaseModel {
|
|
34
|
+
static ENTITY_NAME = 'Brand';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Mirrors the `reference_status` enum on the brands table
|
|
38
|
+
* (mysticat-data-service). Activation writes `active`; deactivation writes
|
|
39
|
+
* `pending`; customer offboard writes `deleted`.
|
|
40
|
+
*/
|
|
41
|
+
static STATUSES = Object.freeze(['pending', 'active', 'deleted', 'ignored']);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default Brand;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { hasText } from '@adobe/spacecat-shared-utils';
|
|
14
|
+
|
|
15
|
+
import SchemaBuilder from '../base/schema.builder.js';
|
|
16
|
+
import Brand from './brand.model.js';
|
|
17
|
+
import BrandCollection from './brand.collection.js';
|
|
18
|
+
|
|
19
|
+
// Minimal projection of the `brands` table (mysticat-data-service) — only the
|
|
20
|
+
// fields the serenity sub-workspace provisioning flows read or patch. Brands
|
|
21
|
+
// are created/owned elsewhere, so columns this entity does not declare
|
|
22
|
+
// (organization_id, site_id, regions, …) are simply never touched by it; a
|
|
23
|
+
// targeted PATCH only sends the attributes it changes.
|
|
24
|
+
const schema = new SchemaBuilder(Brand, BrandCollection)
|
|
25
|
+
.addAttribute('name', {
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: true,
|
|
28
|
+
})
|
|
29
|
+
// reference_status enum on the brands table. Not `required`: this entity
|
|
30
|
+
// never creates a brand, and a targeted PATCH (e.g. setting only
|
|
31
|
+
// semrushWorkspaceId) must not be forced to also send status. The validator
|
|
32
|
+
// still rejects an out-of-enum value when status IS written
|
|
33
|
+
// (activate → 'active', deactivate → 'pending').
|
|
34
|
+
.addAttribute('status', {
|
|
35
|
+
type: Brand.STATUSES,
|
|
36
|
+
validate: (value) => value == null || Brand.STATUSES.includes(value),
|
|
37
|
+
})
|
|
38
|
+
// Brand → Semrush sub-workspace. Nullable (NULL = no sub-workspace
|
|
39
|
+
// connected). Same minimum guard as organizations.semrushWorkspaceId: the
|
|
40
|
+
// shared `hasText` rejects the empty string (and non-strings) while letting
|
|
41
|
+
// null/undefined short-circuit. Note hasText does NOT trim, so a
|
|
42
|
+
// whitespace-only value would pass — acceptable here because this column is
|
|
43
|
+
// only ever written by the activate flow with a real Semrush workspace UUID,
|
|
44
|
+
// never user input.
|
|
45
|
+
.addAttribute('semrushWorkspaceId', {
|
|
46
|
+
type: 'string',
|
|
47
|
+
validate: (value) => value == null || hasText(value),
|
|
48
|
+
})
|
|
49
|
+
// Uniqueness is enforced at the DB level via the UNIQUE constraint on
|
|
50
|
+
// brands.semrush_workspace_id (mysticat-data-service migration
|
|
51
|
+
// 20260615102123), so findBySemrushWorkspaceId returns at most one row.
|
|
52
|
+
.addAllIndex(['semrushWorkspaceId']);
|
|
53
|
+
|
|
54
|
+
export default schema.build();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
BaseCollection, BaseModel,
|
|
15
|
+
} from '../index';
|
|
16
|
+
|
|
17
|
+
export interface Brand extends BaseModel {
|
|
18
|
+
getName(): string;
|
|
19
|
+
getStatus(): string;
|
|
20
|
+
getSemrushWorkspaceId(): string | null;
|
|
21
|
+
setName(value: string): Brand;
|
|
22
|
+
setStatus(value: string): Brand;
|
|
23
|
+
setSemrushWorkspaceId(value: string | null): Brand;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface BrandCollection extends BaseCollection<Brand> {
|
|
27
|
+
allBySemrushWorkspaceId(semrushWorkspaceId: string): Promise<Brand[]>;
|
|
28
|
+
findBySemrushWorkspaceId(semrushWorkspaceId: string): Promise<Brand | null>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { default as Brand } from './brand.model.js';
|
|
14
|
+
export { default as BrandCollection } from './brand.collection.js';
|
|
15
|
+
export { default as BrandSchema } from './brand.schema.js';
|
|
@@ -15,10 +15,11 @@ import type {
|
|
|
15
15
|
} from '../index';
|
|
16
16
|
|
|
17
17
|
// NOTE: `belongs_to Brand` on the schema generates `brandId` plus a
|
|
18
|
-
// `getBrand()` runtime accessor
|
|
19
|
-
// package
|
|
20
|
-
//
|
|
21
|
-
//
|
|
18
|
+
// `getBrand()` runtime accessor. Brand is now a registered (minimal) entity in
|
|
19
|
+
// this package, so the accessor resolves locally; it is still intentionally
|
|
20
|
+
// left off this TypeScript surface, which exposes only the fields callers here
|
|
21
|
+
// need (`brandId`). Rich brand data continues to live in mysticat-data-service
|
|
22
|
+
// and is fetched over HTTP via @adobe/spacecat-shared-brand-client.
|
|
22
23
|
export interface BrandSemrushProject extends BaseModel {
|
|
23
24
|
getBrandId(): string;
|
|
24
25
|
getSemrushProjectId(): string;
|
package/src/models/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export type * from './async-job';
|
|
|
16
16
|
export type * from './audit';
|
|
17
17
|
export type * from './audit-url';
|
|
18
18
|
export type * from './base';
|
|
19
|
+
export type * from './brand';
|
|
19
20
|
export type * from './brand-semrush-project';
|
|
20
21
|
export type * from './configuration';
|
|
21
22
|
export type * from './consumer';
|
package/src/models/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from './contact-sales-lead/index.js';
|
|
|
17
17
|
export * from './audit/index.js';
|
|
18
18
|
export * from './audit-url/index.js';
|
|
19
19
|
export * from './base/index.js';
|
|
20
|
+
export * from './brand/index.js';
|
|
20
21
|
export * from './brand-semrush-project/index.js';
|
|
21
22
|
export * from './configuration/index.js';
|
|
22
23
|
export * from './consumer/index.js';
|