@awsless/ecs 0.0.3 → 0.0.4

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/ecs",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -28,11 +28,11 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@aws-sdk/client-ecs": "3.1024.0",
31
+ "aws-sdk-vitest-mock": "1.0.55",
31
32
  "@awsless/json": "^0.0.11",
32
33
  "@awsless/utils": "^0.0.2"
33
34
  },
34
35
  "devDependencies": {
35
- "aws-sdk-vitest-mock": "1.0.55",
36
36
  "vitest": ">=4"
37
37
  },
38
38
  "scripts": {
@@ -1,35 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
-
31
- export {
32
- __commonJS,
33
- __export,
34
- __toESM
35
- };
@@ -1,545 +0,0 @@
1
- import "./chunk-U67V476Y.js";
2
-
3
- // ../../node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js
4
- var $ = Object.defineProperty;
5
- var C = (s) => {
6
- throw TypeError(s);
7
- };
8
- var D = (s, n, t) => n in s ? $(s, n, { enumerable: true, configurable: true, writable: true, value: t }) : s[n] = t;
9
- var O = (s, n, t) => D(s, typeof n != "symbol" ? n + "" : n, t);
10
- var q = (s, n, t) => n.has(s) || C("Cannot " + t);
11
- var d = (s, n, t) => (q(s, n, "read from private field"), t ? t.call(s) : n.get(s));
12
- var k = (s, n, t) => n.has(s) ? C("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(s) : n.set(s, t);
13
- var f = (s, n, t, e) => (q(s, n, "write to private field"), e ? e.call(s, t) : n.set(s, t), t);
14
- var F = (s, n, t, e) => ({
15
- set _(r) {
16
- f(s, n, r, t);
17
- },
18
- get _() {
19
- return d(s, n, e);
20
- }
21
- });
22
- var M = class {
23
- constructor(n) {
24
- O(this, "value");
25
- O(this, "next");
26
- this.value = n;
27
- }
28
- };
29
- var m;
30
- var w;
31
- var E;
32
- var g = class {
33
- constructor() {
34
- k(this, m);
35
- k(this, w);
36
- k(this, E);
37
- this.clear();
38
- }
39
- enqueue(n) {
40
- let t = new M(n);
41
- d(this, m) ? (d(this, w).next = t, f(this, w, t)) : (f(this, m, t), f(this, w, t)), F(this, E)._++;
42
- }
43
- dequeue() {
44
- let n = d(this, m);
45
- if (n)
46
- return f(this, m, d(this, m).next), F(this, E)._--, n.value;
47
- }
48
- clear() {
49
- f(this, m, void 0), f(this, w, void 0), f(this, E, 0);
50
- }
51
- get size() {
52
- return d(this, E);
53
- }
54
- *[Symbol.iterator]() {
55
- let n = d(this, m);
56
- for (; n; )
57
- yield n.value, n = n.next;
58
- }
59
- };
60
- m = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap();
61
- function y(s) {
62
- if (!((Number.isInteger(s) || s === Number.POSITIVE_INFINITY) && s > 0))
63
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
64
- let n = new g(), t = 0, e = () => {
65
- t--, n.size > 0 && n.dequeue()();
66
- }, r = async (h, p, a) => {
67
- t++;
68
- let l = (async () => h(...a))();
69
- p(l);
70
- try {
71
- await l;
72
- } catch (T) {
73
- }
74
- e();
75
- }, i = (h, p, a) => {
76
- n.enqueue(r.bind(void 0, h, p, a)), (async () => (await Promise.resolve(), t < s && n.size > 0 && n.dequeue()()))();
77
- }, c = (h, ...p) => new Promise((a) => {
78
- i(h, a, p);
79
- });
80
- return Object.defineProperties(c, {
81
- activeCount: {
82
- get: () => t
83
- },
84
- pendingCount: {
85
- get: () => n.size
86
- },
87
- clearQueue: {
88
- value: () => {
89
- n.clear();
90
- }
91
- }
92
- }), c;
93
- }
94
- function o(s, n = null) {
95
- let t = new Event(s);
96
- return n && Object.defineProperty(t, "task", {
97
- value: n,
98
- enumerable: true,
99
- writable: false,
100
- configurable: false
101
- }), t;
102
- }
103
- var G = {
104
- 1: 12.71,
105
- 2: 4.303,
106
- 3: 3.182,
107
- 4: 2.776,
108
- 5: 2.571,
109
- 6: 2.447,
110
- 7: 2.365,
111
- 8: 2.306,
112
- 9: 2.262,
113
- 10: 2.228,
114
- 11: 2.201,
115
- 12: 2.179,
116
- 13: 2.16,
117
- 14: 2.145,
118
- 15: 2.131,
119
- 16: 2.12,
120
- 17: 2.11,
121
- 18: 2.101,
122
- 19: 2.093,
123
- 20: 2.086,
124
- 21: 2.08,
125
- 22: 2.074,
126
- 23: 2.069,
127
- 24: 2.064,
128
- 25: 2.06,
129
- 26: 2.056,
130
- 27: 2.052,
131
- 28: 2.048,
132
- 29: 2.045,
133
- 30: 2.042,
134
- 31: 2.0399,
135
- 32: 2.0378,
136
- 33: 2.0357,
137
- 34: 2.0336,
138
- 35: 2.0315,
139
- 36: 2.0294,
140
- 37: 2.0273,
141
- 38: 2.0252,
142
- 39: 2.0231,
143
- 40: 2.021,
144
- 41: 2.0198,
145
- 42: 2.0186,
146
- 43: 2.0174,
147
- 44: 2.0162,
148
- 45: 2.015,
149
- 46: 2.0138,
150
- 47: 2.0126,
151
- 48: 2.0114,
152
- 49: 2.0102,
153
- 50: 2.009,
154
- 51: 2.0081,
155
- 52: 2.0072,
156
- 53: 2.0063,
157
- 54: 2.0054,
158
- 55: 2.0045,
159
- 56: 2.0036,
160
- 57: 2.0027,
161
- 58: 2.0018,
162
- 59: 2.0009,
163
- 60: 2,
164
- 61: 1.9995,
165
- 62: 1.999,
166
- 63: 1.9985,
167
- 64: 1.998,
168
- 65: 1.9975,
169
- 66: 1.997,
170
- 67: 1.9965,
171
- 68: 1.996,
172
- 69: 1.9955,
173
- 70: 1.995,
174
- 71: 1.9945,
175
- 72: 1.994,
176
- 73: 1.9935,
177
- 74: 1.993,
178
- 75: 1.9925,
179
- 76: 1.992,
180
- 77: 1.9915,
181
- 78: 1.991,
182
- 79: 1.9905,
183
- 80: 1.99,
184
- 81: 1.9897,
185
- 82: 1.9894,
186
- 83: 1.9891,
187
- 84: 1.9888,
188
- 85: 1.9885,
189
- 86: 1.9882,
190
- 87: 1.9879,
191
- 88: 1.9876,
192
- 89: 1.9873,
193
- 90: 1.987,
194
- 91: 1.9867,
195
- 92: 1.9864,
196
- 93: 1.9861,
197
- 94: 1.9858,
198
- 95: 1.9855,
199
- 96: 1.9852,
200
- 97: 1.9849,
201
- 98: 1.9846,
202
- 99: 1.9843,
203
- 100: 1.984,
204
- 101: 1.9838,
205
- 102: 1.9836,
206
- 103: 1.9834,
207
- 104: 1.9832,
208
- 105: 1.983,
209
- 106: 1.9828,
210
- 107: 1.9826,
211
- 108: 1.9824,
212
- 109: 1.9822,
213
- 110: 1.982,
214
- 111: 1.9818,
215
- 112: 1.9816,
216
- 113: 1.9814,
217
- 114: 1.9812,
218
- 115: 1.9819,
219
- 116: 1.9808,
220
- 117: 1.9806,
221
- 118: 1.9804,
222
- 119: 1.9802,
223
- 120: 1.98,
224
- infinity: 1.96
225
- };
226
- var N = G;
227
- var J = (s) => s / 1e6;
228
- var U = () => J(Number(process.hrtime.bigint()));
229
- var B = () => performance.now();
230
- function W(s) {
231
- return s !== null && typeof s == "object" && typeof s.then == "function";
232
- }
233
- var S = (s, n) => s.reduce((e, r) => e + (r - n) ** 2, 0) / (s.length - 1) || 0;
234
- var X = (async () => {
235
- }).constructor;
236
- var Z = (s) => s.constructor === X;
237
- var z = async (s) => {
238
- if (Z(s.fn))
239
- return true;
240
- try {
241
- if (s.opts.beforeEach != null)
242
- try {
243
- await s.opts.beforeEach.call(s);
244
- } catch (e) {
245
- }
246
- let n = s.fn(), t = W(n);
247
- if (t)
248
- try {
249
- await n;
250
- } catch (e) {
251
- }
252
- if (s.opts.afterEach != null)
253
- try {
254
- await s.opts.afterEach.call(s);
255
- } catch (e) {
256
- }
257
- return t;
258
- } catch (n) {
259
- return false;
260
- }
261
- };
262
- var b = class extends EventTarget {
263
- constructor(t, e, r, i = {}) {
264
- super();
265
- this.runs = 0;
266
- this.bench = t, this.name = e, this.fn = r, this.opts = i;
267
- }
268
- async loop(t, e) {
269
- var T;
270
- let r = this.bench.concurrency === "task", { threshold: i } = this.bench, c = 0, h = [];
271
- if (this.opts.beforeAll != null)
272
- try {
273
- await this.opts.beforeAll.call(this);
274
- } catch (u) {
275
- return { error: u };
276
- }
277
- let p = await z(this), a = async () => {
278
- this.opts.beforeEach != null && await this.opts.beforeEach.call(this);
279
- let u = 0;
280
- if (p) {
281
- let v = this.bench.now();
282
- await this.fn.call(this), u = this.bench.now() - v;
283
- } else {
284
- let v = this.bench.now();
285
- this.fn.call(this), u = this.bench.now() - v;
286
- }
287
- h.push(u), c += u, this.opts.afterEach != null && await this.opts.afterEach.call(this);
288
- }, l = y(i);
289
- try {
290
- let u = [];
291
- for (; (c < t || h.length + l.activeCount + l.pendingCount < e) && !((T = this.bench.signal) != null && T.aborted); )
292
- r ? u.push(l(a)) : await a();
293
- u.length && await Promise.all(u);
294
- } catch (u) {
295
- return { error: u };
296
- }
297
- if (this.opts.afterAll != null)
298
- try {
299
- await this.opts.afterAll.call(this);
300
- } catch (u) {
301
- return { error: u };
302
- }
303
- return { samples: h };
304
- }
305
- /**
306
- * run the current task and write the results in `Task.result` object
307
- */
308
- async run() {
309
- var r, i;
310
- if ((r = this.result) != null && r.error)
311
- return this;
312
- this.dispatchEvent(o("start", this)), await this.bench.setup(this, "run");
313
- let { samples: t, error: e } = await this.loop(this.bench.time, this.bench.iterations);
314
- if (this.bench.teardown(this, "run"), t) {
315
- let c = t.reduce((L, A) => L + A, 0);
316
- this.runs = t.length, t.sort((L, A) => L - A);
317
- let h = c / this.runs, p = 1e3 / h, a = t.length, l = a - 1, T = t[0], u = t[l], v = c / t.length || 0, P = S(t, v), R = Math.sqrt(P), I = R / Math.sqrt(a), _ = N[String(Math.round(l) || 1)] || N.infinity, K = I * _, j = K / v * 100, H = t[Math.ceil(a * 0.75) - 1], V = t[Math.ceil(a * 0.99) - 1], Q = t[Math.ceil(a * 0.995) - 1], Y = t[Math.ceil(a * 0.999) - 1];
318
- if ((i = this.bench.signal) != null && i.aborted)
319
- return this;
320
- this.setResult({
321
- totalTime: c,
322
- min: T,
323
- max: u,
324
- hz: p,
325
- period: h,
326
- samples: t,
327
- mean: v,
328
- variance: P,
329
- sd: R,
330
- sem: I,
331
- df: l,
332
- critical: _,
333
- moe: K,
334
- rme: j,
335
- p75: H,
336
- p99: V,
337
- p995: Q,
338
- p999: Y
339
- });
340
- }
341
- if (e) {
342
- if (this.setResult({ error: e }), this.bench.throws)
343
- throw e;
344
- this.dispatchEvent(o("error", this)), this.bench.dispatchEvent(o("error", this));
345
- }
346
- return this.dispatchEvent(o("cycle", this)), this.bench.dispatchEvent(o("cycle", this)), this.dispatchEvent(o("complete", this)), this;
347
- }
348
- /**
349
- * warmup the current task
350
- */
351
- async warmup() {
352
- var e;
353
- if ((e = this.result) != null && e.error)
354
- return;
355
- this.dispatchEvent(o("warmup", this)), await this.bench.setup(this, "warmup");
356
- let { error: t } = await this.loop(this.bench.warmupTime, this.bench.warmupIterations);
357
- if (this.bench.teardown(this, "warmup"), t && (this.setResult({ error: t }), this.bench.throws))
358
- throw t;
359
- }
360
- addEventListener(t, e, r) {
361
- super.addEventListener(t, e, r);
362
- }
363
- removeEventListener(t, e, r) {
364
- super.removeEventListener(t, e, r);
365
- }
366
- /**
367
- * change the result object values
368
- */
369
- setResult(t) {
370
- this.result = { ...this.result, ...t }, Object.freeze(this.result);
371
- }
372
- /**
373
- * reset the task to make the `Task.runs` a zero-value and remove the `Task.result`
374
- * object
375
- */
376
- reset() {
377
- this.dispatchEvent(o("reset", this)), this.runs = 0, this.result = void 0;
378
- }
379
- };
380
- var x = class extends EventTarget {
381
- constructor(t = {}) {
382
- var e, r, i, c, h, p, a, l;
383
- super();
384
- this._tasks = /* @__PURE__ */ new Map();
385
- this._todos = /* @__PURE__ */ new Map();
386
- this.concurrency = null;
387
- this.threshold = 1 / 0;
388
- this.warmupTime = 100;
389
- this.warmupIterations = 5;
390
- this.time = 500;
391
- this.iterations = 10;
392
- this.now = B;
393
- this.now = (e = t.now) != null ? e : this.now, this.warmupTime = (r = t.warmupTime) != null ? r : this.warmupTime, this.warmupIterations = (i = t.warmupIterations) != null ? i : this.warmupIterations, this.time = (c = t.time) != null ? c : this.time, this.iterations = (h = t.iterations) != null ? h : this.iterations, this.signal = t.signal, this.throws = (p = t.throws) != null ? p : false, this.setup = (a = t.setup) != null ? a : () => {
394
- }, this.teardown = (l = t.teardown) != null ? l : () => {
395
- }, this.signal && this.signal.addEventListener(
396
- "abort",
397
- () => {
398
- this.dispatchEvent(o("abort"));
399
- },
400
- { once: true }
401
- );
402
- }
403
- runTask(t) {
404
- var e;
405
- return (e = this.signal) != null && e.aborted ? t : t.run();
406
- }
407
- /**
408
- * run the added tasks that were registered using the
409
- * {@link add} method.
410
- * Note: This method does not do any warmup. Call {@link warmup} for that.
411
- */
412
- async run() {
413
- if (this.concurrency === "bench")
414
- return this.runConcurrently(this.threshold, this.concurrency);
415
- this.dispatchEvent(o("start"));
416
- let t = [];
417
- for (let e of [...this._tasks.values()])
418
- t.push(await this.runTask(e));
419
- return this.dispatchEvent(o("complete")), t;
420
- }
421
- /**
422
- * See Bench.{@link concurrency}
423
- */
424
- async runConcurrently(t = 1 / 0, e = "bench") {
425
- if (this.threshold = t, this.concurrency = e, e === "task")
426
- return this.run();
427
- this.dispatchEvent(o("start"));
428
- let r = y(t), i = [];
429
- for (let h of [...this._tasks.values()])
430
- i.push(r(() => this.runTask(h)));
431
- let c = await Promise.all(i);
432
- return this.dispatchEvent(o("complete")), c;
433
- }
434
- /**
435
- * warmup the benchmark tasks.
436
- * This is not run by default by the {@link run} method.
437
- */
438
- async warmup() {
439
- if (this.concurrency === "bench") {
440
- await this.warmupConcurrently(this.threshold, this.concurrency);
441
- return;
442
- }
443
- this.dispatchEvent(o("warmup"));
444
- for (let [, t] of this._tasks)
445
- await t.warmup();
446
- }
447
- /**
448
- * warmup the benchmark tasks concurrently.
449
- * This is not run by default by the {@link runConcurrently} method.
450
- */
451
- async warmupConcurrently(t = 1 / 0, e = "bench") {
452
- if (this.threshold = t, this.concurrency = e, e === "task") {
453
- await this.warmup();
454
- return;
455
- }
456
- this.dispatchEvent(o("warmup"));
457
- let r = y(t), i = [];
458
- for (let [, c] of this._tasks)
459
- i.push(r(() => c.warmup()));
460
- await Promise.all(i);
461
- }
462
- /**
463
- * reset each task and remove its result
464
- */
465
- reset() {
466
- this.dispatchEvent(o("reset")), this._tasks.forEach((t) => {
467
- t.reset();
468
- });
469
- }
470
- /**
471
- * add a benchmark task to the task map
472
- */
473
- add(t, e, r = {}) {
474
- let i = new b(this, t, e, r);
475
- return this._tasks.set(t, i), this.dispatchEvent(o("add", i)), this;
476
- }
477
- /**
478
- * add a benchmark todo to the todo map
479
- */
480
- // eslint-disable-next-line @typescript-eslint/no-empty-function
481
- todo(t, e = () => {
482
- }, r = {}) {
483
- let i = new b(this, t, e, r);
484
- return this._todos.set(t, i), this.dispatchEvent(o("todo", i)), this;
485
- }
486
- /**
487
- * remove a benchmark task from the task map
488
- */
489
- remove(t) {
490
- let e = this.getTask(t);
491
- return e && (this.dispatchEvent(o("remove", e)), this._tasks.delete(t)), this;
492
- }
493
- addEventListener(t, e, r) {
494
- super.addEventListener(t, e, r);
495
- }
496
- removeEventListener(t, e, r) {
497
- super.removeEventListener(t, e, r);
498
- }
499
- /**
500
- * table of the tasks results
501
- */
502
- table(t) {
503
- return this.tasks.map((e) => {
504
- if (e.result) {
505
- if (e.result.error)
506
- throw e.result.error;
507
- return (t == null ? void 0 : t(e)) || {
508
- "Task Name": e.name,
509
- "ops/sec": e.result.error ? "NaN" : parseInt(e.result.hz.toString(), 10).toLocaleString(),
510
- "Average Time (ns)": e.result.error ? "NaN" : e.result.mean * 1e3 * 1e3,
511
- Margin: e.result.error ? "NaN" : `\xB1${e.result.rme.toFixed(2)}%`,
512
- Samples: e.result.error ? "NaN" : e.result.samples.length
513
- };
514
- }
515
- return null;
516
- });
517
- }
518
- /**
519
- * (getter) tasks results as an array
520
- */
521
- get results() {
522
- return [...this._tasks.values()].map((t) => t.result);
523
- }
524
- /**
525
- * (getter) tasks as an array
526
- */
527
- get tasks() {
528
- return [...this._tasks.values()];
529
- }
530
- get todos() {
531
- return [...this._todos.values()];
532
- }
533
- /**
534
- * get a task based on the task name
535
- */
536
- getTask(t) {
537
- return this._tasks.get(t);
538
- }
539
- };
540
- export {
541
- x as Bench,
542
- b as Task,
543
- U as hrtimeNow,
544
- B as now
545
- };