rocketmq-client-nodejs 0.0.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +69 -1
  3. package/dist/client/BaseClient.d.ts +92 -0
  4. package/dist/client/BaseClient.js +308 -0
  5. package/dist/client/ClientId.d.ts +24 -0
  6. package/dist/client/ClientId.js +33 -0
  7. package/dist/client/Logger.d.ts +24 -0
  8. package/dist/client/Logger.js +34 -0
  9. package/dist/client/RpcClient.d.ts +47 -0
  10. package/dist/client/RpcClient.js +208 -0
  11. package/dist/client/RpcClientManager.d.ts +41 -0
  12. package/dist/client/RpcClientManager.js +139 -0
  13. package/dist/client/SessionCredentials.d.ts +21 -0
  14. package/dist/client/SessionCredentials.js +19 -0
  15. package/dist/client/Settings.d.ts +30 -0
  16. package/dist/client/Settings.js +38 -0
  17. package/dist/client/TelemetrySession.d.ts +27 -0
  18. package/dist/client/TelemetrySession.js +101 -0
  19. package/dist/client/UserAgent.d.ts +25 -0
  20. package/dist/client/UserAgent.js +47 -0
  21. package/dist/client/index.d.ts +26 -0
  22. package/dist/client/index.js +43 -0
  23. package/dist/consumer/Consumer.d.ts +32 -0
  24. package/dist/consumer/Consumer.js +96 -0
  25. package/dist/consumer/FilterExpression.d.ts +25 -0
  26. package/dist/consumer/FilterExpression.js +40 -0
  27. package/dist/consumer/SimpleConsumer.d.ts +47 -8
  28. package/dist/consumer/SimpleConsumer.js +105 -27
  29. package/dist/consumer/SimpleSubscriptionSettings.d.ts +28 -0
  30. package/dist/consumer/SimpleSubscriptionSettings.js +57 -0
  31. package/dist/consumer/SubscriptionLoadBalancer.d.ts +23 -0
  32. package/dist/consumer/SubscriptionLoadBalancer.js +46 -0
  33. package/dist/consumer/index.d.ts +21 -0
  34. package/dist/consumer/index.js +38 -0
  35. package/dist/exception/BadRequestException.d.ts +20 -0
  36. package/dist/exception/BadRequestException.js +28 -0
  37. package/dist/exception/ClientException.d.ts +20 -0
  38. package/dist/exception/ClientException.js +31 -0
  39. package/dist/exception/ForbiddenException.d.ts +20 -0
  40. package/dist/exception/ForbiddenException.js +28 -0
  41. package/dist/exception/InternalErrorException.d.ts +20 -0
  42. package/dist/exception/InternalErrorException.js +28 -0
  43. package/dist/exception/NotFoundException.d.ts +20 -0
  44. package/dist/exception/NotFoundException.js +28 -0
  45. package/dist/exception/PayloadTooLargeException.d.ts +20 -0
  46. package/dist/exception/PayloadTooLargeException.js +28 -0
  47. package/dist/exception/PaymentRequiredException.d.ts +20 -0
  48. package/dist/exception/PaymentRequiredException.js +28 -0
  49. package/dist/exception/ProxyTimeoutException.d.ts +20 -0
  50. package/dist/exception/ProxyTimeoutException.js +28 -0
  51. package/dist/exception/RequestHeaderFieldsTooLargeException.d.ts +20 -0
  52. package/dist/exception/RequestHeaderFieldsTooLargeException.js +28 -0
  53. package/dist/exception/StatusChecker.d.ts +20 -0
  54. package/dist/exception/StatusChecker.js +98 -0
  55. package/dist/exception/TooManyRequestsException.d.ts +20 -0
  56. package/dist/exception/TooManyRequestsException.js +28 -0
  57. package/dist/exception/UnauthorizedException.d.ts +20 -0
  58. package/dist/exception/UnauthorizedException.js +28 -0
  59. package/dist/exception/UnsupportedException.d.ts +20 -0
  60. package/dist/exception/UnsupportedException.js +28 -0
  61. package/dist/exception/index.d.ts +29 -0
  62. package/dist/exception/index.js +46 -0
  63. package/dist/index.d.ts +22 -3
  64. package/dist/index.js +23 -4
  65. package/dist/message/Message.d.ts +37 -0
  66. package/dist/message/Message.js +43 -0
  67. package/dist/message/MessageId.d.ts +59 -0
  68. package/dist/message/MessageId.js +123 -0
  69. package/dist/message/MessageView.d.ts +39 -0
  70. package/dist/message/MessageView.js +90 -0
  71. package/dist/message/PublishingMessage.d.ts +30 -0
  72. package/dist/message/PublishingMessage.js +98 -0
  73. package/dist/message/index.d.ts +20 -0
  74. package/dist/message/index.js +37 -0
  75. package/dist/producer/Producer.d.ts +42 -0
  76. package/dist/producer/Producer.js +242 -1
  77. package/dist/producer/PublishingLoadBalancer.d.ts +24 -0
  78. package/dist/producer/PublishingLoadBalancer.js +82 -0
  79. package/dist/producer/PublishingSettings.d.ts +28 -0
  80. package/dist/producer/PublishingSettings.js +70 -0
  81. package/dist/producer/SendReceipt.d.ts +28 -0
  82. package/dist/producer/SendReceipt.js +57 -0
  83. package/dist/producer/Transaction.d.ts +28 -0
  84. package/dist/producer/Transaction.js +64 -0
  85. package/dist/producer/TransactionChecker.d.ts +21 -0
  86. package/dist/producer/TransactionChecker.js +19 -0
  87. package/dist/producer/index.d.ts +21 -0
  88. package/dist/producer/index.js +39 -0
  89. package/dist/retry/ExponentialBackoffRetryPolicy.d.ts +27 -0
  90. package/dist/retry/ExponentialBackoffRetryPolicy.js +67 -0
  91. package/dist/retry/RetryPolicy.d.ts +46 -0
  92. package/dist/retry/RetryPolicy.js +19 -0
  93. package/dist/retry/index.d.ts +18 -0
  94. package/dist/retry/index.js +35 -0
  95. package/dist/route/Broker.d.ts +25 -0
  96. package/dist/route/Broker.js +40 -0
  97. package/dist/route/Endpoints.d.ts +30 -0
  98. package/dist/route/Endpoints.js +71 -0
  99. package/dist/route/MessageQueue.d.ts +27 -0
  100. package/dist/route/MessageQueue.js +47 -0
  101. package/dist/route/TopicRouteData.d.ts +24 -0
  102. package/dist/route/TopicRouteData.js +37 -0
  103. package/dist/route/index.d.ts +20 -0
  104. package/dist/route/index.js +37 -0
  105. package/dist/util/index.d.ts +36 -0
  106. package/dist/util/index.js +88 -0
  107. package/package.json +12 -5
  108. package/src/client/BaseClient.ts +384 -0
  109. package/src/client/ClientId.ts +31 -0
  110. package/src/client/Logger.ts +35 -0
  111. package/src/client/RpcClient.ts +245 -0
  112. package/src/client/RpcClientManager.ts +173 -0
  113. package/src/client/SessionCredentials.ts +22 -0
  114. package/src/client/Settings.ts +45 -0
  115. package/src/client/TelemetrySession.ts +118 -0
  116. package/src/client/UserAgent.ts +45 -0
  117. package/src/client/index.ts +27 -0
  118. package/src/consumer/Consumer.ts +111 -0
  119. package/src/consumer/FilterExpression.ts +42 -0
  120. package/src/consumer/SimpleConsumer.ts +133 -20
  121. package/src/consumer/SimpleSubscriptionSettings.ts +65 -0
  122. package/src/consumer/SubscriptionLoadBalancer.ts +47 -0
  123. package/src/consumer/index.ts +22 -0
  124. package/src/exception/BadRequestException.ts +25 -0
  125. package/src/exception/ClientException.ts +29 -0
  126. package/src/exception/ForbiddenException.ts +25 -0
  127. package/src/exception/InternalErrorException.ts +25 -0
  128. package/src/exception/NotFoundException.ts +25 -0
  129. package/src/exception/PayloadTooLargeException.ts +25 -0
  130. package/src/exception/PaymentRequiredException.ts +25 -0
  131. package/src/exception/ProxyTimeoutException.ts +25 -0
  132. package/src/exception/RequestHeaderFieldsTooLargeException.ts +25 -0
  133. package/src/exception/StatusChecker.ts +94 -0
  134. package/src/exception/TooManyRequestsException.ts +25 -0
  135. package/src/exception/UnauthorizedException.ts +25 -0
  136. package/src/exception/UnsupportedException.ts +25 -0
  137. package/src/exception/index.ts +30 -0
  138. package/src/index.ts +23 -3
  139. package/src/message/Message.ts +51 -0
  140. package/src/message/MessageId.ts +123 -0
  141. package/src/message/MessageView.ts +94 -0
  142. package/src/message/PublishingMessage.ts +102 -0
  143. package/src/message/index.ts +21 -0
  144. package/src/producer/Producer.ts +291 -0
  145. package/src/producer/PublishingLoadBalancer.ts +85 -0
  146. package/src/producer/PublishingSettings.ts +79 -0
  147. package/src/producer/SendReceipt.ts +60 -0
  148. package/src/producer/Transaction.ts +70 -0
  149. package/src/producer/TransactionChecker.ts +23 -0
  150. package/src/producer/index.ts +23 -0
  151. package/src/retry/ExponentialBackoffRetryPolicy.ts +76 -0
  152. package/src/retry/RetryPolicy.ts +51 -0
  153. package/src/retry/index.ts +19 -0
  154. package/src/route/Broker.ts +39 -0
  155. package/src/route/Endpoints.ts +70 -0
  156. package/src/route/MessageQueue.ts +49 -0
  157. package/src/route/TopicRouteData.ts +38 -0
  158. package/src/route/index.ts +21 -0
  159. package/src/util/index.ts +83 -0
  160. package/dist/grpc/MessagingServiceClient.d.ts +0 -9
  161. package/dist/grpc/MessagingServiceClient.js +0 -13
  162. package/dist/model/SessionCredentials.d.ts +0 -5
  163. package/dist/model/SessionCredentials.js +0 -3
  164. package/src/grpc/MessagingServiceClient.ts +0 -17
  165. package/src/model/SessionCredentials.ts +0 -5
@@ -1,34 +1,112 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _Consumer_messagingServiceClient, _Consumer_topic, _Consumer_consumerGroup;
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
14
18
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.Consumer = void 0;
16
- const MessagingServiceClient_1 = require("../grpc/MessagingServiceClient");
19
+ exports.SimpleConsumer = void 0;
20
+ const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
17
21
  const service_pb_1 = require("../../proto/apache/rocketmq/v2/service_pb");
18
- class Consumer {
22
+ const util_1 = require("../util");
23
+ const FilterExpression_1 = require("./FilterExpression");
24
+ const SimpleSubscriptionSettings_1 = require("./SimpleSubscriptionSettings");
25
+ const SubscriptionLoadBalancer_1 = require("./SubscriptionLoadBalancer");
26
+ const Consumer_1 = require("./Consumer");
27
+ class SimpleConsumer extends Consumer_1.Consumer {
28
+ #simpleSubscriptionSettings;
29
+ #subscriptionExpressions = new Map();
30
+ #subscriptionRouteDataCache = new Map();
31
+ #awaitDuration;
32
+ #topicIndex = 0;
19
33
  constructor(options) {
20
- _Consumer_messagingServiceClient.set(this, void 0);
21
- _Consumer_topic.set(this, void 0);
22
- _Consumer_consumerGroup.set(this, void 0);
23
- __classPrivateFieldSet(this, _Consumer_messagingServiceClient, (0, MessagingServiceClient_1.createMessagingServiceClient)(options), "f");
24
- __classPrivateFieldSet(this, _Consumer_topic, options.topic, "f");
25
- __classPrivateFieldSet(this, _Consumer_consumerGroup, options.consumerGroup, "f");
34
+ options.topics = Array.from(options.subscriptions.keys());
35
+ super(options);
36
+ for (const [topic, filter] of options.subscriptions.entries()) {
37
+ if (typeof filter === 'string') {
38
+ // filter is tag string
39
+ this.#subscriptionExpressions.set(topic, new FilterExpression_1.FilterExpression(filter));
40
+ }
41
+ else {
42
+ this.#subscriptionExpressions.set(topic, filter);
43
+ }
44
+ }
45
+ this.#awaitDuration = options.awaitDuration ?? 30000;
46
+ this.#simpleSubscriptionSettings = new SimpleSubscriptionSettings_1.SimpleSubscriptionSettings(this.clientId, this.endpoints, this.consumerGroup, this.requestTimeout, this.#awaitDuration, this.#subscriptionExpressions);
26
47
  }
27
- async startup() {
28
- const queryRouteRequest = new service_pb_1.QueryRouteRequest();
29
- queryRouteRequest.setTopic(__classPrivateFieldGet(this, _Consumer_topic, "f"));
48
+ getSettings() {
49
+ return this.#simpleSubscriptionSettings;
50
+ }
51
+ wrapHeartbeatRequest() {
52
+ return new service_pb_1.HeartbeatRequest()
53
+ .setClientType(definition_pb_1.ClientType.SIMPLE_CONSUMER)
54
+ .setGroup((0, util_1.createResource)(this.consumerGroup));
55
+ }
56
+ wrapNotifyClientTerminationRequest() {
57
+ return new service_pb_1.NotifyClientTerminationRequest()
58
+ .setGroup((0, util_1.createResource)(this.consumerGroup));
59
+ }
60
+ onTopicRouteDataUpdate(topic, topicRouteData) {
61
+ this.#updateSubscriptionLoadBalancer(topic, topicRouteData);
62
+ }
63
+ #updateSubscriptionLoadBalancer(topic, topicRouteData) {
64
+ let subscriptionLoadBalancer = this.#subscriptionRouteDataCache.get(topic);
65
+ if (!subscriptionLoadBalancer) {
66
+ subscriptionLoadBalancer = new SubscriptionLoadBalancer_1.SubscriptionLoadBalancer(topicRouteData);
67
+ }
68
+ else {
69
+ subscriptionLoadBalancer = subscriptionLoadBalancer.update(topicRouteData);
70
+ }
71
+ this.#subscriptionRouteDataCache.set(topic, subscriptionLoadBalancer);
72
+ return subscriptionLoadBalancer;
73
+ }
74
+ async #getSubscriptionLoadBalancer(topic) {
75
+ let loadBalancer = this.#subscriptionRouteDataCache.get(topic);
76
+ if (!loadBalancer) {
77
+ const topicRouteData = await this.getRouteData(topic);
78
+ loadBalancer = this.#updateSubscriptionLoadBalancer(topic, topicRouteData);
79
+ }
80
+ return loadBalancer;
81
+ }
82
+ async subscribe(topic, filterExpression) {
83
+ await this.getRouteData(topic);
84
+ this.#subscriptionExpressions.set(topic, filterExpression);
85
+ }
86
+ unsubscribe(topic) {
87
+ this.#subscriptionExpressions.delete(topic);
88
+ }
89
+ async receive(maxMessageNum = 10, invisibleDuration = 15000) {
90
+ const topic = this.#nextTopic();
91
+ const filterExpression = this.#subscriptionExpressions.get(topic);
92
+ const loadBalancer = await this.#getSubscriptionLoadBalancer(topic);
93
+ const mq = loadBalancer.takeMessageQueue();
94
+ const request = this.wrapReceiveMessageRequest(maxMessageNum, mq, filterExpression, invisibleDuration, this.#awaitDuration);
95
+ return await this.receiveMessage(request, mq, this.#awaitDuration);
96
+ }
97
+ async ack(message) {
98
+ await this.ackMessage(message);
99
+ }
100
+ async changeInvisibleDuration0(message, invisibleDuration) {
101
+ await this.changeInvisibleDuration0(message, invisibleDuration);
102
+ }
103
+ #nextTopic() {
104
+ const topics = Array.from(this.#subscriptionExpressions.keys());
105
+ if (this.#topicIndex >= topics.length) {
106
+ this.#topicIndex = 0;
107
+ }
108
+ return topics[this.#topicIndex++];
30
109
  }
31
110
  }
32
- exports.Consumer = Consumer;
33
- _Consumer_messagingServiceClient = new WeakMap(), _Consumer_topic = new WeakMap(), _Consumer_consumerGroup = new WeakMap();
34
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2ltcGxlQ29uc3VtZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3VtZXIvU2ltcGxlQ29uc3VtZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkVBRXdDO0FBQ3hDLDBFQUE4RTtBQVE5RSxNQUFhLFFBQVE7SUFLbkIsWUFBWSxPQUF3QjtRQUozQixtREFBZ0Q7UUFDaEQsa0NBQWU7UUFDZiwwQ0FBdUI7UUFHOUIsdUJBQUEsSUFBSSxvQ0FBMkIsSUFBQSxxREFBNEIsRUFBQyxPQUFPLENBQUMsTUFBQSxDQUFDO1FBQ3JFLHVCQUFBLElBQUksbUJBQVUsT0FBTyxDQUFDLEtBQUssTUFBQSxDQUFDO1FBQzVCLHVCQUFBLElBQUksMkJBQWtCLE9BQU8sQ0FBQyxhQUFhLE1BQUEsQ0FBQ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QUVELEtBQUssQ0FBQyxHQUFHLENBQUMsT0FBb0I7UUFDNUIsTUFBTSxJQUFJLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ2pDLENBQUM7SUFFRCxLQUFLLENBQUMsd0JBQXdCLENBQUMsT0FBb0IsRUFBRSxpQkFBeUI7UUFDNUUsTUFBTSxJQUFJLENBQUMsd0JBQXdCLENBQUMsT0FBTyxFQUFFLGlCQUFpQixDQUFDLENBQUM7SUFDbEUsQ0FBQztJQUVELFVBQVU7UUFDUixNQUFNLE1BQU0sR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFDO1FBQ2hFLElBQUksSUFBSSxDQUFDLFdBQVcsSUFBSSxNQUFNLENBQUMsTUFBTSxFQUFFLENBQUM7WUFDdEMsSUFBSSxDQUFDLFdBQVcsR0FBRyxDQUFDLENBQUM7UUFDdkIsQ0FBQztRQUNELE9BQU8sTUFBTSxDQUFDLElBQUksQ0FBQyxXQUFXLEVBQUUsQ0FBQyxDQUFDO0lBQ3BDLENBQUM7Q0FDRjtBQWhHRCx3Q0FnR0MifQ==
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Settings as SettingsPB } from '../../proto/apache/rocketmq/v2/definition_pb';
18
+ import { Endpoints } from '../route';
19
+ import { Settings } from '../client';
20
+ import { FilterExpression } from './FilterExpression';
21
+ export declare class SimpleSubscriptionSettings extends Settings {
22
+ readonly longPollingTimeout: number;
23
+ readonly group: string;
24
+ readonly subscriptionExpressions: Map<string, FilterExpression>;
25
+ constructor(clientId: string, accessPoint: Endpoints, group: string, requestTimeout: number, longPollingTimeout: number, subscriptionExpressions: Map<string, FilterExpression>);
26
+ toProtobuf(): SettingsPB;
27
+ sync(settings: SettingsPB): void;
28
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.SimpleSubscriptionSettings = void 0;
20
+ const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
21
+ const client_1 = require("../client");
22
+ const util_1 = require("../util");
23
+ class SimpleSubscriptionSettings extends client_1.Settings {
24
+ longPollingTimeout;
25
+ group;
26
+ subscriptionExpressions;
27
+ constructor(clientId, accessPoint, group, requestTimeout, longPollingTimeout, subscriptionExpressions) {
28
+ super(clientId, definition_pb_1.ClientType.SIMPLE_CONSUMER, accessPoint, requestTimeout);
29
+ this.longPollingTimeout = longPollingTimeout;
30
+ this.group = group;
31
+ this.subscriptionExpressions = subscriptionExpressions;
32
+ }
33
+ toProtobuf() {
34
+ const subscription = new definition_pb_1.Subscription()
35
+ .setGroup((0, util_1.createResource)(this.group))
36
+ .setLongPollingTimeout((0, util_1.createDuration)(this.longPollingTimeout));
37
+ for (const [topic, filterExpression] of this.subscriptionExpressions.entries()) {
38
+ subscription.addSubscriptions()
39
+ .setTopic((0, util_1.createResource)(topic))
40
+ .setExpression(filterExpression.toProtobuf());
41
+ }
42
+ return new definition_pb_1.Settings()
43
+ .setClientType(this.clientType)
44
+ .setAccessPoint(this.accessPoint.toProtobuf())
45
+ .setRequestTimeout((0, util_1.createDuration)(this.requestTimeout))
46
+ .setSubscription(subscription)
47
+ .setUserAgent(client_1.UserAgent.INSTANCE.toProtobuf());
48
+ }
49
+ sync(settings) {
50
+ if (settings.getPubSubCase() !== definition_pb_1.Settings.PubSubCase.SUBSCRIPTION) {
51
+ // log.error("[Bug] Issued settings not match with the client type, clientId={}, pubSubCase={}, "
52
+ // + "clientType={}", clientId, pubSubCase, clientType);
53
+ }
54
+ }
55
+ }
56
+ exports.SimpleSubscriptionSettings = SimpleSubscriptionSettings;
57
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2ltcGxlU3Vic2NyaXB0aW9uU2V0dGluZ3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3VtZXIvU2ltcGxlU3Vic2NyaXB0aW9uU2V0dGluZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBRUgsZ0ZBSXNEO0FBRXRELHNDQUFnRDtBQUNoRCxrQ0FBeUQ7QUFHekQsTUFBYSwwQkFBMkIsU0FBUSxpQkFBUTtJQUM3QyxrQkFBa0IsQ0FBUztJQUMzQixLQUFLLENBQVM7SUFDZCx1QkFBdUIsQ0FBZ0M7SUFFaEUsWUFBWSxRQUFnQixFQUFFLFdBQXNCLEVBQUUsS0FBYSxFQUNqRSxjQUFzQixFQUFFLGtCQUEwQixF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QsZUFBZSxDQUFDLFlBQVksQ0FBQzthQUM3QixZQUFZLENBQUMsa0JBQVMsQ0FBQyxRQUFRLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztJQUNuRCxDQUFDO0lBRUQsSUFBSSxDQUFDLFFBQW9CO1FBQ3ZCLElBQUksUUFBUSxDQUFDLGFBQWEsRUFBRSxLQUFLLHdCQUFVLENBQUMsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFDO1lBQ3BFLGlHQUFpRztZQUNqRyw4REFBOEQ7UUFDaEUsQ0FBQztJQUNILENBQUM7Q0FDRjtBQXJDRCxnRUFxQ0MifQ==
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessageQueue, TopicRouteData } from '../route';
18
+ export declare class SubscriptionLoadBalancer {
19
+ #private;
20
+ constructor(topicRouteData: TopicRouteData, index?: number);
21
+ update(topicRouteData: TopicRouteData): SubscriptionLoadBalancer;
22
+ takeMessageQueue(): MessageQueue;
23
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.SubscriptionLoadBalancer = void 0;
20
+ const node_crypto_1 = require("node:crypto");
21
+ const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
22
+ const util_1 = require("../util");
23
+ class SubscriptionLoadBalancer {
24
+ #index;
25
+ #messageQueues;
26
+ constructor(topicRouteData, index) {
27
+ this.#messageQueues = topicRouteData.messageQueues.filter(mq => {
28
+ return mq.queueId === util_1.MASTER_BROKER_ID && (mq.permission === definition_pb_1.Permission.READ || mq.permission === definition_pb_1.Permission.READ_WRITE);
29
+ });
30
+ this.#index = index === undefined ? (0, node_crypto_1.randomInt)(this.#messageQueues.length) : index;
31
+ if (this.#messageQueues.length === 0) {
32
+ throw new Error(`No readable message queue found, topicRouteData=${JSON.stringify(topicRouteData)}`);
33
+ }
34
+ }
35
+ update(topicRouteData) {
36
+ return new SubscriptionLoadBalancer(topicRouteData, this.#index);
37
+ }
38
+ takeMessageQueue() {
39
+ if (this.#index >= this.#messageQueues.length) {
40
+ this.#index = 0;
41
+ }
42
+ return this.#messageQueues[this.#index++];
43
+ }
44
+ }
45
+ exports.SubscriptionLoadBalancer = SubscriptionLoadBalancer;
46
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3Vic2NyaXB0aW9uTG9hZEJhbGFuY2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnN1bWVyL1N1YnNjcmlwdGlvbkxvYWRCYWxhbmNlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs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xjQUFjLENBQUMsTUFBTSxFQUFFLENBQUM7WUFDOUMsSUFBSSxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUM7UUFDbEIsQ0FBQztRQUNELE9BQU8sSUFBSSxDQUFDLGNBQWMsQ0FBQyxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUMsQ0FBQztJQUM1QyxDQUFDO0NBQ0Y7QUF4QkQsNERBd0JDIn0=
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export * from './Consumer';
18
+ export * from './FilterExpression';
19
+ export * from './SimpleConsumer';
20
+ export * from './SimpleSubscriptionSettings';
21
+ export * from './SubscriptionLoadBalancer';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ __exportStar(require("./Consumer"), exports);
34
+ __exportStar(require("./FilterExpression"), exports);
35
+ __exportStar(require("./SimpleConsumer"), exports);
36
+ __exportStar(require("./SimpleSubscriptionSettings"), exports);
37
+ __exportStar(require("./SubscriptionLoadBalancer"), exports);
38
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3VtZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7Ozs7Ozs7Ozs7Ozs7OztBQUVILDZDQUEyQjtBQUMzQixxREFBbUM7QUFDbkMsbURBQWlDO0FBQ2pDLCtEQUE2QztBQUM3Qyw2REFBMkMifQ==
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ClientException } from './ClientException';
18
+ export declare class BadRequestException extends ClientException {
19
+ constructor(code: number, message: string, requestId?: string);
20
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.BadRequestException = void 0;
20
+ const ClientException_1 = require("./ClientException");
21
+ class BadRequestException extends ClientException_1.ClientException {
22
+ constructor(code, message, requestId) {
23
+ super(code, message, requestId);
24
+ this.name = 'BadRequestException';
25
+ }
26
+ }
27
+ exports.BadRequestException = BadRequestException;
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmFkUmVxdWVzdEV4Y2VwdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGNlcHRpb24vQmFkUmVxdWVzdEV4Y2VwdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7OztHQWVHOzs7QUFFSCx1REFBb0Q7QUFFcEQsTUFBYSxtQkFBb0IsU0FBUSxpQ0FBZTtJQUN0RCxZQUFZLElBQVksRUFBRSxPQUFlLEVBQUUsU0FBa0I7UUFDM0QsS0FBSyxDQUFDLElBQUksRUFBRSxPQUFPLEVBQUUsU0FBUyxDQUFDLENBQUM7UUFDaEMsSUFBSSxDQUFDLElBQUksR0FBRyxxQkFBcUIsQ0FBQztJQUNwQyxDQUFDO0NBQ0Y7QUFMRCxrREFLQyJ9
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export declare class ClientException extends Error {
18
+ code: number;
19
+ constructor(code: number, message: string, requestId?: string);
20
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ClientException = void 0;
20
+ const REQUEST_ID_KEY = 'request-id';
21
+ const RESPONSE_CODE_KEY = 'response-code';
22
+ class ClientException extends Error {
23
+ code;
24
+ constructor(code, message, requestId) {
25
+ super(`[${REQUEST_ID_KEY}=${requestId}, ${RESPONSE_CODE_KEY}=${code}] ${message}`);
26
+ this.code = code;
27
+ this.name = 'ClientException';
28
+ }
29
+ }
30
+ exports.ClientException = ClientException;
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2xpZW50RXhjZXB0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2V4Y2VwdGlvbi9DbGllbnRFeGNlcHRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBRUgsTUFBTSxjQUFjLEdBQUcsWUFBWSxDQUFDO0FBQ3BDLE1BQU0saUJBQWlCLEdBQUcsZUFBZSxDQUFDO0FBRTFDLE1BQWEsZUFBZ0IsU0FBUSxLQUFLO0lBQ3hDLElBQUksQ0FBUztJQUViLFlBQVksSUFBWSxFQUFFLE9BQWUsRUFBRSxTQUFrQjtRQUMzRCxLQUFLLENBQUMsSUFBSSxjQUFjLElBQUksU0FBUyxLQUFLLGlCQUFpQixJQUFJLElBQUksS0FBSyxPQUFPLEVBQUUsQ0FBQyxDQUFDO1FBQ25GLElBQUksQ0FBQyxJQUFJLEdBQUcsSUFBSSxDQUFDO1FBQ2pCLElBQUksQ0FBQyxJQUFJLEdBQUcsaUJBQWlCLENBQUM7SUFDaEMsQ0FBQztDQUNGO0FBUkQsMENBUUMifQ==
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ClientException } from './ClientException';
18
+ export declare class ForbiddenException extends ClientException {
19
+ constructor(code: number, message: string, requestId?: string);
20
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ForbiddenException = void 0;
20
+ const ClientException_1 = require("./ClientException");
21
+ class ForbiddenException extends ClientException_1.ClientException {
22
+ constructor(code, message, requestId) {
23
+ super(code, message, requestId);
24
+ this.name = 'ForbiddenException';
25
+ }
26
+ }
27
+ exports.ForbiddenException = ForbiddenException;
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRm9yYmlkZGVuRXhjZXB0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2V4Y2VwdGlvbi9Gb3JiaWRkZW5FeGNlcHRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBRUgsdURBQW9EO0FBRXBELE1BQWEsa0JBQW1CLFNBQVEsaUNBQWU7SUFDckQsWUFBWSxJQUFZLEVBQUUsT0FBZSxFQUFFLFNBQWtCO1FBQzNELEtBQUssQ0FBQyxJQUFJLEVBQUUsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO1FBQ2hDLElBQUksQ0FBQyxJQUFJLEdBQUcsb0JBQW9CLENBQUM7SUFDbkMsQ0FBQztDQUNGO0FBTEQsZ0RBS0MifQ==
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ClientException } from './ClientException';
18
+ export declare class InternalErrorException extends ClientException {
19
+ constructor(code: number, message: string, requestId?: string);
20
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.InternalErrorException = void 0;
20
+ const ClientException_1 = require("./ClientException");
21
+ class InternalErrorException extends ClientException_1.ClientException {
22
+ constructor(code, message, requestId) {
23
+ super(code, message, requestId);
24
+ this.name = 'InternalErrorException';
25
+ }
26
+ }
27
+ exports.InternalErrorException = InternalErrorException;
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW50ZXJuYWxFcnJvckV4Y2VwdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGNlcHRpb24vSW50ZXJuYWxFcnJvckV4Y2VwdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7OztHQWVHOzs7QUFFSCx1REFBb0Q7QUFFcEQsTUFBYSxzQkFBdUIsU0FBUSxpQ0FBZTtJQUN6RCxZQUFZLElBQVksRUFBRSxPQUFlLEVBQUUsU0FBa0I7UUFDM0QsS0FBSyxDQUFDLElBQUksRUFBRSxPQUFPLEVBQUUsU0FBUyxDQUFDLENBQUM7UUFDaEMsSUFBSSxDQUFDLElBQUksR0FBRyx3QkFBd0IsQ0FBQztJQUN2QyxDQUFDO0NBQ0Y7QUFMRCx3REFLQyJ9
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ClientException } from './ClientException';
18
+ export declare class NotFoundException extends ClientException {
19
+ constructor(code: number, message: string, requestId?: string);
20
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.NotFoundException = void 0;
20
+ const ClientException_1 = require("./ClientException");
21
+ class NotFoundException extends ClientException_1.ClientException {
22
+ constructor(code, message, requestId) {
23
+ super(code, message, requestId);
24
+ this.name = 'NotFoundException';
25
+ }
26
+ }
27
+ exports.NotFoundException = NotFoundException;
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTm90Rm91bmRFeGNlcHRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXhjZXB0aW9uL05vdEZvdW5kRXhjZXB0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUVILHVEQUFvRDtBQUVwRCxNQUFhLGlCQUFrQixTQUFRLGlDQUFlO0lBQ3BELFlBQVksSUFBWSxFQUFFLE9BQWUsRUFBRSxTQUFrQjtRQUMzRCxLQUFLLENBQUMsSUFBSSxFQUFFLE9BQU8sRUFBRSxTQUFTLENBQUMsQ0FBQztRQUNoQyxJQUFJLENBQUMsSUFBSSxHQUFHLG1CQUFtQixDQUFDO0lBQ2xDLENBQUM7Q0FDRjtBQUxELDhDQUtDIn0=