From b02a2bf8f835060fb0f9b981d6c7ec527ac3722b Mon Sep 17 00:00:00 2001 From: Bryan Klimt Date: Thu, 21 Jun 2018 14:12:31 -0400 Subject: [PATCH] Add trigger labels support and label callables. --- spec/providers/https.spec.ts | 5 ++++- src/cloud-functions.ts | 3 ++- src/providers/https.ts | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/spec/providers/https.spec.ts b/spec/providers/https.spec.ts index 3d80f60ef..6e3a89032 100644 --- a/spec/providers/https.spec.ts +++ b/spec/providers/https.spec.ts @@ -234,7 +234,10 @@ describe('callable.FunctionBuilder', () => { const result = https.onCall((data) => { return 'response'; }); - expect(result.__trigger).to.deep.equal({httpsTrigger: {}}); + expect(result.__trigger).to.deep.equal({ + httpsTrigger: {}, + labels: { 'deployment-callable': 'true' }, + }); }); it('should handle success', () => { diff --git a/src/cloud-functions.ts b/src/cloud-functions.ts index 8db2f15ea..3717f8ca1 100644 --- a/src/cloud-functions.ts +++ b/src/cloud-functions.ts @@ -159,7 +159,8 @@ export interface TriggerAnnotated { eventType: string; resource: string; service: string; - } + }, + labels?: { [key: string]: string } }; } diff --git a/src/providers/https.ts b/src/providers/https.ts index 6ea209dab..82f5c56ba 100644 --- a/src/providers/https.ts +++ b/src/providers/https.ts @@ -435,7 +435,10 @@ export function onCall( return corsHandler(req, res, () => func(req, res)); }; - corsFunc.__trigger = {httpsTrigger: {}}; + corsFunc.__trigger = { + httpsTrigger: {}, + labels: { 'deployment-callable': 'true' }, + }; return corsFunc; }