@finueva/drive 0.1.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/CHANGELOG.md +8 -0
- package/LICENSE +15 -0
- package/README.md +91 -0
- package/THIRD_PARTY_NOTICES.md +55 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +1337 -0
- package/dist/contract.d.ts +2101 -0
- package/dist/core.d.ts +31 -0
- package/dist/core.js +53 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1337 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +1344 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +0 -0
- package/package.json +72 -0
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/core.d.ts
|
|
2
|
+
declare const DRIVE_API_ERROR_CODES: readonly ["authentication_required", "identity_authority_unavailable", "permission_denied", "resource_not_found", "invalid_request", "invalid_pagination_cursor", "invalid_idempotency_key", "precondition_failed", "idempotency_conflict", "quota_exceeded", "service_unavailable", "internal_error"];
|
|
3
|
+
type DriveApiErrorCode = (typeof DRIVE_API_ERROR_CODES)[number];
|
|
4
|
+
type DriveSdkErrorCode = "invalid_input" | "credential_unavailable" | "network_error" | "timeout" | "aborted" | "invalid_response";
|
|
5
|
+
type DriveErrorCode = DriveApiErrorCode | DriveSdkErrorCode;
|
|
6
|
+
declare const DRIVE_API_ERROR_MESSAGES: Readonly<{
|
|
7
|
+
readonly authentication_required: "Authentication is required.";
|
|
8
|
+
readonly identity_authority_unavailable: "Authentication is temporarily unavailable.";
|
|
9
|
+
readonly permission_denied: "The requested action is not permitted.";
|
|
10
|
+
readonly resource_not_found: "The requested resource was not found.";
|
|
11
|
+
readonly invalid_request: "The request is invalid.";
|
|
12
|
+
readonly invalid_pagination_cursor: "The pagination cursor is invalid.";
|
|
13
|
+
readonly invalid_idempotency_key: "The idempotency key is invalid.";
|
|
14
|
+
readonly precondition_failed: "The request precondition failed.";
|
|
15
|
+
readonly idempotency_conflict: "The idempotency key conflicts with an earlier request.";
|
|
16
|
+
readonly quota_exceeded: "The workspace storage quota would be exceeded.";
|
|
17
|
+
readonly service_unavailable: "The service is temporarily unavailable.";
|
|
18
|
+
readonly internal_error: "The request could not be completed.";
|
|
19
|
+
}>;
|
|
20
|
+
declare class DriveError extends Error {
|
|
21
|
+
readonly code: DriveErrorCode;
|
|
22
|
+
readonly status: number | null;
|
|
23
|
+
readonly requestId: string | null;
|
|
24
|
+
readonly details: Readonly<Record<string, never>>;
|
|
25
|
+
constructor(code: DriveErrorCode, options?: {
|
|
26
|
+
status?: number;
|
|
27
|
+
requestId?: string | null;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { DRIVE_API_ERROR_CODES, DRIVE_API_ERROR_MESSAGES, DriveApiErrorCode, DriveError, DriveErrorCode, DriveSdkErrorCode };
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/core.ts
|
|
2
|
+
const DRIVE_API_ERROR_CODES = Object.freeze([
|
|
3
|
+
"authentication_required",
|
|
4
|
+
"identity_authority_unavailable",
|
|
5
|
+
"permission_denied",
|
|
6
|
+
"resource_not_found",
|
|
7
|
+
"invalid_request",
|
|
8
|
+
"invalid_pagination_cursor",
|
|
9
|
+
"invalid_idempotency_key",
|
|
10
|
+
"precondition_failed",
|
|
11
|
+
"idempotency_conflict",
|
|
12
|
+
"quota_exceeded",
|
|
13
|
+
"service_unavailable",
|
|
14
|
+
"internal_error"
|
|
15
|
+
]);
|
|
16
|
+
const DRIVE_API_ERROR_MESSAGES = Object.freeze({
|
|
17
|
+
authentication_required: "Authentication is required.",
|
|
18
|
+
identity_authority_unavailable: "Authentication is temporarily unavailable.",
|
|
19
|
+
permission_denied: "The requested action is not permitted.",
|
|
20
|
+
resource_not_found: "The requested resource was not found.",
|
|
21
|
+
invalid_request: "The request is invalid.",
|
|
22
|
+
invalid_pagination_cursor: "The pagination cursor is invalid.",
|
|
23
|
+
invalid_idempotency_key: "The idempotency key is invalid.",
|
|
24
|
+
precondition_failed: "The request precondition failed.",
|
|
25
|
+
idempotency_conflict: "The idempotency key conflicts with an earlier request.",
|
|
26
|
+
quota_exceeded: "The workspace storage quota would be exceeded.",
|
|
27
|
+
service_unavailable: "The service is temporarily unavailable.",
|
|
28
|
+
internal_error: "The request could not be completed."
|
|
29
|
+
});
|
|
30
|
+
const SDK_MESSAGES = Object.freeze({
|
|
31
|
+
invalid_input: "The Drive SDK input is invalid.",
|
|
32
|
+
credential_unavailable: "A Drive credential could not be obtained.",
|
|
33
|
+
network_error: "The Drive request could not reach the service.",
|
|
34
|
+
timeout: "The Drive request timed out.",
|
|
35
|
+
aborted: "The Drive request was aborted.",
|
|
36
|
+
invalid_response: "Drive returned an invalid response."
|
|
37
|
+
});
|
|
38
|
+
var DriveError = class extends Error {
|
|
39
|
+
code;
|
|
40
|
+
status;
|
|
41
|
+
requestId;
|
|
42
|
+
details;
|
|
43
|
+
constructor(code, options = {}) {
|
|
44
|
+
super(code in DRIVE_API_ERROR_MESSAGES ? DRIVE_API_ERROR_MESSAGES[code] : SDK_MESSAGES[code]);
|
|
45
|
+
this.name = "DriveError";
|
|
46
|
+
this.code = code;
|
|
47
|
+
this.status = options.status ?? null;
|
|
48
|
+
this.requestId = options.requestId ?? null;
|
|
49
|
+
this.details = Object.freeze({});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { DRIVE_API_ERROR_CODES, DRIVE_API_ERROR_MESSAGES, DriveError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { D as UpdateItemPermissionInput, E as RevokeItemPermissionInput, O as UploadQuotaReservation, S as PermissionMutation, T as ReservedUploadQuota, _ as ListFolderChildrenInput, a as CreateUploadInput, b as PermissionGrant, d as DriveResponseValidators, h as FolderItem, i as CreateItemPermissionInput, l as DriveCredentialProvider, n as AbortedUploadQuota, o as DriveClient, p as EffectivePermissionAction, r as CreateFolderInput, s as DriveClientConfig, t as AbortUploadInput, u as DriveOperationResult, v as ListItemPermissionsInput, w as ReadEffectiveItemPermissionsInput, x as PermissionGrantee, y as PermissionAction } from "./contract.js";
|
|
2
|
+
import { createDriveClient } from "./client.js";
|
|
3
|
+
import { DRIVE_API_ERROR_CODES, DRIVE_API_ERROR_MESSAGES, DriveApiErrorCode, DriveError, DriveErrorCode, DriveSdkErrorCode } from "./core.js";
|
|
4
|
+
export { type AbortUploadInput, type AbortedUploadQuota, type CreateFolderInput, type CreateItemPermissionInput, type CreateUploadInput, DRIVE_API_ERROR_CODES, DRIVE_API_ERROR_MESSAGES, type DriveApiErrorCode, type DriveClient, type DriveClientConfig, type DriveCredentialProvider, DriveError, type DriveErrorCode, type DriveOperationResult, type DriveResponseValidators, type DriveSdkErrorCode, type EffectivePermissionAction, type FolderItem, type ListFolderChildrenInput, type ListItemPermissionsInput, type PermissionAction, type PermissionGrant, type PermissionGrantee, type PermissionMutation, type ReadEffectiveItemPermissionsInput, type ReservedUploadQuota, type RevokeItemPermissionInput, type UpdateItemPermissionInput, type UploadQuotaReservation, createDriveClient };
|