THIS REPOSITORY AND PACKAGE WILL BE DEPRECATED IN JULY 2024.
This repository contains types for CloudEvents issued by Google, enabling you to have autocompletion in JavaScript or TypeScript projects.
Note: This repo is auto-generated from schemas in https://github.com/googleapis/google-cloudevents
- Node 10+
Install the library from npm
:
npm i @google/events
This library is meant to provide types for Node projects accepting CloudEvent data, typically sent through a HTTP request's POST
body.
For every event type, this library contains:
- Exports a JavaScript function
to[DataType]
. - Exports a TypeScript type interface
DataType
.
This provides autocompletion and inline IDE documentation for event types.
Require or import the module. Here is an example JS and TS file:
const {toLogEntryData} = require('@google/events/cloud/audit/v1/LogEntryData');
const data = {
// ...
};
const jsExample = toLogEntryData(data);
console.log(jsExample);
import {LogEntryData} from '@google/events/cloud/audit/v1/LogEntryData';
const data = {
// ...
};
const tsExample: LogEntryData = data;
console.log(tsExample);
The reference.md
file has detailed examples for how to use every event data type.