@genn-inc/cluebase-frontend-sdk 0.0.6 → 0.0.8
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/_generated/correlation-attribute-keys.d.ts +3 -0
- package/dist/_generated/correlation-attribute-keys.js +34 -0
- package/dist/_generated/diagnostic-codes.d.ts +4 -0
- package/dist/_generated/diagnostic-codes.js +48 -0
- package/dist/_generated/drop-reasons.d.ts +2 -0
- package/dist/_generated/drop-reasons.js +25 -0
- package/dist/_generated/ingest-routes.d.ts +5 -0
- package/dist/_generated/ingest-routes.js +12 -0
- package/dist/context/trace.js +2 -4
- package/dist/exporter/batch.d.ts +23 -26
- package/dist/exporter/batch.js +247 -289
- package/dist/exporter/browser-outbox-records.d.ts +7 -24
- package/dist/exporter/browser-outbox-records.js +6 -94
- package/dist/exporter/browser-outbox.d.ts +23 -28
- package/dist/exporter/browser-outbox.js +99 -211
- package/dist/exporter/client.d.ts +24 -34
- package/dist/exporter/client.js +105 -318
- package/dist/exporter/delivery-pipeline.d.ts +71 -0
- package/dist/exporter/delivery-pipeline.js +196 -0
- package/dist/exporter/delivery-response-contract.d.ts +1 -81
- package/dist/exporter/delivery-response-contract.js +0 -168
- package/dist/exporter/delivery-response.d.ts +7 -4
- package/dist/exporter/delivery-response.js +59 -133
- package/dist/exporter/diagnostics.d.ts +2 -1
- package/dist/exporter/diagnostics.js +1 -25
- package/dist/exporter/event-id.d.ts +1 -0
- package/dist/exporter/event-id.js +3 -0
- package/dist/exporter/observation-source-event-exporter.d.ts +1 -1
- package/dist/exporter/observation-source-event-exporter.js +2 -2
- package/dist/exporter/sdk-core-delivery.d.ts +225 -0
- package/dist/exporter/sdk-core-delivery.js +97 -0
- package/dist/exporter/sdk-core-wasm.d.ts +7 -1
- package/dist/exporter/sdk-core-wasm.js +24 -3
- package/dist/exporter/source-event.d.ts +2 -0
- package/dist/exporter/source-event.js +17 -0
- package/dist/exporter/span-to-source-signal.d.ts +1 -1
- package/dist/exporter/span-to-source-signal.js +20 -140
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -3
- package/dist/instrumentation/network.d.ts +1 -1
- package/dist/instrumentation/network.js +17 -0
- package/dist/provider/_version.d.ts +1 -1
- package/dist/provider/_version.js +1 -1
- package/dist/provider/config.js +16 -3
- package/dist/provider/constants.js +0 -1
- package/dist/provider/lifecycle-event-dedup.d.ts +7 -0
- package/dist/provider/lifecycle-event-dedup.js +31 -0
- package/dist/provider/sdk-event-pipeline.d.ts +1 -3
- package/dist/provider/sdk-event-pipeline.js +0 -15
- package/dist/provider/sdk-otel-pipeline.d.ts +2 -1
- package/dist/provider/sdk-otel-pipeline.js +2 -11
- package/dist/provider/sdk-runtime-surfaces.d.ts +3 -2
- package/dist/provider/sdk-runtime-surfaces.js +7 -6
- package/dist/provider/sdk.js +88 -54
- package/dist/provider/types.d.ts +12 -19
- package/dist/wasm/pkg-web/cluebase_sdk_core_wasm.d.ts +12 -9
- package/dist/wasm/pkg-web/cluebase_sdk_core_wasm.js +117 -29
- package/dist/wasm/pkg-web/cluebase_sdk_core_wasm_bg.wasm +0 -0
- package/dist/wasm/pkg-web/cluebase_sdk_core_wasm_bg.wasm.d.ts +8 -9
- package/package.json +1 -1
- package/dist/provider/usage-governor.d.ts +0 -7
- package/dist/provider/usage-governor.js +0 -114
package/dist/provider/sdk.js
CHANGED
|
@@ -12,6 +12,7 @@ import { initSdkCoreWasm } from "../exporter/sdk-core-wasm.js";
|
|
|
12
12
|
import { InternalMetricsStore } from "../internal/metrics.js";
|
|
13
13
|
import { isConfigValid, resolveConfig, validateConfig } from "./config.js";
|
|
14
14
|
import { DEFAULT_BATCH_FLUSH_THRESHOLD_BYTES, DEFAULT_CONSENT, DEFAULT_MAX_BATCH_QUEUE_BYTES, DEFAULT_MAX_BATCH_QUEUE_ITEMS, SDK_VERSION, } from "./constants.js";
|
|
15
|
+
import { LifecycleEventDedup } from "./lifecycle-event-dedup.js";
|
|
15
16
|
import { getSdkErrorDetails, reportSdkError } from "./sdk-error.js";
|
|
16
17
|
import { OFFICIAL_CUSTOM_EVENT_NAME, ProviderEventPipeline, readCurrentLifecycleUrl, } from "./sdk-event-pipeline.js";
|
|
17
18
|
import { isValidPublicCustomEventName, normalizeProfileAvatarUrl, normalizePublicIdentityId, toStringOrNull, } from "./sdk-input-normalization.js";
|
|
@@ -48,6 +49,8 @@ class CluebaseBrowserSdkImpl {
|
|
|
48
49
|
this.environmentManager = null;
|
|
49
50
|
this.traceManager = null;
|
|
50
51
|
this.diagnostics = new DiagnosticStore();
|
|
52
|
+
this.lifecycleDedup = new LifecycleEventDedup();
|
|
53
|
+
this.ingestUrlPrefixes = [];
|
|
51
54
|
this.transport = null;
|
|
52
55
|
this.tracerProvider = null;
|
|
53
56
|
this.logger = logger;
|
|
@@ -99,7 +102,6 @@ class CluebaseBrowserSdkImpl {
|
|
|
99
102
|
const nextSignature = JSON.stringify({
|
|
100
103
|
endpoint: resolved.endpoint,
|
|
101
104
|
originalEndpoint: resolved.originalEndpoint,
|
|
102
|
-
localSetupCheckEndpoint: resolved.localSetupCheckEndpoint,
|
|
103
105
|
projectKey: resolved.projectKey,
|
|
104
106
|
producerId: resolved.producerId,
|
|
105
107
|
autocapture: resolved.autocapture,
|
|
@@ -122,6 +124,7 @@ class CluebaseBrowserSdkImpl {
|
|
|
122
124
|
this.shutdown();
|
|
123
125
|
this.internalMetrics.reset();
|
|
124
126
|
this.diagnostics = new DiagnosticStore();
|
|
127
|
+
this.lifecycleDedup.clear();
|
|
125
128
|
this.config = resolved;
|
|
126
129
|
this.initSignature = nextSignature;
|
|
127
130
|
this.identityManager = new IdentityManager();
|
|
@@ -143,6 +146,9 @@ class CluebaseBrowserSdkImpl {
|
|
|
143
146
|
schemaVersion: 1,
|
|
144
147
|
metrics: this.internalMetrics,
|
|
145
148
|
diagnostics: this.diagnostics,
|
|
149
|
+
onEndpointsResolved: (endpoints) => {
|
|
150
|
+
this.adoptIngestUrlPrefixes(endpoints);
|
|
151
|
+
},
|
|
146
152
|
});
|
|
147
153
|
this.transport = new BatchTransport({
|
|
148
154
|
client: ingestClient,
|
|
@@ -154,12 +160,13 @@ class CluebaseBrowserSdkImpl {
|
|
|
154
160
|
queueMaxBytes: DEFAULT_MAX_BATCH_QUEUE_BYTES,
|
|
155
161
|
queueMaxItems: DEFAULT_MAX_BATCH_QUEUE_ITEMS,
|
|
156
162
|
projectKey: resolved.projectKey,
|
|
163
|
+
endpoint: resolved.endpoint,
|
|
164
|
+
sdkVersion: SDK_VERSION,
|
|
165
|
+
sourceSchemaVersion: "1",
|
|
166
|
+
sdkRequest: "browser",
|
|
157
167
|
initialConsent: this.consent,
|
|
158
168
|
metrics: this.internalMetrics,
|
|
159
169
|
diagnostics: this.diagnostics,
|
|
160
|
-
onGovernorFeedback: (feedback) => {
|
|
161
|
-
this.applyUsageGovernorFeedback(feedback);
|
|
162
|
-
},
|
|
163
170
|
});
|
|
164
171
|
this.consent = this.transport.currentConsent();
|
|
165
172
|
this.transport.start();
|
|
@@ -186,6 +193,7 @@ class CluebaseBrowserSdkImpl {
|
|
|
186
193
|
resolved,
|
|
187
194
|
getTransport: () => this.transport,
|
|
188
195
|
getContext: () => this.buildContext(),
|
|
196
|
+
ignoreUrlPrefixes: this.ingestUrlPrefixes,
|
|
189
197
|
});
|
|
190
198
|
this.initialized = true;
|
|
191
199
|
this.refreshSessionCaptureEligibility();
|
|
@@ -248,6 +256,16 @@ class CluebaseBrowserSdkImpl {
|
|
|
248
256
|
const sanitizedTraits = this.sanitizeIdentifyTraits(traits);
|
|
249
257
|
const subjectProfileKeys = safeProfileKeys(traits, this.config?.privacy.deniedKeys ?? []);
|
|
250
258
|
this.identityManager.identify(sanitizedUserId, sanitizedTraits);
|
|
259
|
+
if (!this.lifecycleDedup.shouldEmit({
|
|
260
|
+
action: "identify",
|
|
261
|
+
userId: sanitizedUserId,
|
|
262
|
+
anonymousId: previousAnonymousId,
|
|
263
|
+
organizationId: this.organizationManager?.getContext().organizationId ?? null,
|
|
264
|
+
subjectTraits: this.identityManager.getContext().traits,
|
|
265
|
+
profileKeys: subjectProfileKeys,
|
|
266
|
+
})) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
251
269
|
this.enqueueOfficialCustomEvent(OFFICIAL_CUSTOM_EVENT_NAME.identityIdentified, {
|
|
252
270
|
identity_action: "identify",
|
|
253
271
|
profile_keys: subjectProfileKeys,
|
|
@@ -279,9 +297,20 @@ class CluebaseBrowserSdkImpl {
|
|
|
279
297
|
return;
|
|
280
298
|
}
|
|
281
299
|
const sanitizedOrgId = this.sanitizeIdentityValue("organizationId", normalizedOrganizationId);
|
|
282
|
-
const
|
|
300
|
+
const identityBeforeGroup = this.identityManager?.getContext();
|
|
301
|
+
const previousUserId = identityBeforeGroup?.userId ?? null;
|
|
283
302
|
const organizationProfileKeys = safeProfileKeys(traits, this.config?.privacy.deniedKeys ?? []);
|
|
284
303
|
this.organizationManager.setOrganization(sanitizedOrgId, traits);
|
|
304
|
+
if (!this.lifecycleDedup.shouldEmit({
|
|
305
|
+
action: "associate_organization",
|
|
306
|
+
userId: previousUserId,
|
|
307
|
+
anonymousId: identityBeforeGroup?.anonymousId ?? null,
|
|
308
|
+
organizationId: sanitizedOrgId,
|
|
309
|
+
organizationTraits: this.organizationManager.getContext().traits,
|
|
310
|
+
profileKeys: organizationProfileKeys,
|
|
311
|
+
})) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
285
314
|
this.enqueueOfficialCustomEvent(OFFICIAL_CUSTOM_EVENT_NAME.organizationAssociated, {
|
|
286
315
|
organization_action: "associate",
|
|
287
316
|
profile_keys: organizationProfileKeys,
|
|
@@ -298,6 +327,22 @@ class CluebaseBrowserSdkImpl {
|
|
|
298
327
|
});
|
|
299
328
|
}
|
|
300
329
|
}
|
|
330
|
+
link(input) {
|
|
331
|
+
if (!this.ensureInitializedForPublicCall("link")) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const subject = input?.subject;
|
|
335
|
+
if (subject?.type !== "organization") {
|
|
336
|
+
this.warnPublicDrop("link", "subject.type must be 'organization'");
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const organizationId = normalizePublicIdentityId(subject.id);
|
|
340
|
+
if (!organizationId) {
|
|
341
|
+
this.warnPublicDrop("link", "subject.id must be a non-empty string");
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
this.emitExternalLink("link", organizationId, input?.external?.namespace, input?.external?.id);
|
|
345
|
+
}
|
|
301
346
|
linkExternalAccount(namespace, externalId) {
|
|
302
347
|
if (!this.ensureInitializedForPublicCall("linkExternalAccount")) {
|
|
303
348
|
return;
|
|
@@ -306,21 +351,32 @@ class CluebaseBrowserSdkImpl {
|
|
|
306
351
|
this.warnPublicDrop("linkExternalAccount", "organization manager is unavailable");
|
|
307
352
|
return;
|
|
308
353
|
}
|
|
354
|
+
const organizationId = this.organizationManager.getContext().organizationId;
|
|
355
|
+
if (!organizationId) {
|
|
356
|
+
this.warnPublicDrop("linkExternalAccount", "setOrganization must be called before linkExternalAccount");
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
this.emitExternalLink("linkExternalAccount", organizationId, namespace, externalId);
|
|
360
|
+
}
|
|
361
|
+
emitExternalLink(publicCallName, organizationId, namespace, externalId) {
|
|
309
362
|
try {
|
|
310
|
-
const organizationId = this.organizationManager.getContext().organizationId;
|
|
311
|
-
if (!organizationId) {
|
|
312
|
-
this.warnPublicDrop("linkExternalAccount", "setOrganization must be called before linkExternalAccount");
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
363
|
const normalizedNamespace = normalizePublicIdentityId(namespace);
|
|
316
364
|
const normalizedExternalId = normalizePublicIdentityId(externalId);
|
|
317
365
|
if (!normalizedNamespace || !normalizedExternalId) {
|
|
318
|
-
this.warnPublicDrop(
|
|
366
|
+
this.warnPublicDrop(publicCallName, "namespace and externalId must be non-empty strings");
|
|
319
367
|
return;
|
|
320
368
|
}
|
|
321
369
|
const sanitizedExternalId = this.sanitizeIdentityValue("externalId", normalizedExternalId);
|
|
370
|
+
if (!this.lifecycleDedup.shouldEmit({
|
|
371
|
+
action: "link",
|
|
372
|
+
organizationId,
|
|
373
|
+
externalNamespace: normalizedNamespace,
|
|
374
|
+
externalId: sanitizedExternalId,
|
|
375
|
+
})) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
322
378
|
this.enqueueOfficialCustomEvent(OFFICIAL_CUSTOM_EVENT_NAME.externalAccountLinked, {
|
|
323
|
-
identity_action: "
|
|
379
|
+
identity_action: "link",
|
|
324
380
|
external_namespace: normalizedNamespace,
|
|
325
381
|
}, false, {
|
|
326
382
|
link_type: "canonical_subject_to_external",
|
|
@@ -331,36 +387,12 @@ class CluebaseBrowserSdkImpl {
|
|
|
331
387
|
this.flushLifecycleEvents();
|
|
332
388
|
}
|
|
333
389
|
catch {
|
|
334
|
-
this.logger.error(
|
|
390
|
+
this.logger.error(`${publicCallName} failed`, {
|
|
335
391
|
error_code: "sdk_operation_failed",
|
|
336
392
|
});
|
|
337
393
|
}
|
|
338
394
|
}
|
|
339
395
|
reset() {
|
|
340
|
-
if (!this.initialized) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
try {
|
|
344
|
-
const previousUserId = this.identityManager?.getContext().userId ?? null;
|
|
345
|
-
const previousOrganizationId = this.organizationManager?.getContext().organizationId ?? null;
|
|
346
|
-
this.enqueueOfficialCustomEvent(OFFICIAL_CUSTOM_EVENT_NAME.identityReset, {
|
|
347
|
-
identity_action: "reset",
|
|
348
|
-
}, false, {
|
|
349
|
-
link_type: "logout",
|
|
350
|
-
user_id: previousUserId,
|
|
351
|
-
organization_id: previousOrganizationId,
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
catch {
|
|
355
|
-
this.logger.error("reset failed", {
|
|
356
|
-
error_code: "sdk_operation_failed",
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
finally {
|
|
360
|
-
this.resetSessionState();
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
logout() {
|
|
364
396
|
if (!this.initialized) {
|
|
365
397
|
return;
|
|
366
398
|
}
|
|
@@ -376,7 +408,7 @@ class CluebaseBrowserSdkImpl {
|
|
|
376
408
|
});
|
|
377
409
|
}
|
|
378
410
|
catch {
|
|
379
|
-
this.logger.error("
|
|
411
|
+
this.logger.error("reset failed", {
|
|
380
412
|
error_code: "sdk_operation_failed",
|
|
381
413
|
});
|
|
382
414
|
}
|
|
@@ -441,6 +473,9 @@ class CluebaseBrowserSdkImpl {
|
|
|
441
473
|
});
|
|
442
474
|
}
|
|
443
475
|
setConsent(consent) {
|
|
476
|
+
if (this.consent !== consent) {
|
|
477
|
+
this.lifecycleDedup.clear();
|
|
478
|
+
}
|
|
444
479
|
this.consent = consent;
|
|
445
480
|
if (!this.initialized) {
|
|
446
481
|
return;
|
|
@@ -538,21 +573,15 @@ class CluebaseBrowserSdkImpl {
|
|
|
538
573
|
void this.transport?.flush();
|
|
539
574
|
}
|
|
540
575
|
async flush() {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
await forceFlushCluebaseOtelProvider(this.tracerProvider, deadline?.signal);
|
|
545
|
-
await this.transport?.flush(deadline);
|
|
546
|
-
}
|
|
547
|
-
finally {
|
|
548
|
-
this.transport?.endFlushDeadline(deadline);
|
|
549
|
-
}
|
|
576
|
+
await this.flushCaptureSummaries("manual_flush");
|
|
577
|
+
await forceFlushCluebaseOtelProvider(this.tracerProvider);
|
|
578
|
+
await this.transport?.flush();
|
|
550
579
|
}
|
|
551
580
|
async close() {
|
|
552
|
-
|
|
553
|
-
await
|
|
581
|
+
this.transport?.beginClose();
|
|
582
|
+
await this.flushCaptureSummaries("close");
|
|
554
583
|
this.stopCaptureModules();
|
|
555
|
-
await forceFlushCluebaseOtelProvider(this.tracerProvider
|
|
584
|
+
await forceFlushCluebaseOtelProvider(this.tracerProvider);
|
|
556
585
|
await this.transport?.close();
|
|
557
586
|
if (this.transport?.getDiagnostics().lifecycle === "closing_failed") {
|
|
558
587
|
await this.shutdownAsync();
|
|
@@ -563,11 +592,19 @@ class CluebaseBrowserSdkImpl {
|
|
|
563
592
|
warmupBrowserToken(client) {
|
|
564
593
|
this.runtimeSurfaces.warmupBrowserToken(client);
|
|
565
594
|
}
|
|
595
|
+
adoptIngestUrlPrefixes(endpoints) {
|
|
596
|
+
for (const url of [endpoints.ingestBatchUrl, endpoints.browserTokenUrl]) {
|
|
597
|
+
if (url.length > 0 && !this.ingestUrlPrefixes.includes(url)) {
|
|
598
|
+
this.ingestUrlPrefixes.push(url);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
this.runtimeSurfaces.refreshIgnoreUrlPrefixes();
|
|
602
|
+
}
|
|
566
603
|
startCaptureModules() {
|
|
567
604
|
if (!this.config) {
|
|
568
605
|
return;
|
|
569
606
|
}
|
|
570
|
-
this.runtimeSurfaces.startCaptureModules(this.config);
|
|
607
|
+
this.runtimeSurfaces.startCaptureModules(this.config, this.ingestUrlPrefixes);
|
|
571
608
|
}
|
|
572
609
|
stopCaptureModules() {
|
|
573
610
|
this.runtimeSurfaces.stopCaptureModules();
|
|
@@ -575,9 +612,6 @@ class CluebaseBrowserSdkImpl {
|
|
|
575
612
|
async flushCaptureSummaries(reason) {
|
|
576
613
|
await this.runtimeSurfaces.flushCaptureSummaries(reason);
|
|
577
614
|
}
|
|
578
|
-
applyUsageGovernorFeedback(feedback) {
|
|
579
|
-
this.eventPipeline.applyUsageGovernorFeedback(feedback);
|
|
580
|
-
}
|
|
581
615
|
buildContext() {
|
|
582
616
|
return this.eventPipeline.buildContext();
|
|
583
617
|
}
|
package/dist/provider/types.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ import type { FrontendEventName, ParameterCaptureMode, SdkCollectionMode } from
|
|
|
4
4
|
export type { FrontendEventCategory, FrontendEventName, FrontendEventStatus, ParameterCaptureMode, SdkCollectionMode, } from "./contracts.js";
|
|
5
5
|
export type CluebaseConsentState = "granted" | "denied" | "unknown";
|
|
6
6
|
export type CluebaseGroupType = "organization";
|
|
7
|
+
export type CluebaseLinkInput = {
|
|
8
|
+
subject: {
|
|
9
|
+
type: CluebaseGroupType;
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
external: {
|
|
13
|
+
namespace: string;
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
7
17
|
export type CanonicalJsonValue = string | number | boolean | null | CanonicalJsonValue[] | {
|
|
8
18
|
[key: string]: CanonicalJsonValue;
|
|
9
19
|
};
|
|
@@ -63,7 +73,6 @@ export type CluebaseInitOptions = {
|
|
|
63
73
|
export type ResolvedCluebaseConfig = {
|
|
64
74
|
endpoint: string;
|
|
65
75
|
originalEndpoint: string;
|
|
66
|
-
localSetupCheckEndpoint: string | null;
|
|
67
76
|
projectKey: string;
|
|
68
77
|
producerId: string;
|
|
69
78
|
autocapture: boolean;
|
|
@@ -110,8 +119,8 @@ export type CluebaseBrowserSdk = {
|
|
|
110
119
|
init(options: CluebaseInitOptions): void;
|
|
111
120
|
identify(userId: string, traits?: CluebaseSubjectTraits): void;
|
|
112
121
|
setOrganization(organizationId: string, traits?: CluebaseGroupTraits): void;
|
|
122
|
+
link(input: CluebaseLinkInput): void;
|
|
113
123
|
linkExternalAccount(namespace: string, externalId: string): void;
|
|
114
|
-
logout(): void;
|
|
115
124
|
reset(): void;
|
|
116
125
|
track(eventName: string, properties?: CluebaseTrackProperties, metrics?: CluebaseTrackMetrics): void;
|
|
117
126
|
setConsent(consent: CluebaseConsentState): void;
|
|
@@ -121,23 +130,6 @@ export type CluebaseBrowserSdk = {
|
|
|
121
130
|
getDiagnostics(): DiagnosticsSnapshot;
|
|
122
131
|
withActionContext<T>(callback: () => T): T;
|
|
123
132
|
};
|
|
124
|
-
export type { CostCapability } from "../_generated/usage-governor-tables.js";
|
|
125
|
-
import type { CostCapability } from "../_generated/usage-governor-tables.js";
|
|
126
|
-
export type LimitKind = "monthly_overage_amount_limit" | "internal_cost_limit" | "internal_limit" | "operator_global_monthly_cost_limit";
|
|
127
|
-
export type ThresholdStage = "info" | "warning" | "urgent" | "reached";
|
|
128
|
-
export type LimitReason = {
|
|
129
|
-
limitKind: LimitKind;
|
|
130
|
-
meterKey: string;
|
|
131
|
-
thresholdStage: ThresholdStage;
|
|
132
|
-
currentValue: number;
|
|
133
|
-
limitValue: number;
|
|
134
|
-
retryAfterAt: string | null;
|
|
135
|
-
};
|
|
136
|
-
export type IngestUsageGovernorFeedback = {
|
|
137
|
-
disabledCapabilities: CostCapability[];
|
|
138
|
-
limitReasons: LimitReason[];
|
|
139
|
-
retryAfterAt: string | null;
|
|
140
|
-
};
|
|
141
133
|
export type ParameterSnapshotLeafType = "string" | "number" | "boolean" | "null" | "object" | "array";
|
|
142
134
|
export type ParameterSnapshotLeaf = {
|
|
143
135
|
type: ParameterSnapshotLeafType;
|
|
@@ -285,4 +277,5 @@ export type CaptureModuleContext = {
|
|
|
285
277
|
export type CaptureStopHandle = {
|
|
286
278
|
stop: () => void;
|
|
287
279
|
flush?: (reason: string) => void | Promise<void>;
|
|
280
|
+
refreshIgnoreUrlPrefixes?: () => void;
|
|
288
281
|
};
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
export function deliveryCommandJson(request_json: string): string;
|
|
5
|
+
|
|
6
|
+
export function spanToObservationSourceEventJson(span_json: string, options_json: string): string;
|
|
7
|
+
|
|
4
8
|
export function spanToSdkSignalJson(span_json: string, options_json: string): string;
|
|
5
9
|
|
|
6
10
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
7
11
|
|
|
8
12
|
export interface InitOutput {
|
|
9
13
|
readonly memory: WebAssembly.Memory;
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly __wbindgen_start: () => void;
|
|
14
|
+
readonly deliveryCommandJson: (a: number, b: number, c: number) => void;
|
|
15
|
+
readonly spanToObservationSourceEventJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
16
|
+
readonly spanToSdkSignalJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
17
|
+
readonly __wbindgen_export: (a: number) => void;
|
|
18
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
19
|
+
readonly __wbindgen_export2: (a: number, b: number) => number;
|
|
20
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
21
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
/* @ts-self-types="./cluebase_sdk_core_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} request_json
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function deliveryCommandJson(request_json) {
|
|
8
|
+
let deferred3_0;
|
|
9
|
+
let deferred3_1;
|
|
10
|
+
try {
|
|
11
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
12
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
13
|
+
const len0 = WASM_VECTOR_LEN;
|
|
14
|
+
wasm.deliveryCommandJson(retptr, ptr0, len0);
|
|
15
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
16
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
17
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
18
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
19
|
+
var ptr2 = r0;
|
|
20
|
+
var len2 = r1;
|
|
21
|
+
if (r3) {
|
|
22
|
+
ptr2 = 0; len2 = 0;
|
|
23
|
+
throw takeObject(r2);
|
|
24
|
+
}
|
|
25
|
+
deferred3_0 = ptr2;
|
|
26
|
+
deferred3_1 = len2;
|
|
27
|
+
return getStringFromWasm0(ptr2, len2);
|
|
28
|
+
} finally {
|
|
29
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
30
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} span_json
|
|
36
|
+
* @param {string} options_json
|
|
37
|
+
* @returns {string}
|
|
38
|
+
*/
|
|
39
|
+
export function spanToObservationSourceEventJson(span_json, options_json) {
|
|
40
|
+
let deferred4_0;
|
|
41
|
+
let deferred4_1;
|
|
42
|
+
try {
|
|
43
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
44
|
+
const ptr0 = passStringToWasm0(span_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
45
|
+
const len0 = WASM_VECTOR_LEN;
|
|
46
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
47
|
+
const len1 = WASM_VECTOR_LEN;
|
|
48
|
+
wasm.spanToObservationSourceEventJson(retptr, ptr0, len0, ptr1, len1);
|
|
49
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
50
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
51
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
52
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
53
|
+
var ptr3 = r0;
|
|
54
|
+
var len3 = r1;
|
|
55
|
+
if (r3) {
|
|
56
|
+
ptr3 = 0; len3 = 0;
|
|
57
|
+
throw takeObject(r2);
|
|
58
|
+
}
|
|
59
|
+
deferred4_0 = ptr3;
|
|
60
|
+
deferred4_1 = len3;
|
|
61
|
+
return getStringFromWasm0(ptr3, len3);
|
|
62
|
+
} finally {
|
|
63
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
64
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
3
68
|
/**
|
|
4
69
|
* @param {string} span_json
|
|
5
70
|
* @param {string} options_json
|
|
@@ -9,22 +74,28 @@ export function spanToSdkSignalJson(span_json, options_json) {
|
|
|
9
74
|
let deferred4_0;
|
|
10
75
|
let deferred4_1;
|
|
11
76
|
try {
|
|
12
|
-
const
|
|
77
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
78
|
+
const ptr0 = passStringToWasm0(span_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
13
79
|
const len0 = WASM_VECTOR_LEN;
|
|
14
|
-
const ptr1 = passStringToWasm0(options_json, wasm.
|
|
80
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
15
81
|
const len1 = WASM_VECTOR_LEN;
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
82
|
+
wasm.spanToSdkSignalJson(retptr, ptr0, len0, ptr1, len1);
|
|
83
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
84
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
85
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
86
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
87
|
+
var ptr3 = r0;
|
|
88
|
+
var len3 = r1;
|
|
89
|
+
if (r3) {
|
|
20
90
|
ptr3 = 0; len3 = 0;
|
|
21
|
-
throw
|
|
91
|
+
throw takeObject(r2);
|
|
22
92
|
}
|
|
23
93
|
deferred4_0 = ptr3;
|
|
24
94
|
deferred4_1 = len3;
|
|
25
95
|
return getStringFromWasm0(ptr3, len3);
|
|
26
96
|
} finally {
|
|
27
|
-
wasm.
|
|
97
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
98
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
28
99
|
}
|
|
29
100
|
}
|
|
30
101
|
function __wbg_get_imports() {
|
|
@@ -37,26 +108,20 @@ function __wbg_get_imports() {
|
|
|
37
108
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
38
109
|
}, arguments); },
|
|
39
110
|
__wbg_getTime_f5a55efff2585d5d: function(arg0) {
|
|
40
|
-
const ret = arg0.getTime();
|
|
111
|
+
const ret = getObject(arg0).getTime();
|
|
41
112
|
return ret;
|
|
42
113
|
},
|
|
43
114
|
__wbg_new_0_72d020f0c63443d4: function() {
|
|
44
115
|
const ret = new Date();
|
|
45
|
-
return ret;
|
|
116
|
+
return addHeapObject(ret);
|
|
46
117
|
},
|
|
47
118
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
48
119
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
49
120
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
50
|
-
return ret;
|
|
121
|
+
return addHeapObject(ret);
|
|
51
122
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const offset = table.grow(4);
|
|
55
|
-
table.set(0, undefined);
|
|
56
|
-
table.set(offset + 0, undefined);
|
|
57
|
-
table.set(offset + 1, null);
|
|
58
|
-
table.set(offset + 2, true);
|
|
59
|
-
table.set(offset + 3, false);
|
|
123
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
124
|
+
takeObject(arg0);
|
|
60
125
|
},
|
|
61
126
|
};
|
|
62
127
|
return {
|
|
@@ -65,17 +130,34 @@ function __wbg_get_imports() {
|
|
|
65
130
|
};
|
|
66
131
|
}
|
|
67
132
|
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
133
|
+
function addHeapObject(obj) {
|
|
134
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
135
|
+
const idx = heap_next;
|
|
136
|
+
heap_next = heap[idx];
|
|
137
|
+
|
|
138
|
+
heap[idx] = obj;
|
|
71
139
|
return idx;
|
|
72
140
|
}
|
|
73
141
|
|
|
142
|
+
function dropObject(idx) {
|
|
143
|
+
if (idx < 1028) return;
|
|
144
|
+
heap[idx] = heap_next;
|
|
145
|
+
heap_next = idx;
|
|
146
|
+
}
|
|
147
|
+
|
|
74
148
|
function getArrayU8FromWasm0(ptr, len) {
|
|
75
149
|
ptr = ptr >>> 0;
|
|
76
150
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
77
151
|
}
|
|
78
152
|
|
|
153
|
+
let cachedDataViewMemory0 = null;
|
|
154
|
+
function getDataViewMemory0() {
|
|
155
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
156
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
157
|
+
}
|
|
158
|
+
return cachedDataViewMemory0;
|
|
159
|
+
}
|
|
160
|
+
|
|
79
161
|
function getStringFromWasm0(ptr, len) {
|
|
80
162
|
return decodeText(ptr >>> 0, len);
|
|
81
163
|
}
|
|
@@ -88,15 +170,21 @@ function getUint8ArrayMemory0() {
|
|
|
88
170
|
return cachedUint8ArrayMemory0;
|
|
89
171
|
}
|
|
90
172
|
|
|
173
|
+
function getObject(idx) { return heap[idx]; }
|
|
174
|
+
|
|
91
175
|
function handleError(f, args) {
|
|
92
176
|
try {
|
|
93
177
|
return f.apply(this, args);
|
|
94
178
|
} catch (e) {
|
|
95
|
-
|
|
96
|
-
wasm.__wbindgen_exn_store(idx);
|
|
179
|
+
wasm.__wbindgen_export(addHeapObject(e));
|
|
97
180
|
}
|
|
98
181
|
}
|
|
99
182
|
|
|
183
|
+
let heap = new Array(1024).fill(undefined);
|
|
184
|
+
heap.push(undefined, null, true, false);
|
|
185
|
+
|
|
186
|
+
let heap_next = heap.length;
|
|
187
|
+
|
|
100
188
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
101
189
|
if (realloc === undefined) {
|
|
102
190
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -134,10 +222,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
134
222
|
return ptr;
|
|
135
223
|
}
|
|
136
224
|
|
|
137
|
-
function
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
return
|
|
225
|
+
function takeObject(idx) {
|
|
226
|
+
const ret = getObject(idx);
|
|
227
|
+
dropObject(idx);
|
|
228
|
+
return ret;
|
|
141
229
|
}
|
|
142
230
|
|
|
143
231
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
@@ -174,8 +262,8 @@ function __wbg_finalize_init(instance, module) {
|
|
|
174
262
|
wasmInstance = instance;
|
|
175
263
|
wasm = instance.exports;
|
|
176
264
|
wasmModule = module;
|
|
265
|
+
cachedDataViewMemory0 = null;
|
|
177
266
|
cachedUint8ArrayMemory0 = null;
|
|
178
|
-
wasm.__wbindgen_start();
|
|
179
267
|
return wasm;
|
|
180
268
|
}
|
|
181
269
|
|
|
Binary file
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const __wbindgen_start: () => void;
|
|
4
|
+
export const deliveryCommandJson: (a: number, b: number, c: number) => void;
|
|
5
|
+
export const spanToObservationSourceEventJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
6
|
+
export const spanToSdkSignalJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
7
|
+
export const __wbindgen_export: (a: number) => void;
|
|
8
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
9
|
+
export const __wbindgen_export2: (a: number, b: number) => number;
|
|
10
|
+
export const __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
11
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CostCapability, IngestUsageGovernorFeedback } from "./types.js";
|
|
2
|
-
export declare const DEFAULT_INGEST_USAGE_GOVERNOR_FEEDBACK: IngestUsageGovernorFeedback;
|
|
3
|
-
export declare const normalizeIngestUsageGovernorFeedback: (feedback?: Partial<IngestUsageGovernorFeedback> | null) => IngestUsageGovernorFeedback;
|
|
4
|
-
export declare const mergeIngestUsageGovernorFeedback: (current: IngestUsageGovernorFeedback | null, incoming: IngestUsageGovernorFeedback | null) => IngestUsageGovernorFeedback | null;
|
|
5
|
-
export declare const parseGovernorFeedbackEnvelope: (value: unknown) => IngestUsageGovernorFeedback | null;
|
|
6
|
-
export declare const isCostCapabilityDisabled: (feedback: Pick<IngestUsageGovernorFeedback, "disabledCapabilities">, capability: CostCapability) => boolean;
|
|
7
|
-
export declare const hasUsageGovernorFeedbackChanged: (current: IngestUsageGovernorFeedback, next: IngestUsageGovernorFeedback) => boolean;
|