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
package/docs/classes/Model.md
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
[entropic-bond](../README.md) / [Exports](../modules.md) / Model
|
|
2
|
-
|
|
3
|
-
# Class: Model<T\>
|
|
4
|
-
|
|
5
|
-
Provides abstraction to the database access. You should gain access to a Model
|
|
6
|
-
object through the Store.getModel method instead of its constructor.
|
|
7
|
-
|
|
8
|
-
## Type parameters
|
|
9
|
-
|
|
10
|
-
| Name | Type |
|
|
11
|
-
| :------ | :------ |
|
|
12
|
-
| `T` | extends [`Persistent`](Persistent.md) |
|
|
13
|
-
|
|
14
|
-
## Table of contents
|
|
15
|
-
|
|
16
|
-
### Constructors
|
|
17
|
-
|
|
18
|
-
- [constructor](Model.md#constructor)
|
|
19
|
-
|
|
20
|
-
### Properties
|
|
21
|
-
|
|
22
|
-
- [collectionName](Model.md#collectionname)
|
|
23
|
-
- [error](Model.md#error)
|
|
24
|
-
|
|
25
|
-
### Methods
|
|
26
|
-
|
|
27
|
-
- [count](Model.md#count)
|
|
28
|
-
- [delete](Model.md#delete)
|
|
29
|
-
- [find](Model.md#find)
|
|
30
|
-
- [findById](Model.md#findbyid)
|
|
31
|
-
- [next](Model.md#next)
|
|
32
|
-
- [query](Model.md#query)
|
|
33
|
-
- [save](Model.md#save)
|
|
34
|
-
|
|
35
|
-
## Constructors
|
|
36
|
-
|
|
37
|
-
### constructor
|
|
38
|
-
|
|
39
|
-
• **new Model**<`T`\>(`stream`, `persistentClass`, `subCollection?`)
|
|
40
|
-
|
|
41
|
-
#### Type parameters
|
|
42
|
-
|
|
43
|
-
| Name | Type |
|
|
44
|
-
| :------ | :------ |
|
|
45
|
-
| `T` | extends [`Persistent`](Persistent.md)<`T`\> |
|
|
46
|
-
|
|
47
|
-
#### Parameters
|
|
48
|
-
|
|
49
|
-
| Name | Type |
|
|
50
|
-
| :------ | :------ |
|
|
51
|
-
| `stream` | [`DataSource`](DataSource.md) |
|
|
52
|
-
| `persistentClass` | `string` \| [`Persistent`](Persistent.md) |
|
|
53
|
-
| `subCollection?` | `string` |
|
|
54
|
-
|
|
55
|
-
#### Defined in
|
|
56
|
-
|
|
57
|
-
[store/model.ts:12](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L12)
|
|
58
|
-
|
|
59
|
-
## Properties
|
|
60
|
-
|
|
61
|
-
### collectionName
|
|
62
|
-
|
|
63
|
-
• `Readonly` **collectionName**: `string`
|
|
64
|
-
|
|
65
|
-
#### Defined in
|
|
66
|
-
|
|
67
|
-
[store/model.ts:150](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L150)
|
|
68
|
-
|
|
69
|
-
___
|
|
70
|
-
|
|
71
|
-
### error
|
|
72
|
-
|
|
73
|
-
▪ `Static` **error**: `Object`
|
|
74
|
-
|
|
75
|
-
#### Type declaration
|
|
76
|
-
|
|
77
|
-
| Name | Type |
|
|
78
|
-
| :------ | :------ |
|
|
79
|
-
| `persistentNeedForSubCollection` | `string` |
|
|
80
|
-
|
|
81
|
-
#### Defined in
|
|
82
|
-
|
|
83
|
-
[store/model.ts:10](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L10)
|
|
84
|
-
|
|
85
|
-
## Methods
|
|
86
|
-
|
|
87
|
-
### count
|
|
88
|
-
|
|
89
|
-
▸ **count**(`queryObject`): `Promise`<`number`\>
|
|
90
|
-
|
|
91
|
-
Get the amount of documents matching the query
|
|
92
|
-
|
|
93
|
-
#### Parameters
|
|
94
|
-
|
|
95
|
-
| Name | Type | Description |
|
|
96
|
-
| :------ | :------ | :------ |
|
|
97
|
-
| `queryObject` | [`QueryObject`](../modules.md#queryobject)<`T`\> | the QueryObject with the search constrains |
|
|
98
|
-
|
|
99
|
-
#### Returns
|
|
100
|
-
|
|
101
|
-
`Promise`<`number`\>
|
|
102
|
-
|
|
103
|
-
a promise resolving to the amount of matched documents
|
|
104
|
-
|
|
105
|
-
#### Defined in
|
|
106
|
-
|
|
107
|
-
[store/model.ts:116](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L116)
|
|
108
|
-
|
|
109
|
-
___
|
|
110
|
-
|
|
111
|
-
### delete
|
|
112
|
-
|
|
113
|
-
▸ **delete**(`id`): `Promise`<`void`\>
|
|
114
|
-
|
|
115
|
-
Removes an element from the database by id
|
|
116
|
-
|
|
117
|
-
#### Parameters
|
|
118
|
-
|
|
119
|
-
| Name | Type | Description |
|
|
120
|
-
| :------ | :------ | :------ |
|
|
121
|
-
| `id` | `string` | the id of the element to be removed |
|
|
122
|
-
|
|
123
|
-
#### Returns
|
|
124
|
-
|
|
125
|
-
`Promise`<`void`\>
|
|
126
|
-
|
|
127
|
-
a promise
|
|
128
|
-
|
|
129
|
-
#### Defined in
|
|
130
|
-
|
|
131
|
-
[store/model.ts:79](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L79)
|
|
132
|
-
|
|
133
|
-
___
|
|
134
|
-
|
|
135
|
-
### find
|
|
136
|
-
|
|
137
|
-
▸ **find**<`U`\>(): `Query`<`U`\>
|
|
138
|
-
|
|
139
|
-
Call find to retrieve a Query object used to define the search conditions
|
|
140
|
-
|
|
141
|
-
#### Type parameters
|
|
142
|
-
|
|
143
|
-
| Name | Type |
|
|
144
|
-
| :------ | :------ |
|
|
145
|
-
| `U` | extends [`Persistent`](Persistent.md)<`U`\> |
|
|
146
|
-
|
|
147
|
-
#### Returns
|
|
148
|
-
|
|
149
|
-
`Query`<`U`\>
|
|
150
|
-
|
|
151
|
-
a Query object
|
|
152
|
-
|
|
153
|
-
#### Defined in
|
|
154
|
-
|
|
155
|
-
[store/model.ts:87](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L87)
|
|
156
|
-
|
|
157
|
-
___
|
|
158
|
-
|
|
159
|
-
### findById
|
|
160
|
-
|
|
161
|
-
▸ **findById**<`D`\>(`id`, `instance?`): `Promise`<`D`\>
|
|
162
|
-
|
|
163
|
-
Finds an stored object in the database by its id. The field id is provided
|
|
164
|
-
by the Persistent parent class and it is automatically managed. Therefore,
|
|
165
|
-
you should obtain the id by looking at the id field of the object.
|
|
166
|
-
|
|
167
|
-
#### Type parameters
|
|
168
|
-
|
|
169
|
-
| Name | Type |
|
|
170
|
-
| :------ | :------ |
|
|
171
|
-
| `D` | extends [`Persistent`](Persistent.md)<`D`\> |
|
|
172
|
-
|
|
173
|
-
#### Parameters
|
|
174
|
-
|
|
175
|
-
| Name | Type | Description |
|
|
176
|
-
| :------ | :------ | :------ |
|
|
177
|
-
| `id` | `string` | the id to look for |
|
|
178
|
-
| `instance?` | `D` | you can pass an instace that will be filled with the found data |
|
|
179
|
-
|
|
180
|
-
#### Returns
|
|
181
|
-
|
|
182
|
-
`Promise`<`D`\>
|
|
183
|
-
|
|
184
|
-
a promise resolving to an instance with the found data
|
|
185
|
-
|
|
186
|
-
#### Defined in
|
|
187
|
-
|
|
188
|
-
[store/model.ts:36](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L36)
|
|
189
|
-
|
|
190
|
-
___
|
|
191
|
-
|
|
192
|
-
### next
|
|
193
|
-
|
|
194
|
-
▸ **next**<`U`\>(`limit?`): `Promise`<`U`[]\>
|
|
195
|
-
|
|
196
|
-
Get the next bunch of documents matching the last query
|
|
197
|
-
|
|
198
|
-
#### Type parameters
|
|
199
|
-
|
|
200
|
-
| Name | Type |
|
|
201
|
-
| :------ | :------ |
|
|
202
|
-
| `U` | extends [`Persistent`](Persistent.md)<`U`\> |
|
|
203
|
-
|
|
204
|
-
#### Parameters
|
|
205
|
-
|
|
206
|
-
| Name | Type | Description |
|
|
207
|
-
| :------ | :------ | :------ |
|
|
208
|
-
| `limit?` | `number` | the max amount of documents to retrieve. If not set, uses the last limit set |
|
|
209
|
-
|
|
210
|
-
#### Returns
|
|
211
|
-
|
|
212
|
-
`Promise`<`U`[]\>
|
|
213
|
-
|
|
214
|
-
a promise resolving to a collection of matched documents
|
|
215
|
-
|
|
216
|
-
#### Defined in
|
|
217
|
-
|
|
218
|
-
[store/model.ts:126](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L126)
|
|
219
|
-
|
|
220
|
-
___
|
|
221
|
-
|
|
222
|
-
### query
|
|
223
|
-
|
|
224
|
-
▸ **query**<`U`\>(`queryObject?`, `objectType?`): `Promise`<`U`[]\>
|
|
225
|
-
|
|
226
|
-
Define the search conditions. You pass query operations and how the query
|
|
227
|
-
results are returned to the QueryObject
|
|
228
|
-
|
|
229
|
-
#### Type parameters
|
|
230
|
-
|
|
231
|
-
| Name | Type |
|
|
232
|
-
| :------ | :------ |
|
|
233
|
-
| `U` | extends [`Persistent`](Persistent.md)<`U`\> |
|
|
234
|
-
|
|
235
|
-
#### Parameters
|
|
236
|
-
|
|
237
|
-
| Name | Type | Description |
|
|
238
|
-
| :------ | :------ | :------ |
|
|
239
|
-
| `queryObject` | [`QueryObject`](../modules.md#queryobject)<`U`\> | the QueryObject with the search constrains |
|
|
240
|
-
| `objectType?` | `string` \| `U` | - |
|
|
241
|
-
|
|
242
|
-
#### Returns
|
|
243
|
-
|
|
244
|
-
`Promise`<`U`[]\>
|
|
245
|
-
|
|
246
|
-
a promise resolving to a collection of matched documents
|
|
247
|
-
|
|
248
|
-
#### Defined in
|
|
249
|
-
|
|
250
|
-
[store/model.ts:97](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L97)
|
|
251
|
-
|
|
252
|
-
___
|
|
253
|
-
|
|
254
|
-
### save
|
|
255
|
-
|
|
256
|
-
▸ **save**(`instance`): `Promise`<`void`\>
|
|
257
|
-
|
|
258
|
-
Stores an object in the database
|
|
259
|
-
|
|
260
|
-
#### Parameters
|
|
261
|
-
|
|
262
|
-
| Name | Type | Description |
|
|
263
|
-
| :------ | :------ | :------ |
|
|
264
|
-
| `instance` | `T` | the object instance to store |
|
|
265
|
-
|
|
266
|
-
#### Returns
|
|
267
|
-
|
|
268
|
-
`Promise`<`void`\>
|
|
269
|
-
|
|
270
|
-
a promise
|
|
271
|
-
|
|
272
|
-
#### Defined in
|
|
273
|
-
|
|
274
|
-
[store/model.ts:59](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/store/model.ts#L59)
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
[entropic-bond](../README.md) / [Exports](../modules.md) / Observable
|
|
2
|
-
|
|
3
|
-
# Class: Observable<T\>
|
|
4
|
-
|
|
5
|
-
Implements the Observer pattern.
|
|
6
|
-
The Observable class is used to notify a list of subscribers when an event occurs.
|
|
7
|
-
The subscribers are callback functions that are called when the event occurs.
|
|
8
|
-
The event is passed as a parameter to the callback function.
|
|
9
|
-
|
|
10
|
-
**`Example`**
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
// Create an observable
|
|
14
|
-
const observable = new Observable<number>()
|
|
15
|
-
// Subscribe a listener
|
|
16
|
-
const unsubscribe = observable.subscribe( event => console.log( event ) )
|
|
17
|
-
// Notify the subscribers
|
|
18
|
-
observable.notify( 1 )
|
|
19
|
-
// Unsubscribe the listener
|
|
20
|
-
unsubscribe()
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Type parameters
|
|
24
|
-
|
|
25
|
-
| Name |
|
|
26
|
-
| :------ |
|
|
27
|
-
| `T` |
|
|
28
|
-
|
|
29
|
-
## Table of contents
|
|
30
|
-
|
|
31
|
-
### Constructors
|
|
32
|
-
|
|
33
|
-
- [constructor](Observable.md#constructor)
|
|
34
|
-
|
|
35
|
-
### Methods
|
|
36
|
-
|
|
37
|
-
- [notify](Observable.md#notify)
|
|
38
|
-
- [subscribe](Observable.md#subscribe)
|
|
39
|
-
- [unsubscribe](Observable.md#unsubscribe)
|
|
40
|
-
|
|
41
|
-
## Constructors
|
|
42
|
-
|
|
43
|
-
### constructor
|
|
44
|
-
|
|
45
|
-
• **new Observable**<`T`\>()
|
|
46
|
-
|
|
47
|
-
#### Type parameters
|
|
48
|
-
|
|
49
|
-
| Name |
|
|
50
|
-
| :------ |
|
|
51
|
-
| `T` |
|
|
52
|
-
|
|
53
|
-
## Methods
|
|
54
|
-
|
|
55
|
-
### notify
|
|
56
|
-
|
|
57
|
-
▸ **notify**(`event?`): `void`
|
|
58
|
-
|
|
59
|
-
Notifies all the subscribers with the event passed as parameter.
|
|
60
|
-
|
|
61
|
-
#### Parameters
|
|
62
|
-
|
|
63
|
-
| Name | Type | Description |
|
|
64
|
-
| :------ | :------ | :------ |
|
|
65
|
-
| `event?` | `T` | the event passed to all subscribers. |
|
|
66
|
-
|
|
67
|
-
#### Returns
|
|
68
|
-
|
|
69
|
-
`void`
|
|
70
|
-
|
|
71
|
-
#### Defined in
|
|
72
|
-
|
|
73
|
-
[observable/observable.ts:47](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/observable/observable.ts#L47)
|
|
74
|
-
|
|
75
|
-
___
|
|
76
|
-
|
|
77
|
-
### subscribe
|
|
78
|
-
|
|
79
|
-
▸ **subscribe**(`callback`): [`Unsubscriber`](../modules.md#unsubscriber)
|
|
80
|
-
|
|
81
|
-
Subscribes a listener callback function. On every notification,
|
|
82
|
-
the listener callback will be called with an event as a parameter if sent.
|
|
83
|
-
|
|
84
|
-
#### Parameters
|
|
85
|
-
|
|
86
|
-
| Name | Type | Description |
|
|
87
|
-
| :------ | :------ | :------ |
|
|
88
|
-
| `callback` | [`Callback`](../modules.md#callback)<`T`\> | the listener callback |
|
|
89
|
-
|
|
90
|
-
#### Returns
|
|
91
|
-
|
|
92
|
-
[`Unsubscriber`](../modules.md#unsubscriber)
|
|
93
|
-
|
|
94
|
-
a function to unsubscribe the listener from further notifications
|
|
95
|
-
|
|
96
|
-
#### Defined in
|
|
97
|
-
|
|
98
|
-
[observable/observable.ts:28](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/observable/observable.ts#L28)
|
|
99
|
-
|
|
100
|
-
___
|
|
101
|
-
|
|
102
|
-
### unsubscribe
|
|
103
|
-
|
|
104
|
-
▸ **unsubscribe**(`callback`): `void`
|
|
105
|
-
|
|
106
|
-
Removes the callback from the notification list.
|
|
107
|
-
|
|
108
|
-
#### Parameters
|
|
109
|
-
|
|
110
|
-
| Name | Type |
|
|
111
|
-
| :------ | :------ |
|
|
112
|
-
| `callback` | [`Callback`](../modules.md#callback)<`T`\> |
|
|
113
|
-
|
|
114
|
-
#### Returns
|
|
115
|
-
|
|
116
|
-
`void`
|
|
117
|
-
|
|
118
|
-
#### Defined in
|
|
119
|
-
|
|
120
|
-
[observable/observable.ts:38](https://github.com/entropic-bond/entropic-bond/blob/c9dd385/src/observable/observable.ts#L38)
|