@tramvai/core 5.22.0 → 5.40.0

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/lib/index.d.ts CHANGED
@@ -4,5 +4,5 @@ export { createAction } from './actions/createActions';
4
4
  export * from './actions/declareAction';
5
5
  export * from '@tramvai/tokens-core';
6
6
  export { DI_TOKEN, IS_DI_CHILD_CONTAINER_TOKEN, Scope, Provider, createToken, provide, optional, ExtractTokenType, ExtractDependencyType, Module, MODULE_PARAMETERS, getModuleParameters, walkOfModules, isExtendedModule, ModuleType, ExtendedModule, declareModule, } from '@tinkoff/dippy';
7
- export { Deferred } from './utils/deferred';
7
+ export { Deferred } from './utils/deferred.inline';
8
8
  //# sourceMappingURL=index.d.ts.map
package/lib/index.es.js CHANGED
@@ -4,4 +4,4 @@ export { createAction } from './actions/createActions.es.js';
4
4
  export { declareAction, isTramvaiAction } from './actions/declareAction.es.js';
5
5
  export * from '@tramvai/tokens-core';
6
6
  export { DI_TOKEN, IS_DI_CHILD_CONTAINER_TOKEN, MODULE_PARAMETERS, Module, Scope, createToken, declareModule, getModuleParameters, isExtendedModule, optional, provide, walkOfModules } from '@tinkoff/dippy';
7
- export { Deferred } from './utils/deferred.es.js';
7
+ export { Deferred } from './utils/deferred.inline.es.js';
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ var createActions = require('./actions/createActions.js');
8
8
  var declareAction = require('./actions/declareAction.js');
9
9
  var tokensCore = require('@tramvai/tokens-core');
10
10
  var dippy = require('@tinkoff/dippy');
11
- var deferred = require('./utils/deferred.js');
11
+ var deferred_inline = require('./utils/deferred.inline.js');
12
12
 
13
13
 
14
14
 
@@ -66,7 +66,7 @@ Object.defineProperty(exports, 'walkOfModules', {
66
66
  enumerable: true,
67
67
  get: function () { return dippy.walkOfModules; }
68
68
  });
69
- exports.Deferred = deferred.Deferred;
69
+ exports.Deferred = deferred_inline.Deferred;
70
70
  Object.keys(tokensCore).forEach(function (k) {
71
71
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
72
72
  enumerable: true,
@@ -0,0 +1,14 @@
1
+ export declare class Deferred<T> {
2
+ promise: Promise<T>;
3
+ status: 'pending' | 'resolved' | 'rejected';
4
+ resolve: (value: T) => void;
5
+ reject: (reason: Error) => void;
6
+ resolveData: unknown;
7
+ rejectReason: Error | undefined;
8
+ isResolved: () => boolean;
9
+ isRejected: () => boolean;
10
+ reset: () => void;
11
+ private initPromise;
12
+ constructor();
13
+ }
14
+ //# sourceMappingURL=deferred.inline.d.ts.map
@@ -0,0 +1,40 @@
1
+ class Deferred {
2
+ constructor() {
3
+ this.status = 'pending';
4
+ this.resolve = () => { };
5
+ this.reject = () => { };
6
+ this.isResolved = () => {
7
+ return typeof this.resolveData !== 'undefined';
8
+ };
9
+ this.isRejected = () => {
10
+ return typeof this.rejectReason !== 'undefined';
11
+ };
12
+ this.reset = () => {
13
+ this.status = 'pending';
14
+ this.resolveData = undefined;
15
+ this.rejectReason = undefined;
16
+ this.promise = this.initPromise();
17
+ };
18
+ this.initPromise = () => {
19
+ return new Promise((resolve, reject) => {
20
+ this.resolve = (value) => {
21
+ if (this.status === 'pending') {
22
+ this.resolveData = value;
23
+ this.status = 'resolved';
24
+ resolve(value);
25
+ }
26
+ };
27
+ this.reject = (reason) => {
28
+ if (this.status === 'pending') {
29
+ this.rejectReason = reason;
30
+ this.status = 'rejected';
31
+ reject(reason);
32
+ }
33
+ };
34
+ });
35
+ };
36
+ this.promise = this.initPromise();
37
+ }
38
+ }
39
+
40
+ export { Deferred };
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ class Deferred {
6
+ constructor() {
7
+ this.status = 'pending';
8
+ this.resolve = () => { };
9
+ this.reject = () => { };
10
+ this.isResolved = () => {
11
+ return typeof this.resolveData !== 'undefined';
12
+ };
13
+ this.isRejected = () => {
14
+ return typeof this.rejectReason !== 'undefined';
15
+ };
16
+ this.reset = () => {
17
+ this.status = 'pending';
18
+ this.resolveData = undefined;
19
+ this.rejectReason = undefined;
20
+ this.promise = this.initPromise();
21
+ };
22
+ this.initPromise = () => {
23
+ return new Promise((resolve, reject) => {
24
+ this.resolve = (value) => {
25
+ if (this.status === 'pending') {
26
+ this.resolveData = value;
27
+ this.status = 'resolved';
28
+ resolve(value);
29
+ }
30
+ };
31
+ this.reject = (reason) => {
32
+ if (this.status === 'pending') {
33
+ this.rejectReason = reason;
34
+ this.status = 'rejected';
35
+ reject(reason);
36
+ }
37
+ };
38
+ });
39
+ };
40
+ this.promise = this.initPromise();
41
+ }
42
+ }
43
+
44
+ exports.Deferred = Deferred;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/core",
3
- "version": "5.22.0",
3
+ "version": "5.40.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@tinkoff/utils": "^2.1.2",
22
- "@tramvai/tokens-common": "5.22.0",
23
- "@tramvai/tokens-core": "5.22.0",
24
- "@tramvai/types-actions-state-context": "5.22.0",
22
+ "@tramvai/tokens-common": "5.40.0",
23
+ "@tramvai/tokens-core": "5.40.0",
24
+ "@tramvai/types-actions-state-context": "5.40.0",
25
25
  "@tinkoff/dippy": "0.11.3",
26
26
  "tslib": "^2.4.0"
27
27
  },
@@ -1,8 +0,0 @@
1
- export declare class Deferred<T> {
2
- status: 'pending' | 'resolved' | 'rejected';
3
- promise: Promise<T>;
4
- resolve: (value: T) => void;
5
- reject: (reason?: unknown) => void;
6
- constructor();
7
- }
8
- //# sourceMappingURL=deferred.d.ts.map
@@ -1,25 +0,0 @@
1
- import noop from '@tinkoff/utils/function/noop';
2
-
3
- class Deferred {
4
- constructor() {
5
- this.status = 'pending';
6
- this.resolve = noop;
7
- this.reject = noop;
8
- this.promise = new Promise((resolve, reject) => {
9
- this.resolve = (value) => {
10
- if (this.status === 'pending') {
11
- this.status = 'resolved';
12
- resolve(value);
13
- }
14
- };
15
- this.reject = (reason) => {
16
- if (this.status === 'pending') {
17
- this.status = 'rejected';
18
- reject(reason);
19
- }
20
- };
21
- });
22
- }
23
- }
24
-
25
- export { Deferred };
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var noop = require('@tinkoff/utils/function/noop');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
10
-
11
- class Deferred {
12
- constructor() {
13
- this.status = 'pending';
14
- this.resolve = noop__default["default"];
15
- this.reject = noop__default["default"];
16
- this.promise = new Promise((resolve, reject) => {
17
- this.resolve = (value) => {
18
- if (this.status === 'pending') {
19
- this.status = 'resolved';
20
- resolve(value);
21
- }
22
- };
23
- this.reject = (reason) => {
24
- if (this.status === 'pending') {
25
- this.status = 'rejected';
26
- reject(reason);
27
- }
28
- };
29
- });
30
- }
31
- }
32
-
33
- exports.Deferred = Deferred;