@warp-drive-mirror/utilities 5.8.0-alpha.3 → 5.8.0-alpha.32

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 (182) hide show
  1. package/README.md +14 -26
  2. package/declarations/-private/active-record/find-record.d.ts +5 -6
  3. package/declarations/-private/active-record/query.d.ts +2 -2
  4. package/declarations/-private/active-record/save-record.d.ts +2 -2
  5. package/declarations/-private/handlers/meta-doc.d.ts +1 -1
  6. package/declarations/-private/json-api/find-record.d.ts +37 -18
  7. package/declarations/-private/json-api/query.d.ts +3 -6
  8. package/declarations/-private/json-api/save-record.d.ts +45 -10
  9. package/declarations/-private/json-api/serialize.d.ts +15 -1
  10. package/declarations/-private/rest/find-record.d.ts +5 -8
  11. package/declarations/-private/rest/query.d.ts +2 -2
  12. package/declarations/-private/rest/save-record.d.ts +2 -2
  13. package/dist/active-record.js +2 -0
  14. package/dist/handlers.js +3 -3
  15. package/dist/json-api.js +94 -26
  16. package/dist/rest.js +2 -2
  17. package/dist/string.js +428 -1
  18. package/dist/unpkg/dev/-private.js +7 -0
  19. package/dist/unpkg/dev/active-record.js +395 -0
  20. package/dist/unpkg/dev/builder-utils-Donkk-BZ.js +22 -0
  21. package/dist/unpkg/dev/declarations/-private/active-record/find-record.d.ts +64 -0
  22. package/dist/unpkg/dev/declarations/-private/active-record/query.d.ts +53 -0
  23. package/dist/unpkg/dev/declarations/-private/active-record/save-record.d.ts +146 -0
  24. package/dist/unpkg/dev/declarations/-private/builder-utils.d.ts +4 -0
  25. package/dist/unpkg/dev/declarations/-private/handlers/auto-compress.d.ts +158 -0
  26. package/dist/unpkg/dev/declarations/-private/handlers/gated.d.ts +19 -0
  27. package/dist/unpkg/dev/declarations/-private/handlers/meta-doc.d.ts +47 -0
  28. package/dist/unpkg/dev/declarations/-private/handlers/utils.d.ts +41 -0
  29. package/dist/unpkg/dev/declarations/-private/json-api/-utils.d.ts +109 -0
  30. package/dist/unpkg/dev/declarations/-private/json-api/find-record.d.ts +84 -0
  31. package/dist/unpkg/dev/declarations/-private/json-api/query.d.ts +100 -0
  32. package/dist/unpkg/dev/declarations/-private/json-api/save-record.d.ts +228 -0
  33. package/dist/unpkg/dev/declarations/-private/json-api/serialize.d.ts +70 -0
  34. package/dist/unpkg/dev/declarations/-private/rest/find-record.d.ts +62 -0
  35. package/dist/unpkg/dev/declarations/-private/rest/query.d.ts +53 -0
  36. package/dist/unpkg/dev/declarations/-private/rest/save-record.d.ts +146 -0
  37. package/dist/unpkg/dev/declarations/-private/string/inflect.d.ts +82 -0
  38. package/dist/unpkg/dev/declarations/-private/string/inflections.d.ts +9 -0
  39. package/dist/unpkg/dev/declarations/-private/string/transform.d.ts +77 -0
  40. package/dist/unpkg/dev/declarations/-private.d.ts +1 -0
  41. package/dist/unpkg/dev/declarations/active-record.d.ts +3 -0
  42. package/dist/unpkg/dev/declarations/derivations.d.ts +27 -0
  43. package/dist/unpkg/dev/declarations/handlers.d.ts +10 -0
  44. package/dist/unpkg/dev/declarations/index.d.ts +208 -0
  45. package/dist/unpkg/dev/declarations/json-api.d.ts +5 -0
  46. package/dist/unpkg/dev/declarations/rest.d.ts +3 -0
  47. package/dist/unpkg/dev/declarations/string.d.ts +14 -0
  48. package/dist/unpkg/dev/derivations.js +30 -0
  49. package/dist/unpkg/dev/handlers.js +317 -0
  50. package/dist/unpkg/dev/index.js +361 -0
  51. package/dist/unpkg/dev/inflect-BSG696t-.js +344 -0
  52. package/dist/unpkg/dev/json-api.js +740 -0
  53. package/dist/unpkg/dev/rest.js +393 -0
  54. package/dist/unpkg/dev/string.js +1 -0
  55. package/dist/unpkg/dev-deprecated/-private.js +7 -0
  56. package/dist/unpkg/dev-deprecated/active-record.js +395 -0
  57. package/dist/unpkg/dev-deprecated/builder-utils-Donkk-BZ.js +22 -0
  58. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/find-record.d.ts +64 -0
  59. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/query.d.ts +53 -0
  60. package/dist/unpkg/dev-deprecated/declarations/-private/active-record/save-record.d.ts +146 -0
  61. package/dist/unpkg/dev-deprecated/declarations/-private/builder-utils.d.ts +4 -0
  62. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/auto-compress.d.ts +158 -0
  63. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/gated.d.ts +19 -0
  64. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/meta-doc.d.ts +47 -0
  65. package/dist/unpkg/dev-deprecated/declarations/-private/handlers/utils.d.ts +41 -0
  66. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/-utils.d.ts +109 -0
  67. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/find-record.d.ts +84 -0
  68. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/query.d.ts +100 -0
  69. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/save-record.d.ts +228 -0
  70. package/dist/unpkg/dev-deprecated/declarations/-private/json-api/serialize.d.ts +70 -0
  71. package/dist/unpkg/dev-deprecated/declarations/-private/rest/find-record.d.ts +62 -0
  72. package/dist/unpkg/dev-deprecated/declarations/-private/rest/query.d.ts +53 -0
  73. package/dist/unpkg/dev-deprecated/declarations/-private/rest/save-record.d.ts +146 -0
  74. package/dist/unpkg/dev-deprecated/declarations/-private/string/inflect.d.ts +82 -0
  75. package/dist/unpkg/dev-deprecated/declarations/-private/string/inflections.d.ts +9 -0
  76. package/dist/unpkg/dev-deprecated/declarations/-private/string/transform.d.ts +77 -0
  77. package/dist/unpkg/dev-deprecated/declarations/-private.d.ts +1 -0
  78. package/dist/unpkg/dev-deprecated/declarations/active-record.d.ts +3 -0
  79. package/dist/unpkg/dev-deprecated/declarations/derivations.d.ts +27 -0
  80. package/dist/unpkg/dev-deprecated/declarations/handlers.d.ts +10 -0
  81. package/dist/unpkg/dev-deprecated/declarations/index.d.ts +208 -0
  82. package/dist/unpkg/dev-deprecated/declarations/json-api.d.ts +5 -0
  83. package/dist/unpkg/dev-deprecated/declarations/rest.d.ts +3 -0
  84. package/dist/unpkg/dev-deprecated/declarations/string.d.ts +14 -0
  85. package/dist/unpkg/dev-deprecated/derivations.js +30 -0
  86. package/dist/unpkg/dev-deprecated/handlers.js +317 -0
  87. package/dist/unpkg/dev-deprecated/index.js +361 -0
  88. package/dist/unpkg/dev-deprecated/inflect-BSG696t-.js +344 -0
  89. package/dist/unpkg/dev-deprecated/json-api.js +740 -0
  90. package/dist/unpkg/dev-deprecated/rest.js +393 -0
  91. package/dist/unpkg/dev-deprecated/string.js +1 -0
  92. package/dist/unpkg/prod/-private.js +7 -0
  93. package/dist/unpkg/prod/active-record.js +395 -0
  94. package/dist/unpkg/prod/builder-utils-Donkk-BZ.js +22 -0
  95. package/dist/unpkg/prod/declarations/-private/active-record/find-record.d.ts +64 -0
  96. package/dist/unpkg/prod/declarations/-private/active-record/query.d.ts +53 -0
  97. package/dist/unpkg/prod/declarations/-private/active-record/save-record.d.ts +146 -0
  98. package/dist/unpkg/prod/declarations/-private/builder-utils.d.ts +4 -0
  99. package/dist/unpkg/prod/declarations/-private/handlers/auto-compress.d.ts +158 -0
  100. package/dist/unpkg/prod/declarations/-private/handlers/gated.d.ts +19 -0
  101. package/dist/unpkg/prod/declarations/-private/handlers/meta-doc.d.ts +47 -0
  102. package/dist/unpkg/prod/declarations/-private/handlers/utils.d.ts +41 -0
  103. package/dist/unpkg/prod/declarations/-private/json-api/-utils.d.ts +109 -0
  104. package/dist/unpkg/prod/declarations/-private/json-api/find-record.d.ts +84 -0
  105. package/dist/unpkg/prod/declarations/-private/json-api/query.d.ts +100 -0
  106. package/dist/unpkg/prod/declarations/-private/json-api/save-record.d.ts +228 -0
  107. package/dist/unpkg/prod/declarations/-private/json-api/serialize.d.ts +70 -0
  108. package/dist/unpkg/prod/declarations/-private/rest/find-record.d.ts +62 -0
  109. package/dist/unpkg/prod/declarations/-private/rest/query.d.ts +53 -0
  110. package/dist/unpkg/prod/declarations/-private/rest/save-record.d.ts +146 -0
  111. package/dist/unpkg/prod/declarations/-private/string/inflect.d.ts +82 -0
  112. package/dist/unpkg/prod/declarations/-private/string/inflections.d.ts +9 -0
  113. package/dist/unpkg/prod/declarations/-private/string/transform.d.ts +77 -0
  114. package/dist/unpkg/prod/declarations/-private.d.ts +1 -0
  115. package/dist/unpkg/prod/declarations/active-record.d.ts +3 -0
  116. package/dist/unpkg/prod/declarations/derivations.d.ts +27 -0
  117. package/dist/unpkg/prod/declarations/handlers.d.ts +10 -0
  118. package/dist/unpkg/prod/declarations/index.d.ts +208 -0
  119. package/dist/unpkg/prod/declarations/json-api.d.ts +5 -0
  120. package/dist/unpkg/prod/declarations/rest.d.ts +3 -0
  121. package/dist/unpkg/prod/declarations/string.d.ts +14 -0
  122. package/dist/unpkg/prod/derivations.js +30 -0
  123. package/dist/unpkg/prod/handlers.js +317 -0
  124. package/dist/unpkg/prod/index.js +361 -0
  125. package/dist/unpkg/prod/inflect-BSG696t-.js +344 -0
  126. package/dist/unpkg/prod/json-api.js +740 -0
  127. package/dist/unpkg/prod/rest.js +393 -0
  128. package/dist/unpkg/prod/string.js +1 -0
  129. package/dist/unpkg/prod-deprecated/-private.js +7 -0
  130. package/dist/unpkg/prod-deprecated/active-record.js +395 -0
  131. package/dist/unpkg/prod-deprecated/builder-utils-Donkk-BZ.js +22 -0
  132. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/find-record.d.ts +64 -0
  133. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/query.d.ts +53 -0
  134. package/dist/unpkg/prod-deprecated/declarations/-private/active-record/save-record.d.ts +146 -0
  135. package/dist/unpkg/prod-deprecated/declarations/-private/builder-utils.d.ts +4 -0
  136. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/auto-compress.d.ts +158 -0
  137. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/gated.d.ts +19 -0
  138. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/meta-doc.d.ts +47 -0
  139. package/dist/unpkg/prod-deprecated/declarations/-private/handlers/utils.d.ts +41 -0
  140. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/-utils.d.ts +109 -0
  141. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/find-record.d.ts +84 -0
  142. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/query.d.ts +100 -0
  143. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/save-record.d.ts +228 -0
  144. package/dist/unpkg/prod-deprecated/declarations/-private/json-api/serialize.d.ts +70 -0
  145. package/dist/unpkg/prod-deprecated/declarations/-private/rest/find-record.d.ts +62 -0
  146. package/dist/unpkg/prod-deprecated/declarations/-private/rest/query.d.ts +53 -0
  147. package/dist/unpkg/prod-deprecated/declarations/-private/rest/save-record.d.ts +146 -0
  148. package/dist/unpkg/prod-deprecated/declarations/-private/string/inflect.d.ts +82 -0
  149. package/dist/unpkg/prod-deprecated/declarations/-private/string/inflections.d.ts +9 -0
  150. package/dist/unpkg/prod-deprecated/declarations/-private/string/transform.d.ts +77 -0
  151. package/dist/unpkg/prod-deprecated/declarations/-private.d.ts +1 -0
  152. package/dist/unpkg/prod-deprecated/declarations/active-record.d.ts +3 -0
  153. package/dist/unpkg/prod-deprecated/declarations/derivations.d.ts +27 -0
  154. package/dist/unpkg/prod-deprecated/declarations/handlers.d.ts +10 -0
  155. package/dist/unpkg/prod-deprecated/declarations/index.d.ts +208 -0
  156. package/dist/unpkg/prod-deprecated/declarations/json-api.d.ts +5 -0
  157. package/dist/unpkg/prod-deprecated/declarations/rest.d.ts +3 -0
  158. package/dist/unpkg/prod-deprecated/declarations/string.d.ts +14 -0
  159. package/dist/unpkg/prod-deprecated/derivations.js +30 -0
  160. package/dist/unpkg/prod-deprecated/handlers.js +317 -0
  161. package/dist/unpkg/prod-deprecated/index.js +361 -0
  162. package/dist/unpkg/prod-deprecated/inflect-BSG696t-.js +344 -0
  163. package/dist/unpkg/prod-deprecated/json-api.js +740 -0
  164. package/dist/unpkg/prod-deprecated/rest.js +393 -0
  165. package/dist/unpkg/prod-deprecated/string.js +1 -0
  166. package/logos/README.md +2 -2
  167. package/logos/logo-yellow-slab.svg +1 -0
  168. package/logos/word-mark-black.svg +1 -0
  169. package/logos/word-mark-white.svg +1 -0
  170. package/package.json +4 -4
  171. package/logos/NCC-1701-a-blue.svg +0 -4
  172. package/logos/NCC-1701-a-gold.svg +0 -4
  173. package/logos/NCC-1701-a-gold_100.svg +0 -1
  174. package/logos/NCC-1701-a-gold_base-64.txt +0 -1
  175. package/logos/NCC-1701-a.svg +0 -4
  176. package/logos/docs-badge.svg +0 -2
  177. package/logos/ember-data-logo-dark.svg +0 -12
  178. package/logos/ember-data-logo-light.svg +0 -12
  179. package/logos/social1.png +0 -0
  180. package/logos/social2.png +0 -0
  181. package/logos/warp-drive-logo-dark.svg +0 -4
  182. package/logos/warp-drive-logo-gold.svg +0 -4
@@ -0,0 +1,77 @@
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;
@@ -0,0 +1 @@
1
+ export { defaultRules as InflectionRuleDefaults } from "./-private/string/inflections.js";
@@ -0,0 +1,3 @@
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";
@@ -0,0 +1,27 @@
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 {};
@@ -0,0 +1,10 @@
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";
@@ -0,0 +1,208 @@
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;
@@ -0,0 +1,5 @@
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";
@@ -0,0 +1,3 @@
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";
@@ -0,0 +1,14 @@
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";
@@ -0,0 +1,30 @@
1
+ import { Type } from '@warp-drive-mirror/core/types/symbols';
2
+
3
+ /**
4
+ * A derivation for use by {@link ReactiveResource} that joins the given fields
5
+ * with the optional separator (or '' if no separator is provided).
6
+ *
7
+ * Generally you should not need to import and use this function directly.
8
+ *
9
+ * @example
10
+ * {
11
+ * name: 'fullName',
12
+ * kind: 'derived',
13
+ * type: 'concat',
14
+ * options: {
15
+ * fields: ['firstName', 'lastName'],
16
+ * separator: ' ',
17
+ * },
18
+ * }
19
+ */
20
+ const concat = (record, options, _prop) => {
21
+ if (!options) {
22
+ throw new Error(`options is required`);
23
+ }
24
+ // SAFETY: we cast internally to a more specific type, for our own use
25
+ // SAFETY: but provide the more general signature to the schema service
26
+ const opts = options;
27
+ return opts.fields.map(field => record[field]).join(opts.separator ?? '');
28
+ };
29
+ concat[Type] = 'concat';
30
+ export { concat };