@adobe/spacecat-shared-utils 1.39.0 → 1.40.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 +14 -0
- package/package.json +4 -4
- package/src/helpers.js +1 -1
- package/src/index.d.ts +11 -0
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@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)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* expose getStaticContent function ([#809](https://github.com/adobe/spacecat-shared/issues/809)) ([33ad2ed](https://github.com/adobe/spacecat-shared/commit/33ad2ed2a01c9df4700932befd839c77c59cc504))
|
|
7
|
+
|
|
8
|
+
# [@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)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update external fixes ([#802](https://github.com/adobe/spacecat-shared/issues/802)) ([fc2cb47](https://github.com/adobe/spacecat-shared/commit/fc2cb47183948833f5b0a411ae78d1649e747a17))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.39.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.38.6...@adobe/spacecat-shared-utils-v1.39.0) (2025-06-12)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.0",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@adobe/fetch": "4.2.2",
|
|
49
|
-
"@aws-sdk/client-s3": "3.
|
|
50
|
-
"@aws-sdk/client-secrets-manager": "3.
|
|
51
|
-
"@aws-sdk/client-sqs": "3.
|
|
49
|
+
"@aws-sdk/client-s3": "3.828.0",
|
|
50
|
+
"@aws-sdk/client-secrets-manager": "3.828.0",
|
|
51
|
+
"@aws-sdk/client-sqs": "3.828.0",
|
|
52
52
|
"@json2csv/plainjs": "7.0.6",
|
|
53
53
|
"aws-xray-sdk": "3.10.3",
|
|
54
54
|
"uuid": "11.1.0"
|
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
|
@@ -155,6 +155,17 @@ declare function generateCSVFile(data: object[]): Buffer;
|
|
|
155
155
|
*/
|
|
156
156
|
declare function replacePlaceholders(content: string, placeholders: object): string;
|
|
157
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Function to support reading static file
|
|
160
|
+
* and replace placeholder strings with values.
|
|
161
|
+
*
|
|
162
|
+
* @param {Object} placeholders - A JSON object containing values to replace in the prompt content.
|
|
163
|
+
* @param {String} filename - The path of the prompt file.
|
|
164
|
+
* @returns {Promise<string|null>} - A promise that resolves to a string with the prompt content.
|
|
165
|
+
*/
|
|
166
|
+
declare function getStaticContent(placeholders: object, filename: string):
|
|
167
|
+
Promise<string | null>;
|
|
168
|
+
|
|
158
169
|
/**
|
|
159
170
|
* Reads the content of a prompt file asynchronously and replaces any placeholders
|
|
160
171
|
* with the corresponding values. Logs the error and returns null in case of an error.
|