typespeed 2.0.21 → 2.0.23
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/dist/core.decorator.js +1 -30
- package/dist/default/default-authentication.class.js +25 -0
- package/dist/default/express-server.class.js +11 -4
- package/dist/default/log-default.class.js +0 -6
- package/dist/factory/authentication-factory.class.js +11 -0
- package/dist/factory/log-factory.class.js +9 -0
- package/dist/route.decorator.js +92 -2
- package/dist/typespeed.d.ts +40 -3
- package/dist/typespeed.js +3 -1
- package/package.json +1 -1
- package/src/core.decorator.ts +1 -29
- package/src/default/default-authentication.class.ts +10 -0
- package/src/default/express-server.class.ts +12 -5
- package/src/default/log-default.class.ts +0 -10
- package/src/factory/authentication-factory.class.ts +9 -0
- package/src/factory/log-factory.class.ts +9 -2
- package/src/route.decorator.ts +91 -3
- package/src/typespeed.d.ts +40 -3
- package/src/typespeed.ts +1 -0
- package/test/node_modules/.package-lock.json +65 -101
- package/test/node_modules/@types/body-parser/LICENSE +21 -0
- package/test/node_modules/@types/body-parser/README.md +16 -0
- package/test/node_modules/@types/body-parser/index.d.ts +107 -0
- package/test/node_modules/@types/body-parser/package.json +58 -0
- package/test/node_modules/@types/connect/LICENSE +21 -0
- package/test/node_modules/@types/connect/README.md +16 -0
- package/test/node_modules/@types/connect/index.d.ts +93 -0
- package/test/node_modules/@types/connect/package.json +32 -0
- package/test/node_modules/@types/express/LICENSE +21 -0
- package/test/node_modules/@types/express/README.md +16 -0
- package/test/node_modules/@types/express/index.d.ts +136 -0
- package/test/node_modules/@types/express/package.json +45 -0
- package/test/node_modules/@types/express-serve-static-core/LICENSE +21 -0
- package/test/node_modules/@types/express-serve-static-core/README.md +16 -0
- package/test/node_modules/@types/express-serve-static-core/index.d.ts +1281 -0
- package/test/node_modules/@types/express-serve-static-core/package.json +55 -0
- package/test/node_modules/@types/mime/LICENSE +21 -0
- package/test/node_modules/@types/mime/Mime.d.ts +10 -0
- package/test/node_modules/@types/mime/README.md +16 -0
- package/test/node_modules/@types/mime/index.d.ts +35 -0
- package/test/node_modules/@types/mime/lite.d.ts +7 -0
- package/test/node_modules/@types/mime/package.json +29 -0
- package/test/node_modules/@types/qs/LICENSE +21 -0
- package/test/node_modules/@types/qs/README.md +16 -0
- package/test/node_modules/@types/qs/index.d.ts +62 -0
- package/test/node_modules/@types/qs/package.json +65 -0
- package/test/node_modules/@types/range-parser/LICENSE +21 -0
- package/test/node_modules/@types/range-parser/README.md +55 -0
- package/test/node_modules/@types/range-parser/index.d.ts +35 -0
- package/test/node_modules/@types/range-parser/package.json +25 -0
- package/test/node_modules/@types/send/LICENSE +21 -0
- package/test/node_modules/@types/send/README.md +16 -0
- package/test/node_modules/@types/send/index.d.ts +231 -0
- package/test/node_modules/@types/send/package.json +33 -0
- package/test/node_modules/@types/serve-static/LICENSE +21 -0
- package/test/node_modules/@types/serve-static/README.md +16 -0
- package/test/node_modules/@types/serve-static/index.d.ts +113 -0
- package/test/node_modules/@types/serve-static/package.json +38 -0
- package/test/src/config.json +5 -0
- package/test/src/custom-log.class.ts +6 -0
- package/test/src/jwt-authentication.class.ts +29 -0
- package/test/src/test-request.class.ts +36 -0
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-ci.yml +0 -17
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-publish.yml +0 -30
- package/test/node_modules/@acuminous/bitsyntax/LICENSE +0 -6
- package/test/node_modules/@acuminous/bitsyntax/LICENSE-MIT +0 -21
- package/test/node_modules/@acuminous/bitsyntax/Makefile +0 -15
- package/test/node_modules/@acuminous/bitsyntax/README.md +0 -308
- package/test/node_modules/@acuminous/bitsyntax/index.js +0 -10
- package/test/node_modules/@acuminous/bitsyntax/lib/compile.js +0 -303
- package/test/node_modules/@acuminous/bitsyntax/lib/constructor.js +0 -142
- package/test/node_modules/@acuminous/bitsyntax/lib/grammar.pegjs +0 -67
- package/test/node_modules/@acuminous/bitsyntax/lib/interp.js +0 -232
- package/test/node_modules/@acuminous/bitsyntax/lib/parse.js +0 -32
- package/test/node_modules/@acuminous/bitsyntax/lib/parser.js +0 -1173
- package/test/node_modules/@acuminous/bitsyntax/lib/pattern.js +0 -119
- package/test/node_modules/@acuminous/bitsyntax/package.json +0 -36
- package/test/node_modules/@acuminous/bitsyntax/test/consing.test.js +0 -50
- package/test/node_modules/@acuminous/bitsyntax/test/matching.test.js +0 -193
- package/test/node_modules/amqplib/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/test/node_modules/amqplib/.github/workflows/test.yml +0 -38
- package/test/node_modules/amqplib/CHANGELOG.md +0 -430
- package/test/node_modules/amqplib/LICENSE +0 -6
- package/test/node_modules/amqplib/LICENSE-MIT +0 -21
- package/test/node_modules/amqplib/Makefile +0 -47
- package/test/node_modules/amqplib/README.md +0 -157
- package/test/node_modules/amqplib/bin/generate-defs.js +0 -722
- package/test/node_modules/amqplib/callback_api.js +0 -22
- package/test/node_modules/amqplib/channel_api.js +0 -16
- package/test/node_modules/amqplib/examples/headers.js +0 -42
- package/test/node_modules/amqplib/examples/receive_generator.js +0 -39
- package/test/node_modules/amqplib/examples/send_generators.js +0 -42
- package/test/node_modules/amqplib/examples/ssl.js +0 -64
- package/test/node_modules/amqplib/examples/tutorials/README.md +0 -93
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log.js +0 -28
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_direct.js +0 -30
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_topic.js +0 -27
- package/test/node_modules/amqplib/examples/tutorials/callback_api/new_task.js +0 -27
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive.js +0 -30
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs.js +0 -36
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_direct.js +0 -56
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_topic.js +0 -55
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_client.js +0 -49
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_server.js +0 -45
- package/test/node_modules/amqplib/examples/tutorials/callback_api/send.js +0 -29
- package/test/node_modules/amqplib/examples/tutorials/callback_api/worker.js +0 -35
- package/test/node_modules/amqplib/examples/tutorials/emit_log.js +0 -19
- package/test/node_modules/amqplib/examples/tutorials/emit_log_direct.js +0 -20
- package/test/node_modules/amqplib/examples/tutorials/emit_log_topic.js +0 -19
- package/test/node_modules/amqplib/examples/tutorials/new_task.js +0 -18
- package/test/node_modules/amqplib/examples/tutorials/package.json +0 -16
- package/test/node_modules/amqplib/examples/tutorials/receive.js +0 -21
- package/test/node_modules/amqplib/examples/tutorials/receive_logs.js +0 -28
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_direct.js +0 -44
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_topic.js +0 -43
- package/test/node_modules/amqplib/examples/tutorials/rpc_client.js +0 -52
- package/test/node_modules/amqplib/examples/tutorials/rpc_server.js +0 -39
- package/test/node_modules/amqplib/examples/tutorials/send.js +0 -23
- package/test/node_modules/amqplib/examples/tutorials/worker.js +0 -28
- package/test/node_modules/amqplib/examples/waitForConfirms.js +0 -22
- package/test/node_modules/amqplib/lib/api_args.js +0 -314
- package/test/node_modules/amqplib/lib/bitset.js +0 -130
- package/test/node_modules/amqplib/lib/callback_model.js +0 -327
- package/test/node_modules/amqplib/lib/channel.js +0 -499
- package/test/node_modules/amqplib/lib/channel_model.js +0 -302
- package/test/node_modules/amqplib/lib/codec.js +0 -321
- package/test/node_modules/amqplib/lib/connect.js +0 -189
- package/test/node_modules/amqplib/lib/connection.js +0 -663
- package/test/node_modules/amqplib/lib/credentials.js +0 -42
- package/test/node_modules/amqplib/lib/defs.js +0 -4966
- package/test/node_modules/amqplib/lib/error.js +0 -24
- package/test/node_modules/amqplib/lib/format.js +0 -40
- package/test/node_modules/amqplib/lib/frame.js +0 -113
- package/test/node_modules/amqplib/lib/heartbeat.js +0 -89
- package/test/node_modules/amqplib/lib/mux.js +0 -129
- package/test/node_modules/amqplib/package.json +0 -37
- package/test/node_modules/amqplib/test/bitset.js +0 -69
- package/test/node_modules/amqplib/test/callback_api.js +0 -312
- package/test/node_modules/amqplib/test/channel.js +0 -621
- package/test/node_modules/amqplib/test/channel_api.js +0 -596
- package/test/node_modules/amqplib/test/codec.js +0 -237
- package/test/node_modules/amqplib/test/connect.js +0 -197
- package/test/node_modules/amqplib/test/connection.js +0 -390
- package/test/node_modules/amqplib/test/data.js +0 -254
- package/test/node_modules/amqplib/test/frame.js +0 -198
- package/test/node_modules/amqplib/test/mux.js +0 -204
- package/test/node_modules/amqplib/test/util.js +0 -219
- package/test/node_modules/buffer-more-ints/.travis.yml +0 -6
- package/test/node_modules/buffer-more-ints/LICENSE +0 -19
- package/test/node_modules/buffer-more-ints/README.md +0 -69
- package/test/node_modules/buffer-more-ints/buffer-more-ints-tests.js +0 -183
- package/test/node_modules/buffer-more-ints/buffer-more-ints.js +0 -432
- package/test/node_modules/buffer-more-ints/package.json +0 -19
- package/test/node_modules/buffer-more-ints/polyfill.js +0 -71
- package/test/node_modules/core-util-is/LICENSE +0 -19
- package/test/node_modules/core-util-is/README.md +0 -3
- package/test/node_modules/core-util-is/lib/util.js +0 -107
- package/test/node_modules/core-util-is/package.json +0 -38
- package/test/node_modules/debug/LICENSE +0 -20
- package/test/node_modules/debug/README.md +0 -481
- package/test/node_modules/debug/package.json +0 -59
- package/test/node_modules/debug/src/browser.js +0 -269
- package/test/node_modules/debug/src/common.js +0 -274
- package/test/node_modules/debug/src/index.js +0 -10
- package/test/node_modules/debug/src/node.js +0 -263
- package/test/node_modules/inherits/LICENSE +0 -16
- package/test/node_modules/inherits/README.md +0 -42
- package/test/node_modules/inherits/inherits.js +0 -9
- package/test/node_modules/inherits/inherits_browser.js +0 -27
- package/test/node_modules/inherits/package.json +0 -29
- package/test/node_modules/isarray/README.md +0 -54
- package/test/node_modules/isarray/build/build.js +0 -209
- package/test/node_modules/isarray/component.json +0 -19
- package/test/node_modules/isarray/index.js +0 -3
- package/test/node_modules/isarray/package.json +0 -25
- package/test/node_modules/ms/index.js +0 -162
- package/test/node_modules/ms/license.md +0 -21
- package/test/node_modules/ms/package.json +0 -37
- package/test/node_modules/ms/readme.md +0 -60
- package/test/node_modules/querystringify/LICENSE +0 -22
- package/test/node_modules/querystringify/README.md +0 -61
- package/test/node_modules/querystringify/index.js +0 -118
- package/test/node_modules/querystringify/package.json +0 -38
- package/test/node_modules/readable-stream/LICENSE +0 -18
- package/test/node_modules/readable-stream/README.md +0 -15
- package/test/node_modules/readable-stream/duplex.js +0 -1
- package/test/node_modules/readable-stream/float.patch +0 -923
- package/test/node_modules/readable-stream/lib/_stream_duplex.js +0 -89
- package/test/node_modules/readable-stream/lib/_stream_passthrough.js +0 -46
- package/test/node_modules/readable-stream/lib/_stream_readable.js +0 -951
- package/test/node_modules/readable-stream/lib/_stream_transform.js +0 -209
- package/test/node_modules/readable-stream/lib/_stream_writable.js +0 -477
- package/test/node_modules/readable-stream/package.json +0 -32
- package/test/node_modules/readable-stream/passthrough.js +0 -1
- package/test/node_modules/readable-stream/readable.js +0 -10
- package/test/node_modules/readable-stream/transform.js +0 -1
- package/test/node_modules/readable-stream/writable.js +0 -1
- package/test/node_modules/requires-port/.travis.yml +0 -19
- package/test/node_modules/requires-port/LICENSE +0 -22
- package/test/node_modules/requires-port/README.md +0 -47
- package/test/node_modules/requires-port/index.js +0 -38
- package/test/node_modules/requires-port/package.json +0 -47
- package/test/node_modules/requires-port/test.js +0 -98
- package/test/node_modules/safe-buffer/LICENSE +0 -21
- package/test/node_modules/safe-buffer/README.md +0 -584
- package/test/node_modules/safe-buffer/index.d.ts +0 -187
- package/test/node_modules/safe-buffer/index.js +0 -62
- package/test/node_modules/safe-buffer/package.json +0 -37
- package/test/node_modules/string_decoder/LICENSE +0 -20
- package/test/node_modules/string_decoder/README.md +0 -7
- package/test/node_modules/string_decoder/index.js +0 -221
- package/test/node_modules/string_decoder/package.json +0 -25
- package/test/node_modules/url-parse/LICENSE +0 -22
- package/test/node_modules/url-parse/README.md +0 -153
- package/test/node_modules/url-parse/dist/url-parse.js +0 -755
- package/test/node_modules/url-parse/dist/url-parse.min.js +0 -1
- package/test/node_modules/url-parse/dist/url-parse.min.js.map +0 -1
- package/test/node_modules/url-parse/index.js +0 -589
- package/test/node_modules/url-parse/package.json +0 -49
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// -*- js-indent-level: 2 -*-
|
|
2
|
-
// Constructing patterns
|
|
3
|
-
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
function set(values) {
|
|
7
|
-
var s = {};
|
|
8
|
-
for (var i in values) {
|
|
9
|
-
if (!Object.prototype.hasOwnProperty.call(values, i)) continue;
|
|
10
|
-
s[values[i]] = 1;
|
|
11
|
-
}
|
|
12
|
-
return s;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Construct a segment bound to a variable, e.g., from a segment like
|
|
16
|
-
// "Len:32/unsigned-big". `specifiers0` is an array.
|
|
17
|
-
function variable(name, size, specifiers0) {
|
|
18
|
-
var specifiers = set(specifiers0);
|
|
19
|
-
var segment = {name: name};
|
|
20
|
-
segment.type = type_in(specifiers);
|
|
21
|
-
specs(segment, segment.type, specifiers);
|
|
22
|
-
segment.size = size_of(segment, segment.type, size, segment.unit);
|
|
23
|
-
return segment;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports.variable = variable;
|
|
27
|
-
module.exports.rest = function() {
|
|
28
|
-
return variable('_', true, ['binary']);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Construct a segment with a literal value, e.g., from a segment like
|
|
32
|
-
// "206". `specifiers0` is an array.
|
|
33
|
-
|
|
34
|
-
function value(val, size, specifiers0) {
|
|
35
|
-
var specifiers = set(specifiers0);
|
|
36
|
-
var segment = {value: val};
|
|
37
|
-
segment.type = type_in(specifiers);
|
|
38
|
-
// TODO check type v. value ..
|
|
39
|
-
specs(segment, segment.type, specifiers);
|
|
40
|
-
segment.size = size_of(segment, segment.type, size, segment.unit);
|
|
41
|
-
return segment;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
module.exports.value = value;
|
|
45
|
-
|
|
46
|
-
// A string can appear as a literal, but it must appear without
|
|
47
|
-
// specifiers.
|
|
48
|
-
function string(val) {
|
|
49
|
-
return {value: val, type: 'string'};
|
|
50
|
-
}
|
|
51
|
-
module.exports.string = string;
|
|
52
|
-
|
|
53
|
-
var TYPES = {'integer': 1, 'binary': 1, 'float': 1};
|
|
54
|
-
function type_in(specifiers) {
|
|
55
|
-
for (var t in specifiers) {
|
|
56
|
-
if (!Object.prototype.hasOwnProperty.call(specifiers, t)) continue;
|
|
57
|
-
if (TYPES[t]) { return t; }
|
|
58
|
-
}
|
|
59
|
-
return 'integer';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function specs(segment, type, specifiers) {
|
|
63
|
-
switch (type) {
|
|
64
|
-
case 'integer':
|
|
65
|
-
segment.signed = signed_in(specifiers);
|
|
66
|
-
// fall through
|
|
67
|
-
case 'float':
|
|
68
|
-
segment.bigendian = endian_in(specifiers);
|
|
69
|
-
// fall through
|
|
70
|
-
default:
|
|
71
|
-
segment.unit = unit_in(specifiers, segment.type);
|
|
72
|
-
}
|
|
73
|
-
return segment;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function endian_in(specifiers) {
|
|
77
|
-
// default is big, but I have chosen true = bigendian
|
|
78
|
-
return !specifiers['little'];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function signed_in(specifiers) {
|
|
82
|
-
// this time I got it right; default is unsigned
|
|
83
|
-
return specifiers['signed'];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function unit_in(specifiers, type) {
|
|
87
|
-
for (var s in specifiers) {
|
|
88
|
-
if (!Object.prototype.hasOwnProperty.call(specifiers, s)) continue;
|
|
89
|
-
if (s.substr(0, 5) == 'unit:') {
|
|
90
|
-
var unit = parseInt(s.substr(5));
|
|
91
|
-
// TODO check sane for type
|
|
92
|
-
return unit;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// OK defaults then
|
|
96
|
-
switch (type) {
|
|
97
|
-
case 'binary':
|
|
98
|
-
return 8;
|
|
99
|
-
case 'integer':
|
|
100
|
-
case 'float':
|
|
101
|
-
return 1;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function size_of(segment, type, size, unit) {
|
|
106
|
-
if (size !== undefined && size !== '') {
|
|
107
|
-
return size;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
switch (type) {
|
|
111
|
-
case 'integer':
|
|
112
|
-
return 8;
|
|
113
|
-
case 'float':
|
|
114
|
-
return 64;
|
|
115
|
-
case 'binary':
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "Michael Bridgen <mikeb@squaremobius.net>",
|
|
3
|
-
"name": "@acuminous/bitsyntax",
|
|
4
|
-
"description": "Pattern-matching on byte buffers",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"version": "0.1.2",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git://github.com/acuminous/bitsyntax-js.git"
|
|
10
|
-
},
|
|
11
|
-
"main": "./index",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "make test",
|
|
14
|
-
"prepublish": "make all"
|
|
15
|
-
},
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=0.8"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"buffer-more-ints": "~1.0.0",
|
|
21
|
-
"debug": "^4.3.4",
|
|
22
|
-
"safe-buffer": "~5.1.2"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"pegjs": "^0.7.0",
|
|
26
|
-
"zunit": "^3.2.1"
|
|
27
|
-
},
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/acuminous/bitsyntax-js/issues"
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://github.com/acuminous/bitsyntax-js#readme",
|
|
32
|
-
"directories": {
|
|
33
|
-
"lib": "lib",
|
|
34
|
-
"test": "test"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var syntax = require('zunit').syntax;
|
|
2
|
-
var assert = require('assert');
|
|
3
|
-
var parse = require('..').parse;
|
|
4
|
-
var build = require('..').build;
|
|
5
|
-
var builder = require('..').builder;
|
|
6
|
-
var write = require('..').write;
|
|
7
|
-
|
|
8
|
-
var Buffer = require('safe-buffer').Buffer;
|
|
9
|
-
var suite = syntax.describe;
|
|
10
|
-
var test = syntax.it;
|
|
11
|
-
|
|
12
|
-
TEST_CASES = [
|
|
13
|
-
['n:8', {n:255}, [255]],
|
|
14
|
-
['n:16', {n: 0xf0f0}, [240, 240]],
|
|
15
|
-
['n:32', {n: 0x12345678}, [18,52,86,120]],
|
|
16
|
-
['n:64', {n: 0xffffffffffffffff}, [255,255,255,255,255,255,255,255]],
|
|
17
|
-
|
|
18
|
-
['n:8, s/binary', {n: 255, s: Buffer.from("foobar")}, [255, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]],
|
|
19
|
-
['n:8, "foobar", m:8', {n: 255, m:0}, [255, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, 0]],
|
|
20
|
-
['n:8, s:n/binary', {n:6, s: Buffer.from('foobar')}, [6, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]],
|
|
21
|
-
['n:8, s:n/binary', {n:4, s: Buffer.from('foobar')}, [4, 0x66, 0x6f, 0x6f, 0x62]],
|
|
22
|
-
['n:size', {n:4, size:8}, [4]],
|
|
23
|
-
['206:n/unit:8', {n:1}, [206]]
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
function bufferToArray(buf) {
|
|
27
|
-
return Array.prototype.slice.call(buf);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
suite("Construction", function() {
|
|
31
|
-
TEST_CASES.forEach(function(c) {
|
|
32
|
-
var p = parse(c[0]);
|
|
33
|
-
test(c[0], function() {
|
|
34
|
-
assert.deepEqual(c[2], bufferToArray(build(p, c[1])));
|
|
35
|
-
});
|
|
36
|
-
test(c[0], function() {
|
|
37
|
-
var buf = Buffer.alloc(1024);
|
|
38
|
-
var end = write(buf, 7, p, c[1]);
|
|
39
|
-
buf = buf.slice(7, end);
|
|
40
|
-
assert.deepEqual(c[2], bufferToArray(buf));
|
|
41
|
-
});
|
|
42
|
-
test(c[0], function() {
|
|
43
|
-
var cons = builder(c[0]);
|
|
44
|
-
var buf = cons(c[1]);
|
|
45
|
-
assert.deepEqual(c[2], bufferToArray(buf));
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
});
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
var syntax = require('zunit').syntax;
|
|
2
|
-
var match = require('..').match;
|
|
3
|
-
var parse = require('..').parse;
|
|
4
|
-
var compile = require('..').matcher;
|
|
5
|
-
var assert = require('assert');
|
|
6
|
-
|
|
7
|
-
var Buffer = require('safe-buffer').Buffer;
|
|
8
|
-
var suite = syntax.describe;
|
|
9
|
-
var test = syntax.it;
|
|
10
|
-
|
|
11
|
-
Object.prototype.AMQPLIB_ISSUE_453 = 123123123
|
|
12
|
-
|
|
13
|
-
var INT_TESTS = [
|
|
14
|
-
['n:8',
|
|
15
|
-
[[[255], 255]]],
|
|
16
|
-
['n:8/signed',
|
|
17
|
-
[[[255], -1]]],
|
|
18
|
-
['n:1/unit:8',
|
|
19
|
-
[[[129], 129]]],
|
|
20
|
-
['n:1/unit:8-signed',
|
|
21
|
-
[[[129], -127]]],
|
|
22
|
-
|
|
23
|
-
['n:16',
|
|
24
|
-
[[[1, 255], 511]]],
|
|
25
|
-
['n:16/signed',
|
|
26
|
-
[[[255, 65], -191]]],
|
|
27
|
-
['n:16/little',
|
|
28
|
-
[[[255, 1], 511]]],
|
|
29
|
-
['n:16/signed-little',
|
|
30
|
-
[[[65, 255], -191]]],
|
|
31
|
-
|
|
32
|
-
['n:32',
|
|
33
|
-
[[[45, 23, 97, 102], 756506982]]],
|
|
34
|
-
['n:32/signed',
|
|
35
|
-
[[[245, 23, 97, 102], -183017114]]],
|
|
36
|
-
['n:32/little',
|
|
37
|
-
[[[245, 23, 97, 102], 1717639157]]],
|
|
38
|
-
['n:32/signed-little',
|
|
39
|
-
[[[245, 23, 97, 129], -2124343307]]],
|
|
40
|
-
|
|
41
|
-
['n:4/signed-little-unit:8',
|
|
42
|
-
[[[245, 23, 97, 129], -2124343307]]],
|
|
43
|
-
|
|
44
|
-
['n:64',
|
|
45
|
-
[[[1,2,3,4,5,6,7,8], 72623859790382856]]],
|
|
46
|
-
['n:64/signed',
|
|
47
|
-
[[[255,2,3,4,5,6,7,8], -71491328285473016]]],
|
|
48
|
-
['n:64/little',
|
|
49
|
-
[[[1,2,3,4,5,6,7,8], 578437695752307201]]],
|
|
50
|
-
['n:64/little-signed',
|
|
51
|
-
[[[1,2,3,4,5,6,7,255], -70080650589044223]]],
|
|
52
|
-
['n:8/signed-unit:8-little',
|
|
53
|
-
[[[1,2,3,4,5,6,7,255], -70080650589044223]]],
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
suite("Integer",
|
|
57
|
-
function() {
|
|
58
|
-
|
|
59
|
-
INT_TESTS.forEach(function(p) {
|
|
60
|
-
var pattern = parse(p[0]);
|
|
61
|
-
var cpattern = compile(p[0]);
|
|
62
|
-
p[1].forEach(function(tc) {
|
|
63
|
-
test(p[0], function() {
|
|
64
|
-
assert.deepEqual({n: tc[1]}, match(pattern, Buffer.from(tc[0])));
|
|
65
|
-
});
|
|
66
|
-
test(p[0], function() {
|
|
67
|
-
assert.deepEqual({n: tc[1]}, cpattern(Buffer.from(tc[0])));
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// test cases largely constructed in Erlang using e.g.,
|
|
75
|
-
// Pi = math:pi(), <<Pi:32/float>>.
|
|
76
|
-
FLOAT_TESTS = [
|
|
77
|
-
['n:32/float',
|
|
78
|
-
[[[64,73,15,219], Math.PI],
|
|
79
|
-
[[0, 0, 0, 0], 0.0 ]]],
|
|
80
|
-
|
|
81
|
-
['n:64/float',
|
|
82
|
-
[[[64,9,33,251,84,68,45,24], Math.PI],
|
|
83
|
-
[[0, 0, 0, 0, 0, 0, 0, 0], 0.0]]],
|
|
84
|
-
|
|
85
|
-
['n:32/float-little',
|
|
86
|
-
[[[219, 15, 73, 64], Math.PI],
|
|
87
|
-
[[0, 0, 0, 0], 0.0]]],
|
|
88
|
-
|
|
89
|
-
['n:64/float-little',
|
|
90
|
-
[[[24, 45, 68, 84, 251, 33, 9, 64], Math.PI],
|
|
91
|
-
[[0, 0, 0, 0, 0, 0, 0, 0], 0.0]]],
|
|
92
|
-
|
|
93
|
-
['n:4/float-unit:8',
|
|
94
|
-
[[[64,73,15,219], Math.PI],
|
|
95
|
-
[[0, 0, 0, 0], 0.0]]]
|
|
96
|
-
];
|
|
97
|
-
|
|
98
|
-
suite("Float",
|
|
99
|
-
function() {
|
|
100
|
-
var precision = 0.00001;
|
|
101
|
-
FLOAT_TESTS.forEach(function(p) {
|
|
102
|
-
var pattern = parse(p[0]);
|
|
103
|
-
var cpattern = compile(p[0]);
|
|
104
|
-
p[1].forEach(function(tc) {
|
|
105
|
-
test(p[0], function() {
|
|
106
|
-
var m = match(pattern, Buffer.from(tc[0]));
|
|
107
|
-
assert.ok(m.n !== undefined);
|
|
108
|
-
assert.ok(Math.abs(tc[1] - m.n) < precision);
|
|
109
|
-
});
|
|
110
|
-
test(p[0], function() {
|
|
111
|
-
var m = cpattern(Buffer.from(tc[0]));
|
|
112
|
-
assert.ok(m.n !== undefined);
|
|
113
|
-
assert.ok(Math.abs(tc[1] - m.n) < precision);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
BINARY_TESTS = [
|
|
120
|
-
['n:0/unit:8-binary', []],
|
|
121
|
-
['n:1/unit:8-binary', [93]],
|
|
122
|
-
['n:5/unit:8-binary', [1, 2, 3, 4, 5]],
|
|
123
|
-
['n:32/unit:1-binary', [255, 254, 253, 252]]
|
|
124
|
-
];
|
|
125
|
-
|
|
126
|
-
suite("Binary",
|
|
127
|
-
function() {
|
|
128
|
-
BINARY_TESTS.forEach(function(p) {
|
|
129
|
-
var pattern = parse(p[0]);
|
|
130
|
-
var cpattern = compile(p[0]);
|
|
131
|
-
var prest = p[0] + ', _/binary';
|
|
132
|
-
var patternrest = parse(prest);
|
|
133
|
-
var cpatternrest = compile(prest);
|
|
134
|
-
test(p[0], function() {
|
|
135
|
-
assert.deepEqual({n: Buffer.from(p[1])},
|
|
136
|
-
match(pattern, Buffer.from(p[1])));
|
|
137
|
-
assert.deepEqual({n: Buffer.from(p[1])},
|
|
138
|
-
cpattern(Buffer.from(p[1])));
|
|
139
|
-
});
|
|
140
|
-
test(prest, function() {
|
|
141
|
-
var plusgarbage = p[1].concat([5, 98, 23, 244]);
|
|
142
|
-
assert.deepEqual({n: Buffer.from(p[1])},
|
|
143
|
-
match(patternrest, Buffer.from(plusgarbage)));
|
|
144
|
-
assert.deepEqual({n: Buffer.from(p[1])},
|
|
145
|
-
cpatternrest(Buffer.from(plusgarbage)));
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
var VAR_TESTS = [
|
|
151
|
-
['size, n:size',
|
|
152
|
-
[[[8, 5], 5],
|
|
153
|
-
[[32, 0, 0, 0, 167], 167]]],
|
|
154
|
-
|
|
155
|
-
['size, n:size/binary',
|
|
156
|
-
[[[2, 5, 6], Buffer.from([5, 6])]]],
|
|
157
|
-
|
|
158
|
-
['a, b:a, n:b',
|
|
159
|
-
[[[8, 32, 0, 0, 2, 100], 612]]]
|
|
160
|
-
];
|
|
161
|
-
|
|
162
|
-
suite("Environment",
|
|
163
|
-
function() {
|
|
164
|
-
VAR_TESTS.forEach(function(p) {
|
|
165
|
-
var pattern = parse(p[0]);
|
|
166
|
-
var cpattern = compile(p[0]);
|
|
167
|
-
p[1].forEach(function(tc) {
|
|
168
|
-
test(p[0], function() {
|
|
169
|
-
assert.deepEqual(tc[1], match(pattern, Buffer.from(tc[0])).n);
|
|
170
|
-
});
|
|
171
|
-
test(p[0], function() {
|
|
172
|
-
assert.deepEqual(tc[1], cpattern(Buffer.from(tc[0])).n);
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
STRING_TESTS = [
|
|
179
|
-
['"foobar", n:8', "foobarA", 'A'.charCodeAt(0)],
|
|
180
|
-
['n:8, "foobar", _/binary', "CfoobarGARBAGE", 'C'.charCodeAt(0)],
|
|
181
|
-
['"foo, :-bar\\"", n:8, "another"', 'foo, :-bar"Zanother', 'Z'.charCodeAt(0)]
|
|
182
|
-
];
|
|
183
|
-
|
|
184
|
-
suite("String",
|
|
185
|
-
function() {
|
|
186
|
-
STRING_TESTS.forEach(function(p) {
|
|
187
|
-
var pattern = parse(p[0]);
|
|
188
|
-
test(p[0], function() {
|
|
189
|
-
var res = match(pattern, Buffer.from(p[1]));
|
|
190
|
-
assert.equal(res.n, p[2]);
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report / Support request
|
|
3
|
-
about: Report a bug or ask for help
|
|
4
|
-
title: ''
|
|
5
|
-
labels: ''
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
Before reporting a bug or requesting support please...
|
|
11
|
-
|
|
12
|
-
1. Read the troubleshooting guide
|
|
13
|
-
|
|
14
|
-
- https://amqp-node.github.io/amqplib/#troubleshooting
|
|
15
|
-
|
|
16
|
-
2. Search for existing open and closed issues
|
|
17
|
-
|
|
18
|
-
- https://github.com/amqp-node/amqplib/issues?q=is%3Aissue+TYPE+YOUR+KEYWORDS+HERE
|
|
19
|
-
|
|
20
|
-
3. Ensure you are familiar with the amqplib Channel API and RabbitMQ basics
|
|
21
|
-
|
|
22
|
-
- https://amqp-node.github.io/amqplib/channel_api.html
|
|
23
|
-
- https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html
|
|
24
|
-
- https://www.rabbitmq.com/tutorials/amqp-concepts.html
|
|
25
|
-
|
|
26
|
-
If the above does not help, please provide the following information...
|
|
27
|
-
|
|
28
|
-
- A clear and concise description of what the bug is.
|
|
29
|
-
- RabbitMQ version
|
|
30
|
-
- amqplib version
|
|
31
|
-
|
|
32
|
-
If you include code snippets, please format them so they are easier to read
|
|
33
|
-
|
|
34
|
-
- https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks
|
|
35
|
-
|
|
36
|
-
Thank you
|
|
37
|
-
|
|
38
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
-
|
|
4
|
-
name: Node.js CI
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [main]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [main]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
services:
|
|
16
|
-
rabbitmq:
|
|
17
|
-
image: rabbitmq
|
|
18
|
-
ports:
|
|
19
|
-
- 5672:5672
|
|
20
|
-
|
|
21
|
-
strategy:
|
|
22
|
-
matrix:
|
|
23
|
-
node-version: [10.x, 12.x, 14.x, 16.x, 18.x]
|
|
24
|
-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
25
|
-
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@v2
|
|
28
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
29
|
-
uses: actions/setup-node@v2
|
|
30
|
-
with:
|
|
31
|
-
node-version: ${{ matrix.node-version }}
|
|
32
|
-
cache: "npm"
|
|
33
|
-
|
|
34
|
-
# Install all prerequisites
|
|
35
|
-
- run: npm ci
|
|
36
|
-
|
|
37
|
-
# Run the tests
|
|
38
|
-
- run: make test
|