ali-skills 0.0.21 → 0.0.22
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/node_modules/@ali/cli-skills/dist/cli.mjs +1214 -287
- package/node_modules/@ali/cli-skills/package.json +5 -2
- package/node_modules/@ali/o2-open-client/.editorconfig +11 -0
- package/node_modules/@ali/o2-open-client/README.md +80 -0
- package/node_modules/@ali/o2-open-client/abc.json +8 -0
- package/node_modules/@ali/o2-open-client/es/browser/ee.d.ts +23 -0
- package/node_modules/@ali/o2-open-client/es/browser/ee.js +82 -0
- package/node_modules/@ali/o2-open-client/es/browser/entry.d.ts +32 -0
- package/node_modules/@ali/o2-open-client/es/browser/entry.js +306 -0
- package/node_modules/@ali/o2-open-client/es/browser/escape.d.ts +12 -0
- package/node_modules/@ali/o2-open-client/es/browser/escape.js +178 -0
- package/node_modules/@ali/o2-open-client/es/browser/fetch.d.ts +1 -0
- package/node_modules/@ali/o2-open-client/es/browser/fetch.js +14 -0
- package/node_modules/@ali/o2-open-client/es/browser/index.d.ts +1 -0
- package/node_modules/@ali/o2-open-client/es/browser/index.js +1 -0
- package/node_modules/@ali/o2-open-client/es/common/constant.d.ts +42 -0
- package/node_modules/@ali/o2-open-client/es/common/constant.js +53 -0
- package/node_modules/@ali/o2-open-client/es/common/format.d.ts +14 -0
- package/node_modules/@ali/o2-open-client/es/common/format.js +43 -0
- package/node_modules/@ali/o2-open-client/es/common/service-meta.d.ts +33 -0
- package/node_modules/@ali/o2-open-client/es/common/service-meta.js +33 -0
- package/node_modules/@ali/o2-open-client/es/index.d.ts +1 -0
- package/node_modules/@ali/o2-open-client/es/index.js +8 -0
- package/node_modules/@ali/o2-open-client/es/node/config.d.ts +47 -0
- package/node_modules/@ali/o2-open-client/es/node/config.js +188 -0
- package/node_modules/@ali/o2-open-client/es/node/escape.d.ts +22 -0
- package/node_modules/@ali/o2-open-client/es/node/escape.js +131 -0
- package/node_modules/@ali/o2-open-client/es/node/help.d.ts +10 -0
- package/node_modules/@ali/o2-open-client/es/node/help.js +96 -0
- package/node_modules/@ali/o2-open-client/es/node/index.d.ts +48 -0
- package/node_modules/@ali/o2-open-client/es/node/index.js +247 -0
- package/node_modules/@ali/o2-open-client/es/node/token-handler.d.ts +1 -0
- package/node_modules/@ali/o2-open-client/es/node/token-handler.js +21 -0
- package/node_modules/@ali/o2-open-client/lib/browser/ee.d.ts +23 -0
- package/node_modules/@ali/o2-open-client/lib/browser/ee.js +86 -0
- package/node_modules/@ali/o2-open-client/lib/browser/entry.d.ts +32 -0
- package/node_modules/@ali/o2-open-client/lib/browser/entry.js +310 -0
- package/node_modules/@ali/o2-open-client/lib/browser/escape.d.ts +12 -0
- package/node_modules/@ali/o2-open-client/lib/browser/escape.js +185 -0
- package/node_modules/@ali/o2-open-client/lib/browser/fetch.d.ts +1 -0
- package/node_modules/@ali/o2-open-client/lib/browser/fetch.js +18 -0
- package/node_modules/@ali/o2-open-client/lib/common/constant.d.ts +42 -0
- package/node_modules/@ali/o2-open-client/lib/common/constant.js +56 -0
- package/node_modules/@ali/o2-open-client/lib/common/format.d.ts +14 -0
- package/node_modules/@ali/o2-open-client/lib/common/format.js +48 -0
- package/node_modules/@ali/o2-open-client/lib/common/service-meta.d.ts +33 -0
- package/node_modules/@ali/o2-open-client/lib/common/service-meta.js +36 -0
- package/node_modules/@ali/o2-open-client/lib/index.d.ts +1 -0
- package/node_modules/@ali/o2-open-client/lib/index.js +20 -0
- package/node_modules/@ali/o2-open-client/lib/node/config.d.ts +47 -0
- package/node_modules/@ali/o2-open-client/lib/node/config.js +192 -0
- package/node_modules/@ali/o2-open-client/lib/node/escape.d.ts +22 -0
- package/node_modules/@ali/o2-open-client/lib/node/escape.js +137 -0
- package/node_modules/@ali/o2-open-client/lib/node/help.d.ts +10 -0
- package/node_modules/@ali/o2-open-client/lib/node/help.js +100 -0
- package/node_modules/@ali/o2-open-client/lib/node/index.d.ts +48 -0
- package/node_modules/@ali/o2-open-client/lib/node/index.js +250 -0
- package/node_modules/@ali/o2-open-client/lib/node/token-handler.d.ts +1 -0
- package/node_modules/@ali/o2-open-client/lib/node/token-handler.js +25 -0
- package/node_modules/@ali/o2-open-client/package.json +46 -0
- package/node_modules/@ali/o2-open-client/playwright.config.ts +54 -0
- package/node_modules/@ali/o2-open-client/tsconfig.es.json +31 -0
- package/node_modules/@ali/o2-open-client/tsconfig.json +31 -0
- package/node_modules/@ali/o2-open-client/tsx2doc.config.js +5 -0
- package/node_modules/@ali/o2-open-client/typings/index.d.ts +36 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/node/assert.d.ts +1062 -0
- package/node_modules/@types/node/async_hooks.d.ts +605 -0
- package/node_modules/@types/node/buffer.buffer.d.ts +471 -0
- package/node_modules/@types/node/buffer.d.ts +1936 -0
- package/node_modules/@types/node/child_process.d.ts +1475 -0
- package/node_modules/@types/node/cluster.d.ts +577 -0
- package/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +452 -0
- package/node_modules/@types/node/constants.d.ts +21 -0
- package/node_modules/@types/node/crypto.d.ts +4590 -0
- package/node_modules/@types/node/dgram.d.ts +597 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/node_modules/@types/node/dns/promises.d.ts +479 -0
- package/node_modules/@types/node/dns.d.ts +871 -0
- package/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@types/node/events.d.ts +977 -0
- package/node_modules/@types/node/fs/promises.d.ts +1270 -0
- package/node_modules/@types/node/fs.d.ts +4375 -0
- package/node_modules/@types/node/globals.d.ts +172 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/node_modules/@types/node/http.d.ts +2049 -0
- package/node_modules/@types/node/http2.d.ts +2631 -0
- package/node_modules/@types/node/https.d.ts +578 -0
- package/node_modules/@types/node/index.d.ts +93 -0
- package/node_modules/@types/node/inspector.generated.d.ts +3966 -0
- package/node_modules/@types/node/module.d.ts +539 -0
- package/node_modules/@types/node/net.d.ts +1031 -0
- package/node_modules/@types/node/os.d.ts +506 -0
- package/node_modules/@types/node/package.json +140 -0
- package/node_modules/@types/node/path.d.ts +200 -0
- package/node_modules/@types/node/perf_hooks.d.ts +961 -0
- package/node_modules/@types/node/process.d.ts +1961 -0
- package/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/node/querystring.d.ts +152 -0
- package/node_modules/@types/node/readline/promises.d.ts +162 -0
- package/node_modules/@types/node/readline.d.ts +589 -0
- package/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@types/node/sea.d.ts +153 -0
- package/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/node_modules/@types/node/stream/web.d.ts +533 -0
- package/node_modules/@types/node/stream.d.ts +1698 -0
- package/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/node/test.d.ts +1787 -0
- package/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/node_modules/@types/node/timers.d.ts +286 -0
- package/node_modules/@types/node/tls.d.ts +1259 -0
- package/node_modules/@types/node/trace_events.d.ts +197 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +93 -0
- package/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@types/node/url.d.ts +964 -0
- package/node_modules/@types/node/util.d.ts +2331 -0
- package/node_modules/@types/node/v8.d.ts +809 -0
- package/node_modules/@types/node/vm.d.ts +1001 -0
- package/node_modules/@types/node/wasi.d.ts +181 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/node_modules/@types/node/worker_threads.d.ts +715 -0
- package/node_modules/@types/node/zlib.d.ts +598 -0
- package/node_modules/ansi-styles/index.d.ts +345 -0
- package/node_modules/ansi-styles/index.js +163 -0
- package/node_modules/ansi-styles/license +9 -0
- package/node_modules/ansi-styles/package.json +56 -0
- package/node_modules/ansi-styles/readme.md +152 -0
- package/node_modules/await-event/LICENSE +22 -0
- package/node_modules/await-event/README.md +48 -0
- package/node_modules/await-event/index.js +13 -0
- package/node_modules/await-event/package.json +33 -0
- package/node_modules/await-first/LICENSE +21 -0
- package/node_modules/await-first/README.md +80 -0
- package/node_modules/await-first/lib/index.js +21 -0
- package/node_modules/await-first/package.json +49 -0
- package/node_modules/byte/LICENSE.txt +21 -0
- package/node_modules/byte/README.md +207 -0
- package/node_modules/byte/lib/byte.js +635 -0
- package/node_modules/byte/lib/number.js +82 -0
- package/node_modules/byte/package.json +61 -0
- package/node_modules/chalk/index.d.ts +415 -0
- package/node_modules/chalk/license +9 -0
- package/node_modules/chalk/package.json +68 -0
- package/node_modules/chalk/readme.md +341 -0
- package/node_modules/chalk/source/index.js +229 -0
- package/node_modules/chalk/source/templates.js +134 -0
- package/node_modules/chalk/source/util.js +39 -0
- package/node_modules/circular-json-for-egg/LICENSE.txt +19 -0
- package/node_modules/circular-json-for-egg/README.md +148 -0
- package/node_modules/circular-json-for-egg/build/circular-json.amd.js +2 -0
- package/node_modules/circular-json-for-egg/build/circular-json.js +2 -0
- package/node_modules/circular-json-for-egg/build/circular-json.max.amd.js +210 -0
- package/node_modules/circular-json-for-egg/build/circular-json.max.js +210 -0
- package/node_modules/circular-json-for-egg/build/circular-json.node.js +207 -0
- package/node_modules/circular-json-for-egg/package.json +42 -0
- package/node_modules/cluster-client/LICENSE +21 -0
- package/node_modules/cluster-client/README.md +319 -0
- package/node_modules/cluster-client/index.js +66 -0
- package/node_modules/cluster-client/lib/api_client.js +74 -0
- package/node_modules/cluster-client/lib/connection.js +180 -0
- package/node_modules/cluster-client/lib/const.js +5 -0
- package/node_modules/cluster-client/lib/default_logger.js +11 -0
- package/node_modules/cluster-client/lib/default_transcode.js +6 -0
- package/node_modules/cluster-client/lib/follower.js +331 -0
- package/node_modules/cluster-client/lib/index.js +213 -0
- package/node_modules/cluster-client/lib/leader.js +437 -0
- package/node_modules/cluster-client/lib/protocol/byte_buffer.js +8 -0
- package/node_modules/cluster-client/lib/protocol/packet.js +103 -0
- package/node_modules/cluster-client/lib/protocol/request.js +17 -0
- package/node_modules/cluster-client/lib/protocol/response.js +14 -0
- package/node_modules/cluster-client/lib/server.js +256 -0
- package/node_modules/cluster-client/lib/symbol.js +20 -0
- package/node_modules/cluster-client/lib/utils.js +103 -0
- package/node_modules/cluster-client/lib/wrapper/base.js +210 -0
- package/node_modules/cluster-client/lib/wrapper/cluster.js +57 -0
- package/node_modules/cluster-client/lib/wrapper/single.js +192 -0
- package/node_modules/cluster-client/package.json +60 -0
- package/node_modules/co/LICENSE +22 -0
- package/node_modules/co/Readme.md +212 -0
- package/node_modules/co/index.js +237 -0
- package/node_modules/co/package.json +34 -0
- package/node_modules/color-convert/LICENSE +21 -0
- package/node_modules/color-convert/README.md +68 -0
- package/node_modules/color-convert/conversions.js +839 -0
- package/node_modules/color-convert/index.js +81 -0
- package/node_modules/color-convert/package.json +48 -0
- package/node_modules/color-convert/route.js +97 -0
- package/node_modules/color-name/LICENSE +8 -0
- package/node_modules/color-name/README.md +11 -0
- package/node_modules/color-name/index.js +152 -0
- package/node_modules/color-name/package.json +28 -0
- package/node_modules/core-util-is/LICENSE +19 -0
- package/node_modules/core-util-is/README.md +3 -0
- package/node_modules/core-util-is/lib/util.js +107 -0
- package/node_modules/core-util-is/package.json +38 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/depd/History.md +103 -0
- package/node_modules/depd/LICENSE +22 -0
- package/node_modules/depd/Readme.md +280 -0
- package/node_modules/depd/index.js +538 -0
- package/node_modules/depd/lib/browser/index.js +77 -0
- package/node_modules/depd/package.json +45 -0
- package/node_modules/ee-first/LICENSE +22 -0
- package/node_modules/ee-first/README.md +80 -0
- package/node_modules/ee-first/index.js +95 -0
- package/node_modules/ee-first/package.json +29 -0
- package/node_modules/egg-errors/LICENSE +21 -0
- package/node_modules/egg-errors/README.md +259 -0
- package/node_modules/egg-errors/lib/base.d.ts +10 -0
- package/node_modules/egg-errors/lib/base.js +28 -0
- package/node_modules/egg-errors/lib/base_error.d.ts +6 -0
- package/node_modules/egg-errors/lib/base_error.js +13 -0
- package/node_modules/egg-errors/lib/base_exception.d.ts +6 -0
- package/node_modules/egg-errors/lib/base_exception.js +13 -0
- package/node_modules/egg-errors/lib/error.d.ts +6 -0
- package/node_modules/egg-errors/lib/error.js +13 -0
- package/node_modules/egg-errors/lib/error_options.d.ts +5 -0
- package/node_modules/egg-errors/lib/error_options.js +6 -0
- package/node_modules/egg-errors/lib/error_type.d.ts +6 -0
- package/node_modules/egg-errors/lib/error_type.js +10 -0
- package/node_modules/egg-errors/lib/exception.d.ts +6 -0
- package/node_modules/egg-errors/lib/exception.js +13 -0
- package/node_modules/egg-errors/lib/framework/formatter.d.ts +6 -0
- package/node_modules/egg-errors/lib/framework/formatter.js +29 -0
- package/node_modules/egg-errors/lib/framework/framework_base_error.d.ts +10 -0
- package/node_modules/egg-errors/lib/framework/framework_base_error.js +32 -0
- package/node_modules/egg-errors/lib/http/400.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/400.js +13 -0
- package/node_modules/egg-errors/lib/http/401.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/401.js +13 -0
- package/node_modules/egg-errors/lib/http/402.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/402.js +13 -0
- package/node_modules/egg-errors/lib/http/403.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/403.js +13 -0
- package/node_modules/egg-errors/lib/http/404.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/404.js +13 -0
- package/node_modules/egg-errors/lib/http/405.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/405.js +13 -0
- package/node_modules/egg-errors/lib/http/406.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/406.js +13 -0
- package/node_modules/egg-errors/lib/http/407.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/407.js +13 -0
- package/node_modules/egg-errors/lib/http/408.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/408.js +13 -0
- package/node_modules/egg-errors/lib/http/409.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/409.js +13 -0
- package/node_modules/egg-errors/lib/http/410.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/410.js +13 -0
- package/node_modules/egg-errors/lib/http/411.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/411.js +13 -0
- package/node_modules/egg-errors/lib/http/412.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/412.js +13 -0
- package/node_modules/egg-errors/lib/http/413.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/413.js +13 -0
- package/node_modules/egg-errors/lib/http/414.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/414.js +13 -0
- package/node_modules/egg-errors/lib/http/415.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/415.js +13 -0
- package/node_modules/egg-errors/lib/http/416.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/416.js +13 -0
- package/node_modules/egg-errors/lib/http/417.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/417.js +13 -0
- package/node_modules/egg-errors/lib/http/418.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/418.js +13 -0
- package/node_modules/egg-errors/lib/http/421.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/421.js +13 -0
- package/node_modules/egg-errors/lib/http/422.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/422.js +13 -0
- package/node_modules/egg-errors/lib/http/423.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/423.js +13 -0
- package/node_modules/egg-errors/lib/http/424.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/424.js +13 -0
- package/node_modules/egg-errors/lib/http/425.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/425.js +13 -0
- package/node_modules/egg-errors/lib/http/426.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/426.js +13 -0
- package/node_modules/egg-errors/lib/http/428.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/428.js +13 -0
- package/node_modules/egg-errors/lib/http/429.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/429.js +13 -0
- package/node_modules/egg-errors/lib/http/431.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/431.js +13 -0
- package/node_modules/egg-errors/lib/http/451.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/451.js +13 -0
- package/node_modules/egg-errors/lib/http/500.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/500.js +13 -0
- package/node_modules/egg-errors/lib/http/501.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/501.js +13 -0
- package/node_modules/egg-errors/lib/http/502.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/502.js +13 -0
- package/node_modules/egg-errors/lib/http/503.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/503.js +13 -0
- package/node_modules/egg-errors/lib/http/504.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/504.js +13 -0
- package/node_modules/egg-errors/lib/http/505.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/505.js +13 -0
- package/node_modules/egg-errors/lib/http/506.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/506.js +13 -0
- package/node_modules/egg-errors/lib/http/507.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/507.js +13 -0
- package/node_modules/egg-errors/lib/http/508.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/508.js +13 -0
- package/node_modules/egg-errors/lib/http/509.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/509.js +13 -0
- package/node_modules/egg-errors/lib/http/510.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/510.js +13 -0
- package/node_modules/egg-errors/lib/http/511.d.ts +5 -0
- package/node_modules/egg-errors/lib/http/511.js +13 -0
- package/node_modules/egg-errors/lib/http/http_error.d.ts +10 -0
- package/node_modules/egg-errors/lib/http/http_error.js +13 -0
- package/node_modules/egg-errors/lib/http/http_error_options.d.ts +6 -0
- package/node_modules/egg-errors/lib/http/http_error_options.js +7 -0
- package/node_modules/egg-errors/lib/http/http_header.d.ts +3 -0
- package/node_modules/egg-errors/lib/http/http_header.js +3 -0
- package/node_modules/egg-errors/lib/index.d.ts +50 -0
- package/node_modules/egg-errors/lib/index.js +149 -0
- package/node_modules/egg-errors/package.json +49 -0
- package/node_modules/egg-logger/LICENSE +21 -0
- package/node_modules/egg-logger/README.md +128 -0
- package/node_modules/egg-logger/README.zh-CN.md +125 -0
- package/node_modules/egg-logger/index.d.ts +233 -0
- package/node_modules/egg-logger/index.js +18 -0
- package/node_modules/egg-logger/lib/egg/console_logger.js +36 -0
- package/node_modules/egg-logger/lib/egg/context_logger.js +43 -0
- package/node_modules/egg-logger/lib/egg/custom_logger.js +10 -0
- package/node_modules/egg-logger/lib/egg/error_logger.js +31 -0
- package/node_modules/egg-logger/lib/egg/logger.js +128 -0
- package/node_modules/egg-logger/lib/egg/loggers.js +163 -0
- package/node_modules/egg-logger/lib/level.js +34 -0
- package/node_modules/egg-logger/lib/logger.js +170 -0
- package/node_modules/egg-logger/lib/transports/console.js +52 -0
- package/node_modules/egg-logger/lib/transports/file.js +134 -0
- package/node_modules/egg-logger/lib/transports/file_buffer.js +113 -0
- package/node_modules/egg-logger/lib/transports/transport.js +129 -0
- package/node_modules/egg-logger/lib/utils.js +296 -0
- package/node_modules/egg-logger/package.json +54 -0
- package/node_modules/escape-html/LICENSE +24 -0
- package/node_modules/escape-html/Readme.md +43 -0
- package/node_modules/escape-html/index.js +78 -0
- package/node_modules/escape-html/package.json +24 -0
- package/node_modules/extend-shallow/LICENSE +21 -0
- package/node_modules/extend-shallow/README.md +61 -0
- package/node_modules/extend-shallow/index.js +33 -0
- package/node_modules/extend-shallow/package.json +56 -0
- package/node_modules/has-flag/index.d.ts +39 -0
- package/node_modules/has-flag/index.js +8 -0
- package/node_modules/has-flag/license +9 -0
- package/node_modules/has-flag/package.json +46 -0
- package/node_modules/has-flag/readme.md +89 -0
- package/node_modules/heartbeats/.eslintrc +151 -0
- package/node_modules/heartbeats/.npmignore +28 -0
- package/node_modules/heartbeats/.travis.yml +10 -0
- package/node_modules/heartbeats/LICENSE +21 -0
- package/node_modules/heartbeats/README.md +323 -0
- package/node_modules/heartbeats/lib/beatevent.js +35 -0
- package/node_modules/heartbeats/lib/heart.js +178 -0
- package/node_modules/heartbeats/lib/pulse.js +39 -0
- package/node_modules/heartbeats/main.js +34 -0
- package/node_modules/heartbeats/package.json +39 -0
- package/node_modules/heartbeats/test/benchmark.js +138 -0
- package/node_modules/heartbeats/test/spawn.js +16 -0
- package/node_modules/heartbeats/test/test.js +158 -0
- package/node_modules/httpx/README.md +96 -0
- package/node_modules/httpx/lib/index.d.ts +31 -0
- package/node_modules/httpx/lib/index.js +396 -0
- package/node_modules/httpx/package.json +36 -0
- package/node_modules/iconv-lite/.github/dependabot.yml +11 -0
- package/node_modules/iconv-lite/.idea/codeStyles/Project.xml +47 -0
- package/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/node_modules/iconv-lite/.idea/iconv-lite.iml +12 -0
- package/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/node_modules/iconv-lite/.idea/modules.xml +8 -0
- package/node_modules/iconv-lite/.idea/vcs.xml +6 -0
- package/node_modules/iconv-lite/Changelog.md +212 -0
- package/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules/iconv-lite/README.md +130 -0
- package/node_modules/iconv-lite/encodings/dbcs-codec.js +597 -0
- package/node_modules/iconv-lite/encodings/dbcs-data.js +188 -0
- package/node_modules/iconv-lite/encodings/index.js +23 -0
- package/node_modules/iconv-lite/encodings/internal.js +198 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
- package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
- package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules/iconv-lite/encodings/utf16.js +197 -0
- package/node_modules/iconv-lite/encodings/utf32.js +319 -0
- package/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/node_modules/iconv-lite/lib/index.d.ts +41 -0
- package/node_modules/iconv-lite/lib/index.js +180 -0
- package/node_modules/iconv-lite/lib/streams.js +109 -0
- package/node_modules/iconv-lite/package.json +44 -0
- package/node_modules/ip/README.md +90 -0
- package/node_modules/ip/lib/ip.js +496 -0
- package/node_modules/ip/package.json +25 -0
- package/node_modules/is-class-hotfix/.editorconfig +23 -0
- package/node_modules/is-class-hotfix/.gitattributes +2 -0
- package/node_modules/is-class-hotfix/CHANGELOG.md +7 -0
- package/node_modules/is-class-hotfix/LICENSE.md +21 -0
- package/node_modules/is-class-hotfix/README.md +35 -0
- package/node_modules/is-class-hotfix/bower.json +24 -0
- package/node_modules/is-class-hotfix/is-class.js +28 -0
- package/node_modules/is-class-hotfix/package.json +31 -0
- package/node_modules/is-class-hotfix/test/babel-class.js +27 -0
- package/node_modules/is-class-hotfix/test/is-class.js +31 -0
- package/node_modules/is-extendable/LICENSE +21 -0
- package/node_modules/is-extendable/README.md +72 -0
- package/node_modules/is-extendable/index.js +13 -0
- package/node_modules/is-extendable/package.json +51 -0
- package/node_modules/is-type-of/LICENSE +21 -0
- package/node_modules/is-type-of/README.md +105 -0
- package/node_modules/is-type-of/index.d.ts +65 -0
- package/node_modules/is-type-of/index.js +125 -0
- package/node_modules/is-type-of/package.json +45 -0
- package/node_modules/isstream/.jshintrc +59 -0
- package/node_modules/isstream/.npmignore +1 -0
- package/node_modules/isstream/.travis.yml +12 -0
- package/node_modules/isstream/LICENSE.md +11 -0
- package/node_modules/isstream/README.md +66 -0
- package/node_modules/isstream/isstream.js +27 -0
- package/node_modules/isstream/package.json +33 -0
- package/node_modules/isstream/test.js +168 -0
- package/node_modules/json-stringify-safe/.npmignore +1 -0
- package/node_modules/json-stringify-safe/CHANGELOG.md +14 -0
- package/node_modules/json-stringify-safe/LICENSE +15 -0
- package/node_modules/json-stringify-safe/Makefile +35 -0
- package/node_modules/json-stringify-safe/README.md +52 -0
- package/node_modules/json-stringify-safe/package.json +31 -0
- package/node_modules/json-stringify-safe/stringify.js +27 -0
- package/node_modules/json-stringify-safe/test/mocha.opts +2 -0
- package/node_modules/json-stringify-safe/test/stringify_test.js +246 -0
- package/node_modules/kitx/LICENSE +21 -0
- package/node_modules/kitx/README.md +35 -0
- package/node_modules/kitx/lib/index.d.ts +45 -0
- package/node_modules/kitx/lib/index.js +289 -0
- package/node_modules/kitx/package.json +41 -0
- package/node_modules/long/LICENSE +202 -0
- package/node_modules/long/README.md +246 -0
- package/node_modules/long/dist/long.js +2 -0
- package/node_modules/long/dist/long.js.map +1 -0
- package/node_modules/long/index.js +1 -0
- package/node_modules/long/package.json +34 -0
- package/node_modules/long/src/long.js +1323 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/p-timeout/index.d.ts +113 -0
- package/node_modules/p-timeout/index.js +71 -0
- package/node_modules/p-timeout/license +9 -0
- package/node_modules/p-timeout/package.json +44 -0
- package/node_modules/p-timeout/readme.md +117 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/sdk-base/LICENSE +21 -0
- package/node_modules/sdk-base/README.md +165 -0
- package/node_modules/sdk-base/index.d.ts +29 -0
- package/node_modules/sdk-base/index.js +251 -0
- package/node_modules/sdk-base/package.json +54 -0
- package/node_modules/serialize-json/LICENSE +21 -0
- package/node_modules/serialize-json/README.md +74 -0
- package/node_modules/serialize-json/lib/decoder.js +190 -0
- package/node_modules/serialize-json/lib/encoder.js +200 -0
- package/node_modules/serialize-json/lib/index.js +15 -0
- package/node_modules/serialize-json/package.json +53 -0
- package/node_modules/supports-color/browser.js +5 -0
- package/node_modules/supports-color/index.js +135 -0
- package/node_modules/supports-color/license +9 -0
- package/node_modules/supports-color/package.json +53 -0
- package/node_modules/supports-color/readme.md +76 -0
- package/node_modules/tcp-base/LICENSE +21 -0
- package/node_modules/tcp-base/README.md +134 -0
- package/node_modules/tcp-base/lib/base.js +456 -0
- package/node_modules/tcp-base/package.json +44 -0
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +31 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client.d.ts +108 -0
- package/node_modules/undici-types/connector.d.ts +34 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +28 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/node_modules/undici-types/dispatcher.d.ts +256 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/node_modules/undici-types/errors.d.ts +149 -0
- package/node_modules/undici-types/eventsource.d.ts +61 -0
- package/node_modules/undici-types/fetch.d.ts +209 -0
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/handlers.d.ts +15 -0
- package/node_modules/undici-types/header.d.ts +4 -0
- package/node_modules/undici-types/index.d.ts +71 -0
- package/node_modules/undici-types/interceptors.d.ts +17 -0
- package/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/node_modules/undici-types/mock-client.d.ts +25 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +33 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +39 -0
- package/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/node_modules/undici-types/readable.d.ts +65 -0
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/webidl.d.ts +228 -0
- package/node_modules/undici-types/websocket.d.ts +150 -0
- package/node_modules/unescape/LICENSE +21 -0
- package/node_modules/unescape/README.md +134 -0
- package/node_modules/unescape/index.js +103 -0
- package/node_modules/unescape/package.json +67 -0
- package/node_modules/utility/LICENSE.txt +21 -0
- package/node_modules/utility/README.md +370 -0
- package/node_modules/utility/dist/commonjs/array.d.ts +11 -0
- package/node_modules/utility/dist/commonjs/array.js +46 -0
- package/node_modules/utility/dist/commonjs/crypto.d.ts +86 -0
- package/node_modules/utility/dist/commonjs/crypto.js +159 -0
- package/node_modules/utility/dist/commonjs/date.d.ts +63 -0
- package/node_modules/utility/dist/commonjs/date.js +219 -0
- package/node_modules/utility/dist/commonjs/fs.d.ts +6 -0
- package/node_modules/utility/dist/commonjs/fs.js +20 -0
- package/node_modules/utility/dist/commonjs/function.d.ts +12 -0
- package/node_modules/utility/dist/commonjs/function.js +35 -0
- package/node_modules/utility/dist/commonjs/index.d.ts +12 -0
- package/node_modules/utility/dist/commonjs/index.js +29 -0
- package/node_modules/utility/dist/commonjs/json.d.ts +14 -0
- package/node_modules/utility/dist/commonjs/json.js +41 -0
- package/node_modules/utility/dist/commonjs/number.d.ts +24 -0
- package/node_modules/utility/dist/commonjs/number.js +66 -0
- package/node_modules/utility/dist/commonjs/object.d.ts +20 -0
- package/node_modules/utility/dist/commonjs/object.js +73 -0
- package/node_modules/utility/dist/commonjs/optimize.d.ts +21 -0
- package/node_modules/utility/dist/commonjs/optimize.js +60 -0
- package/node_modules/utility/dist/commonjs/package.json +3 -0
- package/node_modules/utility/dist/commonjs/string.d.ts +29 -0
- package/node_modules/utility/dist/commonjs/string.js +126 -0
- package/node_modules/utility/dist/commonjs/timeout.d.ts +6 -0
- package/node_modules/utility/dist/commonjs/timeout.js +34 -0
- package/node_modules/utility/dist/commonjs/web.d.ts +29 -0
- package/node_modules/utility/dist/commonjs/web.js +61 -0
- package/node_modules/utility/dist/esm/array.d.ts +11 -0
- package/node_modules/utility/dist/esm/array.js +42 -0
- package/node_modules/utility/dist/esm/crypto.d.ts +86 -0
- package/node_modules/utility/dist/esm/crypto.js +146 -0
- package/node_modules/utility/dist/esm/date.d.ts +63 -0
- package/node_modules/utility/dist/esm/date.js +204 -0
- package/node_modules/utility/dist/esm/fs.d.ts +6 -0
- package/node_modules/utility/dist/esm/fs.js +17 -0
- package/node_modules/utility/dist/esm/function.d.ts +12 -0
- package/node_modules/utility/dist/esm/function.js +28 -0
- package/node_modules/utility/dist/esm/index.d.ts +12 -0
- package/node_modules/utility/dist/esm/index.js +13 -0
- package/node_modules/utility/dist/esm/json.d.ts +14 -0
- package/node_modules/utility/dist/esm/json.js +34 -0
- package/node_modules/utility/dist/esm/number.d.ts +24 -0
- package/node_modules/utility/dist/esm/number.js +60 -0
- package/node_modules/utility/dist/esm/object.d.ts +20 -0
- package/node_modules/utility/dist/esm/object.js +67 -0
- package/node_modules/utility/dist/esm/optimize.d.ts +21 -0
- package/node_modules/utility/dist/esm/optimize.js +54 -0
- package/node_modules/utility/dist/esm/package.json +3 -0
- package/node_modules/utility/dist/esm/string.d.ts +29 -0
- package/node_modules/utility/dist/esm/string.js +118 -0
- package/node_modules/utility/dist/esm/timeout.d.ts +6 -0
- package/node_modules/utility/dist/esm/timeout.js +28 -0
- package/node_modules/utility/dist/esm/web.d.ts +29 -0
- package/node_modules/utility/dist/esm/web.js +52 -0
- package/node_modules/utility/dist/package.json +4 -0
- package/node_modules/utility/package.json +85 -0
- package/node_modules/utility/src/array.ts +44 -0
- package/node_modules/utility/src/crypto.ts +160 -0
- package/node_modules/utility/src/date.ts +232 -0
- package/node_modules/utility/src/fs.ts +17 -0
- package/node_modules/utility/src/function.ts +30 -0
- package/node_modules/utility/src/index.ts +12 -0
- package/node_modules/utility/src/json.ts +48 -0
- package/node_modules/utility/src/number.ts +63 -0
- package/node_modules/utility/src/object.ts +72 -0
- package/node_modules/utility/src/optimize.ts +62 -0
- package/node_modules/utility/src/string.ts +132 -0
- package/node_modules/utility/src/timeout.ts +37 -0
- package/node_modules/utility/src/web.ts +53 -0
- package/node_modules/ylru/LICENSE +25 -0
- package/node_modules/ylru/README.md +120 -0
- package/node_modules/ylru/dist/commonjs/index.d.ts +21 -0
- package/node_modules/ylru/dist/commonjs/index.js +112 -0
- package/node_modules/ylru/dist/commonjs/package.json +3 -0
- package/node_modules/ylru/dist/esm/index.d.ts +21 -0
- package/node_modules/ylru/dist/esm/index.js +108 -0
- package/node_modules/ylru/dist/esm/package.json +3 -0
- package/node_modules/ylru/package.json +71 -0
- package/node_modules/ylru/src/index.ts +124 -0
- package/package.json +2 -2
- package/node_modules/@ali/cli-skills/dist/_chunks/libs/abort-controller.mjs +0 -424
- package/node_modules/@ali/cli-skills/dist/_chunks/libs/archiver.mjs +0 -19586
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Copyright (C) 2013-2017 by Andrea Giammarchi - @WebReflection
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
*/
|
|
23
|
+
var
|
|
24
|
+
// should be a not so common char
|
|
25
|
+
// possibly one JSON does not encode
|
|
26
|
+
// possibly one encodeURIComponent does not encode
|
|
27
|
+
// right now this char is '~' but this might change in the future
|
|
28
|
+
specialChar = '~',
|
|
29
|
+
safeSpecialChar = '\\x' + (
|
|
30
|
+
'0' + specialChar.charCodeAt(0).toString(16)
|
|
31
|
+
).slice(-2),
|
|
32
|
+
escapedSafeSpecialChar = '\\' + safeSpecialChar,
|
|
33
|
+
specialCharRG = new RegExp(safeSpecialChar, 'g'),
|
|
34
|
+
safeSpecialCharRG = new RegExp(escapedSafeSpecialChar, 'g'),
|
|
35
|
+
|
|
36
|
+
safeStartWithSpecialCharRG = new RegExp('(?:^|([^\\\\]))' + escapedSafeSpecialChar),
|
|
37
|
+
|
|
38
|
+
indexOf = [].indexOf || function(v){
|
|
39
|
+
for(var i=this.length;i--&&this[i]!==v;);
|
|
40
|
+
return i;
|
|
41
|
+
},
|
|
42
|
+
$String = String // there's no way to drop warnings in JSHint
|
|
43
|
+
// about new String ... well, I need that here!
|
|
44
|
+
// faked, and happy linter!
|
|
45
|
+
;
|
|
46
|
+
|
|
47
|
+
function generateReplacer(value, replacer, resolve) {
|
|
48
|
+
var
|
|
49
|
+
doNotIgnore = false,
|
|
50
|
+
inspect = !!replacer,
|
|
51
|
+
path = [],
|
|
52
|
+
all = [value],
|
|
53
|
+
seen = [value],
|
|
54
|
+
mapp = [resolve ? specialChar : '[Circular]'],
|
|
55
|
+
last = value,
|
|
56
|
+
lvl = 1,
|
|
57
|
+
i, fn
|
|
58
|
+
;
|
|
59
|
+
if (inspect) {
|
|
60
|
+
fn = typeof replacer === 'object' ?
|
|
61
|
+
function (key, value) {
|
|
62
|
+
return key !== '' && indexOf.call(replacer, key) < 0 ? void 0 : value;
|
|
63
|
+
} :
|
|
64
|
+
replacer;
|
|
65
|
+
}
|
|
66
|
+
return function(key, value) {
|
|
67
|
+
// the replacer has rights to decide
|
|
68
|
+
// if a new object should be returned
|
|
69
|
+
// or if there's some key to drop
|
|
70
|
+
// let's call it here rather than "too late"
|
|
71
|
+
if (inspect) value = fn.call(this, key, value);
|
|
72
|
+
|
|
73
|
+
// first pass should be ignored, since it's just the initial object
|
|
74
|
+
if (doNotIgnore) {
|
|
75
|
+
if (last !== this) {
|
|
76
|
+
i = lvl - indexOf.call(all, this) - 1;
|
|
77
|
+
lvl -= i;
|
|
78
|
+
all.splice(lvl, all.length);
|
|
79
|
+
path.splice(lvl - 1, path.length);
|
|
80
|
+
last = this;
|
|
81
|
+
}
|
|
82
|
+
// console.log(lvl, key, path);
|
|
83
|
+
if (typeof value === 'object' && value) {
|
|
84
|
+
// if object isn't referring to parent object, add to the
|
|
85
|
+
// object path stack. Otherwise it is already there.
|
|
86
|
+
if (indexOf.call(all, value) < 0) {
|
|
87
|
+
all.push(last = value);
|
|
88
|
+
}
|
|
89
|
+
lvl = all.length;
|
|
90
|
+
i = indexOf.call(seen, value);
|
|
91
|
+
if (i < 0) {
|
|
92
|
+
i = seen.push(value) - 1;
|
|
93
|
+
if (resolve) {
|
|
94
|
+
// key cannot contain specialChar but could be not a string
|
|
95
|
+
path.push(('' + key).replace(specialCharRG, safeSpecialChar));
|
|
96
|
+
mapp[i] = specialChar + path.join(specialChar);
|
|
97
|
+
} else {
|
|
98
|
+
mapp[i] = mapp[0];
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
value = mapp[i];
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
if (typeof value === 'string' && resolve) {
|
|
105
|
+
// ensure no special char involved on deserialization
|
|
106
|
+
// in this case only first char is important
|
|
107
|
+
// no need to replace all value (better performance)
|
|
108
|
+
value = value .replace(safeSpecialChar, escapedSafeSpecialChar)
|
|
109
|
+
.replace(specialChar, safeSpecialChar);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
doNotIgnore = true;
|
|
114
|
+
}
|
|
115
|
+
return value;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function retrieveFromPath(current, keys) {
|
|
120
|
+
for(var i = 0, length = keys.length; i < length; current = current[
|
|
121
|
+
// keys should be normalized back here
|
|
122
|
+
keys[i++].replace(safeSpecialCharRG, specialChar)
|
|
123
|
+
]);
|
|
124
|
+
return current;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function generateReviver(reviver) {
|
|
128
|
+
return function(key, value) {
|
|
129
|
+
var isString = typeof value === 'string';
|
|
130
|
+
if (isString && value.charAt(0) === specialChar) {
|
|
131
|
+
return new $String(value.slice(1));
|
|
132
|
+
}
|
|
133
|
+
if (key === '') value = regenerate(value, value, {});
|
|
134
|
+
// again, only one needed, do not use the RegExp for this replacement
|
|
135
|
+
// only keys need the RegExp
|
|
136
|
+
if (isString) value = value .replace(safeStartWithSpecialCharRG, '$1' + specialChar)
|
|
137
|
+
.replace(escapedSafeSpecialChar, safeSpecialChar);
|
|
138
|
+
return reviver ? reviver.call(this, key, value) : value;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function regenerateArray(root, current, retrieve) {
|
|
143
|
+
for (var i = 0, length = current.length; i < length; i++) {
|
|
144
|
+
current[i] = regenerate(root, current[i], retrieve);
|
|
145
|
+
}
|
|
146
|
+
return current;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function regenerateObject(root, current, retrieve) {
|
|
150
|
+
for (var key in current) {
|
|
151
|
+
if (current.hasOwnProperty(key)) {
|
|
152
|
+
current[key] = regenerate(root, current[key], retrieve);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return current;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function regenerate(root, current, retrieve) {
|
|
159
|
+
return current instanceof Array ?
|
|
160
|
+
// fast Array reconstruction
|
|
161
|
+
regenerateArray(root, current, retrieve) :
|
|
162
|
+
(
|
|
163
|
+
current instanceof $String ?
|
|
164
|
+
(
|
|
165
|
+
// root is an empty string
|
|
166
|
+
current.length ?
|
|
167
|
+
(
|
|
168
|
+
retrieve.hasOwnProperty(current) ?
|
|
169
|
+
retrieve[current] :
|
|
170
|
+
retrieve[current] = retrieveFromPath(
|
|
171
|
+
root, current.split(specialChar)
|
|
172
|
+
)
|
|
173
|
+
) :
|
|
174
|
+
root
|
|
175
|
+
) :
|
|
176
|
+
(
|
|
177
|
+
current instanceof Object ?
|
|
178
|
+
// dedicated Object parser
|
|
179
|
+
regenerateObject(root, current, retrieve) :
|
|
180
|
+
// value as it is
|
|
181
|
+
current
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var CircularJSON = {
|
|
188
|
+
stringify: function stringify(value, replacer, space, doNotResolve) {
|
|
189
|
+
return CircularJSON.parser.stringify(
|
|
190
|
+
value,
|
|
191
|
+
generateReplacer(value, replacer, !doNotResolve),
|
|
192
|
+
space
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
parse: function parse(text, reviver) {
|
|
196
|
+
return CircularJSON.parser.parse(
|
|
197
|
+
text,
|
|
198
|
+
generateReviver(reviver)
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
// A parser should be an API 1:1 compatible with JSON
|
|
202
|
+
// it should expose stringify and parse methods.
|
|
203
|
+
// The default parser is the native JSON.
|
|
204
|
+
parser: JSON
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
module.exports = CircularJSON;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"name": "circular-json-for-egg",
|
|
4
|
+
"description": "JSON does not handle circular references. This version does",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/eggjs/circular-json",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"JSON",
|
|
9
|
+
"circular",
|
|
10
|
+
"reference",
|
|
11
|
+
"recursive",
|
|
12
|
+
"recursion",
|
|
13
|
+
"parse",
|
|
14
|
+
"stringify"
|
|
15
|
+
],
|
|
16
|
+
"files": [
|
|
17
|
+
"build"
|
|
18
|
+
],
|
|
19
|
+
"generator": "https://github.com/WebReflection/gitstrap",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Andrea Giammarchi",
|
|
22
|
+
"web": "http://webreflection.blogspot.com/"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git://github.com/WebReflection/circular-json.git"
|
|
27
|
+
},
|
|
28
|
+
"unpkg": "build/circular-json.js",
|
|
29
|
+
"main": "./build/circular-json.node.js",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "istanbul cover test/circular-json.js",
|
|
32
|
+
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
|
33
|
+
"web": "$(sleep 2 && open http://0.0.0.0:7151/) & tiny-cdn run ./",
|
|
34
|
+
"prepublish": "make build"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"coveralls": "^2.13.0",
|
|
38
|
+
"istanbul": "^0.4.5",
|
|
39
|
+
"tiny-cdn": "^0.7.0",
|
|
40
|
+
"tressa": "^0.3.1"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 node_modules
|
|
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.
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# cluster-client
|
|
2
|
+
|
|
3
|
+
Sharing Connection among Multi-Process Nodejs
|
|
4
|
+
|
|
5
|
+
[![NPM version][npm-image]][npm-url]
|
|
6
|
+
[](https://github.com/node-modules/cluster-client/actions/workflows/nodejs.yml)
|
|
7
|
+
[![Test coverage][codecov-image]][codecov-url]
|
|
8
|
+
[![Known Vulnerabilities][snyk-image]][snyk-url]
|
|
9
|
+
[![npm download][download-image]][download-url]
|
|
10
|
+
|
|
11
|
+
[npm-image]: https://img.shields.io/npm/v/cluster-client.svg?style=flat-square
|
|
12
|
+
[npm-url]: https://npmjs.org/package/cluster-client
|
|
13
|
+
[codecov-image]: https://codecov.io/gh/node-modules/cluster-client/branch/master/graph/badge.svg
|
|
14
|
+
[codecov-url]: https://codecov.io/gh/node-modules/cluster-client
|
|
15
|
+
[snyk-image]: https://snyk.io/test/npm/cluster-client/badge.svg?style=flat-square
|
|
16
|
+
[snyk-url]: https://snyk.io/test/npm/cluster-client
|
|
17
|
+
[download-image]: https://img.shields.io/npm/dm/cluster-client.svg?style=flat-square
|
|
18
|
+
[download-url]: https://npmjs.org/package/cluster-client
|
|
19
|
+
|
|
20
|
+
As we know, each Node.js process runs in a single thread. Usually, we split a single process into multiple processes to take advantage of multi-core systems. On the other hand, it brings more system overhead, sush as maintaining more TCP connections between servers.
|
|
21
|
+
|
|
22
|
+
This module is designed to share connections among multi-process Nodejs.
|
|
23
|
+
|
|
24
|
+
## Theory
|
|
25
|
+
|
|
26
|
+
- Inspired by [Leader/Follower pattern](http://www.cs.wustl.edu/~schmidt/PDF/lf.pdf).
|
|
27
|
+
- Allow ONLY one process "the Leader" to communicate with server. Other processes "the Followers" act as "Proxy" client, and forward all requests to Leader.
|
|
28
|
+
- The Leader is selected by "Port Competition". Every process try to listen on a certain port (for example 7777), but ONLY one can occupy the port, then it becomes the Leader, the others become Followers.
|
|
29
|
+
- TCP socket connections are maintained between Leader and Followers. And I design a simple communication protocol to exchange data between them.
|
|
30
|
+
- If old Leader dies, one of processes will be selected as the new Leader.
|
|
31
|
+
|
|
32
|
+
## Diagram
|
|
33
|
+
|
|
34
|
+
normal (without using cluster client)
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
+--------+ +--------+
|
|
38
|
+
| Client | | Client | ...
|
|
39
|
+
+--------+ +--------+
|
|
40
|
+
| \ / |
|
|
41
|
+
| \ / |
|
|
42
|
+
| / \ |
|
|
43
|
+
| / \ |
|
|
44
|
+
+--------+ +--------+
|
|
45
|
+
| Server | | Server | ...
|
|
46
|
+
+--------+ +--------+
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
using cluster-client
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
+-------+
|
|
54
|
+
| start |
|
|
55
|
+
+---+---+
|
|
56
|
+
|
|
|
57
|
+
+--------+---------+
|
|
58
|
+
__| port competition |__
|
|
59
|
+
win / +------------------+ \ lose
|
|
60
|
+
/ \
|
|
61
|
+
+--------+ tcp conn +----------+
|
|
62
|
+
| Leader |<---------------->| Follower |
|
|
63
|
+
+--------+ +----------+
|
|
64
|
+
|
|
|
65
|
+
+--------+
|
|
66
|
+
| Client |
|
|
67
|
+
+--------+
|
|
68
|
+
| \
|
|
69
|
+
| \
|
|
70
|
+
| \
|
|
71
|
+
| \
|
|
72
|
+
+--------+ +--------+
|
|
73
|
+
| Server | | Server | ...
|
|
74
|
+
+--------+ +--------+
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Protocol
|
|
79
|
+
|
|
80
|
+
- Packet structure
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
0 1 2 4 12
|
|
84
|
+
+-------+-------+---------------+---------------------------------------------------------------+
|
|
85
|
+
|version|req/res| reserved | request id |
|
|
86
|
+
+-------------------------------+-------------------------------+-------------------------------+
|
|
87
|
+
| timeout | connection object length | application object length |
|
|
88
|
+
+-------------------------------+---------------------------------------------------------------+
|
|
89
|
+
| conn object (JSON format) ... | app object |
|
|
90
|
+
+-----------------------------------------------------------+ |
|
|
91
|
+
| ... |
|
|
92
|
+
+-----------------------------------------------------------------------------------------------+
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- Protocol Type
|
|
96
|
+
- Register Channel
|
|
97
|
+
- Subscribe/Publish
|
|
98
|
+
- Invoke
|
|
99
|
+
- Sequence diagram
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
+----------+ +---------------+ +---------+
|
|
103
|
+
| Follower | | local server | | Leader |
|
|
104
|
+
+----------+ +---------------+ +---------+
|
|
105
|
+
| register channel | assign to |
|
|
106
|
+
+ -----------------------> | --------------------> |
|
|
107
|
+
| | |
|
|
108
|
+
| subscribe |
|
|
109
|
+
+ ------------------------------------------------> |
|
|
110
|
+
| subscribe result |
|
|
111
|
+
| <------------------------------------------------ +
|
|
112
|
+
| |
|
|
113
|
+
| invoke |
|
|
114
|
+
+ ------------------------------------------------> |
|
|
115
|
+
| invoke result |
|
|
116
|
+
| <------------------------------------------------ +
|
|
117
|
+
| |
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Install
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm install cluster-client --save
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Node.js >= 6.0.0 required
|
|
127
|
+
|
|
128
|
+
## Usage
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
'use strict';
|
|
132
|
+
|
|
133
|
+
const co = require('co');
|
|
134
|
+
const Base = require('sdk-base');
|
|
135
|
+
const cluster = require('cluster-client');
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Client Example
|
|
139
|
+
*/
|
|
140
|
+
class YourClient extends Base {
|
|
141
|
+
constructor(options) {
|
|
142
|
+
super(options);
|
|
143
|
+
|
|
144
|
+
this.options = options;
|
|
145
|
+
this.ready(true);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
subscribe(reg, listener) {
|
|
149
|
+
// subscribe logic
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
publish(reg) {
|
|
153
|
+
// publish logic
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
* getData(id) {
|
|
157
|
+
// invoke api
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
getDataCallback(id, cb) {
|
|
161
|
+
// ...
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
getDataPromise(id) {
|
|
165
|
+
// ...
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// create some client instances, but only one instance will connect to server
|
|
170
|
+
const client_1 = cluster(YourClient)
|
|
171
|
+
.delegate('getData')
|
|
172
|
+
.delegate('getDataCallback')
|
|
173
|
+
.delegate('getDataPromise')
|
|
174
|
+
.create({ foo: 'bar' });
|
|
175
|
+
const client_2 = cluster(YourClient)
|
|
176
|
+
.delegate('getData')
|
|
177
|
+
.delegate('getDataCallback')
|
|
178
|
+
.delegate('getDataPromise')
|
|
179
|
+
.create({ foo: 'bar' });
|
|
180
|
+
const client_3 = cluster(YourClient)
|
|
181
|
+
.delegate('getData')
|
|
182
|
+
.delegate('getDataCallback')
|
|
183
|
+
.delegate('getDataPromise')
|
|
184
|
+
.create({ foo: 'bar' });
|
|
185
|
+
|
|
186
|
+
// subscribe information
|
|
187
|
+
client_1.subscribe('some thing', result => console.log(result));
|
|
188
|
+
client_2.subscribe('some thing', result => console.log(result));
|
|
189
|
+
client_3.subscribe('some thing', result => console.log(result));
|
|
190
|
+
|
|
191
|
+
// publish data
|
|
192
|
+
client_2.publish('some data');
|
|
193
|
+
|
|
194
|
+
// invoke method
|
|
195
|
+
client_3.getDataCallback('some thing', (err, val) => console.log(val));
|
|
196
|
+
client_2.getDataPromise('some thing').then(val => console.log(val));
|
|
197
|
+
|
|
198
|
+
co(function*() {
|
|
199
|
+
const ret = yield client_1.getData('some thing');
|
|
200
|
+
console.log(ret);
|
|
201
|
+
}).catch(err => console.error(err));
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## API
|
|
205
|
+
|
|
206
|
+
- `delegate(from, to)`:
|
|
207
|
+
create delegate method, `from` is the method name your want to create, and `to` have 6 possible values: [ `subscribe`, `unSubscribe`, `publish`, `invoke`, `invokeOneway`, `close` ], and the default value is invoke
|
|
208
|
+
- `override(name, value)`:
|
|
209
|
+
override one property
|
|
210
|
+
- `create(…)`
|
|
211
|
+
create the client instance
|
|
212
|
+
- `close(client)`
|
|
213
|
+
close the client
|
|
214
|
+
- `APIClientBase` a base class to help you create your api client
|
|
215
|
+
|
|
216
|
+
## Best Practice
|
|
217
|
+
|
|
218
|
+
1. DataClient
|
|
219
|
+
|
|
220
|
+
- Only provider data API, interact with server and maintain persistent connections etc.
|
|
221
|
+
- No need to concern `cluster` issue
|
|
222
|
+
|
|
223
|
+
1. APIClient
|
|
224
|
+
|
|
225
|
+
- Using `cluster-client` to wrap DataClient
|
|
226
|
+
- Put your bussiness logic here
|
|
227
|
+
|
|
228
|
+
### DataClient
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
const Base = require('sdk-base');
|
|
232
|
+
|
|
233
|
+
class DataClient extends Base {
|
|
234
|
+
constructor(options) {
|
|
235
|
+
super(options);
|
|
236
|
+
this.ready(true);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
subscribe(info, listener) {
|
|
240
|
+
// subscribe data from server
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
publish(info) {
|
|
244
|
+
// publish data to server
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
* getData(id) {
|
|
248
|
+
// asynchronous API
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### APIClient
|
|
254
|
+
|
|
255
|
+
```js
|
|
256
|
+
const DataClient = require('./your-data-client');
|
|
257
|
+
const { APIClientBase } = require('cluster-client');
|
|
258
|
+
|
|
259
|
+
class APIClient extends APIClientBase {
|
|
260
|
+
constructor(options) {
|
|
261
|
+
super(options);
|
|
262
|
+
this._cache = new Map();
|
|
263
|
+
}
|
|
264
|
+
get DataClient() {
|
|
265
|
+
return DataClient;
|
|
266
|
+
}
|
|
267
|
+
get delegates() {
|
|
268
|
+
return {
|
|
269
|
+
getData: 'invoke',
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
get clusterOptions() {
|
|
273
|
+
return {
|
|
274
|
+
name: 'MyClient',
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
subscribe(...args) {
|
|
278
|
+
return this._client.subscribe(...args);
|
|
279
|
+
}
|
|
280
|
+
publish(...args) {
|
|
281
|
+
return this._client.publish(...args);
|
|
282
|
+
}
|
|
283
|
+
* getData(id) {
|
|
284
|
+
// write your business logic & use data client API
|
|
285
|
+
if (this._cache.has(id)) {
|
|
286
|
+
return this._cache.get(id);
|
|
287
|
+
}
|
|
288
|
+
const data = yield this._client.getData(id);
|
|
289
|
+
this._cache.set(id, data);
|
|
290
|
+
return datal
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
```js
|
|
296
|
+
|------------------------------------------------|
|
|
297
|
+
| APIClient |
|
|
298
|
+
| |----------------------------------------|
|
|
299
|
+
| | ClusterClient |
|
|
300
|
+
| | |---------------------------------|
|
|
301
|
+
| | | DataClient |
|
|
302
|
+
|-------|------|---------------------------------|
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
For more information, you can refer to the [discussion](https://github.com/eggjs/egg/issues/322)
|
|
306
|
+
|
|
307
|
+
[MIT](LICENSE)
|
|
308
|
+
|
|
309
|
+
<!-- GITCONTRIBUTOR_START -->
|
|
310
|
+
|
|
311
|
+
## Contributors
|
|
312
|
+
|
|
313
|
+
|[<img src="https://avatars.githubusercontent.com/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/456108?v=4" width="100px;"/><br/><sub><b>shaoshuai0102</b></sub>](https://github.com/shaoshuai0102)<br/>|[<img src="https://avatars.githubusercontent.com/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/227713?v=4" width="100px;"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>|
|
|
314
|
+
| :---: | :---: | :---: | :---: | :---: | :---: |
|
|
315
|
+
[<img src="https://avatars.githubusercontent.com/u/546535?v=4" width="100px;"/><br/><sub><b>leoner</b></sub>](https://github.com/leoner)<br/>|[<img src="https://avatars.githubusercontent.com/u/2160731?v=4" width="100px;"/><br/><sub><b>mansonchor</b></sub>](https://github.com/mansonchor)<br/>|[<img src="https://avatars.githubusercontent.com/u/19849579?v=4" width="100px;"/><br/><sub><b>sinkhaha</b></sub>](https://github.com/sinkhaha)<br/>|[<img src="https://avatars.githubusercontent.com/u/6457450?v=4" width="100px;"/><br/><sub><b>limitMe</b></sub>](https://github.com/limitMe)<br/>
|
|
316
|
+
|
|
317
|
+
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Tue Jun 20 2023 12:29:14 GMT+0800`.
|
|
318
|
+
|
|
319
|
+
<!-- GITCONTRIBUTOR_END -->
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
const is = require('is-type-of');
|
|
5
|
+
const cluster = require('./lib');
|
|
6
|
+
const symbols = require('./lib/symbol');
|
|
7
|
+
const APIClientBase = require('./lib/api_client');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create an Wrapper
|
|
11
|
+
*
|
|
12
|
+
* @param {Function} clientClass - client class
|
|
13
|
+
* @param {Object} options - wrapper options
|
|
14
|
+
* @return {ClientWrapper} wrapper
|
|
15
|
+
*/
|
|
16
|
+
module.exports = cluster;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Close a ClusterClient
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} client - ClusterClient instance to be closed
|
|
22
|
+
* @return {Promise} returns a promise which will be resolved after fully closed
|
|
23
|
+
*/
|
|
24
|
+
module.exports.close = client => {
|
|
25
|
+
assert(is.function(client[symbols.close]), '[cluster#close] client should be instanceof ClusterClient');
|
|
26
|
+
return client[symbols.close]();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* API Client SuperClass
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ---------------------------------------------
|
|
34
|
+
* class ClusterClient extends APIClientBase {
|
|
35
|
+
* get DataClient() {
|
|
36
|
+
* return require('./supports/client');
|
|
37
|
+
* }
|
|
38
|
+
* get delegates() {
|
|
39
|
+
* return {
|
|
40
|
+
* unPublish: 'invokeOneway',
|
|
41
|
+
* };
|
|
42
|
+
* }
|
|
43
|
+
* get clusterOptions() {
|
|
44
|
+
* return {
|
|
45
|
+
* responseTimeout: 1000,
|
|
46
|
+
* port,
|
|
47
|
+
* };
|
|
48
|
+
* }
|
|
49
|
+
* subscribe(...args) {
|
|
50
|
+
* return this._client.subscribe(...args);
|
|
51
|
+
* }
|
|
52
|
+
* unSubscribe(...args) {
|
|
53
|
+
* return this._client.unSubscribe(...args);
|
|
54
|
+
* }
|
|
55
|
+
* publish(...args) {
|
|
56
|
+
* return this._client.publish(...args);
|
|
57
|
+
* }
|
|
58
|
+
* unPublish(...args) {
|
|
59
|
+
* return this._client.unPublish(...args);
|
|
60
|
+
* }
|
|
61
|
+
* close() {
|
|
62
|
+
* return this._client.close();
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
*/
|
|
66
|
+
module.exports.APIClientBase = APIClientBase;
|