@adobe/spacecat-shared-data-access 3.36.1 → 3.38.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,15 @@
1
+ ## [@adobe/spacecat-shared-data-access-v3.38.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.37.0...@adobe/spacecat-shared-data-access-v3.38.0) (2026-04-01)
2
+
3
+ ### Features
4
+
5
+ * rename ahrefs to seo in dependency mapping and test fixtures ([#1492](https://github.com/adobe/spacecat-shared/issues/1492)) ([40aa319](https://github.com/adobe/spacecat-shared/commit/40aa319d78fc1aa8ba96f83002b45eb2dbde570c))
6
+
7
+ ## [@adobe/spacecat-shared-data-access-v3.37.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.36.1...@adobe/spacecat-shared-data-access-v3.37.0) (2026-04-01)
8
+
9
+ ### Features
10
+
11
+ * experimentation engine ([#1446](https://github.com/adobe/spacecat-shared/issues/1446)) ([44bff63](https://github.com/adobe/spacecat-shared/commit/44bff6350c18db58d8fbffde8de05074269ec969))
12
+
1
13
  ## [@adobe/spacecat-shared-data-access-v3.36.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.36.0...@adobe/spacecat-shared-data-access-v3.36.1) (2026-04-01)
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": "3.36.1",
3
+ "version": "3.38.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -21,6 +21,7 @@ import ConfigurationCollection from '../configuration/configuration.collection.j
21
21
  import ConsumerCollection from '../consumer/consumer.collection.js';
22
22
  import ExperimentCollection from '../experiment/experiment.collection.js';
23
23
  import EntitlementCollection from '../entitlement/entitlement.collection.js';
24
+ import GeoExperimentCollection from '../geo-experiment/geo-experiment.collection.js';
24
25
  import FixEntityCollection from '../fix-entity/fix-entity.collection.js';
25
26
  import FixEntitySuggestionCollection from '../fix-entity-suggestion/fix-entity-suggestion.collection.js';
26
27
  import ImportJobCollection from '../import-job/import-job.collection.js';
@@ -57,6 +58,7 @@ import AuditSchema from '../audit/audit.schema.js';
57
58
  import AuditUrlSchema from '../audit-url/audit-url.schema.js';
58
59
  import ConsumerSchema from '../consumer/consumer.schema.js';
59
60
  import EntitlementSchema from '../entitlement/entitlement.schema.js';
61
+ import GeoExperimentSchema from '../geo-experiment/geo-experiment.schema.js';
60
62
  import FixEntitySchema from '../fix-entity/fix-entity.schema.js';
61
63
  import FixEntitySuggestionSchema from '../fix-entity-suggestion/fix-entity-suggestion.schema.js';
62
64
  import ExperimentSchema from '../experiment/experiment.schema.js';
@@ -189,6 +191,7 @@ EntityRegistry.registerEntity(AuditSchema, AuditCollection);
189
191
  EntityRegistry.registerEntity(AuditUrlSchema, AuditUrlCollection);
190
192
  EntityRegistry.registerEntity(ConsumerSchema, ConsumerCollection);
191
193
  EntityRegistry.registerEntity(EntitlementSchema, EntitlementCollection);
194
+ EntityRegistry.registerEntity(GeoExperimentSchema, GeoExperimentCollection);
192
195
  EntityRegistry.registerEntity(FixEntitySchema, FixEntityCollection);
193
196
  EntityRegistry.registerEntity(FixEntitySuggestionSchema, FixEntitySuggestionCollection);
194
197
  EntityRegistry.registerEntity(ExperimentSchema, ExperimentCollection);
@@ -0,0 +1,43 @@
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
+ import BaseCollection from '../base/base.collection.js';
15
+
16
+ class GeoExperimentCollection extends BaseCollection {
17
+ static COLLECTION_NAME = 'GeoExperimentCollection';
18
+
19
+ /**
20
+ * Gets all geo experiments for a site, ordered by most recently updated.
21
+ *
22
+ * @param {string} siteId - The site ID.
23
+ * @param {object} [options={}] - Query options (limit, cursor).
24
+ * @returns {Promise<{data: GeoExperiment[], cursor: string|null}>} Paginated results.
25
+ */
26
+ async allBySiteId(siteId, options = {}) {
27
+ if (!hasText(siteId)) {
28
+ throw new Error('SiteId is required');
29
+ }
30
+
31
+ const result = await this.allByIndexKeys(
32
+ { siteId },
33
+ { ...options, returnCursor: true },
34
+ );
35
+
36
+ return {
37
+ data: result.data || [],
38
+ cursor: result.cursor,
39
+ };
40
+ }
41
+ }
42
+
43
+ export default GeoExperimentCollection;
@@ -0,0 +1,41 @@
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
+ class GeoExperiment extends BaseModel {
16
+ static ENTITY_NAME = 'GeoExperiment';
17
+
18
+ static DEFAULT_UPDATED_BY = 'spacecat';
19
+
20
+ static TYPES = {
21
+ ONSITE_OPPORTUNITY_DEPLOYMENT: 'onsite_opportunity_deployment',
22
+ };
23
+
24
+ static STATUSES = {
25
+ GENERATING_BASELINE: 'GENERATING_BASELINE',
26
+ IN_PROGRESS: 'IN_PROGRESS',
27
+ COMPLETED: 'COMPLETED',
28
+ FAILED: 'FAILED',
29
+ };
30
+
31
+ static PHASES = {
32
+ PRE_ANALYSIS_SUBMITTED: 'pre_analysis_submitted',
33
+ PRE_ANALYSIS_DONE: 'pre_analysis_done',
34
+ DEPLOYMENT_STARTED: 'deployment_started',
35
+ DEPLOYMENT_COMPLETED: 'deployment_completed',
36
+ POST_ANALYSIS_SUBMITTED: 'post_analysis_submitted',
37
+ POST_ANALYSIS_DONE: 'post_analysis_done',
38
+ };
39
+ }
40
+
41
+ export default GeoExperiment;
@@ -0,0 +1,93 @@
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
+ /* c8 ignore start */
14
+
15
+ import {
16
+ hasText,
17
+ isInteger,
18
+ isObject,
19
+ isValidUUID,
20
+ } from '@adobe/spacecat-shared-utils';
21
+
22
+ import SchemaBuilder from '../base/schema.builder.js';
23
+ import GeoExperiment from './geo-experiment.model.js';
24
+ import GeoExperimentCollection from './geo-experiment.collection.js';
25
+
26
+ const schema = new SchemaBuilder(GeoExperiment, GeoExperimentCollection)
27
+ .addReference('belongs_to', 'Site')
28
+ .addReference('belongs_to', 'Opportunity', [], { required: false })
29
+ .addAttribute('preScheduleId', {
30
+ type: 'string',
31
+ validate: (value) => !value || hasText(value),
32
+ })
33
+ .addAttribute('postScheduleId', {
34
+ type: 'string',
35
+ validate: (value) => !value || hasText(value),
36
+ })
37
+ .addAttribute('type', {
38
+ type: Object.values(GeoExperiment.TYPES),
39
+ required: true,
40
+ })
41
+ .addAttribute('status', {
42
+ type: Object.values(GeoExperiment.STATUSES),
43
+ required: true,
44
+ })
45
+ .addAttribute('phase', {
46
+ type: Object.values(GeoExperiment.PHASES),
47
+ required: true,
48
+ })
49
+ .addAttribute('suggestionIds', {
50
+ type: 'list',
51
+ items: {
52
+ type: 'string',
53
+ validate: (value) => isValidUUID(value),
54
+ },
55
+ default: () => [],
56
+ })
57
+ .addAttribute('name', {
58
+ type: 'string',
59
+ required: true,
60
+ validate: (value) => hasText(value),
61
+ })
62
+ .addAttribute('promptsCount', {
63
+ type: 'number',
64
+ default: 0,
65
+ validate: (value) => isInteger(value) && value >= 0,
66
+ })
67
+ .addAttribute('promptsLocation', {
68
+ type: 'string',
69
+ validate: (value) => !value || hasText(value),
70
+ })
71
+ .addAttribute('startTime', {
72
+ type: 'string',
73
+ validate: (value) => !value || hasText(value),
74
+ })
75
+ .addAttribute('endTime', {
76
+ type: 'string',
77
+ validate: (value) => !value || hasText(value),
78
+ })
79
+ .addAttribute('metadata', {
80
+ type: 'any',
81
+ validate: (value) => !value || isObject(value),
82
+ })
83
+ .addAttribute('error', {
84
+ type: 'any',
85
+ validate: (value) => !value || isObject(value),
86
+ })
87
+ .addAttribute('updatedBy', {
88
+ type: 'string',
89
+ default: GeoExperiment.DEFAULT_UPDATED_BY,
90
+ validate: (value) => hasText(value),
91
+ });
92
+
93
+ export default schema.build();
@@ -0,0 +1,71 @@
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,
15
+ BaseModel,
16
+ Opportunity,
17
+ PaginatedResult,
18
+ QueryOptions,
19
+ Site,
20
+ } from '../index';
21
+
22
+ export interface GeoExperiment extends BaseModel {
23
+ getSiteId(): string;
24
+ getOpportunityId(): string | undefined;
25
+ getSite(): Promise<Site>;
26
+ getOpportunity(): Promise<Opportunity>;
27
+ getPreScheduleId(): string | undefined;
28
+ getPostScheduleId(): string | undefined;
29
+ getType(): string;
30
+ getPhase(): string;
31
+ getStatus(): string;
32
+ getSuggestionIds(): string[];
33
+ getPromptsLocation(): string | undefined;
34
+ getName(): string;
35
+ getPromptsCount(): number;
36
+ getStartTime(): string | undefined;
37
+ getEndTime(): string | undefined;
38
+ getMetadata(): object | undefined;
39
+ getError(): object | undefined;
40
+ getUpdatedBy(): string;
41
+
42
+ setSiteId(siteId: string): GeoExperiment;
43
+ setOpportunityId(opportunityId?: string): GeoExperiment;
44
+ setPreScheduleId(preScheduleId?: string): GeoExperiment;
45
+ setPostScheduleId(postScheduleId?: string): GeoExperiment;
46
+ setType(type: string): GeoExperiment;
47
+ setPhase(phase: string): GeoExperiment;
48
+ setStatus(status: string): GeoExperiment;
49
+ setSuggestionIds(suggestionIds: string[]): GeoExperiment;
50
+ setPromptsLocation(promptsLocation?: string): GeoExperiment;
51
+ setName(name: string): GeoExperiment;
52
+ setPromptsCount(promptsCount: number): GeoExperiment;
53
+ setStartTime(startTime?: string): GeoExperiment;
54
+ setEndTime(endTime?: string): GeoExperiment;
55
+ setMetadata(metadata?: object): GeoExperiment;
56
+ setError(error?: object): GeoExperiment;
57
+ setUpdatedBy(updatedBy: string): GeoExperiment;
58
+ }
59
+
60
+ export interface GeoExperimentCollection extends BaseCollection<GeoExperiment> {
61
+ allBySiteId(siteId: string, options?: QueryOptions): Promise<PaginatedResult<GeoExperiment>>;
62
+ findBySiteId(siteId: string): Promise<GeoExperiment | null>;
63
+ allByOpportunityId(
64
+ opportunityId: string,
65
+ options?: QueryOptions,
66
+ ): Promise<GeoExperiment[] | PaginatedResult<GeoExperiment>>;
67
+ findByOpportunityId(
68
+ opportunityId: string,
69
+ options?: QueryOptions,
70
+ ): Promise<GeoExperiment | null>;
71
+ }
@@ -0,0 +1,19 @@
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 GeoExperiment from './geo-experiment.model.js';
14
+ import GeoExperimentCollection from './geo-experiment.collection.js';
15
+
16
+ export {
17
+ GeoExperiment,
18
+ GeoExperimentCollection,
19
+ };
@@ -19,6 +19,7 @@ export type * from './base';
19
19
  export type * from './configuration';
20
20
  export type * from './consumer';
21
21
  export type * from './entitlement';
22
+ export type * from './geo-experiment';
22
23
  export type * from './experiment';
23
24
  export type * from './fix-entity';
24
25
  export type * from './fix-entity-suggestion';
@@ -19,6 +19,7 @@ export * from './base/index.js';
19
19
  export * from './configuration/index.js';
20
20
  export * from './consumer/index.js';
21
21
  export * from './entitlement/index.js';
22
+ export * from './geo-experiment/index.js';
22
23
  export * from './fix-entity/index.js';
23
24
  export * from './fix-entity-suggestion/index.js';
24
25
  export * from './experiment/index.js';
@@ -19,6 +19,7 @@ import type { AuditUrlCollection } from '../models/audit-url';
19
19
  import type { ConfigurationCollection } from '../models/configuration';
20
20
  import type { ConsumerCollection } from '../models/consumer';
21
21
  import type { EntitlementCollection } from '../models/entitlement';
22
+ import type { GeoExperimentCollection } from '../models/geo-experiment';
22
23
  import type { ExperimentCollection } from '../models/experiment';
23
24
  import type { FixEntityCollection } from '../models/fix-entity';
24
25
  import type { FixEntitySuggestionCollection } from '../models/fix-entity-suggestion';
@@ -68,6 +69,7 @@ export interface DataAccess {
68
69
  Configuration: ConfigurationCollection;
69
70
  Consumer: ConsumerCollection;
70
71
  Entitlement: EntitlementCollection;
72
+ GeoExperiment: GeoExperimentCollection;
71
73
  Experiment: ExperimentCollection;
72
74
  FixEntity: FixEntityCollection;
73
75
  FixEntitySuggestion: FixEntitySuggestionCollection;