@ember-data-types/rest 5.6.0-alpha.1 → 5.6.0-alpha.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-data-types/rest",
3
- "version": "5.6.0-alpha.1",
3
+ "version": "5.6.0-alpha.12",
4
4
  "files": [
5
5
  "unstable-preview-types",
6
6
  "README.md",
@@ -1,5 +1 @@
1
- /// <reference path="./request.d.ts" />
2
- /// <reference path="./-private/builders/query.d.ts" />
3
- /// <reference path="./-private/builders/save-record.d.ts" />
4
- /// <reference path="./-private/builders/-utils.d.ts" />
5
- /// <reference path="./-private/builders/find-record.d.ts" />
1
+ /// <reference path="./request.d.ts" />
@@ -61,12 +61,9 @@ declare module '@ember-data/rest/request' {
61
61
  - [query](https://api.emberjs.com/ember-data/release/functions/@ember-data%2Frest/query)
62
62
  - [updateRecord](https://api.emberjs.com/ember-data/release/functions/@ember-data%2Frest/updateRecord)
63
63
 
64
- * @module @ember-data/rest/request
65
- * @main @ember-data/rest/request
64
+ * @module
66
65
  * @public
67
66
  */
68
- export { findRecord } from '@ember-data/rest/-private/builders/find-record';
69
- export { query } from '@ember-data/rest/-private/builders/query';
70
- export { deleteRecord, createRecord, updateRecord } from '@ember-data/rest/-private/builders/save-record';
67
+ export { findRecord, query, deleteRecord, createRecord, updateRecord } from '@warp-drive/utilities/rest';
71
68
  }
72
69
  //# sourceMappingURL=request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,7 +0,0 @@
1
- declare module '@ember-data/rest/-private/builders/-utils' {
2
- import type { UrlOptions } from '@ember-data/request-utils';
3
- import type { CacheOptions, ConstrainedRequestOptions } from '@warp-drive/core-types/request';
4
- export function copyForwardUrlOptions(urlOptions: UrlOptions, options: ConstrainedRequestOptions): void;
5
- export function extractCacheOptions(options: ConstrainedRequestOptions): CacheOptions;
6
- }
7
- //# sourceMappingURL=-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"-utils.d.ts","sourceRoot":"","sources":["../../../src/-private/builders/-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE9F,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAUtG;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CASpF"}
@@ -1,71 +0,0 @@
1
- declare module '@ember-data/rest/-private/builders/find-record' {
2
- import type { TypeFromInstance } from '@warp-drive/core-types/record';
3
- import type { FindRecordOptions, FindRecordRequestOptions, RemotelyAccessibleIdentifier } from '@warp-drive/core-types/request';
4
- import type { SingleResourceDataDocument } from '@warp-drive/core-types/spec/document';
5
- /**
6
- * Builds request options to fetch a single resource by a known id or identifier
7
- * configured for the url and header expectations of most REST APIs.
8
- *
9
- * **Basic Usage**
10
- *
11
- * ```ts
12
- * import { findRecord } from '@ember-data/rest/request';
13
- *
14
- * const data = await store.request(findRecord('person', '1'));
15
- * ```
16
- *
17
- * **With Options**
18
- *
19
- * ```ts
20
- * import { findRecord } from '@ember-data/rest/request';
21
- *
22
- * const options = findRecord('person', '1', { include: ['pets', 'friends'] });
23
- * const data = await store.request(options);
24
- * ```
25
- *
26
- * **With an Identifier**
27
- *
28
- * ```ts
29
- * import { findRecord } from '@ember-data/rest/request';
30
- *
31
- * const options = findRecord({ type: 'person', id: '1' }, { include: ['pets', 'friends'] });
32
- * const data = await store.request(options);
33
- * ```
34
- *
35
- * **Supplying Options to Modify the Request Behavior**
36
- *
37
- * The following options are supported:
38
- *
39
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
40
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
41
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
42
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
43
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
44
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
45
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
46
- * defaulting to `false` if none is configured.
47
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
48
- *
49
- * ```ts
50
- * import { findRecord } from '@ember-data/rest/request';
51
- *
52
- * const options = findRecord('person', '1', { include: ['pets', 'friends'] }, { namespace: 'api/v2' });
53
- * const data = await store.request(options);
54
- * ```
55
- *
56
- * @method findRecord
57
- * @public
58
- * @static
59
- * @for @ember-data/rest/request
60
- * @param identifier
61
- * @param options
62
- */
63
- export type FindRecordResultDocument<T> = Omit<SingleResourceDataDocument<T>, 'data'> & {
64
- data: T;
65
- };
66
- export function findRecord<T>(identifier: RemotelyAccessibleIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions<T>): FindRecordRequestOptions<T, FindRecordResultDocument<T>>;
67
- export function findRecord(identifier: RemotelyAccessibleIdentifier, options?: FindRecordOptions): FindRecordRequestOptions;
68
- export function findRecord<T>(type: TypeFromInstance<T>, id: string, options?: FindRecordOptions<T>): FindRecordRequestOptions<T, FindRecordResultDocument<T>>;
69
- export function findRecord(type: string, id: string, options?: FindRecordOptions): FindRecordRequestOptions;
70
- }
71
- //# sourceMappingURL=find-record.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-record.d.ts","sourceRoot":"","sources":["../../../src/-private/builders/find-record.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC;AAEpG,wBAAgB,UAAU,CAAC,CAAC,EAC1B,UAAU,EAAE,4BAA4B,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAC7D,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC7B,wBAAwB,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,wBAAgB,UAAU,CACxB,UAAU,EAAE,4BAA4B,EACxC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,wBAAwB,CAAC;AAC5B,wBAAgB,UAAU,CAAC,CAAC,EAC1B,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC7B,wBAAwB,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,wBAAwB,CAAC"}
@@ -1,59 +0,0 @@
1
- declare module '@ember-data/rest/-private/builders/query' {
2
- import type { QueryParamsSource } from '@warp-drive/core-types/params';
3
- import type { TypeFromInstance } from '@warp-drive/core-types/record';
4
- import type { ConstrainedRequestOptions, QueryRequestOptions } from '@warp-drive/core-types/request';
5
- import type { CollectionResourceDataDocument } from '@warp-drive/core-types/spec/document';
6
- /**
7
- * Builds request options to query for resources, usually by a primary
8
- * type, configured for the url and header expectations of most REST APIs.
9
- *
10
- * **Basic Usage**
11
- *
12
- * ```ts
13
- * import { query } from '@ember-data/rest/request';
14
- *
15
- * const data = await store.request(query('person'));
16
- * ```
17
- *
18
- * **With Query Params**
19
- *
20
- * ```ts
21
- * import { query } from '@ember-data/rest/request';
22
- *
23
- * const options = query('person', { include: ['pets', 'friends'] });
24
- * const data = await store.request(options);
25
- * ```
26
- *
27
- * **Supplying Options to Modify the Request Behavior**
28
- *
29
- * The following options are supported:
30
- *
31
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
32
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
33
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing and camelCasing the supplied type
34
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
35
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
36
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
37
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
38
- * defaulting to `false` if none is configured.
39
- * - `urlParamsSettings` - an object containing options for how to serialize the query params (see `buildQueryParams`)
40
- *
41
- * ```ts
42
- * import { query } from '@ember-data/rest/request';
43
- *
44
- * const options = query('person', { include: ['pets', 'friends'] }, { reload: true });
45
- * const data = await store.request(options);
46
- * ```
47
- *
48
- * @method query
49
- * @public
50
- * @static
51
- * @for @ember-data/rest/request
52
- * @param identifier
53
- * @param query
54
- * @param options
55
- */
56
- export function query<T>(type: TypeFromInstance<T>, query?: QueryParamsSource, options?: ConstrainedRequestOptions): QueryRequestOptions<T, CollectionResourceDataDocument<T>>;
57
- export function query(type: string, query?: QueryParamsSource, options?: ConstrainedRequestOptions): QueryRequestOptions;
58
- }
59
- //# sourceMappingURL=query.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/-private/builders/query.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACrB,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,KAAK,CAAC,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,yBAAyB,GAClC,mBAAmB,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,yBAAyB,GAClC,mBAAmB,CAAC"}
@@ -1,153 +0,0 @@
1
- declare module '@ember-data/rest/-private/builders/save-record' {
2
- import type { ConstrainedRequestOptions, CreateRequestOptions, DeleteRequestOptions, UpdateRequestOptions } from '@warp-drive/core-types/request';
3
- /**
4
- * Builds request options to delete record for resources,
5
- * configured for the url, method and header expectations of REST APIs.
6
- *
7
- * **Basic Usage**
8
- *
9
- * ```ts
10
- * import { deleteRecord } from '@ember-data/rest/request';
11
- *
12
- * const person = store.peekRecord('person', '1');
13
- *
14
- * // mark record as deleted
15
- * store.deleteRecord(person);
16
- *
17
- * // persist deletion
18
- * const data = await store.request(deleteRecord(person));
19
- * ```
20
- *
21
- * **Supplying Options to Modify the Request Behavior**
22
- *
23
- * The following options are supported:
24
- *
25
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
26
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
27
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
28
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
29
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
30
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
31
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
32
- * defaulting to `false` if none is configured.
33
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
34
- *
35
- * ```ts
36
- * import { deleteRecord } from '@ember-data/rest/request';
37
- *
38
- * const person = store.peekRecord('person', '1');
39
- *
40
- * // mark record as deleted
41
- * store.deleteRecord(person);
42
- *
43
- * // persist deletion
44
- * const options = deleteRecord(person, { namespace: 'api/v1' });
45
- * const data = await store.request(options);
46
- * ```
47
- *
48
- * @method deleteRecord
49
- * @public
50
- * @static
51
- * @for @ember-data/rest/request
52
- * @param record
53
- * @param options
54
- */
55
- export function deleteRecord<T>(record: T, options?: ConstrainedRequestOptions): DeleteRequestOptions<T>;
56
- export function deleteRecord(record: unknown, options?: ConstrainedRequestOptions): DeleteRequestOptions;
57
- /**
58
- * Builds request options to create new record for resources,
59
- * configured for the url, method and header expectations of most REST APIs.
60
- *
61
- * **Basic Usage**
62
- *
63
- * ```ts
64
- * import { createRecord } from '@ember-data/rest/request';
65
- *
66
- * const person = store.createRecord('person', { name: 'Ted' });
67
- * const data = await store.request(createRecord(person));
68
- * ```
69
- *
70
- * **Supplying Options to Modify the Request Behavior**
71
- *
72
- * The following options are supported:
73
- *
74
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
75
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
76
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
77
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
78
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
79
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
80
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
81
- * defaulting to `false` if none is configured.
82
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
83
- *
84
- * ```ts
85
- * import { createRecord } from '@ember-data/rest/request';
86
- *
87
- * const person = store.createRecord('person', { name: 'Ted' });
88
- * const options = createRecord(person, { namespace: 'api/v1' });
89
- * const data = await store.request(options);
90
- * ```
91
- *
92
- * @method createRecord
93
- * @public
94
- * @static
95
- * @for @ember-data/rest/request
96
- * @param record
97
- * @param options
98
- */
99
- export function createRecord<T>(record: T, options?: ConstrainedRequestOptions): CreateRequestOptions<T>;
100
- export function createRecord(record: unknown, options?: ConstrainedRequestOptions): CreateRequestOptions;
101
- /**
102
- * Builds request options to update existing record for resources,
103
- * configured for the url, method and header expectations of most REST APIs.
104
- *
105
- * **Basic Usage**
106
- *
107
- * ```ts
108
- * import { updateRecord } from '@ember-data/rest/request';
109
- *
110
- * const person = store.peekRecord('person', '1');
111
- * person.name = 'Chris';
112
- * const data = await store.request(updateRecord(person));
113
- * ```
114
- *
115
- * **Supplying Options to Modify the Request Behavior**
116
- *
117
- * The following options are supported:
118
- *
119
- * - `patch` - Allows caller to specify whether to use a PATCH request instead of a PUT request, defaults to `false`.
120
- * - `host` - The host to use for the request, defaults to the `host` configured with `setBuildURLConfig`.
121
- * - `namespace` - The namespace to use for the request, defaults to the `namespace` configured with `setBuildURLConfig`.
122
- * - `resourcePath` - The resource path to use for the request, defaults to pluralizing the supplied type
123
- * - `reload` - Whether to forcibly reload the request if it is already in the store, not supplying this
124
- * option will delegate to the store's CachePolicy, defaulting to `false` if none is configured.
125
- * - `backgroundReload` - Whether to reload the request if it is already in the store, but to also resolve the
126
- * promise with the cached value, not supplying this option will delegate to the store's CachePolicy,
127
- * defaulting to `false` if none is configured.
128
- * - `urlParamsSetting` - an object containing options for how to serialize the query params (see `buildQueryParams`)
129
- *
130
- * ```ts
131
- * import { updateRecord } from '@ember-data/rest/request';
132
- *
133
- * const person = store.peekRecord('person', '1');
134
- * person.name = 'Chris';
135
- * const options = updateRecord(person, { patch: true });
136
- * const data = await store.request(options);
137
- * ```
138
- *
139
- * @method updateRecord
140
- * @public
141
- * @static
142
- * @for @ember-data/rest/request
143
- * @param record
144
- * @param options
145
- */
146
- export function updateRecord<T>(record: T, options?: ConstrainedRequestOptions & {
147
- patch?: boolean;
148
- }): UpdateRequestOptions<T>;
149
- export function updateRecord(record: unknown, options?: ConstrainedRequestOptions & {
150
- patch?: boolean;
151
- }): UpdateRequestOptions;
152
- }
153
- //# sourceMappingURL=save-record.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"save-record.d.ts","sourceRoot":"","sources":["../../../src/-private/builders/save-record.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAQxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AACzG,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,oBAAoB,CAAC;AA8BzG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AACzG,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,oBAAoB,CAAC;AA6BzG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,EACT,OAAO,CAAC,EAAE,yBAAyB,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACxD,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3B,wBAAgB,YAAY,CAC1B,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,yBAAyB,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACxD,oBAAoB,CAAC"}