@walkeros/web-source-session 2.0.1 → 2.1.0
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/dev.d.mts +24 -5
- package/dist/dev.d.ts +24 -5
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/walkerOS.json +50 -3
- package/package.json +6 -5
package/dist/dev.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
2
|
import { z } from '@walkeros/core/dev';
|
|
3
|
+
import { Flow, Source } from '@walkeros/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Session source settings schema
|
|
@@ -26,11 +27,29 @@ type Settings = z.infer<typeof SettingsSchema>;
|
|
|
26
27
|
|
|
27
28
|
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
28
29
|
|
|
29
|
-
type
|
|
30
|
-
declare const
|
|
31
|
-
declare const
|
|
30
|
+
type index$1_Settings = Settings;
|
|
31
|
+
declare const index$1_SettingsSchema: typeof SettingsSchema;
|
|
32
|
+
declare const index$1_settings: typeof settings;
|
|
33
|
+
declare namespace index$1 {
|
|
34
|
+
export { type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_settings as settings };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare const sessionStart: Flow.StepExample;
|
|
38
|
+
declare const sessionResume: Flow.StepExample;
|
|
39
|
+
|
|
40
|
+
declare const step_sessionResume: typeof sessionResume;
|
|
41
|
+
declare const step_sessionStart: typeof sessionStart;
|
|
42
|
+
declare namespace step {
|
|
43
|
+
export { step_sessionResume as sessionResume, step_sessionStart as sessionStart };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Prepares localStorage with session/device data. */
|
|
47
|
+
declare const setup: Source.SetupFn;
|
|
48
|
+
|
|
49
|
+
declare const index_setup: typeof setup;
|
|
50
|
+
declare const index_step: typeof step;
|
|
32
51
|
declare namespace index {
|
|
33
|
-
export {
|
|
52
|
+
export { index_setup as setup, index_step as step };
|
|
34
53
|
}
|
|
35
54
|
|
|
36
|
-
export { index as schemas };
|
|
55
|
+
export { index as examples, index$1 as schemas };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
2
|
import { z } from '@walkeros/core/dev';
|
|
3
|
+
import { Flow, Source } from '@walkeros/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Session source settings schema
|
|
@@ -26,11 +27,29 @@ type Settings = z.infer<typeof SettingsSchema>;
|
|
|
26
27
|
|
|
27
28
|
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
28
29
|
|
|
29
|
-
type
|
|
30
|
-
declare const
|
|
31
|
-
declare const
|
|
30
|
+
type index$1_Settings = Settings;
|
|
31
|
+
declare const index$1_SettingsSchema: typeof SettingsSchema;
|
|
32
|
+
declare const index$1_settings: typeof settings;
|
|
33
|
+
declare namespace index$1 {
|
|
34
|
+
export { type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_settings as settings };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare const sessionStart: Flow.StepExample;
|
|
38
|
+
declare const sessionResume: Flow.StepExample;
|
|
39
|
+
|
|
40
|
+
declare const step_sessionResume: typeof sessionResume;
|
|
41
|
+
declare const step_sessionStart: typeof sessionStart;
|
|
42
|
+
declare namespace step {
|
|
43
|
+
export { step_sessionResume as sessionResume, step_sessionStart as sessionStart };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Prepares localStorage with session/device data. */
|
|
47
|
+
declare const setup: Source.SetupFn;
|
|
48
|
+
|
|
49
|
+
declare const index_setup: typeof setup;
|
|
50
|
+
declare const index_step: typeof step;
|
|
32
51
|
declare namespace index {
|
|
33
|
-
export {
|
|
52
|
+
export { index_setup as setup, index_step as step };
|
|
34
53
|
}
|
|
35
54
|
|
|
36
|
-
export { index as schemas };
|
|
55
|
+
export { index as examples, index$1 as schemas };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,
|
|
1
|
+
"use strict";var e,s=Object.defineProperty,t=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(e,t)=>{for(var o in t)s(e,o,{get:t[o],enumerable:!0})},a={};n(a,{examples:()=>b,schemas:()=>r}),module.exports=(e=a,((e,n,a,r)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let c of o(n))i.call(e,c)||c===a||s(e,c,{get:()=>n[c],enumerable:!(r=t(n,c))||r.enumerable});return e})(s({},"__esModule",{value:!0}),e));var r={};n(r,{SettingsSchema:()=>d,settings:()=>u});var c=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),d=l.z.object({storage:l.z.boolean().default(!1).describe("Enable persistent storage for session/device IDs").optional(),consent:l.z.union([l.z.string(),l.z.array(l.z.string())]).describe("Consent key(s) required to enable storage mode").optional(),length:l.z.number().default(30).describe("Session timeout in minutes").optional(),pulse:l.z.boolean().default(!1).describe("Keep session alive on each event").optional(),sessionKey:l.z.string().default("elbSessionId").describe("Storage key for session ID").optional(),sessionStorage:l.z.enum(["local","session"]).default("local").describe("Storage type for session").optional(),deviceKey:l.z.string().default("elbDeviceId").describe("Storage key for device ID").optional(),deviceStorage:l.z.enum(["local","session"]).default("local").describe("Storage type for device").optional(),deviceAge:l.z.number().default(30).describe("Device ID age in days").optional(),cb:l.z.any().describe("Custom session callback function or false to disable").optional()}),u=(0,c.zodToSchema)(d),b={};n(b,{setup:()=>y,step:()=>f});var f={};n(f,{sessionResume:()=>g,sessionStart:()=>p});var p={in:{storage:!0,consent:"functional"},out:{name:"session start",data:{id:"s3ss10n-id",start:17e11,isNew:!0,count:1,runs:1,isStart:!0,storage:!0},entity:"session",action:"start"}},g={in:{storage:!0,consent:"functional"},out:{name:"session start",data:{id:"s3ss10n-id",start:17e11,isNew:!1,count:3,runs:5,isStart:!0,storage:!0},entity:"session",action:"start"}},y=(e,s)=>{if(!e||"object"!=typeof e)return;const t=e;if(t.sessionData&&"object"==typeof t.sessionData){const e="string"==typeof t.sessionKey?t.sessionKey:"elbSessionId";s.localStorage.setItem(e,JSON.stringify(t.sessionData))}if("string"==typeof t.deviceId){const e="string"==typeof t.deviceKey?t.deviceKey:"elbDeviceId";s.localStorage.setItem(e,t.deviceId)}};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["export * as schemas from './schemas';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Session source settings schema\n */\nexport const SettingsSchema = z.object({\n storage: z\n .boolean()\n .default(false)\n .describe('Enable persistent storage for session/device IDs')\n .optional(),\n\n consent: z\n .union([z.string(), z.array(z.string())])\n .describe('Consent key(s) required to enable storage mode')\n .optional(),\n\n length: z\n .number()\n .default(30)\n .describe('Session timeout in minutes')\n .optional(),\n\n pulse: z\n .boolean()\n .default(false)\n .describe('Keep session alive on each event')\n .optional(),\n\n sessionKey: z\n .string()\n .default('elbSessionId')\n .describe('Storage key for session ID')\n .optional(),\n\n sessionStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for session')\n .optional(),\n\n deviceKey: z\n .string()\n .default('elbDeviceId')\n .describe('Storage key for device ID')\n .optional(),\n\n deviceStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for device')\n .optional(),\n\n deviceAge: z\n .number()\n .default(30)\n .describe('Device ID age in days')\n .optional(),\n\n // Note: Using z.any() because z.custom() cannot be converted to JSON Schema\n // TypeScript types provide compile-time safety; runtime accepts function or false\n cb: z\n .any()\n .describe('Custom session callback function or false to disable')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAKX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,SAAS,aACN,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kDAAkD,EAC3D,SAAS;AAAA,EAEZ,SAAS,aACN,MAAM,CAAC,aAAE,OAAO,GAAG,aAAE,MAAM,aAAE,OAAO,CAAC,CAAC,CAAC,EACvC,SAAS,gDAAgD,EACzD,SAAS;AAAA,EAEZ,QAAQ,aACL,OAAO,EACP,QAAQ,EAAE,EACV,SAAS,4BAA4B,EACrC,SAAS;AAAA,EAEZ,OAAO,aACJ,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kCAAkC,EAC3C,SAAS;AAAA,EAEZ,YAAY,aACT,OAAO,EACP,QAAQ,cAAc,EACtB,SAAS,4BAA4B,EACrC,SAAS;AAAA,EAEZ,gBAAgB,aACb,KAAK,CAAC,SAAS,SAAS,CAAC,EACzB,QAAQ,OAAO,EACf,SAAS,0BAA0B,EACnC,SAAS;AAAA,EAEZ,WAAW,aACR,OAAO,EACP,QAAQ,aAAa,EACrB,SAAS,2BAA2B,EACpC,SAAS;AAAA,EAEZ,eAAe,aACZ,KAAK,CAAC,SAAS,SAAS,CAAC,EACzB,QAAQ,OAAO,EACf,SAAS,yBAAyB,EAClC,SAAS;AAAA,EAEZ,WAAW,aACR,OAAO,EACP,QAAQ,EAAE,EACV,SAAS,uBAAuB,EAChC,SAAS;AAAA;AAAA;AAAA,EAIZ,IAAI,aACD,IAAI,EACJ,SAAS,sDAAsD,EAC/D,SAAS;AACd,CAAC;;;AD1DM,IAAM,eAAW,yBAAY,cAAc;","names":["import_dev"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Session source settings schema\n */\nexport const SettingsSchema = z.object({\n storage: z\n .boolean()\n .default(false)\n .describe('Enable persistent storage for session/device IDs')\n .optional(),\n\n consent: z\n .union([z.string(), z.array(z.string())])\n .describe('Consent key(s) required to enable storage mode')\n .optional(),\n\n length: z\n .number()\n .default(30)\n .describe('Session timeout in minutes')\n .optional(),\n\n pulse: z\n .boolean()\n .default(false)\n .describe('Keep session alive on each event')\n .optional(),\n\n sessionKey: z\n .string()\n .default('elbSessionId')\n .describe('Storage key for session ID')\n .optional(),\n\n sessionStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for session')\n .optional(),\n\n deviceKey: z\n .string()\n .default('elbDeviceId')\n .describe('Storage key for device ID')\n .optional(),\n\n deviceStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for device')\n .optional(),\n\n deviceAge: z\n .number()\n .default(30)\n .describe('Device ID age in days')\n .optional(),\n\n // Note: Using z.any() because z.custom() cannot be converted to JSON Schema\n // TypeScript types provide compile-time safety; runtime accepts function or false\n cb: z\n .any()\n .describe('Custom session callback function or false to disable')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\nexport { setup } from './setup';\n","import type { Flow } from '@walkeros/core';\n\nexport const sessionStart: Flow.StepExample = {\n in: {\n storage: true,\n consent: 'functional',\n },\n out: {\n name: 'session start',\n data: {\n id: 's3ss10n-id',\n start: 1700000000000,\n isNew: true,\n count: 1,\n runs: 1,\n isStart: true,\n storage: true,\n },\n entity: 'session',\n action: 'start',\n },\n};\n\nexport const sessionResume: Flow.StepExample = {\n in: {\n storage: true,\n consent: 'functional',\n },\n out: {\n name: 'session start',\n data: {\n id: 's3ss10n-id',\n start: 1700000000000,\n isNew: false,\n count: 3,\n runs: 5,\n isStart: true,\n storage: true,\n },\n entity: 'session',\n action: 'start',\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Prepares localStorage with session/device data. */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n const data = input as Record<string, unknown>;\n\n if (data.sessionData && typeof data.sessionData === 'object') {\n const key =\n typeof data.sessionKey === 'string' ? data.sessionKey : 'elbSessionId';\n env.localStorage.setItem(key, JSON.stringify(data.sessionData));\n }\n\n if (typeof data.deviceId === 'string') {\n const key =\n typeof data.deviceKey === 'string' ? data.deviceKey : 'elbDeviceId';\n env.localStorage.setItem(key, data.deviceId);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAKX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,SAAS,aACN,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kDAAkD,EAC3D,SAAS;AAAA,EAEZ,SAAS,aACN,MAAM,CAAC,aAAE,OAAO,GAAG,aAAE,MAAM,aAAE,OAAO,CAAC,CAAC,CAAC,EACvC,SAAS,gDAAgD,EACzD,SAAS;AAAA,EAEZ,QAAQ,aACL,OAAO,EACP,QAAQ,EAAE,EACV,SAAS,4BAA4B,EACrC,SAAS;AAAA,EAEZ,OAAO,aACJ,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kCAAkC,EAC3C,SAAS;AAAA,E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;AAAA,IACR,QAAQ;AAAA,EACV;AACF;;;ACvCO,IAAM,QAAwB,CAAC,OAAO,QAAQ;AACnD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,QAAM,OAAO;AAEb,MAAI,KAAK,eAAe,OAAO,KAAK,gBAAgB,UAAU;AAC5D,UAAM,MACJ,OAAO,KAAK,eAAe,WAAW,KAAK,aAAa;AAC1D,QAAI,aAAa,QAAQ,KAAK,KAAK,UAAU,KAAK,WAAW,CAAC;AAAA,EAChE;AAEA,MAAI,OAAO,KAAK,aAAa,UAAU;AACrC,UAAM,MACJ,OAAO,KAAK,cAAc,WAAW,KAAK,YAAY;AACxD,QAAI,aAAa,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAC7C;AACF;","names":["import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,
|
|
1
|
+
var e=Object.defineProperty,s=(s,t)=>{for(var o in t)e(s,o,{get:t[o],enumerable:!0})},t={};s(t,{SettingsSchema:()=>n,settings:()=>a});import{zodToSchema as o}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var n=i.object({storage:i.boolean().default(!1).describe("Enable persistent storage for session/device IDs").optional(),consent:i.union([i.string(),i.array(i.string())]).describe("Consent key(s) required to enable storage mode").optional(),length:i.number().default(30).describe("Session timeout in minutes").optional(),pulse:i.boolean().default(!1).describe("Keep session alive on each event").optional(),sessionKey:i.string().default("elbSessionId").describe("Storage key for session ID").optional(),sessionStorage:i.enum(["local","session"]).default("local").describe("Storage type for session").optional(),deviceKey:i.string().default("elbDeviceId").describe("Storage key for device ID").optional(),deviceStorage:i.enum(["local","session"]).default("local").describe("Storage type for device").optional(),deviceAge:i.number().default(30).describe("Device ID age in days").optional(),cb:i.any().describe("Custom session callback function or false to disable").optional()}),a=o(n),r={};s(r,{setup:()=>u,step:()=>c});var c={};s(c,{sessionResume:()=>d,sessionStart:()=>l});var l={in:{storage:!0,consent:"functional"},out:{name:"session start",data:{id:"s3ss10n-id",start:17e11,isNew:!0,count:1,runs:1,isStart:!0,storage:!0},entity:"session",action:"start"}},d={in:{storage:!0,consent:"functional"},out:{name:"session start",data:{id:"s3ss10n-id",start:17e11,isNew:!1,count:3,runs:5,isStart:!0,storage:!0},entity:"session",action:"start"}},u=(e,s)=>{if(!e||"object"!=typeof e)return;const t=e;if(t.sessionData&&"object"==typeof t.sessionData){const e="string"==typeof t.sessionKey?t.sessionKey:"elbSessionId";s.localStorage.setItem(e,JSON.stringify(t.sessionData))}if("string"==typeof t.deviceId){const e="string"==typeof t.deviceKey?t.deviceKey:"elbDeviceId";s.localStorage.setItem(e,t.deviceId)}};export{r as examples,t as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Session source settings schema\n */\nexport const SettingsSchema = z.object({\n storage: z\n .boolean()\n .default(false)\n .describe('Enable persistent storage for session/device IDs')\n .optional(),\n\n consent: z\n .union([z.string(), z.array(z.string())])\n .describe('Consent key(s) required to enable storage mode')\n .optional(),\n\n length: z\n .number()\n .default(30)\n .describe('Session timeout in minutes')\n .optional(),\n\n pulse: z\n .boolean()\n .default(false)\n .describe('Keep session alive on each event')\n .optional(),\n\n sessionKey: z\n .string()\n .default('elbSessionId')\n .describe('Storage key for session ID')\n .optional(),\n\n sessionStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for session')\n .optional(),\n\n deviceKey: z\n .string()\n .default('elbDeviceId')\n .describe('Storage key for device ID')\n .optional(),\n\n deviceStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for device')\n .optional(),\n\n deviceAge: z\n .number()\n .default(30)\n .describe('Device ID age in days')\n .optional(),\n\n // Note: Using z.any() because z.custom() cannot be converted to JSON Schema\n // TypeScript types provide compile-time safety; runtime accepts function or false\n cb: z\n .any()\n .describe('Custom session callback function or false to disable')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAKX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,SAAS,EACN,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kDAAkD,EAC3D,SAAS;AAAA,EAEZ,SAAS,EACN,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EACvC,SAAS,gDAAgD,EACzD,SAAS;AAAA,EAEZ,QAAQ,EACL,OAAO,EACP,QAAQ,EAAE,EACV,SAAS,4BAA4B,EACrC,SAAS;AAAA,EAEZ,OAAO,EACJ,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kCAAkC,EAC3C,SAAS;AAAA,EAEZ,YAAY,EACT,OAAO,EACP,QAAQ,cAAc,EACtB,SAAS,4BAA4B,EACrC,SAAS;AAAA,EAEZ,gBAAgB,EACb,KAAK,CAAC,SAAS,SAAS,CAAC,EACzB,QAAQ,OAAO,EACf,SAAS,0BAA0B,EACnC,SAAS;AAAA,EAEZ,WAAW,EACR,OAAO,EACP,QAAQ,aAAa,EACrB,SAAS,2BAA2B,EACpC,SAAS;AAAA,EAEZ,eAAe,EACZ,KAAK,CAAC,SAAS,SAAS,CAAC,EACzB,QAAQ,OAAO,EACf,SAAS,yBAAyB,EAClC,SAAS;AAAA,EAEZ,WAAW,EACR,OAAO,EACP,QAAQ,EAAE,EACV,SAAS,uBAAuB,EAChC,SAAS;AAAA;AAAA;AAAA,EAIZ,IAAI,EACD,IAAI,EACJ,SAAS,sDAAsD,EAC/D,SAAS;AACd,CAAC;;;AD1DM,IAAM,WAAW,YAAY,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Session source settings schema\n */\nexport const SettingsSchema = z.object({\n storage: z\n .boolean()\n .default(false)\n .describe('Enable persistent storage for session/device IDs')\n .optional(),\n\n consent: z\n .union([z.string(), z.array(z.string())])\n .describe('Consent key(s) required to enable storage mode')\n .optional(),\n\n length: z\n .number()\n .default(30)\n .describe('Session timeout in minutes')\n .optional(),\n\n pulse: z\n .boolean()\n .default(false)\n .describe('Keep session alive on each event')\n .optional(),\n\n sessionKey: z\n .string()\n .default('elbSessionId')\n .describe('Storage key for session ID')\n .optional(),\n\n sessionStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for session')\n .optional(),\n\n deviceKey: z\n .string()\n .default('elbDeviceId')\n .describe('Storage key for device ID')\n .optional(),\n\n deviceStorage: z\n .enum(['local', 'session'])\n .default('local')\n .describe('Storage type for device')\n .optional(),\n\n deviceAge: z\n .number()\n .default(30)\n .describe('Device ID age in days')\n .optional(),\n\n // Note: Using z.any() because z.custom() cannot be converted to JSON Schema\n // TypeScript types provide compile-time safety; runtime accepts function or false\n cb: z\n .any()\n .describe('Custom session callback function or false to disable')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\nexport { setup } from './setup';\n","import type { Flow } from '@walkeros/core';\n\nexport const sessionStart: Flow.StepExample = {\n in: {\n storage: true,\n consent: 'functional',\n },\n out: {\n name: 'session start',\n data: {\n id: 's3ss10n-id',\n start: 1700000000000,\n isNew: true,\n count: 1,\n runs: 1,\n isStart: true,\n storage: true,\n },\n entity: 'session',\n action: 'start',\n },\n};\n\nexport const sessionResume: Flow.StepExample = {\n in: {\n storage: true,\n consent: 'functional',\n },\n out: {\n name: 'session start',\n data: {\n id: 's3ss10n-id',\n start: 1700000000000,\n isNew: false,\n count: 3,\n runs: 5,\n isStart: true,\n storage: true,\n },\n entity: 'session',\n action: 'start',\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Prepares localStorage with session/device data. */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n const data = input as Record<string, unknown>;\n\n if (data.sessionData && typeof data.sessionData === 'object') {\n const key =\n typeof data.sessionKey === 'string' ? data.sessionKey : 'elbSessionId';\n env.localStorage.setItem(key, JSON.stringify(data.sessionData));\n }\n\n if (typeof data.deviceId === 'string') {\n const key =\n typeof data.deviceKey === 'string' ? data.deviceKey : 'elbDeviceId';\n env.localStorage.setItem(key, data.deviceId);\n }\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAKX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,SAAS,EACN,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kDAAkD,EAC3D,SAAS;AAAA,EAEZ,SAAS,EACN,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EACvC,SAAS,gDAAgD,EACzD,SAAS;AAAA,EAEZ,QAAQ,EACL,OAAO,EACP,QAAQ,EAAE,EACV,SAAS,4BAA4B,EACrC,SAAS;AAAA,EAEZ,OAAO,EACJ,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,kCAAkC,EAC3C,SAAS;AAAA,EAEZ,YAAY,EACT,OAAO,EACP,QAAQ,cAAc,EACtB,SAAS,4BAA4B,EACrC,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O,QAAQ;AACnD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,QAAM,OAAO;AAEb,MAAI,KAAK,eAAe,OAAO,KAAK,gBAAgB,UAAU;AAC5D,UAAM,MACJ,OAAO,KAAK,eAAe,WAAW,KAAK,aAAa;AAC1D,QAAI,aAAa,QAAQ,KAAK,KAAK,UAAU,KAAK,WAAW,CAAC;AAAA,EAChE;AAEA,MAAI,OAAO,KAAK,aAAa,UAAU;AACrC,UAAM,MACJ,OAAO,KAAK,cAAc,WAAW,KAAK,YAAY;AACxD,QAAI,aAAa,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAC7C;AACF;","names":[]}
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-source-session",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"type": "source",
|
|
6
|
-
"platform": "web"
|
|
6
|
+
"platform": "web",
|
|
7
|
+
"renderer": "codebox"
|
|
7
8
|
},
|
|
8
9
|
"schemas": {
|
|
9
10
|
"settings": {
|
|
@@ -79,5 +80,51 @@
|
|
|
79
80
|
"additionalProperties": false
|
|
80
81
|
}
|
|
81
82
|
},
|
|
82
|
-
"examples": {
|
|
83
|
+
"examples": {
|
|
84
|
+
"setup": {
|
|
85
|
+
"$code": "(e,s)=>{if(!e||\"object\"!=typeof e)return;const t=e;if(t.sessionData&&\"object\"==typeof t.sessionData){const e=\"string\"==typeof t.sessionKey?t.sessionKey:\"elbSessionId\";s.localStorage.setItem(e,JSON.stringify(t.sessionData))}if(\"string\"==typeof t.deviceId){const e=\"string\"==typeof t.deviceKey?t.deviceKey:\"elbDeviceId\";s.localStorage.setItem(e,t.deviceId)}}"
|
|
86
|
+
},
|
|
87
|
+
"step": {
|
|
88
|
+
"sessionResume": {
|
|
89
|
+
"in": {
|
|
90
|
+
"storage": true,
|
|
91
|
+
"consent": "functional"
|
|
92
|
+
},
|
|
93
|
+
"out": {
|
|
94
|
+
"name": "session start",
|
|
95
|
+
"data": {
|
|
96
|
+
"id": "s3ss10n-id",
|
|
97
|
+
"start": 1700000000000,
|
|
98
|
+
"isNew": false,
|
|
99
|
+
"count": 3,
|
|
100
|
+
"runs": 5,
|
|
101
|
+
"isStart": true,
|
|
102
|
+
"storage": true
|
|
103
|
+
},
|
|
104
|
+
"entity": "session",
|
|
105
|
+
"action": "start"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"sessionStart": {
|
|
109
|
+
"in": {
|
|
110
|
+
"storage": true,
|
|
111
|
+
"consent": "functional"
|
|
112
|
+
},
|
|
113
|
+
"out": {
|
|
114
|
+
"name": "session start",
|
|
115
|
+
"data": {
|
|
116
|
+
"id": "s3ss10n-id",
|
|
117
|
+
"start": 1700000000000,
|
|
118
|
+
"isNew": true,
|
|
119
|
+
"count": 1,
|
|
120
|
+
"runs": 1,
|
|
121
|
+
"isStart": true,
|
|
122
|
+
"storage": true
|
|
123
|
+
},
|
|
124
|
+
"entity": "session",
|
|
125
|
+
"action": "start"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
83
130
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-source-session",
|
|
3
3
|
"description": "Session source for walkerOS",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"update": "npx npm-check-updates -u && npm update"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@walkeros/core": "^2.
|
|
35
|
-
"@walkeros/web-core": "^2.
|
|
34
|
+
"@walkeros/core": "^2.1.0",
|
|
35
|
+
"@walkeros/web-core": "^2.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@walkeros/collector": "^2.
|
|
38
|
+
"@walkeros/collector": "^2.1.0"
|
|
39
39
|
},
|
|
40
40
|
"repository": {
|
|
41
41
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"walkerOS": {
|
|
50
50
|
"type": "source",
|
|
51
|
-
"platform": "web"
|
|
51
|
+
"platform": "web",
|
|
52
|
+
"renderer": "codebox"
|
|
52
53
|
},
|
|
53
54
|
"keywords": [
|
|
54
55
|
"walkerOS",
|