Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/ui-utils

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/ui-utils - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

7

CHANGELOG.md
# @ai-sdk/ui-utils
## 1.0.3
### Patch Changes
- 953469c: chore (ui): extract prepareAttachmentsForRequest
- a3dd2ed: fix (ui): preserve createdAt as Date object
## 1.0.2

@@ -4,0 +11,0 @@

4

dist/index.d.ts

@@ -565,2 +565,4 @@ import { LanguageModelV1FinishReason, JSONValue as JSONValue$1 } from '@ai-sdk/provider';

declare function prepareAttachmentsForRequest(attachmentsFromOptions: FileList | Array<Attachment> | undefined): Promise<Attachment[]>;
declare function processAssistantStream({ stream, onTextPart, onErrorPart, onAssistantMessagePart, onAssistantControlDataPart, onDataMessagePart, }: {

@@ -660,2 +662,2 @@ stream: ReadableStream<Uint8Array>;

export { type AssistantMessage, type AssistantStatus, type AssistantStreamPart, type AssistantStreamString, type Attachment, type ChatRequest, type ChatRequestOptions, type CreateMessage, type DataMessage, type DataStreamPart, type DataStreamString, type DeepPartial, type IdGenerator, type JSONValue, type Message, type RequestOptions, type Schema, type ToolInvocation, type UseAssistantOptions, type UseChatOptions, type UseCompletionOptions, asSchema, callChatApi, callCompletionApi, formatAssistantStreamPart, formatDataStreamPart, getTextFromDataUrl, isDeepEqualData, jsonSchema, parseAssistantStreamPart, parseDataStreamPart, parsePartialJson, processAssistantStream, processDataStream, processTextStream, zodSchema };
export { type AssistantMessage, type AssistantStatus, type AssistantStreamPart, type AssistantStreamString, type Attachment, type ChatRequest, type ChatRequestOptions, type CreateMessage, type DataMessage, type DataStreamPart, type DataStreamString, type DeepPartial, type IdGenerator, type JSONValue, type Message, type RequestOptions, type Schema, type ToolInvocation, type UseAssistantOptions, type UseChatOptions, type UseCompletionOptions, asSchema, callChatApi, callCompletionApi, formatAssistantStreamPart, formatDataStreamPart, getTextFromDataUrl, isDeepEqualData, jsonSchema, parseAssistantStreamPart, parseDataStreamPart, parsePartialJson, prepareAttachmentsForRequest, processAssistantStream, processDataStream, processTextStream, zodSchema };

@@ -45,2 +45,3 @@ "use strict";

parsePartialJson: () => parsePartialJson,
prepareAttachmentsForRequest: () => prepareAttachmentsForRequest,
processAssistantStream: () => processAssistantStream,

@@ -860,3 +861,5 @@ processDataStream: () => processDataStream,

// forwarded to rendering):
revisionId: generateId2()
revisionId: generateId2(),
// Fill in createdAt to retain Date object (lost in JSON.parse):
createdAt: currentMessage.createdAt
};

@@ -1254,2 +1257,34 @@ update([...previousMessages, copiedMessage], copiedData);

// src/prepare-attachments-for-request.ts
async function prepareAttachmentsForRequest(attachmentsFromOptions) {
if (!attachmentsFromOptions) {
return [];
}
if (attachmentsFromOptions instanceof FileList) {
return Promise.all(
Array.from(attachmentsFromOptions).map(async (attachment) => {
const { name, type } = attachment;
const dataUrl = await new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = (readerEvent) => {
var _a;
resolve((_a = readerEvent.target) == null ? void 0 : _a.result);
};
reader.onerror = (error) => reject(error);
reader.readAsDataURL(attachment);
});
return {
name,
contentType: type,
url: dataUrl
};
})
);
}
if (Array.isArray(attachmentsFromOptions)) {
return attachmentsFromOptions;
}
throw new Error("Invalid attachments type");
}
// src/process-assistant-stream.ts

@@ -1368,2 +1403,3 @@ var NEWLINE2 = "\n".charCodeAt(0);

parsePartialJson,
prepareAttachmentsForRequest,
processAssistantStream,

@@ -1370,0 +1406,0 @@ processDataStream,

{
"name": "@ai-sdk/ui-utils",
"version": "1.0.2",
"version": "1.0.3",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc