@burdenoff/be-sdk 2026.803.1 → 2026.803.3
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/{chunk-YH6PCW6L.js → chunk-G27GXB7D.js} +12 -4
- package/dist/chunk-G27GXB7D.js.map +1 -0
- package/dist/{chunk-S32JOMMW.js → chunk-N3YN6ZII.js} +16 -4
- package/dist/chunk-N3YN6ZII.js.map +1 -0
- package/dist/{chunk-KUM4N4CO.js → chunk-RJK4MPDW.js} +147 -20
- package/dist/chunk-RJK4MPDW.js.map +1 -0
- package/dist/{chunk-VOJROV6C.js → chunk-VDYBUTFI.js} +3 -3
- package/dist/{chunk-VOJROV6C.js.map → chunk-VDYBUTFI.js.map} +1 -1
- package/dist/{chunk-GTX65XAP.js → chunk-WW6P2S6L.js} +28 -2
- package/dist/chunk-WW6P2S6L.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/init/index.js +3 -2
- package/dist/instrumentation/index.js +1 -1
- package/dist/rbac/index.d.ts +1 -0
- package/dist/rbac/index.js +1 -1
- package/dist/resource-caps/index.d.ts +18 -3
- package/dist/resource-caps/index.js +2 -1
- package/dist/server/index.js +50 -5
- package/dist/server/index.js.map +1 -1
- package/dist/telemetry/index.js +2 -2
- package/dist/tracker/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-GTX65XAP.js.map +0 -1
- package/dist/chunk-KUM4N4CO.js.map +0 -1
- package/dist/chunk-S32JOMMW.js.map +0 -1
- package/dist/chunk-YH6PCW6L.js.map +0 -1
package/dist/init/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { getSDKState, initializeBurdenoffSDK, isSDKInitialized, resetSDK } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { getSDKState, initializeBurdenoffSDK, isSDKInitialized, resetSDK } from '../chunk-G27GXB7D.js';
|
|
2
|
+
import '../chunk-RJK4MPDW.js';
|
|
3
|
+
import '../chunk-Q6UAOZFZ.js';
|
|
3
4
|
import '../chunk-ZVZ4RAIH.js';
|
|
4
5
|
import '../chunk-QMDYY6GJ.js';
|
|
5
6
|
import '../chunk-7UJXIX4I.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Instrument, Log, Metric, STANDARD_METRICS, SpanKind, SpanStatus, Trace, Tracer, createApolloInlineTracePlugin, createGraphQLInstrumentationPlugin, createPrometheusPlugin, extractOperationInfo, extractTraceContext, getGraphQLOperationFromContext, getGraphQLSpanFromContext, getLogger, getTraceContext, getTracer, initializeInstrumentation, initializeTracer, injectTraceContext, instrumentResolver, instrumentResolverMap, instrumented, isApolloInlineTraceAvailable, isInstrumentationInitialized, isPrometheusAvailable, isTracerInitialized, resetInstrumentation, setupInstrumentation, startSpan, traced, withSpan } from '../chunk-
|
|
1
|
+
export { Instrument, Log, Metric, STANDARD_METRICS, SpanKind, SpanStatus, Trace, Tracer, createApolloInlineTracePlugin, createGraphQLInstrumentationPlugin, createPrometheusPlugin, extractOperationInfo, extractTraceContext, getGraphQLOperationFromContext, getGraphQLSpanFromContext, getLogger, getTraceContext, getTracer, initializeInstrumentation, initializeTracer, injectTraceContext, instrumentResolver, instrumentResolverMap, instrumented, isApolloInlineTraceAvailable, isInstrumentationInitialized, isPrometheusAvailable, isTracerInitialized, resetInstrumentation, setupInstrumentation, startSpan, traced, withSpan } from '../chunk-WW6P2S6L.js';
|
|
2
2
|
export { DEFAULT_CACHE_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_EVENT_QUEUE_CONFIG, DEFAULT_FEATURE_FLAGS, DEFAULT_GRAPHQL_CONFIG, DEFAULT_HTTP_CONFIG, DEFAULT_LOGGING_CONFIG, DEFAULT_METRICS_CONFIG, DEFAULT_TRACING_CONFIG, ENV_VARS, MetricsRegistry, buildDatabaseConfig, buildFeatureFlags, buildGraphQLConfig, buildInstrumentationConfig, buildMetricsConfig, buildTracingConfig, createCounter, createGauge, createHistogram, createUpDownCounter, getInstrumentationConfig, getMetricsRegistry, initializeInstrumentationConfig, initializeMetricsRegistry, isFeatureEnabled, isInstrumentationConfigInitialized, isMetricsRegistryInitialized, resetInstrumentationConfig, resetMetricsRegistry, updateInstrumentationConfig } from '../chunk-Q6UAOZFZ.js';
|
|
3
3
|
export { logger } from '../chunk-CBZNP6RF.js';
|
|
4
4
|
import '../chunk-XE4OXN2W.js';
|
package/dist/rbac/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare class RBACClient {
|
|
|
25
25
|
private client;
|
|
26
26
|
private cache?;
|
|
27
27
|
private config;
|
|
28
|
+
private timeoutMs;
|
|
28
29
|
constructor(config: RBACDirectiveConfig);
|
|
29
30
|
private parsePermission;
|
|
30
31
|
checkPermission(actorId: string, actorType: ActorType, scopeId: string, permission: string, resourceId?: string): Promise<CheckPermissionResult>;
|
package/dist/rbac/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { RBACClient, RBACModule, createRBACClientFromEnv, createRBACDirective, createRBACDirectiveForLayer, createRBACDirectiveFromEnv } from '../chunk-
|
|
1
|
+
export { RBACClient, RBACModule, createRBACClientFromEnv, createRBACDirective, createRBACDirectiveForLayer, createRBACDirectiveFromEnv } from '../chunk-N3YN6ZII.js';
|
|
2
2
|
import '../chunk-QGBXVNRM.js';
|
|
3
3
|
import '../chunk-YFOHAHZE.js';
|
|
4
4
|
import '../chunk-CBZNP6RF.js';
|
|
@@ -18,14 +18,21 @@ interface ResourceCap {
|
|
|
18
18
|
planName: string;
|
|
19
19
|
planTier: PlanTier;
|
|
20
20
|
isFallback: boolean;
|
|
21
|
+
fallbackReason?: 'clientless' | 'billing_error';
|
|
22
|
+
}
|
|
23
|
+
interface WorkspaceResourceCapScope {
|
|
24
|
+
workspaceId: string;
|
|
25
|
+
organizationId: string;
|
|
21
26
|
}
|
|
22
27
|
type BillingPlanTransport = (query: string, variables: Record<string, unknown>) => Promise<unknown>;
|
|
23
28
|
interface ResourceCapsConfig {
|
|
24
29
|
client?: BurdenoffGraphQLClient;
|
|
25
30
|
transport?: BillingPlanTransport;
|
|
26
31
|
cacheTtlMs?: number;
|
|
27
|
-
|
|
32
|
+
clientlessTier?: PlanTier;
|
|
33
|
+
billingFailureTier?: PlanTier;
|
|
28
34
|
onFallback?: () => void;
|
|
35
|
+
onBillingFailure?: () => void;
|
|
29
36
|
}
|
|
30
37
|
declare class ResourceCapExceededError extends GraphQLError {
|
|
31
38
|
constructor(detail: {
|
|
@@ -39,17 +46,25 @@ declare class ResourceCapsModule {
|
|
|
39
46
|
private client?;
|
|
40
47
|
private transport?;
|
|
41
48
|
private cacheTtlMs;
|
|
42
|
-
private
|
|
49
|
+
private clientlessTier;
|
|
50
|
+
private billingFailureTier;
|
|
43
51
|
private onFallback?;
|
|
52
|
+
private onBillingFailure?;
|
|
44
53
|
private warnedClientless;
|
|
45
54
|
private readonly planCache;
|
|
55
|
+
private readonly planResolutionCounter;
|
|
56
|
+
private readonly enforcementCounter;
|
|
46
57
|
constructor(config?: ResourceCapsConfig);
|
|
47
58
|
configure(config: ResourceCapsConfig): void;
|
|
48
59
|
hasBillingSource(): boolean;
|
|
49
60
|
getResourceCap(userId: string, resource: ResourceName): Promise<ResourceCap>;
|
|
50
61
|
enforceResourceCap(userId: string, resource: ResourceName, currentCount: number): Promise<ResourceCap>;
|
|
62
|
+
getWorkspaceResourceCap(scope: WorkspaceResourceCapScope, resource: ResourceName): Promise<ResourceCap>;
|
|
63
|
+
enforceWorkspaceResourceCap(scope: WorkspaceResourceCapScope, resource: ResourceName, currentCount: number): Promise<ResourceCap>;
|
|
51
64
|
invalidate(userId: string): void;
|
|
65
|
+
invalidateWorkspace(workspaceId: string): void;
|
|
52
66
|
invalidateAll(): void;
|
|
67
|
+
private workspaceCacheKey;
|
|
53
68
|
private resolvePlan;
|
|
54
69
|
private fetchPlan;
|
|
55
70
|
private fetchPlanNode;
|
|
@@ -60,4 +75,4 @@ declare function getResourceCaps(config?: ResourceCapsConfig): ResourceCapsModul
|
|
|
60
75
|
declare function configureResourceCaps(config: ResourceCapsConfig): ResourceCapsModule;
|
|
61
76
|
declare function __resetResourceCapsForTests(): void;
|
|
62
77
|
|
|
63
|
-
export { type BillingPlanTransport, type PlanTier, RESOURCE_CAP_DEFAULTS, type ResourceCap, type ResourceCapDefaults, ResourceCapExceededError, type ResourceCapsConfig, ResourceCapsModule, type ResourceName, __resetResourceCapsForTests, configureResourceCaps, getResourceCaps };
|
|
78
|
+
export { type BillingPlanTransport, type PlanTier, RESOURCE_CAP_DEFAULTS, type ResourceCap, type ResourceCapDefaults, ResourceCapExceededError, type ResourceCapsConfig, ResourceCapsModule, type ResourceName, type WorkspaceResourceCapScope, __resetResourceCapsForTests, configureResourceCaps, getResourceCaps };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { RESOURCE_CAP_DEFAULTS, ResourceCapExceededError, ResourceCapsModule, __resetResourceCapsForTests, configureResourceCaps, getResourceCaps } from '../chunk-
|
|
1
|
+
export { RESOURCE_CAP_DEFAULTS, ResourceCapExceededError, ResourceCapsModule, __resetResourceCapsForTests, configureResourceCaps, getResourceCaps } from '../chunk-RJK4MPDW.js';
|
|
2
|
+
import '../chunk-Q6UAOZFZ.js';
|
|
2
3
|
import '../chunk-CBZNP6RF.js';
|
|
3
4
|
import '../chunk-XE4OXN2W.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { createHumanReadableErrorPlugin, formatHttpError, normalizeGraphQLRespon
|
|
|
2
2
|
export { UserFacingGraphQLError, createHttpErrorResponse, createHumanReadableErrorPlugin, createWorkspaceGuardPlugin, formatHttpError, normalizeError, normalizeExecutionResultErrors, normalizeGraphQLResponse, normalizeGraphQLResponsePayload, toUserFacingGraphQLError } from '../chunk-OQLDXOZ3.js';
|
|
3
3
|
import { getWorkspaceQuotaRegistry } from '../chunk-4OPOVK54.js';
|
|
4
4
|
import { setWorkspaceContext } from '../chunk-KESVEZB2.js';
|
|
5
|
-
import { getMetricsRegistry } from '../chunk-Q6UAOZFZ.js';
|
|
6
5
|
import { I18n } from '../chunk-ULFFX3YE.js';
|
|
6
|
+
import { getMetricsRegistry } from '../chunk-Q6UAOZFZ.js';
|
|
7
7
|
import { ContextManager } from '../chunk-RZOFS2BQ.js';
|
|
8
8
|
import { logger } from '../chunk-CBZNP6RF.js';
|
|
9
9
|
import { __name } from '../chunk-XE4OXN2W.js';
|
|
@@ -466,8 +466,56 @@ function canAccessGraphExport(actor) {
|
|
|
466
466
|
}
|
|
467
467
|
__name(canAccessGraphExport, "canAccessGraphExport");
|
|
468
468
|
|
|
469
|
+
// src/server/quotaGaugeRefresh.ts
|
|
470
|
+
function envMs(name, fallback) {
|
|
471
|
+
const raw = process.env[name];
|
|
472
|
+
if (!raw) return fallback;
|
|
473
|
+
const parsed = Number.parseInt(raw, 10);
|
|
474
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
475
|
+
}
|
|
476
|
+
__name(envMs, "envMs");
|
|
477
|
+
var QUOTA_GAUGE_TTL_MS = envMs("BOFF_QUOTA_GAUGE_TTL_MS", 6e4);
|
|
478
|
+
var QUOTA_GAUGE_REFRESH_TIMEOUT_MS = envMs("BOFF_QUOTA_GAUGE_TIMEOUT_MS", 5e3);
|
|
479
|
+
function createQuotaGaugeRefresher(opts) {
|
|
480
|
+
const ttlMs = opts.ttlMs ?? QUOTA_GAUGE_TTL_MS;
|
|
481
|
+
const timeoutMs = opts.timeoutMs ?? QUOTA_GAUGE_REFRESH_TIMEOUT_MS;
|
|
482
|
+
const now = opts.now ?? (() => Date.now());
|
|
483
|
+
let refreshedAt = 0;
|
|
484
|
+
let inFlight = null;
|
|
485
|
+
const refresh = /* @__PURE__ */ __name(async () => {
|
|
486
|
+
if (refreshedAt !== 0 && now() - refreshedAt < ttlMs) return;
|
|
487
|
+
if (!inFlight) {
|
|
488
|
+
inFlight = (async () => {
|
|
489
|
+
let timer;
|
|
490
|
+
try {
|
|
491
|
+
await Promise.race([
|
|
492
|
+
Promise.resolve(opts.collect()).then(() => void 0),
|
|
493
|
+
new Promise((resolve) => {
|
|
494
|
+
timer = setTimeout(resolve, timeoutMs);
|
|
495
|
+
})
|
|
496
|
+
]);
|
|
497
|
+
refreshedAt = now();
|
|
498
|
+
} catch {
|
|
499
|
+
} finally {
|
|
500
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
501
|
+
inFlight = null;
|
|
502
|
+
}
|
|
503
|
+
})();
|
|
504
|
+
}
|
|
505
|
+
await inFlight;
|
|
506
|
+
}, "refresh");
|
|
507
|
+
return {
|
|
508
|
+
refresh,
|
|
509
|
+
lastRefreshedAt: /* @__PURE__ */ __name(() => refreshedAt, "lastRefreshedAt")
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
__name(createQuotaGaugeRefresher, "createQuotaGaugeRefresher");
|
|
513
|
+
|
|
469
514
|
// src/server/server.ts
|
|
470
515
|
var serverStartTime = null;
|
|
516
|
+
var quotaGaugeRefresher = createQuotaGaugeRefresher({
|
|
517
|
+
collect: /* @__PURE__ */ __name(() => getWorkspaceQuotaRegistry().collectAll(), "collect")
|
|
518
|
+
});
|
|
471
519
|
async function createServer(definition) {
|
|
472
520
|
const { config, prismaClient, schema, moduleGraph, restEndpoints, yogaPlugins, buildContext: customBuildContext, workspaceExtensionConfig, disableWorkspaceExtension, onShutdown } = definition;
|
|
473
521
|
const { Elysia } = await import('elysia');
|
|
@@ -715,10 +763,7 @@ async function createServer(definition) {
|
|
|
715
763
|
}
|
|
716
764
|
const promBody = await prom.register.metrics();
|
|
717
765
|
let sdkBody = "";
|
|
718
|
-
|
|
719
|
-
await getWorkspaceQuotaRegistry().collectAll();
|
|
720
|
-
} catch {
|
|
721
|
-
}
|
|
766
|
+
await quotaGaugeRefresher.refresh();
|
|
722
767
|
try {
|
|
723
768
|
sdkBody = getMetricsRegistry().toPrometheusFormat();
|
|
724
769
|
} catch {
|