@punks/backend-entity-manager 0.0.406 → 0.0.408
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 +34 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-invitation-send/index.d.ts +4 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +4 -1
- package/dist/cjs/types/platforms/nest/services/export/service.d.ts +7 -1
- package/dist/esm/index.js +34 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-invitation-send/index.d.ts +4 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +4 -1
- package/dist/esm/types/platforms/nest/services/export/service.d.ts +7 -1
- package/dist/index.d.ts +14 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -22865,14 +22865,18 @@ exports.DataExportService = class DataExportService {
|
|
|
22865
22865
|
}
|
|
22866
22866
|
async exportData(data, input) {
|
|
22867
22867
|
const file = await this.extractData(data, input);
|
|
22868
|
-
const downloadUrl = await this.uploadExportFile(file, {
|
|
22868
|
+
const { downloadUrl, fileName } = await this.uploadExportFile(file, {
|
|
22869
22869
|
dataName: input.dataName,
|
|
22870
22870
|
fileName: input.fileName,
|
|
22871
22871
|
format: input.format,
|
|
22872
22872
|
});
|
|
22873
22873
|
return {
|
|
22874
22874
|
downloadUrl,
|
|
22875
|
-
file
|
|
22875
|
+
file: {
|
|
22876
|
+
fileName,
|
|
22877
|
+
content: file.content,
|
|
22878
|
+
contentType: file.contentType,
|
|
22879
|
+
},
|
|
22876
22880
|
};
|
|
22877
22881
|
}
|
|
22878
22882
|
async extractData(data, input) {
|
|
@@ -22887,19 +22891,27 @@ exports.DataExportService = class DataExportService {
|
|
|
22887
22891
|
};
|
|
22888
22892
|
}
|
|
22889
22893
|
async uploadExportFile(file, { dataName, fileName, format, }) {
|
|
22890
|
-
const
|
|
22894
|
+
const fileNameWithExtension = this.buildExportFileName(fileName, format);
|
|
22895
|
+
const filePath = this.buildExportFilePath(dataName, fileNameWithExtension);
|
|
22891
22896
|
await this.defaultBucketProvider.fileUpload({
|
|
22892
22897
|
bucket: this.defaultFileProvider.defaultBucket,
|
|
22893
22898
|
filePath,
|
|
22894
22899
|
content: file.content,
|
|
22895
22900
|
contentType: file.contentType,
|
|
22896
22901
|
});
|
|
22897
|
-
|
|
22902
|
+
const downloadUrl = await this.defaultFileProvider.getFileProviderDownloadUrl({
|
|
22898
22903
|
reference: filePath,
|
|
22899
22904
|
});
|
|
22905
|
+
return {
|
|
22906
|
+
downloadUrl,
|
|
22907
|
+
fileName: fileNameWithExtension,
|
|
22908
|
+
};
|
|
22909
|
+
}
|
|
22910
|
+
buildExportFileName(fileName, format) {
|
|
22911
|
+
return `${fileName}.${format}`;
|
|
22900
22912
|
}
|
|
22901
|
-
buildExportFilePath(dataName, fileName
|
|
22902
|
-
return `/data-export/${dataName}/${backendCore.createDayPath(new Date())}/${backendCore.newUuid()}_${fileName}
|
|
22913
|
+
buildExportFilePath(dataName, fileName) {
|
|
22914
|
+
return `/data-export/${dataName}/${backendCore.createDayPath(new Date())}/${backendCore.newUuid()}_${fileName}`;
|
|
22903
22915
|
}
|
|
22904
22916
|
get defaultFileProvider() {
|
|
22905
22917
|
return this.registry
|
|
@@ -23753,18 +23765,20 @@ let UserInvitationSendHandler = class UserInvitationSendHandler {
|
|
|
23753
23765
|
if (!user) {
|
|
23754
23766
|
throw new Error(`User not found ${input.userId}`);
|
|
23755
23767
|
}
|
|
23756
|
-
await this.sendRegistrationEmail({
|
|
23757
|
-
user,
|
|
23758
|
-
callback: {
|
|
23759
|
-
tokenPlaceholder: input.callback.tokenPlaceholder,
|
|
23760
|
-
urlTemplate: input.callback.urlTemplate,
|
|
23761
|
-
},
|
|
23762
|
-
languageId: input.languageId,
|
|
23763
|
-
emailTemplateId: input.emailTemplateId,
|
|
23764
|
-
});
|
|
23765
|
-
}
|
|
23766
|
-
async sendRegistrationEmail({ user, callback, languageId, emailTemplateId, }) {
|
|
23767
23768
|
const token = await this.generateEmailVerifyToken(user);
|
|
23769
|
+
const callbackUrl = input.callback.urlTemplate.replace(input.callback.tokenPlaceholder, token);
|
|
23770
|
+
if (input.emailTemplateId) {
|
|
23771
|
+
await this.sendRegistrationEmail({
|
|
23772
|
+
user,
|
|
23773
|
+
callbackUrl,
|
|
23774
|
+
languageId: input.languageId,
|
|
23775
|
+
emailTemplateId: input.emailTemplateId,
|
|
23776
|
+
token,
|
|
23777
|
+
});
|
|
23778
|
+
}
|
|
23779
|
+
return { token, callbackUrl };
|
|
23780
|
+
}
|
|
23781
|
+
async sendRegistrationEmail({ user, callbackUrl, languageId, emailTemplateId, }) {
|
|
23768
23782
|
await this.emailService.sendTemplatedEmail({
|
|
23769
23783
|
to: [user.email],
|
|
23770
23784
|
templateId: emailTemplateId ?? AuthenticationEmailTemplates.Registration,
|
|
@@ -23772,7 +23786,7 @@ let UserInvitationSendHandler = class UserInvitationSendHandler {
|
|
|
23772
23786
|
payload: {
|
|
23773
23787
|
firstName: user.profile.firstName,
|
|
23774
23788
|
lastName: user.profile.lastName,
|
|
23775
|
-
callbackUrl
|
|
23789
|
+
callbackUrl,
|
|
23776
23790
|
},
|
|
23777
23791
|
});
|
|
23778
23792
|
}
|
|
@@ -23812,8 +23826,8 @@ exports.AuthenticationService = class AuthenticationService {
|
|
|
23812
23826
|
async userCreate(input) {
|
|
23813
23827
|
return await this.userCreationHandler.execute(input);
|
|
23814
23828
|
}
|
|
23815
|
-
async
|
|
23816
|
-
await this.userInvitationHandler.execute(input);
|
|
23829
|
+
async userInvite(input) {
|
|
23830
|
+
return await this.userInvitationHandler.execute(input);
|
|
23817
23831
|
}
|
|
23818
23832
|
async userDisable(input) {
|
|
23819
23833
|
await this.userDisableHandler.execute(input);
|