@lmnr-ai/lmnr 0.8.27 → 0.8.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-BN4qSVkS.cjs +50 -0
- package/dist/cli.cjs +7 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/consts-Cx9iKRmq.cjs +23 -0
- package/dist/consts-Cx9iKRmq.cjs.map +1 -0
- package/dist/consts-ivIFfgfN.mjs +12 -0
- package/dist/consts-ivIFfgfN.mjs.map +1 -0
- package/dist/{dist-NGq4u898.cjs → dist-CvLra1Dm.cjs} +182 -46
- package/dist/dist-CvLra1Dm.cjs.map +1 -0
- package/dist/{dist-xQn-Qurn.mjs → dist-CvQVYVO4.mjs} +179 -44
- package/dist/dist-CvQVYVO4.mjs.map +1 -0
- package/dist/{evaluations-53vcYI1f.d.cts → evaluations-DLNweSzE.d.cts} +218 -16
- package/dist/{evaluations-DaLDCsj5.d.mts → evaluations-fF1Y_olL.d.mts} +218 -16
- package/dist/{file-utils-g9E9zyDK.mjs → file-utils-CHgYB_Ei.mjs} +2 -2
- package/dist/{file-utils-g9E9zyDK.mjs.map → file-utils-CHgYB_Ei.mjs.map} +1 -1
- package/dist/{file-utils-D_KglJSl.cjs → file-utils-Cysp1Ym1.cjs} +8 -7
- package/dist/{file-utils-D_KglJSl.cjs.map → file-utils-Cysp1Ym1.cjs.map} +1 -1
- package/dist/index.cjs +1751 -815
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +209 -2
- package/dist/index.d.mts +209 -2
- package/dist/index.mjs +1738 -810
- package/dist/index.mjs.map +1 -1
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.cjs +8037 -0
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.cjs.map +1 -0
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.d.cts +113173 -0
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.d.mts +113173 -0
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.mjs +8036 -0
- package/dist/opentelemetry-lib/instrumentation/temporal/workflow-interceptors.mjs.map +1 -0
- package/dist/{utils-ZnY1kHzq.mjs → utils-Bdv7YZH7.mjs} +26 -2
- package/dist/utils-Bdv7YZH7.mjs.map +1 -0
- package/dist/{utils-DyFz8xv4.cjs → utils-C_Pf3r64.cjs} +29 -54
- package/dist/utils-C_Pf3r64.cjs.map +1 -0
- package/package.json +13 -3
- package/dist/dist-NGq4u898.cjs.map +0 -1
- package/dist/dist-xQn-Qurn.mjs.map +0 -1
- package/dist/utils-DyFz8xv4.cjs.map +0 -1
- package/dist/utils-ZnY1kHzq.mjs.map +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __exportAll = (all, no_symbols) => {
|
|
10
|
+
let target = {};
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
20
|
+
key = keys[i];
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
22
|
+
get: ((k) => from[k]).bind(null, key),
|
|
23
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: true
|
|
31
|
+
}) : target, mod));
|
|
32
|
+
//#endregion
|
|
33
|
+
Object.defineProperty(exports, "__commonJSMin", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return __commonJSMin;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "__exportAll", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function() {
|
|
42
|
+
return __exportAll;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "__toESM", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function() {
|
|
48
|
+
return __toESM;
|
|
49
|
+
}
|
|
50
|
+
});
|
package/dist/cli.cjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_chunk = require("./chunk-BN4qSVkS.cjs");
|
|
3
|
+
const require_utils = require("./utils-C_Pf3r64.cjs");
|
|
4
|
+
const require_dist = require("./dist-CvLra1Dm.cjs");
|
|
5
|
+
const require_file_utils = require("./file-utils-Cysp1Ym1.cjs");
|
|
5
6
|
let fs = require("fs");
|
|
6
|
-
fs =
|
|
7
|
+
fs = require_chunk.__toESM(fs);
|
|
7
8
|
let commander = require("commander");
|
|
8
9
|
let esbuild = require("esbuild");
|
|
9
|
-
esbuild =
|
|
10
|
+
esbuild = require_chunk.__toESM(esbuild);
|
|
10
11
|
let glob = require("glob");
|
|
11
|
-
glob =
|
|
12
|
+
glob = require_chunk.__toESM(glob);
|
|
12
13
|
//#region src/cli/datasets.ts
|
|
13
14
|
const logger$2 = require_utils.initializeLogger();
|
|
14
15
|
const DEFAULT_DATASET_PULL_BATCH_SIZE = 100;
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["logger","initializeLogger","LaminarClient","errorMessage","loadFromPaths","writeToFile","logger","initializeLogger","getDirname","initializeLogger","Command","version","errorMessage"],"sources":["../src/cli/datasets.ts","../src/cli/evals.ts","../src/cli/index.ts"],"sourcesContent":["import { LaminarClient } from \"@lmnr-ai/client\";\nimport { errorMessage, type StringUUID } from \"@lmnr-ai/types\";\n\nimport { Datapoint } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport { loadFromPaths, printToConsole, writeToFile } from \"./file-utils\";\n\nconst logger = initializeLogger();\nconst DEFAULT_DATASET_PULL_BATCH_SIZE = 100;\nconst DEFAULT_DATASET_PUSH_BATCH_SIZE = 100;\n\ninterface DatasetCommandOptions {\n projectApiKey?: string;\n baseUrl?: string;\n port?: number;\n}\n\n/**\n * Pull all data from a dataset in batches.\n */\nconst pullAllData = async <D = any, T = any>(\n client: LaminarClient,\n identifier: { name?: string; id?: StringUUID },\n batchSize: number = DEFAULT_DATASET_PULL_BATCH_SIZE,\n offset: number = 0,\n limit?: number,\n): Promise<Datapoint<D, T>[]> => {\n let hasMore = true;\n let currentOffset = offset;\n const stopAt = limit !== undefined ? offset + limit : undefined;\n\n const result: Datapoint<D, T>[] = [];\n\n while (hasMore && (stopAt === undefined || currentOffset < stopAt)) {\n const data = await client.datasets.pull<D, T>({\n ...identifier,\n offset: currentOffset,\n limit: batchSize,\n });\n\n result.push(...data.items);\n\n // Stop if we received no items or fewer items than requested (end of data)\n if (data.items.length === 0 || data.items.length < batchSize) {\n hasMore = false;\n } else if (stopAt !== undefined && currentOffset + batchSize >= stopAt) {\n hasMore = false;\n } else if (data.totalCount !== undefined && currentOffset + batchSize >= data.totalCount) {\n hasMore = false;\n }\n\n currentOffset += batchSize;\n }\n\n if (limit !== undefined) {\n return result.slice(0, limit);\n }\n\n return result;\n};\n\n/**\n * Handle datasets list command.\n */\nexport const handleDatasetsList = async (\n options: DatasetCommandOptions,\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n try {\n const datasets = await client.datasets.listDatasets();\n\n if (datasets.length === 0) {\n console.log(\"No datasets found.\");\n return;\n }\n\n // Print table header\n const idWidth = 36; // UUID length\n const createdAtWidth = 19; // YYYY-MM-DD HH:MM:SS format\n\n console.log(`\\n${'ID'.padEnd(idWidth)} ${'Created At'.padEnd(createdAtWidth)} Name`);\n console.log(`${'-'.repeat(idWidth)} ${'-'.repeat(createdAtWidth)} ${'-'.repeat(20)}`);\n\n // Print each dataset row\n for (const dataset of datasets) {\n const createdAt = new Date(dataset.createdAt);\n const createdAtStr = createdAt.toISOString().replace('T', ' ').substring(0, 19);\n console.log(\n `${dataset.id.padEnd(idWidth)} ${createdAtStr.padEnd(createdAtWidth)} ${dataset.name}`,\n );\n }\n\n console.log(`\\nTotal: ${datasets.length} dataset(s)\\n`);\n } catch (error) {\n logger.error(\n `Failed to list datasets: ${errorMessage(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets push command.\n */\nexport const handleDatasetsPush = async (\n paths: string[],\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n await client.datasets.push({\n points: data,\n ...identifier,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n });\n logger.info(`Pushed ${data.length} data points to dataset ${options.name || options.id}`);\n } catch (error) {\n logger.error(\n `Failed to push dataset: ${errorMessage(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets pull command.\n */\nexport const handleDatasetsPull = async (\n outputPath: string | undefined,\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n batchSize?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n const result = await pullAllData(\n client,\n identifier,\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n options.offset ?? 0,\n options.limit,\n );\n\n if (outputPath) {\n await writeToFile(outputPath, result, options.outputFormat);\n logger.info(`Successfully pulled ${result.length} data points to ${outputPath}`);\n } else {\n printToConsole(result, options.outputFormat ?? 'json');\n }\n } catch (error) {\n logger.error(\n `Failed to pull dataset: ${errorMessage(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets create command.\n */\nexport const handleDatasetsCreate = async (\n name: string,\n paths: string[],\n options: DatasetCommandOptions & {\n outputFile: string;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n // Load data from input files\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n // Push data to create/populate the dataset\n logger.info(`Pushing ${data.length} data points to dataset '${name}'...`);\n\n try {\n await client.datasets.push({\n points: data,\n name,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n createDataset: true,\n });\n logger.info(`Successfully pushed ${data.length} data points to dataset '${name}'`);\n } catch (error) {\n logger.error(\n `Failed to create dataset: ${errorMessage(error)}`,\n );\n return;\n }\n\n // Pull data back from the dataset\n logger.info(`Pulling data from dataset '${name}'...`);\n\n try {\n const result = await pullAllData(\n client,\n { name },\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n 0,\n undefined,\n );\n\n // Save to output file\n await writeToFile(options.outputFile, result, options.outputFormat);\n\n logger.info(\n `Successfully created dataset '${name}' `\n + `and saved ${result.length} datapoints to ${options.outputFile}`,\n );\n } catch (error) {\n logger.error(\n \"Failed to pull dataset after creation: \" + errorMessage(error),\n );\n }\n};\n\n","import * as esbuild from \"esbuild\";\nimport * as fs from \"fs\";\nimport * as glob from \"glob\";\n\nimport { Evaluation } from \"../evaluations\";\nimport { getDirname, initializeLogger } from \"../utils\";\n\nconst logger = initializeLogger();\n\n// esbuild plugin to skip dynamic imports\nconst createSkipDynamicImportsPlugin = (skipModules: string[]): esbuild.Plugin => ({\n name: 'skip-dynamic-imports',\n setup(build) {\n if (!skipModules || skipModules.length === 0) return;\n\n build.onResolve({ filter: /.*/ }, (args) => {\n // Only handle dynamic imports\n if (args.kind === 'dynamic-import' && skipModules.includes(args.path)) {\n logger.warn(`Skipping dynamic import: ${args.path}`);\n // Return a virtual module that exports an empty object\n return {\n path: args.path,\n namespace: 'lmnr-skip-dynamic-import',\n };\n }\n });\n\n // Provide empty module content for skipped dynamic imports\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n build.onLoad({ filter: /.*/, namespace: 'lmnr-skip-dynamic-import' }, (args) => ({\n contents: 'export default {};',\n loader: 'js',\n }));\n },\n});\n\nfunction loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}): Evaluation<any, any, any>[] {\n globalThis._evaluations = [];\n globalThis._set_global_evaluation = true;\n\n const __filename = filename;\n const __dirname = getDirname();\n\n // add some arguments for proper cjs/esm interop\n\n /* eslint-disable @typescript-eslint/no-implied-eval */\n new Function(\n \"require\",\n \"module\",\n \"__filename\",\n \"__dirname\",\n moduleText,\n )(\n require,\n module,\n __filename,\n __dirname,\n );\n /* eslint-enable @typescript-eslint/no-implied-eval */\n\n // Return the modified _evals global variable\n return globalThis._evaluations;\n}\n\nexport interface EvalCommandOptions {\n failOnError?: boolean;\n outputFile?: string;\n externalPackages?: string[];\n dynamicImportsToSkip?: string[];\n frontendPort?: number;\n}\n\nexport async function runEvaluation(\n files: string[],\n options: EvalCommandOptions,\n): Promise<void> {\n let evalFiles: string[];\n if (files && files.length > 0) {\n evalFiles = files.flatMap((file: string) => glob.sync(file));\n } else {\n // No files provided, use default pattern\n evalFiles = glob.sync('evals/**/*.eval.{ts,js}');\n }\n\n evalFiles.sort();\n\n if (evalFiles.length === 0) {\n logger.error(\"No evaluation files found. Please provide a file or \" +\n \"ensure there are eval files that are named like `*.eval.{ts,js}` in \" +\n \"the `evals` directory or its subdirectories.\");\n process.exit(1);\n }\n\n if (files.length === 0) {\n logger.info(`Located ${evalFiles.length} evaluation files in evals/`);\n } else {\n logger.info(`Running ${evalFiles.length} evaluation files.`);\n }\n\n const scores: {\n file: string,\n scores: Record<string, number>,\n url: string,\n evaluationId: string,\n }[] = [];\n\n for (const file of evalFiles) {\n logger.info(`Loading ${file}...`);\n const buildOptions = {\n bundle: true,\n platform: \"node\" as esbuild.Platform,\n entryPoints: [file],\n outfile: `tmp_out_${file}.js`,\n write: false, // will be loaded in memory as a temp file\n external: [\n \"@lmnr-ai/lmnr\",\n \"@lmnr-ai/lmnr/*\",\n \"@lmnr-ai/client\",\n \"@lmnr-ai/types\",\n \"esbuild\",\n \"fsevents\",\n \"playwright\",\n \"puppeteer\",\n \"puppeteer-core\",\n \"playwright-core\",\n ...(options.externalPackages ? options.externalPackages : []),\n ],\n plugins: [\n createSkipDynamicImportsPlugin(options.dynamicImportsToSkip || []),\n ],\n treeShaking: true,\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n logger.error(\"Error when building: No output files found \" +\n \"it is likely that all eval files are not valid TypeScript or JavaScript files.\");\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluations = loadModule({\n filename: file,\n moduleText: outputFileText,\n });\n\n logger.info(`Loaded ${evaluations.length} evaluations from ${file}`);\n\n for (const evaluation of evaluations) {\n if (!evaluation?.run) {\n logger.error(`Evaluation ${file} does not properly call evaluate()`);\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n if (options.frontendPort) {\n evaluation.setFrontendPort(options.frontendPort);\n }\n const evalResult = await evaluation.run();\n scores.push({\n file,\n scores: evalResult?.averageScores ?? {},\n url: evalResult?.url ?? '',\n evaluationId: evalResult?.evaluationId ?? '',\n });\n }\n }\n\n if (options.outputFile) {\n fs.writeFileSync(options.outputFile, JSON.stringify(scores, null, 2));\n }\n}\n\n","#!/usr/bin/env node\n\nimport { errorMessage } from \"@lmnr-ai/types\";\nimport { Command } from \"commander\";\n\nimport { version } from \"../../package.json\";\nimport { Evaluation } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport {\n handleDatasetsCreate,\n handleDatasetsList,\n handleDatasetsPull,\n handleDatasetsPush,\n} from \"./datasets\";\nimport { runEvaluation } from \"./evals\";\n\nconst logger = initializeLogger();\n\ndeclare global {\n var _evaluations: Evaluation<any, any, any>[] | undefined;\n var _set_global_evaluation: boolean;\n}\n\nasync function cli() {\n const program = new Command();\n\n program\n .name(\"lmnr\")\n .description(\"CLI for Laminar. Use `lmnr <subcommand> --help` for more information.\")\n .version(version, \"-v, --version\", \"display version number\");\n\n // Eval command\n program\n .command(\"eval\")\n .description(\"Run an evaluation\")\n .argument(\n \"[files...]\",\n \"A file or files containing the evaluation to run. If no file is provided, \" +\n \"the evaluation will run all `*.eval.ts|js` files in the `evals` directory. \" +\n \"If multiple files are provided, the evaluation will run each file in order.\",\n )\n .option(\n \"--fail-on-error\",\n \"Fail on error. If specified, will fail if encounters a file that cannot be run\",\n )\n .option(\n \"--output-file <file>\",\n \"Output file to write the results to. Outputs are written in JSON format.\",\n )\n .option(\n \"--external-packages <packages...>\",\n \"[ADVANCED] List of packages to pass as external to esbuild. This will not link \" +\n \"the packages directly into the eval file, but will instead require them at runtime. \" +\n \"Read more: https://esbuild.github.io/api/#external\",\n )\n .option(\n \"--dynamic-imports-to-skip <modules...>\",\n \"[ADVANCED] List of module names to skip when encountered as dynamic imports. \" +\n \"These dynamic imports will resolve to an empty module to prevent build failures. \" +\n \"This is meant to skip the imports that are not used in the evaluation itself.\",\n )\n .option(\n \"--frontend-port <port>\",\n \"Port for the Laminar frontend. Defaults to 5667\",\n (val) => parseInt(val, 10),\n )\n .action(async (files: string[], options) => {\n await runEvaluation(files, options);\n });\n\n const deprecatedDatasetsWarning =\n \"DeprecationWarning: `lmnr datasets` is deprecated and will be removed in a future version. \" +\n \"Use `lmnr-cli dataset` instead.\";\n\n // Datasets command with global options\n const datasetCmd = program\n .command(\"datasets\")\n .description(\"[DEPRECATED] Manage datasets. Use `lmnr-cli dataset` instead.\")\n .option(\n \"--project-api-key <key>\",\n \"Project API key. If not provided, reads from LMNR_PROJECT_API_KEY env variable\",\n )\n .option(\n \"--base-url <url>\",\n \"Base URL for the Laminar API. Defaults to https://api.lmnr.ai or LMNR_BASE_URL env variable\",\n )\n .option(\n \"--port <port>\",\n \"Port for the Laminar API. Defaults to 443\",\n (val) => parseInt(val, 10),\n );\n\n // Datasets list command\n datasetCmd\n .command(\"list\")\n .description(\"List all datasets\")\n .action(async (options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsList({ ...parentOpts, ...options });\n });\n\n // Datasets push command\n datasetCmd\n .command(\"push\")\n .description(\"Push datapoints to an existing dataset\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (paths: string[], options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPush(paths, { ...parentOpts, ...options });\n });\n\n // Datasets pull command\n datasetCmd\n .command(\"pull\")\n .description(\"Pull data from a dataset\")\n .argument(\"[output-path]\", \"Path to save the data. If not provided, prints to console\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\n \"--batch-size <size>\",\n \"Batch size for pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .option(\"--limit <limit>\", \"Limit number of datapoints to pull\", (val) => parseInt(val, 10))\n .option(\"--offset <offset>\", \"Offset for pagination\", (val) => parseInt(val, 10), 0)\n .action(async (outputPath: string | undefined, options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPull(outputPath, { ...parentOpts, ...options });\n });\n\n // Datasets create command\n datasetCmd\n .command(\"create\")\n .description(\"Create a dataset from input files\")\n .argument(\"<name>\", \"Name of the dataset to create\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .requiredOption(\"-o, --output-file <file>\", \"Path to save the pulled data\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing/pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (name: string, paths: string[], options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsCreate(name, paths, { ...parentOpts, ...options });\n });\n\n // If no command provided, show help\n if (!process.argv.slice(2).length) {\n program.help();\n return;\n }\n\n await program.parseAsync();\n}\n\ncli().catch((err) => {\n logger.error(errorMessage(err));\n throw err;\n});\n\n"],"mappings":";;;;;;;;;;;;AAOA,MAAMA,WAASC,cAAAA,kBAAkB;AACjC,MAAM,kCAAkC;AACxC,MAAM,kCAAkC;;;;AAWxC,MAAM,cAAc,OAClB,QACA,YACA,YAAoB,iCACpB,SAAiB,GACjB,UAC+B;CAC/B,IAAI,UAAU;CACd,IAAI,gBAAgB;CACpB,MAAM,SAAS,UAAU,KAAA,IAAY,SAAS,QAAQ,KAAA;CAEtD,MAAM,SAA4B,EAAE;CAEpC,OAAO,YAAY,WAAW,KAAA,KAAa,gBAAgB,SAAS;EAClE,MAAM,OAAO,MAAM,OAAO,SAAS,KAAW;GAC5C,GAAG;GACH,QAAQ;GACR,OAAO;GACR,CAAC;EAEF,OAAO,KAAK,GAAG,KAAK,MAAM;EAG1B,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,MAAM,SAAS,WACjD,UAAU;OACL,IAAI,WAAW,KAAA,KAAa,gBAAgB,aAAa,QAC9D,UAAU;OACL,IAAI,KAAK,eAAe,KAAA,KAAa,gBAAgB,aAAa,KAAK,YAC5E,UAAU;EAGZ,iBAAiB;;CAGnB,IAAI,UAAU,KAAA,GACZ,OAAO,OAAO,MAAM,GAAG,MAAM;CAG/B,OAAO;;;;;AAMT,MA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,wCACC,QAAQ,SAAS,KAAK,GAAG,EAC1B,IACD,CACA,OAAO,OAAO,MAAc,OAAiB,SAAS,QAAQ;EAC7D,QAAQ,OAAO,MAAM,4BAA4B,KAAK;EAEtD,MAAM,qBAAqB,MAAM,OAAO;GAAE,GADvB,IAAI,QAAQ,MAAM,IAAI,EAAE;GACc,GAAG;GAAS,CAAC;GACtE;CAGJ,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC,QAAQ;EACjC,QAAQ,MAAM;EACd;;CAGF,MAAM,QAAQ,YAAY;;AAG5B,KAAK,CAAC,OAAO,QAAQ;CACnB,OAAO,MAAMC,cAAAA,aAAa,IAAI,CAAC;CAC/B,MAAM;EACN"}
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["logger","initializeLogger","LaminarClient","errorMessage","loadFromPaths","writeToFile","logger","initializeLogger","getDirname","initializeLogger","Command","version","errorMessage"],"sources":["../src/cli/datasets.ts","../src/cli/evals.ts","../src/cli/index.ts"],"sourcesContent":["import { LaminarClient } from \"@lmnr-ai/client\";\nimport { errorMessage, type StringUUID } from \"@lmnr-ai/types\";\n\nimport { Datapoint } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport { loadFromPaths, printToConsole, writeToFile } from \"./file-utils\";\n\nconst logger = initializeLogger();\nconst DEFAULT_DATASET_PULL_BATCH_SIZE = 100;\nconst DEFAULT_DATASET_PUSH_BATCH_SIZE = 100;\n\ninterface DatasetCommandOptions {\n projectApiKey?: string;\n baseUrl?: string;\n port?: number;\n}\n\n/**\n * Pull all data from a dataset in batches.\n */\nconst pullAllData = async <D = any, T = any>(\n client: LaminarClient,\n identifier: { name?: string; id?: StringUUID },\n batchSize: number = DEFAULT_DATASET_PULL_BATCH_SIZE,\n offset: number = 0,\n limit?: number,\n): Promise<Datapoint<D, T>[]> => {\n let hasMore = true;\n let currentOffset = offset;\n const stopAt = limit !== undefined ? offset + limit : undefined;\n\n const result: Datapoint<D, T>[] = [];\n\n while (hasMore && (stopAt === undefined || currentOffset < stopAt)) {\n const data = await client.datasets.pull<D, T>({\n ...identifier,\n offset: currentOffset,\n limit: batchSize,\n });\n\n result.push(...data.items);\n\n // Stop if we received no items or fewer items than requested (end of data)\n if (data.items.length === 0 || data.items.length < batchSize) {\n hasMore = false;\n } else if (stopAt !== undefined && currentOffset + batchSize >= stopAt) {\n hasMore = false;\n } else if (data.totalCount !== undefined && currentOffset + batchSize >= data.totalCount) {\n hasMore = false;\n }\n\n currentOffset += batchSize;\n }\n\n if (limit !== undefined) {\n return result.slice(0, limit);\n }\n\n return result;\n};\n\n/**\n * Handle datasets list command.\n */\nexport const handleDatasetsList = async (\n options: DatasetCommandOptions,\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n try {\n const datasets = await client.datasets.listDatasets();\n\n if (datasets.length === 0) {\n console.log(\"No datasets found.\");\n return;\n }\n\n // Print table header\n const idWidth = 36; // UUID length\n const createdAtWidth = 19; // YYYY-MM-DD HH:MM:SS format\n\n console.log(`\\n${'ID'.padEnd(idWidth)} ${'Created At'.padEnd(createdAtWidth)} Name`);\n console.log(`${'-'.repeat(idWidth)} ${'-'.repeat(createdAtWidth)} ${'-'.repeat(20)}`);\n\n // Print each dataset row\n for (const dataset of datasets) {\n const createdAt = new Date(dataset.createdAt);\n const createdAtStr = createdAt.toISOString().replace('T', ' ').substring(0, 19);\n console.log(\n `${dataset.id.padEnd(idWidth)} ${createdAtStr.padEnd(createdAtWidth)} ${dataset.name}`,\n );\n }\n\n console.log(`\\nTotal: ${datasets.length} dataset(s)\\n`);\n } catch (error) {\n logger.error(\n `Failed to list datasets: ${errorMessage(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets push command.\n */\nexport const handleDatasetsPush = async (\n paths: string[],\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n await client.datasets.push({\n points: data,\n ...identifier,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n });\n logger.info(`Pushed ${data.length} data points to dataset ${options.name || options.id}`);\n } catch (error) {\n logger.error(\n `Failed to push dataset: ${errorMessage(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets pull command.\n */\nexport const handleDatasetsPull = async (\n outputPath: string | undefined,\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n batchSize?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n const result = await pullAllData(\n client,\n identifier,\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n options.offset ?? 0,\n options.limit,\n );\n\n if (outputPath) {\n await writeToFile(outputPath, result, options.outputFormat);\n logger.info(`Successfully pulled ${result.length} data points to ${outputPath}`);\n } else {\n printToConsole(result, options.outputFormat ?? 'json');\n }\n } catch (error) {\n logger.error(\n `Failed to pull dataset: ${errorMessage(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets create command.\n */\nexport const handleDatasetsCreate = async (\n name: string,\n paths: string[],\n options: DatasetCommandOptions & {\n outputFile: string;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n // Load data from input files\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n // Push data to create/populate the dataset\n logger.info(`Pushing ${data.length} data points to dataset '${name}'...`);\n\n try {\n await client.datasets.push({\n points: data,\n name,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n createDataset: true,\n });\n logger.info(`Successfully pushed ${data.length} data points to dataset '${name}'`);\n } catch (error) {\n logger.error(\n `Failed to create dataset: ${errorMessage(error)}`,\n );\n return;\n }\n\n // Pull data back from the dataset\n logger.info(`Pulling data from dataset '${name}'...`);\n\n try {\n const result = await pullAllData(\n client,\n { name },\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n 0,\n undefined,\n );\n\n // Save to output file\n await writeToFile(options.outputFile, result, options.outputFormat);\n\n logger.info(\n `Successfully created dataset '${name}' `\n + `and saved ${result.length} datapoints to ${options.outputFile}`,\n );\n } catch (error) {\n logger.error(\n \"Failed to pull dataset after creation: \" + errorMessage(error),\n );\n }\n};\n\n","import * as esbuild from \"esbuild\";\nimport * as fs from \"fs\";\nimport * as glob from \"glob\";\n\nimport { Evaluation } from \"../evaluations\";\nimport { getDirname, initializeLogger } from \"../utils\";\n\nconst logger = initializeLogger();\n\n// esbuild plugin to skip dynamic imports\nconst createSkipDynamicImportsPlugin = (skipModules: string[]): esbuild.Plugin => ({\n name: 'skip-dynamic-imports',\n setup(build) {\n if (!skipModules || skipModules.length === 0) return;\n\n build.onResolve({ filter: /.*/ }, (args) => {\n // Only handle dynamic imports\n if (args.kind === 'dynamic-import' && skipModules.includes(args.path)) {\n logger.warn(`Skipping dynamic import: ${args.path}`);\n // Return a virtual module that exports an empty object\n return {\n path: args.path,\n namespace: 'lmnr-skip-dynamic-import',\n };\n }\n });\n\n // Provide empty module content for skipped dynamic imports\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n build.onLoad({ filter: /.*/, namespace: 'lmnr-skip-dynamic-import' }, (args) => ({\n contents: 'export default {};',\n loader: 'js',\n }));\n },\n});\n\nfunction loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}): Evaluation<any, any, any>[] {\n globalThis._evaluations = [];\n globalThis._set_global_evaluation = true;\n\n const __filename = filename;\n const __dirname = getDirname();\n\n // add some arguments for proper cjs/esm interop\n\n /* eslint-disable @typescript-eslint/no-implied-eval */\n new Function(\n \"require\",\n \"module\",\n \"__filename\",\n \"__dirname\",\n moduleText,\n )(\n require,\n module,\n __filename,\n __dirname,\n );\n /* eslint-enable @typescript-eslint/no-implied-eval */\n\n // Return the modified _evals global variable\n return globalThis._evaluations;\n}\n\nexport interface EvalCommandOptions {\n failOnError?: boolean;\n outputFile?: string;\n externalPackages?: string[];\n dynamicImportsToSkip?: string[];\n frontendPort?: number;\n}\n\nexport async function runEvaluation(\n files: string[],\n options: EvalCommandOptions,\n): Promise<void> {\n let evalFiles: string[];\n if (files && files.length > 0) {\n evalFiles = files.flatMap((file: string) => glob.sync(file));\n } else {\n // No files provided, use default pattern\n evalFiles = glob.sync('evals/**/*.eval.{ts,js}');\n }\n\n evalFiles.sort();\n\n if (evalFiles.length === 0) {\n logger.error(\"No evaluation files found. Please provide a file or \" +\n \"ensure there are eval files that are named like `*.eval.{ts,js}` in \" +\n \"the `evals` directory or its subdirectories.\");\n process.exit(1);\n }\n\n if (files.length === 0) {\n logger.info(`Located ${evalFiles.length} evaluation files in evals/`);\n } else {\n logger.info(`Running ${evalFiles.length} evaluation files.`);\n }\n\n const scores: {\n file: string,\n scores: Record<string, number>,\n url: string,\n evaluationId: string,\n }[] = [];\n\n for (const file of evalFiles) {\n logger.info(`Loading ${file}...`);\n const buildOptions = {\n bundle: true,\n platform: \"node\" as esbuild.Platform,\n entryPoints: [file],\n outfile: `tmp_out_${file}.js`,\n write: false, // will be loaded in memory as a temp file\n external: [\n \"@lmnr-ai/lmnr\",\n \"@lmnr-ai/lmnr/*\",\n \"@lmnr-ai/client\",\n \"@lmnr-ai/types\",\n \"esbuild\",\n \"fsevents\",\n \"playwright\",\n \"puppeteer\",\n \"puppeteer-core\",\n \"playwright-core\",\n ...(options.externalPackages ? options.externalPackages : []),\n ],\n plugins: [\n createSkipDynamicImportsPlugin(options.dynamicImportsToSkip || []),\n ],\n treeShaking: true,\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n logger.error(\"Error when building: No output files found \" +\n \"it is likely that all eval files are not valid TypeScript or JavaScript files.\");\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluations = loadModule({\n filename: file,\n moduleText: outputFileText,\n });\n\n logger.info(`Loaded ${evaluations.length} evaluations from ${file}`);\n\n for (const evaluation of evaluations) {\n if (!evaluation?.run) {\n logger.error(`Evaluation ${file} does not properly call evaluate()`);\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n if (options.frontendPort) {\n evaluation.setFrontendPort(options.frontendPort);\n }\n const evalResult = await evaluation.run();\n scores.push({\n file,\n scores: evalResult?.averageScores ?? {},\n url: evalResult?.url ?? '',\n evaluationId: evalResult?.evaluationId ?? '',\n });\n }\n }\n\n if (options.outputFile) {\n fs.writeFileSync(options.outputFile, JSON.stringify(scores, null, 2));\n }\n}\n\n","#!/usr/bin/env node\n\nimport { errorMessage } from \"@lmnr-ai/types\";\nimport { Command } from \"commander\";\n\nimport { version } from \"../../package.json\";\nimport { Evaluation } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport {\n handleDatasetsCreate,\n handleDatasetsList,\n handleDatasetsPull,\n handleDatasetsPush,\n} from \"./datasets\";\nimport { runEvaluation } from \"./evals\";\n\nconst logger = initializeLogger();\n\ndeclare global {\n var _evaluations: Evaluation<any, any, any>[] | undefined;\n var _set_global_evaluation: boolean;\n}\n\nasync function cli() {\n const program = new Command();\n\n program\n .name(\"lmnr\")\n .description(\"CLI for Laminar. Use `lmnr <subcommand> --help` for more information.\")\n .version(version, \"-v, --version\", \"display version number\");\n\n // Eval command\n program\n .command(\"eval\")\n .description(\"Run an evaluation\")\n .argument(\n \"[files...]\",\n \"A file or files containing the evaluation to run. If no file is provided, \" +\n \"the evaluation will run all `*.eval.ts|js` files in the `evals` directory. \" +\n \"If multiple files are provided, the evaluation will run each file in order.\",\n )\n .option(\n \"--fail-on-error\",\n \"Fail on error. If specified, will fail if encounters a file that cannot be run\",\n )\n .option(\n \"--output-file <file>\",\n \"Output file to write the results to. Outputs are written in JSON format.\",\n )\n .option(\n \"--external-packages <packages...>\",\n \"[ADVANCED] List of packages to pass as external to esbuild. This will not link \" +\n \"the packages directly into the eval file, but will instead require them at runtime. \" +\n \"Read more: https://esbuild.github.io/api/#external\",\n )\n .option(\n \"--dynamic-imports-to-skip <modules...>\",\n \"[ADVANCED] List of module names to skip when encountered as dynamic imports. \" +\n \"These dynamic imports will resolve to an empty module to prevent build failures. \" +\n \"This is meant to skip the imports that are not used in the evaluation itself.\",\n )\n .option(\n \"--frontend-port <port>\",\n \"Port for the Laminar frontend. Defaults to 5667\",\n (val) => parseInt(val, 10),\n )\n .action(async (files: string[], options) => {\n await runEvaluation(files, options);\n });\n\n const deprecatedDatasetsWarning =\n \"DeprecationWarning: `lmnr datasets` is deprecated and will be removed in a future version. \" +\n \"Use `lmnr-cli dataset` instead.\";\n\n // Datasets command with global options\n const datasetCmd = program\n .command(\"datasets\")\n .description(\"[DEPRECATED] Manage datasets. Use `lmnr-cli dataset` instead.\")\n .option(\n \"--project-api-key <key>\",\n \"Project API key. If not provided, reads from LMNR_PROJECT_API_KEY env variable\",\n )\n .option(\n \"--base-url <url>\",\n \"Base URL for the Laminar API. Defaults to https://api.lmnr.ai or LMNR_BASE_URL env variable\",\n )\n .option(\n \"--port <port>\",\n \"Port for the Laminar API. Defaults to 443\",\n (val) => parseInt(val, 10),\n );\n\n // Datasets list command\n datasetCmd\n .command(\"list\")\n .description(\"List all datasets\")\n .action(async (options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsList({ ...parentOpts, ...options });\n });\n\n // Datasets push command\n datasetCmd\n .command(\"push\")\n .description(\"Push datapoints to an existing dataset\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (paths: string[], options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPush(paths, { ...parentOpts, ...options });\n });\n\n // Datasets pull command\n datasetCmd\n .command(\"pull\")\n .description(\"Pull data from a dataset\")\n .argument(\"[output-path]\", \"Path to save the data. If not provided, prints to console\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\n \"--batch-size <size>\",\n \"Batch size for pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .option(\"--limit <limit>\", \"Limit number of datapoints to pull\", (val) => parseInt(val, 10))\n .option(\"--offset <offset>\", \"Offset for pagination\", (val) => parseInt(val, 10), 0)\n .action(async (outputPath: string | undefined, options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPull(outputPath, { ...parentOpts, ...options });\n });\n\n // Datasets create command\n datasetCmd\n .command(\"create\")\n .description(\"Create a dataset from input files\")\n .argument(\"<name>\", \"Name of the dataset to create\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .requiredOption(\"-o, --output-file <file>\", \"Path to save the pulled data\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing/pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (name: string, paths: string[], options, cmd) => {\n process.stderr.write(deprecatedDatasetsWarning + \"\\n\");\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsCreate(name, paths, { ...parentOpts, ...options });\n });\n\n // If no command provided, show help\n if (!process.argv.slice(2).length) {\n program.help();\n return;\n }\n\n await program.parseAsync();\n}\n\ncli().catch((err) => {\n logger.error(errorMessage(err));\n throw err;\n});\n\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAMA,WAASC,cAAAA,kBAAkB;AACjC,MAAM,kCAAkC;AACxC,MAAM,kCAAkC;;;;AAWxC,MAAM,cAAc,OAClB,QACA,YACA,YAAoB,iCACpB,SAAiB,GACjB,UAC+B;CAC/B,IAAI,UAAU;CACd,IAAI,gBAAgB;CACpB,MAAM,SAAS,UAAU,KAAA,IAAY,SAAS,QAAQ,KAAA;CAEtD,MAAM,SAA4B,EAAE;CAEpC,OAAO,YAAY,WAAW,KAAA,KAAa,gBAAgB,SAAS;EAClE,MAAM,OAAO,MAAM,OAAO,SAAS,KAAW;GAC5C,GAAG;GACH,QAAQ;GACR,OAAO;GACR,CAAC;EAEF,OAAO,KAAK,GAAG,KAAK,MAAM;EAG1B,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,MAAM,SAAS,WACjD,UAAU;OACL,IAAI,WAAW,KAAA,KAAa,gBAAgB,aAAa,QAC9D,UAAU;OACL,IAAI,KAAK,eAAe,KAA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S,UAAU,gCAAgC,CACnD,SAAS,cAAc,wDAAwD,CAC/E,eAAe,4BAA4B,+BAA+B,CAC1E,OACC,4BACA,iFACD,CACA,OAAO,mBAAmB,yCAAyC,MAAM,CACzE,OACC,uBACA,wCACC,QAAQ,SAAS,KAAK,GAAG,EAC1B,IACD,CACA,OAAO,OAAO,MAAc,OAAiB,SAAS,QAAQ;EAC7D,QAAQ,OAAO,MAAM,4BAA4B,KAAK;EAEtD,MAAM,qBAAqB,MAAM,OAAO;GAAE,GADvB,IAAI,QAAQ,MAAM,IAAI,EAAE;GACc,GAAG;GAAS,CAAC;GACtE;CAGJ,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC,QAAQ;EACjC,QAAQ,MAAM;EACd;;CAGF,MAAM,QAAQ,YAAY;;AAG5B,KAAK,CAAC,OAAO,QAAQ;CACnB,OAAO,MAAMC,cAAAA,aAAa,IAAI,CAAC;CAC/B,MAAM;EACN"}
|
package/dist/cli.d.cts
CHANGED
package/dist/cli.d.mts
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { r as __require } from "./chunk-hT5z_Zn9.mjs";
|
|
3
|
-
import { L as errorMessage, i as getDirname, s as initializeLogger } from "./utils-
|
|
4
|
-
import { n as version, t as LaminarClient } from "./dist-
|
|
5
|
-
import { i as writeToFile, n as loadFromPaths, r as printToConsole } from "./file-utils-
|
|
3
|
+
import { L as errorMessage, i as getDirname, s as initializeLogger } from "./utils-Bdv7YZH7.mjs";
|
|
4
|
+
import { n as version, t as LaminarClient } from "./dist-CvQVYVO4.mjs";
|
|
5
|
+
import { i as writeToFile, n as loadFromPaths, r as printToConsole } from "./file-utils-CHgYB_Ei.mjs";
|
|
6
6
|
import * as fs from "fs";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
import * as esbuild from "esbuild";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/opentelemetry-lib/instrumentation/temporal/consts.ts
|
|
2
|
+
/** Header key used to carry the serialized Laminar span context through Temporal. */
|
|
3
|
+
const LAMINAR_SPAN_CONTEXT_HEADER = "x-lmnr-span-context";
|
|
4
|
+
/**
|
|
5
|
+
* W3C traceparent header key — written alongside `laminar-span-context` for
|
|
6
|
+
* interop with non-Laminar clients/workers that understand W3C trace context.
|
|
7
|
+
*/
|
|
8
|
+
const TRACEPARENT_HEADER = "traceparent";
|
|
9
|
+
//#endregion
|
|
10
|
+
Object.defineProperty(exports, "LAMINAR_SPAN_CONTEXT_HEADER", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return LAMINAR_SPAN_CONTEXT_HEADER;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "TRACEPARENT_HEADER", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return TRACEPARENT_HEADER;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=consts-Cx9iKRmq.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts-Cx9iKRmq.cjs","names":[],"sources":["../src/opentelemetry-lib/instrumentation/temporal/consts.ts"],"sourcesContent":["/** Header key used to carry the serialized Laminar span context through Temporal. */\nexport const LAMINAR_SPAN_CONTEXT_HEADER = \"x-lmnr-span-context\";\n\n/**\n * W3C traceparent header key — written alongside `laminar-span-context` for\n * interop with non-Laminar clients/workers that understand W3C trace context.\n */\nexport const TRACEPARENT_HEADER = \"traceparent\";\n"],"mappings":";;AACA,MAAa,8BAA8B;;;;;AAM3C,MAAa,qBAAqB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/opentelemetry-lib/instrumentation/temporal/consts.ts
|
|
2
|
+
/** Header key used to carry the serialized Laminar span context through Temporal. */
|
|
3
|
+
const LAMINAR_SPAN_CONTEXT_HEADER = "x-lmnr-span-context";
|
|
4
|
+
/**
|
|
5
|
+
* W3C traceparent header key — written alongside `laminar-span-context` for
|
|
6
|
+
* interop with non-Laminar clients/workers that understand W3C trace context.
|
|
7
|
+
*/
|
|
8
|
+
const TRACEPARENT_HEADER = "traceparent";
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TRACEPARENT_HEADER as n, LAMINAR_SPAN_CONTEXT_HEADER as t };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=consts-ivIFfgfN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts-ivIFfgfN.mjs","names":[],"sources":["../src/opentelemetry-lib/instrumentation/temporal/consts.ts"],"sourcesContent":["/** Header key used to carry the serialized Laminar span context through Temporal. */\nexport const LAMINAR_SPAN_CONTEXT_HEADER = \"x-lmnr-span-context\";\n\n/**\n * W3C traceparent header key — written alongside `laminar-span-context` for\n * interop with non-Laminar clients/workers that understand W3C trace context.\n */\nexport const TRACEPARENT_HEADER = \"traceparent\";\n"],"mappings":";;AACA,MAAa,8BAA8B;;;;;AAM3C,MAAa,qBAAqB"}
|