@scalemule/nextjs 0.0.24 → 0.0.26
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/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/{index-jomBa89d.d.mts → index-CYS_FzSf.d.mts} +7 -0
- package/dist/{index-jomBa89d.d.ts → index-CYS_FzSf.d.ts} +7 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +44 -2
- package/dist/index.mjs +44 -2
- package/dist/server/index.d.mts +38 -4
- package/dist/server/index.d.ts +38 -4
- package/dist/server/index.js +62 -2
- package/dist/server/index.mjs +62 -3
- package/dist/server/webhook-handler.d.mts +2 -2
- package/dist/server/webhook-handler.d.ts +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{webhook-handler-aT2C5z2y.d.mts → webhook-handler-BlklRG--.d.mts} +1 -1
- package/dist/{webhook-handler-Dok4jfub.d.ts → webhook-handler-DHCE2Utl.d.ts} +1 -1
- package/package.json +1 -1
package/dist/client.d.mts
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -614,6 +614,13 @@ interface UseAnalyticsOptions {
|
|
|
614
614
|
anonymousStorageKey?: string;
|
|
615
615
|
/** Use v2 enhanced tracking (default: true) */
|
|
616
616
|
useV2?: boolean;
|
|
617
|
+
/**
|
|
618
|
+
* Minimum milliseconds between duplicate events with the same event_name.
|
|
619
|
+
* Prevents inflated analytics from event bubbling, double-bound listeners,
|
|
620
|
+
* or rapid-fire IntersectionObserver callbacks.
|
|
621
|
+
* Set to 0 to disable dedup. Default: 300ms.
|
|
622
|
+
*/
|
|
623
|
+
eventDedupMs?: number;
|
|
617
624
|
}
|
|
618
625
|
/**
|
|
619
626
|
* Analytics hook return type
|
|
@@ -614,6 +614,13 @@ interface UseAnalyticsOptions {
|
|
|
614
614
|
anonymousStorageKey?: string;
|
|
615
615
|
/** Use v2 enhanced tracking (default: true) */
|
|
616
616
|
useV2?: boolean;
|
|
617
|
+
/**
|
|
618
|
+
* Minimum milliseconds between duplicate events with the same event_name.
|
|
619
|
+
* Prevents inflated analytics from event bubbling, double-bound listeners,
|
|
620
|
+
* or rapid-fire IntersectionObserver callbacks.
|
|
621
|
+
* Set to 0 to disable dedup. Default: 300ms.
|
|
622
|
+
*/
|
|
623
|
+
eventDedupMs?: number;
|
|
617
624
|
}
|
|
618
625
|
/**
|
|
619
626
|
* Analytics hook return type
|
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ScaleMuleClient } from './client.mjs';
|
|
4
4
|
export { ClientConfig, RequestOptions, createClient } from './client.mjs';
|
|
5
|
-
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-
|
|
6
|
-
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-
|
|
5
|
+
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CYS_FzSf.mjs';
|
|
6
|
+
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-CYS_FzSf.mjs';
|
|
7
7
|
|
|
8
8
|
interface ScaleMuleContextValue {
|
|
9
9
|
/** The API client instance */
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ScaleMuleClient } from './client.js';
|
|
4
4
|
export { ClientConfig, RequestOptions, createClient } from './client.js';
|
|
5
|
-
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-
|
|
6
|
-
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-
|
|
5
|
+
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CYS_FzSf.js';
|
|
6
|
+
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-CYS_FzSf.js';
|
|
7
7
|
|
|
8
8
|
interface ScaleMuleContextValue {
|
|
9
9
|
/** The API client instance */
|
package/dist/index.js
CHANGED
|
@@ -2412,6 +2412,44 @@ function useRealtime(options = {}) {
|
|
|
2412
2412
|
[status, error, connect, disconnect, subscribe, send, lastMessage]
|
|
2413
2413
|
);
|
|
2414
2414
|
}
|
|
2415
|
+
|
|
2416
|
+
// src/hooks/event-dedup.ts
|
|
2417
|
+
var DEFAULT_EVENT_DEDUP_MS = 300;
|
|
2418
|
+
var DEDUP_MAP_MAX = 200;
|
|
2419
|
+
var _eventLastFired = typeof window !== "undefined" ? /* @__PURE__ */ new Map() : null;
|
|
2420
|
+
function dedupKey(eventName, properties) {
|
|
2421
|
+
if (!properties) return eventName;
|
|
2422
|
+
const keys = Object.keys(properties);
|
|
2423
|
+
if (keys.length === 0) return eventName;
|
|
2424
|
+
let parts = eventName;
|
|
2425
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2426
|
+
const k = keys[i];
|
|
2427
|
+
const v = properties[k];
|
|
2428
|
+
if (v === null || v === void 0) {
|
|
2429
|
+
parts += `|${k}=`;
|
|
2430
|
+
} else if (typeof v === "object") {
|
|
2431
|
+
parts += `|${k}=[obj]`;
|
|
2432
|
+
} else {
|
|
2433
|
+
parts += `|${k}=${String(v)}`;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
return parts;
|
|
2437
|
+
}
|
|
2438
|
+
function shouldDedup(eventName, cooldownMs, properties) {
|
|
2439
|
+
if (!_eventLastFired || cooldownMs <= 0) return false;
|
|
2440
|
+
const now = Date.now();
|
|
2441
|
+
const key = dedupKey(eventName, properties);
|
|
2442
|
+
const last = _eventLastFired.get(key);
|
|
2443
|
+
if (last !== void 0 && now - last < cooldownMs) return true;
|
|
2444
|
+
if (_eventLastFired.size >= DEDUP_MAP_MAX) {
|
|
2445
|
+
const oldest = _eventLastFired.keys().next().value;
|
|
2446
|
+
if (oldest !== void 0) _eventLastFired.delete(oldest);
|
|
2447
|
+
}
|
|
2448
|
+
_eventLastFired.set(key, now);
|
|
2449
|
+
return false;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
// src/hooks/useAnalytics.ts
|
|
2415
2453
|
function generateUUID() {
|
|
2416
2454
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
2417
2455
|
const r = Math.random() * 16 | 0;
|
|
@@ -2560,7 +2598,8 @@ function useAnalytics(options = {}) {
|
|
|
2560
2598
|
autoGenerateSessionId = true,
|
|
2561
2599
|
sessionStorageKey = "sm_session_id",
|
|
2562
2600
|
anonymousStorageKey = "sm_anonymous_id",
|
|
2563
|
-
useV2 = true
|
|
2601
|
+
useV2 = true,
|
|
2602
|
+
eventDedupMs = DEFAULT_EVENT_DEDUP_MS
|
|
2564
2603
|
} = options;
|
|
2565
2604
|
const shouldAutoCaptureUtmParams = autoCaptureUtmParams ?? autoCapturUtmParams ?? true;
|
|
2566
2605
|
const { client, user, analyticsProxyUrl, publishableKey, gatewayUrl } = useScaleMule();
|
|
@@ -2706,6 +2745,9 @@ function useAnalytics(options = {}) {
|
|
|
2706
2745
|
sendEventRef.current = sendEvent;
|
|
2707
2746
|
const trackEvent = react.useCallback(
|
|
2708
2747
|
async (event) => {
|
|
2748
|
+
if (shouldDedup(event.event_name, eventDedupMs, event.properties)) {
|
|
2749
|
+
return { tracked: 0, session_id: sessionIdRef.current || void 0 };
|
|
2750
|
+
}
|
|
2709
2751
|
setError(null);
|
|
2710
2752
|
setLoading(true);
|
|
2711
2753
|
try {
|
|
@@ -2725,7 +2767,7 @@ function useAnalytics(options = {}) {
|
|
|
2725
2767
|
}
|
|
2726
2768
|
},
|
|
2727
2769
|
// Note: idsReady removed - we use ref to keep callback stable
|
|
2728
|
-
[sendEvent]
|
|
2770
|
+
[sendEvent, eventDedupMs]
|
|
2729
2771
|
);
|
|
2730
2772
|
const trackPageView = react.useCallback(
|
|
2731
2773
|
async (data) => {
|
package/dist/index.mjs
CHANGED
|
@@ -2410,6 +2410,44 @@ function useRealtime(options = {}) {
|
|
|
2410
2410
|
[status, error, connect, disconnect, subscribe, send, lastMessage]
|
|
2411
2411
|
);
|
|
2412
2412
|
}
|
|
2413
|
+
|
|
2414
|
+
// src/hooks/event-dedup.ts
|
|
2415
|
+
var DEFAULT_EVENT_DEDUP_MS = 300;
|
|
2416
|
+
var DEDUP_MAP_MAX = 200;
|
|
2417
|
+
var _eventLastFired = typeof window !== "undefined" ? /* @__PURE__ */ new Map() : null;
|
|
2418
|
+
function dedupKey(eventName, properties) {
|
|
2419
|
+
if (!properties) return eventName;
|
|
2420
|
+
const keys = Object.keys(properties);
|
|
2421
|
+
if (keys.length === 0) return eventName;
|
|
2422
|
+
let parts = eventName;
|
|
2423
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2424
|
+
const k = keys[i];
|
|
2425
|
+
const v = properties[k];
|
|
2426
|
+
if (v === null || v === void 0) {
|
|
2427
|
+
parts += `|${k}=`;
|
|
2428
|
+
} else if (typeof v === "object") {
|
|
2429
|
+
parts += `|${k}=[obj]`;
|
|
2430
|
+
} else {
|
|
2431
|
+
parts += `|${k}=${String(v)}`;
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
return parts;
|
|
2435
|
+
}
|
|
2436
|
+
function shouldDedup(eventName, cooldownMs, properties) {
|
|
2437
|
+
if (!_eventLastFired || cooldownMs <= 0) return false;
|
|
2438
|
+
const now = Date.now();
|
|
2439
|
+
const key = dedupKey(eventName, properties);
|
|
2440
|
+
const last = _eventLastFired.get(key);
|
|
2441
|
+
if (last !== void 0 && now - last < cooldownMs) return true;
|
|
2442
|
+
if (_eventLastFired.size >= DEDUP_MAP_MAX) {
|
|
2443
|
+
const oldest = _eventLastFired.keys().next().value;
|
|
2444
|
+
if (oldest !== void 0) _eventLastFired.delete(oldest);
|
|
2445
|
+
}
|
|
2446
|
+
_eventLastFired.set(key, now);
|
|
2447
|
+
return false;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
// src/hooks/useAnalytics.ts
|
|
2413
2451
|
function generateUUID() {
|
|
2414
2452
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
2415
2453
|
const r = Math.random() * 16 | 0;
|
|
@@ -2558,7 +2596,8 @@ function useAnalytics(options = {}) {
|
|
|
2558
2596
|
autoGenerateSessionId = true,
|
|
2559
2597
|
sessionStorageKey = "sm_session_id",
|
|
2560
2598
|
anonymousStorageKey = "sm_anonymous_id",
|
|
2561
|
-
useV2 = true
|
|
2599
|
+
useV2 = true,
|
|
2600
|
+
eventDedupMs = DEFAULT_EVENT_DEDUP_MS
|
|
2562
2601
|
} = options;
|
|
2563
2602
|
const shouldAutoCaptureUtmParams = autoCaptureUtmParams ?? autoCapturUtmParams ?? true;
|
|
2564
2603
|
const { client, user, analyticsProxyUrl, publishableKey, gatewayUrl } = useScaleMule();
|
|
@@ -2704,6 +2743,9 @@ function useAnalytics(options = {}) {
|
|
|
2704
2743
|
sendEventRef.current = sendEvent;
|
|
2705
2744
|
const trackEvent = useCallback(
|
|
2706
2745
|
async (event) => {
|
|
2746
|
+
if (shouldDedup(event.event_name, eventDedupMs, event.properties)) {
|
|
2747
|
+
return { tracked: 0, session_id: sessionIdRef.current || void 0 };
|
|
2748
|
+
}
|
|
2707
2749
|
setError(null);
|
|
2708
2750
|
setLoading(true);
|
|
2709
2751
|
try {
|
|
@@ -2723,7 +2765,7 @@ function useAnalytics(options = {}) {
|
|
|
2723
2765
|
}
|
|
2724
2766
|
},
|
|
2725
2767
|
// Note: idsReady removed - we use ref to keep callback stable
|
|
2726
|
-
[sendEvent]
|
|
2768
|
+
[sendEvent, eventDedupMs]
|
|
2727
2769
|
);
|
|
2728
2770
|
const trackPageView = useCallback(
|
|
2729
2771
|
async (data) => {
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ServerConfig } from '../webhook-handler-
|
|
2
|
-
export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-
|
|
3
|
-
import { $ as ClientContext, A as ApiError } from '../index-
|
|
1
|
+
import { S as ServerConfig } from '../webhook-handler-BlklRG--.mjs';
|
|
2
|
+
export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-BlklRG--.mjs';
|
|
3
|
+
import { $ as ClientContext, A as ApiError } from '../index-CYS_FzSf.mjs';
|
|
4
4
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -94,6 +94,13 @@ declare function extractClientContextFromReq(req: IncomingMessageLike): ClientCo
|
|
|
94
94
|
* @internal
|
|
95
95
|
*/
|
|
96
96
|
declare function buildClientContextHeaders(context: ClientContext | undefined): Record<string, string>;
|
|
97
|
+
/**
|
|
98
|
+
* Build feature-flag evaluation context from forwarded client context.
|
|
99
|
+
*
|
|
100
|
+
* This keeps server-side flag evaluation aligned with targeting rules that use
|
|
101
|
+
* `ip_address`, while letting callers merge any additional attributes they need.
|
|
102
|
+
*/
|
|
103
|
+
declare function buildFlagContext(clientContext: Pick<ClientContext, 'ip'> | undefined, extraContext?: Record<string, unknown>): Record<string, unknown>;
|
|
97
104
|
|
|
98
105
|
/**
|
|
99
106
|
* Cookie Utilities for Secure Session Management
|
|
@@ -262,6 +269,27 @@ declare function createAuthRoutes(config?: AuthRoutesConfig): {
|
|
|
262
269
|
DELETE: RouteHandler;
|
|
263
270
|
PATCH: RouteHandler;
|
|
264
271
|
};
|
|
272
|
+
interface AnalyticsTrackingGateConfig {
|
|
273
|
+
/** Feature flag key used to decide whether to forward analytics */
|
|
274
|
+
flagKey: string;
|
|
275
|
+
/** Feature flag environment (default: 'prod') */
|
|
276
|
+
environment?: string;
|
|
277
|
+
/**
|
|
278
|
+
* When true, analytics continues if flag evaluation fails.
|
|
279
|
+
* Default: true
|
|
280
|
+
*/
|
|
281
|
+
failOpen?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Build feature-flag evaluation context from the inbound analytics request.
|
|
284
|
+
* Defaults to { ip_address, user_id, anonymous_id, session_id, event_name, page_url }
|
|
285
|
+
* when those values are present.
|
|
286
|
+
*/
|
|
287
|
+
buildContext?: (args: {
|
|
288
|
+
body: Record<string, unknown>;
|
|
289
|
+
clientContext: ClientContext;
|
|
290
|
+
request: Request;
|
|
291
|
+
}) => Record<string, unknown>;
|
|
292
|
+
}
|
|
265
293
|
interface AnalyticsRoutesConfig {
|
|
266
294
|
/** Server client config (optional if using env vars) */
|
|
267
295
|
client?: Partial<ServerConfig>;
|
|
@@ -276,6 +304,12 @@ interface AnalyticsRoutesConfig {
|
|
|
276
304
|
* Default: false (uses catch-all route pattern)
|
|
277
305
|
*/
|
|
278
306
|
simpleProxy?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Optional feature flag gate that suppresses analytics forwarding when the
|
|
309
|
+
* evaluated flag returns false. Useful for test users, internal IPs, or
|
|
310
|
+
* staged rollouts without adding app-specific proxy logic.
|
|
311
|
+
*/
|
|
312
|
+
trackingGate?: AnalyticsTrackingGateConfig;
|
|
279
313
|
}
|
|
280
314
|
/**
|
|
281
315
|
* Create analytics API route handlers
|
|
@@ -906,4 +940,4 @@ declare function invalidateBundleCache(key?: string): void;
|
|
|
906
940
|
*/
|
|
907
941
|
declare function prefetchBundles(keys: string[]): Promise<void>;
|
|
908
942
|
|
|
909
|
-
export { type AnalyticsRoutesConfig, type AuthMiddlewareConfig, type AuthRoutesConfig, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, type HandlerContext, type HandlerOptions, type MySqlBundle, OAUTH_STATE_COOKIE_NAME, type OAuthBundle, type PostgresBundle, type RedisBundle, type S3Bundle, SESSION_COOKIE_NAME, ScaleMuleError, ServerConfig, type SessionCookieOptions, type SessionData, type SmtpBundle, USER_ID_COOKIE_NAME, apiHandler, buildClientContextHeaders, clearOAuthState, clearSession, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSession, getSessionFromRequest, getSmtpBundle, invalidateBundleCache, invalidateSecretCache, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, requireSession, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, withAuth, withCSRFProtection, withCSRFToken, withSession };
|
|
943
|
+
export { type AnalyticsRoutesConfig, type AnalyticsTrackingGateConfig, type AuthMiddlewareConfig, type AuthRoutesConfig, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, type HandlerContext, type HandlerOptions, type MySqlBundle, OAUTH_STATE_COOKIE_NAME, type OAuthBundle, type PostgresBundle, type RedisBundle, type S3Bundle, SESSION_COOKIE_NAME, ScaleMuleError, ServerConfig, type SessionCookieOptions, type SessionData, type SmtpBundle, USER_ID_COOKIE_NAME, apiHandler, buildClientContextHeaders, buildFlagContext, clearOAuthState, clearSession, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSession, getSessionFromRequest, getSmtpBundle, invalidateBundleCache, invalidateSecretCache, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, requireSession, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, withAuth, withCSRFProtection, withCSRFToken, withSession };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ServerConfig } from '../webhook-handler-
|
|
2
|
-
export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-
|
|
3
|
-
import { $ as ClientContext, A as ApiError } from '../index-
|
|
1
|
+
import { S as ServerConfig } from '../webhook-handler-DHCE2Utl.js';
|
|
2
|
+
export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-DHCE2Utl.js';
|
|
3
|
+
import { $ as ClientContext, A as ApiError } from '../index-CYS_FzSf.js';
|
|
4
4
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -94,6 +94,13 @@ declare function extractClientContextFromReq(req: IncomingMessageLike): ClientCo
|
|
|
94
94
|
* @internal
|
|
95
95
|
*/
|
|
96
96
|
declare function buildClientContextHeaders(context: ClientContext | undefined): Record<string, string>;
|
|
97
|
+
/**
|
|
98
|
+
* Build feature-flag evaluation context from forwarded client context.
|
|
99
|
+
*
|
|
100
|
+
* This keeps server-side flag evaluation aligned with targeting rules that use
|
|
101
|
+
* `ip_address`, while letting callers merge any additional attributes they need.
|
|
102
|
+
*/
|
|
103
|
+
declare function buildFlagContext(clientContext: Pick<ClientContext, 'ip'> | undefined, extraContext?: Record<string, unknown>): Record<string, unknown>;
|
|
97
104
|
|
|
98
105
|
/**
|
|
99
106
|
* Cookie Utilities for Secure Session Management
|
|
@@ -262,6 +269,27 @@ declare function createAuthRoutes(config?: AuthRoutesConfig): {
|
|
|
262
269
|
DELETE: RouteHandler;
|
|
263
270
|
PATCH: RouteHandler;
|
|
264
271
|
};
|
|
272
|
+
interface AnalyticsTrackingGateConfig {
|
|
273
|
+
/** Feature flag key used to decide whether to forward analytics */
|
|
274
|
+
flagKey: string;
|
|
275
|
+
/** Feature flag environment (default: 'prod') */
|
|
276
|
+
environment?: string;
|
|
277
|
+
/**
|
|
278
|
+
* When true, analytics continues if flag evaluation fails.
|
|
279
|
+
* Default: true
|
|
280
|
+
*/
|
|
281
|
+
failOpen?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Build feature-flag evaluation context from the inbound analytics request.
|
|
284
|
+
* Defaults to { ip_address, user_id, anonymous_id, session_id, event_name, page_url }
|
|
285
|
+
* when those values are present.
|
|
286
|
+
*/
|
|
287
|
+
buildContext?: (args: {
|
|
288
|
+
body: Record<string, unknown>;
|
|
289
|
+
clientContext: ClientContext;
|
|
290
|
+
request: Request;
|
|
291
|
+
}) => Record<string, unknown>;
|
|
292
|
+
}
|
|
265
293
|
interface AnalyticsRoutesConfig {
|
|
266
294
|
/** Server client config (optional if using env vars) */
|
|
267
295
|
client?: Partial<ServerConfig>;
|
|
@@ -276,6 +304,12 @@ interface AnalyticsRoutesConfig {
|
|
|
276
304
|
* Default: false (uses catch-all route pattern)
|
|
277
305
|
*/
|
|
278
306
|
simpleProxy?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Optional feature flag gate that suppresses analytics forwarding when the
|
|
309
|
+
* evaluated flag returns false. Useful for test users, internal IPs, or
|
|
310
|
+
* staged rollouts without adding app-specific proxy logic.
|
|
311
|
+
*/
|
|
312
|
+
trackingGate?: AnalyticsTrackingGateConfig;
|
|
279
313
|
}
|
|
280
314
|
/**
|
|
281
315
|
* Create analytics API route handlers
|
|
@@ -906,4 +940,4 @@ declare function invalidateBundleCache(key?: string): void;
|
|
|
906
940
|
*/
|
|
907
941
|
declare function prefetchBundles(keys: string[]): Promise<void>;
|
|
908
942
|
|
|
909
|
-
export { type AnalyticsRoutesConfig, type AuthMiddlewareConfig, type AuthRoutesConfig, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, type HandlerContext, type HandlerOptions, type MySqlBundle, OAUTH_STATE_COOKIE_NAME, type OAuthBundle, type PostgresBundle, type RedisBundle, type S3Bundle, SESSION_COOKIE_NAME, ScaleMuleError, ServerConfig, type SessionCookieOptions, type SessionData, type SmtpBundle, USER_ID_COOKIE_NAME, apiHandler, buildClientContextHeaders, clearOAuthState, clearSession, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSession, getSessionFromRequest, getSmtpBundle, invalidateBundleCache, invalidateSecretCache, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, requireSession, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, withAuth, withCSRFProtection, withCSRFToken, withSession };
|
|
943
|
+
export { type AnalyticsRoutesConfig, type AnalyticsTrackingGateConfig, type AuthMiddlewareConfig, type AuthRoutesConfig, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, type HandlerContext, type HandlerOptions, type MySqlBundle, OAUTH_STATE_COOKIE_NAME, type OAuthBundle, type PostgresBundle, type RedisBundle, type S3Bundle, SESSION_COOKIE_NAME, ScaleMuleError, ServerConfig, type SessionCookieOptions, type SessionData, type SmtpBundle, USER_ID_COOKIE_NAME, apiHandler, buildClientContextHeaders, buildFlagContext, clearOAuthState, clearSession, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSession, getSessionFromRequest, getSmtpBundle, invalidateBundleCache, invalidateSecretCache, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, requireSession, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, withAuth, withCSRFProtection, withCSRFToken, withSession };
|
package/dist/server/index.js
CHANGED
|
@@ -159,6 +159,13 @@ function buildClientContextHeaders(context) {
|
|
|
159
159
|
}
|
|
160
160
|
return headers2;
|
|
161
161
|
}
|
|
162
|
+
function buildFlagContext(clientContext, extraContext = {}) {
|
|
163
|
+
const context = { ...extraContext };
|
|
164
|
+
if (clientContext?.ip && context.ip_address === void 0) {
|
|
165
|
+
context.ip_address = clientContext.ip;
|
|
166
|
+
}
|
|
167
|
+
return context;
|
|
168
|
+
}
|
|
162
169
|
|
|
163
170
|
// src/server/client.ts
|
|
164
171
|
var GATEWAY_URLS = {
|
|
@@ -1385,8 +1392,50 @@ function createAuthRoutes(config = {}) {
|
|
|
1385
1392
|
};
|
|
1386
1393
|
return { GET, POST, DELETE, PATCH };
|
|
1387
1394
|
}
|
|
1395
|
+
function getPrimaryTrackingContextSource(body) {
|
|
1396
|
+
if (Array.isArray(body.events)) {
|
|
1397
|
+
const firstEvent = body.events.find((event) => event && typeof event === "object" && !Array.isArray(event));
|
|
1398
|
+
if (firstEvent && typeof firstEvent === "object" && !Array.isArray(firstEvent)) {
|
|
1399
|
+
return firstEvent;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return body;
|
|
1403
|
+
}
|
|
1404
|
+
function buildDefaultTrackingGateContext(args) {
|
|
1405
|
+
const source = getPrimaryTrackingContextSource(args.body);
|
|
1406
|
+
const extraContext = {};
|
|
1407
|
+
for (const key of ["user_id", "anonymous_id", "session_id", "event_name", "page_url"]) {
|
|
1408
|
+
const value = source[key];
|
|
1409
|
+
if (typeof value === "string" && value.trim()) {
|
|
1410
|
+
extraContext[key] = value;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
return buildFlagContext(args.clientContext, extraContext);
|
|
1414
|
+
}
|
|
1388
1415
|
function createAnalyticsRoutes(config = {}) {
|
|
1389
1416
|
const sm = createServerClient(config.client);
|
|
1417
|
+
const shouldSuppressTracking = async (body, clientContext, request) => {
|
|
1418
|
+
const gate = config.trackingGate;
|
|
1419
|
+
if (!gate) {
|
|
1420
|
+
return false;
|
|
1421
|
+
}
|
|
1422
|
+
try {
|
|
1423
|
+
const contextBuilder = gate.buildContext || ((args) => buildDefaultTrackingGateContext(args));
|
|
1424
|
+
const evaluation = await sm.flags.evaluate(
|
|
1425
|
+
gate.flagKey,
|
|
1426
|
+
contextBuilder({ body, clientContext, request }) || {},
|
|
1427
|
+
gate.environment || "prod",
|
|
1428
|
+
{ clientContext }
|
|
1429
|
+
);
|
|
1430
|
+
return evaluation?.value === false;
|
|
1431
|
+
} catch (err) {
|
|
1432
|
+
if (gate.failOpen === false) {
|
|
1433
|
+
console.warn(`[ScaleMule Analytics] Tracking gate blocked "${gate.flagKey}" after evaluation failure`, err);
|
|
1434
|
+
return true;
|
|
1435
|
+
}
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
};
|
|
1390
1439
|
const handleTrackEvent = async (body, clientContext) => {
|
|
1391
1440
|
const {
|
|
1392
1441
|
event_name,
|
|
@@ -1469,8 +1518,12 @@ function createAnalyticsRoutes(config = {}) {
|
|
|
1469
1518
|
};
|
|
1470
1519
|
const POST = async (request, context) => {
|
|
1471
1520
|
try {
|
|
1472
|
-
const
|
|
1521
|
+
const rawBody = await request.json().catch(() => ({}));
|
|
1522
|
+
const body = rawBody && typeof rawBody === "object" && !Array.isArray(rawBody) ? rawBody : {};
|
|
1473
1523
|
const clientContext = extractClientContext(request);
|
|
1524
|
+
if (await shouldSuppressTracking(body, clientContext, request)) {
|
|
1525
|
+
return successResponse({ tracked: 0, suppressed: true }, 202);
|
|
1526
|
+
}
|
|
1474
1527
|
if (config.simpleProxy) {
|
|
1475
1528
|
return handleTrackEvent(body, clientContext);
|
|
1476
1529
|
}
|
|
@@ -1515,7 +1568,13 @@ function createAnalyticsRoutes(config = {}) {
|
|
|
1515
1568
|
let pageViewResult;
|
|
1516
1569
|
try {
|
|
1517
1570
|
pageViewResult = await sm.analytics.trackPageView(
|
|
1518
|
-
{
|
|
1571
|
+
{
|
|
1572
|
+
page_url,
|
|
1573
|
+
page_title,
|
|
1574
|
+
referrer,
|
|
1575
|
+
session_id,
|
|
1576
|
+
user_id
|
|
1577
|
+
},
|
|
1519
1578
|
{ clientContext }
|
|
1520
1579
|
);
|
|
1521
1580
|
} catch (err) {
|
|
@@ -2153,6 +2212,7 @@ exports.ScaleMuleServer = ScaleMuleServer;
|
|
|
2153
2212
|
exports.USER_ID_COOKIE_NAME = USER_ID_COOKIE_NAME;
|
|
2154
2213
|
exports.apiHandler = apiHandler;
|
|
2155
2214
|
exports.buildClientContextHeaders = buildClientContextHeaders;
|
|
2215
|
+
exports.buildFlagContext = buildFlagContext;
|
|
2156
2216
|
exports.clearOAuthState = clearOAuthState;
|
|
2157
2217
|
exports.clearSession = clearSession;
|
|
2158
2218
|
exports.configureBundles = configureBundles;
|
package/dist/server/index.mjs
CHANGED
|
@@ -157,6 +157,13 @@ function buildClientContextHeaders(context) {
|
|
|
157
157
|
}
|
|
158
158
|
return headers2;
|
|
159
159
|
}
|
|
160
|
+
function buildFlagContext(clientContext, extraContext = {}) {
|
|
161
|
+
const context = { ...extraContext };
|
|
162
|
+
if (clientContext?.ip && context.ip_address === void 0) {
|
|
163
|
+
context.ip_address = clientContext.ip;
|
|
164
|
+
}
|
|
165
|
+
return context;
|
|
166
|
+
}
|
|
160
167
|
|
|
161
168
|
// src/server/client.ts
|
|
162
169
|
var GATEWAY_URLS = {
|
|
@@ -1383,8 +1390,50 @@ function createAuthRoutes(config = {}) {
|
|
|
1383
1390
|
};
|
|
1384
1391
|
return { GET, POST, DELETE, PATCH };
|
|
1385
1392
|
}
|
|
1393
|
+
function getPrimaryTrackingContextSource(body) {
|
|
1394
|
+
if (Array.isArray(body.events)) {
|
|
1395
|
+
const firstEvent = body.events.find((event) => event && typeof event === "object" && !Array.isArray(event));
|
|
1396
|
+
if (firstEvent && typeof firstEvent === "object" && !Array.isArray(firstEvent)) {
|
|
1397
|
+
return firstEvent;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return body;
|
|
1401
|
+
}
|
|
1402
|
+
function buildDefaultTrackingGateContext(args) {
|
|
1403
|
+
const source = getPrimaryTrackingContextSource(args.body);
|
|
1404
|
+
const extraContext = {};
|
|
1405
|
+
for (const key of ["user_id", "anonymous_id", "session_id", "event_name", "page_url"]) {
|
|
1406
|
+
const value = source[key];
|
|
1407
|
+
if (typeof value === "string" && value.trim()) {
|
|
1408
|
+
extraContext[key] = value;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return buildFlagContext(args.clientContext, extraContext);
|
|
1412
|
+
}
|
|
1386
1413
|
function createAnalyticsRoutes(config = {}) {
|
|
1387
1414
|
const sm = createServerClient(config.client);
|
|
1415
|
+
const shouldSuppressTracking = async (body, clientContext, request) => {
|
|
1416
|
+
const gate = config.trackingGate;
|
|
1417
|
+
if (!gate) {
|
|
1418
|
+
return false;
|
|
1419
|
+
}
|
|
1420
|
+
try {
|
|
1421
|
+
const contextBuilder = gate.buildContext || ((args) => buildDefaultTrackingGateContext(args));
|
|
1422
|
+
const evaluation = await sm.flags.evaluate(
|
|
1423
|
+
gate.flagKey,
|
|
1424
|
+
contextBuilder({ body, clientContext, request }) || {},
|
|
1425
|
+
gate.environment || "prod",
|
|
1426
|
+
{ clientContext }
|
|
1427
|
+
);
|
|
1428
|
+
return evaluation?.value === false;
|
|
1429
|
+
} catch (err) {
|
|
1430
|
+
if (gate.failOpen === false) {
|
|
1431
|
+
console.warn(`[ScaleMule Analytics] Tracking gate blocked "${gate.flagKey}" after evaluation failure`, err);
|
|
1432
|
+
return true;
|
|
1433
|
+
}
|
|
1434
|
+
return false;
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1388
1437
|
const handleTrackEvent = async (body, clientContext) => {
|
|
1389
1438
|
const {
|
|
1390
1439
|
event_name,
|
|
@@ -1467,8 +1516,12 @@ function createAnalyticsRoutes(config = {}) {
|
|
|
1467
1516
|
};
|
|
1468
1517
|
const POST = async (request, context) => {
|
|
1469
1518
|
try {
|
|
1470
|
-
const
|
|
1519
|
+
const rawBody = await request.json().catch(() => ({}));
|
|
1520
|
+
const body = rawBody && typeof rawBody === "object" && !Array.isArray(rawBody) ? rawBody : {};
|
|
1471
1521
|
const clientContext = extractClientContext(request);
|
|
1522
|
+
if (await shouldSuppressTracking(body, clientContext, request)) {
|
|
1523
|
+
return successResponse({ tracked: 0, suppressed: true }, 202);
|
|
1524
|
+
}
|
|
1472
1525
|
if (config.simpleProxy) {
|
|
1473
1526
|
return handleTrackEvent(body, clientContext);
|
|
1474
1527
|
}
|
|
@@ -1513,7 +1566,13 @@ function createAnalyticsRoutes(config = {}) {
|
|
|
1513
1566
|
let pageViewResult;
|
|
1514
1567
|
try {
|
|
1515
1568
|
pageViewResult = await sm.analytics.trackPageView(
|
|
1516
|
-
{
|
|
1569
|
+
{
|
|
1570
|
+
page_url,
|
|
1571
|
+
page_title,
|
|
1572
|
+
referrer,
|
|
1573
|
+
session_id,
|
|
1574
|
+
user_id
|
|
1575
|
+
},
|
|
1517
1576
|
{ clientContext }
|
|
1518
1577
|
);
|
|
1519
1578
|
} catch (err) {
|
|
@@ -2142,4 +2201,4 @@ async function prefetchBundles(keys) {
|
|
|
2142
2201
|
await Promise.all(keys.map((key) => getBundle(key)));
|
|
2143
2202
|
}
|
|
2144
2203
|
|
|
2145
|
-
export { CSRF_COOKIE_NAME, CSRF_HEADER_NAME, OAUTH_STATE_COOKIE_NAME, SESSION_COOKIE_NAME, ScaleMuleError, ScaleMuleServer, USER_ID_COOKIE_NAME, apiHandler, buildClientContextHeaders, clearOAuthState, clearSession, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, createServerClient, createWebhookHandler, createWebhookRoutes, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSession, getSessionFromRequest, getSmtpBundle, invalidateBundleCache, invalidateSecretCache, parseWebhookEvent, prefetchBundles, prefetchSecrets, registerVideoWebhook, requireAppSecret, requireBundle, requireSession, resolveGatewayUrl, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, verifyWebhookSignature, withAuth, withCSRFProtection, withCSRFToken, withSession };
|
|
2204
|
+
export { CSRF_COOKIE_NAME, CSRF_HEADER_NAME, OAUTH_STATE_COOKIE_NAME, SESSION_COOKIE_NAME, ScaleMuleError, ScaleMuleServer, USER_ID_COOKIE_NAME, apiHandler, buildClientContextHeaders, buildFlagContext, clearOAuthState, clearSession, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, createServerClient, createWebhookHandler, createWebhookRoutes, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSession, getSessionFromRequest, getSmtpBundle, invalidateBundleCache, invalidateSecretCache, parseWebhookEvent, prefetchBundles, prefetchSecrets, registerVideoWebhook, requireAppSecret, requireBundle, requireSession, resolveGatewayUrl, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, verifyWebhookSignature, withAuth, withCSRFProtection, withCSRFToken, withSession };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { i as createWebhookHandler } from '../webhook-handler-
|
|
2
|
-
import '../index-
|
|
1
|
+
export { i as createWebhookHandler } from '../webhook-handler-BlklRG--.mjs';
|
|
2
|
+
import '../index-CYS_FzSf.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { i as createWebhookHandler } from '../webhook-handler-
|
|
2
|
-
import '../index-
|
|
1
|
+
export { i as createWebhookHandler } from '../webhook-handler-DHCE2Utl.js';
|
|
2
|
+
import '../index-CYS_FzSf.js';
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { U as User, N as StorageFile, A as ApiError } from './index-
|
|
3
|
+
import { U as User, N as StorageFile, A as ApiError } from './index-CYS_FzSf.mjs';
|
|
4
4
|
|
|
5
5
|
interface MockUserOptions {
|
|
6
6
|
id?: string;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { U as User, N as StorageFile, A as ApiError } from './index-
|
|
3
|
+
import { U as User, N as StorageFile, A as ApiError } from './index-CYS_FzSf.js';
|
|
4
4
|
|
|
5
5
|
interface MockUserOptions {
|
|
6
6
|
id?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-
|
|
1
|
+
import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-CYS_FzSf.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Server-Side ScaleMule Client
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-
|
|
1
|
+
import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-CYS_FzSf.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Server-Side ScaleMule Client
|
package/package.json
CHANGED