New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arecibo

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arecibo - npm Package Compare versions

Comparing version 0.8.0 to 1.0.0

13

lib/index.d.ts
/// <reference types="node" />
import { RequestHandler } from 'fastify';
import { ServerResponse, IncomingMessage } from 'http';
interface IOpts {
import { RequestHandler, Plugin } from 'fastify';
import { ServerResponse, IncomingMessage, Server } from 'http';
interface Opts {
message?: string;

@@ -12,3 +12,6 @@ readinessURL?: string;

}
export default function arecibo(fastify: any, opts: IOpts, next: (err?: Error) => void): void;
export {};
interface Arecibo extends Plugin<Server, IncomingMessage, ServerResponse, Opts> {
default: Arecibo;
}
declare const _default: Arecibo;
export = _default;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = arecibo;
var _schema = require("./schema");
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
const schema_1 = require("./schema");
const READINESS_URL = '/arecibo/readiness';

@@ -87,26 +84,15 @@ const LIVENESS_URL = '/arecibo/liveness';

`;
const defaultResponse = message => (_, reply) => {
reply.type('text/html').send(message);
const defaultResponse = (message) => (_, reply) => {
reply.type('text/html').send(message);
};
function arecibo(fastify, opts, next) {
const _opts$message = opts.message,
message = _opts$message === void 0 ? defaultMessage : _opts$message,
_opts$readinessURL = opts.readinessURL,
readinessURL = _opts$readinessURL === void 0 ? READINESS_URL : _opts$readinessURL,
_opts$livenessURL = opts.livenessURL,
livenessURL = _opts$livenessURL === void 0 ? LIVENESS_URL : _opts$livenessURL;
const readinessCallback = opts.readinessCallback || defaultResponse(message);
const livenessCallback = opts.livenessCallback || defaultResponse(message);
fastify.get(readinessURL, {
schema: _schema.readinessSchema
}, readinessCallback);
fastify.get(livenessURL, {
schema: _schema.livenessSchema
}, livenessCallback);
next();
}
module.exports = exports.default;
const arecibo = fastify_plugin_1.default(function (fastify, opts, next) {
const { message = defaultMessage, readinessURL = READINESS_URL, livenessURL = LIVENESS_URL, } = opts;
const readinessCallback = opts.readinessCallback || defaultResponse(message);
const livenessCallback = opts.livenessCallback || defaultResponse(message);
fastify.get(readinessURL, { schema: schema_1.readinessSchema }, readinessCallback);
fastify.get(livenessURL, { schema: schema_1.livenessSchema }, livenessCallback);
next();
}, { fastify: '2.x' });
arecibo.default = arecibo;
module.exports = arecibo;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.livenessSchema = exports.readinessSchema = void 0;
const readinessSchema = {
description: 'The kubelet uses liveness probes to know when to restart a Container',
tags: ['arecibo'],
summary: 'Readiness Probe route',
response: {
200: {
description: 'All Systems Ready!',
type: 'string'
}
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.readinessSchema = {
description: 'The kubelet uses liveness probes to know when to restart a Container',
tags: ['arecibo'],
summary: 'Readiness Probe route',
response: {
200: {
description: 'All Systems Ready!',
type: 'string',
},
},
};
exports.readinessSchema = readinessSchema;
const livenessSchema = {
description: 'The kubelet uses readiness probes to know when a Container is ready to start accepting traffic',
tags: ['arecibo'],
summary: 'Liveness Probe route',
response: {
200: {
description: 'All Systems Ready!',
type: 'string'
}
}
exports.livenessSchema = {
description: 'The kubelet uses readiness probes to know when a Container is ready to start accepting traffic',
tags: ['arecibo'],
summary: 'Liveness Probe route',
response: {
200: {
description: 'All Systems Ready!',
type: 'string',
},
},
};
exports.livenessSchema = livenessSchema;
//# sourceMappingURL=schema.js.map
{
"name": "arecibo",
"version": "0.8.0",
"version": "1.0.0",
"description": "Fastify plugin that respondes to kubernetes readiness and liveness probes.",
"main": "./lib/index.js",
"module": "./lib-es/index.js",
"main": "./lib",
"types": "./lib/index.d.ts",
"scripts": {
"type-check": "tsc -p ./tsconfig.json --noEmit",
"clean-build": "rimraf ./lib ./lib-esm && mkdir lib lib-esm",
"clean-build": "rimraf ./lib && mkdir lib",
"prebuild": "npm-run-all clean-build lint type-check",
"build": "npm run build-types && npm-run-all build-js build-esm",
"build-types": "tsc --emitDeclarationOnly",
"build-js": "babel ./src --out-dir lib --extensions \".ts,.tsx\" -s",
"build-esm": "tsc -m es6 --outDir lib-esm --declaration false",
"build": "tsc -p ./tsconfig.json",
"prettier": "prettier --loglevel warn --write \"src/**/*.{ts,tsx}\"",

@@ -43,18 +39,9 @@ "prelint": "npm run prettier",

"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-typescript": "^7.0.0",
"@types/node": "^10.9.3",
"babel-plugin-add-module-exports": "^1.0.0",
"fastify": "^1.11.1",
"npm-run-all": "^4.1.3",
"prettier": "^1.14.2",
"rimraf": "^2.6.2",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"typescript": "^3.0.3"
"@types/node": "10.9.3",
"npm-run-all": "4.1.5",
"prettier": "1.16.4",
"rimraf": "2.6.3",
"tslint": "5.13.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "~3.3.3333"
},

@@ -64,3 +51,7 @@ "files": [

"/lib-esm"
]
],
"dependencies": {
"fastify": "~2.0.0",
"fastify-plugin": "~1.5.0"
}
}
<div align="center">
![arecibo-logo-v1](https://user-images.githubusercontent.com/6388707/44850629-2441de80-ac5e-11e8-9508-10beca9d17ef.png)
</div>

@@ -10,3 +10,3 @@

[![NPM version](https://img.shields.io/npm/v/arecibo.svg?style=flat)](https://www.npmjs.com/package/arecibo)
[![NPM downloads](https://img.shields.io/npm/dm/arecibo.svg?style=flat)](https://www.npmjs.com/package/arecibo)
[![NPM downloads](https://img.shields.io/npm/dm/arecibo.svg?style=flat)](https://www.npmjs.com/package/arecibo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

@@ -18,2 +18,3 @@ [![Known Vulnerabilities](https://snyk.io/test/github/nucleode/arecibo/badge.svg?targetFile=package.json)](https://snyk.io/test/github/nucleode/arecibo?targetFile=package.json)

## Installation
This module only supports 2.x.x versions of fastify.

@@ -24,9 +25,11 @@ ```bash

## Usage
## Usage in Node.js
```javascript
const arecibo = require('arecibo') // or import * as arecibo from 'arecibo'
const arecibo = require('arecibo')
// or import arecibo from 'arecibo'
// or import * as arecibo from 'arecibo'
fastify.register(arecibo, {
message: 'Put here your custom message', // optional, default to original arecibo message
message: 'Put here your custom message', // optional, default to original arecibo message
readinessURL: '/put/here/your/custom/url', // optional, deafult to /arecibo/readiness

@@ -39,5 +42,8 @@ livenessURL: '/put/here/your/custom/url', // optional, deafult to /arecibo/liveness

```
### Note for typescript users
On Kubernetes add deployment manifest
If you set `"esModuleInterop": true` you must import this module using `import arecibo from 'arecibo'`.
## On Kubernetes add deployment manifest
```yaml

@@ -75,3 +81,3 @@ ...

## Fun fact: where does the name come from?
## Fun fact: where does the name come from?
The name is inspired by the Arecibo message, a 1974 interstellar radio message carrying basic information about humanity and Earth sent to globular star cluster M13 in the hope that extraterrestrial intelligence might receive and decipher it. The message was broadcast into space a single time via frequency modulated radio waves at a ceremony to mark the remodelling of the Arecibo radio telescope in Puerto Rico on 16 November 1974.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc