koatty_store 1.5.4 → 1.5.5

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.
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "koatty_store",
3
+ "version": "1.5.5",
4
+ "description": "Cache store for koatty.",
5
+ "scripts": {
6
+ "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
7
+ "build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
8
+ "build:js": "del-cli --force dist && npx rollup -c .rollup.config.js",
9
+ "build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
10
+ "build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
11
+ "eslint": "eslint --ext .ts,.js ./",
12
+ "prepublishOnly": "npm test && npm run build",
13
+ "prerelease": "npm test && npm run build",
14
+ "release": "standard-version",
15
+ "test": "npm run eslint && jest --passWithNoTests"
16
+ },
17
+ "main": "./dist/index.js",
18
+ "exports": {
19
+ "require": "./dist/index.js",
20
+ "import": "./dist/index.mjs"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/koatty/koatty_store.git"
25
+ },
26
+ "keywords": [
27
+ "web",
28
+ "typescript",
29
+ "framework",
30
+ "mvc",
31
+ "koa2",
32
+ "restful",
33
+ "agile",
34
+ "koatty_store",
35
+ "koatty"
36
+ ],
37
+ "engines": {
38
+ "node": ">10.0.0"
39
+ },
40
+ "author": {
41
+ "name": "richenlin",
42
+ "email": "richenlin@gmail.com"
43
+ },
44
+ "license": "BSD-3-Clause",
45
+ "bugs": {
46
+ "url": "https://github.com/koatty/koatty_store/issues"
47
+ },
48
+ "homepage": "https://github.com/koatty/koatty_store",
49
+ "maintainers": [
50
+ {
51
+ "name": "richenlin",
52
+ "email": "richenlin@gmail.com"
53
+ }
54
+ ],
55
+ "devDependencies": {
56
+ "@commitlint/cli": "^17.x.x",
57
+ "@commitlint/config-conventional": "^17.x.x",
58
+ "@microsoft/api-documenter": "^7.x.x",
59
+ "@microsoft/api-extractor": "^7.x.x",
60
+ "@rollup/plugin-json": "^4.x.x",
61
+ "@types/jest": "^27.x.x",
62
+ "@types/koa": "^2.x.x",
63
+ "@types/node": "^16.x.x",
64
+ "@typescript-eslint/eslint-plugin": "^5.x.x",
65
+ "@typescript-eslint/parser": "^5.x.x",
66
+ "conventional-changelog-cli": "^2.x.x",
67
+ "copyfiles": "^2.x.x",
68
+ "del-cli": "^4.x.x",
69
+ "eslint": "^8.x.x",
70
+ "eslint-plugin-jest": "^26.x.x",
71
+ "husky": "^4.x.x",
72
+ "jest": "^28.x.x",
73
+ "jest-html-reporters": "^3.x.x",
74
+ "rollup": "^2.x.x",
75
+ "rollup-plugin-typescript2": "^0.x.x",
76
+ "standard-version": "^9.x.x",
77
+ "ts-jest": "^28.x.x",
78
+ "ts-node": "^10.x.x",
79
+ "typescript": "^4.x.x"
80
+ },
81
+ "dependencies": {
82
+ "@types/ioredis": "^4.x.x",
83
+ "generic-pool": "^3.8.2",
84
+ "ioredis": "^4.28.5",
85
+ "koatty_lib": "^1.x.x",
86
+ "koatty_logger": "^1.x.x"
87
+ },
88
+ "peerDependencies": {
89
+ "koatty_lib": "^1.x.x",
90
+ "koatty_logger": "^1.x.x"
91
+ }
92
+ }
package/package.json CHANGED
@@ -1,18 +1,24 @@
1
1
  {
2
2
  "name": "koatty_store",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "Cache store for koatty.",
5
5
  "scripts": {
6
- "build": "del-cli --force dist && tsc",
6
+ "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
7
+ "build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
8
+ "build:js": "del-cli --force dist && npx rollup -c .rollup.config.js",
9
+ "build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
10
+ "build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
7
11
  "eslint": "eslint --ext .ts,.js ./",
8
12
  "prepublishOnly": "npm test && npm run build",
9
- "release": "npm run prepublishOnly && standard-version",
10
- "pub": "git push --follow-tags origin && npm publish",
11
- "test": "npm run eslint && jest --passWithNoTests",
12
- "test:cov": "jest --collectCoverage --detectOpenHandles",
13
- "version": "conventional-changelog -p angular -i CHANGELOG.md -s"
13
+ "prerelease": "npm test && npm run build",
14
+ "release": "standard-version",
15
+ "test": "npm run eslint && jest --passWithNoTests"
14
16
  },
15
17
  "main": "./dist/index.js",
18
+ "exports": {
19
+ "require": "./dist/index.js",
20
+ "import": "./dist/index.mjs"
21
+ },
16
22
  "repository": {
17
23
  "type": "git",
18
24
  "url": "git+https://github.com/koatty/koatty_store.git"
@@ -47,39 +53,40 @@
47
53
  }
48
54
  ],
49
55
  "devDependencies": {
50
- "@babel/core": "^7.x.x",
51
- "@babel/plugin-proposal-decorators": "^7.x.x",
52
- "@babel/preset-env": "^7.x.x",
53
- "@babel/preset-typescript": "^7.x.x",
54
- "@commitlint/cli": "^12.x.x",
55
- "@commitlint/config-conventional": "^15.x.x",
56
+ "@commitlint/cli": "^17.x.x",
57
+ "@commitlint/config-conventional": "^17.x.x",
58
+ "@microsoft/api-documenter": "^7.x.x",
59
+ "@microsoft/api-extractor": "^7.x.x",
60
+ "@rollup/plugin-json": "^4.x.x",
56
61
  "@types/jest": "^27.x.x",
57
62
  "@types/koa": "^2.x.x",
58
63
  "@types/node": "^16.x.x",
59
64
  "@typescript-eslint/eslint-plugin": "^5.x.x",
60
65
  "@typescript-eslint/parser": "^5.x.x",
61
66
  "conventional-changelog-cli": "^2.x.x",
67
+ "copyfiles": "^2.x.x",
62
68
  "del-cli": "^4.x.x",
63
69
  "eslint": "^8.x.x",
64
- "eslint-plugin-jest": "^25.x.x",
65
- "husky": "^7.x.x",
66
- "jest": "^27.x.x",
67
- "jest-html-reporters": "^2.x.x",
70
+ "eslint-plugin-jest": "^26.x.x",
71
+ "husky": "^4.x.x",
72
+ "jest": "^28.x.x",
73
+ "jest-html-reporters": "^3.x.x",
74
+ "rollup": "^2.x.x",
75
+ "rollup-plugin-typescript2": "^0.x.x",
68
76
  "standard-version": "^9.x.x",
69
- "ts-jest": "^27.x.x",
77
+ "ts-jest": "^28.x.x",
70
78
  "ts-node": "^10.x.x",
71
79
  "typescript": "^4.x.x"
72
80
  },
73
81
  "dependencies": {
74
82
  "@types/ioredis": "^4.x.x",
75
83
  "generic-pool": "^3.8.2",
76
- "ioredis": "^4.28.0",
84
+ "ioredis": "^4.28.5",
77
85
  "koatty_lib": "^1.x.x",
78
86
  "koatty_logger": "^1.x.x"
79
87
  },
80
- "husky": {
81
- "hooks": {
82
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
83
- }
88
+ "peerDependencies": {
89
+ "koatty_lib": "^1.x.x",
90
+ "koatty_logger": "^1.x.x"
84
91
  }
85
92
  }
package/.eslintignore DELETED
@@ -1,9 +0,0 @@
1
- node_modules
2
- .eslintrc.js
3
- **/package-lock.json
4
- **/yarn.lock
5
- **/*.config.js
6
- dist
7
- coverage
8
- test
9
- demo
package/.eslintrc.js DELETED
@@ -1,43 +0,0 @@
1
- /**
2
- *
3
- */
4
- module.exports = {
5
- root: true,
6
- parser: '@typescript-eslint/parser',
7
- extends: [
8
- 'plugin:@typescript-eslint/recommended', // 使用@typescript-eslint/eslint-plugin的推荐规则
9
- 'plugin:jest/recommended',
10
- ],
11
- plugins: [
12
- '@typescript-eslint',
13
- 'jest',
14
- ],
15
- parserOptions: {
16
- project: './tsconfig.json',
17
- },
18
- env: {
19
- node: true,
20
- mongo: true,
21
- jest: true,
22
- },
23
- rules: {
24
- "@typescript-eslint/no-explicit-any": "off",
25
- // "@typescript-eslint/no-require-imports": "off",
26
- "@typescript-eslint/no-var-requires": "off",
27
- "@typescript-eslint/member-ordering": "off",
28
- "@typescript-eslint/consistent-type-assertions": "off",
29
- "@typescript-eslint/no-param-reassign": "off",
30
- "@typescript-eslint/no-empty-function": "off",
31
- "@typescript-eslint/no-empty-interface": "off",
32
- "@typescript-eslint/explicit-module-boundary-types": "off",
33
- "@typescript-eslint/ban-types": ["error",
34
- {
35
- "types": {
36
- "Object": false,
37
- "Function": false,
38
- },
39
- "extendDefaults": true
40
- }
41
- ],
42
- },
43
- };
package/babel.config.js DELETED
@@ -1,21 +0,0 @@
1
- /*
2
- * @Description : babel配置
3
- * @usage : 用于jest执行用例
4
- */
5
-
6
- module.exports = {
7
- presets: [
8
- [
9
- '@babel/preset-env',
10
- {
11
- targets: {
12
- node: 'current',
13
- },
14
- },
15
- ],
16
- '@babel/preset-typescript',
17
- ],
18
- plugins: [
19
- ['@babel/plugin-proposal-decorators', { 'legacy': true }]
20
- ],
21
- };
@@ -1,14 +0,0 @@
1
- /*
2
- *
3
- */
4
- module.exports = {
5
- extends: ['@commitlint/config-conventional'],
6
- rules: {
7
- 'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore']],
8
- 'type-empty': [2, 'never'],
9
- 'scope-enum': [0], // 不校验scope类型
10
- 'scope-empty': [0], // 不校验scope是否设置
11
- 'subject-case': [0], // 不校验描述的字符格式
12
- 'subject-min-length': [2, 'always', 5], // 描述至少5个字符
13
- },
14
- };
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AASA,2CAA6C;AAC7C,yCAA2C;AAC3C,yCAA6C;AAApC,qGAAA,WAAW,OAAA;AACpB,SAAS;AACT,iCAAqC;AAA5B,mGAAA,UAAU,OAAA;AA8BnB;;;;;GAKG;AACH,MAAa,KAAK;IAGd;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,OAAqB;QACpC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,OAAO,IAAI,CAAC,QAAQ,CAAC;SACxB;QACD,OAAO,GAAG;YACN,GAAG;gBACC,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,CAAC;gBACP,SAAS,EAAE,QAAQ;gBACnB,OAAO,EAAE,GAAG;gBACZ,QAAQ,EAAE,EAAE;gBACZ,cAAc,EAAE,GAAG;gBACnB,EAAE,EAAE,CAAC;aACR,EAAE,GAAG,OAAO;SAChB,CAAC;QACF,QAAQ,OAAO,CAAC,IAAI,EAAE;YAClB,KAAK,OAAO;gBACR,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAU,CAAC,OAAO,CAAC,CAAC;gBACxC,MAAM;YACV,KAAK,QAAQ,CAAC;YACd;gBACI,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAW,CAAC,OAAO,CAAC,CAAC;gBACzC,MAAM;SACb;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CACJ;AAtCD,sBAsCC"}
@@ -1,53 +0,0 @@
1
- import { CacheStore } from "../store";
2
- import { StoreOptions } from "../index";
3
- import { MemoryCache } from "./memory_cache";
4
- export declare class MemoryStore extends CacheStore {
5
- client: any;
6
- pool: any;
7
- options: StoreOptions;
8
- /**
9
- * Creates an instance of MemoryStore.
10
- * @param {StoreOptions} options
11
- * @memberof MemoryStore
12
- */
13
- constructor(options: StoreOptions);
14
- /**
15
- * getConnection
16
- *
17
- * @returns {*}
18
- * @memberof MemoryStore
19
- */
20
- getConnection(): MemoryCache;
21
- /**
22
- * close
23
- *
24
- * @returns {*} {Promise<void>}
25
- * @memberof MemoryStore
26
- */
27
- close(): Promise<void>;
28
- /**
29
- * release
30
- *
31
- * @param {*} conn
32
- * @returns {*} {Promise<void>}
33
- * @memberof MemoryStore
34
- */
35
- release(conn: any): Promise<void>;
36
- /**
37
- * defineCommand
38
- *
39
- * @param {string} name
40
- * @param {*} scripts
41
- * @memberof MemoryStore
42
- */
43
- defineCommand(name: string, scripts: any): Promise<void>;
44
- /**
45
- * get and compare value
46
- *
47
- * @param {string} name
48
- * @param {(string | number)} value
49
- * @returns {*} {Promise<any>}
50
- * @memberof MemoryStore
51
- */
52
- getCompare(name: string, value: string | number): Promise<any>;
53
- }
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MemoryStore = void 0;
4
- const store_1 = require("../store");
5
- const memory_cache_1 = require("./memory_cache");
6
- // const MemoryCache = require('@outofsync/memory-cache');
7
- /*
8
- * @Description:
9
- * @Usage:
10
- * @Author: richen
11
- * @Date: 2021-06-29 19:07:57
12
- * @LastEditTime: 2021-12-02 15:30:12
13
- */
14
- class MemoryStore extends store_1.CacheStore {
15
- /**
16
- * Creates an instance of MemoryStore.
17
- * @param {StoreOptions} options
18
- * @memberof MemoryStore
19
- */
20
- constructor(options) {
21
- super(options);
22
- this.options = options;
23
- this.client = null;
24
- }
25
- /**
26
- * getConnection
27
- *
28
- * @returns {*}
29
- * @memberof MemoryStore
30
- */
31
- getConnection() {
32
- if (!this.pool) {
33
- this.pool = new memory_cache_1.MemoryCache({
34
- database: this.options.db
35
- });
36
- }
37
- if (!this.client) {
38
- this.client = this.pool.createClient();
39
- this.client.status = "ready";
40
- }
41
- return this.client;
42
- }
43
- /**
44
- * close
45
- *
46
- * @returns {*} {Promise<void>}
47
- * @memberof MemoryStore
48
- */
49
- async close() {
50
- this.client.end();
51
- this.client = null;
52
- }
53
- /**
54
- * release
55
- *
56
- * @param {*} conn
57
- * @returns {*} {Promise<void>}
58
- * @memberof MemoryStore
59
- */
60
- async release(conn) {
61
- return;
62
- }
63
- /**
64
- * defineCommand
65
- *
66
- * @param {string} name
67
- * @param {*} scripts
68
- * @memberof MemoryStore
69
- */
70
- async defineCommand(name, scripts) {
71
- throw new Error(memory_cache_1.messages.unsupported);
72
- }
73
- /**
74
- * get and compare value
75
- *
76
- * @param {string} name
77
- * @param {(string | number)} value
78
- * @returns {*} {Promise<any>}
79
- * @memberof MemoryStore
80
- */
81
- async getCompare(name, value) {
82
- const client = this.getConnection();
83
- const val = client.get(`${this.options.keyPrefix}${name}`);
84
- if (!val) {
85
- return 0;
86
- }
87
- else if (val == value) {
88
- return client.del(`${this.options.keyPrefix}${name}`);
89
- }
90
- else {
91
- return -1;
92
- }
93
- }
94
- }
95
- exports.MemoryStore = MemoryStore;
96
- //# sourceMappingURL=memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/store/memory.ts"],"names":[],"mappings":";;;AACA,oCAAsC;AAEtC,iDAAuD;AACvD,0DAA0D;AAE1D;;;;;;GAMG;AACH,MAAa,WAAY,SAAQ,kBAAU;IAKvC;;;;OAIG;IACH,YAAY,OAAqB;QAC7B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,aAAa;QACT,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACZ,IAAI,CAAC,IAAI,GAAG,IAAI,0BAAW,CAAC;gBACxB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;aAC5B,CAAC,CAAC;SACN;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IACD;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,IAAS;QACnB,OAAO;IACX,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,OAAY;QAC1C,MAAM,IAAI,KAAK,CAAC,uBAAQ,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,KAAsB;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,EAAE;YACN,OAAO,CAAC,CAAC;SACZ;aAAM,IAAI,GAAG,IAAI,KAAK,EAAE;YACrB,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC;SACzD;aAAM;YACH,OAAO,CAAC,CAAC,CAAC;SACb;IACL,CAAC;CAGJ;AAzFD,kCAyFC"}