@mastra/fastembed 1.1.2 → 1.2.0-alpha.0
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/CHANGELOG.md +18 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +11 -8
- package/dist/index.cjs +127 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +127 -65
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -14775,7 +14775,7 @@ var ZodFirstPartyTypeKind2;
|
|
|
14775
14775
|
ZodFirstPartyTypeKind4["ZodReadonly"] = "ZodReadonly";
|
|
14776
14776
|
})(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {}));
|
|
14777
14777
|
|
|
14778
|
-
// ../_vendored/ai_v5/dist/chunk-
|
|
14778
|
+
// ../_vendored/ai_v5/dist/chunk-OMTTDYJT.js
|
|
14779
14779
|
var marker = "vercel.ai.error";
|
|
14780
14780
|
var symbol2 = Symbol.for(marker);
|
|
14781
14781
|
var _a3;
|
|
@@ -14975,6 +14975,9 @@ var ParseError = class extends Error {
|
|
|
14975
14975
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
14976
14976
|
}
|
|
14977
14977
|
};
|
|
14978
|
+
var LF = 10;
|
|
14979
|
+
var CR = 13;
|
|
14980
|
+
var SPACE = 32;
|
|
14978
14981
|
function noop(_arg) {
|
|
14979
14982
|
}
|
|
14980
14983
|
function createParser(callbacks) {
|
|
@@ -14982,39 +14985,109 @@ function createParser(callbacks) {
|
|
|
14982
14985
|
throw new TypeError(
|
|
14983
14986
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
14984
14987
|
);
|
|
14985
|
-
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
14986
|
-
let
|
|
14987
|
-
function feed(
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14988
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
|
|
14989
|
+
let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
|
|
14990
|
+
function feed(chunk) {
|
|
14991
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
14992
|
+
const trailing2 = processLines(chunk);
|
|
14993
|
+
trailing2 !== "" && pendingFragments.push(trailing2);
|
|
14994
|
+
return;
|
|
14995
|
+
}
|
|
14996
|
+
if (chunk.indexOf(`
|
|
14997
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
14998
|
+
pendingFragments.push(chunk);
|
|
14999
|
+
return;
|
|
15000
|
+
}
|
|
15001
|
+
pendingFragments.push(chunk);
|
|
15002
|
+
const input = pendingFragments.join("");
|
|
15003
|
+
pendingFragments.length = 0;
|
|
15004
|
+
const trailing = processLines(input);
|
|
15005
|
+
trailing !== "" && pendingFragments.push(trailing);
|
|
15006
|
+
}
|
|
15007
|
+
function processLines(chunk) {
|
|
15008
|
+
let searchIndex = 0;
|
|
15009
|
+
if (chunk.indexOf("\r") === -1) {
|
|
15010
|
+
let lfIndex = chunk.indexOf(`
|
|
15011
|
+
`, searchIndex);
|
|
15012
|
+
for (; lfIndex !== -1; ) {
|
|
15013
|
+
if (searchIndex === lfIndex) {
|
|
15014
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
15015
|
+
`, searchIndex);
|
|
15016
|
+
continue;
|
|
15017
|
+
}
|
|
15018
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
15019
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
15020
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
15021
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
15022
|
+
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
15023
|
+
`, searchIndex);
|
|
15024
|
+
continue;
|
|
15025
|
+
}
|
|
15026
|
+
data = dataLines === 0 ? value : `${data}
|
|
15027
|
+
${value}`, dataLines++;
|
|
15028
|
+
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
15029
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
15030
|
+
lfIndex
|
|
15031
|
+
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
15032
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
15033
|
+
`, searchIndex);
|
|
15034
|
+
}
|
|
15035
|
+
return chunk.slice(searchIndex);
|
|
15036
|
+
}
|
|
15037
|
+
for (; searchIndex < chunk.length; ) {
|
|
15038
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
15039
|
+
`, searchIndex);
|
|
15040
|
+
let lineEnd = -1;
|
|
15041
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
15042
|
+
break;
|
|
15043
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
15044
|
+
}
|
|
15045
|
+
return chunk.slice(searchIndex);
|
|
15046
|
+
}
|
|
15047
|
+
function parseLine(chunk, start, end) {
|
|
15048
|
+
if (start === end) {
|
|
14995
15049
|
dispatchEvent();
|
|
14996
15050
|
return;
|
|
14997
15051
|
}
|
|
14998
|
-
|
|
14999
|
-
|
|
15052
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
15053
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
15054
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
15055
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
15056
|
+
${value2}`, dataLines++;
|
|
15000
15057
|
return;
|
|
15001
15058
|
}
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15059
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
15060
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
15061
|
+
return;
|
|
15062
|
+
}
|
|
15063
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
15064
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
15065
|
+
id = value2.includes("\0") ? void 0 : value2;
|
|
15006
15066
|
return;
|
|
15007
15067
|
}
|
|
15008
|
-
|
|
15068
|
+
if (firstCharCode === 58) {
|
|
15069
|
+
if (onComment) {
|
|
15070
|
+
const line2 = chunk.slice(start, end);
|
|
15071
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
15072
|
+
}
|
|
15073
|
+
return;
|
|
15074
|
+
}
|
|
15075
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
15076
|
+
if (fieldSeparatorIndex === -1) {
|
|
15077
|
+
processField(line, "", line);
|
|
15078
|
+
return;
|
|
15079
|
+
}
|
|
15080
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
15081
|
+
processField(field, value, line);
|
|
15009
15082
|
}
|
|
15010
15083
|
function processField(field, value, line) {
|
|
15011
15084
|
switch (field) {
|
|
15012
15085
|
case "event":
|
|
15013
|
-
eventType = value;
|
|
15086
|
+
eventType = value || void 0;
|
|
15014
15087
|
break;
|
|
15015
15088
|
case "data":
|
|
15016
|
-
data = `${data}
|
|
15017
|
-
|
|
15089
|
+
data = dataLines === 0 ? value : `${data}
|
|
15090
|
+
${value}`, dataLines++;
|
|
15018
15091
|
break;
|
|
15019
15092
|
case "id":
|
|
15020
15093
|
id = value.includes("\0") ? void 0 : value;
|
|
@@ -15039,37 +15112,26 @@ function createParser(callbacks) {
|
|
|
15039
15112
|
}
|
|
15040
15113
|
}
|
|
15041
15114
|
function dispatchEvent() {
|
|
15042
|
-
|
|
15115
|
+
dataLines > 0 && onEvent({
|
|
15043
15116
|
id,
|
|
15044
|
-
event: eventType
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
data: data.endsWith(`
|
|
15048
|
-
`) ? data.slice(0, -1) : data
|
|
15049
|
-
}), id = void 0, data = "", eventType = "";
|
|
15117
|
+
event: eventType,
|
|
15118
|
+
data
|
|
15119
|
+
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
15050
15120
|
}
|
|
15051
15121
|
function reset(options = {}) {
|
|
15052
|
-
|
|
15122
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
15123
|
+
const incompleteLine = pendingFragments.join("");
|
|
15124
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
15125
|
+
}
|
|
15126
|
+
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
|
|
15053
15127
|
}
|
|
15054
15128
|
return { feed, reset };
|
|
15055
15129
|
}
|
|
15056
|
-
function
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
`, searchIndex);
|
|
15062
|
-
let lineEnd = -1;
|
|
15063
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
15064
|
-
incompleteLine = chunk.slice(searchIndex);
|
|
15065
|
-
break;
|
|
15066
|
-
} else {
|
|
15067
|
-
const line = chunk.slice(searchIndex, lineEnd);
|
|
15068
|
-
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
15069
|
-
` && searchIndex++;
|
|
15070
|
-
}
|
|
15071
|
-
}
|
|
15072
|
-
return [lines, incompleteLine];
|
|
15130
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
15131
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
15132
|
+
}
|
|
15133
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
15134
|
+
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
15073
15135
|
}
|
|
15074
15136
|
var EventSourceParserStream = class extends TransformStream {
|
|
15075
15137
|
constructor({ onError, onRetry, onComment } = {}) {
|
|
@@ -19553,7 +19615,7 @@ function customProvider({
|
|
|
19553
19615
|
};
|
|
19554
19616
|
}
|
|
19555
19617
|
|
|
19556
|
-
// ../_vendored/ai_v4/dist/chunk-
|
|
19618
|
+
// ../_vendored/ai_v4/dist/chunk-QGLOM3VL.js
|
|
19557
19619
|
var __create = Object.create;
|
|
19558
19620
|
var __defProp3 = Object.defineProperty;
|
|
19559
19621
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -38565,9 +38627,9 @@ var ParseError2 = class extends Error {
|
|
|
38565
38627
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
38566
38628
|
}
|
|
38567
38629
|
};
|
|
38568
|
-
var
|
|
38569
|
-
var
|
|
38570
|
-
var
|
|
38630
|
+
var LF2 = 10;
|
|
38631
|
+
var CR2 = 13;
|
|
38632
|
+
var SPACE2 = 32;
|
|
38571
38633
|
function noop2(_arg) {
|
|
38572
38634
|
}
|
|
38573
38635
|
function createParser2(callbacks) {
|
|
@@ -38606,17 +38668,17 @@ function createParser2(callbacks) {
|
|
|
38606
38668
|
continue;
|
|
38607
38669
|
}
|
|
38608
38670
|
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
38609
|
-
if (
|
|
38610
|
-
const valueStart = chunk.charCodeAt(searchIndex + 5) ===
|
|
38611
|
-
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) ===
|
|
38671
|
+
if (isDataPrefix2(chunk, searchIndex, firstCharCode)) {
|
|
38672
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE2 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
38673
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF2) {
|
|
38612
38674
|
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
38613
38675
|
`, searchIndex);
|
|
38614
38676
|
continue;
|
|
38615
38677
|
}
|
|
38616
38678
|
data = dataLines === 0 ? value : `${data}
|
|
38617
38679
|
${value}`, dataLines++;
|
|
38618
|
-
} else
|
|
38619
|
-
chunk.charCodeAt(searchIndex + 6) ===
|
|
38680
|
+
} else isEventPrefix2(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
38681
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE2 ? searchIndex + 7 : searchIndex + 6,
|
|
38620
38682
|
lfIndex
|
|
38621
38683
|
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
38622
38684
|
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
@@ -38630,7 +38692,7 @@ ${value}`, dataLines++;
|
|
|
38630
38692
|
let lineEnd = -1;
|
|
38631
38693
|
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
38632
38694
|
break;
|
|
38633
|
-
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) ===
|
|
38695
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR2 && chunk.charCodeAt(searchIndex) === LF2 && searchIndex++;
|
|
38634
38696
|
}
|
|
38635
38697
|
return chunk.slice(searchIndex);
|
|
38636
38698
|
}
|
|
@@ -38640,25 +38702,25 @@ ${value}`, dataLines++;
|
|
|
38640
38702
|
return;
|
|
38641
38703
|
}
|
|
38642
38704
|
const firstCharCode = chunk.charCodeAt(start);
|
|
38643
|
-
if (
|
|
38644
|
-
const valueStart = chunk.charCodeAt(start + 5) ===
|
|
38705
|
+
if (isDataPrefix2(chunk, start, firstCharCode)) {
|
|
38706
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE2 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
38645
38707
|
data = dataLines === 0 ? value2 : `${data}
|
|
38646
38708
|
${value2}`, dataLines++;
|
|
38647
38709
|
return;
|
|
38648
38710
|
}
|
|
38649
|
-
if (
|
|
38650
|
-
eventType = chunk.slice(chunk.charCodeAt(start + 6) ===
|
|
38711
|
+
if (isEventPrefix2(chunk, start, firstCharCode)) {
|
|
38712
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE2 ? start + 7 : start + 6, end) || void 0;
|
|
38651
38713
|
return;
|
|
38652
38714
|
}
|
|
38653
38715
|
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
38654
|
-
const value2 = chunk.slice(chunk.charCodeAt(start + 3) ===
|
|
38716
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE2 ? start + 4 : start + 3, end);
|
|
38655
38717
|
id = value2.includes("\0") ? void 0 : value2;
|
|
38656
38718
|
return;
|
|
38657
38719
|
}
|
|
38658
38720
|
if (firstCharCode === 58) {
|
|
38659
38721
|
if (onComment) {
|
|
38660
38722
|
const line2 = chunk.slice(start, end);
|
|
38661
|
-
onComment(line2.slice(chunk.charCodeAt(start + 1) ===
|
|
38723
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE2 ? 2 : 1));
|
|
38662
38724
|
}
|
|
38663
38725
|
return;
|
|
38664
38726
|
}
|
|
@@ -38667,7 +38729,7 @@ ${value2}`, dataLines++;
|
|
|
38667
38729
|
processField(line, "", line);
|
|
38668
38730
|
return;
|
|
38669
38731
|
}
|
|
38670
|
-
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) ===
|
|
38732
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE2 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
38671
38733
|
processField(field, value, line);
|
|
38672
38734
|
}
|
|
38673
38735
|
function processField(field, value, line) {
|
|
@@ -38717,10 +38779,10 @@ ${value}`, dataLines++;
|
|
|
38717
38779
|
}
|
|
38718
38780
|
return { feed, reset };
|
|
38719
38781
|
}
|
|
38720
|
-
function
|
|
38782
|
+
function isDataPrefix2(chunk, i, firstCharCode) {
|
|
38721
38783
|
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
38722
38784
|
}
|
|
38723
|
-
function
|
|
38785
|
+
function isEventPrefix2(chunk, i, firstCharCode) {
|
|
38724
38786
|
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
38725
38787
|
}
|
|
38726
38788
|
var EventSourceParserStream2 = class extends TransformStream {
|