@zthun/helpful-internet 9.1.0 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,17 +1,84 @@
1
- const _ZCookieBuilder = class _ZCookieBuilder {
2
- /**
3
- * Initializes a new instance of this object.
4
- */
5
- constructor() {
6
- this.immortal = this.expires.bind(this, void 0);
7
- this.lax = this.sameSite.bind(this, "lax");
8
- this.strict = this.sameSite.bind(this, "strict");
9
- this._cookie = {
10
- name: "",
11
- value: ""
12
- };
13
- }
14
- /**
1
+ /**
2
+ * Represents a generic cookie.
3
+ */ function _class_call_check$5(instance, Constructor) {
4
+ if (!(instance instanceof Constructor)) {
5
+ throw new TypeError("Cannot call a class as a function");
6
+ }
7
+ }
8
+ function _defineProperties$5(target, props) {
9
+ for(var i = 0; i < props.length; i++){
10
+ var descriptor = props[i];
11
+ descriptor.enumerable = descriptor.enumerable || false;
12
+ descriptor.configurable = true;
13
+ if ("value" in descriptor) descriptor.writable = true;
14
+ Object.defineProperty(target, descriptor.key, descriptor);
15
+ }
16
+ }
17
+ function _create_class$5(Constructor, protoProps, staticProps) {
18
+ _defineProperties$5(Constructor.prototype, protoProps);
19
+ return Constructor;
20
+ }
21
+ function _define_property$5(obj, key, value) {
22
+ if (key in obj) {
23
+ Object.defineProperty(obj, key, {
24
+ value: value,
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true
28
+ });
29
+ } else {
30
+ obj[key] = value;
31
+ }
32
+ return obj;
33
+ }
34
+ function _object_spread(target) {
35
+ for(var i = 1; i < arguments.length; i++){
36
+ var source = arguments[i] != null ? arguments[i] : {};
37
+ var ownKeys = Object.keys(source);
38
+ if (typeof Object.getOwnPropertySymbols === "function") {
39
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
40
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
41
+ }));
42
+ }
43
+ ownKeys.forEach(function(key) {
44
+ _define_property$5(target, key, source[key]);
45
+ });
46
+ }
47
+ return target;
48
+ }
49
+ /**
50
+ * Represents a builder for an IZCookie object.
51
+ */ var ZCookieBuilder = /*#__PURE__*/ function() {
52
+ function ZCookieBuilder() {
53
+ _class_call_check$5(this, ZCookieBuilder);
54
+ _define_property$5(this, "_cookie", void 0);
55
+ /**
56
+ * Removes the cookie expiration.
57
+ *
58
+ * @returns
59
+ * This object.
60
+ */ _define_property$5(this, "immortal", this.expires.bind(this, undefined));
61
+ /**
62
+ * Sets the same site policy to 'lax'
63
+ *
64
+ * @returns
65
+ * This object.
66
+ */ _define_property$5(this, "lax", this.sameSite.bind(this, "lax"));
67
+ /**
68
+ * Sets the same site polity to 'strict'
69
+ *
70
+ * @returns
71
+ * This object.
72
+ */ _define_property$5(this, "strict", this.sameSite.bind(this, "strict"));
73
+ this._cookie = {
74
+ name: "",
75
+ value: ""
76
+ };
77
+ }
78
+ _create_class$5(ZCookieBuilder, [
79
+ {
80
+ key: "name",
81
+ value: /**
15
82
  * Sets the cookie name.
16
83
  *
17
84
  * @param val -
@@ -19,12 +86,14 @@ const _ZCookieBuilder = class _ZCookieBuilder {
19
86
  *
20
87
  * @returns
21
88
  * This object.
22
- */
23
- name(val) {
24
- this._cookie.name = val;
25
- return this;
26
- }
27
- /**
89
+ */ function name(val) {
90
+ this._cookie.name = val;
91
+ return this;
92
+ }
93
+ },
94
+ {
95
+ key: "value",
96
+ value: /**
28
97
  * Sets the cookie value.
29
98
  *
30
99
  * @param val -
@@ -32,12 +101,14 @@ const _ZCookieBuilder = class _ZCookieBuilder {
32
101
  *
33
102
  * @returns
34
103
  * This object.
35
- */
36
- value(val) {
37
- this._cookie.value = val;
38
- return this;
39
- }
40
- /**
104
+ */ function value(val) {
105
+ this._cookie.value = val;
106
+ return this;
107
+ }
108
+ },
109
+ {
110
+ key: "domain",
111
+ value: /**
41
112
  * Sets the cookie domain.
42
113
  *
43
114
  * @param val -
@@ -45,12 +116,14 @@ const _ZCookieBuilder = class _ZCookieBuilder {
45
116
  *
46
117
  * @returns
47
118
  * This object.
48
- */
49
- domain(val) {
50
- this._cookie.domain = val;
51
- return this;
52
- }
53
- /**
119
+ */ function domain(val) {
120
+ this._cookie.domain = val;
121
+ return this;
122
+ }
123
+ },
124
+ {
125
+ key: "expires",
126
+ value: /**
54
127
  * Sets the cookie expiration date.
55
128
  *
56
129
  * @param val -
@@ -58,27 +131,29 @@ const _ZCookieBuilder = class _ZCookieBuilder {
58
131
  *
59
132
  * @returns
60
133
  * This object.
61
- */
62
- expires(val) {
63
- if (val == null) {
64
- delete this._cookie.expires;
65
- return this;
66
- }
67
- this._cookie.expires = typeof val === "string" ? val : val.toJSON();
68
- return this;
69
- }
70
- /**
134
+ */ function expires(val) {
135
+ if (val == null) {
136
+ delete this._cookie.expires;
137
+ return this;
138
+ }
139
+ this._cookie.expires = typeof val === "string" ? val : val.toJSON();
140
+ return this;
141
+ }
142
+ },
143
+ {
144
+ key: "expiresTomorrow",
145
+ value: /**
71
146
  * Sets the cookie expiration date to one day from the moment this is invoked.
72
147
  *
73
148
  * @returns
74
149
  * This object.
75
- */
76
- expiresTomorrow() {
77
- return this.expires(
78
- new Date(Date.now() + _ZCookieBuilder.MillisecondsOneDay)
79
- );
80
- }
81
- /**
150
+ */ function expiresTomorrow() {
151
+ return this.expires(new Date(Date.now() + ZCookieBuilder.MillisecondsOneDay));
152
+ }
153
+ },
154
+ {
155
+ key: "secure",
156
+ value: /**
82
157
  * Sets the cookie secure flag.
83
158
  *
84
159
  * @param val -
@@ -86,12 +161,15 @@ const _ZCookieBuilder = class _ZCookieBuilder {
86
161
  *
87
162
  * @returns
88
163
  * This object.
89
- */
90
- secure(val = true) {
91
- this._cookie.secure = val;
92
- return this;
93
- }
94
- /**
164
+ */ function secure() {
165
+ var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
166
+ this._cookie.secure = val;
167
+ return this;
168
+ }
169
+ },
170
+ {
171
+ key: "sameSite",
172
+ value: /**
95
173
  * Sets the cookie same site policy.
96
174
  *
97
175
  * @param val -
@@ -99,21 +177,25 @@ const _ZCookieBuilder = class _ZCookieBuilder {
99
177
  *
100
178
  * @returns
101
179
  * This object.
102
- */
103
- sameSite(val) {
104
- this._cookie.sameSite = val;
105
- return this;
106
- }
107
- /**
180
+ */ function sameSite(val) {
181
+ this._cookie.sameSite = val;
182
+ return this;
183
+ }
184
+ },
185
+ {
186
+ key: "allowCrossSite",
187
+ value: /**
108
188
  * Sets the same site policy to 'none' and turns on the secure flag.
109
189
  *
110
190
  * @returns
111
191
  * This object.
112
- */
113
- allowCrossSite() {
114
- return this.secure().sameSite("none");
115
- }
116
- /**
192
+ */ function allowCrossSite() {
193
+ return this.secure().sameSite("none");
194
+ }
195
+ },
196
+ {
197
+ key: "httpOnly",
198
+ value: /**
117
199
  * Sets the cookie http only flag.
118
200
  *
119
201
  * @param val -
@@ -121,12 +203,15 @@ const _ZCookieBuilder = class _ZCookieBuilder {
121
203
  *
122
204
  * @returns
123
205
  * This object.
124
- */
125
- httpOnly(val = true) {
126
- this._cookie.httpOnly = val;
127
- return this;
128
- }
129
- /**
206
+ */ function httpOnly() {
207
+ var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
208
+ this._cookie.httpOnly = val;
209
+ return this;
210
+ }
211
+ },
212
+ {
213
+ key: "authentication",
214
+ value: /**
130
215
  * Creates a token based authentication cookie.
131
216
  *
132
217
  * @param token -
@@ -136,29 +221,71 @@ const _ZCookieBuilder = class _ZCookieBuilder {
136
221
  *
137
222
  * @returns
138
223
  * This object.
139
- */
140
- authentication(token) {
141
- const builder = this.name("Authentication").expiresTomorrow().secure().httpOnly();
142
- return token == null ? builder : builder.value(token);
143
- }
144
- /**
224
+ */ function authentication(token) {
225
+ var builder = this.name("Authentication").expiresTomorrow().secure().httpOnly();
226
+ return token == null ? builder : builder.value(token);
227
+ }
228
+ },
229
+ {
230
+ key: "build",
231
+ value: /**
145
232
  * Returns a copy of the built instance of the cookie.
146
233
  *
147
234
  * @returns
148
235
  * A shallow copy of the current cookie object.
149
- */
150
- build() {
151
- return { ...this._cookie };
152
- }
153
- };
154
- _ZCookieBuilder.MillisecondsOneDay = 864e5;
155
- let ZCookieBuilder = _ZCookieBuilder;
156
- class ZEmailContactAddressBuilder {
157
- constructor() {
158
- this._addresses = [];
159
- this._delimiter = ", ";
160
- }
161
- /**
236
+ */ function build() {
237
+ return _object_spread({}, this._cookie);
238
+ }
239
+ }
240
+ ]);
241
+ return ZCookieBuilder;
242
+ }();
243
+ _define_property$5(ZCookieBuilder, "MillisecondsOneDay", 86400000);
244
+
245
+ function _class_call_check$4(instance, Constructor) {
246
+ if (!(instance instanceof Constructor)) {
247
+ throw new TypeError("Cannot call a class as a function");
248
+ }
249
+ }
250
+ function _defineProperties$4(target, props) {
251
+ for(var i = 0; i < props.length; i++){
252
+ var descriptor = props[i];
253
+ descriptor.enumerable = descriptor.enumerable || false;
254
+ descriptor.configurable = true;
255
+ if ("value" in descriptor) descriptor.writable = true;
256
+ Object.defineProperty(target, descriptor.key, descriptor);
257
+ }
258
+ }
259
+ function _create_class$4(Constructor, protoProps, staticProps) {
260
+ _defineProperties$4(Constructor.prototype, protoProps);
261
+ return Constructor;
262
+ }
263
+ function _define_property$4(obj, key, value) {
264
+ if (key in obj) {
265
+ Object.defineProperty(obj, key, {
266
+ value: value,
267
+ enumerable: true,
268
+ configurable: true,
269
+ writable: true
270
+ });
271
+ } else {
272
+ obj[key] = value;
273
+ }
274
+ return obj;
275
+ }
276
+ /**
277
+ * Represents a builder that will build a comma separated
278
+ * list of addresses for an email message.
279
+ */ var ZEmailContactAddressBuilder = /*#__PURE__*/ function() {
280
+ function ZEmailContactAddressBuilder() {
281
+ _class_call_check$4(this, ZEmailContactAddressBuilder);
282
+ _define_property$4(this, "_addresses", []);
283
+ _define_property$4(this, "_delimiter", ", ");
284
+ }
285
+ _create_class$4(ZEmailContactAddressBuilder, [
286
+ {
287
+ key: "address",
288
+ value: /**
162
289
  * Adds an address to the list to builder.
163
290
  *
164
291
  * @param val -
@@ -167,12 +294,14 @@ class ZEmailContactAddressBuilder {
167
294
  *
168
295
  * @returns
169
296
  * This object.
170
- */
171
- address(val) {
172
- this._addresses.push(val);
173
- return this;
174
- }
175
- /**
297
+ */ function address(val) {
298
+ this._addresses.push(val);
299
+ return this;
300
+ }
301
+ },
302
+ {
303
+ key: "addresses",
304
+ value: /**
176
305
  * Sets the addresses to build from.
177
306
  *
178
307
  * @param val -
@@ -180,12 +309,14 @@ class ZEmailContactAddressBuilder {
180
309
  *
181
310
  * @returns
182
311
  * This object.
183
- */
184
- addresses(val) {
185
- this._addresses = val.slice();
186
- return this;
187
- }
188
- /**
312
+ */ function addresses(val) {
313
+ this._addresses = val.slice();
314
+ return this;
315
+ }
316
+ },
317
+ {
318
+ key: "delimiter",
319
+ value: /**
189
320
  * Sets the delimiter to split the addresses with.
190
321
  *
191
322
  * The default is a comma with a space.
@@ -195,40 +326,82 @@ class ZEmailContactAddressBuilder {
195
326
  *
196
327
  * @returns
197
328
  * This object.
198
- */
199
- delimiter(val) {
200
- this._delimiter = val;
201
- return this;
202
- }
203
- /**
329
+ */ function delimiter(val) {
330
+ this._delimiter = val;
331
+ return this;
332
+ }
333
+ },
334
+ {
335
+ key: "build",
336
+ value: /**
204
337
  * Builds the delimiters separated list of addresses.
205
338
  *
206
339
  * @returns
207
340
  * The delimited separated list of addresses.
208
- */
209
- build() {
210
- const addr = (ct) => {
211
- if (!ct) {
212
- return void 0;
213
- }
214
- return typeof ct === "string" ? ct : ct.address;
215
- };
216
- const truthy = (ct) => {
217
- return !!ct;
218
- };
219
- return this._addresses.map(addr).filter(truthy).join(this._delimiter);
220
- }
341
+ */ function build() {
342
+ var addr = function(ct) {
343
+ if (!ct) {
344
+ return undefined;
345
+ }
346
+ return typeof ct === "string" ? ct : ct.address;
347
+ };
348
+ var truthy = function(ct) {
349
+ return !!ct;
350
+ };
351
+ return this._addresses.map(addr).filter(truthy).join(this._delimiter);
352
+ }
353
+ }
354
+ ]);
355
+ return ZEmailContactAddressBuilder;
356
+ }();
357
+
358
+ /**
359
+ * Represents an email contact.
360
+ */ function _class_call_check$3(instance, Constructor) {
361
+ if (!(instance instanceof Constructor)) {
362
+ throw new TypeError("Cannot call a class as a function");
363
+ }
221
364
  }
222
- class ZEmailContactBuilder {
223
- /**
224
- * Initializes a new instance of this object.
225
- */
226
- constructor() {
227
- this._contact = {
228
- address: ""
229
- };
230
- }
231
- /**
365
+ function _defineProperties$3(target, props) {
366
+ for(var i = 0; i < props.length; i++){
367
+ var descriptor = props[i];
368
+ descriptor.enumerable = descriptor.enumerable || false;
369
+ descriptor.configurable = true;
370
+ if ("value" in descriptor) descriptor.writable = true;
371
+ Object.defineProperty(target, descriptor.key, descriptor);
372
+ }
373
+ }
374
+ function _create_class$3(Constructor, protoProps, staticProps) {
375
+ _defineProperties$3(Constructor.prototype, protoProps);
376
+ return Constructor;
377
+ }
378
+ function _define_property$3(obj, key, value) {
379
+ if (key in obj) {
380
+ Object.defineProperty(obj, key, {
381
+ value: value,
382
+ enumerable: true,
383
+ configurable: true,
384
+ writable: true
385
+ });
386
+ } else {
387
+ obj[key] = value;
388
+ }
389
+ return obj;
390
+ }
391
+ /**
392
+ * Represents a builder for an email contact.
393
+ */ var ZEmailContactBuilder = /*#__PURE__*/ function() {
394
+ function ZEmailContactBuilder() {
395
+ _class_call_check$3(this, ZEmailContactBuilder);
396
+ _define_property$3(this, "_contact", void 0);
397
+ this._contact = {
398
+ address: ""
399
+ };
400
+ }
401
+ _create_class$3(ZEmailContactBuilder, [
402
+ {
403
+ key: "address",
404
+ value: /**
232
405
  * Sets the address of the contact.
233
406
  *
234
407
  * @param val -
@@ -236,12 +409,14 @@ class ZEmailContactBuilder {
236
409
  *
237
410
  * @returns
238
411
  * This object.
239
- */
240
- address(val) {
241
- this._contact.address = val;
242
- return this;
243
- }
244
- /**
412
+ */ function address(val) {
413
+ this._contact.address = val;
414
+ return this;
415
+ }
416
+ },
417
+ {
418
+ key: "type",
419
+ value: /**
245
420
  * Sets the type of the contact.
246
421
  *
247
422
  * @param val -
@@ -249,12 +424,14 @@ class ZEmailContactBuilder {
249
424
  *
250
425
  * @returns
251
426
  * This object.
252
- */
253
- type(val) {
254
- this._contact.type = val;
255
- return this;
256
- }
257
- /**
427
+ */ function type(val) {
428
+ this._contact.type = val;
429
+ return this;
430
+ }
431
+ },
432
+ {
433
+ key: "display",
434
+ value: /**
258
435
  * Sets the display of the contact.
259
436
  *
260
437
  * @param val -
@@ -262,12 +439,14 @@ class ZEmailContactBuilder {
262
439
  *
263
440
  * @returns
264
441
  * This object.
265
- */
266
- display(val) {
267
- this._contact.display = val;
268
- return this;
269
- }
270
- /**
442
+ */ function display(val) {
443
+ this._contact.display = val;
444
+ return this;
445
+ }
446
+ },
447
+ {
448
+ key: "assign",
449
+ value: /**
271
450
  * Assigns the values in other to this object.
272
451
  *
273
452
  * @param other -
@@ -275,13 +454,15 @@ class ZEmailContactBuilder {
275
454
  *
276
455
  * @returns
277
456
  * This object.
278
- */
279
- assign(other) {
280
- this._contact = Object.assign({}, this._contact, other);
281
- this._contact = JSON.parse(JSON.stringify(this._contact));
282
- return this;
283
- }
284
- /**
457
+ */ function assign(other) {
458
+ this._contact = Object.assign({}, this._contact, other);
459
+ this._contact = JSON.parse(JSON.stringify(this._contact));
460
+ return this;
461
+ }
462
+ },
463
+ {
464
+ key: "copy",
465
+ value: /**
285
466
  * Copies another object.
286
467
  *
287
468
  * @param other -
@@ -289,31 +470,71 @@ class ZEmailContactBuilder {
289
470
  *
290
471
  * @returns
291
472
  * This object.
292
- */
293
- copy(other) {
294
- this._contact = JSON.parse(JSON.stringify(other));
295
- return this;
296
- }
297
- /**
473
+ */ function copy(other) {
474
+ this._contact = JSON.parse(JSON.stringify(other));
475
+ return this;
476
+ }
477
+ },
478
+ {
479
+ key: "build",
480
+ value: /**
298
481
  * Returns a copy of the built object.
299
482
  *
300
483
  * @returns
301
484
  * A copy of the built email contact.
302
- */
303
- build() {
304
- return JSON.parse(JSON.stringify(this._contact));
305
- }
485
+ */ function build() {
486
+ return JSON.parse(JSON.stringify(this._contact));
487
+ }
488
+ }
489
+ ]);
490
+ return ZEmailContactBuilder;
491
+ }();
492
+
493
+ function _class_call_check$2(instance, Constructor) {
494
+ if (!(instance instanceof Constructor)) {
495
+ throw new TypeError("Cannot call a class as a function");
496
+ }
306
497
  }
307
- class ZEmailEnvelopeBuilder {
308
- /**
309
- * Initializes a new instance of this object.
310
- */
311
- constructor() {
312
- this._envelope = {
313
- from: ""
314
- };
315
- }
316
- /**
498
+ function _defineProperties$2(target, props) {
499
+ for(var i = 0; i < props.length; i++){
500
+ var descriptor = props[i];
501
+ descriptor.enumerable = descriptor.enumerable || false;
502
+ descriptor.configurable = true;
503
+ if ("value" in descriptor) descriptor.writable = true;
504
+ Object.defineProperty(target, descriptor.key, descriptor);
505
+ }
506
+ }
507
+ function _create_class$2(Constructor, protoProps, staticProps) {
508
+ _defineProperties$2(Constructor.prototype, protoProps);
509
+ return Constructor;
510
+ }
511
+ function _define_property$2(obj, key, value) {
512
+ if (key in obj) {
513
+ Object.defineProperty(obj, key, {
514
+ value: value,
515
+ enumerable: true,
516
+ configurable: true,
517
+ writable: true
518
+ });
519
+ } else {
520
+ obj[key] = value;
521
+ }
522
+ return obj;
523
+ }
524
+ /**
525
+ * Represents a builder for an email envelope.
526
+ */ var ZEmailEnvelopeBuilder = /*#__PURE__*/ function() {
527
+ function ZEmailEnvelopeBuilder() {
528
+ _class_call_check$2(this, ZEmailEnvelopeBuilder);
529
+ _define_property$2(this, "_envelope", void 0);
530
+ this._envelope = {
531
+ from: ""
532
+ };
533
+ }
534
+ _create_class$2(ZEmailEnvelopeBuilder, [
535
+ {
536
+ key: "from",
537
+ value: /**
317
538
  * Sets the from field.
318
539
  *
319
540
  * @param val -
@@ -321,12 +542,14 @@ class ZEmailEnvelopeBuilder {
321
542
  *
322
543
  * @returns
323
544
  * This object.
324
- */
325
- from(val) {
326
- this._envelope.from = val;
327
- return this;
328
- }
329
- /**
545
+ */ function from(val) {
546
+ this._envelope.from = val;
547
+ return this;
548
+ }
549
+ },
550
+ {
551
+ key: "to",
552
+ value: /**
330
553
  * Adds a value to the 'to' field.
331
554
  *
332
555
  * @param val -
@@ -334,13 +557,15 @@ class ZEmailEnvelopeBuilder {
334
557
  *
335
558
  * @returns
336
559
  * This object.
337
- */
338
- to(val) {
339
- this._envelope.to = this._envelope.to || [];
340
- this._envelope.to.push(val);
341
- return this;
342
- }
343
- /**
560
+ */ function to(val) {
561
+ this._envelope.to = this._envelope.to || [];
562
+ this._envelope.to.push(val);
563
+ return this;
564
+ }
565
+ },
566
+ {
567
+ key: "tos",
568
+ value: /**
344
569
  * Sets the to field.
345
570
  *
346
571
  * @param val -
@@ -348,12 +573,14 @@ class ZEmailEnvelopeBuilder {
348
573
  *
349
574
  * @returns
350
575
  * This object.
351
- */
352
- tos(val) {
353
- this._envelope.to = val;
354
- return this;
355
- }
356
- /**
576
+ */ function tos(val) {
577
+ this._envelope.to = val;
578
+ return this;
579
+ }
580
+ },
581
+ {
582
+ key: "cc",
583
+ value: /**
357
584
  * Adds a value to the cc field.
358
585
  *
359
586
  * @param val -
@@ -361,13 +588,15 @@ class ZEmailEnvelopeBuilder {
361
588
  *
362
589
  * @returns
363
590
  * This object.
364
- */
365
- cc(val) {
366
- this._envelope.cc = this._envelope.cc || [];
367
- this._envelope.cc.push(val);
368
- return this;
369
- }
370
- /**
591
+ */ function cc(val) {
592
+ this._envelope.cc = this._envelope.cc || [];
593
+ this._envelope.cc.push(val);
594
+ return this;
595
+ }
596
+ },
597
+ {
598
+ key: "ccs",
599
+ value: /**
371
600
  * Sets the cc field.
372
601
  *
373
602
  * @param val -
@@ -375,12 +604,14 @@ class ZEmailEnvelopeBuilder {
375
604
  *
376
605
  * @returns
377
606
  * This object.
378
- */
379
- ccs(val) {
380
- this._envelope.cc = val;
381
- return this;
382
- }
383
- /**
607
+ */ function ccs(val) {
608
+ this._envelope.cc = val;
609
+ return this;
610
+ }
611
+ },
612
+ {
613
+ key: "bcc",
614
+ value: /**
384
615
  * Adds a value to the bcc field.
385
616
  *
386
617
  * @param val -
@@ -388,13 +619,15 @@ class ZEmailEnvelopeBuilder {
388
619
  *
389
620
  * @returns
390
621
  * This object.
391
- */
392
- bcc(val) {
393
- this._envelope.bcc = this._envelope.bcc || [];
394
- this._envelope.bcc.push(val);
395
- return this;
396
- }
397
- /**
622
+ */ function bcc(val) {
623
+ this._envelope.bcc = this._envelope.bcc || [];
624
+ this._envelope.bcc.push(val);
625
+ return this;
626
+ }
627
+ },
628
+ {
629
+ key: "bccs",
630
+ value: /**
398
631
  * Sets the bcc field.
399
632
  *
400
633
  * @param val -
@@ -402,12 +635,14 @@ class ZEmailEnvelopeBuilder {
402
635
  *
403
636
  * @returns
404
637
  * This object.
405
- */
406
- bccs(val) {
407
- this._envelope.bcc = val;
408
- return this;
409
- }
410
- /**
638
+ */ function bccs(val) {
639
+ this._envelope.bcc = val;
640
+ return this;
641
+ }
642
+ },
643
+ {
644
+ key: "assign",
645
+ value: /**
411
646
  * Assigns another partial email envelope to this object.
412
647
  *
413
648
  * @param other -
@@ -415,13 +650,15 @@ class ZEmailEnvelopeBuilder {
415
650
  *
416
651
  * @returns
417
652
  * This object.
418
- */
419
- assign(other) {
420
- this._envelope = Object.assign({}, this._envelope, other);
421
- this._envelope = JSON.parse(JSON.stringify(this._envelope));
422
- return this;
423
- }
424
- /**
653
+ */ function assign(other) {
654
+ this._envelope = Object.assign({}, this._envelope, other);
655
+ this._envelope = JSON.parse(JSON.stringify(this._envelope));
656
+ return this;
657
+ }
658
+ },
659
+ {
660
+ key: "copy",
661
+ value: /**
425
662
  * Copies another email envelope to this object.
426
663
  *
427
664
  * @param other -
@@ -429,31 +666,71 @@ class ZEmailEnvelopeBuilder {
429
666
  *
430
667
  * @returns
431
668
  * This object.
432
- */
433
- copy(other) {
434
- this._envelope = JSON.parse(JSON.stringify(other));
435
- return this;
436
- }
437
- /**
669
+ */ function copy(other) {
670
+ this._envelope = JSON.parse(JSON.stringify(other));
671
+ return this;
672
+ }
673
+ },
674
+ {
675
+ key: "build",
676
+ value: /**
438
677
  * Returns a copy of the built envelope.
439
678
  *
440
679
  * @returns
441
680
  * A copy of the currently built up envelope object.
442
- */
443
- build() {
444
- return JSON.parse(JSON.stringify(this._envelope));
445
- }
681
+ */ function build() {
682
+ return JSON.parse(JSON.stringify(this._envelope));
683
+ }
684
+ }
685
+ ]);
686
+ return ZEmailEnvelopeBuilder;
687
+ }();
688
+
689
+ function _class_call_check$1(instance, Constructor) {
690
+ if (!(instance instanceof Constructor)) {
691
+ throw new TypeError("Cannot call a class as a function");
692
+ }
446
693
  }
447
- class ZEmailBuilder {
448
- /**
449
- * Initializes a new instance of this object.
450
- */
451
- constructor() {
452
- this._email = {
453
- envelope: new ZEmailEnvelopeBuilder().build()
454
- };
455
- }
456
- /**
694
+ function _defineProperties$1(target, props) {
695
+ for(var i = 0; i < props.length; i++){
696
+ var descriptor = props[i];
697
+ descriptor.enumerable = descriptor.enumerable || false;
698
+ descriptor.configurable = true;
699
+ if ("value" in descriptor) descriptor.writable = true;
700
+ Object.defineProperty(target, descriptor.key, descriptor);
701
+ }
702
+ }
703
+ function _create_class$1(Constructor, protoProps, staticProps) {
704
+ _defineProperties$1(Constructor.prototype, protoProps);
705
+ return Constructor;
706
+ }
707
+ function _define_property$1(obj, key, value) {
708
+ if (key in obj) {
709
+ Object.defineProperty(obj, key, {
710
+ value: value,
711
+ enumerable: true,
712
+ configurable: true,
713
+ writable: true
714
+ });
715
+ } else {
716
+ obj[key] = value;
717
+ }
718
+ return obj;
719
+ }
720
+ /**
721
+ * Represents a builder for an email.
722
+ */ var ZEmailBuilder = /*#__PURE__*/ function() {
723
+ function ZEmailBuilder() {
724
+ _class_call_check$1(this, ZEmailBuilder);
725
+ _define_property$1(this, "_email", void 0);
726
+ this._email = {
727
+ envelope: new ZEmailEnvelopeBuilder().build()
728
+ };
729
+ }
730
+ _create_class$1(ZEmailBuilder, [
731
+ {
732
+ key: "envelope",
733
+ value: /**
457
734
  * Sets the envelope of where the email is going.
458
735
  *
459
736
  * @param val -
@@ -461,12 +738,14 @@ class ZEmailBuilder {
461
738
  *
462
739
  * @returns
463
740
  * This object.
464
- */
465
- envelope(val) {
466
- this._email.envelope = val;
467
- return this;
468
- }
469
- /**
741
+ */ function envelope(val) {
742
+ this._email.envelope = val;
743
+ return this;
744
+ }
745
+ },
746
+ {
747
+ key: "subject",
748
+ value: /**
470
749
  * Sets the subject line of the email.
471
750
  *
472
751
  * @param val -
@@ -474,12 +753,14 @@ class ZEmailBuilder {
474
753
  *
475
754
  * @returns
476
755
  * This object.
477
- */
478
- subject(val) {
479
- this._email.subject = val;
480
- return this;
481
- }
482
- /**
756
+ */ function subject(val) {
757
+ this._email.subject = val;
758
+ return this;
759
+ }
760
+ },
761
+ {
762
+ key: "message",
763
+ value: /**
483
764
  * Sets the message of the email.
484
765
  *
485
766
  * The message can be raw text or html.
@@ -489,12 +770,14 @@ class ZEmailBuilder {
489
770
  *
490
771
  * @returns
491
772
  * This object.
492
- */
493
- message(val) {
494
- this._email.message = val;
495
- return this;
496
- }
497
- /**
773
+ */ function message(val) {
774
+ this._email.message = val;
775
+ return this;
776
+ }
777
+ },
778
+ {
779
+ key: "assign",
780
+ value: /**
498
781
  * Assigns the other object to the current email object.
499
782
  *
500
783
  * @param other -
@@ -502,13 +785,15 @@ class ZEmailBuilder {
502
785
  *
503
786
  * @returns
504
787
  * This object.
505
- */
506
- assign(other) {
507
- this._email = Object.assign(this._email, other);
508
- this._email = JSON.parse(JSON.stringify(this._email));
509
- return this;
510
- }
511
- /**
788
+ */ function assign(other) {
789
+ this._email = Object.assign(this._email, other);
790
+ this._email = JSON.parse(JSON.stringify(this._email));
791
+ return this;
792
+ }
793
+ },
794
+ {
795
+ key: "copy",
796
+ value: /**
512
797
  * Copies another email into the builder.
513
798
  *
514
799
  * @param other -
@@ -516,31 +801,73 @@ class ZEmailBuilder {
516
801
  *
517
802
  * @returns
518
803
  * This object.
519
- */
520
- copy(other) {
521
- this._email = JSON.parse(JSON.stringify(other));
522
- return this;
523
- }
524
- /**
804
+ */ function copy(other) {
805
+ this._email = JSON.parse(JSON.stringify(other));
806
+ return this;
807
+ }
808
+ },
809
+ {
810
+ key: "build",
811
+ value: /**
525
812
  * Returns a copy of the built object.
526
813
  *
527
814
  * @returns
528
815
  * A copy of the built object.
529
- */
530
- build() {
531
- return JSON.parse(JSON.stringify(this._email));
532
- }
816
+ */ function build() {
817
+ return JSON.parse(JSON.stringify(this._email));
818
+ }
819
+ }
820
+ ]);
821
+ return ZEmailBuilder;
822
+ }();
823
+
824
+ /**
825
+ * Represents an abstract server connection.
826
+ */ function _class_call_check(instance, Constructor) {
827
+ if (!(instance instanceof Constructor)) {
828
+ throw new TypeError("Cannot call a class as a function");
829
+ }
533
830
  }
534
- class ZServerBuilder {
535
- /**
536
- * Initializes a new instance of this object.
537
- */
538
- constructor() {
539
- this._server = {
540
- address: ""
541
- };
542
- }
543
- /**
831
+ function _defineProperties(target, props) {
832
+ for(var i = 0; i < props.length; i++){
833
+ var descriptor = props[i];
834
+ descriptor.enumerable = descriptor.enumerable || false;
835
+ descriptor.configurable = true;
836
+ if ("value" in descriptor) descriptor.writable = true;
837
+ Object.defineProperty(target, descriptor.key, descriptor);
838
+ }
839
+ }
840
+ function _create_class(Constructor, protoProps, staticProps) {
841
+ _defineProperties(Constructor.prototype, protoProps);
842
+ return Constructor;
843
+ }
844
+ function _define_property(obj, key, value) {
845
+ if (key in obj) {
846
+ Object.defineProperty(obj, key, {
847
+ value: value,
848
+ enumerable: true,
849
+ configurable: true,
850
+ writable: true
851
+ });
852
+ } else {
853
+ obj[key] = value;
854
+ }
855
+ return obj;
856
+ }
857
+ /**
858
+ * Represents a builder for a server object.
859
+ */ var ZServerBuilder = /*#__PURE__*/ function() {
860
+ function ZServerBuilder() {
861
+ _class_call_check(this, ZServerBuilder);
862
+ _define_property(this, "_server", void 0);
863
+ this._server = {
864
+ address: ""
865
+ };
866
+ }
867
+ _create_class(ZServerBuilder, [
868
+ {
869
+ key: "address",
870
+ value: /**
544
871
  * The server ip address or hostname.
545
872
  *
546
873
  * @param val -
@@ -548,12 +875,14 @@ class ZServerBuilder {
548
875
  *
549
876
  * @returns
550
877
  * This object.
551
- */
552
- address(val) {
553
- this._server.address = val;
554
- return this;
555
- }
556
- /**
878
+ */ function address(val) {
879
+ this._server.address = val;
880
+ return this;
881
+ }
882
+ },
883
+ {
884
+ key: "port",
885
+ value: /**
557
886
  * Sets the optional port to connect on.
558
887
  *
559
888
  * @param val -
@@ -561,12 +890,14 @@ class ZServerBuilder {
561
890
  *
562
891
  * @returns
563
892
  * This object.
564
- */
565
- port(val) {
566
- this._server.port = val;
567
- return this;
568
- }
569
- /**
893
+ */ function port(val) {
894
+ this._server.port = val;
895
+ return this;
896
+ }
897
+ },
898
+ {
899
+ key: "username",
900
+ value: /**
570
901
  * Sets the optional username to connect on.
571
902
  *
572
903
  * @param val -
@@ -574,12 +905,14 @@ class ZServerBuilder {
574
905
  *
575
906
  * @returns
576
907
  * This object.
577
- */
578
- username(val) {
579
- this._server.username = val;
580
- return this;
581
- }
582
- /**
908
+ */ function username(val) {
909
+ this._server.username = val;
910
+ return this;
911
+ }
912
+ },
913
+ {
914
+ key: "password",
915
+ value: /**
583
916
  * Sets the password to connect on.
584
917
  *
585
918
  * @param val -
@@ -587,12 +920,14 @@ class ZServerBuilder {
587
920
  *
588
921
  * @returns
589
922
  * This object.
590
- */
591
- password(val) {
592
- this._server.password = val;
593
- return this;
594
- }
595
- /**
923
+ */ function password(val) {
924
+ this._server.password = val;
925
+ return this;
926
+ }
927
+ },
928
+ {
929
+ key: "assign",
930
+ value: /**
596
931
  * Assigns all truthy properties in other to this object.
597
932
  *
598
933
  * @param other -
@@ -600,12 +935,14 @@ class ZServerBuilder {
600
935
  *
601
936
  * @returns
602
937
  * This object.
603
- */
604
- assign(other) {
605
- this._server = Object.assign({}, this._server, other);
606
- return this;
607
- }
608
- /**
938
+ */ function assign(other) {
939
+ this._server = Object.assign({}, this._server, other);
940
+ return this;
941
+ }
942
+ },
943
+ {
944
+ key: "copy",
945
+ value: /**
609
946
  * Copies all properties in other to this object.
610
947
  *
611
948
  * @param other -
@@ -613,27 +950,25 @@ class ZServerBuilder {
613
950
  *
614
951
  * @returns
615
952
  * This object.
616
- */
617
- copy(other) {
618
- this._server = JSON.parse(JSON.stringify(other));
619
- return this;
620
- }
621
- /**
953
+ */ function copy(other) {
954
+ this._server = JSON.parse(JSON.stringify(other));
955
+ return this;
956
+ }
957
+ },
958
+ {
959
+ key: "build",
960
+ value: /**
622
961
  * Returns a copy of the built object.
623
962
  *
624
963
  * @returns
625
964
  * A copy of the built object.
626
- */
627
- build() {
628
- return JSON.parse(JSON.stringify(this._server));
629
- }
630
- }
631
- export {
632
- ZCookieBuilder,
633
- ZEmailBuilder,
634
- ZEmailContactAddressBuilder,
635
- ZEmailContactBuilder,
636
- ZEmailEnvelopeBuilder,
637
- ZServerBuilder
638
- };
965
+ */ function build() {
966
+ return JSON.parse(JSON.stringify(this._server));
967
+ }
968
+ }
969
+ ]);
970
+ return ZServerBuilder;
971
+ }();
972
+
973
+ export { ZCookieBuilder, ZEmailBuilder, ZEmailContactAddressBuilder, ZEmailContactBuilder, ZEmailEnvelopeBuilder, ZServerBuilder };
639
974
  //# sourceMappingURL=index.js.map