clientlinker-flow-confighandler 4.1.8 → 5.0.1

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/README.md CHANGED
@@ -25,7 +25,7 @@ npm i clientlinker-flow-confighandler --save
25
25
  # Usage
26
26
 
27
27
  ```javascript
28
- var clientlinker = require('clientlinker');
28
+ var { clientlinker } = require('clientlinker');
29
29
  var linker = clientlinker({
30
30
  flows: ['confighandler'],
31
31
  clients: {
@@ -40,7 +40,7 @@ var linker = clientlinker({
40
40
  }
41
41
  });
42
42
 
43
- linker.flow('confighandler', require('clientlinker-flow-confighandler'));
43
+ linker.flow('confighandler', require('clientlinker-flow-confighandler').confighandlerFlow);
44
44
 
45
45
  // use
46
46
  linker.run('client.clientHanlder', null, {id: 13})
@@ -48,6 +48,13 @@ linker.run('client.clientHanlder', null, {id: 13})
48
48
  ```
49
49
 
50
50
 
51
+ # Upgrade
52
+
53
+ ## 5.x
54
+
55
+ * The package entry no longer exports the installer function directly; it is now the named export `confighandlerFlow`.
56
+ * Deep imports moved from `flow/*` to `dist/flow/*`; `dist/flow/confighandler` is a named export, not a callable module.
57
+
51
58
  [npm-image]: https://img.shields.io/npm/v/clientlinker-flow-confighandler.svg
52
59
  [downloads-image]: https://img.shields.io/npm/dm/clientlinker-flow-confighandler.svg
53
60
  [npm-url]: https://www.npmjs.org/package/clientlinker-flow-confighandler
@@ -0,0 +1,2 @@
1
+ import type { ClientRuntime, FlowRuntime } from 'clientlinker';
2
+ export declare function confighandler(runtime: ClientRuntime, callback: FlowRuntime): unknown;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.confighandler = confighandler;
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const debug = (0, debug_1.default)('clientlinker-flow-confighandler');
9
+ function confighandler(runtime, callback) {
10
+ const client = runtime.client;
11
+ const options = client.options;
12
+ if (!options.confighandler)
13
+ return callback.next();
14
+ const handler = options.confighandler[runtime.method];
15
+ if (typeof handler == 'function') {
16
+ return handler(runtime.query, runtime.body, runtime.options);
17
+ }
18
+ else {
19
+ debug('config no handler:%s', runtime.method);
20
+ return callback.next();
21
+ }
22
+ }
@@ -0,0 +1,2 @@
1
+ import type { Flow } from 'clientlinker';
2
+ export declare function confighandlerFlow(flow: Flow): void;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.confighandlerFlow = confighandlerFlow;
4
+ const confighandler_1 = require("./confighandler");
5
+ const methods_1 = require("./methods");
6
+ function confighandlerFlow(flow) {
7
+ flow.run = confighandler_1.confighandler;
8
+ flow.methods = methods_1.methods;
9
+ }
@@ -0,0 +1,2 @@
1
+ import type { Client } from 'clientlinker';
2
+ export declare function methods(client: Client): string[] | undefined;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.methods = methods;
4
+ function methods(client) {
5
+ const options = client.options;
6
+ if (typeof options.confighandler == 'object') {
7
+ return Object.keys(options.confighandler);
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "clientlinker-flow-confighandler",
3
- "version": "4.1.8",
3
+ "version": "5.0.1",
4
4
  "description": "Confighandler flow for clientlinker",
5
- "main": "flow/index.js",
5
+ "main": "dist/flow/index.js",
6
+ "types": "dist/flow/index.d.ts",
6
7
  "scripts": {
7
- "test": "cross-env DEBUG=clientlinker-flow-confighandler* mocha test/test_*"
8
+ "build": "tsc -p tsconfig.json",
9
+ "prepare": "npm run build",
10
+ "pretest": "npm run build",
11
+ "test": "cross-env DEBUG=clientlinker-flow-confighandler* jest"
8
12
  },
9
13
  "keywords": [
10
14
  "clientlinker",
@@ -17,11 +21,11 @@
17
21
  "debug": "^4.3.1"
18
22
  },
19
23
  "devDependencies": {
20
- "clientlinker": "^13.1.4",
21
- "clientlinker-flow-confighandler-test": "^3.1.3",
22
- "cross-env": "^7.0.3",
23
- "expect.js": "^0.3.1",
24
- "mocha": "^8.4.0"
24
+ "@types/debug": "^4.1.13",
25
+ "@types/node": "^20.19.43",
26
+ "clientlinker": "^14.0.1",
27
+ "clientlinker-flow-confighandler-test": "^4.0.0",
28
+ "cross-env": "^7.0.3"
25
29
  },
26
30
  "repository": {
27
31
  "type": "git",
@@ -31,5 +35,5 @@
31
35
  "url": "https://github.com/iGdea/node-clientlinker/issues"
32
36
  },
33
37
  "homepage": "https://github.com/iGdea/node-clientlinker/tree/master/packages/clientlinker-flow-confighandler",
34
- "gitHead": "bad3b81f70101364868a5b2e7aaa84a1dcdcc85a"
38
+ "gitHead": "83da4b5802bfd2c2cfa6a4a14a1d8e74a6e3d029"
35
39
  }
@@ -1,16 +0,0 @@
1
- const debug = require('debug')('clientlinker-flow-confighandler');
2
-
3
- module.exports = function confighandler(runtime, callback) {
4
- const client = runtime.client;
5
- const options = client.options;
6
- if (!options.confighandler) return callback.next();
7
-
8
- const handler = options.confighandler[runtime.method];
9
-
10
- if (typeof handler == 'function') {
11
- return handler(runtime.query, runtime.body, runtime.options);
12
- } else {
13
- debug('config no handler:%s', runtime.method);
14
- return callback.next();
15
- }
16
- };
package/flow/index.js DELETED
@@ -1,7 +0,0 @@
1
- const confighandler = require('./confighandler');
2
- const methods = require('./methods');
3
-
4
- module.exports = function(flow) {
5
- flow.run = confighandler;
6
- flow.methods = methods;
7
- };
package/flow/methods.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = function methods(client) {
2
- const options = client.options;
3
- if (typeof options.confighandler == 'object') {
4
- return Object.keys(options.confighandler);
5
- }
6
- };