@matrixai/async-init
Advanced tools
Comparing version 0.0.2 to 1.0.0
@@ -15,4 +15,2 @@ interface CreateDestroy { | ||
declare function ready(errorDestroyed?: Error): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor; | ||
export default CreateDestroy; | ||
export { ready }; | ||
export type { CreateDestroy }; | ||
export { CreateDestroy, ready }; |
@@ -1,3 +0,6 @@ | ||
import { AsyncFunction, GeneratorFunction, AsyncGeneratorFunction, } from './utils'; | ||
import { ErrorAsyncInitDestroyed } from './errors'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ready = exports.CreateDestroy = void 0; | ||
const utils_1 = require("./utils"); | ||
const errors_1 = require("./errors"); | ||
function CreateDestroy() { | ||
@@ -31,3 +34,4 @@ return (constructor) => { | ||
} | ||
function ready(errorDestroyed = new ErrorAsyncInitDestroyed()) { | ||
exports.CreateDestroy = CreateDestroy; | ||
function ready(errorDestroyed = new errors_1.ErrorAsyncInitDestroyed()) { | ||
return (target, key, descriptor) => { | ||
@@ -38,3 +42,3 @@ const f = descriptor.value; | ||
} | ||
if (descriptor.value instanceof AsyncFunction) { | ||
if (descriptor.value instanceof utils_1.AsyncFunction) { | ||
descriptor.value = async function (...args) { | ||
@@ -47,3 +51,3 @@ if (this._destroyed) { | ||
} | ||
else if (descriptor.value instanceof GeneratorFunction) { | ||
else if (descriptor.value instanceof utils_1.GeneratorFunction) { | ||
descriptor.value = function* (...args) { | ||
@@ -56,3 +60,3 @@ if (this._destroyed) { | ||
} | ||
else if (descriptor.value instanceof AsyncGeneratorFunction) { | ||
else if (descriptor.value instanceof utils_1.AsyncGeneratorFunction) { | ||
descriptor.value = async function* (...args) { | ||
@@ -78,4 +82,3 @@ if (this._destroyed) { | ||
} | ||
export default CreateDestroy; | ||
export { ready }; | ||
exports.ready = ready; | ||
//# sourceMappingURL=CreateDestroy.js.map |
@@ -24,4 +24,2 @@ interface CreateDestroyStartStop { | ||
declare function ready(errorNotRunning?: Error): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor; | ||
export default CreateDestroyStartStop; | ||
export { ready }; | ||
export type { CreateDestroyStartStop }; | ||
export { CreateDestroyStartStop, ready }; |
@@ -1,4 +0,7 @@ | ||
import { AsyncFunction, GeneratorFunction, AsyncGeneratorFunction, } from './utils'; | ||
import { ErrorAsyncInitRunning, ErrorAsyncInitNotRunning, ErrorAsyncInitDestroyed, } from './errors'; | ||
function CreateDestroyStartStop(errorRunning = new ErrorAsyncInitRunning(), errorDestroyed = new ErrorAsyncInitDestroyed()) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ready = exports.CreateDestroyStartStop = void 0; | ||
const utils_1 = require("./utils"); | ||
const errors_1 = require("./errors"); | ||
function CreateDestroyStartStop(errorRunning = new errors_1.ErrorAsyncInitRunning(), errorDestroyed = new errors_1.ErrorAsyncInitDestroyed()) { | ||
return (constructor) => { | ||
@@ -76,3 +79,4 @@ return class extends constructor { | ||
} | ||
function ready(errorNotRunning = new ErrorAsyncInitNotRunning()) { | ||
exports.CreateDestroyStartStop = CreateDestroyStartStop; | ||
function ready(errorNotRunning = new errors_1.ErrorAsyncInitNotRunning()) { | ||
return (target, key, descriptor) => { | ||
@@ -83,3 +87,3 @@ const f = descriptor.value; | ||
} | ||
if (descriptor.value instanceof AsyncFunction) { | ||
if (descriptor.value instanceof utils_1.AsyncFunction) { | ||
descriptor.value = async function (...args) { | ||
@@ -92,3 +96,3 @@ if (!this._running) { | ||
} | ||
else if (descriptor.value instanceof GeneratorFunction) { | ||
else if (descriptor.value instanceof utils_1.GeneratorFunction) { | ||
descriptor.value = function* (...args) { | ||
@@ -101,3 +105,3 @@ if (!this._running) { | ||
} | ||
else if (descriptor.value instanceof AsyncGeneratorFunction) { | ||
else if (descriptor.value instanceof utils_1.AsyncGeneratorFunction) { | ||
descriptor.value = async function* (...args) { | ||
@@ -123,4 +127,3 @@ if (!this._running) { | ||
} | ||
export default CreateDestroyStartStop; | ||
export { ready }; | ||
exports.ready = ready; | ||
//# sourceMappingURL=CreateDestroyStartStop.js.map |
@@ -1,11 +0,17 @@ | ||
import { CustomError } from 'ts-custom-error'; | ||
class ErrorAsyncInit extends CustomError { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ErrorAsyncInitDestroyed = exports.ErrorAsyncInitNotRunning = exports.ErrorAsyncInitRunning = exports.ErrorAsyncInit = void 0; | ||
const ts_custom_error_1 = require("ts-custom-error"); | ||
class ErrorAsyncInit extends ts_custom_error_1.CustomError { | ||
} | ||
exports.ErrorAsyncInit = ErrorAsyncInit; | ||
class ErrorAsyncInitRunning extends ErrorAsyncInit { | ||
} | ||
exports.ErrorAsyncInitRunning = ErrorAsyncInitRunning; | ||
class ErrorAsyncInitNotRunning extends ErrorAsyncInit { | ||
} | ||
exports.ErrorAsyncInitNotRunning = ErrorAsyncInitNotRunning; | ||
class ErrorAsyncInitDestroyed extends ErrorAsyncInit { | ||
} | ||
export { ErrorAsyncInit, ErrorAsyncInitRunning, ErrorAsyncInitNotRunning, ErrorAsyncInitDestroyed, }; | ||
exports.ErrorAsyncInitDestroyed = ErrorAsyncInitDestroyed; | ||
//# sourceMappingURL=errors.js.map |
@@ -1,5 +0,27 @@ | ||
export * as createDestroyStartStop from './CreateDestroyStartStop'; | ||
export * as createDestroy from './CreateDestroy'; | ||
export * as startStop from './StartStop'; | ||
export * as errors from './errors'; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.errors = exports.startStop = exports.createDestroy = exports.createDestroyStartStop = void 0; | ||
exports.createDestroyStartStop = __importStar(require("./CreateDestroyStartStop")); | ||
exports.createDestroy = __importStar(require("./CreateDestroy")); | ||
exports.startStop = __importStar(require("./StartStop")); | ||
exports.errors = __importStar(require("./errors")); | ||
//# sourceMappingURL=index.js.map |
@@ -18,4 +18,2 @@ interface StartStop { | ||
declare function ready(errorNotRunning?: Error): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor; | ||
export default StartStop; | ||
export { ready }; | ||
export type { StartStop }; | ||
export { StartStop, ready }; |
@@ -1,3 +0,6 @@ | ||
import { AsyncFunction, GeneratorFunction, AsyncGeneratorFunction, } from './utils'; | ||
import { ErrorAsyncInitNotRunning } from './errors'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ready = exports.StartStop = void 0; | ||
const utils_1 = require("./utils"); | ||
const errors_1 = require("./errors"); | ||
function StartStop() { | ||
@@ -46,3 +49,4 @@ return (constructor) => { | ||
} | ||
function ready(errorNotRunning = new ErrorAsyncInitNotRunning()) { | ||
exports.StartStop = StartStop; | ||
function ready(errorNotRunning = new errors_1.ErrorAsyncInitNotRunning()) { | ||
return (target, key, descriptor) => { | ||
@@ -53,3 +57,3 @@ const f = descriptor.value; | ||
} | ||
if (descriptor.value instanceof AsyncFunction) { | ||
if (descriptor.value instanceof utils_1.AsyncFunction) { | ||
descriptor.value = async function (...args) { | ||
@@ -62,3 +66,3 @@ if (!this._running) { | ||
} | ||
else if (descriptor.value instanceof GeneratorFunction) { | ||
else if (descriptor.value instanceof utils_1.GeneratorFunction) { | ||
descriptor.value = function* (...args) { | ||
@@ -71,3 +75,3 @@ if (!this._running) { | ||
} | ||
else if (descriptor.value instanceof AsyncGeneratorFunction) { | ||
else if (descriptor.value instanceof utils_1.AsyncGeneratorFunction) { | ||
descriptor.value = async function* (...args) { | ||
@@ -93,4 +97,3 @@ if (!this._running) { | ||
} | ||
export default StartStop; | ||
export { ready }; | ||
exports.ready = ready; | ||
//# sourceMappingURL=StartStop.js.map |
@@ -0,5 +1,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AsyncGeneratorFunction = exports.GeneratorFunction = exports.AsyncFunction = void 0; | ||
const AsyncFunction = (async () => { }).constructor; | ||
exports.AsyncFunction = AsyncFunction; | ||
const GeneratorFunction = function* () { }.constructor; | ||
exports.GeneratorFunction = GeneratorFunction; | ||
const AsyncGeneratorFunction = async function* () { }.constructor; | ||
export { AsyncFunction, GeneratorFunction, AsyncGeneratorFunction }; | ||
exports.AsyncGeneratorFunction = AsyncGeneratorFunction; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@matrixai/async-init", | ||
"version": "0.0.2", | ||
"version": "1.0.0", | ||
"author": "Roger Qiu", | ||
@@ -11,10 +11,4 @@ "description": "Asynchronous Initialisation and Deinitialisation Decorators", | ||
}, | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
"./create-destroy-start-stop": "./dist/CreateDestroyStartStop.js", | ||
"./create-destroy": "./dist/CreateDestroy.js", | ||
"./start-stop": "./dist/StartStop.js" | ||
}, | ||
"scripts": { | ||
@@ -21,0 +15,0 @@ "build": "tsc -p ./tsconfig.build.json", |
@@ -10,3 +10,3 @@ # js-async-init | ||
```ts | ||
import CreateDestroyStartStop, { ready } from '@matrixai/async-init/create-destroy-start-stop'; | ||
import { CreateDestroyStartStop, ready } from '@matrixai/async-init/dist/CreateDestroyStartStop'; | ||
@@ -13,0 +13,0 @@ interface X extends CreateDestroyStartStop {}; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
39399
420
1
No