@compilacion/colleciones-clientos 2.0.2 → 2.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"collecionesClientos.iife.js","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/collecionesDsl.js","../src/collecionesClientos.js"],"sourcesContent":["// helper 'private' functions\n\n\n/**\n * Encodes a string to Base64.\n * Uses browser or Node.js method depending on environment.\n * @param {string} str\n * @returns {string}\n */\nconst toBase64 = function (str) {\n if (typeof window !== 'undefined' && typeof window.btoa === 'function') {\n return window.btoa(unescape(encodeURIComponent(str)));\n } else {\n return Buffer.from(str, 'utf-8').toString('base64');\n }\n}\n\n/**\n * Decodes a Base64 string to UTF-8.\n * Uses browser or Node.js method depending on environment.\n * @param {string} b64\n * @returns {string}\n */\nconst fromBase64 = function (b64) {\n if (typeof window !== 'undefined' && typeof window.atob === 'function') {\n return decodeURIComponent(escape(window.atob(b64)));\n } else {\n return Buffer.from(b64, 'base64').toString('utf-8');\n }\n}\n\n/**\n * Collects browser-related context values like screen size, language, etc.\n * Returns an empty object if not in browser environment.\n * @returns {Object}\n */\nconst getBrowserContext = function() {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return {};\n }\n return {\n hasFocus: document.hasFocus(),\n language: navigator.language,\n platform: navigator.platform,\n referrer: document.referrer,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n url: window.location.href,\n userAgent: navigator.userAgent,\n viewportHeight: window.innerHeight,\n viewportWidth: window.innerWidth,\n };\n}\n\nexport {\n fromBase64,\n getBrowserContext,\n toBase64,\n};","/**\n * Base class representing a structured event with timestamp, identifiers, and data fields.\n * This class is used to model events in a semantic and structured format for tracking purposes.\n */\nclass CollecionesEvent {\n\n /**\n * Constructs a new event with default metadata and timestamps.\n */\n constructor() {\n // initialize event properties\n this.entity = '';\n this.adjevtives = [];\n this.identifiers = {};\n this.action = '';\n this.actor = {};\n this.actorIdentifiers = {};\n this.context = {};\n this.references = {};\n // set default values\n this.meta = {\n eventFormat: 'CollecionesEvent',\n eventFormatVersion: '1'\n };\n this.meta.tracker = '';\n this.meta.app = '';\n this.meta.timestamps = {};\n this.meta.timestamps.clientDatetimeUtc = new Date().toISOString();\n if (typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.language) {\n this.meta.timestamps.clientDatetimeLocal = new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString();\n this.meta.timestamps.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n this.meta.timestamps.timeZoneOffset = new Date().getTimezoneOffset()\n } else {\n this.meta.timestamps.clientDatetimeLocal = new Date().toISOString();\n this.meta.timestamps.timeZone = 'UTC';\n }\n }\n\n /**\n * Returns the declared event format.\n * @returns {string} The format name (e.g. 'CollecionesEvent').\n */\n getEventFormat() {\n let v = this.meta?.eventFormat;\n return (typeof v !== 'undefined') ? v : '1';\n }\n\n /**\n * Returns the version of the event format.\n * @returns {string} The format version string.\n */\n getEventFormatVersion() {\n let v = this?.meta?.eventFormatVersion;\n return (typeof v !== 'undefined') ? v : 'CollecionesEvent';\n }\n\n /**\n * Overrides or supplements the event's timestamp fields with custom values.\n * @param {object} dateTimeObject - Key-value pairs to merge into the existing timestamp object.\n */\n overrideDatetime(dateTimeObject = {}) {\n for (const [key, value] of Object.entries(dateTimeObject)) {\n this.meta.timestamps[key] = value;\n }\n }\n\n /**\n * Sets the name of the tracker responsible for generating this event.\n * @param {string} name - Tracker name.\n */\n setTracker(name) {\n this.meta.tracker = name;\n }\n\n /**\n * Sets the name of the application that generated the event.\n * @param {string} name - Application name.\n */\n setAppName(name) {\n this.meta.appName = name;\n }\n\n /**\n * Sets the expected schema name for this event.\n * @param {string} schema - The name of the schema.\n */\n setSchema(schema) {\n if (typeof schema !== 'string') {\n throw new Error('Schema must be a string');\n }\n this.meta.schema = schema;\n }\n\n /**\n * Sets the entity (subject) of the event.\n * @param {string} entity - The entity name.\n */\n setEntity = function(entity) {\n this.entity = entity;\n }\n \n /**\n * Defines the main action of the event (e.g., 'clicked').\n * @param {string} action - The action string.\n */\n setAction = function(action) {\n this.action = action;\n }\n\n /**\n * Adds an adjective that describes the entity in more detail.\n * @param {string} adjective - An adjective string.\n */\n addAdjective = function(adjective) {\n if (typeof adjective !== 'string') {\n throw new Error('Adjective must be a string');\n }\n this.adjevtives.push(adjective);\n }\n\n /**\n * Adds or updates an identifier for the primary entity.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n */\n setIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Identifier name must be a string');\n }\n this.identifiers[name] = identifier;\n }\n\n /**\n * Defines the name of the actor (who or what performed the action).\n * @param {string} name - Actor name (e.g., 'user').\n */\n setActor = function(name) {\n if (typeof name !== 'string') {\n throw new Error('Actor name must be a string');\n }\n this.actor.name = name;\n }\n\n /**\n * Adds or updates an identifier for the actor.\n * @param {string} name - Identifier name.\n * @param {*} identifier - Identifier value.\n */\n setActorIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.actorIdentifiers[name] = identifier;\n }\n\n /**\n * Adds contextual information to the event.\n * @param {string} context - The key of the context field.\n * @param {*} value - The value of the context field.\n */\n setContext = function(context, value) {\n if (typeof context !== 'string') {\n throw new Error('Context must be a string');\n }\n this.context[context] = value;\n }\n\n /**\n * Declares an entity referenced by this event.\n * @param {string} entity - The referenced entity name.\n */\n setRefence = function(entity) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity must be a string');\n }\n if(this.references[entity] === undefined) {\n this.references[entity] = {identifiers: {}};\n }\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n */\n setRefenceIdentifier = function(entity, name, identifier) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity name must be a string');\n }\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.setRefence(entity);\n this.references[entity].identifiers[name] = identifier;\n }\n\n /**\n * Serializes the event to a plain object suitable for JSON.stringify().\n * @returns {object}\n */\n toJSON() {\n return {\n class: 'CollecionesEvent',\n entity: this.entity,\n adjectives: this.adjevtives,\n identifiers: this.identifiers,\n action: this.action,\n actor: this.actor,\n actorIdentifiers: this.actorIdentifiers,\n actorIds: this.actorIds,\n context: this.context,\n references: this.references,\n meta: this.meta\n };\n }\n\n /**\n * Recreates an instance of CollecionesEvent from a plain object.\n * @param {object} obj\n * @returns {CollecionesEvent}\n */\n static fromJSON(obj) { \n if (!obj || obj.class !== 'CollecionesEvent') {\n throw new Error('Invalid or missing event class type'); \n } \n const instance = new CollecionesEvent();\n instance.entity = obj.entity;\n instance.adjevtives = obj.adjectives || [];\n instance.identifiers = obj.identifiers || {};\n instance.action = obj.action;\n instance.actor = obj.actor;\n instance.actorIdentifiers = obj.actorIdentifiers;\n instance.actorIds = obj.actorIds;\n instance.context = obj.context || {};\n instance.references = obj.references || {};\n instance.meta = obj.meta || {};\n return instance;\n }\n \n}\n\nexport default CollecionesEvent;","import { fromBase64, toBase64 } from './utils/utils.js';\nimport CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * CollecionesEmitter\n * -------------------\n * This class collects and sends event objects to a remote endpoint (e.g., an event collector API).\n * It is used in both client- and server-side tracking scenarios, typically in combination with\n * CollecionesEvent or subclasses like CollecionesBaseEvent.\n *\n * Behavior:\n * - Events are buffered via `.track()` or `.trackAsync()`.\n * - If the number of buffered events reaches `flushSize`, the buffer is automatically flushed.\n * - If `flushInterval` is provided, the buffer is flushed at a fixed interval.\n * - Flushing serializes each event using `.toJSON()`, encodes it with base64, and posts\n * the resulting array to the configured endpoint.\n *\n * Example usage:\n * const emitter = new CollecionesEmitter('/track', 5, 10000);\n * emitter.track(new CollecionesEvent());\n *\n * Note:\n * This class is stateful. To stop periodic flushing, call `.stopTimer()` when the emitter is no longer in use.\n */\nclass CollecionesEmitter {\n\n /**\n * Initializes the emitter with buffering settings.\n * @param {string} [endpoint='/collect'] - The URL to send events to.\n * @param {number} [flushSize=10] - Number of events to buffer before flushing.\n * @param {number|boolean} [flushInterval=false] - Time in ms to flush events periodically.\n */\n constructor(endpoint = '/collect', flushSize = 10, flushInterval = false) {\n this.endpoint = endpoint;\n this.flushInterval = flushInterval;\n this.flushSize = flushSize;\n this.buffer = [];\n this.timer = null;\n this.lastPayload = null;\n }\n\n /**\n * Starts the flush timer if a valid interval is set.\n * @returns {void}\n */\n startTimer() {\n this.stopTimer();\n if (typeof this.flushInterval == 'number' && this.flushInterval > 0) {\n this.timer = setInterval(() => this.flush(), this.flushInterval);\n }\n }\n\n /**\n * Starts the flush timer only if not already running.\n * @returns {void}\n */\n startTimerIfStopped() {\n if (!this.timer) {\n this.startTimer();\n }\n }\n\n /**\n * Stops the active flush timer.\n * @returns {void}\n */\n stopTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.timer = null;\n }\n\n /**\n * Adds an event to the buffer and flushes if threshold is reached.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {void}\n */\n track(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.trackAsync(event);\n }\n\n /**\n * Asynchronously adds an event and flushes if the buffer size is exceeded.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked asynchronously.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {Promise<void>} Resolves when event is added and flush triggered if needed.\n */\n async trackAsync(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.startTimerIfStopped();\n this.buffer.push(event);\n return (this.buffer.length >= this.flushSize) ? this.flush() : Promise.resolve();\n }\n\n /**\n * Sends all buffered events in a single POST request to the server.\n * Each event is serialized via `.toJSON()` and encoded as a base64 string.\n * Response status is checked for HTTP success; errors are logged but not thrown.\n *\n * @returns {Promise<boolean|undefined>} Resolves true if flush was triggered, or undefined if buffer was empty.\n */\n async flush() {\n if (this.buffer.length === 0) return;\n this.stopTimer();\n const body = this.buildBody();\n this.lastPayload = body;\n this.buffer = [];\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n body\n });\n if (!response.ok) {\n console.log(`Failed to send events: ${response.statusText}`);\n }\n return true;\n } catch (error) { \n console.log(`Network error sending events: ${error.message}`);\n } \n }\n\n /**\n * Builds a POST-ready payload from the current buffer, without clearing it.\n * @returns {string} JSON string of base64-encoded serialized events.\n */\n buildBody() {\n return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));\n }\n\n}\n\nexport default CollecionesEmitter;","import CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * Tracks events by enriching them with shared identifiers and routing through configured emitters.\n */\nclass CollecionesTracker {\n\n /**\n * Constructs a new tracker instance.\n * @param {Array} emitters - Array of emitter instances responsible for sending events.\n * @param {string} trackerName - Name identifying this tracker.\n * @param {string} appName - Name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n this.emitters = emitters;\n this.trackerName = trackerName;\n this.appName = appName;\n }\n\n /**\n * Sends an event to all emitters after enriching it with identifiers and metadata.\n * @param {CollecionesEvent} collecionesEvent - The event to be sent.\n * @throws {Error} If the input is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setTracker(this.trackerName);\n collecionesEvent.setAppName(this.appName); \n this.emitters.forEach(element => {\n element.track(collecionesEvent, this.trackerName, this.appName);\n });\n }\n}\n\nexport default CollecionesTracker;","import CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport { getBrowserContext } from './utils/utils.js';\n\n/**\n * Web-specific tracker that enriches events with browser context before sending them.\n * Extends the base CollecionesTracker.\n */\nclass CollecionesWebTracker extends CollecionesTracker {\n /**\n * Creates a new instance of CollecionesWebTracker.\n * @param {Array} emitters - A list of emitter instances used to send the event.\n * @param {string} trackerName - The name of the tracker.\n * @param {string} appName - The name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n super(emitters, trackerName, appName);\n }\n\n /**\n * Tracks an event, enriching it with browser context information.\n * @param {CollecionesEvent} collecionesEvent - The event object to track.\n * @throws {Error} If the event is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setContext('browserContext', getBrowserContext());\n super.track(collecionesEvent); \n }\n}\n\nexport default CollecionesWebTracker;","/**\n * Colleciones DSL\n * ---------------\n * This module provides a fluent, human-readable DSL (domain-specific language) for constructing\n * structured tracking events based on CollecionesBaseEvent. Each step in the chain represents\n * a semantically meaningful piece of the event: the entity, the action, the actor, references, etc.\n *\n * Entry Point:\n * collecionesDsl.the('dark')\n *\n * Chaining:\n * - .and('...') : add additional adjectives\n * - ._('entity') : specify the entity being acted on\n * - .identified.by('field') : declare primary identifier for the subject\n * - .has.been('action') : declare what happened\n * - .by('actor') : describe the actor performing the action\n * - .identified.by('id') : add identifiers for the actor\n * - .with('key').set.to('val') : add contextual data fields\n * - .referring.to('entity') : describe referenced/related entities\n * - .identified.by('refId') : add identifiers for the reference\n * - .conform.to('SchemaName') : attach schema metadata\n * - .then.track.with(emitter) : finalize and emit the event\n *\n * Each function in the chain passes forward a scoped version of the CollecionesBaseEvent instance,\n * and enforces semantic constraints (e.g. `.as()` is required after `.by()`).\n *\n * Internal:\n * - Uses setRefence / setRefenceIdentifier for references\n * - Uses helpers.getEvent() for test access\n * - Uses instanceof CollecionesEmitter for validation\n *\n * This file is designed for internal use by developers building with the Colleciones tracking model.\n */\n\nimport CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\n\nlet init = (entity) => {\n return ((entity)=>{\n let eventInstance = new CollecionesEvent(); // Core event object\n eventInstance.setEntity(entity);\n\n let helpers = {\n getEvent: () => {\n return eventInstance;\n },\n };\n\n // DSL function groups\n let andEntity = () => {}; // .and(...) chaining after the()\n let setEntityAfterAnd = () => {}; // ._('entity') after .and\n let setEntityIdentifiers = () => {}; // .identified.by(...) for main subject\n let setAction = () => {}; // .has.been(...) for action\n let setActor = () => {}; // .by('actor')\n let setActorIdentifier = () => {}; // .identified.by(...) inside .by(...)\n let addContext = () => {}; // .with(...).set.to(...)\n let addReference = () => {}; // .referring.to(...)\n let getAddReference = () => {}; // .identified.by().as() inside .referring\n let addReferenceIdentifier = () => {}; // .and(...) after reference\n let conformingTo = () => {}; // .conform.to('SchemaName')\n let track = () => {}; // .then.track.with(emitter)\n\n // Adjective chaining: .and(...)._('entity')\n setEntityAfterAnd = (entity) => {\n eventInstance.addAdjective(eventInstance.entity);\n eventInstance.setEntity(entity);\n return {\n as: () => {\n return { helpers }\n },\n identified: {\n by: setEntityIdentifiers\n },\n has: { been: setAction },\n helpers\n };\n };\n\n // Identifier setup: .identified.by().as()\n setEntityIdentifiers = (name) => {\n eventInstance.setIdentifier(name, null);\n return {\n as: (value) => {\n eventInstance.setIdentifier(name, value);\n return {\n helpers,\n and: {\n by: setEntityIdentifiers\n },\n has: { been: setAction },\n }\n },\n helpers\n };\n };\n\n // Additional adjectives: .and('...')._()\n andEntity = (entity) => {\n eventInstance.addAdjective(eventInstance.entity);\n eventInstance.setEntity(entity);\n return {\n and: andEntity,\n _ : setEntityAfterAnd,\n helpers\n }\n };\n\n // Action: .has.been('...')\n setAction = (action) => {\n eventInstance.setAction(action);\n return {\n by: setActor,\n referring: { to: addReference },\n with: addContext,\n conform: {to: conformingTo},\n then: {track: {with: track}},\n helpers\n }\n };\n\n // Actor: .by('user')\n setActor = (name) => {\n eventInstance.setActor(name);\n return { \n identified: {\n by: setActorIdentifier\n },\n with: addContext,\n helpers\n }\n };\n\n // Actor identifier: .identified.by().as()\n setActorIdentifier = (name) => {\n return {\n as: (value) => {\n eventInstance.setActorIdentifier(name, value);\n return {\n helpers,\n and: setActorIdentifier,\n with: addContext,\n referring: { to: addReference },\n }\n },\n helpers\n }\n };\n\n // Contextual field: .with('key').set.to('value')\n addContext = (context) => {\n return {\n helpers,\n set: {\n to: (value) => {\n eventInstance.setContext(context, value);\n return {\n helpers,\n and: addContext,\n referring: { to: addReference },\n }\n }\n }\n }\n };\n\n // Reference: .referring.to('...')\n addReference = (entity) => {\n eventInstance.setRefence(entity);\n return {\n identified: {\n by: getAddReference(entity)\n },\n conform: {to: conformingTo},\n then: {track: {with: track}},\n helpers\n }\n };\n\n // Reference identifier setup: .identified.by().as()\n getAddReference = (entity) => {\n return (name) => {\n return {\n as: (value) => {\n eventInstance.setRefenceIdentifier(entity, name, value);\n return {\n helpers,\n and: addReferenceIdentifier,\n conform: {to: conformingTo},\n then: {track: {with: track}},\n }\n },\n helpers,\n };\n };\n };\n\n // Schema declaration: .conform.to('...')\n conformingTo = (name) => {\n eventInstance.setSchema(name);\n return { \n then: {track: {with: track}},\n helpers\n }\n };\n\n // Final dispatch: .then.track.with(tracker)\n track = (tracker) => {\n if(!(tracker instanceof CollecionesTracker)){\n throw new Error('can only be a CollecionesTracker')\n }\n tracker.track(eventInstance);\n return {\n and: track,\n helpers,\n }\n };\n\n return {\n and: andEntity,\n _: setEntityAfterAnd,\n identified: {\n by: setEntityIdentifiers\n },\n has: { been: setAction},\n node: '_base',\n helpers\n }\n\n })(entity);\n}\n\nlet collecionesDsl = {\n the: init\n};\n\n\nexport default collecionesDsl;","import CollecionesEmitter from './CollecionesEmitter.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport CollecionesWebTracker from './CollecionesWebTracker.js';\nimport CollecionesEvent from './CollecionesEvent.js';\nimport collecionesDsl from './collecionesDsl.js';\n\n(function(global) {\n global.CollecionesEmitter = CollecionesEmitter;\n global.CollecionesTracker = CollecionesTracker;\n global.CollecionesWebTracker = CollecionesWebTracker;\n global.CollecionesEvent = CollecionesEvent;\n global.collecionesDsl = collecionesDsl;\n})(typeof window !== 'undefined' ? window : globalThis);"],"names":[],"mappings":";;;IAAA;;;IAGA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,QAAQ,GAAG,UAAU,GAAG,EAAE;IAChC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;IAC5E,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,KAAK,MAAM;IACX,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC3D;IACA;;IAgBA;IACA;IACA;IACA;IACA;IACA,MAAM,iBAAiB,GAAG,WAAW;IACrC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE;IAC3E,QAAQ,OAAO,EAAE;IACjB;IACA,IAAI,OAAO;IACX,QAAQ,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;IACrC,QAAQ,QAAQ,EAAE,SAAS,CAAC,QAAQ;IACpC,QAAQ,QAAQ,EAAE,SAAS,CAAC,QAAQ;IACpC,QAAQ,QAAQ,EAAE,QAAQ,CAAC,QAAQ;IACnC,QAAQ,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;IAC1C,QAAQ,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;IACxC,QAAQ,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE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,OAAO;IACf,YAAY,GAAG,EAAE,SAAS;IAC1B,YAAY,CAAC,EAAE,iBAAiB;IAChC,YAAY,UAAU,EAAE;IACxB,gBAAgB,EAAE,EAAE;IACpB,aAAa;IACb,YAAY,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC;IACnC,YAAY,IAAI,EAAE,OAAO;IACzB,YAAY;IACZ;;IAEA,KAAK,EAAE,MAAM,CAAC;IACd;;IAEA,IAAI,cAAc,GAAG;IACrB,IAAI,GAAG,EAAE;IACT,CAAC;;ICnOD,CAAC,SAAS,MAAM,EAAE;IAClB,EAAE,MAAM,CAAC,kBAAkB,GAAG,kBAAkB;IAChD,EAAE,MAAM,CAAC,kBAAkB,GAAG,kBAAkB;IAChD,EAAE,MAAM,CAAC,qBAAqB,GAAG,qBAAqB;IACtD,EAAE,MAAM,CAAC,gBAAgB,GAAG,gBAAgB;IAC5C,EAAE,MAAM,CAAC,cAAc,GAAG,cAAc;IACxC,CAAC,EAAE,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;;;;;;"}
1
+ {"version":3,"file":"collecionesClientos.iife.js","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/collecionesDsl.js","../src/collecionesClientos.js"],"sourcesContent":["// helper 'private' functions\n\n\n/**\n * Encodes a string to Base64.\n * Uses browser or Node.js method depending on environment.\n * @param {string} str\n * @returns {string}\n */\nconst toBase64 = function (str) {\n if (typeof window !== 'undefined' && typeof window.btoa === 'function') {\n return window.btoa(unescape(encodeURIComponent(str)));\n } else {\n return Buffer.from(str, 'utf-8').toString('base64');\n }\n}\n\n/**\n * Decodes a Base64 string to UTF-8.\n * Uses browser or Node.js method depending on environment.\n * @param {string} b64\n * @returns {string}\n */\nconst fromBase64 = function (b64) {\n if (typeof window !== 'undefined' && typeof window.atob === 'function') {\n return decodeURIComponent(escape(window.atob(b64)));\n } else {\n return Buffer.from(b64, 'base64').toString('utf-8');\n }\n}\n\n/**\n * Collects browser-related context values like screen size, language, etc.\n * Returns an empty object if not in browser environment.\n * @returns {Object}\n */\nconst getBrowserContext = function() {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return {};\n }\n return {\n hasFocus: document.hasFocus(),\n language: navigator.language,\n platform: navigator.platform,\n referrer: document.referrer,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n url: window.location.href,\n userAgent: navigator.userAgent,\n viewportHeight: window.innerHeight,\n viewportWidth: window.innerWidth,\n };\n}\n\nexport {\n fromBase64,\n getBrowserContext,\n toBase64,\n};","/**\n * CollecionesEvent\n * -----------------\n * Base class representing a semantically structured event object.\n * Each event models a specific interaction with an entity, optionally performed by an actor,\n * and may reference related entities or include contextual metadata.\n *\n * Key features:\n * - Captures structured semantics: entity, action, actor, context, references\n * - Supports multiple identifiers for both the main entity and the actor\n * - Allows origin tagging for cross-context or cross-application references\n * - Supports referencing collections of entities or grouped data\n * - Includes timestamps and tracker/app metadata for auditability\n * - Fully serializable and deserializable via toJSON/fromJSON\n */\nclass CollecionesEvent {\n\n /**\n * Constructs a new CollecionesEvent with default structure and timestamps.\n * Initializes empty containers for semantic attributes such as:\n * - entity: the subject of the event\n * - adjectives: descriptors of the entity\n * - identifiers: identifiers of the entity\n * - action: what happened to the entity\n * - actor: who or what triggered the event (with identifiers in actorIdentifiers)\n * - context: environmental data related to the event\n * - references: external entities involved, optionally scoped by origin\n * - collections: groups of related entities\n * - meta: tracking metadata and timestamps\n */\n constructor() {\n // initialize event properties\n this.entity = '';\n this.adjevtives = [];\n this.identifiers = {};\n this.action = '';\n this.actor = {};\n this.actorIdentifiers = {};\n this.context = {};\n this.references = {};\n this.collections = {};\n // set default values\n this.meta = {\n eventFormat: 'CollecionesEvent',\n eventFormatVersion: '1'\n };\n this.meta.tracker = '';\n this.meta.app = '';\n this.meta.timestamps = {};\n this.meta.timestamps.clientDatetimeUtc = new Date().toISOString();\n if (typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.language) {\n this.meta.timestamps.clientDatetimeLocal = new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString();\n this.meta.timestamps.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n this.meta.timestamps.timeZoneOffset = new Date().getTimezoneOffset()\n } else {\n this.meta.timestamps.clientDatetimeLocal = new Date().toISOString();\n this.meta.timestamps.timeZone = 'UTC';\n }\n }\n\n /**\n * Returns the declared event format.\n * @returns {string} The format name (e.g. 'CollecionesEvent').\n */\n getEventFormat() {\n let v = this.meta?.eventFormat;\n return (typeof v !== 'undefined') ? v : '1';\n }\n\n /**\n * Returns the version of the event format.\n * @returns {string} The format version string.\n */\n getEventFormatVersion() {\n let v = this?.meta?.eventFormatVersion;\n return (typeof v !== 'undefined') ? v : 'CollecionesEvent';\n }\n\n /**\n * Overrides or supplements the event's timestamp fields with custom values.\n * @param {object} dateTimeObject - Key-value pairs to merge into the existing timestamp object.\n */\n overrideDatetime(dateTimeObject = {}) {\n for (const [key, value] of Object.entries(dateTimeObject)) {\n this.meta.timestamps[key] = value;\n }\n }\n\n /**\n * Sets the name of the tracker responsible for generating this event.\n * @param {string} name - Tracker name.\n */\n setTracker(name) {\n this.meta.tracker = name;\n }\n\n /**\n * Sets the name of the application that generated the event.\n * @param {string} name - Application name.\n */\n setAppName(name) {\n this.meta.appName = name;\n }\n\n /**\n * Sets the expected schema name for this event.\n * @param {string} schema - The name of the schema.\n */\n setSchema(schema) {\n if (typeof schema !== 'string') {\n throw new Error('Schema must be a string');\n }\n this.meta.schema = schema;\n }\n\n /**\n * Sets the entity (subject) of the event.\n * @param {string} entity - The entity name.\n */\n setEntity = function(entity) {\n this.entity = entity;\n }\n \n /**\n * Defines the main action of the event (e.g., 'clicked').\n * @param {string} action - The action string.\n */\n setAction = function(action) {\n this.action = action;\n }\n\n /**\n * Adds an adjective that describes the entity in more detail.\n * @param {string} adjective - An adjective string.\n */\n addAdjective = function(adjective) {\n if (typeof adjective !== 'string') {\n throw new Error('Adjective must be a string');\n }\n this.adjevtives.push(adjective);\n }\n\n /**\n * Adds or updates an identifier for the primary entity.\n * Identifiers allow multiple keys to uniquely identify the entity.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n */\n setIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Identifier name must be a string');\n }\n this.identifiers[name] = identifier;\n }\n\n /**\n * Defines the name of the actor (who or what performed the action).\n * @param {string} name - Actor name (e.g., 'user', 'system').\n */\n setActor = function(name) {\n if (typeof name !== 'string') {\n throw new Error('Actor name must be a string');\n }\n this.actor.name = name;\n }\n\n /**\n * Adds or updates an identifier for the actor.\n * Supports multiple identifiers to uniquely identify the actor.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setActorIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.actorIdentifiers[name] = identifier;\n }\n\n /**\n * Adds contextual information to the event.\n * Context can include any additional environmental or situational data.\n * @param {string} context - The key of the context field.\n * @param {*} value - The value of the context field.\n */\n setContext = function(context, value) {\n if (typeof context !== 'string') {\n throw new Error('Context must be a string');\n }\n this.context[context] = value;\n }\n\n /**\n * Alias for `setReference` for compatibility.\n * Declares an external entity referenced by this event.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setRefence = function(entity, origin=null) {\n return this.setReference(entity, origin);\n }\n\n /**\n * Declares an entity referenced by this event.\n * References may include multiple identifiers and an optional origin to scope the reference.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setReference = function(entity, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity must be a string');\n }\n if(this.references[entity] === undefined) {\n this.references[entity] = {\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * Ensures the reference is declared and sets the identifier under that reference.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setRefenceIdentifier = function(entity, name, identifier, origin=null) {\n return this.setReferenceIdentifier(entity, name, identifier, origin);\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setReferenceIdentifier = function(entity, name, identifier, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity name must be a string');\n }\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.setRefence(entity, origin);\n this.references[entity].identifiers[name] = identifier;\n }\n\n /**\n * Declares a collection of related entities for this event.\n * Collections group multiple related items and may include identifiers and origin metadata.\n * @param {string} entity - The collection name.\n * @param {string|null} origin - Optional origin identifier (e.g. system name).\n */\n setCollection = function(entity, origin=null) {\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {\n items: [],\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds a new item to a collection and returns its index key.\n * Items represent individual elements within the collection.\n * @param {string} entity - The name of the collection.\n * @returns {number} Index of the newly added item in the collection.\n */\n setCollectionItem = function(entity) {\n this.setCollection(entity);\n this.collections[entity].items.push({});\n let itemKey = this.collections[entity].items.length - 1;\n return itemKey;\n }\n\n /**\n * Assigns a reference (identifier) to a specific item in a collection.\n * Useful for tagging individual collection elements with identifiers.\n * @param {string} entity - Collection name.\n * @param {number} itemKey - The index of the item in the collection.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @throws {Error} If the item does not exist at the given index.\n */\n setCollectionItemReference = function(entity, itemKey, name, identifier) {\n this.setCollection(entity);\n if(typeof this.collections[entity].items[itemKey] !== 'object') {\n throw new Error('bad bad man, the collection key does not exists');\n }\n this.collections[entity].items[itemKey][name] = identifier;\n }\n \n /**\n * Sets a static identifier that applies to the entire collection.\n * These identifiers describe the collection as a whole.\n * @param {string} entity - Collection name.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setCollectionIdentifier = function(entity, name, identifier) {\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {};\n }\n this.collections[entity].identifiers[name] = identifier;\n }\n\n /**\n * Serializes the event instance to a plain object suitable for transport or storage.\n * The output includes all semantic fields and metadata.\n * @returns {object} A plain JavaScript object representing the event.\n */\n toJSON() {\n return {\n class: 'CollecionesEvent',\n entity: this.entity,\n adjectives: this.adjevtives,\n identifiers: this.identifiers,\n action: this.action,\n actor: this.actor,\n actorIdentifiers: this.actorIdentifiers,\n actorIds: this.actorIds,\n context: this.context,\n references: this.references,\n meta: this.meta,\n collections: this.collections\n };\n }\n\n /**\n * Recreates a CollecionesEvent instance from a plain object.\n * Used when deserializing events from storage or network transport.\n * @param {object} obj - The input object containing event data.\n * @returns {CollecionesEvent} A rehydrated event instance.\n * @throws {Error} If the class type is not 'CollecionesEvent'.\n */\n static fromJSON(obj) { \n if (!obj || obj.class !== 'CollecionesEvent') {\n throw new Error('Invalid or missing event class type'); \n } \n const instance = new CollecionesEvent();\n instance.entity = obj.entity;\n instance.adjevtives = obj.adjectives || [];\n instance.identifiers = obj.identifiers || {};\n instance.action = obj.action;\n instance.actor = obj.actor;\n instance.actorIdentifiers = obj.actorIdentifiers;\n instance.actorIds = obj.actorIds;\n instance.context = obj.context || {};\n instance.references = obj.references || {};\n instance.meta = obj.meta || {};\n instance.collections = obj.collections || {};\n return instance;\n }\n \n}\n\nexport default CollecionesEvent;","import { fromBase64, toBase64 } from './utils/utils.js';\nimport CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * CollecionesEmitter\n * -------------------\n * This class collects and sends event objects to a remote endpoint (e.g., an event collector API).\n * It is used in both client- and server-side tracking scenarios, typically in combination with\n * CollecionesEvent or subclasses like CollecionesBaseEvent.\n *\n * Behavior:\n * - Events are buffered via `.track()` or `.trackAsync()`.\n * - If the number of buffered events reaches `flushSize`, the buffer is automatically flushed.\n * - If `flushInterval` is provided, the buffer is flushed at a fixed interval.\n * - Flushing serializes each event using `.toJSON()`, encodes it with base64, and posts\n * the resulting array to the configured endpoint.\n *\n * Example usage:\n * const emitter = new CollecionesEmitter('/track', 5, 10000);\n * emitter.track(new CollecionesEvent());\n *\n * Note:\n * This class is stateful. To stop periodic flushing, call `.stopTimer()` when the emitter is no longer in use.\n */\nclass CollecionesEmitter {\n\n /**\n * Initializes the emitter with buffering settings.\n * @param {string} [endpoint='/collect'] - The URL to send events to.\n * @param {number} [flushSize=10] - Number of events to buffer before flushing.\n * @param {number|boolean} [flushInterval=false] - Time in ms to flush events periodically.\n */\n constructor(endpoint = '/collect', flushSize = 10, flushInterval = false) {\n this.endpoint = endpoint;\n this.flushInterval = flushInterval;\n this.flushSize = flushSize;\n this.buffer = [];\n this.timer = null;\n this.lastPayload = null;\n }\n\n /**\n * Starts the flush timer if a valid interval is set.\n * @returns {void}\n */\n startTimer() {\n this.stopTimer();\n if (typeof this.flushInterval == 'number' && this.flushInterval > 0) {\n this.timer = setInterval(() => this.flush(), this.flushInterval);\n }\n }\n\n /**\n * Starts the flush timer only if not already running.\n * @returns {void}\n */\n startTimerIfStopped() {\n if (!this.timer) {\n this.startTimer();\n }\n }\n\n /**\n * Stops the active flush timer.\n * @returns {void}\n */\n stopTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.timer = null;\n }\n\n /**\n * Adds an event to the buffer and flushes if threshold is reached.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {void}\n */\n track(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.trackAsync(event);\n }\n\n /**\n * Asynchronously adds an event and flushes if the buffer size is exceeded.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked asynchronously.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {Promise<void>} Resolves when event is added and flush triggered if needed.\n */\n async trackAsync(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.startTimerIfStopped();\n this.buffer.push(event);\n return (this.buffer.length >= this.flushSize) ? this.flush() : Promise.resolve();\n }\n\n /**\n * Sends all buffered events in a single POST request to the server.\n * Each event is serialized via `.toJSON()` and encoded as a base64 string.\n * Response status is checked for HTTP success; errors are logged but not thrown.\n *\n * @returns {Promise<boolean|undefined>} Resolves true if flush was triggered, or undefined if buffer was empty.\n */\n async flush() {\n if (this.buffer.length === 0) return;\n this.stopTimer();\n const body = this.buildBody();\n this.lastPayload = body;\n this.buffer = [];\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n body\n });\n if (!response.ok) {\n console.log(`Failed to send events: ${response.statusText}`);\n }\n return true;\n } catch (error) { \n console.log(`Network error sending events: ${error.message}`);\n } \n }\n\n /**\n * Builds a POST-ready payload from the current buffer, without clearing it.\n * @returns {string} JSON string of base64-encoded serialized events.\n */\n buildBody() {\n return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));\n }\n\n}\n\nexport default CollecionesEmitter;","import CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * Tracks events by enriching them with shared identifiers and routing through configured emitters.\n */\nclass CollecionesTracker {\n\n /**\n * Constructs a new tracker instance.\n * @param {Array} emitters - Array of emitter instances responsible for sending events.\n * @param {string} trackerName - Name identifying this tracker.\n * @param {string} appName - Name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n this.emitters = emitters;\n this.trackerName = trackerName;\n this.appName = appName;\n }\n\n /**\n * Sends an event to all emitters after enriching it with identifiers and metadata.\n * @param {CollecionesEvent} collecionesEvent - The event to be sent.\n * @throws {Error} If the input is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setTracker(this.trackerName);\n collecionesEvent.setAppName(this.appName); \n this.emitters.forEach(element => {\n element.track(collecionesEvent, this.trackerName, this.appName);\n });\n }\n}\n\nexport default CollecionesTracker;","import CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport { getBrowserContext } from './utils/utils.js';\n\n/**\n * Web-specific tracker that enriches events with browser context before sending them.\n * Extends the base CollecionesTracker.\n */\nclass CollecionesWebTracker extends CollecionesTracker {\n /**\n * Creates a new instance of CollecionesWebTracker.\n * @param {Array} emitters - A list of emitter instances used to send the event.\n * @param {string} trackerName - The name of the tracker.\n * @param {string} appName - The name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n super(emitters, trackerName, appName);\n }\n\n /**\n * Tracks an event, enriching it with browser context information.\n * @param {CollecionesEvent} collecionesEvent - The event object to track.\n * @throws {Error} If the event is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setContext('browserContext', getBrowserContext());\n super.track(collecionesEvent); \n }\n}\n\nexport default CollecionesWebTracker;","/**\n * Colleciones DSL\n * ---------------\n * This module provides a fluent, human-readable DSL (domain-specific language) for constructing\n * structured tracking events based on CollecionesBaseEvent. Each step in the chain represents\n * a semantically meaningful piece of the event: the entity, the action, the actor, references, etc.\n *\n * Entry Point:\n * collecionesDsl.the('dark')\n *\n * Chaining:\n * - .and('...') : add additional adjectives\n * - ._('entity') : specify the entity being acted on\n * - .identified.by('field') : declare primary identifier for the subject\n * - .has.been('action') : declare what happened\n * - .by('actor') : describe the actor performing the action\n * - .identified.by('id') : add identifiers for the actor\n * - .with('key').set.to('val') : add contextual data fields\n * - .referring.to('entity') : describe referenced/related entities\n * - .identified.by('refId') : add identifiers for the reference\n * - .conform.to('SchemaName') : attach schema metadata\n * - .then.track.with(emitter) : finalize and emit the event\n *\n * Each function in the chain passes forward a scoped version of the CollecionesBaseEvent instance,\n * and enforces semantic constraints (e.g. `.as()` is required after `.by()`).\n *\n * Internal:\n * - Uses setRefence / setRefenceIdentifier for references\n * - Uses helpers.getEvent() for test access\n * - Uses instanceof CollecionesEmitter for validation\n *\n * This file is designed for internal use by developers building with the Colleciones tracking model.\n */\n\nimport CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\n\nlet init = (entity) => {\n return ((entity)=>{\n let eventInstance = new CollecionesEvent(); // Core event object\n eventInstance.setEntity(entity);\n\n let helpers = {\n getEvent: () => {\n return eventInstance;\n },\n };\n\n // DSL function groups\n let andEntity = () => {}; // .and(...) chaining after the()\n let setEntityAfterAnd = () => {}; // ._('entity') after .and\n let setEntityIdentifiers = () => {}; // .identified.by(...) for main subject\n let setAction = () => {}; // .has.been(...) for action\n let setActor = () => {}; // .by('actor')\n let setActorIdentifier = () => {}; // .identified.by(...) inside .by(...)\n let addContext = () => {}; // .with(...).set.to(...)\n let addReference = () => {}; // .referring.to(...)\n let getAddReference = () => {}; // .identified.by().as() inside .referring\n let conformingTo = () => {}; // .conform.to('SchemaName')\n let track = () => {}; // .then.track.with(emitter)\n let addCollection = () => {};\n\n // Adjective chaining: .and(...)._('entity')\n setEntityAfterAnd = (entity) => {\n eventInstance.addAdjective(eventInstance.entity);\n eventInstance.setEntity(entity);\n return {\n as: () => {\n return { helpers }\n },\n identified: {\n by: setEntityIdentifiers\n },\n has: { been: setAction },\n helpers\n };\n };\n\n // Identifier setup: .identified.by().as()\n setEntityIdentifiers = (name) => {\n eventInstance.setIdentifier(name, null);\n return {\n as: (value) => {\n eventInstance.setIdentifier(name, value);\n return {\n helpers,\n and: {\n by: setEntityIdentifiers\n },\n has: { been: setAction },\n }\n },\n helpers\n };\n };\n\n // Additional adjectives: .and('...')._()\n andEntity = (entity) => {\n eventInstance.addAdjective(eventInstance.entity);\n eventInstance.setEntity(entity);\n return {\n and: andEntity,\n _ : setEntityAfterAnd,\n helpers\n }\n };\n\n // Action: .has.been('...')\n setAction = (action) => {\n eventInstance.setAction(action);\n return {\n by: setActor,\n referring: { to: addReference },\n with: addContext,\n conform: {to: conformingTo},\n then: {track: {with: track}},\n including: {\n a: addCollection,\n },\n helpers\n }\n };\n\n // Actor: .by('user')\n setActor = (name) => {\n eventInstance.setActor(name);\n return { \n identified: {\n by: setActorIdentifier\n },\n with: addContext,\n including: {\n a: addCollection,\n },\n helpers\n }\n };\n\n // Actor identifier: .identified.by().as()\n setActorIdentifier = (name) => {\n return {\n as: (value) => {\n eventInstance.setActorIdentifier(name, value);\n return {\n helpers,\n and: setActorIdentifier,\n with: addContext,\n referring: { to: addReference },\n including: {\n a: addCollection,\n },\n }\n },\n helpers\n }\n };\n\n // Contextual field: .with('key').set.to('value')\n addContext = (context) => {\n return {\n helpers,\n set: {\n to: (value) => {\n eventInstance.setContext(context, value);\n return {\n helpers,\n and: addContext,\n referring: { to: addReference },\n including: {\n a: addCollection,\n },\n }\n }\n }\n }\n };\n\n // Reference: .referring.to('...')\n addReference = (entity) => {\n eventInstance.setRefence(entity);\n return {\n identified: {\n by: getAddReference(entity)\n },\n conform: {to: conformingTo},\n then: {track: {with: track}},\n including: {\n a: addCollection,\n },\n helpers\n }\n };\n\n // Reference identifier setup: .identified.by().as()\n getAddReference = (entity) => {\n return (name) => {\n return {\n as: (value) => {\n eventInstance.setRefenceIdentifier(entity, name, value);\n return {\n helpers,\n and: {by: getAddReference(entity) },\n conform: {to: conformingTo},\n then: {track: {with: track}},\n including: {\n a: addCollection,\n },\n }\n },\n helpers,\n };\n };\n };\n\n // Schema declaration: .conform.to('...')\n conformingTo = (name) => {\n eventInstance.setSchema(name);\n return { \n then: {track: {with: track}},\n helpers\n }\n };\n\n addCollection = (entity) => {\n const collection = () => {\n eventInstance.setCollection(entity);\n \n const addItem = (referenceName) => {\n const itemKey = eventInstance.setCollectionItem(entity);\n const addIdentifier = (referenceNameNewIdentifier) => {\n referenceName = referenceNameNewIdentifier;\n return {\n as: addItemReferenceValue,\n }\n }\n const addItemReferenceValue = (value) => {\n eventInstance.setCollectionItemReference(entity, itemKey, referenceName, value);\n return {\n and: {\n helpers, \n by: addIdentifier,\n item: { \n identified: { \n by: addItem\n }\n },\n a: addCollection\n },\n conform: {\n to: conformingTo,\n }, \n then: {track: {with: track}},\n helpers\n }\n }\n return {\n as: addItemReferenceValue\n }\n\n };\n\n return {\n helpers,\n with: {\n item: {\n identified: {\n by: addItem\n }\n }\n },\n and: { a: addCollection }\n }\n };\n return {\n collection\n }\n }\n\n // Final dispatch: .then.track.with(tracker)\n track = (tracker) => {\n if(!(tracker instanceof CollecionesTracker)){\n throw new Error('can only be a CollecionesTracker')\n }\n tracker.track(eventInstance);\n return {\n and: track,\n helpers,\n }\n };\n\n return {\n and: andEntity,\n _: setEntityAfterAnd,\n identified: {\n by: setEntityIdentifiers\n },\n has: { been: setAction},\n node: '_base',\n helpers\n }\n\n })(entity);\n}\n\nlet collecionesDsl = {\n the: init\n};\n\n\nexport default collecionesDsl;","import CollecionesEmitter from './CollecionesEmitter.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport CollecionesWebTracker from './CollecionesWebTracker.js';\nimport CollecionesEvent from './CollecionesEvent.js';\nimport collecionesDsl from './collecionesDsl.js';\n\n(function(global) {\n global.CollecionesEmitter = CollecionesEmitter;\n global.CollecionesTracker = CollecionesTracker;\n global.CollecionesWebTracker = CollecionesWebTracker;\n global.CollecionesEvent = CollecionesEvent;\n global.collecionesDsl = collecionesDsl;\n})(typeof window !== 'undefined' ? window : globalThis);"],"names":[],"mappings":";;;IAAA;;;IAGA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,QAAQ,GAAG,UAAU,GAAG,EAAE;IAChC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,U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1B,YAAY,CAAC,EAAE,iBAAiB;IAChC,YAAY,UAAU,EAAE;IACxB,gBAAgB,EAAE,EAAE;IACpB,aAAa;IACb,YAAY,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC;IACnC,YAAY,IAAI,EAAE,OAAO;IACzB,YAAY;IACZ;;IAEA,KAAK,EAAE,MAAM,CAAC;IACd;;IAEA,IAAI,cAAc,GAAG;IACrB,IAAI,GAAG,EAAE;IACT,CAAC;;IC5SD,CAAC,SAAS,MAAM,EAAE;IAClB,EAAE,MAAM,CAAC,kBAAkB,GAAG,kBAAkB;IAChD,EAAE,MAAM,CAAC,kBAAkB,GAAG,kBAAkB;IAChD,EAAE,MAAM,CAAC,qBAAqB,GAAG,qBAAqB;IACtD,EAAE,MAAM,CAAC,gBAAgB,GAAG,gBAAgB;IAC5C,EAAE,MAAM,CAAC,cAAc,GAAG,cAAc;IACxC,CAAC,EAAE,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;;;;;;"}
package/dist/index.cjs CHANGED
@@ -42,13 +42,34 @@ const getBrowserContext = function() {
42
42
  };
43
43
 
44
44
  /**
45
- * Base class representing a structured event with timestamp, identifiers, and data fields.
46
- * This class is used to model events in a semantic and structured format for tracking purposes.
45
+ * CollecionesEvent
46
+ * -----------------
47
+ * Base class representing a semantically structured event object.
48
+ * Each event models a specific interaction with an entity, optionally performed by an actor,
49
+ * and may reference related entities or include contextual metadata.
50
+ *
51
+ * Key features:
52
+ * - Captures structured semantics: entity, action, actor, context, references
53
+ * - Supports multiple identifiers for both the main entity and the actor
54
+ * - Allows origin tagging for cross-context or cross-application references
55
+ * - Supports referencing collections of entities or grouped data
56
+ * - Includes timestamps and tracker/app metadata for auditability
57
+ * - Fully serializable and deserializable via toJSON/fromJSON
47
58
  */
48
59
  class CollecionesEvent {
49
60
 
50
61
  /**
51
- * Constructs a new event with default metadata and timestamps.
62
+ * Constructs a new CollecionesEvent with default structure and timestamps.
63
+ * Initializes empty containers for semantic attributes such as:
64
+ * - entity: the subject of the event
65
+ * - adjectives: descriptors of the entity
66
+ * - identifiers: identifiers of the entity
67
+ * - action: what happened to the entity
68
+ * - actor: who or what triggered the event (with identifiers in actorIdentifiers)
69
+ * - context: environmental data related to the event
70
+ * - references: external entities involved, optionally scoped by origin
71
+ * - collections: groups of related entities
72
+ * - meta: tracking metadata and timestamps
52
73
  */
53
74
  constructor() {
54
75
  // initialize event properties
@@ -60,6 +81,7 @@ class CollecionesEvent {
60
81
  this.actorIdentifiers = {};
61
82
  this.context = {};
62
83
  this.references = {};
84
+ this.collections = {};
63
85
  // set default values
64
86
  this.meta = {
65
87
  eventFormat: 'CollecionesEvent',
@@ -163,6 +185,7 @@ class CollecionesEvent {
163
185
 
164
186
  /**
165
187
  * Adds or updates an identifier for the primary entity.
188
+ * Identifiers allow multiple keys to uniquely identify the entity.
166
189
  * @param {string} name - The identifier key.
167
190
  * @param {*} identifier - The identifier value.
168
191
  */
@@ -175,7 +198,7 @@ class CollecionesEvent {
175
198
 
176
199
  /**
177
200
  * Defines the name of the actor (who or what performed the action).
178
- * @param {string} name - Actor name (e.g., 'user').
201
+ * @param {string} name - Actor name (e.g., 'user', 'system').
179
202
  */
180
203
  setActor = function(name) {
181
204
  if (typeof name !== 'string') {
@@ -186,7 +209,8 @@ class CollecionesEvent {
186
209
 
187
210
  /**
188
211
  * Adds or updates an identifier for the actor.
189
- * @param {string} name - Identifier name.
212
+ * Supports multiple identifiers to uniquely identify the actor.
213
+ * @param {string} name - Identifier key.
190
214
  * @param {*} identifier - Identifier value.
191
215
  */
192
216
  setActorIdentifier = function(name, identifier) {
@@ -198,6 +222,7 @@ class CollecionesEvent {
198
222
 
199
223
  /**
200
224
  * Adds contextual information to the event.
225
+ * Context can include any additional environmental or situational data.
201
226
  * @param {string} context - The key of the context field.
202
227
  * @param {*} value - The value of the context field.
203
228
  */
@@ -208,39 +233,128 @@ class CollecionesEvent {
208
233
  this.context[context] = value;
209
234
  }
210
235
 
236
+ /**
237
+ * Alias for `setReference` for compatibility.
238
+ * Declares an external entity referenced by this event.
239
+ * @param {string} entity - The referenced entity name.
240
+ * @param {string|null} origin - The origin application or context (optional).
241
+ */
242
+ setRefence = function(entity, origin=null) {
243
+ return this.setReference(entity, origin);
244
+ }
245
+
211
246
  /**
212
247
  * Declares an entity referenced by this event.
248
+ * References may include multiple identifiers and an optional origin to scope the reference.
213
249
  * @param {string} entity - The referenced entity name.
250
+ * @param {string|null} origin - The origin application or context (optional).
214
251
  */
215
- setRefence = function(entity) {
252
+ setReference = function(entity, origin=null) {
216
253
  if (typeof entity !== 'string') {
217
254
  throw new Error('Referenced entity must be a string');
218
255
  }
219
256
  if(this.references[entity] === undefined) {
220
- this.references[entity] = {identifiers: {}};
257
+ this.references[entity] = {
258
+ identifiers: {},
259
+ origin
260
+ };
221
261
  }
222
262
  }
223
263
 
264
+ /**
265
+ * Adds or updates an identifier for a referenced entity.
266
+ * Ensures the reference is declared and sets the identifier under that reference.
267
+ * @param {string} entity - The referenced entity name.
268
+ * @param {string} name - The identifier key.
269
+ * @param {*} identifier - The identifier value.
270
+ * @param {string|null} origin - Optional origin context.
271
+ */
272
+ setRefenceIdentifier = function(entity, name, identifier, origin=null) {
273
+ return this.setReferenceIdentifier(entity, name, identifier, origin);
274
+ }
275
+
224
276
  /**
225
277
  * Adds or updates an identifier for a referenced entity.
226
278
  * @param {string} entity - The referenced entity name.
227
279
  * @param {string} name - The identifier key.
228
280
  * @param {*} identifier - The identifier value.
281
+ * @param {string|null} origin - Optional origin context.
229
282
  */
230
- setRefenceIdentifier = function(entity, name, identifier) {
283
+ setReferenceIdentifier = function(entity, name, identifier, origin=null) {
231
284
  if (typeof entity !== 'string') {
232
285
  throw new Error('Referenced entity name must be a string');
233
286
  }
234
287
  if (typeof name !== 'string') {
235
288
  throw new Error('Actor Identifier name must be a string');
236
289
  }
237
- this.setRefence(entity);
290
+ this.setRefence(entity, origin);
238
291
  this.references[entity].identifiers[name] = identifier;
239
292
  }
240
293
 
241
294
  /**
242
- * Serializes the event to a plain object suitable for JSON.stringify().
243
- * @returns {object}
295
+ * Declares a collection of related entities for this event.
296
+ * Collections group multiple related items and may include identifiers and origin metadata.
297
+ * @param {string} entity - The collection name.
298
+ * @param {string|null} origin - Optional origin identifier (e.g. system name).
299
+ */
300
+ setCollection = function(entity, origin=null) {
301
+ if(this.collections[entity] == undefined) {
302
+ this.collections[entity] = {
303
+ items: [],
304
+ identifiers: {},
305
+ origin
306
+ };
307
+ }
308
+ }
309
+
310
+ /**
311
+ * Adds a new item to a collection and returns its index key.
312
+ * Items represent individual elements within the collection.
313
+ * @param {string} entity - The name of the collection.
314
+ * @returns {number} Index of the newly added item in the collection.
315
+ */
316
+ setCollectionItem = function(entity) {
317
+ this.setCollection(entity);
318
+ this.collections[entity].items.push({});
319
+ let itemKey = this.collections[entity].items.length - 1;
320
+ return itemKey;
321
+ }
322
+
323
+ /**
324
+ * Assigns a reference (identifier) to a specific item in a collection.
325
+ * Useful for tagging individual collection elements with identifiers.
326
+ * @param {string} entity - Collection name.
327
+ * @param {number} itemKey - The index of the item in the collection.
328
+ * @param {string} name - The identifier key.
329
+ * @param {*} identifier - The identifier value.
330
+ * @throws {Error} If the item does not exist at the given index.
331
+ */
332
+ setCollectionItemReference = function(entity, itemKey, name, identifier) {
333
+ this.setCollection(entity);
334
+ if(typeof this.collections[entity].items[itemKey] !== 'object') {
335
+ throw new Error('bad bad man, the collection key does not exists');
336
+ }
337
+ this.collections[entity].items[itemKey][name] = identifier;
338
+ }
339
+
340
+ /**
341
+ * Sets a static identifier that applies to the entire collection.
342
+ * These identifiers describe the collection as a whole.
343
+ * @param {string} entity - Collection name.
344
+ * @param {string} name - Identifier key.
345
+ * @param {*} identifier - Identifier value.
346
+ */
347
+ setCollectionIdentifier = function(entity, name, identifier) {
348
+ if(this.collections[entity] == undefined) {
349
+ this.collections[entity] = {};
350
+ }
351
+ this.collections[entity].identifiers[name] = identifier;
352
+ }
353
+
354
+ /**
355
+ * Serializes the event instance to a plain object suitable for transport or storage.
356
+ * The output includes all semantic fields and metadata.
357
+ * @returns {object} A plain JavaScript object representing the event.
244
358
  */
245
359
  toJSON() {
246
360
  return {
@@ -254,14 +368,17 @@ class CollecionesEvent {
254
368
  actorIds: this.actorIds,
255
369
  context: this.context,
256
370
  references: this.references,
257
- meta: this.meta
371
+ meta: this.meta,
372
+ collections: this.collections
258
373
  };
259
374
  }
260
375
 
261
376
  /**
262
- * Recreates an instance of CollecionesEvent from a plain object.
263
- * @param {object} obj
264
- * @returns {CollecionesEvent}
377
+ * Recreates a CollecionesEvent instance from a plain object.
378
+ * Used when deserializing events from storage or network transport.
379
+ * @param {object} obj - The input object containing event data.
380
+ * @returns {CollecionesEvent} A rehydrated event instance.
381
+ * @throws {Error} If the class type is not 'CollecionesEvent'.
265
382
  */
266
383
  static fromJSON(obj) {
267
384
  if (!obj || obj.class !== 'CollecionesEvent') {
@@ -278,6 +395,7 @@ class CollecionesEvent {
278
395
  instance.context = obj.context || {};
279
396
  instance.references = obj.references || {};
280
397
  instance.meta = obj.meta || {};
398
+ instance.collections = obj.collections || {};
281
399
  return instance;
282
400
  }
283
401
 
@@ -543,9 +661,9 @@ let init = (entity) => {
543
661
  let addContext = () => {}; // .with(...).set.to(...)
544
662
  let addReference = () => {}; // .referring.to(...)
545
663
  let getAddReference = () => {}; // .identified.by().as() inside .referring
546
- let addReferenceIdentifier = () => {}; // .and(...) after reference
547
664
  let conformingTo = () => {}; // .conform.to('SchemaName')
548
665
  let track = () => {}; // .then.track.with(emitter)
666
+ let addCollection = () => {};
549
667
 
550
668
  // Adjective chaining: .and(...)._('entity')
551
669
  setEntityAfterAnd = (entity) => {
@@ -601,6 +719,9 @@ let init = (entity) => {
601
719
  with: addContext,
602
720
  conform: {to: conformingTo},
603
721
  then: {track: {with: track}},
722
+ including: {
723
+ a: addCollection,
724
+ },
604
725
  helpers
605
726
  }
606
727
  };
@@ -613,6 +734,9 @@ let init = (entity) => {
613
734
  by: setActorIdentifier
614
735
  },
615
736
  with: addContext,
737
+ including: {
738
+ a: addCollection,
739
+ },
616
740
  helpers
617
741
  }
618
742
  };
@@ -627,6 +751,9 @@ let init = (entity) => {
627
751
  and: setActorIdentifier,
628
752
  with: addContext,
629
753
  referring: { to: addReference },
754
+ including: {
755
+ a: addCollection,
756
+ },
630
757
  }
631
758
  },
632
759
  helpers
@@ -644,6 +771,9 @@ let init = (entity) => {
644
771
  helpers,
645
772
  and: addContext,
646
773
  referring: { to: addReference },
774
+ including: {
775
+ a: addCollection,
776
+ },
647
777
  }
648
778
  }
649
779
  }
@@ -659,6 +789,9 @@ let init = (entity) => {
659
789
  },
660
790
  conform: {to: conformingTo},
661
791
  then: {track: {with: track}},
792
+ including: {
793
+ a: addCollection,
794
+ },
662
795
  helpers
663
796
  }
664
797
  };
@@ -671,9 +804,12 @@ let init = (entity) => {
671
804
  eventInstance.setRefenceIdentifier(entity, name, value);
672
805
  return {
673
806
  helpers,
674
- and: addReferenceIdentifier,
807
+ and: {by: getAddReference(entity) },
675
808
  conform: {to: conformingTo},
676
809
  then: {track: {with: track}},
810
+ including: {
811
+ a: addCollection,
812
+ },
677
813
  }
678
814
  },
679
815
  helpers,
@@ -690,6 +826,61 @@ let init = (entity) => {
690
826
  }
691
827
  };
692
828
 
829
+ addCollection = (entity) => {
830
+ const collection = () => {
831
+ eventInstance.setCollection(entity);
832
+
833
+ const addItem = (referenceName) => {
834
+ const itemKey = eventInstance.setCollectionItem(entity);
835
+ const addIdentifier = (referenceNameNewIdentifier) => {
836
+ referenceName = referenceNameNewIdentifier;
837
+ return {
838
+ as: addItemReferenceValue,
839
+ }
840
+ };
841
+ const addItemReferenceValue = (value) => {
842
+ eventInstance.setCollectionItemReference(entity, itemKey, referenceName, value);
843
+ return {
844
+ and: {
845
+ helpers,
846
+ by: addIdentifier,
847
+ item: {
848
+ identified: {
849
+ by: addItem
850
+ }
851
+ },
852
+ a: addCollection
853
+ },
854
+ conform: {
855
+ to: conformingTo,
856
+ },
857
+ then: {track: {with: track}},
858
+ helpers
859
+ }
860
+ };
861
+ return {
862
+ as: addItemReferenceValue
863
+ }
864
+
865
+ };
866
+
867
+ return {
868
+ helpers,
869
+ with: {
870
+ item: {
871
+ identified: {
872
+ by: addItem
873
+ }
874
+ }
875
+ },
876
+ and: { a: addCollection }
877
+ }
878
+ };
879
+ return {
880
+ collection
881
+ }
882
+ };
883
+
693
884
  // Final dispatch: .then.track.with(tracker)
694
885
  track = (tracker) => {
695
886
  if(!(tracker instanceof CollecionesTracker)){