@smartsoft001/domain-core 2.62.0 → 2.65.0
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/.eslintrc.json +3 -0
- package/README.md +23 -18
- package/package.json +3 -3
- package/src/lib/repositories.ts +3 -3
package/.eslintrc.json
CHANGED
package/README.md
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
`npm i @smartsoft001/domain-core`
|
|
6
6
|
|
|
7
7
|
## Repositories
|
|
8
|
+
|
|
8
9
|
### IItemRepository
|
|
10
|
+
|
|
9
11
|
**create** - Creates a new entity in the storage system.
|
|
10
12
|
|
|
11
13
|
<table>
|
|
@@ -91,7 +93,7 @@ returns a `Promise<void>` that resolves when the entity is successfully updated.
|
|
|
91
93
|
</tr>
|
|
92
94
|
</thead>
|
|
93
95
|
<tr>
|
|
94
|
-
<td>item:
|
|
96
|
+
<td>item:
|
|
95
97
|
|
|
96
98
|
`Partial<T>& { id: string }`
|
|
97
99
|
|
|
@@ -124,7 +126,7 @@ returns a `Promise<void>` that resolves when the entity is successfully updated.
|
|
|
124
126
|
<td>The criteria used to select the entities to be updated.</td>
|
|
125
127
|
</tr>
|
|
126
128
|
<tr>
|
|
127
|
-
<td>set:
|
|
129
|
+
<td>set:
|
|
128
130
|
|
|
129
131
|
`Partial<T>`
|
|
130
132
|
|
|
@@ -157,7 +159,7 @@ returns a `Promise<void>` that resolves when the entities are successfully updat
|
|
|
157
159
|
<td>The specification used to select the entities to be updated.</td>
|
|
158
160
|
</tr>
|
|
159
161
|
<tr>
|
|
160
|
-
<td>set:
|
|
162
|
+
<td>set:
|
|
161
163
|
|
|
162
164
|
`Partial<T>`
|
|
163
165
|
|
|
@@ -315,7 +317,7 @@ returns a `Promise<void>` that resolves when the storage system is cleared.
|
|
|
315
317
|
|
|
316
318
|
returns a `Observable<any>` that emits changes to the matching entities.
|
|
317
319
|
|
|
318
|
-
### IAttachmentRepository
|
|
320
|
+
### IAttachmentRepository
|
|
319
321
|
|
|
320
322
|
**upload** - Uploads a file to the storage system.
|
|
321
323
|
|
|
@@ -351,7 +353,7 @@ returns a `Observable<any>` that emits changes to the matching entities.
|
|
|
351
353
|
<td>The encoding of the file.</td>
|
|
352
354
|
</tr>
|
|
353
355
|
<tr>
|
|
354
|
-
<td>options?:
|
|
356
|
+
<td>options?:
|
|
355
357
|
|
|
356
358
|
`{ streamCallback?: (r: any) => void }`
|
|
357
359
|
|
|
@@ -370,17 +372,20 @@ const repository = new MongoAttachmentRepository(config);
|
|
|
370
372
|
|
|
371
373
|
const fileStream = fs.createReadStream('/path/to/file');
|
|
372
374
|
|
|
373
|
-
await repository.upload(
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
375
|
+
await repository.upload(
|
|
376
|
+
{
|
|
377
|
+
id: 'unique-file-id',
|
|
378
|
+
fileName: 'example.txt',
|
|
379
|
+
stream: fileStream,
|
|
380
|
+
mimeType: 'text/plain',
|
|
381
|
+
encoding: 'utf-8',
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
streamCallback: (writeStream) => {
|
|
385
|
+
console.log('Upload started');
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
);
|
|
384
389
|
|
|
385
390
|
console.log('File uploaded successfully');
|
|
386
391
|
```
|
|
@@ -400,7 +405,7 @@ console.log('File uploaded successfully');
|
|
|
400
405
|
</tr>
|
|
401
406
|
</table>
|
|
402
407
|
|
|
403
|
-
returns a `Promise<{ fileName: string, contentType: string, length: number } | null>` that resolves to an object
|
|
408
|
+
returns a `Promise<{ fileName: string, contentType: string, length: number } | null>` that resolves to an object
|
|
404
409
|
containing file metadata, or `null` if the file is not found.
|
|
405
410
|
|
|
406
411
|
throws an error if retrieving the file information fails.
|
|
@@ -419,7 +424,7 @@ throws an error if retrieving the file information fails.
|
|
|
419
424
|
<td>The unique identifier of the file.</td>
|
|
420
425
|
</tr>
|
|
421
426
|
<tr>
|
|
422
|
-
<td>options?:
|
|
427
|
+
<td>options?:
|
|
423
428
|
|
|
424
429
|
`{ start: number; end: number }`
|
|
425
430
|
|
package/package.json
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"type": "commonjs",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"rxjs": "^7.8.1",
|
|
6
|
-
"@smartsoft001/models": "^2.
|
|
7
|
-
"@smartsoft001/users": "^2.
|
|
6
|
+
"@smartsoft001/models": "^2.65.0",
|
|
7
|
+
"@smartsoft001/users": "^2.65.0"
|
|
8
8
|
},
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.65.0",
|
|
10
10
|
"main": "./src/index.js",
|
|
11
11
|
"typings": "./src/index.d.ts"
|
|
12
12
|
}
|
package/src/lib/repositories.ts
CHANGED
|
@@ -96,7 +96,7 @@ export abstract class IItemRepository<T extends IEntity<string>> {
|
|
|
96
96
|
*/
|
|
97
97
|
abstract create(
|
|
98
98
|
item: T,
|
|
99
|
-
user: IUser,
|
|
99
|
+
user: IUser | null,
|
|
100
100
|
options?: IItemRepositoryOptions,
|
|
101
101
|
): Promise<void>;
|
|
102
102
|
|
|
@@ -126,7 +126,7 @@ export abstract class IItemRepository<T extends IEntity<string>> {
|
|
|
126
126
|
*/
|
|
127
127
|
abstract update(
|
|
128
128
|
item: T,
|
|
129
|
-
user: IUser,
|
|
129
|
+
user: IUser | null,
|
|
130
130
|
options?: IItemRepositoryOptions,
|
|
131
131
|
): Promise<void>;
|
|
132
132
|
|
|
@@ -141,7 +141,7 @@ export abstract class IItemRepository<T extends IEntity<string>> {
|
|
|
141
141
|
*/
|
|
142
142
|
abstract updatePartial(
|
|
143
143
|
item: Partial<T> & { id: string },
|
|
144
|
-
user: IUser,
|
|
144
|
+
user: IUser | null,
|
|
145
145
|
options?: IItemRepositoryOptions,
|
|
146
146
|
): Promise<void>;
|
|
147
147
|
|