@adobe/spacecat-shared-utils 1.39.1 → 1.41.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,17 @@
1
+ # [@adobe/spacecat-shared-utils-v1.41.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.40.0...@adobe/spacecat-shared-utils-v1.41.0) (2025-06-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * introduce findByPreviewURL in site collection ([#773](https://github.com/adobe/spacecat-shared/issues/773)) ([3b7c092](https://github.com/adobe/spacecat-shared/commit/3b7c0925ce66bcb8d38db3e05cc04fefd0cac229))
7
+
8
+ # [@adobe/spacecat-shared-utils-v1.40.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.39.1...@adobe/spacecat-shared-utils-v1.40.0) (2025-06-18)
9
+
10
+
11
+ ### Features
12
+
13
+ * expose getStaticContent function ([#809](https://github.com/adobe/spacecat-shared/issues/809)) ([33ad2ed](https://github.com/adobe/spacecat-shared/commit/33ad2ed2a01c9df4700932befd839c77c59cc504))
14
+
1
15
  # [@adobe/spacecat-shared-utils-v1.39.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.39.0...@adobe/spacecat-shared-utils-v1.39.1) (2025-06-14)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-utils",
3
- "version": "1.39.1",
3
+ "version": "1.41.0",
4
4
  "description": "Shared modules of the Spacecat Services - utils",
5
5
  "type": "module",
6
6
  "engines": {
package/src/helpers.js CHANGED
@@ -95,7 +95,7 @@ export function replacePlaceholders(content, placeholders) {
95
95
  * @param {String} filename - The path of the prompt file.
96
96
  * @returns {Promise<string|null>} - A promise that resolves to a string with the prompt content.
97
97
  */
98
- async function getStaticContent(placeholders, filename) {
98
+ export async function getStaticContent(placeholders, filename) {
99
99
  const fileContent = await fs.readFile(filename, { encoding: 'utf8' });
100
100
  return replacePlaceholders(fileContent, placeholders);
101
101
  }
package/src/index.d.ts CHANGED
@@ -43,6 +43,8 @@ export function toBoolean(value: unknown): boolean;
43
43
 
44
44
  export function isValidUrl(urlString: string): boolean;
45
45
 
46
+ export function isValidHelixPreviewUrl(urlString: string): boolean;
47
+
46
48
  export function isValidUUID(uuid: string): boolean;
47
49
 
48
50
  export function isValidIMSOrgId(imsOrgId: string): boolean;
@@ -155,6 +157,17 @@ declare function generateCSVFile(data: object[]): Buffer;
155
157
  */
156
158
  declare function replacePlaceholders(content: string, placeholders: object): string;
157
159
 
160
+ /**
161
+ * Function to support reading static file
162
+ * and replace placeholder strings with values.
163
+ *
164
+ * @param {Object} placeholders - A JSON object containing values to replace in the prompt content.
165
+ * @param {String} filename - The path of the prompt file.
166
+ * @returns {Promise<string|null>} - A promise that resolves to a string with the prompt content.
167
+ */
168
+ declare function getStaticContent(placeholders: object, filename: string):
169
+ Promise<string | null>;
170
+
158
171
  /**
159
172
  * Reads the content of a prompt file asynchronously and replaces any placeholders
160
173
  * with the corresponding values. Logs the error and returns null in case of an error.
package/src/index.js CHANGED
@@ -38,6 +38,7 @@ export {
38
38
  resolveCustomerSecretsName,
39
39
  generateCSVFile,
40
40
  replacePlaceholders,
41
+ getStaticContent,
41
42
  getPrompt,
42
43
  getQuery,
43
44
  } from './helpers.js';