presidium 0.15.31 → 0.15.35
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/.github/workflows/nodejs.yml +52 -13
- package/Docker.js +1 -0
- package/DockerService.js +2 -2
- package/DynamoStream.js +2 -0
- package/DynamoTable.js +13 -0
- package/TranscribeStream.js +7 -1
- package/TranscribeStream.test.js +9 -2
- package/package.json +1 -1
|
@@ -14,24 +14,63 @@ jobs:
|
|
|
14
14
|
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
|
|
17
|
+
services:
|
|
18
|
+
dynamo:
|
|
19
|
+
image: amazon/dynamodb-local:1.15.0
|
|
20
|
+
ports:
|
|
21
|
+
- 8000:8000
|
|
22
|
+
|
|
23
|
+
registry:
|
|
24
|
+
image: registry:2.7
|
|
25
|
+
ports:
|
|
26
|
+
- 5000:5000
|
|
27
|
+
options: >-
|
|
28
|
+
--restart always
|
|
29
|
+
--name registry
|
|
30
|
+
|
|
31
|
+
mongo:
|
|
32
|
+
image: mongo:4.0.6
|
|
33
|
+
ports:
|
|
34
|
+
- 27017:27017
|
|
35
|
+
|
|
36
|
+
redis:
|
|
37
|
+
image: redis:6.0.9
|
|
38
|
+
ports:
|
|
39
|
+
- 6379:6379
|
|
40
|
+
|
|
41
|
+
elasticsearch:
|
|
42
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
|
|
43
|
+
ports:
|
|
44
|
+
- 9200:9200
|
|
45
|
+
options: >-
|
|
46
|
+
-m "512m"
|
|
47
|
+
-e "discovery.type=single-node"
|
|
48
|
+
-e "ES_JAVA_OPTS=-Xms256m -Xmx256m"
|
|
49
|
+
|
|
50
|
+
gremlin:
|
|
51
|
+
image: tinkerpop/gremlin-server:3.4.4
|
|
52
|
+
ports:
|
|
53
|
+
- 8182:8182
|
|
54
|
+
|
|
55
|
+
minio:
|
|
56
|
+
image: minio/minio:edge-cicd
|
|
57
|
+
ports:
|
|
58
|
+
- 9000:9000
|
|
59
|
+
options: >-
|
|
60
|
+
-e "MINIO_ACCESS_KEY=minioadmin"
|
|
61
|
+
-e "MINIO_SECRET_KEY=minioadmin"
|
|
62
|
+
|
|
63
|
+
kinesis:
|
|
64
|
+
image: saidsef/aws-kinesis-local:latest
|
|
65
|
+
ports:
|
|
66
|
+
- 4567:4567
|
|
67
|
+
|
|
17
68
|
strategy:
|
|
18
69
|
matrix:
|
|
19
|
-
node-version: [14.x, 15.x, 16.x]
|
|
70
|
+
node-version: [14.x, 15.x, 16.x, 17.x]
|
|
20
71
|
|
|
21
72
|
steps:
|
|
22
73
|
- uses: actions/checkout@v2
|
|
23
|
-
- name: Run containers
|
|
24
|
-
run:
|
|
25
|
-
docker run -p 8000:8000 -d amazon/dynamodb-local:1.13.5
|
|
26
|
-
&& docker run -p 5000:5000 -d --restart always --name registry registry:2.7
|
|
27
|
-
&& docker run -p 27017:27017 -d mongo:4.0.6-xenial
|
|
28
|
-
&& docker run -p 6379:6379 -d redis:6.0.9
|
|
29
|
-
&& docker run -p 9200:9200 -d -m "512m" -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms256m -Xmx256m" docker.elastic.co/elasticsearch/elasticsearch:7.1.0
|
|
30
|
-
&& docker run -p 8182:8182 -d tinkerpop/gremlin-server:3.4.4
|
|
31
|
-
&& docker run -p 9000:9000 -d -e "MINIO_ACCESS_KEY=minioadmin" -e "MINIO_SECRET_KEY=minioadmin" minio/minio:edge-cicd server /data
|
|
32
|
-
&& docker run -p 4567:4567 -d saidsef/aws-kinesis-local:latest
|
|
33
|
-
&& docker pull node:15-alpine
|
|
34
|
-
|
|
35
74
|
|
|
36
75
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
37
76
|
uses: actions/setup-node@v1
|
package/Docker.js
CHANGED
package/DockerService.js
CHANGED
|
@@ -47,7 +47,7 @@ const dockerServiceOptions = [
|
|
|
47
47
|
* name: string,
|
|
48
48
|
* image: string,
|
|
49
49
|
* replicas: 1|number,
|
|
50
|
-
* restart: 'no'|'on-failure[:<max-retries>]'|'
|
|
50
|
+
* restart: 'no'|'on-failure[:<max-retries>]'|'any',
|
|
51
51
|
* restartDelay: 10e9|number, // nanoseconds to delay between restarts
|
|
52
52
|
* logDriver: 'json-file'|'syslog'|'journald'|'gelf'|'fluentd'|'awslogs'|'splunk'|'none',
|
|
53
53
|
* logDriverOptions: Object<string>,
|
|
@@ -155,7 +155,7 @@ DockerService.prototype.synchronize = function dockerServiceSynchronize() {
|
|
|
155
155
|
*
|
|
156
156
|
* image: string,
|
|
157
157
|
* replicas: 1|number,
|
|
158
|
-
* restart: 'no'|'on-failure[:<max-retries>]'|'
|
|
158
|
+
* restart: 'no'|'on-failure[:<max-retries>]'|'any',
|
|
159
159
|
* restartDelay: 10e9|number, // nanoseconds to delay between restarts
|
|
160
160
|
* logDriver: 'json-file'|'syslog'|'journald'|'gelf'|'fluentd'|'awslogs'|'splunk'|'none',
|
|
161
161
|
* logDriverOptions: Object<string>,
|
package/DynamoStream.js
CHANGED
|
@@ -42,6 +42,8 @@ const {
|
|
|
42
42
|
* https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDBStreams.html
|
|
43
43
|
*
|
|
44
44
|
* DynamoStream -> Stream Headers -> Stream ARNs
|
|
45
|
+
*
|
|
46
|
+
* `eventName` enumeration: `INSERT`, `MODIFY`, `REMOVE`
|
|
45
47
|
*/
|
|
46
48
|
|
|
47
49
|
const DynamoStream = function (options) {
|
package/DynamoTable.js
CHANGED
|
@@ -146,6 +146,8 @@ DynamoTable.prototype.putItem = async function dynamoTablePutItem(item, options)
|
|
|
146
146
|
...options,
|
|
147
147
|
}).promise().catch(error => {
|
|
148
148
|
error.tableName = this.name
|
|
149
|
+
error.method = 'putItem'
|
|
150
|
+
error.item = item
|
|
149
151
|
throw error
|
|
150
152
|
})
|
|
151
153
|
}
|
|
@@ -172,6 +174,8 @@ DynamoTable.prototype.getItem = async function dynamoTableGetItem(key) {
|
|
|
172
174
|
return result
|
|
173
175
|
}).catch(error => {
|
|
174
176
|
error.tableName = this.name
|
|
177
|
+
error.method = 'getItem'
|
|
178
|
+
error.key = key
|
|
175
179
|
throw error
|
|
176
180
|
})
|
|
177
181
|
}
|
|
@@ -233,6 +237,9 @@ DynamoTable.prototype.updateItem = async function dynamoTableUpdateItem(
|
|
|
233
237
|
...options,
|
|
234
238
|
}).promise().catch(error => {
|
|
235
239
|
error.tableName = this.name
|
|
240
|
+
error.method = 'updateItem'
|
|
241
|
+
error.key = key
|
|
242
|
+
error.updates = updates
|
|
236
243
|
throw error
|
|
237
244
|
})
|
|
238
245
|
}
|
|
@@ -276,6 +283,9 @@ DynamoTable.prototype.incrementItem = async function incrementItem(
|
|
|
276
283
|
...options,
|
|
277
284
|
}).promise().catch(error => {
|
|
278
285
|
error.tableName = this.name
|
|
286
|
+
error.method = 'incrementItem'
|
|
287
|
+
error.key = key
|
|
288
|
+
error.incrementUpdates = incrementUpdates
|
|
279
289
|
throw error
|
|
280
290
|
})
|
|
281
291
|
}
|
|
@@ -303,6 +313,8 @@ DynamoTable.prototype.deleteItem = async function dynamoTableDeleteItem(key, opt
|
|
|
303
313
|
...options,
|
|
304
314
|
}).promise().catch(error => {
|
|
305
315
|
error.tableName = this.name
|
|
316
|
+
error.method = 'deleteItem'
|
|
317
|
+
error.key = key
|
|
306
318
|
throw error
|
|
307
319
|
})
|
|
308
320
|
}
|
|
@@ -335,6 +347,7 @@ DynamoTable.prototype.scan = async function scan(options = {}) {
|
|
|
335
347
|
},
|
|
336
348
|
}).promise().catch(error => {
|
|
337
349
|
error.tableName = this.name
|
|
350
|
+
error.method = 'scan'
|
|
338
351
|
throw error
|
|
339
352
|
})
|
|
340
353
|
}
|
package/TranscribeStream.js
CHANGED
|
@@ -115,7 +115,12 @@ const TranscribeStream = function (options) {
|
|
|
115
115
|
})
|
|
116
116
|
this.websocket.on('message', chunk => {
|
|
117
117
|
const { headers, body } = unmarshalMessage(chunk)
|
|
118
|
-
if (
|
|
118
|
+
if (headers[':message-type'] == 'exception') {
|
|
119
|
+
const error = new Error(body.Message)
|
|
120
|
+
error.name = headers[':exception-type']
|
|
121
|
+
this.emit('error', error)
|
|
122
|
+
}
|
|
123
|
+
else if (body.Transcript.Results.length > 0) {
|
|
119
124
|
if (body.Transcript.Results[0].IsPartial) {
|
|
120
125
|
this.emit('partialTranscription', body.Transcript.Results[0])
|
|
121
126
|
} else {
|
|
@@ -179,6 +184,7 @@ TranscribeStream.prototype.sendAudioChunk = function (chunk) {
|
|
|
179
184
|
|
|
180
185
|
TranscribeStream.prototype.close = function () {
|
|
181
186
|
this.websocket.close()
|
|
187
|
+
this.emit('close')
|
|
182
188
|
}
|
|
183
189
|
|
|
184
190
|
/**
|
package/TranscribeStream.test.js
CHANGED
|
@@ -52,8 +52,6 @@ const test = new Test('TranscribeStream', async function () {
|
|
|
52
52
|
wav.fromScratch(1, 8000, '8', Buffer.from(event.media.payload, 'base64'))
|
|
53
53
|
wav.fromMuLaw()
|
|
54
54
|
testTranscribeStream.sendAudioChunk(Buffer.from(wav.data.samples))
|
|
55
|
-
} else if (event.event == 'stop') {
|
|
56
|
-
testTranscribeStream.close()
|
|
57
55
|
}
|
|
58
56
|
})
|
|
59
57
|
|
|
@@ -64,6 +62,15 @@ const test = new Test('TranscribeStream', async function () {
|
|
|
64
62
|
})
|
|
65
63
|
assert.equal(testTranscription, 'Hello, world.')
|
|
66
64
|
|
|
65
|
+
// wait for timeout error to test error handling
|
|
66
|
+
await new Promise(resolve => {
|
|
67
|
+
testTranscribeStream.on('error', error => {
|
|
68
|
+
console.error(error)
|
|
69
|
+
testTranscribeStream.close()
|
|
70
|
+
resolve()
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
|
|
67
74
|
/*
|
|
68
75
|
// fill media-stream-fixture-aws-keynote.txt
|
|
69
76
|
const Twilio = require('@claimyr_hq/twilio/Twilio')
|