@lmnr-ai/lmnr 0.8.42 → 0.8.44
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/cli.cjs +2 -2
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/{consts-DV6_Ea-8.cjs → consts-9rSS0oeR.cjs} +2 -2
- package/dist/consts-9rSS0oeR.cjs.map +1 -0
- package/dist/{consts-3AfXaMBI.mjs → consts-CTTu3jhI.mjs} +2 -2
- package/dist/consts-CTTu3jhI.mjs.map +1 -0
- package/dist/{dist-xn6QYxLQ.cjs → dist-BtB31bk1.cjs} +27 -8
- package/dist/{dist-xn6QYxLQ.cjs.map → dist-BtB31bk1.cjs.map} +1 -1
- package/dist/{dist-BrVFOUxo.mjs → dist-Cjres0a5.mjs} +27 -8
- package/dist/{dist-BrVFOUxo.mjs.map → dist-Cjres0a5.mjs.map} +1 -1
- package/dist/{evaluations-8Zaace6s.d.mts → evaluations-CVo0ms_r.d.mts} +52 -33
- package/dist/{evaluations-Brer2YNi.d.cts → evaluations-RbBZb5yl.d.cts} +52 -33
- package/dist/{file-utils-Cn3xPQJi.mjs → file-utils-1olUHMKC.mjs} +2 -2
- package/dist/{file-utils-Cn3xPQJi.mjs.map → file-utils-1olUHMKC.mjs.map} +1 -1
- package/dist/{file-utils-Dkw_7jYJ.cjs → file-utils-CMO5MuV9.cjs} +2 -2
- package/dist/{file-utils-Dkw_7jYJ.cjs.map → file-utils-CMO5MuV9.cjs.map} +1 -1
- package/dist/index.cjs +706 -175
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +246 -3
- package/dist/index.d.mts +246 -3
- package/dist/index.mjs +706 -176
- package/dist/index.mjs.map +1 -1
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.cjs +1 -1
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.mjs +1 -1
- package/package.json +3 -3
- package/dist/consts-3AfXaMBI.mjs.map +0 -1
- package/dist/consts-DV6_Ea-8.cjs.map +0 -1
|
@@ -173,8 +173,7 @@ interface SessionBlock {
|
|
|
173
173
|
//#region src/signals.d.ts
|
|
174
174
|
/**
|
|
175
175
|
* A signal's payload schema — the structured output the LLM must return. Every
|
|
176
|
-
* field is required
|
|
177
|
-
* field with an `enum` array.
|
|
176
|
+
* field is required; enums are a string field with an `enum` array.
|
|
178
177
|
*/
|
|
179
178
|
interface SignalStructuredOutput {
|
|
180
179
|
type: "object";
|
|
@@ -186,30 +185,29 @@ interface SignalStructuredOutput {
|
|
|
186
185
|
required: string[];
|
|
187
186
|
}
|
|
188
187
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
188
|
+
* WHEN a signal is evaluated, decided from a single span batch. A closed set,
|
|
189
|
+
* not a column list: these are the only two shapes the backend evaluates, so
|
|
190
|
+
* anything else would be stored and then silently never fire.
|
|
191
|
+
*/
|
|
192
|
+
type SignalTrigger = {
|
|
193
|
+
type: "rootSpanFinished";
|
|
194
|
+
} | {
|
|
195
|
+
type: "spanName";
|
|
196
|
+
spanNames: string[];
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* WHETHER a fired signal runs — a property of the whole trace. Columns:
|
|
200
|
+
* `total_token_count`, `status`, `span_names`. An empty list runs on every
|
|
201
|
+
* firing trace. Extra keys are preserved so the shape can grow server-side
|
|
202
|
+
* without an SDK release.
|
|
199
203
|
*/
|
|
200
|
-
interface SignalTrigger {
|
|
201
|
-
id?: string;
|
|
202
|
-
conditions: SignalFilter[];
|
|
203
|
-
filters: SignalFilter[];
|
|
204
|
-
createdAt?: string;
|
|
205
|
-
/** 0 = batch, 1 = realtime */
|
|
206
|
-
mode?: number;
|
|
207
|
-
}
|
|
208
204
|
interface SignalFilter {
|
|
209
205
|
column: string;
|
|
210
206
|
operator: string;
|
|
211
|
-
value:
|
|
207
|
+
value: unknown;
|
|
208
|
+
[key: string]: unknown;
|
|
212
209
|
}
|
|
210
|
+
type SignalMode = "batch" | "realtime";
|
|
213
211
|
interface Signal {
|
|
214
212
|
id: string;
|
|
215
213
|
projectId: string;
|
|
@@ -219,7 +217,9 @@ interface Signal {
|
|
|
219
217
|
sampleRate: number | null;
|
|
220
218
|
disabled: boolean;
|
|
221
219
|
createdAt: string;
|
|
222
|
-
|
|
220
|
+
trigger: SignalTrigger;
|
|
221
|
+
filters: SignalFilter[];
|
|
222
|
+
mode: SignalMode;
|
|
223
223
|
} //#endregion
|
|
224
224
|
//#region src/sql-schema.d.ts
|
|
225
225
|
/**
|
|
@@ -577,7 +577,7 @@ declare class EvalsResource extends BaseResource {
|
|
|
577
577
|
* @param {Object} options - Update datapoint options
|
|
578
578
|
* @param {string} options.evalId - The evaluation ID
|
|
579
579
|
* @param {string} options.datapointId - The datapoint ID
|
|
580
|
-
* @param {Record<string, number>} options.scores - The scores
|
|
580
|
+
* @param {Record<string, number | null>} options.scores - The scores
|
|
581
581
|
* @param {O} [options.executorOutput] - The executor output
|
|
582
582
|
* @returns {Promise<void>}
|
|
583
583
|
*/
|
|
@@ -589,7 +589,7 @@ declare class EvalsResource extends BaseResource {
|
|
|
589
589
|
}: {
|
|
590
590
|
evalId: string;
|
|
591
591
|
datapointId: string;
|
|
592
|
-
scores: Record<string, number>;
|
|
592
|
+
scores: Record<string, number | null>;
|
|
593
593
|
executorOutput?: O;
|
|
594
594
|
}): Promise<void>;
|
|
595
595
|
/**
|
|
@@ -804,23 +804,28 @@ interface CreateSignalOptions {
|
|
|
804
804
|
name: string;
|
|
805
805
|
prompt: string;
|
|
806
806
|
structuredOutput: SignalStructuredOutput;
|
|
807
|
+
/** Omit for no sampling. */
|
|
807
808
|
sampleRate?: number;
|
|
808
809
|
disabled?: boolean;
|
|
809
|
-
/** Omit
|
|
810
|
-
|
|
810
|
+
/** Omit for the default (root span finished). */
|
|
811
|
+
trigger?: SignalTrigger;
|
|
812
|
+
/** Omit for the default (>1000 tokens); `[]` runs on every firing trace. */
|
|
813
|
+
filters?: SignalFilter[];
|
|
814
|
+
/** Defaults to `"realtime"`. */
|
|
815
|
+
mode?: SignalMode;
|
|
811
816
|
}
|
|
812
817
|
/**
|
|
813
818
|
* A partial patch. Every field is optional and an ABSENT field leaves the stored
|
|
814
|
-
* value alone
|
|
815
|
-
* deactivated signal. `sampleRate: null` explicitly clears sampling, and
|
|
816
|
-
* `triggers` replaces the signal's whole trigger set when present.
|
|
819
|
+
* value alone. `sampleRate: null` clears sampling, `filters: []` clears filters.
|
|
817
820
|
*/
|
|
818
821
|
interface UpdateSignalOptions {
|
|
819
822
|
prompt?: string;
|
|
820
823
|
structuredOutput?: SignalStructuredOutput;
|
|
821
824
|
sampleRate?: number | null;
|
|
822
825
|
disabled?: boolean;
|
|
823
|
-
|
|
826
|
+
trigger?: SignalTrigger;
|
|
827
|
+
filters?: SignalFilter[];
|
|
828
|
+
mode?: SignalMode;
|
|
824
829
|
}
|
|
825
830
|
/** Signals CRUD over the CLI user-token surface (`/v1/cli/signals`). */
|
|
826
831
|
declare class SignalsResource extends BaseResource {
|
|
@@ -838,8 +843,8 @@ declare class SignalsResource extends BaseResource {
|
|
|
838
843
|
create(options: CreateSignalOptions): Promise<Signal>;
|
|
839
844
|
/**
|
|
840
845
|
* PATCH, not PUT: only the keys present in `options` are sent, so the server
|
|
841
|
-
* leaves everything else as stored. `
|
|
842
|
-
* serialization (it means "clear"), so
|
|
846
|
+
* leaves everything else as stored. An explicit `null` on `sampleRate` must
|
|
847
|
+
* survive serialization (it means "clear"), so nulls are NOT stripped here.
|
|
843
848
|
*/
|
|
844
849
|
update(signalId: string, options: UpdateSignalOptions): Promise<Signal>;
|
|
845
850
|
/** Deletes the signal, its triggers, its alerts, and its ClickHouse events. */
|
|
@@ -956,6 +961,7 @@ declare class TracesResource extends BaseResource {
|
|
|
956
961
|
declare class LaminarClient {
|
|
957
962
|
private baseUrl;
|
|
958
963
|
private auth;
|
|
964
|
+
private configuredUrl?;
|
|
959
965
|
private _browserEvents;
|
|
960
966
|
private _cli;
|
|
961
967
|
private _datasets;
|
|
@@ -1015,6 +1021,19 @@ declare class LaminarClient {
|
|
|
1015
1021
|
* key surface. Falls back to `LMNR_PROJECT_API_KEY` as a project key.
|
|
1016
1022
|
*/
|
|
1017
1023
|
private static normalizeAuth;
|
|
1024
|
+
/**
|
|
1025
|
+
* The base URL this client was configured with (constructor arg or
|
|
1026
|
+
* `LMNR_BASE_URL`), before port normalization; `undefined` when the client
|
|
1027
|
+
* fell back to the default Laminar Cloud URL. Lets integrations that accept
|
|
1028
|
+
* a pre-constructed client derive companion transports (e.g. a span
|
|
1029
|
+
* exporter) from the same connection settings.
|
|
1030
|
+
*/
|
|
1031
|
+
get configuredBaseUrl(): string | undefined;
|
|
1032
|
+
/**
|
|
1033
|
+
* The project API key this client authenticates with, or `undefined` when
|
|
1034
|
+
* it uses user-token auth.
|
|
1035
|
+
*/
|
|
1036
|
+
get apiKey(): string | undefined;
|
|
1018
1037
|
get browserEvents(): BrowserEventsResource;
|
|
1019
1038
|
get cli(): CliResource;
|
|
1020
1039
|
get datasets(): DatasetsResource;
|
|
@@ -31532,4 +31551,4 @@ declare function evaluate<D, T, O>({
|
|
|
31532
31551
|
}: EvaluationConstructorProps<D, T, O>): Promise<EvaluationRunResult | undefined>;
|
|
31533
31552
|
//#endregion
|
|
31534
31553
|
export { TracingLevel as S, MaskInputOptions as _, HumanEvaluator as a, SpanType as b, InitializeOptions as c, LaminarClient as d, Dataset as f, LaminarSpanContext as g, Event as h, EvaluatorFunctionReturn as i, EvaluationDataset as l, EvaluationDatapointDatasetLink as m, Evaluation as n, evaluate as o, EvaluationDatapoint as p, EvaluatorFunction as r, StringUUID as s, Datapoint as t, LaminarDataset as u, PushDatapointsResponse as v, TraceType as x, SessionRecordingOptions as y };
|
|
31535
|
-
//# sourceMappingURL=evaluations-
|
|
31554
|
+
//# sourceMappingURL=evaluations-CVo0ms_r.d.mts.map
|
|
@@ -172,8 +172,7 @@ interface SessionBlock {
|
|
|
172
172
|
//#region src/signals.d.ts
|
|
173
173
|
/**
|
|
174
174
|
* A signal's payload schema — the structured output the LLM must return. Every
|
|
175
|
-
* field is required
|
|
176
|
-
* field with an `enum` array.
|
|
175
|
+
* field is required; enums are a string field with an `enum` array.
|
|
177
176
|
*/
|
|
178
177
|
interface SignalStructuredOutput {
|
|
179
178
|
type: "object";
|
|
@@ -185,30 +184,29 @@ interface SignalStructuredOutput {
|
|
|
185
184
|
required: string[];
|
|
186
185
|
}
|
|
187
186
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
187
|
+
* WHEN a signal is evaluated, decided from a single span batch. A closed set,
|
|
188
|
+
* not a column list: these are the only two shapes the backend evaluates, so
|
|
189
|
+
* anything else would be stored and then silently never fire.
|
|
190
|
+
*/
|
|
191
|
+
type SignalTrigger = {
|
|
192
|
+
type: "rootSpanFinished";
|
|
193
|
+
} | {
|
|
194
|
+
type: "spanName";
|
|
195
|
+
spanNames: string[];
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* WHETHER a fired signal runs — a property of the whole trace. Columns:
|
|
199
|
+
* `total_token_count`, `status`, `span_names`. An empty list runs on every
|
|
200
|
+
* firing trace. Extra keys are preserved so the shape can grow server-side
|
|
201
|
+
* without an SDK release.
|
|
198
202
|
*/
|
|
199
|
-
interface SignalTrigger {
|
|
200
|
-
id?: string;
|
|
201
|
-
conditions: SignalFilter[];
|
|
202
|
-
filters: SignalFilter[];
|
|
203
|
-
createdAt?: string;
|
|
204
|
-
/** 0 = batch, 1 = realtime */
|
|
205
|
-
mode?: number;
|
|
206
|
-
}
|
|
207
203
|
interface SignalFilter {
|
|
208
204
|
column: string;
|
|
209
205
|
operator: string;
|
|
210
|
-
value:
|
|
206
|
+
value: unknown;
|
|
207
|
+
[key: string]: unknown;
|
|
211
208
|
}
|
|
209
|
+
type SignalMode = "batch" | "realtime";
|
|
212
210
|
interface Signal {
|
|
213
211
|
id: string;
|
|
214
212
|
projectId: string;
|
|
@@ -218,7 +216,9 @@ interface Signal {
|
|
|
218
216
|
sampleRate: number | null;
|
|
219
217
|
disabled: boolean;
|
|
220
218
|
createdAt: string;
|
|
221
|
-
|
|
219
|
+
trigger: SignalTrigger;
|
|
220
|
+
filters: SignalFilter[];
|
|
221
|
+
mode: SignalMode;
|
|
222
222
|
} //#endregion
|
|
223
223
|
//#region src/sql-schema.d.ts
|
|
224
224
|
/**
|
|
@@ -576,7 +576,7 @@ declare class EvalsResource extends BaseResource {
|
|
|
576
576
|
* @param {Object} options - Update datapoint options
|
|
577
577
|
* @param {string} options.evalId - The evaluation ID
|
|
578
578
|
* @param {string} options.datapointId - The datapoint ID
|
|
579
|
-
* @param {Record<string, number>} options.scores - The scores
|
|
579
|
+
* @param {Record<string, number | null>} options.scores - The scores
|
|
580
580
|
* @param {O} [options.executorOutput] - The executor output
|
|
581
581
|
* @returns {Promise<void>}
|
|
582
582
|
*/
|
|
@@ -588,7 +588,7 @@ declare class EvalsResource extends BaseResource {
|
|
|
588
588
|
}: {
|
|
589
589
|
evalId: string;
|
|
590
590
|
datapointId: string;
|
|
591
|
-
scores: Record<string, number>;
|
|
591
|
+
scores: Record<string, number | null>;
|
|
592
592
|
executorOutput?: O;
|
|
593
593
|
}): Promise<void>;
|
|
594
594
|
/**
|
|
@@ -803,23 +803,28 @@ interface CreateSignalOptions {
|
|
|
803
803
|
name: string;
|
|
804
804
|
prompt: string;
|
|
805
805
|
structuredOutput: SignalStructuredOutput;
|
|
806
|
+
/** Omit for no sampling. */
|
|
806
807
|
sampleRate?: number;
|
|
807
808
|
disabled?: boolean;
|
|
808
|
-
/** Omit
|
|
809
|
-
|
|
809
|
+
/** Omit for the default (root span finished). */
|
|
810
|
+
trigger?: SignalTrigger;
|
|
811
|
+
/** Omit for the default (>1000 tokens); `[]` runs on every firing trace. */
|
|
812
|
+
filters?: SignalFilter[];
|
|
813
|
+
/** Defaults to `"realtime"`. */
|
|
814
|
+
mode?: SignalMode;
|
|
810
815
|
}
|
|
811
816
|
/**
|
|
812
817
|
* A partial patch. Every field is optional and an ABSENT field leaves the stored
|
|
813
|
-
* value alone
|
|
814
|
-
* deactivated signal. `sampleRate: null` explicitly clears sampling, and
|
|
815
|
-
* `triggers` replaces the signal's whole trigger set when present.
|
|
818
|
+
* value alone. `sampleRate: null` clears sampling, `filters: []` clears filters.
|
|
816
819
|
*/
|
|
817
820
|
interface UpdateSignalOptions {
|
|
818
821
|
prompt?: string;
|
|
819
822
|
structuredOutput?: SignalStructuredOutput;
|
|
820
823
|
sampleRate?: number | null;
|
|
821
824
|
disabled?: boolean;
|
|
822
|
-
|
|
825
|
+
trigger?: SignalTrigger;
|
|
826
|
+
filters?: SignalFilter[];
|
|
827
|
+
mode?: SignalMode;
|
|
823
828
|
}
|
|
824
829
|
/** Signals CRUD over the CLI user-token surface (`/v1/cli/signals`). */
|
|
825
830
|
declare class SignalsResource extends BaseResource {
|
|
@@ -837,8 +842,8 @@ declare class SignalsResource extends BaseResource {
|
|
|
837
842
|
create(options: CreateSignalOptions): Promise<Signal>;
|
|
838
843
|
/**
|
|
839
844
|
* PATCH, not PUT: only the keys present in `options` are sent, so the server
|
|
840
|
-
* leaves everything else as stored. `
|
|
841
|
-
* serialization (it means "clear"), so
|
|
845
|
+
* leaves everything else as stored. An explicit `null` on `sampleRate` must
|
|
846
|
+
* survive serialization (it means "clear"), so nulls are NOT stripped here.
|
|
842
847
|
*/
|
|
843
848
|
update(signalId: string, options: UpdateSignalOptions): Promise<Signal>;
|
|
844
849
|
/** Deletes the signal, its triggers, its alerts, and its ClickHouse events. */
|
|
@@ -955,6 +960,7 @@ declare class TracesResource extends BaseResource {
|
|
|
955
960
|
declare class LaminarClient {
|
|
956
961
|
private baseUrl;
|
|
957
962
|
private auth;
|
|
963
|
+
private configuredUrl?;
|
|
958
964
|
private _browserEvents;
|
|
959
965
|
private _cli;
|
|
960
966
|
private _datasets;
|
|
@@ -1014,6 +1020,19 @@ declare class LaminarClient {
|
|
|
1014
1020
|
* key surface. Falls back to `LMNR_PROJECT_API_KEY` as a project key.
|
|
1015
1021
|
*/
|
|
1016
1022
|
private static normalizeAuth;
|
|
1023
|
+
/**
|
|
1024
|
+
* The base URL this client was configured with (constructor arg or
|
|
1025
|
+
* `LMNR_BASE_URL`), before port normalization; `undefined` when the client
|
|
1026
|
+
* fell back to the default Laminar Cloud URL. Lets integrations that accept
|
|
1027
|
+
* a pre-constructed client derive companion transports (e.g. a span
|
|
1028
|
+
* exporter) from the same connection settings.
|
|
1029
|
+
*/
|
|
1030
|
+
get configuredBaseUrl(): string | undefined;
|
|
1031
|
+
/**
|
|
1032
|
+
* The project API key this client authenticates with, or `undefined` when
|
|
1033
|
+
* it uses user-token auth.
|
|
1034
|
+
*/
|
|
1035
|
+
get apiKey(): string | undefined;
|
|
1017
1036
|
get browserEvents(): BrowserEventsResource;
|
|
1018
1037
|
get cli(): CliResource;
|
|
1019
1038
|
get datasets(): DatasetsResource;
|
|
@@ -31531,4 +31550,4 @@ declare function evaluate<D, T, O>({
|
|
|
31531
31550
|
}: EvaluationConstructorProps<D, T, O>): Promise<EvaluationRunResult | undefined>;
|
|
31532
31551
|
//#endregion
|
|
31533
31552
|
export { __exportAll as C, TracingLevel as S, MaskInputOptions as _, HumanEvaluator as a, SpanType as b, InitializeOptions as c, LaminarClient as d, Dataset as f, LaminarSpanContext as g, Event as h, EvaluatorFunctionReturn as i, EvaluationDataset as l, EvaluationDatapointDatasetLink as m, Evaluation as n, evaluate as o, EvaluationDatapoint as p, EvaluatorFunction as r, StringUUID as s, Datapoint as t, LaminarDataset as u, PushDatapointsResponse as v, TraceType as x, SessionRecordingOptions as y };
|
|
31534
|
-
//# sourceMappingURL=evaluations-
|
|
31553
|
+
//# sourceMappingURL=evaluations-RbBZb5yl.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-2rV9d50f.mjs";
|
|
2
|
-
import { W as errorMessage, c as initializeLogger } from "./dist-
|
|
2
|
+
import { W as errorMessage, c as initializeLogger } from "./dist-Cjres0a5.mjs";
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import { createReadStream } from "fs";
|
|
5
5
|
import * as fs from "fs/promises";
|
|
@@ -514,4 +514,4 @@ const printToConsole = (data, format = "json") => {
|
|
|
514
514
|
//#endregion
|
|
515
515
|
export { writeToFile as i, loadFromPaths as n, printToConsole as r, file_utils_exports as t };
|
|
516
516
|
|
|
517
|
-
//# sourceMappingURL=file-utils-
|
|
517
|
+
//# sourceMappingURL=file-utils-1olUHMKC.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-utils-Cn3xPQJi.mjs","names":["asString","generateCsv","mkConfig"],"sources":["../../../node_modules/.pnpm/csv-parser@3.2.1/node_modules/csv-parser/index.js","../../../node_modules/.pnpm/export-to-csv@1.4.0/node_modules/export-to-csv/output/index.js","../src/cli/file-utils.ts"],"sourcesContent":["const { Transform } = require('stream')\n\nconst [cr] = Buffer.from('\\r')\nconst [nl] = Buffer.from('\\n')\nconst defaults = {\n escape: '\"',\n headers: null,\n mapHeaders: ({ header }) => header,\n mapValues: ({ value }) => value,\n newline: '\\n',\n quote: '\"',\n raw: false,\n separator: ',',\n skipComments: false,\n skipLines: null,\n maxRowBytes: Number.MAX_SAFE_INTEGER,\n strict: false,\n outputByteOffset: false\n}\n\nconst DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\nfunction sanitizeHeader(header) {\n if (typeof header !== 'string') {\n return null\n }\n\n if (DANGEROUS_KEYS.has(header)) {\n return null\n }\n\n return header\n}\n\nclass CsvParser extends Transform {\n constructor (opts = {}) {\n super({ objectMode: true, highWaterMark: 16 })\n\n if (Array.isArray(opts)) opts = { headers: opts }\n\n const options = Object.assign({}, defaults, opts)\n\n options.customNewline = options.newline !== defaults.newline\n\n for (const key of ['newline', 'quote', 'separator']) {\n if (typeof options[key] !== 'undefined') {\n ([options[key]] = Buffer.from(options[key]))\n }\n }\n\n // if escape is not defined on the passed options, use the end value of quote\n options.escape = (opts || {}).escape ? Buffer.from(options.escape)[0] : options.quote\n\n this.state = {\n empty: options.raw ? Buffer.alloc(0) : '',\n escaped: false,\n first: true,\n lineNumber: 0,\n previousEnd: 0,\n rowLength: 0,\n quoted: false\n }\n\n this._prev = null\n\n if (options.headers === false) {\n // enforce, as the column length check will fail if headers:false\n options.strict = false\n }\n\n if (options.headers || options.headers === false) {\n this.state.first = false\n }\n\n this.options = options\n this.headers = options.headers\n this.bytesRead = 0\n }\n\n parseCell (buffer, start, end) {\n const { escape, quote } = this.options\n // remove quotes from quoted cells\n if (buffer[start] === quote && buffer[end - 1] === quote) {\n start++\n end--\n }\n\n let y = start\n\n for (let i = start; i < end; i++) {\n // check for escape characters and skip them\n if (buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote) {\n i++\n }\n\n if (y !== i) {\n buffer[y] = buffer[i]\n }\n y++\n }\n\n return this.parseValue(buffer, start, y)\n }\n\n parseLine (buffer, start, end) {\n const { customNewline, escape, mapHeaders, mapValues, quote, separator, skipComments, skipLines } = this.options\n\n end-- // trim newline\n if (!customNewline && buffer.length && buffer[end - 1] === cr) {\n end--\n }\n\n const comma = separator\n const cells = []\n let isQuoted = false\n let offset = start\n\n if (skipComments) {\n const char = typeof skipComments === 'string' ? skipComments : '#'\n if (buffer[start] === Buffer.from(char)[0]) {\n return\n }\n }\n\n const mapValue = (value) => {\n if (this.state.first) {\n return value\n }\n\n const index = cells.length\n const header = this.headers[index]\n\n return mapValues({ header, index, value })\n }\n\n for (let i = start; i < end; i++) {\n const isStartingQuote = !isQuoted && buffer[i] === quote\n const isEndingQuote = isQuoted && buffer[i] === quote && i + 1 <= end && buffer[i + 1] === comma\n const isEscape = isQuoted && buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote\n\n if (isStartingQuote || isEndingQuote) {\n isQuoted = !isQuoted\n continue\n } else if (isEscape) {\n i++\n continue\n }\n\n if (buffer[i] === comma && !isQuoted) {\n let value = this.parseCell(buffer, offset, i)\n value = mapValue(value)\n cells.push(value)\n offset = i + 1\n }\n }\n\n if (offset < end) {\n let value = this.parseCell(buffer, offset, end)\n value = mapValue(value)\n cells.push(value)\n }\n\n if (buffer[end - 1] === comma) {\n cells.push(mapValue(this.state.empty))\n }\n\n const skip = skipLines && skipLines > this.state.lineNumber\n this.state.lineNumber++\n\n if (this.state.first && !skip) {\n this.state.first = false\n this.headers = cells.map((header, index) => {\n const mapped = mapHeaders({ header, index })\n\n if (mapped === null) {\n return null\n }\n\n return sanitizeHeader(mapped)\n })\n\n this.emit('headers', this.headers)\n return\n }\n\n if (!skip && this.options.strict && cells.length !== this.headers.length) {\n const e = new RangeError('Row length does not match headers')\n this.emit('error', e)\n } else {\n if (!skip) {\n const byteOffset = this.bytesRead - buffer.length + start\n this.writeRow(cells, byteOffset)\n }\n }\n }\n\n parseValue (buffer, start, end) {\n if (this.options.raw) {\n return buffer.slice(start, end)\n }\n\n return buffer.toString('utf-8', start, end)\n }\n\n writeRow (cells, byteOffset) {\n const headers = (this.headers === false) ? cells.map((value, index) => index) : this.headers\n\n const row = cells.reduce((o, cell, index) => {\n const header = headers[index]\n if (header === null) return o // skip columns\n if (header !== undefined) {\n o[header] = cell\n } else {\n o[`_${index}`] = cell\n }\n return o\n }, {})\n\n if (this.options.outputByteOffset) {\n this.push({ row, byteOffset })\n } else {\n this.push(row)\n }\n }\n\n _flush (cb) {\n if (this.state.escaped || !this._prev) return cb()\n this.parseLine(this._prev, this.state.previousEnd, this._prev.length + 1) // plus since online -1s\n cb()\n }\n\n _transform (data, enc, cb) {\n if (typeof data === 'string') {\n data = Buffer.from(data)\n }\n\n const { escape, quote } = this.options\n let start = 0\n let buffer = data\n this.bytesRead += data.byteLength\n\n if (this._prev) {\n start = this._prev.length\n buffer = Buffer.concat([this._prev, data])\n this._prev = null\n }\n\n const bufferLength = buffer.length\n\n for (let i = start; i < bufferLength; i++) {\n const chr = buffer[i]\n const nextChr = i + 1 < bufferLength ? buffer[i + 1] : null\n\n this.state.rowLength++\n if (this.state.rowLength > this.options.maxRowBytes) {\n return cb(new Error('Row exceeds the maximum size'))\n }\n\n if (!this.state.escaped && chr === escape && nextChr === quote && i !== start) {\n this.state.escaped = true\n continue\n } else if (chr === quote) {\n if (this.state.escaped) {\n this.state.escaped = false\n // non-escaped quote (quoting the cell)\n } else {\n this.state.quoted = !this.state.quoted\n }\n continue\n }\n\n if (!this.state.quoted) {\n if (this.state.first && !this.options.customNewline) {\n if (chr === nl) {\n this.options.newline = nl\n } else if (chr === cr) {\n if (nextChr !== nl) {\n this.options.newline = cr\n }\n }\n }\n\n if (chr === this.options.newline) {\n this.parseLine(buffer, this.state.previousEnd, i + 1)\n this.state.previousEnd = i + 1\n this.state.rowLength = 0\n }\n }\n }\n\n if (this.state.previousEnd === bufferLength) {\n this.state.previousEnd = 0\n return cb()\n }\n\n if (bufferLength - this.state.previousEnd < data.length) {\n this._prev = data\n this.state.previousEnd -= (bufferLength - data.length)\n return cb()\n }\n\n this._prev = buffer\n cb()\n }\n}\n\nmodule.exports = (opts) => new CsvParser(opts)\n","var q;(function(x){x[\"csv\"]=\"text/csv\";x[\"tsv\"]=\"text/tab-separated-values\";x[\"plain\"]=\"text/plain\"})(q||(q={}));var X=(W)=>W,z=(W)=>W,Z=X,_=X,Y=X,N=X,V=X;var h={fieldSeparator:\",\",decimalSeparator:\".\",quoteStrings:!0,quoteCharacter:'\"',showTitle:!1,title:\"My Generated Report\",filename:\"generated\",showColumnHeaders:!0,useTextFile:!1,fileExtension:\"csv\",mediaType:q.csv,useBom:!0,columnHeaders:[],useKeysAsHeaders:!1,boolDisplay:{true:\"TRUE\",false:\"FALSE\"},replaceUndefinedWith:\"\"},F=\"\\r\\n\",R=\"\\uFEFF\",G=(W)=>Object.assign({},h,W);class K extends Error{constructor(W){super(W);this.name=\"CsvGenerationError\"}}class B extends Error{constructor(W){super(W);this.name=\"EmptyHeadersError\"}}class L extends Error{constructor(W){super(W);this.name=\"CsvDownloadEnvironmentError\"}}class P extends Error{constructor(W){super(W);this.name=\"UnsupportedDataFormatError\"}}var s=function(W,$){if($=='\"'&&W.indexOf('\"')>-1)return W.replace(/\"/g,'\"\"');return W},w=(W)=>typeof W===\"object\"?N(W.key):N(W),y=(W)=>typeof W===\"object\"?V(W.displayLabel):V(W),T=(W,...$)=>$.reduce((j,x)=>x(j),W),E=(W)=>($)=>W.useBom?_(z($)+R):$,M=(W)=>($)=>W.showTitle?S(_(z($)+W.title))(Y(\"\")):$,S=(W)=>($)=>_(z(W)+z($)+F),O=(W)=>($,j)=>l(W)(Y(z($)+z(j))),l=(W)=>($)=>X(z($)+W.fieldSeparator),b=(W,$)=>(j)=>{if(!W.showColumnHeaders)return j;if($.length<1)throw new B(\"Option to show headers but none supplied. Make sure there are keys in your collection or that you've supplied headers through the config options.\");let x=Y(\"\");for(let A=0;A<$.length;A++){const J=y($[A]);x=O(W)(x,v(W,z(J)))}return x=Y(z(x).slice(0,-1)),S(j)(x)},C=(W,$,j)=>(x)=>{let A=x;for(var J=0;J<j.length;J++){let I=Y(\"\");for(let U=0;U<$.length;U++){const H=w($[U]),D=j[J][z(H)];I=O(W)(I,v(W,D))}I=Y(z(I).slice(0,-1)),A=S(A)(I)}return A},k=z,m=(W)=>+W===W&&(!isFinite(W)||Boolean(W%1)),p=(W,$)=>{if(m($)){if(W.decimalSeparator===\"locale\")return Z($.toLocaleString());if(W.decimalSeparator)return Z($.toString().replace(\".\",W.decimalSeparator))}return Z($.toString())},Q=(W,$)=>{let j=$;if(W.quoteStrings||W.fieldSeparator&&$.indexOf(W.fieldSeparator)>-1||W.quoteCharacter&&$.indexOf(W.quoteCharacter)>-1||$.indexOf(\"\\n\")>-1||$.indexOf(\"\\r\")>-1)j=W.quoteCharacter+s($,W.quoteCharacter)+W.quoteCharacter;return Z(j)},g=(W,$)=>{const j=$?\"true\":\"false\";return Z(W.boolDisplay[j])},r=(W,$)=>{if(typeof $===\"undefined\"&&W.replaceUndefinedWith!==void 0)return Q(W,W.replaceUndefinedWith+\"\");if($===null)return Q(W,\"null\");return Q(W,\"\")},v=(W,$)=>{if(typeof $===\"number\")return p(W,$);if(typeof $===\"string\")return Q(W,$);if(typeof $===\"boolean\"&&W.boolDisplay)return g(W,$);if($===null||typeof $===\"undefined\")return r(W,$);throw new P(`\n typeof ${typeof $} isn't supported. Only number, string, boolean, null and undefined are supported.\n Please convert the data in your object to one of those before generating the CSV.\n `)};var BW=(W)=>($)=>{const j=G(W),x=j.useKeysAsHeaders?Object.keys($[0]):j.columnHeaders;let A=T(_(\"\"),E(j),M(j),b(j,x),C(j,x,$));if(z(A).length<1)throw new K(\"Output is empty. Is your data formatted correctly?\");return A},f=(W)=>($)=>{const j=G(W),x=z($),A=j.useTextFile?\"text/plain\":j.mediaType;return new Blob([x],{type:`${A};charset=utf8;`})},LW=(W)=>($)=>{if(!window)throw new L(\"Downloading only supported in a browser environment.\");const j=f(W)($),x=G(W),A=x.useTextFile?\"txt\":x.fileExtension,J=`${x.filename}.${A}`,I=document.createElement(\"a\");I.download=J,I.href=URL.createObjectURL(j),I.setAttribute(\"visibility\",\"hidden\"),document.body.appendChild(I),I.click(),document.body.removeChild(I)};export{G as mkConfig,BW as generateCsv,LW as download,k as asString,f as asBlob,q as MediaType};\n","import { errorMessage } from '@lmnr-ai/types';\nimport csv from 'csv-parser';\nimport { asString, generateCsv, mkConfig } from 'export-to-csv';\nimport { createReadStream } from 'fs';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\n\nimport { Datapoint } from '../evaluations';\nimport { initializeLogger } from '../utils';\n\nconst logger = initializeLogger();\n\n/**\n * Check if a file has a supported extension.\n */\nconst isSupportedFile = (file: string): boolean => {\n const ext = path.extname(file).toLowerCase();\n return ['.json', '.csv', '.jsonl'].includes(ext);\n};\n\n/**\n * Collect all supported files from the given paths.\n * Handles both files and directories.\n */\nexport const collectFiles = async (\n paths: string[],\n recursive: boolean = false,\n): Promise<string[]> => {\n const collectedFiles: string[] = [];\n\n for (const filepath of paths) {\n try {\n const stats = await fs.stat(filepath);\n\n if (stats.isFile()) {\n if (isSupportedFile(filepath)) {\n collectedFiles.push(filepath);\n } else {\n logger.warn(`Skipping unsupported file type: ${filepath}`);\n }\n } else if (stats.isDirectory()) {\n const entries = await fs.readdir(filepath);\n\n for (const entry of entries) {\n const fullPath = path.join(filepath, entry);\n const entryStats = await fs.stat(fullPath);\n\n if (entryStats.isFile() && isSupportedFile(fullPath)) {\n collectedFiles.push(fullPath);\n } else if (recursive && entryStats.isDirectory()) {\n const subFiles = await collectFiles([fullPath], true);\n collectedFiles.push(...subFiles);\n }\n }\n }\n } catch (error) {\n logger.warn(\n `Path does not exist or is not accessible: ${filepath}. `\n + `Error: ${errorMessage(error)}`,\n );\n }\n }\n\n return collectedFiles;\n};\n\n/**\n * Read a JSON file and return its contents.\n */\nconst readJsonFile = async (filepath: string): Promise<any[]> => {\n const content = await fs.readFile(filepath, 'utf-8');\n const parsed = JSON.parse(content);\n return Array.isArray(parsed) ? parsed : [parsed];\n};\n\n/**\n * Try to parse a string as JSON. If it fails, return the original string.\n */\nconst tryParseJson = (content: string): any => {\n // Don't try to parse if it's not a string or doesn't look like JSON\n if (typeof content !== 'string') {\n return content;\n }\n\n // If it doesn't start with { or [, it's probably not JSON\n const trimmed = content.trim();\n if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {\n return content;\n }\n\n try {\n return JSON.parse(content);\n } catch (error) {\n logger.debug(\n `Error parsing JSON: ${errorMessage(error)}`,\n );\n return content;\n }\n};\n\n/**\n * Parse each field in a CSV row, attempting to convert JSON strings back to objects.\n */\nconst parseCsvRow = (row: Record<string, string>): any => {\n const parsed: any = {};\n for (const [key, value] of Object.entries(row)) {\n parsed[key] = tryParseJson(value);\n }\n return parsed;\n};\n\n/**\n * Read a CSV file and return its contents as an array of objects.\n */\nconst readCsvFile = async (filepath: string): Promise<any[]> => new Promise((resolve, reject) => {\n const results: any[] = [];\n createReadStream(filepath)\n .pipe(csv())\n .on('data', (data) => results.push(parseCsvRow(data)))\n .on('end', () => resolve(results))\n .on('error', reject);\n});\n\n/**\n * Read a JSONL file and return its contents as an array of objects.\n */\nasync function readJsonlFile(filepath: string): Promise<any[]> {\n const content = await fs.readFile(filepath, 'utf-8');\n const lines = content.split('\\n').filter((line) => line.trim());\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return lines.map((line) => JSON.parse(line));\n}\n\n/**\n * Read a single file and return its contents.\n */\nasync function readFile(filepath: string): Promise<any[]> {\n const ext = path.extname(filepath).toLowerCase();\n\n if (ext === '.json') {\n return readJsonFile(filepath);\n } else if (ext === '.csv') {\n return readCsvFile(filepath);\n } else if (ext === '.jsonl') {\n return readJsonlFile(filepath);\n } else {\n throw new Error(`Unsupported file type: ${ext}`);\n }\n}\n\n/**\n * Load data from all files in the specified paths.\n */\nexport const loadFromPaths = async <D = any, T = any>(\n paths: string[],\n recursive: boolean = false,\n): Promise<Datapoint<D, T>[]> => {\n const files = await collectFiles(paths, recursive);\n\n if (files.length === 0) {\n logger.warn('No supported files found in the specified paths');\n return [];\n }\n\n logger.info(`Found ${files.length} file(s) to read`);\n\n const result: Datapoint<D, T>[] = [];\n\n for (const file of files) {\n try {\n const data = await readFile(file);\n result.push(...data);\n logger.info(`Read ${data.length} record(s) from ${file}`);\n } catch (error) {\n logger.error(\n `Error reading file ${file}: ${errorMessage(error)}`,\n );\n throw error;\n }\n }\n\n return result;\n};\n\n/**\n * Write data to a JSON file.\n */\nconst writeJsonFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const content = JSON.stringify(data, null, 2);\n await fs.writeFile(filepath, content, 'utf-8');\n};\n\n/**\n * Write data to a CSV file.\n */\nconst writeCsvFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n if (data.length === 0) {\n throw new Error('No data to write to CSV');\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n\n await fs.writeFile(filepath, csvString, 'utf-8');\n};\n\n/**\n * Write data to a JSONL file.\n */\nconst writeJsonlFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const lines = data.map((item) => JSON.stringify(item)).join('\\n');\n await fs.writeFile(filepath, lines + '\\n', 'utf-8');\n};\n\n/**\n * Write data to a file based on the file extension.\n */\nexport const writeToFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n format?: 'json' | 'csv' | 'jsonl',\n): Promise<void> => {\n // Create parent directories if they don't exist\n const dir = path.dirname(filepath);\n await fs.mkdir(dir, { recursive: true });\n\n // Determine the format\n const ext = format ?? path.extname(filepath).slice(1);\n\n if (format && format !== path.extname(filepath).slice(1)) {\n logger.warn(\n `Output format ${format} does not match file extension ${path.extname(filepath).slice(1)}`,\n );\n }\n\n if (ext === 'json') {\n await writeJsonFile(filepath, data);\n } else if (ext === 'csv') {\n await writeCsvFile(filepath, data);\n } else if (ext === 'jsonl') {\n await writeJsonlFile(filepath, data);\n } else {\n throw new Error(`Unsupported output format: ${ext}`);\n }\n};\n\n/**\n * Convert a value to a CSV-safe string.\n * - Strings and numbers pass through\n * - null/undefined become empty strings\n * - Objects and arrays are stringified to JSON\n */\nconst stringifyForCsv = (value: any): string => {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n // For objects and arrays, stringify to JSON\n return JSON.stringify(value);\n};\n\n/**\n * Print data to console in the specified format.\n */\nexport const printToConsole = <D, T>(\n data: Datapoint<D, T>[],\n format: 'json' | 'csv' | 'jsonl' = 'json',\n) => {\n if (format === 'json') {\n console.log(JSON.stringify(data, null, 2));\n } else if (format === 'csv') {\n if (data.length === 0) {\n logger.error('No data to print');\n return;\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n console.log(csvString);\n } else if (format === 'jsonl') {\n data.forEach((item) => console.log(JSON.stringify(item)));\n } else {\n throw new Error(\n `Unsupported output format: ${String(format)}. `\n + \"(supported formats: json, csv, jsonl)\",\n );\n }\n};\n\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;CAAA,MAAM,EAAE,cAAA,UAAsB,QAAQ;CAEtC,MAAM,CAAC,MAAM,OAAO,KAAK,IAAI;CAC7B,MAAM,CAAC,MAAM,OAAO,KAAK,IAAI;CAC7B,MAAM,WAAW;EACf,QAAQ;EACR,SAAS;EACT,aAAa,EAAE,aAAa;EAC5B,YAAY,EAAE,YAAY;EAC1B,SAAS;EACT,OAAO;EACP,KAAK;EACL,WAAW;EACX,cAAc;EACd,WAAW;EACX,aAAa,OAAO;EACpB,QAAQ;EACR,kBAAkB;CACpB;CAEA,MAAM,iBAAiB,IAAI,IAAI;EAAC;EAAa;EAAe;CAAW,CAAC;CAExE,SAAS,eAAe,QAAQ;EAC9B,IAAI,OAAO,WAAW,UACpB,OAAO;EAGT,IAAI,eAAe,IAAI,MAAM,GAC3B,OAAO;EAGT,OAAO;CACT;CAEA,IAAM,YAAN,cAAwB,UAAU;EAChC,YAAa,OAAO,CAAC,GAAG;GACtB,MAAM;IAAE,YAAY;IAAM,eAAe;GAAG,CAAC;GAE7C,IAAI,MAAM,QAAQ,IAAI,GAAG,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ChC;CACH,IAAI,WAAW,QACb,QAAQ,IAAI,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;MACpC,IAAI,WAAW,OAAO;EAC3B,IAAI,KAAK,WAAW,GAAG;GACrB,OAAO,MAAM,kBAAkB;GAC/B;EACF;EAEA,MAAM,gBAAgB,KAAK,KAAI,SAC7B,OAAO,YAAY,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,gBAAgB,KAAK,CAAC,CAAC,CAC3F,CAAC;EAKH,MAAM,YAAYF,EADAC,GAFAC,EAAS,EAAE,kBAAkB,KAAK,CAEd,CAAC,CAAC,CAAC,aACN,CAAC;EACpC,QAAQ,IAAI,SAAS;CACvB,OAAO,IAAI,WAAW,SACpB,KAAK,SAAS,SAAS,QAAQ,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC;MAExD,MAAM,IAAI,MACR,8BAA8B,OAAO,MAAM,EAAE,wCAE/C;AAEJ"}
|
|
1
|
+
{"version":3,"file":"file-utils-1olUHMKC.mjs","names":["asString","generateCsv","mkConfig"],"sources":["../../../node_modules/.pnpm/csv-parser@3.2.1/node_modules/csv-parser/index.js","../../../node_modules/.pnpm/export-to-csv@1.4.0/node_modules/export-to-csv/output/index.js","../src/cli/file-utils.ts"],"sourcesContent":["const { Transform } = require('stream')\n\nconst [cr] = Buffer.from('\\r')\nconst [nl] = Buffer.from('\\n')\nconst defaults = {\n escape: '\"',\n headers: null,\n mapHeaders: ({ header }) => header,\n mapValues: ({ value }) => value,\n newline: '\\n',\n quote: '\"',\n raw: false,\n separator: ',',\n skipComments: false,\n skipLines: null,\n maxRowBytes: Number.MAX_SAFE_INTEGER,\n strict: false,\n outputByteOffset: false\n}\n\nconst DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\nfunction sanitizeHeader(header) {\n if (typeof header !== 'string') {\n return null\n }\n\n if (DANGEROUS_KEYS.has(header)) {\n return null\n }\n\n return header\n}\n\nclass CsvParser extends Transform {\n constructor (opts = {}) {\n super({ objectMode: true, highWaterMark: 16 })\n\n if (Array.isArray(opts)) opts = { headers: opts }\n\n const options = Object.assign({}, defaults, opts)\n\n options.customNewline = options.newline !== defaults.newline\n\n for (const key of ['newline', 'quote', 'separator']) {\n if (typeof options[key] !== 'undefined') {\n ([options[key]] = Buffer.from(options[key]))\n }\n }\n\n // if escape is not defined on the passed options, use the end value of quote\n options.escape = (opts || {}).escape ? Buffer.from(options.escape)[0] : options.quote\n\n this.state = {\n empty: options.raw ? Buffer.alloc(0) : '',\n escaped: false,\n first: true,\n lineNumber: 0,\n previousEnd: 0,\n rowLength: 0,\n quoted: false\n }\n\n this._prev = null\n\n if (options.headers === false) {\n // enforce, as the column length check will fail if headers:false\n options.strict = false\n }\n\n if (options.headers || options.headers === false) {\n this.state.first = false\n }\n\n this.options = options\n this.headers = options.headers\n this.bytesRead = 0\n }\n\n parseCell (buffer, start, end) {\n const { escape, quote } = this.options\n // remove quotes from quoted cells\n if (buffer[start] === quote && buffer[end - 1] === quote) {\n start++\n end--\n }\n\n let y = start\n\n for (let i = start; i < end; i++) {\n // check for escape characters and skip them\n if (buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote) {\n i++\n }\n\n if (y !== i) {\n buffer[y] = buffer[i]\n }\n y++\n }\n\n return this.parseValue(buffer, start, y)\n }\n\n parseLine (buffer, start, end) {\n const { customNewline, escape, mapHeaders, mapValues, quote, separator, skipComments, skipLines } = this.options\n\n end-- // trim newline\n if (!customNewline && buffer.length && buffer[end - 1] === cr) {\n end--\n }\n\n const comma = separator\n const cells = []\n let isQuoted = false\n let offset = start\n\n if (skipComments) {\n const char = typeof skipComments === 'string' ? skipComments : '#'\n if (buffer[start] === Buffer.from(char)[0]) {\n return\n }\n }\n\n const mapValue = (value) => {\n if (this.state.first) {\n return value\n }\n\n const index = cells.length\n const header = this.headers[index]\n\n return mapValues({ header, index, value })\n }\n\n for (let i = start; i < end; i++) {\n const isStartingQuote = !isQuoted && buffer[i] === quote\n const isEndingQuote = isQuoted && buffer[i] === quote && i + 1 <= end && buffer[i + 1] === comma\n const isEscape = isQuoted && buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote\n\n if (isStartingQuote || isEndingQuote) {\n isQuoted = !isQuoted\n continue\n } else if (isEscape) {\n i++\n continue\n }\n\n if (buffer[i] === comma && !isQuoted) {\n let value = this.parseCell(buffer, offset, i)\n value = mapValue(value)\n cells.push(value)\n offset = i + 1\n }\n }\n\n if (offset < end) {\n let value = this.parseCell(buffer, offset, end)\n value = mapValue(value)\n cells.push(value)\n }\n\n if (buffer[end - 1] === comma) {\n cells.push(mapValue(this.state.empty))\n }\n\n const skip = skipLines && skipLines > this.state.lineNumber\n this.state.lineNumber++\n\n if (this.state.first && !skip) {\n this.state.first = false\n this.headers = cells.map((header, index) => {\n const mapped = mapHeaders({ header, index })\n\n if (mapped === null) {\n return null\n }\n\n return sanitizeHeader(mapped)\n })\n\n this.emit('headers', this.headers)\n return\n }\n\n if (!skip && this.options.strict && cells.length !== this.headers.length) {\n const e = new RangeError('Row length does not match headers')\n this.emit('error', e)\n } else {\n if (!skip) {\n const byteOffset = this.bytesRead - buffer.length + start\n this.writeRow(cells, byteOffset)\n }\n }\n }\n\n parseValue (buffer, start, end) {\n if (this.options.raw) {\n return buffer.slice(start, end)\n }\n\n return buffer.toString('utf-8', start, end)\n }\n\n writeRow (cells, byteOffset) {\n const headers = (this.headers === false) ? cells.map((value, index) => index) : this.headers\n\n const row = cells.reduce((o, cell, index) => {\n const header = headers[index]\n if (header === null) return o // skip columns\n if (header !== undefined) {\n o[header] = cell\n } else {\n o[`_${index}`] = cell\n }\n return o\n }, {})\n\n if (this.options.outputByteOffset) {\n this.push({ row, byteOffset })\n } else {\n this.push(row)\n }\n }\n\n _flush (cb) {\n if (this.state.escaped || !this._prev) return cb()\n this.parseLine(this._prev, this.state.previousEnd, this._prev.length + 1) // plus since online -1s\n cb()\n }\n\n _transform (data, enc, cb) {\n if (typeof data === 'string') {\n data = Buffer.from(data)\n }\n\n const { escape, quote } = this.options\n let start = 0\n let buffer = data\n this.bytesRead += data.byteLength\n\n if (this._prev) {\n start = this._prev.length\n buffer = Buffer.concat([this._prev, data])\n this._prev = null\n }\n\n const bufferLength = buffer.length\n\n for (let i = start; i < bufferLength; i++) {\n const chr = buffer[i]\n const nextChr = i + 1 < bufferLength ? buffer[i + 1] : null\n\n this.state.rowLength++\n if (this.state.rowLength > this.options.maxRowBytes) {\n return cb(new Error('Row exceeds the maximum size'))\n }\n\n if (!this.state.escaped && chr === escape && nextChr === quote && i !== start) {\n this.state.escaped = true\n continue\n } else if (chr === quote) {\n if (this.state.escaped) {\n this.state.escaped = false\n // non-escaped quote (quoting the cell)\n } else {\n this.state.quoted = !this.state.quoted\n }\n continue\n }\n\n if (!this.state.quoted) {\n if (this.state.first && !this.options.customNewline) {\n if (chr === nl) {\n this.options.newline = nl\n } else if (chr === cr) {\n if (nextChr !== nl) {\n this.options.newline = cr\n }\n }\n }\n\n if (chr === this.options.newline) {\n this.parseLine(buffer, this.state.previousEnd, i + 1)\n this.state.previousEnd = i + 1\n this.state.rowLength = 0\n }\n }\n }\n\n if (this.state.previousEnd === bufferLength) {\n this.state.previousEnd = 0\n return cb()\n }\n\n if (bufferLength - this.state.previousEnd < data.length) {\n this._prev = data\n this.state.previousEnd -= (bufferLength - data.length)\n return cb()\n }\n\n this._prev = buffer\n cb()\n }\n}\n\nmodule.exports = (opts) => new CsvParser(opts)\n","var q;(function(x){x[\"csv\"]=\"text/csv\";x[\"tsv\"]=\"text/tab-separated-values\";x[\"plain\"]=\"text/plain\"})(q||(q={}));var X=(W)=>W,z=(W)=>W,Z=X,_=X,Y=X,N=X,V=X;var h={fieldSeparator:\",\",decimalSeparator:\".\",quoteStrings:!0,quoteCharacter:'\"',showTitle:!1,title:\"My Generated Report\",filename:\"generated\",showColumnHeaders:!0,useTextFile:!1,fileExtension:\"csv\",mediaType:q.csv,useBom:!0,columnHeaders:[],useKeysAsHeaders:!1,boolDisplay:{true:\"TRUE\",false:\"FALSE\"},replaceUndefinedWith:\"\"},F=\"\\r\\n\",R=\"\\uFEFF\",G=(W)=>Object.assign({},h,W);class K extends Error{constructor(W){super(W);this.name=\"CsvGenerationError\"}}class B extends Error{constructor(W){super(W);this.name=\"EmptyHeadersError\"}}class L extends Error{constructor(W){super(W);this.name=\"CsvDownloadEnvironmentError\"}}class P extends Error{constructor(W){super(W);this.name=\"UnsupportedDataFormatError\"}}var s=function(W,$){if($=='\"'&&W.indexOf('\"')>-1)return W.replace(/\"/g,'\"\"');return W},w=(W)=>typeof W===\"object\"?N(W.key):N(W),y=(W)=>typeof W===\"object\"?V(W.displayLabel):V(W),T=(W,...$)=>$.reduce((j,x)=>x(j),W),E=(W)=>($)=>W.useBom?_(z($)+R):$,M=(W)=>($)=>W.showTitle?S(_(z($)+W.title))(Y(\"\")):$,S=(W)=>($)=>_(z(W)+z($)+F),O=(W)=>($,j)=>l(W)(Y(z($)+z(j))),l=(W)=>($)=>X(z($)+W.fieldSeparator),b=(W,$)=>(j)=>{if(!W.showColumnHeaders)return j;if($.length<1)throw new B(\"Option to show headers but none supplied. Make sure there are keys in your collection or that you've supplied headers through the config options.\");let x=Y(\"\");for(let A=0;A<$.length;A++){const J=y($[A]);x=O(W)(x,v(W,z(J)))}return x=Y(z(x).slice(0,-1)),S(j)(x)},C=(W,$,j)=>(x)=>{let A=x;for(var J=0;J<j.length;J++){let I=Y(\"\");for(let U=0;U<$.length;U++){const H=w($[U]),D=j[J][z(H)];I=O(W)(I,v(W,D))}I=Y(z(I).slice(0,-1)),A=S(A)(I)}return A},k=z,m=(W)=>+W===W&&(!isFinite(W)||Boolean(W%1)),p=(W,$)=>{if(m($)){if(W.decimalSeparator===\"locale\")return Z($.toLocaleString());if(W.decimalSeparator)return Z($.toString().replace(\".\",W.decimalSeparator))}return Z($.toString())},Q=(W,$)=>{let j=$;if(W.quoteStrings||W.fieldSeparator&&$.indexOf(W.fieldSeparator)>-1||W.quoteCharacter&&$.indexOf(W.quoteCharacter)>-1||$.indexOf(\"\\n\")>-1||$.indexOf(\"\\r\")>-1)j=W.quoteCharacter+s($,W.quoteCharacter)+W.quoteCharacter;return Z(j)},g=(W,$)=>{const j=$?\"true\":\"false\";return Z(W.boolDisplay[j])},r=(W,$)=>{if(typeof $===\"undefined\"&&W.replaceUndefinedWith!==void 0)return Q(W,W.replaceUndefinedWith+\"\");if($===null)return Q(W,\"null\");return Q(W,\"\")},v=(W,$)=>{if(typeof $===\"number\")return p(W,$);if(typeof $===\"string\")return Q(W,$);if(typeof $===\"boolean\"&&W.boolDisplay)return g(W,$);if($===null||typeof $===\"undefined\")return r(W,$);throw new P(`\n typeof ${typeof $} isn't supported. Only number, string, boolean, null and undefined are supported.\n Please convert the data in your object to one of those before generating the CSV.\n `)};var BW=(W)=>($)=>{const j=G(W),x=j.useKeysAsHeaders?Object.keys($[0]):j.columnHeaders;let A=T(_(\"\"),E(j),M(j),b(j,x),C(j,x,$));if(z(A).length<1)throw new K(\"Output is empty. Is your data formatted correctly?\");return A},f=(W)=>($)=>{const j=G(W),x=z($),A=j.useTextFile?\"text/plain\":j.mediaType;return new Blob([x],{type:`${A};charset=utf8;`})},LW=(W)=>($)=>{if(!window)throw new L(\"Downloading only supported in a browser environment.\");const j=f(W)($),x=G(W),A=x.useTextFile?\"txt\":x.fileExtension,J=`${x.filename}.${A}`,I=document.createElement(\"a\");I.download=J,I.href=URL.createObjectURL(j),I.setAttribute(\"visibility\",\"hidden\"),document.body.appendChild(I),I.click(),document.body.removeChild(I)};export{G as mkConfig,BW as generateCsv,LW as download,k as asString,f as asBlob,q as MediaType};\n","import { errorMessage } from '@lmnr-ai/types';\nimport csv from 'csv-parser';\nimport { asString, generateCsv, mkConfig } from 'export-to-csv';\nimport { createReadStream } from 'fs';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\n\nimport { Datapoint } from '../evaluations';\nimport { initializeLogger } from '../utils';\n\nconst logger = initializeLogger();\n\n/**\n * Check if a file has a supported extension.\n */\nconst isSupportedFile = (file: string): boolean => {\n const ext = path.extname(file).toLowerCase();\n return ['.json', '.csv', '.jsonl'].includes(ext);\n};\n\n/**\n * Collect all supported files from the given paths.\n * Handles both files and directories.\n */\nexport const collectFiles = async (\n paths: string[],\n recursive: boolean = false,\n): Promise<string[]> => {\n const collectedFiles: string[] = [];\n\n for (const filepath of paths) {\n try {\n const stats = await fs.stat(filepath);\n\n if (stats.isFile()) {\n if (isSupportedFile(filepath)) {\n collectedFiles.push(filepath);\n } else {\n logger.warn(`Skipping unsupported file type: ${filepath}`);\n }\n } else if (stats.isDirectory()) {\n const entries = await fs.readdir(filepath);\n\n for (const entry of entries) {\n const fullPath = path.join(filepath, entry);\n const entryStats = await fs.stat(fullPath);\n\n if (entryStats.isFile() && isSupportedFile(fullPath)) {\n collectedFiles.push(fullPath);\n } else if (recursive && entryStats.isDirectory()) {\n const subFiles = await collectFiles([fullPath], true);\n collectedFiles.push(...subFiles);\n }\n }\n }\n } catch (error) {\n logger.warn(\n `Path does not exist or is not accessible: ${filepath}. `\n + `Error: ${errorMessage(error)}`,\n );\n }\n }\n\n return collectedFiles;\n};\n\n/**\n * Read a JSON file and return its contents.\n */\nconst readJsonFile = async (filepath: string): Promise<any[]> => {\n const content = await fs.readFile(filepath, 'utf-8');\n const parsed = JSON.parse(content);\n return Array.isArray(parsed) ? parsed : [parsed];\n};\n\n/**\n * Try to parse a string as JSON. If it fails, return the original string.\n */\nconst tryParseJson = (content: string): any => {\n // Don't try to parse if it's not a string or doesn't look like JSON\n if (typeof content !== 'string') {\n return content;\n }\n\n // If it doesn't start with { or [, it's probably not JSON\n const trimmed = content.trim();\n if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {\n return content;\n }\n\n try {\n return JSON.parse(content);\n } catch (error) {\n logger.debug(\n `Error parsing JSON: ${errorMessage(error)}`,\n );\n return content;\n }\n};\n\n/**\n * Parse each field in a CSV row, attempting to convert JSON strings back to objects.\n */\nconst parseCsvRow = (row: Record<string, string>): any => {\n const parsed: any = {};\n for (const [key, value] of Object.entries(row)) {\n parsed[key] = tryParseJson(value);\n }\n return parsed;\n};\n\n/**\n * Read a CSV file and return its contents as an array of objects.\n */\nconst readCsvFile = async (filepath: string): Promise<any[]> => new Promise((resolve, reject) => {\n const results: any[] = [];\n createReadStream(filepath)\n .pipe(csv())\n .on('data', (data) => results.push(parseCsvRow(data)))\n .on('end', () => resolve(results))\n .on('error', reject);\n});\n\n/**\n * Read a JSONL file and return its contents as an array of objects.\n */\nasync function readJsonlFile(filepath: string): Promise<any[]> {\n const content = await fs.readFile(filepath, 'utf-8');\n const lines = content.split('\\n').filter((line) => line.trim());\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return lines.map((line) => JSON.parse(line));\n}\n\n/**\n * Read a single file and return its contents.\n */\nasync function readFile(filepath: string): Promise<any[]> {\n const ext = path.extname(filepath).toLowerCase();\n\n if (ext === '.json') {\n return readJsonFile(filepath);\n } else if (ext === '.csv') {\n return readCsvFile(filepath);\n } else if (ext === '.jsonl') {\n return readJsonlFile(filepath);\n } else {\n throw new Error(`Unsupported file type: ${ext}`);\n }\n}\n\n/**\n * Load data from all files in the specified paths.\n */\nexport const loadFromPaths = async <D = any, T = any>(\n paths: string[],\n recursive: boolean = false,\n): Promise<Datapoint<D, T>[]> => {\n const files = await collectFiles(paths, recursive);\n\n if (files.length === 0) {\n logger.warn('No supported files found in the specified paths');\n return [];\n }\n\n logger.info(`Found ${files.length} file(s) to read`);\n\n const result: Datapoint<D, T>[] = [];\n\n for (const file of files) {\n try {\n const data = await readFile(file);\n result.push(...data);\n logger.info(`Read ${data.length} record(s) from ${file}`);\n } catch (error) {\n logger.error(\n `Error reading file ${file}: ${errorMessage(error)}`,\n );\n throw error;\n }\n }\n\n return result;\n};\n\n/**\n * Write data to a JSON file.\n */\nconst writeJsonFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const content = JSON.stringify(data, null, 2);\n await fs.writeFile(filepath, content, 'utf-8');\n};\n\n/**\n * Write data to a CSV file.\n */\nconst writeCsvFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n if (data.length === 0) {\n throw new Error('No data to write to CSV');\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n\n await fs.writeFile(filepath, csvString, 'utf-8');\n};\n\n/**\n * Write data to a JSONL file.\n */\nconst writeJsonlFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const lines = data.map((item) => JSON.stringify(item)).join('\\n');\n await fs.writeFile(filepath, lines + '\\n', 'utf-8');\n};\n\n/**\n * Write data to a file based on the file extension.\n */\nexport const writeToFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n format?: 'json' | 'csv' | 'jsonl',\n): Promise<void> => {\n // Create parent directories if they don't exist\n const dir = path.dirname(filepath);\n await fs.mkdir(dir, { recursive: true });\n\n // Determine the format\n const ext = format ?? path.extname(filepath).slice(1);\n\n if (format && format !== path.extname(filepath).slice(1)) {\n logger.warn(\n `Output format ${format} does not match file extension ${path.extname(filepath).slice(1)}`,\n );\n }\n\n if (ext === 'json') {\n await writeJsonFile(filepath, data);\n } else if (ext === 'csv') {\n await writeCsvFile(filepath, data);\n } else if (ext === 'jsonl') {\n await writeJsonlFile(filepath, data);\n } else {\n throw new Error(`Unsupported output format: ${ext}`);\n }\n};\n\n/**\n * Convert a value to a CSV-safe string.\n * - Strings and numbers pass through\n * - null/undefined become empty strings\n * - Objects and arrays are stringified to JSON\n */\nconst stringifyForCsv = (value: any): string => {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n // For objects and arrays, stringify to JSON\n return JSON.stringify(value);\n};\n\n/**\n * Print data to console in the specified format.\n */\nexport const printToConsole = <D, T>(\n data: Datapoint<D, T>[],\n format: 'json' | 'csv' | 'jsonl' = 'json',\n) => {\n if (format === 'json') {\n console.log(JSON.stringify(data, null, 2));\n } else if (format === 'csv') {\n if (data.length === 0) {\n logger.error('No data to print');\n return;\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n console.log(csvString);\n } else if (format === 'jsonl') {\n data.forEach((item) => console.log(JSON.stringify(item)));\n } else {\n throw new Error(\n `Unsupported output format: ${String(format)}. `\n + \"(supported formats: json, csv, jsonl)\",\n );\n }\n};\n\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;CAAA,MAAM,EAAE,cAAA,UAAsB,QAAQ;CAEtC,MAAM,CAAC,MAAM,OAAO,KAAK,IAAI;CAC7B,MAAM,CAAC,MAAM,OAAO,KAAK,IAAI;CAC7B,MAAM,WAAW;EACf,QAAQ;EACR,SAAS;EACT,aAAa,EAAE,aAAa;EAC5B,YAAY,EAAE,YAAY;EAC1B,SAAS;EACT,OAAO;EACP,KAAK;EACL,WAAW;EACX,cAAc;EACd,WAAW;EACX,aAAa,OAAO;EACpB,QAAQ;EACR,kBAAkB;CACpB;CAEA,MAAM,iBAAiB,IAAI,IAAI;EAAC;EAAa;EAAe;CAAW,CAAC;CAExE,SAAS,eAAe,QAAQ;EAC9B,IAAI,OAAO,WAAW,UACpB,OAAO;EAGT,IAAI,eAAe,IAAI,MAAM,GAC3B,OAAO;EAGT,OAAO;CACT;CAEA,IAAM,YAAN,cAAwB,UAAU;EAChC,YAAa,OAAO,CAAC,GAAG;GACtB,MAAM;IAAE,YAAY;IAAM,eAAe;GAAG,CAAC;GAE7C,IAAI,MAAM,QAAQ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MACA,SAAmC,WAChC;CACH,IAAI,WAAW,QACb,QAAQ,IAAI,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;MACpC,IAAI,WAAW,OAAO;EAC3B,IAAI,KAAK,WAAW,GAAG;GACrB,OAAO,MAAM,kBAAkB;GAC/B;EACF;EAEA,MAAM,gBAAgB,KAAK,KAAI,SAC7B,OAAO,YAAY,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,gBAAgB,KAAK,CAAC,CAAC,CAC3F,CAAC;EAKH,MAAM,YAAYF,EADAC,GAFAC,EAAS,EAAE,kBAAkB,KAAK,CAEd,CAAC,CAAC,CAAC,aACN,CAAC;EACpC,QAAQ,IAAI,SAAS;CACvB,OAAO,IAAI,WAAW,SACpB,KAAK,SAAS,SAAS,QAAQ,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC;MAExD,MAAM,IAAI,MACR,8BAA8B,OAAO,MAAM,EAAE,wCAE/C;AAEJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-BtB31bk1.cjs");
|
|
3
3
|
let path = require("path");
|
|
4
4
|
path = require_rolldown_runtime.__toESM(path);
|
|
5
5
|
let fs = require("fs");
|
|
@@ -541,4 +541,4 @@ Object.defineProperty(exports, "writeToFile", {
|
|
|
541
541
|
}
|
|
542
542
|
});
|
|
543
543
|
|
|
544
|
-
//# sourceMappingURL=file-utils-
|
|
544
|
+
//# sourceMappingURL=file-utils-CMO5MuV9.cjs.map
|