opik 0.0.8 → 0.0.9
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/README.md +77 -6
- package/dist/Client-BFXzOx36.d.cts +5603 -0
- package/dist/Client-BFXzOx36.d.ts +5603 -0
- package/dist/Node18UniversalStreamWrapper-GZXI7BSF.js +1 -0
- package/dist/NodePre18StreamWrapper-TZYQXHQT.js +1 -0
- package/dist/UndiciStreamWrapper-4QYH36IP.js +1 -0
- package/dist/chunk-37E5PSYD.js +4 -0
- package/dist/chunk-WOT6VMZA.js +1 -0
- package/dist/index.cjs +4 -12476
- package/dist/index.d.cts +30 -4629
- package/dist/index.d.ts +30 -4629
- package/dist/index.js +1 -11910
- package/dist/vercel/index.cjs +4 -0
- package/dist/vercel/index.d.cts +42 -0
- package/dist/vercel/index.d.ts +42 -0
- package/dist/vercel/index.js +1 -0
- package/package.json +26 -5
- package/dist/Node18UniversalStreamWrapper-5PLK6H2I.js +0 -216
- package/dist/Node18UniversalStreamWrapper-RYU62PI4.js +0 -220
- package/dist/NodePre18StreamWrapper-PJE27LW2.js +0 -88
- package/dist/NodePre18StreamWrapper-U7T7ZEM6.js +0 -90
- package/dist/UndiciStreamWrapper-E5ZREEPW.js +0 -208
- package/dist/UndiciStreamWrapper-M2WUKUR4.js +0 -204
- package/dist/chunk-MLKGABMK.js +0 -9
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import "./chunk-MLKGABMK.js";
|
|
2
|
-
|
|
3
|
-
// src/opik/rest_api/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts
|
|
4
|
-
var NodePre18StreamWrapper = class {
|
|
5
|
-
readableStream;
|
|
6
|
-
encoding;
|
|
7
|
-
constructor(readableStream) {
|
|
8
|
-
this.readableStream = readableStream;
|
|
9
|
-
}
|
|
10
|
-
on(event, callback) {
|
|
11
|
-
this.readableStream.on(event, callback);
|
|
12
|
-
}
|
|
13
|
-
off(event, callback) {
|
|
14
|
-
this.readableStream.off(event, callback);
|
|
15
|
-
}
|
|
16
|
-
pipe(dest) {
|
|
17
|
-
this.readableStream.pipe(dest);
|
|
18
|
-
return dest;
|
|
19
|
-
}
|
|
20
|
-
pipeTo(dest) {
|
|
21
|
-
return this.pipe(dest);
|
|
22
|
-
}
|
|
23
|
-
unpipe(dest) {
|
|
24
|
-
if (dest) {
|
|
25
|
-
this.readableStream.unpipe(dest);
|
|
26
|
-
} else {
|
|
27
|
-
this.readableStream.unpipe();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
destroy(error) {
|
|
31
|
-
this.readableStream.destroy(error);
|
|
32
|
-
}
|
|
33
|
-
pause() {
|
|
34
|
-
this.readableStream.pause();
|
|
35
|
-
}
|
|
36
|
-
resume() {
|
|
37
|
-
this.readableStream.resume();
|
|
38
|
-
}
|
|
39
|
-
get isPaused() {
|
|
40
|
-
return this.readableStream.isPaused();
|
|
41
|
-
}
|
|
42
|
-
async read() {
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
const chunk = this.readableStream.read();
|
|
45
|
-
if (chunk) {
|
|
46
|
-
resolve(chunk);
|
|
47
|
-
} else {
|
|
48
|
-
this.readableStream.once("readable", () => {
|
|
49
|
-
const chunk2 = this.readableStream.read();
|
|
50
|
-
resolve(chunk2);
|
|
51
|
-
});
|
|
52
|
-
this.readableStream.once("error", reject);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
setEncoding(encoding) {
|
|
57
|
-
this.readableStream.setEncoding(encoding);
|
|
58
|
-
this.encoding = encoding;
|
|
59
|
-
}
|
|
60
|
-
async text() {
|
|
61
|
-
const chunks = [];
|
|
62
|
-
const encoder = new TextEncoder();
|
|
63
|
-
this.readableStream.setEncoding(this.encoding || "utf-8");
|
|
64
|
-
for await (const chunk of this.readableStream) {
|
|
65
|
-
chunks.push(encoder.encode(chunk));
|
|
66
|
-
}
|
|
67
|
-
const decoder = new TextDecoder(this.encoding || "utf-8");
|
|
68
|
-
return decoder.decode(Buffer.concat(chunks));
|
|
69
|
-
}
|
|
70
|
-
async json() {
|
|
71
|
-
const text = await this.text();
|
|
72
|
-
return JSON.parse(text);
|
|
73
|
-
}
|
|
74
|
-
[Symbol.asyncIterator]() {
|
|
75
|
-
const readableStream = this.readableStream;
|
|
76
|
-
const iterator = readableStream[Symbol.asyncIterator]();
|
|
77
|
-
return {
|
|
78
|
-
async next() {
|
|
79
|
-
const { value, done } = await iterator.next();
|
|
80
|
-
return { value, done };
|
|
81
|
-
},
|
|
82
|
-
[Symbol.asyncIterator]() {
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
export {
|
|
89
|
-
NodePre18StreamWrapper
|
|
90
|
-
};
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import "./chunk-MLKGABMK.js";
|
|
2
|
-
|
|
3
|
-
// src/opik/rest_api/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts
|
|
4
|
-
var UndiciStreamWrapper = class _UndiciStreamWrapper {
|
|
5
|
-
readableStream;
|
|
6
|
-
reader;
|
|
7
|
-
events;
|
|
8
|
-
paused;
|
|
9
|
-
resumeCallback;
|
|
10
|
-
encoding;
|
|
11
|
-
constructor(readableStream) {
|
|
12
|
-
this.readableStream = readableStream;
|
|
13
|
-
this.reader = this.readableStream.getReader();
|
|
14
|
-
this.events = {
|
|
15
|
-
data: [],
|
|
16
|
-
end: [],
|
|
17
|
-
error: [],
|
|
18
|
-
readable: [],
|
|
19
|
-
close: [],
|
|
20
|
-
pause: [],
|
|
21
|
-
resume: []
|
|
22
|
-
};
|
|
23
|
-
this.paused = false;
|
|
24
|
-
this.resumeCallback = null;
|
|
25
|
-
this.encoding = null;
|
|
26
|
-
}
|
|
27
|
-
on(event, callback) {
|
|
28
|
-
this.events[event]?.push(callback);
|
|
29
|
-
}
|
|
30
|
-
off(event, callback) {
|
|
31
|
-
this.events[event] = this.events[event]?.filter((cb) => cb !== callback);
|
|
32
|
-
}
|
|
33
|
-
pipe(dest) {
|
|
34
|
-
this.on("data", (chunk) => {
|
|
35
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
36
|
-
dest._write(chunk);
|
|
37
|
-
} else {
|
|
38
|
-
const writer = dest.getWriter();
|
|
39
|
-
writer.write(chunk).then(() => writer.releaseLock());
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
this.on("end", () => {
|
|
43
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
44
|
-
dest._end();
|
|
45
|
-
} else {
|
|
46
|
-
const writer = dest.getWriter();
|
|
47
|
-
writer.close();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
this.on("error", (error) => {
|
|
51
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
52
|
-
dest._error(error);
|
|
53
|
-
} else {
|
|
54
|
-
const writer = dest.getWriter();
|
|
55
|
-
writer.abort(error);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
this._startReading();
|
|
59
|
-
return dest;
|
|
60
|
-
}
|
|
61
|
-
pipeTo(dest) {
|
|
62
|
-
return this.pipe(dest);
|
|
63
|
-
}
|
|
64
|
-
unpipe(dest) {
|
|
65
|
-
this.off("data", (chunk) => {
|
|
66
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
67
|
-
dest._write(chunk);
|
|
68
|
-
} else {
|
|
69
|
-
const writer = dest.getWriter();
|
|
70
|
-
writer.write(chunk).then(() => writer.releaseLock());
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
this.off("end", () => {
|
|
74
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
75
|
-
dest._end();
|
|
76
|
-
} else {
|
|
77
|
-
const writer = dest.getWriter();
|
|
78
|
-
writer.close();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
this.off("error", (error) => {
|
|
82
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
83
|
-
dest._error(error);
|
|
84
|
-
} else {
|
|
85
|
-
const writer = dest.getWriter();
|
|
86
|
-
writer.abort(error);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
destroy(error) {
|
|
91
|
-
this.reader.cancel(error).then(() => {
|
|
92
|
-
this._emit("close");
|
|
93
|
-
}).catch((err) => {
|
|
94
|
-
this._emit("error", err);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
pause() {
|
|
98
|
-
this.paused = true;
|
|
99
|
-
this._emit("pause");
|
|
100
|
-
}
|
|
101
|
-
resume() {
|
|
102
|
-
if (this.paused) {
|
|
103
|
-
this.paused = false;
|
|
104
|
-
this._emit("resume");
|
|
105
|
-
if (this.resumeCallback) {
|
|
106
|
-
this.resumeCallback();
|
|
107
|
-
this.resumeCallback = null;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
get isPaused() {
|
|
112
|
-
return this.paused;
|
|
113
|
-
}
|
|
114
|
-
async read() {
|
|
115
|
-
if (this.paused) {
|
|
116
|
-
await new Promise((resolve) => {
|
|
117
|
-
this.resumeCallback = resolve;
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
const { done, value } = await this.reader.read();
|
|
121
|
-
if (done) {
|
|
122
|
-
return void 0;
|
|
123
|
-
}
|
|
124
|
-
return value;
|
|
125
|
-
}
|
|
126
|
-
setEncoding(encoding) {
|
|
127
|
-
this.encoding = encoding;
|
|
128
|
-
}
|
|
129
|
-
async text() {
|
|
130
|
-
const chunks = [];
|
|
131
|
-
while (true) {
|
|
132
|
-
const { done, value } = await this.reader.read();
|
|
133
|
-
if (done) {
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
if (value) {
|
|
137
|
-
chunks.push(value);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
const decoder = new TextDecoder(this.encoding || "utf-8");
|
|
141
|
-
return decoder.decode(await new Blob(chunks).arrayBuffer());
|
|
142
|
-
}
|
|
143
|
-
async json() {
|
|
144
|
-
const text = await this.text();
|
|
145
|
-
return JSON.parse(text);
|
|
146
|
-
}
|
|
147
|
-
_write(chunk) {
|
|
148
|
-
this._emit("data", chunk);
|
|
149
|
-
}
|
|
150
|
-
_end() {
|
|
151
|
-
this._emit("end");
|
|
152
|
-
}
|
|
153
|
-
_error(error) {
|
|
154
|
-
this._emit("error", error);
|
|
155
|
-
}
|
|
156
|
-
_emit(event, data) {
|
|
157
|
-
if (this.events[event]) {
|
|
158
|
-
for (const callback of this.events[event] || []) {
|
|
159
|
-
callback(data);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
async _startReading() {
|
|
164
|
-
try {
|
|
165
|
-
this._emit("readable");
|
|
166
|
-
while (true) {
|
|
167
|
-
if (this.paused) {
|
|
168
|
-
await new Promise((resolve) => {
|
|
169
|
-
this.resumeCallback = resolve;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
const { done, value } = await this.reader.read();
|
|
173
|
-
if (done) {
|
|
174
|
-
this._emit("end");
|
|
175
|
-
this._emit("close");
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
if (value) {
|
|
179
|
-
this._emit("data", value);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
} catch (error) {
|
|
183
|
-
this._emit("error", error);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
[Symbol.asyncIterator]() {
|
|
187
|
-
return {
|
|
188
|
-
next: async () => {
|
|
189
|
-
if (this.paused) {
|
|
190
|
-
await new Promise((resolve) => {
|
|
191
|
-
this.resumeCallback = resolve;
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
const { done, value } = await this.reader.read();
|
|
195
|
-
if (done) {
|
|
196
|
-
return { done: true, value: void 0 };
|
|
197
|
-
}
|
|
198
|
-
return { done: false, value };
|
|
199
|
-
},
|
|
200
|
-
[Symbol.asyncIterator]() {
|
|
201
|
-
return this;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
export {
|
|
207
|
-
UndiciStreamWrapper
|
|
208
|
-
};
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import "./chunk-MLKGABMK.js";
|
|
2
|
-
|
|
3
|
-
// src/opik/rest_api/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts
|
|
4
|
-
var UndiciStreamWrapper = class _UndiciStreamWrapper {
|
|
5
|
-
constructor(readableStream) {
|
|
6
|
-
this.readableStream = readableStream;
|
|
7
|
-
this.reader = this.readableStream.getReader();
|
|
8
|
-
this.events = {
|
|
9
|
-
data: [],
|
|
10
|
-
end: [],
|
|
11
|
-
error: [],
|
|
12
|
-
readable: [],
|
|
13
|
-
close: [],
|
|
14
|
-
pause: [],
|
|
15
|
-
resume: []
|
|
16
|
-
};
|
|
17
|
-
this.paused = false;
|
|
18
|
-
this.resumeCallback = null;
|
|
19
|
-
this.encoding = null;
|
|
20
|
-
}
|
|
21
|
-
on(event, callback) {
|
|
22
|
-
var _a;
|
|
23
|
-
(_a = this.events[event]) == null ? void 0 : _a.push(callback);
|
|
24
|
-
}
|
|
25
|
-
off(event, callback) {
|
|
26
|
-
var _a;
|
|
27
|
-
this.events[event] = (_a = this.events[event]) == null ? void 0 : _a.filter((cb) => cb !== callback);
|
|
28
|
-
}
|
|
29
|
-
pipe(dest) {
|
|
30
|
-
this.on("data", (chunk) => {
|
|
31
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
32
|
-
dest._write(chunk);
|
|
33
|
-
} else {
|
|
34
|
-
const writer = dest.getWriter();
|
|
35
|
-
writer.write(chunk).then(() => writer.releaseLock());
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
this.on("end", () => {
|
|
39
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
40
|
-
dest._end();
|
|
41
|
-
} else {
|
|
42
|
-
const writer = dest.getWriter();
|
|
43
|
-
writer.close();
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
this.on("error", (error) => {
|
|
47
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
48
|
-
dest._error(error);
|
|
49
|
-
} else {
|
|
50
|
-
const writer = dest.getWriter();
|
|
51
|
-
writer.abort(error);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
this._startReading();
|
|
55
|
-
return dest;
|
|
56
|
-
}
|
|
57
|
-
pipeTo(dest) {
|
|
58
|
-
return this.pipe(dest);
|
|
59
|
-
}
|
|
60
|
-
unpipe(dest) {
|
|
61
|
-
this.off("data", (chunk) => {
|
|
62
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
63
|
-
dest._write(chunk);
|
|
64
|
-
} else {
|
|
65
|
-
const writer = dest.getWriter();
|
|
66
|
-
writer.write(chunk).then(() => writer.releaseLock());
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
this.off("end", () => {
|
|
70
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
71
|
-
dest._end();
|
|
72
|
-
} else {
|
|
73
|
-
const writer = dest.getWriter();
|
|
74
|
-
writer.close();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
this.off("error", (error) => {
|
|
78
|
-
if (dest instanceof _UndiciStreamWrapper) {
|
|
79
|
-
dest._error(error);
|
|
80
|
-
} else {
|
|
81
|
-
const writer = dest.getWriter();
|
|
82
|
-
writer.abort(error);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
destroy(error) {
|
|
87
|
-
this.reader.cancel(error).then(() => {
|
|
88
|
-
this._emit("close");
|
|
89
|
-
}).catch((err) => {
|
|
90
|
-
this._emit("error", err);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
pause() {
|
|
94
|
-
this.paused = true;
|
|
95
|
-
this._emit("pause");
|
|
96
|
-
}
|
|
97
|
-
resume() {
|
|
98
|
-
if (this.paused) {
|
|
99
|
-
this.paused = false;
|
|
100
|
-
this._emit("resume");
|
|
101
|
-
if (this.resumeCallback) {
|
|
102
|
-
this.resumeCallback();
|
|
103
|
-
this.resumeCallback = null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
get isPaused() {
|
|
108
|
-
return this.paused;
|
|
109
|
-
}
|
|
110
|
-
async read() {
|
|
111
|
-
if (this.paused) {
|
|
112
|
-
await new Promise((resolve) => {
|
|
113
|
-
this.resumeCallback = resolve;
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
const { done, value } = await this.reader.read();
|
|
117
|
-
if (done) {
|
|
118
|
-
return void 0;
|
|
119
|
-
}
|
|
120
|
-
return value;
|
|
121
|
-
}
|
|
122
|
-
setEncoding(encoding) {
|
|
123
|
-
this.encoding = encoding;
|
|
124
|
-
}
|
|
125
|
-
async text() {
|
|
126
|
-
const chunks = [];
|
|
127
|
-
while (true) {
|
|
128
|
-
const { done, value } = await this.reader.read();
|
|
129
|
-
if (done) {
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
if (value) {
|
|
133
|
-
chunks.push(value);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const decoder = new TextDecoder(this.encoding || "utf-8");
|
|
137
|
-
return decoder.decode(await new Blob(chunks).arrayBuffer());
|
|
138
|
-
}
|
|
139
|
-
async json() {
|
|
140
|
-
const text = await this.text();
|
|
141
|
-
return JSON.parse(text);
|
|
142
|
-
}
|
|
143
|
-
_write(chunk) {
|
|
144
|
-
this._emit("data", chunk);
|
|
145
|
-
}
|
|
146
|
-
_end() {
|
|
147
|
-
this._emit("end");
|
|
148
|
-
}
|
|
149
|
-
_error(error) {
|
|
150
|
-
this._emit("error", error);
|
|
151
|
-
}
|
|
152
|
-
_emit(event, data) {
|
|
153
|
-
if (this.events[event]) {
|
|
154
|
-
for (const callback of this.events[event] || []) {
|
|
155
|
-
callback(data);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async _startReading() {
|
|
160
|
-
try {
|
|
161
|
-
this._emit("readable");
|
|
162
|
-
while (true) {
|
|
163
|
-
if (this.paused) {
|
|
164
|
-
await new Promise((resolve) => {
|
|
165
|
-
this.resumeCallback = resolve;
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
const { done, value } = await this.reader.read();
|
|
169
|
-
if (done) {
|
|
170
|
-
this._emit("end");
|
|
171
|
-
this._emit("close");
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
if (value) {
|
|
175
|
-
this._emit("data", value);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
} catch (error) {
|
|
179
|
-
this._emit("error", error);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
[Symbol.asyncIterator]() {
|
|
183
|
-
return {
|
|
184
|
-
next: async () => {
|
|
185
|
-
if (this.paused) {
|
|
186
|
-
await new Promise((resolve) => {
|
|
187
|
-
this.resumeCallback = resolve;
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
const { done, value } = await this.reader.read();
|
|
191
|
-
if (done) {
|
|
192
|
-
return { done: true, value: void 0 };
|
|
193
|
-
}
|
|
194
|
-
return { done: false, value };
|
|
195
|
-
},
|
|
196
|
-
[Symbol.asyncIterator]() {
|
|
197
|
-
return this;
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
export {
|
|
203
|
-
UndiciStreamWrapper
|
|
204
|
-
};
|