@anchan828/nest-cloud-run-queue-common 1.0.3-next.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 anchan828
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @anchan828/nest-cloud-run-queue-common
2
+
3
+ ## Install
4
+
5
+ ```shell
6
+ npm i @anchan828/nest-cloud-run-queue-common
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```typescript
12
+
13
+ ```
@@ -0,0 +1,2 @@
1
+ export * from "./interfaces";
2
+ export * from "./providers";
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces"), exports);
18
+ __exportStar(require("./providers"), exports);
@@ -0,0 +1,21 @@
1
+ import { Type } from "@nestjs/common";
2
+ import { ModuleMetadata } from "@nestjs/common/interfaces";
3
+ export declare type ModuleOptions = {};
4
+ export interface ModuleAsyncOptions<T extends ModuleOptions = ModuleOptions> extends Pick<ModuleMetadata, "imports"> {
5
+ useClass?: Type<ModuleOptionsFactory<T>>;
6
+ useExisting?: Type<ModuleOptionsFactory<T>>;
7
+ useFactory?: (...args: any[]) => Promise<T> | T;
8
+ inject?: Array<Type<ModuleOptionsFactory<T>> | string | any>;
9
+ }
10
+ export interface ModuleOptionsFactory<T extends ModuleOptions = ModuleOptions> {
11
+ createModuleOptions(): Promise<T> | T;
12
+ }
13
+ export declare type QueueWorkerName = string;
14
+ export interface Message<T = any> {
15
+ name: QueueWorkerName;
16
+ data?: T;
17
+ }
18
+ export declare type PublishExtraConfig<T extends Message = Message> = {
19
+ prePublish?: (message: T) => T | Promise<T>;
20
+ postPublish?: (message: T, messageId: string) => void | Promise<void>;
21
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Provider, Type } from "@nestjs/common";
2
+ import { Abstract, FactoryProvider } from "@nestjs/common/interfaces";
3
+ import { ModuleAsyncOptions, ModuleOptions } from "./interfaces";
4
+ declare type ProvideType = string | symbol | Type<any> | Abstract<any> | Function;
5
+ export declare function createOptionProvider(provide: ProvideType, options: ModuleOptions): Provider;
6
+ export declare function createAsyncOptionsProvider(provide: ProvideType, options: ModuleAsyncOptions): FactoryProvider;
7
+ export declare function createAsyncProviders(provide: ProvideType, options: ModuleAsyncOptions): Provider[];
8
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createAsyncProviders = exports.createAsyncOptionsProvider = exports.createOptionProvider = void 0;
13
+ function createOptionProvider(provide, options) {
14
+ return { provide, useValue: options };
15
+ }
16
+ exports.createOptionProvider = createOptionProvider;
17
+ function createAsyncOptionsProvider(provide, options) {
18
+ if (options.useFactory) {
19
+ return {
20
+ inject: options.inject || [],
21
+ provide,
22
+ useFactory: options.useFactory,
23
+ };
24
+ }
25
+ return {
26
+ inject: [options.useClass || options.useExisting].filter((x) => x !== undefined),
27
+ provide,
28
+ useFactory: (optionsFactory) => __awaiter(this, void 0, void 0, function* () { return optionsFactory.createModuleOptions(); }),
29
+ };
30
+ }
31
+ exports.createAsyncOptionsProvider = createAsyncOptionsProvider;
32
+ function createAsyncProviders(provide, options) {
33
+ const asyncOptionsProvider = createAsyncOptionsProvider(provide, options);
34
+ if (options.useExisting || options.useFactory) {
35
+ return [asyncOptionsProvider];
36
+ }
37
+ return [
38
+ asyncOptionsProvider,
39
+ {
40
+ provide: options.useClass,
41
+ useClass: options.useClass,
42
+ },
43
+ ];
44
+ }
45
+ exports.createAsyncProviders = createAsyncProviders;
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@anchan828/nest-cloud-run-queue-common",
3
+ "version": "1.0.3-next.0",
4
+ "description": "> TODO: description",
5
+ "homepage": "https://github.com/anchan828/nest-cloud-run-queue/tree/master/packages/common#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/anchan828/nest-cloud-run-queue/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/anchan828/nest-cloud-run-queue.git"
12
+ },
13
+ "license": "MIT",
14
+ "author": "anchan828 <anchan828@gmail.com>",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "directories": {
18
+ "dist": "dist"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc -p tsconfig.build.json",
25
+ "build:watch": "tsc --watch",
26
+ "copy:license": "cp ../../LICENSE ./",
27
+ "lint": "eslint --ignore-path ../../.eslintignore '**/*.ts'",
28
+ "lint:fix": "npm run lint -- --fix",
29
+ "prepublishOnly": "rm -rf dist && npm run build && rm -f dist/*.tsbuildinfo && npm run copy:license",
30
+ "test": "jest --coverage --logHeapUsage --runInBand",
31
+ "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --logHeapUsage",
32
+ "test:watch": "jest --watch",
33
+ "watch": "tsc -w"
34
+ },
35
+ "devDependencies": {
36
+ "@nestjs/common": "8.4.4",
37
+ "rxjs": "7.5.5"
38
+ },
39
+ "peerDependencies": {
40
+ "@nestjs/common": "^8.0.0"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "gitHead": "470341e04eead0d62396245ff1a3fe0c7ad4143e"
46
+ }