@qiwi/cyclone
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,8 @@ | ||
## [3.0.1](https://github.com/qiwi/cyclone/compare/v3.0.0...v3.0.1) (2019-04-02) | ||
### Bug Fixes | ||
* **package:** add missed tslib dep ([351edca](https://github.com/qiwi/cyclone/commit/351edca)) | ||
# [3.0.0](https://github.com/qiwi/cyclone/compare/v2.5.0...v3.0.0) (2019-02-09) | ||
@@ -2,0 +9,0 @@ |
@@ -107,12 +107,11 @@ "use strict"; | ||
} | ||
if (state !== undefined) { | ||
var last = this.last(state); | ||
if (!last) { | ||
throw new error_1.MachineError(error_1.UNREACHABLE_STATE); | ||
} | ||
this.history.length = this.history.indexOf(last) + 1; | ||
} | ||
else { | ||
if (state === undefined) { | ||
this.history.pop(); | ||
return this; | ||
} | ||
var last = this.last(state); | ||
if (!last) { | ||
throw new error_1.MachineError(error_1.UNREACHABLE_STATE); | ||
} | ||
this.history.length = this.history.indexOf(last) + 1; | ||
return this; | ||
@@ -125,8 +124,5 @@ }; | ||
Machine.prototype.lock = function (key) { | ||
if (key) { | ||
this.key = key; | ||
} | ||
else { | ||
this.key = "lock" + Math.random(); | ||
} | ||
this.key = key | ||
? key | ||
: "lock" + generator_1.generateId(); | ||
return this; | ||
@@ -133,0 +129,0 @@ }; |
@@ -91,12 +91,11 @@ import { MachineError, LOCK_VIOLATION, TRANSITION_VIOLATION, INVALID_UNLOCK_KEY, UNREACHABLE_STATE } from './error'; | ||
} | ||
if (state !== undefined) { | ||
const last = this.last(state); | ||
if (!last) { | ||
throw new MachineError(UNREACHABLE_STATE); | ||
} | ||
this.history.length = this.history.indexOf(last) + 1; | ||
} | ||
else { | ||
if (state === undefined) { | ||
this.history.pop(); | ||
return this; | ||
} | ||
const last = this.last(state); | ||
if (!last) { | ||
throw new MachineError(UNREACHABLE_STATE); | ||
} | ||
this.history.length = this.history.indexOf(last) + 1; | ||
return this; | ||
@@ -109,8 +108,5 @@ } | ||
lock(key) { | ||
if (key) { | ||
this.key = key; | ||
} | ||
else { | ||
this.key = `lock${Math.random()}`; | ||
} | ||
this.key = key | ||
? key | ||
: `lock${generateId()}`; | ||
return this; | ||
@@ -117,0 +113,0 @@ } |
@@ -17,5 +17,5 @@ import { | ||
type IFactoryOpts = { | ||
machine?: IMachineOpts, | ||
template?: string | Object, | ||
templateRegistry?: Registry, | ||
machine?: IMachineOpts | ||
template?: string | Object | ||
templateRegistry?: Registry | ||
machineRegistry?: Registry | ||
@@ -26,3 +26,8 @@ } | ||
// NOTE flowgen throws error on typed args destruction | ||
const { machine, template, templateRegistry = DEFAULT_TEMPLATE_REGISTRY, machineRegistry = DEFAULT_MACHINE_REGISTRY } = opts | ||
const { | ||
machine, | ||
template, | ||
templateRegistry = DEFAULT_TEMPLATE_REGISTRY, | ||
machineRegistry = DEFAULT_MACHINE_REGISTRY | ||
} = opts | ||
const _template = getTemplate(template, templateRegistry) | ||
@@ -29,0 +34,0 @@ const machineOpts: IMachineOpts = { ...DEFAULT_MACHINE_OPTS, ..._template, ...machine } |
@@ -75,2 +75,3 @@ import { | ||
export class Machine implements IMachine { | ||
/** | ||
@@ -191,15 +192,14 @@ * Machine options. | ||
if (state !== undefined) { | ||
const last = this.last(state) | ||
if (state === undefined) { | ||
this.history.pop() | ||
return this | ||
} | ||
if (!last) { | ||
throw new MachineError(UNREACHABLE_STATE) | ||
} | ||
const last = this.last(state) | ||
if (!last) { | ||
throw new MachineError(UNREACHABLE_STATE) | ||
} | ||
this.history.length = this.history.indexOf(last) + 1 | ||
this.history.length = this.history.indexOf(last) + 1 | ||
} else { | ||
this.history.pop() | ||
} | ||
return this | ||
@@ -213,7 +213,5 @@ } | ||
public lock (key?: IKey): IMachine { | ||
if (key) { | ||
this.key = key | ||
} else { | ||
this.key = `lock${Math.random()}` | ||
} | ||
this.key = key | ||
? key | ||
: `lock${generateId()}` | ||
@@ -290,2 +288,3 @@ return this | ||
public DEFAULT_HANDLER = DEFAULT_HANDLER | ||
} | ||
@@ -292,0 +291,0 @@ |
export class Registry { | ||
store: { [key: string]: any } | ||
@@ -19,2 +20,3 @@ | ||
} | ||
} |
{ | ||
"name": "@qiwi/cyclone", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "\"State machine\" for basic purposes", | ||
@@ -9,3 +9,4 @@ "main": "lib/es5/index.js", | ||
"jest": "jest --config=jest.config.json", | ||
"lint": "tslint src/**/*.ts --fix", | ||
"lint": "tslint -p tsconfig.lint.json src/**/*.ts", | ||
"lint:fix": "yarn lint -- --fix", | ||
"test": "yarn lint && yarn jest", | ||
@@ -51,3 +52,5 @@ "clean": "rm -rf lib typings", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
@@ -58,19 +61,19 @@ "@semantic-release/changelog": "^3.0.2", | ||
"@semantic-release/npm": "^5.1.4", | ||
"@types/jest": "^24.0.0", | ||
"@types/jest": "^24.0.11", | ||
"@types/jest-json-schema": "^1.2.1", | ||
"coveralls": "^3.0.2", | ||
"coveralls": "^3.0.3", | ||
"dts-generator": "^3.0.0", | ||
"eslint-plugin-typescript": "^0.14.0", | ||
"esm": "^3.2.4", | ||
"flowgen": "1.5.8", | ||
"jest": "^24.1.0", | ||
"esm": "^3.2.22", | ||
"flowgen": "1.8.0", | ||
"jest": "^24.6.0", | ||
"lodash": "^4.17.11", | ||
"replace-in-file": "^3.4.4", | ||
"semantic-release": "^15.13.3", | ||
"replace-in-file": "^3.4.3", | ||
"ts-jest": "^23.10.5", | ||
"tslib": "^1.9.3", | ||
"tslint": "^5.12.1", | ||
"ts-jest": "^24.0.1", | ||
"tslint": "^5.15.0", | ||
"tslint-config-qiwi": "^1.0.1", | ||
"tslint-config-standard": "^8.0.1", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.3.3", | ||
"typescript": "^3.4.1", | ||
"typescript-eslint-parser": "^22.0.0" | ||
@@ -77,0 +80,0 @@ }, |
/** | ||
* Flowtype definitions for index | ||
* Generated by Flowgen from a Typescript Definition | ||
* Flowgen v1.5.8 | ||
* Flowgen v1.8.0 | ||
* Author: [Joar Wilk](http://twitter.com/joarwilk) | ||
@@ -6,0 +6,0 @@ * Repo: http://github.com/joarwilk/flowgen |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63193
1
1152
+ Addedtslib@^1.9.3
+ Addedtslib@1.14.1(transitive)