@fonoster/identity 0.22.3 → 0.22.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.
@@ -49,7 +49,9 @@ function createCreateApiKey(prisma) {
49
49
  role,
50
50
  accessKeyId: (0, generateAccessKeyId_1.generateAccessKeyId)(generateAccessKeyId_1.AccessKeyIdType.API_KEY),
51
51
  accessKeySecret: (0, generateAccessKeySecret_1.generateAccessKeySecret)(),
52
- expiresAt: expiresAt ? new Date(expiresAt) : null
52
+ // expiresAt arrives as epoch seconds (the wire field is int32, which
53
+ // can't hold epoch milliseconds).
54
+ expiresAt: expiresAt ? new Date(expiresAt * 1000) : null
53
55
  }
54
56
  });
55
57
  callback(null, {
@@ -50,7 +50,11 @@ function createListApiKeys(prisma) {
50
50
  skip: pageToken ? 1 : 0,
51
51
  cursor: pageToken ? { ref: pageToken } : undefined
52
52
  });
53
- const items = keys.map((key) => (Object.assign(Object.assign({}, key), { role: key.role })));
53
+ // The wire fields are int32, so timestamps travel as epoch seconds
54
+ // rather than the millisecond Date values Prisma returns.
55
+ const items = keys.map((key) => (Object.assign(Object.assign({}, key), { role: key.role, expiresAt: key.expiresAt
56
+ ? Math.floor(key.expiresAt.getTime() / 1000)
57
+ : undefined, createdAt: Math.floor(key.createdAt.getTime() / 1000), updatedAt: Math.floor(key.updatedAt.getTime() / 1000) })));
54
58
  const response = {
55
59
  items,
56
60
  nextPageToken: items.length < pageSize ? "" : (_a = items[items.length - 1]) === null || _a === void 0 ? void 0 : _a.ref
@@ -29,10 +29,12 @@ exports.createSendVerificationCode = createSendVerificationCode;
29
29
  * limitations under the License.
30
30
  */
31
31
  const common_1 = require("@fonoster/common");
32
+ const logger_1 = require("@fonoster/logger");
32
33
  const createGenerateVerificationCode_1 = require("../utils/createGenerateVerificationCode");
33
34
  const sendVerificationEmail_1 = require("./sendVerificationEmail");
34
35
  const sendVerificationMessage_1 = require("./sendVerificationMessage");
35
36
  const types_1 = require("./types");
37
+ const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
36
38
  function createSendVerificationCode(prisma, identityConfig) {
37
39
  const sendSms = (0, common_1.createSendSmsTwilioImpl)(identityConfig.twilioSmsConfig);
38
40
  const sendEmail = (0, common_1.createSendEmail)(identityConfig.smtpConfig);
@@ -49,6 +51,11 @@ function createSendVerificationCode(prisma, identityConfig) {
49
51
  (0, sendVerificationEmail_1.sendVerificationEmail)(sendEmail, {
50
52
  recipient: request.value,
51
53
  verificationCode
54
+ }).catch((error) => {
55
+ logger.error("failed to send verification email", {
56
+ recipient: request.value,
57
+ error: error instanceof Error ? error.message : error
58
+ });
52
59
  });
53
60
  }
54
61
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/identity",
3
- "version": "0.22.3",
3
+ "version": "0.22.7",
4
4
  "description": "Identity service for Fonoster",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@fonoster/common": "^0.22.3",
27
27
  "@fonoster/logger": "^0.22.0",
28
- "@fonoster/types": "^0.22.0",
28
+ "@fonoster/types": "^0.22.7",
29
29
  "@grpc/grpc-js": "~1.10.6",
30
30
  "@prisma/client": "^6.8.2",
31
31
  "express": "^5.0.1",
@@ -55,5 +55,5 @@
55
55
  "@types/jsonwebtoken": "^9.0.6",
56
56
  "prisma": "^6.8.2"
57
57
  },
58
- "gitHead": "2123e04933b54d78c9e93e64102ec89dc6fb79b6"
58
+ "gitHead": "af2404e51a423e45e59515282495ecdec27e0eed"
59
59
  }