bx-rest 0.0.4 → 0.0.6
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 +9 -2
- package/.editorconfig +0 -17
- package/spec/tsconfig.json +0 -15
- package/tools/add-license-to-file.js +0 -30
- package/tools/generate-alias.js +0 -30
- package/tools/subject-benchmark.js +0 -281
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bx-rest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "bitrix rest api",
|
|
5
5
|
"typings": "./index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -119,12 +119,19 @@
|
|
|
119
119
|
"url": "https://github.com/Aricatofuka/bx-rest/issues"
|
|
120
120
|
},
|
|
121
121
|
"homepage": "https://github.com/Aricatofuka/bx-rest#readme",
|
|
122
|
+
"files": [
|
|
123
|
+
"src",
|
|
124
|
+
"LICENSE.txt",
|
|
125
|
+
"package.json",
|
|
126
|
+
"README.md",
|
|
127
|
+
"tsconfig.json"
|
|
128
|
+
],
|
|
122
129
|
"exports": {
|
|
123
130
|
"./package.json": {
|
|
124
131
|
"default": "./package.json"
|
|
125
132
|
},
|
|
126
133
|
".": {
|
|
127
|
-
"types": "./
|
|
134
|
+
"types": "./src/index.d.ts",
|
|
128
135
|
"node": "./dist/cjs/index.js",
|
|
129
136
|
"require": "./dist/cjs/index.js",
|
|
130
137
|
"es2015": "./dist/esm/index.js",
|
package/.editorconfig
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Editor configuration, see https://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 4
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.ts]
|
|
12
|
-
quote_type = single
|
|
13
|
-
semi = false
|
|
14
|
-
|
|
15
|
-
[*.md]
|
|
16
|
-
max_line_length = off
|
|
17
|
-
trim_trailing_whitespace = false
|
package/spec/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"noEmit": false,
|
|
5
|
-
"outDir": "../dist/spec",
|
|
6
|
-
"target": "es5",
|
|
7
|
-
"downlevelIteration": true,
|
|
8
|
-
"module": "commonjs"
|
|
9
|
-
},
|
|
10
|
-
"references": [
|
|
11
|
-
{
|
|
12
|
-
"path": "../src/tsconfig.types.spec.json"
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
|
|
3
|
-
function addLicenseTextToFile(licenseText, destination) {
|
|
4
|
-
if (!destination) {
|
|
5
|
-
throw new Error('destination file path is required as 2nd argument');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
fs.writeFileSync(
|
|
9
|
-
destination,
|
|
10
|
-
`/**
|
|
11
|
-
@license
|
|
12
|
-
${licenseText}
|
|
13
|
-
**/
|
|
14
|
-
${fs.readFileSync(`${destination}`).toString()}
|
|
15
|
-
`
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function addLicenseToFile(license, destination) {
|
|
20
|
-
if (!license) {
|
|
21
|
-
throw new Error('license path is required as 1st argument');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
addLicenseTextToFile(fs.readFileSync(license).toString(), destination);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
28
|
-
addLicenseToFile: addLicenseToFile,
|
|
29
|
-
addLicenseTextToFile: addLicenseTextToFile,
|
|
30
|
-
};
|
package/tools/generate-alias.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Alias subpath import (`dist/cjs/*`) to top-level path mapping (`rxjs/*`)
|
|
3
|
-
* Previously this was done by placing cjs to top-level package when it's published -
|
|
4
|
-
* Now build uses `dist` as explicit output subpath so we generate top-level alias here instead.
|
|
5
|
-
*/
|
|
6
|
-
const fs = require('fs-extra');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
const aliasRoot = ['ajax', 'fetch', 'operators', 'testing', 'webSocket'];
|
|
10
|
-
|
|
11
|
-
aliasRoot
|
|
12
|
-
.map((alias) => path.resolve(__dirname, `../${alias}`))
|
|
13
|
-
.forEach((alias) => {
|
|
14
|
-
if (fs.existsSync(alias)) {
|
|
15
|
-
fs.removeSync(alias);
|
|
16
|
-
}
|
|
17
|
-
fs.ensureDirSync(alias);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
aliasRoot.forEach((alias) => {
|
|
21
|
-
const pkgManifest = {
|
|
22
|
-
name: `bx-rest/${alias}`,
|
|
23
|
-
types: `../dist/types/${alias}/index.d.ts`,
|
|
24
|
-
main: `../dist/cjs/${alias}/index.js`,
|
|
25
|
-
module: `../dist/esm/${alias}/index.js`,
|
|
26
|
-
sideEffects: false,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
fs.writeJSON(path.resolve(__dirname, `../${alias}/package.json`), pkgManifest, { spaces: 2 });
|
|
30
|
-
});
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const { Bench } = require('tinybench');
|
|
3
|
-
const { Subject: SubjectMaster } = require('../dist-master/cjs');
|
|
4
|
-
const { Subject: SubjectPr } = require('../dist/cjs');
|
|
5
|
-
|
|
6
|
-
async function run() {
|
|
7
|
-
const numIterations = 10_000;
|
|
8
|
-
const bench = new Bench({ warmupIterations: Math.ceil(numIterations / 20), iterations: numIterations });
|
|
9
|
-
|
|
10
|
-
// bench.add('[master] Creating Subject', () => {
|
|
11
|
-
// new SubjectMaster();
|
|
12
|
-
// });
|
|
13
|
-
// bench.add('[pr] Creating Subject', () => {
|
|
14
|
-
// new SubjectPr();
|
|
15
|
-
// });
|
|
16
|
-
|
|
17
|
-
// bench.add('[master] 0 subscribed, 1 next', () => {
|
|
18
|
-
// const source = new SubjectMaster();
|
|
19
|
-
// source.next(1);
|
|
20
|
-
// });
|
|
21
|
-
// bench.add('[pr] 0 subscribed, 1 next', () => {
|
|
22
|
-
// const source = new SubjectPr();
|
|
23
|
-
// source.next(1);
|
|
24
|
-
// });
|
|
25
|
-
|
|
26
|
-
// bench.add('[master] 0 subscribed, 100 next', () => {
|
|
27
|
-
// const source = new SubjectMaster();
|
|
28
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
29
|
-
// source.next(i);
|
|
30
|
-
// }
|
|
31
|
-
// });
|
|
32
|
-
// bench.add('[pr] 0 subscribed, 100 next', () => {
|
|
33
|
-
// const source = new SubjectPr();
|
|
34
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
35
|
-
// source.next(i);
|
|
36
|
-
// }
|
|
37
|
-
// });
|
|
38
|
-
|
|
39
|
-
// bench.add('[master] 1 subscribed, 1 next', () => {
|
|
40
|
-
// const source = new SubjectMaster();
|
|
41
|
-
// const subscription = source.asObservable().subscribe();
|
|
42
|
-
// source.next(1);
|
|
43
|
-
// subscription.unsubscribe();
|
|
44
|
-
// });
|
|
45
|
-
// bench.add('[pr] 1 subscribed, 1 next', () => {
|
|
46
|
-
// const source = new SubjectPr();
|
|
47
|
-
// const subscription = source.asObservable().subscribe();
|
|
48
|
-
// source.next(1);
|
|
49
|
-
// subscription.unsubscribe();
|
|
50
|
-
// });
|
|
51
|
-
|
|
52
|
-
// bench.add('[master] 1 subscribed, 100 next', () => {
|
|
53
|
-
// const source = new SubjectMaster();
|
|
54
|
-
// const subscription = source.asObservable().subscribe();
|
|
55
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
56
|
-
// source.next(i);
|
|
57
|
-
// }
|
|
58
|
-
// subscription.unsubscribe();
|
|
59
|
-
// });
|
|
60
|
-
// bench.add('[pr] 1 subscribed, 100 next', () => {
|
|
61
|
-
// const source = new SubjectPr();
|
|
62
|
-
// const subscription = source.asObservable().subscribe();
|
|
63
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
64
|
-
// source.next(i);
|
|
65
|
-
// }
|
|
66
|
-
// subscription.unsubscribe();
|
|
67
|
-
// });
|
|
68
|
-
|
|
69
|
-
// bench.add('[master] 3 subscribed, 1 next', () => {
|
|
70
|
-
// const source = new SubjectMaster();
|
|
71
|
-
// const s1 = source.asObservable().subscribe();
|
|
72
|
-
// const s2 = source.asObservable().subscribe();
|
|
73
|
-
// const s3 = source.asObservable().subscribe();
|
|
74
|
-
// source.next(1);
|
|
75
|
-
// s1.unsubscribe();
|
|
76
|
-
// s2.unsubscribe();
|
|
77
|
-
// s3.unsubscribe();
|
|
78
|
-
// });
|
|
79
|
-
// bench.add('[pr] 3 subscribed, 1 next', () => {
|
|
80
|
-
// const source = new SubjectPr();
|
|
81
|
-
// const s1 = source.asObservable().subscribe();
|
|
82
|
-
// const s2 = source.asObservable().subscribe();
|
|
83
|
-
// const s3 = source.asObservable().subscribe();
|
|
84
|
-
// source.next(1);
|
|
85
|
-
// s1.unsubscribe();
|
|
86
|
-
// s2.unsubscribe();
|
|
87
|
-
// s3.unsubscribe();
|
|
88
|
-
// });
|
|
89
|
-
|
|
90
|
-
// bench.add('[master] 3 subscribed, 100 next', () => {
|
|
91
|
-
// const source = new SubjectMaster();
|
|
92
|
-
// const s1 = source.asObservable().subscribe();
|
|
93
|
-
// const s2 = source.asObservable().subscribe();
|
|
94
|
-
// const s3 = source.asObservable().subscribe();
|
|
95
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
96
|
-
// source.next(i);
|
|
97
|
-
// }
|
|
98
|
-
// s1.unsubscribe();
|
|
99
|
-
// s2.unsubscribe();
|
|
100
|
-
// s3.unsubscribe();
|
|
101
|
-
// });
|
|
102
|
-
// bench.add('[pr] 3 subscribed, 100 next', () => {
|
|
103
|
-
// const source = new SubjectPr();
|
|
104
|
-
// const s1 = source.asObservable().subscribe();
|
|
105
|
-
// const s2 = source.asObservable().subscribe();
|
|
106
|
-
// const s3 = source.asObservable().subscribe();
|
|
107
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
108
|
-
// source.next(i);
|
|
109
|
-
// }
|
|
110
|
-
// s1.unsubscribe();
|
|
111
|
-
// s2.unsubscribe();
|
|
112
|
-
// s3.unsubscribe();
|
|
113
|
-
// });
|
|
114
|
-
|
|
115
|
-
// bench.add('[master] 10 subscribed, 1 next', () => {
|
|
116
|
-
// const source = new SubjectMaster();
|
|
117
|
-
// const s = [];
|
|
118
|
-
// for (let i = 0; i !== 10; ++i) {
|
|
119
|
-
// s.push(source.asObservable().subscribe());
|
|
120
|
-
// }
|
|
121
|
-
// source.next(1);
|
|
122
|
-
// for (const e of s) {
|
|
123
|
-
// e.unsubscribe();
|
|
124
|
-
// }
|
|
125
|
-
// });
|
|
126
|
-
// bench.add('[pr] 10 subscribed, 1 next', () => {
|
|
127
|
-
// const source = new SubjectPr();
|
|
128
|
-
// const s = [];
|
|
129
|
-
// for (let i = 0; i !== 10; ++i) {
|
|
130
|
-
// s.push(source.asObservable().subscribe());
|
|
131
|
-
// }
|
|
132
|
-
// source.next(1);
|
|
133
|
-
// for (const e of s) {
|
|
134
|
-
// e.unsubscribe();
|
|
135
|
-
// }
|
|
136
|
-
// });
|
|
137
|
-
|
|
138
|
-
// bench.add('[master] 10 subscribed, 100 next', () => {
|
|
139
|
-
// const source = new SubjectMaster();
|
|
140
|
-
// const s = [];
|
|
141
|
-
// for (let i = 0; i !== 10; ++i) {
|
|
142
|
-
// s.push(source.asObservable().subscribe());
|
|
143
|
-
// }
|
|
144
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
145
|
-
// source.next(i);
|
|
146
|
-
// }
|
|
147
|
-
// for (const e of s) {
|
|
148
|
-
// e.unsubscribe();
|
|
149
|
-
// }
|
|
150
|
-
// });
|
|
151
|
-
// bench.add('[pr] 10 subscribed, 100 next', () => {
|
|
152
|
-
// const source = new SubjectPr();
|
|
153
|
-
// const s = [];
|
|
154
|
-
// for (let i = 0; i !== 10; ++i) {
|
|
155
|
-
// s.push(source.asObservable().subscribe());
|
|
156
|
-
// }
|
|
157
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
158
|
-
// source.next(i);
|
|
159
|
-
// }
|
|
160
|
-
// for (const e of s) {
|
|
161
|
-
// e.unsubscribe();
|
|
162
|
-
// }
|
|
163
|
-
// });
|
|
164
|
-
|
|
165
|
-
// bench.add('[master] 100 subscribed, 1 next', () => {
|
|
166
|
-
// const source = new SubjectMaster();
|
|
167
|
-
// const s = [];
|
|
168
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
169
|
-
// s.push(source.asObservable().subscribe());
|
|
170
|
-
// }
|
|
171
|
-
// source.next(1);
|
|
172
|
-
// for (const e of s) {
|
|
173
|
-
// e.unsubscribe();
|
|
174
|
-
// }
|
|
175
|
-
// });
|
|
176
|
-
// bench.add('[pr] 100 subscribed, 1 next', () => {
|
|
177
|
-
// const source = new SubjectPr();
|
|
178
|
-
// const s = [];
|
|
179
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
180
|
-
// s.push(source.asObservable().subscribe());
|
|
181
|
-
// }
|
|
182
|
-
// source.next(1);
|
|
183
|
-
// for (const e of s) {
|
|
184
|
-
// e.unsubscribe();
|
|
185
|
-
// }
|
|
186
|
-
// });
|
|
187
|
-
|
|
188
|
-
// bench.add('[master] 100 subscribed, 100 next', () => {
|
|
189
|
-
// const source = new SubjectMaster();
|
|
190
|
-
// const s = [];
|
|
191
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
192
|
-
// s.push(source.asObservable().subscribe());
|
|
193
|
-
// }
|
|
194
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
195
|
-
// source.next(i);
|
|
196
|
-
// }
|
|
197
|
-
// for (const e of s) {
|
|
198
|
-
// e.unsubscribe();
|
|
199
|
-
// }
|
|
200
|
-
// });
|
|
201
|
-
// bench.add('[pr] 100 subscribed, 100 next', () => {
|
|
202
|
-
// const source = new SubjectPr();
|
|
203
|
-
// const s = [];
|
|
204
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
205
|
-
// s.push(source.asObservable().subscribe());
|
|
206
|
-
// }
|
|
207
|
-
// for (let i = 0; i !== 100; ++i) {
|
|
208
|
-
// source.next(i);
|
|
209
|
-
// }
|
|
210
|
-
// for (const e of s) {
|
|
211
|
-
// e.unsubscribe();
|
|
212
|
-
// }
|
|
213
|
-
// });
|
|
214
|
-
|
|
215
|
-
// bench.add('[master] 1000 subscribed, 1 next', () => {
|
|
216
|
-
// const source = new SubjectMaster();
|
|
217
|
-
// const s = [];
|
|
218
|
-
// for (let i = 0; i !== 1000; ++i) {
|
|
219
|
-
// s.push(source.asObservable().subscribe());
|
|
220
|
-
// }
|
|
221
|
-
// source.next(1);
|
|
222
|
-
// for (const e of s) {
|
|
223
|
-
// e.unsubscribe();
|
|
224
|
-
// }
|
|
225
|
-
// });
|
|
226
|
-
// bench.add('[pr] 1000 subscribed, 1 next', () => {
|
|
227
|
-
// const source = new SubjectPr();
|
|
228
|
-
// const s = [];
|
|
229
|
-
// for (let i = 0; i !== 1000; ++i) {
|
|
230
|
-
// s.push(source.asObservable().subscribe());
|
|
231
|
-
// }
|
|
232
|
-
// source.next(1);
|
|
233
|
-
// for (const e of s) {
|
|
234
|
-
// e.unsubscribe();
|
|
235
|
-
// }
|
|
236
|
-
// });
|
|
237
|
-
|
|
238
|
-
bench.add('[master] 1 subscribed, 10,000 next', () => {
|
|
239
|
-
const source = new SubjectMaster();
|
|
240
|
-
const s = [];
|
|
241
|
-
for (let i = 0; i !== 1; ++i) {
|
|
242
|
-
s.push(source.asObservable().subscribe());
|
|
243
|
-
}
|
|
244
|
-
for (let i = 0; i !== 10000; ++i) {
|
|
245
|
-
source.next(i);
|
|
246
|
-
}
|
|
247
|
-
for (const e of s) {
|
|
248
|
-
e.unsubscribe();
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
bench.add('[pr] 1 subscribed, 10,000 next', () => {
|
|
253
|
-
const source = new SubjectPr();
|
|
254
|
-
const s = [];
|
|
255
|
-
for (let i = 0; i !== 1; ++i) {
|
|
256
|
-
s.push(source.asObservable().subscribe());
|
|
257
|
-
}
|
|
258
|
-
for (let i = 0; i !== 10000; ++i) {
|
|
259
|
-
source.next(i);
|
|
260
|
-
}
|
|
261
|
-
for (const e of s) {
|
|
262
|
-
e.unsubscribe();
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
await bench.warmup();
|
|
267
|
-
await bench.run();
|
|
268
|
-
|
|
269
|
-
console.table(
|
|
270
|
-
bench.tasks.map(({ name, result }) => {
|
|
271
|
-
return {
|
|
272
|
-
Name: name,
|
|
273
|
-
Mean: result?.mean,
|
|
274
|
-
P75: result?.p75,
|
|
275
|
-
P99: result?.p99,
|
|
276
|
-
RME: result?.rme,
|
|
277
|
-
};
|
|
278
|
-
})
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
run();
|