@meistrari/tela-sdk-js 0.0.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -12
- package/dist/index.d.cts +2 -5
- package/dist/index.d.mts +2 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.mjs +1 -10
- package/package.json +13 -4
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const web = require('node:stream/web');
|
|
4
3
|
const changeCase = require('change-case');
|
|
5
4
|
const micromatch = require('micromatch');
|
|
6
|
-
const node_fs = require('node:fs');
|
|
7
|
-
const node_stream = require('node:stream');
|
|
8
5
|
|
|
9
6
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
10
7
|
|
|
@@ -23,7 +20,7 @@ function _interopNamespaceCompat(e) {
|
|
|
23
20
|
const changeCase__namespace = /*#__PURE__*/_interopNamespaceCompat(changeCase);
|
|
24
21
|
const micromatch__default = /*#__PURE__*/_interopDefaultCompat(micromatch);
|
|
25
22
|
|
|
26
|
-
const version = "0.0
|
|
23
|
+
const version = "1.0.0";
|
|
27
24
|
|
|
28
25
|
var __defProp$5 = Object.defineProperty;
|
|
29
26
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -460,7 +457,7 @@ class Stream {
|
|
|
460
457
|
const self = this;
|
|
461
458
|
let iter;
|
|
462
459
|
const encoder = new TextEncoder();
|
|
463
|
-
return new
|
|
460
|
+
return new ReadableStream({
|
|
464
461
|
async start() {
|
|
465
462
|
iter = self[Symbol.asyncIterator]();
|
|
466
463
|
},
|
|
@@ -1074,13 +1071,7 @@ class TelaFile {
|
|
|
1074
1071
|
type: "application/octet-stream"
|
|
1075
1072
|
});
|
|
1076
1073
|
}
|
|
1077
|
-
if (this._file instanceof
|
|
1078
|
-
const webStream = node_stream.Readable.toWeb(this._file);
|
|
1079
|
-
const [sizeStream, contentStream] = webStream.tee();
|
|
1080
|
-
this._size = await getStreamSize(sizeStream);
|
|
1081
|
-
return contentStream;
|
|
1082
|
-
}
|
|
1083
|
-
if (this._file instanceof web.ReadableStream) {
|
|
1074
|
+
if (this._file instanceof ReadableStream) {
|
|
1084
1075
|
const [sizeStream, contentStream] = this._file.tee();
|
|
1085
1076
|
this._size = await getStreamSize(sizeStream);
|
|
1086
1077
|
return contentStream;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { ReadStream } from 'node:fs';
|
|
2
|
-
import { ReadableStream } from 'node:stream/web';
|
|
3
|
-
|
|
4
1
|
type HTTPMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
5
2
|
type RequestOptions<Req = unknown | Record<string, unknown>> = {
|
|
6
3
|
method?: HTTPMethods;
|
|
@@ -141,7 +138,7 @@ type TelaFileOptions = {
|
|
|
141
138
|
* Represents the possible types for a file input,
|
|
142
139
|
* which can be a URL string, Uint8Array, ReadableStream, ReadStream, Blob, or File.
|
|
143
140
|
*/
|
|
144
|
-
type TelaFileInput = string | Uint8Array | ReadableStream |
|
|
141
|
+
type TelaFileInput = string | Uint8Array | ReadableStream | Blob | File;
|
|
145
142
|
/**
|
|
146
143
|
* Represents a file with support for various types including URLs, binary data, streams, and Blobs.
|
|
147
144
|
*
|
|
@@ -189,7 +186,7 @@ declare class TelaFile {
|
|
|
189
186
|
* @throws {InvalidFileURL} If the provided URL is not valid.
|
|
190
187
|
* @throws {EmptyFileError} If the provided file is empty.
|
|
191
188
|
*/
|
|
192
|
-
constructor(file: string | Uint8Array | ReadableStream |
|
|
189
|
+
constructor(file: string | Uint8Array | ReadableStream | Blob | File, options?: TelaFileOptions);
|
|
193
190
|
/**
|
|
194
191
|
* Retrieves the options provided during instantiation.
|
|
195
192
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { ReadStream } from 'node:fs';
|
|
2
|
-
import { ReadableStream } from 'node:stream/web';
|
|
3
|
-
|
|
4
1
|
type HTTPMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
5
2
|
type RequestOptions<Req = unknown | Record<string, unknown>> = {
|
|
6
3
|
method?: HTTPMethods;
|
|
@@ -141,7 +138,7 @@ type TelaFileOptions = {
|
|
|
141
138
|
* Represents the possible types for a file input,
|
|
142
139
|
* which can be a URL string, Uint8Array, ReadableStream, ReadStream, Blob, or File.
|
|
143
140
|
*/
|
|
144
|
-
type TelaFileInput = string | Uint8Array | ReadableStream |
|
|
141
|
+
type TelaFileInput = string | Uint8Array | ReadableStream | Blob | File;
|
|
145
142
|
/**
|
|
146
143
|
* Represents a file with support for various types including URLs, binary data, streams, and Blobs.
|
|
147
144
|
*
|
|
@@ -189,7 +186,7 @@ declare class TelaFile {
|
|
|
189
186
|
* @throws {InvalidFileURL} If the provided URL is not valid.
|
|
190
187
|
* @throws {EmptyFileError} If the provided file is empty.
|
|
191
188
|
*/
|
|
192
|
-
constructor(file: string | Uint8Array | ReadableStream |
|
|
189
|
+
constructor(file: string | Uint8Array | ReadableStream | Blob | File, options?: TelaFileOptions);
|
|
193
190
|
/**
|
|
194
191
|
* Retrieves the options provided during instantiation.
|
|
195
192
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { ReadStream } from 'node:fs';
|
|
2
|
-
import { ReadableStream } from 'node:stream/web';
|
|
3
|
-
|
|
4
1
|
type HTTPMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
5
2
|
type RequestOptions<Req = unknown | Record<string, unknown>> = {
|
|
6
3
|
method?: HTTPMethods;
|
|
@@ -141,7 +138,7 @@ type TelaFileOptions = {
|
|
|
141
138
|
* Represents the possible types for a file input,
|
|
142
139
|
* which can be a URL string, Uint8Array, ReadableStream, ReadStream, Blob, or File.
|
|
143
140
|
*/
|
|
144
|
-
type TelaFileInput = string | Uint8Array | ReadableStream |
|
|
141
|
+
type TelaFileInput = string | Uint8Array | ReadableStream | Blob | File;
|
|
145
142
|
/**
|
|
146
143
|
* Represents a file with support for various types including URLs, binary data, streams, and Blobs.
|
|
147
144
|
*
|
|
@@ -189,7 +186,7 @@ declare class TelaFile {
|
|
|
189
186
|
* @throws {InvalidFileURL} If the provided URL is not valid.
|
|
190
187
|
* @throws {EmptyFileError} If the provided file is empty.
|
|
191
188
|
*/
|
|
192
|
-
constructor(file: string | Uint8Array | ReadableStream |
|
|
189
|
+
constructor(file: string | Uint8Array | ReadableStream | Blob | File, options?: TelaFileOptions);
|
|
193
190
|
/**
|
|
194
191
|
* Retrieves the options provided during instantiation.
|
|
195
192
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { ReadableStream } from 'node:stream/web';
|
|
2
1
|
import * as changeCase from 'change-case';
|
|
3
2
|
import micromatch from 'micromatch';
|
|
4
|
-
import { ReadStream } from 'node:fs';
|
|
5
|
-
import { Readable } from 'node:stream';
|
|
6
3
|
|
|
7
|
-
const version = "0.0
|
|
4
|
+
const version = "1.0.0";
|
|
8
5
|
|
|
9
6
|
var __defProp$5 = Object.defineProperty;
|
|
10
7
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -1055,12 +1052,6 @@ class TelaFile {
|
|
|
1055
1052
|
type: "application/octet-stream"
|
|
1056
1053
|
});
|
|
1057
1054
|
}
|
|
1058
|
-
if (this._file instanceof ReadStream) {
|
|
1059
|
-
const webStream = Readable.toWeb(this._file);
|
|
1060
|
-
const [sizeStream, contentStream] = webStream.tee();
|
|
1061
|
-
this._size = await getStreamSize(sizeStream);
|
|
1062
|
-
return contentStream;
|
|
1063
|
-
}
|
|
1064
1055
|
if (this._file instanceof ReadableStream) {
|
|
1065
1056
|
const [sizeStream, contentStream] = this._file.tee();
|
|
1066
1057
|
this._size = await getStreamSize(sizeStream);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/tela-sdk-js",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,11 +26,15 @@
|
|
|
26
26
|
"prepublishOnly": "bun run build",
|
|
27
27
|
"release": "bunx bumpp & npm publish",
|
|
28
28
|
"build": "bunx unbuild",
|
|
29
|
-
"test": "
|
|
29
|
+
"test:default": "vitest run",
|
|
30
|
+
"test:browser": "vitest run --browser",
|
|
31
|
+
"test:bun": "bun test",
|
|
32
|
+
"test:all": "bun run test:default && bun run test:browser && bun run test:bun",
|
|
30
33
|
"lint": "eslint . --fix",
|
|
31
34
|
"lint:fix": "eslint . --fix",
|
|
32
35
|
"check": "eslint . --quiet && tsc --noEmit",
|
|
33
|
-
"prepack": "bun run build"
|
|
36
|
+
"prepack": "bun run build",
|
|
37
|
+
"postinstall": "bunx playwright install --with-deps chromium"
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
40
|
"change-case": "5.4.4",
|
|
@@ -38,12 +42,17 @@
|
|
|
38
42
|
},
|
|
39
43
|
"devDependencies": {
|
|
40
44
|
"@antfu/eslint-config": "3.0.0",
|
|
45
|
+
"@rollup/plugin-inject": "5.0.5",
|
|
41
46
|
"@types/bun": "latest",
|
|
42
47
|
"@types/micromatch": "4.0.9",
|
|
43
48
|
"@types/node": "22.5.5",
|
|
49
|
+
"@vitest/browser": "^3.0.8",
|
|
44
50
|
"husky": "9.1.6",
|
|
45
51
|
"lint-staged": "15.2.10",
|
|
46
|
-
"
|
|
52
|
+
"playwright": "1.51.0",
|
|
53
|
+
"unbuild": "2.0.0",
|
|
54
|
+
"unenv": "2.0.0-rc.14",
|
|
55
|
+
"vitest": "3.0.8"
|
|
47
56
|
},
|
|
48
57
|
"peerDependencies": {
|
|
49
58
|
"typescript": "5.6.0"
|