@makefully/dutifully 1.21.0 → 1.21.2
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 +8 -0
- package/package.json +2 -2
- package/src/classes/Cheer.js +59 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 1.21.2
|
|
6
|
+
|
|
7
|
+
- Yap poll uses `/status` then download; while pending, tails `/logs` for live Cheerfully worker output.
|
|
8
|
+
|
|
9
|
+
## 1.21.1
|
|
10
|
+
|
|
11
|
+
- Bump `unzip-stream` to ^0.3.2 (fixes zip-slip arbitrary file write, GHSA-6jrj-vc65-c983).
|
|
12
|
+
|
|
5
13
|
## 1.21.0
|
|
6
14
|
|
|
7
15
|
- Add `jobExports` mirror for multi-format diff checks in LipSync and Transcription.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makefully/dutifully",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.2",
|
|
4
4
|
"description": "Client tools for Cheerfully service.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"png-chunks-encode": "^1.0.0",
|
|
74
74
|
"png-chunks-extract": "^1.0.0",
|
|
75
75
|
"sharp": "^0.35.3",
|
|
76
|
-
"unzip-stream": "^0.3.
|
|
76
|
+
"unzip-stream": "^0.3.2"
|
|
77
77
|
}
|
|
78
78
|
}
|
package/src/classes/Cheer.js
CHANGED
|
@@ -65,34 +65,80 @@ const
|
|
|
65
65
|
let response = null;
|
|
66
66
|
|
|
67
67
|
try {
|
|
68
|
-
response = await fetchStream(`${url}/${choreId}`, headers);
|
|
68
|
+
response = await fetchStream(`${url}/${choreId}/status`, headers);
|
|
69
69
|
} catch (e) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
try {
|
|
71
|
+
response = await fetchStream(`${url}/${choreId}`, headers);
|
|
72
|
+
} catch (e2) {
|
|
73
|
+
console.warn(e2);
|
|
74
|
+
setTimeout(checkStatus, 10000);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
if (response.json) {
|
|
77
|
-
if (response.json.errors) {
|
|
80
|
+
if (response.json.errors && response.json.state === 'error') {
|
|
78
81
|
const
|
|
79
82
|
list = Array.isArray(response.json.errors)
|
|
80
83
|
? response.json.errors
|
|
81
84
|
: [response.json.errors];
|
|
82
85
|
|
|
83
86
|
reject(new Error(list.join('; ')));
|
|
84
|
-
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (response.json.state === 'complete') {
|
|
91
|
+
try {
|
|
92
|
+
const zip = await fetchStream(`${url}/${choreId}`, headers);
|
|
93
|
+
|
|
94
|
+
if (zip.stream) {
|
|
95
|
+
resolve(zip.stream);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {
|
|
99
|
+
console.warn(e);
|
|
100
|
+
}
|
|
101
|
+
setTimeout(checkStatus, 5000);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (response.json.status) {
|
|
85
106
|
shareStatus(response.json.status);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
shareStatus(response.json);
|
|
89
|
-
setTimeout(checkStatus, 10000);
|
|
107
|
+
} else if (response.json.state) {
|
|
108
|
+
shareStatus(response.json.state);
|
|
90
109
|
}
|
|
91
|
-
|
|
110
|
+
|
|
111
|
+
if (response.json.state === 'pending') {
|
|
112
|
+
try {
|
|
113
|
+
const logs = await fetchStream(
|
|
114
|
+
`${url}/${choreId}/logs?after=${logAfter}`,
|
|
115
|
+
headers
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (logs.json?.lines?.length) {
|
|
119
|
+
logs.json.lines.forEach((line) => {
|
|
120
|
+
const text = line?.message || JSON.stringify(line);
|
|
121
|
+
|
|
122
|
+
if (text && text !== lastLog) {
|
|
123
|
+
console.log(text);
|
|
124
|
+
lastLog = text;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
logAfter = logs.json.after || logAfter;
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
setTimeout(checkStatus, 10000);
|
|
133
|
+
} else if (response.stream) {
|
|
92
134
|
resolve(response.stream);
|
|
135
|
+
} else {
|
|
136
|
+
setTimeout(checkStatus, 10000);
|
|
93
137
|
}
|
|
94
138
|
};
|
|
95
|
-
let lastStatus = ''
|
|
139
|
+
let lastStatus = '',
|
|
140
|
+
lastLog = '',
|
|
141
|
+
logAfter = 0;
|
|
96
142
|
|
|
97
143
|
checkStatus();
|
|
98
144
|
} else {
|