@dereekb/model 13.2.2 → 13.3.1

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/index.esm.js CHANGED
@@ -1,65 +1,61 @@
1
- import { US_STATE_CODE_STRING_REGEX, splitJoinRemainder, filterFalsyAndEmptyValues, isolateWebsitePathFunction, toRelativeSlashPathStartType, addPrefix, hasWebsiteDomain, toAbsoluteSlashPathStartType, removeHttpFromUrl, forEachKeyValue, iterableToArray, arrayToObject, MAP_IDENTITY, makeValuesGroupMap, cachedGetter, filterMaybeArrayValues, sortByNumberFunction, performAsyncTasks, pushArrayItemsIntoArray, mapPromiseOrValue, isISO8601DayString, isMinuteOfDay, isE164PhoneNumber, isE164PhoneNumberWithExtension, isValidLatLngPoint, isLatLngString, isUniqueKeyedFunction, isWebsiteUrl, isWebsiteUrlWithPrefix } from '@dereekb/util';
1
+ import { US_STATE_CODE_STRING_REGEX, splitJoinRemainder, filterFalsyAndEmptyValues, isolateWebsitePathFunction, toRelativeSlashPathStartType, addPrefix, hasWebsiteDomain, toAbsoluteSlashPathStartType, removeHttpFromUrl, arrayToObject, forEachKeyValue, iterableToArray, MAP_IDENTITY, makeValuesGroupMap, cachedGetter, pushArrayItemsIntoArray, performAsyncTasks, filterMaybeArrayValues, sortByNumberFunction, mapPromiseOrValue, isISO8601DayString, isMinuteOfDay, isE164PhoneNumber, isE164PhoneNumberWithExtension, isValidLatLngPoint, isLatLngString, isUniqueKeyedFunction, isWebsiteUrl, isWebsiteUrlWithPrefix } from '@dereekb/util';
2
2
  import { type } from 'arktype';
3
3
  import { BaseError } from 'make-error';
4
4
 
5
5
  /**
6
6
  * Maximum character length for address line fields (line1, line2).
7
- */
8
- const ADDRESS_LINE_MAX_LENGTH = 50;
7
+ */ var ADDRESS_LINE_MAX_LENGTH = 50;
9
8
  /**
10
9
  * Maximum character length for city names.
11
- */
12
- const ADDRESS_CITY_MAX_LENGTH = 80;
10
+ */ var ADDRESS_CITY_MAX_LENGTH = 80;
13
11
  /**
14
12
  * Maximum character length for full state names (e.g., "Texas").
15
- */
16
- const ADDRESS_STATE_MAX_LENGTH = 30;
13
+ */ var ADDRESS_STATE_MAX_LENGTH = 30;
17
14
  /**
18
15
  * Maximum character length for two-letter state codes (e.g., "TX").
19
- */
20
- const ADDRESS_STATE_CODE_MAX_LENGTH = 2;
16
+ */ var ADDRESS_STATE_CODE_MAX_LENGTH = 2;
21
17
  /**
22
18
  * Maximum character length for ZIP codes, accommodating ZIP+4 format (e.g., "77834-1234").
23
- */
24
- const ADDRESS_ZIP_MAX_LENGTH = 11;
19
+ */ var ADDRESS_ZIP_MAX_LENGTH = 11;
25
20
  /**
26
21
  * Maximum character length for country names.
27
- */
28
- const ADDRESS_COUNTRY_MAX_LENGTH = 80;
22
+ */ var ADDRESS_COUNTRY_MAX_LENGTH = 80;
29
23
  /**
30
24
  * Base ArkType schema for United States address fields without the state.
31
- */
32
- const baseUnitedStatesAddressType = type({
33
- line1: `0 < string <= ${ADDRESS_LINE_MAX_LENGTH}`,
34
- 'line2?': `string <= ${ADDRESS_LINE_MAX_LENGTH}`,
35
- city: `0 < string <= ${ADDRESS_CITY_MAX_LENGTH}`,
36
- zip: [/^\d{5}(-\d{4})?$/, '&', `string <= ${ADDRESS_ZIP_MAX_LENGTH}`]
25
+ */ var baseUnitedStatesAddressType = type({
26
+ line1: "0 < string <= ".concat(ADDRESS_LINE_MAX_LENGTH),
27
+ 'line2?': "string <= ".concat(ADDRESS_LINE_MAX_LENGTH),
28
+ city: "0 < string <= ".concat(ADDRESS_CITY_MAX_LENGTH),
29
+ zip: [
30
+ /^\d{5}(-\d{4})?$/,
31
+ '&',
32
+ "string <= ".concat(ADDRESS_ZIP_MAX_LENGTH)
33
+ ]
37
34
  });
38
35
  /**
39
36
  * ArkType schema for a United States address with a two-letter state code (e.g., "TX").
40
- */
41
- const unitedStatesAddressWithStateCodeType = baseUnitedStatesAddressType.merge({
42
- state: [US_STATE_CODE_STRING_REGEX, '&', `${ADDRESS_STATE_CODE_MAX_LENGTH} <= string <= ${ADDRESS_STATE_CODE_MAX_LENGTH}`]
37
+ */ var unitedStatesAddressWithStateCodeType = baseUnitedStatesAddressType.merge({
38
+ state: [
39
+ US_STATE_CODE_STRING_REGEX,
40
+ '&',
41
+ "".concat(ADDRESS_STATE_CODE_MAX_LENGTH, " <= string <= ").concat(ADDRESS_STATE_CODE_MAX_LENGTH)
42
+ ]
43
43
  });
44
44
  /**
45
45
  * ArkType schema for a United States address with a full state name (e.g., "Texas").
46
- */
47
- const unitedStatesAddressWithStateStringType = baseUnitedStatesAddressType.merge({
48
- state: `0 < string <= ${ADDRESS_STATE_MAX_LENGTH}`
46
+ */ var unitedStatesAddressWithStateStringType = baseUnitedStatesAddressType.merge({
47
+ state: "0 < string <= ".concat(ADDRESS_STATE_MAX_LENGTH)
49
48
  });
50
49
 
51
50
  /**
52
51
  * Fallback link type used when the actual type is not known.
53
- */
54
- const UNKNOWN_WEBSITE_LINK_TYPE = 'u';
52
+ */ var UNKNOWN_WEBSITE_LINK_TYPE = 'u';
55
53
  /**
56
54
  * Maximum character length for a {@link WebsiteLinkType} string.
57
- */
58
- const WEBSITE_LINK_TYPE_MAX_LENGTH = 32;
55
+ */ var WEBSITE_LINK_TYPE_MAX_LENGTH = 32;
59
56
  /**
60
57
  * Regex pattern that validates a {@link WebsiteLinkType} as 1-32 alphanumeric characters.
61
- */
62
- const WEBSITE_LINK_TYPE_REGEX = /^[a-zA-Z0-9]{1,32}$/;
58
+ */ var WEBSITE_LINK_TYPE_REGEX = /^[a-zA-Z0-9]{1,32}$/;
63
59
  /**
64
60
  * Checks whether the given string is a valid {@link WebsiteLinkType}.
65
61
  *
@@ -72,64 +68,114 @@ const WEBSITE_LINK_TYPE_REGEX = /^[a-zA-Z0-9]{1,32}$/;
72
68
  * isValidWebsiteLinkType(''); // false
73
69
  * isValidWebsiteLinkType('a-b'); // false (hyphen not allowed)
74
70
  * ```
75
- */
76
- function isValidWebsiteLinkType(input) {
71
+ */ function isValidWebsiteLinkType(input) {
77
72
  return WEBSITE_LINK_TYPE_REGEX.test(input);
78
73
  }
79
74
  /**
80
75
  * Maximum character length for the encoded data string in a {@link WebsiteLink}.
81
- */
82
- const WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH = 1000;
76
+ */ var WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH = 1000;
83
77
  /**
84
78
  * ArkType schema for a {@link WebsiteLink}.
85
- */
86
- const websiteLinkType = type({
87
- t: [WEBSITE_LINK_TYPE_REGEX, '&', `0 < string <= ${WEBSITE_LINK_TYPE_MAX_LENGTH}`],
88
- d: `0 < string <= ${WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH}`
79
+ */ var websiteLinkType = type({
80
+ t: [
81
+ WEBSITE_LINK_TYPE_REGEX,
82
+ '&',
83
+ "0 < string <= ".concat(WEBSITE_LINK_TYPE_MAX_LENGTH)
84
+ ],
85
+ d: "0 < string <= ".concat(WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH)
89
86
  });
90
87
 
88
+ function _array_like_to_array$2(arr, len) {
89
+ if (len == null || len > arr.length) len = arr.length;
90
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
91
+ return arr2;
92
+ }
93
+ function _array_with_holes$2(arr) {
94
+ if (Array.isArray(arr)) return arr;
95
+ }
96
+ function _iterable_to_array_limit$2(arr, i) {
97
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
98
+ if (_i == null) return;
99
+ var _arr = [];
100
+ var _n = true;
101
+ var _d = false;
102
+ var _s, _e;
103
+ try {
104
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
105
+ _arr.push(_s.value);
106
+ if (i && _arr.length === i) break;
107
+ }
108
+ } catch (err) {
109
+ _d = true;
110
+ _e = err;
111
+ } finally{
112
+ try {
113
+ if (!_n && _i["return"] != null) _i["return"]();
114
+ } finally{
115
+ if (_d) throw _e;
116
+ }
117
+ }
118
+ return _arr;
119
+ }
120
+ function _non_iterable_rest$2() {
121
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
122
+ }
123
+ function _sliced_to_array$2(arr, i) {
124
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
125
+ }
126
+ function _unsupported_iterable_to_array$2(o, minLen) {
127
+ if (!o) return;
128
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
129
+ var n = Object.prototype.toString.call(o).slice(8, -1);
130
+ if (n === "Object" && o.constructor) n = o.constructor.name;
131
+ if (n === "Map" || n === "Set") return Array.from(n);
132
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
133
+ }
91
134
  /**
92
135
  * Maximum character length for a {@link WebsiteFileLinkType}. Matches {@link WEBSITE_LINK_TYPE_MAX_LENGTH}.
93
- */
94
- const WEBSITE_FILE_LINK_TYPE_MAX_LENGTH = WEBSITE_LINK_TYPE_MAX_LENGTH;
136
+ */ var WEBSITE_FILE_LINK_TYPE_MAX_LENGTH = WEBSITE_LINK_TYPE_MAX_LENGTH;
95
137
  /**
96
138
  * Validation regex for {@link WebsiteFileLinkType}. Matches {@link WEBSITE_LINK_TYPE_REGEX}.
97
- */
98
- const WEBSITE_FILE_LINK_TYPE_REGEX = WEBSITE_LINK_TYPE_REGEX;
139
+ */ var WEBSITE_FILE_LINK_TYPE_REGEX = WEBSITE_LINK_TYPE_REGEX;
99
140
  /**
100
141
  * Maximum character length for a {@link WebsiteFileLinkMimeType}.
101
- */
102
- const WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH = 128;
142
+ */ var WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH = 128;
103
143
  /**
104
144
  * Regex pattern that validates a MIME type string (e.g., "text/plain", "application/vnd.api+json").
105
- */
106
- const WEBSITE_FILE_LINK_MIME_TYPE_REGEX = /^\w+\/[-+.\w]+$/;
145
+ */ var WEBSITE_FILE_LINK_MIME_TYPE_REGEX = /^\w+\/[-+.\w]+$/;
107
146
  /**
108
147
  * Maximum character length for a {@link WebsiteFileLinkName}.
109
- */
110
- const WEBSITE_FILE_LINK_NAME_MAX_LENGTH = 128;
148
+ */ var WEBSITE_FILE_LINK_NAME_MAX_LENGTH = 128;
111
149
  /**
112
150
  * Maximum character length for {@link WebsiteFileLinkData}, derived from the total encoded data budget
113
151
  * minus the separator characters, type, MIME type, and name fields.
114
- */
115
- const WEBSITE_FILE_LINK_DATA_MAX_LENGTH = WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH - 3 - WEBSITE_FILE_LINK_TYPE_MAX_LENGTH - WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH - WEBSITE_FILE_LINK_NAME_MAX_LENGTH;
152
+ */ var WEBSITE_FILE_LINK_DATA_MAX_LENGTH = WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH - 3 - WEBSITE_FILE_LINK_TYPE_MAX_LENGTH - WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH - WEBSITE_FILE_LINK_NAME_MAX_LENGTH;
116
153
  /**
117
154
  * Regex pattern for file link data — disallows the pipe character since it is used as the encoding separator.
118
- */
119
- const WEBSITE_FILE_LINK_DATA_REGEX = /^[^|]+$/;
155
+ */ var WEBSITE_FILE_LINK_DATA_REGEX = /^[^|]+$/;
120
156
  /**
121
157
  * ArkType schema for a {@link WebsiteFileLink}.
122
- */
123
- const websiteFileLinkType = type({
124
- 'type?': [WEBSITE_FILE_LINK_TYPE_REGEX, '&', `string <= ${WEBSITE_LINK_TYPE_MAX_LENGTH}`],
125
- 'mime?': [WEBSITE_FILE_LINK_MIME_TYPE_REGEX, '&', `string <= ${WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH}`],
126
- 'name?': `string <= ${WEBSITE_FILE_LINK_NAME_MAX_LENGTH}`,
127
- data: [WEBSITE_FILE_LINK_DATA_REGEX, '&', `0 < string <= ${WEBSITE_FILE_LINK_DATA_MAX_LENGTH}`]
158
+ */ var websiteFileLinkType = type({
159
+ 'type?': [
160
+ WEBSITE_FILE_LINK_TYPE_REGEX,
161
+ '&',
162
+ "string <= ".concat(WEBSITE_LINK_TYPE_MAX_LENGTH)
163
+ ],
164
+ 'mime?': [
165
+ WEBSITE_FILE_LINK_MIME_TYPE_REGEX,
166
+ '&',
167
+ "string <= ".concat(WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH)
168
+ ],
169
+ 'name?': "string <= ".concat(WEBSITE_FILE_LINK_NAME_MAX_LENGTH),
170
+ data: [
171
+ WEBSITE_FILE_LINK_DATA_REGEX,
172
+ '&',
173
+ "0 < string <= ".concat(WEBSITE_FILE_LINK_DATA_MAX_LENGTH)
174
+ ]
128
175
  });
129
176
  /**
130
177
  * The {@link WebsiteLinkType} code used to identify a {@link WebsiteLink} as a file link.
131
- */
132
- const WEBSITE_FILE_LINK_WEBSITE_LINK_TYPE = 'f';
178
+ */ var WEBSITE_FILE_LINK_WEBSITE_LINK_TYPE = 'f';
133
179
  /**
134
180
  * Converts a {@link WebsiteFileLink} to a {@link WebsiteLink} by encoding its fields into the data string.
135
181
  *
@@ -142,8 +188,7 @@ const WEBSITE_FILE_LINK_WEBSITE_LINK_TYPE = 'f';
142
188
  * const link = websiteFileLinkToWebsiteLink(fileLink);
143
189
  * // link.t === 'f'
144
190
  * ```
145
- */
146
- function websiteFileLinkToWebsiteLink(input) {
191
+ */ function websiteFileLinkToWebsiteLink(input) {
147
192
  return {
148
193
  t: WEBSITE_FILE_LINK_WEBSITE_LINK_TYPE,
149
194
  d: encodeWebsiteFileLinkToWebsiteLinkEncodedData(input)
@@ -161,15 +206,13 @@ function websiteFileLinkToWebsiteLink(input) {
161
206
  * const fileLink = websiteLinkToWebsiteLinkFile(link);
162
207
  * // fileLink.data === 'https://example.com/file.txt'
163
208
  * ```
164
- */
165
- function websiteLinkToWebsiteLinkFile(input) {
166
- const encodedData = input.d;
209
+ */ function websiteLinkToWebsiteLinkFile(input) {
210
+ var encodedData = input.d;
167
211
  return decodeWebsiteLinkEncodedDataToWebsiteFileLink(encodedData);
168
212
  }
169
213
  /**
170
214
  * Separator character used when encoding/decoding file link fields into a single string.
171
- */
172
- const WEBSITE_FILE_LINK_ENCODE_SEPARATOR = '|';
215
+ */ var WEBSITE_FILE_LINK_ENCODE_SEPARATOR = '|';
173
216
  /**
174
217
  * Encodes a {@link WebsiteFileLink} into a pipe-separated string suitable for storage in a {@link WebsiteLink}'s data field.
175
218
  *
@@ -188,9 +231,15 @@ const WEBSITE_FILE_LINK_ENCODE_SEPARATOR = '|';
188
231
  * });
189
232
  * // encoded === 't|test/test|https://example.com/|test-name'
190
233
  * ```
191
- */
192
- function encodeWebsiteFileLinkToWebsiteLinkEncodedData(input) {
193
- const encoded = [input.type, input.mime, input.data, input.name].map((x) => x || '').join(WEBSITE_FILE_LINK_ENCODE_SEPARATOR);
234
+ */ function encodeWebsiteFileLinkToWebsiteLinkEncodedData(input) {
235
+ var encoded = [
236
+ input.type,
237
+ input.mime,
238
+ input.data,
239
+ input.name
240
+ ].map(function(x) {
241
+ return x || '';
242
+ }).join(WEBSITE_FILE_LINK_ENCODE_SEPARATOR);
194
243
  return encoded;
195
244
  }
196
245
  /**
@@ -209,14 +258,13 @@ function encodeWebsiteFileLinkToWebsiteLinkEncodedData(input) {
209
258
  * // fileLink.data === 'https://example.com/'
210
259
  * // fileLink.name === 'test-name'
211
260
  * ```
212
- */
213
- function decodeWebsiteLinkEncodedDataToWebsiteFileLink(input) {
214
- const [type, mime, data, name] = splitJoinRemainder(input, WEBSITE_FILE_LINK_ENCODE_SEPARATOR, 4);
261
+ */ function decodeWebsiteLinkEncodedDataToWebsiteFileLink(input) {
262
+ var _splitJoinRemainder = _sliced_to_array$2(splitJoinRemainder(input, WEBSITE_FILE_LINK_ENCODE_SEPARATOR, 4), 4), _$type = _splitJoinRemainder[0], mime = _splitJoinRemainder[1], data = _splitJoinRemainder[2], name = _splitJoinRemainder[3];
215
263
  return filterFalsyAndEmptyValues({
216
- type,
217
- mime,
218
- name,
219
- data
264
+ type: _$type,
265
+ mime: mime,
266
+ name: name,
267
+ data: data
220
268
  });
221
269
  }
222
270
 
@@ -231,8 +279,7 @@ function decodeWebsiteLinkEncodedDataToWebsiteFileLink(input) {
231
279
  * WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID('https://www.facebook.com/myuser');
232
280
  * // returns 'myuser'
233
281
  * ```
234
- */
235
- const WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID = isolateWebsitePathFunction({
282
+ */ var WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID = isolateWebsitePathFunction({
236
283
  isolatePathComponents: 0,
237
284
  removeTrailingSlash: true,
238
285
  removeQueryParameters: true
@@ -254,13 +301,11 @@ const WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID = isolateWebsitePathFunction({
254
301
  * usernameFromUsernameOrWebsiteWithBaseUrlUsername('myuser', '@');
255
302
  * // returns '@myuser'
256
303
  * ```
257
- */
258
- function usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, prefix) {
259
- const username = toRelativeSlashPathStartType(WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID(usernameOrWebsiteUrlToWebsiteUrl(input)));
304
+ */ function usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, prefix) {
305
+ var username = toRelativeSlashPathStartType(WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID(usernameOrWebsiteUrlToWebsiteUrl(input)));
260
306
  if (prefix) {
261
307
  return addPrefix(prefix, username);
262
- }
263
- else {
308
+ } else {
264
309
  return username;
265
310
  }
266
311
  }
@@ -272,8 +317,7 @@ function usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, prefix) {
272
317
  * @param input - a username or full profile URL
273
318
  * @param isolateFn - custom function that extracts the relevant path segment from the URL
274
319
  * @returns the isolated username
275
- */
276
- function usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, isolateFn) {
320
+ */ function usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, isolateFn) {
277
321
  return toRelativeSlashPathStartType(isolateFn(usernameOrWebsiteUrlToWebsiteUrl(input)));
278
322
  }
279
323
  /**
@@ -283,15 +327,13 @@ function usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, isolateFn
283
327
  *
284
328
  * @param input - a username or website URL
285
329
  * @returns a normalized website URL
286
- */
287
- function usernameOrWebsiteUrlToWebsiteUrl(input) {
330
+ */ function usernameOrWebsiteUrlToWebsiteUrl(input) {
288
331
  return hasWebsiteDomain(input) ? input : toAbsoluteSlashPathStartType(removeHttpFromUrl(input));
289
332
  }
290
333
  // MARK: Website
291
334
  /**
292
335
  * {@link WebsiteLinkType} code for generic website URLs.
293
- */
294
- const WEBSITE_URL_WEBSITE_LINK_TYPE = 'w';
336
+ */ var WEBSITE_URL_WEBSITE_LINK_TYPE = 'w';
295
337
  /**
296
338
  * Converts a generic website URL into a {@link WebsiteLink}, stripping the HTTP/HTTPS protocol.
297
339
  *
@@ -303,8 +345,7 @@ const WEBSITE_URL_WEBSITE_LINK_TYPE = 'w';
303
345
  * const link = websiteUrlToWebsiteLink('https://example.com/page');
304
346
  * // link.t === 'w', link.d === 'example.com/page'
305
347
  * ```
306
- */
307
- function websiteUrlToWebsiteLink(input) {
348
+ */ function websiteUrlToWebsiteLink(input) {
308
349
  return {
309
350
  t: WEBSITE_URL_WEBSITE_LINK_TYPE,
310
351
  d: removeHttpFromUrl(input) // website urls are stored as-is without http/https
@@ -313,15 +354,13 @@ function websiteUrlToWebsiteLink(input) {
313
354
  // MARK: Email
314
355
  /**
315
356
  * {@link WebsiteLinkType} code for email addresses.
316
- */
317
- const EMAIL_URL_WEBSITE_LINK_TYPE = 'e';
357
+ */ var EMAIL_URL_WEBSITE_LINK_TYPE = 'e';
318
358
  /**
319
359
  * Converts an email address into a {@link WebsiteLink}.
320
360
  *
321
361
  * @param input - the email address
322
362
  * @returns a WebsiteLink storing the email as data
323
- */
324
- function emailAddressToWebsiteLink(input) {
363
+ */ function emailAddressToWebsiteLink(input) {
325
364
  return {
326
365
  t: EMAIL_URL_WEBSITE_LINK_TYPE,
327
366
  d: input
@@ -330,25 +369,21 @@ function emailAddressToWebsiteLink(input) {
330
369
  // MARK: Phone
331
370
  /**
332
371
  * {@link WebsiteLinkType} code for phone numbers.
333
- */
334
- const PHONE_URL_WEBSITE_LINK_TYPE = 'p';
372
+ */ var PHONE_URL_WEBSITE_LINK_TYPE = 'p';
335
373
  /**
336
374
  * Converts an E.164 phone number into a {@link WebsiteLink}.
337
375
  *
338
376
  * @param input - the phone number in E.164 format
339
377
  * @returns a WebsiteLink storing the phone number as data
340
- */
341
- function phoneNumberToWebsiteLink(input) {
378
+ */ function phoneNumberToWebsiteLink(input) {
342
379
  return {
343
380
  t: PHONE_URL_WEBSITE_LINK_TYPE,
344
381
  d: input
345
382
  };
346
383
  }
347
384
  // MARK: Facebook
348
- /** Base URL for Facebook profiles. */
349
- const FACEBOOK_BASE_URL = `https://www.facebook.com`;
350
- /** {@link WebsiteLinkType} code for Facebook. */
351
- const FACEBOOK_WEBSITE_LINK_TYPE = 'fb';
385
+ /** Base URL for Facebook profiles. */ var FACEBOOK_BASE_URL = "https://www.facebook.com";
386
+ /** {@link WebsiteLinkType} code for Facebook. */ var FACEBOOK_WEBSITE_LINK_TYPE = 'fb';
352
387
  /**
353
388
  * Converts a Facebook profile ID or URL into a {@link WebsiteLink}.
354
389
  *
@@ -365,8 +400,7 @@ const FACEBOOK_WEBSITE_LINK_TYPE = 'fb';
365
400
  * facebookProfileUrlToWebsiteLink('myuser');
366
401
  * // { t: 'fb', d: 'myuser' }
367
402
  * ```
368
- */
369
- function facebookProfileUrlToWebsiteLink(input) {
403
+ */ function facebookProfileUrlToWebsiteLink(input) {
370
404
  return {
371
405
  t: FACEBOOK_WEBSITE_LINK_TYPE,
372
406
  d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
@@ -377,22 +411,18 @@ function facebookProfileUrlToWebsiteLink(input) {
377
411
  *
378
412
  * @param profileId - the Facebook profile ID or username
379
413
  * @returns the full profile URL
380
- */
381
- function facebookProfileUrl(profileId) {
382
- return `${FACEBOOK_BASE_URL}/${profileId}`;
414
+ */ function facebookProfileUrl(profileId) {
415
+ return "".concat(FACEBOOK_BASE_URL, "/").concat(profileId);
383
416
  }
384
417
  // MARK: Instagram
385
- /** Base URL for Instagram profiles. */
386
- const INSTAGRAM_BASE_URL = `https://www.instagram.com`;
387
- /** {@link WebsiteLinkType} code for Instagram. */
388
- const INSTAGRAM_WEBSITE_LINK_TYPE = 'ig';
418
+ /** Base URL for Instagram profiles. */ var INSTAGRAM_BASE_URL = "https://www.instagram.com";
419
+ /** {@link WebsiteLinkType} code for Instagram. */ var INSTAGRAM_WEBSITE_LINK_TYPE = 'ig';
389
420
  /**
390
421
  * Converts an Instagram profile ID or URL into a {@link WebsiteLink}.
391
422
  *
392
423
  * @param input - an Instagram username or full profile URL
393
424
  * @returns a WebsiteLink with the isolated username as data
394
- */
395
- function instagramProfileUrlToWebsiteLink(input) {
425
+ */ function instagramProfileUrlToWebsiteLink(input) {
396
426
  return {
397
427
  t: INSTAGRAM_WEBSITE_LINK_TYPE,
398
428
  d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
@@ -403,22 +433,18 @@ function instagramProfileUrlToWebsiteLink(input) {
403
433
  *
404
434
  * @param profileId - the Instagram username
405
435
  * @returns the full profile URL
406
- */
407
- function instagramProfileUrl(profileId) {
408
- return `${INSTAGRAM_BASE_URL}/${profileId}`;
436
+ */ function instagramProfileUrl(profileId) {
437
+ return "".concat(INSTAGRAM_BASE_URL, "/").concat(profileId);
409
438
  }
410
439
  // MARK: Twitter
411
- /** Base URL for Twitter profiles. */
412
- const TWITTER_BASE_URL = `https://www.twitter.com`;
413
- /** {@link WebsiteLinkType} code for Twitter. */
414
- const TWITTER_WEBSITE_LINK_TYPE = 'tw';
440
+ /** Base URL for Twitter profiles. */ var TWITTER_BASE_URL = "https://www.twitter.com";
441
+ /** {@link WebsiteLinkType} code for Twitter. */ var TWITTER_WEBSITE_LINK_TYPE = 'tw';
415
442
  /**
416
443
  * Converts a Twitter profile ID or URL into a {@link WebsiteLink}.
417
444
  *
418
445
  * @param input - a Twitter username or full profile URL
419
446
  * @returns a WebsiteLink with the isolated username as data
420
- */
421
- function twitterProfileUrlToWebsiteLink(input) {
447
+ */ function twitterProfileUrlToWebsiteLink(input) {
422
448
  return {
423
449
  t: TWITTER_WEBSITE_LINK_TYPE,
424
450
  d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
@@ -429,17 +455,13 @@ function twitterProfileUrlToWebsiteLink(input) {
429
455
  *
430
456
  * @param profileId - the Twitter username
431
457
  * @returns the full profile URL
432
- */
433
- function twitterProfileUrl(profileId) {
434
- return `${TWITTER_BASE_URL}/${profileId}`;
458
+ */ function twitterProfileUrl(profileId) {
459
+ return "".concat(TWITTER_BASE_URL, "/").concat(profileId);
435
460
  }
436
461
  // MARK: Tiktok
437
- /** Base URL for TikTok profiles. */
438
- const TIKTOK_BASE_URL = `https://tiktok.com`;
439
- /** TikTok usernames are prefixed with "@" in URLs and stored data. */
440
- const TIKTOK_USERNAME_PREFIX = '@';
441
- /** {@link WebsiteLinkType} code for TikTok. */
442
- const TIKTOK_WEBSITE_LINK_TYPE = 'tt';
462
+ /** Base URL for TikTok profiles. */ var TIKTOK_BASE_URL = "https://tiktok.com";
463
+ /** TikTok usernames are prefixed with "@" in URLs and stored data. */ var TIKTOK_USERNAME_PREFIX = '@';
464
+ /** {@link WebsiteLinkType} code for TikTok. */ var TIKTOK_WEBSITE_LINK_TYPE = 'tt';
443
465
  /**
444
466
  * Converts a TikTok profile ID or URL into a {@link WebsiteLink}.
445
467
  *
@@ -447,8 +469,7 @@ const TIKTOK_WEBSITE_LINK_TYPE = 'tt';
447
469
  *
448
470
  * @param input - a TikTok username (with or without "@") or full profile URL
449
471
  * @returns a WebsiteLink with the "@"-prefixed username as data
450
- */
451
- function tiktokProfileUrlToWebsiteLink(input) {
472
+ */ function tiktokProfileUrlToWebsiteLink(input) {
452
473
  return {
453
474
  t: TIKTOK_WEBSITE_LINK_TYPE,
454
475
  d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, TIKTOK_USERNAME_PREFIX)
@@ -459,19 +480,15 @@ function tiktokProfileUrlToWebsiteLink(input) {
459
480
  *
460
481
  * @param profileId - the TikTok username (without "@" prefix)
461
482
  * @returns the full profile URL with "@" prefix
462
- */
463
- function tiktokProfileUrl(profileId) {
464
- return `${TIKTOK_BASE_URL}/@${profileId}`;
483
+ */ function tiktokProfileUrl(profileId) {
484
+ return "".concat(TIKTOK_BASE_URL, "/@").concat(profileId);
465
485
  }
466
486
  // MARK: Snapchat
467
- /** Base URL for Snapchat profiles. */
468
- const SNAPCHAT_BASE_URL = `https://snapchat.com`;
469
- /** {@link WebsiteLinkType} code for Snapchat. */
470
- const SNAPCHAT_WEBSITE_LINK_TYPE = 'sc';
487
+ /** Base URL for Snapchat profiles. */ var SNAPCHAT_BASE_URL = "https://snapchat.com";
488
+ /** {@link WebsiteLinkType} code for Snapchat. */ var SNAPCHAT_WEBSITE_LINK_TYPE = 'sc';
471
489
  /**
472
490
  * Isolates a Snapchat username from a URL, ignoring the `/add/` base path segment.
473
- */
474
- const SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
491
+ */ var SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
475
492
  ignoredBasePath: 'add',
476
493
  isolatePathComponents: 0,
477
494
  removeTrailingSlash: true,
@@ -484,8 +501,7 @@ const SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
484
501
  *
485
502
  * @param input - a Snapchat username or full profile URL
486
503
  * @returns a WebsiteLink with the isolated username as data
487
- */
488
- function snapchatProfileUrlToWebsiteLink(input) {
504
+ */ function snapchatProfileUrlToWebsiteLink(input) {
489
505
  return {
490
506
  t: SNAPCHAT_WEBSITE_LINK_TYPE,
491
507
  d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID)
@@ -496,19 +512,15 @@ function snapchatProfileUrlToWebsiteLink(input) {
496
512
  *
497
513
  * @param profileId - the Snapchat username
498
514
  * @returns the full profile URL with `/add/` path
499
- */
500
- function snapchatProfileUrl(profileId) {
501
- return `${SNAPCHAT_BASE_URL}/add/${profileId}`;
515
+ */ function snapchatProfileUrl(profileId) {
516
+ return "".concat(SNAPCHAT_BASE_URL, "/add/").concat(profileId);
502
517
  }
503
518
  // MARK: YouTube
504
- /** Base URL for YouTube channels. */
505
- const YOUTUBE_BASE_URL = `https://youtube.com`;
506
- /** {@link WebsiteLinkType} code for YouTube. */
507
- const YOUTUBE_WEBSITE_LINK_TYPE = 'yt';
519
+ /** Base URL for YouTube channels. */ var YOUTUBE_BASE_URL = "https://youtube.com";
520
+ /** {@link WebsiteLinkType} code for YouTube. */ var YOUTUBE_WEBSITE_LINK_TYPE = 'yt';
508
521
  /**
509
522
  * Isolates a YouTube channel name from a URL, ignoring the `/c/` base path segment.
510
- */
511
- const YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
523
+ */ var YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
512
524
  ignoredBasePath: 'c',
513
525
  isolatePathComponents: 0,
514
526
  removeTrailingSlash: true,
@@ -521,8 +533,7 @@ const YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
521
533
  *
522
534
  * @param input - a YouTube channel name or full channel URL
523
535
  * @returns a WebsiteLink with the isolated channel name as data
524
- */
525
- function youtubeProfileUrlToWebsiteLink(input) {
536
+ */ function youtubeProfileUrlToWebsiteLink(input) {
526
537
  return {
527
538
  t: YOUTUBE_WEBSITE_LINK_TYPE,
528
539
  d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID)
@@ -533,22 +544,18 @@ function youtubeProfileUrlToWebsiteLink(input) {
533
544
  *
534
545
  * @param profileId - the YouTube channel name
535
546
  * @returns the full channel URL with `/c/` path
536
- */
537
- function youtubeProfileUrl(profileId) {
538
- return `${YOUTUBE_BASE_URL}/c/${profileId}`;
547
+ */ function youtubeProfileUrl(profileId) {
548
+ return "".concat(YOUTUBE_BASE_URL, "/c/").concat(profileId);
539
549
  }
540
550
  // MARK: PayPal
541
- /** Base URL for PayPal.me profiles. */
542
- const PAYPAL_BASE_URL = `https://paypal.me`;
543
- /** {@link WebsiteLinkType} code for PayPal. */
544
- const PAYPAL_WEBSITE_LINK_TYPE = 'pp';
551
+ /** Base URL for PayPal.me profiles. */ var PAYPAL_BASE_URL = "https://paypal.me";
552
+ /** {@link WebsiteLinkType} code for PayPal. */ var PAYPAL_WEBSITE_LINK_TYPE = 'pp';
545
553
  /**
546
554
  * Converts a PayPal profile ID or URL into a {@link WebsiteLink}.
547
555
  *
548
556
  * @param input - a PayPal username or full PayPal.me URL
549
557
  * @returns a WebsiteLink with the isolated username as data
550
- */
551
- function paypalProfileUrlToWebsiteLink(input) {
558
+ */ function paypalProfileUrlToWebsiteLink(input) {
552
559
  return {
553
560
  t: PAYPAL_WEBSITE_LINK_TYPE,
554
561
  d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
@@ -559,17 +566,13 @@ function paypalProfileUrlToWebsiteLink(input) {
559
566
  *
560
567
  * @param profileId - the PayPal username
561
568
  * @returns the full PayPal.me URL
562
- */
563
- function paypalProfileUrl(profileId) {
564
- return `${PAYPAL_BASE_URL}/${profileId}`;
569
+ */ function paypalProfileUrl(profileId) {
570
+ return "".concat(PAYPAL_BASE_URL, "/").concat(profileId);
565
571
  }
566
572
  // MARK: Cashapp
567
- /** Base URL for Cash App profiles. */
568
- const CASHAPP_BASE_URL = `https://cash.app`;
569
- /** Cash App usernames are prefixed with "$" (cashtag). */
570
- const CASHAPP_USERNAME_PREFIX = '$';
571
- /** {@link WebsiteLinkType} code for Cash App. */
572
- const CASHAPP_WEBSITE_LINK_TYPE = 'ca';
573
+ /** Base URL for Cash App profiles. */ var CASHAPP_BASE_URL = "https://cash.app";
574
+ /** Cash App usernames are prefixed with "$" (cashtag). */ var CASHAPP_USERNAME_PREFIX = '$';
575
+ /** {@link WebsiteLinkType} code for Cash App. */ var CASHAPP_WEBSITE_LINK_TYPE = 'ca';
573
576
  /**
574
577
  * Converts a Cash App profile ID or URL into a {@link WebsiteLink}.
575
578
  *
@@ -577,8 +580,7 @@ const CASHAPP_WEBSITE_LINK_TYPE = 'ca';
577
580
  *
578
581
  * @param input - a Cash App username (with or without "$") or full profile URL
579
582
  * @returns a WebsiteLink with the "$"-prefixed username as data
580
- */
581
- function cashappProfileUrlToWebsiteLink(input) {
583
+ */ function cashappProfileUrlToWebsiteLink(input) {
582
584
  return {
583
585
  t: CASHAPP_WEBSITE_LINK_TYPE,
584
586
  d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, CASHAPP_USERNAME_PREFIX)
@@ -589,19 +591,15 @@ function cashappProfileUrlToWebsiteLink(input) {
589
591
  *
590
592
  * @param profileId - the Cash App username (without "$" prefix)
591
593
  * @returns the full Cash App URL with "$" prefix
592
- */
593
- function cashappProfileUrl(profileId) {
594
- return `${CASHAPP_BASE_URL}/$${profileId}`;
594
+ */ function cashappProfileUrl(profileId) {
595
+ return "".concat(CASHAPP_BASE_URL, "/$").concat(profileId);
595
596
  }
596
597
  // MARK: Venmo
597
- /** Base URL for Venmo profiles. */
598
- const VENMO_BASE_URL = `https://account.venmo.com`;
599
- /** {@link WebsiteLinkType} code for Venmo. */
600
- const VENMO_WEBSITE_LINK_TYPE = 'vn';
598
+ /** Base URL for Venmo profiles. */ var VENMO_BASE_URL = "https://account.venmo.com";
599
+ /** {@link WebsiteLinkType} code for Venmo. */ var VENMO_WEBSITE_LINK_TYPE = 'vn';
601
600
  /**
602
601
  * Isolates a Venmo username from a URL, ignoring the `/u/` base path segment.
603
- */
604
- const VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
602
+ */ var VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
605
603
  ignoredBasePath: 'u',
606
604
  isolatePathComponents: 0,
607
605
  removeTrailingSlash: true,
@@ -614,8 +612,7 @@ const VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
614
612
  *
615
613
  * @param input - a Venmo username or full profile URL
616
614
  * @returns a WebsiteLink with the isolated username as data
617
- */
618
- function venmoProfileUrlToWebsiteLink(input) {
615
+ */ function venmoProfileUrlToWebsiteLink(input) {
619
616
  return {
620
617
  t: VENMO_WEBSITE_LINK_TYPE,
621
618
  d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID)
@@ -626,19 +623,15 @@ function venmoProfileUrlToWebsiteLink(input) {
626
623
  *
627
624
  * @param profileId - the Venmo username
628
625
  * @returns the full profile URL with `/u/` path
629
- */
630
- function venmoProfileUrl(profileId) {
631
- return `${VENMO_BASE_URL}/u/${profileId}`;
626
+ */ function venmoProfileUrl(profileId) {
627
+ return "".concat(VENMO_BASE_URL, "/u/").concat(profileId);
632
628
  }
633
629
  // MARK: Spotify
634
- /** Base URL for Spotify profiles. */
635
- const SPOTIFY_BASE_URL = `https://open.spotify.com/`;
636
- /** {@link WebsiteLinkType} code for Spotify. */
637
- const SPOTIFY_WEBSITE_LINK_TYPE = 'sp';
630
+ /** Base URL for Spotify profiles. */ var SPOTIFY_BASE_URL = "https://open.spotify.com/";
631
+ /** {@link WebsiteLinkType} code for Spotify. */ var SPOTIFY_WEBSITE_LINK_TYPE = 'sp';
638
632
  /**
639
633
  * Isolates a Spotify username from a URL, ignoring the `/user/` base path segment.
640
- */
641
- const SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
634
+ */ var SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
642
635
  ignoredBasePath: 'user',
643
636
  isolatePathComponents: 0,
644
637
  removeTrailingSlash: true,
@@ -651,8 +644,7 @@ const SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID = isolateWebsitePathFunction({
651
644
  *
652
645
  * @param input - a Spotify username or full profile URL
653
646
  * @returns a WebsiteLink with the isolated username as data
654
- */
655
- function spotifyProfileUrlToWebsiteLink(input) {
647
+ */ function spotifyProfileUrlToWebsiteLink(input) {
656
648
  return {
657
649
  t: SPOTIFY_WEBSITE_LINK_TYPE,
658
650
  d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID)
@@ -663,14 +655,90 @@ function spotifyProfileUrlToWebsiteLink(input) {
663
655
  *
664
656
  * @param profileId - the Spotify username
665
657
  * @returns the full profile URL with `/user/` path
666
- */
667
- function spotifyProfileUrl(profileId) {
668
- return `${SPOTIFY_BASE_URL}/user/${profileId}`;
658
+ */ function spotifyProfileUrl(profileId) {
659
+ return "".concat(SPOTIFY_BASE_URL, "/user/").concat(profileId);
669
660
  }
670
661
 
671
- const GRANTED_SYS_ADMIN_ROLE_KEY = 'sysadmin';
672
- const GRANTED_OWNER_ROLE_KEY = 'owner';
673
- const GRANTED_ADMIN_ROLE_KEY = 'admin';
662
+ function _array_like_to_array$1(arr, len) {
663
+ if (len == null || len > arr.length) len = arr.length;
664
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
665
+ return arr2;
666
+ }
667
+ function _array_with_holes$1(arr) {
668
+ if (Array.isArray(arr)) return arr;
669
+ }
670
+ function _class_call_check$2(instance, Constructor) {
671
+ if (!(instance instanceof Constructor)) {
672
+ throw new TypeError("Cannot call a class as a function");
673
+ }
674
+ }
675
+ function _defineProperties$1(target, props) {
676
+ for(var i = 0; i < props.length; i++){
677
+ var descriptor = props[i];
678
+ descriptor.enumerable = descriptor.enumerable || false;
679
+ descriptor.configurable = true;
680
+ if ("value" in descriptor) descriptor.writable = true;
681
+ Object.defineProperty(target, descriptor.key, descriptor);
682
+ }
683
+ }
684
+ function _create_class$1(Constructor, protoProps, staticProps) {
685
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
686
+ return Constructor;
687
+ }
688
+ function _define_property$3(obj, key, value) {
689
+ if (key in obj) {
690
+ Object.defineProperty(obj, key, {
691
+ value: value,
692
+ enumerable: true,
693
+ configurable: true,
694
+ writable: true
695
+ });
696
+ } else {
697
+ obj[key] = value;
698
+ }
699
+ return obj;
700
+ }
701
+ function _iterable_to_array_limit$1(arr, i) {
702
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
703
+ if (_i == null) return;
704
+ var _arr = [];
705
+ var _n = true;
706
+ var _d = false;
707
+ var _s, _e;
708
+ try {
709
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
710
+ _arr.push(_s.value);
711
+ if (i && _arr.length === i) break;
712
+ }
713
+ } catch (err) {
714
+ _d = true;
715
+ _e = err;
716
+ } finally{
717
+ try {
718
+ if (!_n && _i["return"] != null) _i["return"]();
719
+ } finally{
720
+ if (_d) throw _e;
721
+ }
722
+ }
723
+ return _arr;
724
+ }
725
+ function _non_iterable_rest$1() {
726
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
727
+ }
728
+ function _sliced_to_array$1(arr, i) {
729
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
730
+ }
731
+ function _unsupported_iterable_to_array$1(o, minLen) {
732
+ if (!o) return;
733
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
734
+ var n = Object.prototype.toString.call(o).slice(8, -1);
735
+ if (n === "Object" && o.constructor) n = o.constructor.name;
736
+ if (n === "Map" || n === "Set") return Array.from(n);
737
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
738
+ }
739
+ var GRANTED_SYS_ADMIN_ROLE_KEY = 'sysadmin';
740
+ var GRANTED_OWNER_ROLE_KEY = 'owner';
741
+ var GRANTED_ADMIN_ROLE_KEY = 'admin';
674
742
  /**
675
743
  * Checks whether the given role represents an admin-level permission (either "admin" or "owner").
676
744
  *
@@ -683,15 +751,14 @@ const GRANTED_ADMIN_ROLE_KEY = 'admin';
683
751
  * isGrantedAdminLevelRole('owner'); // true
684
752
  * isGrantedAdminLevelRole('read'); // false
685
753
  * ```
686
- */
687
- function isGrantedAdminLevelRole(role) {
754
+ */ function isGrantedAdminLevelRole(role) {
688
755
  return role === GRANTED_ADMIN_ROLE_KEY || role === GRANTED_OWNER_ROLE_KEY;
689
756
  }
690
- const GRANTED_READ_ROLE_KEY = 'read';
691
- const GRANTED_UPDATE_ROLE_KEY = 'update';
692
- const GRANTED_DELETE_ROLE_KEY = 'delete';
693
- const FULL_ACCESS_ROLE_KEY = '__FULL__';
694
- const NO_ACCESS_ROLE_KEY = '__EMPTY__';
757
+ var GRANTED_READ_ROLE_KEY = 'read';
758
+ var GRANTED_UPDATE_ROLE_KEY = 'update';
759
+ var GRANTED_DELETE_ROLE_KEY = 'delete';
760
+ var FULL_ACCESS_ROLE_KEY = '__FULL__';
761
+ var NO_ACCESS_ROLE_KEY = '__EMPTY__';
695
762
  /**
696
763
  * Creates a {@link GrantedRoleMap} that explicitly denies all access.
697
764
  *
@@ -702,19 +769,15 @@ const NO_ACCESS_ROLE_KEY = '__EMPTY__';
702
769
  * const map = noAccessRoleMap();
703
770
  * isNoAccessRoleMap(map); // true
704
771
  * ```
705
- */
706
- function noAccessRoleMap() {
707
- return {
708
- [NO_ACCESS_ROLE_KEY]: true
709
- };
772
+ */ function noAccessRoleMap() {
773
+ return _define_property$3({}, NO_ACCESS_ROLE_KEY, true);
710
774
  }
711
775
  /**
712
776
  * Type guard that checks whether a role map is a no-access map.
713
777
  *
714
778
  * @param input - the role map to check
715
779
  * @returns true if the map has the no-access marker
716
- */
717
- function isNoAccessRoleMap(input) {
780
+ */ function isNoAccessRoleMap(input) {
718
781
  return input[NO_ACCESS_ROLE_KEY] === true;
719
782
  }
720
783
  /**
@@ -727,19 +790,15 @@ function isNoAccessRoleMap(input) {
727
790
  * const map = fullAccessRoleMap();
728
791
  * isFullAccessRoleMap(map); // true
729
792
  * ```
730
- */
731
- function fullAccessRoleMap() {
732
- return {
733
- [FULL_ACCESS_ROLE_KEY]: true
734
- };
793
+ */ function fullAccessRoleMap() {
794
+ return _define_property$3({}, FULL_ACCESS_ROLE_KEY, true);
735
795
  }
736
796
  /**
737
797
  * Type guard that checks whether a role map is a full-access map.
738
798
  *
739
799
  * @param input - the role map to check
740
800
  * @returns true if the map has the full-access marker
741
- */
742
- function isFullAccessRoleMap(input) {
801
+ */ function isFullAccessRoleMap(input) {
743
802
  return input[FULL_ACCESS_ROLE_KEY] === true;
744
803
  }
745
804
  /**
@@ -761,66 +820,124 @@ function isFullAccessRoleMap(input) {
761
820
  * reader.containsRoles('any', ['read']); // true
762
821
  * reader.containsRoles('all', ['read', 'delete']); // false
763
822
  * ```
764
- */
765
- function grantedRoleMapReader(map) {
823
+ */ function grantedRoleMapReader(map) {
766
824
  return new GrantedRoleMapReaderInstance(map);
767
825
  }
768
- class GrantedRoleMapReaderInstance {
769
- _map;
770
- constructor(map) {
826
+ var GrantedRoleMapReaderInstance = /*#__PURE__*/ function() {
827
+ function GrantedRoleMapReaderInstance(map) {
828
+ _class_call_check$2(this, GrantedRoleMapReaderInstance);
829
+ _define_property$3(this, "_map", void 0);
771
830
  this._map = map;
772
831
  }
773
- hasNoAccess() {
774
- return this._map[NO_ACCESS_ROLE_KEY];
775
- }
776
- truthMap(input) {
777
- const result = {};
778
- forEachKeyValue(input, {
779
- forEach: ([role, value]) => {
780
- if (this.hasRole(role)) {
781
- result[role] = value;
832
+ _create_class$1(GrantedRoleMapReaderInstance, [
833
+ {
834
+ key: "hasNoAccess",
835
+ value: function hasNoAccess() {
836
+ return this._map[NO_ACCESS_ROLE_KEY];
837
+ }
838
+ },
839
+ {
840
+ key: "truthMap",
841
+ value: function truthMap(input) {
842
+ var _this = this;
843
+ var result = {};
844
+ forEachKeyValue(input, {
845
+ forEach: function forEach(param) {
846
+ var _param = _sliced_to_array$1(param, 2), role = _param[0], value = _param[1];
847
+ if (_this.hasRole(role)) {
848
+ result[role] = value;
849
+ }
850
+ }
851
+ });
852
+ return result;
853
+ }
854
+ },
855
+ {
856
+ key: "hasRole",
857
+ value: function hasRole(role) {
858
+ return this.hasRoles('any', role);
859
+ }
860
+ },
861
+ {
862
+ key: "hasRoles",
863
+ value: function hasRoles(setIncludes, inputRoles) {
864
+ if (this._map[FULL_ACCESS_ROLE_KEY]) {
865
+ return true;
866
+ } else {
867
+ return this.containsRoles(setIncludes, inputRoles);
782
868
  }
783
869
  }
784
- });
785
- return result;
786
- }
787
- hasRole(role) {
788
- return this.hasRoles('any', role);
789
- }
790
- hasRoles(setIncludes, inputRoles) {
791
- if (this._map[FULL_ACCESS_ROLE_KEY]) {
792
- return true;
793
- }
794
- else {
795
- return this.containsRoles(setIncludes, inputRoles);
796
- }
797
- }
798
- containsRoles(setIncludes, inputRoles) {
799
- const roles = iterableToArray(inputRoles);
800
- if (setIncludes === 'any') {
801
- return this.containsAnyRole(roles);
802
- }
803
- else {
804
- return this.containsEachRole(roles);
805
- }
806
- }
807
- containsAnyRole(roles) {
808
- for (const role of roles) {
809
- if (this._map[role]) {
810
- return true;
870
+ },
871
+ {
872
+ key: "containsRoles",
873
+ value: function containsRoles(setIncludes, inputRoles) {
874
+ var roles = iterableToArray(inputRoles);
875
+ if (setIncludes === 'any') {
876
+ return this.containsAnyRole(roles);
877
+ } else {
878
+ return this.containsEachRole(roles);
879
+ }
811
880
  }
812
- }
813
- return false;
814
- }
815
- containsEachRole(roles) {
816
- for (const role of roles) {
817
- if (!this._map[role]) {
881
+ },
882
+ {
883
+ key: "containsAnyRole",
884
+ value: function containsAnyRole(roles) {
885
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
886
+ try {
887
+ for(var _iterator = roles[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
888
+ var role = _step.value;
889
+ if (this._map[role]) {
890
+ return true;
891
+ }
892
+ }
893
+ } catch (err) {
894
+ _didIteratorError = true;
895
+ _iteratorError = err;
896
+ } finally{
897
+ try {
898
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
899
+ _iterator.return();
900
+ }
901
+ } finally{
902
+ if (_didIteratorError) {
903
+ throw _iteratorError;
904
+ }
905
+ }
906
+ }
818
907
  return false;
819
908
  }
909
+ },
910
+ {
911
+ key: "containsEachRole",
912
+ value: function containsEachRole(roles) {
913
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
914
+ try {
915
+ for(var _iterator = roles[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
916
+ var role = _step.value;
917
+ if (!this._map[role]) {
918
+ return false;
919
+ }
920
+ }
921
+ } catch (err) {
922
+ _didIteratorError = true;
923
+ _iteratorError = err;
924
+ } finally{
925
+ try {
926
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
927
+ _iterator.return();
928
+ }
929
+ } finally{
930
+ if (_didIteratorError) {
931
+ throw _iteratorError;
932
+ }
933
+ }
934
+ }
935
+ return true;
936
+ }
820
937
  }
821
- return true;
822
- }
823
- }
938
+ ]);
939
+ return GrantedRoleMapReaderInstance;
940
+ }();
824
941
  /**
825
942
  * Converts an array of role strings into a {@link GrantedRoleKeysMap} where each role is mapped to the given boolean value.
826
943
  *
@@ -833,9 +950,13 @@ class GrantedRoleMapReaderInstance {
833
950
  * const map = grantedRoleKeysMapFromArray(['read', 'update']);
834
951
  * // { read: true, update: true }
835
952
  * ```
836
- */
837
- function grantedRoleKeysMapFromArray(roles, value = true) {
838
- return arrayToObject(roles, (x) => x, () => value);
953
+ */ function grantedRoleKeysMapFromArray(roles) {
954
+ var value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
955
+ return arrayToObject(roles, function(x) {
956
+ return x;
957
+ }, function() {
958
+ return value;
959
+ });
839
960
  }
840
961
 
841
962
  /**
@@ -850,8 +971,7 @@ function grantedRoleKeysMapFromArray(roles, value = true) {
850
971
  * const result = noAccessContextGrantedModelRoles(userContext);
851
972
  * // result.roleMap contains the no-access marker
852
973
  * ```
853
- */
854
- function noAccessContextGrantedModelRoles(context, data) {
974
+ */ function noAccessContextGrantedModelRoles(context, data) {
855
975
  return contextGrantedModelRoles(context, data, noAccessRoleMap());
856
976
  }
857
977
  /**
@@ -866,8 +986,7 @@ function noAccessContextGrantedModelRoles(context, data) {
866
986
  * const result = fullAccessGrantedModelRoles(adminContext, modelData);
867
987
  * // result.roleMap contains the full-access marker
868
988
  * ```
869
- */
870
- function fullAccessGrantedModelRoles(context, data) {
989
+ */ function fullAccessGrantedModelRoles(context, data) {
871
990
  return contextGrantedModelRoles(context, data, fullAccessRoleMap());
872
991
  }
873
992
  /**
@@ -877,56 +996,303 @@ function fullAccessGrantedModelRoles(context, data) {
877
996
  * @param data - the model data, if loaded
878
997
  * @param roles - the granted role map
879
998
  * @returns a ContextGrantedModelRoles combining all inputs
880
- */
881
- function contextGrantedModelRoles(context, data, roles) {
999
+ */ function contextGrantedModelRoles(context, data, roles) {
882
1000
  return {
883
- data,
884
- context,
1001
+ data: data,
1002
+ context: context,
885
1003
  roleMap: roles
886
1004
  };
887
1005
  }
888
1006
 
889
- /**
890
- * Abstract ModelPermissionService implementation.
891
- */
892
- class AbstractModelPermissionService {
893
- _modelLoader;
894
- constructor(modelLoader) {
895
- this._modelLoader = modelLoader;
1007
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
1008
+ try {
1009
+ var info = gen[key](arg);
1010
+ var value = info.value;
1011
+ } catch (error) {
1012
+ reject(error);
1013
+ return;
896
1014
  }
897
- get modelLoader() {
898
- return this._modelLoader;
1015
+ if (info.done) {
1016
+ resolve(value);
1017
+ } else {
1018
+ Promise.resolve(value).then(_next, _throw);
899
1019
  }
900
- async roleMapForKeyContext(key, context) {
901
- const model = await this.modelLoader.loadModelForKey(key, context);
902
- let result;
903
- if (model != null) {
904
- result = await this.roleMapForModelContext(model, context);
905
- }
906
- else {
907
- result = noAccessContextGrantedModelRoles(context);
908
- }
909
- return result;
1020
+ }
1021
+ function _async_to_generator$3(fn) {
1022
+ return function() {
1023
+ var self = this, args = arguments;
1024
+ return new Promise(function(resolve, reject) {
1025
+ var gen = fn.apply(self, args);
1026
+ function _next(value) {
1027
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
1028
+ }
1029
+ function _throw(err) {
1030
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
1031
+ }
1032
+ _next(undefined);
1033
+ });
1034
+ };
1035
+ }
1036
+ function _class_call_check$1(instance, Constructor) {
1037
+ if (!(instance instanceof Constructor)) {
1038
+ throw new TypeError("Cannot call a class as a function");
910
1039
  }
911
- async roleMapForModelContext(model, context) {
912
- const output = await this.outputForModel(model, context);
913
- let result;
914
- if (output != null && this.isUsableOutputForRoles(output, context)) {
915
- result = await this.getRoleMapForOutput(output, context, model);
916
- }
917
- else {
918
- result = noAccessContextGrantedModelRoles(context, output);
919
- }
920
- return result;
1040
+ }
1041
+ function _defineProperties(target, props) {
1042
+ for(var i = 0; i < props.length; i++){
1043
+ var descriptor = props[i];
1044
+ descriptor.enumerable = descriptor.enumerable || false;
1045
+ descriptor.configurable = true;
1046
+ if ("value" in descriptor) descriptor.writable = true;
1047
+ Object.defineProperty(target, descriptor.key, descriptor);
921
1048
  }
922
- async getRoleMapForOutput(output, context, model) {
923
- const roleMap = await this.roleMapForModel(output, context, model);
924
- return contextGrantedModelRoles(context, output, roleMap);
1049
+ }
1050
+ function _create_class(Constructor, protoProps, staticProps) {
1051
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1052
+ return Constructor;
1053
+ }
1054
+ function _define_property$2(obj, key, value) {
1055
+ if (key in obj) {
1056
+ Object.defineProperty(obj, key, {
1057
+ value: value,
1058
+ enumerable: true,
1059
+ configurable: true,
1060
+ writable: true
1061
+ });
1062
+ } else {
1063
+ obj[key] = value;
925
1064
  }
926
- isUsableOutputForRoles(output, context) {
927
- return true; // can override in parent functions to further filter roles.
1065
+ return obj;
1066
+ }
1067
+ function _ts_generator$3(thisArg, body) {
1068
+ var f, y, t, _ = {
1069
+ label: 0,
1070
+ sent: function() {
1071
+ if (t[0] & 1) throw t[1];
1072
+ return t[1];
1073
+ },
1074
+ trys: [],
1075
+ ops: []
1076
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
1077
+ return d(g, "next", {
1078
+ value: verb(0)
1079
+ }), d(g, "throw", {
1080
+ value: verb(1)
1081
+ }), d(g, "return", {
1082
+ value: verb(2)
1083
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
1084
+ value: function() {
1085
+ return this;
1086
+ }
1087
+ }), g;
1088
+ function verb(n) {
1089
+ return function(v) {
1090
+ return step([
1091
+ n,
1092
+ v
1093
+ ]);
1094
+ };
1095
+ }
1096
+ function step(op) {
1097
+ if (f) throw new TypeError("Generator is already executing.");
1098
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
1099
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1100
+ if (y = 0, t) op = [
1101
+ op[0] & 2,
1102
+ t.value
1103
+ ];
1104
+ switch(op[0]){
1105
+ case 0:
1106
+ case 1:
1107
+ t = op;
1108
+ break;
1109
+ case 4:
1110
+ _.label++;
1111
+ return {
1112
+ value: op[1],
1113
+ done: false
1114
+ };
1115
+ case 5:
1116
+ _.label++;
1117
+ y = op[1];
1118
+ op = [
1119
+ 0
1120
+ ];
1121
+ continue;
1122
+ case 7:
1123
+ op = _.ops.pop();
1124
+ _.trys.pop();
1125
+ continue;
1126
+ default:
1127
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1128
+ _ = 0;
1129
+ continue;
1130
+ }
1131
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1132
+ _.label = op[1];
1133
+ break;
1134
+ }
1135
+ if (op[0] === 6 && _.label < t[1]) {
1136
+ _.label = t[1];
1137
+ t = op;
1138
+ break;
1139
+ }
1140
+ if (t && _.label < t[2]) {
1141
+ _.label = t[2];
1142
+ _.ops.push(op);
1143
+ break;
1144
+ }
1145
+ if (t[2]) _.ops.pop();
1146
+ _.trys.pop();
1147
+ continue;
1148
+ }
1149
+ op = body.call(thisArg, _);
1150
+ } catch (e) {
1151
+ op = [
1152
+ 6,
1153
+ e
1154
+ ];
1155
+ y = 0;
1156
+ } finally{
1157
+ f = t = 0;
1158
+ }
1159
+ if (op[0] & 5) throw op[1];
1160
+ return {
1161
+ value: op[0] ? op[1] : void 0,
1162
+ done: true
1163
+ };
928
1164
  }
929
1165
  }
1166
+ /**
1167
+ * Abstract ModelPermissionService implementation.
1168
+ */ var AbstractModelPermissionService = /*#__PURE__*/ function() {
1169
+ function AbstractModelPermissionService(modelLoader) {
1170
+ _class_call_check$1(this, AbstractModelPermissionService);
1171
+ _define_property$2(this, "_modelLoader", void 0);
1172
+ this._modelLoader = modelLoader;
1173
+ }
1174
+ _create_class(AbstractModelPermissionService, [
1175
+ {
1176
+ key: "modelLoader",
1177
+ get: function get() {
1178
+ return this._modelLoader;
1179
+ }
1180
+ },
1181
+ {
1182
+ key: "roleMapForKeyContext",
1183
+ value: function roleMapForKeyContext(key, context) {
1184
+ return _async_to_generator$3(function() {
1185
+ var model, result;
1186
+ return _ts_generator$3(this, function(_state) {
1187
+ switch(_state.label){
1188
+ case 0:
1189
+ return [
1190
+ 4,
1191
+ this.modelLoader.loadModelForKey(key, context)
1192
+ ];
1193
+ case 1:
1194
+ model = _state.sent();
1195
+ if (!(model != null)) return [
1196
+ 3,
1197
+ 3
1198
+ ];
1199
+ return [
1200
+ 4,
1201
+ this.roleMapForModelContext(model, context)
1202
+ ];
1203
+ case 2:
1204
+ result = _state.sent();
1205
+ return [
1206
+ 3,
1207
+ 4
1208
+ ];
1209
+ case 3:
1210
+ result = noAccessContextGrantedModelRoles(context);
1211
+ _state.label = 4;
1212
+ case 4:
1213
+ return [
1214
+ 2,
1215
+ result
1216
+ ];
1217
+ }
1218
+ });
1219
+ }).call(this);
1220
+ }
1221
+ },
1222
+ {
1223
+ key: "roleMapForModelContext",
1224
+ value: function roleMapForModelContext(model, context) {
1225
+ return _async_to_generator$3(function() {
1226
+ var output, result;
1227
+ return _ts_generator$3(this, function(_state) {
1228
+ switch(_state.label){
1229
+ case 0:
1230
+ return [
1231
+ 4,
1232
+ this.outputForModel(model, context)
1233
+ ];
1234
+ case 1:
1235
+ output = _state.sent();
1236
+ if (!(output != null && this.isUsableOutputForRoles(output, context))) return [
1237
+ 3,
1238
+ 3
1239
+ ];
1240
+ return [
1241
+ 4,
1242
+ this.getRoleMapForOutput(output, context, model)
1243
+ ];
1244
+ case 2:
1245
+ result = _state.sent();
1246
+ return [
1247
+ 3,
1248
+ 4
1249
+ ];
1250
+ case 3:
1251
+ result = noAccessContextGrantedModelRoles(context, output);
1252
+ _state.label = 4;
1253
+ case 4:
1254
+ return [
1255
+ 2,
1256
+ result
1257
+ ];
1258
+ }
1259
+ });
1260
+ }).call(this);
1261
+ }
1262
+ },
1263
+ {
1264
+ key: "getRoleMapForOutput",
1265
+ value: function getRoleMapForOutput(output, context, model) {
1266
+ return _async_to_generator$3(function() {
1267
+ var roleMap;
1268
+ return _ts_generator$3(this, function(_state) {
1269
+ switch(_state.label){
1270
+ case 0:
1271
+ return [
1272
+ 4,
1273
+ this.roleMapForModel(output, context, model)
1274
+ ];
1275
+ case 1:
1276
+ roleMap = _state.sent();
1277
+ return [
1278
+ 2,
1279
+ contextGrantedModelRoles(context, output, roleMap)
1280
+ ];
1281
+ }
1282
+ });
1283
+ }).call(this);
1284
+ }
1285
+ },
1286
+ {
1287
+ key: "isUsableOutputForRoles",
1288
+ value: function isUsableOutputForRoles(output, context) {
1289
+ return true; // can override in parent functions to further filter roles.
1290
+ }
1291
+ }
1292
+ ]);
1293
+ return AbstractModelPermissionService;
1294
+ }
1295
+ ();
930
1296
 
931
1297
  /**
932
1298
  * Creates a factory that normalizes a {@link SyncEntityCommonTypeIdPairFactoryInput} into a full {@link SyncEntityCommonTypeIdPair}.
@@ -943,16 +1309,14 @@ class AbstractModelPermissionService {
943
1309
  * factory('abc123'); // { commonType: 'user', commonId: 'abc123' }
944
1310
  * factory({ commonType: 'user', commonId: 'abc123' }); // passed through as-is
945
1311
  * ```
946
- */
947
- function syncEntityCommonTypeIdPairFactory(commonType) {
948
- return (input) => {
1312
+ */ function syncEntityCommonTypeIdPairFactory(commonType) {
1313
+ return function(input) {
949
1314
  if (typeof input === 'string') {
950
1315
  return {
951
- commonType,
1316
+ commonType: commonType,
952
1317
  commonId: input
953
1318
  };
954
- }
955
- else {
1319
+ } else {
956
1320
  return input;
957
1321
  }
958
1322
  };
@@ -975,64 +1339,155 @@ function syncEntityCommonTypeIdPairFactory(commonType) {
975
1339
  * const entity = factory({ commonType: 'user', commonId: 'abc123' });
976
1340
  * // entity.id === 'abc123', entity.sourceInfo.id === 'api'
977
1341
  * ```
978
- */
979
- function syncEntityFactory(config) {
980
- const { idFactory: inputIdFactory, sourceInfo } = config;
981
- const idFactory = inputIdFactory ?? MAP_IDENTITY;
982
- return (input) => {
983
- const { commonType, commonId } = input;
984
- const id = idFactory(commonId);
1342
+ */ function syncEntityFactory(config) {
1343
+ var inputIdFactory = config.idFactory, sourceInfo = config.sourceInfo;
1344
+ var idFactory = inputIdFactory !== null && inputIdFactory !== void 0 ? inputIdFactory : MAP_IDENTITY;
1345
+ return function(input) {
1346
+ var commonType = input.commonType, commonId = input.commonId;
1347
+ var id = idFactory(commonId);
985
1348
  return {
986
- commonType,
987
- commonId,
988
- id,
989
- sourceInfo
1349
+ commonType: commonType,
1350
+ commonId: commonId,
1351
+ id: id,
1352
+ sourceInfo: sourceInfo
990
1353
  };
991
1354
  };
992
1355
  }
993
1356
 
1357
+ function _assert_this_initialized(self) {
1358
+ if (self === void 0) {
1359
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1360
+ }
1361
+ return self;
1362
+ }
1363
+ function _call_super(_this, derived, args) {
1364
+ derived = _get_prototype_of(derived);
1365
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
1366
+ }
1367
+ function _class_call_check(instance, Constructor) {
1368
+ if (!(instance instanceof Constructor)) {
1369
+ throw new TypeError("Cannot call a class as a function");
1370
+ }
1371
+ }
1372
+ function _define_property$1(obj, key, value) {
1373
+ if (key in obj) {
1374
+ Object.defineProperty(obj, key, {
1375
+ value: value,
1376
+ enumerable: true,
1377
+ configurable: true,
1378
+ writable: true
1379
+ });
1380
+ } else {
1381
+ obj[key] = value;
1382
+ }
1383
+ return obj;
1384
+ }
1385
+ function _get_prototype_of(o) {
1386
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1387
+ return o.__proto__ || Object.getPrototypeOf(o);
1388
+ };
1389
+ return _get_prototype_of(o);
1390
+ }
1391
+ function _inherits(subClass, superClass) {
1392
+ if (typeof superClass !== "function" && superClass !== null) {
1393
+ throw new TypeError("Super expression must either be null or a function");
1394
+ }
1395
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1396
+ constructor: {
1397
+ value: subClass,
1398
+ writable: true,
1399
+ configurable: true
1400
+ }
1401
+ });
1402
+ if (superClass) _set_prototype_of(subClass, superClass);
1403
+ }
1404
+ function _possible_constructor_return(self, call) {
1405
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
1406
+ return call;
1407
+ }
1408
+ return _assert_this_initialized(self);
1409
+ }
1410
+ function _set_prototype_of(o, p) {
1411
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1412
+ o.__proto__ = p;
1413
+ return o;
1414
+ };
1415
+ return _set_prototype_of(o, p);
1416
+ }
1417
+ function _type_of(obj) {
1418
+ "@swc/helpers - typeof";
1419
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1420
+ }
1421
+ function _is_native_reflect_construct() {
1422
+ try {
1423
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1424
+ } catch (_) {}
1425
+ return (_is_native_reflect_construct = function() {
1426
+ return !!result;
1427
+ })();
1428
+ }
994
1429
  /**
995
1430
  * Error thrown when the common type is not known/registered.
996
- */
997
- class UnregisteredSyncEntityCommonTypeError extends BaseError {
998
- commonType;
999
- constructor(commonType) {
1000
- super(`The common type "${commonType}" is not registered.`);
1001
- this.commonType = commonType;
1431
+ */ var UnregisteredSyncEntityCommonTypeError = /*#__PURE__*/ function(BaseError) {
1432
+ _inherits(UnregisteredSyncEntityCommonTypeError, BaseError);
1433
+ function UnregisteredSyncEntityCommonTypeError(commonType) {
1434
+ _class_call_check(this, UnregisteredSyncEntityCommonTypeError);
1435
+ var _this;
1436
+ _this = _call_super(this, UnregisteredSyncEntityCommonTypeError, [
1437
+ 'The common type "'.concat(commonType, '" is not registered.')
1438
+ ]), _define_property$1(_this, "commonType", void 0);
1439
+ _this.commonType = commonType;
1440
+ return _this;
1002
1441
  }
1003
- }
1442
+ return UnregisteredSyncEntityCommonTypeError;
1443
+ }(BaseError);
1004
1444
  /**
1005
1445
  * Error thrown when no primary sync source is found for an entity.
1006
- */
1007
- class NoPrimarySyncSourceError extends BaseError {
1008
- entity;
1009
- constructor(entity) {
1010
- super(`No primary sync source found for entity "${entity.commonType}:${entity.commonId}".`);
1011
- this.entity = entity;
1446
+ */ var NoPrimarySyncSourceError = /*#__PURE__*/ function(BaseError) {
1447
+ _inherits(NoPrimarySyncSourceError, BaseError);
1448
+ function NoPrimarySyncSourceError(entity) {
1449
+ _class_call_check(this, NoPrimarySyncSourceError);
1450
+ var _this;
1451
+ _this = _call_super(this, NoPrimarySyncSourceError, [
1452
+ 'No primary sync source found for entity "'.concat(entity.commonType, ":").concat(entity.commonId, '".')
1453
+ ]), _define_property$1(_this, "entity", void 0);
1454
+ _this.entity = entity;
1455
+ return _this;
1012
1456
  }
1013
- }
1457
+ return NoPrimarySyncSourceError;
1458
+ }(BaseError);
1014
1459
  /**
1015
1460
  * Error thrown when multiple primary sync sources are found for an entity.
1016
- */
1017
- class MultiplePrimarySyncSourceError extends BaseError {
1018
- entity;
1019
- constructor(entity) {
1020
- super(`Multiple primary sync sources found for entity "${entity.commonType}:${entity.commonId}".`);
1021
- this.entity = entity;
1461
+ */ var MultiplePrimarySyncSourceError = /*#__PURE__*/ function(BaseError) {
1462
+ _inherits(MultiplePrimarySyncSourceError, BaseError);
1463
+ function MultiplePrimarySyncSourceError(entity) {
1464
+ _class_call_check(this, MultiplePrimarySyncSourceError);
1465
+ var _this;
1466
+ _this = _call_super(this, MultiplePrimarySyncSourceError, [
1467
+ 'Multiple primary sync sources found for entity "'.concat(entity.commonType, ":").concat(entity.commonId, '".')
1468
+ ]), _define_property$1(_this, "entity", void 0);
1469
+ _this.entity = entity;
1470
+ return _this;
1022
1471
  }
1023
- }
1472
+ return MultiplePrimarySyncSourceError;
1473
+ }(BaseError);
1024
1474
  /**
1025
1475
  * Error thrown when a synchronization fails for an entity.
1026
- */
1027
- class SynchronizationFailedError extends BaseError {
1028
- entity;
1029
- error;
1030
- constructor(entity, error) {
1031
- super(`Synchronization failed for entity "${entity.commonType}:${entity.commonId}". Error: ${error}`);
1032
- this.entity = entity;
1033
- this.error = error;
1476
+ */ var SynchronizationFailedError = /*#__PURE__*/ function(BaseError) {
1477
+ _inherits(SynchronizationFailedError, BaseError);
1478
+ function SynchronizationFailedError(entity, error) {
1479
+ _class_call_check(this, SynchronizationFailedError);
1480
+ var _this;
1481
+ _this = _call_super(this, SynchronizationFailedError, [
1482
+ 'Synchronization failed for entity "'.concat(entity.commonType, ":").concat(entity.commonId, '". Error: ').concat(error)
1483
+ ]), _define_property$1(_this, "entity", void 0), _define_property$1(_this, "error", void 0);
1484
+ _this.entity = entity;
1485
+ _this.error = error;
1486
+ return _this;
1034
1487
  }
1035
- }
1488
+ return SynchronizationFailedError;
1489
+ }
1490
+ (BaseError);
1036
1491
 
1037
1492
  /**
1038
1493
  * Creates a {@link SyncEntitySynchronizer} from the given configuration.
@@ -1053,27 +1508,268 @@ class SynchronizationFailedError extends BaseError {
1053
1508
  * const instance = await synchronizer.synchronizeInstance({ commonType: 'user', commonId: '123' });
1054
1509
  * const result = await instance.synchronize();
1055
1510
  * ```
1056
- */
1057
- function syncEntitySynchronizer(config) {
1058
- const map = new Map(config.commonTypeSynchronizers.map((x) => [x.commonType, x]));
1059
- const commonTypes = Array.from(map.keys());
1060
- const commonTypeSynchronizer = (input) => {
1061
- const synchronizer = map.get(input);
1511
+ */ function syncEntitySynchronizer(config) {
1512
+ var map = new Map(config.commonTypeSynchronizers.map(function(x) {
1513
+ return [
1514
+ x.commonType,
1515
+ x
1516
+ ];
1517
+ }));
1518
+ var commonTypes = Array.from(map.keys());
1519
+ var commonTypeSynchronizer = function commonTypeSynchronizer(input) {
1520
+ var synchronizer = map.get(input);
1062
1521
  if (!synchronizer) {
1063
1522
  throw new UnregisteredSyncEntityCommonTypeError(input);
1064
1523
  }
1065
1524
  return synchronizer;
1066
1525
  };
1067
1526
  return {
1068
- commonTypes,
1069
- commonTypeSynchronizer,
1070
- synchronizeInstance: (input) => {
1071
- const synchronizer = commonTypeSynchronizer(input.commonType);
1527
+ commonTypes: commonTypes,
1528
+ commonTypeSynchronizer: commonTypeSynchronizer,
1529
+ synchronizeInstance: function synchronizeInstance(input) {
1530
+ var synchronizer = commonTypeSynchronizer(input.commonType);
1072
1531
  return synchronizer.synchronizeInstance(input);
1073
1532
  }
1074
1533
  };
1075
1534
  }
1076
1535
 
1536
+ function _array_like_to_array(arr, len) {
1537
+ if (len == null || len > arr.length) len = arr.length;
1538
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1539
+ return arr2;
1540
+ }
1541
+ function _array_with_holes(arr) {
1542
+ if (Array.isArray(arr)) return arr;
1543
+ }
1544
+ function _array_without_holes(arr) {
1545
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
1546
+ }
1547
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
1548
+ try {
1549
+ var info = gen[key](arg);
1550
+ var value = info.value;
1551
+ } catch (error) {
1552
+ reject(error);
1553
+ return;
1554
+ }
1555
+ if (info.done) {
1556
+ resolve(value);
1557
+ } else {
1558
+ Promise.resolve(value).then(_next, _throw);
1559
+ }
1560
+ }
1561
+ function _async_to_generator$2(fn) {
1562
+ return function() {
1563
+ var self = this, args = arguments;
1564
+ return new Promise(function(resolve, reject) {
1565
+ var gen = fn.apply(self, args);
1566
+ function _next(value) {
1567
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
1568
+ }
1569
+ function _throw(err) {
1570
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
1571
+ }
1572
+ _next(undefined);
1573
+ });
1574
+ };
1575
+ }
1576
+ function _define_property(obj, key, value) {
1577
+ if (key in obj) {
1578
+ Object.defineProperty(obj, key, {
1579
+ value: value,
1580
+ enumerable: true,
1581
+ configurable: true,
1582
+ writable: true
1583
+ });
1584
+ } else {
1585
+ obj[key] = value;
1586
+ }
1587
+ return obj;
1588
+ }
1589
+ function _iterable_to_array(iter) {
1590
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1591
+ }
1592
+ function _iterable_to_array_limit(arr, i) {
1593
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1594
+ if (_i == null) return;
1595
+ var _arr = [];
1596
+ var _n = true;
1597
+ var _d = false;
1598
+ var _s, _e;
1599
+ try {
1600
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1601
+ _arr.push(_s.value);
1602
+ if (i && _arr.length === i) break;
1603
+ }
1604
+ } catch (err) {
1605
+ _d = true;
1606
+ _e = err;
1607
+ } finally{
1608
+ try {
1609
+ if (!_n && _i["return"] != null) _i["return"]();
1610
+ } finally{
1611
+ if (_d) throw _e;
1612
+ }
1613
+ }
1614
+ return _arr;
1615
+ }
1616
+ function _non_iterable_rest() {
1617
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1618
+ }
1619
+ function _non_iterable_spread() {
1620
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1621
+ }
1622
+ function _object_destructuring_empty(o) {
1623
+ if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
1624
+ return o;
1625
+ }
1626
+ function _object_spread(target) {
1627
+ for(var i = 1; i < arguments.length; i++){
1628
+ var source = arguments[i] != null ? arguments[i] : {};
1629
+ var ownKeys = Object.keys(source);
1630
+ if (typeof Object.getOwnPropertySymbols === "function") {
1631
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1632
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1633
+ }));
1634
+ }
1635
+ ownKeys.forEach(function(key) {
1636
+ _define_property(target, key, source[key]);
1637
+ });
1638
+ }
1639
+ return target;
1640
+ }
1641
+ function ownKeys(object, enumerableOnly) {
1642
+ var keys = Object.keys(object);
1643
+ if (Object.getOwnPropertySymbols) {
1644
+ var symbols = Object.getOwnPropertySymbols(object);
1645
+ keys.push.apply(keys, symbols);
1646
+ }
1647
+ return keys;
1648
+ }
1649
+ function _object_spread_props(target, source) {
1650
+ source = source != null ? source : {};
1651
+ if (Object.getOwnPropertyDescriptors) {
1652
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1653
+ } else {
1654
+ ownKeys(Object(source)).forEach(function(key) {
1655
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1656
+ });
1657
+ }
1658
+ return target;
1659
+ }
1660
+ function _sliced_to_array(arr, i) {
1661
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
1662
+ }
1663
+ function _to_consumable_array(arr) {
1664
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
1665
+ }
1666
+ function _unsupported_iterable_to_array(o, minLen) {
1667
+ if (!o) return;
1668
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1669
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1670
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1671
+ if (n === "Map" || n === "Set") return Array.from(n);
1672
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1673
+ }
1674
+ function _ts_generator$2(thisArg, body) {
1675
+ var f, y, t, _ = {
1676
+ label: 0,
1677
+ sent: function() {
1678
+ if (t[0] & 1) throw t[1];
1679
+ return t[1];
1680
+ },
1681
+ trys: [],
1682
+ ops: []
1683
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
1684
+ return d(g, "next", {
1685
+ value: verb(0)
1686
+ }), d(g, "throw", {
1687
+ value: verb(1)
1688
+ }), d(g, "return", {
1689
+ value: verb(2)
1690
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
1691
+ value: function() {
1692
+ return this;
1693
+ }
1694
+ }), g;
1695
+ function verb(n) {
1696
+ return function(v) {
1697
+ return step([
1698
+ n,
1699
+ v
1700
+ ]);
1701
+ };
1702
+ }
1703
+ function step(op) {
1704
+ if (f) throw new TypeError("Generator is already executing.");
1705
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
1706
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1707
+ if (y = 0, t) op = [
1708
+ op[0] & 2,
1709
+ t.value
1710
+ ];
1711
+ switch(op[0]){
1712
+ case 0:
1713
+ case 1:
1714
+ t = op;
1715
+ break;
1716
+ case 4:
1717
+ _.label++;
1718
+ return {
1719
+ value: op[1],
1720
+ done: false
1721
+ };
1722
+ case 5:
1723
+ _.label++;
1724
+ y = op[1];
1725
+ op = [
1726
+ 0
1727
+ ];
1728
+ continue;
1729
+ case 7:
1730
+ op = _.ops.pop();
1731
+ _.trys.pop();
1732
+ continue;
1733
+ default:
1734
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1735
+ _ = 0;
1736
+ continue;
1737
+ }
1738
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1739
+ _.label = op[1];
1740
+ break;
1741
+ }
1742
+ if (op[0] === 6 && _.label < t[1]) {
1743
+ _.label = t[1];
1744
+ t = op;
1745
+ break;
1746
+ }
1747
+ if (t && _.label < t[2]) {
1748
+ _.label = t[2];
1749
+ _.ops.push(op);
1750
+ break;
1751
+ }
1752
+ if (t[2]) _.ops.pop();
1753
+ _.trys.pop();
1754
+ continue;
1755
+ }
1756
+ op = body.call(thisArg, _);
1757
+ } catch (e) {
1758
+ op = [
1759
+ 6,
1760
+ e
1761
+ ];
1762
+ y = 0;
1763
+ } finally{
1764
+ f = t = 0;
1765
+ }
1766
+ if (op[0] & 5) throw op[1];
1767
+ return {
1768
+ value: op[0] ? op[1] : void 0,
1769
+ done: true
1770
+ };
1771
+ }
1772
+ }
1077
1773
  /**
1078
1774
  * Creates a {@link BasicSyncEntityCommonTypeSynchronizer} that orchestrates synchronization across multiple sources
1079
1775
  * for a specific entity common type.
@@ -1088,68 +1784,81 @@ function syncEntitySynchronizer(config) {
1088
1784
  * @throws {NoPrimarySyncSourceError} when no primary source is found
1089
1785
  * @throws {MultiplePrimarySyncSourceError} when more than one primary source is found
1090
1786
  * @throws {SynchronizationFailedError} when primary or secondary sync returns failed/error
1091
- */
1092
- function basicSyncEntityCommonTypeSynchronizerInstanceFactory(config) {
1093
- const { commonType, sources, entitySourceContextLoader, dynamicSources = false } = config;
1094
- const syncEntityCommonTypeIdPairForType = syncEntityCommonTypeIdPairFactory(commonType);
1095
- const sourcesByContextType = makeValuesGroupMap(sources, (x) => x.contextType);
1096
- const allGlobalSources = sourcesByContextType.get('global') ?? [];
1097
- const allContextSources = sourcesByContextType.get('context') ?? [];
1787
+ */ function basicSyncEntityCommonTypeSynchronizerInstanceFactory(config) {
1788
+ var _sourcesByContextType_get, _sourcesByContextType_get1;
1789
+ var commonType = config.commonType, sources = config.sources, entitySourceContextLoader = config.entitySourceContextLoader, _config_dynamicSources = config.dynamicSources, dynamicSources = _config_dynamicSources === void 0 ? false : _config_dynamicSources;
1790
+ var syncEntityCommonTypeIdPairForType = syncEntityCommonTypeIdPairFactory(commonType);
1791
+ var sourcesByContextType = makeValuesGroupMap(sources, function(x) {
1792
+ return x.contextType;
1793
+ });
1794
+ var allGlobalSources = (_sourcesByContextType_get = sourcesByContextType.get('global')) !== null && _sourcesByContextType_get !== void 0 ? _sourcesByContextType_get : [];
1795
+ var allContextSources = (_sourcesByContextType_get1 = sourcesByContextType.get('context')) !== null && _sourcesByContextType_get1 !== void 0 ? _sourcesByContextType_get1 : [];
1098
1796
  /**
1099
1797
  * Loads the relevant sources for the given entity and context.
1100
1798
  *
1101
1799
  * @param entitySourceContext The contextual information for the entity.
1102
1800
  * @returns The relevant sources for the entity.
1103
- */
1104
- function loadSources(entityCommonTypeIdPair, entitySourceContext) {
1105
- const { globalSources, contextSources } = entitySourceContext;
1801
+ */ function loadSources(entityCommonTypeIdPair, entitySourceContext) {
1802
+ var globalSources = entitySourceContext.globalSources, contextSources = entitySourceContext.contextSources;
1106
1803
  // load/filter global sources
1107
- const globalMap = new Map(globalSources.map((x) => {
1108
- let sourceId;
1109
- let flowType;
1804
+ var globalMap = new Map(globalSources.map(function(x) {
1805
+ var sourceId;
1806
+ var flowType;
1110
1807
  if (typeof x === 'string') {
1111
1808
  sourceId = x;
1112
1809
  flowType = 'unset';
1113
- }
1114
- else {
1810
+ } else {
1115
1811
  sourceId = x.sourceId;
1116
1812
  flowType = x.flowType;
1117
1813
  }
1118
- return [sourceId, { sourceId, flowType }];
1814
+ return [
1815
+ sourceId,
1816
+ {
1817
+ sourceId: sourceId,
1818
+ flowType: flowType
1819
+ }
1820
+ ];
1119
1821
  }));
1120
- const relevantGlobalSources = filterMaybeArrayValues(allGlobalSources.map((x) => {
1121
- const sourceContext = globalMap.get(x.info.id);
1122
- let result;
1822
+ var relevantGlobalSources = filterMaybeArrayValues(allGlobalSources.map(function(x) {
1823
+ var sourceContext = globalMap.get(x.info.id);
1824
+ var result;
1123
1825
  if (sourceContext != null) {
1826
+ var _ref, _sourceContext_flowType;
1124
1827
  result = {
1125
- entityCommonTypeIdPair,
1126
- flowType: sourceContext.flowType ?? x.defaultFlowType ?? 'unset',
1828
+ entityCommonTypeIdPair: entityCommonTypeIdPair,
1829
+ flowType: (_ref = (_sourceContext_flowType = sourceContext.flowType) !== null && _sourceContext_flowType !== void 0 ? _sourceContext_flowType : x.defaultFlowType) !== null && _ref !== void 0 ? _ref : 'unset',
1127
1830
  source: x
1128
1831
  };
1129
1832
  }
1130
1833
  return result;
1131
1834
  }));
1132
1835
  // load/filter context sources
1133
- const contextMap = new Map(contextSources.map((x) => [x.sourceId, x]));
1134
- const relevantContextSources = filterMaybeArrayValues(allContextSources.map((x) => {
1135
- const sourceContext = contextMap.get(x.info.id);
1136
- let result;
1836
+ var contextMap = new Map(contextSources.map(function(x) {
1837
+ return [
1838
+ x.sourceId,
1839
+ x
1840
+ ];
1841
+ }));
1842
+ var relevantContextSources = filterMaybeArrayValues(allContextSources.map(function(x) {
1843
+ var sourceContext = contextMap.get(x.info.id);
1844
+ var result;
1137
1845
  if (sourceContext != null) {
1138
- const flowType = sourceContext.flowType ?? x.defaultFlowType ?? 'unset';
1846
+ var _ref, _sourceContext_flowType;
1847
+ var flowType = (_ref = (_sourceContext_flowType = sourceContext.flowType) !== null && _sourceContext_flowType !== void 0 ? _sourceContext_flowType : x.defaultFlowType) !== null && _ref !== void 0 ? _ref : 'unset';
1139
1848
  result = {
1140
- entityCommonTypeIdPair,
1141
- flowType,
1849
+ entityCommonTypeIdPair: entityCommonTypeIdPair,
1850
+ flowType: flowType,
1142
1851
  source: x,
1143
1852
  context: sourceContext
1144
1853
  };
1145
1854
  }
1146
1855
  return result;
1147
1856
  }));
1148
- const allSources = [...relevantGlobalSources, ...relevantContextSources];
1857
+ var allSources = _to_consumable_array(relevantGlobalSources).concat(_to_consumable_array(relevantContextSources));
1149
1858
  // sort by order, with primary first
1150
- allSources.sort(sortByNumberFunction((x) => {
1151
- let result;
1152
- switch (x.flowType) {
1859
+ allSources.sort(sortByNumberFunction(function(x) {
1860
+ var result;
1861
+ switch(x.flowType){
1153
1862
  case 'primary':
1154
1863
  result = 1;
1155
1864
  break;
@@ -1165,123 +1874,458 @@ function basicSyncEntityCommonTypeSynchronizerInstanceFactory(config) {
1165
1874
  }));
1166
1875
  return allSources;
1167
1876
  }
1168
- const synchronizeInstance = async (input) => {
1169
- const syncEntityCommonTypeIdPair = syncEntityCommonTypeIdPairForType(input);
1170
- const _loadRelevantSources = async () => {
1171
- const entitySourceContext = await entitySourceContextLoader(syncEntityCommonTypeIdPair);
1172
- const relevantSources = loadSources(syncEntityCommonTypeIdPair, entitySourceContext);
1173
- return relevantSources;
1174
- };
1175
- let loadRelevantSources;
1176
- if (dynamicSources) {
1177
- // if dynamic, reload each time and do not cache
1178
- loadRelevantSources = _loadRelevantSources;
1179
- }
1180
- else {
1181
- // if not dynamic, make a cached getter
1182
- loadRelevantSources = cachedGetter(_loadRelevantSources);
1183
- }
1184
- /**
1877
+ var synchronizeInstance = function synchronizeInstance(input) {
1878
+ return _async_to_generator$2(function() {
1879
+ var syncEntityCommonTypeIdPair, _loadRelevantSources, loadRelevantSources, synchronize, instance;
1880
+ return _ts_generator$2(this, function(_state) {
1881
+ syncEntityCommonTypeIdPair = syncEntityCommonTypeIdPairForType(input);
1882
+ _loadRelevantSources = function _loadRelevantSources() {
1883
+ return _async_to_generator$2(function() {
1884
+ var entitySourceContext, relevantSources;
1885
+ return _ts_generator$2(this, function(_state) {
1886
+ switch(_state.label){
1887
+ case 0:
1888
+ return [
1889
+ 4,
1890
+ entitySourceContextLoader(syncEntityCommonTypeIdPair)
1891
+ ];
1892
+ case 1:
1893
+ entitySourceContext = _state.sent();
1894
+ relevantSources = loadSources(syncEntityCommonTypeIdPair, entitySourceContext);
1895
+ return [
1896
+ 2,
1897
+ relevantSources
1898
+ ];
1899
+ }
1900
+ });
1901
+ })();
1902
+ };
1903
+ if (dynamicSources) {
1904
+ // if dynamic, reload each time and do not cache
1905
+ loadRelevantSources = _loadRelevantSources;
1906
+ } else {
1907
+ // if not dynamic, make a cached getter
1908
+ loadRelevantSources = cachedGetter(_loadRelevantSources);
1909
+ }
1910
+ /**
1185
1911
  * Performs the synchonization
1186
- */
1187
- const synchronize = async (context) => {
1188
- const relevantSources = await loadRelevantSources();
1189
- const syncEntityInstances = await Promise.all(relevantSources.map((x) => x.source.syncEntityInstance(x).then((y) => [x, y])));
1190
- const sourcesByFlowType = makeValuesGroupMap(syncEntityInstances, (x) => x[0].flowType);
1191
- const primarySources = sourcesByFlowType.get('primary') ?? [];
1192
- const secondarySources = sourcesByFlowType.get('secondary') ?? [];
1193
- const replicaSources = sourcesByFlowType.get('replica') ?? [];
1194
- // assert primary sources count
1195
- switch (primarySources.length) {
1912
+ */ synchronize = function synchronize(context) {
1913
+ return _async_to_generator$2(function() {
1914
+ var _sourcesByFlowType_get, _sourcesByFlowType_get1, _sourcesByFlowType_get2, relevantSources, syncEntityInstances, sourcesByFlowType, primarySources, secondarySources, replicaSources, result;
1915
+ function synchronizeInstance(source, deleted) {
1916
+ var _source = _sliced_to_array(source, 2), _$input = _source[0], sourceInstance = _source[1];
1917
+ var promise = deleted ? sourceInstance.synchronizeDelete() : sourceInstance.synchronize();
1918
+ return promise.catch(function(error) {
1919
+ var errorResult = {
1920
+ type: 'error',
1921
+ error: error,
1922
+ entity: _object_spread_props(_object_spread({}, syncEntityCommonTypeIdPair), {
1923
+ sourceInfo: _$input.source.info,
1924
+ id: ''
1925
+ })
1926
+ };
1927
+ return errorResult;
1928
+ });
1929
+ }
1930
+ function performSynchronizationOfSources(input) {
1931
+ return _async_to_generator$2(function() {
1932
+ var syncRecursionDepth, secondaryFlaggedDelete, result, primarySource, primarySyncResult, synchronizedEntityResults, primaryFlaggedDelete, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, secondarySource, secondarySyncResult, _, err, replicaTaskResults;
1933
+ return _ts_generator$2(this, function(_state) {
1934
+ switch(_state.label){
1935
+ case 0:
1936
+ syncRecursionDepth = input.syncRecursionDepth, secondaryFlaggedDelete = input.secondaryFlaggedDelete;
1937
+ // synchronize the primary source
1938
+ primarySource = primarySources[0];
1939
+ return [
1940
+ 4,
1941
+ synchronizeInstance(primarySource, secondaryFlaggedDelete !== null && secondaryFlaggedDelete !== void 0 ? secondaryFlaggedDelete : false)
1942
+ ];
1943
+ case 1:
1944
+ primarySyncResult = _state.sent();
1945
+ synchronizedEntityResults = [
1946
+ primarySyncResult
1947
+ ];
1948
+ primaryFlaggedDelete = false;
1949
+ switch(primarySyncResult.type){
1950
+ case 'deleted':
1951
+ primaryFlaggedDelete = true;
1952
+ break;
1953
+ case 'failed':
1954
+ case 'error':
1955
+ throw new SynchronizationFailedError(syncEntityCommonTypeIdPair, primarySyncResult.error);
1956
+ }
1957
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1958
+ _state.label = 2;
1959
+ case 2:
1960
+ _state.trys.push([
1961
+ 2,
1962
+ 13,
1963
+ 14,
1964
+ 15
1965
+ ]);
1966
+ _iterator = secondarySources[Symbol.iterator]();
1967
+ _state.label = 3;
1968
+ case 3:
1969
+ if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
1970
+ 3,
1971
+ 12
1972
+ ];
1973
+ secondarySource = _step.value;
1974
+ return [
1975
+ 4,
1976
+ synchronizeInstance(secondarySource, primaryFlaggedDelete)
1977
+ ];
1978
+ case 4:
1979
+ secondarySyncResult = _state.sent();
1980
+ synchronizedEntityResults.push(secondarySyncResult);
1981
+ _ = secondarySyncResult.type;
1982
+ switch(_){
1983
+ case 'deleted':
1984
+ return [
1985
+ 3,
1986
+ 5
1987
+ ];
1988
+ case 'failed':
1989
+ return [
1990
+ 3,
1991
+ 9
1992
+ ];
1993
+ case 'error':
1994
+ return [
1995
+ 3,
1996
+ 9
1997
+ ];
1998
+ case 'nochange':
1999
+ return [
2000
+ 3,
2001
+ 10
2002
+ ];
2003
+ case 'synchronized':
2004
+ return [
2005
+ 3,
2006
+ 10
2007
+ ];
2008
+ }
2009
+ return [
2010
+ 3,
2011
+ 10
2012
+ ];
2013
+ case 5:
2014
+ if (!(primaryFlaggedDelete === false)) return [
2015
+ 3,
2016
+ 8
2017
+ ];
2018
+ if (!(syncRecursionDepth === 1)) return [
2019
+ 3,
2020
+ 7
2021
+ ];
2022
+ return [
2023
+ 4,
2024
+ performSynchronizationOfSources({
2025
+ syncRecursionDepth: syncRecursionDepth + 1,
2026
+ secondaryFlaggedDelete: true
2027
+ })
2028
+ ];
2029
+ case 6:
2030
+ result = _state.sent();
2031
+ return [
2032
+ 3,
2033
+ 7
2034
+ ];
2035
+ case 7:
2036
+ return [
2037
+ 3,
2038
+ 11
2039
+ ];
2040
+ case 8:
2041
+ return [
2042
+ 3,
2043
+ 11
2044
+ ];
2045
+ case 9:
2046
+ throw new SynchronizationFailedError(syncEntityCommonTypeIdPair, secondarySyncResult.error);
2047
+ case 10:
2048
+ // continue normally
2049
+ return [
2050
+ 3,
2051
+ 11
2052
+ ];
2053
+ case 11:
2054
+ _iteratorNormalCompletion = true;
2055
+ return [
2056
+ 3,
2057
+ 3
2058
+ ];
2059
+ case 12:
2060
+ return [
2061
+ 3,
2062
+ 15
2063
+ ];
2064
+ case 13:
2065
+ err = _state.sent();
2066
+ _didIteratorError = true;
2067
+ _iteratorError = err;
2068
+ return [
2069
+ 3,
2070
+ 15
2071
+ ];
2072
+ case 14:
2073
+ try {
2074
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2075
+ _iterator.return();
2076
+ }
2077
+ } finally{
2078
+ if (_didIteratorError) {
2079
+ throw _iteratorError;
2080
+ }
2081
+ }
2082
+ return [
2083
+ 7
2084
+ ];
2085
+ case 15:
2086
+ if (!(result == null)) return [
2087
+ 3,
2088
+ 17
2089
+ ];
2090
+ return [
2091
+ 4,
2092
+ performAsyncTasks(replicaSources, function(x) {
2093
+ return synchronizeInstance(x, primaryFlaggedDelete);
2094
+ }, {
2095
+ sequential: false,
2096
+ maxParallelTasks: 3
2097
+ })
2098
+ ];
2099
+ case 16:
2100
+ replicaTaskResults = _state.sent();
2101
+ // add all the results
2102
+ pushArrayItemsIntoArray(synchronizedEntityResults, replicaTaskResults.results.map(function(x) {
2103
+ return x[1];
2104
+ }));
2105
+ // compute final result
2106
+ result = {
2107
+ synchronizedEntityResults: synchronizedEntityResults
2108
+ };
2109
+ _state.label = 17;
2110
+ case 17:
2111
+ return [
2112
+ 2,
2113
+ result
2114
+ ];
2115
+ }
2116
+ });
2117
+ })();
2118
+ }
2119
+ return _ts_generator$2(this, function(_state) {
2120
+ switch(_state.label){
2121
+ case 0:
2122
+ _object_destructuring_empty(context !== null && context !== void 0 ? context : {});
2123
+ return [
2124
+ 4,
2125
+ loadRelevantSources()
2126
+ ];
2127
+ case 1:
2128
+ relevantSources = _state.sent();
2129
+ return [
2130
+ 4,
2131
+ Promise.all(relevantSources.map(function(x) {
2132
+ return x.source.syncEntityInstance(x).then(function(y) {
2133
+ return [
2134
+ x,
2135
+ y
2136
+ ];
2137
+ });
2138
+ }))
2139
+ ];
2140
+ case 2:
2141
+ syncEntityInstances = _state.sent();
2142
+ sourcesByFlowType = makeValuesGroupMap(syncEntityInstances, function(x) {
2143
+ return x[0].flowType;
2144
+ });
2145
+ primarySources = (_sourcesByFlowType_get = sourcesByFlowType.get('primary')) !== null && _sourcesByFlowType_get !== void 0 ? _sourcesByFlowType_get : [];
2146
+ secondarySources = (_sourcesByFlowType_get1 = sourcesByFlowType.get('secondary')) !== null && _sourcesByFlowType_get1 !== void 0 ? _sourcesByFlowType_get1 : [];
2147
+ replicaSources = (_sourcesByFlowType_get2 = sourcesByFlowType.get('replica')) !== null && _sourcesByFlowType_get2 !== void 0 ? _sourcesByFlowType_get2 : [];
2148
+ // assert primary sources count
2149
+ switch(primarySources.length){
2150
+ case 0:
2151
+ throw new NoPrimarySyncSourceError(syncEntityCommonTypeIdPair);
2152
+ case 1:
2153
+ break;
2154
+ default:
2155
+ throw new MultiplePrimarySyncSourceError(syncEntityCommonTypeIdPair);
2156
+ }
2157
+ return [
2158
+ 4,
2159
+ performSynchronizationOfSources({
2160
+ syncRecursionDepth: 0
2161
+ })
2162
+ ];
2163
+ case 3:
2164
+ result = _state.sent();
2165
+ return [
2166
+ 2,
2167
+ {
2168
+ targetPair: syncEntityCommonTypeIdPair,
2169
+ entitiesSynchronized: result.synchronizedEntityResults
2170
+ }
2171
+ ];
2172
+ }
2173
+ });
2174
+ })();
2175
+ };
2176
+ instance = {
2177
+ entityPair: syncEntityCommonTypeIdPair,
2178
+ synchronize: synchronize
2179
+ };
2180
+ return [
2181
+ 2,
2182
+ instance
2183
+ ];
2184
+ });
2185
+ })();
2186
+ };
2187
+ var result = {
2188
+ commonType: commonType,
2189
+ synchronizeInstance: synchronizeInstance
2190
+ };
2191
+ return result;
2192
+ }
2193
+
2194
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
2195
+ try {
2196
+ var info = gen[key](arg);
2197
+ var value = info.value;
2198
+ } catch (error) {
2199
+ reject(error);
2200
+ return;
2201
+ }
2202
+ if (info.done) {
2203
+ resolve(value);
2204
+ } else {
2205
+ Promise.resolve(value).then(_next, _throw);
2206
+ }
2207
+ }
2208
+ function _async_to_generator$1(fn) {
2209
+ return function() {
2210
+ var self = this, args = arguments;
2211
+ return new Promise(function(resolve, reject) {
2212
+ var gen = fn.apply(self, args);
2213
+ function _next(value) {
2214
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
2215
+ }
2216
+ function _throw(err) {
2217
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
2218
+ }
2219
+ _next(undefined);
2220
+ });
2221
+ };
2222
+ }
2223
+ function _instanceof(left, right) {
2224
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
2225
+ return !!right[Symbol.hasInstance](left);
2226
+ } else {
2227
+ return left instanceof right;
2228
+ }
2229
+ }
2230
+ function _ts_generator$1(thisArg, body) {
2231
+ var f, y, t, _ = {
2232
+ label: 0,
2233
+ sent: function() {
2234
+ if (t[0] & 1) throw t[1];
2235
+ return t[1];
2236
+ },
2237
+ trys: [],
2238
+ ops: []
2239
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
2240
+ return d(g, "next", {
2241
+ value: verb(0)
2242
+ }), d(g, "throw", {
2243
+ value: verb(1)
2244
+ }), d(g, "return", {
2245
+ value: verb(2)
2246
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
2247
+ value: function() {
2248
+ return this;
2249
+ }
2250
+ }), g;
2251
+ function verb(n) {
2252
+ return function(v) {
2253
+ return step([
2254
+ n,
2255
+ v
2256
+ ]);
2257
+ };
2258
+ }
2259
+ function step(op) {
2260
+ if (f) throw new TypeError("Generator is already executing.");
2261
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
2262
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2263
+ if (y = 0, t) op = [
2264
+ op[0] & 2,
2265
+ t.value
2266
+ ];
2267
+ switch(op[0]){
1196
2268
  case 0:
1197
- throw new NoPrimarySyncSourceError(syncEntityCommonTypeIdPair);
1198
2269
  case 1:
2270
+ t = op;
1199
2271
  break;
1200
- default:
1201
- throw new MultiplePrimarySyncSourceError(syncEntityCommonTypeIdPair);
1202
- }
1203
- function synchronizeInstance(source, deleted) {
1204
- const [input, sourceInstance] = source;
1205
- const promise = deleted ? sourceInstance.synchronizeDelete() : sourceInstance.synchronize();
1206
- return promise.catch((error) => {
1207
- const errorResult = {
1208
- type: 'error',
1209
- error,
1210
- entity: {
1211
- ...syncEntityCommonTypeIdPair,
1212
- sourceInfo: input.source.info,
1213
- id: ''
1214
- }
2272
+ case 4:
2273
+ _.label++;
2274
+ return {
2275
+ value: op[1],
2276
+ done: false
1215
2277
  };
1216
- return errorResult;
1217
- });
1218
- }
1219
- async function performSynchronizationOfSources(input) {
1220
- const { secondaryFlaggedDelete } = input;
1221
- let result;
1222
- // synchronize the primary source
1223
- const primarySource = primarySources[0];
1224
- const primarySyncResult = await synchronizeInstance(primarySource, secondaryFlaggedDelete ?? false);
1225
- const synchronizedEntityResults = [primarySyncResult];
1226
- let primaryFlaggedDelete = false;
1227
- switch (primarySyncResult.type) {
1228
- case 'deleted':
1229
- primaryFlaggedDelete = true;
2278
+ case 5:
2279
+ _.label++;
2280
+ y = op[1];
2281
+ op = [
2282
+ 0
2283
+ ];
2284
+ continue;
2285
+ case 7:
2286
+ op = _.ops.pop();
2287
+ _.trys.pop();
2288
+ continue;
2289
+ default:
2290
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
2291
+ _ = 0;
2292
+ continue;
2293
+ }
2294
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
2295
+ _.label = op[1];
1230
2296
  break;
1231
- case 'failed':
1232
- case 'error':
1233
- throw new SynchronizationFailedError(syncEntityCommonTypeIdPair, primarySyncResult.error);
1234
- }
1235
- // synchronize all secondary sources, one after the other. If any secondary source returns deleted and the primary source was not flagged as deleted, then the synchronization will be restarted.
1236
- for (const secondarySource of secondarySources) {
1237
- const secondarySyncResult = await synchronizeInstance(secondarySource, primaryFlaggedDelete);
1238
- synchronizedEntityResults.push(secondarySyncResult);
1239
- switch (secondarySyncResult.type) {
1240
- case 'deleted':
1241
- if (primaryFlaggedDelete === false) {
1242
- break;
1243
- }
1244
- break;
1245
- case 'failed':
1246
- case 'error':
1247
- throw new SynchronizationFailedError(syncEntityCommonTypeIdPair, secondarySyncResult.error);
1248
2297
  }
1249
- }
1250
- // if result was already set, then it was completed in a recursive result
1251
- if (result == null) {
1252
- // synchronize all replica sources concurrently
1253
- const replicaTaskResults = await performAsyncTasks(replicaSources, (x) => synchronizeInstance(x, primaryFlaggedDelete), {
1254
- sequential: false,
1255
- maxParallelTasks: 3
1256
- });
1257
- // add all the results
1258
- pushArrayItemsIntoArray(synchronizedEntityResults, replicaTaskResults.results.map((x) => x[1]));
1259
- // compute final result
1260
- result = {
1261
- synchronizedEntityResults
1262
- };
1263
- }
1264
- return result;
2298
+ if (op[0] === 6 && _.label < t[1]) {
2299
+ _.label = t[1];
2300
+ t = op;
2301
+ break;
2302
+ }
2303
+ if (t && _.label < t[2]) {
2304
+ _.label = t[2];
2305
+ _.ops.push(op);
2306
+ break;
2307
+ }
2308
+ if (t[2]) _.ops.pop();
2309
+ _.trys.pop();
2310
+ continue;
1265
2311
  }
1266
- const result = await performSynchronizationOfSources({ });
1267
- return {
1268
- targetPair: syncEntityCommonTypeIdPair,
1269
- entitiesSynchronized: result.synchronizedEntityResults
1270
- };
1271
- };
1272
- const instance = {
1273
- entityPair: syncEntityCommonTypeIdPair,
1274
- synchronize
2312
+ op = body.call(thisArg, _);
2313
+ } catch (e) {
2314
+ op = [
2315
+ 6,
2316
+ e
2317
+ ];
2318
+ y = 0;
2319
+ } finally{
2320
+ f = t = 0;
2321
+ }
2322
+ if (op[0] & 5) throw op[1];
2323
+ return {
2324
+ value: op[0] ? op[1] : void 0,
2325
+ done: true
1275
2326
  };
1276
- return instance;
1277
- };
1278
- const result = {
1279
- commonType,
1280
- synchronizeInstance
1281
- };
1282
- return result;
2327
+ }
1283
2328
  }
1284
-
1285
2329
  /**
1286
2330
  * Creates a function that validates input against an ArkType schema and then processes it.
1287
2331
  *
@@ -1300,18 +2344,46 @@ function basicSyncEntityCommonTypeSynchronizerInstanceFactory(config) {
1300
2344
  *
1301
2345
  * const result = await processUser({ id: '123', name: 'John' });
1302
2346
  * ```
1303
- */
1304
- function transformAndValidateObject(config) {
1305
- const transformToResult = transformAndValidateObjectResult(config);
1306
- const { handleValidationError } = config;
1307
- return async (input, context) => {
1308
- const x = await transformToResult(input, context);
1309
- if (x.success) {
1310
- return { object: x.object, result: x.result };
1311
- }
1312
- // Error handler is expected to throw. If it doesn't, there is no validated object to return.
1313
- const result = await handleValidationError(x.validationErrors);
1314
- return { object: undefined, result };
2347
+ */ function transformAndValidateObject(config) {
2348
+ var transformToResult = transformAndValidateObjectResult(config);
2349
+ var handleValidationError = config.handleValidationError;
2350
+ return function(input, context) {
2351
+ return _async_to_generator$1(function() {
2352
+ var x, result;
2353
+ return _ts_generator$1(this, function(_state) {
2354
+ switch(_state.label){
2355
+ case 0:
2356
+ return [
2357
+ 4,
2358
+ transformToResult(input, context)
2359
+ ];
2360
+ case 1:
2361
+ x = _state.sent();
2362
+ if (x.success) {
2363
+ return [
2364
+ 2,
2365
+ {
2366
+ object: x.object,
2367
+ result: x.result
2368
+ }
2369
+ ];
2370
+ }
2371
+ return [
2372
+ 4,
2373
+ handleValidationError(x.validationErrors)
2374
+ ];
2375
+ case 2:
2376
+ result = _state.sent();
2377
+ return [
2378
+ 2,
2379
+ {
2380
+ object: undefined,
2381
+ result: result
2382
+ }
2383
+ ];
2384
+ }
2385
+ });
2386
+ })();
1315
2387
  };
1316
2388
  }
1317
2389
  /**
@@ -1322,14 +2394,13 @@ function transformAndValidateObject(config) {
1322
2394
  *
1323
2395
  * @param defaults - default error handler
1324
2396
  * @returns a factory function that creates TransformAndValidateObjectFunction instances
1325
- */
1326
- function transformAndValidateObjectFactory(defaults) {
1327
- const { handleValidationError: defaultHandleValidationError } = defaults;
1328
- return (schema, fn, handleValidationError) => {
1329
- const config = {
1330
- schema,
1331
- fn,
1332
- handleValidationError: handleValidationError ?? defaultHandleValidationError
2397
+ */ function transformAndValidateObjectFactory(defaults) {
2398
+ var defaultHandleValidationError = defaults.handleValidationError;
2399
+ return function(schema, fn, handleValidationError) {
2400
+ var config = {
2401
+ schema: schema,
2402
+ fn: fn,
2403
+ handleValidationError: handleValidationError !== null && handleValidationError !== void 0 ? handleValidationError : defaultHandleValidationError
1333
2404
  };
1334
2405
  return transformAndValidateObject(config);
1335
2406
  };
@@ -1357,17 +2428,42 @@ function transformAndValidateObjectFactory(defaults) {
1357
2428
  * console.log(result.validationErrors.summary);
1358
2429
  * }
1359
2430
  * ```
1360
- */
1361
- function transformAndValidateObjectResult(config) {
1362
- const { schema, fn } = config;
1363
- return async (input) => {
1364
- const out = schema(input);
1365
- if (out instanceof type.errors) {
1366
- return { validationErrors: out, success: false };
1367
- }
1368
- const object = out;
1369
- const result = await fn(object);
1370
- return { object, result, success: true };
2431
+ */ function transformAndValidateObjectResult(config) {
2432
+ var schema = config.schema, fn = config.fn;
2433
+ return function(input) {
2434
+ return _async_to_generator$1(function() {
2435
+ var out, object, result;
2436
+ return _ts_generator$1(this, function(_state) {
2437
+ switch(_state.label){
2438
+ case 0:
2439
+ out = schema(input);
2440
+ if (_instanceof(out, type.errors)) {
2441
+ return [
2442
+ 2,
2443
+ {
2444
+ validationErrors: out,
2445
+ success: false
2446
+ }
2447
+ ];
2448
+ }
2449
+ object = out;
2450
+ return [
2451
+ 4,
2452
+ fn(object)
2453
+ ];
2454
+ case 1:
2455
+ result = _state.sent();
2456
+ return [
2457
+ 2,
2458
+ {
2459
+ object: object,
2460
+ result: result,
2461
+ success: true
2462
+ }
2463
+ ];
2464
+ }
2465
+ });
2466
+ })();
1371
2467
  };
1372
2468
  }
1373
2469
 
@@ -1376,8 +2472,7 @@ function transformAndValidateObjectResult(config) {
1376
2472
  *
1377
2473
  * @param defaults - shared error handler defaults
1378
2474
  * @returns a factory that produces functions returning {@link TransformAndValidateFunctionResult}
1379
- */
1380
- function transformAndValidateFunctionResultFactory(defaults) {
2475
+ */ function transformAndValidateFunctionResultFactory(defaults) {
1381
2476
  return toTransformAndValidateFunctionResultFactory(transformAndValidateObjectFactory(defaults));
1382
2477
  }
1383
2478
  /**
@@ -1386,24 +2481,151 @@ function transformAndValidateFunctionResultFactory(defaults) {
1386
2481
  *
1387
2482
  * @param transformAndValidateObjectFactory - the base factory to wrap
1388
2483
  * @returns a factory that produces functions returning results with `params` attached
1389
- */
1390
- function toTransformAndValidateFunctionResultFactory(transformAndValidateObjectFactory) {
1391
- return (schema, fn, handleValidationError) => {
1392
- const transformAndValidateObjectFn = transformAndValidateObjectFactory(schema, fn, handleValidationError);
1393
- return (input, context) => {
2484
+ */ function toTransformAndValidateFunctionResultFactory(transformAndValidateObjectFactory) {
2485
+ return function(schema, fn, handleValidationError) {
2486
+ var transformAndValidateObjectFn = transformAndValidateObjectFactory(schema, fn, handleValidationError);
2487
+ return function(input, context) {
1394
2488
  return toTransformAndValidateFunctionResult(transformAndValidateObjectFn(input, context));
1395
2489
  };
1396
2490
  };
1397
2491
  }
1398
2492
  function toTransformAndValidateFunctionResult(objectOutput) {
1399
- return mapPromiseOrValue(objectOutput, (x) => {
1400
- const { object, result } = x;
1401
- const fnResult = result;
2493
+ return mapPromiseOrValue(objectOutput, function(x) {
2494
+ var object = x.object, result = x.result;
2495
+ var fnResult = result;
1402
2496
  fnResult.params = object;
1403
2497
  return fnResult;
1404
2498
  });
1405
2499
  }
1406
2500
 
2501
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2502
+ try {
2503
+ var info = gen[key](arg);
2504
+ var value = info.value;
2505
+ } catch (error) {
2506
+ reject(error);
2507
+ return;
2508
+ }
2509
+ if (info.done) {
2510
+ resolve(value);
2511
+ } else {
2512
+ Promise.resolve(value).then(_next, _throw);
2513
+ }
2514
+ }
2515
+ function _async_to_generator(fn) {
2516
+ return function() {
2517
+ var self = this, args = arguments;
2518
+ return new Promise(function(resolve, reject) {
2519
+ var gen = fn.apply(self, args);
2520
+ function _next(value) {
2521
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2522
+ }
2523
+ function _throw(err) {
2524
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2525
+ }
2526
+ _next(undefined);
2527
+ });
2528
+ };
2529
+ }
2530
+ function _ts_generator(thisArg, body) {
2531
+ var f, y, t, _ = {
2532
+ label: 0,
2533
+ sent: function() {
2534
+ if (t[0] & 1) throw t[1];
2535
+ return t[1];
2536
+ },
2537
+ trys: [],
2538
+ ops: []
2539
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
2540
+ return d(g, "next", {
2541
+ value: verb(0)
2542
+ }), d(g, "throw", {
2543
+ value: verb(1)
2544
+ }), d(g, "return", {
2545
+ value: verb(2)
2546
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
2547
+ value: function() {
2548
+ return this;
2549
+ }
2550
+ }), g;
2551
+ function verb(n) {
2552
+ return function(v) {
2553
+ return step([
2554
+ n,
2555
+ v
2556
+ ]);
2557
+ };
2558
+ }
2559
+ function step(op) {
2560
+ if (f) throw new TypeError("Generator is already executing.");
2561
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
2562
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2563
+ if (y = 0, t) op = [
2564
+ op[0] & 2,
2565
+ t.value
2566
+ ];
2567
+ switch(op[0]){
2568
+ case 0:
2569
+ case 1:
2570
+ t = op;
2571
+ break;
2572
+ case 4:
2573
+ _.label++;
2574
+ return {
2575
+ value: op[1],
2576
+ done: false
2577
+ };
2578
+ case 5:
2579
+ _.label++;
2580
+ y = op[1];
2581
+ op = [
2582
+ 0
2583
+ ];
2584
+ continue;
2585
+ case 7:
2586
+ op = _.ops.pop();
2587
+ _.trys.pop();
2588
+ continue;
2589
+ default:
2590
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
2591
+ _ = 0;
2592
+ continue;
2593
+ }
2594
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
2595
+ _.label = op[1];
2596
+ break;
2597
+ }
2598
+ if (op[0] === 6 && _.label < t[1]) {
2599
+ _.label = t[1];
2600
+ t = op;
2601
+ break;
2602
+ }
2603
+ if (t && _.label < t[2]) {
2604
+ _.label = t[2];
2605
+ _.ops.push(op);
2606
+ break;
2607
+ }
2608
+ if (t[2]) _.ops.pop();
2609
+ _.trys.pop();
2610
+ continue;
2611
+ }
2612
+ op = body.call(thisArg, _);
2613
+ } catch (e) {
2614
+ op = [
2615
+ 6,
2616
+ e
2617
+ ];
2618
+ y = 0;
2619
+ } finally{
2620
+ f = t = 0;
2621
+ }
2622
+ if (op[0] & 5) throw op[1];
2623
+ return {
2624
+ value: op[0] ? op[1] : void 0,
2625
+ done: true
2626
+ };
2627
+ }
2628
+ }
1407
2629
  /**
1408
2630
  * Creates a factory for transform-and-validate functions that return only the result (discarding the parsed object).
1409
2631
  *
@@ -1411,45 +2633,55 @@ function toTransformAndValidateFunctionResult(objectOutput) {
1411
2633
  *
1412
2634
  * @param defaults - shared error handler defaults
1413
2635
  * @returns a factory that produces functions returning only the handler's result
1414
- */
1415
- function transformAndValidateResultFactory(defaults) {
1416
- const factory = transformAndValidateObjectFactory(defaults);
1417
- return (schema, fn, handleValidationError) => {
1418
- const transformAndValidateObjectFn = factory(schema, fn, handleValidationError);
1419
- return async (input, context) => {
1420
- const { result } = await transformAndValidateObjectFn(input, context);
1421
- return result;
2636
+ */ function transformAndValidateResultFactory(defaults) {
2637
+ var factory = transformAndValidateObjectFactory(defaults);
2638
+ return function(schema, fn, handleValidationError) {
2639
+ var transformAndValidateObjectFn = factory(schema, fn, handleValidationError);
2640
+ return function(input, context) {
2641
+ return _async_to_generator(function() {
2642
+ var result;
2643
+ return _ts_generator(this, function(_state) {
2644
+ switch(_state.label){
2645
+ case 0:
2646
+ return [
2647
+ 4,
2648
+ transformAndValidateObjectFn(input, context)
2649
+ ];
2650
+ case 1:
2651
+ result = _state.sent().result;
2652
+ return [
2653
+ 2,
2654
+ result
2655
+ ];
2656
+ }
2657
+ });
2658
+ })();
1422
2659
  };
1423
2660
  };
1424
2661
  }
1425
2662
 
1426
2663
  /**
1427
2664
  * ArkType schema for a model key (non-empty string).
1428
- */
1429
- const modelKeyType = type('string > 0');
2665
+ */ var modelKeyType = type('string > 0');
1430
2666
  /**
1431
2667
  * ArkType schema for a model id (non-empty string).
1432
- */
1433
- const modelIdType = type('string > 0');
2668
+ */ var modelIdType = type('string > 0');
1434
2669
  /**
1435
2670
  * ArkType schema for target model params with a required `key` field.
1436
- */
1437
- const targetModelParamsType = type({
2671
+ */ var targetModelParamsType = type({
1438
2672
  key: modelKeyType
1439
2673
  });
1440
2674
  /**
1441
2675
  * ArkType schema for target model id params with a required `id` field.
1442
- */
1443
- const targetModelIdParamsType = type({
2676
+ */ var targetModelIdParamsType = type({
1444
2677
  id: modelIdType
1445
2678
  });
1446
2679
 
1447
2680
  function clearable(definition) {
1448
- let result;
2681
+ var result;
1449
2682
  if (typeof definition === 'string') {
1450
- result = `${definition} | null | undefined`;
1451
- }
1452
- else {
2683
+ result = "".concat(definition, " | null | undefined");
2684
+ } else {
1453
2685
  result = definition.or('null').or('undefined');
1454
2686
  }
1455
2687
  return result;
@@ -1464,43 +2696,49 @@ function clearable(definition) {
1464
2696
  * If we only used Date, or only used string.date.parse, then using the ArkType gets more specific to
1465
2697
  * those independent cases, and will cause validation errors if you end up passing the object of that type
1466
2698
  * rather than a freshly parsed JSON string POJO of that type.
1467
- */
1468
- const ARKTYPE_DATE_DTO_TYPE = 'Date | string.date.parse';
2699
+ */ var ARKTYPE_DATE_DTO_TYPE = 'Date | string.date.parse';
1469
2700
 
1470
2701
  /**
1471
2702
  * ArkType schema for a valid ISO 8601 day string (e.g., "2024-01-15").
1472
- */
1473
- const iso8601DayStringType = type('string > 0').narrow((val, ctx) => (val != null && isISO8601DayString(val)) || ctx.mustBe('a valid ISO 8601 day string'));
2703
+ */ var iso8601DayStringType = type('string > 0').narrow(function(val, ctx) {
2704
+ return val != null && isISO8601DayString(val) || ctx.mustBe('a valid ISO 8601 day string');
2705
+ });
1474
2706
 
1475
2707
  /**
1476
2708
  * ArkType schema for a valid minute of the day (0-1439).
1477
- */
1478
- const minuteOfDayType = type('number').narrow((val, ctx) => (val != null && isMinuteOfDay(val)) || ctx.mustBe('a valid minute of the day (0-1439)'));
2709
+ */ var minuteOfDayType = type('number').narrow(function(val, ctx) {
2710
+ return val != null && isMinuteOfDay(val) || ctx.mustBe('a valid minute of the day (0-1439)');
2711
+ });
1479
2712
 
1480
2713
  /**
1481
2714
  * ArkType schema for a valid E.164 phone number without an extension.
1482
- */
1483
- const e164PhoneNumberType = type('string > 0').narrow((val, ctx) => (val != null && isE164PhoneNumber(val, false)) || ctx.mustBe('a valid E.164 phone number without an extension'));
2715
+ */ var e164PhoneNumberType = type('string > 0').narrow(function(val, ctx) {
2716
+ return val != null && isE164PhoneNumber(val, false) || ctx.mustBe('a valid E.164 phone number without an extension');
2717
+ });
1484
2718
  /**
1485
2719
  * ArkType schema for a valid E.164 phone number, optionally with an extension.
1486
- */
1487
- const e164PhoneNumberWithOptionalExtensionType = type('string > 0').narrow((val, ctx) => (val != null && isE164PhoneNumber(val, true)) || ctx.mustBe('a valid E.164 phone number'));
2720
+ */ var e164PhoneNumberWithOptionalExtensionType = type('string > 0').narrow(function(val, ctx) {
2721
+ return val != null && isE164PhoneNumber(val, true) || ctx.mustBe('a valid E.164 phone number');
2722
+ });
1488
2723
  /**
1489
2724
  * ArkType schema for a valid E.164 phone number that includes an extension.
1490
- */
1491
- const e164PhoneNumberWithExtensionType = type('string > 0').narrow((val, ctx) => (val != null && isE164PhoneNumberWithExtension(val)) || ctx.mustBe('a valid E.164 phone number with an extension'));
2725
+ */ var e164PhoneNumberWithExtensionType = type('string > 0').narrow(function(val, ctx) {
2726
+ return val != null && isE164PhoneNumberWithExtension(val) || ctx.mustBe('a valid E.164 phone number with an extension');
2727
+ });
1492
2728
 
1493
2729
  /**
1494
2730
  * ArkType schema for a valid {@link LatLngPoint} with lat in [-90, 90] and lng in [-180, 180].
1495
- */
1496
- const latLngPointType = type({
2731
+ */ var latLngPointType = type({
1497
2732
  lat: '-90 <= number <= 90',
1498
2733
  lng: '-180 <= number <= 180'
1499
- }).narrow((val, ctx) => (val != null && isValidLatLngPoint(val)) || ctx.mustBe('a valid LatLngPoint with lat in [-90, 90] and lng in [-180, 180]'));
2734
+ }).narrow(function(val, ctx) {
2735
+ return val != null && isValidLatLngPoint(val) || ctx.mustBe('a valid LatLngPoint with lat in [-90, 90] and lng in [-180, 180]');
2736
+ });
1500
2737
  /**
1501
2738
  * ArkType schema for a valid {@link LatLngString} (comma-separated lat/lng, e.g. "30.5,-96.3").
1502
- */
1503
- const latLngStringType = type('string > 0').narrow((val, ctx) => (val != null && isLatLngString(val)) || ctx.mustBe('a valid lat,lng string (e.g. "30.5,-96.3")'));
2739
+ */ var latLngStringType = type('string > 0').narrow(function(val, ctx) {
2740
+ return val != null && isLatLngString(val) || ctx.mustBe('a valid lat,lng string (e.g. "30.5,-96.3")');
2741
+ });
1504
2742
 
1505
2743
  /**
1506
2744
  * Creates an ArkType schema that validates an array has no duplicate keys.
@@ -1512,20 +2750,22 @@ const latLngStringType = type('string > 0').narrow((val, ctx) => (val != null &&
1512
2750
  * ```typescript
1513
2751
  * const uniqueItemsType = uniqueKeyedType((item: Item) => item.id);
1514
2752
  * ```
1515
- */
1516
- function uniqueKeyedType(readKey) {
1517
- const isUniqueKeyed = isUniqueKeyedFunction(readKey);
1518
- return type('unknown[]').narrow((val, ctx) => (val != null && isUniqueKeyed(val)) || ctx.mustBe('an array with unique keys'));
2753
+ */ function uniqueKeyedType(readKey) {
2754
+ var isUniqueKeyed = isUniqueKeyedFunction(readKey);
2755
+ return type('unknown[]').narrow(function(val, ctx) {
2756
+ return val != null && isUniqueKeyed(val) || ctx.mustBe('an array with unique keys');
2757
+ });
1519
2758
  }
1520
2759
 
1521
2760
  /**
1522
2761
  * ArkType schema for a valid website URL (with or without protocol prefix).
1523
- */
1524
- const websiteUrlType = type('string > 0').narrow((val, ctx) => (val != null && isWebsiteUrl(val)) || ctx.mustBe('a valid website URL'));
2762
+ */ var websiteUrlType = type('string > 0').narrow(function(val, ctx) {
2763
+ return val != null && isWebsiteUrl(val) || ctx.mustBe('a valid website URL');
2764
+ });
1525
2765
  /**
1526
2766
  * ArkType schema for a valid website URL that starts with `http://` or `https://`.
1527
- */
1528
- const websiteUrlWithPrefixType = type('string > 0').narrow((val, ctx) => (val != null && isWebsiteUrlWithPrefix(val)) || ctx.mustBe('a valid website URL starting with http:// or https://'));
2767
+ */ var websiteUrlWithPrefixType = type('string > 0').narrow(function(val, ctx) {
2768
+ return val != null && isWebsiteUrlWithPrefix(val) || ctx.mustBe('a valid website URL starting with http:// or https://');
2769
+ });
1529
2770
 
1530
2771
  export { ADDRESS_CITY_MAX_LENGTH, ADDRESS_COUNTRY_MAX_LENGTH, ADDRESS_LINE_MAX_LENGTH, ADDRESS_STATE_CODE_MAX_LENGTH, ADDRESS_STATE_MAX_LENGTH, ADDRESS_ZIP_MAX_LENGTH, ARKTYPE_DATE_DTO_TYPE, AbstractModelPermissionService, CASHAPP_BASE_URL, CASHAPP_USERNAME_PREFIX, CASHAPP_WEBSITE_LINK_TYPE, EMAIL_URL_WEBSITE_LINK_TYPE, FACEBOOK_BASE_URL, FACEBOOK_WEBSITE_LINK_TYPE, FULL_ACCESS_ROLE_KEY, GRANTED_ADMIN_ROLE_KEY, GRANTED_DELETE_ROLE_KEY, GRANTED_OWNER_ROLE_KEY, GRANTED_READ_ROLE_KEY, GRANTED_SYS_ADMIN_ROLE_KEY, GRANTED_UPDATE_ROLE_KEY, GrantedRoleMapReaderInstance, INSTAGRAM_BASE_URL, INSTAGRAM_WEBSITE_LINK_TYPE, NO_ACCESS_ROLE_KEY, PAYPAL_BASE_URL, PAYPAL_WEBSITE_LINK_TYPE, PHONE_URL_WEBSITE_LINK_TYPE, SNAPCHAT_BASE_URL, SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID, SNAPCHAT_WEBSITE_LINK_TYPE, SPOTIFY_BASE_URL, SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID, SPOTIFY_WEBSITE_LINK_TYPE, TIKTOK_BASE_URL, TIKTOK_USERNAME_PREFIX, TIKTOK_WEBSITE_LINK_TYPE, TWITTER_BASE_URL, TWITTER_WEBSITE_LINK_TYPE, UNKNOWN_WEBSITE_LINK_TYPE, VENMO_BASE_URL, VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID, VENMO_WEBSITE_LINK_TYPE, WEBSITE_FILE_LINK_DATA_MAX_LENGTH, WEBSITE_FILE_LINK_DATA_REGEX, WEBSITE_FILE_LINK_ENCODE_SEPARATOR, WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH, WEBSITE_FILE_LINK_MIME_TYPE_REGEX, WEBSITE_FILE_LINK_NAME_MAX_LENGTH, WEBSITE_FILE_LINK_TYPE_MAX_LENGTH, WEBSITE_FILE_LINK_TYPE_REGEX, WEBSITE_FILE_LINK_WEBSITE_LINK_TYPE, WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH, WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID, WEBSITE_LINK_TYPE_MAX_LENGTH, WEBSITE_LINK_TYPE_REGEX, WEBSITE_URL_WEBSITE_LINK_TYPE, YOUTUBE_BASE_URL, YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID, YOUTUBE_WEBSITE_LINK_TYPE, basicSyncEntityCommonTypeSynchronizerInstanceFactory, cashappProfileUrl, cashappProfileUrlToWebsiteLink, clearable, contextGrantedModelRoles, decodeWebsiteLinkEncodedDataToWebsiteFileLink, e164PhoneNumberType, e164PhoneNumberWithExtensionType, e164PhoneNumberWithOptionalExtensionType, emailAddressToWebsiteLink, encodeWebsiteFileLinkToWebsiteLinkEncodedData, facebookProfileUrl, facebookProfileUrlToWebsiteLink, fullAccessGrantedModelRoles, fullAccessRoleMap, grantedRoleKeysMapFromArray, grantedRoleMapReader, instagramProfileUrl, instagramProfileUrlToWebsiteLink, isFullAccessRoleMap, isGrantedAdminLevelRole, isNoAccessRoleMap, isValidWebsiteLinkType, iso8601DayStringType, latLngPointType, latLngStringType, minuteOfDayType, modelIdType, modelKeyType, noAccessContextGrantedModelRoles, noAccessRoleMap, paypalProfileUrl, paypalProfileUrlToWebsiteLink, phoneNumberToWebsiteLink, snapchatProfileUrl, snapchatProfileUrlToWebsiteLink, spotifyProfileUrl, spotifyProfileUrlToWebsiteLink, syncEntityCommonTypeIdPairFactory, syncEntityFactory, syncEntitySynchronizer, targetModelIdParamsType, targetModelParamsType, tiktokProfileUrl, tiktokProfileUrlToWebsiteLink, toTransformAndValidateFunctionResult, toTransformAndValidateFunctionResultFactory, transformAndValidateFunctionResultFactory, transformAndValidateObject, transformAndValidateObjectFactory, transformAndValidateObjectResult, transformAndValidateResultFactory, twitterProfileUrl, twitterProfileUrlToWebsiteLink, uniqueKeyedType, unitedStatesAddressWithStateCodeType, unitedStatesAddressWithStateStringType, usernameFromUsernameOrWebsiteWithBaseUrlUsername, usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername, usernameOrWebsiteUrlToWebsiteUrl, venmoProfileUrl, venmoProfileUrlToWebsiteLink, websiteFileLinkToWebsiteLink, websiteFileLinkType, websiteLinkToWebsiteLinkFile, websiteLinkType, websiteUrlToWebsiteLink, websiteUrlType, websiteUrlWithPrefixType, youtubeProfileUrl, youtubeProfileUrlToWebsiteLink };
1531
- //# sourceMappingURL=index.esm.js.map