@mastra/fastembed 1.1.2 → 1.1.3-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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mastra/fastembed
2
2
 
3
+ ## 1.1.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Security remediation for the 2026-06-17 "easy-day-js" supply-chain incident. Patch bump to publish clean versions and move the `latest` dist-tag forward, superseding the compromised versions that declared the malicious `easy-day-js` dependency. ([#18056](https://github.com/mastra-ai/mastra/pull/18056))
8
+
3
9
  ## 1.1.2
4
10
 
5
11
  ### Patch Changes
@@ -1549,16 +1549,16 @@ declare interface EventSourceMessage {
1549
1549
  * implementation in that browsers will default this to `message`, whereas this parser will
1550
1550
  * leave this as `undefined` if not explicitly declared.
1551
1551
  */
1552
- event?: string | undefined
1552
+ event?: string | undefined;
1553
1553
  /**
1554
1554
  * ID of the message, if any was provided by the server. Can be used by clients to keep the
1555
1555
  * last received message ID in sync when reconnecting.
1556
1556
  */
1557
- id?: string | undefined
1557
+ id?: string | undefined;
1558
1558
  /**
1559
1559
  * The data received for this message
1560
1560
  */
1561
- data: string
1561
+ data: string;
1562
1562
  }
1563
1563
 
1564
1564
  /**
@@ -1582,8 +1582,11 @@ declare interface EventSourceMessage {
1582
1582
  *
1583
1583
  * @public
1584
1584
  */
1585
- declare class EventSourceParserStream extends TransformStream<string, EventSourceMessage> {
1586
- constructor({onError, onRetry, onComment}?: StreamOptions)
1585
+ declare class EventSourceParserStream extends TransformStream<
1586
+ string,
1587
+ EventSourceMessage
1588
+ > {
1589
+ constructor({ onError, onRetry, onComment }?: StreamOptions);
1587
1590
  }
1588
1591
 
1589
1592
  /**
@@ -6830,19 +6833,19 @@ declare interface StreamOptions {
6830
6833
  *
6831
6834
  * @defaultValue `undefined`
6832
6835
  */
6833
- onError?: ('terminate' | ((error: Error) => void)) | undefined
6836
+ onError?: ("terminate" | ((error: Error) => void)) | undefined;
6834
6837
  /**
6835
6838
  * Callback for when a reconnection interval is sent from the server.
6836
6839
  *
6837
6840
  * @param retry - The number of milliseconds to wait before reconnecting.
6838
6841
  */
6839
- onRetry?: ((retry: number) => void) | undefined
6842
+ onRetry?: ((retry: number) => void) | undefined;
6840
6843
  /**
6841
6844
  * Callback for when a comment is encountered in the stream.
6842
6845
  *
6843
6846
  * @param comment - The comment encountered in the stream.
6844
6847
  */
6845
- onComment?: ((comment: string) => void) | undefined
6848
+ onComment?: ((comment: string) => void) | undefined;
6846
6849
  }
6847
6850
 
6848
6851
  /**
package/dist/index.cjs CHANGED
@@ -14806,7 +14806,7 @@ var ZodFirstPartyTypeKind2;
14806
14806
  ZodFirstPartyTypeKind4["ZodReadonly"] = "ZodReadonly";
14807
14807
  })(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {}));
14808
14808
 
14809
- // ../_vendored/ai_v5/dist/chunk-TQ7JQ3AX.js
14809
+ // ../_vendored/ai_v5/dist/chunk-OMTTDYJT.js
14810
14810
  var marker = "vercel.ai.error";
14811
14811
  var symbol2 = Symbol.for(marker);
14812
14812
  var _a3;
@@ -15006,6 +15006,9 @@ var ParseError = class extends Error {
15006
15006
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
15007
15007
  }
15008
15008
  };
15009
+ var LF = 10;
15010
+ var CR = 13;
15011
+ var SPACE = 32;
15009
15012
  function noop(_arg) {
15010
15013
  }
15011
15014
  function createParser(callbacks) {
@@ -15013,39 +15016,109 @@ function createParser(callbacks) {
15013
15016
  throw new TypeError(
15014
15017
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
15015
15018
  );
15016
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
15017
- let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
15018
- function feed(newChunk) {
15019
- const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
15020
- for (const line of complete)
15021
- parseLine(line);
15022
- incompleteLine = incomplete, isFirstChunk = false;
15023
- }
15024
- function parseLine(line) {
15025
- if (line === "") {
15019
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
15020
+ let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
15021
+ function feed(chunk) {
15022
+ if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
15023
+ const trailing2 = processLines(chunk);
15024
+ trailing2 !== "" && pendingFragments.push(trailing2);
15025
+ return;
15026
+ }
15027
+ if (chunk.indexOf(`
15028
+ `) === -1 && chunk.indexOf("\r") === -1) {
15029
+ pendingFragments.push(chunk);
15030
+ return;
15031
+ }
15032
+ pendingFragments.push(chunk);
15033
+ const input = pendingFragments.join("");
15034
+ pendingFragments.length = 0;
15035
+ const trailing = processLines(input);
15036
+ trailing !== "" && pendingFragments.push(trailing);
15037
+ }
15038
+ function processLines(chunk) {
15039
+ let searchIndex = 0;
15040
+ if (chunk.indexOf("\r") === -1) {
15041
+ let lfIndex = chunk.indexOf(`
15042
+ `, searchIndex);
15043
+ for (; lfIndex !== -1; ) {
15044
+ if (searchIndex === lfIndex) {
15045
+ dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
15046
+ `, searchIndex);
15047
+ continue;
15048
+ }
15049
+ const firstCharCode = chunk.charCodeAt(searchIndex);
15050
+ if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
15051
+ const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
15052
+ if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
15053
+ onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
15054
+ `, searchIndex);
15055
+ continue;
15056
+ }
15057
+ data = dataLines === 0 ? value : `${data}
15058
+ ${value}`, dataLines++;
15059
+ } else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
15060
+ chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
15061
+ lfIndex
15062
+ ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
15063
+ searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
15064
+ `, searchIndex);
15065
+ }
15066
+ return chunk.slice(searchIndex);
15067
+ }
15068
+ for (; searchIndex < chunk.length; ) {
15069
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
15070
+ `, searchIndex);
15071
+ let lineEnd = -1;
15072
+ 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)
15073
+ break;
15074
+ parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
15075
+ }
15076
+ return chunk.slice(searchIndex);
15077
+ }
15078
+ function parseLine(chunk, start, end) {
15079
+ if (start === end) {
15026
15080
  dispatchEvent();
15027
15081
  return;
15028
15082
  }
15029
- if (line.startsWith(":")) {
15030
- onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
15083
+ const firstCharCode = chunk.charCodeAt(start);
15084
+ if (isDataPrefix(chunk, start, firstCharCode)) {
15085
+ const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
15086
+ data = dataLines === 0 ? value2 : `${data}
15087
+ ${value2}`, dataLines++;
15031
15088
  return;
15032
15089
  }
15033
- const fieldSeparatorIndex = line.indexOf(":");
15034
- if (fieldSeparatorIndex !== -1) {
15035
- const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
15036
- processField(field, value, line);
15090
+ if (isEventPrefix(chunk, start, firstCharCode)) {
15091
+ eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
15092
+ return;
15093
+ }
15094
+ if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
15095
+ const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
15096
+ id = value2.includes("\0") ? void 0 : value2;
15037
15097
  return;
15038
15098
  }
15039
- processField(line, "", line);
15099
+ if (firstCharCode === 58) {
15100
+ if (onComment) {
15101
+ const line2 = chunk.slice(start, end);
15102
+ onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
15103
+ }
15104
+ return;
15105
+ }
15106
+ const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
15107
+ if (fieldSeparatorIndex === -1) {
15108
+ processField(line, "", line);
15109
+ return;
15110
+ }
15111
+ const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
15112
+ processField(field, value, line);
15040
15113
  }
15041
15114
  function processField(field, value, line) {
15042
15115
  switch (field) {
15043
15116
  case "event":
15044
- eventType = value;
15117
+ eventType = value || void 0;
15045
15118
  break;
15046
15119
  case "data":
15047
- data = `${data}${value}
15048
- `;
15120
+ data = dataLines === 0 ? value : `${data}
15121
+ ${value}`, dataLines++;
15049
15122
  break;
15050
15123
  case "id":
15051
15124
  id = value.includes("\0") ? void 0 : value;
@@ -15070,37 +15143,26 @@ function createParser(callbacks) {
15070
15143
  }
15071
15144
  }
15072
15145
  function dispatchEvent() {
15073
- data.length > 0 && onEvent({
15146
+ dataLines > 0 && onEvent({
15074
15147
  id,
15075
- event: eventType || void 0,
15076
- // If the data buffer's last character is a U+000A LINE FEED (LF) character,
15077
- // then remove the last character from the data buffer.
15078
- data: data.endsWith(`
15079
- `) ? data.slice(0, -1) : data
15080
- }), id = void 0, data = "", eventType = "";
15148
+ event: eventType,
15149
+ data
15150
+ }), id = void 0, data = "", dataLines = 0, eventType = void 0;
15081
15151
  }
15082
15152
  function reset(options = {}) {
15083
- incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
15153
+ if (options.consume && pendingFragments.length > 0) {
15154
+ const incompleteLine = pendingFragments.join("");
15155
+ parseLine(incompleteLine, 0, incompleteLine.length);
15156
+ }
15157
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
15084
15158
  }
15085
15159
  return { feed, reset };
15086
15160
  }
15087
- function splitLines(chunk) {
15088
- const lines = [];
15089
- let incompleteLine = "", searchIndex = 0;
15090
- for (; searchIndex < chunk.length; ) {
15091
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
15092
- `, searchIndex);
15093
- let lineEnd = -1;
15094
- 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) {
15095
- incompleteLine = chunk.slice(searchIndex);
15096
- break;
15097
- } else {
15098
- const line = chunk.slice(searchIndex, lineEnd);
15099
- lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
15100
- ` && searchIndex++;
15101
- }
15102
- }
15103
- return [lines, incompleteLine];
15161
+ function isDataPrefix(chunk, i, firstCharCode) {
15162
+ return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
15163
+ }
15164
+ function isEventPrefix(chunk, i, firstCharCode) {
15165
+ 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;
15104
15166
  }
15105
15167
  var EventSourceParserStream = class extends TransformStream {
15106
15168
  constructor({ onError, onRetry, onComment } = {}) {
@@ -19584,7 +19646,7 @@ function customProvider({
19584
19646
  };
19585
19647
  }
19586
19648
 
19587
- // ../_vendored/ai_v4/dist/chunk-J65CK2AI.js
19649
+ // ../_vendored/ai_v4/dist/chunk-QGLOM3VL.js
19588
19650
  var __create = Object.create;
19589
19651
  var __defProp3 = Object.defineProperty;
19590
19652
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -38596,9 +38658,9 @@ var ParseError2 = class extends Error {
38596
38658
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
38597
38659
  }
38598
38660
  };
38599
- var LF = 10;
38600
- var CR = 13;
38601
- var SPACE = 32;
38661
+ var LF2 = 10;
38662
+ var CR2 = 13;
38663
+ var SPACE2 = 32;
38602
38664
  function noop2(_arg) {
38603
38665
  }
38604
38666
  function createParser2(callbacks) {
@@ -38637,17 +38699,17 @@ function createParser2(callbacks) {
38637
38699
  continue;
38638
38700
  }
38639
38701
  const firstCharCode = chunk.charCodeAt(searchIndex);
38640
- if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
38641
- const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
38642
- if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
38702
+ if (isDataPrefix2(chunk, searchIndex, firstCharCode)) {
38703
+ const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE2 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
38704
+ if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF2) {
38643
38705
  onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
38644
38706
  `, searchIndex);
38645
38707
  continue;
38646
38708
  }
38647
38709
  data = dataLines === 0 ? value : `${data}
38648
38710
  ${value}`, dataLines++;
38649
- } else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
38650
- chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
38711
+ } else isEventPrefix2(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
38712
+ chunk.charCodeAt(searchIndex + 6) === SPACE2 ? searchIndex + 7 : searchIndex + 6,
38651
38713
  lfIndex
38652
38714
  ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
38653
38715
  searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
@@ -38661,7 +38723,7 @@ ${value}`, dataLines++;
38661
38723
  let lineEnd = -1;
38662
38724
  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)
38663
38725
  break;
38664
- parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
38726
+ parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR2 && chunk.charCodeAt(searchIndex) === LF2 && searchIndex++;
38665
38727
  }
38666
38728
  return chunk.slice(searchIndex);
38667
38729
  }
@@ -38671,25 +38733,25 @@ ${value}`, dataLines++;
38671
38733
  return;
38672
38734
  }
38673
38735
  const firstCharCode = chunk.charCodeAt(start);
38674
- if (isDataPrefix(chunk, start, firstCharCode)) {
38675
- const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
38736
+ if (isDataPrefix2(chunk, start, firstCharCode)) {
38737
+ const valueStart = chunk.charCodeAt(start + 5) === SPACE2 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
38676
38738
  data = dataLines === 0 ? value2 : `${data}
38677
38739
  ${value2}`, dataLines++;
38678
38740
  return;
38679
38741
  }
38680
- if (isEventPrefix(chunk, start, firstCharCode)) {
38681
- eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
38742
+ if (isEventPrefix2(chunk, start, firstCharCode)) {
38743
+ eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE2 ? start + 7 : start + 6, end) || void 0;
38682
38744
  return;
38683
38745
  }
38684
38746
  if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
38685
- const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
38747
+ const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE2 ? start + 4 : start + 3, end);
38686
38748
  id = value2.includes("\0") ? void 0 : value2;
38687
38749
  return;
38688
38750
  }
38689
38751
  if (firstCharCode === 58) {
38690
38752
  if (onComment) {
38691
38753
  const line2 = chunk.slice(start, end);
38692
- onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
38754
+ onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE2 ? 2 : 1));
38693
38755
  }
38694
38756
  return;
38695
38757
  }
@@ -38698,7 +38760,7 @@ ${value2}`, dataLines++;
38698
38760
  processField(line, "", line);
38699
38761
  return;
38700
38762
  }
38701
- const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
38763
+ const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE2 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
38702
38764
  processField(field, value, line);
38703
38765
  }
38704
38766
  function processField(field, value, line) {
@@ -38748,10 +38810,10 @@ ${value}`, dataLines++;
38748
38810
  }
38749
38811
  return { feed, reset };
38750
38812
  }
38751
- function isDataPrefix(chunk, i, firstCharCode) {
38813
+ function isDataPrefix2(chunk, i, firstCharCode) {
38752
38814
  return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
38753
38815
  }
38754
- function isEventPrefix(chunk, i, firstCharCode) {
38816
+ function isEventPrefix2(chunk, i, firstCharCode) {
38755
38817
  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;
38756
38818
  }
38757
38819
  var EventSourceParserStream2 = class extends TransformStream {