@mindstudio-ai/agent 0.1.157 → 0.1.158
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/cli.js +8 -6
- package/dist/index.d.ts +69 -1
- package/dist/index.js +130 -3
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +8 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8937,6 +8937,8 @@ function buildReferenceDocs(data) {
|
|
|
8937
8937
|
|
|
8938
8938
|
Reporting bugs / ideas (\`reportIssue\`): For building an in-app "Report a bug" or feedback feature, use \`mindstudio.reportIssue({ title, body?, kind?, reporter? })\` (also importable directly as \`reportIssue\`). It files an issue into the app's issue tracker \u2014 visible to the app's team in the dashboard and pickup-able by the Remy agent. Backend only: wire it as frontend UI \u2192 app backend method \u2192 \`reportIssue\` (a browser can't call it; it uses the app's hook token, and the app id is derived server-side). \`kind\` is \`'bug'\` (default) or \`'idea'\`. \`reporter\` is a free-form display label (a name, email, or ticket id) \u2014 NOT an identity check and not tied to a user; pass the current user's email if you have it, or omit for anonymous. It returns the created issue \u2014 show \`result.number\` to confirm "Reported as #42". Rate limited per app (20/min): catch \`MindStudioError\` with \`code === 'rate_limited'\` and show a graceful "try again shortly" message, and debounce the submit button (every call creates a new issue \u2014 no dedupe).
|
|
8939
8939
|
|
|
8940
|
+
HTTP responses of the method's own (\`respond\`): A method normally returns data, which every caller gets and the API interface sends as JSON. A method whose answer is HTTP itself (TwiML for Twilio, a plain-text challenge echo for a webhook verification, a feed, a CSV, a redirect, a stored file) returns \`respond(...)\` (\`import { respond } from '@mindstudio-ai/agent'\`): \`respond({ status?, headers?, body? })\` (body a string or bytes, at most 5 MB), \`respond.text(body, { status?, headers? })\`, \`respond.json(value, { status?, headers? })\`, \`respond.redirect(url, status = 302)\`, \`respond.file(storedFile, { headers? })\`. Only the API and webhook interfaces send it; returned to any other caller (frontend method calls, MCP, agent/voice tools, crons, a streamed call) it's a method error \`http_response_not_sent\`, so keep such a method HTTP-only and wrap a shared function where the data is needed elsewhere. Headers are the app's except \`X-Remy-*\`, connection headers, \`Content-Length\` and platform cookies (\`__ms_*\`); a bad one fails as \`invalid_http_response\`. \`respond.file\` takes a store's \`put\`/\`get\`/\`list\` result and serves the file at the request's own URL straight from storage (any size, range requests work, missing \u2192 404). Failures are still thrown \`MindStudioError\`s.
|
|
8941
|
+
|
|
8940
8942
|
Table options: \`db.defineTable<T>(name, { unique, defaults })\`.
|
|
8941
8943
|
- \`unique: [['email'], ['userId', 'orgId']]\` \u2014 declares unique constraints (SDK communicates to platform, enables upsert).
|
|
8942
8944
|
- \`defaults: { status: 'pending' }\` \u2014 client-side defaults applied in push() and upsert().
|
|
@@ -9547,7 +9549,7 @@ async function startMcpServer(options) {
|
|
|
9547
9549
|
capabilities: { tools: {} },
|
|
9548
9550
|
serverInfo: {
|
|
9549
9551
|
name: "mindstudio-agent",
|
|
9550
|
-
version: "0.1.
|
|
9552
|
+
version: "0.1.158"
|
|
9551
9553
|
},
|
|
9552
9554
|
instructions: 'Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `ask` with any question about the SDK \u2014 it knows every action, model, and connector and returns working code with real model IDs and config options. Examples: ask("generate an image with FLUX"), ask("what models support vision?"), ask("how do I send a Slack message?").\n2. Call `changeName` to set your display name \u2014 use your name or whatever your user calls you. This is how you\'ll appear in MindStudio request logs.\n3. If you have a profile picture, pass its public image URL to `changeProfilePicture`.\n4. For manual browsing, call `listActions` to discover all available actions.\n\nThen use the tools to generate text, images, video, audio, search the web, work with data sources, run agents, and more.\n\nImportant:\n- AI-powered actions (text generation, image generation, video, audio, etc.) cost money. Before running these, call `estimateActionCost` and confirm with the user before proceeding \u2014 unless they\'ve explicitly told you to go ahead.\n- Not all agents from `listAgents` are configured for API use. Do not try to run an agent just because it appears in the list \u2014 it will likely fail. Only run agents the user specifically asks you to run.'
|
|
9553
9555
|
});
|
|
@@ -10565,7 +10567,7 @@ function isNewerVersion(current, latest) {
|
|
|
10565
10567
|
return false;
|
|
10566
10568
|
}
|
|
10567
10569
|
async function checkForUpdate() {
|
|
10568
|
-
const currentVersion = "0.1.
|
|
10570
|
+
const currentVersion = "0.1.158";
|
|
10569
10571
|
if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
|
|
10570
10572
|
return null;
|
|
10571
10573
|
}
|
|
@@ -10600,7 +10602,7 @@ async function checkForUpdate() {
|
|
|
10600
10602
|
}
|
|
10601
10603
|
}
|
|
10602
10604
|
function printUpdateNotice(latestVersion) {
|
|
10603
|
-
const currentVersion = "0.1.
|
|
10605
|
+
const currentVersion = "0.1.158";
|
|
10604
10606
|
process.stderr.write(
|
|
10605
10607
|
`
|
|
10606
10608
|
${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
|
|
@@ -10613,7 +10615,7 @@ function isStandaloneBinary() {
|
|
|
10613
10615
|
return !argv1.includes("node_modules");
|
|
10614
10616
|
}
|
|
10615
10617
|
async function cmdUpdate() {
|
|
10616
|
-
const currentVersion = "0.1.
|
|
10618
|
+
const currentVersion = "0.1.158";
|
|
10617
10619
|
process.stderr.write(
|
|
10618
10620
|
` ${ansi2.gray("Current version:")} ${currentVersion}
|
|
10619
10621
|
`
|
|
@@ -10754,7 +10756,7 @@ async function cmdLogin(options) {
|
|
|
10754
10756
|
process.stderr.write("\n");
|
|
10755
10757
|
printLogo();
|
|
10756
10758
|
process.stderr.write("\n");
|
|
10757
|
-
const ver = "0.1.
|
|
10759
|
+
const ver = "0.1.158";
|
|
10758
10760
|
process.stderr.write(
|
|
10759
10761
|
` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
|
|
10760
10762
|
`
|
|
@@ -11082,7 +11084,7 @@ async function main() {
|
|
|
11082
11084
|
const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
|
|
11083
11085
|
try {
|
|
11084
11086
|
if (command === "version" || command === "-v") {
|
|
11085
|
-
process.stdout.write("0.1.
|
|
11087
|
+
process.stdout.write("0.1.158\n");
|
|
11086
11088
|
return;
|
|
11087
11089
|
}
|
|
11088
11090
|
if (command === "login") {
|
package/dist/index.d.ts
CHANGED
|
@@ -12102,6 +12102,74 @@ declare class MindStudioError extends Error {
|
|
|
12102
12102
|
toJSON(): Record<string, unknown>;
|
|
12103
12103
|
}
|
|
12104
12104
|
|
|
12105
|
+
/** The largest inline body, in bytes. A larger one is a stored file: `respond.file`. */
|
|
12106
|
+
declare const RESPONSE_BODY_MAX_BYTES: number;
|
|
12107
|
+
/** Response headers. An array sends the header once per value (`Set-Cookie`). */
|
|
12108
|
+
type HttpResponseHeaders = Record<string, string | string[]>;
|
|
12109
|
+
interface HttpResponseInit {
|
|
12110
|
+
/** 200 to 599. Defaults to 200. */
|
|
12111
|
+
status?: number;
|
|
12112
|
+
headers?: HttpResponseHeaders;
|
|
12113
|
+
}
|
|
12114
|
+
interface HttpResponseOptions extends HttpResponseInit {
|
|
12115
|
+
/** Text, or bytes (`Uint8Array` or `Buffer`). */
|
|
12116
|
+
body?: string | Uint8Array;
|
|
12117
|
+
}
|
|
12118
|
+
/** A stored file to answer with: what a store's `put`, `get` or `list` returns. */
|
|
12119
|
+
interface HttpResponseFile {
|
|
12120
|
+
store: string;
|
|
12121
|
+
key: string;
|
|
12122
|
+
access: FileAccess;
|
|
12123
|
+
}
|
|
12124
|
+
/** A response a method returns. Build one with {@link respond}. */
|
|
12125
|
+
declare class HttpResponse {
|
|
12126
|
+
readonly status: number;
|
|
12127
|
+
readonly headers: HttpResponseHeaders;
|
|
12128
|
+
readonly body?: string | Uint8Array;
|
|
12129
|
+
readonly file?: HttpResponseFile;
|
|
12130
|
+
constructor(options: HttpResponseOptions & {
|
|
12131
|
+
file?: HttpResponseFile;
|
|
12132
|
+
});
|
|
12133
|
+
toJSON(): Record<string, unknown>;
|
|
12134
|
+
}
|
|
12135
|
+
/**
|
|
12136
|
+
* Answer an API or webhook request with an HTTP response of the method's own:
|
|
12137
|
+
* a status, headers and a text or binary body.
|
|
12138
|
+
*
|
|
12139
|
+
* Only for a method whose answer is HTTP itself. A method that returns data
|
|
12140
|
+
* keeps returning it, and every caller gets it; a method that returns a
|
|
12141
|
+
* response can only be called through the API and webhook interfaces. A
|
|
12142
|
+
* failure any caller should see is still a thrown `MindStudioError`.
|
|
12143
|
+
*
|
|
12144
|
+
* @example
|
|
12145
|
+
* ```ts
|
|
12146
|
+
* import { respond } from '@mindstudio-ai/agent';
|
|
12147
|
+
*
|
|
12148
|
+
* export async function voiceCall() {
|
|
12149
|
+
* return respond.text('<Response><Say>Hello</Say></Response>', {
|
|
12150
|
+
* headers: { 'Content-Type': 'text/xml' },
|
|
12151
|
+
* });
|
|
12152
|
+
* }
|
|
12153
|
+
* ```
|
|
12154
|
+
*/
|
|
12155
|
+
declare const respond: ((options?: HttpResponseOptions) => HttpResponse) & {
|
|
12156
|
+
/** Text, as `text/plain; charset=utf-8` unless the headers name a type. */
|
|
12157
|
+
text(body: string, init?: HttpResponseInit): HttpResponse;
|
|
12158
|
+
/** JSON, with a status or headers of the method's choosing. */
|
|
12159
|
+
json(value: unknown, init?: HttpResponseInit): HttpResponse;
|
|
12160
|
+
/** A redirect: 301, 302 (the default), 303, 307 or 308. */
|
|
12161
|
+
redirect(url: string, status?: number): HttpResponse;
|
|
12162
|
+
/**
|
|
12163
|
+
* A stored file, sent at the request's own URL with no redirect for the
|
|
12164
|
+
* client to follow. The bytes come straight from storage, never through
|
|
12165
|
+
* the method, so a file of any size works, and range requests too. The
|
|
12166
|
+
* stored content type is sent unless the headers name one.
|
|
12167
|
+
*/
|
|
12168
|
+
file(file: HttpResponseFile, init?: {
|
|
12169
|
+
headers?: HttpResponseHeaders;
|
|
12170
|
+
}): HttpResponse;
|
|
12171
|
+
};
|
|
12172
|
+
|
|
12105
12173
|
/**
|
|
12106
12174
|
* AsyncLocalStorage-based request context for concurrent execution.
|
|
12107
12175
|
*
|
|
@@ -12890,4 +12958,4 @@ declare const prerender: {
|
|
|
12890
12958
|
}>;
|
|
12891
12959
|
};
|
|
12892
12960
|
|
|
12893
|
-
export { type Accessor, type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AddThumbnailToVideoStepInput, type AddThumbnailToVideoStepOutput, type AgentInfo, type AgentOptions, type AggregateRow, type AggregateSelect, type AggregateTerm, type AiSourceVendor, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type Analytics, type AnalyticsDateRange, type AnalyticsDimension, type AnalyticsFilter, type AnalyticsFilterOp, type AnalyticsGranularity, type AnalyticsMetric, type AnalyticsQueryResponse, type AnalyticsQueryResultRow, type AnalyticsQuerySpec, type AnalyticsReadOptions, type AnalyzeImageStepInput, type AnalyzeImageStepOutput, type AnalyzeVideoStepInput, type AnalyzeVideoStepOutput, type AppAuthContext, type AppContextResult, type AppDatabase, type AppDatabaseColumnSchema, type AppDatabaseTable, type AppRoleAssignment, AuthContext, type AuthTableConfig, type BatchStepInput, type BatchStepResult, type Batchable, type CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CheckAppRoleStepInput, type CheckAppRoleStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type Connection, type ConnectorActionDetail, type ConnectorService, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CrawlerBucket, type CrawlerHit, type CrawlerOverview, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type Db, type DecomposeImageStepInput, type DecomposeImageStepOutput, type DefineStoreOptions, type DefineTableOptions, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGmailEmailStepInput, type DeleteGmailEmailStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DeleteGoogleSheetRowsStepInput, type DeleteGoogleSheetRowsStepOutput, type DetectChangesStepInput, type DetectChangesStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type EvaluateDecisionStepInput, type EvaluateDecisionStepOutput, type EventGrantOptions, type EventGrantResult, type Events, type ExecuteStepBatchOptions, type ExecuteStepBatchResult, type ExtractAudioFromVideoStepInput, type ExtractAudioFromVideoStepOutput, type ExtractTextStepInput, type ExtractTextStepOutput, type FetchDataSourceDocumentStepInput, type FetchDataSourceDocumentStepOutput, type FetchGoogleDocStepInput, type FetchGoogleDocStepOutput, type FetchGoogleSheetStepInput, type FetchGoogleSheetStepOutput, type FetchSlackChannelHistoryStepInput, type FetchSlackChannelHistoryStepOutput, type FetchYoutubeCaptionsStepInput, type FetchYoutubeCaptionsStepOutput, type FetchYoutubeChannelStepInput, type FetchYoutubeChannelStepOutput, type FetchYoutubeCommentsStepInput, type FetchYoutubeCommentsStepOutput, type FetchYoutubeVideoStepInput, type FetchYoutubeVideoStepOutput, type FileAccess, type Files, type FromSchema, type Generate3dModelStepInput, type Generate3dModelStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateSoundStepInput, type GenerateSoundStepOutput, type GenerateStaticVideoFromImageStepInput, type GenerateStaticVideoFromImageStepOutput, type GenerateTextStepInput, type GenerateTextStepOutput, type GenerateVideoStepInput, type GenerateVideoStepOutput, type GetGmailAttachmentsStepInput, type GetGmailAttachmentsStepOutput, type GetGmailDraftStepInput, type GetGmailDraftStepOutput, type GetGmailEmailStepInput, type GetGmailEmailStepOutput, type GetGmailUnreadCountStepInput, type GetGmailUnreadCountStepOutput, type GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetGoogleDriveFileStepInput, type GetGoogleDriveFileStepOutput, type GetGoogleSheetInfoStepInput, type GetGoogleSheetInfoStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type GetStreamOptions, type HubspotCreateCompanyStepInput, type HubspotCreateCompanyStepOutput, type HubspotCreateContactStepInput, type HubspotCreateContactStepOutput, type HubspotGetCompanyStepInput, type HubspotGetCompanyStepOutput, type HubspotGetContactStepInput, type HubspotGetContactStepOutput, type HunterApiCompanyEnrichmentStepInput, type HunterApiCompanyEnrichmentStepOutput, type HunterApiDomainSearchStepInput, type HunterApiDomainSearchStepOutput, type HunterApiEmailFinderStepInput, type HunterApiEmailFinderStepOutput, type HunterApiEmailVerificationStepInput, type HunterApiEmailVerificationStepOutput, type HunterApiPersonEnrichmentStepInput, type HunterApiPersonEnrichmentStepOutput, type ImageFaceSwapStepInput, type ImageFaceSwapStepOutput, type ImageRemoveWatermarkStepInput, type ImageRemoveWatermarkStepOutput, type ImportFromUrlStepInput, type ImportFromUrlStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type Jewel, type JewelConfig, type JewelGradeContext, type JewelMethod, type JewelMethodInput, type JewelPairRecord, type JewelProposal, type JewelProposeOutcome, type JewelProposeResult, type JewelQueueItem, type JewelQueueResolution, type JewelQueueResolveResult, type JewelRunParams, type JewelVerdict, type JewelsApi, type JsonObjectSchema, type JsonSchema, type JsonSchemaTypeName, type ListAgentsResult, type ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGmailDraftsStepInput, type ListGmailDraftsStepOutput, type ListGmailLabelsStepInput, type ListGmailLabelsStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type ListGoogleDriveFilesStepInput, type ListGoogleDriveFilesStepOutput, type ListOptions, type ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LiveNow, type LogicStepInput, type LogicStepOutput, MAX_EVENT_PAYLOAD_CHARS, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MapObject, type MapOutcome, type MapPoint, type MapRunObject, type MapRunOutcome, type MapRunParams, type MapRunRecord, type MapRunResult, type MappedDocument, type Mapper, type MapperConfig, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, type MeshyAnimateStepInput, type MeshyAnimateStepOutput, type MeshyImageTo3dStepInput, type MeshyImageTo3dStepOutput, type MeshyRemeshStepInput, type MeshyRemeshStepOutput, type MeshyRigStepInput, type MeshyRigStepOutput, type MeshyTextTo3dStepInput, type MeshyTextTo3dStepOutput, type MeshyTextureStepInput, type MeshyTextureStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MindStudioModelSummary, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, type MonacoSnippet, type MonacoSnippetField, type MonacoSnippetFieldType, type MuteVideoStepInput, type MuteVideoStepOutput, type N8nRunNodeStepInput, type N8nRunNodeStepOutput, type NotionCreatePageStepInput, type NotionCreatePageStepOutput, type NotionUpdatePageStepInput, type NotionUpdatePageStepOutput, type PackagedWorkflow, type PackagedWorkflowInput, type PackagedWorkflowSignature, type PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type Predicate, type PushInput, type PutOptions, type PutStream, Query, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type QuickbooksApiRequestStepInput, type QuickbooksApiRequestStepOutput, RawQuery, type ReadDelivery, type ReadRunParams, type ReadRunRecord, type ReadRunResult, type Reader, type ReaderConfig, type ReaderDocument, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type RenderVideoFromHtmlCompositionStepInput, type RenderVideoFromHtmlCompositionStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ReportIssueInput, type ReportedIssue, type RequestContext, type ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFfmpegStepInput, type RunFfmpegStepOutput, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunTaskOptions, type RunTaskOptionsWithExample, type RunTaskOptionsWithSchema, type RunTaskResult, type SchemaValidationError, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, type ScreenshotUrlStepInput, type ScreenshotUrlStepOutput, type SearchGmailEmailsStepInput, type SearchGmailEmailsStepOutput, type SearchGoogleCalendarEventsStepInput, type SearchGoogleCalendarEventsStepOutput, type SearchGoogleDriveStepInput, type SearchGoogleDriveStepOutput, type SearchGoogleImagesStepInput, type SearchGoogleImagesStepOutput, type SearchGoogleNewsStepInput, type SearchGoogleNewsStepOutput, type SearchGoogleStepInput, type SearchGoogleStepOutput, type SearchGoogleTrendsStepInput, type SearchGoogleTrendsStepOutput, type SearchPerplexityStepInput, type SearchPerplexityStepOutput, type SearchXPostsStepInput, type SearchXPostsStepOutput, type SearchYoutubeStepInput, type SearchYoutubeStepOutput, type SearchYoutubeTrendsStepInput, type SearchYoutubeTrendsStepOutput, type SendEmailStepInput, type SendEmailStepOutput, type SendGmailDraftStepInput, type SendGmailDraftStepOutput, type SendGmailMessageStepInput, type SendGmailMessageStepOutput, type SendSMSStepInput, type SendSMSStepOutput, type SendSlackDirectMessageStepInput, type SendSlackDirectMessageStepOutput, type SessionContext, type SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepLogEvent, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, Store, type StoredFile, type SystemFields, Table, type TaskEvent, type TaskToolCall, type TaskToolConfig, type TaskUsage, type TextToSpeechStepInput, type TextToSpeechStepOutput, type TopSource, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type TypesafeEvaluateStepInput, type TypesafeEvaluateStepOutput, type UpdateGmailLabelsStepInput, type UpdateGmailLabelsStepOutput, type UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UpdateInput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UploadFileResult, type UploadToken, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type User, type UserInfoResult, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type Voice, type VoiceCallResult, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, type YouDotComFinanceResearchStepInput, type YouDotComFinanceResearchStepOutput, type YouDotComGetPageContentStepInput, type YouDotComGetPageContentStepOutput, type YouDotComLiveNewsStepInput, type YouDotComLiveNewsStepOutput, type YouDotComWebResearchStepInput, type YouDotComWebResearchStepOutput, type YouDotComWebSearchStepInput, type YouDotComWebSearchStepOutput, analytics, auth, blockTypeAliases, dataSources, db, mindstudio as default, defineJewel, defineMapper, defineReader, deletes, documents, email, events, files, getRequestContext, mindstudio, monacoSnippets, passthrough, prerender, reportIssue, resolveUser, runWithContext, session, skip, stepMetadata, stream, voice, waitUntil };
|
|
12961
|
+
export { type Accessor, type ActiveCampaignAddNoteStepInput, type ActiveCampaignAddNoteStepOutput, type ActiveCampaignCreateContactStepInput, type ActiveCampaignCreateContactStepOutput, type AddSubtitlesToVideoStepInput, type AddSubtitlesToVideoStepOutput, type AddThumbnailToVideoStepInput, type AddThumbnailToVideoStepOutput, type AgentInfo, type AgentOptions, type AggregateRow, type AggregateSelect, type AggregateTerm, type AiSourceVendor, type AirtableCreateUpdateRecordStepInput, type AirtableCreateUpdateRecordStepOutput, type AirtableDeleteRecordStepInput, type AirtableDeleteRecordStepOutput, type AirtableGetRecordStepInput, type AirtableGetRecordStepOutput, type AirtableGetTableRecordsStepInput, type AirtableGetTableRecordsStepOutput, type Analytics, type AnalyticsDateRange, type AnalyticsDimension, type AnalyticsFilter, type AnalyticsFilterOp, type AnalyticsGranularity, type AnalyticsMetric, type AnalyticsQueryResponse, type AnalyticsQueryResultRow, type AnalyticsQuerySpec, type AnalyticsReadOptions, type AnalyzeImageStepInput, type AnalyzeImageStepOutput, type AnalyzeVideoStepInput, type AnalyzeVideoStepOutput, type AppAuthContext, type AppContextResult, type AppDatabase, type AppDatabaseColumnSchema, type AppDatabaseTable, type AppRoleAssignment, AuthContext, type AuthTableConfig, type BatchStepInput, type BatchStepResult, type Batchable, type CaptureThumbnailStepInput, type CaptureThumbnailStepOutput, type CheckAppRoleStepInput, type CheckAppRoleStepOutput, type CodaCreateUpdatePageStepInput, type CodaCreateUpdatePageStepOutput, type CodaCreateUpdateRowStepInput, type CodaCreateUpdateRowStepOutput, type CodaFindRowStepInput, type CodaFindRowStepOutput, type CodaGetPageStepInput, type CodaGetPageStepOutput, type CodaGetTableRowsStepInput, type CodaGetTableRowsStepOutput, type Connection, type ConnectorActionDetail, type ConnectorService, type ConvertPdfToImagesStepInput, type ConvertPdfToImagesStepOutput, type CrawlerBucket, type CrawlerHit, type CrawlerOverview, type CreateDataSourceStepInput, type CreateDataSourceStepOutput, type CreateGmailDraftStepInput, type CreateGmailDraftStepOutput, type CreateGoogleCalendarEventStepInput, type CreateGoogleCalendarEventStepOutput, type CreateGoogleDocStepInput, type CreateGoogleDocStepOutput, type CreateGoogleSheetStepInput, type CreateGoogleSheetStepOutput, type Db, type DecomposeImageStepInput, type DecomposeImageStepOutput, type DefineStoreOptions, type DefineTableOptions, type DeleteDataSourceDocumentStepInput, type DeleteDataSourceDocumentStepOutput, type DeleteDataSourceStepInput, type DeleteDataSourceStepOutput, type DeleteGmailEmailStepInput, type DeleteGmailEmailStepOutput, type DeleteGoogleCalendarEventStepInput, type DeleteGoogleCalendarEventStepOutput, type DeleteGoogleSheetRowsStepInput, type DeleteGoogleSheetRowsStepOutput, type DetectChangesStepInput, type DetectChangesStepOutput, type DetectPIIStepInput, type DetectPIIStepOutput, type DownloadVideoStepInput, type DownloadVideoStepOutput, type EnhanceImageGenerationPromptStepInput, type EnhanceImageGenerationPromptStepOutput, type EnhanceVideoGenerationPromptStepInput, type EnhanceVideoGenerationPromptStepOutput, type EnrichPersonStepInput, type EnrichPersonStepOutput, type EvaluateDecisionStepInput, type EvaluateDecisionStepOutput, type EventGrantOptions, type EventGrantResult, type Events, type ExecuteStepBatchOptions, type ExecuteStepBatchResult, type ExtractAudioFromVideoStepInput, type ExtractAudioFromVideoStepOutput, type ExtractTextStepInput, type ExtractTextStepOutput, type FetchDataSourceDocumentStepInput, type FetchDataSourceDocumentStepOutput, type FetchGoogleDocStepInput, type FetchGoogleDocStepOutput, type FetchGoogleSheetStepInput, type FetchGoogleSheetStepOutput, type FetchSlackChannelHistoryStepInput, type FetchSlackChannelHistoryStepOutput, type FetchYoutubeCaptionsStepInput, type FetchYoutubeCaptionsStepOutput, type FetchYoutubeChannelStepInput, type FetchYoutubeChannelStepOutput, type FetchYoutubeCommentsStepInput, type FetchYoutubeCommentsStepOutput, type FetchYoutubeVideoStepInput, type FetchYoutubeVideoStepOutput, type FileAccess, type Files, type FromSchema, type Generate3dModelStepInput, type Generate3dModelStepOutput, type GenerateAssetStepInput, type GenerateAssetStepOutput, type GenerateImageStepInput, type GenerateImageStepOutput, type GenerateLipsyncStepInput, type GenerateLipsyncStepOutput, type GenerateMusicStepInput, type GenerateMusicStepOutput, type GeneratePdfStepInput, type GeneratePdfStepOutput, type GenerateSoundStepInput, type GenerateSoundStepOutput, type GenerateStaticVideoFromImageStepInput, type GenerateStaticVideoFromImageStepOutput, type GenerateTextStepInput, type GenerateTextStepOutput, type GenerateVideoStepInput, type GenerateVideoStepOutput, type GetGmailAttachmentsStepInput, type GetGmailAttachmentsStepOutput, type GetGmailDraftStepInput, type GetGmailDraftStepOutput, type GetGmailEmailStepInput, type GetGmailEmailStepOutput, type GetGmailUnreadCountStepInput, type GetGmailUnreadCountStepOutput, type GetGoogleCalendarEventStepInput, type GetGoogleCalendarEventStepOutput, type GetGoogleDriveFileStepInput, type GetGoogleDriveFileStepOutput, type GetGoogleSheetInfoStepInput, type GetGoogleSheetInfoStepOutput, type GetMediaMetadataStepInput, type GetMediaMetadataStepOutput, type GetStreamOptions, HttpResponse, type HttpResponseFile, type HttpResponseHeaders, type HttpResponseInit, type HttpResponseOptions, type HubspotCreateCompanyStepInput, type HubspotCreateCompanyStepOutput, type HubspotCreateContactStepInput, type HubspotCreateContactStepOutput, type HubspotGetCompanyStepInput, type HubspotGetCompanyStepOutput, type HubspotGetContactStepInput, type HubspotGetContactStepOutput, type HunterApiCompanyEnrichmentStepInput, type HunterApiCompanyEnrichmentStepOutput, type HunterApiDomainSearchStepInput, type HunterApiDomainSearchStepOutput, type HunterApiEmailFinderStepInput, type HunterApiEmailFinderStepOutput, type HunterApiEmailVerificationStepInput, type HunterApiEmailVerificationStepOutput, type HunterApiPersonEnrichmentStepInput, type HunterApiPersonEnrichmentStepOutput, type ImageFaceSwapStepInput, type ImageFaceSwapStepOutput, type ImageRemoveWatermarkStepInput, type ImageRemoveWatermarkStepOutput, type ImportFromUrlStepInput, type ImportFromUrlStepOutput, type InsertVideoClipsStepInput, type InsertVideoClipsStepOutput, type Jewel, type JewelConfig, type JewelGradeContext, type JewelMethod, type JewelMethodInput, type JewelPairRecord, type JewelProposal, type JewelProposeOutcome, type JewelProposeResult, type JewelQueueItem, type JewelQueueResolution, type JewelQueueResolveResult, type JewelRunParams, type JewelVerdict, type JewelsApi, type JsonObjectSchema, type JsonSchema, type JsonSchemaTypeName, type ListAgentsResult, type ListDataSourcesStepInput, type ListDataSourcesStepOutput, type ListGmailDraftsStepInput, type ListGmailDraftsStepOutput, type ListGmailLabelsStepInput, type ListGmailLabelsStepOutput, type ListGoogleCalendarEventsStepInput, type ListGoogleCalendarEventsStepOutput, type ListGoogleDriveFilesStepInput, type ListGoogleDriveFilesStepOutput, type ListOptions, type ListRecentGmailEmailsStepInput, type ListRecentGmailEmailsStepOutput, type LiveNow, type LogicStepInput, type LogicStepOutput, MAX_EVENT_PAYLOAD_CHARS, type MakeDotComRunScenarioStepInput, type MakeDotComRunScenarioStepOutput, type MapObject, type MapOutcome, type MapPoint, type MapRunObject, type MapRunOutcome, type MapRunParams, type MapRunRecord, type MapRunResult, type MappedDocument, type Mapper, type MapperConfig, type MergeAudioStepInput, type MergeAudioStepOutput, type MergeVideosStepInput, type MergeVideosStepOutput, type MeshyAnimateStepInput, type MeshyAnimateStepOutput, type MeshyImageTo3dStepInput, type MeshyImageTo3dStepOutput, type MeshyRemeshStepInput, type MeshyRemeshStepOutput, type MeshyRigStepInput, type MeshyRigStepOutput, type MeshyTextTo3dStepInput, type MeshyTextTo3dStepOutput, type MeshyTextureStepInput, type MeshyTextureStepOutput, MindStudioAgent, MindStudioError, type MindStudioModel, type MindStudioModelSummary, type MixAudioIntoVideoStepInput, type MixAudioIntoVideoStepOutput, type ModelType, type MonacoSnippet, type MonacoSnippetField, type MonacoSnippetFieldType, type MuteVideoStepInput, type MuteVideoStepOutput, type N8nRunNodeStepInput, type N8nRunNodeStepOutput, type NotionCreatePageStepInput, type NotionCreatePageStepOutput, type NotionUpdatePageStepInput, type NotionUpdatePageStepOutput, type PackagedWorkflow, type PackagedWorkflowInput, type PackagedWorkflowSignature, type PeopleSearchStepInput, type PeopleSearchStepOutput, type PostToLinkedInStepInput, type PostToLinkedInStepOutput, type PostToSlackChannelStepInput, type PostToSlackChannelStepOutput, type PostToXStepInput, type PostToXStepOutput, type PostToZapierStepInput, type PostToZapierStepOutput, type Predicate, type PushInput, type PutOptions, type PutStream, Query, type QueryDataSourceStepInput, type QueryDataSourceStepOutput, type QueryExternalDatabaseStepInput, type QueryExternalDatabaseStepOutput, type QuickbooksApiRequestStepInput, type QuickbooksApiRequestStepOutput, RESPONSE_BODY_MAX_BYTES, RawQuery, type ReadDelivery, type ReadRunParams, type ReadRunRecord, type ReadRunResult, type Reader, type ReaderConfig, type ReaderDocument, type RedactPIIStepInput, type RedactPIIStepOutput, type RemoveBackgroundFromImageStepInput, type RemoveBackgroundFromImageStepOutput, type RenderVideoFromHtmlCompositionStepInput, type RenderVideoFromHtmlCompositionStepOutput, type ReplyToGmailEmailStepInput, type ReplyToGmailEmailStepOutput, type ReportIssueInput, type ReportedIssue, type RequestContext, type ResizeVideoStepInput, type ResizeVideoStepOutput, type ResolvedUser, Roles, type RunAgentOptions, type RunAgentResult, type RunFfmpegStepInput, type RunFfmpegStepOutput, type RunFromConnectorRegistryStepInput, type RunFromConnectorRegistryStepOutput, type RunTaskOptions, type RunTaskOptionsWithExample, type RunTaskOptionsWithSchema, type RunTaskResult, type SchemaValidationError, type ScrapeLinkedInCompanyStepInput, type ScrapeLinkedInCompanyStepOutput, type ScrapeLinkedInProfileStepInput, type ScrapeLinkedInProfileStepOutput, type ScrapeUrlStepInput, type ScrapeUrlStepOutput, type ScrapeXPostStepInput, type ScrapeXPostStepOutput, type ScrapeXProfileStepInput, type ScrapeXProfileStepOutput, type ScreenshotUrlStepInput, type ScreenshotUrlStepOutput, type SearchGmailEmailsStepInput, type SearchGmailEmailsStepOutput, type SearchGoogleCalendarEventsStepInput, type SearchGoogleCalendarEventsStepOutput, type SearchGoogleDriveStepInput, type SearchGoogleDriveStepOutput, type SearchGoogleImagesStepInput, type SearchGoogleImagesStepOutput, type SearchGoogleNewsStepInput, type SearchGoogleNewsStepOutput, type SearchGoogleStepInput, type SearchGoogleStepOutput, type SearchGoogleTrendsStepInput, type SearchGoogleTrendsStepOutput, type SearchPerplexityStepInput, type SearchPerplexityStepOutput, type SearchXPostsStepInput, type SearchXPostsStepOutput, type SearchYoutubeStepInput, type SearchYoutubeStepOutput, type SearchYoutubeTrendsStepInput, type SearchYoutubeTrendsStepOutput, type SendEmailStepInput, type SendEmailStepOutput, type SendGmailDraftStepInput, type SendGmailDraftStepOutput, type SendGmailMessageStepInput, type SendGmailMessageStepOutput, type SendSMSStepInput, type SendSMSStepOutput, type SendSlackDirectMessageStepInput, type SendSlackDirectMessageStepOutput, type SessionContext, type SetGmailReadStatusStepInput, type SetGmailReadStatusStepOutput, type SetRunTitleStepInput, type SetRunTitleStepOutput, type SetVariableStepInput, type SetVariableStepOutput, type StepCostEstimateEntry, type StepExecutionMeta, type StepExecutionOptions, type StepExecutionResult, type StepInputMap, type StepLogEvent, type StepMetadata, type StepMethods, type StepName, type StepOutputMap, Store, type StoredFile, type SystemFields, Table, type TaskEvent, type TaskToolCall, type TaskToolConfig, type TaskUsage, type TextToSpeechStepInput, type TextToSpeechStepOutput, type TopSource, type TranscribeAudioStepInput, type TranscribeAudioStepOutput, type TrimMediaStepInput, type TrimMediaStepOutput, type TypesafeEvaluateStepInput, type TypesafeEvaluateStepOutput, type UpdateGmailLabelsStepInput, type UpdateGmailLabelsStepOutput, type UpdateGoogleCalendarEventStepInput, type UpdateGoogleCalendarEventStepOutput, type UpdateGoogleDocStepInput, type UpdateGoogleDocStepOutput, type UpdateGoogleSheetStepInput, type UpdateGoogleSheetStepOutput, type UpdateInput, type UploadDataSourceDocumentStepInput, type UploadDataSourceDocumentStepOutput, type UploadFileResult, type UploadToken, type UpscaleImageStepInput, type UpscaleImageStepOutput, type UpscaleVideoStepInput, type UpscaleVideoStepOutput, type User, type UserInfoResult, type UserMessageStepInput, type UserMessageStepOutput, type VideoFaceSwapStepInput, type VideoFaceSwapStepOutput, type VideoRemoveBackgroundStepInput, type VideoRemoveBackgroundStepOutput, type VideoRemoveWatermarkStepInput, type VideoRemoveWatermarkStepOutput, type Voice, type VoiceCallResult, type WatermarkImageStepInput, type WatermarkImageStepOutput, type WatermarkVideoStepInput, type WatermarkVideoStepOutput, type YouDotComFinanceResearchStepInput, type YouDotComFinanceResearchStepOutput, type YouDotComGetPageContentStepInput, type YouDotComGetPageContentStepOutput, type YouDotComLiveNewsStepInput, type YouDotComLiveNewsStepOutput, type YouDotComWebResearchStepInput, type YouDotComWebResearchStepOutput, type YouDotComWebSearchStepInput, type YouDotComWebSearchStepOutput, analytics, auth, blockTypeAliases, dataSources, db, mindstudio as default, defineJewel, defineMapper, defineReader, deletes, documents, email, events, files, getRequestContext, mindstudio, monacoSnippets, passthrough, prerender, reportIssue, resolveUser, respond, runWithContext, session, skip, stepMetadata, stream, voice, waitUntil };
|
package/dist/index.js
CHANGED
|
@@ -8386,6 +8386,130 @@ function resolveToken(provided, config) {
|
|
|
8386
8386
|
);
|
|
8387
8387
|
}
|
|
8388
8388
|
|
|
8389
|
+
// src/respond.ts
|
|
8390
|
+
var RESPONSE_BODY_MAX_BYTES = 5 * 1024 * 1024;
|
|
8391
|
+
var TOKEN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
8392
|
+
var HEADER_VALUE = /^[\t\x20-\x7e\x80-\xff]*$/;
|
|
8393
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
8394
|
+
var HttpResponse = class {
|
|
8395
|
+
status;
|
|
8396
|
+
headers;
|
|
8397
|
+
body;
|
|
8398
|
+
file;
|
|
8399
|
+
constructor(options) {
|
|
8400
|
+
const status = options.status ?? 200;
|
|
8401
|
+
if (!Number.isInteger(status) || status < 200 || status > 599) {
|
|
8402
|
+
throw invalid(
|
|
8403
|
+
`status must be a whole number from 200 to 599, not ${status}`
|
|
8404
|
+
);
|
|
8405
|
+
}
|
|
8406
|
+
const headers = options.headers ?? {};
|
|
8407
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
8408
|
+
if (!TOKEN.test(name)) {
|
|
8409
|
+
throw invalid(`"${name}" isn't a valid header name`);
|
|
8410
|
+
}
|
|
8411
|
+
for (const one of Array.isArray(value) ? value : [value]) {
|
|
8412
|
+
if (typeof one !== "string" || !HEADER_VALUE.test(one)) {
|
|
8413
|
+
throw invalid(
|
|
8414
|
+
`header "${name}" must be a string of printable Latin-1 characters, with no line breaks`
|
|
8415
|
+
);
|
|
8416
|
+
}
|
|
8417
|
+
}
|
|
8418
|
+
}
|
|
8419
|
+
if (options.body !== void 0) {
|
|
8420
|
+
const bytes = typeof options.body === "string" ? Buffer.byteLength(options.body) : options.body.byteLength;
|
|
8421
|
+
if (bytes > RESPONSE_BODY_MAX_BYTES) {
|
|
8422
|
+
throw invalid(
|
|
8423
|
+
`the body is ${bytes} bytes, over the ${RESPONSE_BODY_MAX_BYTES} limit; put it in a store and answer with respond.file`
|
|
8424
|
+
);
|
|
8425
|
+
}
|
|
8426
|
+
}
|
|
8427
|
+
this.status = status;
|
|
8428
|
+
this.headers = headers;
|
|
8429
|
+
this.body = options.body;
|
|
8430
|
+
this.file = options.file;
|
|
8431
|
+
}
|
|
8432
|
+
toJSON() {
|
|
8433
|
+
return {
|
|
8434
|
+
$mindstudio: "http-response",
|
|
8435
|
+
v: 1,
|
|
8436
|
+
status: this.status,
|
|
8437
|
+
headers: this.headers,
|
|
8438
|
+
...typeof this.body === "string" && { body: { text: this.body } },
|
|
8439
|
+
...this.body instanceof Uint8Array && {
|
|
8440
|
+
body: { base64: Buffer.from(this.body).toString("base64") }
|
|
8441
|
+
},
|
|
8442
|
+
...this.file && {
|
|
8443
|
+
file: {
|
|
8444
|
+
store: this.file.store,
|
|
8445
|
+
key: this.file.key,
|
|
8446
|
+
access: this.file.access
|
|
8447
|
+
}
|
|
8448
|
+
}
|
|
8449
|
+
};
|
|
8450
|
+
}
|
|
8451
|
+
};
|
|
8452
|
+
function invalid(message) {
|
|
8453
|
+
return new MindStudioError(
|
|
8454
|
+
`Invalid HTTP response: ${message}.`,
|
|
8455
|
+
"invalid_http_response",
|
|
8456
|
+
500
|
|
8457
|
+
);
|
|
8458
|
+
}
|
|
8459
|
+
function withDefault(headers, name, value) {
|
|
8460
|
+
const has = Object.keys(headers ?? {}).some(
|
|
8461
|
+
(key) => key.toLowerCase() === name.toLowerCase()
|
|
8462
|
+
);
|
|
8463
|
+
return has ? { ...headers } : { ...headers, [name]: value };
|
|
8464
|
+
}
|
|
8465
|
+
var respond = Object.assign(
|
|
8466
|
+
(options = {}) => new HttpResponse(options),
|
|
8467
|
+
{
|
|
8468
|
+
/** Text, as `text/plain; charset=utf-8` unless the headers name a type. */
|
|
8469
|
+
text(body, init = {}) {
|
|
8470
|
+
return new HttpResponse({
|
|
8471
|
+
...init,
|
|
8472
|
+
body,
|
|
8473
|
+
headers: withDefault(
|
|
8474
|
+
init.headers,
|
|
8475
|
+
"Content-Type",
|
|
8476
|
+
"text/plain; charset=utf-8"
|
|
8477
|
+
)
|
|
8478
|
+
});
|
|
8479
|
+
},
|
|
8480
|
+
/** JSON, with a status or headers of the method's choosing. */
|
|
8481
|
+
json(value, init = {}) {
|
|
8482
|
+
return new HttpResponse({
|
|
8483
|
+
...init,
|
|
8484
|
+
body: JSON.stringify(value),
|
|
8485
|
+
headers: withDefault(
|
|
8486
|
+
init.headers,
|
|
8487
|
+
"Content-Type",
|
|
8488
|
+
"application/json; charset=utf-8"
|
|
8489
|
+
)
|
|
8490
|
+
});
|
|
8491
|
+
},
|
|
8492
|
+
/** A redirect: 301, 302 (the default), 303, 307 or 308. */
|
|
8493
|
+
redirect(url, status = 302) {
|
|
8494
|
+
if (!REDIRECT_STATUSES.has(status)) {
|
|
8495
|
+
throw invalid(
|
|
8496
|
+
`a redirect's status is 301, 302, 303, 307 or 308, not ${status}`
|
|
8497
|
+
);
|
|
8498
|
+
}
|
|
8499
|
+
return new HttpResponse({ status, headers: { Location: url } });
|
|
8500
|
+
},
|
|
8501
|
+
/**
|
|
8502
|
+
* A stored file, sent at the request's own URL with no redirect for the
|
|
8503
|
+
* client to follow. The bytes come straight from storage, never through
|
|
8504
|
+
* the method, so a file of any size works, and range requests too. The
|
|
8505
|
+
* stored content type is sent unless the headers name one.
|
|
8506
|
+
*/
|
|
8507
|
+
file(file, init = {}) {
|
|
8508
|
+
return new HttpResponse({ headers: init.headers, file });
|
|
8509
|
+
}
|
|
8510
|
+
}
|
|
8511
|
+
);
|
|
8512
|
+
|
|
8389
8513
|
// src/jewel/index.ts
|
|
8390
8514
|
function errorInfo(e) {
|
|
8391
8515
|
if (e instanceof Error) {
|
|
@@ -8609,17 +8733,17 @@ function objectFor(input) {
|
|
|
8609
8733
|
var OUTCOME_KINDS = /* @__PURE__ */ new Set(["documents", "passthrough", "skip", "deletes"]);
|
|
8610
8734
|
function normalizeOutcome(value) {
|
|
8611
8735
|
const outcome = value;
|
|
8612
|
-
const
|
|
8736
|
+
const invalid2 = () => ({
|
|
8613
8737
|
kind: "error",
|
|
8614
8738
|
error: {
|
|
8615
8739
|
message: `map returned an invalid outcome: ${JSON.stringify(value)?.slice(0, 200)}. Return documents(), passthrough(), skip() or deletes().`
|
|
8616
8740
|
}
|
|
8617
8741
|
});
|
|
8618
8742
|
if (!outcome || typeof outcome !== "object" || !OUTCOME_KINDS.has(outcome.kind)) {
|
|
8619
|
-
return
|
|
8743
|
+
return invalid2();
|
|
8620
8744
|
}
|
|
8621
8745
|
if (outcome.kind === "documents" && !isIterable(outcome.documents) && !isAsyncIterable(outcome.documents)) {
|
|
8622
|
-
return
|
|
8746
|
+
return invalid2();
|
|
8623
8747
|
}
|
|
8624
8748
|
return outcome;
|
|
8625
8749
|
}
|
|
@@ -9213,9 +9337,11 @@ var prerender = {
|
|
|
9213
9337
|
};
|
|
9214
9338
|
export {
|
|
9215
9339
|
AuthContext,
|
|
9340
|
+
HttpResponse,
|
|
9216
9341
|
MAX_EVENT_PAYLOAD_CHARS,
|
|
9217
9342
|
MindStudioAgent2 as MindStudioAgent,
|
|
9218
9343
|
MindStudioError,
|
|
9344
|
+
RESPONSE_BODY_MAX_BYTES,
|
|
9219
9345
|
Roles,
|
|
9220
9346
|
analytics,
|
|
9221
9347
|
auth,
|
|
@@ -9238,6 +9364,7 @@ export {
|
|
|
9238
9364
|
prerender,
|
|
9239
9365
|
reportIssue,
|
|
9240
9366
|
resolveUser,
|
|
9367
|
+
respond,
|
|
9241
9368
|
runWithContext,
|
|
9242
9369
|
session,
|
|
9243
9370
|
skip,
|