diff --git a/.eslintrc b/.eslintrc index 6d47232..d369782 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,6 +14,9 @@ "node": true, "mocha": true }, + "plugins": [ + "header" + ], "rules": { "no-var": "error", "standard/no-callback-literal": "off", @@ -31,6 +34,7 @@ "valid-jsdoc": "warn", "semi": ["error", "always"], "quotes": ["error", "double", { "allowTemplateLiterals": true }], - "@typescript-eslint/no-explicit-any": "off" + "@typescript-eslint/no-explicit-any": "off", + "header/header": [2, "block", ["", " Copyright 2021 The CloudEvents Authors"," SPDX-License-Identifier: Apache-2.0", ""], 2] } } diff --git a/cucumber.js b/cucumber.js index abde5e2..5f59d71 100644 --- a/cucumber.js +++ b/cucumber.js @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + // cucumber.js let common = [ "--require-module ts-node/register", // Load TypeScript module diff --git a/package-lock.json b/package-lock.json index ea1e8f3..2951a86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3185,6 +3185,12 @@ "regexpp": "^3.0.0" } }, + "eslint-plugin-header": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", + "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", + "dev": true + }, "eslint-plugin-import": { "version": "2.22.1", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", diff --git a/package.json b/package.json index 6a1a0b9..9b1595c 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,62 @@ }, { "name": "Lance Ball", - "email": "lball@redhat.com" + "email": "lball@redhat.com", + "url": "https://github.com/lance" + }, + { + "name": "Lucas Holmquist", + "email": "lholmqui@redhat.com", + "url": "https://github.com/lholmquist" + }, + { + "name": "Grant Timmerman", + "url": "https://github.com/grant" + }, + { + "name": "Daniel Bevenius", + "email": "daniel.bevenius@gmail.com", + "url": "https://github.com/danbev" + }, + { + "name": "Helio Frota", + "url": "https://github.com/helio-frota" + }, + { + "name": "Doug Davis", + "email": "dug@us.ibm.com", + "url": "https://github.com/duglin" + }, + { + "name": "Remi Cattiau", + "email": "rcattiau@gmail.com", + "url": "https://github.com/loopingz" + }, + { + "name": "Michele Angioni", + "url": "https://github.com/micheleangioni" + }, + { + "name": "Ali Ok", + "email": "aliok@redhat.com", + "url": "https://github.com/aliok" + }, + { + "name": "Philip Hayes", + "url": "https://github.com/deewhyweb" + }, + { + "name": "Jingwen Peng", + "url": "https://github.com/pengsrc" + }, + { + "name": "Sidharth Vinod", + "email": "sidharthv96@gmail.com", + "url": "https://github.com/sidharthv96" + }, + { + "name": "Matej Vasek", + "url": "https://github.com/matejvasek" } ], "license": "Apache-2.0", @@ -74,6 +129,7 @@ "eslint": "^7.3.0", "eslint-config-prettier": "^6.11.0", "eslint-config-standard": "^14.1.1", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-import": "^2.20.2", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.1.4", diff --git a/src/constants.ts b/src/constants.ts index 30d1dbe..93e9f5f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + const CONSTANTS = Object.freeze({ CHARSET_DEFAULT: "utf-8", EXTENSIONS_PREFIX: "ce-", diff --git a/src/event/cloudevent.ts b/src/event/cloudevent.ts index 5df0b9c..4fa91fa 100644 --- a/src/event/cloudevent.ts +++ b/src/event/cloudevent.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { v4 as uuidv4 } from "uuid"; import { Emitter } from ".."; diff --git a/src/event/interfaces.ts b/src/event/interfaces.ts index bfc3a0e..8fa0201 100644 --- a/src/event/interfaces.ts +++ b/src/event/interfaces.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + /** * The object interface for CloudEvents 1.0. * @see https://github.com/cloudevents/spec/blob/v1.0/spec.md diff --git a/src/event/schemas.ts b/src/event/schemas.ts index c27e44b..4b7bd1d 100644 --- a/src/event/schemas.ts +++ b/src/event/schemas.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + export const schemaV1 = { $ref: "#/definitions/event", definitions: { diff --git a/src/event/spec.ts b/src/event/spec.ts index 3c3abc3..ec0bf07 100644 --- a/src/event/spec.ts +++ b/src/event/spec.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import Ajv from "ajv"; import { ValidationError, isBase64 } from "./validation"; diff --git a/src/event/validation.ts b/src/event/validation.ts index 645df30..ca43534 100644 --- a/src/event/validation.ts +++ b/src/event/validation.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { ErrorObject } from "ajv"; /** diff --git a/src/index.ts b/src/index.ts index b3ae0a4..5257f6d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { CloudEvent, Version } from "./event/cloudevent"; import { ValidationError } from "./event/validation"; import { CloudEventV03, CloudEventV03Attributes, CloudEventV1, CloudEventV1Attributes } from "./event/interfaces"; diff --git a/src/message/http/headers.ts b/src/message/http/headers.ts index 8e2f7fe..e4becc3 100644 --- a/src/message/http/headers.ts +++ b/src/message/http/headers.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { PassThroughParser, DateParser, MappedParser } from "../../parsers"; import { CloudEvent } from "../.."; import { Headers } from "../"; diff --git a/src/message/http/index.ts b/src/message/http/index.ts index 7852dce..ad6356f 100644 --- a/src/message/http/index.ts +++ b/src/message/http/index.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { CloudEvent, CloudEventV03, CloudEventV1, CONSTANTS, Mode, Version } from "../.."; import { Message, Headers } from ".."; diff --git a/src/message/index.ts b/src/message/index.ts index 67f0d8f..6365d29 100644 --- a/src/message/index.ts +++ b/src/message/index.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { IncomingHttpHeaders } from "http"; import { CloudEvent } from ".."; import { binary, deserialize, structured, isEvent } from "./http"; diff --git a/src/parsers.ts b/src/parsers.ts index c70d043..9af9103 100644 --- a/src/parsers.ts +++ b/src/parsers.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import CONSTANTS from "./constants"; import { isString, isDefinedOrThrow, isStringOrObjectOrThrow, ValidationError } from "./event/validation"; diff --git a/src/transport/emitter.ts b/src/transport/emitter.ts index d75f477..c5002cf 100644 --- a/src/transport/emitter.ts +++ b/src/transport/emitter.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { CloudEvent } from "../event/cloudevent"; import { HTTP, Message, Mode } from "../message"; import { EventEmitter } from "events"; diff --git a/src/transport/http/index.ts b/src/transport/http/index.ts index 845475d..60eaad2 100644 --- a/src/transport/http/index.ts +++ b/src/transport/http/index.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { Message, Options } from "../.."; import axios from "axios"; diff --git a/src/transport/protocols.ts b/src/transport/protocols.ts index 4b46cad..26e81e5 100644 --- a/src/transport/protocols.ts +++ b/src/transport/protocols.ts @@ -1,6 +1,12 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + /** * An enum representing the transport protocols for an event */ + export const enum Protocol { HTTPBinary, HTTPStructured, diff --git a/test/conformance/steps.ts b/test/conformance/steps.ts index 8b3377d..92a9cf2 100644 --- a/test/conformance/steps.ts +++ b/test/conformance/steps.ts @@ -1,4 +1,10 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + /* eslint-disable @typescript-eslint/ban-ts-comment */ + import { assert } from "chai"; import { Given, When, Then, World } from "cucumber"; import { Message, Headers, HTTP } from "../../src"; diff --git a/test/integration/cloud_event_test.ts b/test/integration/cloud_event_test.ts index cdb34a2..efede82 100644 --- a/test/integration/cloud_event_test.ts +++ b/test/integration/cloud_event_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import path from "path"; import fs from "fs"; diff --git a/test/integration/constants_test.ts b/test/integration/constants_test.ts index f76c98f..e98ec87 100644 --- a/test/integration/constants_test.ts +++ b/test/integration/constants_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import { expect } from "chai"; import { CONSTANTS } from "../../src"; diff --git a/test/integration/emitter_factory_test.ts b/test/integration/emitter_factory_test.ts index 3de763b..9df2a06 100644 --- a/test/integration/emitter_factory_test.ts +++ b/test/integration/emitter_factory_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import "mocha"; import { expect } from "chai"; import nock from "nock"; diff --git a/test/integration/emitter_singleton_test.ts b/test/integration/emitter_singleton_test.ts index bfa53db..5749ed2 100644 --- a/test/integration/emitter_singleton_test.ts +++ b/test/integration/emitter_singleton_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import "mocha"; import { emitterFor, HTTP, Mode, Message, Emitter } from "../../src"; diff --git a/test/integration/message_test.ts b/test/integration/message_test.ts index 127f6f6..85169de 100644 --- a/test/integration/message_test.ts +++ b/test/integration/message_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import path from "path"; import fs from "fs"; diff --git a/test/integration/parser_test.ts b/test/integration/parser_test.ts index ea7f67c..c08ba68 100644 --- a/test/integration/parser_test.ts +++ b/test/integration/parser_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import "mocha"; import { expect } from "chai"; diff --git a/test/integration/sdk_test.ts b/test/integration/sdk_test.ts index 42a8cf9..f31653b 100644 --- a/test/integration/sdk_test.ts +++ b/test/integration/sdk_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import "mocha"; import { expect } from "chai"; import { CloudEvent, Version } from "../../src"; diff --git a/test/integration/spec_03_tests.ts b/test/integration/spec_03_tests.ts index 27cb3d8..ad84122 100644 --- a/test/integration/spec_03_tests.ts +++ b/test/integration/spec_03_tests.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import "mocha"; import { expect } from "chai"; import { CloudEvent, Version, ValidationError, Mode } from "../../src"; diff --git a/test/integration/spec_1_tests.ts b/test/integration/spec_1_tests.ts index 6da9774..87fd022 100644 --- a/test/integration/spec_1_tests.ts +++ b/test/integration/spec_1_tests.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import "mocha"; import { expect } from "chai"; import { CloudEvent, Version, ValidationError } from "../../src"; diff --git a/test/integration/utilities_test.ts b/test/integration/utilities_test.ts index f387e60..a0b8a2e 100644 --- a/test/integration/utilities_test.ts +++ b/test/integration/utilities_test.ts @@ -1,3 +1,8 @@ +/* + Copyright 2021 The CloudEvents Authors + SPDX-License-Identifier: Apache-2.0 +*/ + import "mocha"; import { expect } from "chai"; import { isStringOrThrow, equalsOrThrow, isBase64, asData } from "../../src/event/validation";