@mixedbread/sdk 0.1.0-alpha.8
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 +210 -0
- package/LICENSE +201 -0
- package/README.md +360 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +89 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +241 -0
- package/core.d.ts.map +1 -0
- package/core.js +914 -0
- package/core.js.map +1 -0
- package/core.mjs +882 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +47 -0
- package/error.d.ts.map +1 -0
- package/error.js +113 -0
- package/error.js.map +1 -0
- package/error.mjs +97 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +148 -0
- package/index.d.ts +148 -0
- package/index.d.ts.map +1 -0
- package/index.js +151 -0
- package/index.js.map +1 -0
- package/index.mjs +108 -0
- package/index.mjs.map +1 -0
- package/lib/polling.d.ts +48 -0
- package/lib/polling.d.ts.map +1 -0
- package/lib/polling.js +75 -0
- package/lib/polling.js.map +1 -0
- package/lib/polling.mjs +71 -0
- package/lib/polling.mjs.map +1 -0
- package/package.json +124 -0
- package/pagination.d.ts +30 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +45 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +41 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/extractions/content.d.ts +35 -0
- package/resources/extractions/content.d.ts.map +1 -0
- package/resources/extractions/content.js +19 -0
- package/resources/extractions/content.js.map +1 -0
- package/resources/extractions/content.mjs +15 -0
- package/resources/extractions/content.mjs.map +1 -0
- package/resources/extractions/extractions.d.ts +18 -0
- package/resources/extractions/extractions.d.ts.map +1 -0
- package/resources/extractions/extractions.js +47 -0
- package/resources/extractions/extractions.js.map +1 -0
- package/resources/extractions/extractions.mjs +20 -0
- package/resources/extractions/extractions.mjs.map +1 -0
- package/resources/extractions/index.d.ts +5 -0
- package/resources/extractions/index.d.ts.map +1 -0
- package/resources/extractions/index.js +13 -0
- package/resources/extractions/index.js.map +1 -0
- package/resources/extractions/index.mjs +6 -0
- package/resources/extractions/index.mjs.map +1 -0
- package/resources/extractions/jobs.d.ts +44 -0
- package/resources/extractions/jobs.d.ts.map +1 -0
- package/resources/extractions/jobs.js +29 -0
- package/resources/extractions/jobs.js.map +1 -0
- package/resources/extractions/jobs.mjs +25 -0
- package/resources/extractions/jobs.mjs.map +1 -0
- package/resources/extractions/schema.d.ts +85 -0
- package/resources/extractions/schema.d.ts.map +1 -0
- package/resources/extractions/schema.js +39 -0
- package/resources/extractions/schema.js.map +1 -0
- package/resources/extractions/schema.mjs +35 -0
- package/resources/extractions/schema.mjs.map +1 -0
- package/resources/files.d.ts +125 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +99 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +71 -0
- package/resources/files.mjs.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +30 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/parsing/index.d.ts +3 -0
- package/resources/parsing/index.d.ts.map +1 -0
- package/resources/parsing/index.js +10 -0
- package/resources/parsing/index.js.map +1 -0
- package/resources/parsing/index.mjs +4 -0
- package/resources/parsing/index.mjs.map +1 -0
- package/resources/parsing/jobs.d.ts +278 -0
- package/resources/parsing/jobs.d.ts.map +1 -0
- package/resources/parsing/jobs.js +147 -0
- package/resources/parsing/jobs.js.map +1 -0
- package/resources/parsing/jobs.mjs +119 -0
- package/resources/parsing/jobs.mjs.map +1 -0
- package/resources/parsing/parsing.d.ts +10 -0
- package/resources/parsing/parsing.d.ts.map +1 -0
- package/resources/parsing/parsing.js +40 -0
- package/resources/parsing/parsing.js.map +1 -0
- package/resources/parsing/parsing.mjs +13 -0
- package/resources/parsing/parsing.mjs.map +1 -0
- package/resources/shared.d.ts +35 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/top-level.d.ts +11 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.mjs.map +1 -0
- package/resources/vector-stores/files.d.ts +280 -0
- package/resources/vector-stores/files.d.ts.map +1 -0
- package/resources/vector-stores/files.js +167 -0
- package/resources/vector-stores/files.js.map +1 -0
- package/resources/vector-stores/files.mjs +139 -0
- package/resources/vector-stores/files.mjs.map +1 -0
- package/resources/vector-stores/index.d.ts +3 -0
- package/resources/vector-stores/index.d.ts.map +1 -0
- package/resources/vector-stores/index.js +11 -0
- package/resources/vector-stores/index.js.map +1 -0
- package/resources/vector-stores/index.mjs +4 -0
- package/resources/vector-stores/index.mjs.map +1 -0
- package/resources/vector-stores/vector-stores.d.ts +400 -0
- package/resources/vector-stores/vector-stores.d.ts.map +1 -0
- package/resources/vector-stores/vector-stores.js +121 -0
- package/resources/vector-stores/vector-stores.js.map +1 -0
- package/resources/vector-stores/vector-stores.mjs +93 -0
- package/resources/vector-stores/vector-stores.mjs.map +1 -0
- package/shims/node.d.ts +30 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +81 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1208 -0
- package/src/error.ts +130 -0
- package/src/index.ts +294 -0
- package/src/lib/.keep +4 -0
- package/src/lib/polling.ts +115 -0
- package/src/pagination.ts +82 -0
- package/src/resource.ts +11 -0
- package/src/resources/extractions/content.ts +43 -0
- package/src/resources/extractions/extractions.ts +47 -0
- package/src/resources/extractions/index.ts +14 -0
- package/src/resources/extractions/jobs.ts +55 -0
- package/src/resources/extractions/schema.ts +111 -0
- package/src/resources/files.ts +181 -0
- package/src/resources/index.ts +32 -0
- package/src/resources/parsing/index.ts +12 -0
- package/src/resources/parsing/jobs.ts +438 -0
- package/src/resources/parsing/parsing.ts +32 -0
- package/src/resources/shared.ts +41 -0
- package/src/resources/top-level.ts +14 -0
- package/src/resources/vector-stores/files.ts +434 -0
- package/src/resources/vector-stores/index.ts +30 -0
- package/src/resources/vector-stores/vector-stores.ts +561 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +255 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +171 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +158 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
export type Agent = any;
|
5
|
+
|
6
|
+
// @ts-ignore
|
7
|
+
declare const _fetch: unknown extends typeof fetch ? never : typeof fetch;
|
8
|
+
export { _fetch as fetch };
|
9
|
+
|
10
|
+
// @ts-ignore
|
11
|
+
type _Request = unknown extends Request ? never : Request;
|
12
|
+
export { _Request as Request };
|
13
|
+
|
14
|
+
// @ts-ignore
|
15
|
+
type _RequestInfo = unknown extends RequestInfo ? never : RequestInfo;
|
16
|
+
export { type _RequestInfo as RequestInfo };
|
17
|
+
|
18
|
+
// @ts-ignore
|
19
|
+
type _RequestInit = unknown extends RequestInit ? never : RequestInit;
|
20
|
+
export { type _RequestInit as RequestInit };
|
21
|
+
|
22
|
+
// @ts-ignore
|
23
|
+
type _Response = unknown extends Response ? never : Response;
|
24
|
+
export { _Response as Response };
|
25
|
+
|
26
|
+
// @ts-ignore
|
27
|
+
type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit;
|
28
|
+
export { type _ResponseInit as ResponseInit };
|
29
|
+
|
30
|
+
// @ts-ignore
|
31
|
+
type _ResponseType = unknown extends ResponseType ? never : ResponseType;
|
32
|
+
export { type _ResponseType as ResponseType };
|
33
|
+
|
34
|
+
// @ts-ignore
|
35
|
+
type _BodyInit = unknown extends BodyInit ? never : BodyInit;
|
36
|
+
export { type _BodyInit as BodyInit };
|
37
|
+
|
38
|
+
// @ts-ignore
|
39
|
+
type _Headers = unknown extends Headers ? never : Headers;
|
40
|
+
export { _Headers as Headers };
|
41
|
+
|
42
|
+
// @ts-ignore
|
43
|
+
type _HeadersInit = unknown extends HeadersInit ? never : HeadersInit;
|
44
|
+
export { type _HeadersInit as HeadersInit };
|
45
|
+
|
46
|
+
type EndingType = 'native' | 'transparent';
|
47
|
+
|
48
|
+
export interface BlobPropertyBag {
|
49
|
+
endings?: EndingType;
|
50
|
+
type?: string;
|
51
|
+
}
|
52
|
+
|
53
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
54
|
+
lastModified?: number;
|
55
|
+
}
|
56
|
+
|
57
|
+
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
58
|
+
|
59
|
+
// @ts-ignore
|
60
|
+
type _FormData = unknown extends FormData ? never : FormData;
|
61
|
+
// @ts-ignore
|
62
|
+
declare const _FormData: unknown extends typeof FormData ? never : typeof FormData;
|
63
|
+
export { _FormData as FormData };
|
64
|
+
|
65
|
+
// @ts-ignore
|
66
|
+
type _File = unknown extends File ? never : File;
|
67
|
+
// @ts-ignore
|
68
|
+
declare const _File: unknown extends typeof File ? never : typeof File;
|
69
|
+
export { _File as File };
|
70
|
+
|
71
|
+
// @ts-ignore
|
72
|
+
type _Blob = unknown extends Blob ? never : Blob;
|
73
|
+
// @ts-ignore
|
74
|
+
declare const _Blob: unknown extends typeof Blob ? never : typeof Blob;
|
75
|
+
export { _Blob as Blob };
|
76
|
+
|
77
|
+
export declare class Readable {
|
78
|
+
readable: boolean;
|
79
|
+
readonly readableEnded: boolean;
|
80
|
+
readonly readableFlowing: boolean | null;
|
81
|
+
readonly readableHighWaterMark: number;
|
82
|
+
readonly readableLength: number;
|
83
|
+
readonly readableObjectMode: boolean;
|
84
|
+
destroyed: boolean;
|
85
|
+
read(size?: number): any;
|
86
|
+
pause(): this;
|
87
|
+
resume(): this;
|
88
|
+
isPaused(): boolean;
|
89
|
+
destroy(error?: Error): this;
|
90
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
91
|
+
}
|
92
|
+
|
93
|
+
export declare class FsReadStream extends Readable {
|
94
|
+
path: {}; // node type is string | Buffer
|
95
|
+
}
|
96
|
+
|
97
|
+
// @ts-ignore
|
98
|
+
type _ReadableStream<R = any> = unknown extends ReadableStream<R> ? never : ReadableStream<R>;
|
99
|
+
// @ts-ignore
|
100
|
+
declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
|
101
|
+
export { _ReadableStream as ReadableStream };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bun-runtime.d.ts","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,wBAAgB,UAAU,IAAI,KAAK,CAMlC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getRuntime = void 0;
|
4
|
+
const web_runtime_1 = require("./web-runtime.js");
|
5
|
+
const node_fs_1 = require("node:fs");
|
6
|
+
function getRuntime() {
|
7
|
+
const runtime = (0, web_runtime_1.getRuntime)();
|
8
|
+
function isFsReadStream(value) {
|
9
|
+
return value instanceof node_fs_1.ReadStream;
|
10
|
+
}
|
11
|
+
return { ...runtime, isFsReadStream };
|
12
|
+
}
|
13
|
+
exports.getRuntime = getRuntime;
|
14
|
+
//# sourceMappingURL=bun-runtime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bun-runtime.js","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":";;;AAIA,kDAA4D;AAC5D,qCAAqD;AAErD,SAAgB,UAAU;IACxB,MAAM,OAAO,GAAG,IAAA,wBAAa,GAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,oBAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC;AAND,gCAMC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { getRuntime as getWebRuntime } from "./web-runtime.mjs";
|
2
|
+
import { ReadStream as FsReadStream } from 'node:fs';
|
3
|
+
export function getRuntime() {
|
4
|
+
const runtime = getWebRuntime();
|
5
|
+
function isFsReadStream(value) {
|
6
|
+
return value instanceof FsReadStream;
|
7
|
+
}
|
8
|
+
return { ...runtime, isFsReadStream };
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=bun-runtime.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bun-runtime.mjs","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"OAIO,EAAE,UAAU,IAAI,aAAa,EAAE;OAC/B,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,SAAS;AAEpD,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,YAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC"}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
import { manual } from "./manual-types.js";
|
5
|
+
import * as auto from '@mixedbread/sdk/_shims/auto/types';
|
6
|
+
import { type RequestOptions } from "../core.js";
|
7
|
+
|
8
|
+
type SelectType<Manual, Auto> = unknown extends Manual ? Auto : Manual;
|
9
|
+
|
10
|
+
export const kind: string;
|
11
|
+
|
12
|
+
// @ts-ignore
|
13
|
+
export type Agent = SelectType<manual.Agent, auto.Agent>;
|
14
|
+
|
15
|
+
// @ts-ignore
|
16
|
+
export const fetch: SelectType<typeof manual.fetch, typeof auto.fetch>;
|
17
|
+
|
18
|
+
// @ts-ignore
|
19
|
+
export type Request = SelectType<manual.Request, auto.Request>;
|
20
|
+
// @ts-ignore
|
21
|
+
export type RequestInfo = SelectType<manual.RequestInfo, auto.RequestInfo>;
|
22
|
+
// @ts-ignore
|
23
|
+
export type RequestInit = SelectType<manual.RequestInit, auto.RequestInit>;
|
24
|
+
|
25
|
+
// @ts-ignore
|
26
|
+
export type Response = SelectType<manual.Response, auto.Response>;
|
27
|
+
// @ts-ignore
|
28
|
+
export type ResponseInit = SelectType<manual.ResponseInit, auto.ResponseInit>;
|
29
|
+
// @ts-ignore
|
30
|
+
export type ResponseType = SelectType<manual.ResponseType, auto.ResponseType>;
|
31
|
+
// @ts-ignore
|
32
|
+
export type BodyInit = SelectType<manual.BodyInit, auto.BodyInit>;
|
33
|
+
// @ts-ignore
|
34
|
+
export type Headers = SelectType<manual.Headers, auto.Headers>;
|
35
|
+
// @ts-ignore
|
36
|
+
export const Headers: SelectType<typeof manual.Headers, typeof auto.Headers>;
|
37
|
+
// @ts-ignore
|
38
|
+
export type HeadersInit = SelectType<manual.HeadersInit, auto.HeadersInit>;
|
39
|
+
|
40
|
+
// @ts-ignore
|
41
|
+
export type BlobPropertyBag = SelectType<manual.BlobPropertyBag, auto.BlobPropertyBag>;
|
42
|
+
// @ts-ignore
|
43
|
+
export type FilePropertyBag = SelectType<manual.FilePropertyBag, auto.FilePropertyBag>;
|
44
|
+
// @ts-ignore
|
45
|
+
export type FileFromPathOptions = SelectType<manual.FileFromPathOptions, auto.FileFromPathOptions>;
|
46
|
+
// @ts-ignore
|
47
|
+
export type FormData = SelectType<manual.FormData, auto.FormData>;
|
48
|
+
// @ts-ignore
|
49
|
+
export const FormData: SelectType<typeof manual.FormData, typeof auto.FormData>;
|
50
|
+
// @ts-ignore
|
51
|
+
export type File = SelectType<manual.File, auto.File>;
|
52
|
+
// @ts-ignore
|
53
|
+
export const File: SelectType<typeof manual.File, typeof auto.File>;
|
54
|
+
// @ts-ignore
|
55
|
+
export type Blob = SelectType<manual.Blob, auto.Blob>;
|
56
|
+
// @ts-ignore
|
57
|
+
export const Blob: SelectType<typeof manual.Blob, typeof auto.Blob>;
|
58
|
+
|
59
|
+
// @ts-ignore
|
60
|
+
export type Readable = SelectType<manual.Readable, auto.Readable>;
|
61
|
+
// @ts-ignore
|
62
|
+
export type FsReadStream = SelectType<manual.FsReadStream, auto.FsReadStream>;
|
63
|
+
// @ts-ignore
|
64
|
+
export type ReadableStream = SelectType<manual.ReadableStream, auto.ReadableStream>;
|
65
|
+
// @ts-ignore
|
66
|
+
export const ReadableStream: SelectType<typeof manual.ReadableStream, typeof auto.ReadableStream>;
|
67
|
+
|
68
|
+
export function getMultipartRequestOptions<T = Record<string, unknown>>(
|
69
|
+
form: FormData,
|
70
|
+
opts: RequestOptions<T>,
|
71
|
+
): Promise<RequestOptions<T>>;
|
72
|
+
|
73
|
+
export function getDefaultAgent(url: string): any;
|
74
|
+
|
75
|
+
// @ts-ignore
|
76
|
+
export type FileFromPathOptions = SelectType<manual.FileFromPathOptions, auto.FileFromPathOptions>;
|
77
|
+
|
78
|
+
export function fileFromPath(path: string, options?: FileFromPathOptions): Promise<File>;
|
79
|
+
export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
|
80
|
+
|
81
|
+
export function isFsReadStream(value: any): value is FsReadStream;
|
package/_shims/index.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
const shims = require('./registry');
|
5
|
+
const auto = require('@mixedbread/sdk/_shims/auto/runtime');
|
6
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
7
|
+
for (const property of Object.keys(shims)) {
|
8
|
+
Object.defineProperty(exports, property, {
|
9
|
+
get() {
|
10
|
+
return shims[property];
|
11
|
+
},
|
12
|
+
});
|
13
|
+
}
|
package/_shims/index.mjs
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
import * as shims from './registry.mjs';
|
5
|
+
import * as auto from '@mixedbread/sdk/_shims/auto/runtime';
|
6
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
7
|
+
export * from './registry.mjs';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
/**
|
5
|
+
* Types will get added to this namespace when you import one of the following:
|
6
|
+
*
|
7
|
+
* import '@mixedbread/sdk/shims/node'
|
8
|
+
* import '@mixedbread/sdk/shims/web'
|
9
|
+
*
|
10
|
+
* Importing more than one will cause type and runtime errors.
|
11
|
+
*/
|
12
|
+
export namespace manual {}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node-runtime.d.ts","sourceRoot":"","sources":["../src/_shims/node-runtime.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AA6CxC,wBAAgB,UAAU,IAAI,KAAK,CAqBlC"}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.getRuntime = void 0;
|
30
|
+
/**
|
31
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
32
|
+
*/
|
33
|
+
const nf = __importStar(require("node-fetch"));
|
34
|
+
const fd = __importStar(require("formdata-node"));
|
35
|
+
const agentkeepalive_1 = __importDefault(require("agentkeepalive"));
|
36
|
+
const abort_controller_1 = require("abort-controller");
|
37
|
+
const node_fs_1 = require("node:fs");
|
38
|
+
const form_data_encoder_1 = require("form-data-encoder");
|
39
|
+
const node_stream_1 = require("node:stream");
|
40
|
+
const MultipartBody_1 = require("./MultipartBody.js");
|
41
|
+
const web_1 = require("node:stream/web");
|
42
|
+
let fileFromPathWarned = false;
|
43
|
+
async function fileFromPath(path, ...args) {
|
44
|
+
// this import fails in environments that don't handle export maps correctly, like old versions of Jest
|
45
|
+
const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => __importStar(require('formdata-node/file-from-path')));
|
46
|
+
if (!fileFromPathWarned) {
|
47
|
+
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
|
48
|
+
fileFromPathWarned = true;
|
49
|
+
}
|
50
|
+
// @ts-ignore
|
51
|
+
return await _fileFromPath(path, ...args);
|
52
|
+
}
|
53
|
+
const defaultHttpAgent = new agentkeepalive_1.default({ keepAlive: true, timeout: 5 * 60 * 1000 });
|
54
|
+
const defaultHttpsAgent = new agentkeepalive_1.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1000 });
|
55
|
+
async function getMultipartRequestOptions(form, opts) {
|
56
|
+
const encoder = new form_data_encoder_1.FormDataEncoder(form);
|
57
|
+
const readable = node_stream_1.Readable.from(encoder);
|
58
|
+
const body = new MultipartBody_1.MultipartBody(readable);
|
59
|
+
const headers = {
|
60
|
+
...opts.headers,
|
61
|
+
...encoder.headers,
|
62
|
+
'Content-Length': encoder.contentLength,
|
63
|
+
};
|
64
|
+
return { ...opts, body: body, headers };
|
65
|
+
}
|
66
|
+
function getRuntime() {
|
67
|
+
// Polyfill global object if needed.
|
68
|
+
if (typeof AbortController === 'undefined') {
|
69
|
+
// @ts-expect-error (the types are subtly different, but compatible in practice)
|
70
|
+
globalThis.AbortController = abort_controller_1.AbortController;
|
71
|
+
}
|
72
|
+
return {
|
73
|
+
kind: 'node',
|
74
|
+
fetch: nf.default,
|
75
|
+
Request: nf.Request,
|
76
|
+
Response: nf.Response,
|
77
|
+
Headers: nf.Headers,
|
78
|
+
FormData: fd.FormData,
|
79
|
+
Blob: fd.Blob,
|
80
|
+
File: fd.File,
|
81
|
+
ReadableStream: web_1.ReadableStream,
|
82
|
+
getMultipartRequestOptions,
|
83
|
+
getDefaultAgent: (url) => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent),
|
84
|
+
fileFromPath,
|
85
|
+
isFsReadStream: (value) => value instanceof node_fs_1.ReadStream,
|
86
|
+
};
|
87
|
+
}
|
88
|
+
exports.getRuntime = getRuntime;
|
89
|
+
//# sourceMappingURL=node-runtime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node-runtime.js","sourceRoot":"","sources":["../src/_shims/node-runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,+CAAiC;AACjC,kDAAoC;AAEpC,oEAA4C;AAC5C,uDAA8E;AAC9E,qCAAqD;AAErD,yDAAoD;AACpD,6CAAuC;AAEvC,sDAAgD;AAEhD,yCAAiD;AAIjD,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAS/B,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,GAAG,IAAW;IACtD,uGAAuG;IACvG,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,wDAAa,8BAA8B,GAAC,CAAC;IAErF,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,uDAAuD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACrG,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IACD,aAAa;IACb,OAAO,MAAM,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,gBAAgB,GAAU,IAAI,wBAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AAChG,MAAM,iBAAiB,GAAU,IAAI,wBAAc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AAC,KAAU,EAAyB,EAAE,CAAC,KAAK,YAAY,oBAAY;KACrF,CAAC;AACJ,CAAC;AArBD,gCAqBC"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import * as nf from 'node-fetch';
|
2
|
+
import * as fd from 'formdata-node';
|
3
|
+
import KeepAliveAgent from 'agentkeepalive';
|
4
|
+
import { AbortController as AbortControllerPolyfill } from 'abort-controller';
|
5
|
+
import { ReadStream as FsReadStream } from 'node:fs';
|
6
|
+
import { FormDataEncoder } from 'form-data-encoder';
|
7
|
+
import { Readable } from 'node:stream';
|
8
|
+
import { MultipartBody } from "./MultipartBody.mjs";
|
9
|
+
import { ReadableStream } from 'node:stream/web';
|
10
|
+
let fileFromPathWarned = false;
|
11
|
+
async function fileFromPath(path, ...args) {
|
12
|
+
// this import fails in environments that don't handle export maps correctly, like old versions of Jest
|
13
|
+
const { fileFromPath: _fileFromPath } = await import('formdata-node/file-from-path');
|
14
|
+
if (!fileFromPathWarned) {
|
15
|
+
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
|
16
|
+
fileFromPathWarned = true;
|
17
|
+
}
|
18
|
+
// @ts-ignore
|
19
|
+
return await _fileFromPath(path, ...args);
|
20
|
+
}
|
21
|
+
const defaultHttpAgent = new KeepAliveAgent({ keepAlive: true, timeout: 5 * 60 * 1000 });
|
22
|
+
const defaultHttpsAgent = new KeepAliveAgent.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1000 });
|
23
|
+
async function getMultipartRequestOptions(form, opts) {
|
24
|
+
const encoder = new FormDataEncoder(form);
|
25
|
+
const readable = Readable.from(encoder);
|
26
|
+
const body = new MultipartBody(readable);
|
27
|
+
const headers = {
|
28
|
+
...opts.headers,
|
29
|
+
...encoder.headers,
|
30
|
+
'Content-Length': encoder.contentLength,
|
31
|
+
};
|
32
|
+
return { ...opts, body: body, headers };
|
33
|
+
}
|
34
|
+
export function getRuntime() {
|
35
|
+
// Polyfill global object if needed.
|
36
|
+
if (typeof AbortController === 'undefined') {
|
37
|
+
// @ts-expect-error (the types are subtly different, but compatible in practice)
|
38
|
+
globalThis.AbortController = AbortControllerPolyfill;
|
39
|
+
}
|
40
|
+
return {
|
41
|
+
kind: 'node',
|
42
|
+
fetch: nf.default,
|
43
|
+
Request: nf.Request,
|
44
|
+
Response: nf.Response,
|
45
|
+
Headers: nf.Headers,
|
46
|
+
FormData: fd.FormData,
|
47
|
+
Blob: fd.Blob,
|
48
|
+
File: fd.File,
|
49
|
+
ReadableStream,
|
50
|
+
getMultipartRequestOptions,
|
51
|
+
getDefaultAgent: (url) => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent),
|
52
|
+
fileFromPath,
|
53
|
+
isFsReadStream: (value) => value instanceof FsReadStream,
|
54
|
+
};
|
55
|
+
}
|
56
|
+
//# sourceMappingURL=node-runtime.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node-runtime.mjs","sourceRoot":"","sources":["../src/_shims/node-runtime.ts"],"names":[],"mappings":"OAGO,KAAK,EAAE,MAAM,YAAY;OACzB,KAAK,EAAE,MAAM,eAAe;OAE5B,cAAc,MAAM,gBAAgB;OACpC,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,kBAAkB;OACtE,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,SAAS;OAE7C,EAAE,eAAe,EAAE,MAAM,mBAAmB;OAC5C,EAAE,QAAQ,EAAE,MAAM,aAAa;OAE/B,EAAE,aAAa,EAAE;OAEjB,EAAE,cAAc,EAAE,MAAM,iBAAiB;AAIhD,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAS/B,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,GAAG,IAAW;IACtD,uGAAuG;IACvG,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;IAErF,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,u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rB,OAAO,EAAE,EAAE,CAAC,OAAO;QACnB,QAAQ,EAAE,EAAE,CAAC,QAAQ;QACrB,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,cAAc;QACd,0BAA0B;QAC1B,eAAe,EAAE,CAAC,GAAW,EAAS,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC;QACzG,YAAY;QACZ,cAAc,EAAE,CAAC,KAAU,EAAyB,EAAE,CAAC,KAAK,YAAY,YAAY;KACrF,CAAC;AACJ,CAAC"}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
import * as nf from 'node-fetch';
|
5
|
+
import * as fd from 'formdata-node';
|
6
|
+
|
7
|
+
export { type Agent } from 'node:http';
|
8
|
+
export { type Readable } from 'node:stream';
|
9
|
+
export { type ReadStream as FsReadStream } from 'node:fs';
|
10
|
+
export { ReadableStream } from 'node:stream/web';
|
11
|
+
|
12
|
+
export const fetch: typeof nf.default;
|
13
|
+
|
14
|
+
export type Request = nf.Request;
|
15
|
+
export type RequestInfo = nf.RequestInfo;
|
16
|
+
export type RequestInit = nf.RequestInit;
|
17
|
+
|
18
|
+
export type Response = nf.Response;
|
19
|
+
export type ResponseInit = nf.ResponseInit;
|
20
|
+
export type ResponseType = nf.ResponseType;
|
21
|
+
export type BodyInit = nf.BodyInit;
|
22
|
+
export type Headers = nf.Headers;
|
23
|
+
export type HeadersInit = nf.HeadersInit;
|
24
|
+
|
25
|
+
type EndingType = 'native' | 'transparent';
|
26
|
+
export interface BlobPropertyBag {
|
27
|
+
endings?: EndingType;
|
28
|
+
type?: string;
|
29
|
+
}
|
30
|
+
|
31
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
32
|
+
lastModified?: number;
|
33
|
+
}
|
34
|
+
|
35
|
+
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
36
|
+
|
37
|
+
export type FormData = fd.FormData;
|
38
|
+
export const FormData: typeof fd.FormData;
|
39
|
+
export type File = fd.File;
|
40
|
+
export const File: typeof fd.File;
|
41
|
+
export type Blob = fd.Blob;
|
42
|
+
export const Blob: typeof fd.Blob;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
import { type RequestOptions } from "../core.js";
|
5
|
+
export interface Shims {
|
6
|
+
kind: string;
|
7
|
+
fetch: any;
|
8
|
+
Request: any;
|
9
|
+
Response: any;
|
10
|
+
Headers: any;
|
11
|
+
FormData: any;
|
12
|
+
Blob: any;
|
13
|
+
File: any;
|
14
|
+
ReadableStream: any;
|
15
|
+
getMultipartRequestOptions: <T = Record<string, unknown>>(form: Shims['FormData'], opts: RequestOptions<T>) => Promise<RequestOptions<T>>;
|
16
|
+
getDefaultAgent: (url: string) => any;
|
17
|
+
fileFromPath: ((path: string, filename?: string, options?: {}) => Promise<Shims['File']>) | ((path: string, options?: {}) => Promise<Shims['File']>);
|
18
|
+
isFsReadStream: (value: any) => boolean;
|
19
|
+
}
|
20
|
+
export declare let auto: boolean;
|
21
|
+
export declare let kind: Shims['kind'] | undefined;
|
22
|
+
export declare let fetch: Shims['fetch'] | undefined;
|
23
|
+
export declare let Request: Shims['Request'] | undefined;
|
24
|
+
export declare let Response: Shims['Response'] | undefined;
|
25
|
+
export declare let Headers: Shims['Headers'] | undefined;
|
26
|
+
export declare let FormData: Shims['FormData'] | undefined;
|
27
|
+
export declare let Blob: Shims['Blob'] | undefined;
|
28
|
+
export declare let File: Shims['File'] | undefined;
|
29
|
+
export declare let ReadableStream: Shims['ReadableStream'] | undefined;
|
30
|
+
export declare let getMultipartRequestOptions: Shims['getMultipartRequestOptions'] | undefined;
|
31
|
+
export declare let getDefaultAgent: Shims['getDefaultAgent'] | undefined;
|
32
|
+
export declare let fileFromPath: Shims['fileFromPath'] | undefined;
|
33
|
+
export declare let isFsReadStream: Shims['isFsReadStream'] | undefined;
|
34
|
+
export declare function setShims(shims: Shims, options?: {
|
35
|
+
auto: boolean;
|
36
|
+
}): void;
|
37
|
+
//# sourceMappingURL=registry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/_shims/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,GAAG,CAAC;IACV,cAAc,EAAE,GAAG,CAAC;IACpB,0BAA0B,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtD,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,EACvB,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,KACpB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IACtC,YAAY,EACR,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAC3E,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC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
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setShims = exports.isFsReadStream = exports.fileFromPath = exports.getDefaultAgent = exports.getMultipartRequestOptions = exports.ReadableStream = exports.File = exports.Blob = exports.FormData = exports.Headers = exports.Response = exports.Request = exports.fetch = exports.kind = exports.auto = void 0;
|
4
|
+
exports.auto = false;
|
5
|
+
exports.kind = undefined;
|
6
|
+
exports.fetch = undefined;
|
7
|
+
exports.Request = undefined;
|
8
|
+
exports.Response = undefined;
|
9
|
+
exports.Headers = undefined;
|
10
|
+
exports.FormData = undefined;
|
11
|
+
exports.Blob = undefined;
|
12
|
+
exports.File = undefined;
|
13
|
+
exports.ReadableStream = undefined;
|
14
|
+
exports.getMultipartRequestOptions = undefined;
|
15
|
+
exports.getDefaultAgent = undefined;
|
16
|
+
exports.fileFromPath = undefined;
|
17
|
+
exports.isFsReadStream = undefined;
|
18
|
+
function setShims(shims, options = { auto: false }) {
|
19
|
+
if (exports.auto) {
|
20
|
+
throw new Error(`you must \`import '@mixedbread/sdk/shims/${shims.kind}'\` before importing anything else from @mixedbread/sdk`);
|
21
|
+
}
|
22
|
+
if (exports.kind) {
|
23
|
+
throw new Error(`can't \`import '@mixedbread/sdk/shims/${shims.kind}'\` after \`import '@mixedbread/sdk/shims/${exports.kind}'\``);
|
24
|
+
}
|
25
|
+
exports.auto = options.auto;
|
26
|
+
exports.kind = shims.kind;
|
27
|
+
exports.fetch = shims.fetch;
|
28
|
+
exports.Request = shims.Request;
|
29
|
+
exports.Response = shims.Response;
|
30
|
+
exports.Headers = shims.Headers;
|
31
|
+
exports.FormData = shims.FormData;
|
32
|
+
exports.Blob = shims.Blob;
|
33
|
+
exports.File = shims.File;
|
34
|
+
exports.ReadableStream = shims.ReadableStream;
|
35
|
+
exports.getMultipartRequestOptions = shims.getMultipartRequestOptions;
|
36
|
+
exports.getDefaultAgent = shims.getDefaultAgent;
|
37
|
+
exports.fileFromPath = shims.fileFromPath;
|
38
|
+
exports.isFsReadStream = shims.isFsReadStream;
|
39
|
+
}
|
40
|
+
exports.setShims = setShims;
|
41
|
+
//# sourceMappingURL=registry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/_shims/registry.ts"],"names":[],"mappings":";;;AA0BW,QAAA,IAAI,GAAG,KAAK,CAAC;AACb,QAAA,IAAI,GAA8B,SAAS,CAAC;AAC5C,QAAA,KAAK,GAA+B,SAAS,CAAC;AAC9C,QAAA,OAAO,GAAiC,SAAS,CAAC;AAClD,QAAA,QAAQ,GAAkC,SAAS,CAAC;AACpD,QAAA,OAAO,GAAiC,SAAS,CAAC;AAClD,QAAA,QAAQ,GAAkC,SAAS,CAAC;AACpD,QAAA,IAAI,GAA8B,SAAS,CAAC;AAC5C,QAAA,IAAI,GAA8B,SAAS,CAAC;AAC5C,QAAA,cAAc,GAAwC,SAAS,CAAC;AAChE,QAAA,0BAA0B,GAAoD,SAAS,CAAC;AACxF,QAAA,eAAe,GAAyC,SAAS,CAAC;AAClE,QAAA,YAAY,GAAsC,SAAS,CAAC;AAC5D,QAAA,cAAc,GAAwC,SAAS,CAAC;AAE3E,SAAgB,QAAQ,CAAC,KAAY,EAAE,UAA6B,EAAE,IAAI,EAAE,KAAK,EAAE;IACjF,IAAI,YAAI,EAAE;QACR,MAAM,IAAI,KAAK,CACb,4CAA4C,KAAK,CAAC,IAAI,yDAAyD,CAChH,CAAC;KACH;IACD,IAAI,YAAI,EAAE;QACR,MAAM,IAAI,KAAK,CACb,yCAAyC,KAAK,CAAC,IAAI,6CAA6C,YAAI,KAAK,CAC1G,CAAC;KACH;IACD,YAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACpB,YAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAClB,aAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IACpB,eAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACxB,gBAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC1B,eAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACxB,gBAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC1B,YAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAClB,YAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAClB,sBAAc,GAAG,KAAK,CAAC,cAAc,CAAC;IACtC,kCAA0B,GAAG,KAAK,CAAC,0BAA0B,CAAC;IAC9D,uBAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IACxC,oBAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAClC,sBAAc,GAAG,KAAK,CAAC,cAAc,CAAC;AACxC,CAAC;AAzBD,4BAyBC"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export let auto = false;
|
2
|
+
export let kind = undefined;
|
3
|
+
export let fetch = undefined;
|
4
|
+
export let Request = undefined;
|
5
|
+
export let Response = undefined;
|
6
|
+
export let Headers = undefined;
|
7
|
+
export let FormData = undefined;
|
8
|
+
export let Blob = undefined;
|
9
|
+
export let File = undefined;
|
10
|
+
export let ReadableStream = undefined;
|
11
|
+
export let getMultipartRequestOptions = undefined;
|
12
|
+
export let getDefaultAgent = undefined;
|
13
|
+
export let fileFromPath = undefined;
|
14
|
+
export let isFsReadStream = undefined;
|
15
|
+
export function setShims(shims, options = { auto: false }) {
|
16
|
+
if (auto) {
|
17
|
+
throw new Error(`you must \`import '@mixedbread/sdk/shims/${shims.kind}'\` before importing anything else from @mixedbread/sdk`);
|
18
|
+
}
|
19
|
+
if (kind) {
|
20
|
+
throw new Error(`can't \`import '@mixedbread/sdk/shims/${shims.kind}'\` after \`import '@mixedbread/sdk/shims/${kind}'\``);
|
21
|
+
}
|
22
|
+
auto = options.auto;
|
23
|
+
kind = shims.kind;
|
24
|
+
fetch = shims.fetch;
|
25
|
+
Request = shims.Request;
|
26
|
+
Response = shims.Response;
|
27
|
+
Headers = shims.Headers;
|
28
|
+
FormData = shims.FormData;
|
29
|
+
Blob = shims.Blob;
|
30
|
+
File = shims.File;
|
31
|
+
ReadableStream = shims.ReadableStream;
|
32
|
+
getMultipartRequestOptions = shims.getMultipartRequestOptions;
|
33
|
+
getDefaultAgent = shims.getDefaultAgent;
|
34
|
+
fileFromPath = shims.fileFromPath;
|
35
|
+
isFsReadStream = shims.isFsReadStream;
|
36
|
+
}
|
37
|
+
//# sourceMappingURL=registry.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"registry.mjs","sourceRoot":"","sources":["../src/_shims/registry.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,IAAI,IAAI,GAAG,KAAK,CAAC;AACxB,MAAM,CAAC,IAAI,IAAI,GAA8B,SAAS,CAAC;AACvD,MAAM,CAAC,IAAI,KAAK,GAA+B,SAAS,CAAC;AACzD,MAAM,CAAC,IAAI,OAAO,GAAiC,SAAS,CAAC;AAC7D,MAAM,CAAC,IAAI,QAAQ,GAAkC,SAAS,CAAC;AAC/D,MAAM,CAAC,IAAI,OAAO,GAAiC,SAAS,CAAC;AAC7D,MAAM,CAAC,IAAI,QAAQ,GAAkC,SAAS,CAAC;AAC/D,MAAM,CAAC,IAAI,IAAI,GAA8B,SAAS,CAAC;AACvD,MAAM,CAAC,IAAI,IAAI,GAA8B,SAAS,CAAC;AACvD,MAAM,CAAC,IAAI,cAAc,GAAwC,SAAS,CAAC;AAC3E,MAAM,CAAC,IAAI,0BAA0B,GAAoD,SAAS,CAAC;AACnG,MAAM,CAAC,IAAI,eAAe,GAAyC,SAAS,CAAC;AAC7E,MAAM,CAAC,IAAI,YAAY,GAAsC,SAAS,CAAC;AACvE,MAAM,CAAC,IAAI,cAAc,GAAwC,SAAS,CAAC;AAE3E,MAAM,UAAU,QAAQ,CAAC,KAAY,EAAE,UAA6B,EAAE,IAAI,EAAE,KAAK,EAAE;IACjF,IAAI,IAAI,EAAE;QACR,MAAM,IAAI,KAAK,CACb,4CAA4C,KAAK,CAAC,IAAI,yDAAyD,CAChH,CAAC;KACH;IACD,I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