@dynamic-labs-sdk/client 0.1.0-alpha.31 → 0.1.0-alpha.32
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/CHANGELOG.md +4 -0
- package/constants.cjs.js +1 -1
- package/constants.esm.js +1 -1
- package/index.cjs.js +8 -1
- package/index.esm.js +8 -1
- package/package.json +2 -2
- package/src/client/core/createCore/createCore.d.ts.map +1 -1
- package/src/client/createDynamicClient/createDynamicClient.d.ts.map +1 -1
- package/src/client/types/DynamicClientConfig.d.ts +6 -1
- package/src/client/types/DynamicClientConfig.d.ts.map +1 -1
- package/src/modules/auth/logout/logout.d.ts.map +1 -1
- package/src/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/constants.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
|
4
4
|
var buffer = require('buffer');
|
|
5
5
|
|
|
6
6
|
var name = "@dynamic-labs-sdk/client";
|
|
7
|
-
var version = "0.1.0-alpha.
|
|
7
|
+
var version = "0.1.0-alpha.32";
|
|
8
8
|
var dependencies = {
|
|
9
9
|
"@dynamic-labs/sdk-api-core": "0.0.823"};
|
|
10
10
|
|
package/constants.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AuthStorageEnum, SDKApi, Configuration } from '@dynamic-labs/sdk-api-co
|
|
|
2
2
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
3
3
|
|
|
4
4
|
var name = "@dynamic-labs-sdk/client";
|
|
5
|
-
var version = "0.1.0-alpha.
|
|
5
|
+
var version = "0.1.0-alpha.32";
|
|
6
6
|
var dependencies = {
|
|
7
7
|
"@dynamic-labs/sdk-api-core": "0.0.823"};
|
|
8
8
|
|
package/index.cjs.js
CHANGED
|
@@ -120,6 +120,7 @@ const retryOnFail = async ({ delay = 0, fn, maxRetries })=>{
|
|
|
120
120
|
return client.projectSettings;
|
|
121
121
|
}
|
|
122
122
|
const apiClient = constants.createApiClient({}, client);
|
|
123
|
+
core.logger.debug('[fetchProjectSettings] Fetching project settings...');
|
|
123
124
|
const doFetch = async ()=>apiClient.getEnvironmentSettings({
|
|
124
125
|
environmentId: core.environmentId,
|
|
125
126
|
sdkVersion: `${constants.CLIENT_SDK_NAME}/${core.version}`
|
|
@@ -264,6 +265,7 @@ const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
|
|
|
264
265
|
* @returns A promise that resolves when the logout process is complete.
|
|
265
266
|
*/ const logout = async (client = constants.getDefaultClient())=>{
|
|
266
267
|
const core = constants.getCore(client);
|
|
268
|
+
core.logger.debug('[logout] Logging out...');
|
|
267
269
|
await disconnectAndTerminateWalletProviders(client);
|
|
268
270
|
if (client.user !== null) {
|
|
269
271
|
const apiClient = constants.createApiClient({}, client);
|
|
@@ -512,6 +514,7 @@ class ClientAlreadyInitializedError extends constants.BaseError {
|
|
|
512
514
|
* @throws ClientAlreadyInitializedError If the client is already initialized.
|
|
513
515
|
*/ const initializeClient = async (client = constants.getDefaultClient())=>{
|
|
514
516
|
const core = constants.getCore(client);
|
|
517
|
+
core.logger.debug('[initializeClient] Initializing client. Current init status', core.state.get().initStatus);
|
|
515
518
|
if (core.state.get().initStatus !== 'uninitialized') {
|
|
516
519
|
throw new ClientAlreadyInitializedError();
|
|
517
520
|
}
|
|
@@ -890,7 +893,9 @@ class InvalidStorageValue extends constants.BaseError {
|
|
|
890
893
|
var _config_coreConfig_apiBaseUrl;
|
|
891
894
|
const apiBaseUrl = (_config_coreConfig_apiBaseUrl = (_config_coreConfig = config.coreConfig) == null ? void 0 : _config_coreConfig.apiBaseUrl) != null ? _config_coreConfig_apiBaseUrl : DEFAULT_API_BASE_URL;
|
|
892
895
|
var _config_coreConfig_logger;
|
|
893
|
-
const logger = (_config_coreConfig_logger = (_config_coreConfig1 = config.coreConfig) == null ? void 0 : _config_coreConfig1.logger) != null ? _config_coreConfig_logger : getNetworkProviderFromNetworkId.createLogger(
|
|
896
|
+
const logger = (_config_coreConfig_logger = (_config_coreConfig1 = config.coreConfig) == null ? void 0 : _config_coreConfig1.logger) != null ? _config_coreConfig_logger : getNetworkProviderFromNetworkId.createLogger({
|
|
897
|
+
level: config.logLevel
|
|
898
|
+
});
|
|
894
899
|
var _config_coreConfig_storageAdapter;
|
|
895
900
|
const storage = getNetworkProviderFromNetworkId.createStorage({
|
|
896
901
|
prefix: `dynamic_${config.environmentId}`,
|
|
@@ -974,7 +979,9 @@ class InvalidStorageValue extends constants.BaseError {
|
|
|
974
979
|
const autoInitialize = (_config_autoInitialize = config.autoInitialize) != null ? _config_autoInitialize : true;
|
|
975
980
|
// Prevent the auto initialization in SSR
|
|
976
981
|
const shouldAutoInitialize = isServerSideRendering() ? false : autoInitialize;
|
|
982
|
+
core.logger.debug('[createDynamicClient] Creating client...');
|
|
977
983
|
if (shouldAutoInitialize) {
|
|
984
|
+
core.logger.debug('[createDynamicClient] Initializing client...');
|
|
978
985
|
void initializeClient(client);
|
|
979
986
|
}
|
|
980
987
|
constants.setDefaultClient(client);
|
package/index.esm.js
CHANGED
|
@@ -105,6 +105,7 @@ const retryOnFail = async ({ delay = 0, fn, maxRetries })=>{
|
|
|
105
105
|
return client.projectSettings;
|
|
106
106
|
}
|
|
107
107
|
const apiClient = createApiClient({}, client);
|
|
108
|
+
core.logger.debug('[fetchProjectSettings] Fetching project settings...');
|
|
108
109
|
const doFetch = async ()=>apiClient.getEnvironmentSettings({
|
|
109
110
|
environmentId: core.environmentId,
|
|
110
111
|
sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`
|
|
@@ -249,6 +250,7 @@ const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
|
|
|
249
250
|
* @returns A promise that resolves when the logout process is complete.
|
|
250
251
|
*/ const logout = async (client = getDefaultClient())=>{
|
|
251
252
|
const core = getCore(client);
|
|
253
|
+
core.logger.debug('[logout] Logging out...');
|
|
252
254
|
await disconnectAndTerminateWalletProviders(client);
|
|
253
255
|
if (client.user !== null) {
|
|
254
256
|
const apiClient = createApiClient({}, client);
|
|
@@ -497,6 +499,7 @@ class ClientAlreadyInitializedError extends BaseError {
|
|
|
497
499
|
* @throws ClientAlreadyInitializedError If the client is already initialized.
|
|
498
500
|
*/ const initializeClient = async (client = getDefaultClient())=>{
|
|
499
501
|
const core = getCore(client);
|
|
502
|
+
core.logger.debug('[initializeClient] Initializing client. Current init status', core.state.get().initStatus);
|
|
500
503
|
if (core.state.get().initStatus !== 'uninitialized') {
|
|
501
504
|
throw new ClientAlreadyInitializedError();
|
|
502
505
|
}
|
|
@@ -875,7 +878,9 @@ class InvalidStorageValue extends BaseError {
|
|
|
875
878
|
var _config_coreConfig_apiBaseUrl;
|
|
876
879
|
const apiBaseUrl = (_config_coreConfig_apiBaseUrl = (_config_coreConfig = config.coreConfig) == null ? void 0 : _config_coreConfig.apiBaseUrl) != null ? _config_coreConfig_apiBaseUrl : DEFAULT_API_BASE_URL;
|
|
877
880
|
var _config_coreConfig_logger;
|
|
878
|
-
const logger = (_config_coreConfig_logger = (_config_coreConfig1 = config.coreConfig) == null ? void 0 : _config_coreConfig1.logger) != null ? _config_coreConfig_logger : createLogger(
|
|
881
|
+
const logger = (_config_coreConfig_logger = (_config_coreConfig1 = config.coreConfig) == null ? void 0 : _config_coreConfig1.logger) != null ? _config_coreConfig_logger : createLogger({
|
|
882
|
+
level: config.logLevel
|
|
883
|
+
});
|
|
879
884
|
var _config_coreConfig_storageAdapter;
|
|
880
885
|
const storage = createStorage({
|
|
881
886
|
prefix: `dynamic_${config.environmentId}`,
|
|
@@ -959,7 +964,9 @@ class InvalidStorageValue extends BaseError {
|
|
|
959
964
|
const autoInitialize = (_config_autoInitialize = config.autoInitialize) != null ? _config_autoInitialize : true;
|
|
960
965
|
// Prevent the auto initialization in SSR
|
|
961
966
|
const shouldAutoInitialize = isServerSideRendering() ? false : autoInitialize;
|
|
967
|
+
core.logger.debug('[createDynamicClient] Creating client...');
|
|
962
968
|
if (shouldAutoInitialize) {
|
|
969
|
+
core.logger.debug('[createDynamicClient] Initializing client...');
|
|
963
970
|
void initializeClient(client);
|
|
964
971
|
}
|
|
965
972
|
setDefaultClient(client);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-sdk/client",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.
|
|
32
|
+
"@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.32",
|
|
33
33
|
"@dynamic-labs/sdk-api-core": "0.0.823",
|
|
34
34
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.211",
|
|
35
35
|
"@simplewebauthn/browser": "13.1.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCore.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/client/core/createCore/createCore.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,UAAU,CAAC;AAG9D;;GAEG;AACH,eAAO,MAAM,UAAU,WAAY,mBAAmB,KAAG,
|
|
1
|
+
{"version":3,"file":"createCore.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/client/core/createCore/createCore.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,UAAU,CAAC;AAG9D;;GAEG;AACH,eAAO,MAAM,UAAU,WAAY,mBAAmB,KAAG,WAkDxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDynamicClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/createDynamicClient/createDynamicClient.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,WACtB,mBAAmB,KAC1B,
|
|
1
|
+
{"version":3,"file":"createDynamicClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/createDynamicClient/createDynamicClient.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,WACtB,mBAAmB,KAC1B,aA2CF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LogLevel } from '../../services/logger';
|
|
2
|
+
import type { DynamicCoreConfig } from '../core/types';
|
|
2
3
|
/**
|
|
3
4
|
* All available options to configure the Dynamic client.
|
|
4
5
|
*/
|
|
@@ -21,6 +22,10 @@ export type DynamicClientConfig = {
|
|
|
21
22
|
* The environment ID of the Dynamic app.
|
|
22
23
|
*/
|
|
23
24
|
environmentId: string;
|
|
25
|
+
/**
|
|
26
|
+
* The log level to use for the logger.
|
|
27
|
+
*/
|
|
28
|
+
logLevel?: LogLevel;
|
|
24
29
|
/**
|
|
25
30
|
* Metadata relating to your app.
|
|
26
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicClientConfig.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/types/DynamicClientConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAE/B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"DynamicClientConfig.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/types/DynamicClientConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAE/B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/auth/logout/logout.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/auth/logout/logout.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,eAAO,MAAM,MAAM,sEA+ClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/modules/initializeClient/initializeClient.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"initializeClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/modules/initializeClient/initializeClient.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,mEAoG5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchProjectSettings.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"fetchProjectSettings.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,6HA4ChC,CAAC"}
|