core-services-sdk 1.3.42 → 1.3.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-services-sdk",
3
- "version": "1.3.42",
3
+ "version": "1.3.44",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "types": "types/index.d.ts",
@@ -215,3 +215,11 @@ export const generateAlertId = () => generatePrefixedId(ID_PREFIXES.ALERT)
215
215
  * @returns {string} A resource ID.
216
216
  */
217
217
  export const generateResourceId = () => generatePrefixedId(ID_PREFIXES.RESOURCE)
218
+
219
+ /**
220
+ * Generates a resource ID with a `ieml_` prefix.
221
+ *
222
+ * @returns {string} An incoming email ID.
223
+ */
224
+ export const generateIncomingEmailId = () =>
225
+ generatePrefixedId(ID_PREFIXES.INCOMING_EMAIL)
@@ -85,4 +85,7 @@ export const ID_PREFIXES = Object.freeze({
85
85
 
86
86
  /** Resource entity ID prefix */
87
87
  RESOURCE: 'res',
88
+
89
+ /** Incoming email ID prefix */
90
+ INCOMING_EMAIL: 'ieml',
88
91
  })
@@ -21,7 +21,10 @@ const generateMsgId = () => `rbt_${ulid()}`
21
21
  */
22
22
  export const connectQueueService = async ({ host, log }) => {
23
23
  const t0 = Date.now()
24
- const logger = log.child({ op: 'connectQueueService', host: mask(host) })
24
+ const logger = log.child({
25
+ op: 'connectQueueService',
26
+ host: mask(host, '.', 3),
27
+ })
25
28
 
26
29
  try {
27
30
  logger.debug('start')
@@ -50,7 +53,7 @@ export const connectQueueService = async ({ host, log }) => {
50
53
  */
51
54
  export const createChannel = async ({ host, log }) => {
52
55
  const t0 = Date.now()
53
- const logger = log.child({ op: 'createChannel', host: mask(host) })
56
+ const logger = log.child({ op: 'createChannel', host: mask(host, '.', 3) })
54
57
 
55
58
  try {
56
59
  logger.debug('start')
@@ -175,7 +178,7 @@ export const subscribeToQueue = async ({
175
178
  */
176
179
  export const initializeQueue = async ({ host, log }) => {
177
180
  const { channel, connection } = await createChannel({ host, log })
178
- const logger = log.child({ op: 'initializeQueue', host: mask(host) })
181
+ const logger = log.child({ op: 'initializeQueue', host: mask(host, '.', 3) })
179
182
 
180
183
  /**
181
184
  * Publishes a message to a queue with a generated `rbt_<ulid>` ID.
@@ -1,6 +1,5 @@
1
1
  // @ts-nocheck
2
2
  import { describe, it, expect } from 'vitest'
3
-
4
3
  import { ID_PREFIXES } from '../../src/ids/prefixes.js'
5
4
 
6
5
  describe('ID_PREFIXES', () => {
@@ -32,6 +31,7 @@ describe('ID_PREFIXES', () => {
32
31
  DEVICE: 'dev',
33
32
  ALERT: 'alr',
34
33
  RESOURCE: 'res',
34
+ INCOMING_EMAIL: 'ieml', // ✅ added
35
35
  })
36
36
  })
37
37
 
@@ -87,4 +87,13 @@ describe('mask', () => {
87
87
  const value = mask(input, '*', 5)
88
88
  expect(value).toEqual(expected)
89
89
  })
90
+
91
+ it('mask long string with maskLen in recursive calls', () => {
92
+ const input = {
93
+ val: 'abcdsdkljhfjksdhgfjksdghkhsdkjfhasldkjjhskjfgsdkjhgfhskdgfefgh',
94
+ }
95
+ const expected = { val: 'ab***gh' }
96
+ const value = mask(input, '*', 3)
97
+ expect(value).toEqual(expected)
98
+ })
90
99
  })
@@ -26,3 +26,4 @@ export function generateProfileId(): string
26
26
  export function generateDeviceId(): string
27
27
  export function generateAlertId(): string
28
28
  export function generateResourceId(): string
29
+ export function generateIncomingEmailId(): string
@@ -67,4 +67,6 @@ export const ID_PREFIXES: Readonly<{
67
67
  ALERT: 'alr'
68
68
  /** Resource entity ID prefix */
69
69
  RESOURCE: 'res'
70
+ /** Incoming email ID prefix */
71
+ INCOMING_EMAIL: 'ieml'
70
72
  }>