suanpan_node_sdk 2.2.4 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/api/index.d.ts +10 -10
  2. package/dist/api/index.js +56 -52
  3. package/dist/api/index.js.map +1 -1
  4. package/dist/core/common/constant.d.ts +6 -6
  5. package/dist/core/common/constant.js +50 -50
  6. package/dist/core/common/exec.d.ts +1 -1
  7. package/dist/core/common/exec.js +53 -53
  8. package/dist/core/common/log.d.ts +3 -3
  9. package/dist/core/common/log.js +15 -15
  10. package/dist/core/event/index.d.ts +6 -6
  11. package/dist/core/event/index.js +10 -10
  12. package/dist/core/logkit/index.d.ts +33 -33
  13. package/dist/core/logkit/index.js +125 -125
  14. package/dist/core/logkit/index.js.map +1 -1
  15. package/dist/core/message/channel.d.ts +7 -7
  16. package/dist/core/message/channel.js +2 -2
  17. package/dist/core/message/channelFactory.d.ts +4 -4
  18. package/dist/core/message/channelFactory.js +10 -10
  19. package/dist/core/message/index.d.ts +6 -6
  20. package/dist/core/message/index.js +22 -18
  21. package/dist/core/message/index.js.map +1 -1
  22. package/dist/core/message/message.d.ts +19 -19
  23. package/dist/core/message/message.js +59 -59
  24. package/dist/core/message/message.js.map +1 -1
  25. package/dist/core/message/messageBuilder.d.ts +12 -12
  26. package/dist/core/message/messageBuilder.js +50 -50
  27. package/dist/core/message/messageBuilder.js.map +1 -1
  28. package/dist/core/message/messageChain.d.ts +9 -9
  29. package/dist/core/message/messageChain.js +29 -29
  30. package/dist/core/message/messageListener.d.ts +4 -4
  31. package/dist/core/message/messageListener.js +11 -11
  32. package/dist/core/message/mq/index.d.ts +9 -9
  33. package/dist/core/message/mq/index.js +50 -50
  34. package/dist/core/message/mq/redis.d.ts +12 -12
  35. package/dist/core/message/mq/redis.js +101 -97
  36. package/dist/core/message/mq/redis.js.map +1 -1
  37. package/dist/core/parameter/commandArgs.d.ts +2 -2
  38. package/dist/core/parameter/commandArgs.js +22 -22
  39. package/dist/core/parameter/commandArgs.js.map +1 -1
  40. package/dist/core/parameter/environment.d.ts +86 -86
  41. package/dist/core/parameter/environment.js +103 -103
  42. package/dist/core/parameter/index.d.ts +7 -7
  43. package/dist/core/parameter/index.js +33 -33
  44. package/dist/core/script/script-babel/babel.d.ts +1 -1
  45. package/dist/core/script/script-babel/babel.js +23 -23
  46. package/dist/core/script/script-babel/plugin.d.ts +7 -7
  47. package/dist/core/script/script-babel/plugin.js +16 -16
  48. package/dist/core/script/script-constant.d.ts +36 -36
  49. package/dist/core/script/script-constant.js +70 -70
  50. package/dist/core/script/script-context.d.ts +1 -1
  51. package/dist/core/script/script-context.js +295 -295
  52. package/dist/core/script/script-front.d.ts +1 -1
  53. package/dist/core/script/script-front.js +201 -201
  54. package/dist/core/script/script-insert.d.ts +18 -18
  55. package/dist/core/script/script-insert.js +43 -43
  56. package/dist/core/script/script-manager.d.ts +74 -74
  57. package/dist/core/script/script-manager.js +261 -261
  58. package/dist/core/script/script-storage.d.ts +22 -22
  59. package/dist/core/script/script-storage.js +241 -241
  60. package/dist/core/script/script-support.d.ts +11 -11
  61. package/dist/core/script/script-support.js +140 -140
  62. package/dist/core/script/script-template.d.ts +1 -1
  63. package/dist/core/script/script-template.js +6 -6
  64. package/dist/core/service/port.d.ts +5 -5
  65. package/dist/core/service/port.js +53 -53
  66. package/dist/core/service/port.js.map +1 -1
  67. package/dist/core/storage/index.d.ts +5 -5
  68. package/dist/core/storage/index.js +21 -17
  69. package/dist/core/storage/index.js.map +1 -1
  70. package/dist/core/storage/minioStorage.d.ts +31 -28
  71. package/dist/core/storage/minioStorage.js +224 -209
  72. package/dist/core/storage/minioStorage.js.map +1 -1
  73. package/dist/core/storage/objectStorage.d.ts +23 -19
  74. package/dist/core/storage/objectStorage.js +3 -3
  75. package/dist/core/storage/ossStorage.d.ts +29 -26
  76. package/dist/core/storage/ossStorage.js +215 -193
  77. package/dist/core/storage/ossStorage.js.map +1 -1
  78. package/dist/core/storage/storageFlusher.d.ts +14 -14
  79. package/dist/core/storage/storageFlusher.js +54 -54
  80. package/dist/core/storage/storageLogger.d.ts +16 -16
  81. package/dist/core/storage/storageLogger.js +100 -100
  82. package/dist/core/storage/storageLogger.js.map +1 -1
  83. package/dist/core/storage/storagePath.d.ts +16 -16
  84. package/dist/core/storage/storagePath.js +49 -49
  85. package/dist/core/storage/wrapperStorage.d.ts +17 -17
  86. package/dist/core/storage/wrapperStorage.js +47 -47
  87. package/dist/core/storage/wrapperStorage.js.map +1 -1
  88. package/dist/core/utils/flusher.d.ts +18 -18
  89. package/dist/core/utils/flusher.js +66 -62
  90. package/dist/core/utils/flusher.js.map +1 -1
  91. package/dist/core/utils/http.d.ts +3 -3
  92. package/dist/core/utils/http.js +35 -35
  93. package/dist/core/utils/http.js.map +1 -1
  94. package/dist/core/utils/index.d.ts +57 -56
  95. package/dist/core/utils/index.js +247 -243
  96. package/dist/core/utils/index.js.map +1 -1
  97. package/dist/core/utils/number.d.ts +2 -2
  98. package/dist/core/utils/number.js +19 -19
  99. package/dist/core/utils/retry.d.ts +1 -1
  100. package/dist/core/utils/retry.js +34 -34
  101. package/dist/core/utils/retry.js.map +1 -1
  102. package/dist/core/utils/suanpan.d.ts +21 -20
  103. package/dist/core/utils/suanpan.js +103 -92
  104. package/dist/core/utils/suanpan.js.map +1 -1
  105. package/dist/core/web/app.d.ts +2 -2
  106. package/dist/core/web/app.js +38 -38
  107. package/dist/core/web/app.js.map +1 -1
  108. package/dist/core/web/server.d.ts +3 -3
  109. package/dist/core/web/server.js +64 -60
  110. package/dist/core/web/server.js.map +1 -1
  111. package/dist/main.d.ts +5 -5
  112. package/dist/main.js +28 -24
  113. package/dist/main.js.map +1 -1
  114. package/dist/types/conmonTypes.d.ts +21 -21
  115. package/dist/types/conmonTypes.js +16 -16
  116. package/dist/types/index.d.ts +3 -3
  117. package/dist/types/index.js +19 -15
  118. package/dist/types/index.js.map +1 -1
  119. package/dist/types/storageTypes.d.ts +59 -58
  120. package/dist/types/storageTypes.js +9 -9
  121. package/dist/types/streamTypes.d.ts +21 -21
  122. package/dist/types/streamTypes.js +2 -2
  123. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.argvs = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const split_string_1 = __importDefault(require("split-string"));
9
- const yargs_1 = require("yargs");
10
- const yargs = yargs_1.parserConfiguration({
11
- 'camel-case-expansion': false
12
- });
13
- function getArgvFromEnvSpParam() {
14
- const spParam = !lodash_1.default.isString(process.env.SP_PARAM) ? '' : process.env.SP_PARAM;
15
- const textSpParam = Buffer.from(spParam, 'base64').toString('utf8');
16
- return yargs.parse(split_string_1.default(textSpParam.trim(), {
17
- separator: ' ',
18
- quotes: ['"', '\''],
19
- brackets: true
20
- }));
21
- }
22
- exports.argvs = Object.assign(yargs.argv, getArgvFromEnvSpParam());
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.argvs = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const split_string_1 = __importDefault(require("split-string"));
9
+ const yargs_1 = require("yargs");
10
+ const yargs = (0, yargs_1.parserConfiguration)({
11
+ 'camel-case-expansion': false
12
+ });
13
+ function getArgvFromEnvSpParam() {
14
+ const spParam = !lodash_1.default.isString(process.env.SP_PARAM) ? '' : process.env.SP_PARAM;
15
+ const textSpParam = Buffer.from(spParam, 'base64').toString('utf8');
16
+ return yargs.parse((0, split_string_1.default)(textSpParam.trim(), {
17
+ separator: ' ',
18
+ quotes: ['"', '\''],
19
+ brackets: true
20
+ }));
21
+ }
22
+ exports.argvs = Object.assign(yargs.argv, getArgvFromEnvSpParam());
23
23
  //# sourceMappingURL=commandArgs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandArgs.js","sourceRoot":"","sources":["../../../src/core/parameter/commandArgs.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,gEAAiC;AACjC,iCAA4C;AAG5C,MAAM,KAAK,GAAG,2BAAmB,CAAC;IAChC,sBAAsB,EAAE,KAAK;CAC9B,CAAC,CAAC;AAEH,SAAS,qBAAqB;IAC5B,MAAM,OAAO,GAAG,CAAC,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC9E,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC,KAAK,CAAC,sBAAK,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;AAEY,QAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,qBAAqB,EAAE,CAAiB,CAAC"}
1
+ {"version":3,"file":"commandArgs.js","sourceRoot":"","sources":["../../../src/core/parameter/commandArgs.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,gEAAiC;AACjC,iCAA4C;AAG5C,MAAM,KAAK,GAAG,IAAA,2BAAmB,EAAC;IAChC,sBAAsB,EAAE,KAAK;CAC9B,CAAC,CAAC;AAEH,SAAS,qBAAqB;IAC5B,MAAM,OAAO,GAAG,CAAC,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC9E,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAA,sBAAK,EAAC,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;AAEY,QAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,qBAAqB,EAAE,CAAiB,CAAC"}
@@ -1,86 +1,86 @@
1
- import { Platform } from '../../types';
2
- export declare function getPlatform(): Platform;
3
- export declare class Environment {
4
- /**
5
- * Gets a value indicating the type of the current operating system.
6
- */
7
- static readonly platform: Platform;
8
- /**
9
- * Gets a value indicating whether the current operating system is `Linux`.
10
- */
11
- static readonly isLinux: boolean;
12
- /**
13
- * Gets a value indicating whether the current operating system is `Macintosh`.
14
- */
15
- static readonly isMac: boolean;
16
- /**
17
- * Gets a value indicating whether the current operating system is `Windows`.
18
- */
19
- static readonly isWindows: boolean;
20
- static readonly stream: {
21
- userId: any;
22
- appId: any;
23
- componentId: any;
24
- nodeId: any;
25
- host: any;
26
- sendQueue: any;
27
- receiveQueue: any;
28
- sendQueueMaxLength: any;
29
- sendQueueTrimImmediately: any;
30
- };
31
- static readonly suanpan: {
32
- affinity: string | undefined;
33
- host: string | undefined;
34
- port: string | undefined;
35
- protocol: boolean | "" | undefined;
36
- accessSecret: string | undefined;
37
- field: {
38
- userIdHeader: string;
39
- userSignature: string;
40
- userSignVersionHeader: string;
41
- };
42
- };
43
- static readonly mq: {
44
- sendQueue: any;
45
- receiveQueue: any;
46
- sendQueueMaxLength: any;
47
- sendQueueTrimImmediately: any;
48
- host: any;
49
- port: any;
50
- type: any;
51
- };
52
- static readonly oss: {
53
- endpoint: any;
54
- bucketName: any;
55
- accessId: any;
56
- accessKey: any;
57
- tempStore: any;
58
- globalStore: any;
59
- };
60
- static readonly minio: {
61
- endpoint: any;
62
- bucketName: any;
63
- accessId: any;
64
- accessKey: any;
65
- tempStore: any;
66
- globalStore: any;
67
- };
68
- static readonly local: {
69
- tempStore: any;
70
- globalStore: any;
71
- };
72
- static readonly spConfig: {
73
- mstorageType: any;
74
- storageType: any;
75
- mqType: any;
76
- dwType: any;
77
- debug: boolean;
78
- };
79
- static readonly logkit: {
80
- uri: string | undefined;
81
- path: string;
82
- logLevel: string;
83
- namespace: string;
84
- eventName: string;
85
- };
86
- }
1
+ import { Platform } from '../../types';
2
+ export declare function getPlatform(): Platform;
3
+ export declare class Environment {
4
+ /**
5
+ * Gets a value indicating the type of the current operating system.
6
+ */
7
+ static readonly platform: Platform;
8
+ /**
9
+ * Gets a value indicating whether the current operating system is `Linux`.
10
+ */
11
+ static readonly isLinux: boolean;
12
+ /**
13
+ * Gets a value indicating whether the current operating system is `Macintosh`.
14
+ */
15
+ static readonly isMac: boolean;
16
+ /**
17
+ * Gets a value indicating whether the current operating system is `Windows`.
18
+ */
19
+ static readonly isWindows: boolean;
20
+ static readonly stream: {
21
+ userId: any;
22
+ appId: any;
23
+ componentId: any;
24
+ nodeId: any;
25
+ host: any;
26
+ sendQueue: any;
27
+ receiveQueue: any;
28
+ sendQueueMaxLength: any;
29
+ sendQueueTrimImmediately: any;
30
+ };
31
+ static readonly suanpan: {
32
+ affinity: string | undefined;
33
+ host: string | undefined;
34
+ port: string | undefined;
35
+ protocol: boolean | "" | undefined;
36
+ accessSecret: string | undefined;
37
+ field: {
38
+ userIdHeader: string;
39
+ userSignature: string;
40
+ userSignVersionHeader: string;
41
+ };
42
+ };
43
+ static readonly mq: {
44
+ sendQueue: any;
45
+ receiveQueue: any;
46
+ sendQueueMaxLength: any;
47
+ sendQueueTrimImmediately: any;
48
+ host: any;
49
+ port: any;
50
+ type: any;
51
+ };
52
+ static readonly oss: {
53
+ endpoint: any;
54
+ bucketName: any;
55
+ accessId: any;
56
+ accessKey: any;
57
+ tempStore: any;
58
+ globalStore: any;
59
+ };
60
+ static readonly minio: {
61
+ endpoint: any;
62
+ bucketName: any;
63
+ accessId: any;
64
+ accessKey: any;
65
+ tempStore: any;
66
+ globalStore: any;
67
+ };
68
+ static readonly local: {
69
+ tempStore: any;
70
+ globalStore: any;
71
+ };
72
+ static readonly spConfig: {
73
+ mstorageType: any;
74
+ storageType: any;
75
+ mqType: any;
76
+ dwType: any;
77
+ debug: boolean;
78
+ };
79
+ static readonly logkit: {
80
+ uri: string | undefined;
81
+ path: string;
82
+ logLevel: string;
83
+ namespace: string;
84
+ eventName: string;
85
+ };
86
+ }
@@ -1,104 +1,104 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Environment = exports.getPlatform = void 0;
4
- const commandArgs_1 = require("./commandArgs");
5
- const types_1 = require("../../types");
6
- function getPlatform() {
7
- if (process.platform === 'linux') {
8
- return types_1.Platform.LINUX;
9
- }
10
- if (process.platform === 'darwin') {
11
- return types_1.Platform.MACINTOSH;
12
- }
13
- if (process.platform === 'win32') {
14
- return types_1.Platform.WINDOWS;
15
- }
16
- throw new Error('error.env.platform.not.supported');
17
- }
18
- exports.getPlatform = getPlatform;
19
- class Environment {
20
- }
21
- exports.Environment = Environment;
22
- /**
23
- * Gets a value indicating the type of the current operating system.
24
- */
25
- Environment.platform = getPlatform();
26
- /**
27
- * Gets a value indicating whether the current operating system is `Linux`.
28
- */
29
- Environment.isLinux = (Environment.platform === types_1.Platform.LINUX);
30
- /**
31
- * Gets a value indicating whether the current operating system is `Macintosh`.
32
- */
33
- Environment.isMac = (Environment.platform === types_1.Platform.MACINTOSH);
34
- /**
35
- * Gets a value indicating whether the current operating system is `Windows`.
36
- */
37
- Environment.isWindows = (Environment.platform === types_1.Platform.WINDOWS);
38
- Environment.stream = {
39
- userId: commandArgs_1.argvs['stream-user-id'] || process.env.SP_USER_ID,
40
- appId: commandArgs_1.argvs['stream-app-id'] || process.env.SP_APP_ID,
41
- componentId: commandArgs_1.argvs['stream-component-id'] || process.env.SP_COMPONENT_ID,
42
- nodeId: commandArgs_1.argvs['stream-node-id'] || process.env.SP_NODE_ID,
43
- host: commandArgs_1.argvs['stream-host'] || process.env.SP_MQ_REDIS_HOST,
44
- sendQueue: commandArgs_1.argvs['stream-send-queue'] || process.env.SP_STREAM_SEND_QUEUE,
45
- receiveQueue: commandArgs_1.argvs['stream-recv-queue'] || process.env.SP_STREAM_RECV_QUEUE,
46
- sendQueueMaxLength: commandArgs_1.argvs['stream-send-queue-max-length'] || process.env.SP_STREAM_SEND_QUEUE_MAX_LENGTH,
47
- sendQueueTrimImmediately: commandArgs_1.argvs['stream-send-queue-trim-immediately'] || process.env.SP_STREAM_SEND_QUEUE_TRIM_IMMEDIATELY
48
- };
49
- Environment.suanpan = {
50
- affinity: process.env.SP_AFFINITY,
51
- host: process.env.SP_HOST,
52
- port: process.env.SP_PORT,
53
- protocol: process.env.SP_HOST_TLS && process.env.SP_HOST_TLS !== 'false',
54
- accessSecret: process.env.SP_ACCESS_SECRET,
55
- field: {
56
- userIdHeader: process.env.SP_USER_ID_HEADER_FIELD || 'x-sp-user-id',
57
- userSignature: process.env.SP_USER_SIGNATURE_HEADER_FIELD || 'x-sp-signature',
58
- userSignVersionHeader: process.env.SP_USER_SIGN_VERSION_HEADER_FIELD || 'x-sp-sign-version'
59
- }
60
- };
61
- Environment.mq = {
62
- sendQueue: commandArgs_1.argvs['stream-send-queue'] || process.env.SP_STREAM_SEND_QUEUE,
63
- receiveQueue: commandArgs_1.argvs['stream-recv-queue'] || process.env.SP_STREAM_RECV_QUEUE,
64
- sendQueueMaxLength: commandArgs_1.argvs['stream-send-queue-max-length'] || process.env.SP_STREAM_SEND_QUEUE_MAX_LENGTH,
65
- sendQueueTrimImmediately: commandArgs_1.argvs['stream-send-queue-trim-immediately'] || process.env.SP_STREAM_SEND_QUEUE_TRIM_IMMEDIATELY,
66
- host: commandArgs_1.argvs['mq-redis-host'] || process.env.SP_MQ_REDIS_HOST,
67
- port: commandArgs_1.argvs['mq-redis-port'] || process.env.SP_MQ_REDIS_PORT || 6379,
68
- type: commandArgs_1.argvs['mq-type'] || process.env.SP_MQ_TYPE
69
- };
70
- Environment.oss = {
71
- endpoint: commandArgs_1.argvs['storage-oss-endpoint'],
72
- bucketName: commandArgs_1.argvs['storage-oss-bucket-name'],
73
- accessId: commandArgs_1.argvs['storage-oss-access-id'],
74
- accessKey: commandArgs_1.argvs['storage-oss-access-key'],
75
- tempStore: commandArgs_1.argvs['storage-oss-temp-store'] || process.env.SP_STORAGE_OSS_TEMP_STORE,
76
- globalStore: commandArgs_1.argvs['storage-oss-global-store'] || process.env.SP_STORAGE_OSS_GLOBAL_STORE
77
- };
78
- Environment.minio = {
79
- endpoint: commandArgs_1.argvs['storage-minio-endpoint'] || 'http://127.0.0.1:9000',
80
- bucketName: commandArgs_1.argvs['storage-minio-bucket-name'] || 'suanpan',
81
- accessId: commandArgs_1.argvs['storage-minio-access-id'] || 'MINIO_ACCESS',
82
- accessKey: commandArgs_1.argvs['storage-minio-access-key'] || 'MINIO_SECRET',
83
- tempStore: commandArgs_1.argvs['storage-minio-temp-store'] || process.env.SP_STORAGE_MINIO_TEMP_STORE,
84
- globalStore: commandArgs_1.argvs['storage-minio-global-store'] || process.env.SP_STORAGE_MINIO_GLOBAL_STORE
85
- };
86
- Environment.local = {
87
- tempStore: commandArgs_1.argvs['storage-local-temp-store'] || process.env.SP_STORAGE_LOCAL_TEMP_STORE,
88
- globalStore: commandArgs_1.argvs['storage-local-global-store'] || process.env.SP_STORAGE_LOCAL_GLOBAL_STORE
89
- };
90
- Environment.spConfig = {
91
- mstorageType: commandArgs_1.argvs['mstorage-type'] || process.env.SP_MSTORAGE_TYPE,
92
- storageType: commandArgs_1.argvs['storage-type'] || process.env.SP_STORAGE_TYPE,
93
- mqType: commandArgs_1.argvs['mq-type'] || process.env.SP_MQ_TYPE,
94
- dwType: commandArgs_1.argvs['dw-type'] || process.env.SP_DW_TYPE,
95
- debug: process.env.SP_DEBUG === 'true'
96
- };
97
- Environment.logkit = {
98
- uri: process.env.SP_LOGKIT_URI,
99
- path: process.env.SP_LOGKIT_PATH || `/socket/${Environment.stream.userId}/${Environment.stream.appId}`,
100
- logLevel: process.env.SP_LOGKIT_LOGS_LEVEL || 'debug',
101
- namespace: process.env.SP_LOGKIT_NAMESPACE || 'logkit',
102
- eventName: process.env.SP_LOGKIT_EVENTS_APPEND || 'append'
103
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Environment = exports.getPlatform = void 0;
4
+ const commandArgs_1 = require("./commandArgs");
5
+ const types_1 = require("../../types");
6
+ function getPlatform() {
7
+ if (process.platform === 'linux') {
8
+ return types_1.Platform.LINUX;
9
+ }
10
+ if (process.platform === 'darwin') {
11
+ return types_1.Platform.MACINTOSH;
12
+ }
13
+ if (process.platform === 'win32') {
14
+ return types_1.Platform.WINDOWS;
15
+ }
16
+ throw new Error('error.env.platform.not.supported');
17
+ }
18
+ exports.getPlatform = getPlatform;
19
+ class Environment {
20
+ }
21
+ exports.Environment = Environment;
22
+ /**
23
+ * Gets a value indicating the type of the current operating system.
24
+ */
25
+ Environment.platform = getPlatform();
26
+ /**
27
+ * Gets a value indicating whether the current operating system is `Linux`.
28
+ */
29
+ Environment.isLinux = (Environment.platform === types_1.Platform.LINUX);
30
+ /**
31
+ * Gets a value indicating whether the current operating system is `Macintosh`.
32
+ */
33
+ Environment.isMac = (Environment.platform === types_1.Platform.MACINTOSH);
34
+ /**
35
+ * Gets a value indicating whether the current operating system is `Windows`.
36
+ */
37
+ Environment.isWindows = (Environment.platform === types_1.Platform.WINDOWS);
38
+ Environment.stream = {
39
+ userId: commandArgs_1.argvs['stream-user-id'] || process.env.SP_USER_ID,
40
+ appId: commandArgs_1.argvs['stream-app-id'] || process.env.SP_APP_ID,
41
+ componentId: commandArgs_1.argvs['stream-component-id'] || process.env.SP_COMPONENT_ID,
42
+ nodeId: commandArgs_1.argvs['stream-node-id'] || process.env.SP_NODE_ID,
43
+ host: commandArgs_1.argvs['stream-host'] || process.env.SP_MQ_REDIS_HOST,
44
+ sendQueue: commandArgs_1.argvs['stream-send-queue'] || process.env.SP_STREAM_SEND_QUEUE,
45
+ receiveQueue: commandArgs_1.argvs['stream-recv-queue'] || process.env.SP_STREAM_RECV_QUEUE,
46
+ sendQueueMaxLength: commandArgs_1.argvs['stream-send-queue-max-length'] || process.env.SP_STREAM_SEND_QUEUE_MAX_LENGTH,
47
+ sendQueueTrimImmediately: commandArgs_1.argvs['stream-send-queue-trim-immediately'] || process.env.SP_STREAM_SEND_QUEUE_TRIM_IMMEDIATELY
48
+ };
49
+ Environment.suanpan = {
50
+ affinity: process.env.SP_AFFINITY,
51
+ host: process.env.SP_HOST,
52
+ port: process.env.SP_PORT,
53
+ protocol: process.env.SP_HOST_TLS && process.env.SP_HOST_TLS !== 'false',
54
+ accessSecret: process.env.SP_ACCESS_SECRET,
55
+ field: {
56
+ userIdHeader: process.env.SP_USER_ID_HEADER_FIELD || 'x-sp-user-id',
57
+ userSignature: process.env.SP_USER_SIGNATURE_HEADER_FIELD || 'x-sp-signature',
58
+ userSignVersionHeader: process.env.SP_USER_SIGN_VERSION_HEADER_FIELD || 'x-sp-sign-version'
59
+ }
60
+ };
61
+ Environment.mq = {
62
+ sendQueue: commandArgs_1.argvs['stream-send-queue'] || process.env.SP_STREAM_SEND_QUEUE,
63
+ receiveQueue: commandArgs_1.argvs['stream-recv-queue'] || process.env.SP_STREAM_RECV_QUEUE,
64
+ sendQueueMaxLength: commandArgs_1.argvs['stream-send-queue-max-length'] || process.env.SP_STREAM_SEND_QUEUE_MAX_LENGTH,
65
+ sendQueueTrimImmediately: commandArgs_1.argvs['stream-send-queue-trim-immediately'] || process.env.SP_STREAM_SEND_QUEUE_TRIM_IMMEDIATELY,
66
+ host: commandArgs_1.argvs['mq-redis-host'] || process.env.SP_MQ_REDIS_HOST,
67
+ port: commandArgs_1.argvs['mq-redis-port'] || process.env.SP_MQ_REDIS_PORT || 6379,
68
+ type: commandArgs_1.argvs['mq-type'] || process.env.SP_MQ_TYPE
69
+ };
70
+ Environment.oss = {
71
+ endpoint: commandArgs_1.argvs['storage-oss-endpoint'],
72
+ bucketName: commandArgs_1.argvs['storage-oss-bucket-name'],
73
+ accessId: commandArgs_1.argvs['storage-oss-access-id'],
74
+ accessKey: commandArgs_1.argvs['storage-oss-access-key'],
75
+ tempStore: commandArgs_1.argvs['storage-oss-temp-store'] || process.env.SP_STORAGE_OSS_TEMP_STORE,
76
+ globalStore: commandArgs_1.argvs['storage-oss-global-store'] || process.env.SP_STORAGE_OSS_GLOBAL_STORE
77
+ };
78
+ Environment.minio = {
79
+ endpoint: commandArgs_1.argvs['storage-minio-endpoint'] || 'http://127.0.0.1:9000',
80
+ bucketName: commandArgs_1.argvs['storage-minio-bucket-name'] || 'suanpan',
81
+ accessId: commandArgs_1.argvs['storage-minio-access-id'] || 'MINIO_ACCESS',
82
+ accessKey: commandArgs_1.argvs['storage-minio-access-key'] || 'MINIO_SECRET',
83
+ tempStore: commandArgs_1.argvs['storage-minio-temp-store'] || process.env.SP_STORAGE_MINIO_TEMP_STORE,
84
+ globalStore: commandArgs_1.argvs['storage-minio-global-store'] || process.env.SP_STORAGE_MINIO_GLOBAL_STORE
85
+ };
86
+ Environment.local = {
87
+ tempStore: commandArgs_1.argvs['storage-local-temp-store'] || process.env.SP_STORAGE_LOCAL_TEMP_STORE,
88
+ globalStore: commandArgs_1.argvs['storage-local-global-store'] || process.env.SP_STORAGE_LOCAL_GLOBAL_STORE
89
+ };
90
+ Environment.spConfig = {
91
+ mstorageType: commandArgs_1.argvs['mstorage-type'] || process.env.SP_MSTORAGE_TYPE,
92
+ storageType: commandArgs_1.argvs['storage-type'] || process.env.SP_STORAGE_TYPE,
93
+ mqType: commandArgs_1.argvs['mq-type'] || process.env.SP_MQ_TYPE,
94
+ dwType: commandArgs_1.argvs['dw-type'] || process.env.SP_DW_TYPE,
95
+ debug: process.env.SP_DEBUG === 'true'
96
+ };
97
+ Environment.logkit = {
98
+ uri: process.env.SP_LOGKIT_URI,
99
+ path: process.env.SP_LOGKIT_PATH || `/socket/${Environment.stream.userId}/${Environment.stream.appId}`,
100
+ logLevel: process.env.SP_LOGKIT_LOGS_LEVEL || 'debug',
101
+ namespace: process.env.SP_LOGKIT_NAMESPACE || 'logkit',
102
+ eventName: process.env.SP_LOGKIT_EVENTS_APPEND || 'append'
103
+ };
104
104
  //# sourceMappingURL=environment.js.map
@@ -1,7 +1,7 @@
1
- export declare class Parameter {
2
- static get UserId(): string;
3
- static get AppId(): string;
4
- static get ComponentId(): string;
5
- static get NodeId(): string;
6
- static get<T extends unknown>(key?: string): T;
7
- }
1
+ export declare class Parameter {
2
+ static get UserId(): string;
3
+ static get AppId(): string;
4
+ static get ComponentId(): string;
5
+ static get NodeId(): string;
6
+ static get<T extends unknown>(key?: string): T;
7
+ }
@@ -1,34 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Parameter = void 0;
4
- require("lodash");
5
- const commandArgs_1 = require("./commandArgs");
6
- const environment_1 = require("./environment");
7
- const constant_1 = require("../common/constant");
8
- class Parameter {
9
- static get UserId() {
10
- return environment_1.Environment.stream.userId;
11
- }
12
- static get AppId() {
13
- return environment_1.Environment.stream.appId;
14
- }
15
- static get ComponentId() {
16
- return environment_1.Environment.stream.componentId;
17
- }
18
- static get NodeId() {
19
- return environment_1.Environment.stream.nodeId;
20
- }
21
- static get(key) {
22
- if (key !== undefined) {
23
- return commandArgs_1.argvs[key];
24
- }
25
- for (const filterKey of constant_1.COMMAND_FILTER_KEYS) {
26
- if (commandArgs_1.argvs[filterKey]) {
27
- delete commandArgs_1.argvs[filterKey];
28
- }
29
- }
30
- return commandArgs_1.argvs;
31
- }
32
- }
33
- exports.Parameter = Parameter;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Parameter = void 0;
4
+ require("lodash");
5
+ const commandArgs_1 = require("./commandArgs");
6
+ const environment_1 = require("./environment");
7
+ const constant_1 = require("../common/constant");
8
+ class Parameter {
9
+ static get UserId() {
10
+ return environment_1.Environment.stream.userId;
11
+ }
12
+ static get AppId() {
13
+ return environment_1.Environment.stream.appId;
14
+ }
15
+ static get ComponentId() {
16
+ return environment_1.Environment.stream.componentId;
17
+ }
18
+ static get NodeId() {
19
+ return environment_1.Environment.stream.nodeId;
20
+ }
21
+ static get(key) {
22
+ if (key !== undefined) {
23
+ return commandArgs_1.argvs[key];
24
+ }
25
+ for (const filterKey of constant_1.COMMAND_FILTER_KEYS) {
26
+ if (commandArgs_1.argvs[filterKey]) {
27
+ delete commandArgs_1.argvs[filterKey];
28
+ }
29
+ }
30
+ return commandArgs_1.argvs;
31
+ }
32
+ }
33
+ exports.Parameter = Parameter;
34
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,24 +1,24 @@
1
- 'use strict';
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const log_1 = __importDefault(require("../../common/log"));
7
- const { plugins } = require('./plugin');
8
- const { transformSync } = require('@babel/core');
9
- function transform(code) {
10
- let babelResult;
11
- try {
12
- babelResult = transformSync(code, {
13
- // ast: true,
14
- plugins: [plugins]
15
- });
16
- }
17
- catch (ex) {
18
- log_1.default.error('babel parse error.');
19
- throw ex;
20
- }
21
- return babelResult;
22
- }
23
- module.exports = { transform };
1
+ 'use strict';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const log_1 = __importDefault(require("../../common/log"));
7
+ const { plugins } = require('./plugin');
8
+ const { transformSync } = require('@babel/core');
9
+ function transform(code) {
10
+ let babelResult;
11
+ try {
12
+ babelResult = transformSync(code, {
13
+ // ast: true,
14
+ plugins: [plugins]
15
+ });
16
+ }
17
+ catch (ex) {
18
+ log_1.default.error('babel parse error.');
19
+ throw ex;
20
+ }
21
+ return babelResult;
22
+ }
23
+ module.exports = { transform };
24
24
  //# sourceMappingURL=babel.js.map
@@ -1,7 +1,7 @@
1
- export function plugins({ types: t }: {
2
- types: any;
3
- }): {
4
- visitor: {
5
- Identifier(path: any): void;
6
- };
7
- };
1
+ export function plugins({ types: t }: {
2
+ types: any;
3
+ }): {
4
+ visitor: {
5
+ Identifier(path: any): void;
6
+ };
7
+ };
@@ -1,17 +1,17 @@
1
- 'use strict';
2
- module.exports.plugins = function ({ types: t }) {
3
- return {
4
- visitor: {
5
- Identifier(path) {
6
- const parent = path.findParent(path => {
7
- return (path.isCallExpression() && path.node.callee.name === 'sendMessage');
8
- });
9
- if (!parent) {
10
- return;
11
- }
12
- path.replaceWith(t.memberExpression(t.identifier('global'), t.identifier('sendMessage')));
13
- }
14
- }
15
- };
16
- };
1
+ 'use strict';
2
+ module.exports.plugins = function ({ types: t }) {
3
+ return {
4
+ visitor: {
5
+ Identifier(path) {
6
+ const parent = path.findParent(path => {
7
+ return (path.isCallExpression() && path.node.callee.name === 'sendMessage');
8
+ });
9
+ if (!parent) {
10
+ return;
11
+ }
12
+ path.replaceWith(t.memberExpression(t.identifier('global'), t.identifier('sendMessage')));
13
+ }
14
+ }
15
+ };
16
+ };
17
17
  //# sourceMappingURL=plugin.js.map