@zthun/helpful-internet 9.11.10 → 9.11.11

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.cjs CHANGED
@@ -1,714 +1,626 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- /**
6
- * Represents a generic cookie.
7
- */ function _define_property$5(obj, key, value) {
8
- if (key in obj) {
9
- Object.defineProperty(obj, key, {
10
- value: value,
11
- enumerable: true,
12
- configurable: true,
13
- writable: true
14
- });
15
- } else {
16
- obj[key] = value;
17
- }
18
- return obj;
19
- }
20
- /**
21
- * Represents a builder for an IZCookie object.
22
- */ class ZCookieBuilder {
23
- /**
24
- * Sets the cookie name.
25
- *
26
- * @param val -
27
- * The value to set.
28
- *
29
- * @returns
30
- * This object.
31
- */ name(val) {
32
- this._cookie.name = val;
33
- return this;
34
- }
35
- /**
36
- * Sets the cookie value.
37
- *
38
- * @param val -
39
- * The value to set.
40
- *
41
- * @returns
42
- * This object.
43
- */ value(val) {
44
- this._cookie.value = val;
45
- return this;
46
- }
47
- /**
48
- * Sets the cookie domain.
49
- *
50
- * @param val -
51
- * The value to set.
52
- *
53
- * @returns
54
- * This object.
55
- */ domain(val) {
56
- this._cookie.domain = val;
57
- return this;
58
- }
59
- /**
60
- * Sets the cookie expiration date.
61
- *
62
- * @param val -
63
- * The value to set.
64
- *
65
- * @returns
66
- * This object.
67
- */ expires(val) {
68
- if (val == null) {
69
- delete this._cookie.expires;
70
- return this;
71
- }
72
- this._cookie.expires = typeof val === "string" ? val : val.toJSON();
73
- return this;
74
- }
75
- /**
76
- * Sets the cookie expiration date to one day from the moment this is invoked.
77
- *
78
- * @returns
79
- * This object.
80
- */ expiresTomorrow() {
81
- return this.expires(new Date(Date.now() + ZCookieBuilder.MillisecondsOneDay));
82
- }
83
- /**
84
- * Sets the cookie secure flag.
85
- *
86
- * @param val -
87
- * The value to set.
88
- *
89
- * @returns
90
- * This object.
91
- */ secure(val = true) {
92
- this._cookie.secure = val;
93
- return this;
94
- }
95
- /**
96
- * Sets the cookie same site policy.
97
- *
98
- * @param val -
99
- * The value to set.
100
- *
101
- * @returns
102
- * This object.
103
- */ sameSite(val) {
104
- this._cookie.sameSite = val;
105
- return this;
106
- }
107
- /**
108
- * Sets the same site policy to 'none' and turns on the secure flag.
109
- *
110
- * @returns
111
- * This object.
112
- */ allowCrossSite() {
113
- return this.secure().sameSite("none");
114
- }
115
- /**
116
- * Sets the cookie http only flag.
117
- *
118
- * @param val -
119
- * The value to set.
120
- *
121
- * @returns
122
- * This object.
123
- */ httpOnly(val = true) {
124
- this._cookie.httpOnly = val;
125
- return this;
126
- }
127
- /**
128
- * Creates a token based authentication cookie.
129
- *
130
- * @param token -
131
- * The token value for the cookie. You
132
- * can leave this as undefined to set it
133
- * later.
134
- *
135
- * @returns
136
- * This object.
137
- */ authentication(token) {
138
- const builder = this.name("Authentication").expiresTomorrow().secure().httpOnly();
139
- return token == null ? builder : builder.value(token);
140
- }
141
- /**
142
- * Returns a copy of the built instance of the cookie.
143
- *
144
- * @returns
145
- * A shallow copy of the current cookie object.
146
- */ build() {
147
- return {
148
- ...this._cookie
149
- };
150
- }
151
- /**
152
- * Initializes a new instance of this object.
153
- */ constructor(){
154
- _define_property$5(this, "_cookie", void 0);
155
- /**
156
- * Removes the cookie expiration.
157
- *
158
- * @returns
159
- * This object.
160
- */ _define_property$5(this, "immortal", this.expires.bind(this, undefined));
161
- /**
162
- * Sets the same site policy to 'lax'
163
- *
164
- * @returns
165
- * This object.
166
- */ _define_property$5(this, "lax", this.sameSite.bind(this, "lax"));
167
- /**
168
- * Sets the same site polity to 'strict'
169
- *
170
- * @returns
171
- * This object.
172
- */ _define_property$5(this, "strict", this.sameSite.bind(this, "strict"));
173
- this._cookie = {
174
- name: "",
175
- value: ""
176
- };
177
- }
178
- }
179
- _define_property$5(ZCookieBuilder, "MillisecondsOneDay", 86400000);
180
-
181
- function _define_property$4(obj, key, value) {
182
- if (key in obj) {
183
- Object.defineProperty(obj, key, {
184
- value: value,
185
- enumerable: true,
186
- configurable: true,
187
- writable: true
188
- });
189
- } else {
190
- obj[key] = value;
191
- }
192
- return obj;
193
- }
194
- /**
195
- * Represents a builder that will build a comma separated
196
- * list of addresses for an email message.
197
- */ class ZEmailContactAddressBuilder {
198
- /**
199
- * Adds an address to the list to builder.
200
- *
201
- * @param val -
202
- * The address to add. This can be the empty string,
203
- * null, or undefined.
204
- *
205
- * @returns
206
- * This object.
207
- */ address(val) {
208
- this._addresses.push(val);
209
- return this;
210
- }
211
- /**
212
- * Sets the addresses to build from.
213
- *
214
- * @param val -
215
- * The address to set.
216
- *
217
- * @returns
218
- * This object.
219
- */ addresses(val) {
220
- this._addresses = val.slice();
221
- return this;
222
- }
223
- /**
224
- * Sets the delimiter to split the addresses with.
225
- *
226
- * The default is a comma with a space.
227
- *
228
- * @param val -
229
- * The delimiter to set.
230
- *
231
- * @returns
232
- * This object.
233
- */ delimiter(val) {
234
- this._delimiter = val;
235
- return this;
236
- }
237
- /**
238
- * Builds the delimiters separated list of addresses.
239
- *
240
- * @returns
241
- * The delimited separated list of addresses.
242
- */ build() {
243
- const addr = (ct)=>{
244
- if (!ct) {
245
- return undefined;
246
- }
247
- return typeof ct === "string" ? ct : ct.address;
248
- };
249
- const truthy = (ct)=>{
250
- return !!ct;
251
- };
252
- return this._addresses.map(addr).filter(truthy).join(this._delimiter);
253
- }
254
- constructor(){
255
- _define_property$4(this, "_addresses", []);
256
- _define_property$4(this, "_delimiter", ", ");
257
- }
258
- }
259
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/cookie/cookie.mts
260
3
  /**
261
- * Represents an email contact.
262
- */ function _define_property$3(obj, key, value) {
263
- if (key in obj) {
264
- Object.defineProperty(obj, key, {
265
- value: value,
266
- enumerable: true,
267
- configurable: true,
268
- writable: true
269
- });
270
- } else {
271
- obj[key] = value;
272
- }
273
- return obj;
274
- }
4
+ * Represents a generic cookie.
5
+ */ /**
6
+ * Represents a builder for an IZCookie object.
7
+ */ var ZCookieBuilder = class ZCookieBuilder {
8
+ static MillisecondsOneDay = 864e5;
9
+ _cookie;
10
+ /**
11
+ * Initializes a new instance of this object.
12
+ */ constructor() {
13
+ this._cookie = {
14
+ name: "",
15
+ value: ""
16
+ };
17
+ }
18
+ /**
19
+ * Sets the cookie name.
20
+ *
21
+ * @param val -
22
+ * The value to set.
23
+ *
24
+ * @returns
25
+ * This object.
26
+ */ name(val) {
27
+ this._cookie.name = val;
28
+ return this;
29
+ }
30
+ /**
31
+ * Sets the cookie value.
32
+ *
33
+ * @param val -
34
+ * The value to set.
35
+ *
36
+ * @returns
37
+ * This object.
38
+ */ value(val) {
39
+ this._cookie.value = val;
40
+ return this;
41
+ }
42
+ /**
43
+ * Sets the cookie domain.
44
+ *
45
+ * @param val -
46
+ * The value to set.
47
+ *
48
+ * @returns
49
+ * This object.
50
+ */ domain(val) {
51
+ this._cookie.domain = val;
52
+ return this;
53
+ }
54
+ /**
55
+ * Sets the cookie expiration date.
56
+ *
57
+ * @param val -
58
+ * The value to set.
59
+ *
60
+ * @returns
61
+ * This object.
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
+ /**
71
+ * Sets the cookie expiration date to one day from the moment this is invoked.
72
+ *
73
+ * @returns
74
+ * This object.
75
+ */ expiresTomorrow() {
76
+ return this.expires(new Date(Date.now() + ZCookieBuilder.MillisecondsOneDay));
77
+ }
78
+ /**
79
+ * Removes the cookie expiration.
80
+ *
81
+ * @returns
82
+ * This object.
83
+ */ immortal = this.expires.bind(this, void 0);
84
+ /**
85
+ * Sets the cookie secure flag.
86
+ *
87
+ * @param val -
88
+ * The value to set.
89
+ *
90
+ * @returns
91
+ * This object.
92
+ */ secure(val = true) {
93
+ this._cookie.secure = val;
94
+ return this;
95
+ }
96
+ /**
97
+ * Sets the cookie same site policy.
98
+ *
99
+ * @param val -
100
+ * The value to set.
101
+ *
102
+ * @returns
103
+ * This object.
104
+ */ sameSite(val) {
105
+ this._cookie.sameSite = val;
106
+ return this;
107
+ }
108
+ /**
109
+ * Sets the same site policy to 'lax'
110
+ *
111
+ * @returns
112
+ * This object.
113
+ */ lax = this.sameSite.bind(this, "lax");
114
+ /**
115
+ * Sets the same site polity to 'strict'
116
+ *
117
+ * @returns
118
+ * This object.
119
+ */ strict = this.sameSite.bind(this, "strict");
120
+ /**
121
+ * Sets the same site policy to 'none' and turns on the secure flag.
122
+ *
123
+ * @returns
124
+ * This object.
125
+ */ allowCrossSite() {
126
+ return this.secure().sameSite("none");
127
+ }
128
+ /**
129
+ * Sets the cookie http only flag.
130
+ *
131
+ * @param val -
132
+ * The value to set.
133
+ *
134
+ * @returns
135
+ * This object.
136
+ */ httpOnly(val = true) {
137
+ this._cookie.httpOnly = val;
138
+ return this;
139
+ }
140
+ /**
141
+ * Creates a token based authentication cookie.
142
+ *
143
+ * @param token -
144
+ * The token value for the cookie. You
145
+ * can leave this as undefined to set it
146
+ * later.
147
+ *
148
+ * @returns
149
+ * This object.
150
+ */ authentication(token) {
151
+ const builder = this.name("Authentication").expiresTomorrow().secure().httpOnly();
152
+ return token == null ? builder : builder.value(token);
153
+ }
154
+ /**
155
+ * Returns a copy of the built instance of the cookie.
156
+ *
157
+ * @returns
158
+ * A shallow copy of the current cookie object.
159
+ */ build() {
160
+ return { ...this._cookie };
161
+ }
162
+ };
163
+ //#endregion
164
+ //#region src/email/email-envelope.mts
275
165
  /**
276
- * Represents a builder for an email contact.
277
- */ class ZEmailContactBuilder {
278
- /**
279
- * Sets the address of the contact.
280
- *
281
- * @param val -
282
- * The value to set.
283
- *
284
- * @returns
285
- * This object.
286
- */ address(val) {
287
- this._contact.address = val;
288
- return this;
289
- }
290
- /**
291
- * Sets the type of the contact.
292
- *
293
- * @param val -
294
- * The value to set.
295
- *
296
- * @returns
297
- * This object.
298
- */ type(val) {
299
- this._contact.type = val;
300
- return this;
301
- }
302
- /**
303
- * Sets the display of the contact.
304
- *
305
- * @param val -
306
- * The value to set.
307
- *
308
- * @returns
309
- * This object.
310
- */ display(val) {
311
- this._contact.display = val;
312
- return this;
313
- }
314
- /**
315
- * Assigns the values in other to this object.
316
- *
317
- * @param other -
318
- * The value to partial copy.
319
- *
320
- * @returns
321
- * This object.
322
- */ assign(other) {
323
- this._contact = Object.assign({}, this._contact, other);
324
- this._contact = JSON.parse(JSON.stringify(this._contact));
325
- return this;
326
- }
327
- /**
328
- * Copies another object.
329
- *
330
- * @param other -
331
- * The value to copy.
332
- *
333
- * @returns
334
- * This object.
335
- */ copy(other) {
336
- this._contact = JSON.parse(JSON.stringify(other));
337
- return this;
338
- }
339
- /**
340
- * Returns a copy of the built object.
341
- *
342
- * @returns
343
- * A copy of the built email contact.
344
- */ build() {
345
- return JSON.parse(JSON.stringify(this._contact));
346
- }
347
- /**
348
- * Initializes a new instance of this object.
349
- */ constructor(){
350
- _define_property$3(this, "_contact", void 0);
351
- this._contact = {
352
- address: ""
353
- };
354
- }
355
- }
356
-
357
- function _define_property$2(obj, key, value) {
358
- if (key in obj) {
359
- Object.defineProperty(obj, key, {
360
- value: value,
361
- enumerable: true,
362
- configurable: true,
363
- writable: true
364
- });
365
- } else {
366
- obj[key] = value;
367
- }
368
- return obj;
369
- }
166
+ * Represents a builder for an email envelope.
167
+ */ var ZEmailEnvelopeBuilder = class {
168
+ _envelope;
169
+ /**
170
+ * Initializes a new instance of this object.
171
+ */ constructor() {
172
+ this._envelope = { from: "" };
173
+ }
174
+ /**
175
+ * Sets the from field.
176
+ *
177
+ * @param val -
178
+ * The value to set.
179
+ *
180
+ * @returns
181
+ * This object.
182
+ */ from(val) {
183
+ this._envelope.from = val;
184
+ return this;
185
+ }
186
+ /**
187
+ * Adds a value to the 'to' field.
188
+ *
189
+ * @param val -
190
+ * The value to add.
191
+ *
192
+ * @returns
193
+ * This object.
194
+ */ to(val) {
195
+ this._envelope.to = this._envelope.to || [];
196
+ this._envelope.to.push(val);
197
+ return this;
198
+ }
199
+ /**
200
+ * Sets the to field.
201
+ *
202
+ * @param val -
203
+ * The value to set.
204
+ *
205
+ * @returns
206
+ * This object.
207
+ */ tos(val) {
208
+ this._envelope.to = val;
209
+ return this;
210
+ }
211
+ /**
212
+ * Adds a value to the cc field.
213
+ *
214
+ * @param val -
215
+ * The value to add.
216
+ *
217
+ * @returns
218
+ * This object.
219
+ */ cc(val) {
220
+ this._envelope.cc = this._envelope.cc || [];
221
+ this._envelope.cc.push(val);
222
+ return this;
223
+ }
224
+ /**
225
+ * Sets the cc field.
226
+ *
227
+ * @param val -
228
+ * The value to set.
229
+ *
230
+ * @returns
231
+ * This object.
232
+ */ ccs(val) {
233
+ this._envelope.cc = val;
234
+ return this;
235
+ }
236
+ /**
237
+ * Adds a value to the bcc field.
238
+ *
239
+ * @param val -
240
+ * The value to add.
241
+ *
242
+ * @returns
243
+ * This object.
244
+ */ bcc(val) {
245
+ this._envelope.bcc = this._envelope.bcc || [];
246
+ this._envelope.bcc.push(val);
247
+ return this;
248
+ }
249
+ /**
250
+ * Sets the bcc field.
251
+ *
252
+ * @param val -
253
+ * The value to set.
254
+ *
255
+ * @returns
256
+ * This object.
257
+ */ bccs(val) {
258
+ this._envelope.bcc = val;
259
+ return this;
260
+ }
261
+ /**
262
+ * Assigns another partial email envelope to this object.
263
+ *
264
+ * @param other -
265
+ * The value to partial copy.
266
+ *
267
+ * @returns
268
+ * This object.
269
+ */ assign(other) {
270
+ this._envelope = Object.assign({}, this._envelope, other);
271
+ this._envelope = JSON.parse(JSON.stringify(this._envelope));
272
+ return this;
273
+ }
274
+ /**
275
+ * Copies another email envelope to this object.
276
+ *
277
+ * @param other -
278
+ * The value to copy.
279
+ *
280
+ * @returns
281
+ * This object.
282
+ */ copy(other) {
283
+ this._envelope = JSON.parse(JSON.stringify(other));
284
+ return this;
285
+ }
286
+ /**
287
+ * Returns a copy of the built envelope.
288
+ *
289
+ * @returns
290
+ * A copy of the currently built up envelope object.
291
+ */ build() {
292
+ return JSON.parse(JSON.stringify(this._envelope));
293
+ }
294
+ };
295
+ //#endregion
296
+ //#region src/email/email.mts
370
297
  /**
371
- * Represents a builder for an email envelope.
372
- */ class ZEmailEnvelopeBuilder {
373
- /**
374
- * Sets the from field.
375
- *
376
- * @param val -
377
- * The value to set.
378
- *
379
- * @returns
380
- * This object.
381
- */ from(val) {
382
- this._envelope.from = val;
383
- return this;
384
- }
385
- /**
386
- * Adds a value to the 'to' field.
387
- *
388
- * @param val -
389
- * The value to add.
390
- *
391
- * @returns
392
- * This object.
393
- */ to(val) {
394
- this._envelope.to = this._envelope.to || [];
395
- this._envelope.to.push(val);
396
- return this;
397
- }
398
- /**
399
- * Sets the to field.
400
- *
401
- * @param val -
402
- * The value to set.
403
- *
404
- * @returns
405
- * This object.
406
- */ tos(val) {
407
- this._envelope.to = val;
408
- return this;
409
- }
410
- /**
411
- * Adds a value to the cc field.
412
- *
413
- * @param val -
414
- * The value to add.
415
- *
416
- * @returns
417
- * This object.
418
- */ cc(val) {
419
- this._envelope.cc = this._envelope.cc || [];
420
- this._envelope.cc.push(val);
421
- return this;
422
- }
423
- /**
424
- * Sets the cc field.
425
- *
426
- * @param val -
427
- * The value to set.
428
- *
429
- * @returns
430
- * This object.
431
- */ ccs(val) {
432
- this._envelope.cc = val;
433
- return this;
434
- }
435
- /**
436
- * Adds a value to the bcc field.
437
- *
438
- * @param val -
439
- * The value to add.
440
- *
441
- * @returns
442
- * This object.
443
- */ bcc(val) {
444
- this._envelope.bcc = this._envelope.bcc || [];
445
- this._envelope.bcc.push(val);
446
- return this;
447
- }
448
- /**
449
- * Sets the bcc field.
450
- *
451
- * @param val -
452
- * The value to set.
453
- *
454
- * @returns
455
- * This object.
456
- */ bccs(val) {
457
- this._envelope.bcc = val;
458
- return this;
459
- }
460
- /**
461
- * Assigns another partial email envelope to this object.
462
- *
463
- * @param other -
464
- * The value to partial copy.
465
- *
466
- * @returns
467
- * This object.
468
- */ assign(other) {
469
- this._envelope = Object.assign({}, this._envelope, other);
470
- this._envelope = JSON.parse(JSON.stringify(this._envelope));
471
- return this;
472
- }
473
- /**
474
- * Copies another email envelope to this object.
475
- *
476
- * @param other -
477
- * The value to copy.
478
- *
479
- * @returns
480
- * This object.
481
- */ copy(other) {
482
- this._envelope = JSON.parse(JSON.stringify(other));
483
- return this;
484
- }
485
- /**
486
- * Returns a copy of the built envelope.
487
- *
488
- * @returns
489
- * A copy of the currently built up envelope object.
490
- */ build() {
491
- return JSON.parse(JSON.stringify(this._envelope));
492
- }
493
- /**
494
- * Initializes a new instance of this object.
495
- */ constructor(){
496
- _define_property$2(this, "_envelope", void 0);
497
- this._envelope = {
498
- from: ""
499
- };
500
- }
501
- }
502
-
503
- function _define_property$1(obj, key, value) {
504
- if (key in obj) {
505
- Object.defineProperty(obj, key, {
506
- value: value,
507
- enumerable: true,
508
- configurable: true,
509
- writable: true
510
- });
511
- } else {
512
- obj[key] = value;
513
- }
514
- return obj;
515
- }
298
+ * Represents a builder for an email.
299
+ */ var ZEmailBuilder = class {
300
+ _email;
301
+ /**
302
+ * Initializes a new instance of this object.
303
+ */ constructor() {
304
+ this._email = { envelope: new ZEmailEnvelopeBuilder().build() };
305
+ }
306
+ /**
307
+ * Sets the envelope of where the email is going.
308
+ *
309
+ * @param val -
310
+ * The value to set.
311
+ *
312
+ * @returns
313
+ * This object.
314
+ */ envelope(val) {
315
+ this._email.envelope = val;
316
+ return this;
317
+ }
318
+ /**
319
+ * Sets the subject line of the email.
320
+ *
321
+ * @param val -
322
+ * The value to set.
323
+ *
324
+ * @returns
325
+ * This object.
326
+ */ subject(val) {
327
+ this._email.subject = val;
328
+ return this;
329
+ }
330
+ /**
331
+ * Sets the message of the email.
332
+ *
333
+ * The message can be raw text or html.
334
+ *
335
+ * @param val -
336
+ * A html enabled formatted message to set.
337
+ *
338
+ * @returns
339
+ * This object.
340
+ */ message(val) {
341
+ this._email.message = val;
342
+ return this;
343
+ }
344
+ /**
345
+ * Assigns the other object to the current email object.
346
+ *
347
+ * @param other -
348
+ * The object to copy.
349
+ *
350
+ * @returns
351
+ * This object.
352
+ */ assign(other) {
353
+ this._email = Object.assign(this._email, other);
354
+ this._email = JSON.parse(JSON.stringify(this._email));
355
+ return this;
356
+ }
357
+ /**
358
+ * Copies another email into the builder.
359
+ *
360
+ * @param other -
361
+ * The object to copy.
362
+ *
363
+ * @returns
364
+ * This object.
365
+ */ copy(other) {
366
+ this._email = JSON.parse(JSON.stringify(other));
367
+ return this;
368
+ }
369
+ /**
370
+ * Returns a copy of the built object.
371
+ *
372
+ * @returns
373
+ * A copy of the built object.
374
+ */ build() {
375
+ return JSON.parse(JSON.stringify(this._email));
376
+ }
377
+ };
378
+ //#endregion
379
+ //#region src/email/email-contact.mts
516
380
  /**
517
- * Represents a builder for an email.
518
- */ class ZEmailBuilder {
519
- /**
520
- * Sets the envelope of where the email is going.
521
- *
522
- * @param val -
523
- * The value to set.
524
- *
525
- * @returns
526
- * This object.
527
- */ envelope(val) {
528
- this._email.envelope = val;
529
- return this;
530
- }
531
- /**
532
- * Sets the subject line of the email.
533
- *
534
- * @param val -
535
- * The value to set.
536
- *
537
- * @returns
538
- * This object.
539
- */ subject(val) {
540
- this._email.subject = val;
541
- return this;
542
- }
543
- /**
544
- * Sets the message of the email.
545
- *
546
- * The message can be raw text or html.
547
- *
548
- * @param val -
549
- * A html enabled formatted message to set.
550
- *
551
- * @returns
552
- * This object.
553
- */ message(val) {
554
- this._email.message = val;
555
- return this;
556
- }
557
- /**
558
- * Assigns the other object to the current email object.
559
- *
560
- * @param other -
561
- * The object to copy.
562
- *
563
- * @returns
564
- * This object.
565
- */ assign(other) {
566
- this._email = Object.assign(this._email, other);
567
- this._email = JSON.parse(JSON.stringify(this._email));
568
- return this;
569
- }
570
- /**
571
- * Copies another email into the builder.
572
- *
573
- * @param other -
574
- * The object to copy.
575
- *
576
- * @returns
577
- * This object.
578
- */ copy(other) {
579
- this._email = JSON.parse(JSON.stringify(other));
580
- return this;
581
- }
582
- /**
583
- * Returns a copy of the built object.
584
- *
585
- * @returns
586
- * A copy of the built object.
587
- */ build() {
588
- return JSON.parse(JSON.stringify(this._email));
589
- }
590
- /**
591
- * Initializes a new instance of this object.
592
- */ constructor(){
593
- _define_property$1(this, "_email", void 0);
594
- this._email = {
595
- envelope: new ZEmailEnvelopeBuilder().build()
596
- };
597
- }
598
- }
599
-
381
+ * Represents an email contact.
382
+ */ /**
383
+ * Represents a builder for an email contact.
384
+ */ var ZEmailContactBuilder = class {
385
+ _contact;
386
+ /**
387
+ * Initializes a new instance of this object.
388
+ */ constructor() {
389
+ this._contact = { address: "" };
390
+ }
391
+ /**
392
+ * Sets the address of the contact.
393
+ *
394
+ * @param val -
395
+ * The value to set.
396
+ *
397
+ * @returns
398
+ * This object.
399
+ */ address(val) {
400
+ this._contact.address = val;
401
+ return this;
402
+ }
403
+ /**
404
+ * Sets the type of the contact.
405
+ *
406
+ * @param val -
407
+ * The value to set.
408
+ *
409
+ * @returns
410
+ * This object.
411
+ */ type(val) {
412
+ this._contact.type = val;
413
+ return this;
414
+ }
415
+ /**
416
+ * Sets the display of the contact.
417
+ *
418
+ * @param val -
419
+ * The value to set.
420
+ *
421
+ * @returns
422
+ * This object.
423
+ */ display(val) {
424
+ this._contact.display = val;
425
+ return this;
426
+ }
427
+ /**
428
+ * Assigns the values in other to this object.
429
+ *
430
+ * @param other -
431
+ * The value to partial copy.
432
+ *
433
+ * @returns
434
+ * This object.
435
+ */ assign(other) {
436
+ this._contact = Object.assign({}, this._contact, other);
437
+ this._contact = JSON.parse(JSON.stringify(this._contact));
438
+ return this;
439
+ }
440
+ /**
441
+ * Copies another object.
442
+ *
443
+ * @param other -
444
+ * The value to copy.
445
+ *
446
+ * @returns
447
+ * This object.
448
+ */ copy(other) {
449
+ this._contact = JSON.parse(JSON.stringify(other));
450
+ return this;
451
+ }
452
+ /**
453
+ * Returns a copy of the built object.
454
+ *
455
+ * @returns
456
+ * A copy of the built email contact.
457
+ */ build() {
458
+ return JSON.parse(JSON.stringify(this._contact));
459
+ }
460
+ };
461
+ //#endregion
462
+ //#region src/email/email-contact-address.mts
600
463
  /**
601
- * Represents an abstract server connection.
602
- */ function _define_property(obj, key, value) {
603
- if (key in obj) {
604
- Object.defineProperty(obj, key, {
605
- value: value,
606
- enumerable: true,
607
- configurable: true,
608
- writable: true
609
- });
610
- } else {
611
- obj[key] = value;
612
- }
613
- return obj;
614
- }
464
+ * Represents a builder that will build a comma separated
465
+ * list of addresses for an email message.
466
+ */ var ZEmailContactAddressBuilder = class {
467
+ _addresses = [];
468
+ _delimiter = ", ";
469
+ /**
470
+ * Adds an address to the list to builder.
471
+ *
472
+ * @param val -
473
+ * The address to add. This can be the empty string,
474
+ * null, or undefined.
475
+ *
476
+ * @returns
477
+ * This object.
478
+ */ address(val) {
479
+ this._addresses.push(val);
480
+ return this;
481
+ }
482
+ /**
483
+ * Sets the addresses to build from.
484
+ *
485
+ * @param val -
486
+ * The address to set.
487
+ *
488
+ * @returns
489
+ * This object.
490
+ */ addresses(val) {
491
+ this._addresses = val.slice();
492
+ return this;
493
+ }
494
+ /**
495
+ * Sets the delimiter to split the addresses with.
496
+ *
497
+ * The default is a comma with a space.
498
+ *
499
+ * @param val -
500
+ * The delimiter to set.
501
+ *
502
+ * @returns
503
+ * This object.
504
+ */ delimiter(val) {
505
+ this._delimiter = val;
506
+ return this;
507
+ }
508
+ /**
509
+ * Builds the delimiters separated list of addresses.
510
+ *
511
+ * @returns
512
+ * The delimited separated list of addresses.
513
+ */ build() {
514
+ const addr = (ct) => {
515
+ if (!ct) return;
516
+ return typeof ct === "string" ? ct : ct.address;
517
+ };
518
+ const truthy = (ct) => {
519
+ return !!ct;
520
+ };
521
+ return this._addresses.map(addr).filter(truthy).join(this._delimiter);
522
+ }
523
+ };
524
+ //#endregion
525
+ //#region src/server/server.mts
615
526
  /**
616
- * Represents a builder for a server object.
617
- */ class ZServerBuilder {
618
- /**
619
- * The server ip address or hostname.
620
- *
621
- * @param val -
622
- * The value to set.
623
- *
624
- * @returns
625
- * This object.
626
- */ address(val) {
627
- this._server.address = val;
628
- return this;
629
- }
630
- /**
631
- * Sets the optional port to connect on.
632
- *
633
- * @param val -
634
- * The value to set.
635
- *
636
- * @returns
637
- * This object.
638
- */ port(val) {
639
- this._server.port = val;
640
- return this;
641
- }
642
- /**
643
- * Sets the optional username to connect on.
644
- *
645
- * @param val -
646
- * The value to set.
647
- *
648
- * @returns
649
- * This object.
650
- */ username(val) {
651
- this._server.username = val;
652
- return this;
653
- }
654
- /**
655
- * Sets the password to connect on.
656
- *
657
- * @param val -
658
- * The value to set.
659
- *
660
- * @returns
661
- * This object.
662
- */ password(val) {
663
- this._server.password = val;
664
- return this;
665
- }
666
- /**
667
- * Assigns all truthy properties in other to this object.
668
- *
669
- * @param other -
670
- * The server object to copy.
671
- *
672
- * @returns
673
- * This object.
674
- */ assign(other) {
675
- this._server = Object.assign({}, this._server, other);
676
- return this;
677
- }
678
- /**
679
- * Copies all properties in other to this object.
680
- *
681
- * @param other -
682
- * The server object to copy.
683
- *
684
- * @returns
685
- * This object.
686
- */ copy(other) {
687
- this._server = JSON.parse(JSON.stringify(other));
688
- return this;
689
- }
690
- /**
691
- * Returns a copy of the built object.
692
- *
693
- * @returns
694
- * A copy of the built object.
695
- */ build() {
696
- return JSON.parse(JSON.stringify(this._server));
697
- }
698
- /**
699
- * Initializes a new instance of this object.
700
- */ constructor(){
701
- _define_property(this, "_server", void 0);
702
- this._server = {
703
- address: ""
704
- };
705
- }
706
- }
707
-
527
+ * Represents an abstract server connection.
528
+ */ /**
529
+ * Represents a builder for a server object.
530
+ */ var ZServerBuilder = class {
531
+ _server;
532
+ /**
533
+ * Initializes a new instance of this object.
534
+ */ constructor() {
535
+ this._server = { address: "" };
536
+ }
537
+ /**
538
+ * The server ip address or hostname.
539
+ *
540
+ * @param val -
541
+ * The value to set.
542
+ *
543
+ * @returns
544
+ * This object.
545
+ */ address(val) {
546
+ this._server.address = val;
547
+ return this;
548
+ }
549
+ /**
550
+ * Sets the optional port to connect on.
551
+ *
552
+ * @param val -
553
+ * The value to set.
554
+ *
555
+ * @returns
556
+ * This object.
557
+ */ port(val) {
558
+ this._server.port = val;
559
+ return this;
560
+ }
561
+ /**
562
+ * Sets the optional username to connect on.
563
+ *
564
+ * @param val -
565
+ * The value to set.
566
+ *
567
+ * @returns
568
+ * This object.
569
+ */ username(val) {
570
+ this._server.username = val;
571
+ return this;
572
+ }
573
+ /**
574
+ * Sets the password to connect on.
575
+ *
576
+ * @param val -
577
+ * The value to set.
578
+ *
579
+ * @returns
580
+ * This object.
581
+ */ password(val) {
582
+ this._server.password = val;
583
+ return this;
584
+ }
585
+ /**
586
+ * Assigns all truthy properties in other to this object.
587
+ *
588
+ * @param other -
589
+ * The server object to copy.
590
+ *
591
+ * @returns
592
+ * This object.
593
+ */ assign(other) {
594
+ this._server = Object.assign({}, this._server, other);
595
+ return this;
596
+ }
597
+ /**
598
+ * Copies all properties in other to this object.
599
+ *
600
+ * @param other -
601
+ * The server object to copy.
602
+ *
603
+ * @returns
604
+ * This object.
605
+ */ copy(other) {
606
+ this._server = JSON.parse(JSON.stringify(other));
607
+ return this;
608
+ }
609
+ /**
610
+ * Returns a copy of the built object.
611
+ *
612
+ * @returns
613
+ * A copy of the built object.
614
+ */ build() {
615
+ return JSON.parse(JSON.stringify(this._server));
616
+ }
617
+ };
618
+ //#endregion
708
619
  exports.ZCookieBuilder = ZCookieBuilder;
709
620
  exports.ZEmailBuilder = ZEmailBuilder;
710
621
  exports.ZEmailContactAddressBuilder = ZEmailContactAddressBuilder;
711
622
  exports.ZEmailContactBuilder = ZEmailContactBuilder;
712
623
  exports.ZEmailEnvelopeBuilder = ZEmailEnvelopeBuilder;
713
624
  exports.ZServerBuilder = ZServerBuilder;
714
- //# sourceMappingURL=index.cjs.map
625
+
626
+ //# sourceMappingURL=index.cjs.map