@adobe/spacecat-shared-data-access 4.21.1 → 4.22.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-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)
2
+
3
+ ### Features
4
+
5
+ * 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))
6
+
1
7
  ## [@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
8
 
3
9
  ### 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.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -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'] },