@ember-data/request-utils 5.4.1-beta.1 → 5.4.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deprecation-support.js +2 -1
- package/dist/deprecation-support.js.map +1 -1
- package/dist/handlers.js +147 -0
- package/dist/handlers.js.map +1 -0
- package/dist/index.js +240 -27
- package/dist/index.js.map +1 -1
- package/dist/{inflect-8aYUyMN7.js → inflect-CwI_k2it.js} +141 -147
- package/dist/inflect-CwI_k2it.js.map +1 -0
- package/dist/string.js +2 -1
- package/dist/string.js.map +1 -1
- package/dist/transform-1PDozfHr.js +192 -0
- package/dist/transform-1PDozfHr.js.map +1 -0
- package/package.json +7 -6
- package/unstable-preview-types/-private/handlers/auto-compress.d.ts +168 -0
- package/unstable-preview-types/-private/handlers/auto-compress.d.ts.map +1 -0
- package/unstable-preview-types/-private/string/inflect.d.ts +126 -0
- package/unstable-preview-types/-private/string/inflect.d.ts.map +1 -1
- package/unstable-preview-types/-private/string/transform.d.ts +93 -57
- package/unstable-preview-types/-private/string/transform.d.ts.map +1 -1
- package/unstable-preview-types/handlers.d.ts +11 -0
- package/unstable-preview-types/handlers.d.ts.map +1 -0
- package/unstable-preview-types/index.d.ts +184 -10
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/unstable-preview-types/string.d.ts +12 -0
- package/unstable-preview-types/string.d.ts.map +1 -1
- package/dist/inflect-8aYUyMN7.js.map +0 -1
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
/// <reference path="./handlers.d.ts" />
|
|
1
2
|
/// <reference path="./deprecation-support.d.ts" />
|
|
2
3
|
/// <reference path="./string.d.ts" />
|
|
3
|
-
/// <reference path="./-private/
|
|
4
|
+
/// <reference path="./-private/handlers/auto-compress.d.ts" />
|
|
4
5
|
/// <reference path="./-private/string/transform.d.ts" />
|
|
5
6
|
/// <reference path="./-private/string/inflect.d.ts" />
|
|
7
|
+
/// <reference path="./-private/string/inflections.d.ts" />
|
|
6
8
|
declare module '@ember-data/request-utils' {
|
|
7
9
|
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
8
10
|
import type { Cache } from '@warp-drive/core-types/cache';
|
|
9
11
|
import type { StableDocumentIdentifier } from '@warp-drive/core-types/identifier';
|
|
10
12
|
import type { QueryParamsSerializationOptions, QueryParamsSource, Serializable } from '@warp-drive/core-types/params';
|
|
11
|
-
import type { ImmutableRequestInfo, ResponseInfo } from '@warp-drive/core-types/request';
|
|
13
|
+
import type { ImmutableRequestInfo, ResponseInfo, StructuredDocument } from '@warp-drive/core-types/request';
|
|
14
|
+
import type { ResourceDocument } from '@warp-drive/core-types/spec/document';
|
|
12
15
|
type UnsubscribeToken = object;
|
|
13
16
|
type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
|
|
14
17
|
type DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';
|
|
@@ -278,7 +281,7 @@ declare module '@ember-data/request-utils' {
|
|
|
278
281
|
* @public
|
|
279
282
|
* @for @ember-data/request-utils
|
|
280
283
|
* @param {URLSearchParams | object} params
|
|
281
|
-
* @param {
|
|
284
|
+
* @param {Object} options
|
|
282
285
|
* @return {URLSearchParams} A URLSearchParams with keys inserted in sorted order
|
|
283
286
|
*/
|
|
284
287
|
export function sortQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): URLSearchParams;
|
|
@@ -299,9 +302,9 @@ declare module '@ember-data/request-utils' {
|
|
|
299
302
|
* @static
|
|
300
303
|
* @public
|
|
301
304
|
* @for @ember-data/request-utils
|
|
302
|
-
* @param {URLSearchParams |
|
|
303
|
-
* @param {
|
|
304
|
-
* @return {
|
|
305
|
+
* @param {URLSearchParams | Object} params
|
|
306
|
+
* @param {Object} [options]
|
|
307
|
+
* @return {String} A sorted query params string without the leading `?`
|
|
305
308
|
*/
|
|
306
309
|
export function buildQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): string;
|
|
307
310
|
export interface CacheControlValue {
|
|
@@ -345,13 +348,161 @@ declare module '@ember-data/request-utils' {
|
|
|
345
348
|
* @static
|
|
346
349
|
* @public
|
|
347
350
|
* @for @ember-data/request-utils
|
|
348
|
-
* @param {
|
|
351
|
+
* @param {String} header
|
|
349
352
|
* @return {CacheControlValue}
|
|
350
353
|
*/
|
|
351
354
|
export function parseCacheControl(header: string): CacheControlValue;
|
|
355
|
+
/**
|
|
356
|
+
* The configuration options for the CachePolicy
|
|
357
|
+
* provided by `@ember-data/request-utils`.
|
|
358
|
+
*
|
|
359
|
+
* ```ts
|
|
360
|
+
* import { CachePolicy } from '@ember-data/request-utils';
|
|
361
|
+
*
|
|
362
|
+
* new CachePolicy({
|
|
363
|
+
* // ... PolicyConfig Settings ... //
|
|
364
|
+
* });
|
|
365
|
+
* ```
|
|
366
|
+
*
|
|
367
|
+
* @typedoc
|
|
368
|
+
*/
|
|
352
369
|
export type PolicyConfig = {
|
|
370
|
+
/**
|
|
371
|
+
* the number of milliseconds after which a request is considered
|
|
372
|
+
* stale. If a request is issued again after this time, the request
|
|
373
|
+
* will respond from cache immediately while a background request
|
|
374
|
+
* is made to update the cache.
|
|
375
|
+
*
|
|
376
|
+
* This is calculated against the `date` header of the response.
|
|
377
|
+
*
|
|
378
|
+
* If your API does not provide a `date` header, the `Fetch` handler
|
|
379
|
+
* provided by `@ember-data/request/fetch` will automatically add
|
|
380
|
+
* it to responses if it is not present. Responses without a `date`
|
|
381
|
+
* header will be considered stale immediately.
|
|
382
|
+
*
|
|
383
|
+
* @typedoc
|
|
384
|
+
*/
|
|
353
385
|
apiCacheSoftExpires: number;
|
|
386
|
+
/**
|
|
387
|
+
* the number of milliseconds after which a request is considered
|
|
388
|
+
* expired and should be re-fetched. If a request is issued again
|
|
389
|
+
* after this time, the request will disregard the cache and
|
|
390
|
+
* wait for a fresh response from the API.
|
|
391
|
+
*
|
|
392
|
+
* This is calculated against the `date` header of the response.
|
|
393
|
+
*
|
|
394
|
+
* If your API does not provide a `date` header, the `Fetch` handler
|
|
395
|
+
* provided by `@ember-data/request/fetch` will automatically add
|
|
396
|
+
* it to responses if it is not present. Responses without a `date`
|
|
397
|
+
* header will be considered hard expired immediately.
|
|
398
|
+
*
|
|
399
|
+
* @typedoc
|
|
400
|
+
*/
|
|
354
401
|
apiCacheHardExpires: number;
|
|
402
|
+
/**
|
|
403
|
+
* In Testing environments, the `apiCacheSoftExpires` will always be `false`
|
|
404
|
+
* and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
|
|
405
|
+
*
|
|
406
|
+
* This helps reduce flakiness and produce predictably rendered results in test suites.
|
|
407
|
+
*
|
|
408
|
+
* Requests that specifically set `cacheOptions.backgroundReload = true` will
|
|
409
|
+
* still be background reloaded in tests.
|
|
410
|
+
*
|
|
411
|
+
* This behavior can be opted out of by setting this value to `true`.
|
|
412
|
+
*
|
|
413
|
+
* @typedoc
|
|
414
|
+
*/
|
|
415
|
+
disableTestOptimization?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* In addition to the simple time-based expiration strategy, CachePolicy
|
|
418
|
+
* supports various common server-supplied expiration strategies via
|
|
419
|
+
* headers, as well as custom expiration strategies via the `isExpired`
|
|
420
|
+
* function.
|
|
421
|
+
*
|
|
422
|
+
* Requests will be validated for expiration against these constraints.
|
|
423
|
+
* If any of these constraints are not met, the request will be considered
|
|
424
|
+
* expired. If all constraints are met, the request will be considered
|
|
425
|
+
* valid and the time based expiration strategy will NOT be used.
|
|
426
|
+
*
|
|
427
|
+
* Meeting a constraint means BOTH that the properties the constraint
|
|
428
|
+
* requires are present AND that the expiration time indicated by those
|
|
429
|
+
* properties has not been exceeded.
|
|
430
|
+
*
|
|
431
|
+
* In other words, if the properties for a constraint are not present,
|
|
432
|
+
* this does not count either as meeting or as not meeting the constraint,
|
|
433
|
+
* the constraint simply does not apply.
|
|
434
|
+
*
|
|
435
|
+
* The `isExpired` function is called with the request and should return
|
|
436
|
+
* `true` if the request is expired, `false` if it is not expired, and
|
|
437
|
+
* `null` if the expiration status is unknown.
|
|
438
|
+
*
|
|
439
|
+
* In order constraints are checked:
|
|
440
|
+
*
|
|
441
|
+
* - isExpired function
|
|
442
|
+
* - ↳ (if null) X-WarpDrive-Expires header
|
|
443
|
+
* - ↳ (if null) Cache-Control header
|
|
444
|
+
* - ↳ (if null) Expires header
|
|
445
|
+
*
|
|
446
|
+
* @typedoc
|
|
447
|
+
*/
|
|
448
|
+
constraints?: {
|
|
449
|
+
/**
|
|
450
|
+
* Headers that should be checked for expiration.
|
|
451
|
+
*
|
|
452
|
+
* @typedoc
|
|
453
|
+
*/
|
|
454
|
+
headers?: {
|
|
455
|
+
/**
|
|
456
|
+
* Whether the `Cache-Control` header should be checked for expiration.
|
|
457
|
+
* If `true`, then the `max-age` and `s-maxage` directives are used alongside
|
|
458
|
+
* the `Age` and `Date` headers to determine if the expiration time has passed.
|
|
459
|
+
*
|
|
460
|
+
* Other directives are ignored.
|
|
461
|
+
*
|
|
462
|
+
* 'Cache-Control' will take precedence over 'Expires' if both are present
|
|
463
|
+
* and both configured to be checked.
|
|
464
|
+
*
|
|
465
|
+
* @typedoc
|
|
466
|
+
*/
|
|
467
|
+
'Cache-Control'?: boolean;
|
|
468
|
+
/**
|
|
469
|
+
* Whether the `Expires` header should be checked for expiration.
|
|
470
|
+
*
|
|
471
|
+
* If `true`, then the `Expires` header is used to caclulate the expiration time
|
|
472
|
+
* and determine if the expiration time has passed.
|
|
473
|
+
*
|
|
474
|
+
* 'Cache-Control' will take precedence over 'Expires' if both are present.
|
|
475
|
+
*
|
|
476
|
+
* @typedoc
|
|
477
|
+
*/
|
|
478
|
+
Expires?: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Whether the `X-WarpDrive-Expires` header should be checked for expiration.
|
|
481
|
+
*
|
|
482
|
+
* If `true`, then the `X-WarpDrive-Expires` header is used to caclulate the expiration time
|
|
483
|
+
* and determine if the expiration time has passed.
|
|
484
|
+
*
|
|
485
|
+
* This header will take precedence over 'Cache-Control' and 'Expires' if all three are present.
|
|
486
|
+
*
|
|
487
|
+
* The header's value should be a [UTC date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString).
|
|
488
|
+
*
|
|
489
|
+
* @typedoc
|
|
490
|
+
*/
|
|
491
|
+
'X-WarpDrive-Expires'?: boolean;
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* A function that should be called to determine if the request is expired.
|
|
495
|
+
*
|
|
496
|
+
* If present, this function will be called with the request and should return
|
|
497
|
+
* `true` if the request is expired, `false` if it is not expired, and
|
|
498
|
+
* `null` if the expiration status is unknown.
|
|
499
|
+
*
|
|
500
|
+
* If the function does not return `null`,
|
|
501
|
+
*
|
|
502
|
+
* @typedoc
|
|
503
|
+
*/
|
|
504
|
+
isExpired?: (request: StructuredDocument<ResourceDocument>) => boolean | null;
|
|
505
|
+
};
|
|
355
506
|
};
|
|
356
507
|
/**
|
|
357
508
|
* A basic CachePolicy that can be added to the Store service.
|
|
@@ -359,6 +510,18 @@ declare module '@ember-data/request-utils' {
|
|
|
359
510
|
* Determines staleness based on time since the request was last received from the API
|
|
360
511
|
* using the `date` header.
|
|
361
512
|
*
|
|
513
|
+
* Determines expiration based on configured constraints as well as a time based
|
|
514
|
+
* expiration strategy based on the `date` header.
|
|
515
|
+
*
|
|
516
|
+
* In order expiration is determined by:
|
|
517
|
+
*
|
|
518
|
+
* - Is explicitly invalidated
|
|
519
|
+
* - ↳ (if null) isExpired function <IF Constraint Active>
|
|
520
|
+
* - ↳ (if null) X-WarpDrive-Expires header <IF Constraint Active>
|
|
521
|
+
* - ↳ (if null) Cache-Control header <IF Constraint Active>
|
|
522
|
+
* - ↳ (if null) Expires header <IF Constraint Active>
|
|
523
|
+
* - ↳ (if null) Date header + apiCacheHardExpires < current time
|
|
524
|
+
*
|
|
362
525
|
* Invalidates any request for which `cacheOptions.types` was provided when a createRecord
|
|
363
526
|
* request for that type is successful.
|
|
364
527
|
*
|
|
@@ -398,6 +561,17 @@ declare module '@ember-data/request-utils' {
|
|
|
398
561
|
* }
|
|
399
562
|
* ```
|
|
400
563
|
*
|
|
564
|
+
* In Testing environments, the `apiCacheSoftExpires` will always be `false`
|
|
565
|
+
* and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
|
|
566
|
+
*
|
|
567
|
+
* This helps reduce flakiness and produce predictably rendered results in test suites.
|
|
568
|
+
*
|
|
569
|
+
* Requests that specifically set `cacheOptions.backgroundReload = true` will
|
|
570
|
+
* still be background reloaded in tests.
|
|
571
|
+
*
|
|
572
|
+
* This behavior can be opted out of by setting `disableTestOptimization = true`
|
|
573
|
+
* in the policy config.
|
|
574
|
+
*
|
|
401
575
|
* @class CachePolicy
|
|
402
576
|
* @public
|
|
403
577
|
* @module @ember-data/request-utils
|
|
@@ -447,7 +621,7 @@ declare module '@ember-data/request-utils' {
|
|
|
447
621
|
*
|
|
448
622
|
* @method invalidateRequestsForType
|
|
449
623
|
* @public
|
|
450
|
-
* @param {
|
|
624
|
+
* @param {String} type
|
|
451
625
|
* @param {Store} store
|
|
452
626
|
*/
|
|
453
627
|
invalidateRequestsForType(type: string, store: Store): void;
|
|
@@ -485,7 +659,7 @@ declare module '@ember-data/request-utils' {
|
|
|
485
659
|
* @public
|
|
486
660
|
* @param {StableDocumentIdentifier} identifier
|
|
487
661
|
* @param {Store} store
|
|
488
|
-
* @return {
|
|
662
|
+
* @return {Boolean} true if the request is considered hard expired
|
|
489
663
|
*/
|
|
490
664
|
isHardExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
|
|
491
665
|
/**
|
|
@@ -502,7 +676,7 @@ declare module '@ember-data/request-utils' {
|
|
|
502
676
|
* @public
|
|
503
677
|
* @param {StableDocumentIdentifier} identifier
|
|
504
678
|
* @param {Store} store
|
|
505
|
-
* @return {
|
|
679
|
+
* @return {Boolean} true if the request is considered soft expired
|
|
506
680
|
*/
|
|
507
681
|
isSoftExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
|
|
508
682
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC7G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAI7E,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAChE,KAAK,sBAAsB,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAExF,MAAM,WAAW,oBAAoB;IACnC,CAAC,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,YAAY,GAAG,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3G,CAAC,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC;CAExG;AAED,UAAU,yBAAyB;IAEjC,CAAC,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9E;AAED,UAAU,yBAAyB;IAEjC,CAAC,UAAU,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,sBAAsB,GAAG,IAAI,CAAC;C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;IACH,UAAU,CACR,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,IAAI,EACxC,UAAU,EAAE,wBAAwB,GAAG,IAAI,EAC3C,KAAK,EAAE,KAAK,GACX,IAAI;IAgCP;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,UAAU,EAAE,wBAAwB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;IAoB1E;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CAAC,UAAU,EAAE,wBAAwB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;CA0C3E;AAED,qBAAa,gBAAiB,SAAQ,WAAW;gBACnC,MAAM,EAAE,YAAY;CAgBjC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
declare module '@ember-data/request-utils/string' {
|
|
2
|
+
/**
|
|
3
|
+
* String utilties for transforming and inflecting strings useful for
|
|
4
|
+
* when the format provided by the server is not the format you want to use
|
|
5
|
+
* in your application.
|
|
6
|
+
*
|
|
7
|
+
* Each transformation function stores its results in an LRUCache to avoid
|
|
8
|
+
* recomputing the same value multiple times. The cache size can be set
|
|
9
|
+
* using the `setMaxLRUCacheSize` function. The default size is 10,000.
|
|
10
|
+
*
|
|
11
|
+
* @module @ember-data/request-utils/string
|
|
12
|
+
* @main @ember-data/request-utils/string
|
|
13
|
+
*/
|
|
2
14
|
export { pluralize, singularize, singular, plural, loadIrregular, loadUncountable, irregular, uncountable, resetToDefaults, clear, clearRules, } from '@ember-data/request-utils/-private/string/inflect';
|
|
3
15
|
export { dasherize, camelize, capitalize, underscore, setMaxLRUCacheSize } from '@ember-data/request-utils/-private/string/transform';
|
|
4
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inflect-8aYUyMN7.js","sources":["../src/-private/string/inflections.ts","../src/-private/string/transform.ts","../src/-private/string/inflect.ts"],"sourcesContent":["export type RulesArray = Array<[RegExp, string]>;\ntype DefaultRulesType = {\n plurals: RulesArray;\n singular: RulesArray;\n irregularPairs: Array<[string, string]>;\n uncountable: string[];\n};\n\nexport const defaultRules: DefaultRulesType = {\n plurals: [\n [/$/, 's'],\n [/s$/i, 's'],\n [/^(ax|test)is$/i, '$1es'],\n [/(octop|vir)us$/i, '$1i'],\n [/(octop|vir)i$/i, '$1i'],\n [/(alias|status|bonus)$/i, '$1es'],\n [/(bu)s$/i, '$1ses'],\n [/(buffal|tomat)o$/i, '$1oes'],\n [/([ti])um$/i, '$1a'],\n [/([ti])a$/i, '$1a'],\n [/sis$/i, 'ses'],\n [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'],\n [/(hive)$/i, '$1s'],\n [/([^aeiouy]|qu)y$/i, '$1ies'],\n [/(x|ch|ss|sh)$/i, '$1es'],\n [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'],\n [/^(m|l)ouse$/i, '$1ice'],\n [/^(m|l)ice$/i, '$1ice'],\n [/^(ox)$/i, '$1en'],\n [/^(oxen)$/i, '$1'],\n [/(quiz)$/i, '$1zes'],\n ],\n\n singular: [\n [/s$/i, ''],\n [/(ss)$/i, '$1'],\n [/(n)ews$/i, '$1ews'],\n [/([ti])a$/i, '$1um'],\n [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'],\n [/(^analy)(sis|ses)$/i, '$1sis'],\n [/([^f])ves$/i, '$1fe'],\n [/(hive)s$/i, '$1'],\n [/(tive)s$/i, '$1'],\n [/([lr])ves$/i, '$1f'],\n [/([^aeiouy]|qu)ies$/i, '$1y'],\n [/(s)eries$/i, '$1eries'],\n [/(m)ovies$/i, '$1ovie'],\n [/(x|ch|ss|sh)es$/i, '$1'],\n [/^(m|l)ice$/i, '$1ouse'],\n [/(bus)(es)?$/i, '$1'],\n [/(o)es$/i, '$1'],\n [/(shoe)s$/i, '$1'],\n [/(cris|test)(is|es)$/i, '$1is'],\n [/^(a)x[ie]s$/i, '$1xis'],\n [/(octop|vir)(us|i)$/i, '$1us'],\n [/(alias|status|bonus)(es)?$/i, '$1'],\n [/^(ox)en/i, '$1'],\n [/(vert|ind)ices$/i, '$1ex'],\n [/(matr)ices$/i, '$1ix'],\n [/(quiz)zes$/i, '$1'],\n [/(database)s$/i, '$1'],\n ],\n\n irregularPairs: [\n ['person', 'people'],\n ['man', 'men'],\n ['child', 'children'],\n ['sex', 'sexes'],\n ['move', 'moves'],\n ['cow', 'kine'],\n ['zombie', 'zombies'],\n ],\n\n uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police'],\n};\n","import { DEBUG } from '@warp-drive/build-config/env';\n\nconst DEFAULT_MAX_CACHE_SIZE = 10_000;\nexport class LRUCache<T, V> {\n declare size: number;\n declare state: Map<T, V>;\n declare doWork: (k: T) => V;\n\n // debug stats\n declare _hits: number;\n declare _misses: number;\n declare _ejected: number;\n\n constructor(doWork: (k: T) => V, size?: number) {\n this.size = size || DEFAULT_MAX_CACHE_SIZE;\n this.state = new Map();\n this.doWork = doWork;\n\n if (DEBUG) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n get(key: T) {\n const value = this.state.get(key);\n if (value) {\n if (DEBUG) {\n this._hits++;\n }\n this.state.delete(key);\n this.state.set(key, value);\n return value;\n }\n if (DEBUG) {\n this._misses++;\n }\n\n const newValue = this.doWork(key);\n this.set(key, newValue);\n return newValue;\n }\n\n set(key: T, value: V) {\n if (this.state.size === this.size) {\n for (const [k] of this.state) {\n if (DEBUG) {\n this._ejected++;\n }\n this.state.delete(k);\n break;\n }\n }\n this.state.set(key, value);\n }\n\n clear() {\n this.state.clear();\n if (DEBUG) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n}\n\nconst STRING_DASHERIZE_REGEXP = /[ _]/g;\nconst STRING_DECAMELIZE_REGEXP = /([a-z\\d])([A-Z])/g;\nconst STRING_DASHERIZE_CACHE = new LRUCache<string, string>((key: string) =>\n key.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase().replace(STRING_DASHERIZE_REGEXP, '-')\n);\n\n// eslint-disable-next-line no-useless-escape\nconst STRING_CAMELIZE_REGEXP_1 = /(\\-|\\_|\\.|\\s)+(.)?/g;\nconst STRING_CAMELIZE_REGEXP_2 = /(^|\\/)([A-Z])/g;\nconst CAMELIZE_CACHE = new LRUCache<string, string>((key: string) =>\n key\n .replace(STRING_CAMELIZE_REGEXP_1, (_match, _separator, chr: string | null) => (chr ? chr.toUpperCase() : ''))\n .replace(STRING_CAMELIZE_REGEXP_2, (match /*, separator, chr */) => match.toLowerCase())\n);\n\nconst STRING_UNDERSCORE_REGEXP_1 = /([a-z\\d])([A-Z]+)/g;\n// eslint-disable-next-line no-useless-escape\nconst STRING_UNDERSCORE_REGEXP_2 = /\\-|\\s+/g;\nconst UNDERSCORE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase()\n);\n\nconst STRING_CAPITALIZE_REGEXP = /(^|\\/)([a-z\\u00C0-\\u024F])/g;\nconst CAPITALIZE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase())\n);\n\n/**\n Replaces underscores, spaces, or camelCase with dashes.\n\n ```js\n import { dasherize } from '@ember-data/request-utils/string';\n\n dasherize('innerHTML'); // 'inner-html'\n dasherize('action_name'); // 'action-name'\n dasherize('css-class-name'); // 'css-class-name'\n dasherize('my favorite items'); // 'my-favorite-items'\n dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'\n ```\n\n @typedoc\n*/\nexport function dasherize(str: string): string {\n return STRING_DASHERIZE_CACHE.get(str);\n}\n\n/**\n Returns the lowerCamelCase form of a string.\n\n ```js\n import { camelize } from '@ember-data/request-utils/string';\n\n camelize('innerHTML'); // 'innerHTML'\n camelize('action_name'); // 'actionName'\n camelize('css-class-name'); // 'cssClassName'\n camelize('my favorite items'); // 'myFavoriteItems'\n camelize('My Favorite Items'); // 'myFavoriteItems'\n camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'\n```\n\n @typedoc\n*/\nexport function camelize(str: string): string {\n return CAMELIZE_CACHE.get(str);\n}\n\n/**\n Returns the lower\\_case\\_and\\_underscored form of a string.\n\n ```js\n import { underscore } from '@ember-data/request-utils/string';\n\n underscore('innerHTML'); // 'inner_html'\n underscore('action_name'); // 'action_name'\n underscore('css-class-name'); // 'css_class_name'\n underscore('my favorite items'); // 'my_favorite_items'\n underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'\n ```\n\n @typedoc\n*/\nexport function underscore(str: string): string {\n return UNDERSCORE_CACHE.get(str);\n}\n\n/**\n Returns the Capitalized form of a string\n\n ```js\n import { capitalize } from '@ember-data/request-utils/string';\n\n capitalize('innerHTML') // 'InnerHTML'\n capitalize('action_name') // 'Action_name'\n capitalize('css-class-name') // 'Css-class-name'\n capitalize('my favorite items') // 'My favorite items'\n capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'\n ```\n\n @typedoc\n*/\nexport function capitalize(str: string): string {\n return CAPITALIZE_CACHE.get(str);\n}\n\nexport function setMaxLRUCacheSize(size: number) {\n CAMELIZE_CACHE.size = size;\n UNDERSCORE_CACHE.size = size;\n CAPITALIZE_CACHE.size = size;\n STRING_DASHERIZE_CACHE.size = size;\n}\n","import { assert } from '@warp-drive/build-config/macros';\n\nimport { defaultRules } from './inflections';\nimport { capitalize, LRUCache } from './transform';\n\nconst BLANK_REGEX = /^\\s*$/;\nconst LAST_WORD_DASHED_REGEX = /([\\w/-]+[_/\\s-])([a-z\\d]+$)/;\nconst LAST_WORD_CAMELIZED_REGEX = /([\\w/\\s-]+)([A-Z][a-z\\d]*$)/;\nconst CAMELIZED_REGEX = /[A-Z][a-z\\d]*$/;\n\nconst SINGULARS = new LRUCache<string, string>((word: string) => {\n return _singularize(word);\n});\nconst PLURALS = new LRUCache<string, string>((word: string) => {\n return _pluralize(word);\n});\nconst UNCOUNTABLE = new Set(defaultRules.uncountable);\nconst IRREGULAR: Map<string, string> = new Map();\nconst INVERSE_IRREGULAR: Map<string, string> = new Map();\nconst SINGULAR_RULES = new Map(defaultRules.singular.reverse());\nconst PLURAL_RULES = new Map(defaultRules.plurals.reverse());\n\nexport function uncountable(word: string) {\n UNCOUNTABLE.add(word.toLowerCase());\n}\n\nexport function loadUncountable(uncountables: string[]) {\n uncountables.forEach((word) => {\n uncountable(word);\n });\n}\n\nexport function irregular(single: string, plur: string) {\n //pluralizing\n IRREGULAR.set(single.toLowerCase(), plur);\n IRREGULAR.set(plur.toLowerCase(), plur);\n\n //singularizing\n INVERSE_IRREGULAR.set(plur.toLowerCase(), single);\n INVERSE_IRREGULAR.set(single.toLowerCase(), single);\n}\n\nexport function loadIrregular(irregularPairs: Array<[string, string]>) {\n irregularPairs.forEach((pair) => {\n //pluralizing\n IRREGULAR.set(pair[0].toLowerCase(), pair[1]);\n IRREGULAR.set(pair[1].toLowerCase(), pair[1]);\n\n //singularizing\n INVERSE_IRREGULAR.set(pair[1].toLowerCase(), pair[0]);\n INVERSE_IRREGULAR.set(pair[0].toLowerCase(), pair[0]);\n });\n}\nloadIrregular(defaultRules.irregularPairs);\n\nexport function clear() {\n SINGULARS.clear();\n PLURALS.clear();\n}\n\nexport function resetToDefaults() {\n clearRules();\n defaultRules.uncountable.forEach((v) => UNCOUNTABLE.add(v));\n defaultRules.singular.forEach((v) => SINGULAR_RULES.set(v[0], v[1]));\n defaultRules.plurals.forEach((v) => PLURAL_RULES.set(v[0], v[1]));\n loadIrregular(defaultRules.irregularPairs);\n}\n\nexport function clearRules() {\n SINGULARS.clear();\n PLURALS.clear();\n UNCOUNTABLE.clear();\n IRREGULAR.clear();\n INVERSE_IRREGULAR.clear();\n SINGULAR_RULES.clear();\n PLURAL_RULES.clear();\n}\n\nexport function singularize(word: string) {\n assert(`singularize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return SINGULARS.get(word);\n}\n\nexport function pluralize(word: string) {\n assert(`pluralize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return PLURALS.get(word);\n}\n\nfunction unshiftMap<K, V>(v: [K, V], map: Map<K, V>) {\n // reorder\n const rules = [v, ...map.entries()];\n map.clear();\n rules.forEach((rule) => {\n map.set(rule[0], rule[1]);\n });\n}\n\nexport function plural(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (PLURAL_RULES.has(regex)) {\n PLURAL_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], PLURAL_RULES);\n}\n\nexport function singular(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (SINGULAR_RULES.has(regex)) {\n SINGULAR_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], SINGULAR_RULES);\n}\n\nfunction _pluralize(word: string) {\n return inflect(word, PLURAL_RULES, IRREGULAR);\n}\n\nfunction _singularize(word: string) {\n return inflect(word, SINGULAR_RULES, INVERSE_IRREGULAR);\n}\n\nfunction inflect(word: string, typeRules: Map<RegExp, string>, irregulars: Map<string, string>) {\n // empty strings\n const isBlank = !word || BLANK_REGEX.test(word);\n if (isBlank) {\n return word;\n }\n\n // basic uncountables\n const lowercase = word.toLowerCase();\n if (UNCOUNTABLE.has(lowercase)) {\n return word;\n }\n\n // adv uncountables\n const wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);\n const lastWord = wordSplit ? wordSplit[2].toLowerCase() : null;\n if (lastWord && UNCOUNTABLE.has(lastWord)) {\n return word;\n }\n\n // handle irregulars\n const isCamelized = CAMELIZED_REGEX.test(word);\n for (let [rule, substitution] of irregulars) {\n if (lowercase.match(rule + '$')) {\n if (isCamelized && lastWord && irregulars.has(lastWord)) {\n substitution = capitalize(substitution);\n rule = capitalize(rule);\n }\n\n return word.replace(new RegExp(rule, 'i'), substitution);\n }\n }\n\n // do the actual inflection\n for (const [rule, substitution] of typeRules) {\n if (rule.test(word)) {\n return word.replace(rule, substitution);\n }\n }\n\n return word;\n}\n"],"names":["defaultRules","plurals","singular","irregularPairs","uncountable","DEFAULT_MAX_CACHE_SIZE","LRUCache","constructor","doWork","size","state","Map","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","_hits","_misses","_ejected","get","key","value","delete","set","newValue","k","clear","STRING_DASHERIZE_REGEXP","STRING_DECAMELIZE_REGEXP","STRING_DASHERIZE_CACHE","replace","toLowerCase","STRING_CAMELIZE_REGEXP_1","STRING_CAMELIZE_REGEXP_2","CAMELIZE_CACHE","_match","_separator","chr","toUpperCase","match","STRING_UNDERSCORE_REGEXP_1","STRING_UNDERSCORE_REGEXP_2","UNDERSCORE_CACHE","str","STRING_CAPITALIZE_REGEXP","CAPITALIZE_CACHE","dasherize","camelize","underscore","capitalize","setMaxLRUCacheSize","BLANK_REGEX","LAST_WORD_DASHED_REGEX","LAST_WORD_CAMELIZED_REGEX","CAMELIZED_REGEX","SINGULARS","word","_singularize","PLURALS","_pluralize","UNCOUNTABLE","Set","IRREGULAR","INVERSE_IRREGULAR","SINGULAR_RULES","reverse","PLURAL_RULES","add","loadUncountable","uncountables","forEach","irregular","single","plur","loadIrregular","pair","resetToDefaults","clearRules","v","singularize","test","Error","length","pluralize","unshiftMap","map","rules","entries","rule","plural","regex","string","has","inflect","typeRules","irregulars","isBlank","lowercase","wordSplit","exec","lastWord","isCamelized","substitution","RegExp"],"mappings":";;AAQO,MAAMA,YAA8B,GAAG;AAC5CC,EAAAA,OAAO,EAAE,CACP,CAAC,GAAG,EAAE,GAAG,CAAC,EACV,CAAC,KAAK,EAAE,GAAG,CAAC,EACZ,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAC1B,CAAC,iBAAiB,EAAE,KAAK,CAAC,EAC1B,CAAC,gBAAgB,EAAE,KAAK,CAAC,EACzB,CAAC,wBAAwB,EAAE,MAAM,CAAC,EAClC,CAAC,SAAS,EAAE,OAAO,CAAC,EACpB,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAC9B,CAAC,YAAY,EAAE,KAAK,CAAC,EACrB,CAAC,WAAW,EAAE,KAAK,CAAC,EACpB,CAAC,OAAO,EAAE,KAAK,CAAC,EAChB,CAAC,wBAAwB,EAAE,SAAS,CAAC,EACrC,CAAC,UAAU,EAAE,KAAK,CAAC,EACnB,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAC9B,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAC1B,CAAC,4BAA4B,EAAE,QAAQ,CAAC,EACxC,CAAC,cAAc,EAAE,OAAO,CAAC,EACzB,CAAC,aAAa,EAAE,OAAO,CAAC,EACxB,CAAC,SAAS,EAAE,MAAM,CAAC,EACnB,CAAC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