From 85a957d69a94fa9882b32e645a9fc2904dffcc14 Mon Sep 17 00:00:00 2001 From: Eric Jizba Date: Wed, 3 Nov 2021 14:07:21 -0700 Subject: [PATCH] Clean up licensing --- .eslintrc.json | 12 ++++++++++- package-lock.json | 17 +++++++++++++++ package.json | 1 + src/Context.ts | 3 +++ src/FunctionInfo.ts | 3 +++ src/FunctionLoader.ts | 3 +++ src/GrpcService.ts | 3 +++ src/Worker.ts | 3 +++ src/WorkerChannel.ts | 3 +++ src/augmenters/InvocationRequestAugmenters.ts | 3 +++ src/augmenters/index.ts | 3 +++ src/converters/BindingConverters.ts | 3 +++ src/converters/RpcConverters.ts | 3 +++ src/converters/RpcHttpConverters.ts | 3 +++ src/converters/index.ts | 3 +++ src/http/Request.ts | 3 ++- src/http/Response.ts | 5 +++-- src/nodejsWorker.ts | 3 +++ src/utils/InternalException.ts | 3 +++ src/utils/Logger.ts | 7 +++++-- test/BindingConvertersTests.ts | 3 +++ test/ContextTests.ts | 3 +++ test/FunctionInfoTests.ts | 3 +++ test/FunctionLoaderTests.ts | 3 +++ test/RpcConvertersTests.ts | 3 +++ test/RpcHttpConverters.ts | 3 +++ test/TestEventStream.ts | 3 +++ test/TypesTests.ts | 3 +++ test/WorkerChannelTests.ts | 3 +++ test/WorkerTests.ts | 3 +++ types/LICENSE | 21 +++++++++++++++++++ types/index.d.ts | 3 +++ types/index.test.ts | 3 +++ 33 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 types/LICENSE diff --git a/.eslintrc.json b/.eslintrc.json index 326a551b..d4e1e164 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,8 @@ { "parser": "@typescript-eslint/parser", "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "header" ], "parserOptions": { "project": "tsconfig.json", @@ -14,6 +15,15 @@ "plugin:prettier/recommended" ], "rules": { + "header/header": [ + 2, + "line", + [ + " Copyright (c) .NET Foundation. All rights reserved.", + " Licensed under the MIT License." + ], + 2 + ], "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-types": "off", "@typescript-eslint/explicit-module-boundary-types": "off", diff --git a/package-lock.json b/package-lock.json index 05941e22..03fb6628 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "chai-as-promised": "^7.1.1", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-prettier": "^4.0.0", "husky": "^7.0.2", "mocha": "^5.2.0", @@ -2125,6 +2126,15 @@ "eslint": ">=7.0.0" } }, + "node_modules/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, + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz", @@ -9175,6 +9185,13 @@ "dev": true, "requires": {} }, + "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, + "requires": {} + }, "eslint-plugin-prettier": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz", diff --git a/package.json b/package.json index 47198ae4..467e214e 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "eslint-config-prettier": "^8.3.0", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-prettier": "^4.0.0", "eslint": "^7.32.0", "husky": "^7.0.2", diff --git a/src/Context.ts b/src/Context.ts index 6eeb8a58..936f1211 100644 --- a/src/Context.ts +++ b/src/Context.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { BindingDefinition, Context, diff --git a/src/FunctionInfo.ts b/src/FunctionInfo.ts index 3f484d06..6699703d 100644 --- a/src/FunctionInfo.ts +++ b/src/FunctionInfo.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; import { toRpcHttp, toTypedData } from './converters'; diff --git a/src/FunctionLoader.ts b/src/FunctionLoader.ts index e24425e8..c3bab8eb 100644 --- a/src/FunctionLoader.ts +++ b/src/FunctionLoader.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import * as url from 'url'; import { isFunction, isObject } from 'util'; import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; diff --git a/src/GrpcService.ts b/src/GrpcService.ts index 4e603dc2..b0ab72ea 100644 --- a/src/GrpcService.ts +++ b/src/GrpcService.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import * as grpc from 'grpc'; import * as protobuf from 'protobufjs'; // import protobufjs json descriptor diff --git a/src/Worker.ts b/src/Worker.ts index 11234afc..006fc00a 100644 --- a/src/Worker.ts +++ b/src/Worker.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import * as parseArgs from 'minimist'; import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; import { FunctionLoader } from './FunctionLoader'; diff --git a/src/WorkerChannel.ts b/src/WorkerChannel.ts index 25e94a03..1376fd63 100644 --- a/src/WorkerChannel.ts +++ b/src/WorkerChannel.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { Context } from '@azure/functions'; import { format, isFunction } from 'util'; import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; diff --git a/src/augmenters/InvocationRequestAugmenters.ts b/src/augmenters/InvocationRequestAugmenters.ts index bcdf4adc..cf6ba145 100644 --- a/src/augmenters/InvocationRequestAugmenters.ts +++ b/src/augmenters/InvocationRequestAugmenters.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc'; /** diff --git a/src/augmenters/index.ts b/src/augmenters/index.ts index c0b6350a..260ca749 100644 --- a/src/augmenters/index.ts +++ b/src/augmenters/index.ts @@ -1 +1,4 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + export * from './InvocationRequestAugmenters'; diff --git a/src/converters/BindingConverters.ts b/src/converters/BindingConverters.ts index 82626cee..c413e9f8 100644 --- a/src/converters/BindingConverters.ts +++ b/src/converters/BindingConverters.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { BindingDefinition, ContextBindingData } from '@azure/functions'; import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc'; import { FunctionInfo } from '../FunctionInfo'; diff --git a/src/converters/RpcConverters.ts b/src/converters/RpcConverters.ts index 6fe81eec..cec384d2 100644 --- a/src/converters/RpcConverters.ts +++ b/src/converters/RpcConverters.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { TraceContext } from '@azure/functions'; import { isLong } from 'long'; import { diff --git a/src/converters/RpcHttpConverters.ts b/src/converters/RpcHttpConverters.ts index 34b4e63e..9e805cf9 100644 --- a/src/converters/RpcHttpConverters.ts +++ b/src/converters/RpcHttpConverters.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { Cookie, HttpMethod } from '@azure/functions'; import { AzureFunctionsRpcMessages as rpc, diff --git a/src/converters/index.ts b/src/converters/index.ts index 8acfb808..93fc1318 100644 --- a/src/converters/index.ts +++ b/src/converters/index.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + export * from './BindingConverters'; export * from './RpcConverters'; export * from './RpcHttpConverters'; diff --git a/src/http/Request.ts b/src/http/Request.ts index 88975085..f778e5f6 100644 --- a/src/http/Request.ts +++ b/src/http/Request.ts @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. +// Licensed under the MIT License. + import { HttpMethod, HttpRequest } from '@azure/functions'; export class RequestProperties implements HttpRequest { diff --git a/src/http/Response.ts b/src/http/Response.ts index 9279db79..6397bc89 100644 --- a/src/http/Response.ts +++ b/src/http/Response.ts @@ -1,7 +1,8 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { Cookie } from '@azure/functions'; -// Copyright (c) .NET Foundation. All rights thiserved. -// Licensed under the MIT License. See License.txt in the project root for license information. interface IResponse { statusCode?: string | number; headers: { diff --git a/src/nodejsWorker.ts b/src/nodejsWorker.ts index 2ed36d81..a4d28bbc 100644 --- a/src/nodejsWorker.ts +++ b/src/nodejsWorker.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + const logPrefix = 'LanguageWorkerConsoleLog'; const errorPrefix = logPrefix + '[error] '; const warnPrefix = logPrefix + '[warn] '; diff --git a/src/utils/InternalException.ts b/src/utils/InternalException.ts index 2a90fc45..49d9e0e1 100644 --- a/src/utils/InternalException.ts +++ b/src/utils/InternalException.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + export class InternalException extends Error { public isAzureFunctionsInternalException = true; } diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index 9fdba91f..55f26e2e 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -1,6 +1,9 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + /** - * Use these methods only if you want to guarantee the messages reach the host despite potential performance impact. - Otherwise, please stick to utilizing the gRPC channel to propagate these messages with category: RpcLogCategory.System + * Use these methods only if you want to guarantee the messages reach the host despite potential performance impact. + * Otherwise, please stick to utilizing the gRPC channel to propagate these messages with category: RpcLogCategory.System **/ const logPrefix = 'LanguageWorkerConsoleLog'; diff --git a/test/BindingConvertersTests.ts b/test/BindingConvertersTests.ts index dfbd52ec..523c44fc 100644 --- a/test/BindingConvertersTests.ts +++ b/test/BindingConvertersTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { expect } from 'chai'; import { fromString } from 'long'; import 'mocha'; diff --git a/test/ContextTests.ts b/test/ContextTests.ts index 01d05254..459120f5 100644 --- a/test/ContextTests.ts +++ b/test/ContextTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { Context } from '@azure/functions'; import { expect } from 'chai'; import 'mocha'; diff --git a/test/FunctionInfoTests.ts b/test/FunctionInfoTests.ts index 031c4dcd..2b4af525 100644 --- a/test/FunctionInfoTests.ts +++ b/test/FunctionInfoTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { expect } from 'chai'; import 'mocha'; import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; diff --git a/test/FunctionLoaderTests.ts b/test/FunctionLoaderTests.ts index 2f020d44..1f5c2586 100644 --- a/test/FunctionLoaderTests.ts +++ b/test/FunctionLoaderTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import 'mocha'; import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; import { FunctionLoader } from '../src/FunctionLoader'; diff --git a/test/RpcConvertersTests.ts b/test/RpcConvertersTests.ts index dfa36b35..e79ebfba 100644 --- a/test/RpcConvertersTests.ts +++ b/test/RpcConvertersTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { expect } from 'chai'; import 'mocha'; import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; diff --git a/test/RpcHttpConverters.ts b/test/RpcHttpConverters.ts index 7d5ed4b1..d70a9bb9 100644 --- a/test/RpcHttpConverters.ts +++ b/test/RpcHttpConverters.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { Cookie } from '@azure/functions'; import { expect } from 'chai'; import 'mocha'; diff --git a/test/TestEventStream.ts b/test/TestEventStream.ts index ca78fdd0..6e9ebcfc 100644 --- a/test/TestEventStream.ts +++ b/test/TestEventStream.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { EventEmitter } from 'events'; import * as sinon from 'sinon'; import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc'; diff --git a/test/TypesTests.ts b/test/TypesTests.ts index 4e613fca..39347667 100644 --- a/test/TypesTests.ts +++ b/test/TypesTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { expect } from 'chai'; import * as cp from 'child_process'; import 'mocha'; diff --git a/test/WorkerChannelTests.ts b/test/WorkerChannelTests.ts index 13d9d328..54330334 100644 --- a/test/WorkerChannelTests.ts +++ b/test/WorkerChannelTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { expect } from 'chai'; import 'mocha'; import * as sinon from 'sinon'; diff --git a/test/WorkerTests.ts b/test/WorkerTests.ts index 797f2775..a65cc721 100644 --- a/test/WorkerTests.ts +++ b/test/WorkerTests.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + import { expect } from 'chai'; import 'mocha'; import { startNodeWorker } from '../src/Worker'; diff --git a/types/LICENSE b/types/LICENSE new file mode 100644 index 00000000..a33fe1c5 --- /dev/null +++ b/types/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) .NET Foundation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/types/index.d.ts b/types/index.d.ts index 6fc81f0d..f7592d5d 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + declare module '@azure/functions' { /** * Interface for your Azure Function code. This function must be exported (via module.exports or exports) diff --git a/types/index.test.ts b/types/index.test.ts index ecfb35bd..81f9212c 100644 --- a/types/index.test.ts +++ b/types/index.test.ts @@ -1,3 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + // This file will be compiled by multiple versions of TypeScript as decribed in ./test/TypesTests.ts to verify there are no errors import { AzureFunction, Context, Cookie, HttpMethod, HttpRequest } from '@azure/functions';