suanpan_node_sdk 2.2.3 → 2.2.5-beta

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 +2 -1
@@ -1,101 +1,101 @@
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.ObjectStorageLogger = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const log4js_1 = __importDefault(require("log4js"));
9
- const moment_1 = __importDefault(require("moment"));
10
- const storageFlusher_1 = require("./storageFlusher");
11
- const utils_1 = require("../utils");
12
- const types_1 = require("../../types");
13
- class ObjectStorageLogger {
14
- constructor(options, storage) {
15
- this.options = options;
16
- this.storage = storage;
17
- this.log = (level, message, flush = false) => {
18
- if (level < this._minLevel) {
19
- return;
20
- }
21
- if (this.options.console) {
22
- switch (level) {
23
- case types_1.LogLevel.DEBUG:
24
- this._logger.debug(message);
25
- break;
26
- case types_1.LogLevel.INFO:
27
- this._logger.info(message);
28
- break;
29
- case types_1.LogLevel.WARN:
30
- this._logger.warn(message);
31
- break;
32
- case types_1.LogLevel.ERROR:
33
- this._logger.error(message);
34
- break;
35
- default: {
36
- throw new Error(`unsupported log level: ${level}`);
37
- }
38
- }
39
- }
40
- this._flusher.add(`${moment_1.default().format('YYYY-MM-DD HH:mm:ss')} ==> ${message}`);
41
- if (flush) {
42
- this._flusher.flush();
43
- }
44
- };
45
- this.info = (message, flush = false) => {
46
- this.log(types_1.LogLevel.INFO, message, flush);
47
- };
48
- this.debug = (message, flush = false) => {
49
- this.log(types_1.LogLevel.DEBUG, message, flush);
50
- };
51
- this.warn = (message, flush = false) => {
52
- this.log(types_1.LogLevel.WARN, message, flush);
53
- };
54
- this.error = (message, flush = false) => {
55
- this.log(types_1.LogLevel.ERROR, message, flush);
56
- };
57
- this._validate(options);
58
- this._logger = log4js_1.default.getLogger();
59
- this._minLevel = this.options.level || types_1.LogLevel.DEBUG;
60
- switch (this._minLevel) {
61
- case types_1.LogLevel.DEBUG:
62
- this._logger.level = 'debug';
63
- break;
64
- case types_1.LogLevel.INFO:
65
- this._logger.level = 'info';
66
- break;
67
- case types_1.LogLevel.WARN:
68
- this._logger.level = 'warn';
69
- break;
70
- case types_1.LogLevel.ERROR:
71
- this._logger.level = 'error';
72
- break;
73
- default: {
74
- throw new Error(`unsupported log level: ${this._minLevel}`);
75
- }
76
- }
77
- this._flusher = new storageFlusher_1.StorageLogFlusher({
78
- storageFilePath: options.storagePath,
79
- maxItems: options.maxItems,
80
- flushInterval: options.flushInterval
81
- }, this.storage);
82
- }
83
- _validate(options) {
84
- if (lodash_1.default.isEmpty(options)) {
85
- throw new Error('storage options is empty.');
86
- }
87
- if (!options.storagePath) {
88
- throw new Error('storage path must be provided.');
89
- }
90
- const flushInterval = options.flushInterval;
91
- if (flushInterval !== undefined && !utils_1.isSafePositiveInteger(flushInterval)) {
92
- throw new Error(`flushInterval: ${flushInterval} is not a positive integer.`);
93
- }
94
- const maxItems = options.maxItems;
95
- if (maxItems !== undefined && !utils_1.isSafePositiveInteger(maxItems)) {
96
- throw new Error(`maxItems: ${maxItems} is not a positive integer.`);
97
- }
98
- }
99
- }
100
- exports.ObjectStorageLogger = ObjectStorageLogger;
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.ObjectStorageLogger = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const log4js_1 = __importDefault(require("log4js"));
9
+ const moment_1 = __importDefault(require("moment"));
10
+ const storageFlusher_1 = require("./storageFlusher");
11
+ const utils_1 = require("../utils");
12
+ const types_1 = require("../../types");
13
+ class ObjectStorageLogger {
14
+ constructor(options, storage) {
15
+ this.options = options;
16
+ this.storage = storage;
17
+ this.log = (level, message, flush = false) => {
18
+ if (level < this._minLevel) {
19
+ return;
20
+ }
21
+ if (this.options.console) {
22
+ switch (level) {
23
+ case types_1.LogLevel.DEBUG:
24
+ this._logger.debug(message);
25
+ break;
26
+ case types_1.LogLevel.INFO:
27
+ this._logger.info(message);
28
+ break;
29
+ case types_1.LogLevel.WARN:
30
+ this._logger.warn(message);
31
+ break;
32
+ case types_1.LogLevel.ERROR:
33
+ this._logger.error(message);
34
+ break;
35
+ default: {
36
+ throw new Error(`unsupported log level: ${level}`);
37
+ }
38
+ }
39
+ }
40
+ this._flusher.add(`${(0, moment_1.default)().format('YYYY-MM-DD HH:mm:ss')} ==> ${message}`);
41
+ if (flush) {
42
+ this._flusher.flush();
43
+ }
44
+ };
45
+ this.info = (message, flush = false) => {
46
+ this.log(types_1.LogLevel.INFO, message, flush);
47
+ };
48
+ this.debug = (message, flush = false) => {
49
+ this.log(types_1.LogLevel.DEBUG, message, flush);
50
+ };
51
+ this.warn = (message, flush = false) => {
52
+ this.log(types_1.LogLevel.WARN, message, flush);
53
+ };
54
+ this.error = (message, flush = false) => {
55
+ this.log(types_1.LogLevel.ERROR, message, flush);
56
+ };
57
+ this._validate(options);
58
+ this._logger = log4js_1.default.getLogger();
59
+ this._minLevel = this.options.level || types_1.LogLevel.DEBUG;
60
+ switch (this._minLevel) {
61
+ case types_1.LogLevel.DEBUG:
62
+ this._logger.level = 'debug';
63
+ break;
64
+ case types_1.LogLevel.INFO:
65
+ this._logger.level = 'info';
66
+ break;
67
+ case types_1.LogLevel.WARN:
68
+ this._logger.level = 'warn';
69
+ break;
70
+ case types_1.LogLevel.ERROR:
71
+ this._logger.level = 'error';
72
+ break;
73
+ default: {
74
+ throw new Error(`unsupported log level: ${this._minLevel}`);
75
+ }
76
+ }
77
+ this._flusher = new storageFlusher_1.StorageLogFlusher({
78
+ storageFilePath: options.storagePath,
79
+ maxItems: options.maxItems,
80
+ flushInterval: options.flushInterval
81
+ }, this.storage);
82
+ }
83
+ _validate(options) {
84
+ if (lodash_1.default.isEmpty(options)) {
85
+ throw new Error('storage options is empty.');
86
+ }
87
+ if (!options.storagePath) {
88
+ throw new Error('storage path must be provided.');
89
+ }
90
+ const flushInterval = options.flushInterval;
91
+ if (flushInterval !== undefined && !(0, utils_1.isSafePositiveInteger)(flushInterval)) {
92
+ throw new Error(`flushInterval: ${flushInterval} is not a positive integer.`);
93
+ }
94
+ const maxItems = options.maxItems;
95
+ if (maxItems !== undefined && !(0, utils_1.isSafePositiveInteger)(maxItems)) {
96
+ throw new Error(`maxItems: ${maxItems} is not a positive integer.`);
97
+ }
98
+ }
99
+ }
100
+ exports.ObjectStorageLogger = ObjectStorageLogger;
101
101
  //# sourceMappingURL=storageLogger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storageLogger.js","sourceRoot":"","sources":["../../../src/core/storage/storageLogger.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,oDAA4B;AAC5B,oDAA4B;AAK5B,qDAAqD;AACrD,oCAAiD;AACjD,uCAA6D;AAC7D,MAAa,mBAAmB;IAM9B,YAAoB,OAA6B,EAAU,OAAwB;QAA/D,YAAO,GAAP,OAAO,CAAsB;QAAU,YAAO,GAAP,OAAO,CAAiB;QA6C3E,QAAG,GAAG,CAAC,KAAe,EAAE,OAAe,EAAE,KAAK,GAAG,KAAK,EAAE,EAAE;YAChE,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;gBAAE,OAAO;aAAE;YACvC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;gBACxB,QAAQ,KAAK,EAAE;oBACb,KAAK,gBAAQ,CAAC,KAAK;wBACjB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBAC5B,MAAM;oBACR,KAAK,gBAAQ,CAAC,IAAI;wBAChB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBAC3B,MAAM;oBACR,KAAK,gBAAQ,CAAC,IAAI;wBAChB,IAAI,CAAC,OAAO,CAAC,IAA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AAC;SAC/E;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,IAAA,6BAAqB,EAAC,QAAQ,CAAC,EAAE;YAC9D,MAAM,IAAI,KAAK,CAAC,aAAa,QAAQ,6BAA6B,CAAC,CAAC;SACrE;IACH,CAAC;CA4CF;AA7FD,kDA6FC"}
@@ -1,16 +1,16 @@
1
- import type { StoragePathOptions } from '../../types';
2
- export declare class StoragePath {
3
- private ctx?;
4
- constructor(ctx?: StoragePathOptions | undefined);
5
- private _getUserId;
6
- private _getAppId;
7
- private _getNodeId;
8
- private _getComponentId;
9
- getUserPath(userId?: string): string;
10
- getAppPath(userId?: string, appId?: string): string;
11
- getComponentPath(userId?: string, componentId?: string): string;
12
- getNodePath(userId?: string, appId?: string, nodeId?: string): string;
13
- getAppLogPath(userId?: string, appId?: string): string;
14
- getNodeLogPath(userId?: string, appId?: string, nodeId?: string): string;
15
- getAppTempDir(userId?: string, appId?: string): string;
16
- }
1
+ import type { StoragePathOptions } from '../../types';
2
+ export declare class StoragePath {
3
+ private ctx?;
4
+ constructor(ctx?: StoragePathOptions | undefined);
5
+ private _getUserId;
6
+ private _getAppId;
7
+ private _getNodeId;
8
+ private _getComponentId;
9
+ getUserPath(userId?: string): string;
10
+ getAppPath(userId?: string, appId?: string): string;
11
+ getComponentPath(userId?: string, componentId?: string): string;
12
+ getNodePath(userId?: string, appId?: string, nodeId?: string): string;
13
+ getAppLogPath(userId?: string, appId?: string): string;
14
+ getNodeLogPath(userId?: string, appId?: string, nodeId?: string): string;
15
+ getAppTempDir(userId?: string, appId?: string): string;
16
+ }
@@ -1,50 +1,50 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StoragePath = void 0;
4
- const environment_1 = require("../parameter/environment");
5
- const { userId: streamUserId, appId: streamAppId, nodeId: streamNodeId, componentId: streamComponentId } = environment_1.Environment.stream;
6
- class StoragePath {
7
- constructor(ctx) {
8
- this.ctx = ctx;
9
- }
10
- _getUserId(userId) {
11
- var _a;
12
- return userId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.userId) || streamUserId;
13
- }
14
- _getAppId(appId) {
15
- var _a;
16
- return appId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.appId) || streamAppId;
17
- }
18
- _getNodeId(nodeId) {
19
- var _a;
20
- return nodeId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.nodeId) || streamNodeId;
21
- }
22
- _getComponentId(componentId) {
23
- var _a;
24
- return componentId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.componentId) || streamComponentId;
25
- }
26
- getUserPath(userId) {
27
- return `studio/${this._getUserId(userId)}`;
28
- }
29
- getAppPath(userId, appId) {
30
- return `${this.getUserPath(userId)}/${this._getAppId(appId)}`;
31
- }
32
- getComponentPath(userId, componentId) {
33
- return `${this.getUserPath(userId)}/component/${this._getComponentId(componentId)}`;
34
- }
35
- getNodePath(userId, appId, nodeId) {
36
- return `${this.getAppPath(userId, appId)}/${this._getNodeId(nodeId)}`;
37
- }
38
- getAppLogPath(userId, appId) {
39
- const userPath = this.getUserPath(userId);
40
- return `${userPath}/logs/${this._getAppId(appId)}`;
41
- }
42
- getNodeLogPath(userId, appId, nodeId) {
43
- return `${this.getAppLogPath(userId, appId)}/${this._getNodeId(nodeId)}`;
44
- }
45
- getAppTempDir(userId, appId) {
46
- return `${this.getUserPath(userId)}/tmp/${this._getAppId(appId)}`;
47
- }
48
- }
49
- exports.StoragePath = StoragePath;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StoragePath = void 0;
4
+ const environment_1 = require("../parameter/environment");
5
+ const { userId: streamUserId, appId: streamAppId, nodeId: streamNodeId, componentId: streamComponentId } = environment_1.Environment.stream;
6
+ class StoragePath {
7
+ constructor(ctx) {
8
+ this.ctx = ctx;
9
+ }
10
+ _getUserId(userId) {
11
+ var _a;
12
+ return userId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.userId) || streamUserId;
13
+ }
14
+ _getAppId(appId) {
15
+ var _a;
16
+ return appId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.appId) || streamAppId;
17
+ }
18
+ _getNodeId(nodeId) {
19
+ var _a;
20
+ return nodeId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.nodeId) || streamNodeId;
21
+ }
22
+ _getComponentId(componentId) {
23
+ var _a;
24
+ return componentId || ((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.componentId) || streamComponentId;
25
+ }
26
+ getUserPath(userId) {
27
+ return `studio/${this._getUserId(userId)}`;
28
+ }
29
+ getAppPath(userId, appId) {
30
+ return `${this.getUserPath(userId)}/${this._getAppId(appId)}`;
31
+ }
32
+ getComponentPath(userId, componentId) {
33
+ return `${this.getUserPath(userId)}/component/${this._getComponentId(componentId)}`;
34
+ }
35
+ getNodePath(userId, appId, nodeId) {
36
+ return `${this.getAppPath(userId, appId)}/${this._getNodeId(nodeId)}`;
37
+ }
38
+ getAppLogPath(userId, appId) {
39
+ const userPath = this.getUserPath(userId);
40
+ return `${userPath}/logs/${this._getAppId(appId)}`;
41
+ }
42
+ getNodeLogPath(userId, appId, nodeId) {
43
+ return `${this.getAppLogPath(userId, appId)}/${this._getNodeId(nodeId)}`;
44
+ }
45
+ getAppTempDir(userId, appId) {
46
+ return `${this.getUserPath(userId)}/tmp/${this._getAppId(appId)}`;
47
+ }
48
+ }
49
+ exports.StoragePath = StoragePath;
50
50
  //# sourceMappingURL=storagePath.js.map
@@ -1,17 +1,17 @@
1
- import { StorageType, IStorageConfig } from '../../types';
2
- import type { IObjectStorage } from './objectStorage';
3
- export declare class StorageFactory {
4
- /**
5
- * 组件内部使用 OSS API
6
- */
7
- static getStorage(storageType: StorageType): IObjectStorage;
8
- /**
9
- * 通用的 OSS API
10
- */
11
- static newStorage(options: IStorageConfig): IObjectStorage;
12
- }
13
- export declare class Storage {
14
- private static _instance;
15
- static get Instance(): IObjectStorage;
16
- private constructor();
17
- }
1
+ import { StorageType, IStorageConfig } from '../../types';
2
+ import type { IObjectStorage } from './objectStorage';
3
+ export declare class StorageFactory {
4
+ /**
5
+ * 组件内部使用 OSS API
6
+ */
7
+ static getStorage(storageType: StorageType): IObjectStorage;
8
+ /**
9
+ * 通用的 OSS API
10
+ */
11
+ static newStorage(options: IStorageConfig): IObjectStorage;
12
+ }
13
+ export declare class Storage {
14
+ private static _instance;
15
+ static get Instance(): IObjectStorage;
16
+ private constructor();
17
+ }
@@ -1,48 +1,48 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Storage = exports.StorageFactory = void 0;
4
- const ossStorage_1 = require("./ossStorage");
5
- const environment_1 = require("../parameter/environment");
6
- const minioStorage_1 = require("./minioStorage");
7
- const types_1 = require("../../types");
8
- class StorageFactory {
9
- /**
10
- * 组件内部使用 OSS API
11
- */
12
- static getStorage(storageType) {
13
- if (!storageType) {
14
- throw new Error('missing storageType');
15
- }
16
- if (storageType === types_1.StorageType.OSS || storageType === types_1.StorageType.SUANPAN) {
17
- return new ossStorage_1.OSSStorage();
18
- }
19
- else if (storageType === types_1.StorageType.MINIO) {
20
- return new minioStorage_1.MinioStorage();
21
- }
22
- throw new Error(`unknown storage type ${storageType}.`);
23
- }
24
- /**
25
- * 通用的 OSS API
26
- */
27
- static newStorage(options) {
28
- if (options.type === 'oss') {
29
- return new ossStorage_1.OSSStorage(options.config);
30
- }
31
- else if (options.type === 'minio') {
32
- return new minioStorage_1.MinioStorage(options.config);
33
- }
34
- throw new Error(`unknown storage type ${options.type}.`);
35
- }
36
- }
37
- exports.StorageFactory = StorageFactory;
38
- class Storage {
39
- constructor() { }
40
- static get Instance() {
41
- if (!this._instance) {
42
- this._instance = StorageFactory.getStorage(environment_1.Environment.spConfig.storageType);
43
- }
44
- return this._instance;
45
- }
46
- }
47
- exports.Storage = Storage;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Storage = exports.StorageFactory = void 0;
4
+ const ossStorage_1 = require("./ossStorage");
5
+ const environment_1 = require("../parameter/environment");
6
+ const minioStorage_1 = require("./minioStorage");
7
+ const types_1 = require("../../types");
8
+ class StorageFactory {
9
+ /**
10
+ * 组件内部使用 OSS API
11
+ */
12
+ static getStorage(storageType) {
13
+ if (!storageType) {
14
+ throw new Error('missing storageType');
15
+ }
16
+ if (storageType === types_1.StorageType.OSS || storageType === types_1.StorageType.SUANPAN) {
17
+ return new ossStorage_1.OSSStorage();
18
+ }
19
+ else if (storageType === types_1.StorageType.MINIO) {
20
+ return new minioStorage_1.MinioStorage();
21
+ }
22
+ throw new Error(`unknown storage type ${storageType}.`);
23
+ }
24
+ /**
25
+ * 通用的 OSS API
26
+ */
27
+ static newStorage(options) {
28
+ if (options.type === 'oss') {
29
+ return new ossStorage_1.OSSStorage(options.config);
30
+ }
31
+ else if (options.type === 'minio') {
32
+ return new minioStorage_1.MinioStorage(options.config);
33
+ }
34
+ throw new Error(`unknown storage type ${options.type}.`);
35
+ }
36
+ }
37
+ exports.StorageFactory = StorageFactory;
38
+ class Storage {
39
+ static get Instance() {
40
+ if (!this._instance) {
41
+ this._instance = StorageFactory.getStorage(environment_1.Environment.spConfig.storageType);
42
+ }
43
+ return this._instance;
44
+ }
45
+ constructor() { }
46
+ }
47
+ exports.Storage = Storage;
48
48
  //# sourceMappingURL=wrapperStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrapperStorage.js","sourceRoot":"","sources":["../../../src/core/storage/wrapperStorage.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,0DAAuD;AACvD,iDAA8C;AAC9C,uCAAqF;AAErF,MAAa,cAAc;IAEzB;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,WAAwB;QACxC,IAAI,CAAC,WAAW,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SAAE;QAC7D,IAAI,WAAW,KAAK,mBAAW,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AC;SAAE;QAC7D,IAAI,WAAW,KAAK,mBAAW,CAAC,GAAG,IAAI,WAAW,KAAK,mBAAW,CAAC,OAAO,EAAE;YAC1E,OAAO,IAAI,uBAAU,EAAE,CAAC;SACzB;aAAM,IAAI,WAAW,KAAK,mBAAW,CAAC,KAAK,EAAE;YAC5C,OAAO,IAAI,2BAAY,EAAE,CAAC;SAC3B;QACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,WAAW,GAAG,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAuB;QACvC,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE;YAC1B,OAAO,IAAI,uBAAU,CAAC,OAAO,CAAC,MAAsB,CAAC,CAAC;SACvD;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,2BAAY,CAAC,OAAO,CAAC,MAAqB,CAAC,CAAC;SACxD;QACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IAC3D,CAAC;CACF;AA1BD,wCA0BC;AACD,MAAa,OAAO;IAGX,MAAM,KAAK,QAAQ;QACxB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,UAAU,CAAC,yBAAW,CAAC,QAAQ,CAAC,WAA0B,CAAC,CAAC;SAC7F;QACD,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,gBAAwB,CAAC;CAC1B;AAVD,0BAUC"}
@@ -1,18 +1,18 @@
1
- /// <reference types="node" />
2
- import * as events from 'events';
3
- export declare type FlushOptions = {
4
- maxItems?: number;
5
- flushInterval?: number;
6
- };
7
- export declare class BufferFlusher extends events.EventEmitter {
8
- private _buffer;
9
- private _maxItems;
10
- private _flushInterval;
11
- private _flushTimeoutId;
12
- constructor(options?: FlushOptions);
13
- get(): string[];
14
- clear(): void;
15
- stop(): void;
16
- add(data: string): void;
17
- flush(): void;
18
- }
1
+ /// <reference types="node" />
2
+ import * as events from 'events';
3
+ export type FlushOptions = {
4
+ maxItems?: number;
5
+ flushInterval?: number;
6
+ };
7
+ export declare class BufferFlusher extends events.EventEmitter {
8
+ private _buffer;
9
+ private _maxItems;
10
+ private _flushInterval;
11
+ private _flushTimeoutId;
12
+ constructor(options?: FlushOptions);
13
+ get(): string[];
14
+ clear(): void;
15
+ stop(): void;
16
+ add(data: string): void;
17
+ flush(): void;
18
+ }