core-services-sdk 1.3.36 → 1.3.38
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 +2 -2
- package/src/fastify/error-codes.js +2 -4
- package/src/fastify/error-handlers/with-error-handling.js +5 -6
- package/src/http/HttpError.js +10 -29
- package/src/http/http.js +2 -3
- package/tests/fastify/error-handler.unit.test.js +3 -11
- package/tests/fastify/error-handlers/with-error-handling.test.js +3 -6
- package/tests/http/HttpError.unit.test.js +13 -17
- package/tsconfig.json +3 -1
- package/types/core/combine-unique-arrays.d.ts +1 -1
- package/types/core/index.d.ts +9 -9
- package/types/core/normalize-array-operators.d.ts +1 -1
- package/types/core/normalize-min-max.d.ts +16 -10
- package/types/core/normalize-phone-number.d.ts +30 -24
- package/types/core/normalize-premitives-types-or-default.d.ts +17 -4
- package/types/core/normalize-to-array.d.ts +1 -1
- package/types/core/otp-generators.d.ts +22 -18
- package/types/core/regex-utils.d.ts +1 -1
- package/types/core/sanitize-objects.d.ts +13 -4
- package/types/crypto/crypto.d.ts +31 -18
- package/types/crypto/encryption.d.ts +14 -6
- package/types/crypto/index.d.ts +2 -2
- package/types/fastify/error-codes.d.ts +11 -16
- package/types/fastify/error-handlers/with-error-handling.d.ts +26 -15
- package/types/fastify/index.d.ts +2 -2
- package/types/http/HttpError.d.ts +67 -76
- package/types/http/http-method.d.ts +6 -6
- package/types/http/http.d.ts +58 -34
- package/types/http/index.d.ts +4 -4
- package/types/http/responseType.d.ts +6 -6
- package/types/ids/generators.d.ts +28 -28
- package/types/ids/index.d.ts +2 -2
- package/types/ids/prefixes.d.ts +54 -54
- package/types/index.d.ts +11 -11
- package/types/logger/get-logger.d.ts +23 -21
- package/types/logger/index.d.ts +1 -1
- package/types/mailer/index.d.ts +2 -2
- package/types/mailer/mailer.service.d.ts +29 -19
- package/types/mailer/transport.factory.d.ts +43 -43
- package/types/mongodb/connect.d.ts +12 -7
- package/types/mongodb/dsl-to-mongo.d.ts +2 -1
- package/types/mongodb/index.d.ts +5 -5
- package/types/mongodb/initialize-mongodb.d.ts +18 -13
- package/types/mongodb/paginate.d.ts +23 -13
- package/types/mongodb/validate-mongo-uri.d.ts +1 -1
- package/types/rabbit-mq/index.d.ts +1 -1
- package/types/rabbit-mq/rabbit-mq.d.ts +62 -37
- package/types/templates/index.d.ts +1 -1
- package/types/templates/template-loader.d.ts +7 -3
- package/types/util/context.d.ts +53 -53
- package/types/util/index.d.ts +6 -6
- package/types/util/mask-sensitive.d.ts +14 -2
package/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
1
|
+
export * from './core/index.js'
|
|
2
|
+
export * from './crypto/index.js'
|
|
3
|
+
export * from './fastify/index.js'
|
|
4
|
+
export * from './http/index.js'
|
|
5
|
+
export * from './ids/index.js'
|
|
6
|
+
export * from './mongodb/index.js'
|
|
7
|
+
export * from './logger/index.js'
|
|
8
|
+
export * from './mailer/index.js'
|
|
9
|
+
export * from './rabbit-mq/index.js'
|
|
10
|
+
export * from './templates/index.js'
|
|
11
|
+
export * from './util/index.js'
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
export function getLogger(
|
|
1
|
+
export function getLogger(
|
|
2
|
+
option: true | any | undefined,
|
|
3
|
+
): import('pino').Logger | typeof dummyLogger
|
|
2
4
|
declare namespace dummyLogger {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
function info(): void
|
|
6
|
+
function warn(): void
|
|
7
|
+
function trace(): void
|
|
8
|
+
function debug(): void
|
|
9
|
+
function error(): void
|
|
10
|
+
function fatal(): void
|
|
11
|
+
function levels(): void
|
|
12
|
+
function silent(): void
|
|
13
|
+
function child(): {
|
|
14
|
+
info: () => void
|
|
15
|
+
warn: () => void
|
|
16
|
+
trace: () => void
|
|
17
|
+
debug: () => void
|
|
18
|
+
error: () => void
|
|
19
|
+
fatal: () => void
|
|
20
|
+
levels: () => void
|
|
21
|
+
silent: () => void
|
|
22
|
+
child(): /*elided*/ any
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
|
-
export {}
|
|
25
|
+
export {}
|
package/types/logger/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './get-logger.js'
|
package/types/mailer/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function initMailer(config: any): Mailer
|
|
2
|
-
import { Mailer } from './mailer.service.js'
|
|
1
|
+
export function initMailer(config: any): Mailer
|
|
2
|
+
import { Mailer } from './mailer.service.js'
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
export class Mailer {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @param {object} transporter - Nodemailer transporter instance
|
|
4
|
+
*/
|
|
5
|
+
constructor(transporter: object)
|
|
6
|
+
transporter: any
|
|
7
|
+
/**
|
|
8
|
+
* Send an email
|
|
9
|
+
*/
|
|
10
|
+
send({
|
|
11
|
+
to,
|
|
12
|
+
subject,
|
|
13
|
+
html,
|
|
14
|
+
text,
|
|
15
|
+
from,
|
|
16
|
+
cc,
|
|
17
|
+
bcc,
|
|
18
|
+
replyTo,
|
|
19
|
+
attachments,
|
|
20
|
+
}: {
|
|
21
|
+
to: any
|
|
22
|
+
subject: any
|
|
23
|
+
html: any
|
|
24
|
+
text: any
|
|
25
|
+
from: any
|
|
26
|
+
cc: any
|
|
27
|
+
bcc: any
|
|
28
|
+
replyTo: any
|
|
29
|
+
attachments: any
|
|
30
|
+
}): Promise<any>
|
|
21
31
|
}
|
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
* Factory for creating email transporters based on configuration.
|
|
3
3
|
*/
|
|
4
4
|
export class TransportFactory {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Create a Nodemailer transporter
|
|
7
|
+
*
|
|
8
|
+
* @param {object} config - Transport configuration object
|
|
9
|
+
* @param {'smtp' | 'gmail' | 'sendgrid' | 'ses'} config.type - Type of email transport
|
|
10
|
+
*
|
|
11
|
+
* For type 'smtp':
|
|
12
|
+
* @param {string} config.host - SMTP server host
|
|
13
|
+
* @param {number} config.port - SMTP server port
|
|
14
|
+
* @param {boolean} config.secure - Use TLS
|
|
15
|
+
* @param {{ user: string, pass: string }} config.auth - SMTP auth credentials
|
|
16
|
+
*
|
|
17
|
+
* For type 'gmail':
|
|
18
|
+
* @param {{ user: string, pass: string }} config.auth - Gmail credentials
|
|
19
|
+
*
|
|
20
|
+
* For type 'sendgrid':
|
|
21
|
+
* @param {string} config.apiKey - SendGrid API key
|
|
22
|
+
*
|
|
23
|
+
* For type 'ses':
|
|
24
|
+
* @param {string} config.accessKeyId - AWS access key
|
|
25
|
+
* @param {string} config.secretAccessKey - AWS secret
|
|
26
|
+
* @param {string} config.region - AWS region
|
|
27
|
+
*
|
|
28
|
+
* @returns {import('nodemailer').Transporter | typeof import('@sendgrid/mail')}
|
|
29
|
+
*/
|
|
30
|
+
static create(config: {
|
|
31
|
+
type: 'smtp' | 'gmail' | 'sendgrid' | 'ses'
|
|
32
|
+
host: string
|
|
33
|
+
port: number
|
|
34
|
+
secure: boolean
|
|
35
|
+
auth: {
|
|
36
|
+
user: string
|
|
37
|
+
pass: string
|
|
38
|
+
}
|
|
39
|
+
auth: {
|
|
40
|
+
user: string
|
|
41
|
+
pass: string
|
|
42
|
+
}
|
|
43
|
+
apiKey: string
|
|
44
|
+
accessKeyId: string
|
|
45
|
+
secretAccessKey: string
|
|
46
|
+
region: string
|
|
47
|
+
}): any | typeof import('@sendgrid/mail')
|
|
48
48
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
export function mongoConnect({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
export function mongoConnect({
|
|
2
|
+
uri,
|
|
3
|
+
serverApi,
|
|
4
|
+
timeout,
|
|
5
|
+
retries,
|
|
6
|
+
}: {
|
|
7
|
+
uri: string
|
|
8
|
+
serverApi?: object
|
|
9
|
+
timeout?: number
|
|
10
|
+
retries?: number
|
|
11
|
+
}): Promise<MongoClient>
|
|
12
|
+
import { MongoClient } from 'mongodb'
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
* @param {Record<string, any>} query - normalized DSL query
|
|
5
5
|
* @returns {Record<string, any>} - MongoDB query object
|
|
6
6
|
*/
|
|
7
|
-
export function toMongo(query?: Record<string, any>): Record<string, any
|
|
7
|
+
export function toMongo(query?: Record<string, any>): Record<string, any>
|
|
8
|
+
export function castIsoDates(obj: any): any
|
package/types/mongodb/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './connect.js'
|
|
2
|
+
export * from './paginate.js'
|
|
3
|
+
export * from './dsl-to-mongo.js'
|
|
4
|
+
export * from './initialize-mongodb.js'
|
|
5
|
+
export * from './validate-mongo-uri.js'
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
export function initializeMongoDb({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export function initializeMongoDb({
|
|
2
|
+
config,
|
|
3
|
+
collectionNames,
|
|
4
|
+
}: {
|
|
5
|
+
config: {
|
|
6
|
+
uri: string
|
|
7
|
+
options: {
|
|
8
|
+
dbName: string
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
collectionNames: Record<string, string>
|
|
12
|
+
}): Promise<
|
|
13
|
+
Record<string, import('mongodb').Collection> & {
|
|
14
|
+
withTransaction: <T>(action: {
|
|
15
|
+
session: import('mongodb').ClientSession
|
|
16
|
+
}) => Promise<T>
|
|
17
|
+
}
|
|
18
|
+
>
|
|
@@ -9,16 +9,26 @@
|
|
|
9
9
|
* @param {'asc'|'desc'} [options.order='asc']
|
|
10
10
|
* @param {number} [options.limit=10]
|
|
11
11
|
*/
|
|
12
|
-
export function paginate(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
order
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
export function paginate(
|
|
13
|
+
collection: import('mongodb').Collection,
|
|
14
|
+
{
|
|
15
|
+
limit,
|
|
16
|
+
projection,
|
|
17
|
+
filter,
|
|
18
|
+
cursor,
|
|
19
|
+
order,
|
|
20
|
+
cursorField,
|
|
21
|
+
}?: {
|
|
22
|
+
filter?: any
|
|
23
|
+
cursorField?: string
|
|
24
|
+
cursor?: string | Date | ObjectId
|
|
25
|
+
order?: 'asc' | 'desc'
|
|
26
|
+
limit?: number
|
|
27
|
+
},
|
|
28
|
+
): Promise<{
|
|
29
|
+
order: 'asc' | 'desc'
|
|
30
|
+
list: import('mongodb').WithId<import('bson').Document>[]
|
|
31
|
+
previous: any
|
|
32
|
+
next: any
|
|
33
|
+
}>
|
|
34
|
+
import { ObjectId } from 'mongodb'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './rabbit-mq.js'
|
|
@@ -1,40 +1,65 @@
|
|
|
1
|
-
export function connectQueueService({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
nackOnError?: boolean;
|
|
15
|
-
prefetch?: number;
|
|
16
|
-
}): Promise<void>;
|
|
17
|
-
export function initializeQueue({ host, log }: {
|
|
18
|
-
host: string;
|
|
19
|
-
log: import("pino").Logger;
|
|
1
|
+
export function connectQueueService({
|
|
2
|
+
host,
|
|
3
|
+
log,
|
|
4
|
+
}: {
|
|
5
|
+
host: string
|
|
6
|
+
log: import('pino').Logger
|
|
7
|
+
}): Promise<amqp.Connection>
|
|
8
|
+
export function createChannel({
|
|
9
|
+
host,
|
|
10
|
+
log,
|
|
11
|
+
}: {
|
|
12
|
+
host: string
|
|
13
|
+
log: import('pino').Logger
|
|
20
14
|
}): Promise<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
channel: amqp.Channel
|
|
16
|
+
connection: amqp.Connection
|
|
17
|
+
}>
|
|
18
|
+
export function subscribeToQueue({
|
|
19
|
+
log,
|
|
20
|
+
queue,
|
|
21
|
+
channel,
|
|
22
|
+
prefetch,
|
|
23
|
+
onReceive,
|
|
24
|
+
nackOnError,
|
|
25
|
+
}: {
|
|
26
|
+
channel: any
|
|
27
|
+
queue: string
|
|
28
|
+
onReceive: (data: any, correlationId?: string) => Promise<void>
|
|
29
|
+
log: import('pino').Logger
|
|
30
|
+
nackOnError?: boolean
|
|
31
|
+
prefetch?: number
|
|
32
|
+
}): Promise<string>
|
|
33
|
+
export function initializeQueue({
|
|
34
|
+
host,
|
|
35
|
+
log,
|
|
36
|
+
}: {
|
|
37
|
+
host: string
|
|
38
|
+
log: import('pino').Logger
|
|
39
|
+
}): Promise<{
|
|
40
|
+
publish: (
|
|
41
|
+
queue: string,
|
|
42
|
+
data: any,
|
|
43
|
+
correlationId?: string,
|
|
44
|
+
) => Promise<boolean>
|
|
45
|
+
subscribe: (options: {
|
|
46
|
+
queue: string
|
|
47
|
+
onReceive: (data: any, correlationId?: string) => Promise<void>
|
|
48
|
+
nackOnError?: boolean
|
|
49
|
+
}) => Promise<string>
|
|
50
|
+
channel: amqp.Channel
|
|
51
|
+
connection: amqp.Connection
|
|
52
|
+
close: () => Promise<void>
|
|
53
|
+
}>
|
|
29
54
|
export function rabbitUriFromEnv(env: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}): string
|
|
55
|
+
RABBIT_HOST: string
|
|
56
|
+
RABBIT_PORT: string | number
|
|
57
|
+
RABBIT_USERNAME: string
|
|
58
|
+
RABBIT_PASSWORD: string
|
|
59
|
+
RABBIT_PROTOCOL?: string
|
|
60
|
+
}): string
|
|
36
61
|
export type Log = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
62
|
+
info: (obj: any, msg?: string) => void
|
|
63
|
+
error: (obj: any, msg?: string) => void
|
|
64
|
+
debug: (obj: any, msg?: string) => void
|
|
65
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './template-loader.js'
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export function isItFile(filePathOrString: string): Promise<boolean
|
|
2
|
-
export function getTemplateContent(
|
|
3
|
-
|
|
1
|
+
export function isItFile(filePathOrString: string): Promise<boolean>
|
|
2
|
+
export function getTemplateContent(
|
|
3
|
+
maybeFilePathOrString: string,
|
|
4
|
+
): Promise<string>
|
|
5
|
+
export function loadTemplates(
|
|
6
|
+
templateSet: Record<string, string>,
|
|
7
|
+
): Promise<Record<string, (params: Record<string, any>) => string>>
|
package/types/util/context.d.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
export namespace Context {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Run a callback within a given context store.
|
|
4
|
+
* Everything `await`ed or invoked inside this callback will have access
|
|
5
|
+
* to the provided store via {@link Context.get}, {@link Context.set}, or {@link Context.all}.
|
|
6
|
+
*
|
|
7
|
+
* @template T
|
|
8
|
+
* @param {Record<string, any>} store
|
|
9
|
+
* @param {() => T} callback - Function to execute inside the context.
|
|
10
|
+
* @returns {T} The return value of the callback (sync or async).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* Context.run(
|
|
14
|
+
* { correlationId: 'abc123' },
|
|
15
|
+
* async () => {
|
|
16
|
+
* console.log(Context.get('correlationId')) // "abc123"
|
|
17
|
+
* }
|
|
18
|
+
* )
|
|
19
|
+
*/
|
|
20
|
+
function run<T>(store: Record<string, any>, callback: () => T): T
|
|
21
|
+
/**
|
|
22
|
+
* Retrieve a single value from the current async context store.
|
|
23
|
+
*
|
|
24
|
+
* @template T
|
|
25
|
+
* @param {string} key - The key of the value to retrieve.
|
|
26
|
+
* @returns {T|undefined} The stored value, or `undefined` if no store exists or key not found.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const userId = Context.get('userId')
|
|
30
|
+
*/
|
|
31
|
+
function get<T>(key: string): T | undefined
|
|
32
|
+
/**
|
|
33
|
+
* Set a single key-value pair in the current async context store.
|
|
34
|
+
* If there is no active store (i.e. outside of a {@link Context.run}),
|
|
35
|
+
* this function does nothing.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} key - The key under which to store the value.
|
|
38
|
+
* @param {any} value - The value to store.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* Context.set('tenantId', 'tnt_1234')
|
|
42
|
+
*/
|
|
43
|
+
function set(key: string, value: any): void
|
|
44
|
+
/**
|
|
45
|
+
* Get the entire store object for the current async context.
|
|
46
|
+
*
|
|
47
|
+
* @returns {Record<string, any>} The current store object,
|
|
48
|
+
* or an empty object if no store exists.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const all = Context.all()
|
|
52
|
+
* console.log(all) // { correlationId: 'abc123', userId: 'usr_789' }
|
|
53
|
+
*/
|
|
54
|
+
function all(): Record<string, any>
|
|
55
55
|
}
|
package/types/util/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export namespace util {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export { mask }
|
|
3
|
+
export { maskSingle }
|
|
4
4
|
}
|
|
5
|
-
export { Context } from
|
|
6
|
-
import { mask } from './mask-sensitive.js'
|
|
7
|
-
import { maskSingle } from './mask-sensitive.js'
|
|
8
|
-
export { mask, maskSingle }
|
|
5
|
+
export { Context } from './context.js'
|
|
6
|
+
import { mask } from './mask-sensitive.js'
|
|
7
|
+
import { maskSingle } from './mask-sensitive.js'
|
|
8
|
+
export { mask, maskSingle }
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
export function maskSingle(
|
|
2
|
-
|
|
1
|
+
export function maskSingle(
|
|
2
|
+
value: string | number | boolean | null | undefined,
|
|
3
|
+
fill?: string,
|
|
4
|
+
maskLen?: number,
|
|
5
|
+
left?: number,
|
|
6
|
+
right?: number,
|
|
7
|
+
): string
|
|
8
|
+
export function mask(
|
|
9
|
+
value: string | number | boolean | any[] | any | null | undefined,
|
|
10
|
+
fill?: string,
|
|
11
|
+
maskLen?: number,
|
|
12
|
+
left?: number,
|
|
13
|
+
right?: number,
|
|
14
|
+
): string | any[] | any
|