@ember-data-types/active-record 5.6.0-alpha.14 → 5.6.0-alpha.17
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,71 +1,71 @@
|
|
|
1
1
|
declare module '@ember-data/active-record/request' {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export { findRecord, query, deleteRecord, createRecord, updateRecord } from
|
|
70
|
-
|
|
71
|
-
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*This package provides utilities for working with [ActiveRecord](https://guides.rubyonrails.org/active_record_basics.html#convention-over-configuration-in-active-record) APIs.
|
|
6
|
+
*
|
|
7
|
+
* ## Installation
|
|
8
|
+
*
|
|
9
|
+
* Install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)
|
|
10
|
+
*
|
|
11
|
+
* ::: code-group
|
|
12
|
+
*
|
|
13
|
+
* ```sh [pnpm]
|
|
14
|
+
* pnpm add -E @ember-data/active-record
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ```sh [npm]
|
|
18
|
+
* npm add -E @ember-data/active-record
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ```sh [yarn]
|
|
22
|
+
* yarn add -E @ember-data/active-record
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ```sh [bun]
|
|
26
|
+
* bun add --exact @ember-data/active-record
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* :::
|
|
30
|
+
*
|
|
31
|
+
* ## Usage
|
|
32
|
+
*
|
|
33
|
+
* Request builders are functions that produce [Fetch Options](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
|
|
34
|
+
* They take a few contextual inputs about the request you want to make, abstracting away the gnarlier details.
|
|
35
|
+
*
|
|
36
|
+
* For instance, to construct a request that would fetch a resource from your API:
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { findRecord } from '@ember-data/active-record/request';
|
|
40
|
+
*
|
|
41
|
+
* const options = findRecord('ember-developer', '1', { include: ['pets', 'friends'] });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* This would produce the following request object:
|
|
45
|
+
*
|
|
46
|
+
* ```js
|
|
47
|
+
* {
|
|
48
|
+
* url: 'https://api.example.com/v1/ember_developers/1?include=friends,pets',
|
|
49
|
+
* method: 'GET',
|
|
50
|
+
* headers: <Headers>, // 'Accept': 'application/json;charset=utf-8'
|
|
51
|
+
* op: 'findRecord';
|
|
52
|
+
* records: [{ type: 'ember-developer', id: '1' }]
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* Request builder output may be used with either `requestManager.request` or `store.request`.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* const data = await store.request(options);
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* URLs are stable. The same query will produce the same URL every time, even if the order of keys in
|
|
63
|
+
* the query or values in an array changes.
|
|
64
|
+
*
|
|
65
|
+
* URLs follow the most common ActiveRecord format (underscored pluralized resource types).
|
|
66
|
+
*
|
|
67
|
+
* @module
|
|
68
|
+
*/
|
|
69
|
+
export { findRecord, query, deleteRecord, createRecord, updateRecord } from "@warp-drive/utilities/active-record";
|
|
70
|
+
|
|
71
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC"}
|