entropic-bond 1.50.0 → 1.50.1
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/lib/auth/auth-mock.d.ts +22 -0
- package/lib/auth/auth-mock.spec.d.ts +1 -0
- package/lib/auth/auth.d.ts +131 -0
- package/lib/auth/user-auth-types.d.ts +19 -0
- package/lib/cloud-functions/cloud-functions-mock.d.ts +11 -0
- package/lib/cloud-functions/cloud-functions-mock.spec.d.ts +1 -0
- package/lib/cloud-functions/cloud-functions.d.ts +19 -0
- package/lib/cloud-storage/cloud-storage.d.ts +24 -0
- package/lib/cloud-storage/cloud-storage.spec.d.ts +1 -0
- package/lib/cloud-storage/mock-cloud-storage.d.ts +20 -0
- package/lib/cloud-storage/stored-file.d.ts +39 -0
- package/lib/entropic-bond.js +1667 -0
- package/lib/entropic-bond.umd.cjs +7 -0
- package/lib/index.d.ts +19 -0
- package/lib/observable/observable.d.ts +52 -0
- package/lib/observable/observable.spec.d.ts +1 -0
- package/lib/persistent/entropic-component.d.ts +76 -0
- package/lib/persistent/entropic-component.spec.d.ts +1 -0
- package/lib/persistent/persistent.d.ts +281 -0
- package/lib/persistent/persistent.spec.d.ts +67 -0
- package/lib/server-auth/server-auth-mock.d.ts +12 -0
- package/lib/server-auth/server-auth-mock.spec.d.ts +1 -0
- package/lib/server-auth/server-auth.d.ts +24 -0
- package/lib/store/data-source.d.ts +137 -0
- package/lib/store/json-data-source.d.ts +68 -0
- package/lib/store/json-data-source.spec.d.ts +1 -0
- package/lib/store/mocks/test-user.d.ts +49 -0
- package/lib/store/model.d.ts +238 -0
- package/lib/store/model.spec.d.ts +1 -0
- package/lib/store/store.d.ts +62 -0
- package/lib/store/store.spec.d.ts +1 -0
- package/lib/types/utility-types.d.ts +45 -0
- package/lib/types/utility-types.spec.d.ts +1 -0
- package/lib/utils/test-utils/test-person.d.ts +33 -0
- package/{src/utils/utils.ts → lib/utils/utils.d.ts} +10 -34
- package/lib/utils/utils.spec.d.ts +1 -0
- package/package.json +4 -1
- package/.github/workflows/release.yml +0 -26
- package/CHANGELOG.md +0 -1151
- package/docs/.nojekyll +0 -1
- package/docs/README.md +0 -94
- package/docs/classes/Auth.md +0 -391
- package/docs/classes/AuthMock.md +0 -278
- package/docs/classes/AuthService.md +0 -188
- package/docs/classes/CloudFunctions.md +0 -123
- package/docs/classes/CloudFunctionsMock.md +0 -97
- package/docs/classes/CloudStorage.md +0 -215
- package/docs/classes/DataSource.md +0 -248
- package/docs/classes/EntropicComponent.md +0 -666
- package/docs/classes/JsonDataSource.md +0 -328
- package/docs/classes/MockCloudStorage.md +0 -279
- package/docs/classes/Model.md +0 -274
- package/docs/classes/Observable.md +0 -120
- package/docs/classes/Persistent.md +0 -420
- package/docs/classes/ServerAuth.md +0 -211
- package/docs/classes/ServerAuthMock.md +0 -176
- package/docs/classes/ServerAuthService.md +0 -130
- package/docs/classes/Store.md +0 -218
- package/docs/classes/StoredFile.md +0 -636
- package/docs/enums/StoredFileEvent.md +0 -41
- package/docs/interfaces/AuthError.md +0 -30
- package/docs/interfaces/CloudFunctionsService.md +0 -69
- package/docs/interfaces/Collection.md +0 -13
- package/docs/interfaces/CustomCredentials.md +0 -7
- package/docs/interfaces/DocumentReference.md +0 -49
- package/docs/interfaces/JsonRawData.md +0 -7
- package/docs/interfaces/SignData.md +0 -63
- package/docs/interfaces/StoreParams.md +0 -52
- package/docs/interfaces/StoredFileChange.md +0 -41
- package/docs/interfaces/UploadControl.md +0 -90
- package/docs/interfaces/UserCredentials.md +0 -113
- package/docs/interfaces/Values.md +0 -17
- package/docs/modules.md +0 -1273
- package/src/auth/auth-mock.spec.ts +0 -168
- package/src/auth/auth-mock.ts +0 -129
- package/src/auth/auth.ts +0 -185
- package/src/auth/user-auth-types.ts +0 -21
- package/src/cloud-functions/cloud-functions-mock.spec.ts +0 -136
- package/src/cloud-functions/cloud-functions-mock.ts +0 -23
- package/src/cloud-functions/cloud-functions.ts +0 -83
- package/src/cloud-storage/cloud-storage.spec.ts +0 -207
- package/src/cloud-storage/cloud-storage.ts +0 -60
- package/src/cloud-storage/mock-cloud-storage.ts +0 -72
- package/src/cloud-storage/stored-file.ts +0 -102
- package/src/index.ts +0 -19
- package/src/observable/observable.spec.ts +0 -105
- package/src/observable/observable.ts +0 -67
- package/src/persistent/entropic-component.spec.ts +0 -143
- package/src/persistent/entropic-component.ts +0 -135
- package/src/persistent/persistent.spec.ts +0 -828
- package/src/persistent/persistent.ts +0 -650
- package/src/server-auth/server-auth-mock.spec.ts +0 -53
- package/src/server-auth/server-auth-mock.ts +0 -45
- package/src/server-auth/server-auth.ts +0 -49
- package/src/store/data-source.ts +0 -186
- package/src/store/json-data-source.spec.ts +0 -100
- package/src/store/json-data-source.ts +0 -256
- package/src/store/mocks/mock-data.json +0 -155
- package/src/store/mocks/test-user.ts +0 -122
- package/src/store/model.spec.ts +0 -659
- package/src/store/model.ts +0 -462
- package/src/store/store.spec.ts +0 -30
- package/src/store/store.ts +0 -113
- package/src/types/utility-types.spec.ts +0 -117
- package/src/types/utility-types.ts +0 -116
- package/src/utils/test-utils/test-person.ts +0 -44
- package/src/utils/utils.spec.ts +0 -95
- package/tsconfig-build.json +0 -7
- package/tsconfig-cjs.json +0 -9
- package/tsconfig.json +0 -33
- package/vite.config.ts +0 -22
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
[entropic-bond](../README.md) / [Exports](../modules.md) / ServerAuthMock
|
|
2
|
-
|
|
3
|
-
# Class: ServerAuthMock
|
|
4
|
-
|
|
5
|
-
## Hierarchy
|
|
6
|
-
|
|
7
|
-
- [`ServerAuthService`](ServerAuthService.md)
|
|
8
|
-
|
|
9
|
-
↳ **`ServerAuthMock`**
|
|
10
|
-
|
|
11
|
-
## Table of contents
|
|
12
|
-
|
|
13
|
-
### Constructors
|
|
14
|
-
|
|
15
|
-
- [constructor](ServerAuthMock.md#constructor)
|
|
16
|
-
|
|
17
|
-
### Accessors
|
|
18
|
-
|
|
19
|
-
- [userCredentials](ServerAuthMock.md#usercredentials)
|
|
20
|
-
|
|
21
|
-
### Methods
|
|
22
|
-
|
|
23
|
-
- [deleteUser](ServerAuthMock.md#deleteuser)
|
|
24
|
-
- [getUser](ServerAuthMock.md#getuser)
|
|
25
|
-
- [setCustomCredentials](ServerAuthMock.md#setcustomcredentials)
|
|
26
|
-
- [updateUser](ServerAuthMock.md#updateuser)
|
|
27
|
-
|
|
28
|
-
## Constructors
|
|
29
|
-
|
|
30
|
-
### constructor
|
|
31
|
-
|
|
32
|
-
• **new ServerAuthMock**(`userCredentials`)
|
|
33
|
-
|
|
34
|
-
#### Parameters
|
|
35
|
-
|
|
36
|
-
| Name | Type |
|
|
37
|
-
| :------ | :------ |
|
|
38
|
-
| `userCredentials` | [`Collection`](../interfaces/Collection.md)<[`UserCredentials`](../interfaces/UserCredentials.md)<{}\>\> |
|
|
39
|
-
|
|
40
|
-
#### Overrides
|
|
41
|
-
|
|
42
|
-
[ServerAuthService](ServerAuthService.md).[constructor](ServerAuthService.md#constructor)
|
|
43
|
-
|
|
44
|
-
#### Defined in
|
|
45
|
-
|
|
46
|
-
[server-auth/server-auth-mock.ts:6](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth-mock.ts#L6)
|
|
47
|
-
|
|
48
|
-
## Accessors
|
|
49
|
-
|
|
50
|
-
### userCredentials
|
|
51
|
-
|
|
52
|
-
• `get` **userCredentials**(): [`Collection`](../interfaces/Collection.md)<[`UserCredentials`](../interfaces/UserCredentials.md)<{}\>\>
|
|
53
|
-
|
|
54
|
-
#### Returns
|
|
55
|
-
|
|
56
|
-
[`Collection`](../interfaces/Collection.md)<[`UserCredentials`](../interfaces/UserCredentials.md)<{}\>\>
|
|
57
|
-
|
|
58
|
-
#### Defined in
|
|
59
|
-
|
|
60
|
-
[server-auth/server-auth-mock.ts:39](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth-mock.ts#L39)
|
|
61
|
-
|
|
62
|
-
## Methods
|
|
63
|
-
|
|
64
|
-
### deleteUser
|
|
65
|
-
|
|
66
|
-
▸ **deleteUser**(`userId`): `Promise`<`void`\>
|
|
67
|
-
|
|
68
|
-
#### Parameters
|
|
69
|
-
|
|
70
|
-
| Name | Type |
|
|
71
|
-
| :------ | :------ |
|
|
72
|
-
| `userId` | `string` |
|
|
73
|
-
|
|
74
|
-
#### Returns
|
|
75
|
-
|
|
76
|
-
`Promise`<`void`\>
|
|
77
|
-
|
|
78
|
-
#### Overrides
|
|
79
|
-
|
|
80
|
-
[ServerAuthService](ServerAuthService.md).[deleteUser](ServerAuthService.md#deleteuser)
|
|
81
|
-
|
|
82
|
-
#### Defined in
|
|
83
|
-
|
|
84
|
-
[server-auth/server-auth-mock.ts:34](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth-mock.ts#L34)
|
|
85
|
-
|
|
86
|
-
___
|
|
87
|
-
|
|
88
|
-
### getUser
|
|
89
|
-
|
|
90
|
-
▸ **getUser**<`T`\>(`userId`): `Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
91
|
-
|
|
92
|
-
#### Type parameters
|
|
93
|
-
|
|
94
|
-
| Name | Type |
|
|
95
|
-
| :------ | :------ |
|
|
96
|
-
| `T` | extends [`CustomCredentials`](../interfaces/CustomCredentials.md) |
|
|
97
|
-
|
|
98
|
-
#### Parameters
|
|
99
|
-
|
|
100
|
-
| Name | Type |
|
|
101
|
-
| :------ | :------ |
|
|
102
|
-
| `userId` | `string` |
|
|
103
|
-
|
|
104
|
-
#### Returns
|
|
105
|
-
|
|
106
|
-
`Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
107
|
-
|
|
108
|
-
#### Overrides
|
|
109
|
-
|
|
110
|
-
[ServerAuthService](ServerAuthService.md).[getUser](ServerAuthService.md#getuser)
|
|
111
|
-
|
|
112
|
-
#### Defined in
|
|
113
|
-
|
|
114
|
-
[server-auth/server-auth-mock.ts:11](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth-mock.ts#L11)
|
|
115
|
-
|
|
116
|
-
___
|
|
117
|
-
|
|
118
|
-
### setCustomCredentials
|
|
119
|
-
|
|
120
|
-
▸ **setCustomCredentials**<`T`\>(`userId`, `customCredentials`): `Promise`<`void`\>
|
|
121
|
-
|
|
122
|
-
#### Type parameters
|
|
123
|
-
|
|
124
|
-
| Name | Type |
|
|
125
|
-
| :------ | :------ |
|
|
126
|
-
| `T` | extends [`CustomCredentials`](../interfaces/CustomCredentials.md) |
|
|
127
|
-
|
|
128
|
-
#### Parameters
|
|
129
|
-
|
|
130
|
-
| Name | Type |
|
|
131
|
-
| :------ | :------ |
|
|
132
|
-
| `userId` | `string` |
|
|
133
|
-
| `customCredentials` | `T` |
|
|
134
|
-
|
|
135
|
-
#### Returns
|
|
136
|
-
|
|
137
|
-
`Promise`<`void`\>
|
|
138
|
-
|
|
139
|
-
#### Overrides
|
|
140
|
-
|
|
141
|
-
[ServerAuthService](ServerAuthService.md).[setCustomCredentials](ServerAuthService.md#setcustomcredentials)
|
|
142
|
-
|
|
143
|
-
#### Defined in
|
|
144
|
-
|
|
145
|
-
[server-auth/server-auth-mock.ts:17](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth-mock.ts#L17)
|
|
146
|
-
|
|
147
|
-
___
|
|
148
|
-
|
|
149
|
-
### updateUser
|
|
150
|
-
|
|
151
|
-
▸ **updateUser**<`T`\>(`userId`, `credentials`): `Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
152
|
-
|
|
153
|
-
#### Type parameters
|
|
154
|
-
|
|
155
|
-
| Name | Type |
|
|
156
|
-
| :------ | :------ |
|
|
157
|
-
| `T` | extends [`CustomCredentials`](../interfaces/CustomCredentials.md) |
|
|
158
|
-
|
|
159
|
-
#### Parameters
|
|
160
|
-
|
|
161
|
-
| Name | Type |
|
|
162
|
-
| :------ | :------ |
|
|
163
|
-
| `userId` | `string` |
|
|
164
|
-
| `credentials` | `Partial`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\> |
|
|
165
|
-
|
|
166
|
-
#### Returns
|
|
167
|
-
|
|
168
|
-
`Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
169
|
-
|
|
170
|
-
#### Overrides
|
|
171
|
-
|
|
172
|
-
[ServerAuthService](ServerAuthService.md).[updateUser](ServerAuthService.md#updateuser)
|
|
173
|
-
|
|
174
|
-
#### Defined in
|
|
175
|
-
|
|
176
|
-
[server-auth/server-auth-mock.ts:24](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth-mock.ts#L24)
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
[entropic-bond](../README.md) / [Exports](../modules.md) / ServerAuthService
|
|
2
|
-
|
|
3
|
-
# Class: ServerAuthService
|
|
4
|
-
|
|
5
|
-
## Hierarchy
|
|
6
|
-
|
|
7
|
-
- **`ServerAuthService`**
|
|
8
|
-
|
|
9
|
-
↳ [`ServerAuth`](ServerAuth.md)
|
|
10
|
-
|
|
11
|
-
↳ [`ServerAuthMock`](ServerAuthMock.md)
|
|
12
|
-
|
|
13
|
-
## Table of contents
|
|
14
|
-
|
|
15
|
-
### Constructors
|
|
16
|
-
|
|
17
|
-
- [constructor](ServerAuthService.md#constructor)
|
|
18
|
-
|
|
19
|
-
### Methods
|
|
20
|
-
|
|
21
|
-
- [deleteUser](ServerAuthService.md#deleteuser)
|
|
22
|
-
- [getUser](ServerAuthService.md#getuser)
|
|
23
|
-
- [setCustomCredentials](ServerAuthService.md#setcustomcredentials)
|
|
24
|
-
- [updateUser](ServerAuthService.md#updateuser)
|
|
25
|
-
|
|
26
|
-
## Constructors
|
|
27
|
-
|
|
28
|
-
### constructor
|
|
29
|
-
|
|
30
|
-
• **new ServerAuthService**()
|
|
31
|
-
|
|
32
|
-
## Methods
|
|
33
|
-
|
|
34
|
-
### deleteUser
|
|
35
|
-
|
|
36
|
-
▸ `Abstract` **deleteUser**(`userId`): `Promise`<`void`\>
|
|
37
|
-
|
|
38
|
-
#### Parameters
|
|
39
|
-
|
|
40
|
-
| Name | Type |
|
|
41
|
-
| :------ | :------ |
|
|
42
|
-
| `userId` | `string` |
|
|
43
|
-
|
|
44
|
-
#### Returns
|
|
45
|
-
|
|
46
|
-
`Promise`<`void`\>
|
|
47
|
-
|
|
48
|
-
#### Defined in
|
|
49
|
-
|
|
50
|
-
[server-auth/server-auth.ts:11](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth.ts#L11)
|
|
51
|
-
|
|
52
|
-
___
|
|
53
|
-
|
|
54
|
-
### getUser
|
|
55
|
-
|
|
56
|
-
▸ `Abstract` **getUser**<`T`\>(`userId`): `Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
57
|
-
|
|
58
|
-
#### Type parameters
|
|
59
|
-
|
|
60
|
-
| Name | Type |
|
|
61
|
-
| :------ | :------ |
|
|
62
|
-
| `T` | extends [`CustomCredentials`](../interfaces/CustomCredentials.md) |
|
|
63
|
-
|
|
64
|
-
#### Parameters
|
|
65
|
-
|
|
66
|
-
| Name | Type |
|
|
67
|
-
| :------ | :------ |
|
|
68
|
-
| `userId` | `string` |
|
|
69
|
-
|
|
70
|
-
#### Returns
|
|
71
|
-
|
|
72
|
-
`Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
73
|
-
|
|
74
|
-
#### Defined in
|
|
75
|
-
|
|
76
|
-
[server-auth/server-auth.ts:9](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth.ts#L9)
|
|
77
|
-
|
|
78
|
-
___
|
|
79
|
-
|
|
80
|
-
### setCustomCredentials
|
|
81
|
-
|
|
82
|
-
▸ `Abstract` **setCustomCredentials**<`T`\>(`userId`, `customCredentials`): `Promise`<`void`\>
|
|
83
|
-
|
|
84
|
-
#### Type parameters
|
|
85
|
-
|
|
86
|
-
| Name | Type |
|
|
87
|
-
| :------ | :------ |
|
|
88
|
-
| `T` | extends [`CustomCredentials`](../interfaces/CustomCredentials.md) |
|
|
89
|
-
|
|
90
|
-
#### Parameters
|
|
91
|
-
|
|
92
|
-
| Name | Type |
|
|
93
|
-
| :------ | :------ |
|
|
94
|
-
| `userId` | `string` |
|
|
95
|
-
| `customCredentials` | `T` |
|
|
96
|
-
|
|
97
|
-
#### Returns
|
|
98
|
-
|
|
99
|
-
`Promise`<`void`\>
|
|
100
|
-
|
|
101
|
-
#### Defined in
|
|
102
|
-
|
|
103
|
-
[server-auth/server-auth.ts:8](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth.ts#L8)
|
|
104
|
-
|
|
105
|
-
___
|
|
106
|
-
|
|
107
|
-
### updateUser
|
|
108
|
-
|
|
109
|
-
▸ `Abstract` **updateUser**<`T`\>(`userId`, `credentials`): `Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
110
|
-
|
|
111
|
-
#### Type parameters
|
|
112
|
-
|
|
113
|
-
| Name | Type |
|
|
114
|
-
| :------ | :------ |
|
|
115
|
-
| `T` | extends [`CustomCredentials`](../interfaces/CustomCredentials.md) |
|
|
116
|
-
|
|
117
|
-
#### Parameters
|
|
118
|
-
|
|
119
|
-
| Name | Type |
|
|
120
|
-
| :------ | :------ |
|
|
121
|
-
| `userId` | `string` |
|
|
122
|
-
| `credentials` | `Partial`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\> |
|
|
123
|
-
|
|
124
|
-
#### Returns
|
|
125
|
-
|
|
126
|
-
`Promise`<[`UserCredentials`](../interfaces/UserCredentials.md)<`T`\>\>
|
|
127
|
-
|
|
128
|
-
#### Defined in
|
|
129
|
-
|
|
130
|
-
[server-auth/server-auth.ts:10](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/server-auth/server-auth.ts#L10)
|
package/docs/classes/Store.md
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
[entropic-bond](../README.md) / [Exports](../modules.md) / Store
|
|
2
|
-
|
|
3
|
-
# Class: Store
|
|
4
|
-
|
|
5
|
-
The store is the main entry point for the data access layer.
|
|
6
|
-
It provides methods to retrieve models for collections and subcollections.
|
|
7
|
-
It also provides methods to populate property references with actual data from the store.
|
|
8
|
-
You need to register a data source before using the store.
|
|
9
|
-
|
|
10
|
-
**`Example`**
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
// Register a data source
|
|
14
|
-
Store.useDataSource( new FirestoreDataSource( firebase.firestore() ) )
|
|
15
|
-
// Retrieve a model for a collection
|
|
16
|
-
const model = Store.getModel( 'User' )
|
|
17
|
-
// Retrieve a model for a subcollection
|
|
18
|
-
const model = Store.getModelForSubCollection( user, 'Posts' )
|
|
19
|
-
// Populate property references
|
|
20
|
-
const user = await Store.populate( user )
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Table of contents
|
|
24
|
-
|
|
25
|
-
### Properties
|
|
26
|
-
|
|
27
|
-
- [error](Store.md#error)
|
|
28
|
-
|
|
29
|
-
### Accessors
|
|
30
|
-
|
|
31
|
-
- [dataSource](Store.md#datasource)
|
|
32
|
-
|
|
33
|
-
### Methods
|
|
34
|
-
|
|
35
|
-
- [getModel](Store.md#getmodel)
|
|
36
|
-
- [getModelForSubCollection](Store.md#getmodelforsubcollection)
|
|
37
|
-
- [isPopulated](Store.md#ispopulated)
|
|
38
|
-
- [populate](Store.md#populate)
|
|
39
|
-
- [useDataSource](Store.md#usedatasource)
|
|
40
|
-
|
|
41
|
-
## Properties
|
|
42
|
-
|
|
43
|
-
### error
|
|
44
|
-
|
|
45
|
-
▪ `Static` **error**: `Object`
|
|
46
|
-
|
|
47
|
-
#### Type declaration
|
|
48
|
-
|
|
49
|
-
| Name | Type |
|
|
50
|
-
| :------ | :------ |
|
|
51
|
-
| `shouldBeRegistered` | `string` |
|
|
52
|
-
|
|
53
|
-
#### Defined in
|
|
54
|
-
|
|
55
|
-
[store/store.ts:23](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/store.ts#L23)
|
|
56
|
-
|
|
57
|
-
## Accessors
|
|
58
|
-
|
|
59
|
-
### dataSource
|
|
60
|
-
|
|
61
|
-
• `Static` `get` **dataSource**(): [`DataSource`](DataSource.md)
|
|
62
|
-
|
|
63
|
-
The data source currently used by the store
|
|
64
|
-
|
|
65
|
-
#### Returns
|
|
66
|
-
|
|
67
|
-
[`DataSource`](DataSource.md)
|
|
68
|
-
|
|
69
|
-
the data source
|
|
70
|
-
|
|
71
|
-
#### Defined in
|
|
72
|
-
|
|
73
|
-
[store/store.ts:38](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/store.ts#L38)
|
|
74
|
-
|
|
75
|
-
## Methods
|
|
76
|
-
|
|
77
|
-
### getModel
|
|
78
|
-
|
|
79
|
-
▸ `Static` **getModel**<`T`\>(`classId`): [`Model`](Model.md)<`T`\>
|
|
80
|
-
|
|
81
|
-
Retrieves a model for a collection
|
|
82
|
-
|
|
83
|
-
#### Type parameters
|
|
84
|
-
|
|
85
|
-
| Name | Type |
|
|
86
|
-
| :------ | :------ |
|
|
87
|
-
| `T` | extends [`Persistent`](Persistent.md)<`T`\> |
|
|
88
|
-
|
|
89
|
-
#### Parameters
|
|
90
|
-
|
|
91
|
-
| Name | Type | Description |
|
|
92
|
-
| :------ | :------ | :------ |
|
|
93
|
-
| `classId` | `string` \| `T` | the class name or an instance of the document type stored in the collection |
|
|
94
|
-
|
|
95
|
-
#### Returns
|
|
96
|
-
|
|
97
|
-
[`Model`](Model.md)<`T`\>
|
|
98
|
-
|
|
99
|
-
the model for the collection
|
|
100
|
-
|
|
101
|
-
#### Defined in
|
|
102
|
-
|
|
103
|
-
[store/store.ts:47](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/store.ts#L47)
|
|
104
|
-
|
|
105
|
-
___
|
|
106
|
-
|
|
107
|
-
### getModelForSubCollection
|
|
108
|
-
|
|
109
|
-
▸ `Static` **getModelForSubCollection**<`T`\>(`document`, `subCollection`): [`Model`](Model.md)<`T`\>
|
|
110
|
-
|
|
111
|
-
Retrieves a model for a subcollection
|
|
112
|
-
|
|
113
|
-
#### Type parameters
|
|
114
|
-
|
|
115
|
-
| Name | Type |
|
|
116
|
-
| :------ | :------ |
|
|
117
|
-
| `T` | extends [`Persistent`](Persistent.md)<`T`\> |
|
|
118
|
-
|
|
119
|
-
#### Parameters
|
|
120
|
-
|
|
121
|
-
| Name | Type | Description |
|
|
122
|
-
| :------ | :------ | :------ |
|
|
123
|
-
| `document` | [`Persistent`](Persistent.md) | the persistent object that owns the subcollection |
|
|
124
|
-
| `subCollection` | `string` | the name of the subcollection |
|
|
125
|
-
|
|
126
|
-
#### Returns
|
|
127
|
-
|
|
128
|
-
[`Model`](Model.md)<`T`\>
|
|
129
|
-
|
|
130
|
-
the model for the subcollection
|
|
131
|
-
|
|
132
|
-
#### Defined in
|
|
133
|
-
|
|
134
|
-
[store/store.ts:58](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/store.ts#L58)
|
|
135
|
-
|
|
136
|
-
___
|
|
137
|
-
|
|
138
|
-
### isPopulated
|
|
139
|
-
|
|
140
|
-
▸ `Static` **isPopulated**<`T`\>(`instance`): `boolean`
|
|
141
|
-
|
|
142
|
-
Checks if an instance is populated
|
|
143
|
-
|
|
144
|
-
#### Type parameters
|
|
145
|
-
|
|
146
|
-
| Name | Type |
|
|
147
|
-
| :------ | :------ |
|
|
148
|
-
| `T` | extends [`Persistent`](Persistent.md)<`T`\> |
|
|
149
|
-
|
|
150
|
-
#### Parameters
|
|
151
|
-
|
|
152
|
-
| Name | Type | Description |
|
|
153
|
-
| :------ | :------ | :------ |
|
|
154
|
-
| `instance` | `T` \| readonly `T`[] | the instance or array of instances to be checked |
|
|
155
|
-
|
|
156
|
-
#### Returns
|
|
157
|
-
|
|
158
|
-
`boolean`
|
|
159
|
-
|
|
160
|
-
true if the instance is populated
|
|
161
|
-
|
|
162
|
-
#### Defined in
|
|
163
|
-
|
|
164
|
-
[store/store.ts:100](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/store.ts#L100)
|
|
165
|
-
|
|
166
|
-
___
|
|
167
|
-
|
|
168
|
-
### populate
|
|
169
|
-
|
|
170
|
-
▸ `Static` **populate**<`T`\>(`instance`): `Promise`<`T`\>
|
|
171
|
-
|
|
172
|
-
Populates property references with actual data from the store.
|
|
173
|
-
It will not retrieve data if the instance is already populated
|
|
174
|
-
|
|
175
|
-
#### Type parameters
|
|
176
|
-
|
|
177
|
-
| Name | Type |
|
|
178
|
-
| :------ | :------ |
|
|
179
|
-
| `T` | extends [`Persistent`](Persistent.md) \| [`Persistent`](Persistent.md)[] |
|
|
180
|
-
|
|
181
|
-
#### Parameters
|
|
182
|
-
|
|
183
|
-
| Name | Type | Description |
|
|
184
|
-
| :------ | :------ | :------ |
|
|
185
|
-
| `instance` | `T` | the data to be populated. |
|
|
186
|
-
|
|
187
|
-
#### Returns
|
|
188
|
-
|
|
189
|
-
`Promise`<`T`\>
|
|
190
|
-
|
|
191
|
-
the populated instance
|
|
192
|
-
|
|
193
|
-
#### Defined in
|
|
194
|
-
|
|
195
|
-
[store/store.ts:69](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/store.ts#L69)
|
|
196
|
-
|
|
197
|
-
___
|
|
198
|
-
|
|
199
|
-
### useDataSource
|
|
200
|
-
|
|
201
|
-
▸ `Static` **useDataSource**(`dataSource`): `void`
|
|
202
|
-
|
|
203
|
-
Registers a data source to be used by the store.
|
|
204
|
-
You need to register a data source before using the store.
|
|
205
|
-
|
|
206
|
-
#### Parameters
|
|
207
|
-
|
|
208
|
-
| Name | Type | Description |
|
|
209
|
-
| :------ | :------ | :------ |
|
|
210
|
-
| `dataSource` | [`DataSource`](DataSource.md) | the data source to be used by the store |
|
|
211
|
-
|
|
212
|
-
#### Returns
|
|
213
|
-
|
|
214
|
-
`void`
|
|
215
|
-
|
|
216
|
-
#### Defined in
|
|
217
|
-
|
|
218
|
-
[store/store.ts:30](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/store.ts#L30)
|