@streamlayer/sdk-web-anonymous-auth
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -369,3 +369,4 @@ "use strict"; | ||
timestamp: getTimeFunction(opts), | ||
messageKey: opts.messageKey || "msg" | ||
messageKey: opts.messageKey || "msg", | ||
onChild: opts.onChild || noop | ||
}; | ||
@@ -378,3 +379,5 @@ logger2.levels = getLevels(opts); | ||
logger2._stdErrSerialize = stdErrSerialize; | ||
logger2.child = child; | ||
logger2.child = function(...args) { | ||
return child.call(this, setOpts, ...args); | ||
}; | ||
if (transmit2) logger2._logEvent = createLogEventShape(); | ||
@@ -402,3 +405,3 @@ function getLevelVal() { | ||
} | ||
function child(bindings, childOptions) { | ||
function child(setOpts2, bindings, childOptions) { | ||
if (!bindings) { | ||
@@ -434,3 +437,7 @@ throw new Error("missing bindings for child Pino"); | ||
appendChildLogger(this, newLogger); | ||
newLogger.child = function(...args) { | ||
return child.call(this, setOpts2, ...args); | ||
}; | ||
newLogger.level = childOptions.level || this.level; | ||
setOpts2.onChild(newLogger); | ||
return newLogger; | ||
@@ -497,4 +504,8 @@ } | ||
}); | ||
if (!opts.transmit && self2[level] === noop) { | ||
return; | ||
if (self2[level] === noop) { | ||
if (!opts.transmit) return; | ||
const transmitLevel = opts.transmit.level || self2.level; | ||
const transmitValue = rootLogger.levels.values[transmitLevel]; | ||
const methodValue = rootLogger.levels.values[level]; | ||
if (methodValue < transmitValue) return; | ||
} | ||
@@ -763,7 +774,8 @@ self2[level] = createWrap(self2, opts, rootLogger, level); | ||
}; | ||
const anonymousAuth = async (instance, opts) => { | ||
const anonymousAuth = async (instance, opts = {}) => { | ||
var _a, _b; | ||
const { schemaName, issuer } = { | ||
schemaName: "slra", | ||
issuer: "sdk-web" | ||
issuer: "sdk-web", | ||
...opts | ||
}; | ||
@@ -786,3 +798,3 @@ const organization = await instance.stores.organizationSettings.getValue(); | ||
instance.sdk.anonymousAuthorization = async () => { | ||
await anonymousAuth(instance); | ||
await anonymousAuth(instance, opts); | ||
}; | ||
@@ -789,0 +801,0 @@ done(); |
@@ -367,3 +367,4 @@ import "@streamlayer/sl-eslib/interactive/interactive.common_pb"; | ||
timestamp: getTimeFunction(opts), | ||
messageKey: opts.messageKey || "msg" | ||
messageKey: opts.messageKey || "msg", | ||
onChild: opts.onChild || noop | ||
}; | ||
@@ -376,3 +377,5 @@ logger2.levels = getLevels(opts); | ||
logger2._stdErrSerialize = stdErrSerialize; | ||
logger2.child = child; | ||
logger2.child = function(...args) { | ||
return child.call(this, setOpts, ...args); | ||
}; | ||
if (transmit2) logger2._logEvent = createLogEventShape(); | ||
@@ -400,3 +403,3 @@ function getLevelVal() { | ||
} | ||
function child(bindings, childOptions) { | ||
function child(setOpts2, bindings, childOptions) { | ||
if (!bindings) { | ||
@@ -432,3 +435,7 @@ throw new Error("missing bindings for child Pino"); | ||
appendChildLogger(this, newLogger); | ||
newLogger.child = function(...args) { | ||
return child.call(this, setOpts2, ...args); | ||
}; | ||
newLogger.level = childOptions.level || this.level; | ||
setOpts2.onChild(newLogger); | ||
return newLogger; | ||
@@ -495,4 +502,8 @@ } | ||
}); | ||
if (!opts.transmit && self2[level] === noop) { | ||
return; | ||
if (self2[level] === noop) { | ||
if (!opts.transmit) return; | ||
const transmitLevel = opts.transmit.level || self2.level; | ||
const transmitValue = rootLogger.levels.values[transmitLevel]; | ||
const methodValue = rootLogger.levels.values[level]; | ||
if (methodValue < transmitValue) return; | ||
} | ||
@@ -761,7 +772,8 @@ self2[level] = createWrap(self2, opts, rootLogger, level); | ||
}; | ||
const anonymousAuth = async (instance, opts) => { | ||
const anonymousAuth = async (instance, opts = {}) => { | ||
var _a, _b; | ||
const { schemaName, issuer } = { | ||
schemaName: "slra", | ||
issuer: "sdk-web" | ||
issuer: "sdk-web", | ||
...opts | ||
}; | ||
@@ -784,3 +796,3 @@ const organization = await instance.stores.organizationSettings.getValue(); | ||
instance.sdk.anonymousAuthorization = async () => { | ||
await anonymousAuth(instance); | ||
await anonymousAuth(instance, opts); | ||
}; | ||
@@ -787,0 +799,0 @@ done(); |
import { StreamLayerContext } from '@streamlayer/sdk-web-interfaces'; | ||
declare module '@streamlayer/sdk-web-interfaces' { | ||
@@ -9,3 +8,6 @@ interface StreamLayerSDK { | ||
type DoneFn = Function; | ||
export declare const anonymous: (instance: StreamLayerContext, opts: unknown, done: DoneFn) => void; | ||
export declare const anonymous: (instance: StreamLayerContext, opts: { | ||
schemaName?: string; | ||
issuer?: string; | ||
}, done: DoneFn) => void; | ||
export {}; |
{ | ||
"name": "@streamlayer/sdk-web-anonymous-auth", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"author": "StreamLayer, Inc (https://streamlayer.io)", | ||
@@ -26,22 +26,22 @@ "maintainers": [ | ||
"peerDependencies": { | ||
"jose": "^5.6.2", | ||
"@streamlayer/sdk-web": "^1.0.4" | ||
"jose": "^5.9.3", | ||
"@streamlayer/sdk-web": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@nx/devkit": "19.5.7", | ||
"@nx/playwright": "19.5.7", | ||
"@nx/webpack": "19.5.7", | ||
"@playwright/test": "^1.45.0", | ||
"@swc/helpers": "~0.5.12", | ||
"@nx/devkit": "19.8.0", | ||
"@nx/playwright": "19.8.0", | ||
"@nx/webpack": "19.8.0", | ||
"@playwright/test": "^1.47.2", | ||
"@swc/helpers": "~0.5.13", | ||
"rollup-plugin-visualizer": "^5.12.0", | ||
"url": "^0.11.3", | ||
"vite": "5.3.2", | ||
"vite-plugin-dts": "^3.9.1", | ||
"url": "^0.11.4", | ||
"vite": "5.4.7", | ||
"vite-plugin-dts": "^4.2.1", | ||
"vite-plugin-node-polyfills": "^0.22.0", | ||
"vite-tsconfig-paths": "^4.3.2", | ||
"webpack": "^5.92.1", | ||
"@streamlayer/sdk-web-api": "^1.1.3", | ||
"@streamlayer/sdk-web-core": "^1.0.4", | ||
"@streamlayer/sdk-web-interfaces": "^1.0.4" | ||
"vite-tsconfig-paths": "^5.0.1", | ||
"webpack": "^5.94.0", | ||
"@streamlayer/sdk-web-api": "^1.2.0", | ||
"@streamlayer/sdk-web-core": "^1.1.0", | ||
"@streamlayer/sdk-web-interfaces": "^1.1.0" | ||
} | ||
} |
51104
1606