Skip to content

Commit ee2c747

Browse files
authored
refactor: use cesdk (#391)
* refactor: use cesdk Signed-off-by: Grant Timmerman <[email protected]> * chore: run lint, docs Signed-off-by: Grant Timmerman <[email protected]> * style: remove unused import Signed-off-by: Grant Timmerman <[email protected]> * ci: mfix after merge Signed-off-by: Grant Timmerman <[email protected]>
1 parent 9c25913 commit ee2c747

File tree

10 files changed

+45
-395
lines changed

10 files changed

+45
-395
lines changed

docs/generated/api.json

+6-282
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@
223223
},
224224
{
225225
"kind": "Reference",
226-
"text": "CloudEventsContext",
227-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext:interface"
226+
"text": "CloudEvent",
227+
"canonicalReference": "cloudevents!CloudEvent:class"
228228
},
229229
{
230230
"kind": "Content",
@@ -282,8 +282,8 @@
282282
},
283283
{
284284
"kind": "Reference",
285-
"text": "CloudEventsContext",
286-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext:interface"
285+
"text": "CloudEvent",
286+
"canonicalReference": "cloudevents!CloudEvent:class"
287287
},
288288
{
289289
"kind": "Content",
@@ -333,282 +333,6 @@
333333
],
334334
"extendsTokenRanges": []
335335
},
336-
{
337-
"kind": "Interface",
338-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext:interface",
339-
"docComment": "/**\n * The CloudEvents v1.0 context attributes. {@link https://github.com/cloudevents/spec/blob/v1.0.1/spec.md#context-attributes}\n *\n * @public\n */\n",
340-
"excerptTokens": [
341-
{
342-
"kind": "Content",
343-
"text": "export interface CloudEventsContext "
344-
}
345-
],
346-
"releaseTag": "Public",
347-
"name": "CloudEventsContext",
348-
"members": [
349-
{
350-
"kind": "PropertySignature",
351-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#data:member",
352-
"docComment": "/**\n * The event payload.\n */\n",
353-
"excerptTokens": [
354-
{
355-
"kind": "Content",
356-
"text": "data?: "
357-
},
358-
{
359-
"kind": "Content",
360-
"text": "any"
361-
},
362-
{
363-
"kind": "Content",
364-
"text": ";"
365-
}
366-
],
367-
"isOptional": true,
368-
"releaseTag": "Public",
369-
"name": "data",
370-
"propertyTypeTokenRange": {
371-
"startIndex": 1,
372-
"endIndex": 2
373-
}
374-
},
375-
{
376-
"kind": "PropertySignature",
377-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#datacontenttype:member",
378-
"docComment": "/**\n * Content type of the event data.\n */\n",
379-
"excerptTokens": [
380-
{
381-
"kind": "Content",
382-
"text": "datacontenttype?: "
383-
},
384-
{
385-
"kind": "Content",
386-
"text": "string"
387-
},
388-
{
389-
"kind": "Content",
390-
"text": ";"
391-
}
392-
],
393-
"isOptional": true,
394-
"releaseTag": "Public",
395-
"name": "datacontenttype",
396-
"propertyTypeTokenRange": {
397-
"startIndex": 1,
398-
"endIndex": 2
399-
}
400-
},
401-
{
402-
"kind": "PropertySignature",
403-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#dataschema:member",
404-
"docComment": "/**\n * A link to the schema that the event data adheres to.\n */\n",
405-
"excerptTokens": [
406-
{
407-
"kind": "Content",
408-
"text": "dataschema?: "
409-
},
410-
{
411-
"kind": "Content",
412-
"text": "string"
413-
},
414-
{
415-
"kind": "Content",
416-
"text": ";"
417-
}
418-
],
419-
"isOptional": true,
420-
"releaseTag": "Public",
421-
"name": "dataschema",
422-
"propertyTypeTokenRange": {
423-
"startIndex": 1,
424-
"endIndex": 2
425-
}
426-
},
427-
{
428-
"kind": "PropertySignature",
429-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#id:member",
430-
"docComment": "/**\n * ID of the event.\n */\n",
431-
"excerptTokens": [
432-
{
433-
"kind": "Content",
434-
"text": "id: "
435-
},
436-
{
437-
"kind": "Content",
438-
"text": "string"
439-
},
440-
{
441-
"kind": "Content",
442-
"text": ";"
443-
}
444-
],
445-
"isOptional": false,
446-
"releaseTag": "Public",
447-
"name": "id",
448-
"propertyTypeTokenRange": {
449-
"startIndex": 1,
450-
"endIndex": 2
451-
}
452-
},
453-
{
454-
"kind": "PropertySignature",
455-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#source:member",
456-
"docComment": "/**\n * The event producer.\n */\n",
457-
"excerptTokens": [
458-
{
459-
"kind": "Content",
460-
"text": "source: "
461-
},
462-
{
463-
"kind": "Content",
464-
"text": "string"
465-
},
466-
{
467-
"kind": "Content",
468-
"text": ";"
469-
}
470-
],
471-
"isOptional": false,
472-
"releaseTag": "Public",
473-
"name": "source",
474-
"propertyTypeTokenRange": {
475-
"startIndex": 1,
476-
"endIndex": 2
477-
}
478-
},
479-
{
480-
"kind": "PropertySignature",
481-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#specversion:member",
482-
"docComment": "/**\n * The version of the CloudEvents specification which the event uses.\n */\n",
483-
"excerptTokens": [
484-
{
485-
"kind": "Content",
486-
"text": "specversion: "
487-
},
488-
{
489-
"kind": "Content",
490-
"text": "string"
491-
},
492-
{
493-
"kind": "Content",
494-
"text": ";"
495-
}
496-
],
497-
"isOptional": false,
498-
"releaseTag": "Public",
499-
"name": "specversion",
500-
"propertyTypeTokenRange": {
501-
"startIndex": 1,
502-
"endIndex": 2
503-
}
504-
},
505-
{
506-
"kind": "PropertySignature",
507-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#subject:member",
508-
"docComment": "/**\n * Describes the subject of the event in the context of the event producer.\n */\n",
509-
"excerptTokens": [
510-
{
511-
"kind": "Content",
512-
"text": "subject?: "
513-
},
514-
{
515-
"kind": "Content",
516-
"text": "string"
517-
},
518-
{
519-
"kind": "Content",
520-
"text": ";"
521-
}
522-
],
523-
"isOptional": true,
524-
"releaseTag": "Public",
525-
"name": "subject",
526-
"propertyTypeTokenRange": {
527-
"startIndex": 1,
528-
"endIndex": 2
529-
}
530-
},
531-
{
532-
"kind": "PropertySignature",
533-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#time:member",
534-
"docComment": "/**\n * Timestamp of when the event happened.\n */\n",
535-
"excerptTokens": [
536-
{
537-
"kind": "Content",
538-
"text": "time?: "
539-
},
540-
{
541-
"kind": "Content",
542-
"text": "string"
543-
},
544-
{
545-
"kind": "Content",
546-
"text": ";"
547-
}
548-
],
549-
"isOptional": true,
550-
"releaseTag": "Public",
551-
"name": "time",
552-
"propertyTypeTokenRange": {
553-
"startIndex": 1,
554-
"endIndex": 2
555-
}
556-
},
557-
{
558-
"kind": "PropertySignature",
559-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#traceparent:member",
560-
"docComment": "/**\n * The traceparent string, containing a trace version, trace ID, span ID, and trace options.\n *\n * @see\n *\n * https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md\n */\n",
561-
"excerptTokens": [
562-
{
563-
"kind": "Content",
564-
"text": "traceparent?: "
565-
},
566-
{
567-
"kind": "Content",
568-
"text": "string"
569-
},
570-
{
571-
"kind": "Content",
572-
"text": ";"
573-
}
574-
],
575-
"isOptional": true,
576-
"releaseTag": "Public",
577-
"name": "traceparent",
578-
"propertyTypeTokenRange": {
579-
"startIndex": 1,
580-
"endIndex": 2
581-
}
582-
},
583-
{
584-
"kind": "PropertySignature",
585-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext#type:member",
586-
"docComment": "/**\n * Type of occurrence which has happened.\n */\n",
587-
"excerptTokens": [
588-
{
589-
"kind": "Content",
590-
"text": "type: "
591-
},
592-
{
593-
"kind": "Content",
594-
"text": "string"
595-
},
596-
{
597-
"kind": "Content",
598-
"text": ";"
599-
}
600-
],
601-
"isOptional": false,
602-
"releaseTag": "Public",
603-
"name": "type",
604-
"propertyTypeTokenRange": {
605-
"startIndex": 1,
606-
"endIndex": 2
607-
}
608-
}
609-
],
610-
"extendsTokenRanges": []
611-
},
612336
{
613337
"kind": "Interface",
614338
"canonicalReference": "@google-cloud/functions-framework!CloudFunctionsContext:interface",
@@ -749,8 +473,8 @@
749473
},
750474
{
751475
"kind": "Reference",
752-
"text": "CloudEventsContext",
753-
"canonicalReference": "@google-cloud/functions-framework!CloudEventsContext:interface"
476+
"text": "CloudEvent",
477+
"canonicalReference": "cloudevents!CloudEvent:class"
754478
},
755479
{
756480
"kind": "Content",

docs/generated/api.md

+4-17
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/// <reference types="node" />
88

9+
import { CloudEvent } from 'cloudevents';
910
import * as express from 'express';
1011

1112
// @public
@@ -14,27 +15,13 @@ export const cloudEvent: (functionName: string, handler: CloudEventFunction) =>
1415
// @public
1516
export interface CloudEventFunction {
1617
// (undocumented)
17-
(cloudEvent: CloudEventsContext): any;
18+
(cloudEvent: CloudEvent): any;
1819
}
1920

2021
// @public
2122
export interface CloudEventFunctionWithCallback {
2223
// (undocumented)
23-
(cloudEvent: CloudEventsContext, callback: Function): any;
24-
}
25-
26-
// @public
27-
export interface CloudEventsContext {
28-
data?: any;
29-
datacontenttype?: string;
30-
dataschema?: string;
31-
id: string;
32-
source: string;
33-
specversion: string;
34-
subject?: string;
35-
time?: string;
36-
traceparent?: string;
37-
type: string;
24+
(cloudEvent: CloudEvent, callback: Function): any;
3825
}
3926

4027
// @public
@@ -48,7 +35,7 @@ export interface CloudFunctionsContext {
4835
}
4936

5037
// @public
51-
export type Context = CloudFunctionsContext | CloudEventsContext;
38+
export type Context = CloudFunctionsContext | CloudEvent;
5239

5340
// @public
5441
export interface Data {

0 commit comments

Comments
 (0)