@edgestore/sdk 0.0.0-canary-20260730115626
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/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/credentials.d.ts +22 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +37 -0
- package/dist/errors.d.ts +65 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +59 -0
- package/dist/generated/api-v2.d.ts +9222 -0
- package/dist/generated/api-v2.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/internal/multipartUpload.d.ts +31 -0
- package/dist/internal/multipartUpload.d.ts.map +1 -0
- package/dist/internal/multipartUpload.js +96 -0
- package/dist/internal/operationTypes.d.ts +19 -0
- package/dist/internal/operationTypes.d.ts.map +1 -0
- package/dist/internal/projectOperation.d.ts +20 -0
- package/dist/internal/projectOperation.d.ts.map +1 -0
- package/dist/internal/projectOperation.js +15 -0
- package/dist/internal/runtimeOperations.d.ts +131 -0
- package/dist/internal/runtimeOperations.d.ts.map +1 -0
- package/dist/internal/runtimeOperations.js +184 -0
- package/dist/internal/sizedStreamReader.d.ts +7 -0
- package/dist/internal/sizedStreamReader.d.ts.map +1 -0
- package/dist/internal/sizedStreamReader.js +95 -0
- package/dist/internal/transport.d.ts +30 -0
- package/dist/internal/transport.d.ts.map +1 -0
- package/dist/internal/transport.js +103 -0
- package/dist/internal/uploadRetry.d.ts +20 -0
- package/dist/internal/uploadRetry.d.ts.map +1 -0
- package/dist/internal/uploadRetry.js +95 -0
- package/dist/internal/uploadTransfer.d.ts +16 -0
- package/dist/internal/uploadTransfer.d.ts.map +1 -0
- package/dist/internal/uploadTransfer.js +61 -0
- package/dist/internal/uploadValidation.d.ts +3 -0
- package/dist/internal/uploadValidation.d.ts.map +1 -0
- package/dist/internal/uploadValidation.js +14 -0
- package/dist/managementAccess.d.ts +78 -0
- package/dist/managementAccess.d.ts.map +1 -0
- package/dist/managementAccess.js +161 -0
- package/dist/managementClient.d.ts +7 -0
- package/dist/managementClient.d.ts.map +1 -0
- package/dist/managementClient.js +11 -0
- package/dist/managementResources.d.ts +87 -0
- package/dist/managementResources.d.ts.map +1 -0
- package/dist/managementResources.js +219 -0
- package/dist/runtime.d.ts +171 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +24 -0
- package/dist/sdk.d.ts +47 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +24 -0
- package/dist/system.d.ts +17 -0
- package/dist/system.d.ts.map +1 -0
- package/dist/system.js +12 -0
- package/dist/upload.d.ts +17 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +285 -0
- package/dist/uploadTypes.d.ts +78 -0
- package/dist/uploadTypes.d.ts.map +1 -0
- package/dist/uploadTypes.js +7 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/package.json +70 -0
- package/src/credentials.ts +67 -0
- package/src/errors.ts +98 -0
- package/src/generated/api-v2.ts +9222 -0
- package/src/generated/openapi-v2.json +18849 -0
- package/src/generated/source.ts +8 -0
- package/src/index.ts +78 -0
- package/src/internal/multipartUpload.ts +140 -0
- package/src/internal/operationTypes.ts +29 -0
- package/src/internal/projectOperation.ts +55 -0
- package/src/internal/runtimeOperations.ts +249 -0
- package/src/internal/sizedStreamReader.ts +116 -0
- package/src/internal/transport.ts +170 -0
- package/src/internal/uploadRetry.ts +143 -0
- package/src/internal/uploadTransfer.ts +107 -0
- package/src/internal/uploadValidation.ts +17 -0
- package/src/managementAccess.ts +290 -0
- package/src/managementClient.ts +20 -0
- package/src/managementResources.ts +380 -0
- package/src/runtime.ts +280 -0
- package/src/sdk.ts +90 -0
- package/src/system.ts +29 -0
- package/src/upload.ts +454 -0
- package/src/uploadTypes.ts +100 -0
- package/src/version.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 EdgeStore contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @edgestore/sdk
|
|
2
|
+
|
|
3
|
+
Official low-level TypeScript SDK for the EdgeStore API.
|
|
4
|
+
|
|
5
|
+
The SDK is server-only and uses EdgeStore API v2. Generated OpenAPI types stay
|
|
6
|
+
internal while the package exposes a stable, resource-oriented public API.
|
|
7
|
+
|
|
8
|
+
Operation and field documentation is generated from the pinned OpenAPI schema;
|
|
9
|
+
SDK-specific behavior is documented on the handwritten public facade.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { createEdgeStoreSdk } from '@edgestore/sdk';
|
|
13
|
+
|
|
14
|
+
const sdk = createEdgeStoreSdk({
|
|
15
|
+
credentials: {
|
|
16
|
+
accessKey: process.env.EDGE_STORE_ACCESS_KEY!,
|
|
17
|
+
secretKey: process.env.EDGE_STORE_SECRET_KEY!,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const result = await sdk.runtime.uploads.upload({
|
|
22
|
+
bucket: 'documents',
|
|
23
|
+
source: pdfBlob,
|
|
24
|
+
fileName: 'invoice.pdf',
|
|
25
|
+
metadata: { invoiceId: 'invoice-123' },
|
|
26
|
+
signal,
|
|
27
|
+
onProgress: ({ percentage, phase }) => console.log(phase, percentage),
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Project credentials expose runtime resources for their current project.
|
|
32
|
+
Management tokens expose management resources and runtime calls with an
|
|
33
|
+
explicit `project` selector.
|
|
34
|
+
|
|
35
|
+
Use `runtime.files.generateSignedReadUrls` for protected runtime reads and
|
|
36
|
+
`management.files.generateAccessUrls` when management code needs readable URLs
|
|
37
|
+
for public or protected files.
|
|
38
|
+
|
|
39
|
+
Common runtime inputs and results are exported as named types. Types for any
|
|
40
|
+
other operation can be derived from the public SDK interfaces:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import type { ManagementEdgeStoreSdk } from '@edgestore/sdk';
|
|
44
|
+
|
|
45
|
+
type CreateProject =
|
|
46
|
+
ManagementEdgeStoreSdk['management']['projects']['create'];
|
|
47
|
+
type CreateProjectInput = Parameters<CreateProject>[0];
|
|
48
|
+
type CreateProjectOutput = Awaited<ReturnType<CreateProject>>;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The high-level upload helper supports automatic multipart selection, bounded
|
|
52
|
+
parallelism, retries, progress, abort signals, cancellation, and processing
|
|
53
|
+
polling. Lower-level upload lifecycle methods are also available.
|
|
54
|
+
|
|
55
|
+
See the [EdgeStore documentation](https://edgestore.dev/docs/sdk) for runtime,
|
|
56
|
+
management, error-handling, and custom transport examples.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Project-scoped credentials used by runtime API clients. */
|
|
2
|
+
export type ProjectCredentials = {
|
|
3
|
+
/** Project access key. */
|
|
4
|
+
accessKey: string;
|
|
5
|
+
/** Project secret key. */
|
|
6
|
+
secretKey: string;
|
|
7
|
+
};
|
|
8
|
+
/** Management token used by administrative API clients. */
|
|
9
|
+
export type ManagementCredentials = {
|
|
10
|
+
/** Account- or user-owned management token. */
|
|
11
|
+
token: string;
|
|
12
|
+
};
|
|
13
|
+
/** Credentials accepted by {@link createEdgeStoreSdk}. */
|
|
14
|
+
export type EdgeStoreCredentials = ProjectCredentials | ManagementCredentials;
|
|
15
|
+
export type ClassifiedCredentials = ({
|
|
16
|
+
kind: 'project';
|
|
17
|
+
} & ProjectCredentials) | ({
|
|
18
|
+
kind: 'management';
|
|
19
|
+
} & ManagementCredentials);
|
|
20
|
+
export declare function classifyCredentials(credentials: EdgeStoreCredentials): ClassifiedCredentials;
|
|
21
|
+
export declare function getAuthorizationHeader(credentials: ClassifiedCredentials): string;
|
|
22
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,qBAAqB,GAAG;IAClC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAE9E,MAAM,MAAM,qBAAqB,GAC7B,CAAC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG,kBAAkB,CAAC,GAC1C,CAAC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GAAG,qBAAqB,CAAC,CAAC;AAErD,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,oBAAoB,GAChC,qBAAqB,CAmBvB;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,qBAAqB,GACjC,MAAM,CAWR"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Project-scoped credentials used by runtime API clients. */ function classifyCredentials(credentials) {
|
|
2
|
+
const values = credentials;
|
|
3
|
+
const token = values.token;
|
|
4
|
+
const accessKey = values.accessKey;
|
|
5
|
+
const secretKey = values.secretKey;
|
|
6
|
+
if (token !== undefined) {
|
|
7
|
+
if (accessKey !== undefined || secretKey !== undefined) {
|
|
8
|
+
throw new TypeError('EdgeStore credentials cannot contain both a management token and project keys.');
|
|
9
|
+
}
|
|
10
|
+
assertCredential(token, 'token');
|
|
11
|
+
return {
|
|
12
|
+
kind: 'management',
|
|
13
|
+
token
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
assertCredential(accessKey, 'accessKey');
|
|
17
|
+
assertCredential(secretKey, 'secretKey');
|
|
18
|
+
return {
|
|
19
|
+
kind: 'project',
|
|
20
|
+
accessKey,
|
|
21
|
+
secretKey
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function getAuthorizationHeader(credentials) {
|
|
25
|
+
if (credentials.kind === 'management') {
|
|
26
|
+
return `Bearer ${credentials.token}`;
|
|
27
|
+
}
|
|
28
|
+
const encodedCredentials = Buffer.from(`${credentials.accessKey}:${credentials.secretKey}`, 'utf8').toString('base64');
|
|
29
|
+
return `Basic ${encodedCredentials}`;
|
|
30
|
+
}
|
|
31
|
+
function assertCredential(value, name) {
|
|
32
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
33
|
+
throw new TypeError(`EdgeStore credential \`${name}\` must not be empty.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { classifyCredentials, getAuthorizationHeader };
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Base class for errors raised by the EdgeStore SDK. */
|
|
2
|
+
export declare class EdgeStoreError extends Error {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
}
|
|
5
|
+
/** A non-success response returned by the EdgeStore API. */
|
|
6
|
+
export declare class EdgeStoreApiError extends EdgeStoreError {
|
|
7
|
+
readonly name = "EdgeStoreApiError";
|
|
8
|
+
/** HTTP response status. */
|
|
9
|
+
readonly status: number;
|
|
10
|
+
/** Stable machine-readable API error code. */
|
|
11
|
+
readonly code: string;
|
|
12
|
+
/** Structured error details, when provided by the API. */
|
|
13
|
+
readonly details: unknown;
|
|
14
|
+
/** EdgeStore request identifier for tracing and support. */
|
|
15
|
+
readonly requestId: string | undefined;
|
|
16
|
+
/** Server-requested retry delay parsed from `Retry-After`. */
|
|
17
|
+
readonly retryAfterSeconds: number | undefined;
|
|
18
|
+
constructor(options: {
|
|
19
|
+
message: string;
|
|
20
|
+
status: number;
|
|
21
|
+
code: string;
|
|
22
|
+
details?: unknown;
|
|
23
|
+
requestId?: string;
|
|
24
|
+
retryAfterSeconds?: number;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** A request that could not reach the API or upload destination. */
|
|
28
|
+
export declare class EdgeStoreNetworkError extends EdgeStoreError {
|
|
29
|
+
readonly name = "EdgeStoreNetworkError";
|
|
30
|
+
constructor(message: string, options?: ErrorOptions);
|
|
31
|
+
}
|
|
32
|
+
/** A request or upload canceled through an `AbortSignal`. */
|
|
33
|
+
export declare class EdgeStoreAbortError extends EdgeStoreError {
|
|
34
|
+
readonly name = "EdgeStoreAbortError";
|
|
35
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
36
|
+
}
|
|
37
|
+
/** Base class for failures tied to an upload created by the SDK. */
|
|
38
|
+
export declare class EdgeStoreUploadError extends EdgeStoreError {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
/** Upload identifier that can be used for diagnostics. */
|
|
41
|
+
readonly uploadId: string;
|
|
42
|
+
constructor(message: string, uploadId: string, options?: ErrorOptions);
|
|
43
|
+
}
|
|
44
|
+
/** An upload canceled before it reached a completed state. */
|
|
45
|
+
export declare class EdgeStoreUploadCanceledError extends EdgeStoreUploadError {
|
|
46
|
+
readonly name = "EdgeStoreUploadCanceledError";
|
|
47
|
+
}
|
|
48
|
+
/** An upload that did not finish server-side processing before its deadline. */
|
|
49
|
+
export declare class EdgeStoreUploadProcessingTimeoutError extends EdgeStoreUploadError {
|
|
50
|
+
readonly name = "EdgeStoreUploadProcessingTimeoutError";
|
|
51
|
+
}
|
|
52
|
+
/** Failure returned for a singular file mutation. */
|
|
53
|
+
export declare class EdgeStoreFileMutationError<TFileReference = {
|
|
54
|
+
id: string;
|
|
55
|
+
} | {
|
|
56
|
+
key: string;
|
|
57
|
+
} | {
|
|
58
|
+
url: string;
|
|
59
|
+
}, TCode extends string = 'FILE_NOT_CONFIRMABLE' | 'FILE_NOT_DELETABLE' | 'FILE_NOT_RESTORABLE' | 'INVALID_FILE_REF'> extends EdgeStoreError {
|
|
60
|
+
readonly code: TCode;
|
|
61
|
+
readonly fileRef: TFileReference;
|
|
62
|
+
readonly name = "EdgeStoreFileMutationError";
|
|
63
|
+
constructor(code: TCode, message: string, fileRef: TFileReference);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAkB,IAAI,EAAE,MAAM,CAAoB;CACnD;AAED,4DAA4D;AAC5D,qBAAa,iBAAkB,SAAQ,cAAc;IACnD,SAAkB,IAAI,uBAAuB;IAC7C,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,8DAA8D;IAC9D,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEnC,OAAO,EAAE;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;CAQF;AAED,oEAAoE;AACpE,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,SAAkB,IAAI,2BAA2B;gBAErC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAGpD;AAED,6DAA6D;AAC7D,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,SAAkB,IAAI,yBAAyB;gBAG7C,OAAO,SAAuC,EAC9C,OAAO,CAAC,EAAE,YAAY;CAIzB;AAED,oEAAoE;AACpE,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,SAAkB,IAAI,EAAE,MAAM,CAA0B;IACxD,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAItE;AAED,8DAA8D;AAC9D,qBAAa,4BAA6B,SAAQ,oBAAoB;IACpE,SAAkB,IAAI,kCAAkC;CACzD;AAED,gFAAgF;AAChF,qBAAa,qCAAsC,SAAQ,oBAAoB;IAC7E,SAAkB,IAAI,2CAA2C;CAClE;AAED,qDAAqD;AACrD,qBAAa,0BAA0B,CACrC,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACnE,KAAK,SAAS,MAAM,GAChB,sBAAsB,GACtB,oBAAoB,GACpB,qBAAqB,GACrB,kBAAkB,CACtB,SAAQ,cAAc;IAIpB,QAAQ,CAAC,IAAI,EAAE,KAAK;IAEpB,QAAQ,CAAC,OAAO,EAAE,cAAc;IALlC,SAAkB,IAAI,gCAAgC;gBAG3C,IAAI,EAAE,KAAK,EACpB,OAAO,EAAE,MAAM,EACN,OAAO,EAAE,cAAc;CAInC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else obj[key] = value;
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
/** Base class for errors raised by the EdgeStore SDK. */ class EdgeStoreError extends Error {
|
|
13
|
+
constructor(...args){
|
|
14
|
+
super(...args), _define_property(this, "name", 'EdgeStoreError');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** A non-success response returned by the EdgeStore API. */ class EdgeStoreApiError extends EdgeStoreError {
|
|
18
|
+
constructor(options){
|
|
19
|
+
super(options.message), _define_property(this, "name", 'EdgeStoreApiError'), /** HTTP response status. */ _define_property(this, "status", void 0), /** Stable machine-readable API error code. */ _define_property(this, "code", void 0), /** Structured error details, when provided by the API. */ _define_property(this, "details", void 0), /** EdgeStore request identifier for tracing and support. */ _define_property(this, "requestId", void 0), /** Server-requested retry delay parsed from `Retry-After`. */ _define_property(this, "retryAfterSeconds", void 0);
|
|
20
|
+
this.status = options.status;
|
|
21
|
+
this.code = options.code;
|
|
22
|
+
this.details = options.details;
|
|
23
|
+
this.requestId = options.requestId;
|
|
24
|
+
this.retryAfterSeconds = options.retryAfterSeconds;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** A request that could not reach the API or upload destination. */ class EdgeStoreNetworkError extends EdgeStoreError {
|
|
28
|
+
constructor(message, options){
|
|
29
|
+
super(message, options), _define_property(this, "name", 'EdgeStoreNetworkError');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** A request or upload canceled through an `AbortSignal`. */ class EdgeStoreAbortError extends EdgeStoreError {
|
|
33
|
+
constructor(message = 'The EdgeStore request was aborted.', options){
|
|
34
|
+
super(message, options), _define_property(this, "name", 'EdgeStoreAbortError');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Base class for failures tied to an upload created by the SDK. */ class EdgeStoreUploadError extends EdgeStoreError {
|
|
38
|
+
constructor(message, uploadId, options){
|
|
39
|
+
super(message, options), _define_property(this, "name", 'EdgeStoreUploadError'), /** Upload identifier that can be used for diagnostics. */ _define_property(this, "uploadId", void 0);
|
|
40
|
+
this.uploadId = uploadId;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** An upload canceled before it reached a completed state. */ class EdgeStoreUploadCanceledError extends EdgeStoreUploadError {
|
|
44
|
+
constructor(...args){
|
|
45
|
+
super(...args), _define_property(this, "name", 'EdgeStoreUploadCanceledError');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** An upload that did not finish server-side processing before its deadline. */ class EdgeStoreUploadProcessingTimeoutError extends EdgeStoreUploadError {
|
|
49
|
+
constructor(...args){
|
|
50
|
+
super(...args), _define_property(this, "name", 'EdgeStoreUploadProcessingTimeoutError');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Failure returned for a singular file mutation. */ class EdgeStoreFileMutationError extends EdgeStoreError {
|
|
54
|
+
constructor(code, message, fileRef){
|
|
55
|
+
super(message), _define_property(this, "code", void 0), _define_property(this, "fileRef", void 0), _define_property(this, "name", void 0), this.code = code, this.fileRef = fileRef, this.name = 'EdgeStoreFileMutationError';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { EdgeStoreAbortError, EdgeStoreApiError, EdgeStoreError, EdgeStoreFileMutationError, EdgeStoreNetworkError, EdgeStoreUploadCanceledError, EdgeStoreUploadError, EdgeStoreUploadProcessingTimeoutError };
|