@punks/backend-entity-manager 0.0.450 → 0.0.452
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/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/export.d.ts +2 -1
- package/dist/cjs/types/abstractions/serializer.d.ts +1 -1
- package/dist/cjs/types/commands/export.d.ts +1 -1
- package/dist/esm/index.js +5 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/export.d.ts +2 -1
- package/dist/esm/types/abstractions/serializer.d.ts +1 -1
- package/dist/esm/types/commands/export.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -14,9 +14,10 @@ export type EntitiesExportResult = {
|
|
|
14
14
|
file: EntitiesExportFile;
|
|
15
15
|
downloadUrl: string;
|
|
16
16
|
};
|
|
17
|
-
export type EntitiesExportInput<TEntity, TEntitySearchParameters extends IEntitySearchParameters<TEntity, TSorting, TCursor>, TSorting extends SortingType, TCursor> = {
|
|
17
|
+
export type EntitiesExportInput<TEntity, TEntitySearchParameters extends IEntitySearchParameters<TEntity, TSorting, TCursor>, TSorting extends SortingType, TCursor, TPayload = unknown> = {
|
|
18
18
|
filter?: TEntitySearchParameters;
|
|
19
19
|
options: EntitiesExportOptions;
|
|
20
|
+
payload?: TPayload;
|
|
20
21
|
};
|
|
21
22
|
export type EntityExportBucketSettings = {
|
|
22
23
|
bucket: string;
|
|
@@ -76,7 +76,7 @@ export type ImportEntry<TSheetItem, TEntityId> = {
|
|
|
76
76
|
export interface IEntitySerializer<TEntity, TEntityId, TEntitySearchParameters, TSheetItem, TPayload = unknown> {
|
|
77
77
|
export(filters?: TEntitySearchParameters): Promise<TSheetItem[]>;
|
|
78
78
|
import(items: TSheetItem[], payload?: TPayload): Promise<void>;
|
|
79
|
-
serialize(items: TSheetItem[], format: EntitySerializationFormat): Promise<EntityExportFile>;
|
|
79
|
+
serialize(items: TSheetItem[], format: EntitySerializationFormat, payload?: TPayload): Promise<EntityExportFile>;
|
|
80
80
|
parse<TPayload>(data: Buffer, format: EntitySerializationFormat, payload?: TPayload): Promise<ImportEntry<TSheetItem, TEntityId>[]>;
|
|
81
81
|
createSample(format: EntitySerializationFormat): Promise<EntityExportFile>;
|
|
82
82
|
}
|
|
@@ -8,7 +8,7 @@ export declare class EntitiesExportCommand<TEntity, TEntitySearchParameters exte
|
|
|
8
8
|
private readonly services;
|
|
9
9
|
private readonly settings;
|
|
10
10
|
constructor(services: EntityServiceLocator<TEntity, unknown>, settings: EntitiesImportExportSettings);
|
|
11
|
-
execute(input: EntitiesExportInput<TEntity, TEntitySearchParameters, TSorting, TCursor>): Promise<EntitiesExportResult>;
|
|
11
|
+
execute<TPayload>(input: EntitiesExportInput<TEntity, TEntitySearchParameters, TSorting, TCursor, TPayload>): Promise<EntitiesExportResult>;
|
|
12
12
|
private buildExportFile;
|
|
13
13
|
private uploadExportFile;
|
|
14
14
|
private buildAbsoluteBucketPath;
|
package/dist/esm/index.js
CHANGED
|
@@ -895,7 +895,7 @@ class EntitiesExportCommand {
|
|
|
895
895
|
}
|
|
896
896
|
async execute(input) {
|
|
897
897
|
const sheetItems = await this.getExportSheetItems(input.filter);
|
|
898
|
-
const outputFile = await this.buildExportFile(sheetItems, input.options.format);
|
|
898
|
+
const outputFile = await this.buildExportFile(sheetItems, input.options.format, input.payload);
|
|
899
899
|
const downloadUrl = await this.uploadExportFile(outputFile);
|
|
900
900
|
return {
|
|
901
901
|
downloadUrl,
|
|
@@ -906,8 +906,10 @@ class EntitiesExportCommand {
|
|
|
906
906
|
},
|
|
907
907
|
};
|
|
908
908
|
}
|
|
909
|
-
async buildExportFile(data, format) {
|
|
910
|
-
return await this.services
|
|
909
|
+
async buildExportFile(data, format, payload) {
|
|
910
|
+
return await this.services
|
|
911
|
+
.resolveSerializer()
|
|
912
|
+
.serialize(data, format, payload);
|
|
911
913
|
}
|
|
912
914
|
async uploadExportFile(file) {
|
|
913
915
|
await this.bucket.fileUpload({
|