@unicitylabs/sphere-sdk 0.14.11-dev.8 → 0.14.11
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/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +29 -15
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +29 -15
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/wallet-api-v2/index.cjs +95 -1
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.js +95 -1
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +29 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -15
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +33 -19
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +6 -1
- package/dist/modules/payments-v2/index.d.ts +6 -1
- package/dist/modules/payments-v2/index.js +32 -19
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -3089,6 +3089,98 @@ var SerialChain = class {
|
|
|
3089
3089
|
}
|
|
3090
3090
|
};
|
|
3091
3091
|
|
|
3092
|
+
// core/logger.ts
|
|
3093
|
+
var LOGGER_KEY = "__sphere_sdk_logger__";
|
|
3094
|
+
function getState() {
|
|
3095
|
+
const g = globalThis;
|
|
3096
|
+
if (!g[LOGGER_KEY]) {
|
|
3097
|
+
g[LOGGER_KEY] = { debug: false, tags: {}, handler: null };
|
|
3098
|
+
}
|
|
3099
|
+
return g[LOGGER_KEY];
|
|
3100
|
+
}
|
|
3101
|
+
function isEnabled(tag) {
|
|
3102
|
+
const state = getState();
|
|
3103
|
+
if (tag in state.tags) return state.tags[tag];
|
|
3104
|
+
return state.debug;
|
|
3105
|
+
}
|
|
3106
|
+
var logger = {
|
|
3107
|
+
/**
|
|
3108
|
+
* Configure the logger. Can be called multiple times (last write wins).
|
|
3109
|
+
* Typically called by createBrowserProviders(), createNodeProviders(), or Sphere.init().
|
|
3110
|
+
*/
|
|
3111
|
+
configure(config) {
|
|
3112
|
+
const state = getState();
|
|
3113
|
+
if (config.debug !== void 0) state.debug = config.debug;
|
|
3114
|
+
if (config.handler !== void 0) state.handler = config.handler;
|
|
3115
|
+
},
|
|
3116
|
+
/**
|
|
3117
|
+
* Enable/disable debug logging for a specific tag.
|
|
3118
|
+
* Per-tag setting overrides the global debug flag.
|
|
3119
|
+
*
|
|
3120
|
+
* @example
|
|
3121
|
+
* ```ts
|
|
3122
|
+
* logger.setTagDebug('Nostr', true); // enable only Nostr logs
|
|
3123
|
+
* logger.setTagDebug('Nostr', false); // disable Nostr logs even if global debug=true
|
|
3124
|
+
* ```
|
|
3125
|
+
*/
|
|
3126
|
+
setTagDebug(tag, enabled) {
|
|
3127
|
+
getState().tags[tag] = enabled;
|
|
3128
|
+
},
|
|
3129
|
+
/**
|
|
3130
|
+
* Clear per-tag override, falling back to global debug flag.
|
|
3131
|
+
*/
|
|
3132
|
+
clearTagDebug(tag) {
|
|
3133
|
+
delete getState().tags[tag];
|
|
3134
|
+
},
|
|
3135
|
+
/** Returns true if debug mode is enabled for the given tag (or globally). */
|
|
3136
|
+
isDebugEnabled(tag) {
|
|
3137
|
+
if (tag) return isEnabled(tag);
|
|
3138
|
+
return getState().debug;
|
|
3139
|
+
},
|
|
3140
|
+
/**
|
|
3141
|
+
* Debug-level log. Only shown when debug is enabled (globally or for this tag).
|
|
3142
|
+
* Use for detailed operational information.
|
|
3143
|
+
*/
|
|
3144
|
+
debug(tag, message, ...args) {
|
|
3145
|
+
if (!isEnabled(tag)) return;
|
|
3146
|
+
const state = getState();
|
|
3147
|
+
if (state.handler) {
|
|
3148
|
+
state.handler("debug", tag, message, ...args);
|
|
3149
|
+
} else {
|
|
3150
|
+
console.log(`[${tag}]`, message, ...args);
|
|
3151
|
+
}
|
|
3152
|
+
},
|
|
3153
|
+
/**
|
|
3154
|
+
* Warning-level log. ALWAYS shown regardless of debug flag.
|
|
3155
|
+
* Use for important but non-critical issues (timeouts, retries, degraded state).
|
|
3156
|
+
*/
|
|
3157
|
+
warn(tag, message, ...args) {
|
|
3158
|
+
const state = getState();
|
|
3159
|
+
if (state.handler) {
|
|
3160
|
+
state.handler("warn", tag, message, ...args);
|
|
3161
|
+
} else {
|
|
3162
|
+
console.warn(`[${tag}]`, message, ...args);
|
|
3163
|
+
}
|
|
3164
|
+
},
|
|
3165
|
+
/**
|
|
3166
|
+
* Error-level log. ALWAYS shown regardless of debug flag.
|
|
3167
|
+
* Use for critical failures that should never be silenced.
|
|
3168
|
+
*/
|
|
3169
|
+
error(tag, message, ...args) {
|
|
3170
|
+
const state = getState();
|
|
3171
|
+
if (state.handler) {
|
|
3172
|
+
state.handler("error", tag, message, ...args);
|
|
3173
|
+
} else {
|
|
3174
|
+
console.error(`[${tag}]`, message, ...args);
|
|
3175
|
+
}
|
|
3176
|
+
},
|
|
3177
|
+
/** Reset all logger state (debug flag, tags, handler). Primarily for tests. */
|
|
3178
|
+
reset() {
|
|
3179
|
+
const g = globalThis;
|
|
3180
|
+
delete g[LOGGER_KEY];
|
|
3181
|
+
}
|
|
3182
|
+
};
|
|
3183
|
+
|
|
3092
3184
|
// node_modules/@noble/hashes/hkdf.js
|
|
3093
3185
|
function extract(hash, ikm, salt) {
|
|
3094
3186
|
ahash(hash);
|
|
@@ -4250,7 +4342,9 @@ var WalletApiDeliveryPort = class {
|
|
|
4250
4342
|
await this.settleClaims(acks, settled, outcomes);
|
|
4251
4343
|
await this.settleRejects(acks, settled);
|
|
4252
4344
|
} catch (err) {
|
|
4253
|
-
await this.addSeenAll(settled).catch(() =>
|
|
4345
|
+
await this.addSeenAll(settled).catch((seenErr) => {
|
|
4346
|
+
logger.warn("WalletApiDelivery", `seen-set write failed for ${String(settled.length)} committed acks:`, seenErr);
|
|
4347
|
+
});
|
|
4254
4348
|
throw asRetryable(err);
|
|
4255
4349
|
}
|
|
4256
4350
|
await this.addSeenAll(settled);
|