@compilacion/colleciones-clientos 2.0.0 → 2.0.2
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/collecionesClientos.iife.js +31 -25
- package/dist/collecionesClientos.iife.js.map +1 -1
- package/dist/index.cjs +31 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +31 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -57,10 +57,8 @@
|
|
|
57
57
|
this.adjevtives = [];
|
|
58
58
|
this.identifiers = {};
|
|
59
59
|
this.action = '';
|
|
60
|
-
this.actor = {
|
|
61
|
-
|
|
62
|
-
identifiers: []
|
|
63
|
-
};
|
|
60
|
+
this.actor = {};
|
|
61
|
+
this.actorIdentifiers = {};
|
|
64
62
|
this.context = {};
|
|
65
63
|
this.references = {};
|
|
66
64
|
// set default values
|
|
@@ -196,7 +194,7 @@
|
|
|
196
194
|
if (typeof name !== 'string') {
|
|
197
195
|
throw new Error('Actor Identifier name must be a string');
|
|
198
196
|
}
|
|
199
|
-
this.
|
|
197
|
+
this.actorIdentifiers[name] = identifier;
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
/**
|
|
@@ -253,6 +251,8 @@
|
|
|
253
251
|
identifiers: this.identifiers,
|
|
254
252
|
action: this.action,
|
|
255
253
|
actor: this.actor,
|
|
254
|
+
actorIdentifiers: this.actorIdentifiers,
|
|
255
|
+
actorIds: this.actorIds,
|
|
256
256
|
context: this.context,
|
|
257
257
|
references: this.references,
|
|
258
258
|
meta: this.meta
|
|
@@ -264,16 +264,18 @@
|
|
|
264
264
|
* @param {object} obj
|
|
265
265
|
* @returns {CollecionesEvent}
|
|
266
266
|
*/
|
|
267
|
-
static fromJSON(obj) {
|
|
267
|
+
static fromJSON(obj) {
|
|
268
268
|
if (!obj || obj.class !== 'CollecionesEvent') {
|
|
269
|
-
throw new Error('Invalid or missing event class type');
|
|
270
|
-
}
|
|
269
|
+
throw new Error('Invalid or missing event class type');
|
|
270
|
+
}
|
|
271
271
|
const instance = new CollecionesEvent();
|
|
272
272
|
instance.entity = obj.entity;
|
|
273
273
|
instance.adjevtives = obj.adjectives || [];
|
|
274
274
|
instance.identifiers = obj.identifiers || {};
|
|
275
275
|
instance.action = obj.action;
|
|
276
|
-
instance.actor = obj.actor
|
|
276
|
+
instance.actor = obj.actor;
|
|
277
|
+
instance.actorIdentifiers = obj.actorIdentifiers;
|
|
278
|
+
instance.actorIds = obj.actorIds;
|
|
277
279
|
instance.context = obj.context || {};
|
|
278
280
|
instance.references = obj.references || {};
|
|
279
281
|
instance.meta = obj.meta || {};
|
|
@@ -317,6 +319,7 @@
|
|
|
317
319
|
this.flushSize = flushSize;
|
|
318
320
|
this.buffer = [];
|
|
319
321
|
this.timer = null;
|
|
322
|
+
this.lastPayload = null;
|
|
320
323
|
}
|
|
321
324
|
|
|
322
325
|
/**
|
|
@@ -390,13 +393,10 @@
|
|
|
390
393
|
*/
|
|
391
394
|
async flush() {
|
|
392
395
|
if (this.buffer.length === 0) return;
|
|
393
|
-
const eventsToSend = [...this.buffer];
|
|
394
|
-
this.buffer = [];
|
|
395
|
-
let postPayload = [];
|
|
396
|
-
eventsToSend.forEach((e) => {
|
|
397
|
-
postPayload.push( toBase64( JSON.stringify(e.toJSON())) );
|
|
398
|
-
});
|
|
399
396
|
this.stopTimer();
|
|
397
|
+
const body = this.buildBody();
|
|
398
|
+
this.lastPayload = body;
|
|
399
|
+
this.buffer = [];
|
|
400
400
|
try {
|
|
401
401
|
const response = await fetch(this.endpoint, {
|
|
402
402
|
method: 'POST',
|
|
@@ -404,16 +404,25 @@
|
|
|
404
404
|
headers: {
|
|
405
405
|
'Content-Type': 'application/json'
|
|
406
406
|
},
|
|
407
|
-
body
|
|
407
|
+
body
|
|
408
408
|
});
|
|
409
409
|
if (!response.ok) {
|
|
410
410
|
console.log(`Failed to send events: ${response.statusText}`);
|
|
411
411
|
}
|
|
412
412
|
return true;
|
|
413
|
-
} catch (error) {
|
|
413
|
+
} catch (error) {
|
|
414
414
|
console.log(`Network error sending events: ${error.message}`);
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Builds a POST-ready payload from the current buffer, without clearing it.
|
|
420
|
+
* @returns {string} JSON string of base64-encoded serialized events.
|
|
421
|
+
*/
|
|
422
|
+
buildBody() {
|
|
423
|
+
return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));
|
|
424
|
+
}
|
|
425
|
+
|
|
417
426
|
}
|
|
418
427
|
|
|
419
428
|
/**
|
|
@@ -431,7 +440,6 @@
|
|
|
431
440
|
this.emitters = emitters;
|
|
432
441
|
this.trackerName = trackerName;
|
|
433
442
|
this.appName = appName;
|
|
434
|
-
this.identifiers = {};
|
|
435
443
|
}
|
|
436
444
|
|
|
437
445
|
/**
|
|
@@ -443,9 +451,6 @@
|
|
|
443
451
|
if (!(collecionesEvent instanceof CollecionesEvent)) {
|
|
444
452
|
throw new Error('Event must be of type CollecionesEvent');
|
|
445
453
|
}
|
|
446
|
-
for (const [key, value] of Object.entries(this.identifiers)) {
|
|
447
|
-
collecionesEvent.addIdentifier(key, value);
|
|
448
|
-
}
|
|
449
454
|
collecionesEvent.setTracker(this.trackerName);
|
|
450
455
|
collecionesEvent.setAppName(this.appName);
|
|
451
456
|
this.emitters.forEach(element => {
|
|
@@ -686,11 +691,12 @@
|
|
|
686
691
|
}
|
|
687
692
|
};
|
|
688
693
|
|
|
689
|
-
// Final dispatch: .then.track.with(
|
|
690
|
-
track = (
|
|
691
|
-
if(
|
|
692
|
-
|
|
694
|
+
// Final dispatch: .then.track.with(tracker)
|
|
695
|
+
track = (tracker) => {
|
|
696
|
+
if(!(tracker instanceof CollecionesTracker)){
|
|
697
|
+
throw new Error('can only be a CollecionesTracker')
|
|
693
698
|
}
|
|
699
|
+
tracker.track(eventInstance);
|
|
694
700
|
return {
|
|
695
701
|
and: track,
|
|
696
702
|
helpers,
|
|
@@ -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 name:'', \n identifiers: []\n };\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.actor.identifiers[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 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 || { name: '', identifiers: {} };\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 { 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 }\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 const eventsToSend = [...this.buffer];\n this.buffer = [];\n let postPayload = [];\n eventsToSend.forEach((e) => {\n postPayload.push( toBase64( JSON.stringify(e.toJSON())) );\n });\n this.stopTimer();\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: JSON.stringify(postPayload)\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\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 this.identifiers = {};\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 for (const [key, value] of Object.entries(this.identifiers)) {\n collecionesEvent.addIdentifier(key, value);\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 CollecionesEmitter from './CollecionesEmitter.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(emitter)\n track = (emitter) => {\n if(emitter instanceof CollecionesEmitter){\n emitter.track(eventInstance);\n }\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.collec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,YAAY;IACZ;;IAEA,KAAK,EAAE,MAAM,CAAC;IACd;;IAEA,IAAI,cAAc,GAAG;IACrB,IAAI,GAAG,EAAE;IACT,CAAC;;IClOD,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 * 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,Q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BAAgB;IAChB;IACA,SAAS;;IAET;IACA,QAAQ,KAAK,GAAG,CAAC,OAAO,KAAK;IAC7B,YAAY,GAAG,EAAE,OAAO,YAAY,kBAAkB,CAAC,CAAC;IACxD,gBAAgB,MAAM,IAAI,KAAK,CAAC,kCAAkC;IAClE;IACA,YAAY,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC;IACxC,YAAY,OAAO;IACnB,gBAAgB,GAAG,EAAE,KAAK;IAC1B,gBAAgB,OAAO;IACvB;IACA,SAAS;;IAET,QAAQ,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;;;;;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -56,10 +56,8 @@ class CollecionesEvent {
|
|
|
56
56
|
this.adjevtives = [];
|
|
57
57
|
this.identifiers = {};
|
|
58
58
|
this.action = '';
|
|
59
|
-
this.actor = {
|
|
60
|
-
|
|
61
|
-
identifiers: []
|
|
62
|
-
};
|
|
59
|
+
this.actor = {};
|
|
60
|
+
this.actorIdentifiers = {};
|
|
63
61
|
this.context = {};
|
|
64
62
|
this.references = {};
|
|
65
63
|
// set default values
|
|
@@ -195,7 +193,7 @@ class CollecionesEvent {
|
|
|
195
193
|
if (typeof name !== 'string') {
|
|
196
194
|
throw new Error('Actor Identifier name must be a string');
|
|
197
195
|
}
|
|
198
|
-
this.
|
|
196
|
+
this.actorIdentifiers[name] = identifier;
|
|
199
197
|
}
|
|
200
198
|
|
|
201
199
|
/**
|
|
@@ -252,6 +250,8 @@ class CollecionesEvent {
|
|
|
252
250
|
identifiers: this.identifiers,
|
|
253
251
|
action: this.action,
|
|
254
252
|
actor: this.actor,
|
|
253
|
+
actorIdentifiers: this.actorIdentifiers,
|
|
254
|
+
actorIds: this.actorIds,
|
|
255
255
|
context: this.context,
|
|
256
256
|
references: this.references,
|
|
257
257
|
meta: this.meta
|
|
@@ -263,16 +263,18 @@ class CollecionesEvent {
|
|
|
263
263
|
* @param {object} obj
|
|
264
264
|
* @returns {CollecionesEvent}
|
|
265
265
|
*/
|
|
266
|
-
static fromJSON(obj) {
|
|
266
|
+
static fromJSON(obj) {
|
|
267
267
|
if (!obj || obj.class !== 'CollecionesEvent') {
|
|
268
|
-
throw new Error('Invalid or missing event class type');
|
|
269
|
-
}
|
|
268
|
+
throw new Error('Invalid or missing event class type');
|
|
269
|
+
}
|
|
270
270
|
const instance = new CollecionesEvent();
|
|
271
271
|
instance.entity = obj.entity;
|
|
272
272
|
instance.adjevtives = obj.adjectives || [];
|
|
273
273
|
instance.identifiers = obj.identifiers || {};
|
|
274
274
|
instance.action = obj.action;
|
|
275
|
-
instance.actor = obj.actor
|
|
275
|
+
instance.actor = obj.actor;
|
|
276
|
+
instance.actorIdentifiers = obj.actorIdentifiers;
|
|
277
|
+
instance.actorIds = obj.actorIds;
|
|
276
278
|
instance.context = obj.context || {};
|
|
277
279
|
instance.references = obj.references || {};
|
|
278
280
|
instance.meta = obj.meta || {};
|
|
@@ -316,6 +318,7 @@ class CollecionesEmitter {
|
|
|
316
318
|
this.flushSize = flushSize;
|
|
317
319
|
this.buffer = [];
|
|
318
320
|
this.timer = null;
|
|
321
|
+
this.lastPayload = null;
|
|
319
322
|
}
|
|
320
323
|
|
|
321
324
|
/**
|
|
@@ -389,13 +392,10 @@ class CollecionesEmitter {
|
|
|
389
392
|
*/
|
|
390
393
|
async flush() {
|
|
391
394
|
if (this.buffer.length === 0) return;
|
|
392
|
-
const eventsToSend = [...this.buffer];
|
|
393
|
-
this.buffer = [];
|
|
394
|
-
let postPayload = [];
|
|
395
|
-
eventsToSend.forEach((e) => {
|
|
396
|
-
postPayload.push( toBase64( JSON.stringify(e.toJSON())) );
|
|
397
|
-
});
|
|
398
395
|
this.stopTimer();
|
|
396
|
+
const body = this.buildBody();
|
|
397
|
+
this.lastPayload = body;
|
|
398
|
+
this.buffer = [];
|
|
399
399
|
try {
|
|
400
400
|
const response = await fetch(this.endpoint, {
|
|
401
401
|
method: 'POST',
|
|
@@ -403,16 +403,25 @@ class CollecionesEmitter {
|
|
|
403
403
|
headers: {
|
|
404
404
|
'Content-Type': 'application/json'
|
|
405
405
|
},
|
|
406
|
-
body
|
|
406
|
+
body
|
|
407
407
|
});
|
|
408
408
|
if (!response.ok) {
|
|
409
409
|
console.log(`Failed to send events: ${response.statusText}`);
|
|
410
410
|
}
|
|
411
411
|
return true;
|
|
412
|
-
} catch (error) {
|
|
412
|
+
} catch (error) {
|
|
413
413
|
console.log(`Network error sending events: ${error.message}`);
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Builds a POST-ready payload from the current buffer, without clearing it.
|
|
419
|
+
* @returns {string} JSON string of base64-encoded serialized events.
|
|
420
|
+
*/
|
|
421
|
+
buildBody() {
|
|
422
|
+
return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));
|
|
423
|
+
}
|
|
424
|
+
|
|
416
425
|
}
|
|
417
426
|
|
|
418
427
|
/**
|
|
@@ -430,7 +439,6 @@ class CollecionesTracker {
|
|
|
430
439
|
this.emitters = emitters;
|
|
431
440
|
this.trackerName = trackerName;
|
|
432
441
|
this.appName = appName;
|
|
433
|
-
this.identifiers = {};
|
|
434
442
|
}
|
|
435
443
|
|
|
436
444
|
/**
|
|
@@ -442,9 +450,6 @@ class CollecionesTracker {
|
|
|
442
450
|
if (!(collecionesEvent instanceof CollecionesEvent)) {
|
|
443
451
|
throw new Error('Event must be of type CollecionesEvent');
|
|
444
452
|
}
|
|
445
|
-
for (const [key, value] of Object.entries(this.identifiers)) {
|
|
446
|
-
collecionesEvent.addIdentifier(key, value);
|
|
447
|
-
}
|
|
448
453
|
collecionesEvent.setTracker(this.trackerName);
|
|
449
454
|
collecionesEvent.setAppName(this.appName);
|
|
450
455
|
this.emitters.forEach(element => {
|
|
@@ -685,11 +690,12 @@ let init = (entity) => {
|
|
|
685
690
|
}
|
|
686
691
|
};
|
|
687
692
|
|
|
688
|
-
// Final dispatch: .then.track.with(
|
|
689
|
-
track = (
|
|
690
|
-
if(
|
|
691
|
-
|
|
693
|
+
// Final dispatch: .then.track.with(tracker)
|
|
694
|
+
track = (tracker) => {
|
|
695
|
+
if(!(tracker instanceof CollecionesTracker)){
|
|
696
|
+
throw new Error('can only be a CollecionesTracker')
|
|
692
697
|
}
|
|
698
|
+
tracker.track(eventInstance);
|
|
693
699
|
return {
|
|
694
700
|
and: track,
|
|
695
701
|
helpers,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/collecionesDsl.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 name:'', \n identifiers: []\n };\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.actor.identifiers[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 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 || { name: '', identifiers: {} };\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 { 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 }\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 const eventsToSend = [...this.buffer];\n this.buffer = [];\n let postPayload = [];\n eventsToSend.forEach((e) => {\n postPayload.push( toBase64( JSON.stringify(e.toJSON())) );\n });\n this.stopTimer();\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: JSON.stringify(postPayload)\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\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 this.identifiers = {};\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 for (const [key, value] of Object.entries(this.identifiers)) {\n collecionesEvent.addIdentifier(key, value);\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 CollecionesEmitter from './CollecionesEmitter.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(emitter)\n track = (emitter) => {\n if(emitter instanceof CollecionesEmitter){\n emitter.track(eventInstance);\n }\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;"],"names":[],"mappings":";;AAAA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,QAAQ,GAAG,UAAU,GAAG,EAAE;AAChC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;AAC5E,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,KAAK,MAAM;AACX,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC3D;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,WAAW;AACrC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE;AAC3E,QAAQ,OAAO,EAAE;AACjB;AACA,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE,QAAQ,C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AK,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,gBAAgB;AAChB;AACA,SAAS;;AAET;AACA,QAAQ,KAAK,GAAG,CAAC,OAAO,KAAK;AAC7B,YAAY,GAAG,OAAO,YAAY,kBAAkB,CAAC;AACrD,gBAAgB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC;AAC5C;AACA,YAAY,OAAO;AACnB,gBAAgB,GAAG,EAAE,KAAK;AAC1B,gBAAgB,OAAO;AACvB;AACA,SAAS;;AAET,QAAQ,OAAO;AACf,YAAY,GAAG,EAAE,SAAS;AAC1B,YAAY,CAAC,EAAE,iBAAiB;AAChC,YAAY,UAAU,EAAE;AACxB,gBAAgB,EAAE,EAAE;AACpB,aAAa;AACb,YAAY,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC;AACnC,YAAY,IAAI,EAAE,OAAO;AACzB,YAAY;AACZ;;AAEA,KAAK,EAAE,MAAM,CAAC;AACd;;AAEG,IAAC,cAAc,GAAG;AACrB,IAAI,GAAG,EAAE;AACT;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/collecionesDsl.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;"],"names":[],"mappings":";;AAAA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,QAAQ,GAAG,UAAU,GAAG,EAAE;AAChC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;AAC5E,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,KAAK,MAAM;AACX,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC3D;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,WAAW;AACrC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE;AAC3E,QAAQ,OAAO,EAAE;AACjB;AACA,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;AACrC,QAAQ,QAAQ,EAAE,SAAS,CAAC,QAAQ;AACpC,QAAQ,QAAQ,EAAE,SAAS,CAAC,QAAQ;AACpC,QAAQ,QAAQ,EAAE,QAAQ,CAAC,QA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AAM,IAAI,KAAK,CAAC,kCAAkC;AAClE;AACA,YAAY,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC;AACxC,YAAY,OAAO;AACnB,gBAAgB,GAAG,EAAE,KAAK;AAC1B,gBAAgB,OAAO;AACvB;AACA,SAAS;;AAET,QAAQ,OAAO;AACf,YAAY,GAAG,EAAE,SAAS;AAC1B,YAAY,CAAC,EAAE,iBAAiB;AAChC,YAAY,UAAU,EAAE;AACxB,gBAAgB,EAAE,EAAE;AACpB,aAAa;AACb,YAAY,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC;AACnC,YAAY,IAAI,EAAE,OAAO;AACzB,YAAY;AACZ;;AAEA,KAAK,EAAE,MAAM,CAAC;AACd;;AAEG,IAAC,cAAc,GAAG;AACrB,IAAI,GAAG,EAAE;AACT;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -54,10 +54,8 @@ class CollecionesEvent {
|
|
|
54
54
|
this.adjevtives = [];
|
|
55
55
|
this.identifiers = {};
|
|
56
56
|
this.action = '';
|
|
57
|
-
this.actor = {
|
|
58
|
-
|
|
59
|
-
identifiers: []
|
|
60
|
-
};
|
|
57
|
+
this.actor = {};
|
|
58
|
+
this.actorIdentifiers = {};
|
|
61
59
|
this.context = {};
|
|
62
60
|
this.references = {};
|
|
63
61
|
// set default values
|
|
@@ -193,7 +191,7 @@ class CollecionesEvent {
|
|
|
193
191
|
if (typeof name !== 'string') {
|
|
194
192
|
throw new Error('Actor Identifier name must be a string');
|
|
195
193
|
}
|
|
196
|
-
this.
|
|
194
|
+
this.actorIdentifiers[name] = identifier;
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
/**
|
|
@@ -250,6 +248,8 @@ class CollecionesEvent {
|
|
|
250
248
|
identifiers: this.identifiers,
|
|
251
249
|
action: this.action,
|
|
252
250
|
actor: this.actor,
|
|
251
|
+
actorIdentifiers: this.actorIdentifiers,
|
|
252
|
+
actorIds: this.actorIds,
|
|
253
253
|
context: this.context,
|
|
254
254
|
references: this.references,
|
|
255
255
|
meta: this.meta
|
|
@@ -261,16 +261,18 @@ class CollecionesEvent {
|
|
|
261
261
|
* @param {object} obj
|
|
262
262
|
* @returns {CollecionesEvent}
|
|
263
263
|
*/
|
|
264
|
-
static fromJSON(obj) {
|
|
264
|
+
static fromJSON(obj) {
|
|
265
265
|
if (!obj || obj.class !== 'CollecionesEvent') {
|
|
266
|
-
throw new Error('Invalid or missing event class type');
|
|
267
|
-
}
|
|
266
|
+
throw new Error('Invalid or missing event class type');
|
|
267
|
+
}
|
|
268
268
|
const instance = new CollecionesEvent();
|
|
269
269
|
instance.entity = obj.entity;
|
|
270
270
|
instance.adjevtives = obj.adjectives || [];
|
|
271
271
|
instance.identifiers = obj.identifiers || {};
|
|
272
272
|
instance.action = obj.action;
|
|
273
|
-
instance.actor = obj.actor
|
|
273
|
+
instance.actor = obj.actor;
|
|
274
|
+
instance.actorIdentifiers = obj.actorIdentifiers;
|
|
275
|
+
instance.actorIds = obj.actorIds;
|
|
274
276
|
instance.context = obj.context || {};
|
|
275
277
|
instance.references = obj.references || {};
|
|
276
278
|
instance.meta = obj.meta || {};
|
|
@@ -314,6 +316,7 @@ class CollecionesEmitter {
|
|
|
314
316
|
this.flushSize = flushSize;
|
|
315
317
|
this.buffer = [];
|
|
316
318
|
this.timer = null;
|
|
319
|
+
this.lastPayload = null;
|
|
317
320
|
}
|
|
318
321
|
|
|
319
322
|
/**
|
|
@@ -387,13 +390,10 @@ class CollecionesEmitter {
|
|
|
387
390
|
*/
|
|
388
391
|
async flush() {
|
|
389
392
|
if (this.buffer.length === 0) return;
|
|
390
|
-
const eventsToSend = [...this.buffer];
|
|
391
|
-
this.buffer = [];
|
|
392
|
-
let postPayload = [];
|
|
393
|
-
eventsToSend.forEach((e) => {
|
|
394
|
-
postPayload.push( toBase64( JSON.stringify(e.toJSON())) );
|
|
395
|
-
});
|
|
396
393
|
this.stopTimer();
|
|
394
|
+
const body = this.buildBody();
|
|
395
|
+
this.lastPayload = body;
|
|
396
|
+
this.buffer = [];
|
|
397
397
|
try {
|
|
398
398
|
const response = await fetch(this.endpoint, {
|
|
399
399
|
method: 'POST',
|
|
@@ -401,16 +401,25 @@ class CollecionesEmitter {
|
|
|
401
401
|
headers: {
|
|
402
402
|
'Content-Type': 'application/json'
|
|
403
403
|
},
|
|
404
|
-
body
|
|
404
|
+
body
|
|
405
405
|
});
|
|
406
406
|
if (!response.ok) {
|
|
407
407
|
console.log(`Failed to send events: ${response.statusText}`);
|
|
408
408
|
}
|
|
409
409
|
return true;
|
|
410
|
-
} catch (error) {
|
|
410
|
+
} catch (error) {
|
|
411
411
|
console.log(`Network error sending events: ${error.message}`);
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Builds a POST-ready payload from the current buffer, without clearing it.
|
|
417
|
+
* @returns {string} JSON string of base64-encoded serialized events.
|
|
418
|
+
*/
|
|
419
|
+
buildBody() {
|
|
420
|
+
return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));
|
|
421
|
+
}
|
|
422
|
+
|
|
414
423
|
}
|
|
415
424
|
|
|
416
425
|
/**
|
|
@@ -428,7 +437,6 @@ class CollecionesTracker {
|
|
|
428
437
|
this.emitters = emitters;
|
|
429
438
|
this.trackerName = trackerName;
|
|
430
439
|
this.appName = appName;
|
|
431
|
-
this.identifiers = {};
|
|
432
440
|
}
|
|
433
441
|
|
|
434
442
|
/**
|
|
@@ -440,9 +448,6 @@ class CollecionesTracker {
|
|
|
440
448
|
if (!(collecionesEvent instanceof CollecionesEvent)) {
|
|
441
449
|
throw new Error('Event must be of type CollecionesEvent');
|
|
442
450
|
}
|
|
443
|
-
for (const [key, value] of Object.entries(this.identifiers)) {
|
|
444
|
-
collecionesEvent.addIdentifier(key, value);
|
|
445
|
-
}
|
|
446
451
|
collecionesEvent.setTracker(this.trackerName);
|
|
447
452
|
collecionesEvent.setAppName(this.appName);
|
|
448
453
|
this.emitters.forEach(element => {
|
|
@@ -683,11 +688,12 @@ let init = (entity) => {
|
|
|
683
688
|
}
|
|
684
689
|
};
|
|
685
690
|
|
|
686
|
-
// Final dispatch: .then.track.with(
|
|
687
|
-
track = (
|
|
688
|
-
if(
|
|
689
|
-
|
|
691
|
+
// Final dispatch: .then.track.with(tracker)
|
|
692
|
+
track = (tracker) => {
|
|
693
|
+
if(!(tracker instanceof CollecionesTracker)){
|
|
694
|
+
throw new Error('can only be a CollecionesTracker')
|
|
690
695
|
}
|
|
696
|
+
tracker.track(eventInstance);
|
|
691
697
|
return {
|
|
692
698
|
and: track,
|
|
693
699
|
helpers,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/collecionesDsl.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 name:'', \n identifiers: []\n };\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.actor.identifiers[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 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 || { name: '', identifiers: {} };\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 { 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 }\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 const eventsToSend = [...this.buffer];\n this.buffer = [];\n let postPayload = [];\n eventsToSend.forEach((e) => {\n postPayload.push( toBase64( JSON.stringify(e.toJSON())) );\n });\n this.stopTimer();\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: JSON.stringify(postPayload)\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\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 this.identifiers = {};\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 for (const [key, value] of Object.entries(this.identifiers)) {\n collecionesEvent.addIdentifier(key, value);\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 CollecionesEmitter from './CollecionesEmitter.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(emitter)\n track = (emitter) => {\n if(emitter instanceof CollecionesEmitter){\n emitter.track(eventInstance);\n }\n return {\n and: track,\n helpers,\n }\n };\n\n return {\n and: andEntity,\n _: setEntityAfterAnd,\n identified: {\n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AAE,IAAI,EAAE,SAAS,CAAC;AACnC,YAAY,IAAI,EAAE,OAAO;AACzB,YAAY;AACZ;;AAEA,KAAK,EAAE,MAAM,CAAC;AACd;;AAEG,IAAC,cAAc,GAAG;AACrB,IAAI,GAAG,EAAE;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/collecionesDsl.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;"],"names":[],"mappings":"AAAA;;;AAGA;AACA;AACA;AACA;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GAAG,EAAE;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilacion/colleciones-clientos",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "vitest",
|
|
13
13
|
"test:watch": "vitest --watch",
|
|
14
|
-
"manual-runner": "node ./test/manual
|
|
14
|
+
"manual-runner": "node ./test/manual.js",
|
|
15
15
|
"build:package": "rollup -c",
|
|
16
16
|
"watch:build": "rollup -c --watch",
|
|
17
17
|
"start:server": "node ./test/webclient/devServer.js",
|