@zone-eu/zonemta-delivery-counters 0.0.0-stage → 1.0.2

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.
package/.eslintrc.js ADDED
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ rules: {
5
+ indent: [2, 4, {
6
+ SwitchCase: 1
7
+ }],
8
+ quotes: [2, 'single'],
9
+ 'linebreak-style': [2, 'unix'],
10
+ semi: [2, 'always'],
11
+ strict: [2, 'global'],
12
+ eqeqeq: 2,
13
+ 'dot-notation': 2,
14
+ curly: 2,
15
+ 'no-fallthrough': 2,
16
+ 'quote-props': [2, 'as-needed'],
17
+ 'no-unused-expressions': [2, {
18
+ allowShortCircuit: true
19
+ }],
20
+ 'no-unused-vars': 2,
21
+ 'no-undefined': 2,
22
+ 'handle-callback-err': 2,
23
+ 'no-new': 2,
24
+ 'new-cap': 2,
25
+ 'no-eval': 2,
26
+ 'no-invalid-this': 2,
27
+ radix: [2, 'always'],
28
+ 'no-use-before-define': [2, 'nofunc'],
29
+ 'callback-return': [2, ['callback', 'cb', 'done']],
30
+ 'comma-dangle': [2, 'never'],
31
+ 'comma-style': [2, 'last'],
32
+ 'no-regex-spaces': 2,
33
+ 'no-empty': 2,
34
+ 'no-duplicate-case': 2,
35
+ 'no-empty-character-class': 2,
36
+ 'no-redeclare': [2, {
37
+ builtinGlobals: true
38
+ }],
39
+ 'block-scoped-var': 2,
40
+ 'no-sequences': 2,
41
+ 'no-throw-literal': 2,
42
+ 'no-useless-call': 2,
43
+ 'no-useless-concat': 2,
44
+ 'no-void': 2,
45
+ yoda: 2,
46
+ 'no-undef': 2,
47
+ 'global-require': 2,
48
+ 'no-var': 2,
49
+ 'no-bitwise': 2,
50
+ 'no-lonely-if': 2,
51
+ 'no-mixed-spaces-and-tabs': 2,
52
+ 'arrow-body-style': [2, 'as-needed'],
53
+ 'arrow-parens': [2, 'as-needed'],
54
+ 'prefer-arrow-callback': 2,
55
+ 'object-shorthand': 2,
56
+ 'prefer-spread': 2
57
+ },
58
+ env: {
59
+ es6: true,
60
+ node: true
61
+ },
62
+ extends: 'eslint:recommended',
63
+ globals: {
64
+ it: true,
65
+ describe: true,
66
+ beforeEach: true,
67
+ afterEach: true
68
+ },
69
+ fix: true
70
+ };
package/LICENSE ADDED
@@ -0,0 +1,287 @@
1
+  EUROPEAN UNION PUBLIC LICENCE v. 1.2
2
+ EUPL © the European Union 2007, 2016
3
+
4
+ This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
5
+ below) which is provided under the terms of this Licence. Any use of the Work,
6
+ other than as authorised under this Licence is prohibited (to the extent such
7
+ use is covered by a right of the copyright holder of the Work).
8
+
9
+ The Work is provided under the terms of this Licence when the Licensor (as
10
+ defined below) has placed the following notice immediately following the
11
+ copyright notice for the Work:
12
+
13
+ Licensed under the EUPL
14
+
15
+ or has expressed by any other means his willingness to license under the EUPL.
16
+
17
+ 1. Definitions
18
+
19
+ In this Licence, the following terms have the following meaning:
20
+
21
+ - ‘The Licence’: this Licence.
22
+
23
+ - ‘The Original Work’: the work or software distributed or communicated by the
24
+ Licensor under this Licence, available as Source Code and also as Executable
25
+ Code as the case may be.
26
+
27
+ - ‘Derivative Works’: the works or software that could be created by the
28
+ Licensee, based upon the Original Work or modifications thereof. This Licence
29
+ does not define the extent of modification or dependence on the Original Work
30
+ required in order to classify a work as a Derivative Work; this extent is
31
+ determined by copyright law applicable in the country mentioned in Article 15.
32
+
33
+ - ‘The Work’: the Original Work or its Derivative Works.
34
+
35
+ - ‘The Source Code’: the human-readable form of the Work which is the most
36
+ convenient for people to study and modify.
37
+
38
+ - ‘The Executable Code’: any code which has generally been compiled and which is
39
+ meant to be interpreted by a computer as a program.
40
+
41
+ - ‘The Licensor’: the natural or legal person that distributes or communicates
42
+ the Work under the Licence.
43
+
44
+ - ‘Contributor(s)’: any natural or legal person who modifies the Work under the
45
+ Licence, or otherwise contributes to the creation of a Derivative Work.
46
+
47
+ - ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
48
+ the Work under the terms of the Licence.
49
+
50
+ - ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
51
+ renting, distributing, communicating, transmitting, or otherwise making
52
+ available, online or offline, copies of the Work or providing access to its
53
+ essential functionalities at the disposal of any other natural or legal
54
+ person.
55
+
56
+ 2. Scope of the rights granted by the Licence
57
+
58
+ The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
59
+ sublicensable licence to do the following, for the duration of copyright vested
60
+ in the Original Work:
61
+
62
+ - use the Work in any circumstance and for all usage,
63
+ - reproduce the Work,
64
+ - modify the Work, and make Derivative Works based upon the Work,
65
+ - communicate to the public, including the right to make available or display
66
+ the Work or copies thereof to the public and perform publicly, as the case may
67
+ be, the Work,
68
+ - distribute the Work or copies thereof,
69
+ - lend and rent the Work or copies thereof,
70
+ - sublicense rights in the Work or copies thereof.
71
+
72
+ Those rights can be exercised on any media, supports and formats, whether now
73
+ known or later invented, as far as the applicable law permits so.
74
+
75
+ In the countries where moral rights apply, the Licensor waives his right to
76
+ exercise his moral right to the extent allowed by law in order to make effective
77
+ the licence of the economic rights here above listed.
78
+
79
+ The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
80
+ any patents held by the Licensor, to the extent necessary to make use of the
81
+ rights granted on the Work under this Licence.
82
+
83
+ 3. Communication of the Source Code
84
+
85
+ The Licensor may provide the Work either in its Source Code form, or as
86
+ Executable Code. If the Work is provided as Executable Code, the Licensor
87
+ provides in addition a machine-readable copy of the Source Code of the Work
88
+ along with each copy of the Work that the Licensor distributes or indicates, in
89
+ a notice following the copyright notice attached to the Work, a repository where
90
+ the Source Code is easily and freely accessible for as long as the Licensor
91
+ continues to distribute or communicate the Work.
92
+
93
+ 4. Limitations on copyright
94
+
95
+ Nothing in this Licence is intended to deprive the Licensee of the benefits from
96
+ any exception or limitation to the exclusive rights of the rights owners in the
97
+ Work, of the exhaustion of those rights or of other applicable limitations
98
+ thereto.
99
+
100
+ 5. Obligations of the Licensee
101
+
102
+ The grant of the rights mentioned above is subject to some restrictions and
103
+ obligations imposed on the Licensee. Those obligations are the following:
104
+
105
+ Attribution right: The Licensee shall keep intact all copyright, patent or
106
+ trademarks notices and all notices that refer to the Licence and to the
107
+ disclaimer of warranties. The Licensee must include a copy of such notices and a
108
+ copy of the Licence with every copy of the Work he/she distributes or
109
+ communicates. The Licensee must cause any Derivative Work to carry prominent
110
+ notices stating that the Work has been modified and the date of modification.
111
+
112
+ Copyleft clause: If the Licensee distributes or communicates copies of the
113
+ Original Works or Derivative Works, this Distribution or Communication will be
114
+ done under the terms of this Licence or of a later version of this Licence
115
+ unless the Original Work is expressly distributed only under this version of the
116
+ Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
117
+ (becoming Licensor) cannot offer or impose any additional terms or conditions on
118
+ the Work or Derivative Work that alter or restrict the terms of the Licence.
119
+
120
+ Compatibility clause: If the Licensee Distributes or Communicates Derivative
121
+ Works or copies thereof based upon both the Work and another work licensed under
122
+ a Compatible Licence, this Distribution or Communication can be done under the
123
+ terms of this Compatible Licence. For the sake of this clause, ‘Compatible
124
+ Licence’ refers to the licences listed in the appendix attached to this Licence.
125
+ Should the Licensee's obligations under the Compatible Licence conflict with
126
+ his/her obligations under this Licence, the obligations of the Compatible
127
+ Licence shall prevail.
128
+
129
+ Provision of Source Code: When distributing or communicating copies of the Work,
130
+ the Licensee will provide a machine-readable copy of the Source Code or indicate
131
+ a repository where this Source will be easily and freely available for as long
132
+ as the Licensee continues to distribute or communicate the Work.
133
+
134
+ Legal Protection: This Licence does not grant permission to use the trade names,
135
+ trademarks, service marks, or names of the Licensor, except as required for
136
+ reasonable and customary use in describing the origin of the Work and
137
+ reproducing the content of the copyright notice.
138
+
139
+ 6. Chain of Authorship
140
+
141
+ The original Licensor warrants that the copyright in the Original Work granted
142
+ hereunder is owned by him/her or licensed to him/her and that he/she has the
143
+ power and authority to grant the Licence.
144
+
145
+ Each Contributor warrants that the copyright in the modifications he/she brings
146
+ to the Work are owned by him/her or licensed to him/her and that he/she has the
147
+ power and authority to grant the Licence.
148
+
149
+ Each time You accept the Licence, the original Licensor and subsequent
150
+ Contributors grant You a licence to their contributions to the Work, under the
151
+ terms of this Licence.
152
+
153
+ 7. Disclaimer of Warranty
154
+
155
+ The Work is a work in progress, which is continuously improved by numerous
156
+ Contributors. It is not a finished work and may therefore contain defects or
157
+ ‘bugs’ inherent to this type of development.
158
+
159
+ For the above reason, the Work is provided under the Licence on an ‘as is’ basis
160
+ and without warranties of any kind concerning the Work, including without
161
+ limitation merchantability, fitness for a particular purpose, absence of defects
162
+ or errors, accuracy, non-infringement of intellectual property rights other than
163
+ copyright as stated in Article 6 of this Licence.
164
+
165
+ This disclaimer of warranty is an essential part of the Licence and a condition
166
+ for the grant of any rights to the Work.
167
+
168
+ 8. Disclaimer of Liability
169
+
170
+ Except in the cases of wilful misconduct or damages directly caused to natural
171
+ persons, the Licensor will in no event be liable for any direct or indirect,
172
+ material or moral, damages of any kind, arising out of the Licence or of the use
173
+ of the Work, including without limitation, damages for loss of goodwill, work
174
+ stoppage, computer failure or malfunction, loss of data or any commercial
175
+ damage, even if the Licensor has been advised of the possibility of such damage.
176
+ However, the Licensor will be liable under statutory product liability laws as
177
+ far such laws apply to the Work.
178
+
179
+ 9. Additional agreements
180
+
181
+ While distributing the Work, You may choose to conclude an additional agreement,
182
+ defining obligations or services consistent with this Licence. However, if
183
+ accepting obligations, You may act only on your own behalf and on your sole
184
+ responsibility, not on behalf of the original Licensor or any other Contributor,
185
+ and only if You agree to indemnify, defend, and hold each Contributor harmless
186
+ for any liability incurred by, or claims asserted against such Contributor by
187
+ the fact You have accepted any warranty or additional liability.
188
+
189
+ 10. Acceptance of the Licence
190
+
191
+ The provisions of this Licence can be accepted by clicking on an icon ‘I agree’
192
+ placed under the bottom of a window displaying the text of this Licence or by
193
+ affirming consent in any other similar way, in accordance with the rules of
194
+ applicable law. Clicking on that icon indicates your clear and irrevocable
195
+ acceptance of this Licence and all of its terms and conditions.
196
+
197
+ Similarly, you irrevocably accept this Licence and all of its terms and
198
+ conditions by exercising any rights granted to You by Article 2 of this Licence,
199
+ such as the use of the Work, the creation by You of a Derivative Work or the
200
+ Distribution or Communication by You of the Work or copies thereof.
201
+
202
+ 11. Information to the public
203
+
204
+ In case of any Distribution or Communication of the Work by means of electronic
205
+ communication by You (for example, by offering to download the Work from a
206
+ remote location) the distribution channel or media (for example, a website) must
207
+ at least provide to the public the information requested by the applicable law
208
+ regarding the Licensor, the Licence and the way it may be accessible, concluded,
209
+ stored and reproduced by the Licensee.
210
+
211
+ 12. Termination of the Licence
212
+
213
+ The Licence and the rights granted hereunder will terminate automatically upon
214
+ any breach by the Licensee of the terms of the Licence.
215
+
216
+ Such a termination will not terminate the licences of any person who has
217
+ received the Work from the Licensee under the Licence, provided such persons
218
+ remain in full compliance with the Licence.
219
+
220
+ 13. Miscellaneous
221
+
222
+ Without prejudice of Article 9 above, the Licence represents the complete
223
+ agreement between the Parties as to the Work.
224
+
225
+ If any provision of the Licence is invalid or unenforceable under applicable
226
+ law, this will not affect the validity or enforceability of the Licence as a
227
+ whole. Such provision will be construed or reformed so as necessary to make it
228
+ valid and enforceable.
229
+
230
+ The European Commission may publish other linguistic versions or new versions of
231
+ this Licence or updated versions of the Appendix, so far this is required and
232
+ reasonable, without reducing the scope of the rights granted by the Licence. New
233
+ versions of the Licence will be published with a unique version number.
234
+
235
+ All linguistic versions of this Licence, approved by the European Commission,
236
+ have identical value. Parties can take advantage of the linguistic version of
237
+ their choice.
238
+
239
+ 14. Jurisdiction
240
+
241
+ Without prejudice to specific agreement between parties,
242
+
243
+ - any litigation resulting from the interpretation of this License, arising
244
+ between the European Union institutions, bodies, offices or agencies, as a
245
+ Licensor, and any Licensee, will be subject to the jurisdiction of the Court
246
+ of Justice of the European Union, as laid down in article 272 of the Treaty on
247
+ the Functioning of the European Union,
248
+
249
+ - any litigation arising between other parties and resulting from the
250
+ interpretation of this License, will be subject to the exclusive jurisdiction
251
+ of the competent court where the Licensor resides or conducts its primary
252
+ business.
253
+
254
+ 15. Applicable Law
255
+
256
+ Without prejudice to specific agreement between parties,
257
+
258
+ - this Licence shall be governed by the law of the European Union Member State
259
+ where the Licensor has his seat, resides or has his registered office,
260
+
261
+ - this licence shall be governed by Belgian law if the Licensor has no seat,
262
+ residence or registered office inside a European Union Member State.
263
+
264
+ Appendix
265
+
266
+ ‘Compatible Licences’ according to Article 5 EUPL are:
267
+
268
+ - GNU General Public License (GPL) v. 2, v. 3
269
+ - GNU Affero General Public License (AGPL) v. 3
270
+ - Open Software License (OSL) v. 2.1, v. 3.0
271
+ - Eclipse Public License (EPL) v. 1.0
272
+ - CeCILL v. 2.0, v. 2.1
273
+ - Mozilla Public Licence (MPL) v. 2
274
+ - GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
275
+ - Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
276
+ works other than software
277
+ - European Union Public Licence (EUPL) v. 1.1, v. 1.2
278
+ - Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
279
+ Reciprocity (LiLiQ-R+).
280
+
281
+ The European Commission may update this Appendix to later versions of the above
282
+ licences without producing a new version of the EUPL, as long as they provide
283
+ the rights granted in Article 2 of this Licence and protect the covered Source
284
+ Code from exclusive appropriation.
285
+
286
+ All other changes or additions to this Appendix require the production of a new
287
+ EUPL version.
package/LICENSE_ET ADDED
@@ -0,0 +1,97 @@
1
+ EUROOPA LIIDU TARKVARA VABA KASUTUSE LITSENTS v. 1.2
2
+ EUPL © Euroopa Liit 2007, 2016
3
+ Euroopa Liidu tarkvara vaba kasutuse litsents („EUPL“) kehtib allpool määratletud teose suhtes, mida levitatakse vastavalt käesoleva litsentsi tingimustele. Teost on keelatud kasutada muul viisil kui vastavalt käesoleva litsentsi tingimustele niivõrd, kuivõrd sellise kasutamise suhtes kehtivad teose autoriõiguse omaja õigused). Teost levitatakse vastavalt käesoleva litsentsi tingimustele, kui allpool määratletud litsentsiandja paneb vahetult teose autoriõiguse märke järele järgmise märke:
4
+ Litsentsitud EUPL alusel
5
+ või on muul viisil väljendanud soovi litsentsida originaalteos EUPL alusel.
6
+
7
+ 1.Mõisted
8
+ Käesolevas litsentsis kasutatakse järgmisi mõisteid:
9
+ — „litsents“–käesolev litsents;
10
+ — „originaalteos“–teos või tarkvara, mida litsentsiandja käesoleva litsentsi alusel levitab või edastab ning mis on kättesaadav lähtekoodina ja teatavatel juhtudel ka täitmiskoodina;
11
+ — „tuletatud teos“–teos või tarkvara, mida litsentsisaajal on olnud võimalik luua tuginedes originaalteosele või selle muudetud versioonile. Käesolevas litsentsis ei määratleta muudatuse ulatust või sõltuvust originaalteosest, mis on vajalik selleks, et klassifitseerida teos tuletatud teoseks; selline ulatus määratakse kindlaks vastavalt artiklis 15 nimetatud riigis kehtivatele autoriõigust käsitlevatele õigusaktidele;
12
+ — „teos“–originaalteos või sellest tuletatud teosed;
13
+ — „lähtekood“–teose inimloetav vorm, mida inimestel on kõige lihtsam uurida ja muuta;
14
+ — „täitmiskood“–igasugune kood, mille on tavaliselt koostanud arvuti ja mis on mõeldud arvuti poolt programmina tõlgendamiseks;
15
+ — „litsentsiandja“–füüsiline või juriidiline isik, kes levitab või edastab teost litsentsi alusel;
16
+ — „edasiarendaja“–füüsiline või juriidiline isik, kes muudab teost litsentsi alusel või osaleb muul moel tuletatud teose loomises;
17
+ — „litsentsisaaja“ või „Teie“–iga füüsiline või juriidiline isik, kes kasutab teost ükskõik mis moel vastavalt litsentsi tingimustele;
18
+ — „levitamine“ või „edastamine“–teose koopiate müümine, teisele isikule andmine, laenutamine, rentimine, levitamine, edastamine, ülekandmine või teose koopiate või selle oluliste funktsioonide muul viisil teistele füüsilistele või juriidilistele isikutele kättesaadavaks tegemine võrgus või võrguväliselt.
19
+
20
+ 2.Litsentsiga antavate õiguste ulatus
21
+ Käesolevaga annab litsentsiandja Teile ülemaailmse, tasuta, all-litsentsi andmise õigusega lihtlitsentsi, mille alusel võite teha originaalteose autoriõiguse kehtivusaja jooksul järgmist:
22
+ — kasutada teost mis tahes eesmärgil ja mis tahes viisil,
23
+ — teost reprodutseerida,
24
+ — teost muuta ja luua teosel põhinevaid tuletatud teoseid,
25
+ — teost või selle koopiaid üldsusele edastada, sealhulgas neid kättesaadavaks teha või eksponeerida, samuti avalikult esitada,
26
+ — teost või selle koopiaid levitada,
27
+ — teost või selle koopiaid laenutada ja rentida,
28
+ — anda all-litsentse teose või selle koopiate suhtes kehtivate õiguste kohta.
29
+ Neid õigusi võib teostada mistahes praegu tuntud või hiljem leiutatud keskkonnas, toel või formaadis, ja sellises ulatuses, nagu lubab kohaldatav õigus. Riikides, kus kehtivad isiklikud õigused, loobub litsentsiandja seadusega lubatud ulatuses oma õigusest teostada isiklikke õigusi, et oleks võimalik eespool loetletud varalisi õigusi litsentsida. Litsentsiandja annab litsentsisaajale tasuta lihtlitsentsi kõigi litsentsiandjale kuuluvate patentide kasutamiseks ulatuses, mis on vajalik teose suhtes käesoleva litsentsiga antud õiguste kasutamiseks.
30
+
31
+ 3.Lähtekoodi edastamine
32
+ Litsentsiandja võib teose kättesaadavaks teha kas lähtekoodi või täitmiskoodi kujul. Kui teos tehakse kättesaadavaks täitmiskoodi kujul, lisab litsentsiandja igale tema poolt levitatavale teose koopiale lähtekoodi masinloetava koopia või näitab teose autoriõiguse märke järele lisatud märkega ära hoidla, kust lähtekood on kergesti ja tasuta kättesaadav seni, kuni litsentsiandja jätkab teose levitamist või edastamist.
33
+
34
+ 4.Autoriõiguse piiramine
35
+ Käesolev litsents ei võta litsentsisaajalt võimalusi, mis tulenevad teose õiguste omaja ainuõiguste suhtes kehtestatud eranditest või ainuõiguste piiramisest, nende õiguste ammendumisest või muudest nende õiguste suhtes kohaldatavatest piirangutest.
36
+
37
+ 5.Litsentsisaaja kohustused
38
+ Eespool nimetatud õigused antakse litsentsisaajale tingimusel, et ta peab kinni teatavatest piirangutest ja täidab teatavaid talle pandud kohustusi. Need kohustused on järgmised:
39
+
40
+ Õigus autorsusele. Litsentsisaaja hoiab puutumatuna kõik autoriõiguse, patentide ja kaubamärkide kohta käivad märked ja kõik märked, mis viitavad litsentsile ja garantii puudumisele. Litsentsisaaja peab teose iga tema poolt levitatavale või edastatavale koopiale lisama nimetatud märgete koopiad ja litsentsi koopia. Litsentsisaaja peab tagama, et iga tuletatud teos kannab selget märget selle kohta, et teost on muudetud ja muutmise kuupäeva.
41
+
42
+ Klausel vaba kasutamise tagamise kohta (copyleft). Kui litsentsisaaja levitab või edastab originaalteose või tuletatud teoste koopiaid, toimub see levitamine või edastamine vastavalt käesoleva litsentsi tingimustele või käesoleva litsentsi hilisema versiooni tingimustele, välja arvatud juhul, kui originaalteost levitatakse ainult vastavalt litsentsi käesolevale versioonile (näiteks märkides „ainult EUPL v.1.2“). Litsentsisaaja ei tohi (litsentsiandjaks saades) teosele või tuletatud teosele lisada ega kehtestada mingeid lisatingimusi, mis muudavad või piiravad litsentsi tingimusi.
43
+
44
+ Ühilduvuse klausel. Kui litsentsisaaja levitab või edastab tuletatud teoseid või nende koopiaid, mis põhinevad nii teosel kui ka teisel, käesoleva litsentsiga ühilduva litsentsi alusel litsentsitud teosel, võib see levitamine või edastamine toimuda vastavalt nimetatud ühilduva litsentsi tingimustele. Käesolevas klauslis tähendab „ühilduv litsents“ käesoleva litsentsi lisas loetletud litsentse. Kui litsentsisaaja ühilduvale litsentsile vastavad kohustused on vastuolus tema kohustustega vastavalt käesolevale litsentsile, loetakse kehtivaks ühilduva litsentsi kohased kohustused.
45
+
46
+ Lähtekoodi lisamine. Teose koopiate levitamisel või edastamisel lisab litsentsisaaja igale koopiale lähtekoodi masinloetava koopia või näitab ära hoidla, kust lähtekood on kergesti ja tasuta kättesaadav seni, kuni litsentsisaaja jätkab teose levitamist või edastamist.
47
+
48
+ Õiguskaitse. Käesoleva litsentsiga ei anta luba kasutada litsentsiandja ärinimesid, kaubamärke, teenindusmärke või nimesid, välja arvatud juhul, kui see on vajalik mõistlikuks ja tavapäraseks kasutamiseks teose päritolu kirjeldamisel ja autoriõiguse märke sisu reprodutseerimisel.
49
+
50
+ 6.Autorsuse ahel
51
+ Esialgne litsentsiandja tagab, et käesoleva litsentsiga antav autoriõigus originaalteosele kuulub talle või on talle litsentsitud ja et tal on õigus seda litsentsiga edasi anda. Iga edasiarendaja tagab, et autoriõigus tema poolt teosele tehtavatele muudatustele kuulub talle või on talle litsentsitud ja et tal on õigus litsentsi anda. Iga kord, kui Te võtate vastu litsentsi, annavad esialgne litsentsiandja ja hilisemad edasiarendajad Teile litsentsi nende osaluse kasutamiseks teoses vastavalt käesoleva litsentsi tingimustele.
52
+
53
+ 7.Garantii puudumine
54
+ Teos on veel pooleli ja arvukad edasiarendajad parendavad seda järjepidevalt. See ei ole lõpetatud teos ja võib seetõttu sisaldada defekte ja programmivigu, mis on omased seda liiki arendustegevusele. Seetõttu levitatakse teost litsentsi alusel „sellisena, nagu see on“ ilma teose suhtes kehtiva garantiita, muu hulgas garantiita kaubandusliku kvaliteedi kohta, garantiita sobivuse kohta mingi kindla eesmärgi jaoks, garantiita defektide ja vigade puudumise kohta, garantiita täpsuse kohta ja selle kohta, et ei ole rikutud muid intellektuaalse omandi õigusi peale käesoleva litsentsi artiklis 6 nimetatud autoriõiguse. Käesolev garantii puudumise klausel on litsentsi oluline osa ja teosele õiguste andmise eeltingimus.
55
+
56
+ 8.Vastutuse välistamine
57
+ Välja arvatud tahtliku õiguserikkumise või füüsilistele isikutele tekitatud otsese kahju puhul, ei vastuta litsentsiandja mitte mingil juhul litsentsi või teose kasutamise tagajärjel tekkinud mistahes otsese või kaudse, varalise või moraalse kahju eest, muu hulgas maineväärtuse langusest tekkinud kahju, tööseisakute, arvutirikke ja talitlushäirete, andmete kadumise ja ärikahju eest, isegi juhul kui litsentsiandjat on sellise kahju tekkimise võimalikkusest teavitatud. Litsentsiandja vastutab siiski vastavalt tootevastutust käsitlevatele õigusaktidele niivõrd, kuivõrd need õigusaktid on teose suhtes kohaldatavad.
58
+
59
+ 9.Lisakokkulepped
60
+ Teose levitamisel võite Te sõlmida lisakokkuleppe, milles määratakse kindlaks käesoleva litsentsiga vastavuses olevad kohustused või teenused. Kuid kui olete nõus võtma kohustusi, võite Te tegutseda ainult iseenda nimel ja vastutusel, mitte esialgse litsentsiandja või teiste edasiarendajate nimel, ja ainult juhul, kui Te nõustute vabastama edasiarendajad vastutusest, kaitsma ja hoidma neid kahju tekkimise eest vastutuse või nõuete osas, mida nende vastu võidakse esitada selle tagajärjel, et Teie pakute garantiid või võtate lisavastutuse.
61
+
62
+ 10.Litsentsiga nõustumine
63
+ Käesoleva litsentsi sätetega saab nõustuda, klõpsates ikoonile „Nõustun“ litsentsi teksti näitava akna all või väljendades nõusolekut muul sarnasel viisil vastavalt kehtivatele õigusaktidele. Sellele ikoonile klõpsates väljendate selgelt ja pöördumatult oma nõusolekut käesoleva litsentsi ja kõigi selle tingimuste suhtes. Samuti nõustute pöördumatult käesoleva litsentsi ja kõigi selle tingimustega, kui teostate Teile käesoleva litsentsi artikliga 2 antud õigusi, näiteks kasutate teost, loote tuletatud teose või levitate või edastate teost või selle koopiaid.
64
+
65
+ 11.Üldsuse teavitamine
66
+ Juhul, kui Te kasutate teose levitamiseks või edastamiseks elektroonilisi sidevahendeid (näiteks võimaldate teose allalaadimist veebisaidilt), tuleb levitamiskanalil või andmekandjal (näiteks veebisaidil) teha üldsusele kättesaadavaks vähemalt kohaldatava õiguse alusel kohustuslik teave litsentsiandja ja litsentsi kohta ning selle kohta, kuidas see on litsentsisaajale kättesaadav, litsentsilepingu sõlmimise kohta ja selle kohta, kuidas litsentsisaaja saab litsentsi säilitada ja reprodutseerida.
67
+
68
+ 12.Litsentsi lõppemine
69
+ Litsents ja sellega antud õigused lõppevad automaatselt juhul, kui litsentsisaaja rikub litsentsi tingimusi. Sellise lõppemise korral ei lõpe ühegi sellise isiku litsents, kes sai teose litsentsisaajalt vastavalt litsentsi tingimustele, juhul kui see isik täidab jätkuvalt litsentsi tingimusi.
70
+
71
+ 13.Muud sätted
72
+ Ilma et see piiraks litsentsi artikli 9 kohaldamist, sisaldab litsents kogu kokkulepet, mis osapoolte vahel seose teosega on. Kui mõni litsentsi säte on vastavalt kohaldatavatele õigusaktidele kehtetu või seda ei ole võimalik jõustada, ei mõjuta see litsentsi kui terviku kehtivust ega jõustatavust. Sellist sätet tõlgendatakse või muudetakse nii nagu vaja, et see kehtiks ja saaks tagada selle täitmise. Euroopa Komisjon võib avaldada käesoleva litsentsi muid keeleversioone või uusi versioone või lisa uuendatud versioone, kuivõrd see on vajalik ja mõistlik, vähendamata sellega litsentsiga antavate õiguste ulatust. Litsentsi uued versioonid avaldatakse kordumatu versiooninumbriga. Käesoleva litsentsi kõik keeleversioonid, mille Euroopa Komisjon on heaks kiitnud, on võrdväärsed. Osapooled võivad kasutada enda valitud keeleversiooni.
73
+
74
+ 14.Kohtualluvus
75
+ Ilma et see piiraks konkreetse osapooltevahelise kokkuleppe kohaldamist,
76
+ — kuuluvad käesoleva litsentsi tõlgendamisest tulenevad kohtuvaidlused Euroopa Liidu institutsioonide, organite, büroode või asutuste kui litsentsiandja ja mistahes litsentsisaaja vahel Euroopa Liidu Kohtu pädevusse, nagu on sätestatud Euroopa Liidu toimimise lepingu artiklis 272,
77
+ — kuuluvad käesoleva litsentsi tõlgendamisest tulenevad kohtuvaidlused muude osapoolte vahel selle pädeva kohtu ainupädevusse, kelle tööpiirkonnas asub litsentsiandja elukoht või peamine tegevuskoht.
78
+
79
+ 15.Kohaldatav õigus
80
+ Ilma et see piiraks konkreetse osapooltevahelise kokkuleppe kohaldamist,
81
+ — kohaldatakse käesoleva litsentsi suhtes selle Euroopa Liidu liikmesriigi õigust, kus paikneb litsentsiandja peakorter, elukoht või asukoht,
82
+ — kohaldatakse litsentsi suhtes Belgia õigust, kui litsentsiandja peakorter, elukoht või asukoht asub väljaspool Euroopa Liidu liikmesriike.
83
+
84
+ Liide
85
+ Euroopa Liidu tarkvara vaba kasutuse litsentsi artiklis 5 osutatud „ühilduvad litsentsid“ on järgmised:
86
+ — GNU General Public License (GPL) v. 2, v. 3
87
+ — GNU Affero General Public License (AGPL) v. 3
88
+ — Open Software License (OSL) v. 2.1, v. 3.0
89
+ — Eclipse Public License (EPL) v. 1.0
90
+ — CeCILL v. 2.0, v. 2.1
91
+ — Mozilla Public Licence (MPL) v. 2
92
+ — GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
93
+ — Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) muude teoste puhul peale tarkvara
94
+ — European Union Public Licence (EUPL) v. 1.1, v. 1.2
95
+ — Québec Free and Open-Source Licence – Reciprocity (LiLiQ-R) or Strong Reciprocity (LiLiQ-R+).
96
+ Euroopa Komisjon võib käesolevat lisa ajakohastada loetletud litsentside hilisemate versioonidega ilma, et peaks selleks koostama EUPLi uue versiooni, eeldusel et nende litsentsidega tagatakse käesoleva litsentsi artiklis 2 sätestatud õigused ja kaitstakse hõlmatud lähtekoodi eksklusiivse omastamise eest.
97
+ Kõigi muude käesoleva liite muudatuste või täienduste jaoks on vaja koostada EUPLi uus versioon.
package/README.md CHANGED
@@ -1,3 +1,45 @@
1
- # Temporary Holding Version
1
+ # @zone-eu/zonemta-delivery-counters
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Delivery counters plugin for [ZoneMTA](https://github.com/zone-eu/zone-mta). Install this to see delivery counts and sending speed in [ZoneMTA WebAdmin](https://github.com/zone-eu/zmta-webadmin).
4
+
5
+ ## Setup
6
+
7
+ Add this as a dependency for your ZoneMTA app
8
+
9
+ Requires Node.js 20 or newer.
10
+
11
+ ```
12
+ npm install @zone-eu/zonemta-delivery-counters --save
13
+ ```
14
+
15
+ Add a configuration entry in the "plugins" section of your ZoneMTA app
16
+
17
+ ```json
18
+ ...
19
+ "plugins": {
20
+ "modules/@zone-eu/zonemta-delivery-counters": {
21
+ "enabled": "main",
22
+ "redis": "redis://localhost:6379/2",
23
+ "prefix": "zmta"
24
+ }
25
+ }
26
+ ...
27
+ ```
28
+
29
+ Redis configuration is optional. If not set then the redis connection provided by ZoneMTA is used.
30
+
31
+ ## Counter retention
32
+
33
+ Only the dated counters used by WebAdmin are written: `delivered_<zone>^YYYY/MM/DD`, `bounced_<zone>^YYYY/MM/DD`, and `domains^YYYY/MM/DD`, with the configured prefix followed by `_` when set. Dates use UTC. Each counter expires 48 hours after its last update. The increment and expiry are written in the same Redis transaction.
34
+
35
+ Undated aggregates and dated delivery/bounce totals without a zone are no longer updated. Existing keys from older versions are not automatically deleted or expired. After upgrading all plugin instances, remove obsolete counter keys and expire or remove historical dated keys that have no TTL. Restrict cleanup to this plugin's keys and check for any other consumers first.
36
+
37
+ Please note that if you used the zone-mta-template when installing ZoneMTA (Which is the default procedure in the documentaton) zone-mta-counters is already installed for you.
38
+
39
+ ## License
40
+
41
+ Delivery counters for ZoneMTA is licensed under the [European Union Public License 1.2](LICENSE) or later.
42
+
43
+ > Delivery counters for ZoneMTA is part of the Zone Mail Suite (ZMS). Suite of programs and modules for an efficient, fast and modern email server.
44
+
45
+ Copyright (c) 2026 Zone Media OÜ
package/index.js ADDED
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ const redis = require('redis');
4
+ const COUNTER_TTL = 48 * 60 * 60;
5
+
6
+ module.exports.title = 'Stats Counter';
7
+ module.exports.init = function(app, done) {
8
+ // prefer redis provided by the configuration
9
+ const client = app.config.redis
10
+ ? redis.createClient(typeof app.config.redis === 'string' ? { url: app.config.redis } : app.config.redis)
11
+ : app.db.redis;
12
+ const prefix = app.config.prefix ? app.config.prefix + '_' : '';
13
+ const logError = err => app.logger.error('Redis', err.message);
14
+
15
+ if (app.config.redis) {
16
+ client.on('error', logError);
17
+ return client.connect().then(registerHook, done);
18
+ }
19
+
20
+ registerHook();
21
+
22
+ function registerHook() {
23
+ app.addHook('queue:release', (zone, data, next) => {
24
+ if (!data || !data.status) {
25
+ return next();
26
+ }
27
+
28
+ let date = new Date();
29
+ let year = date.getUTCFullYear() + '';
30
+ let month = date.getUTCMonth() + 1;
31
+ let day = date.getUTCDate();
32
+
33
+ month = (month < 10 ? '0' : '') + month;
34
+ day = (day < 10 ? '0' : '') + day;
35
+
36
+ let suffix = '^' + year + '/' + month + '/' + day;
37
+ let aggregateKey = prefix + (data.status.delivered ? 'delivered' : 'bounced');
38
+ let key = aggregateKey + '_' + zone.name + suffix;
39
+ let domainKey = prefix + 'domains' + suffix;
40
+
41
+ const query = client
42
+ .multi()
43
+ .incr(key)
44
+ .expire(key, COUNTER_TTL);
45
+
46
+ // Legacy aggregates: no readers found in WebAdmin or ZoneMTA.
47
+ // Uncomment if a consumer needs them; retain expiry on each key.
48
+ // query
49
+ // .incr(aggregateKey)
50
+ // .expire(aggregateKey, COUNTER_TTL)
51
+ // .incr(aggregateKey + suffix)
52
+ // .expire(aggregateKey + suffix, COUNTER_TTL)
53
+ // .incr(aggregateKey + '_' + zone.name)
54
+ // .expire(aggregateKey + '_' + zone.name, COUNTER_TTL);
55
+
56
+ // ZoneMTA may provide a callback-based Redis client.
57
+ if (typeof query.zIncrBy === 'function') {
58
+ query.zIncrBy(domainKey, 1, data.domain).expire(domainKey, COUNTER_TTL);
59
+ // Legacy undated ranking: grows with distinct domains while traffic keeps its TTL refreshed.
60
+ // query.zIncrBy(prefix + 'domains', 1, data.domain).expire(prefix + 'domains', COUNTER_TTL);
61
+ query.exec().catch(logError);
62
+ } else {
63
+ query.zincrby(domainKey, 1, data.domain).expire(domainKey, COUNTER_TTL);
64
+ // query.zincrby(prefix + 'domains', 1, data.domain).expire(prefix + 'domains', COUNTER_TTL);
65
+ query.exec((err, replies) => {
66
+ if (err) {
67
+ return logError(err);
68
+ }
69
+ // ioredis returns command errors inside [error, result] pairs.
70
+ for (const reply of replies || []) {
71
+ const commandError = Array.isArray(reply) ? reply[0] : reply;
72
+ if (commandError instanceof Error) {
73
+ logError(commandError);
74
+ }
75
+ }
76
+ });
77
+ }
78
+
79
+ // Do not wait until counters are updated before returning.
80
+ setImmediate(next);
81
+ });
82
+
83
+ done();
84
+ }
85
+ };
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
- "name": "@zone-eu/zonemta-delivery-counters",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@zone-eu/zonemta-delivery-counters",
3
+ "version": "1.0.2",
4
+ "description": "Delivery counters plugin for ZoneMTA",
5
+ "main": "index.js",
6
+ "author": "Andris Reinman",
7
+ "license": "EUPL-1.2",
8
+ "engines": {
9
+ "node": ">=20.0.0"
10
+ },
11
+ "dependencies": {
12
+ "redis": "6.3.0"
13
+ }
14
+ }