Skip to content

Commit df3db62

Browse files
authored
Add trigger labels support and label callables. (#273)
1 parent 54b2d88 commit df3db62

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

spec/providers/https.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,10 @@ describe('callable.FunctionBuilder', () => {
234234
const result = https.onCall((data) => {
235235
return 'response';
236236
});
237-
expect(result.__trigger).to.deep.equal({httpsTrigger: {}});
237+
expect(result.__trigger).to.deep.equal({
238+
httpsTrigger: {},
239+
labels: { 'deployment-callable': 'true' },
240+
});
238241
});
239242

240243
it('should handle success', () => {

src/cloud-functions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ export interface TriggerAnnotated {
159159
eventType: string;
160160
resource: string;
161161
service: string;
162-
}
162+
},
163+
labels?: { [key: string]: string }
163164
};
164165
}
165166

src/providers/https.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ export function onCall(
435435
return corsHandler(req, res, () => func(req, res));
436436
};
437437

438-
corsFunc.__trigger = {httpsTrigger: {}};
438+
corsFunc.__trigger = {
439+
httpsTrigger: {},
440+
labels: { 'deployment-callable': 'true' },
441+
};
439442

440443
return corsFunc;
441444
}

0 commit comments

Comments
 (0)