@scality/data-browser-library 1.0.0-preview.9 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DataBrowserUI.d.ts +12 -0
- package/dist/components/DataBrowserUI.js +99 -0
- package/dist/components/Editor.d.ts +1 -1
- package/dist/components/Editor.js +3 -3
- package/dist/components/__tests__/BucketAccessor.test.js +214 -0
- package/dist/components/__tests__/BucketCorsPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCorsPage.test.js +263 -0
- package/dist/components/__tests__/BucketCreate.test.js +271 -105
- package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
- package/dist/components/__tests__/BucketDetails.test.js +421 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +13 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +178 -178
- package/dist/components/__tests__/BucketLifecycleList.test.js +85 -85
- package/dist/components/__tests__/BucketList.test.js +463 -239
- package/dist/components/__tests__/BucketNotificationFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationFormPage.test.js +348 -0
- package/dist/components/__tests__/BucketNotificationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationList.test.js +379 -0
- package/dist/components/__tests__/BucketOverview.test.js +281 -266
- package/dist/components/__tests__/BucketPolicyPage.test.js +151 -99
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +15 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +544 -544
- package/dist/components/__tests__/BucketReplicationList.test.js +106 -106
- package/dist/components/__tests__/CreateFolderButton.test.js +56 -56
- package/dist/components/__tests__/DeleteBucketButton.test.js +64 -64
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +47 -47
- package/dist/components/__tests__/DeleteObjectButton.test.js +64 -64
- package/dist/components/__tests__/EmptyBucketButton.test.js +59 -59
- package/dist/components/__tests__/MetadataSearch.test.js +65 -65
- package/dist/components/__tests__/ObjectList.test.js +741 -240
- package/dist/components/__tests__/UploadButton.test.js +45 -45
- package/dist/components/breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/components/breadcrumb/Breadcrumb.js +37 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.d.ts +1 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.js +10 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.js +196 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.js +153 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.js +134 -0
- package/dist/components/breadcrumb/index.d.ts +8 -0
- package/dist/components/breadcrumb/index.js +4 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.d.ts +2 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.js +82 -0
- package/dist/components/buckets/BucketAccessor.d.ts +2 -0
- package/dist/components/buckets/BucketAccessor.js +125 -0
- package/dist/components/buckets/BucketConfigEditButton.d.ts +8 -0
- package/dist/components/buckets/{BucketPolicyButton.js → BucketConfigEditButton.js} +9 -5
- package/dist/components/buckets/BucketCorsPage.d.ts +1 -0
- package/dist/components/buckets/BucketCorsPage.js +234 -0
- package/dist/components/buckets/BucketCreate.d.ts +3 -2
- package/dist/components/buckets/BucketCreate.js +89 -47
- package/dist/components/buckets/BucketDetails.d.ts +42 -0
- package/dist/components/buckets/BucketDetails.js +249 -85
- package/dist/components/buckets/BucketLifecycleFormPage.js +206 -190
- package/dist/components/buckets/BucketLifecycleList.d.ts +2 -2
- package/dist/components/buckets/BucketLifecycleList.js +47 -47
- package/dist/components/buckets/BucketList.d.ts +7 -8
- package/dist/components/buckets/BucketList.js +158 -101
- package/dist/components/buckets/BucketLocation.js +4 -4
- package/dist/components/buckets/BucketOverview.d.ts +22 -2
- package/dist/components/buckets/BucketOverview.js +394 -187
- package/dist/components/buckets/BucketPage.js +43 -21
- package/dist/components/buckets/BucketPolicyPage.js +155 -127
- package/dist/components/buckets/BucketReplicationFormPage.js +134 -133
- package/dist/components/buckets/BucketReplicationList.d.ts +2 -2
- package/dist/components/buckets/BucketReplicationList.js +42 -42
- package/dist/components/buckets/BucketVersioning.d.ts +4 -0
- package/dist/components/buckets/BucketVersioning.js +76 -0
- package/dist/components/buckets/DeleteBucketButton.js +8 -8
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +2 -2
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +2 -2
- package/dist/components/buckets/EmptyBucketButton.js +24 -24
- package/dist/components/buckets/EmptyBucketSummary.d.ts +2 -2
- package/dist/components/buckets/EmptyBucketSummary.js +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.d.ts +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.js +22 -22
- package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
- package/dist/components/buckets/notifications/BucketNotificationFormPage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationFormPage.js +316 -0
- package/dist/components/buckets/notifications/BucketNotificationList.d.ts +10 -0
- package/dist/components/buckets/notifications/BucketNotificationList.js +267 -0
- package/dist/components/buckets/notifications/EventsSection.js +145 -29
- package/dist/components/buckets/notifications/__tests__/events.test.d.ts +1 -0
- package/dist/components/buckets/notifications/__tests__/events.test.js +56 -0
- package/dist/components/buckets/notifications/events.d.ts +71 -7
- package/dist/components/buckets/notifications/events.js +98 -16
- package/dist/components/index.d.ts +27 -20
- package/dist/components/index.js +17 -10
- package/dist/components/layouts/ArrowNavigation.d.ts +3 -0
- package/dist/components/layouts/ArrowNavigation.js +28 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +5 -1
- package/dist/components/layouts/BrowserPageLayout.js +10 -5
- package/dist/components/objects/CreateFolderButton.d.ts +2 -2
- package/dist/components/objects/CreateFolderButton.js +12 -12
- package/dist/components/objects/DeleteObjectButton.d.ts +1 -1
- package/dist/components/objects/DeleteObjectButton.js +19 -21
- package/dist/components/objects/GetPresignedUrlButton.d.ts +7 -0
- package/dist/components/objects/GetPresignedUrlButton.js +255 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +263 -230
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +540 -138
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectTags.js +95 -123
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +516 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +1064 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +18 -2
- package/dist/components/objects/ObjectDetails/index.js +152 -40
- package/dist/components/objects/ObjectList.d.ts +12 -10
- package/dist/components/objects/ObjectList.js +590 -263
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +4 -4
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +15 -15
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +32 -31
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +6 -6
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +51 -51
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +78 -78
- package/dist/components/objects/ObjectPage.js +12 -8
- package/dist/components/objects/UploadButton.d.ts +3 -3
- package/dist/components/objects/UploadButton.js +10 -10
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.d.ts +1 -0
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.js +531 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +23 -12
- package/dist/components/providers/DataBrowserProvider.js +60 -38
- package/dist/components/providers/QueryProvider.d.ts +9 -0
- package/dist/components/providers/QueryProvider.js +21 -0
- package/dist/components/search/MetadataSearch.js +29 -28
- package/dist/components/search/SearchHints.js +1 -1
- package/dist/components/ui/ArrayFieldActions.js +12 -7
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +2 -2
- package/dist/components/ui/ConfirmDeleteRuleModal.js +6 -1
- package/dist/components/ui/DeleteObjectModalContent.d.ts +1 -1
- package/dist/components/ui/DeleteObjectModalContent.js +12 -12
- package/dist/components/ui/FilterFormSection.d.ts +2 -2
- package/dist/components/ui/FilterFormSection.js +29 -29
- package/dist/components/ui/Search.elements.d.ts +2 -2
- package/dist/components/ui/Search.elements.js +7 -7
- package/dist/components/ui/Table.elements.d.ts +2 -1
- package/dist/components/ui/Table.elements.js +18 -12
- package/dist/config/__tests__/factory.test.d.ts +1 -0
- package/dist/config/__tests__/factory.test.js +311 -0
- package/dist/config/factory.d.ts +10 -56
- package/dist/config/factory.js +23 -71
- package/dist/config/types.d.ts +212 -34
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
- package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.d.ts +1 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.js +145 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +45 -45
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +27 -27
- package/dist/hooks/__tests__/useLoginMutation.test.d.ts +1 -0
- package/dist/hooks/__tests__/useLoginMutation.test.js +194 -0
- package/dist/hooks/bucketConfiguration.d.ts +8 -1
- package/dist/hooks/bucketConfiguration.js +52 -51
- package/dist/hooks/bucketOperations.d.ts +10 -1
- package/dist/hooks/bucketOperations.js +10 -9
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +44 -44
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +63 -63
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +65 -65
- package/dist/hooks/factories/index.d.ts +4 -4
- package/dist/hooks/factories/index.js +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +16 -13
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3LoginHook.js +1 -1
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +3 -3
- package/dist/hooks/factories/useCreateS3MutationHook.js +7 -2
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3QueryHook.js +11 -6
- package/dist/hooks/index.d.ts +19 -12
- package/dist/hooks/index.js +16 -9
- package/dist/hooks/loginOperations.d.ts +1 -1
- package/dist/hooks/loginOperations.js +1 -1
- package/dist/hooks/objectOperations.d.ts +2 -2
- package/dist/hooks/objectOperations.js +50 -49
- package/dist/hooks/presignedOperations.d.ts +4 -4
- package/dist/hooks/presignedOperations.js +5 -5
- package/dist/hooks/useAccessibleBuckets.d.ts +11 -0
- package/dist/hooks/useAccessibleBuckets.js +115 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +48 -0
- package/dist/hooks/useBucketConfigEditor.d.ts +31 -0
- package/dist/hooks/useBucketConfigEditor.js +82 -0
- package/dist/hooks/useDataBrowserNavigate.d.ts +28 -0
- package/dist/hooks/useDataBrowserNavigate.js +24 -0
- package/dist/hooks/useDeleteBucketConfigRule.d.ts +2 -2
- package/dist/hooks/useDeleteBucketConfigRule.js +4 -4
- package/dist/hooks/useEmptyBucket.js +11 -11
- package/dist/hooks/useFeatures.d.ts +7 -0
- package/dist/hooks/useFeatures.js +8 -0
- package/dist/hooks/useISVBucketDetection.js +6 -6
- package/dist/hooks/useIsBucketEmpty.js +4 -4
- package/dist/hooks/useLimitedAccessFlow.d.ts +48 -0
- package/dist/hooks/useLimitedAccessFlow.js +23 -0
- package/dist/hooks/useS3Client.d.ts +6 -0
- package/dist/hooks/useS3Client.js +3 -2
- package/dist/hooks/useS3ConfigSwitch.d.ts +11 -0
- package/dist/hooks/useS3ConfigSwitch.js +37 -0
- package/dist/hooks/useSupportedNotificationEvents.d.ts +6 -0
- package/dist/hooks/useSupportedNotificationEvents.js +8 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -2
- package/dist/schemas/bucketPolicySchema.json +3 -13
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -1
- package/dist/test/msw/handlers/deleteBucket.js +20 -10
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketAcl.js +29 -17
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketLocation.js +29 -15
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketPolicy.js +52 -32
- package/dist/test/msw/handlers/headObject.d.ts +1 -1
- package/dist/test/msw/handlers/headObject.js +31 -13
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -1
- package/dist/test/msw/handlers/listBuckets.js +5 -3
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -1
- package/dist/test/msw/handlers/listObjectVersions.js +38 -26
- package/dist/test/msw/handlers/listObjects.d.ts +1 -1
- package/dist/test/msw/handlers/listObjects.js +35 -23
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -1
- package/dist/test/msw/handlers/objectLegalHold.js +32 -17
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -1
- package/dist/test/msw/handlers/objectRetention.js +31 -17
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/putBucketAcl.js +29 -14
- package/dist/test/msw/handlers/putObject.d.ts +1 -1
- package/dist/test/msw/handlers/putObject.js +27 -12
- package/dist/test/msw/handlers.d.ts +3 -3
- package/dist/test/msw/handlers.js +77 -54
- package/dist/test/msw/index.d.ts +2 -2
- package/dist/test/msw/index.js +1 -1
- package/dist/test/msw/server.d.ts +1 -1
- package/dist/test/msw/server.js +1 -1
- package/dist/test/msw/utils.js +2 -2
- package/dist/test/setup.d.ts +1 -1
- package/dist/test/setup.js +13 -30
- package/dist/test/testUtils.d.ts +85 -33
- package/dist/test/testUtils.js +176 -111
- package/dist/test/utils/errorHandling.test.js +119 -119
- package/dist/types/index.d.ts +49 -36
- package/dist/types/monaco.d.ts +13 -0
- package/dist/types/monaco.js +0 -0
- package/dist/utils/__tests__/proxyMiddleware.test.d.ts +1 -0
- package/dist/utils/__tests__/proxyMiddleware.test.js +579 -0
- package/dist/utils/__tests__/s3Client.test.d.ts +1 -0
- package/dist/utils/__tests__/s3Client.test.js +340 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.js +437 -0
- package/dist/utils/constants.d.ts +10 -0
- package/dist/utils/constants.js +19 -9
- package/dist/utils/deletion/index.d.ts +2 -2
- package/dist/utils/deletion/index.js +1 -1
- package/dist/utils/deletion/messages.d.ts +1 -1
- package/dist/utils/deletion/messages.js +4 -4
- package/dist/utils/errorHandling.d.ts +3 -3
- package/dist/utils/errorHandling.js +6 -6
- package/dist/utils/hooks.js +8 -8
- package/dist/utils/index.d.ts +5 -4
- package/dist/utils/index.js +4 -2
- package/dist/utils/proxyMiddleware.d.ts +32 -13
- package/dist/utils/proxyMiddleware.js +90 -36
- package/dist/utils/s3Client.d.ts +14 -4
- package/dist/utils/s3Client.js +5 -26
- package/dist/utils/s3ConfigIdentifier.d.ts +79 -0
- package/dist/utils/s3ConfigIdentifier.js +57 -0
- package/dist/utils/s3RuleUtils.d.ts +5 -5
- package/dist/utils/s3RuleUtils.js +17 -17
- package/package.json +10 -8
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +0 -316
- package/dist/components/buckets/BucketPolicyButton.d.ts +0 -7
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +0 -1
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +0 -234
- package/dist/hooks/useLoginMutation.d.ts +0 -21
- package/dist/hooks/useLoginMutation.js +0 -9
- package/dist/utils/useFeatures.d.ts +0 -1
- package/dist/utils/useFeatures.js +0 -7
- /package/dist/components/__tests__/{BucketNotificationCreatePage.test.d.ts → BucketAccessor.test.d.ts} +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { EnhancedS3Error, ErrorCategory, createS3Error, createS3OperationError, isEnhancedS3Error, isNotFoundError, isS3ServiceException, shouldRetryError } from "../../utils/errorHandling.js";
|
|
2
2
|
const TEST_CONSTANTS = {
|
|
3
|
-
REQUEST_ID:
|
|
3
|
+
REQUEST_ID: 'test-request-id',
|
|
4
4
|
ATTEMPTS: 1,
|
|
5
5
|
RETRY_DELAY: 0,
|
|
6
|
-
BUCKET:
|
|
7
|
-
KEY:
|
|
6
|
+
BUCKET: 'test-bucket',
|
|
7
|
+
KEY: 'test-key',
|
|
8
8
|
MESSAGES: {
|
|
9
|
-
NO_SUCH_BUCKET:
|
|
10
|
-
NO_SUCH_KEY:
|
|
11
|
-
INVALID_REQUEST:
|
|
12
|
-
ACCESS_DENIED:
|
|
13
|
-
INTERNAL_ERROR:
|
|
14
|
-
NETWORK_FAILED:
|
|
15
|
-
SERVICE_UNAVAILABLE:
|
|
9
|
+
NO_SUCH_BUCKET: 'The specified bucket does not exist',
|
|
10
|
+
NO_SUCH_KEY: 'The specified key does not exist',
|
|
11
|
+
INVALID_REQUEST: 'Invalid request',
|
|
12
|
+
ACCESS_DENIED: 'Access denied',
|
|
13
|
+
INTERNAL_ERROR: 'Internal error',
|
|
14
|
+
NETWORK_FAILED: 'Network connection failed',
|
|
15
|
+
SERVICE_UNAVAILABLE: 'Service temporarily unavailable'
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
const createMockAWSError = (errorType, message, statusCode = 500)=>{
|
|
19
19
|
const error = new Error(message);
|
|
20
|
-
Object.defineProperty(error,
|
|
20
|
+
Object.defineProperty(error, 'name', {
|
|
21
21
|
value: errorType,
|
|
22
22
|
writable: true
|
|
23
23
|
});
|
|
@@ -30,53 +30,53 @@ const createMockAWSError = (errorType, message, statusCode = 500)=>{
|
|
|
30
30
|
return error;
|
|
31
31
|
};
|
|
32
32
|
const TestErrors = {
|
|
33
|
-
noSuchBucket: ()=>createMockAWSError(
|
|
34
|
-
noSuchKey: ()=>createMockAWSError(
|
|
35
|
-
invalidRequest: ()=>createMockAWSError(
|
|
36
|
-
accessDenied: ()=>createMockAWSError(
|
|
37
|
-
internalError: ()=>createMockAWSError(
|
|
38
|
-
serviceUnavailable: ()=>createMockAWSError(
|
|
33
|
+
noSuchBucket: ()=>createMockAWSError('NoSuchBucket', TEST_CONSTANTS.MESSAGES.NO_SUCH_BUCKET, 404),
|
|
34
|
+
noSuchKey: ()=>createMockAWSError('NoSuchKey', TEST_CONSTANTS.MESSAGES.NO_SUCH_KEY, 404),
|
|
35
|
+
invalidRequest: ()=>createMockAWSError('InvalidRequest', TEST_CONSTANTS.MESSAGES.INVALID_REQUEST, 400),
|
|
36
|
+
accessDenied: ()=>createMockAWSError('AccessDenied', TEST_CONSTANTS.MESSAGES.ACCESS_DENIED, 403),
|
|
37
|
+
internalError: ()=>createMockAWSError('InternalError', TEST_CONSTANTS.MESSAGES.INTERNAL_ERROR, 500),
|
|
38
|
+
serviceUnavailable: ()=>createMockAWSError('ServiceUnavailable', TEST_CONSTANTS.MESSAGES.SERVICE_UNAVAILABLE, 503),
|
|
39
39
|
abortError: ()=>{
|
|
40
|
-
const error = new Error(
|
|
41
|
-
Object.defineProperty(error,
|
|
42
|
-
value:
|
|
40
|
+
const error = new Error('Operation aborted');
|
|
41
|
+
Object.defineProperty(error, 'name', {
|
|
42
|
+
value: 'AbortError',
|
|
43
43
|
writable: true
|
|
44
44
|
});
|
|
45
45
|
return error;
|
|
46
46
|
},
|
|
47
47
|
networkError: ()=>new Error(TEST_CONSTANTS.MESSAGES.NETWORK_FAILED),
|
|
48
48
|
timeoutError: ()=>{
|
|
49
|
-
const error = new Error(
|
|
50
|
-
Object.defineProperty(error,
|
|
51
|
-
value:
|
|
49
|
+
const error = new Error('Request timeout');
|
|
50
|
+
Object.defineProperty(error, 'name', {
|
|
51
|
+
value: 'TimeoutError',
|
|
52
52
|
writable: true
|
|
53
53
|
});
|
|
54
54
|
return error;
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
const TestEnhancedErrors = {
|
|
58
|
-
server: ()=>new EnhancedS3Error(
|
|
59
|
-
network: ()=>new EnhancedS3Error(
|
|
60
|
-
client: ()=>new EnhancedS3Error(
|
|
61
|
-
auth: ()=>new EnhancedS3Error(
|
|
62
|
-
notFound: ()=>new EnhancedS3Error(
|
|
63
|
-
cancelled: ()=>new EnhancedS3Error(
|
|
64
|
-
unknown: ()=>new EnhancedS3Error(
|
|
58
|
+
server: ()=>new EnhancedS3Error('Server error', 'ServerError', ErrorCategory.SERVER_ERROR, new Error()),
|
|
59
|
+
network: ()=>new EnhancedS3Error('Network error', 'NetworkError', ErrorCategory.NETWORK_ERROR, new Error()),
|
|
60
|
+
client: ()=>new EnhancedS3Error('Client error', 'ClientError', ErrorCategory.CLIENT_ERROR, new Error()),
|
|
61
|
+
auth: ()=>new EnhancedS3Error('Auth error', 'AuthError', ErrorCategory.AUTHORIZATION, new Error()),
|
|
62
|
+
notFound: ()=>new EnhancedS3Error('Not found', 'NotFoundError', ErrorCategory.NOT_FOUND, new Error()),
|
|
63
|
+
cancelled: ()=>new EnhancedS3Error('Cancelled', 'CancelError', ErrorCategory.CANCELLATION, new Error()),
|
|
64
|
+
unknown: ()=>new EnhancedS3Error('Unknown', 'UnknownError', ErrorCategory.UNKNOWN, new Error())
|
|
65
65
|
};
|
|
66
|
-
describe(
|
|
67
|
-
test(
|
|
68
|
-
expect(ErrorCategory.CLIENT_ERROR).toBe(
|
|
69
|
-
expect(ErrorCategory.SERVER_ERROR).toBe(
|
|
70
|
-
expect(ErrorCategory.NETWORK_ERROR).toBe(
|
|
71
|
-
expect(ErrorCategory.CANCELLATION).toBe(
|
|
72
|
-
expect(ErrorCategory.AUTHORIZATION).toBe(
|
|
73
|
-
expect(ErrorCategory.NOT_FOUND).toBe(
|
|
74
|
-
expect(ErrorCategory.UNKNOWN).toBe(
|
|
66
|
+
describe('ErrorCategory', ()=>{
|
|
67
|
+
test('contains all expected categories', ()=>{
|
|
68
|
+
expect(ErrorCategory.CLIENT_ERROR).toBe('CLIENT_ERROR');
|
|
69
|
+
expect(ErrorCategory.SERVER_ERROR).toBe('SERVER_ERROR');
|
|
70
|
+
expect(ErrorCategory.NETWORK_ERROR).toBe('NETWORK_ERROR');
|
|
71
|
+
expect(ErrorCategory.CANCELLATION).toBe('CANCELLATION');
|
|
72
|
+
expect(ErrorCategory.AUTHORIZATION).toBe('AUTHORIZATION');
|
|
73
|
+
expect(ErrorCategory.NOT_FOUND).toBe('NOT_FOUND');
|
|
74
|
+
expect(ErrorCategory.UNKNOWN).toBe('UNKNOWN');
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
|
-
describe(
|
|
78
|
-
test(
|
|
79
|
-
const originalError = new Error(
|
|
77
|
+
describe('EnhancedS3Error', ()=>{
|
|
78
|
+
test('creates error with all properties', ()=>{
|
|
79
|
+
const originalError = new Error('Original error');
|
|
80
80
|
const metadata = {
|
|
81
81
|
httpStatusCode: 400,
|
|
82
82
|
requestId: TEST_CONSTANTS.REQUEST_ID,
|
|
@@ -84,12 +84,12 @@ describe("EnhancedS3Error", ()=>{
|
|
|
84
84
|
totalRetryDelay: TEST_CONSTANTS.RETRY_DELAY
|
|
85
85
|
};
|
|
86
86
|
const context = {
|
|
87
|
-
operation:
|
|
87
|
+
operation: 'test',
|
|
88
88
|
bucket: TEST_CONSTANTS.BUCKET
|
|
89
89
|
};
|
|
90
|
-
const error = new EnhancedS3Error(
|
|
91
|
-
expect(error.message).toBe(
|
|
92
|
-
expect(error.name).toBe(
|
|
90
|
+
const error = new EnhancedS3Error('Test error', 'TestError', ErrorCategory.CLIENT_ERROR, originalError, 400, metadata, context);
|
|
91
|
+
expect(error.message).toBe('Test error');
|
|
92
|
+
expect(error.name).toBe('TestError');
|
|
93
93
|
expect(error.category).toBe(ErrorCategory.CLIENT_ERROR);
|
|
94
94
|
expect(error.statusCode).toBe(400);
|
|
95
95
|
expect(error.metadata).toBe(metadata);
|
|
@@ -98,12 +98,12 @@ describe("EnhancedS3Error", ()=>{
|
|
|
98
98
|
expect(error instanceof Error).toBe(true);
|
|
99
99
|
expect(error instanceof EnhancedS3Error).toBe(true);
|
|
100
100
|
});
|
|
101
|
-
describe(
|
|
102
|
-
test(
|
|
101
|
+
describe('shouldRetry', ()=>{
|
|
102
|
+
test('returns true for retryable categories', ()=>{
|
|
103
103
|
expect(TestEnhancedErrors.server().shouldRetry()).toBe(true);
|
|
104
104
|
expect(TestEnhancedErrors.network().shouldRetry()).toBe(true);
|
|
105
105
|
});
|
|
106
|
-
test(
|
|
106
|
+
test('returns false for non-retryable categories', ()=>{
|
|
107
107
|
expect(TestEnhancedErrors.client().shouldRetry()).toBe(false);
|
|
108
108
|
expect(TestEnhancedErrors.auth().shouldRetry()).toBe(false);
|
|
109
109
|
expect(TestEnhancedErrors.notFound().shouldRetry()).toBe(false);
|
|
@@ -112,59 +112,59 @@ describe("EnhancedS3Error", ()=>{
|
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
|
-
describe(
|
|
116
|
-
describe(
|
|
117
|
-
test(
|
|
115
|
+
describe('Type Guards', ()=>{
|
|
116
|
+
describe('isS3ServiceException', ()=>{
|
|
117
|
+
test('returns true for S3ServiceException', ()=>{
|
|
118
118
|
expect(isS3ServiceException(TestErrors.invalidRequest())).toBe(true);
|
|
119
119
|
});
|
|
120
|
-
test(
|
|
121
|
-
expect(isS3ServiceException(new Error(
|
|
120
|
+
test('returns false for regular Error', ()=>{
|
|
121
|
+
expect(isS3ServiceException(new Error('Regular error'))).toBe(false);
|
|
122
122
|
});
|
|
123
|
-
test(
|
|
124
|
-
expect(isS3ServiceException(
|
|
123
|
+
test('returns false for non-Error objects', ()=>{
|
|
124
|
+
expect(isS3ServiceException('string')).toBe(false);
|
|
125
125
|
expect(isS3ServiceException(null)).toBe(false);
|
|
126
126
|
expect(isS3ServiceException(void 0)).toBe(false);
|
|
127
127
|
expect(isS3ServiceException({})).toBe(false);
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
|
-
describe(
|
|
131
|
-
test(
|
|
130
|
+
describe('isEnhancedS3Error', ()=>{
|
|
131
|
+
test('returns true for EnhancedS3Error', ()=>{
|
|
132
132
|
expect(isEnhancedS3Error(TestEnhancedErrors.unknown())).toBe(true);
|
|
133
133
|
});
|
|
134
|
-
test(
|
|
135
|
-
expect(isEnhancedS3Error(new Error(
|
|
134
|
+
test('returns false for other error types', ()=>{
|
|
135
|
+
expect(isEnhancedS3Error(new Error('Regular error'))).toBe(false);
|
|
136
136
|
expect(isEnhancedS3Error(TestErrors.invalidRequest())).toBe(false);
|
|
137
|
-
expect(isEnhancedS3Error(
|
|
137
|
+
expect(isEnhancedS3Error('string')).toBe(false);
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
140
|
});
|
|
141
|
-
describe(
|
|
142
|
-
test(
|
|
141
|
+
describe('createS3Error', ()=>{
|
|
142
|
+
test('handles AbortError', ()=>{
|
|
143
143
|
const abortError = TestErrors.abortError();
|
|
144
144
|
const result = createS3Error(abortError);
|
|
145
|
-
expect(result.message).toBe(
|
|
146
|
-
expect(result.name).toBe(
|
|
145
|
+
expect(result.message).toBe('Operation was cancelled');
|
|
146
|
+
expect(result.name).toBe('AbortError');
|
|
147
147
|
expect(result.category).toBe(ErrorCategory.CANCELLATION);
|
|
148
148
|
expect(result.originalError).toBe(abortError);
|
|
149
149
|
});
|
|
150
|
-
test(
|
|
150
|
+
test('handles specific AWS errors', ()=>{
|
|
151
151
|
const testCases = [
|
|
152
152
|
{
|
|
153
153
|
error: TestErrors.noSuchBucket(),
|
|
154
154
|
expectedCategory: ErrorCategory.NOT_FOUND,
|
|
155
|
-
expectedName:
|
|
155
|
+
expectedName: 'NoSuchBucket',
|
|
156
156
|
expectedStatus: 404
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
error: TestErrors.noSuchKey(),
|
|
160
160
|
expectedCategory: ErrorCategory.NOT_FOUND,
|
|
161
|
-
expectedName:
|
|
161
|
+
expectedName: 'NoSuchKey',
|
|
162
162
|
expectedStatus: 404
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
error: TestErrors.invalidRequest(),
|
|
166
166
|
expectedCategory: ErrorCategory.CLIENT_ERROR,
|
|
167
|
-
expectedName:
|
|
167
|
+
expectedName: 'InvalidRequest',
|
|
168
168
|
expectedStatus: 400
|
|
169
169
|
}
|
|
170
170
|
];
|
|
@@ -176,7 +176,7 @@ describe("createS3Error", ()=>{
|
|
|
176
176
|
expect(result.metadata).toBe(error.$metadata);
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
|
-
test(
|
|
179
|
+
test('handles status code classification', ()=>{
|
|
180
180
|
const testCases = [
|
|
181
181
|
{
|
|
182
182
|
error: TestErrors.accessDenied(),
|
|
@@ -192,7 +192,7 @@ describe("createS3Error", ()=>{
|
|
|
192
192
|
expect(result.category).toBe(expectedCategory);
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
|
-
test(
|
|
195
|
+
test('handles network errors', ()=>{
|
|
196
196
|
const testCases = [
|
|
197
197
|
TestErrors.networkError(),
|
|
198
198
|
TestErrors.timeoutError()
|
|
@@ -202,28 +202,28 @@ describe("createS3Error", ()=>{
|
|
|
202
202
|
expect(result.category).toBe(ErrorCategory.NETWORK_ERROR);
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
-
test(
|
|
205
|
+
test('handles edge cases', ()=>{
|
|
206
206
|
const testCases = [
|
|
207
207
|
{
|
|
208
|
-
input: new Error(
|
|
208
|
+
input: new Error('Some error'),
|
|
209
209
|
expectedCategory: ErrorCategory.UNKNOWN,
|
|
210
|
-
expectedMessage:
|
|
210
|
+
expectedMessage: 'Some error'
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
|
-
input:
|
|
213
|
+
input: 'String error',
|
|
214
214
|
expectedCategory: ErrorCategory.UNKNOWN,
|
|
215
|
-
expectedMessage:
|
|
216
|
-
expectedName:
|
|
215
|
+
expectedMessage: 'String error',
|
|
216
|
+
expectedName: 'UnknownError'
|
|
217
217
|
},
|
|
218
218
|
{
|
|
219
219
|
input: null,
|
|
220
220
|
expectedCategory: ErrorCategory.UNKNOWN,
|
|
221
|
-
expectedMessage:
|
|
221
|
+
expectedMessage: 'Unknown error occurred'
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
224
|
input: void 0,
|
|
225
225
|
expectedCategory: ErrorCategory.UNKNOWN,
|
|
226
|
-
expectedMessage:
|
|
226
|
+
expectedMessage: 'Unknown error occurred'
|
|
227
227
|
}
|
|
228
228
|
];
|
|
229
229
|
testCases.forEach(({ input, expectedCategory, expectedMessage, expectedName })=>{
|
|
@@ -233,37 +233,37 @@ describe("createS3Error", ()=>{
|
|
|
233
233
|
if (expectedName) expect(result.name).toBe(expectedName);
|
|
234
234
|
});
|
|
235
235
|
});
|
|
236
|
-
test(
|
|
236
|
+
test('preserves context', ()=>{
|
|
237
237
|
const context = {
|
|
238
|
-
operation:
|
|
238
|
+
operation: 'test',
|
|
239
239
|
bucket: TEST_CONSTANTS.BUCKET
|
|
240
240
|
};
|
|
241
|
-
const result = createS3Error(new Error(
|
|
241
|
+
const result = createS3Error(new Error('Test error'), context);
|
|
242
242
|
expect(result.context).toBe(context);
|
|
243
243
|
});
|
|
244
244
|
});
|
|
245
|
-
describe(
|
|
246
|
-
test(
|
|
245
|
+
describe('createS3OperationError', ()=>{
|
|
246
|
+
test('message modification scenarios', ()=>{
|
|
247
247
|
const testCases = [
|
|
248
248
|
{
|
|
249
|
-
name:
|
|
250
|
-
error: new Error(
|
|
251
|
-
operation:
|
|
249
|
+
name: 'preserves existing operation in message',
|
|
250
|
+
error: new Error('ListObjectsV2 failed: Access denied'),
|
|
251
|
+
operation: 'ListObjectsV2',
|
|
252
252
|
bucket: TEST_CONSTANTS.BUCKET,
|
|
253
|
-
expectedMessage:
|
|
253
|
+
expectedMessage: 'ListObjectsV2 failed: Access denied'
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
|
-
name:
|
|
256
|
+
name: 'enhances message with operation context',
|
|
257
257
|
error: new Error(TEST_CONSTANTS.MESSAGES.ACCESS_DENIED),
|
|
258
|
-
operation:
|
|
258
|
+
operation: 'GetObject',
|
|
259
259
|
bucket: TEST_CONSTANTS.BUCKET,
|
|
260
260
|
key: TEST_CONSTANTS.KEY,
|
|
261
261
|
expectedMessage: `GetObject failed for bucket '${TEST_CONSTANTS.BUCKET}', key '${TEST_CONSTANTS.KEY}': ${TEST_CONSTANTS.MESSAGES.ACCESS_DENIED}`
|
|
262
262
|
},
|
|
263
263
|
{
|
|
264
|
-
name:
|
|
264
|
+
name: 'handles operation without bucket',
|
|
265
265
|
error: new Error(TEST_CONSTANTS.MESSAGES.SERVICE_UNAVAILABLE),
|
|
266
|
-
operation:
|
|
266
|
+
operation: 'ListBuckets',
|
|
267
267
|
expectedMessage: `ListBuckets failed: ${TEST_CONSTANTS.MESSAGES.SERVICE_UNAVAILABLE}`
|
|
268
268
|
}
|
|
269
269
|
];
|
|
@@ -278,17 +278,17 @@ describe("createS3OperationError", ()=>{
|
|
|
278
278
|
});
|
|
279
279
|
});
|
|
280
280
|
});
|
|
281
|
-
test(
|
|
281
|
+
test('preserves all error properties', ()=>{
|
|
282
282
|
const originalError = TestErrors.noSuchBucket();
|
|
283
|
-
const result = createS3OperationError(originalError,
|
|
283
|
+
const result = createS3OperationError(originalError, 'HeadObject', TEST_CONSTANTS.BUCKET, TEST_CONSTANTS.KEY);
|
|
284
284
|
expect(result.category).toBe(ErrorCategory.NOT_FOUND);
|
|
285
285
|
expect(result.statusCode).toBe(404);
|
|
286
286
|
expect(result.metadata).toBe(originalError.$metadata);
|
|
287
287
|
expect(result.originalError).toBe(originalError);
|
|
288
288
|
});
|
|
289
289
|
});
|
|
290
|
-
describe(
|
|
291
|
-
test(
|
|
290
|
+
describe('shouldRetryError', ()=>{
|
|
291
|
+
test('respects maxRetries limit', ()=>{
|
|
292
292
|
const retryableError = TestEnhancedErrors.server();
|
|
293
293
|
const maxRetries = 3;
|
|
294
294
|
expect(shouldRetryError(retryableError, 0, maxRetries)).toBe(true);
|
|
@@ -296,7 +296,7 @@ describe("shouldRetryError", ()=>{
|
|
|
296
296
|
expect(shouldRetryError(retryableError, 3, maxRetries)).toBe(false);
|
|
297
297
|
expect(shouldRetryError(retryableError, 5, maxRetries)).toBe(false);
|
|
298
298
|
});
|
|
299
|
-
test(
|
|
299
|
+
test('uses error category for retry decision', ()=>{
|
|
300
300
|
const testCases = [
|
|
301
301
|
{
|
|
302
302
|
error: TestEnhancedErrors.server(),
|
|
@@ -319,7 +319,7 @@ describe("shouldRetryError", ()=>{
|
|
|
319
319
|
expect(shouldRetryError(error, 0)).toBe(shouldRetry);
|
|
320
320
|
});
|
|
321
321
|
});
|
|
322
|
-
test(
|
|
322
|
+
test('converts and retries AWS errors', ()=>{
|
|
323
323
|
const testCases = [
|
|
324
324
|
{
|
|
325
325
|
error: TestErrors.internalError(),
|
|
@@ -334,25 +334,25 @@ describe("shouldRetryError", ()=>{
|
|
|
334
334
|
expect(shouldRetryError(error, 0)).toBe(shouldRetry);
|
|
335
335
|
});
|
|
336
336
|
});
|
|
337
|
-
test(
|
|
337
|
+
test('uses default maxRetries of 3', ()=>{
|
|
338
338
|
const retryableError = TestEnhancedErrors.server();
|
|
339
339
|
expect(shouldRetryError(retryableError, 0)).toBe(true);
|
|
340
340
|
expect(shouldRetryError(retryableError, 3)).toBe(false);
|
|
341
341
|
});
|
|
342
342
|
});
|
|
343
|
-
describe(
|
|
344
|
-
test(
|
|
343
|
+
describe('isNotFoundError', ()=>{
|
|
344
|
+
test('returns true for NOT_FOUND category errors', ()=>{
|
|
345
345
|
expect(isNotFoundError(TestEnhancedErrors.notFound())).toBe(true);
|
|
346
346
|
});
|
|
347
|
-
test(
|
|
347
|
+
test('returns true for AWS NOT_FOUND errors', ()=>{
|
|
348
348
|
expect(isNotFoundError(TestErrors.noSuchBucket())).toBe(true);
|
|
349
349
|
expect(isNotFoundError(TestErrors.noSuchKey())).toBe(true);
|
|
350
350
|
});
|
|
351
|
-
test(
|
|
352
|
-
const error404 = createMockAWSError(
|
|
351
|
+
test('returns true for 404 status code errors', ()=>{
|
|
352
|
+
const error404 = createMockAWSError('NoSuchLifecycleConfiguration', 'The lifecycle configuration does not exist', 404);
|
|
353
353
|
expect(isNotFoundError(error404)).toBe(true);
|
|
354
354
|
});
|
|
355
|
-
test(
|
|
355
|
+
test('returns false for other error categories', ()=>{
|
|
356
356
|
expect(isNotFoundError(TestEnhancedErrors.server())).toBe(false);
|
|
357
357
|
expect(isNotFoundError(TestEnhancedErrors.network())).toBe(false);
|
|
358
358
|
expect(isNotFoundError(TestEnhancedErrors.client())).toBe(false);
|
|
@@ -360,39 +360,39 @@ describe("isNotFoundError", ()=>{
|
|
|
360
360
|
expect(isNotFoundError(TestEnhancedErrors.cancelled())).toBe(false);
|
|
361
361
|
expect(isNotFoundError(TestEnhancedErrors.unknown())).toBe(false);
|
|
362
362
|
});
|
|
363
|
-
test(
|
|
363
|
+
test('returns false for non-404 AWS errors', ()=>{
|
|
364
364
|
expect(isNotFoundError(TestErrors.invalidRequest())).toBe(false);
|
|
365
365
|
expect(isNotFoundError(TestErrors.accessDenied())).toBe(false);
|
|
366
366
|
expect(isNotFoundError(TestErrors.internalError())).toBe(false);
|
|
367
367
|
});
|
|
368
|
-
test(
|
|
368
|
+
test('handles edge cases', ()=>{
|
|
369
369
|
expect(isNotFoundError(null)).toBe(false);
|
|
370
370
|
expect(isNotFoundError(void 0)).toBe(false);
|
|
371
|
-
expect(isNotFoundError(
|
|
371
|
+
expect(isNotFoundError('string')).toBe(false);
|
|
372
372
|
expect(isNotFoundError({})).toBe(false);
|
|
373
|
-
expect(isNotFoundError(new Error(
|
|
373
|
+
expect(isNotFoundError(new Error('Regular error'))).toBe(false);
|
|
374
374
|
});
|
|
375
|
-
test(
|
|
376
|
-
const regularError = new Error(
|
|
375
|
+
test('works with any error type by converting to EnhancedS3Error', ()=>{
|
|
376
|
+
const regularError = new Error('Some error');
|
|
377
377
|
const result = isNotFoundError(regularError);
|
|
378
378
|
expect(result).toBe(false);
|
|
379
379
|
});
|
|
380
380
|
});
|
|
381
|
-
describe(
|
|
382
|
-
test(
|
|
381
|
+
describe('Integration Tests', ()=>{
|
|
382
|
+
test('complete error processing workflow', ()=>{
|
|
383
383
|
const testCases = [
|
|
384
384
|
{
|
|
385
|
-
name:
|
|
385
|
+
name: 'NoSuchBucket - non-retryable',
|
|
386
386
|
originalError: TestErrors.noSuchBucket(),
|
|
387
|
-
operation:
|
|
387
|
+
operation: 'ListObjectsV2',
|
|
388
388
|
bucket: TEST_CONSTANTS.BUCKET,
|
|
389
389
|
expectedCategory: ErrorCategory.NOT_FOUND,
|
|
390
390
|
shouldRetry: false
|
|
391
391
|
},
|
|
392
392
|
{
|
|
393
|
-
name:
|
|
393
|
+
name: 'Server error - retryable',
|
|
394
394
|
originalError: TestErrors.serviceUnavailable(),
|
|
395
|
-
operation:
|
|
395
|
+
operation: 'PutObject',
|
|
396
396
|
bucket: TEST_CONSTANTS.BUCKET,
|
|
397
397
|
key: TEST_CONSTANTS.KEY,
|
|
398
398
|
expectedCategory: ErrorCategory.SERVER_ERROR,
|
|
@@ -408,9 +408,9 @@ describe("Integration Tests", ()=>{
|
|
|
408
408
|
expect(shouldRetryError(operationError, 3)).toBe(false);
|
|
409
409
|
});
|
|
410
410
|
});
|
|
411
|
-
test(
|
|
411
|
+
test('retry attempt progression', ()=>{
|
|
412
412
|
const serverError = TestErrors.serviceUnavailable();
|
|
413
|
-
const operationError = createS3OperationError(serverError,
|
|
413
|
+
const operationError = createS3OperationError(serverError, 'PutObject', TEST_CONSTANTS.BUCKET, TEST_CONSTANTS.KEY);
|
|
414
414
|
[
|
|
415
415
|
0,
|
|
416
416
|
1,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
import { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
1
|
+
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
2
|
import type { AwsCredentialIdentity } from "@aws-sdk/types";
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
import type { ProxyConfiguration, S3EventType } from "../config/types";
|
|
4
|
+
export type { _Object, Bucket, BucketCannedACL, BucketLocationConstraint, CopyObjectCommandInput, CopyObjectCommandOutput, CreateBucketCommandInput, CreateBucketCommandOutput, DeleteBucketCommandInput, DeleteBucketCommandOutput, DeleteBucketCorsCommandOutput, DeleteBucketLifecycleCommandOutput, DeleteBucketPolicyCommandOutput, DeleteBucketReplicationCommandOutput, DeleteBucketTaggingCommandOutput, DeleteMarkerEntry, DeleteObjectCommandInput, DeleteObjectCommandOutput, DeleteObjectsCommandInput, DeleteObjectsCommandOutput, DeleteObjectTaggingCommandOutput, GetBucketAclCommandOutput, GetBucketCorsCommandOutput, GetBucketEncryptionCommandOutput, GetBucketLifecycleConfigurationCommandOutput, GetBucketLocationCommandInput, GetBucketLocationCommandOutput, GetBucketNotificationConfigurationCommandOutput, GetBucketPolicyCommandOutput, GetBucketReplicationCommandOutput, GetBucketTaggingCommandOutput, GetBucketVersioningCommandOutput, GetObjectAclCommandOutput, GetObjectAttributesCommandInput, GetObjectAttributesCommandOutput, GetObjectCommandInput, GetObjectCommandOutput, GetObjectLegalHoldCommandOutput, GetObjectLockConfigurationCommandOutput, GetObjectRetentionCommandOutput, GetObjectTaggingCommandOutput, GetObjectTorrentCommandOutput, HeadObjectCommandInput, HeadObjectCommandOutput, ListBucketsCommandOutput, ListMultipartUploadsCommandInput, ListMultipartUploadsCommandOutput, ListObjectsV2CommandInput, ListObjectsV2CommandOutput, ListObjectVersionsCommandInput, ListObjectVersionsCommandOutput, ObjectCannedACL, ObjectVersion, Owner, PutBucketAclCommandInput, PutBucketCorsCommandInput, PutBucketEncryptionCommandInput, PutBucketLifecycleConfigurationCommandInput, PutBucketNotificationConfigurationCommandInput, PutBucketPolicyCommandInput, PutBucketReplicationCommandInput, PutBucketTaggingCommandInput, PutBucketTaggingCommandOutput, PutBucketVersioningCommandInput, PutObjectAclCommandInput, PutObjectCommandInput, PutObjectCommandOutput, PutObjectLegalHoldCommandInput, PutObjectLockConfigurationCommandInput, PutObjectRetentionCommandInput, PutObjectTaggingCommandInput, RestoreObjectCommandInput, RestoreObjectCommandOutput, SelectObjectContentCommandInput, SelectObjectContentCommandOutput, Tag, } from '@aws-sdk/client-s3';
|
|
5
|
+
export type { MonacoJsonDefaults, MonacoLanguagesJson } from './monaco';
|
|
6
|
+
/**
|
|
7
|
+
* S3 backend capabilities configuration.
|
|
8
|
+
*/
|
|
9
|
+
export interface S3Capabilities {
|
|
10
|
+
bucketEncryption?: boolean;
|
|
11
|
+
supportedNotificationEvents?: S3EventType[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* S3 browser configuration options.
|
|
15
|
+
*
|
|
16
|
+
* This interface extends the AWS S3 client config with additional options
|
|
17
|
+
* specific to the data browser library.
|
|
18
|
+
*/
|
|
19
|
+
export interface S3BrowserConfig extends Omit<S3ClientConfig, 'credentials'> {
|
|
5
20
|
endpoint?: string;
|
|
6
21
|
region: string;
|
|
7
22
|
forcePathStyle?: boolean;
|
|
8
|
-
|
|
9
|
-
realS3Host?: string;
|
|
10
|
-
proxyPath?: string;
|
|
11
|
-
proxyHost?: string;
|
|
12
|
-
proxyPort?: number;
|
|
23
|
+
proxy?: ProxyConfiguration;
|
|
13
24
|
publicAclIndicator?: string;
|
|
25
|
+
s3Capabilities?: S3Capabilities;
|
|
26
|
+
features?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Stable identifier for React Query cache isolation.
|
|
29
|
+
*
|
|
30
|
+
* When provided, this value is used as the primary cache key instead of
|
|
31
|
+
* deriving it from credentials. This is essential when credentials change
|
|
32
|
+
* frequently (e.g., OIDC token refresh triggering new AssumeRole calls)
|
|
33
|
+
* but represent the same logical identity/permissions.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // For AssumeRole scenarios, use the role ARN as cacheKey
|
|
37
|
+
* cacheKey: 'arn:aws:iam::123456789012:role/MyRole'
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // For direct credentials (standalone mode), omit cacheKey
|
|
41
|
+
* // The library will use accessKeyId as fallback
|
|
42
|
+
*/
|
|
43
|
+
cacheKey?: string;
|
|
14
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* AWS credentials for S3 authentication.
|
|
47
|
+
*/
|
|
15
48
|
export interface S3Credentials extends AwsCredentialIdentity {
|
|
16
|
-
roleArn?: string;
|
|
17
|
-
features?: string[];
|
|
18
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Function type that returns the current S3 configuration with credentials.
|
|
52
|
+
*
|
|
53
|
+
* This function is called by the DataBrowserProvider to get the latest
|
|
54
|
+
* configuration. It should return fresh credentials when they have been
|
|
55
|
+
* refreshed.
|
|
56
|
+
*/
|
|
19
57
|
export type GetConfigFunction = () => S3BrowserConfig & {
|
|
20
58
|
credentials: S3Credentials;
|
|
21
59
|
};
|
|
22
|
-
export
|
|
23
|
-
key: string;
|
|
24
|
-
size?: number;
|
|
25
|
-
lastModified?: Date;
|
|
26
|
-
etag?: string;
|
|
27
|
-
storageClass?: string;
|
|
28
|
-
owner?: {
|
|
29
|
-
displayName?: string;
|
|
30
|
-
id?: string;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface ObjectVersion extends ObjectInfo {
|
|
34
|
-
versionId: string;
|
|
35
|
-
isLatest: boolean;
|
|
36
|
-
isDeleteMarker?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface CommonPrefix {
|
|
39
|
-
prefix: string;
|
|
40
|
-
}
|
|
41
|
-
export interface ListObjectsResult {
|
|
42
|
-
objects: ObjectInfo[];
|
|
43
|
-
commonPrefixes: CommonPrefix[];
|
|
44
|
-
nextContinuationToken?: string;
|
|
45
|
-
isTruncated: boolean;
|
|
46
|
-
}
|
|
47
|
-
export type S3ErrorCode = "AccessDenied" | "NoSuchBucket" | "NoSuchKey" | "InvalidBucketName" | "BucketNotFound" | "NetworkError" | "UnknownError";
|
|
60
|
+
export type S3ErrorCode = 'AccessDenied' | 'NoSuchBucket' | 'NoSuchKey' | 'InvalidBucketName' | 'BucketNotFound' | 'NetworkError' | 'UnknownError';
|
|
48
61
|
export interface S3Error extends Error {
|
|
49
62
|
code?: S3ErrorCode;
|
|
50
63
|
statusCode?: number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface MonacoJsonDefaults {
|
|
2
|
+
setDiagnosticsOptions(options: {
|
|
3
|
+
validate: boolean;
|
|
4
|
+
schemas?: Array<{
|
|
5
|
+
uri: string;
|
|
6
|
+
fileMatch: string[];
|
|
7
|
+
schema: unknown;
|
|
8
|
+
}>;
|
|
9
|
+
}): void;
|
|
10
|
+
}
|
|
11
|
+
export interface MonacoLanguagesJson {
|
|
12
|
+
jsonDefaults: MonacoJsonDefaults;
|
|
13
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|