@reproapp/node-sdk 0.0.23 → 0.0.24
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/index.js +6 -5
- package/dist/ingest/client.d.ts +1 -1
- package/dist/ingest/client.js +2 -1
- package/package.json +1 -1
- package/src/index.ts +7 -6
- package/src/ingest/client.ts +3 -2
package/dist/index.js
CHANGED
|
@@ -1525,9 +1525,10 @@ function resolveCollectionOrWarn(source, type) {
|
|
|
1525
1525
|
function post(cfg, sessionId, body, options) {
|
|
1526
1526
|
try {
|
|
1527
1527
|
const entries = Array.isArray(body?.entries) ? body.entries : [];
|
|
1528
|
-
(0, client_1.enqueueIngestEntries)(cfg, sessionId, entries, options);
|
|
1528
|
+
return (0, client_1.enqueueIngestEntries)(cfg, sessionId, entries, options);
|
|
1529
1529
|
}
|
|
1530
1530
|
catch { /* swallow in SDK */ }
|
|
1531
|
+
return false;
|
|
1531
1532
|
}
|
|
1532
1533
|
function toIngestConfig(cfg) {
|
|
1533
1534
|
return {
|
|
@@ -4918,9 +4919,6 @@ function emitDbQuery(cfg, sid, aid, payload) {
|
|
|
4918
4919
|
const spanContext = payload?.spanContext ?? captureSpanContextFromTracer();
|
|
4919
4920
|
if (!shouldCaptureDbSpan(spanContext))
|
|
4920
4921
|
return;
|
|
4921
|
-
if (ctx.captureScope) {
|
|
4922
|
-
ctx.captureScope.dbChangeCount += 1;
|
|
4923
|
-
}
|
|
4924
4922
|
const runCtx = {
|
|
4925
4923
|
sid: ctx.sid,
|
|
4926
4924
|
aid: ctx.aid,
|
|
@@ -5039,7 +5037,7 @@ async function emitDbQueryAsync(cfg, sid, aid, payload) {
|
|
|
5039
5037
|
resultMetaMaterialization: resultMetaMaterialization.skipped,
|
|
5040
5038
|
errorMaterialization: errorMaterialization.skipped,
|
|
5041
5039
|
}, spanContext);
|
|
5042
|
-
post(cfg, sid, {
|
|
5040
|
+
const enqueued = post(cfg, sid, {
|
|
5043
5041
|
entries: [{
|
|
5044
5042
|
actionId: aid ?? null,
|
|
5045
5043
|
requestRid: ctx.rid ?? null,
|
|
@@ -5048,6 +5046,9 @@ async function emitDbQueryAsync(cfg, sid, aid, payload) {
|
|
|
5048
5046
|
t: payload.t,
|
|
5049
5047
|
}]
|
|
5050
5048
|
});
|
|
5049
|
+
if (enqueued && ctx.captureScope) {
|
|
5050
|
+
ctx.captureScope.dbChangeCount += 1;
|
|
5051
|
+
}
|
|
5051
5052
|
}
|
|
5052
5053
|
function buildMinimalUpdate(before, after) {
|
|
5053
5054
|
const set = {};
|
package/dist/ingest/client.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export declare const configureIngestQueueDrain: (options: {
|
|
|
8
8
|
}) => void;
|
|
9
9
|
export declare const kickIngestQueueDrain: () => void;
|
|
10
10
|
export declare const postIngestEntries: (config: IngestClientConfig, sessionId: string, entries: LegacyEntry[]) => Promise<void>;
|
|
11
|
-
export declare const enqueueIngestEntries: (config: IngestClientConfig, sessionId: string, entries: LegacyEntry[], options?: EnqueueIngestOptions) =>
|
|
11
|
+
export declare const enqueueIngestEntries: (config: IngestClientConfig, sessionId: string, entries: LegacyEntry[], options?: EnqueueIngestOptions) => boolean;
|
|
12
12
|
export declare const flushIngestQueue: () => Promise<void>;
|
|
13
13
|
export type { IngestClientConfig, LegacyEntry } from './types';
|
package/dist/ingest/client.js
CHANGED
|
@@ -173,7 +173,7 @@ const drainIngestQueue = async () => {
|
|
|
173
173
|
};
|
|
174
174
|
const enqueueIngestEntries = (config, sessionId, entries, options = {}) => {
|
|
175
175
|
if (!sessionId || !Array.isArray(entries) || entries.length === 0) {
|
|
176
|
-
return;
|
|
176
|
+
return false;
|
|
177
177
|
}
|
|
178
178
|
const priority = options.priority === 'high' ? 'high' : 'normal';
|
|
179
179
|
const batch = {
|
|
@@ -208,6 +208,7 @@ const enqueueIngestEntries = (config, sessionId, entries, options = {}) => {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
scheduleDrain(shouldDeferDrain?.() ? deferDrainMs : 0);
|
|
211
|
+
return ingestQueue.includes(batch);
|
|
211
212
|
};
|
|
212
213
|
exports.enqueueIngestEntries = enqueueIngestEntries;
|
|
213
214
|
const flushIngestQueue = async () => {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1921,11 +1921,12 @@ function post(
|
|
|
1921
1921
|
sessionId: string,
|
|
1922
1922
|
body: any,
|
|
1923
1923
|
options?: EnqueueIngestOptions,
|
|
1924
|
-
) {
|
|
1924
|
+
): boolean {
|
|
1925
1925
|
try {
|
|
1926
1926
|
const entries = Array.isArray(body?.entries) ? (body.entries as LegacyEntry[]) : [];
|
|
1927
|
-
enqueueIngestEntries(cfg, sessionId, entries, options);
|
|
1927
|
+
return enqueueIngestEntries(cfg, sessionId, entries, options);
|
|
1928
1928
|
} catch { /* swallow in SDK */ }
|
|
1929
|
+
return false;
|
|
1929
1930
|
}
|
|
1930
1931
|
|
|
1931
1932
|
function toIngestConfig(cfg: IngestClientConfig): IngestClientConfig {
|
|
@@ -5858,9 +5859,6 @@ function emitDbQuery(cfg: any, sid?: string, aid?: string, payload?: any) {
|
|
|
5858
5859
|
const ctx = getCtx() as Ctx;
|
|
5859
5860
|
const spanContext = payload?.spanContext ?? captureSpanContextFromTracer();
|
|
5860
5861
|
if (!shouldCaptureDbSpan(spanContext)) return;
|
|
5861
|
-
if (ctx.captureScope) {
|
|
5862
|
-
ctx.captureScope.dbChangeCount += 1;
|
|
5863
|
-
}
|
|
5864
5862
|
const runCtx: Ctx = {
|
|
5865
5863
|
sid: ctx.sid,
|
|
5866
5864
|
aid: ctx.aid,
|
|
@@ -5978,7 +5976,7 @@ async function emitDbQueryAsync(cfg: any, sid?: string, aid?: string, payload?:
|
|
|
5978
5976
|
resultMetaMaterialization: resultMetaMaterialization.skipped,
|
|
5979
5977
|
errorMaterialization: errorMaterialization.skipped,
|
|
5980
5978
|
}, spanContext);
|
|
5981
|
-
post(cfg, sid, {
|
|
5979
|
+
const enqueued = post(cfg, sid, {
|
|
5982
5980
|
entries: [{
|
|
5983
5981
|
actionId: aid ?? null,
|
|
5984
5982
|
requestRid: ctx.rid ?? null,
|
|
@@ -5987,6 +5985,9 @@ async function emitDbQueryAsync(cfg: any, sid?: string, aid?: string, payload?:
|
|
|
5987
5985
|
t: payload.t,
|
|
5988
5986
|
}]
|
|
5989
5987
|
});
|
|
5988
|
+
if (enqueued && ctx.captureScope) {
|
|
5989
|
+
ctx.captureScope.dbChangeCount += 1;
|
|
5990
|
+
}
|
|
5990
5991
|
}
|
|
5991
5992
|
|
|
5992
5993
|
function buildMinimalUpdate(before: any, after: any) {
|
package/src/ingest/client.ts
CHANGED
|
@@ -211,9 +211,9 @@ export const enqueueIngestEntries = (
|
|
|
211
211
|
sessionId: string,
|
|
212
212
|
entries: LegacyEntry[],
|
|
213
213
|
options: EnqueueIngestOptions = {},
|
|
214
|
-
):
|
|
214
|
+
): boolean => {
|
|
215
215
|
if (!sessionId || !Array.isArray(entries) || entries.length === 0) {
|
|
216
|
-
return;
|
|
216
|
+
return false;
|
|
217
217
|
}
|
|
218
218
|
const priority = options.priority === 'high' ? 'high' : 'normal';
|
|
219
219
|
const batch: QueuedIngestBatch = {
|
|
@@ -246,6 +246,7 @@ export const enqueueIngestEntries = (
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
scheduleDrain(shouldDeferDrain?.() ? deferDrainMs : 0);
|
|
249
|
+
return ingestQueue.includes(batch);
|
|
249
250
|
};
|
|
250
251
|
|
|
251
252
|
export const flushIngestQueue = async (): Promise<void> => {
|