@warp-drive-mirror/utilities 5.8.0-alpha.37 → 5.8.0-alpha.40

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.
Files changed (137) hide show
  1. package/dist/unpkg/dev/active-record.js +11 -12
  2. package/dist/unpkg/dev/handlers.js +4 -5
  3. package/dist/unpkg/dev/index.js +50 -49
  4. package/dist/unpkg/{prod-deprecated/inflect-BSG696t-.js → dev/inflect-BEv8WqY1.js} +4 -5
  5. package/dist/unpkg/dev/json-api.js +16 -16
  6. package/dist/unpkg/dev/rest.js +11 -12
  7. package/dist/unpkg/dev/string.js +1 -1
  8. package/dist/unpkg/dev-deprecated/active-record.js +11 -12
  9. package/dist/unpkg/dev-deprecated/handlers.js +4 -5
  10. package/dist/unpkg/dev-deprecated/index.js +50 -49
  11. package/dist/unpkg/dev-deprecated/{inflect-BSG696t-.js → inflect-BEv8WqY1.js} +4 -5
  12. package/dist/unpkg/dev-deprecated/json-api.js +16 -16
  13. package/dist/unpkg/dev-deprecated/rest.js +11 -12
  14. package/dist/unpkg/dev-deprecated/string.js +1 -1
  15. package/dist/unpkg/prod/active-record.js +1 -30
  16. package/dist/unpkg/prod/handlers.js +1 -13
  17. package/dist/unpkg/prod/index.js +2 -124
  18. package/dist/unpkg/{dev/inflect-BSG696t-.js → prod/inflect-Dh9dyEYx.js} +0 -11
  19. package/dist/unpkg/prod/json-api.js +2 -40
  20. package/dist/unpkg/prod/rest.js +1 -30
  21. package/dist/unpkg/prod/string.js +1 -1
  22. package/dist/unpkg/prod-deprecated/active-record.js +1 -30
  23. package/dist/unpkg/prod-deprecated/handlers.js +1 -13
  24. package/dist/unpkg/prod-deprecated/index.js +2 -124
  25. package/dist/unpkg/{prod/inflect-BSG696t-.js → prod-deprecated/inflect-Dh9dyEYx.js} +0 -11
  26. package/dist/unpkg/prod-deprecated/json-api.js +2 -40
  27. package/dist/unpkg/prod-deprecated/rest.js +1 -30
  28. package/dist/unpkg/prod-deprecated/string.js +1 -1
  29. package/package.json +12 -20
  30. package/dist/unpkg/dev/declarations/-private/active-record/find-record.d.ts +0 -64
  31. package/dist/unpkg/dev/declarations/-private/active-record/query.d.ts +0 -53
  32. package/dist/unpkg/dev/declarations/-private/active-record/save-record.d.ts +0 -146
  33. package/dist/unpkg/dev/declarations/-private/builder-utils.d.ts +0 -4
  34. package/dist/unpkg/dev/declarations/-private/handlers/auto-compress.d.ts +0 -158
  35. package/dist/unpkg/dev/declarations/-private/handlers/gated.d.ts +0 -19
  36. package/dist/unpkg/dev/declarations/-private/handlers/meta-doc.d.ts +0 -47
  37. package/dist/unpkg/dev/declarations/-private/handlers/utils.d.ts +0 -41
  38. package/dist/unpkg/dev/declarations/-private/json-api/-utils.d.ts +0 -109
  39. package/dist/unpkg/dev/declarations/-private/json-api/find-record.d.ts +0 -84
  40. package/dist/unpkg/dev/declarations/-private/json-api/query.d.ts +0 -100
  41. package/dist/unpkg/dev/declarations/-private/json-api/save-record.d.ts +0 -228
  42. package/dist/unpkg/dev/declarations/-private/json-api/serialize.d.ts +0 -70
  43. package/dist/unpkg/dev/declarations/-private/rest/find-record.d.ts +0 -62
  44. package/dist/unpkg/dev/declarations/-private/rest/query.d.ts +0 -53
  45. package/dist/unpkg/dev/declarations/-private/rest/save-record.d.ts +0 -146
  46. package/dist/unpkg/dev/declarations/-private/string/inflect.d.ts +0 -82
  47. package/dist/unpkg/dev/declarations/-private/string/inflections.d.ts +0 -9
  48. package/dist/unpkg/dev/declarations/-private/string/transform.d.ts +0 -77
  49. package/dist/unpkg/dev/declarations/-private.d.ts +0 -1
  50. package/dist/unpkg/dev/declarations/active-record.d.ts +0 -3
  51. package/dist/unpkg/dev/declarations/derivations.d.ts +0 -27
  52. package/dist/unpkg/dev/declarations/handlers.d.ts +0 -10
  53. package/dist/unpkg/dev/declarations/index.d.ts +0 -208
  54. package/dist/unpkg/dev/declarations/json-api.d.ts +0 -5
  55. package/dist/unpkg/dev/declarations/rest.d.ts +0 -3
  56. package/dist/unpkg/dev/declarations/string.d.ts +0 -14
  57. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/find-record.d.ts +0 -64
  58. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/query.d.ts +0 -53
  59. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/save-record.d.ts +0 -146
  60. package/dist/unpkg/dev-deprecated/declarations/-private/builder-utils.d.ts +0 -4
  61. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/auto-compress.d.ts +0 -158
  62. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/gated.d.ts +0 -19
  63. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/meta-doc.d.ts +0 -47
  64. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/utils.d.ts +0 -41
  65. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/-utils.d.ts +0 -109
  66. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/find-record.d.ts +0 -84
  67. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/query.d.ts +0 -100
  68. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/save-record.d.ts +0 -228
  69. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/serialize.d.ts +0 -70
  70. package/dist/unpkg/dev-deprecated/declarations/-private/rest/find-record.d.ts +0 -62
  71. package/dist/unpkg/dev-deprecated/declarations/-private/rest/query.d.ts +0 -53
  72. package/dist/unpkg/dev-deprecated/declarations/-private/rest/save-record.d.ts +0 -146
  73. package/dist/unpkg/dev-deprecated/declarations/-private/string/inflect.d.ts +0 -82
  74. package/dist/unpkg/dev-deprecated/declarations/-private/string/inflections.d.ts +0 -9
  75. package/dist/unpkg/dev-deprecated/declarations/-private/string/transform.d.ts +0 -77
  76. package/dist/unpkg/dev-deprecated/declarations/-private.d.ts +0 -1
  77. package/dist/unpkg/dev-deprecated/declarations/active-record.d.ts +0 -3
  78. package/dist/unpkg/dev-deprecated/declarations/derivations.d.ts +0 -27
  79. package/dist/unpkg/dev-deprecated/declarations/handlers.d.ts +0 -10
  80. package/dist/unpkg/dev-deprecated/declarations/index.d.ts +0 -208
  81. package/dist/unpkg/dev-deprecated/declarations/json-api.d.ts +0 -5
  82. package/dist/unpkg/dev-deprecated/declarations/rest.d.ts +0 -3
  83. package/dist/unpkg/dev-deprecated/declarations/string.d.ts +0 -14
  84. package/dist/unpkg/prod/declarations/-private/active-record/find-record.d.ts +0 -64
  85. package/dist/unpkg/prod/declarations/-private/active-record/query.d.ts +0 -53
  86. package/dist/unpkg/prod/declarations/-private/active-record/save-record.d.ts +0 -146
  87. package/dist/unpkg/prod/declarations/-private/builder-utils.d.ts +0 -4
  88. package/dist/unpkg/prod/declarations/-private/handlers/auto-compress.d.ts +0 -158
  89. package/dist/unpkg/prod/declarations/-private/handlers/gated.d.ts +0 -19
  90. package/dist/unpkg/prod/declarations/-private/handlers/meta-doc.d.ts +0 -47
  91. package/dist/unpkg/prod/declarations/-private/handlers/utils.d.ts +0 -41
  92. package/dist/unpkg/prod/declarations/-private/json-api/-utils.d.ts +0 -109
  93. package/dist/unpkg/prod/declarations/-private/json-api/find-record.d.ts +0 -84
  94. package/dist/unpkg/prod/declarations/-private/json-api/query.d.ts +0 -100
  95. package/dist/unpkg/prod/declarations/-private/json-api/save-record.d.ts +0 -228
  96. package/dist/unpkg/prod/declarations/-private/json-api/serialize.d.ts +0 -70
  97. package/dist/unpkg/prod/declarations/-private/rest/find-record.d.ts +0 -62
  98. package/dist/unpkg/prod/declarations/-private/rest/query.d.ts +0 -53
  99. package/dist/unpkg/prod/declarations/-private/rest/save-record.d.ts +0 -146
  100. package/dist/unpkg/prod/declarations/-private/string/inflect.d.ts +0 -82
  101. package/dist/unpkg/prod/declarations/-private/string/inflections.d.ts +0 -9
  102. package/dist/unpkg/prod/declarations/-private/string/transform.d.ts +0 -77
  103. package/dist/unpkg/prod/declarations/-private.d.ts +0 -1
  104. package/dist/unpkg/prod/declarations/active-record.d.ts +0 -3
  105. package/dist/unpkg/prod/declarations/derivations.d.ts +0 -27
  106. package/dist/unpkg/prod/declarations/handlers.d.ts +0 -10
  107. package/dist/unpkg/prod/declarations/index.d.ts +0 -208
  108. package/dist/unpkg/prod/declarations/json-api.d.ts +0 -5
  109. package/dist/unpkg/prod/declarations/rest.d.ts +0 -3
  110. package/dist/unpkg/prod/declarations/string.d.ts +0 -14
  111. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/find-record.d.ts +0 -64
  112. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/query.d.ts +0 -53
  113. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/save-record.d.ts +0 -146
  114. package/dist/unpkg/prod-deprecated/declarations/-private/builder-utils.d.ts +0 -4
  115. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/auto-compress.d.ts +0 -158
  116. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/gated.d.ts +0 -19
  117. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/meta-doc.d.ts +0 -47
  118. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/utils.d.ts +0 -41
  119. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/-utils.d.ts +0 -109
  120. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/find-record.d.ts +0 -84
  121. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/query.d.ts +0 -100
  122. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/save-record.d.ts +0 -228
  123. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/serialize.d.ts +0 -70
  124. package/dist/unpkg/prod-deprecated/declarations/-private/rest/find-record.d.ts +0 -62
  125. package/dist/unpkg/prod-deprecated/declarations/-private/rest/query.d.ts +0 -53
  126. package/dist/unpkg/prod-deprecated/declarations/-private/rest/save-record.d.ts +0 -146
  127. package/dist/unpkg/prod-deprecated/declarations/-private/string/inflect.d.ts +0 -82
  128. package/dist/unpkg/prod-deprecated/declarations/-private/string/inflections.d.ts +0 -9
  129. package/dist/unpkg/prod-deprecated/declarations/-private/string/transform.d.ts +0 -77
  130. package/dist/unpkg/prod-deprecated/declarations/-private.d.ts +0 -1
  131. package/dist/unpkg/prod-deprecated/declarations/active-record.d.ts +0 -3
  132. package/dist/unpkg/prod-deprecated/declarations/derivations.d.ts +0 -27
  133. package/dist/unpkg/prod-deprecated/declarations/handlers.d.ts +0 -10
  134. package/dist/unpkg/prod-deprecated/declarations/index.d.ts +0 -208
  135. package/dist/unpkg/prod-deprecated/declarations/json-api.d.ts +0 -5
  136. package/dist/unpkg/prod-deprecated/declarations/rest.d.ts +0 -3
  137. package/dist/unpkg/prod-deprecated/declarations/string.d.ts +0 -14
@@ -1,146 +0,0 @@
1
- import type { ReactiveDataDocument } from "@warp-drive-mirror/core/reactive";
2
- import type { TypedRecordInstance } from "@warp-drive-mirror/core/types/record";
3
- import type { ConstrainedRequestOptions, CreateRequestOptions, DeleteRequestOptions, UpdateRequestOptions } from "@warp-drive-mirror/core/types/request";
4
- /**
5
- * Builds request options to delete record for resources,
6
- * configured for the url, method and header expectations of REST APIs.
7
- *
8
- * **Basic Usage**
9
- *
10
- * ```ts
11
- * import { deleteRecord } from '@warp-drive-mirror/utilities/rest';
12
- *
13
- * const person = store.peekRecord('person', '1');
14
- *
15
- * // mark record as deleted
16
- * store.deleteRecord(person);
17
- *
18
- * // persist deletion
19
- * const data = await store.request(deleteRecord(person));
20
- * ```
21
- *
22
- * **Supplying Options to Modify the Request Behavior**
23
- *
24
- * The following options are supported:
25
- *
26
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
27
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
28
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
29
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
30
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
31
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
32
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
33
- * defaulting to `false` if none is configured.
34
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
35
- *
36
- * ```ts
37
- * import { deleteRecord } from '@warp-drive-mirror/utilities/rest';
38
- *
39
- * const person = store.peekRecord('person', '1');
40
- *
41
- * // mark record as deleted
42
- * store.deleteRecord(person);
43
- *
44
- * // persist deletion
45
- * const options = deleteRecord(person, { namespace: 'api/v1' });
46
- * const data = await store.request(options);
47
- * ```
48
- *
49
- * @public
50
- * @param record
51
- * @param options
52
- */
53
- export declare function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;
54
- export declare function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;
55
- /**
56
- * Builds request options to create new record for resources,
57
- * configured for the url, method and header expectations of most REST APIs.
58
- *
59
- * **Basic Usage**
60
- *
61
- * ```ts
62
- * import { createRecord } from '@warp-drive-mirror/utilities/rest';
63
- *
64
- * const person = store.createRecord('person', { name: 'Ted' });
65
- * const data = await store.request(createRecord(person));
66
- * ```
67
- *
68
- * **Supplying Options to Modify the Request Behavior**
69
- *
70
- * The following options are supported:
71
- *
72
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
73
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
74
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
75
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
76
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
77
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
78
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
79
- * defaulting to `false` if none is configured.
80
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
81
- *
82
- * ```ts
83
- * import { createRecord } from '@warp-drive-mirror/utilities/rest';
84
- *
85
- * const person = store.createRecord('person', { name: 'Ted' });
86
- * const options = createRecord(person, { namespace: 'api/v1' });
87
- * const data = await store.request(options);
88
- * ```
89
- *
90
- * @public
91
- * @param record
92
- * @param options
93
- */
94
- export declare function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;
95
- export declare function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;
96
- /**
97
- * Builds request options to update existing record for resources,
98
- * configured for the url, method and header expectations of most REST APIs.
99
- *
100
- * **Basic Usage**
101
- *
102
- * ```ts
103
- * import { updateRecord } from '@warp-drive-mirror/utilities/rest';
104
- *
105
- * const person = store.peekRecord('person', '1');
106
- * person.name = 'Chris';
107
- * const data = await store.request(updateRecord(person));
108
- * ```
109
- *
110
- * **Supplying Options to Modify the Request Behavior**
111
- *
112
- * The following options are supported:
113
- *
114
- * - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.
115
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
116
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
117
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
118
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
119
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
120
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
121
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
122
- * defaulting to `false` if none is configured.
123
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
124
- *
125
- * ```ts
126
- * import { updateRecord } from '@warp-drive-mirror/utilities/rest';
127
- *
128
- * const person = store.peekRecord('person', '1');
129
- * person.name = 'Chris';
130
- * const options = updateRecord(person, { patch: true });
131
- * const data = await store.request(options);
132
- * ```
133
- *
134
- * @public
135
- * @param record
136
- * @param options
137
- */
138
- export declare function updateRecord<
139
- T extends TypedRecordInstance,
140
- RT extends TypedRecordInstance = T
141
- >(record: T, options?: ConstrainedRequestOptions & {
142
- patch?: boolean;
143
- }): UpdateRequestOptions<ReactiveDataDocument<RT>, T>;
144
- export declare function updateRecord(record: unknown, options?: ConstrainedRequestOptions & {
145
- patch?: boolean;
146
- }): UpdateRequestOptions;
@@ -1,82 +0,0 @@
1
- /**
2
- * Marks a word as uncountable. Uncountable words are not pluralized
3
- * or singularized.
4
- *
5
- * @public
6
- * @since 4.13.0
7
- */
8
- export declare function uncountable(word: string): void;
9
- /**
10
- * Marks a list of words as uncountable. Uncountable words are not pluralized
11
- * or singularized.
12
- *
13
- * @public
14
- * @since 4.13.0
15
- */
16
- export declare function loadUncountable(uncountables: string[]): void;
17
- /**
18
- * Marks a word as irregular. Irregular words have unique
19
- * pluralization and singularization rules.
20
- *
21
- * @public
22
- * @since 4.13.0
23
- */
24
- export declare function irregular(single: string, plur: string): void;
25
- /**
26
- * Marks a list of word pairs as irregular. Irregular words have unique
27
- * pluralization and singularization rules.
28
- *
29
- * @public
30
- * @since 4.13.0
31
- */
32
- export declare function loadIrregular(irregularPairs: Array<[string, string]>): void;
33
- /**
34
- * Clears the caches for singularize and pluralize.
35
- *
36
- * @public
37
- * @since 4.13.0
38
- */
39
- export declare function clear(): void;
40
- /**
41
- * Resets the inflection rules to the defaults.
42
- *
43
- * @public
44
- * @since 4.13.0
45
- */
46
- export declare function resetToDefaults(): void;
47
- /**
48
- * Clears all inflection rules
49
- * and resets the caches for singularize and pluralize.
50
- *
51
- * @public
52
- * @since 4.13.0
53
- */
54
- export declare function clearRules(): void;
55
- /**
56
- * Singularizes a word.
57
- *
58
- * @public
59
- * @since 4.13.0
60
- */
61
- export declare function singularize(word: string): string;
62
- /**
63
- * Pluralizes a word.
64
- *
65
- * @public
66
- * @since 4.13.0
67
- */
68
- export declare function pluralize(word: string): string;
69
- /**
70
- * Adds a pluralization rule.
71
- *
72
- * @public
73
- * @since 4.13.0
74
- */
75
- export declare function plural(regex: RegExp, string: string): void;
76
- /**
77
- * Adds a singularization rule.
78
- *
79
- * @public
80
- * @since 4.13.0
81
- */
82
- export declare function singular(regex: RegExp, string: string): void;
@@ -1,9 +0,0 @@
1
- export type RulesArray = Array<[RegExp, string]>;
2
- type DefaultRulesType = {
3
- plurals: RulesArray;
4
- singular: RulesArray;
5
- irregularPairs: Array<[string, string]>;
6
- uncountable: string[];
7
- };
8
- export declare const defaultRules: DefaultRulesType;
9
- export {};
@@ -1,77 +0,0 @@
1
- /**
2
- * Replaces underscores, spaces, or camelCase with dashes.
3
- *
4
- * ```js
5
- * import { dasherize } from '@warp-drive-mirror/utilities/string';
6
- *
7
- * dasherize('innerHTML'); // 'inner-html'
8
- * dasherize('action_name'); // 'action-name'
9
- * dasherize('css-class-name'); // 'css-class-name'
10
- * dasherize('my favorite items'); // 'my-favorite-items'
11
- * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
12
- * ```
13
- *
14
- * @public
15
- * @since 4.13.0
16
- */
17
- export declare const dasherize: (str: string) => string;
18
- /**
19
- * Returns the lowerCamelCase form of a string.
20
- *
21
- * ```js
22
- * import { camelize } from '@warp-drive-mirror/utilities/string';
23
- *
24
- * camelize('innerHTML'); // 'innerHTML'
25
- * camelize('action_name'); // 'actionName'
26
- * camelize('css-class-name'); // 'cssClassName'
27
- * camelize('my favorite items'); // 'myFavoriteItems'
28
- * camelize('My Favorite Items'); // 'myFavoriteItems'
29
- * camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'
30
- * ```
31
- *
32
- * @public
33
- * @since 4.13.0
34
- */
35
- export declare function camelize(str: string): string;
36
- /**
37
- * Returns the lower\_case\_and\_underscored form of a string.
38
- *
39
- * ```js
40
- * import { underscore } from '@warp-drive-mirror/utilities/string';
41
- *
42
- * underscore('innerHTML'); // 'inner_html'
43
- * underscore('action_name'); // 'action_name'
44
- * underscore('css-class-name'); // 'css_class_name'
45
- * underscore('my favorite items'); // 'my_favorite_items'
46
- * underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'
47
- * ```
48
- *
49
- * @public
50
- * @since 4.13.0
51
- */
52
- export declare function underscore(str: string): string;
53
- /**
54
- * Returns the Capitalized form of a string
55
- *
56
- * ```js
57
- * import { capitalize } from '@warp-drive-mirror/utilities/string';
58
- *
59
- * capitalize('innerHTML') // 'InnerHTML'
60
- * capitalize('action_name') // 'Action_name'
61
- * capitalize('css-class-name') // 'Css-class-name'
62
- * capitalize('my favorite items') // 'My favorite items'
63
- * capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'
64
- * ```
65
- *
66
- * @public
67
- * @since 4.13.0
68
- */
69
- export declare function capitalize(str: string): string;
70
- /**
71
- * Sets the maximum size of the LRUCache for all string transformation functions.
72
- * The default size is 10,000.
73
- *
74
- * @public
75
- * @since 4.13.0
76
- */
77
- export declare function setMaxLRUCacheSize(size: number): void;
@@ -1 +0,0 @@
1
- export { defaultRules as InflectionRuleDefaults } from "./-private/string/inflections.js";
@@ -1,3 +0,0 @@
1
- export { findRecord } from "./-private/active-record/find-record.js";
2
- export { query } from "./-private/active-record/query.js";
3
- export { deleteRecord, createRecord, updateRecord } from "./-private/active-record/save-record.js";
@@ -1,27 +0,0 @@
1
- import type { ReactiveResource } from "@warp-drive-mirror/core/reactive";
2
- import { Type } from "@warp-drive-mirror/core/types/symbols";
3
- interface ConcatDerivation {
4
- (record: ReactiveResource & {
5
- [key: string]: unknown;
6
- }, options: Record<string, unknown> | null, _prop: string): string;
7
- [Type]: "concat";
8
- }
9
- /**
10
- * A derivation for use by {@link ReactiveResource} that joins the given fields
11
- * with the optional separator (or '' if no separator is provided).
12
- *
13
- * Generally you should not need to import and use this function directly.
14
- *
15
- * @example
16
- * {
17
- * name: 'fullName',
18
- * kind: 'derived',
19
- * type: 'concat',
20
- * options: {
21
- * fields: ['firstName', 'lastName'],
22
- * separator: ' ',
23
- * },
24
- * }
25
- */
26
- export declare const concat: ConcatDerivation;
27
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * A selection of pre-built request handlers for handling common
3
- * request scenarios.
4
- *
5
- * @module
6
- */
7
- export { AutoCompress, SupportsRequestStreams } from "./-private/handlers/auto-compress.js";
8
- export { Gate } from "./-private/handlers/gated.js";
9
- export { MetaDocHandler } from "./-private/handlers/meta-doc.js";
10
- export { addTraceHeader, TAB_ASSIGNED, TAB_ID, assertInvalidUrlLength, MAX_URL_LENGTH } from "./-private/handlers/utils.js";
@@ -1,208 +0,0 @@
1
- import type { QueryParamsSerializationOptions, QueryParamsSource, Serializable } from "@warp-drive-mirror/core/types/params";
2
- export interface BuildURLConfig {
3
- host: string | null;
4
- namespace: string | null;
5
- }
6
- /**
7
- * Sets the global configuration for `buildBaseURL`
8
- * for host and namespace values for the application.
9
- *
10
- * These values may still be overridden by passing
11
- * them to buildBaseURL directly.
12
- *
13
- * This method may be called as many times as needed.
14
- * host values of `''` or `'/'` are equivalent.
15
- *
16
- * Except for the value of `/` as host, host should not
17
- * end with `/`.
18
- *
19
- * namespace should not start or end with a `/`.
20
- *
21
- * ```ts
22
- * type BuildURLConfig = {
23
- * host: string;
24
- * namespace: string'
25
- * }
26
- * ```
27
- *
28
- * Example:
29
- *
30
- * ```ts
31
- * import { setBuildURLConfig } from '@ember-data-mirror/request-utils';
32
- *
33
- * setBuildURLConfig({
34
- * host: 'https://api.example.com',
35
- * namespace: 'api/v1'
36
- * });
37
- * ```
38
- *
39
- * @public
40
- */
41
- export declare function setBuildURLConfig(config: BuildURLConfig): void;
42
- export interface FindRecordUrlOptions {
43
- op: "findRecord";
44
- identifier: {
45
- type: string;
46
- id: string;
47
- };
48
- resourcePath?: string;
49
- host?: string;
50
- namespace?: string;
51
- }
52
- export interface QueryUrlOptions {
53
- op: "query";
54
- identifier: {
55
- type: string;
56
- };
57
- resourcePath?: string;
58
- host?: string;
59
- namespace?: string;
60
- }
61
- export interface FindManyUrlOptions {
62
- op: "findMany";
63
- identifiers: {
64
- type: string;
65
- id: string;
66
- }[];
67
- resourcePath?: string;
68
- host?: string;
69
- namespace?: string;
70
- }
71
- export interface FindRelatedCollectionUrlOptions {
72
- op: "findRelatedCollection";
73
- identifier: {
74
- type: string;
75
- id: string;
76
- };
77
- fieldPath: string;
78
- resourcePath?: string;
79
- host?: string;
80
- namespace?: string;
81
- }
82
- export interface FindRelatedResourceUrlOptions {
83
- op: "findRelatedRecord";
84
- identifier: {
85
- type: string;
86
- id: string;
87
- };
88
- fieldPath: string;
89
- resourcePath?: string;
90
- host?: string;
91
- namespace?: string;
92
- }
93
- export interface CreateRecordUrlOptions {
94
- op: "createRecord";
95
- identifier: {
96
- type: string;
97
- };
98
- resourcePath?: string;
99
- host?: string;
100
- namespace?: string;
101
- }
102
- export interface UpdateRecordUrlOptions {
103
- op: "updateRecord";
104
- identifier: {
105
- type: string;
106
- id: string;
107
- };
108
- resourcePath?: string;
109
- host?: string;
110
- namespace?: string;
111
- }
112
- export interface DeleteRecordUrlOptions {
113
- op: "deleteRecord";
114
- identifier: {
115
- type: string;
116
- id: string;
117
- };
118
- resourcePath?: string;
119
- host?: string;
120
- namespace?: string;
121
- }
122
- export interface GenericUrlOptions {
123
- resourcePath: string;
124
- host?: string;
125
- namespace?: string;
126
- }
127
- export type UrlOptions = FindRecordUrlOptions | QueryUrlOptions | FindManyUrlOptions | FindRelatedCollectionUrlOptions | FindRelatedResourceUrlOptions | CreateRecordUrlOptions | UpdateRecordUrlOptions | DeleteRecordUrlOptions | GenericUrlOptions;
128
- /**
129
- * Builds a URL for a request based on the provided options.
130
- * Does not include support for building query params (see `buildQueryParams`)
131
- * so that it may be composed cleanly with other query-params strategies.
132
- *
133
- * Usage:
134
- *
135
- * ```ts
136
- * import { buildBaseURL } from '@ember-data-mirror/request-utils';
137
- *
138
- * const url = buildBaseURL({
139
- * host: 'https://api.example.com',
140
- * namespace: 'api/v1',
141
- * resourcePath: 'emberDevelopers',
142
- * op: 'query',
143
- * identifier: { type: 'ember-developer' }
144
- * });
145
- *
146
- * // => 'https://api.example.com/api/v1/emberDevelopers'
147
- * ```
148
- *
149
- * On the surface this may seem like a lot of work to do something simple, but
150
- * it is designed to be composable with other utilities and interfaces that the
151
- * average product engineer will never need to see or use.
152
- *
153
- * A few notes:
154
- *
155
- * - `resourcePath` is optional, but if it is not provided, `identifier.type` will be used.
156
- * - `host` and `namespace` are optional, but if they are not provided, the values globally
157
- * configured via `setBuildURLConfig` will be used.
158
- * - `op` is required and must be one of the following:
159
- * - 'findRecord' 'query' 'findMany' 'findRelatedCollection' 'findRelatedRecord'` 'createRecord' 'updateRecord' 'deleteRecord'
160
- * - Depending on the value of `op`, `identifier` or `identifiers` will be required.
161
- *
162
- * @public
163
- */
164
- export declare function buildBaseURL(urlOptions: UrlOptions): string;
165
- /**
166
- * filter out keys of an object that have falsy values or point to empty arrays
167
- * returning a new object with only those keys that have truthy values / non-empty arrays
168
- *
169
- * @public
170
- * @param source object to filter keys with empty values from
171
- * @return A new object with the keys that contained empty values removed
172
- */
173
- export declare function filterEmpty(source: Record<string, Serializable>): Record<string, Serializable>;
174
- /**
175
- * Sorts query params by both key and value returning a new URLSearchParams
176
- * object with the keys inserted in sorted order.
177
- *
178
- * Treats `included` specially, splicing it into an array if it is a string and sorting the array.
179
- *
180
- * Options:
181
- * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'
182
- *
183
- * 'bracket': appends [] to the key for every value e.g. `&ids[]=1&ids[]=2`
184
- * 'indices': appends [i] to the key for every value e.g. `&ids[0]=1&ids[1]=2`
185
- * 'repeat': appends the key for every value e.g. `&ids=1&ids=2`
186
- * 'comma' (default): appends the key once with a comma separated list of values e.g. `&ids=1,2`
187
- *
188
- * @public
189
- * @return A {@link URLSearchParams} with keys inserted in sorted order
190
- */
191
- export declare function sortQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): URLSearchParams;
192
- /**
193
- * Sorts query params by both key and value, returning a query params string
194
- *
195
- * Treats `included` specially, splicing it into an array if it is a string and sorting the array.
196
- *
197
- * Options:
198
- * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'
199
- *
200
- * 'bracket': appends [] to the key for every value e.g. `ids[]=1&ids[]=2`
201
- * 'indices': appends [i] to the key for every value e.g. `ids[0]=1&ids[1]=2`
202
- * 'repeat': appends the key for every value e.g. `ids=1&ids=2`
203
- * 'comma' (default): appends the key once with a comma separated list of values e.g. `ids=1,2`
204
- *
205
- * @public
206
- * @return A sorted query params string without the leading `?`
207
- */
208
- export declare function buildQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): string;
@@ -1,5 +0,0 @@
1
- export { findRecord } from "./-private/json-api/find-record.js";
2
- export { query, postQuery } from "./-private/json-api/query.js";
3
- export { deleteRecord, createRecord, updateRecord } from "./-private/json-api/save-record.js";
4
- export { serializeResources, serializePatch } from "./-private/json-api/serialize.js";
5
- export { setBuildURLConfig } from "./-private/json-api/-utils.js";
@@ -1,3 +0,0 @@
1
- export { findRecord } from "./-private/rest/find-record.js";
2
- export { query } from "./-private/rest/query.js";
3
- export { deleteRecord, createRecord, updateRecord } from "./-private/rest/save-record.js";
@@ -1,14 +0,0 @@
1
- /**
2
- * String utilities for transforming and inflecting strings useful for
3
- * when the format provided by the server is not the format you want to use
4
- * in your application.
5
- *
6
- * Each transformation function stores its results in an LRUCache to avoid
7
- * recomputing the same value multiple times. The cache size can be set
8
- * using the `setMaxLRUCacheSize` function. The default size is 10,000.
9
- *
10
- * @module
11
- * @public
12
- */
13
- export { pluralize, singularize, singular, plural, loadIrregular, loadUncountable, irregular, uncountable, resetToDefaults, clear, clearRules } from "./-private/string/inflect.js";
14
- export { dasherize, camelize, capitalize, underscore, setMaxLRUCacheSize } from "./-private/string/transform.js";
@@ -1,64 +0,0 @@
1
- import type { ReactiveDataDocument } from "@warp-drive-mirror/core/reactive";
2
- import type { TypeFromInstance } from "@warp-drive-mirror/core/types/record";
3
- import type { FindRecordOptions, FindRecordRequestOptions, RemotelyAccessibleIdentifier } from "@warp-drive-mirror/core/types/request";
4
- /**
5
- * Builds request options to fetch a single resource by a known id or identifier
6
- * configured for the url and header expectations of most ActiveRecord APIs.
7
- *
8
- * **Basic Usage**
9
- *
10
- * ```ts
11
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
12
- *
13
- * const data = await store.request(findRecord('person', '1'));
14
- * ```
15
- *
16
- * **With Options**
17
- *
18
- * ```ts
19
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
20
- *
21
- * const options = findRecord('person', '1', { include: ['pets', 'friends'] });
22
- * const data = await store.request(options);
23
- * ```
24
- *
25
- * **With an Identifier**
26
- *
27
- * ```ts
28
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
29
- *
30
- * const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });
31
- * const data = await store.request(options);
32
- * ```
33
- *
34
- * **Supplying Options to Modify the Request Behavior**
35
- *
36
- * The following options are supported:
37
- *
38
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
39
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
40
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and underscoring the supplied type
41
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
42
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
43
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
44
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
45
- * defaulting to `false` if none is configured.
46
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
47
- *
48
- * ```ts
49
- * import { findRecord } from '@warp-drive-mirror/utilities/active-record';
50
- *
51
- * const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });
52
- * const data = await store.request(options);
53
- * ```
54
- *
55
- * @public
56
- * @param identifier
57
- * @param options
58
- */
59
- export declare function findRecord<T>(identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions): FindRecordRequestOptions<ReactiveDataDocument<T>, T>;
60
- export declare function findRecord(identifier: RemotelyAccessibleIdentifier, options?: FindRecordOptions): FindRecordRequestOptions;
61
- export declare function findRecord<T>(type: TypeFromInstance<T>, id: string, options?: FindRecordOptions): FindRecordRequestOptions<ReactiveDataDocument<T>, T>;
62
- export declare function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;
63
- /** @deprecated use {@link ReactiveDataDocument} instead */
64
- export type FindRecordResultDocument<T> = ReactiveDataDocument<T>;