@reactionary/feeds 0.12.0 → 0.12.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/cli.cjs +30 -7
- package/package.json +9 -9
package/cli.cjs
CHANGED
|
@@ -37063,7 +37063,8 @@ var init_envelope_model = __esm({
|
|
|
37063
37063
|
page: AnalyticsPageSchema.optional(),
|
|
37064
37064
|
userAgent: string2().optional().meta({ description: "The user agent of the visitor's request, if known. Delivery happens after the request, so subscribers cannot read it from the request context later." }),
|
|
37065
37065
|
clientIp: string2().optional().meta({ description: "The IP address of the visitor's request, if known. Personal data: capturing it does not forward it, each subscriber decides what to send to its vendor." }),
|
|
37066
|
-
isBot: boolean2().optional().meta({ description: "True if the request was identified as a bot or crawler." })
|
|
37066
|
+
isBot: boolean2().optional().meta({ description: "True if the request was identified as a bot or crawler." }),
|
|
37067
|
+
sessionId: string2().optional().meta({ description: "The id of the visitor's session at emit time (`session.id`), if the storefront sets one." })
|
|
37067
37068
|
});
|
|
37068
37069
|
AnalyticsEventEnvelopeSchema = looseObject({
|
|
37069
37070
|
id: string2().meta({ description: "Unique event id (UUID). Used for deduplication by vendors and for debugging." }),
|
|
@@ -39473,6 +39474,7 @@ var init_session_schema = __esm({
|
|
|
39473
39474
|
lastUpdated: coerce_exports.date()
|
|
39474
39475
|
});
|
|
39475
39476
|
SessionSchema = looseObject({
|
|
39477
|
+
id: string2().optional().meta({ description: "The id of the visitor's current session, set by the storefront. A long-lived visitor id belongs in marketingContext.identifier, not here." }),
|
|
39476
39478
|
identityContext: IdentityContextSchema,
|
|
39477
39479
|
marketingContext: PersonalizationProfileSchema.default(() => PersonalizationProfileSchema.parse({})),
|
|
39478
39480
|
consent: AnalyticsConsentSchema.optional().meta({ description: "The visitor's consent for analytics and marketing processing, if known. When absent, the analytics dispatcher applies its configured default." })
|
|
@@ -40373,6 +40375,28 @@ var init_context3 = __esm({
|
|
|
40373
40375
|
});
|
|
40374
40376
|
|
|
40375
40377
|
// packages/core/src/analytics/dispatcher.ts
|
|
40378
|
+
function createHandlerScope() {
|
|
40379
|
+
const asyncHooks = typeof process !== "undefined" ? process.getBuiltinModule?.("node:async_hooks") : void 0;
|
|
40380
|
+
if (asyncHooks) {
|
|
40381
|
+
const storage = new asyncHooks.AsyncLocalStorage();
|
|
40382
|
+
return {
|
|
40383
|
+
run: (fn) => storage.run(true, fn),
|
|
40384
|
+
active: () => storage.getStore() === true
|
|
40385
|
+
};
|
|
40386
|
+
}
|
|
40387
|
+
let running = 0;
|
|
40388
|
+
return {
|
|
40389
|
+
async run(fn) {
|
|
40390
|
+
running++;
|
|
40391
|
+
try {
|
|
40392
|
+
return await fn();
|
|
40393
|
+
} finally {
|
|
40394
|
+
running--;
|
|
40395
|
+
}
|
|
40396
|
+
},
|
|
40397
|
+
active: () => running > 0
|
|
40398
|
+
};
|
|
40399
|
+
}
|
|
40376
40400
|
function eventTypeMatches(pattern, type) {
|
|
40377
40401
|
if (pattern === "*") {
|
|
40378
40402
|
return true;
|
|
@@ -40388,16 +40412,15 @@ function isPurposeAllowed(purpose, consent) {
|
|
|
40388
40412
|
}
|
|
40389
40413
|
return purpose === "analytics" ? consent.analytics : consent.marketing;
|
|
40390
40414
|
}
|
|
40391
|
-
var
|
|
40415
|
+
var DEFAULT_CONSENT, insideHandler, AnalyticsDispatcher;
|
|
40392
40416
|
var init_dispatcher = __esm({
|
|
40393
40417
|
"packages/core/src/analytics/dispatcher.ts"() {
|
|
40394
40418
|
"use strict";
|
|
40395
|
-
import_node_async_hooks = require("node:async_hooks");
|
|
40396
40419
|
init_reactionary_decorator();
|
|
40397
40420
|
init_schemas3();
|
|
40398
40421
|
init_result();
|
|
40399
40422
|
DEFAULT_CONSENT = { analytics: true, marketing: true };
|
|
40400
|
-
insideHandler =
|
|
40423
|
+
insideHandler = createHandlerScope();
|
|
40401
40424
|
AnalyticsDispatcher = class {
|
|
40402
40425
|
requestContext;
|
|
40403
40426
|
subscribers;
|
|
@@ -40428,7 +40451,7 @@ var init_dispatcher = __esm({
|
|
|
40428
40451
|
* Never throws: invalid input and emits made from inside a subscriber are logged and dropped.
|
|
40429
40452
|
*/
|
|
40430
40453
|
emit(type, input, options = {}) {
|
|
40431
|
-
if (insideHandler.
|
|
40454
|
+
if (insideHandler.active()) {
|
|
40432
40455
|
console.warn(`Analytics event '${type}' was emitted from inside a subscriber and has been dropped`);
|
|
40433
40456
|
return error({ type: "InvalidInput", error: "Events cannot be emitted from inside an analytics subscriber" });
|
|
40434
40457
|
}
|
|
@@ -40491,7 +40514,8 @@ var init_dispatcher = __esm({
|
|
|
40491
40514
|
page: referrer ? { referrer } : void 0,
|
|
40492
40515
|
userAgent: userAgent || void 0,
|
|
40493
40516
|
clientIp: clientIp || void 0,
|
|
40494
|
-
isBot
|
|
40517
|
+
isBot,
|
|
40518
|
+
sessionId: session.id || void 0
|
|
40495
40519
|
};
|
|
40496
40520
|
}
|
|
40497
40521
|
scheduleFlush() {
|
|
@@ -40536,7 +40560,6 @@ var init_dispatcher = __esm({
|
|
|
40536
40560
|
for (const event of events2) {
|
|
40537
40561
|
try {
|
|
40538
40562
|
const outcome = await insideHandler.run(
|
|
40539
|
-
true,
|
|
40540
40563
|
() => traceSpan(`AnalyticsSubscriber.${subscriber.name}.handle`, () => subscriber.handle(event, ctx))
|
|
40541
40564
|
);
|
|
40542
40565
|
if (outcome === "rejected") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/feeds",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"url": "git+https://github.com/Solteq/reactionary.git"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@reactionary/algolia": "0.12.
|
|
16
|
-
"@reactionary/commercetools": "0.12.
|
|
17
|
-
"@reactionary/core": "0.12.
|
|
18
|
-
"@reactionary/fake": "0.12.
|
|
19
|
-
"@reactionary/magento": "0.12.
|
|
20
|
-
"@reactionary/medusa": "0.12.
|
|
21
|
-
"@reactionary/meilisearch": "0.12.
|
|
22
|
-
"@reactionary/unomi": "0.12.
|
|
15
|
+
"@reactionary/algolia": "0.12.2",
|
|
16
|
+
"@reactionary/commercetools": "0.12.2",
|
|
17
|
+
"@reactionary/core": "0.12.2",
|
|
18
|
+
"@reactionary/fake": "0.12.2",
|
|
19
|
+
"@reactionary/magento": "0.12.2",
|
|
20
|
+
"@reactionary/medusa": "0.12.2",
|
|
21
|
+
"@reactionary/meilisearch": "0.12.2",
|
|
22
|
+
"@reactionary/unomi": "0.12.2",
|
|
23
23
|
"commander": "^15.0.0",
|
|
24
24
|
"dotenv": "^17.2.2",
|
|
25
25
|
"sitemap": "^9.0.1",
|