@databricks/sql 1.2.0 → 1.3.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 (174) hide show
  1. package/README.md +2 -2
  2. package/dist/DBSQLClient.d.ts +9 -9
  3. package/dist/DBSQLClient.js +94 -63
  4. package/dist/DBSQLClient.js.map +1 -1
  5. package/dist/DBSQLOperation/CompleteOperationHelper.d.ts +3 -3
  6. package/dist/DBSQLOperation/CompleteOperationHelper.js +12 -17
  7. package/dist/DBSQLOperation/CompleteOperationHelper.js.map +1 -1
  8. package/dist/DBSQLOperation/FetchResultsHelper.d.ts +4 -5
  9. package/dist/DBSQLOperation/FetchResultsHelper.js +16 -12
  10. package/dist/DBSQLOperation/FetchResultsHelper.js.map +1 -1
  11. package/dist/DBSQLOperation/OperationStatusHelper.d.ts +2 -3
  12. package/dist/DBSQLOperation/OperationStatusHelper.js +12 -12
  13. package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -1
  14. package/dist/DBSQLOperation/SchemaHelper.d.ts +2 -3
  15. package/dist/DBSQLOperation/SchemaHelper.js +2 -3
  16. package/dist/DBSQLOperation/SchemaHelper.js.map +1 -1
  17. package/dist/DBSQLOperation/index.d.ts +7 -7
  18. package/dist/DBSQLOperation/index.js +18 -11
  19. package/dist/DBSQLOperation/index.js.map +1 -1
  20. package/dist/DBSQLSession.d.ts +3 -5
  21. package/dist/DBSQLSession.js +63 -49
  22. package/dist/DBSQLSession.js.map +1 -1
  23. package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.d.ts +24 -0
  24. package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js +165 -0
  25. package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js.map +1 -0
  26. package/dist/connection/auth/DatabricksOAuth/OAuthManager.d.ts +47 -0
  27. package/dist/connection/auth/DatabricksOAuth/OAuthManager.js +169 -0
  28. package/dist/connection/auth/DatabricksOAuth/OAuthManager.js.map +1 -0
  29. package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.d.ts +10 -0
  30. package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.js +29 -0
  31. package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.js.map +1 -0
  32. package/dist/connection/auth/DatabricksOAuth/OAuthScope.d.ts +7 -0
  33. package/dist/connection/auth/DatabricksOAuth/OAuthScope.js +11 -0
  34. package/dist/connection/auth/DatabricksOAuth/OAuthScope.js.map +1 -0
  35. package/dist/connection/auth/DatabricksOAuth/OAuthToken.d.ts +10 -0
  36. package/dist/connection/auth/DatabricksOAuth/OAuthToken.js +32 -0
  37. package/dist/connection/auth/DatabricksOAuth/OAuthToken.js.map +1 -0
  38. package/dist/connection/auth/DatabricksOAuth/index.d.ts +21 -0
  39. package/dist/connection/auth/DatabricksOAuth/index.js +41 -0
  40. package/dist/connection/auth/DatabricksOAuth/index.js.map +1 -0
  41. package/dist/connection/auth/PlainHttpAuthentication.d.ts +11 -11
  42. package/dist/connection/auth/PlainHttpAuthentication.js +15 -7
  43. package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
  44. package/dist/connection/connections/HttpConnection.d.ts +1 -2
  45. package/dist/connection/connections/HttpConnection.js +24 -14
  46. package/dist/connection/connections/HttpConnection.js.map +1 -1
  47. package/dist/connection/contracts/IAuthentication.d.ts +2 -2
  48. package/dist/connection/contracts/IConnectionOptions.d.ts +3 -1
  49. package/dist/connection/contracts/IConnectionProvider.d.ts +1 -2
  50. package/dist/contracts/IDBSQLClient.d.ts +17 -3
  51. package/dist/dto/Status.d.ts +9 -13
  52. package/dist/dto/Status.js +31 -10
  53. package/dist/dto/Status.js.map +1 -1
  54. package/dist/globalConfig.d.ts +5 -0
  55. package/dist/globalConfig.js +5 -0
  56. package/dist/globalConfig.js.map +1 -1
  57. package/dist/hive/Commands/BaseCommand.d.ts +3 -1
  58. package/dist/hive/Commands/BaseCommand.js +66 -4
  59. package/dist/hive/Commands/BaseCommand.js.map +1 -1
  60. package/dist/hive/HiveDriver.d.ts +3 -2
  61. package/dist/hive/HiveDriver.js +116 -44
  62. package/dist/hive/HiveDriver.js.map +1 -1
  63. package/dist/index.d.ts +0 -2
  64. package/dist/index.js +0 -2
  65. package/dist/index.js.map +1 -1
  66. package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/http_connection.js +10 -0
  67. package/dist/result/ArrowResult.js +3 -0
  68. package/dist/result/ArrowResult.js.map +1 -1
  69. package/dist/result/JsonResult.js +3 -0
  70. package/dist/result/JsonResult.js.map +1 -1
  71. package/dist/utils/areHeadersEqual.d.ts +2 -0
  72. package/dist/utils/areHeadersEqual.js +49 -0
  73. package/dist/utils/areHeadersEqual.js.map +1 -0
  74. package/dist/utils/index.d.ts +2 -1
  75. package/dist/utils/index.js +3 -1
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/version.d.ts +1 -1
  78. package/dist/version.js +1 -1
  79. package/package.json +6 -6
  80. package/thrift/TCLIService.d.ts +17 -0
  81. package/thrift/TCLIService_types.d.ts +185 -13
  82. package/thrift/TCLIService_types.js +2013 -279
  83. package/dist/connection/auth/NoSaslAuthentication.d.ts +0 -5
  84. package/dist/connection/auth/NoSaslAuthentication.js +0 -15
  85. package/dist/connection/auth/NoSaslAuthentication.js.map +0 -1
  86. package/dist/connection/auth/helpers/SaslPackageFactory.d.ts +0 -11
  87. package/dist/connection/auth/helpers/SaslPackageFactory.js +0 -20
  88. package/dist/connection/auth/helpers/SaslPackageFactory.js.map +0 -1
  89. package/dist/connection/contracts/ITransport.d.ts +0 -13
  90. package/dist/connection/contracts/ITransport.js +0 -3
  91. package/dist/connection/contracts/ITransport.js.map +0 -1
  92. package/dist/connection/transports/HttpTransport.d.ts +0 -14
  93. package/dist/connection/transports/HttpTransport.js +0 -24
  94. package/dist/connection/transports/HttpTransport.js.map +0 -1
  95. package/dist/connection/types/AuthOptions.d.ts +0 -4
  96. package/dist/connection/types/AuthOptions.js +0 -3
  97. package/dist/connection/types/AuthOptions.js.map +0 -1
  98. package/dist/factory/StatusFactory.d.ts +0 -12
  99. package/dist/factory/StatusFactory.js +0 -35
  100. package/dist/factory/StatusFactory.js.map +0 -1
  101. package/node_modules/async-limiter/.eslintignore +0 -2
  102. package/node_modules/async-limiter/.nycrc +0 -10
  103. package/node_modules/async-limiter/.travis.yml +0 -9
  104. package/node_modules/async-limiter/LICENSE +0 -8
  105. package/node_modules/async-limiter/index.js +0 -67
  106. package/node_modules/async-limiter/package.json +0 -35
  107. package/node_modules/async-limiter/readme.md +0 -132
  108. package/node_modules/browser-or-node/LICENSE +0 -21
  109. package/node_modules/browser-or-node/README.md +0 -63
  110. package/node_modules/browser-or-node/lib/index.js +0 -31
  111. package/node_modules/browser-or-node/package.json +0 -60
  112. package/node_modules/browser-or-node/src/index.js +0 -26
  113. package/node_modules/isomorphic-ws/LICENSE +0 -21
  114. package/node_modules/isomorphic-ws/README.md +0 -58
  115. package/node_modules/isomorphic-ws/browser.js +0 -17
  116. package/node_modules/isomorphic-ws/index.d.ts +0 -8
  117. package/node_modules/isomorphic-ws/node.js +0 -3
  118. package/node_modules/isomorphic-ws/package.json +0 -34
  119. package/node_modules/node-int64/.npmignore +0 -3
  120. package/node_modules/node-int64/Int64.js +0 -268
  121. package/node_modules/node-int64/LICENSE +0 -19
  122. package/node_modules/node-int64/README.md +0 -78
  123. package/node_modules/node-int64/package.json +0 -27
  124. package/node_modules/node-int64/test.js +0 -120
  125. package/node_modules/q/CHANGES.md +0 -800
  126. package/node_modules/q/LICENSE +0 -18
  127. package/node_modules/q/README.md +0 -874
  128. package/node_modules/q/package.json +0 -76
  129. package/node_modules/q/q.js +0 -2076
  130. package/node_modules/q/queue.js +0 -35
  131. package/node_modules/ws/LICENSE +0 -21
  132. package/node_modules/ws/README.md +0 -417
  133. package/node_modules/ws/index.js +0 -9
  134. package/node_modules/ws/lib/buffer-util.js +0 -72
  135. package/node_modules/ws/lib/constants.js +0 -10
  136. package/node_modules/ws/lib/event-target.js +0 -170
  137. package/node_modules/ws/lib/extension.js +0 -211
  138. package/node_modules/ws/lib/permessage-deflate.js +0 -516
  139. package/node_modules/ws/lib/receiver.js +0 -513
  140. package/node_modules/ws/lib/sender.js +0 -401
  141. package/node_modules/ws/lib/validation.js +0 -29
  142. package/node_modules/ws/lib/websocket-server.js +0 -369
  143. package/node_modules/ws/lib/websocket.js +0 -828
  144. package/node_modules/ws/package.json +0 -44
  145. /package/{node_modules → dist/node_modules}/thrift/LICENSE +0 -0
  146. /package/{node_modules → dist/node_modules}/thrift/README.md +0 -0
  147. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/README.md +0 -0
  148. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/binary.js +0 -0
  149. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/binary_protocol.js +0 -0
  150. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/browser.js +0 -0
  151. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/buffered_transport.js +0 -0
  152. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/compact_protocol.js +0 -0
  153. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/connection.js +0 -0
  154. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/create_client.js +0 -0
  155. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/framed_transport.js +0 -0
  156. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/header_protocol.js +0 -0
  157. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/header_transport.js +0 -0
  158. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/index.js +0 -0
  159. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error.js +0 -0
  160. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/int64_util.js +0 -0
  161. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/json_parse.js +0 -0
  162. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/json_protocol.js +0 -0
  163. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/log.js +0 -0
  164. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/multiplexed_processor.js +0 -0
  165. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/multiplexed_protocol.js +0 -0
  166. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/protocol.js +0 -0
  167. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/server.js +0 -0
  168. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/thrift.js +0 -0
  169. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/transport.js +0 -0
  170. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/web_server.js +0 -0
  171. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/ws_connection.js +0 -0
  172. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/ws_transport.js +0 -0
  173. /package/{node_modules → dist/node_modules}/thrift/lib/nodejs/lib/thrift/xhr_connection.js +0 -0
  174. /package/{node_modules → dist/node_modules}/thrift/package.json +0 -0
@@ -1,5 +0,0 @@
1
- import IAuthentication from '../contracts/IAuthentication';
2
- import ITransport from '../contracts/ITransport';
3
- export default class NoSaslAuthentication implements IAuthentication {
4
- authenticate(transport: ITransport): Promise<ITransport>;
5
- }
@@ -1,15 +0,0 @@
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 thrift_1 = __importDefault(require("thrift"));
7
- class NoSaslAuthentication {
8
- authenticate(transport) {
9
- transport.connect();
10
- transport.setOptions('transport', thrift_1.default.TBufferedTransport);
11
- return Promise.resolve(transport);
12
- }
13
- }
14
- exports.default = NoSaslAuthentication;
15
- //# sourceMappingURL=NoSaslAuthentication.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoSaslAuthentication.js","sourceRoot":"","sources":["../../../lib/connection/auth/NoSaslAuthentication.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAI5B,MAAqB,oBAAoB;IACvC,YAAY,CAAC,SAAqB;QAChC,SAAS,CAAC,OAAO,EAAE,CAAC;QACpB,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,gBAAM,CAAC,kBAAkB,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;CACF;AAPD,uCAOC"}
@@ -1,11 +0,0 @@
1
- /// <reference types="node" />
2
- export declare enum StatusCode {
3
- START = 1,
4
- OK = 2,
5
- BAD = 3,
6
- ERROR = 4,
7
- COMPLETE = 5
8
- }
9
- export declare class SaslPackageFactory {
10
- static create(status: StatusCode, body: Buffer): Buffer;
11
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SaslPackageFactory = exports.StatusCode = void 0;
4
- var StatusCode;
5
- (function (StatusCode) {
6
- StatusCode[StatusCode["START"] = 1] = "START";
7
- StatusCode[StatusCode["OK"] = 2] = "OK";
8
- StatusCode[StatusCode["BAD"] = 3] = "BAD";
9
- StatusCode[StatusCode["ERROR"] = 4] = "ERROR";
10
- StatusCode[StatusCode["COMPLETE"] = 5] = "COMPLETE";
11
- })(StatusCode = exports.StatusCode || (exports.StatusCode = {}));
12
- class SaslPackageFactory {
13
- static create(status, body) {
14
- const bodyLength = Buffer.alloc(4);
15
- bodyLength.writeUInt32BE(body.length, 0);
16
- return Buffer.concat([Buffer.from([status]), bodyLength, body]);
17
- }
18
- }
19
- exports.SaslPackageFactory = SaslPackageFactory;
20
- //# sourceMappingURL=SaslPackageFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SaslPackageFactory.js","sourceRoot":"","sources":["../../../../lib/connection/auth/helpers/SaslPackageFactory.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,uCAAM,CAAA;IACN,yCAAO,CAAA;IACP,6CAAS,CAAA;IACT,mDAAY,CAAA;AACd,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB;AAED,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,MAAkB,EAAE,IAAY;QAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEnC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAEzC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;CACF;AARD,gDAQC"}
@@ -1,13 +0,0 @@
1
- /// <reference types="node" />
2
- export type ThriftConnection = any;
3
- export default interface ITransport {
4
- getTransport(): any;
5
- setOptions(option: string, value: any): void;
6
- getOptions(): object;
7
- connect(): any;
8
- addListener(eventName: string, listener: Function): void;
9
- removeListener(eventName: string, listener: Function): void;
10
- emit(eventName: string): void;
11
- write(data: Buffer | String): void;
12
- end(): void;
13
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITransport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ITransport.js","sourceRoot":"","sources":["../../../lib/connection/contracts/ITransport.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import ITransport from '../contracts/ITransport';
2
- export default class HttpTransport implements ITransport {
3
- private httpOptions;
4
- constructor(httpOptions?: object);
5
- getTransport(): any;
6
- setOptions(option: string, value: any): void;
7
- getOptions(): object;
8
- connect(): void;
9
- addListener(): void;
10
- removeListener(): void;
11
- write(): void;
12
- end(): void;
13
- emit(): void;
14
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class HttpTransport {
4
- constructor(httpOptions = {}) {
5
- this.httpOptions = httpOptions;
6
- }
7
- getTransport() {
8
- return this.httpOptions;
9
- }
10
- setOptions(option, value) {
11
- this.httpOptions = Object.assign(Object.assign({}, this.httpOptions), { [option]: value });
12
- }
13
- getOptions() {
14
- return this.httpOptions;
15
- }
16
- connect() { }
17
- addListener() { }
18
- removeListener() { }
19
- write() { }
20
- end() { }
21
- emit() { }
22
- }
23
- exports.default = HttpTransport;
24
- //# sourceMappingURL=HttpTransport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpTransport.js","sourceRoot":"","sources":["../../../lib/connection/transports/HttpTransport.ts"],"names":[],"mappings":";;AAEA,MAAqB,aAAa;IAGhC,YAAY,cAAsB,EAAE;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,UAAU,CAAC,MAAc,EAAE,KAAU;QACnC,IAAI,CAAC,WAAW,mCACX,IAAI,CAAC,WAAW,KACnB,CAAC,MAAM,CAAC,EAAE,KAAK,GAChB,CAAC;IACJ,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,OAAO,KAAI,CAAC;IAEZ,WAAW,KAAI,CAAC;IAEhB,cAAc,KAAI,CAAC;IAEnB,KAAK,KAAI,CAAC;IAEV,GAAG,KAAI,CAAC;IAER,IAAI,KAAI,CAAC;CACV;AAjCD,gCAiCC"}
@@ -1,4 +0,0 @@
1
- export type AuthOptions = {
2
- username?: string;
3
- password?: string;
4
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=AuthOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthOptions.js","sourceRoot":"","sources":["../../../lib/connection/types/AuthOptions.ts"],"names":[],"mappings":""}
@@ -1,12 +0,0 @@
1
- import { TStatus } from '../../thrift/TCLIService_types';
2
- import Status from '../dto/Status';
3
- export default class StatusFactory {
4
- /**
5
- * @param status thrift status object from API responses
6
- * @throws {StatusError}
7
- */
8
- create(status: TStatus): Status;
9
- private isSuccess;
10
- private isError;
11
- private isExecuting;
12
- }
@@ -1,35 +0,0 @@
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 TCLIService_types_1 = require("../../thrift/TCLIService_types");
7
- const Status_1 = __importDefault(require("../dto/Status"));
8
- const StatusError_1 = __importDefault(require("../errors/StatusError"));
9
- class StatusFactory {
10
- /**
11
- * @param status thrift status object from API responses
12
- * @throws {StatusError}
13
- */
14
- create(status) {
15
- if (this.isError(status)) {
16
- throw new StatusError_1.default(status);
17
- }
18
- return new Status_1.default({
19
- success: this.isSuccess(status),
20
- executing: this.isExecuting(status),
21
- infoMessages: status.infoMessages || [],
22
- });
23
- }
24
- isSuccess(status) {
25
- return (status.statusCode === TCLIService_types_1.TStatusCode.SUCCESS_STATUS || status.statusCode === TCLIService_types_1.TStatusCode.SUCCESS_WITH_INFO_STATUS);
26
- }
27
- isError(status) {
28
- return status.statusCode === TCLIService_types_1.TStatusCode.ERROR_STATUS || status.statusCode === TCLIService_types_1.TStatusCode.INVALID_HANDLE_STATUS;
29
- }
30
- isExecuting(status) {
31
- return status.statusCode === TCLIService_types_1.TStatusCode.STILL_EXECUTING_STATUS;
32
- }
33
- }
34
- exports.default = StatusFactory;
35
- //# sourceMappingURL=StatusFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatusFactory.js","sourceRoot":"","sources":["../../lib/factory/StatusFactory.ts"],"names":[],"mappings":";;;;;AAAA,sEAAsE;AACtE,2DAAmC;AACnC,wEAAgD;AAEhD,MAAqB,aAAa;IAChC;;;OAGG;IACH,MAAM,CAAC,MAAe;QACpB,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACxB,MAAM,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;SAC/B;QAED,OAAO,IAAI,gBAAM,CAAC;YAChB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;YAC/B,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACnC,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,MAAe;QAC/B,OAAO,CACL,MAAM,CAAC,UAAU,KAAK,+BAAW,CAAC,cAAc,IAAI,MAAM,CAAC,UAAU,KAAK,+BAAW,CAAC,wBAAwB,CAC/G,CAAC;IACJ,CAAC;IAEO,OAAO,CAAC,MAAe;QAC7B,OAAO,MAAM,CAAC,UAAU,KAAK,+BAAW,CAAC,YAAY,IAAI,MAAM,CAAC,UAAU,KAAK,+BAAW,CAAC,qBAAqB,CAAC;IACnH,CAAC;IAEO,WAAW,CAAC,MAAe;QACjC,OAAO,MAAM,CAAC,UAAU,KAAK,+BAAW,CAAC,sBAAsB,CAAC;IAClE,CAAC;CACF;AA9BD,gCA8BC"}
@@ -1,2 +0,0 @@
1
- coverage
2
- .nyc_output
@@ -1,10 +0,0 @@
1
- {
2
- "check-coverage": false,
3
- "lines": 99,
4
- "statements": 99,
5
- "functions": 99,
6
- "branches": 99,
7
- "include": [
8
- "index.js"
9
- ]
10
- }
@@ -1,9 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "6"
4
- - "8"
5
- - "10"
6
- - "node"
7
- script: npm run travis
8
- cache:
9
- yarn: true
@@ -1,8 +0,0 @@
1
- The MIT License (MIT)
2
- Copyright (c) 2017 Samuel Reed <samuel.trace.reed@gmail.com>
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
-
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- function Queue(options) {
4
- if (!(this instanceof Queue)) {
5
- return new Queue(options);
6
- }
7
-
8
- options = options || {};
9
- this.concurrency = options.concurrency || Infinity;
10
- this.pending = 0;
11
- this.jobs = [];
12
- this.cbs = [];
13
- this._done = done.bind(this);
14
- }
15
-
16
- var arrayAddMethods = [
17
- 'push',
18
- 'unshift',
19
- 'splice'
20
- ];
21
-
22
- arrayAddMethods.forEach(function(method) {
23
- Queue.prototype[method] = function() {
24
- var methodResult = Array.prototype[method].apply(this.jobs, arguments);
25
- this._run();
26
- return methodResult;
27
- };
28
- });
29
-
30
- Object.defineProperty(Queue.prototype, 'length', {
31
- get: function() {
32
- return this.pending + this.jobs.length;
33
- }
34
- });
35
-
36
- Queue.prototype._run = function() {
37
- if (this.pending === this.concurrency) {
38
- return;
39
- }
40
- if (this.jobs.length) {
41
- var job = this.jobs.shift();
42
- this.pending++;
43
- job(this._done);
44
- this._run();
45
- }
46
-
47
- if (this.pending === 0) {
48
- while (this.cbs.length !== 0) {
49
- var cb = this.cbs.pop();
50
- process.nextTick(cb);
51
- }
52
- }
53
- };
54
-
55
- Queue.prototype.onDone = function(cb) {
56
- if (typeof cb === 'function') {
57
- this.cbs.push(cb);
58
- this._run();
59
- }
60
- };
61
-
62
- function done() {
63
- this.pending--;
64
- this._run();
65
- }
66
-
67
- module.exports = Queue;
@@ -1,35 +0,0 @@
1
- {
2
- "name": "async-limiter",
3
- "version": "1.0.1",
4
- "description": "asynchronous function queue with adjustable concurrency",
5
- "keywords": [
6
- "throttle",
7
- "async",
8
- "limiter",
9
- "asynchronous",
10
- "job",
11
- "task",
12
- "concurrency",
13
- "concurrent"
14
- ],
15
- "dependencies": {},
16
- "devDependencies": {
17
- "coveralls": "^3.0.3",
18
- "eslint": "^5.16.0",
19
- "eslint-plugin-mocha": "^5.3.0",
20
- "intelli-espower-loader": "^1.0.1",
21
- "mocha": "^6.1.4",
22
- "nyc": "^14.1.1",
23
- "power-assert": "^1.6.1"
24
- },
25
- "scripts": {
26
- "test": "mocha --require intelli-espower-loader test/",
27
- "travis": "npm run lint && npm run test",
28
- "coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
29
- "example": "node example",
30
- "lint": "eslint ."
31
- },
32
- "repository": "https://github.com/strml/async-limiter.git",
33
- "author": "Samuel Reed <samuel.trace.reed@gmail.com",
34
- "license": "MIT"
35
- }
@@ -1,132 +0,0 @@
1
- # Async-Limiter
2
-
3
- A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue).
4
-
5
- [![npm](http://img.shields.io/npm/v/async-limiter.svg?style=flat-square)](http://www.npmjs.org/async-limiter)
6
- [![tests](https://img.shields.io/travis/STRML/async-limiter.svg?style=flat-square&branch=master)](https://travis-ci.org/STRML/async-limiter)
7
- [![coverage](https://img.shields.io/coveralls/STRML/async-limiter.svg?style=flat-square&branch=master)](https://coveralls.io/r/STRML/async-limiter)
8
-
9
- This module exports a class `Limiter` that implements some of the `Array` API.
10
- Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods.
11
-
12
- ## Motivation
13
-
14
- Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when
15
- run at infinite concurrency.
16
-
17
- In this case, it is actually faster, and takes far less memory, to limit concurrency.
18
-
19
- This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would
20
- make this module faster or lighter, but new functionality is not desired.
21
-
22
- Style should confirm to nodejs/node style.
23
-
24
- ## Example
25
-
26
- ``` javascript
27
- var Limiter = require('async-limiter')
28
-
29
- var t = new Limiter({concurrency: 2});
30
- var results = []
31
-
32
- // add jobs using the familiar Array API
33
- t.push(function (cb) {
34
- results.push('two')
35
- cb()
36
- })
37
-
38
- t.push(
39
- function (cb) {
40
- results.push('four')
41
- cb()
42
- },
43
- function (cb) {
44
- results.push('five')
45
- cb()
46
- }
47
- )
48
-
49
- t.unshift(function (cb) {
50
- results.push('one')
51
- cb()
52
- })
53
-
54
- t.splice(2, 0, function (cb) {
55
- results.push('three')
56
- cb()
57
- })
58
-
59
- // Jobs run automatically. If you want a callback when all are done,
60
- // call 'onDone()'.
61
- t.onDone(function () {
62
- console.log('all done:', results)
63
- })
64
- ```
65
-
66
- ## Zlib Example
67
-
68
- ```js
69
- const zlib = require('zlib');
70
- const Limiter = require('async-limiter');
71
-
72
- const message = {some: "data"};
73
- const payload = new Buffer(JSON.stringify(message));
74
-
75
- // Try with different concurrency values to see how this actually
76
- // slows significantly with higher concurrency!
77
- //
78
- // 5: 1398.607ms
79
- // 10: 1375.668ms
80
- // Infinity: 4423.300ms
81
- //
82
- const t = new Limiter({concurrency: 5});
83
- function deflate(payload, cb) {
84
- t.push(function(done) {
85
- zlib.deflate(payload, function(err, buffer) {
86
- done();
87
- cb(err, buffer);
88
- });
89
- });
90
- }
91
-
92
- console.time('deflate');
93
- for(let i = 0; i < 30000; ++i) {
94
- deflate(payload, function (err, buffer) {});
95
- }
96
- t.onDone(function() {
97
- console.timeEnd('deflate');
98
- });
99
- ```
100
-
101
- ## Install
102
-
103
- `npm install async-limiter`
104
-
105
- ## Test
106
-
107
- `npm test`
108
-
109
- ## API
110
-
111
- ### `var t = new Limiter([opts])`
112
- Constructor. `opts` may contain inital values for:
113
- * `t.concurrency`
114
-
115
- ## Instance methods
116
-
117
- ### `t.onDone(fn)`
118
- `fn` will be called once and only once, when the queue is empty.
119
-
120
- ## Instance methods mixed in from `Array`
121
- Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).
122
- ### `t.push(element1, ..., elementN)`
123
- ### `t.unshift(element1, ..., elementN)`
124
- ### `t.splice(index , howMany[, element1[, ...[, elementN]]])`
125
-
126
- ## Properties
127
- ### `t.concurrency`
128
- Max number of jobs the queue should process concurrently, defaults to `Infinity`.
129
-
130
- ### `t.length`
131
- Jobs pending + jobs to process (readonly).
132
-
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Dineshkumar Pandiyan <flexdinesh@gmail.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,63 +0,0 @@
1
- # Browser or Node.js
2
-
3
- [![Build Status](https://travis-ci.org/flexdinesh/browser-or-node.svg?branch=master)](https://travis-ci.org/flexdinesh/browser-or-node)
4
- [![npm version](https://badge.fury.io/js/browser-or-node.svg)](https://www.npmjs.com/package/browser-or-node)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
-
7
- Check whether the code is running in the browser or node.js runtime.
8
-
9
- ## Install
10
-
11
- ```
12
- $ npm install --save browser-or-node
13
- ```
14
-
15
- ## Usage
16
-
17
- ES6 style import
18
-
19
- ```js
20
- import { isBrowser, isNode, isWebWorker, isJsDom } from "browser-or-node";
21
-
22
- if (isBrowser) {
23
- // do browser only stuff
24
- }
25
-
26
- if (isNode) {
27
- // do node.js only stuff
28
- }
29
-
30
- if (isWebWorker) {
31
- // do web worker only stuff
32
- }
33
-
34
- if (isJsDom) {
35
- // do jsdom only stuff
36
- }
37
- ```
38
-
39
- ES5 style import
40
-
41
- ```js
42
- var jsEnv = require("browser-or-node");
43
-
44
- if (jsEnv.isBrowser) {
45
- // do browser only stuff
46
- }
47
-
48
- if (jsEnv.isNode) {
49
- // do node.js only stuff
50
- }
51
-
52
- if (jsEnv.isWebWorker) {
53
- // do web worker only stuff
54
- }
55
-
56
- if (jsEnv.isJsDom) {
57
- // do jsdom only stuff
58
- }
59
- ```
60
-
61
- ## License
62
-
63
- MIT © Dineshkumar Pandiyan
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
8
-
9
- /* global window self */
10
-
11
- var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
12
-
13
- /* eslint-disable no-restricted-globals */
14
- var isWebWorker = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope';
15
- /* eslint-enable no-restricted-globals */
16
-
17
- var isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
18
-
19
- /**
20
- * @see https://github.com/jsdom/jsdom/releases/tag/12.0.0
21
- * @see https://github.com/jsdom/jsdom/issues/1537
22
- */
23
- /* eslint-disable no-undef */
24
- var isJsDom = function isJsDom() {
25
- return typeof window !== 'undefined' && window.name === 'nodejs' || navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom');
26
- };
27
-
28
- exports.isBrowser = isBrowser;
29
- exports.isWebWorker = isWebWorker;
30
- exports.isNode = isNode;
31
- exports.isJsDom = isJsDom;
@@ -1,60 +0,0 @@
1
- {
2
- "name": "browser-or-node",
3
- "version": "1.3.0",
4
- "description": "Check where the code is running in the browser or node.js",
5
- "main": "./lib/index.js",
6
- "scripts": {
7
- "clean": "rimraf lib",
8
- "test": "npm run cover",
9
- "test:only": "cross-env BABEL_ENV=commonjs mocha --require babel-core/register --recursive",
10
- "test:watch": "npm test -- --watch",
11
- "test:examples": "node examples/",
12
- "cover": "cross-env BABEL_ENV=commonjs istanbul cover node_modules/mocha/bin/_mocha -- --require babel-core/register --recursive",
13
- "lint": "eslint src",
14
- "build": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
15
- "prepublish": "npm run clean && npm run lint && npm run test && npm run build"
16
- },
17
- "files": [
18
- "lib",
19
- "src"
20
- ],
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/flexdinesh/browser-or-node.git"
24
- },
25
- "keywords": [
26
- "npm",
27
- "browser",
28
- "node",
29
- "is browser",
30
- "is node",
31
- "is browser node"
32
- ],
33
- "author": "Dineshkumar Pandiyan <flexdinesh@gmail.com>",
34
- "contributors": [
35
- "Daniel Wang <daniel.liberated@gmail.com> (https://github.com/dan1wang/)"
36
- ],
37
- "license": "MIT",
38
- "bugs": {
39
- "url": "https://github.com/flexdinesh/browser-or-node/issues"
40
- },
41
- "homepage": "https://github.com/flexdinesh/browser-or-node#readme",
42
- "devDependencies": {
43
- "babel": "^6.23.0",
44
- "babel-cli": "^6.26.0",
45
- "babel-eslint": "^10.1.0",
46
- "babel-plugin-add-module-exports": "^1.0.2",
47
- "babel-preset-es2015": "^6.24.1",
48
- "babel-preset-stage-2": "^6.24.1",
49
- "chai": "^4.2.0",
50
- "cross-env": "^7.0.2",
51
- "eslint": "^7.3.1",
52
- "eslint-config-airbnb": "^18.2.0",
53
- "eslint-plugin-import": "^2.21.2",
54
- "eslint-plugin-jsx-a11y": "^6.3.1",
55
- "eslint-plugin-react": "^7.20.0",
56
- "istanbul": "^1.0.0-alpha",
57
- "mocha": "^8.0.1",
58
- "rimraf": "^3.0.2"
59
- }
60
- }