@notifiles/sdk 1.1.17 → 1.1.18
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notifiles/sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.18",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "adoucoure",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"keywords": [],
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"@lifeomic/attempt": "^3.1.0",
|
|
53
54
|
"@microflash/remark-figure-caption": "^2.0.2",
|
|
54
55
|
"@stdlib/string-replace": "^0.2.1",
|
|
55
56
|
"axios": "^1.6.1",
|
|
@@ -3,7 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import translate from './translate.js';
|
|
4
4
|
import htmlToHast from '../../../../lib/remark/htmlToHast.js';
|
|
5
5
|
//#TODO: https://github.com/anfragment/react-email-dynamic
|
|
6
|
-
import
|
|
6
|
+
import { retry } from '@lifeomic/attempt';
|
|
7
7
|
|
|
8
8
|
export default async (props) => {
|
|
9
9
|
const { entry } = props
|
|
@@ -90,27 +90,32 @@ export default async (props) => {
|
|
|
90
90
|
subject,
|
|
91
91
|
'utf-8'
|
|
92
92
|
)
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
await retry(async (context) => {
|
|
95
96
|
await fs.promises.cp(
|
|
96
97
|
`${path}/manifest.json`,
|
|
97
98
|
buildPaths.manifestFileNameBuilt
|
|
98
99
|
)
|
|
99
100
|
return true
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
}, {
|
|
102
|
+
delay: 200,
|
|
103
|
+
maxAttempts: 3,
|
|
104
|
+
initialDelay: 0,
|
|
105
|
+
minDelay: 0,
|
|
106
|
+
maxDelay: 0,
|
|
107
|
+
factor: 0,
|
|
108
|
+
timeout: 0,
|
|
109
|
+
jitter: false,
|
|
110
|
+
initialJitter: false,
|
|
111
|
+
handleError: null,
|
|
112
|
+
handleTimeout: null,
|
|
113
|
+
beforeAttempt: null,
|
|
114
|
+
calculateDelay: null
|
|
115
|
+
});
|
|
116
|
+
} catch (err) {
|
|
117
|
+
console.log(`Attempt ${err} failed`);
|
|
104
118
|
}
|
|
105
|
-
pRetry(run, {
|
|
106
|
-
retries: 15,
|
|
107
|
-
onFailedAttempt: error => {
|
|
108
|
-
console.log(`Attempt ${error.attemptNumber} failed. There are ${error.retriesLeft} retries left.`);
|
|
109
|
-
// 1st request => Attempt 1 failed. There are 4 retries left.
|
|
110
|
-
// 2nd request => Attempt 2 failed. There are 3 retries left.
|
|
111
|
-
// …
|
|
112
|
-
},
|
|
113
|
-
})
|
|
114
119
|
|
|
115
120
|
const child = htmlToHast({ data: body })
|
|
116
121
|
const hast = await perform({
|