@dynamic-labs-sdk/client 0.17.2 → 0.17.4
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/{InvalidParamError-Dc2HgrDm.esm.js → InvalidParamError-BgvcmQ36.esm.js} +53 -4
- package/dist/InvalidParamError-BgvcmQ36.esm.js.map +1 -0
- package/dist/{InvalidParamError-z_h8HyKL.cjs.js → InvalidParamError-CApg0dxd.cjs.js} +59 -4
- package/dist/InvalidParamError-CApg0dxd.cjs.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-DsYkBFyx.cjs.js → NotWaasWalletAccountError-C8iogcNm.cjs.js} +3 -3
- package/dist/{NotWaasWalletAccountError-DsYkBFyx.cjs.js.map → NotWaasWalletAccountError-C8iogcNm.cjs.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-B4xS_9HL.esm.js → NotWaasWalletAccountError-CfH6ZpRB.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-B4xS_9HL.esm.js.map → NotWaasWalletAccountError-CfH6ZpRB.esm.js.map} +1 -1
- package/dist/client/core/createCore/createCore.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCore.d.ts +10 -0
- package/dist/client/core/types/DynamicCore.d.ts.map +1 -1
- package/dist/client/types/DynamicClientConfig.d.ts +5 -0
- package/dist/client/types/DynamicClientConfig.d.ts.map +1 -1
- package/dist/core.cjs.js +5 -5
- package/dist/core.esm.js +5 -5
- package/dist/{getNetworkProviderFromNetworkId-CllkC31J.cjs.js → getNetworkProviderFromNetworkId-BP2AzuLE.cjs.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-CllkC31J.cjs.js.map → getNetworkProviderFromNetworkId-BP2AzuLE.cjs.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-DO13PEvc.esm.js → getNetworkProviderFromNetworkId-DoLT1yjR.esm.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-DO13PEvc.esm.js.map → getNetworkProviderFromNetworkId-DoLT1yjR.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DqmEBqI9.cjs.js → getSignedSessionId-CbNoTJxx.cjs.js} +3 -3
- package/dist/{getSignedSessionId-DqmEBqI9.cjs.js.map → getSignedSessionId-CbNoTJxx.cjs.js.map} +1 -1
- package/dist/{getSignedSessionId-BM05CMyp.esm.js → getSignedSessionId-np5XdQ1A.esm.js} +3 -3
- package/dist/{getSignedSessionId-BM05CMyp.esm.js.map → getSignedSessionId-np5XdQ1A.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-BK4IBZlH.cjs.js → getVerifiedCredentialForWalletAccount-BDXePo9t.cjs.js} +3 -3
- package/dist/{getVerifiedCredentialForWalletAccount-BK4IBZlH.cjs.js.map → getVerifiedCredentialForWalletAccount-BDXePo9t.cjs.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-57Omjjyi.esm.js → getVerifiedCredentialForWalletAccount-CyyHc2ec.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-57Omjjyi.esm.js.map → getVerifiedCredentialForWalletAccount-CyyHc2ec.esm.js.map} +1 -1
- package/dist/index.cjs.js +82 -57
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +82 -57
- package/dist/index.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-CXRaUbFE.esm.js → isMfaRequiredForAction-BtO6Xkeu.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CXRaUbFE.esm.js.map → isMfaRequiredForAction-BtO6Xkeu.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-BS239c-s.cjs.js → isMfaRequiredForAction-C84laGI8.cjs.js} +2 -2
- package/dist/{isMfaRequiredForAction-BS239c-s.cjs.js.map → isMfaRequiredForAction-C84laGI8.cjs.js.map} +1 -1
- package/dist/modules/apiClient/apiClient.types.d.ts +7 -0
- package/dist/modules/apiClient/apiClient.types.d.ts.map +1 -1
- package/dist/modules/apiClient/constants.d.ts +2 -0
- package/dist/modules/apiClient/constants.d.ts.map +1 -1
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/auth/getElevatedAccessToken/getElevatedAccessToken.d.ts +15 -8
- package/dist/modules/auth/getElevatedAccessToken/getElevatedAccessToken.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/deletePasskey/deletePasskey.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.d.ts.map +1 -1
- package/dist/modules/mfa/deleteMfaDevice/deleteMfaDevice.d.ts +6 -4
- package/dist/modules/mfa/deleteMfaDevice/deleteMfaDevice.d.ts.map +1 -1
- package/dist/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts.map +1 -1
- package/dist/services/instrumentation/constants.d.ts +17 -0
- package/dist/services/instrumentation/constants.d.ts.map +1 -0
- package/dist/services/instrumentation/createInstrumentation/createInstrumentation.d.ts +18 -0
- package/dist/services/instrumentation/createInstrumentation/createInstrumentation.d.ts.map +1 -0
- package/dist/services/instrumentation/createInstrumentation/index.d.ts +2 -0
- package/dist/services/instrumentation/createInstrumentation/index.d.ts.map +1 -0
- package/dist/services/instrumentation/extractSessionId/extractSessionId.d.ts +12 -0
- package/dist/services/instrumentation/extractSessionId/extractSessionId.d.ts.map +1 -0
- package/dist/services/instrumentation/instrumentFunction/extractParams/extractParams.d.ts +27 -0
- package/dist/services/instrumentation/instrumentFunction/extractParams/extractParams.d.ts.map +1 -0
- package/dist/services/instrumentation/instrumentFunction/index.d.ts +2 -0
- package/dist/services/instrumentation/instrumentFunction/index.d.ts.map +1 -0
- package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts +73 -0
- package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts.map +1 -0
- package/dist/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.d.ts +14 -0
- package/dist/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.d.ts.map +1 -0
- package/dist/services/instrumentation/instrumentation.types.d.ts +49 -0
- package/dist/services/instrumentation/instrumentation.types.d.ts.map +1 -0
- package/dist/services/instrumentation/scrubParameters/index.d.ts +2 -0
- package/dist/services/instrumentation/scrubParameters/index.d.ts.map +1 -0
- package/dist/services/instrumentation/scrubParameters/scrubParameters.d.ts +8 -0
- package/dist/services/instrumentation/scrubParameters/scrubParameters.d.ts.map +1 -0
- package/dist/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.d.ts +24 -0
- package/dist/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.d.ts.map +1 -0
- package/dist/services/instrumentation/transports/createDynamicTransport/index.d.ts +2 -0
- package/dist/services/instrumentation/transports/createDynamicTransport/index.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/getUserAgent/getUserAgent.d.ts +10 -0
- package/dist/utils/getUserAgent/getUserAgent.d.ts.map +1 -0
- package/dist/waas.cjs.js +4 -4
- package/dist/waas.esm.js +3 -3
- package/dist/waasCore.cjs.js +4 -4
- package/dist/waasCore.esm.js +3 -3
- package/package.json +3 -3
- package/dist/InvalidParamError-Dc2HgrDm.esm.js.map +0 -1
- package/dist/InvalidParamError-z_h8HyKL.cjs.js.map +0 -1
package/dist/{isMfaRequiredForAction-CXRaUbFE.esm.js → isMfaRequiredForAction-BtO6Xkeu.esm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as getCore, T as assertDefined, j as getDefaultClient, u as createApiClient } from "./InvalidParamError-BgvcmQ36.esm.js";
|
|
2
2
|
|
|
3
3
|
//#region src/modules/mfa/consumeMfaToken/consumeMfaToken.ts
|
|
4
4
|
/**
|
|
@@ -59,4 +59,4 @@ const isMfaRequiredForAction = async ({ mfaAction }, client = getDefaultClient()
|
|
|
59
59
|
|
|
60
60
|
//#endregion
|
|
61
61
|
export { getMfaMethods as n, consumeMfaToken as r, isMfaRequiredForAction as t };
|
|
62
|
-
//# sourceMappingURL=isMfaRequiredForAction-
|
|
62
|
+
//# sourceMappingURL=isMfaRequiredForAction-BtO6Xkeu.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMfaRequiredForAction-
|
|
1
|
+
{"version":3,"file":"isMfaRequiredForAction-BtO6Xkeu.esm.js","names":[],"sources":["../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,mBAAmB,SAAS,kBAAkB,KAAK;CAC9D,MAAM,OAAO,QAAQ,OAAO;CAE5B,MAAM,WAAW,KAAK,MAAM,KAAK,CAAC;AAElC,eAAc,UAAU,qBAAqB;AAE7C,MAAK,MAAM,IAAI,EACb,UAAU,MACX,CAAC;AAEF,QAAO;;;;;;;;;;;;;;ACZT,MAAa,gBAAgB,OAAO,SAAS,kBAAkB,KAAK;CAClE,MAAM,OAAO,QAAQ,OAAO;AAQ5B,QALuB,MAFL,gBAAgB,EAAE,EAAE,OAAO,CAEN,kBAAkB;EACvD,eAAe,KAAK;EACpB,cAAc;EACf,CAAC;;;;;;;;;;;;;;;ACDJ,MAAa,yBAAyB,OACpC,EAAE,aACF,SAAS,kBAAkB,KACxB;CACH,MAAM,kBAAkB,OAAO;AAQ/B,KAAI,CANwB,iBAAiB,UAAU,KAAK,SAAS,MAClE,WAAW,OAAO,WAAW,aAAa,OAAO,SACnD,CAKC,QAAO;AAMT,KAH4B,iBAAiB,UAAU,KAAK,SAI1D,QAAO;AAMT,SAHmB,MAAM,cAAc,OAAO,EAG5B"}
|
package/dist/{isMfaRequiredForAction-BS239c-s.cjs.js → isMfaRequiredForAction-C84laGI8.cjs.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_InvalidParamError = require('./InvalidParamError-
|
|
1
|
+
const require_InvalidParamError = require('./InvalidParamError-CApg0dxd.cjs.js');
|
|
2
2
|
|
|
3
3
|
//#region src/modules/mfa/consumeMfaToken/consumeMfaToken.ts
|
|
4
4
|
/**
|
|
@@ -76,4 +76,4 @@ Object.defineProperty(exports, 'isMfaRequiredForAction', {
|
|
|
76
76
|
return isMfaRequiredForAction;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
//# sourceMappingURL=isMfaRequiredForAction-
|
|
79
|
+
//# sourceMappingURL=isMfaRequiredForAction-C84laGI8.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMfaRequiredForAction-
|
|
1
|
+
{"version":3,"file":"isMfaRequiredForAction-C84laGI8.cjs.js","names":["getDefaultClient","getCore","getDefaultClient","getCore","createApiClient","getDefaultClient"],"sources":["../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,mBAAmB,SAASA,4CAAkB,KAAK;CAC9D,MAAM,OAAOC,kCAAQ,OAAO;CAE5B,MAAM,WAAW,KAAK,MAAM,KAAK,CAAC;AAElC,yCAAc,UAAU,qBAAqB;AAE7C,MAAK,MAAM,IAAI,EACb,UAAU,MACX,CAAC;AAEF,QAAO;;;;;;;;;;;;;;ACZT,MAAa,gBAAgB,OAAO,SAASC,4CAAkB,KAAK;CAClE,MAAM,OAAOC,kCAAQ,OAAO;AAQ5B,QALuB,MAFLC,0CAAgB,EAAE,EAAE,OAAO,CAEN,kBAAkB;EACvD,eAAe,KAAK;EACpB,cAAc;EACf,CAAC;;;;;;;;;;;;;;;ACDJ,MAAa,yBAAyB,OACpC,EAAE,aACF,SAASC,4CAAkB,KACxB;CACH,MAAM,kBAAkB,OAAO;AAQ/B,KAAI,CANwB,iBAAiB,UAAU,KAAK,SAAS,MAClE,WAAW,OAAO,WAAW,aAAa,OAAO,SACnD,CAKC,QAAO;AAMT,KAH4B,iBAAiB,UAAU,KAAK,SAI1D,QAAO;AAMT,SAHmB,MAAM,cAAc,OAAO,EAG5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
1
2
|
/**
|
|
2
3
|
* A function that maps one error type to another.
|
|
3
4
|
*
|
|
@@ -16,6 +17,12 @@
|
|
|
16
17
|
*/
|
|
17
18
|
export type ErrorMapper = (error: Error) => Error | null;
|
|
18
19
|
export type CreateApiClientOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* When set, reads the elevated access token for the given scope from
|
|
22
|
+
* client state and includes it in the `x-dyn-elevated-access-token`
|
|
23
|
+
* header. If no valid token exists for the scope, the header is omitted.
|
|
24
|
+
*/
|
|
25
|
+
elevatedAccessTokenScope?: TokenScope;
|
|
19
26
|
/**
|
|
20
27
|
* Array of error mappers that will be applied to API errors in order.
|
|
21
28
|
* Each mapper can transform an error into a different error type or return null to skip transformation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.types.d.ts","sourceRoot":"","sources":["../../../src/modules/apiClient/apiClient.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,GAAG,IAAI,CAAC;AAEzD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"apiClient.types.d.ts","sourceRoot":"","sources":["../../../src/modules/apiClient/apiClient.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,GAAG,IAAI,CAAC;AAEzD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,UAAU,CAAC;IAEtC;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const DYNAMIC_API_VERSION_HEADER = "x-dyn-api-version";
|
|
2
2
|
export declare const DYNAMIC_REQUEST_ID_HEADER = "x-dyn-request-id";
|
|
3
3
|
export declare const DYNAMIC_SDK_VERSION_HEADER = "x-dyn-version";
|
|
4
|
+
export declare const ELEVATED_ACCESS_TOKEN_HEADER = "x-dyn-elevated-access-token";
|
|
4
5
|
export declare const MFA_TOKEN_HEADER = "x-mfa-auth-token";
|
|
5
6
|
export declare const SESSION_PUBLIC_KEY_HEADER = "x-dyn-session-public-key";
|
|
6
7
|
export declare const DYNAMIC_SDK_API_VERSION: string;
|
|
8
|
+
export declare const DYNAMIC_SDK_SESSION_ID_HEADER = "x-dyn-session-id";
|
|
7
9
|
export declare const CLIENT_SDK_NAME = "ClientSDK";
|
|
8
10
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/modules/apiClient/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAE9D,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D,eAAO,MAAM,0BAA0B,kBAAkB,CAAC;AAE1D,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,yBAAyB,6BAA6B,CAAC;AAEpE,eAAO,MAAM,uBAAuB,QACQ,CAAC;AAE7C,eAAO,MAAM,eAAe,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/modules/apiClient/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAE9D,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D,eAAO,MAAM,0BAA0B,kBAAkB,CAAC;AAE1D,eAAO,MAAM,4BAA4B,gCAAgC,CAAC;AAE1E,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,yBAAyB,6BAA6B,CAAC;AAEpE,eAAO,MAAM,uBAAuB,QACQ,CAAC;AAE7C,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAEhE,eAAO,MAAM,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApiClient.d.ts","sourceRoot":"","sources":["../../../src/modules/apiClient/createApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAInE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"createApiClient.d.ts","sourceRoot":"","sources":["../../../src/modules/apiClient/createApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAInE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAkChE;;;;GAIG;AACH,eAAO,MAAM,eAAe,YACjB,sBAAsB,sBACvB,aAAa,WAgEtB,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
type GetElevatedAccessTokenParams = {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to consume single-use tokens after retrieval.
|
|
4
|
+
* Set to `false` to check for token existence without side-effects.
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
consume?: boolean;
|
|
2
8
|
scope: string;
|
|
3
9
|
};
|
|
4
10
|
/**
|
|
@@ -7,24 +13,25 @@ type GetElevatedAccessTokenParams = {
|
|
|
7
13
|
* This function retrieves an elevated access token that contains the specified scope.
|
|
8
14
|
* Expired tokens are automatically filtered out.
|
|
9
15
|
*
|
|
10
|
-
*
|
|
11
|
-
* consumed (removed from state) after retrieval.
|
|
12
|
-
* for
|
|
16
|
+
* By default, if the token has `singleUse: true`, it will be automatically
|
|
17
|
+
* consumed (removed from state) after retrieval. Pass `consume: false` to
|
|
18
|
+
* check for token existence without consuming it.
|
|
13
19
|
*
|
|
14
20
|
* @param params - The parameters object.
|
|
15
21
|
* @param params.scope - The scope to match (e.g., 'wallet:export').
|
|
22
|
+
* @param params.consume - Whether to consume single-use tokens (default: true).
|
|
16
23
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
17
24
|
* @returns The elevated access token if found and not expired, or undefined if not found or expired.
|
|
18
25
|
*
|
|
19
26
|
* @example
|
|
20
27
|
* ```typescript
|
|
28
|
+
* // Retrieve and consume (default)
|
|
21
29
|
* const token = getElevatedAccessToken({ scope: 'wallet:export' });
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* }
|
|
30
|
+
*
|
|
31
|
+
* // Check existence without consuming
|
|
32
|
+
* const token = getElevatedAccessToken({ scope: 'credential:unlink', consume: false });
|
|
26
33
|
* ```
|
|
27
34
|
*/
|
|
28
|
-
export declare const getElevatedAccessToken: ({ scope }: GetElevatedAccessTokenParams, client?: import("../../../exports").DynamicClient) => string | undefined;
|
|
35
|
+
export declare const getElevatedAccessToken: ({ consume, scope }: GetElevatedAccessTokenParams, client?: import("../../../exports").DynamicClient) => string | undefined;
|
|
29
36
|
export {};
|
|
30
37
|
//# sourceMappingURL=getElevatedAccessToken.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getElevatedAccessToken.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/getElevatedAccessToken/getElevatedAccessToken.ts"],"names":[],"mappings":"AAGA,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"getElevatedAccessToken.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/getElevatedAccessToken/getElevatedAccessToken.ts"],"names":[],"mappings":"AAGA,KAAK,4BAA4B,GAAG;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,sBAAsB,uBACN,4BAA4B,wDAEtD,MAAM,GAAG,SAiCX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deletePasskey.d.ts","sourceRoot":"","sources":["../../../../../src/modules/auth/passkeys/deletePasskey/deletePasskey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deletePasskey.d.ts","sourceRoot":"","sources":["../../../../../src/modules/auth/passkeys/deletePasskey/deletePasskey.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,kBACT;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2DAEnC,OAAO,CAAC,IAAI,CAgBd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverRegisterPasskey.d.ts","sourceRoot":"","sources":["../../../../../src/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"serverRegisterPasskey.d.ts","sourceRoot":"","sources":["../../../../../src/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,KAAK,2BAA2B,GAAG;IACjC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,EAAE,wBAAwB,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,qCACE,2BAA2B,UACrD,aAAa,iEAuBtB,CAAC"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
type DeleteMfaDeviceParams = {
|
|
2
2
|
deviceId: string;
|
|
3
|
-
mfaAuthToken
|
|
3
|
+
mfaAuthToken?: string;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
6
|
* Deletes a specific MFA device from the user's account.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* When an elevated access token for `credential:unlink` is available,
|
|
9
|
+
* it is sent via the `x-dyn-elevated-access-token` header and the
|
|
10
|
+
* MFA auth token is not required. Otherwise, `mfaAuthToken` must be
|
|
11
|
+
* provided for backward compatibility with the legacy MFA flow.
|
|
10
12
|
*
|
|
11
13
|
* @param params.deviceId - The unique identifier of the MFA device to delete.
|
|
12
|
-
* @param params.mfaAuthToken - The MFA authentication token
|
|
14
|
+
* @param params.mfaAuthToken - The MFA authentication token. Optional when using elevated access tokens.
|
|
13
15
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
14
16
|
* @returns A promise that resolves when the MFA device is successfully deleted.
|
|
15
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteMfaDevice.d.ts","sourceRoot":"","sources":["../../../../src/modules/mfa/deleteMfaDevice/deleteMfaDevice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deleteMfaDevice.d.ts","sourceRoot":"","sources":["../../../../src/modules/mfa/deleteMfaDevice/deleteMfaDevice.ts"],"names":[],"mappings":"AAQA,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,+BACE,qBAAqB,qEA+BlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerTotpMfaDevice.d.ts","sourceRoot":"","sources":["../../../../src/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerTotpMfaDevice.d.ts","sourceRoot":"","sources":["../../../../src/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,uIAUjC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const DEFAULT_PII_FIELDS: string[];
|
|
2
|
+
export declare const REDACTED_VALUE = "[REDACTED]";
|
|
3
|
+
export declare const MAX_STRING_LENGTH = 500;
|
|
4
|
+
export declare const TRUNCATED_SUFFIX = "...[truncated]";
|
|
5
|
+
/**
|
|
6
|
+
* Label prefix for binary data placeholders. The full placeholder includes the
|
|
7
|
+
* byte length, e.g. `[Binary:16 bytes]`, so consumers can gauge data size
|
|
8
|
+
* without the actual bytes appearing in logs.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BINARY_LABEL = "Binary";
|
|
11
|
+
/**
|
|
12
|
+
* Placeholder emitted when a circular reference is detected in the value tree.
|
|
13
|
+
* Using a named constant makes it easy to search for or filter in downstream
|
|
14
|
+
* log tooling.
|
|
15
|
+
*/
|
|
16
|
+
export declare const CIRCULAR_VALUE = "[Circular]";
|
|
17
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/services/instrumentation/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAY9B,CAAC;AAEF,eAAO,MAAM,cAAc,eAAe,CAAC;AAE3C,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Instrumentation, InstrumentationConfig } from '../instrumentation.types';
|
|
2
|
+
type CreateInstrumentationParams = {
|
|
3
|
+
config?: Partial<InstrumentationConfig>;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Creates the instrumentation service that gates event emission behind an
|
|
7
|
+
* enabled flag and delegates to a pluggable transport.
|
|
8
|
+
*
|
|
9
|
+
* The transport is intentionally optional at creation time — it is wired in
|
|
10
|
+
* later via setTransport so the SDK can initialise without one. Events logged
|
|
11
|
+
* before a transport is set are simply dropped.
|
|
12
|
+
*
|
|
13
|
+
* Custom piiFields are merged with and deduplicated against the defaults so
|
|
14
|
+
* callers only need to list additional fields, not replicate the baseline.
|
|
15
|
+
*/
|
|
16
|
+
export declare const createInstrumentation: ({ config: inputConfig, }?: CreateInstrumentationParams) => Instrumentation;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=createInstrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInstrumentation.d.ts","sourceRoot":"","sources":["../../../../src/services/instrumentation/createInstrumentation/createInstrumentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EAGtB,MAAM,0BAA0B,CAAC;AAElC,KAAK,2BAA2B,GAAG;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACzC,CAAC;AAQF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,8BAE/B,2BAA2B,KAAQ,eAyBrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/instrumentation/createInstrumentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the session ID (`sid` claim) from a JWT token string.
|
|
3
|
+
*
|
|
4
|
+
* Decodes the base64url-encoded payload segment of the token and reads the
|
|
5
|
+
* `sid` field. This is used to correlate instrumentation events with the
|
|
6
|
+
* authenticated session, without ever forwarding the full token.
|
|
7
|
+
*
|
|
8
|
+
* Returns `null` when no token is present, when the token is malformed, or
|
|
9
|
+
* when the payload does not contain a `sid` claim.
|
|
10
|
+
*/
|
|
11
|
+
export declare const extractSessionId: (token: string) => string | null;
|
|
12
|
+
//# sourceMappingURL=extractSessionId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractSessionId.d.ts","sourceRoot":"","sources":["../../../../src/services/instrumentation/extractSessionId/extractSessionId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,MAAM,GAAG,IASzD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalises the raw positional arguments of an instrumented function call
|
|
3
|
+
* into a flat `Record<string, unknown>` suitable for structured logging.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this is needed
|
|
6
|
+
*
|
|
7
|
+
* Instrumented functions are wrapped with `(...args: unknown[])`, so their
|
|
8
|
+
* parameters arrive as an array. Logging a raw array loses the semantic names
|
|
9
|
+
* of each argument. This function recovers a named representation:
|
|
10
|
+
*
|
|
11
|
+
* - **No arguments** → `{}`
|
|
12
|
+
* - **Single plain-object argument** → that object is returned as-is, because
|
|
13
|
+
* SDK functions follow the single-object-parameter convention, so the object
|
|
14
|
+
* already carries named keys (`{ amount, to }`, etc.).
|
|
15
|
+
* - **Everything else** (multiple args, a single primitive, a single array) →
|
|
16
|
+
* each value is indexed as `arg0`, `arg1`, …
|
|
17
|
+
*
|
|
18
|
+
* ## Why arrays are NOT treated as plain objects
|
|
19
|
+
*
|
|
20
|
+
* `typeof [] === 'object'` and `[] !== null`, so without the `Array.isArray`
|
|
21
|
+
* guard a single-array argument would be returned as-is. That would produce
|
|
22
|
+
* an object with numeric string keys (`{ '0': ..., '1': ... }`), which is
|
|
23
|
+
* misleading and inconsistent with how multi-arg calls are handled. Instead,
|
|
24
|
+
* arrays fall through to the indexed `arg0` path.
|
|
25
|
+
*/
|
|
26
|
+
export declare const extractParams: (args: unknown[]) => Record<string, unknown>;
|
|
27
|
+
//# sourceMappingURL=extractParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractParams.d.ts","sourceRoot":"","sources":["../../../../../src/services/instrumentation/instrumentFunction/extractParams/extractParams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa,SAAU,OAAO,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAuBrE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/instrumentation/instrumentFunction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { DynamicCore } from '../../../client/core/types/DynamicCore';
|
|
2
|
+
type InstrumentFunctionParams<T extends (...args: unknown[]) => unknown> = {
|
|
3
|
+
/** The original function to wrap. */
|
|
4
|
+
fn: T;
|
|
5
|
+
/** Human-readable name recorded in every emitted event. */
|
|
6
|
+
functionName: string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the current `DynamicCore` instance, or `undefined` when the SDK
|
|
9
|
+
* has not yet been initialised. Instrumentation is skipped when this returns
|
|
10
|
+
* `undefined` or when `core.instrumentation.config.enabled` is `false`.
|
|
11
|
+
*/
|
|
12
|
+
getCore: () => DynamicCore | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* When `true`, every field in `parameters` and `resolvedValue` is replaced
|
|
15
|
+
* with `"[redacted]"` regardless of `piiFields`. Use this for functions
|
|
16
|
+
* whose arguments are inherently sensitive (e.g., signing, authentication).
|
|
17
|
+
*/
|
|
18
|
+
redactAll?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Wraps a function so that each invocation emits a structured
|
|
22
|
+
* `FunctionInstrumentationEvent` at three lifecycle points:
|
|
23
|
+
*
|
|
24
|
+
* - **started** — immediately before the function body executes, with the
|
|
25
|
+
* PII-scrubbed call parameters.
|
|
26
|
+
* - **resolved** — after the function (or its returned Promise) settles
|
|
27
|
+
* successfully, with the PII-scrubbed return value.
|
|
28
|
+
* - **rejected** — if the function throws synchronously or its returned
|
|
29
|
+
* Promise rejects.
|
|
30
|
+
*
|
|
31
|
+
* The original return value (or thrown error) is always forwarded to the
|
|
32
|
+
* caller unchanged — instrumentation is purely observational.
|
|
33
|
+
*
|
|
34
|
+
* ## Usage
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* const transfer = instrumentFunction({
|
|
38
|
+
* fn: rawTransfer,
|
|
39
|
+
* functionName: 'transfer',
|
|
40
|
+
* getCore: () => core,
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // When called, three events are emitted automatically:
|
|
44
|
+
* await transfer({ amount: 1, to: '0xabc' });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* ## How functions are wrapped
|
|
48
|
+
*
|
|
49
|
+
* `instrumentFunction` is not called manually in application code. Instead,
|
|
50
|
+
* the esbuild instrumentation plugin (`tools/instrumentation-plugin`) injects
|
|
51
|
+
* it at build time: any exported function annotated with `@instrumented` in its
|
|
52
|
+
* JSDoc is automatically wrapped by the plugin during the build step.
|
|
53
|
+
* The plugin strips the original `export`, renames the function, and re-exports
|
|
54
|
+
* it under the original name via `instrumentFunction(...)` — so the public API
|
|
55
|
+
* is unchanged and no call sites need to be updated.
|
|
56
|
+
*
|
|
57
|
+
* ## Opting out
|
|
58
|
+
*
|
|
59
|
+
* Instrumentation is skipped entirely when:
|
|
60
|
+
* - `getCore()` returns `undefined` (SDK not initialised), or
|
|
61
|
+
* - `core.instrumentation.config.enabled` is `false`.
|
|
62
|
+
*
|
|
63
|
+
* In both cases the original function is called directly with no overhead.
|
|
64
|
+
*
|
|
65
|
+
* ## PII scrubbing
|
|
66
|
+
*
|
|
67
|
+
* All string values whose key appears in `piiFields` are replaced with
|
|
68
|
+
* `"[redacted]"` before events are emitted. Pass `redactAll: true` to redact
|
|
69
|
+
* every field, regardless of key name.
|
|
70
|
+
*/
|
|
71
|
+
export declare const instrumentFunction: <T extends (...args: unknown[]) => unknown>({ fn, functionName, getCore, redactAll, }: InstrumentFunctionParams<T>) => T;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=instrumentFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentFunction.d.ts","sourceRoot":"","sources":["../../../../src/services/instrumentation/instrumentFunction/instrumentFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAQ1E,KAAK,wBAAwB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,IAAI;IACzE,qCAAqC;IACrC,EAAE,EAAE,CAAC,CAAC;IACN,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,CAAC;IACvC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,6CAKzE,wBAAwB,CAAC,CAAC,CAAC,KAAG,CAuFhC,CAAC"}
|
package/dist/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type ScrubResolvedValueParams = {
|
|
2
|
+
piiFields: string[];
|
|
3
|
+
redactAll?: boolean;
|
|
4
|
+
value: unknown;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Scrubs a resolved return value of any type before logging it.
|
|
8
|
+
* Routes through `scrubParameters` by wrapping the value so that strings,
|
|
9
|
+
* arrays, Dates, Errors, and all other types are handled identically to
|
|
10
|
+
* nested object fields.
|
|
11
|
+
*/
|
|
12
|
+
export declare const scrubResolvedValue: ({ piiFields, redactAll, value, }: ScrubResolvedValueParams) => unknown;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=scrubResolvedValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrubResolvedValue.d.ts","sourceRoot":"","sources":["../../../../../src/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.ts"],"names":[],"mappings":"AAEA,KAAK,wBAAwB,GAAG;IAC9B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,qCAI5B,wBAAwB,KAAG,OAKnB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type InstrumentationEventPhase = 'started' | 'resolved' | 'rejected';
|
|
2
|
+
/**
|
|
3
|
+
* Common fields shared by all instrumentation events.
|
|
4
|
+
*
|
|
5
|
+
* All string values that match piiFields are redacted before this event is
|
|
6
|
+
* constructed, so it is safe to forward to an external transport.
|
|
7
|
+
*/
|
|
8
|
+
export type InstrumentationEvent = {
|
|
9
|
+
environmentId: string;
|
|
10
|
+
parameters: Record<string, unknown>;
|
|
11
|
+
sdkSessionId: string;
|
|
12
|
+
sdkVersion: string;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
tokenSessionId: string | null;
|
|
15
|
+
userAgent: string;
|
|
16
|
+
userId: string | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A telemetry record emitted by instrumentFunction for each phase of a
|
|
20
|
+
* function call (started, resolved, rejected). Extends InstrumentationEvent
|
|
21
|
+
* with function-execution-specific fields.
|
|
22
|
+
*/
|
|
23
|
+
export type FunctionInstrumentationEvent = InstrumentationEvent & {
|
|
24
|
+
functionName: string;
|
|
25
|
+
phase: InstrumentationEventPhase;
|
|
26
|
+
rejectedError?: Error;
|
|
27
|
+
resolvedValue?: unknown;
|
|
28
|
+
};
|
|
29
|
+
export type InstrumentationConfig = {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
piiFields: string[];
|
|
32
|
+
};
|
|
33
|
+
/** Pluggable sink that receives fully-scrubbed events for forwarding. */
|
|
34
|
+
export type InstrumentationTransport = {
|
|
35
|
+
log: (event: InstrumentationEvent) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The instrumentation service instance held on DynamicCore.
|
|
39
|
+
* Acts as a gatekeeper: events are only forwarded to the transport when
|
|
40
|
+
* enabled, and the transport can be swapped at any time without restarting.
|
|
41
|
+
*/
|
|
42
|
+
export type Instrumentation = {
|
|
43
|
+
config: InstrumentationConfig;
|
|
44
|
+
log: (event: InstrumentationEvent) => void;
|
|
45
|
+
logFunction: (event: FunctionInstrumentationEvent) => void;
|
|
46
|
+
setEnabled: (enabled: boolean) => void;
|
|
47
|
+
setTransport: (transport: InstrumentationTransport) => void;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=instrumentation.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.types.d.ts","sourceRoot":"","sources":["../../../src/services/instrumentation/instrumentation.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,GAAG;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,yBAAyB,CAAC;IACjC,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,GAAG,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,CAAC;IAC3D,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,YAAY,EAAE,CAAC,SAAS,EAAE,wBAAwB,KAAK,IAAI,CAAC;CAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/instrumentation/scrubParameters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type ScrubParametersParams = {
|
|
2
|
+
piiFields: string[];
|
|
3
|
+
redactAll?: boolean;
|
|
4
|
+
value: Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
export declare const scrubParameters: ({ piiFields, redactAll, value, }: ScrubParametersParams) => Record<string, unknown>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=scrubParameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrubParameters.d.ts","sourceRoot":"","sources":["../../../../src/services/instrumentation/scrubParameters/scrubParameters.ts"],"names":[],"mappings":"AAcA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AA0KF,eAAO,MAAM,eAAe,qCAIzB,qBAAqB,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAQhD,CAAC"}
|
package/dist/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Fetch } from '../../../fetch';
|
|
2
|
+
import type { InstrumentationTransport } from '../../instrumentation.types';
|
|
3
|
+
type CreateDynamicTransportParams = {
|
|
4
|
+
environmentId: string;
|
|
5
|
+
fetch: Fetch;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Creates a batched transport that ships instrumentation events to Dynamic's
|
|
9
|
+
* log ingestion endpoint.
|
|
10
|
+
*
|
|
11
|
+
* Events are queued synchronously and flushed as a single HTTP batch in the
|
|
12
|
+
* next microtask (via queueMicrotask). Multiple log() calls within the same
|
|
13
|
+
* synchronous tick are coalesced into one request, avoiding a round-trip per
|
|
14
|
+
* event.
|
|
15
|
+
*
|
|
16
|
+
* Fetch errors are swallowed to prevent an instrumentation failure from
|
|
17
|
+
* triggering another instrumentation event and causing an infinite loop.
|
|
18
|
+
*
|
|
19
|
+
* Works in both browser and SSR environments — fetch is injected and
|
|
20
|
+
* queueMicrotask is available in Node.js >= 11.
|
|
21
|
+
*/
|
|
22
|
+
export declare const createDynamicTransport: (params: CreateDynamicTransportParams) => InstrumentationTransport;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=createDynamicTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDynamicTransport.d.ts","sourceRoot":"","sources":["../../../../../src/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAEV,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AAIrC,KAAK,4BAA4B,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,WACzB,4BAA4B,KACnC,wBAkCF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/instrumentation/transports/createDynamicTransport/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|