@braintrust/core
Advanced tools
Comparing version
@@ -42,2 +42,21 @@ declare const TRANSACTION_ID_FIELD = "_xact_id"; | ||
export { ALL_ROW_ID_FIELDS, AUDIT_METADATA_FIELD, AUDIT_SOURCE_FIELD, CREATED_FIELD, ID_FIELD, IS_MERGE_FIELD, MERGE_PATHS_FIELD, OBJECT_DELETE_FIELD, PARENT_ID_FIELD, type Score, type Scorer, type ScorerArgs, type Source, SpanTypeAttribute, TRANSACTION_ID_FIELD, VALID_SOURCES, mergeDicts, mergeRowBatch }; | ||
interface RepoStatus { | ||
commit?: string; | ||
branch?: string; | ||
tag?: string; | ||
dirty?: boolean; | ||
author_name?: string; | ||
author_email?: string; | ||
commit_message?: string; | ||
commit_time?: string; | ||
git_diff?: string; | ||
} | ||
type GitFields = Array<keyof RepoStatus>; | ||
type CollectMetadata = "all" | "none" | "some"; | ||
type GitMetadataSettings = { | ||
collect: CollectMetadata; | ||
fields?: GitFields; | ||
}; | ||
declare function mergeGitMetadataSettings(s1: GitMetadataSettings, s2: GitMetadataSettings): GitMetadataSettings; | ||
export { ALL_ROW_ID_FIELDS, AUDIT_METADATA_FIELD, AUDIT_SOURCE_FIELD, CREATED_FIELD, type CollectMetadata, type GitFields, type GitMetadataSettings, ID_FIELD, IS_MERGE_FIELD, MERGE_PATHS_FIELD, OBJECT_DELETE_FIELD, PARENT_ID_FIELD, type RepoStatus, type Score, type Scorer, type ScorerArgs, type Source, SpanTypeAttribute, TRANSACTION_ID_FIELD, VALID_SOURCES, mergeDicts, mergeGitMetadataSettings, mergeRowBatch }; |
@@ -36,2 +36,3 @@ "use strict"; | ||
mergeDicts: () => mergeDicts, | ||
mergeGitMetadataSettings: () => mergeGitMetadataSettings, | ||
mergeRowBatch: () => mergeRowBatch | ||
@@ -129,2 +130,22 @@ }); | ||
})(SpanTypeAttribute || {}); | ||
// src/git_fields.ts | ||
function mergeGitMetadataSettings(s1, s2) { | ||
var _a; | ||
if (s1.collect === "all") { | ||
return s2; | ||
} else if (s2.collect === "all") { | ||
return s1; | ||
} else if (s1.collect === "none") { | ||
return s1; | ||
} else if (s2.collect === "none") { | ||
return s2; | ||
} | ||
const fields = ((_a = s1.fields) != null ? _a : []).filter((f) => { | ||
var _a2; | ||
return ((_a2 = s2.fields) != null ? _a2 : []).includes(f); | ||
}); | ||
const collect = fields.length > 0 ? "some" : "none"; | ||
return { collect, fields }; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -145,3 +166,4 @@ 0 && (module.exports = { | ||
mergeDicts, | ||
mergeGitMetadataSettings, | ||
mergeRowBatch | ||
}); |
{ | ||
"name": "@braintrust/core", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Shared core dependencies for Braintrust packages", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13534
21.88%337
21.22%