suanpan_node_sdk 2.0.0-beta.9 → 2.0.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.
Files changed (224) hide show
  1. package/README.md +69 -45
  2. package/dist/api/index.d.ts +12 -0
  3. package/dist/api/index.js +55 -0
  4. package/dist/api/index.js.map +1 -0
  5. package/dist/core/common/constant.d.ts +6 -0
  6. package/dist/{constant.js → core/common/constant.js} +7 -2
  7. package/dist/core/common/constant.js.map +1 -0
  8. package/dist/{common → core/common}/exec.d.ts +0 -0
  9. package/dist/{common → core/common}/exec.js +0 -0
  10. package/dist/core/common/exec.js.map +1 -0
  11. package/dist/core/common/log.d.ts +3 -0
  12. package/dist/core/common/log.js +16 -0
  13. package/dist/core/common/log.js.map +1 -0
  14. package/dist/core/event/index.d.ts +6 -0
  15. package/dist/core/event/index.js +11 -0
  16. package/dist/core/event/index.js.map +1 -0
  17. package/dist/core/logkit/index.d.ts +33 -0
  18. package/dist/core/logkit/index.js +126 -0
  19. package/dist/core/logkit/index.js.map +1 -0
  20. package/dist/core/message/channel.d.ts +10 -0
  21. package/dist/core/message/channel.js +3 -0
  22. package/dist/core/message/channel.js.map +1 -0
  23. package/dist/core/message/channelFactory.d.ts +4 -0
  24. package/dist/core/message/channelFactory.js +12 -0
  25. package/dist/core/message/channelFactory.js.map +1 -0
  26. package/dist/core/message/index.d.ts +6 -0
  27. package/dist/core/message/index.js +19 -0
  28. package/dist/core/message/index.js.map +1 -0
  29. package/dist/core/message/message.d.ts +19 -0
  30. package/dist/core/message/message.js +62 -0
  31. package/dist/core/message/message.js.map +1 -0
  32. package/dist/core/message/messageBuilder.d.ts +13 -0
  33. package/dist/core/message/messageBuilder.js +55 -0
  34. package/dist/core/message/messageBuilder.js.map +1 -0
  35. package/dist/core/message/messageChain.d.ts +9 -0
  36. package/dist/core/message/messageChain.js +30 -0
  37. package/dist/core/message/messageChain.js.map +1 -0
  38. package/dist/core/message/messageListener.d.ts +4 -0
  39. package/dist/core/message/messageListener.js +13 -0
  40. package/dist/core/message/messageListener.js.map +1 -0
  41. package/dist/core/message/mq/index.d.ts +9 -0
  42. package/dist/core/message/mq/index.js +47 -0
  43. package/dist/core/message/mq/index.js.map +1 -0
  44. package/dist/core/message/mq/redis.d.ts +10 -0
  45. package/dist/core/message/mq/redis.js +92 -0
  46. package/dist/core/message/mq/redis.js.map +1 -0
  47. package/dist/core/parameter/commandArgs.d.ts +2 -0
  48. package/dist/core/parameter/commandArgs.js +23 -0
  49. package/dist/core/parameter/commandArgs.js.map +1 -0
  50. package/dist/core/parameter/environment.d.ts +84 -0
  51. package/dist/core/parameter/environment.js +102 -0
  52. package/dist/core/parameter/environment.js.map +1 -0
  53. package/dist/core/parameter/index.d.ts +8 -0
  54. package/dist/core/parameter/index.js +32 -0
  55. package/dist/core/parameter/index.js.map +1 -0
  56. package/dist/{script → core/script}/script-babel/babel.d.ts +0 -0
  57. package/dist/{script → core/script}/script-babel/babel.js +0 -0
  58. package/dist/core/script/script-babel/babel.js.map +1 -0
  59. package/dist/{script → core/script}/script-babel/plugin.d.ts +0 -0
  60. package/dist/{script → core/script}/script-babel/plugin.js +0 -0
  61. package/dist/core/script/script-babel/plugin.js.map +1 -0
  62. package/dist/{script → core/script}/script-constant.d.ts +0 -0
  63. package/dist/{script → core/script}/script-constant.js +0 -0
  64. package/dist/core/script/script-constant.js.map +1 -0
  65. package/dist/{script → core/script}/script-context.d.ts +1 -1
  66. package/dist/{script → core/script}/script-context.js +1 -1
  67. package/dist/core/script/script-context.js.map +1 -0
  68. package/dist/{script → core/script}/script-front.d.ts +0 -0
  69. package/dist/{script → core/script}/script-front.js +0 -0
  70. package/dist/core/script/script-front.js.map +1 -0
  71. package/dist/{script → core/script}/script-insert.d.ts +0 -0
  72. package/dist/{script → core/script}/script-insert.js +1 -1
  73. package/dist/core/script/script-insert.js.map +1 -0
  74. package/dist/{script → core/script}/script-manager.d.ts +0 -0
  75. package/dist/{script → core/script}/script-manager.js +2 -2
  76. package/dist/core/script/script-manager.js.map +1 -0
  77. package/dist/{script → core/script}/script-storage.d.ts +1 -1
  78. package/dist/{script → core/script}/script-storage.js +2 -2
  79. package/dist/core/script/script-storage.js.map +1 -0
  80. package/dist/{script → core/script}/script-support.d.ts +0 -0
  81. package/dist/{script → core/script}/script-support.js +1 -1
  82. package/dist/core/script/script-support.js.map +1 -0
  83. package/dist/{script → core/script}/script-template.d.ts +0 -0
  84. package/dist/{script → core/script}/script-template.js +0 -0
  85. package/dist/core/script/script-template.js.map +1 -0
  86. package/dist/{port.d.ts → core/service/port.d.ts} +1 -0
  87. package/dist/{port.js → core/service/port.js} +23 -8
  88. package/dist/core/service/port.js.map +1 -0
  89. package/dist/{latestStorage → core/storage}/minio.d.ts +7 -3
  90. package/dist/{latestStorage → core/storage}/minio.js +54 -14
  91. package/dist/core/storage/minio.js.map +1 -0
  92. package/dist/{latestStorage → core/storage}/oss.d.ts +5 -1
  93. package/dist/{latestStorage → core/storage}/oss.js +54 -3
  94. package/dist/core/storage/oss.js.map +1 -0
  95. package/dist/core/storage/storage.d.ts +37 -0
  96. package/dist/{latestStorage → core/storage}/storage.js +3 -15
  97. package/dist/core/storage/storage.js.map +1 -0
  98. package/dist/core/storage/storageFlusher.d.ts +12 -0
  99. package/dist/core/storage/storageFlusher.js +53 -0
  100. package/dist/core/storage/storageFlusher.js.map +1 -0
  101. package/dist/core/storage/storageLogger.d.ts +14 -0
  102. package/dist/core/storage/storageLogger.js +100 -0
  103. package/dist/core/storage/storageLogger.js.map +1 -0
  104. package/dist/core/storage/storagePath.d.ts +16 -0
  105. package/dist/core/storage/storagePath.js +50 -0
  106. package/dist/core/storage/storagePath.js.map +1 -0
  107. package/dist/core/storage/wrapperStorage.d.ts +6 -0
  108. package/dist/{latestStorage → core/storage}/wrapperStorage.js +5 -5
  109. package/dist/core/storage/wrapperStorage.js.map +1 -0
  110. package/dist/core/utils/flusher.d.ts +18 -0
  111. package/dist/core/utils/flusher.js +63 -0
  112. package/dist/core/utils/flusher.js.map +1 -0
  113. package/dist/core/utils/index.d.ts +55 -0
  114. package/dist/core/utils/index.js +238 -0
  115. package/dist/core/utils/index.js.map +1 -0
  116. package/dist/core/utils/number.d.ts +2 -0
  117. package/dist/core/utils/number.js +20 -0
  118. package/dist/core/utils/number.js.map +1 -0
  119. package/dist/{common → core/utils}/retry.d.ts +0 -0
  120. package/dist/{common → core/utils}/retry.js +0 -0
  121. package/dist/core/utils/retry.js.map +1 -0
  122. package/dist/core/utils/support.d.ts +3 -0
  123. package/dist/core/utils/support.js +28 -0
  124. package/dist/core/utils/support.js.map +1 -0
  125. package/dist/{web → core/web}/app.d.ts +0 -0
  126. package/dist/{web → core/web}/app.js +2 -2
  127. package/dist/core/web/app.js.map +1 -0
  128. package/dist/{web → core/web}/server.d.ts +0 -0
  129. package/dist/{web → core/web}/server.js +10 -10
  130. package/dist/core/web/server.js.map +1 -0
  131. package/dist/main.d.ts +5 -88
  132. package/dist/main.js +9 -37
  133. package/dist/main.js.map +1 -1
  134. package/dist/types/conmonTypes.d.ts +21 -0
  135. package/dist/types/conmonTypes.js +17 -0
  136. package/dist/types/conmonTypes.js.map +1 -0
  137. package/dist/types/index.d.ts +3 -0
  138. package/dist/types/index.js +16 -0
  139. package/dist/types/index.js.map +1 -0
  140. package/dist/types/{storage-types.d.ts → storageTypes.d.ts} +23 -9
  141. package/dist/types/{storage-types.js → storageTypes.js} +1 -1
  142. package/dist/types/storageTypes.js.map +1 -0
  143. package/dist/types/streamTypes.d.ts +24 -0
  144. package/dist/types/streamTypes.js +3 -0
  145. package/dist/types/streamTypes.js.map +1 -0
  146. package/package.json +5 -2
  147. package/dist/arguments.d.ts +0 -72
  148. package/dist/arguments.js +0 -69
  149. package/dist/arguments.js.map +0 -1
  150. package/dist/commandArgs.d.ts +0 -10
  151. package/dist/commandArgs.js +0 -18
  152. package/dist/commandArgs.js.map +0 -1
  153. package/dist/common/exec.js.map +0 -1
  154. package/dist/common/file.d.ts +0 -1
  155. package/dist/common/file.js +0 -18
  156. package/dist/common/file.js.map +0 -1
  157. package/dist/common/log.d.ts +0 -3
  158. package/dist/common/log.js +0 -11
  159. package/dist/common/log.js.map +0 -1
  160. package/dist/common/retry.js.map +0 -1
  161. package/dist/common/streamUtility.d.ts +0 -7
  162. package/dist/common/streamUtility.js +0 -42
  163. package/dist/common/streamUtility.js.map +0 -1
  164. package/dist/common/util.d.ts +0 -45
  165. package/dist/common/util.js +0 -175
  166. package/dist/common/util.js.map +0 -1
  167. package/dist/constant.d.ts +0 -1
  168. package/dist/constant.js.map +0 -1
  169. package/dist/dyParameter.d.ts +0 -5
  170. package/dist/dyParameter.js +0 -34
  171. package/dist/dyParameter.js.map +0 -1
  172. package/dist/eventLogger.d.ts +0 -29
  173. package/dist/eventLogger.js +0 -123
  174. package/dist/eventLogger.js.map +0 -1
  175. package/dist/global.d.ts +0 -9
  176. package/dist/global.js +0 -39
  177. package/dist/global.js.map +0 -1
  178. package/dist/latestStorage/minio.js.map +0 -1
  179. package/dist/latestStorage/oss.js.map +0 -1
  180. package/dist/latestStorage/path.d.ts +0 -9
  181. package/dist/latestStorage/path.js +0 -30
  182. package/dist/latestStorage/path.js.map +0 -1
  183. package/dist/latestStorage/storage.d.ts +0 -27
  184. package/dist/latestStorage/storage.js.map +0 -1
  185. package/dist/latestStorage/wrapperStorage.d.ts +0 -7
  186. package/dist/latestStorage/wrapperStorage.js.map +0 -1
  187. package/dist/mq.d.ts +0 -55
  188. package/dist/mq.js +0 -158
  189. package/dist/mq.js.map +0 -1
  190. package/dist/parameter.d.ts +0 -14
  191. package/dist/parameter.js +0 -94
  192. package/dist/parameter.js.map +0 -1
  193. package/dist/port.js.map +0 -1
  194. package/dist/previousStorage/local.d.ts +0 -12
  195. package/dist/previousStorage/local.js +0 -90
  196. package/dist/previousStorage/local.js.map +0 -1
  197. package/dist/previousStorage/minio.d.ts +0 -10
  198. package/dist/previousStorage/minio.js +0 -201
  199. package/dist/previousStorage/minio.js.map +0 -1
  200. package/dist/previousStorage/oss.d.ts +0 -27
  201. package/dist/previousStorage/oss.js +0 -153
  202. package/dist/previousStorage/oss.js.map +0 -1
  203. package/dist/previousStorage/storage.d.ts +0 -21
  204. package/dist/previousStorage/storage.js +0 -21
  205. package/dist/previousStorage/storage.js.map +0 -1
  206. package/dist/script/script-babel/babel.js.map +0 -1
  207. package/dist/script/script-babel/plugin.js.map +0 -1
  208. package/dist/script/script-constant.js.map +0 -1
  209. package/dist/script/script-context.js.map +0 -1
  210. package/dist/script/script-front.js.map +0 -1
  211. package/dist/script/script-insert.js.map +0 -1
  212. package/dist/script/script-manager.js.map +0 -1
  213. package/dist/script/script-storage.js.map +0 -1
  214. package/dist/script/script-support.js.map +0 -1
  215. package/dist/script/script-template.js.map +0 -1
  216. package/dist/socketSever.d.ts +0 -1
  217. package/dist/socketSever.js +0 -47
  218. package/dist/socketSever.js.map +0 -1
  219. package/dist/staticServer.d.ts +0 -5
  220. package/dist/staticServer.js +0 -30
  221. package/dist/staticServer.js.map +0 -1
  222. package/dist/types/storage-types.js.map +0 -1
  223. package/dist/web/app.js.map +0 -1
  224. package/dist/web/server.js.map +0 -1
@@ -1,3 +1,26 @@
1
+ import type { LogLevel } from './conmonTypes';
2
+ export declare type ObjectItem = {
3
+ name: string;
4
+ lastModified: string;
5
+ };
6
+ export declare enum StorageType {
7
+ OSS = "oss",
8
+ SUANPAN = "suanpan",
9
+ MINIO = "minio"
10
+ }
11
+ export interface StoragePathOptions {
12
+ userId?: string;
13
+ appId?: string;
14
+ nodeId?: string;
15
+ componentId?: string;
16
+ }
17
+ export declare type StorageLoggerOptions = {
18
+ storagePath: string;
19
+ console?: boolean;
20
+ level?: LogLevel;
21
+ maxItems?: number;
22
+ flushInterval?: number;
23
+ };
1
24
  export declare type StsToken = {
2
25
  Credentials: {
3
26
  AccessKeyId: string;
@@ -8,12 +31,3 @@ export declare type StsToken = {
8
31
  bucket: string;
9
32
  region: string;
10
33
  };
11
- export declare type ObjectItem = {
12
- name: string;
13
- lastModified: string;
14
- };
15
- export declare enum StorageType {
16
- OSS = "oss",
17
- SUANPAN = "suanpan",
18
- MINIO = "minio"
19
- }
@@ -7,4 +7,4 @@ var StorageType;
7
7
  StorageType["SUANPAN"] = "suanpan";
8
8
  StorageType["MINIO"] = "minio";
9
9
  })(StorageType = exports.StorageType || (exports.StorageType = {}));
10
- //# sourceMappingURL=storage-types.js.map
10
+ //# sourceMappingURL=storageTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storageTypes.js","sourceRoot":"","sources":["../../src/types/storageTypes.ts"],"names":[],"mappings":";;;AAOA,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB"}
@@ -0,0 +1,24 @@
1
+ export declare type Inx = 'in1' | 'in2' | 'in3' | 'in4' | 'in5';
2
+ export declare type Outx = 'out1' | 'out2' | 'out3' | 'out4' | 'out5';
3
+ export declare type InputPortsMap<T> = {
4
+ [inx in Inx]?: T;
5
+ };
6
+ export declare type OutPortsMap<T> = {
7
+ [outx in Outx]?: T;
8
+ };
9
+ export interface RequestStream extends InputPortsMap<string> {
10
+ id: string;
11
+ type: string;
12
+ extra: string;
13
+ }
14
+ export interface ResponseStream extends OutPortsMap<string> {
15
+ request_id: string;
16
+ node_id: string;
17
+ success?: 'true' | 'false';
18
+ type?: string;
19
+ extra?: string;
20
+ msg?: string;
21
+ }
22
+ export declare type DeserializedRequestStream = {
23
+ [P in keyof RequestStream]: any;
24
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=streamTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamTypes.js","sourceRoot":"","sources":["../../src/types/streamTypes.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suanpan_node_sdk",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.0",
4
4
  "description": "suanpan sdk for node.js",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -17,7 +17,8 @@
17
17
  "lint": "./node_modules/.bin/eslint src --ext .ts,.js",
18
18
  "lint-fix": "./node_modules/.bin/eslint --fix --ext .ts,.js .",
19
19
  "prebuild": "make prebuild",
20
- "build": "make build"
20
+ "build": "make build",
21
+ "prepublish": "npm run build"
21
22
  },
22
23
  "files": [
23
24
  "dist",
@@ -60,6 +61,7 @@
60
61
  "moment": "^2.24.0",
61
62
  "promise-retry": "^2.0.1",
62
63
  "require-from-string": "^2.0.2",
64
+ "serialize-javascript": "^6.0.0",
63
65
  "serve-handler": "^6.1.3",
64
66
  "socket.io": "^2.3.0",
65
67
  "socket.io-client": "^4.1.3",
@@ -78,6 +80,7 @@
78
80
  "@types/minio": "^7.0.7",
79
81
  "@types/node": "^14.14.35",
80
82
  "@types/promise-retry": "^1.1.3",
83
+ "@types/serialize-javascript": "^5.0.1",
81
84
  "@types/uuid": "^8.3.1",
82
85
  "@typescript-eslint/eslint-plugin": "^4.19.0",
83
86
  "@typescript-eslint/parser": "^4.19.0",
@@ -1,72 +0,0 @@
1
- declare namespace ossConfig {
2
- const endpoint: unknown;
3
- const bucketName: unknown;
4
- const accessId: unknown;
5
- const accessKey: unknown;
6
- const tempStore: unknown;
7
- const globalStore: unknown;
8
- }
9
- declare namespace minioConfig {
10
- const endpoint_1: unknown;
11
- export { endpoint_1 as endpoint };
12
- const bucketName_1: unknown;
13
- export { bucketName_1 as bucketName };
14
- const accessId_1: unknown;
15
- export { accessId_1 as accessId };
16
- const accessKey_1: unknown;
17
- export { accessKey_1 as accessKey };
18
- const tempStore_1: unknown;
19
- export { tempStore_1 as tempStore };
20
- const globalStore_1: unknown;
21
- export { globalStore_1 as globalStore };
22
- }
23
- declare namespace localConfig {
24
- const tempStore_2: unknown;
25
- export { tempStore_2 as tempStore };
26
- const globalStore_2: unknown;
27
- export { globalStore_2 as globalStore };
28
- }
29
- declare namespace streamConfig {
30
- const userId: unknown;
31
- const appId: unknown;
32
- const nodeId: unknown;
33
- const host: unknown;
34
- const sendQueue: unknown;
35
- const receiveQueue: unknown;
36
- const sendQueueMaxLength: unknown;
37
- const sendQueueTrimImmediately: unknown;
38
- }
39
- declare namespace suanpanConfig {
40
- export const affinity: string | undefined;
41
- const host_1: string | undefined;
42
- export { host_1 as host };
43
- export const port: string | undefined;
44
- export const protocol: boolean | "" | undefined;
45
- export const accessSecret: string | undefined;
46
- export namespace field {
47
- const userIdHeader: string;
48
- const userSignature: string;
49
- const userSignVersionHeader: string;
50
- }
51
- }
52
- export namespace mq {
53
- const sendQueue_1: unknown;
54
- export { sendQueue_1 as sendQueue };
55
- const receiveQueue_1: unknown;
56
- export { receiveQueue_1 as receiveQueue };
57
- const sendQueueMaxLength_1: unknown;
58
- export { sendQueueMaxLength_1 as sendQueueMaxLength };
59
- const sendQueueTrimImmediately_1: unknown;
60
- export { sendQueueTrimImmediately_1 as sendQueueTrimImmediately };
61
- const host_2: unknown;
62
- export { host_2 as host };
63
- export const type: unknown;
64
- }
65
- export namespace spConfig {
66
- const mstorageType: unknown;
67
- const storageType: unknown;
68
- const mqType: unknown;
69
- const dwType: unknown;
70
- const debug: boolean;
71
- }
72
- export { ossConfig as oss, minioConfig as minio, localConfig as local, streamConfig as stream, suanpanConfig as suanpan };
package/dist/arguments.js DELETED
@@ -1,69 +0,0 @@
1
- 'use strict';
2
- const argvs = require('./commandArgs');
3
- const streamConfig = {
4
- userId: argvs['stream-user-id'] || process.env.SP_USER_ID,
5
- appId: argvs['stream-app-id'] || process.env.SP_APP_ID,
6
- nodeId: argvs['stream-node-id'] || process.env.SP_NODE_ID,
7
- host: argvs['stream-host'] || process.env.SP_MQ_REDIS_HOST,
8
- sendQueue: argvs['stream-send-queue'] || process.env.SP_STREAM_SEND_QUEUE,
9
- receiveQueue: argvs['stream-recv-queue'] || process.env.SP_STREAM_RECV_QUEUE,
10
- sendQueueMaxLength: argvs['stream-send-queue-max-length'] || process.env.SP_STREAM_SEND_QUEUE_MAX_LENGTH,
11
- sendQueueTrimImmediately: argvs['stream-send-queue-trim-immediately'] || process.env.SP_STREAM_SEND_QUEUE_TRIM_IMMEDIATELY
12
- };
13
- const suanpanConfig = {
14
- affinity: process.env.SP_AFFINITY,
15
- host: process.env.SP_HOST,
16
- port: process.env.SP_PORT,
17
- protocol: process.env.SP_HOST_TLS && process.env.SP_HOST_TLS !== 'false',
18
- accessSecret: process.env.SP_ACCESS_SECRET,
19
- field: {
20
- userIdHeader: process.env.SP_USER_ID_HEADER_FIELD || 'x-sp-user-id',
21
- userSignature: process.env.SP_USER_SIGNATURE_HEADER_FIELD || 'x-sp-signature',
22
- userSignVersionHeader: process.env.SP_USER_SIGN_VERSION_HEADER_FIELD || 'x-sp-sign-version'
23
- }
24
- };
25
- const mq = {
26
- sendQueue: argvs['stream-send-queue'] || process.env.SP_STREAM_SEND_QUEUE,
27
- receiveQueue: argvs['stream-recv-queue'] || process.env.SP_STREAM_RECV_QUEUE,
28
- sendQueueMaxLength: argvs['stream-send-queue-max-length'] || process.env.SP_STREAM_SEND_QUEUE_MAX_LENGTH,
29
- sendQueueTrimImmediately: argvs['stream-send-queue-trim-immediately'] || process.env.SP_STREAM_SEND_QUEUE_TRIM_IMMEDIATELY,
30
- host: argvs['mq-redis-host'] || process.env.SP_MQ_REDIS_HOST,
31
- type: argvs['mq-type'] || process.env.SP_MQ_TYPE
32
- };
33
- const ossConfig = {
34
- endpoint: argvs['storage-oss-endpoint'],
35
- bucketName: argvs['storage-oss-bucket-name'],
36
- accessId: argvs['storage-oss-access-id'],
37
- accessKey: argvs['storage-oss-access-key'],
38
- tempStore: argvs['storage-oss-temp-store'] || process.env.SP_STORAGE_OSS_TEMP_STORE,
39
- globalStore: argvs['storage-oss-global-store'] || process.env.SP_STORAGE_OSS_GLOBAL_STORE
40
- };
41
- const minioConfig = {
42
- endpoint: argvs['storage-minio-endpoint'] || 'http://127.0.0.1:9000',
43
- bucketName: argvs['storage-minio-bucket-name'] || 'suanpan',
44
- accessId: argvs['storage-minio-access-id'] || 'MINIO_ACCESS',
45
- accessKey: argvs['storage-minio-access-key'] || 'MINIO_SECRET',
46
- tempStore: argvs['storage-minio-temp-store'] || process.env.SP_STORAGE_MINIO_TEMP_STORE,
47
- globalStore: argvs['storage-minio-global-store'] || process.env.SP_STORAGE_MINIO_GLOBAL_STORE
48
- };
49
- const localConfig = {
50
- tempStore: argvs['storage-local-temp-store'] || process.env.SP_STORAGE_LOCAL_TEMP_STORE,
51
- globalStore: argvs['storage-local-global-store'] || process.env.SP_STORAGE_LOCAL_GLOBAL_STORE
52
- };
53
- const spConfig = {
54
- mstorageType: argvs['mstorage-type'] || process.env.SP_MSTORAGE_TYPE,
55
- storageType: argvs['storage-type'] || process.env.SP_STORAGE_TYPE,
56
- mqType: argvs['mq-type'] || process.env.SP_MQ_TYPE,
57
- dwType: argvs['dw-type'] || process.env.SP_DW_TYPE,
58
- debug: process.env.SP_DEBUG === 'true'
59
- };
60
- module.exports = {
61
- oss: ossConfig,
62
- minio: minioConfig,
63
- local: localConfig,
64
- stream: streamConfig,
65
- suanpan: suanpanConfig,
66
- mq,
67
- spConfig
68
- };
69
- //# sourceMappingURL=arguments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arguments.js","sourceRoot":"","sources":["../src/arguments.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,KAAK,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEvC,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;IACzD,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS;IACtD,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,I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AAG,CAAC,2BAA2B;IACvF,WAAW,EAAE,KAAK,CAAC,4BAA4B,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,6BAA6B;CAC9F,CAAC;AAEF,MAAM,QAAQ,GAAG;IACf,YAAY,EAAE,KAAK,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB;IACpE,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe;IACjE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;IAClD,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;IAClD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;CACvC,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG;IACf,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,EAAE;IACF,QAAQ;CACT,CAAC"}
@@ -1,10 +0,0 @@
1
- export = argvs;
2
- declare const argvs: {
3
- [x: string]: unknown;
4
- _: string[];
5
- $0: string;
6
- } & {
7
- [x: string]: unknown;
8
- _: string[];
9
- $0: string;
10
- };
@@ -1,18 +0,0 @@
1
- 'use strict';
2
- const is = require('is-type-of');
3
- const split = require('split-string');
4
- const yargs = require('yargs').parserConfiguration({
5
- 'camel-case-expansion': false
6
- });
7
- function getArgvFromEnvSpParam() {
8
- const spParam = !is.string(process.env.SP_PARAM) ? '' : process.env.SP_PARAM;
9
- const textSpParam = Buffer.from(spParam, 'base64').toString('utf8');
10
- return yargs.parse(split(textSpParam.trim(), {
11
- separator: ' ',
12
- quotes: ['"', '\''],
13
- brackets: true
14
- }));
15
- }
16
- const argvs = Object.assign(yargs.argv, getArgvFromEnvSpParam());
17
- module.exports = argvs;
18
- //# sourceMappingURL=commandArgs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandArgs.js","sourceRoot":"","sources":["../src/commandArgs.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACjC,MAAM,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC;IACjD,sBAAsB,EAAE,KAAK;CAC9B,CAAC,CAAC;AAEH,SAAS,qBAAqB;IAC5B,MAAM,OAAO,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7E,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE;QAC3C,SAAS,EAAE,GAAG;QACd,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC;QACnB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC;AAEjE,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/common/exec.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAE9C,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAA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MAAM,SAAS,GAAG,EAAE,CAAC;QAErB,MAAM,aAAa,GAAG,IAAI,mBAAmB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,MAAM,aAAa,GAAG,IAAI,mBAAmB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACjC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC,EAAE;gBACd,OAAO,EAAE,CAAC;aACX;iBAAM;gBACL,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC1B,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;iBACrC;gBACD,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;aACxB;QACH,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,EAAE,cAAc,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- export function writeBufToFile(dstPath: any, buf: any): Promise<any>;
@@ -1,18 +0,0 @@
1
- 'use strict';
2
- const fs = require('fs-extra');
3
- function writeBufToFile(dstPath, buf) {
4
- return new Promise((resolve, reject) => {
5
- const ws = fs.createWriteStream(dstPath);
6
- ws.write(buf);
7
- ws.end();
8
- ws.on('finish', () => {
9
- resolve();
10
- });
11
- ws.on('error', (error) => {
12
- console.log(`${dstPath} write error : ${error}`);
13
- reject(error);
14
- });
15
- });
16
- }
17
- module.exports = { writeBufToFile };
18
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/common/file.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE/B,SAAS,cAAc,CAAE,OAAO,EAAE,GAAG;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACzC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACd,EAAE,CAAC,GAAG,EAAE,CAAC;QACT,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACnB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACvB,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,kBAAkB,KAAK,EAAE,CAAC,CAAC;YACjD,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,cAAc,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- export = logger;
2
- declare const logger: log4js.Logger;
3
- import log4js = require("log4js");
@@ -1,11 +0,0 @@
1
- 'use strict';
2
- const log4js = require('log4js');
3
- const logger = log4js.getLogger();
4
- if (process.env.SP_DEBUG === 'true' || process.env.SP_DEBUG === true) {
5
- logger.level = 'debug';
6
- }
7
- else {
8
- logger.level = 'info';
9
- }
10
- module.exports = logger;
11
- //# sourceMappingURL=log.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/common/log.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;AAElC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,EAAE;IACpE,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC;CACxB;KAAM;IACL,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/common/retry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAAkC;AAElC,SAAe,eAAe,CAAC,UAAkB,CAAC;;QAChD,MAAM,YAAY,GAAG;YACnB,OAAO;YACP,MAAM,EAAE,CAAC;YACT,UAAU,EAAE,CAAC,GAAG,IAAI;YACpB,SAAS,EAAE,IAAI;SAChB,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC;CAAA;AAED,SAAsB,YAAY,CAAC,EAAE,EAAE,UAAkB,CAAC;;QACxD,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;QACpD,OAAO,uBAAK,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;IACjC,CAAC;CAAA;AAHD,oCAGC"}
@@ -1,7 +0,0 @@
1
- /// <reference types="node" />
2
- import { Stream } from 'stream';
3
- export declare function convertStreamToBuffer(stream: Stream): Promise<Buffer>;
4
- declare type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex';
5
- export declare function convertStreamToString(stream: Stream, encoding?: BufferEncoding): Promise<string>;
6
- export declare function convertBufferToStream(buffer: Buffer): Stream;
7
- export {};
@@ -1,42 +0,0 @@
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.convertBufferToStream = exports.convertStreamToString = exports.convertStreamToBuffer = void 0;
13
- const stream_1 = require("stream");
14
- function convertStreamToBuffer(stream) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- return new Promise((resolve, reject) => {
17
- const buffers = [];
18
- stream.on('data', buffer => buffers.push(typeof buffer === 'string' ? Buffer.from(buffer) : buffer));
19
- stream.on('end', () => resolve(Buffer.concat(buffers)));
20
- stream.on('error', error => reject(error));
21
- stream.resume();
22
- });
23
- });
24
- }
25
- exports.convertStreamToBuffer = convertStreamToBuffer;
26
- function convertStreamToString(stream, encoding = 'utf-8') {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const buffer = yield convertStreamToBuffer(stream);
29
- return buffer.toString(encoding);
30
- });
31
- }
32
- exports.convertStreamToString = convertStreamToString;
33
- function convertBufferToStream(buffer) {
34
- return new stream_1.Readable({
35
- read() {
36
- this.push(buffer);
37
- this.push(null);
38
- }
39
- });
40
- }
41
- exports.convertBufferToStream = convertBufferToStream;
42
- //# sourceMappingURL=streamUtility.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"streamUtility.js","sourceRoot":"","sources":["../../src/common/streamUtility.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA0C;AAE1C,SAAsB,qBAAqB,CAAC,MAAc;;QACxD,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACrG,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACxD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACrC,MAAO,CAAC,MAAM,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AARD,sDAQC;AAID,SAAsB,qBAAqB,CAAC,MAAc,EAAE,WAA2B,OAAO;;QAC5F,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CAAA;AAHD,sDAGC;AAED,SAAgB,qBAAqB,CAAC,MAAc;IAClD,OAAO,IAAI,iBAAQ,CAAC;QAClB,IAAI;YACF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAPD,sDAOC"}
@@ -1,45 +0,0 @@
1
- export function generateUUID(): string;
2
- export function isDesktop(): any;
3
- export function signatureV1(secret?: string, data?: string): string;
4
- export function jsonParse(str: any, errLog: any): any;
5
- export function getConfig(setting: any): any;
6
- export function getFullPath(keyPath: any, defaultPrefix: any): any;
7
- export function rmPrefixPath(originPath: any, prefix: any): any;
8
- export function isUseMaster(): boolean;
9
- export function isTrue(value: any): boolean;
10
- export function pathEndWith(csvFilePath: any, fileSuffix: any): boolean;
11
- export function readableToString(readable: any): Promise<any>;
12
- export function stringifyIfNecessary(data: any): any;
13
- export function leftMerge(leftObj?: {}, rightObj?: {}): {};
14
- /**
15
- * insert a string at a specific index
16
- *
17
- * @param leftInsert and @param replace cannot be true at the same time
18
- *
19
- * by default, @param insertStr will be inserted between index and index + 1,
20
- * you can set @param leftInsert: true to insert @param insertStr between index-1 and index
21
- *
22
- * @param {*} originString
23
- * @param {*} index
24
- * @param {*} insertStr
25
- */
26
- export function insertbyIndex(originString: any, { index, insertStr, leftInsert, replace }: {
27
- index: any;
28
- insertStr: any;
29
- leftInsert?: boolean | undefined;
30
- replace?: boolean | undefined;
31
- }): any;
32
- /**
33
- * find the nth occurrence of the specified character
34
- * @param {*} str
35
- * @param {*} char
36
- * @param {*} num
37
- */
38
- export function indexOfNthCharacters(str: any, char: any, num: any): any;
39
- /**
40
- * find the nth occurrence of the specified character
41
- * @param {*} str
42
- * @param {*} char
43
- * @param {*} num
44
- */
45
- export function lastIndexOfNthCharacters(str: any, char: any, num: any): any;
@@ -1,175 +0,0 @@
1
- 'use strict';
2
- process.env.SUPPRESS_NO_CONFIG_WARNING = true;
3
- const _ = require('lodash');
4
- const path = require('path');
5
- const config = require('config');
6
- const logger = require('./log');
7
- const crypto = require('crypto');
8
- const APP_NODE_TYPE_CONFIG = 'app.nodeType';
9
- const USER_MASTER = 'user-master';
10
- const uuid = require('uuid');
11
- function generateUUID() {
12
- return uuid.v4();
13
- }
14
- function getConfig(setting) {
15
- let rs;
16
- try {
17
- rs = config.get(setting);
18
- }
19
- catch (ex) {
20
- logger.debug(`get NODE_CONFIG '${setting}' failed.`, ex.message);
21
- rs = null;
22
- }
23
- return rs;
24
- }
25
- function rmPrefixPath(originPath, prefix) {
26
- if (originPath.startsWith(prefix)) {
27
- return originPath.substr(prefix.length);
28
- }
29
- return originPath;
30
- }
31
- function getFullPath(keyPath, defaultPrefix) {
32
- if (_.startsWith(keyPath, defaultPrefix)) {
33
- return keyPath;
34
- }
35
- return path.posix.join(defaultPrefix, keyPath);
36
- }
37
- function jsonParse(str, errLog) {
38
- let parsed;
39
- try {
40
- parsed = JSON.parse(str);
41
- }
42
- catch (err) {
43
- if (errLog) {
44
- logger.debug(`${errLog} ${err}`);
45
- }
46
- else {
47
- logger.debug(`unable to parse json string ${str}. Error: ${err}`);
48
- }
49
- parsed = str;
50
- }
51
- return parsed;
52
- }
53
- function isTrue(value) {
54
- return value === 'true' || value === true;
55
- }
56
- const isUseMaster = () => {
57
- return getConfig(APP_NODE_TYPE_CONFIG) === USER_MASTER;
58
- };
59
- function stringifyIfNecessary(data) {
60
- let result;
61
- if (_.isString(data)) {
62
- result = data;
63
- }
64
- else {
65
- try {
66
- result = JSON.stringify(data);
67
- }
68
- catch (ex) {
69
- logger.debug('cannot Json.stringify, data:', data);
70
- result = data;
71
- }
72
- }
73
- return result;
74
- }
75
- function pathEndWith(csvFilePath, fileSuffix) {
76
- return path.basename(csvFilePath).endsWith(fileSuffix);
77
- }
78
- function readableToString(readable) {
79
- return new Promise((resolve, reject) => {
80
- const chunks = [];
81
- readable.on('data', chunk => chunks.push(chunk));
82
- readable.on('error', reject);
83
- readable.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
84
- });
85
- }
86
- function leftMerge(leftObj = {}, rightObj = {}) {
87
- return _.mapValues(leftObj, (value, key) => {
88
- if (Object.prototype.hasOwnProperty.call(rightObj, key)) {
89
- return rightObj[key];
90
- }
91
- return value;
92
- });
93
- }
94
- /**
95
- * insert a string at a specific index
96
- *
97
- * @param leftInsert and @param replace cannot be true at the same time
98
- *
99
- * by default, @param insertStr will be inserted between index and index + 1,
100
- * you can set @param leftInsert: true to insert @param insertStr between index-1 and index
101
- *
102
- * @param {*} originString
103
- * @param {*} index
104
- * @param {*} insertStr
105
- */
106
- function insertbyIndex(originString, { index, insertStr, leftInsert = false, replace = false }) {
107
- if (index > 0) {
108
- let leftIndex = index + 1;
109
- let rightIndex = leftIndex;
110
- if (replace) {
111
- leftIndex = index;
112
- rightIndex = leftIndex + 1;
113
- }
114
- if (leftInsert) {
115
- leftIndex = leftIndex - 1;
116
- rightIndex = leftIndex;
117
- }
118
- return originString.substring(0, leftIndex) + insertStr + originString.substr(rightIndex);
119
- }
120
- return insertStr + originString;
121
- }
122
- /**
123
- * find the nth occurrence of the specified character
124
- * @param {*} str
125
- * @param {*} char
126
- * @param {*} num
127
- */
128
- function indexOfNthCharacters(str, char, num) {
129
- let index = str.indexOf(char);
130
- for (let i = 1; i < num; i++) {
131
- index = str.indexOf(char, index + 1);
132
- }
133
- return index;
134
- }
135
- /**
136
- * find the nth occurrence of the specified character
137
- * @param {*} str
138
- * @param {*} char
139
- * @param {*} num
140
- */
141
- function lastIndexOfNthCharacters(str, char, num) {
142
- let index = str.lastIndexOf(char);
143
- for (let i = 1; i < num; i++) {
144
- index = str.lastIndexOf(char, index - 1);
145
- }
146
- return index;
147
- }
148
- function signatureV1(secret = '', data = '') {
149
- const hmac = crypto.createHmac('sha1', secret);
150
- hmac.update(data);
151
- const signatureOut = hmac.digest('base64');
152
- return signatureOut;
153
- }
154
- function isDesktop() {
155
- return getConfig('app.isDesktop');
156
- }
157
- module.exports = {
158
- generateUUID,
159
- isDesktop,
160
- signatureV1,
161
- jsonParse,
162
- getConfig,
163
- getFullPath,
164
- rmPrefixPath,
165
- isUseMaster,
166
- isTrue,
167
- pathEndWith,
168
- readableToString,
169
- stringifyIfNecessary,
170
- leftMerge,
171
- insertbyIndex,
172
- indexOfNthCharacters,
173
- lastIndexOfNthCharacters
174
- };
175
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources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,CAAC,CAAC;IAC3C,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,SAAS,CAAC,eAAe,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,OAAO,GAAG;IACf,YAAY;IACZ,SAAS;IACT,WAAW;IACX,SAAS;IACT,SAAS;IACT,WAAW;IACX,YAAY;IACZ,WAAW;IACX,MAAM;IACN,WAAW;IACX,gBAAgB;IAChB,oBAAoB;IACpB,SAAS;IACT,aAAa;IACb,oBAAoB;IACpB,wBAAwB;CACzB,CAAC"}
@@ -1 +0,0 @@
1
- export const COMMAND_FILTER_KEYS: string[];
@@ -1 +0,0 @@
1
- {"version":3,"file":"constant.js","sourceRoot":"","sources":["../src/constant.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEA,QAAA,mBAAmB,GAAG;IACjC,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,8BAA8B;IAC9B,oCAAoC;IACpC,SAAS;IACT,eAAe;IACf,eAAe;IACf,+BAA+B;IAC/B,qBAAqB;IACrB,cAAc;IACd,wBAAwB;IACxB,2BAA2B;IAC3B,yBAAyB;IACzB,0BAA0B;IAC1B,0BAA0B;IAC1B,SAAS;IACT,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,cAAc;IACd,kBAAkB;IAClB,kBAAkB;IAClB,sBAAsB;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,wBAAwB;IACxB,wBAAwB;IACxB,0BAA0B;IAC1B,0BAA0B;IAC1B,GAAG;IACH,IAAI;IACJ,OAAO;IACP,OAAO;IACP,SAAS;IACT,QAAQ;IACR,WAAW;CACZ,CAAC"}