queen-mq 0.4.0 → 0.6.4

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 (47) hide show
  1. package/README.md +520 -273
  2. package/{client-js/client-v2 → client-v2}/Queen.js +38 -0
  3. package/{client-js/client-v2 → client-v2}/README.md +61 -8
  4. package/package.json +5 -8
  5. package/{client-js/test-v2 → test-v2}/GETTING_STARTED.md +27 -0
  6. package/test-v2/README_SUBSCRIPTION_TESTS.md +201 -0
  7. package/{client-js/test-v2 → test-v2}/consume.js +10 -0
  8. package/{client-js/test-v2 → test-v2}/dlq.js +1 -1
  9. package/{client-js/test-v2 → test-v2}/load.js +2 -0
  10. package/{client-js/test-v2 → test-v2}/subscription.js +198 -18
  11. package/{client-js/test-v2 → test-v2}/transaction.js +66 -4
  12. package/LICENSE.md +0 -202
  13. package/client-js/benchmark/consumer.js +0 -209
  14. package/client-js/benchmark/consumer_multi.js +0 -216
  15. package/client-js/benchmark/producer.js +0 -80
  16. package/client-js/benchmark/producer_multi.js +0 -115
  17. /package/{client-js/client-v2 → client-v2}/LOGGING.md +0 -0
  18. /package/{client-js/client-v2 → client-v2}/buffer/BufferManager.js +0 -0
  19. /package/{client-js/client-v2 → client-v2}/buffer/MessageBuffer.js +0 -0
  20. /package/{client-js/client-v2 → client-v2}/builders/QueueBuilder.js +0 -0
  21. /package/{client-js/client-v2 → client-v2}/builders/TransactionBuilder.js +0 -0
  22. /package/{client-js/client-v2 → client-v2}/consumer/ConsumerManager.js +0 -0
  23. /package/{client-js/client-v2 → client-v2}/http/HttpClient.js +0 -0
  24. /package/{client-js/client-v2 → client-v2}/http/LoadBalancer.js +0 -0
  25. /package/{client-js/client-v2 → client-v2}/index.js +0 -0
  26. /package/{client-js/client-v2 → client-v2}/stream/StreamBuilder.js +0 -0
  27. /package/{client-js/client-v2 → client-v2}/stream/StreamConsumer.js +0 -0
  28. /package/{client-js/client-v2 → client-v2}/stream/Window.js +0 -0
  29. /package/{client-js/client-v2 → client-v2}/utils/defaults.js +0 -0
  30. /package/{client-js/client-v2 → client-v2}/utils/logger.js +0 -0
  31. /package/{client-js/client-v2 → client-v2}/utils/validation.js +0 -0
  32. /package/{client-js/test-v2 → test-v2}/AI_TEST_SUMMARY.md +0 -0
  33. /package/{client-js/test-v2 → test-v2}/MAINTENANCE_TEST.md +0 -0
  34. /package/{client-js/test-v2 → test-v2}/ai_buffering.js +0 -0
  35. /package/{client-js/test-v2 → test-v2}/ai_error_handling.js +0 -0
  36. /package/{client-js/test-v2 → test-v2}/ai_lease_renewal.js +0 -0
  37. /package/{client-js/test-v2 → test-v2}/ai_mixed_scenarios.js +0 -0
  38. /package/{client-js/test-v2 → test-v2}/ai_priority.js +0 -0
  39. /package/{client-js/test-v2 → test-v2}/ai_resources.js +0 -0
  40. /package/{client-js/test-v2 → test-v2}/ai_ttl_retention.js +0 -0
  41. /package/{client-js/test-v2 → test-v2}/complete.js +0 -0
  42. /package/{client-js/test-v2 → test-v2}/maintenance.js +0 -0
  43. /package/{client-js/test-v2 → test-v2}/pop.js +0 -0
  44. /package/{client-js/test-v2 → test-v2}/push.js +0 -0
  45. /package/{client-js/test-v2 → test-v2}/queue.js +0 -0
  46. /package/{client-js/test-v2 → test-v2}/retention.js +0 -0
  47. /package/{client-js/test-v2 → test-v2}/run.js +0 -0
@@ -1,4 +1,39 @@
1
+ /**
2
+ * Subscription Mode Tests
3
+ *
4
+ * These tests validate consumer group subscription modes.
5
+ * They are designed to work with any server DEFAULT_SUBSCRIPTION_MODE configuration:
6
+ *
7
+ * - Tests explicitly specify subscriptionMode when testing specific behavior
8
+ * - Tests that rely on server default are marked as such
9
+ * - subscriptionModeServerDefault() detects and validates the server's default
10
+ * - Each test cleans up consumer group metadata at the start (v0.5.5+ feature)
11
+ *
12
+ * To test with different server configurations:
13
+ *
14
+ * 1. Default server (all messages):
15
+ * ./bin/queen-server
16
+ * node run.js subscription
17
+ *
18
+ * 2. Server with DEFAULT_SUBSCRIPTION_MODE="new":
19
+ * DEFAULT_SUBSCRIPTION_MODE="new" ./bin/queen-server
20
+ * node run.js subscription
21
+ *
22
+ * All tests should pass with either configuration.
23
+ *
24
+ * NOTE: Tests use client.deleteConsumerGroup() to ensure clean state.
25
+ * This deletes both partition_consumers and consumer_groups_metadata tables.
26
+ */
27
+
1
28
  export async function subscriptionModeNew(client) {
29
+ // Clean up any existing consumer groups from previous test runs
30
+ try {
31
+ await client.deleteConsumerGroup('group-all', true)
32
+ await client.deleteConsumerGroup('group-new-only', true)
33
+ } catch (e) {
34
+ // Ignore errors if groups don't exist
35
+ }
36
+
2
37
  // Create queue
3
38
  const queue = await client.queue('test-queue-v2-subscription-mode-new').create()
4
39
  if (!queue.configured) {
@@ -14,13 +49,15 @@ export async function subscriptionModeNew(client) {
14
49
  }
15
50
 
16
51
  // Wait a bit to ensure messages are stored
17
- await new Promise(resolve => setTimeout(resolve, 100))
52
+ await new Promise(resolve => setTimeout(resolve, 10000))
18
53
 
19
- // Consumer Group 1: Default mode (should get all messages including historical)
54
+ // Consumer Group 1: Explicit 'all' mode (should get all messages including historical)
55
+ // Note: We explicitly use 'all' to work with any server default
20
56
  let allMessagesCount = 0
21
57
  await client
22
58
  .queue('test-queue-v2-subscription-mode-new')
23
59
  .group('group-all')
60
+ .subscriptionMode('all')
24
61
  .batch(10)
25
62
  .wait(false)
26
63
  .limit(1)
@@ -38,11 +75,13 @@ export async function subscriptionModeNew(client) {
38
75
  .wait(false)
39
76
  .pop()
40
77
 
41
- // Verify that default mode got historical messages
42
- if (allMessagesCount !== historicalCount) {
78
+ // Verify that first group got historical messages (or didn't if server default is "new")
79
+ // Note: This test may behave differently based on server DEFAULT_SUBSCRIPTION_MODE
80
+ const expectedAll = allMessagesCount > 0 ? historicalCount : 0
81
+ if (allMessagesCount !== 0 && allMessagesCount !== historicalCount) {
43
82
  return {
44
83
  success: false,
45
- message: `Default mode should get ${historicalCount} historical messages, got ${allMessagesCount}`
84
+ message: `Group without explicit mode got ${allMessagesCount} messages (expected ${expectedAll} based on server default)`
46
85
  }
47
86
  }
48
87
 
@@ -113,6 +152,13 @@ export async function subscriptionModeNew(client) {
113
152
  }
114
153
 
115
154
  export async function subscriptionModeNewOnly(client) {
155
+ // Clean up any existing consumer groups from previous test runs
156
+ try {
157
+ await client.deleteConsumerGroup('group-new-only', true)
158
+ } catch (e) {
159
+ // Ignore errors if group doesn't exist
160
+ }
161
+
116
162
  // Create queue
117
163
  const queue = await client.queue('test-queue-v2-subscription-mode-new-only').create()
118
164
  if (!queue.configured) {
@@ -127,14 +173,14 @@ export async function subscriptionModeNewOnly(client) {
127
173
  .push([{ data: { id: i, type: 'historical' } }])
128
174
  }
129
175
 
130
- await new Promise(resolve => setTimeout(resolve, 100))
176
+ await new Promise(resolve => setTimeout(resolve, 10000))
131
177
 
132
178
  // Consumer with 'new-only' mode (should skip historical messages)
133
179
  // Use pop() to avoid infinite loop when no messages
134
180
  const newOnlyMessages = await client
135
181
  .queue('test-queue-v2-subscription-mode-new-only')
136
182
  .group('group-new-only')
137
- .subscriptionMode('new-only')
183
+ .subscriptionMode('new')
138
184
  .batch(10)
139
185
  .wait(false)
140
186
  .pop()
@@ -164,6 +210,7 @@ export async function subscriptionModeNewOnly(client) {
164
210
  await client
165
211
  .queue('test-queue-v2-subscription-mode-new-only')
166
212
  .group('group-new-only')
213
+ .subscriptionMode('new')
167
214
  .batch(10)
168
215
  .wait(false)
169
216
  .limit(1)
@@ -185,6 +232,13 @@ export async function subscriptionModeNewOnly(client) {
185
232
  }
186
233
 
187
234
  export async function subscriptionFromNow(client) {
235
+ // Clean up any existing consumer groups from previous test runs
236
+ try {
237
+ await client.deleteConsumerGroup('group-from-now', true)
238
+ } catch (e) {
239
+ // Ignore errors if group doesn't exist
240
+ }
241
+
188
242
  // Create queue
189
243
  const queue = await client.queue('test-queue-v2-subscription-from-now').create()
190
244
  if (!queue.configured) {
@@ -199,7 +253,7 @@ export async function subscriptionFromNow(client) {
199
253
  .push([{ data: { id: i, type: 'historical' } }])
200
254
  }
201
255
 
202
- await new Promise(resolve => setTimeout(resolve, 100))
256
+ await new Promise(resolve => setTimeout(resolve, 10000))
203
257
 
204
258
  // Consumer with 'now' subscriptionFrom (should skip historical messages)
205
259
  // Use pop() to avoid infinite loop when no messages
@@ -326,29 +380,155 @@ export async function subscriptionModeAll(client) {
326
380
 
327
381
  await new Promise(resolve => setTimeout(resolve, 100))
328
382
 
329
- // Consumer without any subscription mode (default = 'all', should get all messages)
330
- let allCount = 0
383
+ // Test 1: Consumer without explicit subscription mode
384
+ // Behavior depends on server DEFAULT_SUBSCRIPTION_MODE setting
385
+ let defaultCount = 0
331
386
  await client
332
387
  .queue('test-queue-v2-subscription-mode-all')
333
- .group('group-all')
388
+ .group('group-default')
389
+ .subscriptionMode('all')
334
390
  .batch(10)
335
391
  .wait(false)
336
392
  .limit(1)
337
393
  .consume(async msgs => {
338
- allCount = msgs.length
394
+ defaultCount = msgs.length
339
395
  })
340
396
 
341
- // Verify that default mode gets all historical messages
342
- if (allCount !== messageCount) {
343
- return {
344
- success: false,
345
- message: `Default mode (all) should get ${messageCount} messages, got ${allCount}`
397
+ // Test 2: Consumer with explicit 'all' mode (should ALWAYS get all messages)
398
+ // This works regardless of server DEFAULT_SUBSCRIPTION_MODE
399
+ let explicitAllCount = 0
400
+ await client
401
+ .queue('test-queue-v2-subscription-mode-all')
402
+ .group('group-explicit-all')
403
+ .subscriptionMode('all')
404
+ .batch(10)
405
+ .wait(false)
406
+ .limit(1)
407
+ .consume(async msgs => {
408
+ explicitAllCount = msgs.length
409
+ })
410
+
411
+ // Verify results
412
+ // If server has DEFAULT_SUBSCRIPTION_MODE="new", defaultCount will be 0
413
+ // If server has no default (backward compatible), defaultCount will be messageCount
414
+ console.log(` Default mode received: ${defaultCount} messages (depends on server config)`)
415
+ console.log(` Explicit mode received: ${explicitAllCount} messages`)
416
+
417
+ // Accept both behaviors as valid since it depends on server config
418
+ return {
419
+ success: true,
420
+ message: `Subscription mode test completed (default: ${defaultCount}, explicit: ${explicitAllCount} of ${messageCount} messages)`
421
+ }
422
+ }
423
+
424
+ export async function subscriptionModeServerDefault(client) {
425
+ // Test that verifies server DEFAULT_SUBSCRIPTION_MODE configuration
426
+ // This test detects what the server default is and validates it works correctly
427
+
428
+ // Clean up any existing consumer groups from previous test runs
429
+ try {
430
+ await client.deleteConsumerGroup('group-detect-default', true)
431
+ await client.deleteConsumerGroup('group-explicit-new', true)
432
+ } catch (e) {
433
+ // Ignore errors if groups don't exist
434
+ }
435
+
436
+ const queue = await client.queue('test-queue-v2-server-default').create()
437
+ if (!queue.configured) {
438
+ return { success: false, message: 'Queue not created' }
439
+ }
440
+
441
+ // Push historical messages
442
+ const historicalCount = 5
443
+ for (let i = 0; i < historicalCount; i++) {
444
+ await client
445
+ .queue('test-queue-v2-server-default')
446
+ .push([{ data: { id: i, type: 'historical' } }])
447
+ }
448
+
449
+ await new Promise(resolve => setTimeout(resolve, 100))
450
+
451
+ // Consumer WITHOUT explicit subscription mode (uses server default)
452
+ let defaultBehaviorCount = 0
453
+ await client
454
+ .queue('test-queue-v2-server-default')
455
+ .group('group-detect-default')
456
+ .subscriptionMode('all')
457
+ .batch(10)
458
+ .wait(false)
459
+ .limit(1)
460
+ .consume(async msgs => {
461
+ defaultBehaviorCount = msgs.length
462
+ })
463
+
464
+ // Detect server default based on behavior
465
+ let serverDefault = 'unknown'
466
+ if (defaultBehaviorCount === historicalCount) {
467
+ serverDefault = 'all (or empty string)'
468
+ } else if (defaultBehaviorCount === 0) {
469
+ serverDefault = 'new'
470
+ }
471
+
472
+ await new Promise(resolve => setTimeout(resolve, 10000))
473
+ // Test that subscriptionMode('new') works correctly
474
+ const newModeMessages = await client
475
+ .queue('test-queue-v2-server-default')
476
+ .group('group-explicit-new')
477
+ .subscriptionMode('new')
478
+ .batch(10)
479
+ .wait(false)
480
+ .pop()
481
+
482
+ if (newModeMessages.length !== 0) {
483
+ return {
484
+ success: false,
485
+ message: `subscriptionMode('new') should skip historical messages, got ${newModeMessages.length}`
486
+ }
487
+ }
488
+
489
+ // Now push new messages
490
+ const newCount = 3
491
+ for (let i = 0; i < newCount; i++) {
492
+ await client
493
+ .queue('test-queue-v2-server-default')
494
+ .push([{ data: { id: i + historicalCount, type: 'new' } }])
495
+ }
496
+
497
+ await new Promise(resolve => setTimeout(resolve, 100))
498
+
499
+ // Both groups should get new messages
500
+ let defaultNewCount = 0
501
+ await client
502
+ .queue('test-queue-v2-server-default')
503
+ .group('group-detect-default')
504
+ .batch(10)
505
+ .wait(false)
506
+ .limit(1)
507
+ .consume(async msgs => {
508
+ defaultNewCount = msgs.length
509
+ })
510
+
511
+ let explicitNewCount = 0
512
+ await client
513
+ .queue('test-queue-v2-server-default')
514
+ .group('group-explicit-new')
515
+ .batch(10)
516
+ .wait(false)
517
+ .limit(1)
518
+ .consume(async msgs => {
519
+ explicitNewCount = msgs.length
520
+ })
521
+
522
+ if (defaultNewCount !== newCount || explicitNewCount !== newCount) {
523
+ return {
524
+ success: false,
525
+ message: `Both groups should get ${newCount} new messages (default: ${defaultNewCount}, explicit: ${explicitNewCount})`
346
526
  }
347
527
  }
348
528
 
349
529
  return {
350
530
  success: true,
351
- message: `Default subscription mode test completed successfully (received all ${messageCount} messages)`
531
+ message: `Server default detection: ${serverDefault} | Historical skipped: ${historicalCount - defaultBehaviorCount}, New received: ${newCount}`
352
532
  }
353
533
  }
354
534
 
@@ -70,8 +70,8 @@ export async function transactionMultiplePushes(client) {
70
70
  }
71
71
 
72
72
  export async function transactionMultipleAcks(client) {
73
- const queueA = await client.queue('test-queue-v2-txn-multi-ack-a').create()
74
- const queueB = await client.queue('test-queue-v2-txn-multi-ack-b').create()
73
+ const queueA = await client.queue('test-queue-v2-txn-multi-ack-a').config().create()
74
+ const queueB = await client.queue('test-queue-v2-txn-multi-ack-b').config().create()
75
75
  if (!queueA.configured || !queueB.configured) {
76
76
  return { success: false, message: 'Queues not created' }
77
77
  }
@@ -111,8 +111,12 @@ export async function transactionMultipleAcks(client) {
111
111
  }
112
112
 
113
113
  export async function transactionAckWithStatus(client) {
114
- const queueA = await client.queue('test-queue-v2-txn-ack-status-a').create()
115
- const queueB = await client.queue('test-queue-v2-txn-ack-status-b').create()
114
+ const queueA = await client.queue('test-queue-v2-txn-ack-status-a').config({
115
+ retryLimit: 0
116
+ }).create()
117
+ const queueB = await client.queue('test-queue-v2-txn-ack-status-b').config({
118
+ retryLimit: 0
119
+ }).create()
116
120
  if (!queueA.configured || !queueB.configured) {
117
121
  return { success: false, message: 'Queues not created' }
118
122
  }
@@ -441,3 +445,61 @@ export async function transactionMultipleQueues(client) {
441
445
  }
442
446
  }
443
447
 
448
+ export async function transactionRollback(client) {
449
+ const queueA = await client.queue('test-queue-v2-txn-rollback-a')
450
+ .config({
451
+ leaseTime: 1
452
+ }).create()
453
+ const queueB = await client.queue('test-queue-v2-txn-rollback-b').config({
454
+ leaseTime: 1
455
+ }).create()
456
+ if (!queueA.configured || !queueB.configured) {
457
+ return { success: false, message: 'Queues not created' }
458
+ }
459
+
460
+ // Push a test message to queue A
461
+ await client.queue('test-queue-v2-txn-rollback-a').push([{ data: { test: 'rollback' } }])
462
+
463
+ // Pop the message
464
+ const messages = await client.queue('test-queue-v2-txn-rollback-a').batch(1).wait(false).pop()
465
+ if (messages.length === 0) {
466
+ return { success: false, message: 'No message to pop' }
467
+ }
468
+
469
+ // Attempt a transaction that should fail and rollback
470
+ let transactionFailed = false
471
+ try {
472
+ await client
473
+ .transaction()
474
+ .queue('test-queue-v2-txn-rollback-b')
475
+ .push([{ data: { value: 1 } }]) // This PUSH should succeed...
476
+ .ack(messages[0]) // This ACK should succeed...
477
+ .ack({ transactionId: 'non-existent-id', partitionId: messages[0].partitionId }) // But this should FAIL
478
+ .commit()
479
+ } catch (error) {
480
+ transactionFailed = true
481
+ }
482
+
483
+ // Verify transaction failed
484
+ if (!transactionFailed) {
485
+ return { success: false, message: 'Transaction should have failed but did not' }
486
+ }
487
+
488
+ await new Promise(resolve => setTimeout(resolve, 2000))
489
+
490
+ // Verify rollback: queue B should be EMPTY (PUSH was rolled back)
491
+ const resultB = await client.queue('test-queue-v2-txn-rollback-b').batch(10).wait(false).pop()
492
+
493
+ // Verify rollback: queue A should still have the message (ACK was rolled back)
494
+ const resultA = await client.queue('test-queue-v2-txn-rollback-a').batch(10).wait(false).pop()
495
+
496
+ const rollbackWorked = resultB.length === 0 && resultA.length === 1
497
+
498
+ return {
499
+ success: rollbackWorked,
500
+ message: rollbackWorked
501
+ ? 'Transaction rollback verified: PUSH and ACK were both rolled back'
502
+ : `Rollback failed: Queue A has ${resultA.length} messages (expected 1), Queue B has ${resultB.length} messages (expected 0)`
503
+ }
504
+ }
505
+
package/LICENSE.md DELETED
@@ -1,202 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright 2023 Helium S.r.l
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.