5.1.0 • Published 10 months ago

@1mill/cloudevents v5.1.0

Weekly downloads
60
License
MIT
Repository
github
Last release
10 months ago

@1mill/cloudevents

Introduction

This is an implementation and extention of the CloudEvents v1 specification to easily build cloudevents with origin history.

Install

<script src="https://unpkg.com/@1mill/cloudevents@5/dist/index.umd.js">

or

npm install @1mill/cloudevents
// const { Cloudevent } = require('@1mill/cloudevents') // CommonJs
import { Cloudevent } from '@1mill/cloudevents' // EMS

const cloudevent = new Cloudevent({
  data: { some: 'payload' },
  source: 'https://github.com/1mill/cloudevents',
  type: 'cmd.do-this-command.v0',
})

console.log(cloudevent)
// {
//  actor: undefined,
//  data: '{"some":"payload"}',
//  datacontenttype: 'application/json',
//  dataschema: undefined,
//  id: 'ce_z08RP-H06c09gyrLLrIt3c_NYfHj1UDDY',
//  originid: 'ce_z08RP-H06c09gyrLLrIt3c_NYfHj1UDDY',
//  originsource: 'https://github.com/1mill/cloudevents',
//  origintime: '2024-09-08T21:03:36.320Z',
//  origintype: 'cmd.do-this-command.v0',
//  source: 'https://github.com/1mill/cloudevents',
//  specversion: '1.0',
//  subject: undefined,
//  time: '2024-09-08T21:03:36.320Z',
//  type: 'cmd.do-this-command.v0',
//  wschannelid: undefined,
// }

const enrichedCloudevent = new Cloudevent({
  actor: 'user#1234',
  data: { new: 'payload', value: true },
  origin: cloudevent,
  source: 'https://www.erikekberg.com/',
  subject: 'project#4321',
  type: 'fct.this-thing-happened.v0',
  wschannelid: 'some-prefix:my-resource-name#id=12345',
})

console.log(enrichedCloudevent)
// {
//  actor: 'user#1234',
//  data: '{"new":"payload","value":true}',
//  datacontenttype: 'application/json',
//  dataschema: undefined,
//  id: 'ce_0xy5S_hip8nHwNoLuec1Zmdc1hMzDMDuf',
//  originid: 'ce_z08RP-H06c09gyrLLrIt3c_NYfHj1UDDY',
//  originsource: 'https://github.com/1mill/cloudevents',
//  origintime: '2024-09-08T21:03:36.320Z',
//  origintype: 'cmd.do-this-command.v0',
//  source: 'https://www.erikekberg.com/',
//  specversion: '1.0',
//  subject: 'project#4321',
//  time: '2024-09-08T21:03:36.324Z',
//  type: 'fct.this-thing-happened.v0',
//  wschannelid: 'some-prefix:my-resource-name#id=12345',
// }

Props

PropsRequiredTypeDefaultNotes
actorString
dataAny
datacontenttypeStringIf data is present, then defaults to "application/json" unless otherwise specified
dataschemaString
originCloudeventHelper to set originid, originsource, origintype, and origintime attributes
sourceyesStringprocess.env.MILL_CLOUDEVENTS_SOURCERecommended to use universal identifiers (e.g. https://my-domain.com/my/feature/path/123)
specversionString1.0Cloudevent specification version
subjectString
typeyesString
wschannelidString

Release new version

  1. Create .env and add NPM_TOKEN=...
  2. Run docker compose run node
  3. In the container, run npm version <major|minor|patch>
  4. In the container, run npm run deploy
5.1.0

10 months ago

5.0.0

10 months ago

4.6.3

10 months ago

4.6.2

10 months ago

4.4.1

3 years ago

4.4.0

3 years ago

4.6.1

3 years ago

4.6.0

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.5.0

3 years ago

4.1.0

3 years ago

4.3.0

3 years ago

4.1.1

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.1

4 years ago

3.0.0

4 years ago

0.11.3

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

0.11.1

4 years ago

0.11.2

4 years ago

0.11.0

4 years ago

0.10.11

4 years ago

0.10.10

4 years ago

0.10.9

4 years ago

0.10.8

4 years ago

0.10.7

4 years ago

0.10.6

4 years ago

0.10.5

4 years ago

0.10.4

5 years ago

0.10.3

5 years ago

0.10.1

5 years ago

0.10.2

5 years ago

0.10.0

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.8.9

5 years ago

0.9.0

5 years ago

0.8.8

5 years ago

0.8.7

5 years ago

0.8.6

5 years ago

0.8.5

5 years ago

0.8.4

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.5

5 years ago

0.6.4

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.10

5 years ago

0.5.9

5 years ago

0.5.8

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.4

5 years ago

0.5.5

5 years ago

0.5.3

5 years ago

0.5.0

5 years ago

0.4.1

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.4.0

5 years ago

0.1.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago