Skip to content

Commit eb70b93

Browse files
authored
feat: Add support to invoke a Cloud Function with a custom installationId via Parse.Cloud.run (#1939)
1 parent 473babf commit eb70b93

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cloud.js

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ export function run(name: string, data: mixed, options: RequestOptions): Promise
4747
if (options.sessionToken) {
4848
requestOptions.sessionToken = options.sessionToken;
4949
}
50+
if (options.installationId) {
51+
requestOptions.installationId = options.installationId;
52+
}
5053
if (options.context && typeof options.context === 'object') {
5154
requestOptions.context = options.context;
5255
}

src/__tests__/Cloud-test.js

+9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ describe('Cloud', () => {
8080
]);
8181
});
8282

83+
it('run passes installationId option', () => {
84+
Cloud.run('myfunction', {}, { installationId: 'asdf1234' });
85+
expect(CoreManager.getCloudController().run.mock.calls[0]).toEqual([
86+
'myfunction',
87+
{},
88+
{ installationId: 'asdf1234' },
89+
]);
90+
});
91+
8392
it('startJob throws with an invalid job name', () => {
8493
expect(Cloud.startJob).toThrow('Cloud job name must be a string.');
8594

0 commit comments

Comments
 (0)