@lorikeetai/node-sdk 0.1.0-alpha.2 → 0.1.0-alpha.7
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 +58 -0
- package/README.md +26 -21
- package/_shims/MultipartBody.js.map +1 -1
- package/_shims/MultipartBody.mjs.map +1 -1
- package/_shims/auto/runtime-bun.d.ts.map +1 -1
- package/_shims/auto/runtime-bun.js.map +1 -1
- package/_shims/auto/runtime-node.d.ts.map +1 -1
- package/_shims/auto/runtime-node.js.map +1 -1
- package/_shims/auto/runtime.d.ts.map +1 -1
- package/_shims/auto/runtime.js.map +1 -1
- package/_shims/auto/types-node.d.ts.map +1 -1
- package/_shims/auto/types-node.js.map +1 -1
- package/_shims/auto/types.d.ts +52 -52
- package/_shims/bun-runtime.d.ts.map +1 -1
- package/_shims/bun-runtime.js +1 -2
- package/_shims/bun-runtime.js.map +1 -1
- package/_shims/bun-runtime.mjs.map +1 -1
- package/_shims/index.d.ts +36 -36
- package/_shims/index.js +5 -5
- package/_shims/index.mjs +4 -4
- package/_shims/node-runtime.d.ts.map +1 -1
- package/_shims/node-runtime.js +1 -2
- package/_shims/node-runtime.js.map +1 -1
- package/_shims/node-runtime.mjs.map +1 -1
- package/_shims/node-types.d.ts +27 -27
- package/_shims/registry.d.ts.map +1 -1
- package/_shims/registry.js +2 -2
- package/_shims/registry.js.map +1 -1
- package/_shims/registry.mjs.map +1 -1
- package/_shims/web-runtime.d.ts.map +1 -1
- package/_shims/web-runtime.js +1 -2
- package/_shims/web-runtime.js.map +1 -1
- package/_shims/web-runtime.mjs.map +1 -1
- package/_shims/web-types.d.ts +52 -52
- package/core.d.ts +2 -4
- package/core.d.ts.map +1 -1
- package/core.js +7 -6
- package/core.js.map +1 -1
- package/core.mjs +2 -1
- package/core.mjs.map +1 -1
- package/error.d.ts.map +1 -1
- package/error.js.map +1 -1
- package/error.mjs.map +1 -1
- package/index.d.mts +1 -5
- package/index.d.ts +1 -5
- package/index.d.ts.map +1 -1
- package/index.js +4 -14
- package/index.js.map +1 -1
- package/index.mjs +3 -13
- package/index.mjs.map +1 -1
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/formats.js.map +1 -1
- package/internal/qs/formats.mjs.map +1 -1
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/index.js.map +1 -1
- package/internal/qs/index.mjs.map +1 -1
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.js +1 -2
- package/internal/qs/stringify.js.map +1 -1
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/types.d.ts.map +1 -1
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.js +9 -9
- package/internal/qs/utils.js.map +1 -1
- package/internal/qs/utils.mjs.map +1 -1
- package/lib/generate-signature.d.ts +5 -0
- package/lib/generate-signature.d.ts.map +1 -0
- package/lib/generate-signature.js +19 -0
- package/lib/generate-signature.js.map +1 -0
- package/lib/generate-signature.mjs +13 -0
- package/lib/generate-signature.mjs.map +1 -0
- package/package.json +15 -13
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/conversation/chat.d.ts +53 -33
- package/resources/conversation/chat.d.ts.map +1 -1
- package/resources/conversation/chat.js +6 -15
- package/resources/conversation/chat.js.map +1 -1
- package/resources/conversation/chat.mjs +5 -14
- package/resources/conversation/chat.mjs.map +1 -1
- package/resources/conversation/conversation.d.ts +3 -1
- package/resources/conversation/conversation.d.ts.map +1 -1
- package/resources/conversation/conversation.js +1 -1
- package/resources/conversation/conversation.js.map +1 -1
- package/resources/conversation/conversation.mjs.map +1 -1
- package/resources/conversation/index.d.ts +1 -1
- package/resources/conversation/index.d.ts.map +1 -1
- package/resources/conversation/index.js +3 -3
- package/resources/conversation/index.js.map +1 -1
- package/resources/conversation/index.mjs +1 -1
- package/resources/conversation/index.mjs.map +1 -1
- package/resources/conversation.d.ts.map +1 -1
- package/resources/conversation.js.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/ingest.d.ts +1 -34
- package/resources/ingest.d.ts.map +1 -1
- package/resources/ingest.js +2 -15
- package/resources/ingest.js.map +1 -1
- package/resources/ingest.mjs +2 -15
- package/resources/ingest.mjs.map +1 -1
- package/resources/token.d.ts +0 -4
- package/resources/token.d.ts.map +1 -1
- package/resources/token.js +1 -5
- package/resources/token.js.map +1 -1
- package/resources/token.mjs +0 -4
- package/resources/token.mjs.map +1 -1
- package/shims/node.d.ts +0 -4
- package/shims/node.d.ts.map +1 -1
- package/shims/node.js +0 -25
- package/shims/node.js.map +1 -1
- package/shims/node.mjs +0 -1
- package/shims/node.mjs.map +1 -1
- package/shims/web.d.ts.map +1 -1
- package/shims/web.js +0 -25
- package/shims/web.js.map +1 -1
- package/shims/web.mjs +0 -1
- package/shims/web.mjs.map +1 -1
- package/src/_shims/MultipartBody.ts +1 -1
- package/src/_shims/auto/runtime-bun.ts +1 -1
- package/src/_shims/auto/runtime-node.ts +1 -1
- package/src/_shims/auto/runtime.ts +1 -1
- package/src/_shims/auto/types-node.ts +1 -1
- package/src/_shims/auto/types.d.ts +52 -52
- package/src/_shims/bun-runtime.ts +6 -6
- package/src/_shims/index.d.ts +36 -36
- package/src/_shims/index.js +5 -5
- package/src/_shims/index.mjs +4 -4
- package/src/_shims/node-runtime.ts +32 -32
- package/src/_shims/node-types.d.ts +27 -27
- package/src/_shims/registry.ts +44 -44
- package/src/_shims/web-runtime.ts +16 -16
- package/src/_shims/web-types.d.ts +52 -52
- package/src/core.ts +373 -373
- package/src/error.ts +37 -37
- package/src/index.ts +61 -78
- package/src/internal/qs/formats.ts +5 -5
- package/src/internal/qs/index.ts +5 -5
- package/src/internal/qs/stringify.ts +98 -98
- package/src/internal/qs/types.ts +52 -52
- package/src/internal/qs/utils.ts +87 -87
- package/src/lib/generate-signature.ts +13 -0
- package/src/resource.ts +3 -3
- package/src/resources/conversation/chat.ts +70 -51
- package/src/resources/conversation/conversation.ts +10 -8
- package/src/resources/conversation/index.ts +10 -2
- package/src/resources/conversation.ts +1 -1
- package/src/resources/index.ts +3 -3
- package/src/resources/ingest.ts +5 -55
- package/src/resources/token.ts +9 -13
- package/src/shims/node.ts +24 -24
- package/src/shims/web.ts +24 -24
- package/src/uploads.ts +75 -74
- package/src/version.ts +1 -1
- package/uploads.d.ts +2 -2
- package/uploads.d.ts.map +1 -1
- package/uploads.js +3 -4
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -2
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/pets.d.ts +0 -157
- package/resources/pets.d.ts.map +0 -1
- package/resources/pets.js +0 -75
- package/resources/pets.js.map +0 -1
- package/resources/pets.mjs +0 -71
- package/resources/pets.mjs.map +0 -1
- package/resources/shared.d.ts +0 -12
- package/resources/shared.d.ts.map +0 -1
- package/resources/shared.js +0 -4
- package/resources/shared.js.map +0 -1
- package/resources/shared.mjs +0 -3
- package/resources/shared.mjs.map +0 -1
- package/resources/store/index.d.ts +0 -3
- package/resources/store/index.d.ts.map +0 -1
- package/resources/store/index.js +0 -9
- package/resources/store/index.js.map +0 -1
- package/resources/store/index.mjs +0 -4
- package/resources/store/index.mjs.map +0 -1
- package/resources/store/order.d.ts +0 -16
- package/resources/store/order.d.ts.map +0 -1
- package/resources/store/order.js +0 -26
- package/resources/store/order.js.map +0 -1
- package/resources/store/order.mjs +0 -22
- package/resources/store/order.mjs.map +0 -1
- package/resources/store/store.d.ts +0 -35
- package/resources/store/store.d.ts.map +0 -1
- package/resources/store/store.js +0 -53
- package/resources/store/store.js.map +0 -1
- package/resources/store/store.mjs +0 -26
- package/resources/store/store.mjs.map +0 -1
- package/resources/user.d.ts +0 -96
- package/resources/user.d.ts.map +0 -1
- package/resources/user.js +0 -65
- package/resources/user.js.map +0 -1
- package/resources/user.mjs +0 -61
- package/resources/user.mjs.map +0 -1
- package/src/resources/pets.ts +0 -276
- package/src/resources/shared.ts +0 -18
- package/src/resources/store/index.ts +0 -4
- package/src/resources/store/order.ts +0 -26
- package/src/resources/store/store.ts +0 -59
- package/src/resources/user.ts +0 -185
package/src/resources/token.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '../resource'
|
|
4
|
-
import * as Core from '../core'
|
|
5
|
-
import * as TokenAPI from './token'
|
|
3
|
+
import { APIResource } from '../resource'
|
|
4
|
+
import * as Core from '../core'
|
|
5
|
+
import * as TokenAPI from './token'
|
|
6
6
|
|
|
7
7
|
export class Token extends APIResource {
|
|
8
|
-
/**
|
|
9
|
-
* Create a signed JWT so that we can associate customer data with a user account
|
|
10
|
-
* securely.
|
|
11
|
-
*/
|
|
12
8
|
create(body: TokenCreateParams, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
13
9
|
return this._client.post('/ingest/token', {
|
|
14
10
|
body,
|
|
15
11
|
...options,
|
|
16
12
|
headers: { Accept: '*/*', ...options?.headers },
|
|
17
|
-
})
|
|
13
|
+
})
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
|
|
@@ -22,24 +18,24 @@ export interface TokenCreateParams {
|
|
|
22
18
|
/**
|
|
23
19
|
* The email of the user.
|
|
24
20
|
*/
|
|
25
|
-
email: string
|
|
21
|
+
email: string
|
|
26
22
|
|
|
27
23
|
/**
|
|
28
24
|
* The first name of the user.
|
|
29
25
|
*/
|
|
30
|
-
firstName: string
|
|
26
|
+
firstName: string
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* The last name of the user.
|
|
34
30
|
*/
|
|
35
|
-
lastName: string
|
|
31
|
+
lastName: string
|
|
36
32
|
|
|
37
33
|
/**
|
|
38
34
|
* The unique identifier of the user in your system.
|
|
39
35
|
*/
|
|
40
|
-
remoteId: string
|
|
36
|
+
remoteId: string
|
|
41
37
|
}
|
|
42
38
|
|
|
43
39
|
export namespace Token {
|
|
44
|
-
export import TokenCreateParams = TokenAPI.TokenCreateParams
|
|
40
|
+
export import TokenCreateParams = TokenAPI.TokenCreateParams
|
|
45
41
|
}
|
package/src/shims/node.ts
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
import * as types from '../_shims/node-types'
|
|
3
|
-
import { setShims } from '../_shims/registry'
|
|
4
|
-
import { getRuntime } from '../_shims/node-runtime'
|
|
5
|
-
setShims(getRuntime())
|
|
2
|
+
import * as types from '../_shims/node-types'
|
|
3
|
+
import { setShims } from '../_shims/registry'
|
|
4
|
+
import { getRuntime } from '../_shims/node-runtime'
|
|
5
|
+
setShims(getRuntime())
|
|
6
6
|
|
|
7
7
|
declare module '../_shims/manual-types' {
|
|
8
8
|
export namespace manual {
|
|
9
9
|
// @ts-ignore
|
|
10
|
-
export type Agent = types.Agent
|
|
10
|
+
export type Agent = types.Agent
|
|
11
11
|
// @ts-ignore
|
|
12
|
-
export import fetch = types.fetch
|
|
12
|
+
export import fetch = types.fetch
|
|
13
13
|
// @ts-ignore
|
|
14
|
-
export type Request = types.Request
|
|
14
|
+
export type Request = types.Request
|
|
15
15
|
// @ts-ignore
|
|
16
|
-
export type RequestInfo = types.RequestInfo
|
|
16
|
+
export type RequestInfo = types.RequestInfo
|
|
17
17
|
// @ts-ignore
|
|
18
|
-
export type RequestInit = types.RequestInit
|
|
18
|
+
export type RequestInit = types.RequestInit
|
|
19
19
|
// @ts-ignore
|
|
20
|
-
export type Response = types.Response
|
|
20
|
+
export type Response = types.Response
|
|
21
21
|
// @ts-ignore
|
|
22
|
-
export type ResponseInit = types.ResponseInit
|
|
22
|
+
export type ResponseInit = types.ResponseInit
|
|
23
23
|
// @ts-ignore
|
|
24
|
-
export type ResponseType = types.ResponseType
|
|
24
|
+
export type ResponseType = types.ResponseType
|
|
25
25
|
// @ts-ignore
|
|
26
|
-
export type BodyInit = types.BodyInit
|
|
26
|
+
export type BodyInit = types.BodyInit
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
export type Headers = types.Headers
|
|
28
|
+
export type Headers = types.Headers
|
|
29
29
|
// @ts-ignore
|
|
30
|
-
export type HeadersInit = types.HeadersInit
|
|
30
|
+
export type HeadersInit = types.HeadersInit
|
|
31
31
|
// @ts-ignore
|
|
32
|
-
export type BlobPropertyBag = types.BlobPropertyBag
|
|
32
|
+
export type BlobPropertyBag = types.BlobPropertyBag
|
|
33
33
|
// @ts-ignore
|
|
34
|
-
export type FilePropertyBag = types.FilePropertyBag
|
|
34
|
+
export type FilePropertyBag = types.FilePropertyBag
|
|
35
35
|
// @ts-ignore
|
|
36
|
-
export type FileFromPathOptions = types.FileFromPathOptions
|
|
36
|
+
export type FileFromPathOptions = types.FileFromPathOptions
|
|
37
37
|
// @ts-ignore
|
|
38
|
-
export import FormData = types.FormData
|
|
38
|
+
export import FormData = types.FormData
|
|
39
39
|
// @ts-ignore
|
|
40
|
-
export import File = types.File
|
|
40
|
+
export import File = types.File
|
|
41
41
|
// @ts-ignore
|
|
42
|
-
export import Blob = types.Blob
|
|
42
|
+
export import Blob = types.Blob
|
|
43
43
|
// @ts-ignore
|
|
44
|
-
export type Readable = types.Readable
|
|
44
|
+
export type Readable = types.Readable
|
|
45
45
|
// @ts-ignore
|
|
46
|
-
export type FsReadStream = types.FsReadStream
|
|
46
|
+
export type FsReadStream = types.FsReadStream
|
|
47
47
|
// @ts-ignore
|
|
48
|
-
export import ReadableStream = types.ReadableStream
|
|
48
|
+
export import ReadableStream = types.ReadableStream
|
|
49
49
|
}
|
|
50
50
|
}
|
package/src/shims/web.ts
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
import * as types from '../_shims/web-types'
|
|
3
|
-
import { setShims } from '../_shims/registry'
|
|
4
|
-
import { getRuntime } from '../_shims/web-runtime'
|
|
5
|
-
setShims(getRuntime({ manuallyImported: true }))
|
|
2
|
+
import * as types from '../_shims/web-types'
|
|
3
|
+
import { setShims } from '../_shims/registry'
|
|
4
|
+
import { getRuntime } from '../_shims/web-runtime'
|
|
5
|
+
setShims(getRuntime({ manuallyImported: true }))
|
|
6
6
|
|
|
7
7
|
declare module '../_shims/manual-types' {
|
|
8
8
|
export namespace manual {
|
|
9
9
|
// @ts-ignore
|
|
10
|
-
export type Agent = types.Agent
|
|
10
|
+
export type Agent = types.Agent
|
|
11
11
|
// @ts-ignore
|
|
12
|
-
export import fetch = types.fetch
|
|
12
|
+
export import fetch = types.fetch
|
|
13
13
|
// @ts-ignore
|
|
14
|
-
export type Request = types.Request
|
|
14
|
+
export type Request = types.Request
|
|
15
15
|
// @ts-ignore
|
|
16
|
-
export type RequestInfo = types.RequestInfo
|
|
16
|
+
export type RequestInfo = types.RequestInfo
|
|
17
17
|
// @ts-ignore
|
|
18
|
-
export type RequestInit = types.RequestInit
|
|
18
|
+
export type RequestInit = types.RequestInit
|
|
19
19
|
// @ts-ignore
|
|
20
|
-
export type Response = types.Response
|
|
20
|
+
export type Response = types.Response
|
|
21
21
|
// @ts-ignore
|
|
22
|
-
export type ResponseInit = types.ResponseInit
|
|
22
|
+
export type ResponseInit = types.ResponseInit
|
|
23
23
|
// @ts-ignore
|
|
24
|
-
export type ResponseType = types.ResponseType
|
|
24
|
+
export type ResponseType = types.ResponseType
|
|
25
25
|
// @ts-ignore
|
|
26
|
-
export type BodyInit = types.BodyInit
|
|
26
|
+
export type BodyInit = types.BodyInit
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
export type Headers = types.Headers
|
|
28
|
+
export type Headers = types.Headers
|
|
29
29
|
// @ts-ignore
|
|
30
|
-
export type HeadersInit = types.HeadersInit
|
|
30
|
+
export type HeadersInit = types.HeadersInit
|
|
31
31
|
// @ts-ignore
|
|
32
|
-
export type BlobPropertyBag = types.BlobPropertyBag
|
|
32
|
+
export type BlobPropertyBag = types.BlobPropertyBag
|
|
33
33
|
// @ts-ignore
|
|
34
|
-
export type FilePropertyBag = types.FilePropertyBag
|
|
34
|
+
export type FilePropertyBag = types.FilePropertyBag
|
|
35
35
|
// @ts-ignore
|
|
36
|
-
export type FileFromPathOptions = types.FileFromPathOptions
|
|
36
|
+
export type FileFromPathOptions = types.FileFromPathOptions
|
|
37
37
|
// @ts-ignore
|
|
38
|
-
export import FormData = types.FormData
|
|
38
|
+
export import FormData = types.FormData
|
|
39
39
|
// @ts-ignore
|
|
40
|
-
export import File = types.File
|
|
40
|
+
export import File = types.File
|
|
41
41
|
// @ts-ignore
|
|
42
|
-
export import Blob = types.Blob
|
|
42
|
+
export import Blob = types.Blob
|
|
43
43
|
// @ts-ignore
|
|
44
|
-
export type Readable = types.Readable
|
|
44
|
+
export type Readable = types.Readable
|
|
45
45
|
// @ts-ignore
|
|
46
|
-
export type FsReadStream = types.FsReadStream
|
|
46
|
+
export type FsReadStream = types.FsReadStream
|
|
47
47
|
// @ts-ignore
|
|
48
|
-
export import ReadableStream = types.ReadableStream
|
|
48
|
+
export import ReadableStream = types.ReadableStream
|
|
49
49
|
}
|
|
50
50
|
}
|
package/src/uploads.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RequestOptions } from './core'
|
|
1
|
+
import { type RequestOptions } from './core'
|
|
2
2
|
import {
|
|
3
3
|
FormData,
|
|
4
4
|
File,
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
getMultipartRequestOptions,
|
|
8
8
|
type FsReadStream,
|
|
9
9
|
isFsReadStream,
|
|
10
|
-
} from './_shims/index'
|
|
11
|
-
import { MultipartBody } from './_shims/MultipartBody'
|
|
12
|
-
export { fileFromPath } from './_shims/index'
|
|
10
|
+
} from './_shims/index'
|
|
11
|
+
import { MultipartBody } from './_shims/MultipartBody'
|
|
12
|
+
export { fileFromPath } from './_shims/index'
|
|
13
13
|
|
|
14
|
-
type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView
|
|
15
|
-
export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Array | DataView
|
|
14
|
+
type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView
|
|
15
|
+
export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Array | DataView
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Typically, this is a native "File" class.
|
|
@@ -23,20 +23,20 @@ export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Arra
|
|
|
23
23
|
* For convenience, you can also pass a fetch Response, or in Node,
|
|
24
24
|
* the result of fs.createReadStream().
|
|
25
25
|
*/
|
|
26
|
-
export type Uploadable = FileLike | ResponseLike | FsReadStream
|
|
26
|
+
export type Uploadable = FileLike | ResponseLike | FsReadStream
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
|
|
30
30
|
*/
|
|
31
31
|
export interface BlobLike {
|
|
32
32
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
|
|
33
|
-
readonly size: number
|
|
33
|
+
readonly size: number
|
|
34
34
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
|
|
35
|
-
readonly type: string
|
|
35
|
+
readonly type: string
|
|
36
36
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
37
|
-
text(): Promise<string
|
|
37
|
+
text(): Promise<string>
|
|
38
38
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
39
|
-
slice(start?: number, end?: number): BlobLike
|
|
39
|
+
slice(start?: number, end?: number): BlobLike
|
|
40
40
|
// unfortunately @types/node-fetch@^2.6.4 doesn't type the arrayBuffer method
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -45,31 +45,31 @@ export interface BlobLike {
|
|
|
45
45
|
*/
|
|
46
46
|
export interface FileLike extends BlobLike {
|
|
47
47
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
|
|
48
|
-
readonly lastModified: number
|
|
48
|
+
readonly lastModified: number
|
|
49
49
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
|
|
50
|
-
readonly name: string
|
|
50
|
+
readonly name: string
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Intended to match web.Response, node.Response, node-fetch.Response, etc.
|
|
55
55
|
*/
|
|
56
56
|
export interface ResponseLike {
|
|
57
|
-
url: string
|
|
58
|
-
blob(): Promise<BlobLike
|
|
57
|
+
url: string
|
|
58
|
+
blob(): Promise<BlobLike>
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export const isResponseLike = (value: any): value is ResponseLike =>
|
|
62
62
|
value != null &&
|
|
63
63
|
typeof value === 'object' &&
|
|
64
64
|
typeof value.url === 'string' &&
|
|
65
|
-
typeof value.blob === 'function'
|
|
65
|
+
typeof value.blob === 'function'
|
|
66
66
|
|
|
67
67
|
export const isFileLike = (value: any): value is FileLike =>
|
|
68
68
|
value != null &&
|
|
69
69
|
typeof value === 'object' &&
|
|
70
70
|
typeof value.name === 'string' &&
|
|
71
71
|
typeof value.lastModified === 'number' &&
|
|
72
|
-
isBlobLike(value)
|
|
72
|
+
isBlobLike(value)
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* The BlobLike type omits arrayBuffer() because @types/node-fetch@^2.6.4 lacks it; but this check
|
|
@@ -82,13 +82,13 @@ export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Pro
|
|
|
82
82
|
typeof value.type === 'string' &&
|
|
83
83
|
typeof value.text === 'function' &&
|
|
84
84
|
typeof value.slice === 'function' &&
|
|
85
|
-
typeof value.arrayBuffer === 'function'
|
|
85
|
+
typeof value.arrayBuffer === 'function'
|
|
86
86
|
|
|
87
87
|
export const isUploadable = (value: any): value is Uploadable => {
|
|
88
|
-
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value)
|
|
89
|
-
}
|
|
88
|
+
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value)
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
export type ToFileInput = Uploadable | Exclude<BlobLikePart, string> | AsyncIterable<BlobLikePart
|
|
91
|
+
export type ToFileInput = Uploadable | Exclude<BlobLikePart, string> | AsyncIterable<BlobLikePart>
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
@@ -105,68 +105,69 @@ export async function toFile(
|
|
|
105
105
|
options?: FilePropertyBag | undefined,
|
|
106
106
|
): Promise<FileLike> {
|
|
107
107
|
// If it's a promise, resolve it.
|
|
108
|
-
value = await value
|
|
108
|
+
value = await value
|
|
109
109
|
|
|
110
110
|
// If we've been given a `File` we don't need to do anything
|
|
111
111
|
if (isFileLike(value)) {
|
|
112
|
-
return value
|
|
112
|
+
return value
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
if (isResponseLike(value)) {
|
|
116
|
-
const blob = await value.blob()
|
|
117
|
-
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file'
|
|
116
|
+
const blob = await value.blob()
|
|
117
|
+
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file'
|
|
118
118
|
|
|
119
119
|
// we need to convert the `Blob` into an array buffer because the `Blob` class
|
|
120
120
|
// that `node-fetch` defines is incompatible with the web standard which results
|
|
121
121
|
// in `new File` interpreting it as a string instead of binary data.
|
|
122
|
-
const data = isBlobLike(blob) ? [(await blob.arrayBuffer()) as any] : [blob]
|
|
122
|
+
const data = isBlobLike(blob) ? [(await blob.arrayBuffer()) as any] : [blob]
|
|
123
123
|
|
|
124
|
-
return new File(data, name, options)
|
|
124
|
+
return new File(data, name, options)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
const bits = await getBytes(value)
|
|
127
|
+
const bits = await getBytes(value)
|
|
128
128
|
|
|
129
|
-
name ||= getName(value) ?? 'unknown_file'
|
|
129
|
+
name ||= getName(value) ?? 'unknown_file'
|
|
130
130
|
|
|
131
131
|
if (!options?.type) {
|
|
132
|
-
const type = (bits[0] as any)?.type
|
|
132
|
+
const type = (bits[0] as any)?.type
|
|
133
133
|
if (typeof type === 'string') {
|
|
134
|
-
options = { ...options, type }
|
|
134
|
+
options = { ...options, type }
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
return new File(bits, name, options)
|
|
138
|
+
return new File(bits, name, options)
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
|
|
142
|
-
let parts: Array<BlobPart> = []
|
|
142
|
+
let parts: Array<BlobPart> = []
|
|
143
143
|
if (
|
|
144
144
|
typeof value === 'string' ||
|
|
145
145
|
ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
146
146
|
value instanceof ArrayBuffer
|
|
147
147
|
) {
|
|
148
|
-
parts.push(value)
|
|
148
|
+
parts.push(value)
|
|
149
149
|
} else if (isBlobLike(value)) {
|
|
150
|
-
parts.push(await value.arrayBuffer())
|
|
150
|
+
parts.push(await value.arrayBuffer())
|
|
151
151
|
} else if (
|
|
152
152
|
isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc.
|
|
153
153
|
) {
|
|
154
154
|
for await (const chunk of value) {
|
|
155
|
-
parts.push(chunk as BlobPart)
|
|
155
|
+
parts.push(chunk as BlobPart) // TODO, consider validating?
|
|
156
156
|
}
|
|
157
157
|
} else {
|
|
158
158
|
throw new Error(
|
|
159
|
-
`Unexpected data type: ${typeof value}; constructor: ${
|
|
160
|
-
?.name
|
|
161
|
-
|
|
159
|
+
`Unexpected data type: ${typeof value}; constructor: ${
|
|
160
|
+
value?.constructor?.name
|
|
161
|
+
}; props: ${propsForError(value)}`,
|
|
162
|
+
)
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
return parts
|
|
165
|
+
return parts
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
function propsForError(value: any): string {
|
|
168
|
-
const props = Object.getOwnPropertyNames(value)
|
|
169
|
-
return `[${props.map((p) => `"${p}"`).join(', ')}]
|
|
169
|
+
const props = Object.getOwnPropertyNames(value)
|
|
170
|
+
return `[${props.map((p) => `"${p}"`).join(', ')}]`
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
function getName(value: any): string | undefined {
|
|
@@ -175,20 +176,20 @@ function getName(value: any): string | undefined {
|
|
|
175
176
|
getStringFromMaybeBuffer(value.filename) ||
|
|
176
177
|
// For fs.ReadStream
|
|
177
178
|
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop()
|
|
178
|
-
)
|
|
179
|
+
)
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
const getStringFromMaybeBuffer = (x: string | Buffer | unknown): string | undefined => {
|
|
182
|
-
if (typeof x === 'string') return x
|
|
183
|
-
if (typeof Buffer !== 'undefined' && x instanceof Buffer) return String(x)
|
|
184
|
-
return undefined
|
|
185
|
-
}
|
|
183
|
+
if (typeof x === 'string') return x
|
|
184
|
+
if (typeof Buffer !== 'undefined' && x instanceof Buffer) return String(x)
|
|
185
|
+
return undefined
|
|
186
|
+
}
|
|
186
187
|
|
|
187
188
|
const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator<unknown> =>
|
|
188
|
-
value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function'
|
|
189
|
+
value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function'
|
|
189
190
|
|
|
190
191
|
export const isMultipartBody = (body: any): body is MultipartBody =>
|
|
191
|
-
body && typeof body === 'object' && body.body && body[Symbol.toStringTag] === 'MultipartBody'
|
|
192
|
+
body && typeof body === 'object' && body.body && body[Symbol.toStringTag] === 'MultipartBody'
|
|
192
193
|
|
|
193
194
|
/**
|
|
194
195
|
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
|
@@ -197,59 +198,59 @@ export const isMultipartBody = (body: any): body is MultipartBody =>
|
|
|
197
198
|
export const maybeMultipartFormRequestOptions = async <T = Record<string, unknown>>(
|
|
198
199
|
opts: RequestOptions<T>,
|
|
199
200
|
): Promise<RequestOptions<T | MultipartBody>> => {
|
|
200
|
-
if (!hasUploadableValue(opts.body)) return opts
|
|
201
|
+
if (!hasUploadableValue(opts.body)) return opts
|
|
201
202
|
|
|
202
|
-
const form = await createForm(opts.body)
|
|
203
|
-
return getMultipartRequestOptions(form, opts)
|
|
204
|
-
}
|
|
203
|
+
const form = await createForm(opts.body)
|
|
204
|
+
return getMultipartRequestOptions(form, opts)
|
|
205
|
+
}
|
|
205
206
|
|
|
206
207
|
export const multipartFormRequestOptions = async <T = Record<string, unknown>>(
|
|
207
208
|
opts: RequestOptions<T>,
|
|
208
209
|
): Promise<RequestOptions<T | MultipartBody>> => {
|
|
209
|
-
const form = await createForm(opts.body)
|
|
210
|
-
return getMultipartRequestOptions(form, opts)
|
|
211
|
-
}
|
|
210
|
+
const form = await createForm(opts.body)
|
|
211
|
+
return getMultipartRequestOptions(form, opts)
|
|
212
|
+
}
|
|
212
213
|
|
|
213
214
|
export const createForm = async <T = Record<string, unknown>>(body: T | undefined): Promise<FormData> => {
|
|
214
|
-
const form = new FormData()
|
|
215
|
-
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)))
|
|
216
|
-
return form
|
|
217
|
-
}
|
|
215
|
+
const form = new FormData()
|
|
216
|
+
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)))
|
|
217
|
+
return form
|
|
218
|
+
}
|
|
218
219
|
|
|
219
220
|
const hasUploadableValue = (value: unknown): boolean => {
|
|
220
|
-
if (isUploadable(value)) return true
|
|
221
|
-
if (Array.isArray(value)) return value.some(hasUploadableValue)
|
|
221
|
+
if (isUploadable(value)) return true
|
|
222
|
+
if (Array.isArray(value)) return value.some(hasUploadableValue)
|
|
222
223
|
if (value && typeof value === 'object') {
|
|
223
224
|
for (const k in value) {
|
|
224
|
-
if (hasUploadableValue((value as any)[k])) return true
|
|
225
|
+
if (hasUploadableValue((value as any)[k])) return true
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
|
-
return false
|
|
228
|
-
}
|
|
228
|
+
return false
|
|
229
|
+
}
|
|
229
230
|
|
|
230
231
|
const addFormValue = async (form: FormData, key: string, value: unknown): Promise<void> => {
|
|
231
|
-
if (value === undefined) return
|
|
232
|
+
if (value === undefined) return
|
|
232
233
|
if (value == null) {
|
|
233
234
|
throw new TypeError(
|
|
234
235
|
`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`,
|
|
235
|
-
)
|
|
236
|
+
)
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
// TODO: make nested formats configurable
|
|
239
240
|
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
240
|
-
form.append(key, String(value))
|
|
241
|
+
form.append(key, String(value))
|
|
241
242
|
} else if (isUploadable(value)) {
|
|
242
|
-
const file = await toFile(value)
|
|
243
|
-
form.append(key, file as File)
|
|
243
|
+
const file = await toFile(value)
|
|
244
|
+
form.append(key, file as File)
|
|
244
245
|
} else if (Array.isArray(value)) {
|
|
245
|
-
await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)))
|
|
246
|
+
await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)))
|
|
246
247
|
} else if (typeof value === 'object') {
|
|
247
248
|
await Promise.all(
|
|
248
249
|
Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)),
|
|
249
|
-
)
|
|
250
|
+
)
|
|
250
251
|
} else {
|
|
251
252
|
throw new TypeError(
|
|
252
253
|
`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`,
|
|
253
|
-
)
|
|
254
|
+
)
|
|
254
255
|
}
|
|
255
|
-
}
|
|
256
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.0-alpha.
|
|
1
|
+
export const VERSION = '0.1.0-alpha.7' // x-release-please-version
|
package/uploads.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare const isMultipartBody: (body: any) => body is MultipartBody;
|
|
|
69
69
|
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
|
70
70
|
* Otherwise returns the request as is.
|
|
71
71
|
*/
|
|
72
|
-
export declare const maybeMultipartFormRequestOptions: <T = Record<string, unknown>>(opts: RequestOptions<T>) => Promise<RequestOptions<
|
|
73
|
-
export declare const multipartFormRequestOptions: <T = Record<string, unknown>>(opts: RequestOptions<T>) => Promise<RequestOptions<
|
|
72
|
+
export declare const maybeMultipartFormRequestOptions: <T = Record<string, unknown>>(opts: RequestOptions<T>) => Promise<RequestOptions<T | MultipartBody>>;
|
|
73
|
+
export declare const multipartFormRequestOptions: <T = Record<string, unknown>>(opts: RequestOptions<T>) => Promise<RequestOptions<T | MultipartBody>>;
|
|
74
74
|
export declare const createForm: <T = Record<string, unknown>>(body: T | undefined) => Promise<FormData>;
|
|
75
75
|
//# sourceMappingURL=uploads.d.ts.map
|
package/uploads.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,EACL,QAAQ,EAER,KAAK,IAAI,EACT,KAAK,eAAe,EAEpB,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,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MAAM,YAAY,UAAW,GAAG,KAAG,KAAK,IAAI,UAElD,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,aAAa,CAAC,YAAY,CAAC,CAAA;AAElG;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,EAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,GACpC,OAAO,CAAC,QAAQ,CAAC,CAiCnB;AAoDD,eAAO,MAAM,eAAe,SAAU,GAAG,KAAG,IAAI,IAAI,aAC2C,CAAA;AAE/F;;;GAGG;AACH,eAAO,MAAM,gCAAgC,GAAU,CAAC,kCAChD,cAAc,CAAC,CAAC,CAAC,KACtB,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,aAAa,CAAC,CAK3C,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAU,CAAC,kCAC3C,cAAc,CAAC,CAAC,CAAC,KACtB,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,aAAa,CAAC,CAG3C,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,CAAC,kCAAkC,CAAC,GAAG,SAAS,KAAG,OAAO,CAAC,QAAQ,CAInG,CAAA"}
|
package/uploads.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createForm = exports.multipartFormRequestOptions = exports.maybeMultipartFormRequestOptions = exports.isMultipartBody = exports.
|
|
3
|
+
exports.createForm = exports.multipartFormRequestOptions = exports.maybeMultipartFormRequestOptions = exports.isMultipartBody = exports.isUploadable = exports.isBlobLike = exports.isFileLike = exports.isResponseLike = exports.fileFromPath = void 0;
|
|
4
|
+
exports.toFile = toFile;
|
|
4
5
|
const index_1 = require("./_shims/index.js");
|
|
5
6
|
var index_2 = require("./_shims/index.js");
|
|
6
7
|
Object.defineProperty(exports, "fileFromPath", { enumerable: true, get: function () { return index_2.fileFromPath; } });
|
|
@@ -66,7 +67,6 @@ async function toFile(value, name, options) {
|
|
|
66
67
|
}
|
|
67
68
|
return new index_1.File(bits, name, options);
|
|
68
69
|
}
|
|
69
|
-
exports.toFile = toFile;
|
|
70
70
|
async function getBytes(value) {
|
|
71
71
|
let parts = [];
|
|
72
72
|
if (typeof value === 'string' ||
|
|
@@ -84,8 +84,7 @@ async function getBytes(value) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor
|
|
88
|
-
?.name}; props: ${propsForError(value)}`);
|
|
87
|
+
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
89
88
|
}
|
|
90
89
|
return parts;
|
|
91
90
|
}
|
package/uploads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;;AAqGA,wBAqCC;AAzID,6CAQuB;AAEvB,2CAA6C;AAApC,qGAAA,YAAY,OAAA;AAiDd,MAAM,cAAc,GAAG,CAAC,KAAU,EAAyB,EAAE,CAClE,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;IAC7B,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAA;AAJrB,QAAA,cAAc,kBAIO;AAE3B,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE,CAC1D,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,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AAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IAChF,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CACzF,CAAA;IACH,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
package/uploads.mjs
CHANGED
|
@@ -75,8 +75,7 @@ async function getBytes(value) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor
|
|
79
|
-
?.name}; props: ${propsForError(value)}`);
|
|
78
|
+
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
80
79
|
}
|
|
81
80
|
return parts;
|
|
82
81
|
}
|