@adobe/spacecat-shared-data-access 4.21.1 → 4.22.1

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,15 @@
1
+ ## [@adobe/spacecat-shared-data-access-v4.22.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v4.22.0...@adobe/spacecat-shared-data-access-v4.22.1) (2026-08-19)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **data-access:** remove deprecated brand pendingSemrushProvisioning attribute (SITES-49448) ([#1886](https://github.com/adobe/spacecat-shared/issues/1886)) ([3b09e0b](https://github.com/adobe/spacecat-shared/commit/3b09e0b613526030f317db5e1f74324fdeea7ff0)), closes [#5](https://github.com/adobe/spacecat-shared/issues/5) [1867/#1880](https://github.com/1867/spacecat-shared/issues/1880)
6
+
7
+ ## [@adobe/spacecat-shared-data-access-v4.22.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v4.21.1...@adobe/spacecat-shared-data-access-v4.22.0) (2026-08-14)
8
+
9
+ ### Features
10
+
11
+ * schema changes for trial users entity to allow searching by external user id ([#1871](https://github.com/adobe/spacecat-shared/issues/1871)) ([3ecf546](https://github.com/adobe/spacecat-shared/commit/3ecf5466b41dcd32cf5dd591f8762fefd714af1f))
12
+
1
13
  ## [@adobe/spacecat-shared-data-access-v4.21.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v4.21.0...@adobe/spacecat-shared-data-access-v4.21.1) (2026-08-14)
2
14
 
3
15
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "4.21.1",
3
+ "version": "4.22.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -34,6 +34,14 @@ import BaseModel from '../base/base.model.js';
34
34
  * `Organization.semrushWorkspaceId` is a DISTINCT field and stays — do not
35
35
  * reintroduce a brand mirror by symbol-name sweep.
36
36
  *
37
+ * NOTE: there is also no `pendingSemrushProvisioning` attribute. That
38
+ * "Save as pending" staging blob (`{primaryUrl, markets, generatePrompts}`,
39
+ * mapped to `brands.pending_semrush_provisioning`) was removed in SITES-49448
40
+ * once the brand/market management model made pending brands carry no
41
+ * markets, models chosen per market, and the primary URL a `site_id`
42
+ * selection at create time — the blob's shape no longer matches anything the
43
+ * product writes.
44
+ *
37
45
  * @class Brand
38
46
  * @extends BaseModel
39
47
  */
@@ -49,15 +49,6 @@ const schema = new SchemaBuilder(Brand, BrandCollection)
49
49
  type: 'string',
50
50
  validate: (value) => value == null || hasText(value),
51
51
  })
52
- // Nullable JSONB blob holding deferred Semrush provisioning data for a
53
- // pending (draft) brand. Maps to brands.pending_semrush_provisioning
54
- // (migration 20260618120000). Validated loosely here (object-or-null); the
55
- // DB CHECK enforces the object shape and the controller owns field-level
56
- // validation and the activate-flow consumption semantics.
57
- .addAttribute('pendingSemrushProvisioning', {
58
- type: 'any',
59
- validate: (value) => value == null || (typeof value === 'object' && !Array.isArray(value)),
60
- })
61
52
  // Uniqueness guarantee on the write-of-record column
62
53
  // (brands.semrush_sub_workspace_id, mysticat-data-service migration
63
54
  // 20260702091920), so findBySemrushSubWorkspaceId returns at most one row.
@@ -43,9 +43,29 @@ export interface TrialUserCollection extends BaseCollection<TrialUser> {
43
43
  allByProviderAndExternalUserId(provider: ProviderType, externalId: string): Promise<TrialUser[]>;
44
44
  allByOrganizationId(organizationId: string): Promise<TrialUser[]>;
45
45
  allByEmailId(emailId: string): Promise<TrialUser[]>;
46
+ allByExternalUserId(externalUserId: string): Promise<TrialUser[]>;
47
+ allByExternalUserIdAndUpdatedAt(
48
+ externalUserId: string,
49
+ updatedAt: string
50
+ ): Promise<TrialUser[]>;
46
51
  findByProvider(provider: ProviderType): Promise<TrialUser | null>;
47
52
  findByProviderAndExternalUserId(provider: ProviderType, externalId: string):
48
53
  Promise<TrialUser | null>;
49
54
  findByOrganizationId(organizationId: string): Promise<TrialUser | null>;
50
55
  findByEmailId(emailId: string): Promise<TrialUser | null>;
56
+ /**
57
+ * externalUserId is optional and not enforced unique (no DB unique constraint), so this
58
+ * returns one arbitrary match when multiple trial users share the same externalUserId.
59
+ * Use allByExternalUserId if you need every matching record.
60
+ */
61
+ findByExternalUserId(externalUserId: string): Promise<TrialUser | null>;
62
+ /**
63
+ * externalUserId is optional and not enforced unique (no DB unique constraint), so this
64
+ * returns one arbitrary match when multiple trial users share the same externalUserId.
65
+ * Use allByExternalUserIdAndUpdatedAt if you need every matching record.
66
+ */
67
+ findByExternalUserIdAndUpdatedAt(
68
+ externalUserId: string,
69
+ updatedAt: string
70
+ ): Promise<TrialUser | null>;
51
71
  }
@@ -53,6 +53,11 @@ const schema = new SchemaBuilder(TrialUser, TrialUserCollection)
53
53
  { composite: ['organizationId'] },
54
54
  { composite: ['updatedAt'] },
55
55
  )
56
+ // externalUserId is not enforced unique (no DB unique constraint) and is optional, so
57
+ // findByExternalUserId only returns one arbitrary match. Prefer allByExternalUserId
58
+ // unless the caller can guarantee uniqueness for their use case.
59
+ // Note: this schema is now at 4 of the 5-index cap enforced by SchemaBuilder
60
+ // (#buildIndexes) - budget the next lookup index accordingly.
56
61
  .addIndex(
57
62
  { composite: ['externalUserId'] },
58
63
  { composite: ['updatedAt'] },