Skip to content

Commit 1f34a4e

Browse files
authored
Merge pull request #1153 from adobe/source-bus
feat: add sourceBus()
2 parents 79a8f25 + 186bc43 commit 1f34a4e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/helix-shared-storage/src/storage.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function sanitizeKey(keyOrPath) {
8787
return keyOrPath;
8888
}
8989

90-
const BUCKET_KEYS = ['config', 'code', 'content', 'media'];
90+
const BUCKET_KEYS = ['config', 'code', 'content', 'media', 'source'];
9191

9292
export function parseBucketNames(bucketNames) {
9393
if (!bucketNames) {
@@ -802,6 +802,13 @@ export class HelixStorage {
802802
return this.bucket(this._bucketMap.media);
803803
}
804804

805+
/**
806+
* @returns {Bucket}
807+
*/
808+
sourceBus(disableR2 = false) {
809+
return this.bucket(this._bucketMap.source, disableR2);
810+
}
811+
805812
/**
806813
* @returns {Bucket}
807814
*/

packages/helix-shared-storage/test/storage.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ describe('Storage test', () => {
115115
config: 'helix-config-bus',
116116
content: 'helix-content-bus',
117117
media: 'helix-media-bus',
118+
source: 'helix-source-bus',
118119
});
119120
});
120121

@@ -124,6 +125,7 @@ describe('Storage test', () => {
124125
config: 'bucket-02',
125126
content: 'bucket-03',
126127
media: 'bucket-04',
128+
source: 'bucket-05',
127129
};
128130
assert.deepStrictEqual(parseBucketNames(JSON.stringify(map)), map);
129131
});
@@ -134,6 +136,7 @@ describe('Storage test', () => {
134136
config: 'bucket-02',
135137
content: 'bucket-03',
136138
media: 'bucket-04',
139+
source: 'bucket-05',
137140
};
138141
storage = new HelixStorage({
139142
region: AWS_REGION,
@@ -198,6 +201,10 @@ describe('Storage test', () => {
198201
assert.strictEqual(storage.configBus().bucket, 'helix-config-bus');
199202
});
200203

204+
it('can get the source-bus', () => {
205+
assert.strictEqual(storage.sourceBus().bucket, 'helix-source-bus');
206+
});
207+
201208
it('can get an object', async () => {
202209
nock('https://helix-code-bus.s3.fake.amazonaws.com')
203210
.get('/foo?x-id=GetObject')

0 commit comments

Comments
 (0)