core-services-sdk 1.3.43 → 1.3.45

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.43",
3
+ "version": "1.3.45",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "types": "types/index.d.ts",
@@ -223,3 +223,10 @@ export const generateResourceId = () => generatePrefixedId(ID_PREFIXES.RESOURCE)
223
223
  */
224
224
  export const generateIncomingEmailId = () =>
225
225
  generatePrefixedId(ID_PREFIXES.INCOMING_EMAIL)
226
+
227
+ /**
228
+ * Generates a resource ID with a `eml_` prefix.
229
+ *
230
+ * @returns {string} An Email ID.
231
+ */
232
+ export const generateEmailId = () => generatePrefixedId(ID_PREFIXES.EMAIL)
@@ -88,4 +88,7 @@ export const ID_PREFIXES = Object.freeze({
88
88
 
89
89
  /** Incoming email ID prefix */
90
90
  INCOMING_EMAIL: 'ieml',
91
+
92
+ /** Email ID prefix */
93
+ EMAIL: 'eml',
91
94
  })
@@ -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.
@@ -31,7 +31,8 @@ describe('ID_PREFIXES', () => {
31
31
  DEVICE: 'dev',
32
32
  ALERT: 'alr',
33
33
  RESOURCE: 'res',
34
- INCOMING_EMAIL: 'ieml', // ✅ added
34
+ INCOMING_EMAIL: 'ieml',
35
+ EMAIL: 'eml',
35
36
  })
36
37
  })
37
38
 
@@ -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
  })