@atlaskit/media-client 39.1.20 → 39.2.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/CHANGELOG.md +17 -0
- package/dist/cjs/test-helpers/AuthParameter.js +1 -0
- package/dist/cjs/test-helpers/MediaHeaders.js +1 -0
- package/dist/cjs/test-helpers/MockedMediaApi/MockedMediaApi.js +615 -0
- package/dist/cjs/test-helpers/MockedMediaApi/assign.js +21 -0
- package/dist/cjs/test-helpers/MockedMediaApi/copy.js +18 -0
- package/dist/cjs/test-helpers/MockedMediaApi/createEmptyFileItem.js +29 -0
- package/dist/cjs/test-helpers/MockedMediaApi/createErrorFileState.js +14 -0
- package/dist/cjs/test-helpers/MockedMediaApi/createFileState.js +29 -0
- package/dist/cjs/test-helpers/MockedMediaApi/createProcessingFileItem.js +64 -0
- package/dist/cjs/test-helpers/MockedMediaApi/createUploadingFileState.js +30 -0
- package/dist/cjs/test-helpers/MockedMediaApi/getIdentifier.js +16 -0
- package/dist/cjs/test-helpers/MockedMediaApi/getMediaFile.js +18 -0
- package/dist/cjs/test-helpers/MockedMediaApi/helpers.js +82 -0
- package/dist/cjs/test-helpers/MockedMediaApi/merge.js +21 -0
- package/dist/cjs/test-helpers/MockedMediaApi/normaliseInput.js +12 -0
- package/dist/cjs/test-helpers/MockedMediaApi/types.js +5 -0
- package/dist/cjs/test-helpers/_numbers.js +9 -0
- package/dist/cjs/test-helpers/authProvider.js +69 -0
- package/dist/cjs/test-helpers/cachedAuths.js +7 -0
- package/dist/cjs/test-helpers/collectionNames.js +11 -0
- package/dist/cjs/test-helpers/createMediaStoreError.js +10 -0
- package/dist/cjs/test-helpers/createPollingMaxAttemptsError.js +13 -0
- package/dist/cjs/test-helpers/createRateLimitedError.js +18 -0
- package/dist/cjs/test-helpers/createServerUnauthorizedError.js +19 -0
- package/dist/cjs/test-helpers/createStorybookMediaClient.js +19 -0
- package/dist/cjs/test-helpers/createStorybookMediaClientConfig.js +24 -0
- package/dist/cjs/test-helpers/createUploadMediaClient.js +11 -0
- package/dist/cjs/test-helpers/createUploadMediaClientConfig.js +13 -0
- package/dist/cjs/test-helpers/defaultAuthParameter.js +9 -0
- package/dist/cjs/test-helpers/defaultMediaPickerAuthProvider.js +17 -0
- package/dist/cjs/test-helpers/defaultMetadata.js +16 -0
- package/dist/cjs/test-helpers/exampleMediaItems.js +298 -0
- package/dist/cjs/test-helpers/fakeMediaClient.js +78 -0
- package/dist/cjs/test-helpers/getDefaultMediaClientConfig.js +15 -0
- package/dist/cjs/test-helpers/index.js +582 -0
- package/dist/cjs/test-helpers/mediaClientErrors.js +40 -0
- package/dist/cjs/test-helpers/mediaClientProvider.js +73 -0
- package/dist/cjs/test-helpers/mediaPickerAuthProvider.js +56 -0
- package/dist/cjs/test-helpers/requestAuthProvider.js +48 -0
- package/dist/es2019/test-helpers/AuthParameter.js +0 -0
- package/dist/es2019/test-helpers/MediaHeaders.js +0 -0
- package/dist/es2019/test-helpers/MockedMediaApi/MockedMediaApi.js +205 -0
- package/dist/es2019/test-helpers/MockedMediaApi/assign.js +18 -0
- package/dist/es2019/test-helpers/MockedMediaApi/copy.js +8 -0
- package/dist/es2019/test-helpers/MockedMediaApi/createEmptyFileItem.js +23 -0
- package/dist/es2019/test-helpers/MockedMediaApi/createErrorFileState.js +6 -0
- package/dist/es2019/test-helpers/MockedMediaApi/createFileState.js +23 -0
- package/dist/es2019/test-helpers/MockedMediaApi/createProcessingFileItem.js +53 -0
- package/dist/es2019/test-helpers/MockedMediaApi/createUploadingFileState.js +24 -0
- package/dist/es2019/test-helpers/MockedMediaApi/getIdentifier.js +8 -0
- package/dist/es2019/test-helpers/MockedMediaApi/getMediaFile.js +7 -0
- package/dist/es2019/test-helpers/MockedMediaApi/helpers.js +47 -0
- package/dist/es2019/test-helpers/MockedMediaApi/merge.js +18 -0
- package/dist/es2019/test-helpers/MockedMediaApi/normaliseInput.js +4 -0
- package/dist/es2019/test-helpers/MockedMediaApi/types.js +1 -0
- package/dist/es2019/test-helpers/_numbers.js +3 -0
- package/dist/es2019/test-helpers/authProvider.js +34 -0
- package/dist/es2019/test-helpers/cachedAuths.js +1 -0
- package/dist/es2019/test-helpers/collectionNames.js +5 -0
- package/dist/es2019/test-helpers/createMediaStoreError.js +2 -0
- package/dist/es2019/test-helpers/createPollingMaxAttemptsError.js +4 -0
- package/dist/es2019/test-helpers/createRateLimitedError.js +6 -0
- package/dist/es2019/test-helpers/createServerUnauthorizedError.js +6 -0
- package/dist/es2019/test-helpers/createStorybookMediaClient.js +13 -0
- package/dist/es2019/test-helpers/createStorybookMediaClientConfig.js +17 -0
- package/dist/es2019/test-helpers/createUploadMediaClient.js +3 -0
- package/dist/es2019/test-helpers/createUploadMediaClientConfig.js +5 -0
- package/dist/es2019/test-helpers/defaultAuthParameter.js +3 -0
- package/dist/es2019/test-helpers/defaultMediaPickerAuthProvider.js +9 -0
- package/dist/es2019/test-helpers/defaultMetadata.js +10 -0
- package/dist/es2019/test-helpers/exampleMediaItems.js +292 -0
- package/dist/es2019/test-helpers/fakeMediaClient.js +63 -0
- package/dist/es2019/test-helpers/getDefaultMediaClientConfig.js +7 -0
- package/dist/es2019/test-helpers/index.js +103 -0
- package/dist/es2019/test-helpers/mediaClientErrors.js +26 -0
- package/dist/es2019/test-helpers/mediaClientProvider.js +33 -0
- package/dist/es2019/test-helpers/mediaPickerAuthProvider.js +39 -0
- package/dist/es2019/test-helpers/requestAuthProvider.js +18 -0
- package/dist/esm/test-helpers/AuthParameter.js +0 -0
- package/dist/esm/test-helpers/MediaHeaders.js +0 -0
- package/dist/esm/test-helpers/MockedMediaApi/MockedMediaApi.js +608 -0
- package/dist/esm/test-helpers/MockedMediaApi/assign.js +14 -0
- package/dist/esm/test-helpers/MockedMediaApi/copy.js +11 -0
- package/dist/esm/test-helpers/MockedMediaApi/createEmptyFileItem.js +23 -0
- package/dist/esm/test-helpers/MockedMediaApi/createErrorFileState.js +8 -0
- package/dist/esm/test-helpers/MockedMediaApi/createFileState.js +23 -0
- package/dist/esm/test-helpers/MockedMediaApi/createProcessingFileItem.js +57 -0
- package/dist/esm/test-helpers/MockedMediaApi/createUploadingFileState.js +24 -0
- package/dist/esm/test-helpers/MockedMediaApi/getIdentifier.js +10 -0
- package/dist/esm/test-helpers/MockedMediaApi/getMediaFile.js +11 -0
- package/dist/esm/test-helpers/MockedMediaApi/helpers.js +47 -0
- package/dist/esm/test-helpers/MockedMediaApi/merge.js +14 -0
- package/dist/esm/test-helpers/MockedMediaApi/normaliseInput.js +6 -0
- package/dist/esm/test-helpers/MockedMediaApi/types.js +1 -0
- package/dist/esm/test-helpers/_numbers.js +3 -0
- package/dist/esm/test-helpers/authProvider.js +62 -0
- package/dist/esm/test-helpers/cachedAuths.js +1 -0
- package/dist/esm/test-helpers/collectionNames.js +5 -0
- package/dist/esm/test-helpers/createMediaStoreError.js +4 -0
- package/dist/esm/test-helpers/createPollingMaxAttemptsError.js +7 -0
- package/dist/esm/test-helpers/createRateLimitedError.js +11 -0
- package/dist/esm/test-helpers/createServerUnauthorizedError.js +12 -0
- package/dist/esm/test-helpers/createStorybookMediaClient.js +14 -0
- package/dist/esm/test-helpers/createStorybookMediaClientConfig.js +18 -0
- package/dist/esm/test-helpers/createUploadMediaClient.js +5 -0
- package/dist/esm/test-helpers/createUploadMediaClientConfig.js +7 -0
- package/dist/esm/test-helpers/defaultAuthParameter.js +3 -0
- package/dist/esm/test-helpers/defaultMediaPickerAuthProvider.js +11 -0
- package/dist/esm/test-helpers/defaultMetadata.js +10 -0
- package/dist/esm/test-helpers/exampleMediaItems.js +292 -0
- package/dist/esm/test-helpers/fakeMediaClient.js +67 -0
- package/dist/esm/test-helpers/getDefaultMediaClientConfig.js +9 -0
- package/dist/esm/test-helpers/index.js +103 -0
- package/dist/esm/test-helpers/mediaClientErrors.js +26 -0
- package/dist/esm/test-helpers/mediaClientProvider.js +33 -0
- package/dist/esm/test-helpers/mediaPickerAuthProvider.js +43 -0
- package/dist/esm/test-helpers/requestAuthProvider.js +41 -0
- package/dist/types/test-helpers/AuthParameter.d.ts +3 -0
- package/dist/types/test-helpers/MediaHeaders.d.ts +4 -0
- package/dist/types/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +16 -0
- package/dist/types/test-helpers/MockedMediaApi/assign.d.ts +6 -0
- package/dist/types/test-helpers/MockedMediaApi/copy.d.ts +5 -0
- package/dist/types/test-helpers/MockedMediaApi/createEmptyFileItem.d.ts +2 -0
- package/dist/types/test-helpers/MockedMediaApi/createErrorFileState.d.ts +4 -0
- package/dist/types/test-helpers/MockedMediaApi/createFileState.d.ts +3 -0
- package/dist/types/test-helpers/MockedMediaApi/createProcessingFileItem.d.ts +6 -0
- package/dist/types/test-helpers/MockedMediaApi/createUploadingFileState.d.ts +3 -0
- package/dist/types/test-helpers/MockedMediaApi/getIdentifier.d.ts +6 -0
- package/dist/types/test-helpers/MockedMediaApi/getMediaFile.d.ts +3 -0
- package/dist/types/test-helpers/MockedMediaApi/helpers.d.ts +44 -0
- package/dist/types/test-helpers/MockedMediaApi/merge.d.ts +5 -0
- package/dist/types/test-helpers/MockedMediaApi/normaliseInput.d.ts +1 -0
- package/dist/types/test-helpers/MockedMediaApi/types.d.ts +8 -0
- package/dist/types/test-helpers/_numbers.d.ts +1 -0
- package/dist/types/test-helpers/authProvider.d.ts +6 -0
- package/dist/types/test-helpers/cachedAuths.d.ts +4 -0
- package/dist/types/test-helpers/collectionNames.d.ts +5 -0
- package/dist/types/test-helpers/createMediaStoreError.d.ts +2 -0
- package/dist/types/test-helpers/createPollingMaxAttemptsError.d.ts +2 -0
- package/dist/types/test-helpers/createRateLimitedError.d.ts +8 -0
- package/dist/types/test-helpers/createServerUnauthorizedError.d.ts +8 -0
- package/dist/types/test-helpers/createStorybookMediaClient.d.ts +9 -0
- package/dist/types/test-helpers/createStorybookMediaClientConfig.d.ts +3 -0
- package/dist/types/test-helpers/createUploadMediaClient.d.ts +2 -0
- package/dist/types/test-helpers/createUploadMediaClientConfig.d.ts +3 -0
- package/dist/types/test-helpers/defaultAuthParameter.d.ts +2 -0
- package/dist/types/test-helpers/defaultMediaPickerAuthProvider.d.ts +1 -0
- package/dist/types/test-helpers/defaultMetadata.d.ts +3 -0
- package/dist/types/test-helpers/exampleMediaItems.d.ts +75 -0
- package/dist/types/test-helpers/fakeMediaClient.d.ts +7 -0
- package/dist/types/test-helpers/getDefaultMediaClientConfig.d.ts +2 -0
- package/dist/types/test-helpers/index.d.ts +103 -0
- package/dist/types/test-helpers/mediaClientErrors.d.ts +24 -0
- package/dist/types/test-helpers/mediaClientProvider.d.ts +30 -0
- package/dist/types/test-helpers/mediaPickerAuthProvider.d.ts +14 -0
- package/dist/types/test-helpers/requestAuthProvider.d.ts +3 -0
- package/package.json +3 -3
- package/test-helpers/package.json +8 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoryBookAuthProvider } from './authProvider';
|
|
2
|
+
import { collectionNames } from './collectionNames';
|
|
3
|
+
import { defaultAuthParameter } from './defaultAuthParameter';
|
|
4
|
+
export const createStorybookMediaClientConfig = (authParameter = defaultAuthParameter) => {
|
|
5
|
+
const scopes = {
|
|
6
|
+
'urn:filestore:file:*': ['read'],
|
|
7
|
+
'urn:filestore:chunk:*': ['read']
|
|
8
|
+
};
|
|
9
|
+
collectionNames.forEach(c => {
|
|
10
|
+
scopes[`urn:filestore:collection:${c}`] = ['read', 'update'];
|
|
11
|
+
});
|
|
12
|
+
const isAsapEnvironment = authParameter.authType === 'asap';
|
|
13
|
+
const authProvider = StoryBookAuthProvider.create(isAsapEnvironment, scopes);
|
|
14
|
+
return {
|
|
15
|
+
authProvider
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { authProviderBaseURL } from './mediaPickerAuthProvider';
|
|
2
|
+
export const defaultMediaPickerAuthProvider = () => () => {
|
|
3
|
+
const auth = {
|
|
4
|
+
clientId: 'a89be2a1-f91f-485c-9962-a8fb25ccfa13',
|
|
5
|
+
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhODliZTJhMS1mOTFmLTQ4NWMtOTk2Mi1hOGZiMjVjY2ZhMTMiLCJ1bnNhZmUiOnRydWUsImlhdCI6MTQ3MzIyNTEzNn0.6Isj5jKgKzWDnPqfoMLiC_LVIlGM8kg_wxG6eGGwhTw',
|
|
6
|
+
baseUrl: authProviderBaseURL
|
|
7
|
+
};
|
|
8
|
+
return Promise.resolve(auth);
|
|
9
|
+
};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { videoPreviewURI } from '@atlaskit/media-common/videoPreviewURI';
|
|
2
|
+
import { videoURI } from '@atlaskit/media-common/videoURI';
|
|
3
|
+
import { defaultCollectionName as collectionName, onlyAnimatedGifsCollectionName } from './collectionNames';
|
|
4
|
+
const fileType = 'file';
|
|
5
|
+
|
|
6
|
+
// === FILE ===
|
|
7
|
+
|
|
8
|
+
export const genericFileId = {
|
|
9
|
+
id: '2dfcc12d-04d7-46e7-9fdf-3715ff00ba40',
|
|
10
|
+
mediaItemType: fileType,
|
|
11
|
+
collectionName: collectionName
|
|
12
|
+
};
|
|
13
|
+
export const audioFileId = {
|
|
14
|
+
id: 'a965c8df-1d64-4db8-9de5-16dfa8fd2e12',
|
|
15
|
+
// mp3 audio
|
|
16
|
+
mediaItemType: fileType,
|
|
17
|
+
collectionName: collectionName
|
|
18
|
+
};
|
|
19
|
+
export const audioNoCoverFileId = {
|
|
20
|
+
id: '7a5698bb-919c-4200-8699-6041e7913b11',
|
|
21
|
+
// mp3 audio
|
|
22
|
+
mediaItemType: fileType,
|
|
23
|
+
collectionName: collectionName
|
|
24
|
+
};
|
|
25
|
+
export const videoFileId = {
|
|
26
|
+
id: '1b01a476-83b4-4f44-8192-f83b2d00913a',
|
|
27
|
+
// mp4 video
|
|
28
|
+
mediaItemType: fileType,
|
|
29
|
+
collectionName: collectionName
|
|
30
|
+
};
|
|
31
|
+
export const videoHorizontalFileId = {
|
|
32
|
+
id: '2afaf845-4385-431f-9a15-3e21520cf896',
|
|
33
|
+
// .mov video
|
|
34
|
+
mediaItemType: fileType,
|
|
35
|
+
collectionName: collectionName
|
|
36
|
+
};
|
|
37
|
+
export const videoLargeFileId = {
|
|
38
|
+
id: '3291050e-6b66-4296-94c6-12088ef6fbad',
|
|
39
|
+
mediaItemType: fileType,
|
|
40
|
+
collectionName: collectionName
|
|
41
|
+
};
|
|
42
|
+
export const videoSquareFileId = {
|
|
43
|
+
id: 'cdff20d6-2c0a-4d0d-b2a9-22cc728a0368',
|
|
44
|
+
mediaItemType: fileType,
|
|
45
|
+
collectionName: collectionName
|
|
46
|
+
};
|
|
47
|
+
export const videoProcessingFailedId = {
|
|
48
|
+
id: 'e558199f-f982-4d23-93eb-313be5998d1b',
|
|
49
|
+
mediaItemType: fileType,
|
|
50
|
+
collectionName: collectionName
|
|
51
|
+
};
|
|
52
|
+
export const imageFileId = {
|
|
53
|
+
id: '5556346b-b081-482b-bc4a-4faca8ecd2de',
|
|
54
|
+
// jpg image
|
|
55
|
+
mediaItemType: fileType,
|
|
56
|
+
collectionName: collectionName
|
|
57
|
+
};
|
|
58
|
+
export const emptyImageFileId = {
|
|
59
|
+
id: 'aa7f7a63-2b1a-4405-b585-62e375a3b40a',
|
|
60
|
+
// jpg image
|
|
61
|
+
mediaItemType: fileType,
|
|
62
|
+
collectionName: collectionName
|
|
63
|
+
};
|
|
64
|
+
export const smallImageFileId = {
|
|
65
|
+
id: 'f251bd05-4b2d-485d-a088-57d112ca7945',
|
|
66
|
+
mediaItemType: fileType,
|
|
67
|
+
collectionName: collectionName
|
|
68
|
+
};
|
|
69
|
+
export const wideImageFileId = {
|
|
70
|
+
id: '3b6621a2-5b72-400e-ad95-447610dbb770',
|
|
71
|
+
mediaItemType: fileType,
|
|
72
|
+
collectionName: collectionName
|
|
73
|
+
};
|
|
74
|
+
export const largeImageFileId = {
|
|
75
|
+
id: '0607a6a8-b2ec-49a7-b6d3-d767cb49e844',
|
|
76
|
+
mediaItemType: fileType,
|
|
77
|
+
collectionName: collectionName
|
|
78
|
+
};
|
|
79
|
+
export const verticalImageFileId = {
|
|
80
|
+
id: 'f9235f5a-d582-4740-8611-ebf3feaf28b6',
|
|
81
|
+
mediaItemType: fileType,
|
|
82
|
+
collectionName: collectionName
|
|
83
|
+
};
|
|
84
|
+
export const docFileId = {
|
|
85
|
+
id: '71cd7e7d-4e86-4b89-a0b4-7f6ffe013c94',
|
|
86
|
+
mediaItemType: fileType,
|
|
87
|
+
collectionName: collectionName
|
|
88
|
+
};
|
|
89
|
+
export const bigDocFileId = {
|
|
90
|
+
id: 'd22f7a80-a661-4518-8b0e-eba02b6dfaca',
|
|
91
|
+
mediaItemType: fileType,
|
|
92
|
+
collectionName: collectionName
|
|
93
|
+
};
|
|
94
|
+
export const largePdfFileId = {
|
|
95
|
+
id: '0a510b7f-4168-44d8-b4d7-f5639ecefa2c',
|
|
96
|
+
mediaItemType: fileType,
|
|
97
|
+
collectionName: collectionName
|
|
98
|
+
};
|
|
99
|
+
export const passwordProtectedPdfFileId = {
|
|
100
|
+
id: 'c0e5bfa5-013d-4cbc-9b87-17d7f63bcc30',
|
|
101
|
+
mediaItemType: fileType,
|
|
102
|
+
collectionName: collectionName
|
|
103
|
+
};
|
|
104
|
+
export const codeFileId = {
|
|
105
|
+
id: '4bc95dd5-a7a2-4cbd-ac46-f9b9f0e0941a',
|
|
106
|
+
mediaItemType: fileType,
|
|
107
|
+
collectionName: collectionName
|
|
108
|
+
};
|
|
109
|
+
export const emailFileId = {
|
|
110
|
+
id: '79bb7327-fa6c-4e6f-8a7a-4ebd3607f481',
|
|
111
|
+
mediaItemType: fileType,
|
|
112
|
+
collectionName: collectionName
|
|
113
|
+
};
|
|
114
|
+
export const emailUnsupportedFileId = {
|
|
115
|
+
id: '3a2ae022-212a-4dca-a7d3-86eb016a0ed2',
|
|
116
|
+
mediaItemType: fileType,
|
|
117
|
+
collectionName: collectionName
|
|
118
|
+
};
|
|
119
|
+
export const archiveFileId = {
|
|
120
|
+
id: '1abbae6b-f507-4b4f-b181-21016bf3b7cc',
|
|
121
|
+
mediaItemType: fileType,
|
|
122
|
+
collectionName: collectionName
|
|
123
|
+
};
|
|
124
|
+
export const zipJiraArchiveFileId = {
|
|
125
|
+
id: 'aa99969c-6f0e-4cdc-8a57-9d38c43b2af8',
|
|
126
|
+
mediaItemType: fileType,
|
|
127
|
+
collectionName: collectionName
|
|
128
|
+
};
|
|
129
|
+
export const zipFileWithNestedFolderId = {
|
|
130
|
+
id: 'd1730520-316c-482a-a8c8-2b34acbea00b',
|
|
131
|
+
mediaItemType: fileType,
|
|
132
|
+
collectionName: collectionName
|
|
133
|
+
};
|
|
134
|
+
export const zipFileId = {
|
|
135
|
+
id: '3822aff2-9297-4ad9-93fd-ab1709f400ad',
|
|
136
|
+
mediaItemType: fileType,
|
|
137
|
+
collectionName: collectionName
|
|
138
|
+
};
|
|
139
|
+
export const zipItemMultipleFoldersAtRootId = {
|
|
140
|
+
id: 'b2c4623b-bd84-4d90-a2ed-61d50b0bd5f4',
|
|
141
|
+
mediaItemType: fileType,
|
|
142
|
+
collectionName: collectionName
|
|
143
|
+
};
|
|
144
|
+
export const zipItemLargeInnerFileId = {
|
|
145
|
+
id: '36b7957c-2d73-4cd5-8541-103daa2619ce',
|
|
146
|
+
mediaItemType: fileType,
|
|
147
|
+
collectionName: collectionName
|
|
148
|
+
};
|
|
149
|
+
export const zipEncryptedFileId = {
|
|
150
|
+
id: 'd1569d0f-936d-46f3-b974-a285696016c0',
|
|
151
|
+
mediaItemType: fileType,
|
|
152
|
+
collectionName: collectionName
|
|
153
|
+
};
|
|
154
|
+
export const unknownFileId = {
|
|
155
|
+
id: 'e0652e68-c596-4800-8a91-1920e6b8a585',
|
|
156
|
+
mediaItemType: fileType,
|
|
157
|
+
collectionName: collectionName
|
|
158
|
+
};
|
|
159
|
+
export const errorFileId = {
|
|
160
|
+
id: 'error-file-id',
|
|
161
|
+
mediaItemType: fileType,
|
|
162
|
+
collectionName: collectionName
|
|
163
|
+
};
|
|
164
|
+
export const gifFileId = {
|
|
165
|
+
id: '26adc5af-3af4-42a8-9c24-62b6ce0f9369',
|
|
166
|
+
mediaItemType: fileType,
|
|
167
|
+
collectionName: collectionName
|
|
168
|
+
};
|
|
169
|
+
export const noMetadataFileId = {
|
|
170
|
+
id: '1adaf6f9-37f6-4171-ab6b-455ec3115381',
|
|
171
|
+
mediaItemType: fileType,
|
|
172
|
+
collectionName: collectionName
|
|
173
|
+
};
|
|
174
|
+
export const animatedFileId = {
|
|
175
|
+
id: 'af637c7a-75c3-4254-b074-d16e6ae2e04b',
|
|
176
|
+
mediaItemType: fileType,
|
|
177
|
+
collectionName: onlyAnimatedGifsCollectionName
|
|
178
|
+
};
|
|
179
|
+
export const svgFileIds = {
|
|
180
|
+
ajDigitalCamera: {
|
|
181
|
+
id: '961e6894-88cd-4970-a0f5-4478910074dd',
|
|
182
|
+
mediaItemType: fileType,
|
|
183
|
+
collectionName: collectionName
|
|
184
|
+
},
|
|
185
|
+
car: {
|
|
186
|
+
id: '50960d32-c79c-47ea-9878-8165438648e2',
|
|
187
|
+
mediaItemType: fileType,
|
|
188
|
+
collectionName: collectionName
|
|
189
|
+
},
|
|
190
|
+
atom: {
|
|
191
|
+
id: '48693a13-d03a-4aa6-9444-cd803bb3df5e',
|
|
192
|
+
mediaItemType: fileType,
|
|
193
|
+
collectionName: collectionName
|
|
194
|
+
},
|
|
195
|
+
openweb: {
|
|
196
|
+
id: '8d214027-956c-4036-80c1-bede14fee52c',
|
|
197
|
+
mediaItemType: fileType,
|
|
198
|
+
collectionName: collectionName
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// === EXTERNAL IMAGE ===
|
|
203
|
+
|
|
204
|
+
export const atlassianLogoUrl = 'https://wac-cdn.atlassian.com/assets/img/favicons/atlassian/apple-touch-icon-152x152.png';
|
|
205
|
+
export const externalImageIdentifier = {
|
|
206
|
+
mediaItemType: 'external-image',
|
|
207
|
+
dataURI: atlassianLogoUrl
|
|
208
|
+
};
|
|
209
|
+
export const externalSmallImageIdentifier = {
|
|
210
|
+
mediaItemType: 'external-image',
|
|
211
|
+
dataURI: 'https://aui-cdn.atlassian.com/media/files-icon.png'
|
|
212
|
+
};
|
|
213
|
+
export const externaBrokenlIdentifier = {
|
|
214
|
+
mediaItemType: 'external-image',
|
|
215
|
+
dataURI: 'https://some-uri'
|
|
216
|
+
};
|
|
217
|
+
export const genericFileDetails = {
|
|
218
|
+
id: 'fd4c4672-323a-4b6c-8326-223169e2a13e',
|
|
219
|
+
mediaType: 'image',
|
|
220
|
+
mimeType: 'image/gif',
|
|
221
|
+
name: 'picker-thread-leaking.gif',
|
|
222
|
+
size: 2958464,
|
|
223
|
+
processingStatus: 'succeeded',
|
|
224
|
+
artifacts: {
|
|
225
|
+
'thumb_320.jpg': {
|
|
226
|
+
url: '/file/fd4c4672-323a-4b6c-8326-223169e2a13e/artifact/thumb_320.jpg/binary',
|
|
227
|
+
processingStatus: 'succeeded'
|
|
228
|
+
},
|
|
229
|
+
'thumb_large.jpg': {
|
|
230
|
+
url: '/file/fd4c4672-323a-4b6c-8326-223169e2a13e/artifact/thumb_320.jpg/binary',
|
|
231
|
+
processingStatus: 'succeeded'
|
|
232
|
+
},
|
|
233
|
+
'thumb_120.jpg': {
|
|
234
|
+
url: '/file/fd4c4672-323a-4b6c-8326-223169e2a13e/artifact/thumb_120.jpg/binary',
|
|
235
|
+
processingStatus: 'succeeded'
|
|
236
|
+
},
|
|
237
|
+
'thumb.jpg': {
|
|
238
|
+
url: '/file/fd4c4672-323a-4b6c-8326-223169e2a13e/artifact/thumb_120.jpg/binary',
|
|
239
|
+
processingStatus: 'succeeded'
|
|
240
|
+
},
|
|
241
|
+
'meta.json': {
|
|
242
|
+
url: '/file/fd4c4672-323a-4b6c-8326-223169e2a13e/artifact/meta.json/binary',
|
|
243
|
+
processingStatus: 'succeeded'
|
|
244
|
+
},
|
|
245
|
+
'image.jpg': {
|
|
246
|
+
url: '/file/fd4c4672-323a-4b6c-8326-223169e2a13e/artifact/image.jpg/binary',
|
|
247
|
+
processingStatus: 'succeeded'
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
export const imageFileDetails = {
|
|
252
|
+
id: 'some-id',
|
|
253
|
+
mediaType: 'image',
|
|
254
|
+
name: 'image_file.jpg',
|
|
255
|
+
size: 2958464
|
|
256
|
+
};
|
|
257
|
+
export const videoFileDetails = {
|
|
258
|
+
id: 'some-id',
|
|
259
|
+
mediaType: 'video',
|
|
260
|
+
name: 'video_file.mp4',
|
|
261
|
+
size: 29584640
|
|
262
|
+
};
|
|
263
|
+
export const audioFileDetails = {
|
|
264
|
+
id: 'some-id',
|
|
265
|
+
mediaType: 'audio',
|
|
266
|
+
name: 'audio_file.mp3',
|
|
267
|
+
size: 2958464
|
|
268
|
+
};
|
|
269
|
+
export const docFileDetails = {
|
|
270
|
+
id: 'some-id',
|
|
271
|
+
mediaType: 'doc',
|
|
272
|
+
name: 'doc_file.pdf',
|
|
273
|
+
size: 2958464
|
|
274
|
+
};
|
|
275
|
+
export const unknownFileDetails = {
|
|
276
|
+
id: 'some-id',
|
|
277
|
+
mediaType: 'unknown',
|
|
278
|
+
name: 'doc_file.pdf',
|
|
279
|
+
size: 2958464
|
|
280
|
+
};
|
|
281
|
+
export const genericDataURI = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAZABkAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABkAAAAAQAAAGQAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAAKgAwAEAAAAAQAAAAIAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAAIAAgMBEQACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQICAQECAQEBAgICAgICAgICAQICAgICAgICAgL/2wBDAQEBAQEBAQEBAQECAQEBAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/3QAEAAH/2gAMAwEAAhEDEQA/AP0U8M2NmPDfh8C0tgBomkgAW8OAPsFvwK/lh7s+5u+/4n//2Q==';
|
|
282
|
+
|
|
283
|
+
// === VR test ids ===
|
|
284
|
+
|
|
285
|
+
export const vrVideoDetails = {
|
|
286
|
+
id: '57b9af11-eead-4711-85fa-9d393278c314',
|
|
287
|
+
name: 'video.mp4',
|
|
288
|
+
dataUri: videoURI,
|
|
289
|
+
previewDataUri: videoPreviewURI,
|
|
290
|
+
mediaType: 'video',
|
|
291
|
+
mimeType: 'video/mp4'
|
|
292
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
3
|
+
import { asMock } from '@atlaskit/media-common/jestHelpers';
|
|
4
|
+
import { MediaClient } from '../';
|
|
5
|
+
import { getDefaultMediaClientConfig } from './getDefaultMediaClientConfig';
|
|
6
|
+
export const fakeMediaClient = (config = getDefaultMediaClientConfig()) => {
|
|
7
|
+
if (jest && jest.createMockFromModule) {
|
|
8
|
+
const {
|
|
9
|
+
MediaClient: MockMediaClient,
|
|
10
|
+
FileFetcherImpl,
|
|
11
|
+
MediaStore: MockMediaStore,
|
|
12
|
+
StargateClient
|
|
13
|
+
} = jest.createMockFromModule('@atlaskit/media-client');
|
|
14
|
+
const mediaClient = new MockMediaClient();
|
|
15
|
+
const fileFetcher = new FileFetcherImpl();
|
|
16
|
+
const mockMediaStore = new MockMediaStore({
|
|
17
|
+
authProvider: config.authProvider
|
|
18
|
+
});
|
|
19
|
+
const stargateClient = new StargateClient();
|
|
20
|
+
mediaClient.file = fileFetcher;
|
|
21
|
+
mediaClient.stargate = stargateClient;
|
|
22
|
+
mediaClient.config = config; // <- deprecated
|
|
23
|
+
mediaClient.mediaClientConfig = config;
|
|
24
|
+
mediaClient.mediaStore = mockMediaStore;
|
|
25
|
+
mediaClient.mediaStore.getItems = jest.fn().mockResolvedValue({
|
|
26
|
+
data: {
|
|
27
|
+
items: []
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
asMock(mediaClient.getImageUrl).mockResolvedValue('some-image-url');
|
|
31
|
+
asMock(mediaClient.getImageUrlSync).mockReturnValue('some-image-url');
|
|
32
|
+
asMock(mediaClient.getImage).mockImplementation(mockMediaStore.getImage);
|
|
33
|
+
asMock(mediaClient.file.copyFile).mockReturnValue({
|
|
34
|
+
id: 'copied-file-id'
|
|
35
|
+
});
|
|
36
|
+
asMock(mediaClient.file.getCurrentState).mockReturnValue(Promise.resolve({
|
|
37
|
+
id: 'file-id',
|
|
38
|
+
status: 'processed',
|
|
39
|
+
mediaType: 'image',
|
|
40
|
+
name: 'file_name'
|
|
41
|
+
}));
|
|
42
|
+
asMock(mediaClient.file.getFileState).mockImplementation(() => ({
|
|
43
|
+
subscribe: jest.fn()
|
|
44
|
+
}));
|
|
45
|
+
asMock(mediaClient.stargate.fetchToken).mockImplementation(() => Promise.resolve({
|
|
46
|
+
data: {
|
|
47
|
+
clientId: 'some-client-id-from-smart-edge',
|
|
48
|
+
token: 'some-token-from-smart-edge',
|
|
49
|
+
baseUrl: 'some-base-url-from-smart-edge',
|
|
50
|
+
expiresIn: 34000,
|
|
51
|
+
iat: new Date().getTime() / 1000
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
return mediaClient;
|
|
55
|
+
} else {
|
|
56
|
+
return new MediaClient(config);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use `import { getDefaultMediaClientConfig } from '@atlaskit/media-client/test-helpers'` instead.
|
|
62
|
+
*/
|
|
63
|
+
export { getDefaultMediaClientConfig } from './getDefaultMediaClientConfig';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `import { StoryBookAuthProvider } from '@atlaskit/media-client/test-helpers/auth-provider'` instead.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { StoryBookAuthProvider } from './authProvider';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `import { createStorybookMediaClient } from '@atlaskit/media-client/test-helpers/media-client-provider'` instead.
|
|
9
|
+
*/
|
|
10
|
+
export { createStorybookMediaClient } from './createStorybookMediaClient';
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `import { createStorybookMediaClientConfig } from '@atlaskit/media-client/test-helpers/media-client-provider'` instead.
|
|
13
|
+
*/
|
|
14
|
+
export { createStorybookMediaClientConfig } from './createStorybookMediaClientConfig';
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `import { createUploadMediaClient } from '@atlaskit/media-client/test-helpers/media-client-provider'` instead.
|
|
17
|
+
*/
|
|
18
|
+
export { createUploadMediaClient } from './createUploadMediaClient';
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `import { createUploadMediaClientConfig } from '@atlaskit/media-client/test-helpers/media-client-provider'` instead.
|
|
21
|
+
*/
|
|
22
|
+
export { createUploadMediaClientConfig } from './createUploadMediaClientConfig';
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use `import { defaultBaseUrl, defaultParams } from '@atlaskit/media-client/test-helpers/media-client-provider'` instead.
|
|
25
|
+
*/
|
|
26
|
+
export { defaultBaseUrl, defaultParams } from './mediaClientProvider';
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use `import { collectionNames, defaultCollectionName, defaultMediaPickerCollectionName, fileCollectionName, onlyAnimatedGifsCollectionName } from '@atlaskit/media-client/test-helpers/collection-names'` instead.
|
|
29
|
+
*/
|
|
30
|
+
export { collectionNames, defaultCollectionName, defaultMediaPickerCollectionName, fileCollectionName, onlyAnimatedGifsCollectionName } from './collectionNames';
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use `import { animatedFileId, archiveFileId, atlassianLogoUrl, audioFileDetails, audioFileId, audioNoCoverFileId, bigDocFileId, docFileDetails, docFileId, emptyImageFileId, errorFileId, externalImageIdentifier, externalSmallImageIdentifier, externaBrokenlIdentifier, genericDataURI, genericFileDetails, genericFileId, gifFileId, imageFileDetails, imageFileId, largeImageFileId, largePdfFileId, noMetadataFileId, passwordProtectedPdfFileId, smallImageFileId, unknownFileDetails, unknownFileId, verticalImageFileId, videoFileDetails, videoFileId, videoHorizontalFileId, videoLargeFileId, videoProcessingFailedId, videoSquareFileId, wideImageFileId, zipFileId, zipFileWithNestedFolderId, zipItemLargeInnerFileId, zipItemMultipleFoldersAtRootId, zipJiraArchiveFileId, zipEncryptedFileId, codeFileId, emailFileId, emailUnsupportedFileId, vrVideoDetails, svgFileIds } from '@atlaskit/media-client/test-helpers/example-media-items'` instead.
|
|
33
|
+
*/
|
|
34
|
+
export { animatedFileId, archiveFileId, atlassianLogoUrl, audioFileDetails, audioFileId, audioNoCoverFileId, bigDocFileId, docFileDetails, docFileId, emptyImageFileId, errorFileId, externalImageIdentifier, externalSmallImageIdentifier, externaBrokenlIdentifier, genericDataURI, genericFileDetails, genericFileId, gifFileId, imageFileDetails, imageFileId, largeImageFileId, largePdfFileId, noMetadataFileId, passwordProtectedPdfFileId, smallImageFileId, unknownFileDetails, unknownFileId, verticalImageFileId, videoFileDetails, videoFileId, videoHorizontalFileId, videoLargeFileId, videoProcessingFailedId, videoSquareFileId, wideImageFileId, zipFileId, zipFileWithNestedFolderId, zipItemLargeInnerFileId, zipItemMultipleFoldersAtRootId, zipJiraArchiveFileId, zipEncryptedFileId, codeFileId, emailFileId, emailUnsupportedFileId, vrVideoDetails, svgFileIds } from './exampleMediaItems';
|
|
35
|
+
export const authProviderBaseURL = 'https://media.staging.atl-paas.net';
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `import { defaultMediaPickerAuthProvider } from '@atlaskit/media-client/test-helpers/media-picker-auth-provider'` instead.
|
|
38
|
+
*/
|
|
39
|
+
export { defaultMediaPickerAuthProvider } from './defaultMediaPickerAuthProvider';
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use `import { mediaPickerAuthProvider } from '@atlaskit/media-client/test-helpers/media-picker-auth-provider'` instead.
|
|
42
|
+
*/
|
|
43
|
+
export { mediaPickerAuthProvider } from './mediaPickerAuthProvider';
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `import { fakeMediaClient } from '@atlaskit/media-client/test-helpers/fake-media-client'` instead.
|
|
46
|
+
*/
|
|
47
|
+
export { fakeMediaClient } from './fakeMediaClient';
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Use `import { merge } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
50
|
+
*/
|
|
51
|
+
export { merge } from './MockedMediaApi/merge';
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use `import { getIdentifier } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
54
|
+
*/
|
|
55
|
+
export { getIdentifier } from './MockedMediaApi/getIdentifier';
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Use `import { createEmptyFileItem } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
58
|
+
*/
|
|
59
|
+
export { createEmptyFileItem } from './MockedMediaApi/createEmptyFileItem';
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use `import { copy } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
62
|
+
*/
|
|
63
|
+
export { copy } from './MockedMediaApi/copy';
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `import { assign } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
66
|
+
*/
|
|
67
|
+
export { assign } from './MockedMediaApi/assign';
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Use `import { createMockedMediaApi } from '@atlaskit/media-client/test-helpers/mocked-media-api'` instead.
|
|
70
|
+
*/
|
|
71
|
+
export { createMockedMediaApi } from './MockedMediaApi/MockedMediaApi';
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use `import { createUploadingFileState } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
74
|
+
*/
|
|
75
|
+
export { createUploadingFileState } from './MockedMediaApi/createUploadingFileState';
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use `import { createFileState } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
78
|
+
*/
|
|
79
|
+
export { createFileState } from './MockedMediaApi/createFileState';
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated Use `import { createErrorFileState } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
82
|
+
*/
|
|
83
|
+
export { createErrorFileState } from './MockedMediaApi/createErrorFileState';
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Use `import { createProcessingFileItem } from '@atlaskit/media-client/test-helpers/mocked-media-api/helpers'` instead.
|
|
86
|
+
*/
|
|
87
|
+
export { createProcessingFileItem } from './MockedMediaApi/createProcessingFileItem';
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Use `import { createMediaStoreError } from '@atlaskit/media-client/test-helpers/media-client-errors'` instead.
|
|
90
|
+
*/
|
|
91
|
+
export { createMediaStoreError } from './createMediaStoreError';
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated Use `import { createPollingMaxAttemptsError } from '@atlaskit/media-client/test-helpers/media-client-errors'` instead.
|
|
94
|
+
*/
|
|
95
|
+
export { createPollingMaxAttemptsError } from './createPollingMaxAttemptsError';
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated Use `import { createRateLimitedError } from '@atlaskit/media-client/test-helpers/media-client-errors'` instead.
|
|
98
|
+
*/
|
|
99
|
+
export { createRateLimitedError } from './createRateLimitedError';
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use `import { createServerUnauthorizedError } from '@atlaskit/media-client/test-helpers/media-client-errors'` instead.
|
|
102
|
+
*/
|
|
103
|
+
export { createServerUnauthorizedError } from './createServerUnauthorizedError';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `import { createServerUnauthorizedError } from '@atlaskit/media-client/test-helpers'` instead.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { createServerUnauthorizedError } from './createServerUnauthorizedError';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `import { createRateLimitedError } from '@atlaskit/media-client/test-helpers'` instead.
|
|
9
|
+
*/
|
|
10
|
+
export { createRateLimitedError } from './createRateLimitedError';
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `import { createPollingMaxAttemptsError } from '@atlaskit/media-client/test-helpers'` instead.
|
|
13
|
+
*/
|
|
14
|
+
export { createPollingMaxAttemptsError } from './createPollingMaxAttemptsError';
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `import { createMediaStoreError } from '@atlaskit/media-client/test-helpers'` instead.
|
|
17
|
+
*/
|
|
18
|
+
export { createMediaStoreError } from './createMediaStoreError';
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `import { MediaHeaders } from '@atlaskit/media-client/test-helpers/media-client-errors'` instead.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use `import { defaultMetadata } from '@atlaskit/media-client/test-helpers/media-client-errors'` instead.
|
|
25
|
+
*/
|
|
26
|
+
export { defaultMetadata } from './defaultMetadata';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
3
|
+
export const defaultBaseUrl = 'https://media.staging.atl-paas.net';
|
|
4
|
+
export const defaultParams = {
|
|
5
|
+
clientId: '5a9812fc-d029-4a39-8a46-d3cc36eed7ab',
|
|
6
|
+
asapIssuer: 'micros/media-playground',
|
|
7
|
+
baseUrl: defaultBaseUrl
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `import { createStorybookMediaClient } from '@atlaskit/media-client/test-helpers'` instead.
|
|
12
|
+
*/
|
|
13
|
+
export { createStorybookMediaClient } from './createStorybookMediaClient';
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `import { createStorybookMediaClientConfig } from '@atlaskit/media-client/test-helpers'` instead.
|
|
16
|
+
*/
|
|
17
|
+
export { createStorybookMediaClientConfig } from './createStorybookMediaClientConfig';
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `import { createUploadMediaClient } from '@atlaskit/media-client/test-helpers'` instead.
|
|
20
|
+
*/
|
|
21
|
+
export { createUploadMediaClient } from './createUploadMediaClient';
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `import { createUploadMediaClientConfig } from '@atlaskit/media-client/test-helpers'` instead.
|
|
24
|
+
*/
|
|
25
|
+
export { createUploadMediaClientConfig } from './createUploadMediaClientConfig';
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `import { AuthParameter } from '@atlaskit/media-client/test-helpers/media-client-provider'` instead.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use `import { defaultAuthParameter } from '@atlaskit/media-client/test-helpers/media-client-provider'` instead.
|
|
32
|
+
*/
|
|
33
|
+
export { defaultAuthParameter } from './defaultAuthParameter';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
3
|
+
import { cachedAuths } from './cachedAuths';
|
|
4
|
+
import { defaultCollectionName } from './collectionNames';
|
|
5
|
+
import { requestAuthProvider } from './requestAuthProvider';
|
|
6
|
+
export const authProviderBaseURL = 'https://media.staging.atl-paas.net';
|
|
7
|
+
export const accessUrns = {
|
|
8
|
+
MediaServicesSample: {
|
|
9
|
+
'urn:filestore:collection:MediaServicesSample': ['read', 'insert'],
|
|
10
|
+
'urn:filestore:chunk:*': ['create', 'read'],
|
|
11
|
+
'urn:filestore:upload': ['create'],
|
|
12
|
+
'urn:filestore:upload:*': ['read', 'update'],
|
|
13
|
+
'urn:filestore:file': ['create'],
|
|
14
|
+
'urn:filestore:file:*': ['read', 'update']
|
|
15
|
+
},
|
|
16
|
+
'mediapicker-test': {
|
|
17
|
+
'urn:filestore:collection': ['create'],
|
|
18
|
+
'urn:filestore:collection:mediapicker-test': ['read', 'insert'],
|
|
19
|
+
'urn:filestore:chunk:*': ['create', 'read'],
|
|
20
|
+
'urn:filestore:upload': ['create'],
|
|
21
|
+
'urn:filestore:upload:*': ['read', 'update'],
|
|
22
|
+
'urn:filestore:file': ['create'],
|
|
23
|
+
'urn:filestore:file:*': ['read', 'update']
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const mediaPickerAuthProvider = (authEnvironment = 'asap', env) => context => {
|
|
27
|
+
const collectionName = context && context.collectionName || defaultCollectionName;
|
|
28
|
+
authEnvironment = authEnvironment === 'asap' ? 'asap' : '';
|
|
29
|
+
const cacheKey = `${collectionName}:${authEnvironment}`;
|
|
30
|
+
if (!cachedAuths[cacheKey]) {
|
|
31
|
+
cachedAuths[cacheKey] = requestAuthProvider(authEnvironment, collectionName, env);
|
|
32
|
+
}
|
|
33
|
+
return cachedAuths[cacheKey];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `import { defaultMediaPickerAuthProvider } from '@atlaskit/media-client/test-helpers'` instead.
|
|
38
|
+
*/
|
|
39
|
+
export { defaultMediaPickerAuthProvider } from './defaultMediaPickerAuthProvider';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { accessUrns } from './mediaPickerAuthProvider';
|
|
2
|
+
export const requestAuthProvider = async (authEnvironment, collectionName, env = 'staging') => {
|
|
3
|
+
const url = `https://media-playground.${env}.atl-paas.net/token/tenant?environment=${authEnvironment}`;
|
|
4
|
+
const body = JSON.stringify({
|
|
5
|
+
access: accessUrns[collectionName] || {}
|
|
6
|
+
});
|
|
7
|
+
const headers = new Headers();
|
|
8
|
+
headers.append('Content-Type', 'application/json; charset=utf-8');
|
|
9
|
+
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
10
|
+
const response = await fetch(url, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body,
|
|
13
|
+
headers
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// We leverage the fact, that our internal /token/tenant API returns data in the same format as Auth
|
|
17
|
+
return response.json();
|
|
18
|
+
};
|
|
File without changes
|
|
File without changes
|