mini-semaphore 1.3.3 → 1.3.9

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/README.md CHANGED
@@ -1,4 +1,5 @@
1
- [![Build Status](https://travis-ci.com/jeffy-g/mini-semaphore.svg?branch=master)](https://travis-ci.com/jeffy-g/mini-semaphore) ![GitHub](https://img.shields.io/github/license/jeffy-g/mini-semaphore?style=plastic)
1
+ [![CircleCI](https://circleci.com/gh/jeffy-g/mini-semaphore/tree/master.svg?style=svg)](https://circleci.com/gh/jeffy-g/mini-semaphore/tree/master)
2
+ ![GitHub](https://img.shields.io/github/license/jeffy-g/mini-semaphore?style=plastic)
2
3
 
3
4
  # Mini Semaphore (mini-semaphore
4
5
 
package/cjs/class.js CHANGED
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /*!
3
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
5
+ Released under the MIT license
6
+ https://opensource.org/licenses/mit-license.php
7
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.MiniSemaphore = void 0;
4
11
  const core = require("./core");
package/cjs/core.js CHANGED
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /*!
3
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
5
+ Released under the MIT license
6
+ https://opensource.org/licenses/mit-license.php
7
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.release = exports.acquire = void 0;
4
11
  const extras_1 = require("./extras");
@@ -10,7 +17,7 @@ const box = (z, r) => {
10
17
  z.q.push(r);
11
18
  }
12
19
  };
13
- exports.acquire = (dis, lazy = true) => {
20
+ const acquire = (dis, lazy = true) => {
14
21
  return new Promise(r => {
15
22
  if (!lazy) {
16
23
  box(dis, r);
@@ -20,7 +27,8 @@ exports.acquire = (dis, lazy = true) => {
20
27
  }
21
28
  });
22
29
  };
23
- exports.release = (dis) => {
30
+ exports.acquire = acquire;
31
+ const release = (dis) => {
24
32
  dis.capacity++;
25
33
  if (dis.q.length) {
26
34
  dis.capacity -= 1, (dis.q.shift() || extras_1.THROW)();
@@ -30,3 +38,4 @@ exports.release = (dis) => {
30
38
  dis.capacity = dis.limit;
31
39
  }
32
40
  };
41
+ exports.release = release;
package/cjs/deque.js CHANGED
@@ -35,7 +35,6 @@ class Deque {
35
35
  const i = (this._f + l) & (this._c - 1);
36
36
  this._a[i] = s;
37
37
  this._l = l + 1;
38
- return l + 1;
39
38
  }
40
39
  shift() {
41
40
  const l = this._l;
@@ -49,17 +48,6 @@ class Deque {
49
48
  this._l = l - 1;
50
49
  return r;
51
50
  }
52
- clear() {
53
- const l = this._l;
54
- const f = this._f;
55
- const c = this._c;
56
- const a = this._a;
57
- for (let j = 0; j < l; ++j) {
58
- a[(f + j) & (c - 1)] = void 0;
59
- }
60
- this._l = 0;
61
- this._f = 0;
62
- }
63
51
  get length() {
64
52
  return this._l;
65
53
  }
package/cjs/extras.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.THROW = void 0;
4
- exports.THROW = () => {
4
+ const THROW = () => {
5
5
  throw new Error("mini-semaphore: inconsistent occurred");
6
6
  };
7
+ exports.THROW = THROW;
@@ -1,25 +1,32 @@
1
1
  "use strict";
2
+ /*!
3
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
5
+ Released under the MIT license
6
+ https://opensource.org/licenses/mit-license.php
7
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.restrictor = void 0;
4
11
  const c = require("./class");
5
- const { MiniSemaphore: MS } = c;
6
- const internalLock = new MS(1);
7
- let locks = Object.create(null);
8
- const get = async (key, restriction) => {
9
- await internalLock.acquire(false);
10
- let lock = locks[key];
11
- if (!lock) {
12
- locks[key] = lock = new MS(restriction);
13
- }
14
- if (lock.limit !== restriction) {
15
- internalLock.release();
16
- throw new ReferenceError(`Cannot get object with different restriction: key: '${key}', lock.limit: ${lock.limit} <-> restriction: ${restriction},`);
17
- }
18
- internalLock.release();
19
- return lock;
20
- };
21
12
  var restrictor;
22
13
  (function (restrictor) {
14
+ const { MiniSemaphore: MS } = c;
15
+ const internalLock = new MS(1);
16
+ let locks = Object.create(null);
17
+ const get = async (key, restriction) => {
18
+ await internalLock.acquire(false);
19
+ let lock = locks[key];
20
+ if (!lock) {
21
+ locks[key] = lock = new MS(restriction);
22
+ }
23
+ if (lock.limit !== restriction) {
24
+ internalLock.release();
25
+ throw new ReferenceError(`Cannot get object with different restriction: key: '${key}', lock.limit: ${lock.limit} <-> restriction: ${restriction},`);
26
+ }
27
+ internalLock.release();
28
+ return lock;
29
+ };
23
30
  restrictor.getLockByKey = async (key) => {
24
31
  await internalLock.acquire(false);
25
32
  const l = locks[key];
@@ -53,9 +60,9 @@ var restrictor;
53
60
  locks = newLocks;
54
61
  internalLock.release();
55
62
  if (debug) {
56
- console.log(`purged: [\n${eliminatedKeys.join(",\n")}\n]` +
63
+ console.log(`eliminated: [\n${eliminatedKeys.join(",\n")}\n]` +
57
64
  "\n" +
58
- `lived: [\n${Object.keys(newLocks).join(",\n")}\n]`);
65
+ `lived: [\n${Object.keys(newLocks).join(",\n")}\n]`);
59
66
  }
60
67
  return eliminatedCount;
61
68
  };
package/cjs/index.d.ts CHANGED
@@ -32,8 +32,8 @@ export declare class Deque<T extends any> {
32
32
  /**
33
33
  * @param s subject
34
34
  */
35
- push(s: T): number;
36
- shift(): T | undefined;
35
+ push(s: T): void;
36
+ // shift(): T | undefined;
37
37
  clear(): void;
38
38
  get length(): number;
39
39
  }
@@ -94,8 +94,6 @@ export declare type TFlowableLock<T = TVoidFunction> = IFlowableLock & {
94
94
  readonly q: Deque<T>;
95
95
  };
96
96
  export declare type TVoidFunction = () => void;
97
- export declare const acquire: (dis: TFlowableLock<TVoidFunction>, lazy?: boolean) => Promise<void>;
98
- export declare const release: (dis: TFlowableLock<TVoidFunction>) => void;
99
97
 
100
98
 
101
99
  /**
package/cjs/index.js CHANGED
@@ -1,5 +1,13 @@
1
1
  "use strict";
2
+ /*!
3
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
5
+ Released under the MIT license
6
+ https://opensource.org/licenses/mit-license.php
7
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.restrictor = exports.Deque = exports.create = exports.MiniSemaphore = void 0;
3
11
  var class_1 = require("./class");
4
12
  Object.defineProperty(exports, "MiniSemaphore", { enumerable: true, get: function () { return class_1.MiniSemaphore; } });
5
13
  var object_1 = require("./object");
package/cjs/object.js CHANGED
@@ -1,11 +1,18 @@
1
1
  "use strict";
2
+ /*!
3
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
5
+ Released under the MIT license
6
+ https://opensource.org/licenses/mit-license.php
7
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.create = void 0;
4
11
  const core = require("./core");
5
12
  const deque_1 = require("./deque");
6
13
  const a = core.acquire;
7
14
  const r = core.release;
8
- exports.create = (capacity) => {
15
+ const create = (capacity) => {
9
16
  return {
10
17
  capacity,
11
18
  limit: capacity,
@@ -33,3 +40,4 @@ exports.create = (capacity) => {
33
40
  }
34
41
  };
35
42
  };
43
+ exports.create = create;
package/esm/class.js CHANGED
@@ -1,3 +1,10 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
1
8
  import * as core from "./core";
2
9
  import { Deque } from "./deque";
3
10
  const a = core.acquire;
package/esm/core.js CHANGED
@@ -1,3 +1,10 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
1
8
  import { THROW } from "./extras";
2
9
  const box = (z, r) => {
3
10
  if (z.capacity > 0) {
package/esm/deque.js CHANGED
@@ -32,7 +32,6 @@ export class Deque {
32
32
  const i = (this._f + l) & (this._c - 1);
33
33
  this._a[i] = s;
34
34
  this._l = l + 1;
35
- return l + 1;
36
35
  }
37
36
  shift() {
38
37
  const l = this._l;
@@ -46,17 +45,6 @@ export class Deque {
46
45
  this._l = l - 1;
47
46
  return r;
48
47
  }
49
- clear() {
50
- const l = this._l;
51
- const f = this._f;
52
- const c = this._c;
53
- const a = this._a;
54
- for (let j = 0; j < l; ++j) {
55
- a[(f + j) & (c - 1)] = void 0;
56
- }
57
- this._l = 0;
58
- this._f = 0;
59
- }
60
48
  get length() {
61
49
  return this._l;
62
50
  }
@@ -1,22 +1,29 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
1
8
  import * as c from "./class";
2
- const { MiniSemaphore: MS } = c;
3
- const internalLock = new MS(1);
4
- let locks = Object.create(null);
5
- const get = async (key, restriction) => {
6
- await internalLock.acquire(false);
7
- let lock = locks[key];
8
- if (!lock) {
9
- locks[key] = lock = new MS(restriction);
10
- }
11
- if (lock.limit !== restriction) {
12
- internalLock.release();
13
- throw new ReferenceError(`Cannot get object with different restriction: key: '${key}', lock.limit: ${lock.limit} <-> restriction: ${restriction},`);
14
- }
15
- internalLock.release();
16
- return lock;
17
- };
18
9
  export var restrictor;
19
10
  (function (restrictor) {
11
+ const { MiniSemaphore: MS } = c;
12
+ const internalLock = new MS(1);
13
+ let locks = Object.create(null);
14
+ const get = async (key, restriction) => {
15
+ await internalLock.acquire(false);
16
+ let lock = locks[key];
17
+ if (!lock) {
18
+ locks[key] = lock = new MS(restriction);
19
+ }
20
+ if (lock.limit !== restriction) {
21
+ internalLock.release();
22
+ throw new ReferenceError(`Cannot get object with different restriction: key: '${key}', lock.limit: ${lock.limit} <-> restriction: ${restriction},`);
23
+ }
24
+ internalLock.release();
25
+ return lock;
26
+ };
20
27
  restrictor.getLockByKey = async (key) => {
21
28
  await internalLock.acquire(false);
22
29
  const l = locks[key];
@@ -50,9 +57,9 @@ export var restrictor;
50
57
  locks = newLocks;
51
58
  internalLock.release();
52
59
  if (debug) {
53
- console.log(`purged: [\n${eliminatedKeys.join(",\n")}\n]` +
60
+ console.log(`eliminated: [\n${eliminatedKeys.join(",\n")}\n]` +
54
61
  "\n" +
55
- `lived: [\n${Object.keys(newLocks).join(",\n")}\n]`);
62
+ `lived: [\n${Object.keys(newLocks).join(",\n")}\n]`);
56
63
  }
57
64
  return eliminatedCount;
58
65
  };
package/esm/index.d.ts CHANGED
@@ -32,8 +32,8 @@ export declare class Deque<T extends any> {
32
32
  /**
33
33
  * @param s subject
34
34
  */
35
- push(s: T): number;
36
- shift(): T | undefined;
35
+ push(s: T): void;
36
+ // shift(): T | undefined;
37
37
  clear(): void;
38
38
  get length(): number;
39
39
  }
@@ -94,8 +94,6 @@ export declare type TFlowableLock<T = TVoidFunction> = IFlowableLock & {
94
94
  readonly q: Deque<T>;
95
95
  };
96
96
  export declare type TVoidFunction = () => void;
97
- export declare const acquire: (dis: TFlowableLock<TVoidFunction>, lazy?: boolean) => Promise<void>;
98
- export declare const release: (dis: TFlowableLock<TVoidFunction>) => void;
99
97
 
100
98
 
101
99
  /**
package/esm/index.js CHANGED
@@ -1,3 +1,10 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
1
8
  export { MiniSemaphore } from "./class";
2
9
  export { create } from "./object";
3
10
  export { Deque } from "./deque";
package/esm/object.js CHANGED
@@ -1,3 +1,10 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
1
8
  import * as core from "./core";
2
9
  import { Deque } from "./deque";
3
10
  const a = core.acquire;
package/index.d.ts CHANGED
@@ -32,8 +32,8 @@ export declare class Deque<T extends any> {
32
32
  /**
33
33
  * @param s subject
34
34
  */
35
- push(s: T): number;
36
- shift(): T | undefined;
35
+ push(s: T): void;
36
+ // shift(): T | undefined;
37
37
  clear(): void;
38
38
  get length(): number;
39
39
  }
@@ -94,8 +94,6 @@ export declare type TFlowableLock<T = TVoidFunction> = IFlowableLock & {
94
94
  readonly q: Deque<T>;
95
95
  };
96
96
  export declare type TVoidFunction = () => void;
97
- export declare const acquire: (dis: TFlowableLock<TVoidFunction>, lazy?: boolean) => Promise<void>;
98
- export declare const release: (dis: TFlowableLock<TVoidFunction>) => void;
99
97
 
100
98
 
101
99
  /**
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "mini-semaphore",
3
- "version": "1.3.3",
3
+ "version": "1.3.9",
4
4
  "description": "A lightweight version of Semaphore",
5
5
  "private": false,
6
6
  "main": "./cjs/index.js",
7
- "module": "./esm/index.js",
7
+ "module": "./webpack-esm/index.mjs",
8
8
  "unpkg": "./umd/index.js",
9
9
  "sideEffects": false,
10
10
  "types": "./index.d.ts",
11
- "typings": "./index.d.ts",
12
11
  "author": "jeffy-g",
13
12
  "license": "MIT",
14
13
  "bugs": {
@@ -20,7 +19,7 @@
20
19
  "url": "git+https://github.com/jeffy-g/mini-semaphore.git"
21
20
  },
22
21
  "engines": {
23
- "node": ">=10",
22
+ "node": ">=v12.22.10",
24
23
  "yarn": "^1.22.4"
25
24
  },
26
25
  "files": [
@@ -31,9 +30,11 @@
31
30
  "esm",
32
31
  "umd",
33
32
  "webpack",
33
+ "webpack-esm",
34
34
  "*.d.ts"
35
35
  ],
36
36
  "keywords": [
37
+ "async",
37
38
  "lock",
38
39
  "mutex",
39
40
  "promise",
package/umd/index.d.ts CHANGED
@@ -32,8 +32,8 @@ export declare class Deque<T extends any> {
32
32
  /**
33
33
  * @param s subject
34
34
  */
35
- push(s: T): number;
36
- shift(): T | undefined;
35
+ push(s: T): void;
36
+ // shift(): T | undefined;
37
37
  clear(): void;
38
38
  get length(): number;
39
39
  }
@@ -94,8 +94,6 @@ export declare type TFlowableLock<T = TVoidFunction> = IFlowableLock & {
94
94
  readonly q: Deque<T>;
95
95
  };
96
96
  export declare type TVoidFunction = () => void;
97
- export declare const acquire: (dis: TFlowableLock<TVoidFunction>, lazy?: boolean) => Promise<void>;
98
- export declare const release: (dis: TFlowableLock<TVoidFunction>) => void;
99
97
 
100
98
 
101
99
  /**
package/umd/index.js CHANGED
@@ -1,192 +1,7 @@
1
- !function(t, e) {
2
- 'object' == typeof exports && 'object' == typeof module ? module.exports = e() : 'function' == typeof define && define.amd ? define([], e) : 'object' == typeof exports ? exports.MiniSema = e() : t.MiniSema = e();
3
- }(window, (function() {
4
- return function(t) {
5
- var e = {};
6
- function n(i) {
7
- if (e[i]) return e[i].exports;
8
- var r = e[i] = {
9
- i: i,
10
- l: !1,
11
- exports: {}
12
- };
13
- return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports;
14
- }
15
- return n.m = t, n.c = e, n.d = function(t, e, i) {
16
- n.o(t, e) || Object.defineProperty(t, e, {
17
- enumerable: !0,
18
- get: i
19
- });
20
- }, n.r = function(t) {
21
- 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
22
- value: 'Module'
23
- }), Object.defineProperty(t, '__esModule', {
24
- value: !0
25
- });
26
- }, n.t = function(t, e) {
27
- if (1 & e && (t = n(t)), 8 & e) return t;
28
- if (4 & e && 'object' == typeof t && t && t.__esModule) return t;
29
- var i = Object.create(null);
30
- if (n.r(i), Object.defineProperty(i, 'default', {
31
- enumerable: !0,
32
- value: t
33
- }), 2 & e && 'string' != typeof t) for (var r in t) n.d(i, r, function(e) {
34
- return t[e];
35
- }.bind(null, r));
36
- return i;
37
- }, n.n = function(t) {
38
- var e = t && t.__esModule ? function() {
39
- return t.default;
40
- } : function() {
41
- return t;
42
- };
43
- return n.d(e, 'a', e), e;
44
- }, n.o = function(t, e) {
45
- return Object.prototype.hasOwnProperty.call(t, e);
46
- }, n.p = "", n(n.s = 0);
47
- }([ function(t, e, n) {
48
- "use strict";
49
- n.r(e), n.d(e, "MiniSemaphore", (function() {
50
- return p;
51
- })), n.d(e, "create", (function() {
52
- return _;
53
- })), n.d(e, "Deque", (function() {
54
- return u;
55
- })), n.d(e, "restrictor", (function() {
56
- return g;
57
- }));
58
- var i = {};
59
- n.r(i), n.d(i, "MiniSemaphore", (function() {
60
- return p;
61
- }));
62
- const r = () => {
63
- throw new Error("mini-semaphore: inconsistent occurred");
64
- }, o = (t, e) => {
65
- t.capacity > 0 ? (t.capacity--, e()) : t.q.push(e);
66
- }, c = (t, e = !0) => new Promise(n => {
67
- e ? setTimeout(() => o(t, n), 4) : o(t, n);
68
- }), s = t => {
69
- t.capacity++, t.q.length && (t.capacity -= 1, (t.q.shift() || r)()), t.capacity > t.limit && (console.warn("inconsistent release!"),
70
- t.capacity = t.limit);
71
- }, a = t => (t => (t >>>= 0, t -= 1, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8,
72
- (t |= t >> 16) + 1))(Math.min(Math.max(16, 0 | t), 1073741824));
73
- class u {
74
- constructor(t) {
75
- this._c = a(t), this._l = 0, this._f = 0, this._a = [];
76
- }
77
- push(t) {
78
- const e = this._l;
79
- this._c < e + 1 && l(this, a(1.5 * this._c + 16));
80
- const n = this._f + e & this._c - 1;
81
- return this._a[n] = t, this._l = e + 1, e + 1;
82
- }
83
- shift() {
84
- const t = this._l;
85
- if (0 === t) return;
86
- const e = this._f, n = this._a[e];
87
- return this._a[e] = void 0, this._f = e + 1 & this._c - 1, this._l = t - 1, n;
88
- }
89
- clear() {
90
- const t = this._l, e = this._f, n = this._c, i = this._a;
91
- for (let r = 0; r < t; ++r) i[e + r & n - 1] = void 0;
92
- this._l = 0, this._f = 0;
93
- }
94
- get length() {
95
- return this._l;
96
- }
97
- }
98
- const l = (t, e) => {
99
- const n = t._c;
100
- t._c = e;
101
- const i = t._f, r = t._l;
102
- if (i + r > n) {
103
- const e = i + r & n - 1;
104
- ((t, e, n, i, r) => {
105
- for (let o = 0; o < r; ++o) n[o + i] = t[o + e], t[o + e] = void 0;
106
- })(t._a, 0, t._a, n, e);
107
- }
108
- }, f = c, h = s;
109
- class p {
110
- constructor(t) {
111
- this.limit = this.capacity = t, this.q = new u(t);
112
- }
113
- acquire(t) {
114
- return f(this, t);
115
- }
116
- release() {
117
- h(this);
118
- }
119
- setRestriction(t) {
120
- this.limit = this.capacity = t;
121
- }
122
- get pending() {
123
- return this.q.length;
124
- }
125
- async flow(t, e) {
126
- await f(this, e);
127
- try {
128
- return await t();
129
- } finally {
130
- h(this);
131
- }
132
- }
133
- }
134
- const y = c, d = s, _ = t => ({
135
- capacity: t,
136
- limit: t,
137
- q: new u(t),
138
- acquire(t) {
139
- return y(this, t);
140
- },
141
- release() {
142
- d(this);
143
- },
144
- setRestriction(t) {
145
- this.limit = this.capacity = t;
146
- },
147
- get pending() {
148
- return this.q.length;
149
- },
150
- async flow(t, e) {
151
- await y(this, e);
152
- try {
153
- return await t();
154
- } finally {
155
- d(this);
156
- }
157
- }
158
- }), {MiniSemaphore: m} = i, w = new m(1);
159
- let b = Object.create(null);
160
- var g;
161
- !function(t) {
162
- async function e(t, e, n) {
163
- const i = await (async (t, e) => {
164
- await w.acquire(!1);
165
- let n = b[t];
166
- if (n || (b[t] = n = new m(e)), n.limit !== e) throw w.release(), new ReferenceError(`Cannot get object with different restriction: key: '${t}', lock.limit: ${n.limit} <-> restriction: ${e},`);
167
- return w.release(), n;
168
- })(t, e), r = i.flow(n);
169
- return i.last = Date.now(), r;
170
- }
171
- t.getLockByKey = async t => {
172
- await w.acquire(!1);
173
- const e = b[t];
174
- return w.release(), e;
175
- }, t.cleanup = async (t, e) => {
176
- await w.acquire(!1);
177
- const n = b, i = Object.create(null), r = Object.keys(n);
178
- let o, c = 0;
179
- !t && (t = 1), t *= 1e3, e && (o = []);
180
- for (let s = 0, a = r.length; s < a; ) {
181
- const a = r[s++], u = n[a];
182
- u.last && Date.now() - u.last >= t ? (c++, e && o.push(a)) : i[a] = u;
183
- }
184
- return b = i, w.release(), e && console.log(`purged: [\n${o.join(",\n")}\n]\nlived: [\n${Object.keys(i).join(",\n")}\n]`),
185
- c;
186
- }, t.multi = e, t.one = async function(t, n) {
187
- return e(t, 1, n);
188
- };
189
- }(g || (g = {}));
190
- } ]);
191
- }));
192
- //# sourceMappingURL=index.js.map
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ !function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports.MiniSema=t():e.MiniSema=t()}(globalThis,(()=>(()=>{"use strict";var e={518:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MiniSemaphore=void 0;const r=i(461),n=i(761),s=r.acquire,c=r.release;t.MiniSemaphore=class{constructor(e){this.limit=this.capacity=e,this.q=new n.Deque(e)}acquire(e){return s(this,e)}release(){c(this)}setRestriction(e){this.limit=this.capacity=e}get pending(){return this.q.length}async flow(e,t){await s(this,t);try{return await e()}finally{c(this)}}}},461:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.release=t.acquire=void 0;const r=i(669),n=(e,t)=>{e.capacity>0?(e.capacity--,
3
+ t()):e.q.push(t)};t.acquire=(e,t=!0)=>new Promise((i=>{t?setTimeout((()=>n(e,i)),4):n(e,i)}));t.release=e=>{e.capacity++,e.q.length&&(e.capacity-=1,(e.q.shift()||r.THROW)()),e.capacity>e.limit&&(console.warn("inconsistent release!"),e.capacity=e.limit)}},761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Deque=void 0;const i=e=>(e=>(e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,1+(e|=e>>16)))(Math.min(Math.max(16,0|e),1073741824));t.Deque=class{constructor(e){this._c=i(e),this._l=0,this._f=0,this._a=[]}push(e){const t=this._l;this._c<t+1&&r(this,i(1.5*this._c+16));const n=this._f+t&this._c-1;this._a[n]=e,this._l=t+1}shift(){const e=this._l;if(0===e)return;const t=this._f,i=this._a[t];return this._a[t]=void 0,this._f=t+1&this._c-1,this._l=e-1,i}get length(){return this._l}}
4
+ ;const r=(e,t)=>{const i=e._c;e._c=t;const r=e._f,n=e._l;if(r+n>i){const t=r+n&i-1;((e,t,i,r,n)=>{for(let s=0;s<n;++s)i[s+r]=e[s+t],e[s+t]=void 0})(e._a,0,e._a,i,t)}}},669:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.THROW=void 0;t.THROW=()=>{throw new Error("mini-semaphore: inconsistent occurred")}},464:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.restrictor=void 0;const r=i(518);(e=>{const{MiniSemaphore:t}=r,i=new t(1);let n=Object.create(null);async function s(e,r,s){const c=await(async(e,r)=>{await i.acquire(!1);let s=n[e];if(s||(n[e]=s=new t(r)),s.limit!==r)throw i.release(),new ReferenceError(`Cannot get object with different restriction: key: '${e}', lock.limit: ${s.limit} <-> restriction: ${r},`);return i.release(),s})(e,r),a=c.flow(s)
5
+ ;return c.last=Date.now(),a}e.getLockByKey=async e=>{await i.acquire(!1);const t=n[e];return i.release(),t},e.cleanup=async(e,t)=>{await i.acquire(!1);const r=n,s=Object.create(null),c=Object.keys(r);let a,o=0;!e&&(e=1),e*=1e3,t&&(a=[]);for(let i=0,n=c.length;i<n;){const n=c[i++],l=r[n];l.last&&Date.now()-l.last>=e?(o++,t&&a.push(n)):s[n]=l}return n=s,i.release(),t&&console.log(`eliminated: [\n${a.join(",\n")}\n]\nlived: [\n${Object.keys(s).join(",\n")}\n]`),o},e.multi=s,e.one=async function(e,t){return s(e,1,t)}})(t.restrictor||(t.restrictor={}))},139:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0;const r=i(461),n=i(761),s=r.acquire,c=r.release;t.create=e=>({capacity:e,limit:e,q:new n.Deque(e),acquire(e){return s(this,e)},release(){c(this)},setRestriction(e){
6
+ this.limit=this.capacity=e},get pending(){return this.q.length},async flow(e,t){await s(this,t);try{return await e()}finally{c(this)}}})}},t={};function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,i),s.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.restrictor=e.Deque=e.create=e.MiniSemaphore=void 0;var t=i(518);Object.defineProperty(e,"MiniSemaphore",{enumerable:!0,get:function(){return t.MiniSemaphore}});var n=i(139);Object.defineProperty(e,"create",{enumerable:!0,get:function(){return n.create}});var s=i(761);Object.defineProperty(e,"Deque",{enumerable:!0,get:function(){return s.Deque}});var c=i(464);Object.defineProperty(e,"restrictor",{enumerable:!0,get:function(){return c.restrictor}})})(),r
7
+ })()));
@@ -0,0 +1,7 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
@@ -32,8 +32,8 @@ export declare class Deque<T extends any> {
32
32
  /**
33
33
  * @param s subject
34
34
  */
35
- push(s: T): number;
36
- shift(): T | undefined;
35
+ push(s: T): void;
36
+ // shift(): T | undefined;
37
37
  clear(): void;
38
38
  get length(): number;
39
39
  }
@@ -94,8 +94,6 @@ export declare type TFlowableLock<T = TVoidFunction> = IFlowableLock & {
94
94
  readonly q: Deque<T>;
95
95
  };
96
96
  export declare type TVoidFunction = () => void;
97
- export declare const acquire: (dis: TFlowableLock<TVoidFunction>, lazy?: boolean) => Promise<void>;
98
- export declare const release: (dis: TFlowableLock<TVoidFunction>) => void;
99
97
 
100
98
 
101
99
  /**
package/webpack/index.js CHANGED
@@ -1,188 +1,6 @@
1
- module.exports = function(t) {
2
- var e = {};
3
- function n(i) {
4
- if (e[i]) return e[i].exports;
5
- var r = e[i] = {
6
- i: i,
7
- l: !1,
8
- exports: {}
9
- };
10
- return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports;
11
- }
12
- return n.m = t, n.c = e, n.d = function(t, e, i) {
13
- n.o(t, e) || Object.defineProperty(t, e, {
14
- enumerable: !0,
15
- get: i
16
- });
17
- }, n.r = function(t) {
18
- 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
19
- value: 'Module'
20
- }), Object.defineProperty(t, '__esModule', {
21
- value: !0
22
- });
23
- }, n.t = function(t, e) {
24
- if (1 & e && (t = n(t)), 8 & e) return t;
25
- if (4 & e && 'object' == typeof t && t && t.__esModule) return t;
26
- var i = Object.create(null);
27
- if (n.r(i), Object.defineProperty(i, 'default', {
28
- enumerable: !0,
29
- value: t
30
- }), 2 & e && 'string' != typeof t) for (var r in t) n.d(i, r, function(e) {
31
- return t[e];
32
- }.bind(null, r));
33
- return i;
34
- }, n.n = function(t) {
35
- var e = t && t.__esModule ? function() {
36
- return t.default;
37
- } : function() {
38
- return t;
39
- };
40
- return n.d(e, 'a', e), e;
41
- }, n.o = function(t, e) {
42
- return Object.prototype.hasOwnProperty.call(t, e);
43
- }, n.p = "", n(n.s = 0);
44
- }([ function(t, e, n) {
45
- "use strict";
46
- n.r(e), n.d(e, "MiniSemaphore", (function() {
47
- return p;
48
- })), n.d(e, "create", (function() {
49
- return d;
50
- })), n.d(e, "Deque", (function() {
51
- return l;
52
- })), n.d(e, "restrictor", (function() {
53
- return b;
54
- }));
55
- var i = {};
56
- n.r(i), n.d(i, "MiniSemaphore", (function() {
57
- return p;
58
- }));
59
- const r = () => {
60
- throw new Error("mini-semaphore: inconsistent occurred");
61
- }, s = (t, e) => {
62
- t.capacity > 0 ? (t.capacity--, e()) : t.q.push(e);
63
- }, c = (t, e = !0) => new Promise(n => {
64
- e ? setTimeout(() => s(t, n), 4) : s(t, n);
65
- }), o = t => {
66
- t.capacity++, t.q.length && (t.capacity -= 1, (t.q.shift() || r)()), t.capacity > t.limit && (console.warn("inconsistent release!"),
67
- t.capacity = t.limit);
68
- }, a = t => (t => (t >>>= 0, t -= 1, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8,
69
- (t |= t >> 16) + 1))(Math.min(Math.max(16, 0 | t), 1073741824));
70
- class l {
71
- constructor(t) {
72
- this._c = a(t), this._l = 0, this._f = 0, this._a = [];
73
- }
74
- push(t) {
75
- const e = this._l;
76
- this._c < e + 1 && u(this, a(1.5 * this._c + 16));
77
- const n = this._f + e & this._c - 1;
78
- return this._a[n] = t, this._l = e + 1, e + 1;
79
- }
80
- shift() {
81
- const t = this._l;
82
- if (0 === t) return;
83
- const e = this._f, n = this._a[e];
84
- return this._a[e] = void 0, this._f = e + 1 & this._c - 1, this._l = t - 1, n;
85
- }
86
- clear() {
87
- const t = this._l, e = this._f, n = this._c, i = this._a;
88
- for (let r = 0; r < t; ++r) i[e + r & n - 1] = void 0;
89
- this._l = 0, this._f = 0;
90
- }
91
- get length() {
92
- return this._l;
93
- }
94
- }
95
- const u = (t, e) => {
96
- const n = t._c;
97
- t._c = e;
98
- const i = t._f, r = t._l;
99
- if (i + r > n) {
100
- const e = i + r & n - 1;
101
- ((t, e, n, i, r) => {
102
- for (let s = 0; s < r; ++s) n[s + i] = t[s + e], t[s + e] = void 0;
103
- })(t._a, 0, t._a, n, e);
104
- }
105
- }, h = c, f = o;
106
- class p {
107
- constructor(t) {
108
- this.limit = this.capacity = t, this.q = new l(t);
109
- }
110
- acquire(t) {
111
- return h(this, t);
112
- }
113
- release() {
114
- f(this);
115
- }
116
- setRestriction(t) {
117
- this.limit = this.capacity = t;
118
- }
119
- get pending() {
120
- return this.q.length;
121
- }
122
- async flow(t, e) {
123
- await h(this, e);
124
- try {
125
- return await t();
126
- } finally {
127
- f(this);
128
- }
129
- }
130
- }
131
- const y = c, _ = o, d = t => ({
132
- capacity: t,
133
- limit: t,
134
- q: new l(t),
135
- acquire(t) {
136
- return y(this, t);
137
- },
138
- release() {
139
- _(this);
140
- },
141
- setRestriction(t) {
142
- this.limit = this.capacity = t;
143
- },
144
- get pending() {
145
- return this.q.length;
146
- },
147
- async flow(t, e) {
148
- await y(this, e);
149
- try {
150
- return await t();
151
- } finally {
152
- _(this);
153
- }
154
- }
155
- }), {MiniSemaphore: m} = i, w = new m(1);
156
- let g = Object.create(null);
157
- var b;
158
- !function(t) {
159
- async function e(t, e, n) {
160
- const i = await (async (t, e) => {
161
- await w.acquire(!1);
162
- let n = g[t];
163
- if (n || (g[t] = n = new m(e)), n.limit !== e) throw w.release(), new ReferenceError(`Cannot get object with different restriction: key: '${t}', lock.limit: ${n.limit} <-> restriction: ${e},`);
164
- return w.release(), n;
165
- })(t, e), r = i.flow(n);
166
- return i.last = Date.now(), r;
167
- }
168
- t.getLockByKey = async t => {
169
- await w.acquire(!1);
170
- const e = g[t];
171
- return w.release(), e;
172
- }, t.cleanup = async (t, e) => {
173
- await w.acquire(!1);
174
- const n = g, i = Object.create(null), r = Object.keys(n);
175
- let s, c = 0;
176
- !t && (t = 1), t *= 1e3, e && (s = []);
177
- for (let o = 0, a = r.length; o < a; ) {
178
- const a = r[o++], l = n[a];
179
- l.last && Date.now() - l.last >= t ? (c++, e && s.push(a)) : i[a] = l;
180
- }
181
- return g = i, w.release(), e && console.log(`purged: [\n${s.join(",\n")}\n]\nlived: [\n${Object.keys(i).join(",\n")}\n]`),
182
- c;
183
- }, t.multi = e, t.one = async function(t, n) {
184
- return e(t, 1, n);
185
- };
186
- }(b || (b = {}));
187
- } ]);
188
- //# sourceMappingURL=index.js.map
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ (()=>{"use strict";var e={518:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MiniSemaphore=void 0;const r=i(461),n=i(761),s=r.acquire,a=r.release;t.MiniSemaphore=class{constructor(e){this.limit=this.capacity=e,this.q=new n.Deque(e)}acquire(e){return s(this,e)}release(){a(this)}setRestriction(e){this.limit=this.capacity=e}get pending(){return this.q.length}async flow(e,t){await s(this,t);try{return await e()}finally{a(this)}}}},461:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.release=t.acquire=void 0;const r=i(669),n=(e,t)=>{e.capacity>0?(e.capacity--,t()):e.q.push(t)};t.acquire=(e,t=!0)=>new Promise((i=>{t?setTimeout((()=>n(e,i)),4):n(e,i)}));t.release=e=>{e.capacity++,e.q.length&&(e.capacity-=1,(e.q.shift()||r.THROW)()),
3
+ e.capacity>e.limit&&(console.warn("inconsistent release!"),e.capacity=e.limit)}},761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Deque=void 0;const i=e=>(e=>(e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,1+(e|=e>>16)))(Math.min(Math.max(16,0|e),1073741824));t.Deque=class{constructor(e){this._c=i(e),this._l=0,this._f=0,this._a=[]}push(e){const t=this._l;this._c<t+1&&r(this,i(1.5*this._c+16));const n=this._f+t&this._c-1;this._a[n]=e,this._l=t+1}shift(){const e=this._l;if(0===e)return;const t=this._f,i=this._a[t];return this._a[t]=void 0,this._f=t+1&this._c-1,this._l=e-1,i}get length(){return this._l}};const r=(e,t)=>{const i=e._c;e._c=t;const r=e._f,n=e._l;if(r+n>i){const t=r+n&i-1;((e,t,i,r,n)=>{for(let s=0;s<n;++s)i[s+r]=e[s+t],e[s+t]=void 0})(e._a,0,e._a,i,t)}}},669:(e,t)=>{
4
+ Object.defineProperty(t,"__esModule",{value:!0}),t.THROW=void 0;t.THROW=()=>{throw new Error("mini-semaphore: inconsistent occurred")}},464:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.restrictor=void 0;const r=i(518);(e=>{const{MiniSemaphore:t}=r,i=new t(1);let n=Object.create(null);async function s(e,r,s){const a=await(async(e,r)=>{await i.acquire(!1);let s=n[e];if(s||(n[e]=s=new t(r)),s.limit!==r)throw i.release(),new ReferenceError(`Cannot get object with different restriction: key: '${e}', lock.limit: ${s.limit} <-> restriction: ${r},`);return i.release(),s})(e,r),c=a.flow(s);return a.last=Date.now(),c}e.getLockByKey=async e=>{await i.acquire(!1);const t=n[e];return i.release(),t},e.cleanup=async(e,t)=>{await i.acquire(!1)
5
+ ;const r=n,s=Object.create(null),a=Object.keys(r);let c,o=0;!e&&(e=1),e*=1e3,t&&(c=[]);for(let i=0,n=a.length;i<n;){const n=a[i++],l=r[n];l.last&&Date.now()-l.last>=e?(o++,t&&c.push(n)):s[n]=l}return n=s,i.release(),t&&console.log(`eliminated: [\n${c.join(",\n")}\n]\nlived: [\n${Object.keys(s).join(",\n")}\n]`),o},e.multi=s,e.one=async function(e,t){return s(e,1,t)}})(t.restrictor||(t.restrictor={}))},139:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0;const r=i(461),n=i(761),s=r.acquire,a=r.release;t.create=e=>({capacity:e,limit:e,q:new n.Deque(e),acquire(e){return s(this,e)},release(){a(this)},setRestriction(e){this.limit=this.capacity=e},get pending(){return this.q.length},async flow(e,t){await s(this,t);try{return await e()}finally{a(this)}}})}},t={}
6
+ ;function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,i),s.exports}var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.restrictor=e.Deque=e.create=e.MiniSemaphore=void 0;var t=i(518);Object.defineProperty(e,"MiniSemaphore",{enumerable:!0,get:function(){return t.MiniSemaphore}});var n=i(139);Object.defineProperty(e,"create",{enumerable:!0,get:function(){return n.create}});var s=i(761);Object.defineProperty(e,"Deque",{enumerable:!0,get:function(){return s.Deque}});var a=i(464);Object.defineProperty(e,"restrictor",{enumerable:!0,get:function(){return a.restrictor}})})(),module.exports=r})();
@@ -0,0 +1,7 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
@@ -0,0 +1,210 @@
1
+ /**
2
+ * ### Implementation restricted to FIFO
3
+ *
4
+ * this class is based on https://github.com/petkaantonov/deque/blob/master/js/deque.js
5
+ * Released under the MIT License: https://github.com/petkaantonov/deque/blob/master/LICENSE
6
+ */
7
+ export declare class Deque<T extends any> {
8
+ /**
9
+ * capacity
10
+ * @type {number}
11
+ */
12
+ _c: number;
13
+ /**
14
+ * current length (size
15
+ * @type {number}
16
+ */
17
+ _l: number;
18
+ /**
19
+ * current front position
20
+ * @type {number}
21
+ */
22
+ _f: number;
23
+ /**
24
+ * @type {T[]}
25
+ */
26
+ _a: T[];
27
+ /**
28
+ * default capacity `16`
29
+ * @param ic initial capacity
30
+ */
31
+ constructor(ic?: number);
32
+ /**
33
+ * @param s subject
34
+ */
35
+ push(s: T): void;
36
+ // shift(): T | undefined;
37
+ clear(): void;
38
+ get length(): number;
39
+ }
40
+
41
+ /**
42
+ * basic of simplified lock interface
43
+ */
44
+ export interface ISimplifiedLock {
45
+ /**
46
+ * acquire the process rights
47
+ *
48
+ * @param lazy Whether the privilege acquisition process is deffer. default `true`
49
+ */
50
+ acquire(lazy?: boolean): Promise<void>;
51
+ /**
52
+ * release the pending of one
53
+ */
54
+ release(): void;
55
+ /**
56
+ * Change sharing restrictions to the value of `restriction`
57
+ * @param {number} restriction
58
+ */
59
+ setRestriction(restriction: number): void;
60
+ /**
61
+ * Get the number of currently pending processes
62
+ * @type {number}
63
+ */
64
+ readonly pending: number;
65
+ /**
66
+ * limitation
67
+ */
68
+ limit: number;
69
+ /**
70
+ * capacity
71
+ */
72
+ capacity: number;
73
+ }
74
+ /**
75
+ * extention of `ISimplifiedLock` interface
76
+ */
77
+ export interface IFlowableLock extends ISimplifiedLock {
78
+ /**
79
+ * combination of acquire/release
80
+ *
81
+ * + acquire/release is automatic
82
+ *
83
+ * @param lazy Whether the privilege acquisition process is deffer. default `true`
84
+ */
85
+ flow<T>(f: () => Promise<T>, lazy?: boolean): Promise<T>;
86
+ }
87
+ /**
88
+ * internal type for `createMiniSemaphore`
89
+ */
90
+ export declare type TFlowableLock<T = TVoidFunction> = IFlowableLock & {
91
+ /**
92
+ * pending
93
+ */
94
+ readonly q: Deque<T>;
95
+ };
96
+ export declare type TVoidFunction = () => void;
97
+
98
+
99
+ /**
100
+ * #### Mini Semaphore
101
+ *
102
+ * + minimal implementation of semaphore
103
+ *
104
+ * @example
105
+ * import { MiniSemaphore } from "mini-semaphore";
106
+ *
107
+ * const s = new MiniSemaphore(10);
108
+ * async function fetchTypeData(type_id) {
109
+ * await s.acquire();
110
+ * try {
111
+ * return fetch(`https://esi.evetech.net/latest/universe/types/${type_id}/`);
112
+ * } finally {
113
+ * s.release();
114
+ * }
115
+ * }
116
+ *
117
+ * //
118
+ * // or automatic acquire/release
119
+ * //
120
+ * async function fetchTypeData(type_id) {
121
+ * return s.flow(async () => fetch(`https://esi.evetech.net/latest/universe/types/${type_id}/`));
122
+ * }
123
+ *
124
+ * @date 2020/2/7
125
+ * @version 1.0
126
+ */
127
+ export declare class MiniSemaphore implements TFlowableLock {
128
+ /**
129
+ * spare capacity
130
+ */
131
+ capacity: number;
132
+ /**
133
+ * limitation
134
+ */
135
+ limit: number;
136
+ /**
137
+ * queue of Promise's `resolve`
138
+ */
139
+ q: Deque<TVoidFunction>;
140
+ /**
141
+ * constructs a semaphore instance limited at `capacity`
142
+ *
143
+ * @param capacity limitation of concurrent async by `capacity`
144
+ */
145
+ constructor(capacity: number);
146
+ /**
147
+ * If there is enough capacity, execute the `resolve` immediately
148
+ *
149
+ * If not, put it in a queue and wait for the currently pending process to execute `release`
150
+ */
151
+ acquire(lazy?: boolean): Promise<void>;
152
+ release(): void;
153
+ setRestriction(restriction: number): void;
154
+ get pending(): number;
155
+ /**
156
+ * automatic acquire/release
157
+ * @param process
158
+ */
159
+ flow<T>(process: () => Promise<T>, lazy?: boolean): Promise<T>;
160
+ }
161
+
162
+ /**
163
+ * object implementation of `IFlowableLock`
164
+ *
165
+ * + constructs a semaphore object limited at `capacity`
166
+ *
167
+ * @param capacity limitation of concurrent async by `capacity`
168
+ * @date 2020/2/7
169
+ * @version 1.0
170
+ */
171
+ export declare const create: (capacity: number) => IFlowableLock;
172
+
173
+ declare namespace fr {
174
+ /**
175
+ * Eliminate unused instances for the `timeSpan` seconds
176
+ *
177
+ * @param timeSpan specify unit as seconds
178
+ * @returns {Promise<number>} eliminated count
179
+ * @date 2020/6/19
180
+ */
181
+ const cleanup: (timeSpan: number, debug?: true | undefined) => Promise<number>;
182
+ /**
183
+ * get the semaphore associated with the value of `key`
184
+ *
185
+ * + ⚠️ The object to be retrieved with `key` must already be created with `multi` ore `one`
186
+ *
187
+ * @param key
188
+ * @returns `IFlowableLock` instance or `undefined`
189
+ */
190
+ export const getLockByKey: (key: string | number) => Promise<IFlowableLock>;
191
+ /**
192
+ * Allocate a semaphore for each `key`, and limit the number of shares with the value of `restriction`
193
+ *
194
+ * @param key number or string as tag
195
+ * @param restriction number of process restriction
196
+ * @param pb the process body
197
+ */
198
+ export function multi<T>(key: string | number, restriction: number, pb: () => Promise<T>): Promise<T>;
199
+ /**
200
+ * synonym of `multi(key, 1, pb)`
201
+ *
202
+ * + use case
203
+ * * Avoid concurrent requests to the same url
204
+ *
205
+ * @param key number or string as tag
206
+ * @param pb the process body
207
+ */
208
+ export function one<T>(key: string | number, pb: () => Promise<T>): Promise<T>;
209
+ }
210
+ export declare const restrictor: typeof fr;
@@ -0,0 +1,6 @@
1
+ /*! For license information please see index.mjs.LICENSE.txt */
2
+ var e={518:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MiniSemaphore=void 0;const r=i(461),n=i(761),s=r.acquire,a=r.release;t.MiniSemaphore=class{constructor(e){this.limit=this.capacity=e,this.q=new n.Deque(e)}acquire(e){return s(this,e)}release(){a(this)}setRestriction(e){this.limit=this.capacity=e}get pending(){return this.q.length}async flow(e,t){await s(this,t);try{return await e()}finally{a(this)}}}},461:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.release=t.acquire=void 0;const r=i(669),n=(e,t)=>{e.capacity>0?(e.capacity--,t()):e.q.push(t)};t.acquire=(e,t=!0)=>new Promise((i=>{t?setTimeout((()=>n(e,i)),4):n(e,i)}));t.release=e=>{e.capacity++,e.q.length&&(e.capacity-=1,(e.q.shift()||r.THROW)()),
3
+ e.capacity>e.limit&&(console.warn("inconsistent release!"),e.capacity=e.limit)}},761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Deque=void 0;const i=e=>(e=>(e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,1+(e|=e>>16)))(Math.min(Math.max(16,0|e),1073741824));t.Deque=class{constructor(e){this._c=i(e),this._l=0,this._f=0,this._a=[]}push(e){const t=this._l;this._c<t+1&&r(this,i(1.5*this._c+16));const n=this._f+t&this._c-1;this._a[n]=e,this._l=t+1}shift(){const e=this._l;if(0===e)return;const t=this._f,i=this._a[t];return this._a[t]=void 0,this._f=t+1&this._c-1,this._l=e-1,i}get length(){return this._l}};const r=(e,t)=>{const i=e._c;e._c=t;const r=e._f,n=e._l;if(r+n>i){const t=r+n&i-1;((e,t,i,r,n)=>{for(let s=0;s<n;++s)i[s+r]=e[s+t],e[s+t]=void 0})(e._a,0,e._a,i,t)}}},669:(e,t)=>{
4
+ Object.defineProperty(t,"__esModule",{value:!0}),t.THROW=void 0;t.THROW=()=>{throw new Error("mini-semaphore: inconsistent occurred")}},464:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.restrictor=void 0;const r=i(518);(e=>{const{MiniSemaphore:t}=r,i=new t(1);let n=Object.create(null);async function s(e,r,s){const a=await(async(e,r)=>{await i.acquire(!1);let s=n[e];if(s||(n[e]=s=new t(r)),s.limit!==r)throw i.release(),new ReferenceError(`Cannot get object with different restriction: key: '${e}', lock.limit: ${s.limit} <-> restriction: ${r},`);return i.release(),s})(e,r),c=a.flow(s);return a.last=Date.now(),c}e.getLockByKey=async e=>{await i.acquire(!1);const t=n[e];return i.release(),t},e.cleanup=async(e,t)=>{await i.acquire(!1)
5
+ ;const r=n,s=Object.create(null),a=Object.keys(r);let c,o=0;!e&&(e=1),e*=1e3,t&&(c=[]);for(let i=0,n=a.length;i<n;){const n=a[i++],l=r[n];l.last&&Date.now()-l.last>=e?(o++,t&&c.push(n)):s[n]=l}return n=s,i.release(),t&&console.log(`eliminated: [\n${c.join(",\n")}\n]\nlived: [\n${Object.keys(s).join(",\n")}\n]`),o},e.multi=s,e.one=async function(e,t){return s(e,1,t)}})(t.restrictor||(t.restrictor={}))},139:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0;const r=i(461),n=i(761),s=r.acquire,a=r.release;t.create=e=>({capacity:e,limit:e,q:new n.Deque(e),acquire(e){return s(this,e)},release(){a(this)},setRestriction(e){this.limit=this.capacity=e},get pending(){return this.q.length},async flow(e,t){await s(this,t);try{return await e()}finally{a(this)}}})}},t={}
6
+ ;function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,i),s.exports}var r={};(()=>{var e=r;Object.defineProperty(e,"X$",{value:!0}),e.gD=e.P7=e.Ue=e.G3=void 0;var t=i(518);Object.defineProperty(e,"G3",{enumerable:!0,get:function(){return t.MiniSemaphore}});var n=i(139);Object.defineProperty(e,"Ue",{enumerable:!0,get:function(){return n.create}});var s=i(761);Object.defineProperty(e,"P7",{enumerable:!0,get:function(){return s.Deque}});var a=i(464);Object.defineProperty(e,"gD",{enumerable:!0,get:function(){return a.restrictor}})})();var n=r.P7,s=r.G3,a=r.X$,c=r.Ue,o=r.gD;export{n as Deque,s as MiniSemaphore,a as __esModule,c as create,o as restrictor};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
+ Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
4
+ Released under the MIT license
5
+ https://opensource.org/licenses/mit-license.php
6
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
+ */
package/umd/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["webpack://MiniSema/index.js"],"sourcesContent":["!function(t, e) {\n 'object' == typeof exports && 'object' == typeof module ? module.exports = e() : 'function' == typeof define && define.amd ? define([], e) : 'object' == typeof exports ? exports.MiniSema = e() : t.MiniSema = e();\n}(window, (function() {\n return function(t) {\n var e = {};\n function n(i) {\n if (e[i]) return e[i].exports;\n var r = e[i] = {\n i: i,\n l: !1,\n exports: {}\n };\n return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports;\n }\n return n.m = t, n.c = e, n.d = function(t, e, i) {\n n.o(t, e) || Object.defineProperty(t, e, {\n enumerable: !0,\n get: i\n });\n }, n.r = function(t) {\n 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {\n value: 'Module'\n }), Object.defineProperty(t, '__esModule', {\n value: !0\n });\n }, n.t = function(t, e) {\n if (1 & e && (t = n(t)), 8 & e) return t;\n if (4 & e && 'object' == typeof t && t && t.__esModule) return t;\n var i = Object.create(null);\n if (n.r(i), Object.defineProperty(i, 'default', {\n enumerable: !0,\n value: t\n }), 2 & e && 'string' != typeof t) for (var r in t) n.d(i, r, function(e) {\n return t[e];\n }.bind(null, r));\n return i;\n }, n.n = function(t) {\n var e = t && t.__esModule ? function() {\n return t.default;\n } : function() {\n return t;\n };\n return n.d(e, 'a', e), e;\n }, n.o = function(t, e) {\n return Object.prototype.hasOwnProperty.call(t, e);\n }, n.p = \"\", n(n.s = 0);\n }([ function(t, e, n) {\n \"use strict\";\n n.r(e), n.d(e, \"MiniSemaphore\", (function() {\n return p;\n })), n.d(e, \"create\", (function() {\n return _;\n })), n.d(e, \"Deque\", (function() {\n return u;\n })), n.d(e, \"restrictor\", (function() {\n return g;\n }));\n var i = {};\n n.r(i), n.d(i, \"MiniSemaphore\", (function() {\n return p;\n }));\n const r = () => {\n throw new Error(\"mini-semaphore: inconsistent occurred\");\n }, o = (t, e) => {\n t.capacity > 0 ? (t.capacity--, e()) : t.q.push(e);\n }, c = (t, e = !0) => new Promise(n => {\n e ? setTimeout(() => o(t, n), 4) : o(t, n);\n }), s = t => {\n t.capacity++, t.q.length && (t.capacity -= 1, (t.q.shift() || r)()), t.capacity > t.limit && (console.warn(\"inconsistent release!\"), \n t.capacity = t.limit);\n }, a = t => (t => (t >>>= 0, t -= 1, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8, \n (t |= t >> 16) + 1))(Math.min(Math.max(16, 0 | t), 1073741824));\n class u {\n constructor(t) {\n this._c = a(t), this._l = 0, this._f = 0, this._a = [];\n }\n push(t) {\n const e = this._l;\n this._c < e + 1 && l(this, a(1.5 * this._c + 16));\n const n = this._f + e & this._c - 1;\n return this._a[n] = t, this._l = e + 1, e + 1;\n }\n shift() {\n const t = this._l;\n if (0 === t) return;\n const e = this._f, n = this._a[e];\n return this._a[e] = void 0, this._f = e + 1 & this._c - 1, this._l = t - 1, n;\n }\n clear() {\n const t = this._l, e = this._f, n = this._c, i = this._a;\n for (let r = 0; r < t; ++r) i[e + r & n - 1] = void 0;\n this._l = 0, this._f = 0;\n }\n get length() {\n return this._l;\n }\n }\n const l = (t, e) => {\n const n = t._c;\n t._c = e;\n const i = t._f, r = t._l;\n if (i + r > n) {\n const e = i + r & n - 1;\n ((t, e, n, i, r) => {\n for (let o = 0; o < r; ++o) n[o + i] = t[o + e], t[o + e] = void 0;\n })(t._a, 0, t._a, n, e);\n }\n }, f = c, h = s;\n class p {\n constructor(t) {\n this.limit = this.capacity = t, this.q = new u(t);\n }\n acquire(t) {\n return f(this, t);\n }\n release() {\n h(this);\n }\n setRestriction(t) {\n this.limit = this.capacity = t;\n }\n get pending() {\n return this.q.length;\n }\n async flow(t, e) {\n await f(this, e);\n try {\n return await t();\n } finally {\n h(this);\n }\n }\n }\n const y = c, d = s, _ = t => ({\n capacity: t,\n limit: t,\n q: new u(t),\n acquire(t) {\n return y(this, t);\n },\n release() {\n d(this);\n },\n setRestriction(t) {\n this.limit = this.capacity = t;\n },\n get pending() {\n return this.q.length;\n },\n async flow(t, e) {\n await y(this, e);\n try {\n return await t();\n } finally {\n d(this);\n }\n }\n }), {MiniSemaphore: m} = i, w = new m(1);\n let b = Object.create(null);\n var g;\n !function(t) {\n async function e(t, e, n) {\n const i = await (async (t, e) => {\n await w.acquire(!1);\n let n = b[t];\n if (n || (b[t] = n = new m(e)), n.limit !== e) throw w.release(), new ReferenceError(`Cannot get object with different restriction: key: '${t}', lock.limit: ${n.limit} <-> restriction: ${e},`);\n return w.release(), n;\n })(t, e), r = i.flow(n);\n return i.last = Date.now(), r;\n }\n t.getLockByKey = async t => {\n await w.acquire(!1);\n const e = b[t];\n return w.release(), e;\n }, t.cleanup = async (t, e) => {\n await w.acquire(!1);\n const n = b, i = Object.create(null), r = Object.keys(n);\n let o, c = 0;\n !t && (t = 1), t *= 1e3, e && (o = []);\n for (let s = 0, a = r.length; s < a; ) {\n const a = r[s++], u = n[a];\n u.last && Date.now() - u.last >= t ? (c++, e && o.push(a)) : i[a] = u;\n }\n return b = i, w.release(), e && console.log(`purged: [\\n${o.join(\",\\n\")}\\n]\\nlived: [\\n${Object.keys(i).join(\",\\n\")}\\n]`), \n c;\n }, t.multi = e, t.one = async function(t, n) {\n return e(t, 1, n);\n };\n }(g || (g = {}));\n } ]);\n}));"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourceRoot":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["webpack:///index.js"],"sourcesContent":["module.exports = function(t) {\n var e = {};\n function n(i) {\n if (e[i]) return e[i].exports;\n var r = e[i] = {\n i: i,\n l: !1,\n exports: {}\n };\n return t[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports;\n }\n return n.m = t, n.c = e, n.d = function(t, e, i) {\n n.o(t, e) || Object.defineProperty(t, e, {\n enumerable: !0,\n get: i\n });\n }, n.r = function(t) {\n 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {\n value: 'Module'\n }), Object.defineProperty(t, '__esModule', {\n value: !0\n });\n }, n.t = function(t, e) {\n if (1 & e && (t = n(t)), 8 & e) return t;\n if (4 & e && 'object' == typeof t && t && t.__esModule) return t;\n var i = Object.create(null);\n if (n.r(i), Object.defineProperty(i, 'default', {\n enumerable: !0,\n value: t\n }), 2 & e && 'string' != typeof t) for (var r in t) n.d(i, r, function(e) {\n return t[e];\n }.bind(null, r));\n return i;\n }, n.n = function(t) {\n var e = t && t.__esModule ? function() {\n return t.default;\n } : function() {\n return t;\n };\n return n.d(e, 'a', e), e;\n }, n.o = function(t, e) {\n return Object.prototype.hasOwnProperty.call(t, e);\n }, n.p = \"\", n(n.s = 0);\n}([ function(t, e, n) {\n \"use strict\";\n n.r(e), n.d(e, \"MiniSemaphore\", (function() {\n return p;\n })), n.d(e, \"create\", (function() {\n return d;\n })), n.d(e, \"Deque\", (function() {\n return l;\n })), n.d(e, \"restrictor\", (function() {\n return b;\n }));\n var i = {};\n n.r(i), n.d(i, \"MiniSemaphore\", (function() {\n return p;\n }));\n const r = () => {\n throw new Error(\"mini-semaphore: inconsistent occurred\");\n }, s = (t, e) => {\n t.capacity > 0 ? (t.capacity--, e()) : t.q.push(e);\n }, c = (t, e = !0) => new Promise(n => {\n e ? setTimeout(() => s(t, n), 4) : s(t, n);\n }), o = t => {\n t.capacity++, t.q.length && (t.capacity -= 1, (t.q.shift() || r)()), t.capacity > t.limit && (console.warn(\"inconsistent release!\"), \n t.capacity = t.limit);\n }, a = t => (t => (t >>>= 0, t -= 1, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8, \n (t |= t >> 16) + 1))(Math.min(Math.max(16, 0 | t), 1073741824));\n class l {\n constructor(t) {\n this._c = a(t), this._l = 0, this._f = 0, this._a = [];\n }\n push(t) {\n const e = this._l;\n this._c < e + 1 && u(this, a(1.5 * this._c + 16));\n const n = this._f + e & this._c - 1;\n return this._a[n] = t, this._l = e + 1, e + 1;\n }\n shift() {\n const t = this._l;\n if (0 === t) return;\n const e = this._f, n = this._a[e];\n return this._a[e] = void 0, this._f = e + 1 & this._c - 1, this._l = t - 1, n;\n }\n clear() {\n const t = this._l, e = this._f, n = this._c, i = this._a;\n for (let r = 0; r < t; ++r) i[e + r & n - 1] = void 0;\n this._l = 0, this._f = 0;\n }\n get length() {\n return this._l;\n }\n }\n const u = (t, e) => {\n const n = t._c;\n t._c = e;\n const i = t._f, r = t._l;\n if (i + r > n) {\n const e = i + r & n - 1;\n ((t, e, n, i, r) => {\n for (let s = 0; s < r; ++s) n[s + i] = t[s + e], t[s + e] = void 0;\n })(t._a, 0, t._a, n, e);\n }\n }, h = c, f = o;\n class p {\n constructor(t) {\n this.limit = this.capacity = t, this.q = new l(t);\n }\n acquire(t) {\n return h(this, t);\n }\n release() {\n f(this);\n }\n setRestriction(t) {\n this.limit = this.capacity = t;\n }\n get pending() {\n return this.q.length;\n }\n async flow(t, e) {\n await h(this, e);\n try {\n return await t();\n } finally {\n f(this);\n }\n }\n }\n const y = c, _ = o, d = t => ({\n capacity: t,\n limit: t,\n q: new l(t),\n acquire(t) {\n return y(this, t);\n },\n release() {\n _(this);\n },\n setRestriction(t) {\n this.limit = this.capacity = t;\n },\n get pending() {\n return this.q.length;\n },\n async flow(t, e) {\n await y(this, e);\n try {\n return await t();\n } finally {\n _(this);\n }\n }\n }), {MiniSemaphore: m} = i, w = new m(1);\n let g = Object.create(null);\n var b;\n !function(t) {\n async function e(t, e, n) {\n const i = await (async (t, e) => {\n await w.acquire(!1);\n let n = g[t];\n if (n || (g[t] = n = new m(e)), n.limit !== e) throw w.release(), new ReferenceError(`Cannot get object with different restriction: key: '${t}', lock.limit: ${n.limit} <-> restriction: ${e},`);\n return w.release(), n;\n })(t, e), r = i.flow(n);\n return i.last = Date.now(), r;\n }\n t.getLockByKey = async t => {\n await w.acquire(!1);\n const e = g[t];\n return w.release(), e;\n }, t.cleanup = async (t, e) => {\n await w.acquire(!1);\n const n = g, i = Object.create(null), r = Object.keys(n);\n let s, c = 0;\n !t && (t = 1), t *= 1e3, e && (s = []);\n for (let o = 0, a = r.length; o < a; ) {\n const a = r[o++], l = n[a];\n l.last && Date.now() - l.last >= t ? (c++, e && s.push(a)) : i[a] = l;\n }\n return g = i, w.release(), e && console.log(`purged: [\\n${s.join(\",\\n\")}\\n]\\nlived: [\\n${Object.keys(i).join(\",\\n\")}\\n]`), \n c;\n }, t.multi = e, t.one = async function(t, n) {\n return e(t, 1, n);\n };\n }(b || (b = {}));\n} ]);"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourceRoot":""}