@adobe/spacecat-shared-data-access 1.17.2 → 1.18.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,10 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.18.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.17.2...@adobe/spacecat-shared-data-access-v1.18.0) (2024-02-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * fulfillable items support on Organization ([#160](https://github.com/adobe/spacecat-shared/issues/160)) ([7bc5bfc](https://github.com/adobe/spacecat-shared/commit/7bc5bfc596171f6007eb759c282681b29b138672))
7
+
1
8
  # [@adobe/spacecat-shared-data-access-v1.17.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.17.1...@adobe/spacecat-shared-data-access-v1.17.2) (2024-02-17)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.17.2",
3
+ "version": "1.18.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -30,6 +30,7 @@ export const OrganizationDto = {
30
30
  updatedAt: organization.getUpdatedAt(),
31
31
  GSI1PK: 'ALL_ORGANIZATIONS',
32
32
  config: Config.toDynamoItem(organization.getConfig()),
33
+ fulfillableItems: organization.getFulfillableItems(),
33
34
  }),
34
35
 
35
36
  /**
@@ -45,6 +46,7 @@ export const OrganizationDto = {
45
46
  createdAt: dynamoItem.createdAt,
46
47
  updatedAt: dynamoItem.updatedAt,
47
48
  config: dynamoItem.config,
49
+ fulfillableItems: dynamoItem.fulfillableItems,
48
50
  };
49
51
 
50
52
  return createOrganization(organizationData);
package/src/index.d.ts CHANGED
@@ -100,6 +100,10 @@ export interface Config {
100
100
 
101
101
  }
102
102
 
103
+ export interface FulfillableItems {
104
+ items: string[];
105
+ }
106
+
103
107
  /**
104
108
  * AuditConfig defines the structure for the overall audit configuration of a site.
105
109
  */
@@ -313,6 +317,12 @@ export interface Organization {
313
317
  * @returns {Config} The current audit configuration.
314
318
  */
315
319
  getConfig: () => Config;
320
+
321
+ /**
322
+ * Retrieves the fulfillable items object for the org.
323
+ * @returns {FulfillableItems} The current fulfillable items object.
324
+ */
325
+ getFulfillableItems: () => FulfillableItems;
316
326
  }
317
327
 
318
328
  export interface Configuration {
@@ -29,6 +29,7 @@ const Organization = (data = {}) => {
29
29
  self.getConfig = () => self.state.config;
30
30
  self.getName = () => self.state.name;
31
31
  self.getImsOrgId = () => self.state.imsOrgId;
32
+ self.getFulfillableItems = () => self.state.fulfillableItems;
32
33
 
33
34
  /**
34
35
  * Updates the IMS Org ID belonging to the organization.
@@ -77,6 +78,18 @@ const Organization = (data = {}) => {
77
78
 
78
79
  return self;
79
80
  };
81
+
82
+ self.updateFulfillableItems = (fulfillableItems) => {
83
+ if (!isObject(fulfillableItems)) {
84
+ throw new Error('Fulfillable items object must be provided');
85
+ }
86
+
87
+ self.state.fulfillableItems = fulfillableItems;
88
+ self.touch();
89
+
90
+ return self;
91
+ };
92
+
80
93
  return Object.freeze(self);
81
94
  };
82
95