euclid-ndk 0.2.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 (127) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +603 -0
  3. package/dist/auth/index.d.ts +18 -0
  4. package/dist/auth/index.d.ts.map +1 -0
  5. package/dist/auth/index.js +17 -0
  6. package/dist/auth/index.js.map +1 -0
  7. package/dist/auth/rfc9421.d.ts +112 -0
  8. package/dist/auth/rfc9421.d.ts.map +1 -0
  9. package/dist/auth/rfc9421.js +452 -0
  10. package/dist/auth/rfc9421.js.map +1 -0
  11. package/dist/auth/scheme.d.ts +46 -0
  12. package/dist/auth/scheme.d.ts.map +1 -0
  13. package/dist/auth/scheme.js +44 -0
  14. package/dist/auth/scheme.js.map +1 -0
  15. package/dist/auth/signable.d.ts +37 -0
  16. package/dist/auth/signable.d.ts.map +1 -0
  17. package/dist/auth/signable.js +70 -0
  18. package/dist/auth/signable.js.map +1 -0
  19. package/dist/auth/sigv4.d.ts +72 -0
  20. package/dist/auth/sigv4.d.ts.map +1 -0
  21. package/dist/auth/sigv4.js +227 -0
  22. package/dist/auth/sigv4.js.map +1 -0
  23. package/dist/credentials.d.ts +56 -0
  24. package/dist/credentials.d.ts.map +1 -0
  25. package/dist/credentials.js +135 -0
  26. package/dist/credentials.js.map +1 -0
  27. package/dist/dto/com.d.ts +101 -0
  28. package/dist/dto/com.d.ts.map +1 -0
  29. package/dist/dto/com.js +132 -0
  30. package/dist/dto/com.js.map +1 -0
  31. package/dist/dto/eag.d.ts +104 -0
  32. package/dist/dto/eag.d.ts.map +1 -0
  33. package/dist/dto/eag.js +70 -0
  34. package/dist/dto/eag.js.map +1 -0
  35. package/dist/dto/eam.d.ts +105 -0
  36. package/dist/dto/eam.d.ts.map +1 -0
  37. package/dist/dto/eam.js +98 -0
  38. package/dist/dto/eam.js.map +1 -0
  39. package/dist/dto/eap.d.ts +88 -0
  40. package/dist/dto/eap.d.ts.map +1 -0
  41. package/dist/dto/eap.js +54 -0
  42. package/dist/dto/eap.js.map +1 -0
  43. package/dist/dto/ekm.d.ts +109 -0
  44. package/dist/dto/ekm.d.ts.map +1 -0
  45. package/dist/dto/ekm.js +78 -0
  46. package/dist/dto/ekm.js.map +1 -0
  47. package/dist/dto/ekv.d.ts +73 -0
  48. package/dist/dto/ekv.d.ts.map +1 -0
  49. package/dist/dto/ekv.js +45 -0
  50. package/dist/dto/ekv.js.map +1 -0
  51. package/dist/dto/ens.d.ts +84 -0
  52. package/dist/dto/ens.d.ts.map +1 -0
  53. package/dist/dto/ens.js +72 -0
  54. package/dist/dto/ens.js.map +1 -0
  55. package/dist/dto/eqs.d.ts +160 -0
  56. package/dist/dto/eqs.d.ts.map +1 -0
  57. package/dist/dto/eqs.js +120 -0
  58. package/dist/dto/eqs.js.map +1 -0
  59. package/dist/dto/esm.d.ts +192 -0
  60. package/dist/dto/esm.d.ts.map +1 -0
  61. package/dist/dto/esm.js +147 -0
  62. package/dist/dto/esm.js.map +1 -0
  63. package/dist/dto/ess.d.ts +49 -0
  64. package/dist/dto/ess.d.ts.map +1 -0
  65. package/dist/dto/ess.js +30 -0
  66. package/dist/dto/ess.js.map +1 -0
  67. package/dist/dto/json.d.ts +24 -0
  68. package/dist/dto/json.d.ts.map +1 -0
  69. package/dist/dto/json.js +47 -0
  70. package/dist/dto/json.js.map +1 -0
  71. package/dist/errors.d.ts +40 -0
  72. package/dist/errors.d.ts.map +1 -0
  73. package/dist/errors.js +73 -0
  74. package/dist/errors.js.map +1 -0
  75. package/dist/http/client.d.ts +96 -0
  76. package/dist/http/client.d.ts.map +1 -0
  77. package/dist/http/client.js +258 -0
  78. package/dist/http/client.js.map +1 -0
  79. package/dist/index.d.ts +93 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +110 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/modules/base.d.ts +121 -0
  84. package/dist/modules/base.d.ts.map +1 -0
  85. package/dist/modules/base.js +142 -0
  86. package/dist/modules/base.js.map +1 -0
  87. package/dist/modules/eag.d.ts +166 -0
  88. package/dist/modules/eag.d.ts.map +1 -0
  89. package/dist/modules/eag.js +189 -0
  90. package/dist/modules/eag.js.map +1 -0
  91. package/dist/modules/eam.d.ts +314 -0
  92. package/dist/modules/eam.d.ts.map +1 -0
  93. package/dist/modules/eam.js +641 -0
  94. package/dist/modules/eam.js.map +1 -0
  95. package/dist/modules/eap.d.ts +204 -0
  96. package/dist/modules/eap.d.ts.map +1 -0
  97. package/dist/modules/eap.js +218 -0
  98. package/dist/modules/eap.js.map +1 -0
  99. package/dist/modules/ekm.d.ts +182 -0
  100. package/dist/modules/ekm.d.ts.map +1 -0
  101. package/dist/modules/ekm.js +228 -0
  102. package/dist/modules/ekm.js.map +1 -0
  103. package/dist/modules/ekv.d.ts +189 -0
  104. package/dist/modules/ekv.d.ts.map +1 -0
  105. package/dist/modules/ekv.js +212 -0
  106. package/dist/modules/ekv.js.map +1 -0
  107. package/dist/modules/ens.d.ts +122 -0
  108. package/dist/modules/ens.d.ts.map +1 -0
  109. package/dist/modules/ens.js +167 -0
  110. package/dist/modules/ens.js.map +1 -0
  111. package/dist/modules/eqs.d.ts +283 -0
  112. package/dist/modules/eqs.d.ts.map +1 -0
  113. package/dist/modules/eqs.js +355 -0
  114. package/dist/modules/eqs.js.map +1 -0
  115. package/dist/modules/esm.d.ts +358 -0
  116. package/dist/modules/esm.d.ts.map +1 -0
  117. package/dist/modules/esm.js +660 -0
  118. package/dist/modules/esm.js.map +1 -0
  119. package/dist/modules/ess.d.ts +96 -0
  120. package/dist/modules/ess.d.ts.map +1 -0
  121. package/dist/modules/ess.js +110 -0
  122. package/dist/modules/ess.js.map +1 -0
  123. package/dist/url.d.ts +31 -0
  124. package/dist/url.d.ts.map +1 -0
  125. package/dist/url.js +47 -0
  126. package/dist/url.js.map +1 -0
  127. package/package.json +47 -0
@@ -0,0 +1,355 @@
1
+ /**
2
+ * EQS - euclid's queue module: queues, messages, leases, dead letter queues.
3
+ *
4
+ * One object, {@link EuclidEqs}, built from a session that has already logged in:
5
+ *
6
+ * ```ts
7
+ * const eqs = (await Euclid.forServer(url).login("jens", "secret")).eqs();
8
+ * const queue = await eqs.createQueue("orders");
9
+ *
10
+ * await eqs.sendMessage(queue.ern, JSON.stringify({ order: 17 }));
11
+ * for (const message of (await eqs.receiveMessages(queue.ern, { waitTimeSeconds: 20 })).items) {
12
+ * await handle(message.body);
13
+ * await eqs.deleteMessage(message.receiptHandle);
14
+ * }
15
+ * ```
16
+ *
17
+ * Receiving is a lease rather than a read: a message a consumer takes is invisible to every other
18
+ * consumer until its visibility timeout expires, and deleting it with the receipt handle is what says
19
+ * the work was done. A consumer that dies instead simply stops holding the lease, and the message comes
20
+ * back - which is why the delete belongs after the work rather than before it.
21
+ */
22
+ import { variantMapToJson, variantOf, variantToJson } from "../dto/com.js";
23
+ import { toPage } from "../dto/eam.js";
24
+ import { toCreateQueueResult, toQueue, toQueueMessage, toQueueMessageAttribute, toQueueMessageCount, toQueueMessageMetadata, toQueueMetadata, toQueueStatusResult, toRedriveDlqResult, } from "../dto/eqs.js";
25
+ import { listPayload, ModuleClient, pagePayload } from "./base.js";
26
+ export const TARGET = "eqs";
27
+ /** How long a received message stays invisible before it goes back on the queue, in seconds. */
28
+ export const DEFAULT_VISIBILITY = 30;
29
+ /** How many times a message may be received before it goes to the dead letter queue. */
30
+ export const DEFAULT_MAX_RETRIES = 3;
31
+ /** The largest message a queue accepts, in bytes. */
32
+ export const DEFAULT_MAX_MESSAGE_LENGTH = 1024 * 1024;
33
+ /**
34
+ * How long to pause, in milliseconds, before asking again when the server answered a long poll
35
+ * immediately because it had no slot free to wait in. Only reached when the server is short of threads,
36
+ * which is the moment to ask less often rather than more.
37
+ */
38
+ export const SLOTS_BUSY_BACKOFF_MS = 500;
39
+ /**
40
+ * How close to its deadline a long poll may come back and still count as having been waited out rather
41
+ * than answered early. Absorbs the jitter between the server's clock and this one, so an honoured wait
42
+ * is not followed by a pointless extra request for the last few milliseconds.
43
+ */
44
+ export const HONOURED_WAIT_TOLERANCE_MS = 250;
45
+ /**
46
+ * Added to a long poll's wait to give the response time to travel: the server answers at the end of the
47
+ * window it was asked for, so a timeout of exactly that window would race the network.
48
+ */
49
+ export const LONG_POLL_RESPONSE_MARGIN_MS = 10_000;
50
+ /**
51
+ * EQS's operations, on the credentials of the session that created it.
52
+ *
53
+ * Built by {@link EuclidSession.eqs} rather than directly, so that it shares that session's identity,
54
+ * namespace and connection settings - and follows them as they change.
55
+ */
56
+ export class EuclidEqs extends ModuleClient {
57
+ /**
58
+ * How long to pause before asking again when the server declined to wait out a long poll.
59
+ *
60
+ * A field rather than a constant because it is the one part of the polling a caller may reasonably
61
+ * want to change - and because nothing in a test suite wants to sit out a backoff that exists to be
62
+ * kind to a server short of threads.
63
+ */
64
+ slotsBusyBackoffMs = SLOTS_BUSY_BACKOFF_MS;
65
+ constructor(session, options = {}) {
66
+ super(session, { target: TARGET, ...options });
67
+ }
68
+ // -- queues ----------------------------------------------------------------------------------
69
+ /** Creates a queue, and answers with the ERN everything else names it by. */
70
+ async createQueue(name, options = {}) {
71
+ return toCreateQueueResult(await this.call("create-queue", {
72
+ name,
73
+ visibility: options.visibility ?? DEFAULT_VISIBILITY,
74
+ maxRetries: options.maxRetries ?? DEFAULT_MAX_RETRIES,
75
+ maxMessageLength: options.maxMessageLength ?? DEFAULT_MAX_MESSAGE_LENGTH,
76
+ dlqName: options.dlqName ?? "",
77
+ delay: options.delay ?? 0,
78
+ priority: options.priority ?? "",
79
+ internal: options.internal ?? false,
80
+ }));
81
+ }
82
+ /** Deletes a queue and everything on it. */
83
+ async deleteQueue(ern) {
84
+ await this.call("delete-queue", { ern });
85
+ }
86
+ /**
87
+ * One page of queues, and how many exist in total.
88
+ *
89
+ * euclid's own queues - the delivery queue behind a bucket listener, say - are left out unless
90
+ * `includeInternal` asks for them, so a listing shows what a person would recognise. A component
91
+ * looking for the queues it created has to ask.
92
+ */
93
+ async listQueues(options = {}) {
94
+ const payload = { ...listPayload(options, "name"), includeInternal: options.includeInternal ?? false };
95
+ return toPage(await this.call("list-queues", payload), "queues", toQueue);
96
+ }
97
+ /** The ERN of the queue of this name, in the session's account and namespace. */
98
+ async getQueueErn(name) {
99
+ return this.textOf("get-queue-ern", { name }, "ern");
100
+ }
101
+ /** Where a queue lives and how much is in it. */
102
+ async getQueueMetadata(ern) {
103
+ return toQueueMetadata(await this.call("get-queue-metadata", { ern }));
104
+ }
105
+ /** Deletes every message on a queue, leaving the queue itself in place. */
106
+ async purgeQueue(ern) {
107
+ await this.call("purge-queue", { ern });
108
+ }
109
+ /**
110
+ * Deletes every message on every queue of an account, which defaults to this session's own.
111
+ *
112
+ * Exactly as blunt as it sounds, and there is no undo: it exists for a test environment between runs
113
+ * rather than for anything that has consumers attached.
114
+ */
115
+ async purgeAllQueues(options = {}) {
116
+ await this.call("purge-all-queues", {
117
+ region: options.region || this.session.region,
118
+ accountId: options.accountId || this.session.accountId,
119
+ });
120
+ }
121
+ /**
122
+ * Stops a queue, so it hands no more messages out.
123
+ *
124
+ * Messages already in flight are left alone: their consumer took them before the queue was stopped
125
+ * and is still entitled to finish, so deleting one still works. Only new receives are refused, with
126
+ * HTTP 409.
127
+ */
128
+ async stopQueue(ern) {
129
+ return this.#setQueueStatus("stop-queue", ern);
130
+ }
131
+ /** Starts a queue that was stopped, so it hands messages out again. */
132
+ async startQueue(ern) {
133
+ return this.#setQueueStatus("start-queue", ern);
134
+ }
135
+ /**
136
+ * Changes a queue's default visibility timeout, and answers with the one it now has.
137
+ *
138
+ * Only the default changes. Messages already in flight keep the window they were given when they were
139
+ * received, so this can neither expire a lease a consumer is still working on nor hold back a message
140
+ * its consumer has already given up on.
141
+ */
142
+ async setQueueVisibility(ern, visibility) {
143
+ return this.numberOf("set-queue-visibility", { ern, visibility }, "visibility");
144
+ }
145
+ /**
146
+ * Moves messages out of a dead letter queue and back onto the queues they came from.
147
+ *
148
+ * `ern` has to name a queue that some other queue points at as its dead letter queue; an ordinary
149
+ * queue is refused rather than redriven into itself. A named `targetErn` has to be one of the queues
150
+ * that feed it, since anything else would be a move rather than a redrive.
151
+ *
152
+ * Left unnamed, each message goes back where it came from - and a message whose origin was never
153
+ * recorded is left alone rather than guessed at. The result says how many, so a caller can name a
154
+ * target and deal with them deliberately.
155
+ */
156
+ async redriveDlq(ern, targetErn = "") {
157
+ return toRedriveDlqResult(await this.call("redrive-dlq", { ern, targetErn }));
158
+ }
159
+ /** Tags a queue. */
160
+ async addQueueTag(ern, key, value) {
161
+ await this.call("add-queue-tag", { ern, key, value });
162
+ }
163
+ /** Sets the value of a tag the queue already has. */
164
+ async setQueueTag(ern, key, value) {
165
+ await this.call("set-queue-tag", { ern, key, value });
166
+ }
167
+ /** Removes a tag from a queue. */
168
+ async deleteQueueTag(ern, key) {
169
+ await this.call("delete-queue-tag", { ern, key });
170
+ }
171
+ /** stop-queue and start-queue take the same request and differ only in what they record. */
172
+ async #setQueueStatus(action, ern) {
173
+ return toQueueStatusResult(await this.call(action, { ern }));
174
+ }
175
+ // -- messages --------------------------------------------------------------------------------
176
+ /**
177
+ * Puts a message on a queue, and answers with the ID the server gave it.
178
+ *
179
+ * The envelope and the priority are left out of the request entirely when there is nothing to say
180
+ * about them, so the queue's own defaults are what apply rather than an empty string the server would
181
+ * have to interpret.
182
+ */
183
+ async sendMessage(queueErn, body, options = {}) {
184
+ const payload = {
185
+ ern: queueErn,
186
+ body,
187
+ attributes: variantMapToJson(options.attributes),
188
+ };
189
+ if (options.systemAttributes !== undefined && Object.keys(options.systemAttributes).length > 0) {
190
+ payload["systemAttributes"] = variantMapToJson(options.systemAttributes);
191
+ }
192
+ if (options.priority)
193
+ payload["priority"] = options.priority;
194
+ return this.textOf("send-message", payload, "messageId");
195
+ }
196
+ /**
197
+ * Takes up to `maxMessages` messages off a queue, waiting up to `waitTimeSeconds` for them.
198
+ *
199
+ * The waiting is the server's, not this client's: it holds the request open until a message lands or
200
+ * the time runs out, so an idle queue costs one request for the whole window rather than one per poll
201
+ * tick, and a message comes back the instant it is sent.
202
+ *
203
+ * The one case that loops is the server declining to wait. It keeps a bounded number of long-poll
204
+ * slots - one fewer than it has threads - so that consumers sitting in a wait cannot starve the
205
+ * producers trying to send to them; with none free it answers at once with whatever is on the queue.
206
+ * That comes back empty with time still on the clock, and the answer is to wait a moment and ask
207
+ * again rather than immediately, since asking again at once is what a server short of threads does not
208
+ * need.
209
+ *
210
+ * With no wait asked for, the queue's depth is checked first and an empty queue costs no receive at
211
+ * all - a receive is a write, and one that takes nothing is work the server did for nothing.
212
+ */
213
+ async receiveMessages(queueErn, options = {}) {
214
+ const maxMessages = options.maxMessages ?? 10;
215
+ const waitSeconds = options.waitTimeSeconds ?? 0;
216
+ if (waitSeconds <= 0) {
217
+ if ((await this.getMessageCount(queueErn)).available <= 0)
218
+ return { total: 0, items: [] };
219
+ return this.#receive(queueErn, maxMessages, 0);
220
+ }
221
+ const deadline = Date.now() + waitSeconds * 1000;
222
+ for (;;) {
223
+ // Rounded up rather than truncated: the wait travels in whole seconds, and a caller who asked
224
+ // for five would otherwise be given four and a round trip to ask for the fifth.
225
+ const wait = Math.max(1, Math.ceil((deadline - Date.now()) / 1000));
226
+ const result = await this.#receive(queueErn, maxMessages, wait);
227
+ if (result.items.length > 0)
228
+ return result;
229
+ const remaining = deadline - Date.now();
230
+ if (remaining <= HONOURED_WAIT_TOLERANCE_MS)
231
+ return result;
232
+ await delay(Math.min(this.slotsBusyBackoffMs, remaining));
233
+ }
234
+ }
235
+ /**
236
+ * Takes everything off a queue, a batch at a time, until it comes back empty.
237
+ *
238
+ * For draining a queue rather than for consuming one: every message comes back on a lease, so a caller
239
+ * that does not delete them will see them all again once the visibility timeout expires.
240
+ */
241
+ async receiveAllMessages(queueErn, batchSize = 10) {
242
+ const messages = [];
243
+ for (;;) {
244
+ const batch = await this.receiveMessages(queueErn, { maxMessages: batchSize });
245
+ if (batch.items.length === 0)
246
+ return messages;
247
+ messages.push(...batch.items);
248
+ }
249
+ }
250
+ /**
251
+ * One page of a queue's messages, without receiving them.
252
+ *
253
+ * A read rather than a lease: nothing here becomes invisible, nothing counts as a delivery, and
254
+ * nothing can be deleted by receipt handle afterwards. It is how a queue is inspected, not how it is
255
+ * consumed.
256
+ */
257
+ async listMessages(queueErn, options = {}) {
258
+ const payload = { queueErn, ...pagePayload(options, "created") };
259
+ return toPage(await this.call("list-messages", payload), "messages", toQueueMessage);
260
+ }
261
+ /**
262
+ * Deletes a received message, by the handle the receive handed out.
263
+ *
264
+ * The handle is a lease: this works while the message's visibility timeout is still running and fails
265
+ * once it has expired and the message has gone back on the queue.
266
+ */
267
+ async deleteMessage(receiptHandle) {
268
+ await this.call("delete-message", { receiptHandle });
269
+ }
270
+ /**
271
+ * Deletes a message by its ID, including one nobody has received.
272
+ *
273
+ * Bypasses the lease {@link deleteMessage} goes through, which is what makes it able to remove a
274
+ * message that is still waiting or still delayed. A euclid extension with no SQS equivalent.
275
+ */
276
+ async deleteMessageById(messageId) {
277
+ await this.call("delete-message", { messageId });
278
+ }
279
+ /** How many messages a queue holds, by the state they are in. */
280
+ async getMessageCount(ern) {
281
+ return toQueueMessageCount(await this.call("get-message-count", { ern }));
282
+ }
283
+ /** Everything about one message except its body. */
284
+ async getMessageMetadata(messageId) {
285
+ return toQueueMessageMetadata(await this.call("get-message-metadata", { messageId }));
286
+ }
287
+ /**
288
+ * Changes how long one message stays invisible - extending a lease a consumer needs longer.
289
+ *
290
+ * Sent as `set-message-visibility`, the name that says what it changes and pairs with
291
+ * {@link setQueueVisibility}. euclid answers to `set-visibility` as well, which is what euclid-jdk
292
+ * sends and what a server older than the newer name knows it by; such a server refuses this with
293
+ * HTTP 404, and {@link ModuleClient.call} is the way round that.
294
+ */
295
+ async setMessageVisibility(messageId, visibility) {
296
+ await this.call("set-message-visibility", { messageId, visibility });
297
+ }
298
+ /** One attribute of one message. */
299
+ async getMessageAttribute(messageId, name) {
300
+ return toQueueMessageAttribute(await this.call("get-message-attribute", { messageId, name }));
301
+ }
302
+ /**
303
+ * Sets one attribute of one message, creating it if it was not there.
304
+ *
305
+ * The attribute's name travels as `key` on this action and as `name` on the one that reads it back -
306
+ * the server's own asymmetry, reproduced rather than papered over, so that a request built from this
307
+ * SDK matches what euclid-cli and euclid-jdk send.
308
+ */
309
+ async setMessageAttribute(messageId, name, value) {
310
+ const payload = { messageId, key: name, value: variantToJson(variantOf(value)) };
311
+ return toQueueMessageAttribute(await this.call("set-message-attribute", payload));
312
+ }
313
+ // -- monitoring ------------------------------------------------------------------------------
314
+ /**
315
+ * EQS's own metrics, as the server collects them. Answered unparsed - the shape belongs to the
316
+ * monitoring module rather than to EQS.
317
+ */
318
+ async metrics() {
319
+ return this.call("get-metrics");
320
+ }
321
+ /**
322
+ * A view of this client whose requests are marked as euclid's own traffic.
323
+ *
324
+ * Some calls observe the system rather than use it: reading a queue's depth to report it, polling for
325
+ * a heartbeat. They are indistinguishable from real work by their action alone - the same
326
+ * `get-message-count` is a user's question one moment and a metric collector's poll the next - so the
327
+ * caller says which it is, and the server logs and scales accordingly. Instrumentation that polls
328
+ * every few seconds would otherwise keep a pool permanently awake and make an idle module look busy:
329
+ * the monitoring preventing the thing it exists to measure.
330
+ *
331
+ * A separate client rather than a flag on this one, so that no call has to remember to set it back -
332
+ * but the same connection, since two clients that differ by a header have no reason to differ by a
333
+ * socket. Closing either closes both, which the owning session does anyway.
334
+ */
335
+ asInternal() {
336
+ return new EuclidEqs(this.session, { client: this.client, headers: { "x-euclid-internal": "true" } });
337
+ }
338
+ // -- transport -------------------------------------------------------------------------------
339
+ /**
340
+ * One receive-messages request, held open by the server for `waitSeconds`.
341
+ *
342
+ * The client's own timeout is sized for an answer that comes straight back, so a long poll gets its
343
+ * own: the request is meant to take as long as the server was asked to hold it, and abandoning it at
344
+ * the usual deadline would abandon a request being served correctly.
345
+ */
346
+ async #receive(queueErn, maxMessages, waitSeconds) {
347
+ const timeoutMs = waitSeconds > 0 ? waitSeconds * 1000 + LONG_POLL_RESPONSE_MARGIN_MS : undefined;
348
+ const payload = { ern: queueErn, maxCount: maxMessages, waitTime: waitSeconds };
349
+ return toPage(await this.call("receive-messages", payload, timeoutMs), "messages", toQueueMessage);
350
+ }
351
+ }
352
+ function delay(milliseconds) {
353
+ return milliseconds > 0 ? new Promise((resolve) => setTimeout(resolve, milliseconds)) : Promise.resolve();
354
+ }
355
+ //# sourceMappingURL=eqs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eqs.js","sourceRoot":"","sources":["../../src/modules/eqs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAqB,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAa,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GAUnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAsC,MAAM,WAAW,CAAC;AAGvG,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC;AAE5B,gGAAgG;AAChG,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,wFAAwF;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,qDAAqD;AACrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AA0DnD;;;;;GAKG;AACH,MAAM,O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