strapi-plugin-magic-mail 2.3.5 → 2.3.7
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/server/index.js +21 -11
- package/dist/server/index.mjs +21 -11
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -5543,7 +5543,7 @@ function requireOauth() {
|
|
|
5543
5543
|
});
|
|
5544
5544
|
return oauth;
|
|
5545
5545
|
}
|
|
5546
|
-
const version = "2.3.
|
|
5546
|
+
const version = "2.3.6";
|
|
5547
5547
|
const require$$2 = {
|
|
5548
5548
|
version
|
|
5549
5549
|
};
|
|
@@ -5975,21 +5975,31 @@ function requireEmailDesigner() {
|
|
|
5975
5975
|
});
|
|
5976
5976
|
},
|
|
5977
5977
|
/**
|
|
5978
|
-
* Get template by numeric ID (
|
|
5979
|
-
*
|
|
5980
|
-
* so we use entityService as fallback for numeric IDs
|
|
5978
|
+
* Get template by numeric ID (supports both templateReferenceId and internal db id)
|
|
5979
|
+
* First tries templateReferenceId, then falls back to internal database id via entityService
|
|
5981
5980
|
*/
|
|
5982
5981
|
async findById(id) {
|
|
5983
|
-
|
|
5984
|
-
|
|
5982
|
+
const numericId = Number(id);
|
|
5983
|
+
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by numeric ID: ${numericId}`);
|
|
5984
|
+
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
5985
|
+
filters: { templateReferenceId: numericId },
|
|
5986
|
+
limit: 1,
|
|
5985
5987
|
populate: ["versions"]
|
|
5986
5988
|
});
|
|
5987
|
-
if (
|
|
5988
|
-
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by
|
|
5989
|
-
|
|
5990
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${id} not found`);
|
|
5989
|
+
if (byRefId.length > 0) {
|
|
5990
|
+
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by templateReferenceId ${numericId}: documentId=${byRefId[0].documentId}, name="${byRefId[0].name}"`);
|
|
5991
|
+
return byRefId[0];
|
|
5991
5992
|
}
|
|
5992
|
-
|
|
5993
|
+
strapi2.log.info(`[magic-mail] [FALLBACK] templateReferenceId not found, trying internal db id: ${numericId}`);
|
|
5994
|
+
const byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
5995
|
+
populate: ["versions"]
|
|
5996
|
+
});
|
|
5997
|
+
if (byInternalId) {
|
|
5998
|
+
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by internal id ${numericId}: documentId=${byInternalId.documentId}, name="${byInternalId.name}"`);
|
|
5999
|
+
return byInternalId;
|
|
6000
|
+
}
|
|
6001
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal id)`);
|
|
6002
|
+
return null;
|
|
5993
6003
|
},
|
|
5994
6004
|
/**
|
|
5995
6005
|
* Get template by reference ID
|
package/dist/server/index.mjs
CHANGED
|
@@ -5533,7 +5533,7 @@ function requireOauth() {
|
|
|
5533
5533
|
});
|
|
5534
5534
|
return oauth;
|
|
5535
5535
|
}
|
|
5536
|
-
const version = "2.3.
|
|
5536
|
+
const version = "2.3.6";
|
|
5537
5537
|
const require$$2 = {
|
|
5538
5538
|
version
|
|
5539
5539
|
};
|
|
@@ -5965,21 +5965,31 @@ function requireEmailDesigner() {
|
|
|
5965
5965
|
});
|
|
5966
5966
|
},
|
|
5967
5967
|
/**
|
|
5968
|
-
* Get template by numeric ID (
|
|
5969
|
-
*
|
|
5970
|
-
* so we use entityService as fallback for numeric IDs
|
|
5968
|
+
* Get template by numeric ID (supports both templateReferenceId and internal db id)
|
|
5969
|
+
* First tries templateReferenceId, then falls back to internal database id via entityService
|
|
5971
5970
|
*/
|
|
5972
5971
|
async findById(id) {
|
|
5973
|
-
|
|
5974
|
-
|
|
5972
|
+
const numericId = Number(id);
|
|
5973
|
+
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by numeric ID: ${numericId}`);
|
|
5974
|
+
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
5975
|
+
filters: { templateReferenceId: numericId },
|
|
5976
|
+
limit: 1,
|
|
5975
5977
|
populate: ["versions"]
|
|
5976
5978
|
});
|
|
5977
|
-
if (
|
|
5978
|
-
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by
|
|
5979
|
-
|
|
5980
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${id} not found`);
|
|
5979
|
+
if (byRefId.length > 0) {
|
|
5980
|
+
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by templateReferenceId ${numericId}: documentId=${byRefId[0].documentId}, name="${byRefId[0].name}"`);
|
|
5981
|
+
return byRefId[0];
|
|
5981
5982
|
}
|
|
5982
|
-
|
|
5983
|
+
strapi2.log.info(`[magic-mail] [FALLBACK] templateReferenceId not found, trying internal db id: ${numericId}`);
|
|
5984
|
+
const byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
5985
|
+
populate: ["versions"]
|
|
5986
|
+
});
|
|
5987
|
+
if (byInternalId) {
|
|
5988
|
+
strapi2.log.info(`[magic-mail] [SUCCESS] Found template by internal id ${numericId}: documentId=${byInternalId.documentId}, name="${byInternalId.name}"`);
|
|
5989
|
+
return byInternalId;
|
|
5990
|
+
}
|
|
5991
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal id)`);
|
|
5992
|
+
return null;
|
|
5983
5993
|
},
|
|
5984
5994
|
/**
|
|
5985
5995
|
* Get template by reference ID
|
package/package.json
CHANGED