@warp-drive/utilities 5.9.0-alpha.2 → 5.9.0-alpha.21
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/cjs-dist/string.cjs +448 -0
- package/cjs-dist/string.cjs.map +1 -0
- package/declarations/-private.d.ts +12 -1
- package/declarations/-private.d.ts.map +1 -0
- package/declarations/active-record.d.ts +260 -3
- package/declarations/active-record.d.ts.map +1 -0
- package/declarations/derivations.d.ts +26 -23
- package/declarations/derivations.d.ts.map +1 -0
- package/declarations/handlers.d.ts +282 -9
- package/declarations/handlers.d.ts.map +1 -0
- package/declarations/index-BeMAuqgZ.d.ts +462 -0
- package/declarations/index-BeMAuqgZ.d.ts.map +1 -0
- package/declarations/index.d.ts +2 -208
- package/declarations/json-api.d.ts +496 -5
- package/declarations/json-api.d.ts.map +1 -0
- package/declarations/rest.d.ts +258 -3
- package/declarations/rest.d.ts.map +1 -0
- package/declarations/string.d.ts +164 -13
- package/declarations/string.d.ts.map +1 -0
- package/dist/-private.js +2 -6
- package/dist/active-record.js +254 -379
- package/dist/active-record.js.map +1 -0
- package/dist/builder-utils-BkXwUT0x.js +16 -0
- package/dist/builder-utils-BkXwUT0x.js.map +1 -0
- package/dist/derivations.js +26 -26
- package/dist/derivations.js.map +1 -0
- package/dist/handlers.js +240 -283
- package/dist/handlers.js.map +1 -0
- package/dist/index.js +357 -335
- package/dist/index.js.map +1 -0
- package/dist/inflections-DzBsjJqj.js +80 -0
- package/dist/inflections-DzBsjJqj.js.map +1 -0
- package/dist/json-api.js +470 -706
- package/dist/json-api.js.map +1 -0
- package/dist/rest.js +254 -377
- package/dist/rest.js.map +1 -0
- package/dist/string-CWmAluxh.js +290 -0
- package/dist/string-CWmAluxh.js.map +1 -0
- package/dist/string.js +2 -427
- package/dist/unpkg/dev/-private.js +2 -6
- package/dist/unpkg/dev/active-record.js +253 -378
- package/dist/unpkg/dev/active-record.js.map +1 -0
- package/dist/unpkg/dev/builder-utils-BkXwUT0x.js +16 -0
- package/dist/unpkg/dev/builder-utils-BkXwUT0x.js.map +1 -0
- package/dist/unpkg/dev/derivations.js +26 -26
- package/dist/unpkg/dev/derivations.js.map +1 -0
- package/dist/unpkg/dev/handlers.js +238 -282
- package/dist/unpkg/dev/handlers.js.map +1 -0
- package/dist/unpkg/dev/index.js +356 -336
- package/dist/unpkg/dev/index.js.map +1 -0
- package/dist/unpkg/dev/inflections-DzBsjJqj.js +80 -0
- package/dist/unpkg/dev/inflections-DzBsjJqj.js.map +1 -0
- package/dist/unpkg/dev/json-api.js +469 -706
- package/dist/unpkg/dev/json-api.js.map +1 -0
- package/dist/unpkg/dev/rest.js +253 -376
- package/dist/unpkg/dev/rest.js.map +1 -0
- package/dist/unpkg/dev/string-j4ur-TDs.js +289 -0
- package/dist/unpkg/dev/string-j4ur-TDs.js.map +1 -0
- package/dist/unpkg/dev/string.js +3 -1
- package/dist/unpkg/dev-deprecated/-private.js +2 -6
- package/dist/unpkg/dev-deprecated/active-record.js +253 -378
- package/dist/unpkg/dev-deprecated/active-record.js.map +1 -0
- package/dist/unpkg/dev-deprecated/builder-utils-BkXwUT0x.js +16 -0
- package/dist/unpkg/dev-deprecated/builder-utils-BkXwUT0x.js.map +1 -0
- package/dist/unpkg/dev-deprecated/derivations.js +26 -26
- package/dist/unpkg/dev-deprecated/derivations.js.map +1 -0
- package/dist/unpkg/dev-deprecated/handlers.js +238 -282
- package/dist/unpkg/dev-deprecated/handlers.js.map +1 -0
- package/dist/unpkg/dev-deprecated/index.js +356 -336
- package/dist/unpkg/dev-deprecated/index.js.map +1 -0
- package/dist/unpkg/dev-deprecated/inflections-DzBsjJqj.js +80 -0
- package/dist/unpkg/dev-deprecated/inflections-DzBsjJqj.js.map +1 -0
- package/dist/unpkg/dev-deprecated/json-api.js +469 -706
- package/dist/unpkg/dev-deprecated/json-api.js.map +1 -0
- package/dist/unpkg/dev-deprecated/rest.js +253 -376
- package/dist/unpkg/dev-deprecated/rest.js.map +1 -0
- package/dist/unpkg/dev-deprecated/string-j4ur-TDs.js +289 -0
- package/dist/unpkg/dev-deprecated/string-j4ur-TDs.js.map +1 -0
- package/dist/unpkg/dev-deprecated/string.js +3 -1
- package/dist/unpkg/prod/-private.js +2 -6
- package/dist/unpkg/prod/active-record.js +236 -351
- package/dist/unpkg/prod/active-record.js.map +1 -0
- package/dist/unpkg/prod/builder-utils-BkXwUT0x.js +16 -0
- package/dist/unpkg/prod/builder-utils-BkXwUT0x.js.map +1 -0
- package/dist/unpkg/prod/derivations.js +26 -26
- package/dist/unpkg/prod/derivations.js.map +1 -0
- package/dist/unpkg/prod/handlers.js +231 -272
- package/dist/unpkg/prod/handlers.js.map +1 -0
- package/dist/unpkg/prod/index.js +265 -215
- package/dist/unpkg/prod/index.js.map +1 -0
- package/dist/unpkg/prod/inflections-DzBsjJqj.js +80 -0
- package/dist/unpkg/prod/inflections-DzBsjJqj.js.map +1 -0
- package/dist/unpkg/prod/json-api.js +446 -669
- package/dist/unpkg/prod/json-api.js.map +1 -0
- package/dist/unpkg/prod/rest.js +236 -349
- package/dist/unpkg/prod/rest.js.map +1 -0
- package/dist/unpkg/prod/string-T1ahjLdj.js +283 -0
- package/dist/unpkg/prod/string-T1ahjLdj.js.map +1 -0
- package/dist/unpkg/prod/string.js +3 -1
- package/dist/unpkg/prod-deprecated/-private.js +2 -6
- package/dist/unpkg/prod-deprecated/active-record.js +236 -351
- package/dist/unpkg/prod-deprecated/active-record.js.map +1 -0
- package/dist/unpkg/prod-deprecated/builder-utils-BkXwUT0x.js +16 -0
- package/dist/unpkg/prod-deprecated/builder-utils-BkXwUT0x.js.map +1 -0
- package/dist/unpkg/prod-deprecated/derivations.js +26 -26
- package/dist/unpkg/prod-deprecated/derivations.js.map +1 -0
- package/dist/unpkg/prod-deprecated/handlers.js +231 -272
- package/dist/unpkg/prod-deprecated/handlers.js.map +1 -0
- package/dist/unpkg/prod-deprecated/index.js +265 -215
- package/dist/unpkg/prod-deprecated/index.js.map +1 -0
- package/dist/unpkg/prod-deprecated/inflections-DzBsjJqj.js +80 -0
- package/dist/unpkg/prod-deprecated/inflections-DzBsjJqj.js.map +1 -0
- package/dist/unpkg/prod-deprecated/json-api.js +446 -669
- package/dist/unpkg/prod-deprecated/json-api.js.map +1 -0
- package/dist/unpkg/prod-deprecated/rest.js +236 -349
- package/dist/unpkg/prod-deprecated/rest.js.map +1 -0
- package/dist/unpkg/prod-deprecated/string-T1ahjLdj.js +283 -0
- package/dist/unpkg/prod-deprecated/string-T1ahjLdj.js.map +1 -0
- package/dist/unpkg/prod-deprecated/string.js +3 -1
- package/package.json +11 -10
- package/declarations/-private/active-record/find-record.d.ts +0 -64
- package/declarations/-private/active-record/query.d.ts +0 -53
- package/declarations/-private/active-record/save-record.d.ts +0 -146
- package/declarations/-private/builder-utils.d.ts +0 -4
- package/declarations/-private/handlers/auto-compress.d.ts +0 -158
- package/declarations/-private/handlers/gated.d.ts +0 -19
- package/declarations/-private/handlers/meta-doc.d.ts +0 -47
- package/declarations/-private/handlers/utils.d.ts +0 -41
- package/declarations/-private/json-api/-utils.d.ts +0 -109
- package/declarations/-private/json-api/find-record.d.ts +0 -84
- package/declarations/-private/json-api/query.d.ts +0 -100
- package/declarations/-private/json-api/save-record.d.ts +0 -228
- package/declarations/-private/json-api/serialize.d.ts +0 -70
- package/declarations/-private/rest/find-record.d.ts +0 -62
- package/declarations/-private/rest/query.d.ts +0 -53
- package/declarations/-private/rest/save-record.d.ts +0 -146
- package/declarations/-private/string/inflect.d.ts +0 -82
- package/declarations/-private/string/inflections.d.ts +0 -9
- package/declarations/-private/string/transform.d.ts +0 -77
- package/dist/builder-utils-Donkk-BZ.js +0 -22
- package/dist/inflect-BSG696t-.js +0 -344
- package/dist/string.cjs +0 -430
- package/dist/unpkg/dev/builder-utils-Donkk-BZ.js +0 -22
- package/dist/unpkg/dev/inflect-BEv8WqY1.js +0 -343
- package/dist/unpkg/dev-deprecated/builder-utils-Donkk-BZ.js +0 -22
- package/dist/unpkg/dev-deprecated/inflect-BEv8WqY1.js +0 -343
- package/dist/unpkg/prod/builder-utils-Donkk-BZ.js +0 -22
- package/dist/unpkg/prod/inflect-Dh9dyEYx.js +0 -333
- package/dist/unpkg/prod-deprecated/builder-utils-Donkk-BZ.js +0 -22
- package/dist/unpkg/prod-deprecated/inflect-Dh9dyEYx.js +0 -333
package/declarations/rest.d.ts
CHANGED
|
@@ -1,3 +1,258 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ReactiveDataDocument } from "@warp-drive/core/reactive";
|
|
2
|
+
import { TypeFromInstance, TypedRecordInstance } from "@warp-drive/core/types/record";
|
|
3
|
+
import { ConstrainedRequestOptions, CreateRequestOptions, DeleteRequestOptions, FindRecordOptions, FindRecordRequestOptions, QueryRequestOptions, RemotelyAccessibleIdentifier, UpdateRequestOptions } from "@warp-drive/core/types/request";
|
|
4
|
+
import { QueryParamsSource } from "@warp-drive/core/types/params";
|
|
5
|
+
//#region src/-private/rest/find-record.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Builds request options to fetch a single resource by a known id or identifier
|
|
8
|
+
* configured for the url and header expectations of most REST APIs.
|
|
9
|
+
*
|
|
10
|
+
* **Basic Usage**
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { findRecord } from '@warp-drive/utilities/rest';
|
|
14
|
+
*
|
|
15
|
+
* const data = await store.request(findRecord('person', '1'));
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* **With Options**
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { findRecord } from '@warp-drive/utilities/rest';
|
|
22
|
+
*
|
|
23
|
+
* const options = findRecord('person', '1', { include: ['pets', 'friends'] });
|
|
24
|
+
* const data = await store.request(options);
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* **With an Identifier**
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { findRecord } from '@warp-drive/utilities/rest';
|
|
31
|
+
*
|
|
32
|
+
* const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });
|
|
33
|
+
* const data = await store.request(options);
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* **Supplying Options to Modify the Request Behavior**
|
|
37
|
+
*
|
|
38
|
+
* The following options are supported:
|
|
39
|
+
*
|
|
40
|
+
* - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
|
|
41
|
+
* - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
|
|
42
|
+
* - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
|
|
43
|
+
* - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
|
|
44
|
+
* option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
|
|
45
|
+
* - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
|
|
46
|
+
* promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
|
|
47
|
+
* defaulting to `false` if none is configured.
|
|
48
|
+
* - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { findRecord } from '@warp-drive/utilities/rest';
|
|
52
|
+
*
|
|
53
|
+
* const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });
|
|
54
|
+
* const data = await store.request(options);
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
declare function findRecord<T>(identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions): FindRecordRequestOptions<ReactiveDataDocument<T>, T>;
|
|
60
|
+
declare function findRecord(identifier: RemotelyAccessibleIdentifier, options?: FindRecordOptions): FindRecordRequestOptions;
|
|
61
|
+
declare function findRecord<T>(type: TypeFromInstance<T>, id: string, options?: FindRecordOptions): FindRecordRequestOptions<ReactiveDataDocument<T>, T>;
|
|
62
|
+
declare function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/-private/rest/query.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* Builds request options to query for resources, usually by a primary
|
|
67
|
+
* type, configured for the url and header expectations of most REST APIs.
|
|
68
|
+
*
|
|
69
|
+
* **Basic Usage**
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { query } from '@warp-drive/utilities/rest';
|
|
73
|
+
*
|
|
74
|
+
* const data = await store.request(query('person'));
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* **With Query Params**
|
|
78
|
+
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* import { query } from '@warp-drive/utilities/rest';
|
|
81
|
+
*
|
|
82
|
+
* const options = query('person', { include: ['pets', 'friends'] });
|
|
83
|
+
* const data = await store.request(options);
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* **Supplying Options to Modify the Request Behavior**
|
|
87
|
+
*
|
|
88
|
+
* The following options are supported:
|
|
89
|
+
*
|
|
90
|
+
* - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
|
|
91
|
+
* - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
|
|
92
|
+
* - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
|
|
93
|
+
* - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
|
|
94
|
+
* option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
|
|
95
|
+
* - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
|
|
96
|
+
* promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
|
|
97
|
+
* defaulting to `false` if none is configured.
|
|
98
|
+
* - `urlParamsSettings` - an object containing options for how to serialize the query params (see `buildQueryParams`)
|
|
99
|
+
*
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { query } from '@warp-drive/utilities/rest';
|
|
102
|
+
*
|
|
103
|
+
* const options = query('person', { include: ['pets', 'friends'] }, { reload: true });
|
|
104
|
+
* const data = await store.request(options);
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @param identifier
|
|
109
|
+
* @param query
|
|
110
|
+
* @param options
|
|
111
|
+
*/
|
|
112
|
+
declare function query<T>(type: TypeFromInstance<T>, query?: QueryParamsSource, options?: ConstrainedRequestOptions): QueryRequestOptions<ReactiveDataDocument<T[]>>;
|
|
113
|
+
declare function query(type: string, query?: QueryParamsSource, options?: ConstrainedRequestOptions): QueryRequestOptions;
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/-private/rest/save-record.d.ts
|
|
116
|
+
/**
|
|
117
|
+
* Builds request options to delete record for resources,
|
|
118
|
+
* configured for the url, method and header expectations of REST APIs.
|
|
119
|
+
*
|
|
120
|
+
* **Basic Usage**
|
|
121
|
+
*
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { deleteRecord } from '@warp-drive/utilities/rest';
|
|
124
|
+
*
|
|
125
|
+
* const person = store.peekRecord('person', '1');
|
|
126
|
+
*
|
|
127
|
+
* // mark record as deleted
|
|
128
|
+
* store.deleteRecord(person);
|
|
129
|
+
*
|
|
130
|
+
* // persist deletion
|
|
131
|
+
* const data = await store.request(deleteRecord(person));
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* **Supplying Options to Modify the Request Behavior**
|
|
135
|
+
*
|
|
136
|
+
* The following options are supported:
|
|
137
|
+
*
|
|
138
|
+
* - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
|
|
139
|
+
* - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
|
|
140
|
+
* - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
|
|
141
|
+
* - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
|
|
142
|
+
* option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
|
|
143
|
+
* - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
|
|
144
|
+
* promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
|
|
145
|
+
* defaulting to `false` if none is configured.
|
|
146
|
+
* - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* import { deleteRecord } from '@warp-drive/utilities/rest';
|
|
150
|
+
*
|
|
151
|
+
* const person = store.peekRecord('person', '1');
|
|
152
|
+
*
|
|
153
|
+
* // mark record as deleted
|
|
154
|
+
* store.deleteRecord(person);
|
|
155
|
+
*
|
|
156
|
+
* // persist deletion
|
|
157
|
+
* const options = deleteRecord(person, { namespace: 'api/v1' });
|
|
158
|
+
* const data = await store.request(options);
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
* @param record
|
|
163
|
+
* @param options
|
|
164
|
+
*/
|
|
165
|
+
declare function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;
|
|
166
|
+
declare function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;
|
|
167
|
+
/**
|
|
168
|
+
* Builds request options to create new record for resources,
|
|
169
|
+
* configured for the url, method and header expectations of most REST APIs.
|
|
170
|
+
*
|
|
171
|
+
* **Basic Usage**
|
|
172
|
+
*
|
|
173
|
+
* ```ts
|
|
174
|
+
* import { createRecord } from '@warp-drive/utilities/rest';
|
|
175
|
+
*
|
|
176
|
+
* const person = store.createRecord('person', { name: 'Ted' });
|
|
177
|
+
* const data = await store.request(createRecord(person));
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* **Supplying Options to Modify the Request Behavior**
|
|
181
|
+
*
|
|
182
|
+
* The following options are supported:
|
|
183
|
+
*
|
|
184
|
+
* - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
|
|
185
|
+
* - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
|
|
186
|
+
* - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
|
|
187
|
+
* - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
|
|
188
|
+
* option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
|
|
189
|
+
* - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
|
|
190
|
+
* promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
|
|
191
|
+
* defaulting to `false` if none is configured.
|
|
192
|
+
* - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
|
|
193
|
+
*
|
|
194
|
+
* ```ts
|
|
195
|
+
* import { createRecord } from '@warp-drive/utilities/rest';
|
|
196
|
+
*
|
|
197
|
+
* const person = store.createRecord('person', { name: 'Ted' });
|
|
198
|
+
* const options = createRecord(person, { namespace: 'api/v1' });
|
|
199
|
+
* const data = await store.request(options);
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @public
|
|
203
|
+
* @param record
|
|
204
|
+
* @param options
|
|
205
|
+
*/
|
|
206
|
+
declare function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;
|
|
207
|
+
declare function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;
|
|
208
|
+
/**
|
|
209
|
+
* Builds request options to update existing record for resources,
|
|
210
|
+
* configured for the url, method and header expectations of most REST APIs.
|
|
211
|
+
*
|
|
212
|
+
* **Basic Usage**
|
|
213
|
+
*
|
|
214
|
+
* ```ts
|
|
215
|
+
* import { updateRecord } from '@warp-drive/utilities/rest';
|
|
216
|
+
*
|
|
217
|
+
* const person = store.peekRecord('person', '1');
|
|
218
|
+
* person.name = 'Chris';
|
|
219
|
+
* const data = await store.request(updateRecord(person));
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* **Supplying Options to Modify the Request Behavior**
|
|
223
|
+
*
|
|
224
|
+
* The following options are supported:
|
|
225
|
+
*
|
|
226
|
+
* - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.
|
|
227
|
+
* - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
|
|
228
|
+
* - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
|
|
229
|
+
* - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
|
|
230
|
+
* - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
|
|
231
|
+
* option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
|
|
232
|
+
* - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
|
|
233
|
+
* promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
|
|
234
|
+
* defaulting to `false` if none is configured.
|
|
235
|
+
* - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
|
|
236
|
+
*
|
|
237
|
+
* ```ts
|
|
238
|
+
* import { updateRecord } from '@warp-drive/utilities/rest';
|
|
239
|
+
*
|
|
240
|
+
* const person = store.peekRecord('person', '1');
|
|
241
|
+
* person.name = 'Chris';
|
|
242
|
+
* const options = updateRecord(person, { patch: true });
|
|
243
|
+
* const data = await store.request(options);
|
|
244
|
+
* ```
|
|
245
|
+
*
|
|
246
|
+
* @public
|
|
247
|
+
* @param record
|
|
248
|
+
* @param options
|
|
249
|
+
*/
|
|
250
|
+
declare function updateRecord<T extends TypedRecordInstance, RT extends TypedRecordInstance = T>(record: T, options?: ConstrainedRequestOptions & {
|
|
251
|
+
patch?: boolean;
|
|
252
|
+
}): UpdateRequestOptions<ReactiveDataDocument<RT>, T>;
|
|
253
|
+
declare function updateRecord(record: unknown, options?: ConstrainedRequestOptions & {
|
|
254
|
+
patch?: boolean;
|
|
255
|
+
}): UpdateRequestOptions;
|
|
256
|
+
//#endregion
|
|
257
|
+
export { createRecord, deleteRecord, findRecord, query, updateRecord };
|
|
258
|
+
//# sourceMappingURL=rest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest.d.ts","names":[],"sources":["../src/-private/rest/find-record.ts","../src/-private/rest/query.ts","../src/-private/rest/save-record.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiEgB,WAAW,GACzB,YAAY,6BAA6B,iBAAiB,KAC1D,UAAU,oBACT,yBAAyB,qBAAqB,IAAI;iBACrC,WACd,YAAY,8BACZ,UAAU,oBACT;iBACa,WAAW,GACzB,MAAM,iBAAiB,IACvB,YACA,UAAU,oBACT,yBAAyB,qBAAqB,IAAI;iBACrC,WAAW,cAAc,YAAY,UAAU,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCtBnE,MAAM,GACpB,MAAM,iBAAiB,IACvB,QAAQ,mBACR,UAAU,4BACT,oBAAoB,qBAAqB;iBAC5B,MACd,cACA,QAAQ,mBACR,UAAU,4BACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCSa,aAAa,GAAG,QAAQ,GAAG,UAAU,4BAA4B,qBAAqB;iBACtF,aAAa,iBAAiB,UAAU,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqEpE,aAAa,GAAG,QAAQ,GAAG,UAAU,4BAA4B,qBAAqB;iBACtF,aAAa,iBAAiB,UAAU,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuEpE,aAAa,UAAU,qBAAqB,WAAW,sBAAsB,GAC3F,QAAQ,GACR,UAAU;EAA8B;IACvC,qBAAqB,qBAAqB,KAAK;iBAClC,aACd,iBACA,UAAU;EAA8B;IACvC"}
|
package/declarations/string.d.ts
CHANGED
|
@@ -1,14 +1,165 @@
|
|
|
1
|
+
//#region src/-private/string/inflect.d.ts
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
* Marks a word as uncountable. Uncountable words are not pluralized
|
|
4
|
+
* or singularized.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
* @since 4.13.0
|
|
8
|
+
*/
|
|
9
|
+
declare function uncountable(word: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Marks a list of words as uncountable. Uncountable words are not pluralized
|
|
12
|
+
* or singularized.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @since 4.13.0
|
|
16
|
+
*/
|
|
17
|
+
declare function loadUncountable(uncountables: string[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Marks a word as irregular. Irregular words have unique
|
|
20
|
+
* pluralization and singularization rules.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* @since 4.13.0
|
|
24
|
+
*/
|
|
25
|
+
declare function irregular(single: string, plur: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Marks a list of word pairs as irregular. Irregular words have unique
|
|
28
|
+
* pluralization and singularization rules.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
* @since 4.13.0
|
|
32
|
+
*/
|
|
33
|
+
declare function loadIrregular(irregularPairs: Array<[string, string]>): void;
|
|
34
|
+
/**
|
|
35
|
+
* Clears the caches for singularize and pluralize.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @since 4.13.0
|
|
39
|
+
*/
|
|
40
|
+
declare function clear(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Resets the inflection rules to the defaults.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
* @since 4.13.0
|
|
46
|
+
*/
|
|
47
|
+
declare function resetToDefaults(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Clears all inflection rules
|
|
50
|
+
* and resets the caches for singularize and pluralize.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
* @since 4.13.0
|
|
54
|
+
*/
|
|
55
|
+
declare function clearRules(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Singularizes a word.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
* @since 4.13.0
|
|
61
|
+
*/
|
|
62
|
+
declare function singularize(word: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Pluralizes a word.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
* @since 4.13.0
|
|
68
|
+
*/
|
|
69
|
+
declare function pluralize(word: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Adds a pluralization rule.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
* @since 4.13.0
|
|
75
|
+
*/
|
|
76
|
+
declare function plural(regex: RegExp, string: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Adds a singularization rule.
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
* @since 4.13.0
|
|
82
|
+
*/
|
|
83
|
+
declare function singular(regex: RegExp, string: string): void;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/-private/string/transform.d.ts
|
|
86
|
+
/**
|
|
87
|
+
* Replaces underscores, spaces, or camelCase with dashes.
|
|
88
|
+
*
|
|
89
|
+
* ```js
|
|
90
|
+
* import { dasherize } from '@warp-drive/utilities/string';
|
|
91
|
+
*
|
|
92
|
+
* dasherize('innerHTML'); // 'inner-html'
|
|
93
|
+
* dasherize('action_name'); // 'action-name'
|
|
94
|
+
* dasherize('css-class-name'); // 'css-class-name'
|
|
95
|
+
* dasherize('my favorite items'); // 'my-favorite-items'
|
|
96
|
+
* dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
* @since 4.13.0
|
|
101
|
+
*/
|
|
102
|
+
declare const dasherize: (str: string) => string;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the lowerCamelCase form of a string.
|
|
105
|
+
*
|
|
106
|
+
* ```js
|
|
107
|
+
* import { camelize } from '@warp-drive/utilities/string';
|
|
108
|
+
*
|
|
109
|
+
* camelize('innerHTML'); // 'innerHTML'
|
|
110
|
+
* camelize('action_name'); // 'actionName'
|
|
111
|
+
* camelize('css-class-name'); // 'cssClassName'
|
|
112
|
+
* camelize('my favorite items'); // 'myFavoriteItems'
|
|
113
|
+
* camelize('My Favorite Items'); // 'myFavoriteItems'
|
|
114
|
+
* camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
* @since 4.13.0
|
|
119
|
+
*/
|
|
120
|
+
declare function camelize(str: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* Returns the lower\_case\_and\_underscored form of a string.
|
|
123
|
+
*
|
|
124
|
+
* ```js
|
|
125
|
+
* import { underscore } from '@warp-drive/utilities/string';
|
|
126
|
+
*
|
|
127
|
+
* underscore('innerHTML'); // 'inner_html'
|
|
128
|
+
* underscore('action_name'); // 'action_name'
|
|
129
|
+
* underscore('css-class-name'); // 'css_class_name'
|
|
130
|
+
* underscore('my favorite items'); // 'my_favorite_items'
|
|
131
|
+
* underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
* @since 4.13.0
|
|
136
|
+
*/
|
|
137
|
+
declare function underscore(str: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* Returns the Capitalized form of a string
|
|
140
|
+
*
|
|
141
|
+
* ```js
|
|
142
|
+
* import { capitalize } from '@warp-drive/utilities/string';
|
|
143
|
+
*
|
|
144
|
+
* capitalize('innerHTML') // 'InnerHTML'
|
|
145
|
+
* capitalize('action_name') // 'Action_name'
|
|
146
|
+
* capitalize('css-class-name') // 'Css-class-name'
|
|
147
|
+
* capitalize('my favorite items') // 'My favorite items'
|
|
148
|
+
* capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @public
|
|
152
|
+
* @since 4.13.0
|
|
153
|
+
*/
|
|
154
|
+
declare function capitalize(str: string): string;
|
|
155
|
+
/**
|
|
156
|
+
* Sets the maximum size of the LRUCache for all string transformation functions.
|
|
157
|
+
* The default size is 10,000.
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
* @since 4.13.0
|
|
161
|
+
*/
|
|
162
|
+
declare function setMaxLRUCacheSize(size: number): void;
|
|
163
|
+
//#endregion
|
|
164
|
+
export { camelize, capitalize, clear, clearRules, dasherize, irregular, loadIrregular, loadUncountable, plural, pluralize, resetToDefaults, setMaxLRUCacheSize, singular, singularize, uncountable, underscore };
|
|
165
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","names":[],"sources":["../src/-private/string/inflect.ts","../src/-private/string/transform.ts"],"mappings":";;;;;;;;iBA8BgB,YAAY;;;;;;;;iBAWZ,gBAAgB;;;;;;;;iBAahB,UAAU,gBAAgB;;;;;;;;iBAiB1B,cAAc,gBAAgB;;;;;;;iBAmB9B;;;;;;;iBAWA;;;;;;;;iBAeA;;;;;;;iBAgBA,YAAY;;;;;;;iBAYZ,UAAU;;;;;;;iBAqBV,OAAO,OAAO,QAAQ;;;;;;;iBAgBtB,SAAS,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;cC9I3B,YAAY;;;;;;;;;;;;;;;;;;iBAmBT,SAAS;;;;;;;;;;;;;;;;;iBAoBT,WAAW;;;;;;;;;;;;;;;;;iBAoBX,WAAW;;;;;;;;iBAWX,mBAAmB"}
|
package/dist/-private.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
singular: [[/s$/i, ''], [/(ss)$/i, '$1'], [/(n)ews$/i, '$1ews'], [/([ti])a$/i, '$1um'], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'], [/(^analy)(sis|ses)$/i, '$1sis'], [/([^f])ves$/i, '$1fe'], [/(hive)s$/i, '$1'], [/(tive)s$/i, '$1'], [/([lr])ves$/i, '$1f'], [/([^aeiouy]|qu)ies$/i, '$1y'], [/(s)eries$/i, '$1eries'], [/(m)ovies$/i, '$1ovie'], [/(x|ch|ss|sh)es$/i, '$1'], [/^(m|l)ice$/i, '$1ouse'], [/(bus)(es)?$/i, '$1'], [/(o)es$/i, '$1'], [/(shoe)s$/i, '$1'], [/(cris|test)(is|es)$/i, '$1is'], [/^(a)x[ie]s$/i, '$1xis'], [/(octop|vir)(us|i)$/i, '$1us'], [/(alias|status|bonus)(es)?$/i, '$1'], [/^(ox)en/i, '$1'], [/(vert|ind)ices$/i, '$1ex'], [/(matr)ices$/i, '$1ix'], [/(quiz)zes$/i, '$1'], [/(database)s$/i, '$1']],
|
|
4
|
-
irregularPairs: [['person', 'people'], ['man', 'men'], ['child', 'children'], ['sex', 'sexes'], ['move', 'moves'], ['cow', 'kine'], ['zombie', 'zombies']],
|
|
5
|
-
uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police']
|
|
6
|
-
};
|
|
1
|
+
import { t as defaultRules } from "./inflections-DzBsjJqj.js";
|
|
2
|
+
|
|
7
3
|
export { defaultRules as InflectionRuleDefaults };
|