@ardrive/turbo-sdk 1.10.0-alpha.2 → 1.10.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/bundles/web.bundle.min.js +43767 -52609
- package/lib/cjs/common/factory.js +2 -115
- package/lib/cjs/common/payment.js +2 -1
- package/lib/cjs/common/signer.js +4 -3
- package/lib/cjs/common/token/arweave.js +2 -1
- package/lib/cjs/common/token/solana.js +2 -1
- package/lib/cjs/common/upload.js +25 -2
- package/lib/cjs/node/factory.js +63 -0
- package/lib/cjs/node/signer.js +2 -1
- package/lib/cjs/node/upload.js +3 -3
- package/lib/cjs/utils/base64.js +2 -1
- package/lib/cjs/utils/common.js +30 -3
- package/lib/cjs/utils/readableStream.js +18 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/web/factory.js +7 -27
- package/lib/cjs/web/upload.js +3 -3
- package/lib/esm/common/factory.js +2 -115
- package/lib/esm/common/payment.js +1 -0
- package/lib/esm/common/signer.js +1 -0
- package/lib/esm/common/token/arweave.js +1 -0
- package/lib/esm/common/token/solana.js +1 -0
- package/lib/esm/common/upload.js +24 -1
- package/lib/esm/node/factory.js +63 -0
- package/lib/esm/node/signer.js +1 -0
- package/lib/esm/node/upload.js +1 -1
- package/lib/esm/utils/base64.js +1 -0
- package/lib/esm/utils/common.js +26 -0
- package/lib/esm/utils/readableStream.js +17 -0
- package/lib/esm/version.js +1 -1
- package/lib/esm/web/factory.js +9 -29
- package/lib/esm/web/upload.js +1 -1
- package/lib/types/common/factory.d.ts +19 -6
- package/lib/types/common/factory.d.ts.map +1 -1
- package/lib/types/common/payment.d.ts.map +1 -1
- package/lib/types/common/signer.d.ts +1 -0
- package/lib/types/common/signer.d.ts.map +1 -1
- package/lib/types/common/token/arweave.d.ts.map +1 -1
- package/lib/types/common/token/solana.d.ts.map +1 -1
- package/lib/types/common/upload.d.ts +1 -0
- package/lib/types/common/upload.d.ts.map +1 -1
- package/lib/types/node/factory.d.ts +5 -16
- package/lib/types/node/factory.d.ts.map +1 -1
- package/lib/types/node/signer.d.ts.map +1 -1
- package/lib/types/node/upload.d.ts +1 -1
- package/lib/types/node/upload.d.ts.map +1 -1
- package/lib/types/utils/base64.d.ts +1 -0
- package/lib/types/utils/base64.d.ts.map +1 -1
- package/lib/types/utils/common.d.ts +6 -16
- package/lib/types/utils/common.d.ts.map +1 -1
- package/lib/types/utils/readableStream.d.ts +1 -0
- package/lib/types/utils/readableStream.d.ts.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/lib/types/web/factory.d.ts.map +1 -1
- package/lib/types/web/upload.d.ts +1 -1
- package/lib/types/web/upload.d.ts.map +1 -1
- package/package.json +1 -1
@@ -1,30 +1,6 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
3
|
-
*
|
4
|
-
* This program is free software: you can redistribute it and/or modify
|
5
|
-
* it under the terms of the GNU Affero General Public License as published by
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
7
|
-
* (at your option) any later version.
|
8
|
-
*
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
* GNU Affero General Public License for more details.
|
13
|
-
*
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
15
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
-
*/
|
17
|
-
import { ArweaveSigner, EthereumSigner, HexSolanaSigner } from 'arbundles';
|
18
|
-
import { TurboNodeSigner } from '../node/signer.js';
|
19
|
-
import { TurboAuthenticatedNodeUploadService } from '../node/upload.js';
|
20
|
-
import { isEthPrivateKey, isJWK, } from '../types.js';
|
21
|
-
import { isWeb } from '../utils/common.js';
|
22
|
-
import { TurboWebArweaveSigner } from '../web/signer.js';
|
23
|
-
import { TurboAuthenticatedWebUploadService } from '../web/upload.js';
|
24
1
|
import { TurboWinstonLogger } from './logger.js';
|
25
|
-
import {
|
26
|
-
import {
|
27
|
-
import { TurboAuthenticatedClient, TurboUnauthenticatedClient, } from './turbo.js';
|
2
|
+
import { TurboUnauthenticatedPaymentService } from './payment.js';
|
3
|
+
import { TurboUnauthenticatedClient } from './turbo.js';
|
28
4
|
import { TurboUnauthenticatedUploadService } from './upload.js';
|
29
5
|
export class TurboBaseFactory {
|
30
6
|
/* @deprecated - use TurboWinstonLogger directly */
|
@@ -49,94 +25,5 @@ export class TurboBaseFactory {
|
|
49
25
|
paymentService,
|
50
26
|
});
|
51
27
|
}
|
52
|
-
static getSigner(providedSigner, providedPrivateKey, token) {
|
53
|
-
let signer;
|
54
|
-
if (providedSigner !== undefined) {
|
55
|
-
signer = providedSigner;
|
56
|
-
}
|
57
|
-
else if (providedPrivateKey !== undefined) {
|
58
|
-
if (token === 'solana') {
|
59
|
-
signer = new HexSolanaSigner(providedPrivateKey);
|
60
|
-
}
|
61
|
-
else if (token === 'ethereum') {
|
62
|
-
if (!isEthPrivateKey(providedPrivateKey)) {
|
63
|
-
throw new Error('An Ethereum private key must be provided for EthereumSigner.');
|
64
|
-
}
|
65
|
-
signer = new EthereumSigner(providedPrivateKey);
|
66
|
-
}
|
67
|
-
else {
|
68
|
-
if (!isJWK(providedPrivateKey)) {
|
69
|
-
throw new Error('A JWK must be provided for ArweaveSigner.');
|
70
|
-
}
|
71
|
-
signer = new ArweaveSigner(providedPrivateKey);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
throw new Error('A privateKey or signer must be provided.');
|
76
|
-
}
|
77
|
-
if (isWeb()) {
|
78
|
-
return new TurboWebArweaveSigner({
|
79
|
-
signer,
|
80
|
-
logger: this.logger,
|
81
|
-
});
|
82
|
-
}
|
83
|
-
return new TurboNodeSigner({
|
84
|
-
signer,
|
85
|
-
logger: this.logger,
|
86
|
-
});
|
87
|
-
}
|
88
|
-
static authenticated({ privateKey, signer: providedSigner, paymentServiceConfig = {}, uploadServiceConfig = {}, token, tokenMap, gatewayUrl, tokenTools, }) {
|
89
|
-
if (!token) {
|
90
|
-
if (providedSigner) {
|
91
|
-
// Derive token from signer if not provided
|
92
|
-
if (providedSigner instanceof EthereumSigner) {
|
93
|
-
token = 'ethereum';
|
94
|
-
}
|
95
|
-
else if (providedSigner instanceof HexSolanaSigner) {
|
96
|
-
token = 'solana';
|
97
|
-
}
|
98
|
-
else {
|
99
|
-
token = 'arweave';
|
100
|
-
}
|
101
|
-
}
|
102
|
-
else {
|
103
|
-
token = 'arweave';
|
104
|
-
}
|
105
|
-
}
|
106
|
-
const turboSigner = this.getSigner(providedSigner, privateKey, token);
|
107
|
-
if (!tokenTools) {
|
108
|
-
if (tokenMap && token === 'arweave') {
|
109
|
-
tokenTools = tokenMap.arweave;
|
110
|
-
}
|
111
|
-
tokenTools = defaultTokenMap[token]?.({
|
112
|
-
gatewayUrl,
|
113
|
-
logger: this.logger,
|
114
|
-
});
|
115
|
-
}
|
116
|
-
const paymentService = new TurboAuthenticatedPaymentService({
|
117
|
-
...paymentServiceConfig,
|
118
|
-
signer: turboSigner,
|
119
|
-
logger: this.logger,
|
120
|
-
token,
|
121
|
-
tokenTools,
|
122
|
-
});
|
123
|
-
const uploadService = isWeb()
|
124
|
-
? new TurboAuthenticatedWebUploadService({
|
125
|
-
...uploadServiceConfig,
|
126
|
-
signer: turboSigner,
|
127
|
-
logger: this.logger,
|
128
|
-
token,
|
129
|
-
})
|
130
|
-
: new TurboAuthenticatedNodeUploadService({
|
131
|
-
...uploadServiceConfig,
|
132
|
-
signer: turboSigner,
|
133
|
-
logger: this.logger,
|
134
|
-
token,
|
135
|
-
});
|
136
|
-
return new TurboAuthenticatedClient({
|
137
|
-
uploadService,
|
138
|
-
paymentService,
|
139
|
-
});
|
140
|
-
}
|
141
28
|
}
|
142
29
|
TurboBaseFactory.logger = TurboWinstonLogger.default;
|
@@ -15,6 +15,7 @@
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
17
|
import { BigNumber } from 'bignumber.js';
|
18
|
+
import { Buffer } from 'node:buffer';
|
18
19
|
import { TurboHTTPService } from './http.js';
|
19
20
|
import { TurboWinstonLogger } from './logger.js';
|
20
21
|
export const developmentPaymentServiceURL = 'https://payment.ardrive.dev';
|
package/lib/esm/common/signer.js
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
import { EthereumSigner, HexSolanaSigner } from 'arbundles';
|
18
18
|
import { randomBytes } from 'crypto';
|
19
19
|
import { Wallet as EthereumWallet, parseEther } from 'ethers';
|
20
|
+
import { Buffer } from 'node:buffer';
|
20
21
|
import nacl from 'tweetnacl';
|
21
22
|
import { toB64Url } from '../utils/base64.js';
|
22
23
|
/**
|
@@ -16,6 +16,7 @@
|
|
16
16
|
*/
|
17
17
|
import Arweave from '@irys/arweave';
|
18
18
|
import { BigNumber } from 'bignumber.js';
|
19
|
+
import { Buffer } from 'node:buffer';
|
19
20
|
import { sha256B64Url, toB64Url } from '../../utils/base64.js';
|
20
21
|
import { sleep } from '../../utils/common.js';
|
21
22
|
import { TurboWinstonLogger } from '../logger.js';
|
@@ -17,6 +17,7 @@
|
|
17
17
|
import { Connection, PublicKey, SystemProgram, Transaction, } from '@solana/web3.js';
|
18
18
|
import { BigNumber } from 'bignumber.js';
|
19
19
|
import bs58 from 'bs58';
|
20
|
+
import { Buffer } from 'node:buffer';
|
20
21
|
import { sleep } from '../../utils/common.js';
|
21
22
|
import { TurboWinstonLogger } from '../logger.js';
|
22
23
|
export const lamportToTokenAmount = (winston) => winston;
|
package/lib/esm/common/upload.js
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
3
|
+
*
|
4
|
+
* This program is free software: you can redistribute it and/or modify
|
5
|
+
* it under the terms of the GNU Affero General Public License as published by
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
7
|
+
* (at your option) any later version.
|
8
|
+
*
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
* GNU Affero General Public License for more details.
|
13
|
+
*
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
15
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
import { Buffer } from 'node:buffer';
|
1
18
|
import { pLimit } from 'plimit-lit';
|
2
19
|
import { TurboHTTPService } from './http.js';
|
3
20
|
import { TurboWinstonLogger } from './logger.js';
|
@@ -87,7 +104,8 @@ export class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUpl
|
|
87
104
|
return this.contentTypeFromFile(file);
|
88
105
|
}
|
89
106
|
async uploadFolder(params) {
|
90
|
-
|
107
|
+
this.logger.debug('Uploading folder...', { params });
|
108
|
+
const { dataItemOpts, signal, manifestOptions = {}, maxConcurrentUploads = 1, throwOnFailure = true, } = params;
|
91
109
|
const { disableManifest, indexFile, fallbackFile } = manifestOptions;
|
92
110
|
const paths = {};
|
93
111
|
const response = {
|
@@ -126,6 +144,11 @@ export class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUpl
|
|
126
144
|
const files = await this.getFiles(params);
|
127
145
|
const limit = pLimit(maxConcurrentUploads);
|
128
146
|
await Promise.all(files.map((file) => limit(() => uploadFile(file))));
|
147
|
+
this.logger.debug('Finished uploading files', {
|
148
|
+
numFiles: files.length,
|
149
|
+
numErrors: errors.length,
|
150
|
+
results: response.fileResponses,
|
151
|
+
});
|
129
152
|
if (errors.length > 0) {
|
130
153
|
response.errors = errors;
|
131
154
|
}
|
package/lib/esm/node/factory.js
CHANGED
@@ -14,6 +14,69 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
+
import { EthereumSigner, HexSolanaSigner } from 'arbundles';
|
17
18
|
import { TurboBaseFactory } from '../common/factory.js';
|
19
|
+
import { defaultTokenMap } from '../common/index.js';
|
20
|
+
import { TurboAuthenticatedPaymentService } from '../common/payment.js';
|
21
|
+
import { TurboAuthenticatedClient } from '../common/turbo.js';
|
22
|
+
import { createTurboSigner } from '../utils/common.js';
|
23
|
+
import { TurboNodeSigner } from './signer.js';
|
24
|
+
import { TurboAuthenticatedUploadService } from './upload.js';
|
18
25
|
export class TurboFactory extends TurboBaseFactory {
|
26
|
+
static getSigner(providedSigner, providedPrivateKey, token) {
|
27
|
+
return new TurboNodeSigner({
|
28
|
+
signer: createTurboSigner({
|
29
|
+
signer: providedSigner,
|
30
|
+
privateKey: providedPrivateKey,
|
31
|
+
token,
|
32
|
+
}),
|
33
|
+
logger: this.logger,
|
34
|
+
});
|
35
|
+
}
|
36
|
+
static authenticated({ privateKey, signer: providedSigner, paymentServiceConfig = {}, uploadServiceConfig = {}, token, tokenMap, gatewayUrl, tokenTools, }) {
|
37
|
+
if (!token) {
|
38
|
+
if (providedSigner) {
|
39
|
+
// Derive token from signer if not provided
|
40
|
+
if (providedSigner instanceof EthereumSigner) {
|
41
|
+
token = 'ethereum';
|
42
|
+
}
|
43
|
+
else if (providedSigner instanceof HexSolanaSigner) {
|
44
|
+
token = 'solana';
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
token = 'arweave';
|
48
|
+
}
|
49
|
+
}
|
50
|
+
else {
|
51
|
+
token = 'arweave';
|
52
|
+
}
|
53
|
+
}
|
54
|
+
const turboSigner = this.getSigner(providedSigner, privateKey, token);
|
55
|
+
if (!tokenTools) {
|
56
|
+
if (tokenMap && token === 'arweave') {
|
57
|
+
tokenTools = tokenMap.arweave;
|
58
|
+
}
|
59
|
+
tokenTools = defaultTokenMap[token]?.({
|
60
|
+
gatewayUrl,
|
61
|
+
logger: this.logger,
|
62
|
+
});
|
63
|
+
}
|
64
|
+
const paymentService = new TurboAuthenticatedPaymentService({
|
65
|
+
...paymentServiceConfig,
|
66
|
+
signer: turboSigner,
|
67
|
+
logger: this.logger,
|
68
|
+
token,
|
69
|
+
tokenTools,
|
70
|
+
});
|
71
|
+
const uploadService = new TurboAuthenticatedUploadService({
|
72
|
+
...uploadServiceConfig,
|
73
|
+
signer: turboSigner,
|
74
|
+
logger: this.logger,
|
75
|
+
token,
|
76
|
+
});
|
77
|
+
return new TurboAuthenticatedClient({
|
78
|
+
uploadService,
|
79
|
+
paymentService,
|
80
|
+
});
|
81
|
+
}
|
19
82
|
}
|
package/lib/esm/node/signer.js
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
17
|
import { ArconnectSigner, ArweaveSigner, EthereumSigner, HexSolanaSigner, serializeTags, streamSigner, } from 'arbundles';
|
18
|
+
import { Buffer } from 'node:buffer';
|
18
19
|
import { TurboDataItemAbstractSigner } from '../common/signer.js';
|
19
20
|
import { fromB64Url } from '../utils/base64.js';
|
20
21
|
/**
|
package/lib/esm/node/upload.js
CHANGED
@@ -20,7 +20,7 @@ import { Readable } from 'node:stream';
|
|
20
20
|
import { join } from 'path';
|
21
21
|
import { TurboAuthenticatedBaseUploadService, defaultUploadServiceURL, } from '../common/upload.js';
|
22
22
|
import { isNodeUploadFolderParams, } from '../types.js';
|
23
|
-
export class
|
23
|
+
export class TurboAuthenticatedUploadService extends TurboAuthenticatedBaseUploadService {
|
24
24
|
constructor({ url = defaultUploadServiceURL, retryConfig, signer, logger, token, }) {
|
25
25
|
super({ url, retryConfig, logger, token, signer });
|
26
26
|
}
|
package/lib/esm/utils/base64.js
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
*/
|
17
17
|
import { bufferTob64Url } from 'arweave/node/lib/utils.js';
|
18
18
|
import { createHash } from 'crypto';
|
19
|
+
import { Buffer } from 'node:buffer';
|
19
20
|
export const base64URLRegex = /^[a-zA-Z0-9_-]{43}$/;
|
20
21
|
export function jwkToPublicArweaveAddress(jwk) {
|
21
22
|
return ownerToAddress(jwk.n);
|
package/lib/esm/utils/common.js
CHANGED
@@ -14,9 +14,35 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
+
import { ArweaveSigner, EthereumSigner, HexSolanaSigner } from 'arbundles';
|
18
|
+
import { isEthPrivateKey, isJWK, } from '../types.js';
|
17
19
|
export function sleep(ms) {
|
18
20
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
19
21
|
}
|
20
22
|
export function isWeb() {
|
21
23
|
return typeof window !== 'undefined';
|
22
24
|
}
|
25
|
+
export function createTurboSigner({ signer: clientProvidedSigner, privateKey: clientProvidedPrivateKey, token = 'arweave', }) {
|
26
|
+
if (clientProvidedSigner !== undefined) {
|
27
|
+
return clientProvidedSigner;
|
28
|
+
}
|
29
|
+
if (clientProvidedPrivateKey === undefined) {
|
30
|
+
throw new Error('A privateKey or signer must be provided.');
|
31
|
+
}
|
32
|
+
if (token === 'solana') {
|
33
|
+
// TODO: Add a type check for SOL private keys shape for detailed error message
|
34
|
+
return new HexSolanaSigner(clientProvidedPrivateKey);
|
35
|
+
}
|
36
|
+
else if (token === 'ethereum') {
|
37
|
+
if (!isEthPrivateKey(clientProvidedPrivateKey)) {
|
38
|
+
throw new Error('An Ethereum private key must be provided for EthereumSigner.');
|
39
|
+
}
|
40
|
+
return new EthereumSigner(clientProvidedPrivateKey);
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
if (!isJWK(clientProvidedPrivateKey)) {
|
44
|
+
throw new Error('A JWK must be provided for ArweaveSigner.');
|
45
|
+
}
|
46
|
+
return new ArweaveSigner(clientProvidedPrivateKey);
|
47
|
+
}
|
48
|
+
}
|
@@ -1,3 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
3
|
+
*
|
4
|
+
* This program is free software: you can redistribute it and/or modify
|
5
|
+
* it under the terms of the GNU Affero General Public License as published by
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
7
|
+
* (at your option) any later version.
|
8
|
+
*
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
* GNU Affero General Public License for more details.
|
13
|
+
*
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
15
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
import { Buffer } from 'node:buffer';
|
1
18
|
export async function readableStreamToBuffer({ stream, size, }) {
|
2
19
|
const reader = stream.getReader();
|
3
20
|
const buffer = Buffer.alloc(size);
|
package/lib/esm/version.js
CHANGED
package/lib/esm/web/factory.js
CHANGED
@@ -14,40 +14,20 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
-
import {
|
17
|
+
import { EthereumSigner, HexSolanaSigner } from 'arbundles';
|
18
18
|
import { TurboBaseFactory } from '../common/factory.js';
|
19
19
|
import { TurboAuthenticatedClient, TurboAuthenticatedPaymentService, defaultTokenMap, } from '../common/index.js';
|
20
|
-
import {
|
20
|
+
import { createTurboSigner } from '../utils/common.js';
|
21
21
|
import { TurboWebArweaveSigner } from './signer.js';
|
22
|
-
import {
|
22
|
+
import { TurboAuthenticatedUploadService } from './upload.js';
|
23
23
|
export class TurboFactory extends TurboBaseFactory {
|
24
24
|
static getSigner(providedSigner, providedPrivateKey, token) {
|
25
|
-
let signer;
|
26
|
-
if (providedSigner !== undefined) {
|
27
|
-
signer = providedSigner;
|
28
|
-
}
|
29
|
-
else if (providedPrivateKey !== undefined) {
|
30
|
-
if (token === 'solana') {
|
31
|
-
signer = new HexSolanaSigner(providedPrivateKey);
|
32
|
-
}
|
33
|
-
else if (token === 'ethereum') {
|
34
|
-
if (!isEthPrivateKey(providedPrivateKey)) {
|
35
|
-
throw new Error('An Ethereum private key must be provided for EthereumSigner.');
|
36
|
-
}
|
37
|
-
signer = new EthereumSigner(providedPrivateKey);
|
38
|
-
}
|
39
|
-
else {
|
40
|
-
if (!isJWK(providedPrivateKey)) {
|
41
|
-
throw new Error('A JWK must be provided for ArweaveSigner.');
|
42
|
-
}
|
43
|
-
signer = new ArweaveSigner(providedPrivateKey);
|
44
|
-
}
|
45
|
-
}
|
46
|
-
else {
|
47
|
-
throw new Error('A privateKey or signer must be provided.');
|
48
|
-
}
|
49
25
|
return new TurboWebArweaveSigner({
|
50
|
-
signer
|
26
|
+
signer: createTurboSigner({
|
27
|
+
signer: providedSigner,
|
28
|
+
privateKey: providedPrivateKey,
|
29
|
+
token,
|
30
|
+
}),
|
51
31
|
logger: this.logger,
|
52
32
|
});
|
53
33
|
}
|
@@ -87,7 +67,7 @@ export class TurboFactory extends TurboBaseFactory {
|
|
87
67
|
token,
|
88
68
|
tokenTools,
|
89
69
|
});
|
90
|
-
const uploadService = new
|
70
|
+
const uploadService = new TurboAuthenticatedUploadService({
|
91
71
|
...uploadServiceConfig,
|
92
72
|
signer: turboSigner,
|
93
73
|
logger: this.logger,
|
package/lib/esm/web/upload.js
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
*/
|
17
17
|
import { TurboAuthenticatedBaseUploadService, defaultUploadServiceURL, } from '../common/upload.js';
|
18
18
|
import { isWebUploadFolderParams, } from '../types.js';
|
19
|
-
export class
|
19
|
+
export class TurboAuthenticatedUploadService extends TurboAuthenticatedBaseUploadService {
|
20
20
|
constructor({ url = defaultUploadServiceURL, retryConfig, signer, logger, token, }) {
|
21
21
|
super({ url, retryConfig, logger, token, signer });
|
22
22
|
}
|
@@ -1,13 +1,26 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
3
|
+
*
|
4
|
+
* This program is free software: you can redistribute it and/or modify
|
5
|
+
* it under the terms of the GNU Affero General Public License as published by
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
7
|
+
* (at your option) any later version.
|
8
|
+
*
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
* GNU Affero General Public License for more details.
|
13
|
+
*
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
15
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
import { TurboUnauthenticatedConfiguration } from '../types.js';
|
2
18
|
import { TurboWinstonLogger } from './logger.js';
|
3
|
-
import {
|
4
|
-
|
5
|
-
export declare class TurboBaseFactory {
|
19
|
+
import { TurboUnauthenticatedClient } from './turbo.js';
|
20
|
+
export declare abstract class TurboBaseFactory {
|
6
21
|
protected static logger: TurboWinstonLogger;
|
7
22
|
static setLogLevel(level: string): void;
|
8
23
|
static setLogFormat(format: string): void;
|
9
24
|
static unauthenticated({ paymentServiceConfig, uploadServiceConfig, }?: TurboUnauthenticatedConfiguration): TurboUnauthenticatedClient;
|
10
|
-
protected static getSigner(providedSigner: TurboSigner | undefined, providedPrivateKey: TurboWallet | undefined, token: TokenType): TurboDataItemAbstractSigner;
|
11
|
-
static authenticated({ privateKey, signer: providedSigner, paymentServiceConfig, uploadServiceConfig, token, tokenMap, gatewayUrl, tokenTools, }: TurboAuthenticatedConfiguration): TurboAuthenticatedClient;
|
12
25
|
}
|
13
26
|
//# sourceMappingURL=factory.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/common/factory.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/common/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAGxD,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,MAAM,CAAC,MAAM,qBAA8B;IAGrD,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM;IAKhC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM;IAIlC,MAAM,CAAC,eAAe,CAAC,EACrB,oBAAyB,EACzB,mBAAwB,GACzB,GAAE,iCAAsC;CAc1C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EAET,6CAA6C,EAC7C,yCAAyC,EACzC,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EAEzB,WAAW,EAEX,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,+CAA+C,EAC/C,2CAA2C,EAC3C,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,eAAO,MAAM,4BAA4B,gCAAgC,CAAC;AAC1E,eAAO,MAAM,wBAAwB,+BAA+B,CAAC;AAErE,qBAAa,kCACX,YAAW,2CAA2C;IAEtD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACjD,SAAS,C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B,EAC9B,WAAW,EACX,MAAM,EACN,MAAmC,EACnC,KAAiB,EACjB,UAAU,GACX,EAAE,6CAA6C;IAMnC,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAY3C,cAAc,CAAC,EAC1B,MAAM,EACN,UAAe,GAChB,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAShD,qBAAqB,CAChC,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,4BAA4B,CAAC;YAO1B,sBAAsB;IAYvB,eAAe,CAAC,EAC3B,aAAiB,EACjB,WAAW,EAAE,YAAY,GAC1B,EAAE,yBAAyB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CA+ChE"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
1
2
|
import { FileStreamFactory, SendTxWithSignerParams, TurboDataItemSigner, TurboDataItemSignerParams, TurboFileFactory, TurboLogger, TurboSignedDataItemFactory, TurboSigner } from '../types.js';
|
2
3
|
/**
|
3
4
|
* Abstract class for signing TurboDataItems.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/common/signer.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/common/signer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,WAAW,EACX,0BAA0B,EAC1B,WAAW,EACZ,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,8BAAsB,2BACpB,YAAW,mBAAmB;IAE9B,QAAQ,CAAC,YAAY,CAAC,EACpB,iBAAiB,EACjB,eAAe,EACf,YAAY,GACb,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAE5E,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;gBAElB,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,yBAAyB;IAKzD,SAAS,KAAK,SAAS,IAAI;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAmB1E;IAEY,4BAA4B;;;;;IAY5B,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5C,gGAAgG;IACnF,eAAe,CAAC,EAC3B,MAAM,EACN,MAAM,EACN,QAAQ,GACT,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB9B,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAgBnE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"arweave.d.ts","sourceRoot":"","sources":["../../../../src/common/token/arweave.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"arweave.d.ts","sourceRoot":"","sources":["../../../../src/common/token/arweave.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAKxB,qBAAa,YAAa,YAAW,UAAU;IAC7C,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;gBAElC,EACV,UAAkC,EAClC,OAEE,EACF,MAAmC,EACnC,KAAY,EACZ,cAIC,GACF,GAAE;QACD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,cAAc,CAAC,EAAE,mBAAmB,CAAC;KACjC;IAOO,iBAAiB,CAAC,EAC7B,aAAa,EACb,MAAM,EACN,WAAW,EACX,MAAM,GACP,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAC/B,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IA4CW,uBAAuB,CAAC,EACnC,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDJ,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAqB9C;AAED,eAAO,MAAM,oBAAoB,YAAa,SAAS,CAAC,KAAK,oBAAY,CAAC;AAC1E,eAAO,MAAM,eAAe,OAAQ,SAAS,CAAC,KAAK,WACV,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../../src/common/token/solana.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,UAAU,EAMX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../../src/common/token/solana.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,UAAU,EAMX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAIxB,eAAO,MAAM,oBAAoB,YAAa,SAAS,CAAC,KAAK,oBAAY,CAAC;AAC1E,eAAO,MAAM,gBAAgB,QAAS,SAAS,CAAC,KAAK,WACZ,CAAC;AAE1C,qBAAa,WAAY,YAAW,UAAU;IAC5C,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IACjC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;gBAElC,EACV,MAAmC,EACnC,UAAkD,EAClD,cAIC,GACF,GAAE,WAAgB;IAQN,iBAAiB,CAAC,EAC7B,MAAM,EACN,WAAW,EACX,MAAM,GACP,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAC/B,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;YA0BY,QAAQ;IA2BT,uBAAuB,CAAC,EACnC,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,IAAI,CAAC;CA4ClB"}
|
@@ -14,6 +14,7 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
+
import { Buffer } from 'node:buffer';
|
17
18
|
import { Readable } from 'node:stream';
|
18
19
|
import { ArweaveManifest, TokenType, TurboAbortSignal, TurboAuthenticatedUploadServiceConfiguration, TurboAuthenticatedUploadServiceInterface, TurboDataItemSigner, TurboFileFactory, TurboLogger, TurboSignedDataItemFactory, TurboUnauthenticatedUploadServiceConfiguration, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse, TurboUploadFolderParams, TurboUploadFolderResponse } from '../types.js';
|
19
20
|
import { TurboHTTPService } from './http.js';
|
@@ -1 +1 @@
|
|
1
|
-
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,OAAO,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM;IACzD,QAAQ,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,cAAc;IAC7E,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IACjD,QAAQ,CAAC,eAAe,CACtB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,uBAAuB,GAC9B,MAAM;IACT,QAAQ,CAAC,oBAAoB,CAC3B,cAAc,EAAE,MAAM,GACrB,QAAQ,GAAG,cAAc;IAE5B,OAAO,CAAC,cAAc;IAchB,YAAY,CAChB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,yBAAyB,CAAC;CAoGtC"}
|
@@ -1,20 +1,9 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
3
|
-
*
|
4
|
-
* This program is free software: you can redistribute it and/or modify
|
5
|
-
* it under the terms of the GNU Affero General Public License as published by
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
7
|
-
* (at your option) any later version.
|
8
|
-
*
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
* GNU Affero General Public License for more details.
|
13
|
-
*
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
15
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
-
*/
|
17
1
|
import { TurboBaseFactory } from '../common/factory.js';
|
2
|
+
import { TurboDataItemAbstractSigner } from '../common/signer.js';
|
3
|
+
import { TurboAuthenticatedClient } from '../common/turbo.js';
|
4
|
+
import { TokenType, TurboAuthenticatedConfiguration, TurboSigner, TurboWallet } from '../types.js';
|
18
5
|
export declare class TurboFactory extends TurboBaseFactory {
|
6
|
+
protected static getSigner(providedSigner: TurboSigner | undefined, providedPrivateKey: TurboWallet | undefined, token: TokenType): TurboDataItemAbstractSigner;
|
7
|
+
static authenticated({ privateKey, signer: providedSigner, paymentServiceConfig, uploadServiceConfig, token, tokenMap, gatewayUrl, tokenTools, }: TurboAuthenticatedConfiguration): TurboAuthenticatedClient;
|
19
8
|
}
|
20
9
|
//# sourceMappingURL=factory.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/node/factory.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/node/factory.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,SAAS,EACT,+BAA+B,EAC/B,WAAW,EACX,WAAW,EACZ,MAAM,aAAa,CAAC;AAKrB,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,SAAS,CAAC,MAAM,CAAC,SAAS,CACxB,cAAc,EAAE,WAAW,GAAG,SAAS,EACvC,kBAAkB,EAAE,WAAW,GAAG,SAAS,EAC3C,KAAK,EAAE,SAAS,GACf,2BAA2B;IAW9B,MAAM,CAAC,aAAa,CAAC,EACnB,UAAU,EACV,MAAM,EAAE,cAAc,EACtB,oBAAyB,EACzB,mBAAwB,EACxB,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE,+BAA+B;CA8CnC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/node/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EAGhB,MAAM,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/node/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EAGhB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAE3E;;GAEG;AACH,qBAAa,eAAgB,SAAQ,2BAA2B;gBAClD,CAAC,EAAE,yBAAyB;IAIlC,YAAY,CAAC,EACjB,iBAAiB,EACjB,eAAe,EACf,YAAY,GACb,EAAE;QACD,iBAAiB,EAAE,MAAM,QAAQ,CAAC;QAClC,eAAe,EAAE,iBAAiB,CAAC;QACnC,YAAY,CAAC,EAAE,eAAe,CAAC;KAChC,GAAG,OAAO,CAAC;QACV,qBAAqB,EAAE,MAAM,QAAQ,CAAC;QACtC,mBAAmB,EAAE,iBAAiB,CAAC;KACxC,CAAC;IAyBF,OAAO,CAAC,8BAA8B;CAiCvC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Readable } from 'node:stream';
|
2
2
|
import { TurboAuthenticatedBaseUploadService } from '../common/upload.js';
|
3
3
|
import { TurboAuthenticatedUploadServiceConfiguration, TurboUploadFolderParams } from '../types.js';
|
4
|
-
export declare class
|
4
|
+
export declare class TurboAuthenticatedUploadService extends TurboAuthenticatedBaseUploadService {
|
5
5
|
constructor({ url, retryConfig, signer, logger, token, }: TurboAuthenticatedUploadServiceConfiguration);
|
6
6
|
private getAbsoluteFilePathsFromFolder;
|
7
7
|
getFiles(params: TurboUploadFolderParams): Promise<string[]>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/node/upload.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EACL,mCAAmC,EAEpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,4CAA4C,EAC5C,uBAAuB,EAExB,MAAM,aAAa,CAAC;AAErB,qBAAa,
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/node/upload.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EACL,mCAAmC,EAEpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,4CAA4C,EAC5C,uBAAuB,EAExB,MAAM,aAAa,CAAC;AAErB,qBAAa,+BAAgC,SAAQ,mCAAmC;gBAC1E,EACV,GAA6B,EAC7B,WAAW,EACX,MAAM,EACN,MAAM,EACN,KAAK,GACN,EAAE,4CAA4C;YAIjC,8BAA8B;IAqB5C,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAO5D,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;IAI5C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIjC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIjC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB,GAAG,MAAM;IAOtE,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAKzC,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ;CAGvD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/utils/base64.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/utils/base64.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,cAAc,QAAwB,CAAC;AAEpD,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,YAAY,GAChB,oBAAoB,CAEtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,oBAAoB,CAExE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAStD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAErD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAExD"}
|