Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cedx/akismet

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cedx/akismet - npm Package Compare versions

Comparing version 16.1.0 to 16.1.1

src/author.js

71

lib/author.d.ts
/**
* Represents the author of a comment.
*/
export declare class Author {
export class Author {
/**
* Creates a new author from the specified JSON object.
* @param {Record<string, any>} json A JSON object representing an author.
* @returns {Author} The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Author;
/**
* Creates a new author.
* @param {Partial<AuthorOptions>} options An object providing values to initialize this instance.
*/
constructor(options?: Partial<AuthorOptions>);
/**
* The author's mail address. If you set it to `"akismet-guaranteed-spam@example.com"`, Akismet will always return `true`.
* @type {string}
*/

@@ -11,2 +23,3 @@ email: string;

* The author's IP address.
* @type {string}
*/

@@ -16,2 +29,3 @@ ipAddress: string;

* The author's name. If you set it to `"viagra-test-123"`, Akismet will always return `true`.
* @type {string}
*/

@@ -21,2 +35,3 @@ name: string;

* The author's role. If you set it to `"administrator"`, Akismet will always return `false`.
* @type {AuthorRole|string}
*/

@@ -26,2 +41,3 @@ role: AuthorRole | string;

* The URL of the author's website.
* @type {URL|null}
*/

@@ -31,18 +47,8 @@ url: URL | null;

* The author's user agent, that is the string identifying the Web browser used to submit comments.
* @type {string}
*/
userAgent: string;
/**
* Creates a new author.
* @param options An object providing values to initialize this instance.
*/
constructor(options?: Partial<AuthorOptions>);
/**
* Creates a new author from the specified JSON object.
* @param json A JSON object representing an author.
* @returns The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Author;
/**
* Converts this object to a map in JSON format.
* @returns The map in JSON format corresponding to this object.
* @returns {Record<string, any>} The map in JSON format corresponding to this object.
*/

@@ -52,6 +58,30 @@ toJSON(): Record<string, any>;

/**
* Specifies the role of an author.
*/
export type AuthorRole = string;
/**
* Defines the options of an {@link Author} instance.
* @typedef {object} AuthorOptions
* @property {string} email The author's mail address. If you set it to `"akismet-guaranteed-spam@example.com"`, Akismet will always return `true`.
* @property {string} ipAddress The author's IP address.
* @property {string} name The author's name.
* @property {AuthorRole|string} role The author's role.
* @property {URL|string} url The URL of the author's website.
* @property {string} userAgent The author's user agent, that is the string identifying the Web browser used to submit comments.
*/
export interface AuthorOptions {
/**
* Specifies the role of an author.
* @enum {string}
*/
export const AuthorRole: Readonly<{
/**
* The author is an administrator.
*/
administrator: "administrator";
}>;
/**
* Defines the options of an {@link Author } instance.
*/
export type AuthorOptions = {
/**
* The author's mail address. If you set it to `"akismet-guaranteed-spam@example.com"`, Akismet will always return `true`.

@@ -75,3 +105,3 @@ */

*/
url: string;
url: URL | string;
/**

@@ -81,12 +111,3 @@ * The author's user agent, that is the string identifying the Web browser used to submit comments.

userAgent: string;
}
/**
* Specifies the role of an author.
*/
export declare enum AuthorRole {
/**
* The author is an administrator.
*/
administrator = "administrator"
}
};
//# sourceMappingURL=author.d.ts.map
/**
* Represents the front page or home URL transmitted when making requests.
*/
export declare class Blog {
export class Blog {
/**
* Creates a new blog from the specified JSON object.
* @param {Record<string, any>} json A JSON object representing a blog.
* @returns {Blog} The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Blog;
/**
* Creates a new blog.
* @param {Partial<BlogOptions>} options An object providing values to initialize this instance.
*/
constructor(options?: Partial<BlogOptions>);
/**
* The character encoding for the values included in comments.
* @type {string}
*/

@@ -11,2 +23,3 @@ charset: string;

* The languages in use on the blog or site, in ISO 639-1 format.
* @type {string[]}
*/

@@ -16,18 +29,8 @@ languages: string[];

* The blog or site URL.
* @type {URL|null}
*/
url: URL | null;
/**
* Creates a new blog.
* @param options An object providing values to initialize this instance.
*/
constructor(options: Partial<BlogOptions>);
/**
* Creates a new blog from the specified JSON object.
* @param json A JSON object representing a blog.
* @returns The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Blog;
/**
* Converts this object to a map in JSON format.
* @returns The map in JSON format corresponding to this object.
* @returns {Record<string, any>} The map in JSON format corresponding to this object.
*/

@@ -37,5 +40,5 @@ toJSON(): Record<string, any>;

/**
* Defines the options of a {@link Blog} instance.
* Defines the options of a {@link Blog } instance.
*/
export interface BlogOptions {
export type BlogOptions = {
/**

@@ -52,4 +55,4 @@ * The character encoding for the values included in comments.

*/
url: string;
}
url: URL | string;
};
//# sourceMappingURL=blog.d.ts.map
/**
* Specifies the result of a comment check.
*/
export declare enum CheckResult {
export type CheckResult = number;
/**
* Specifies the result of a comment check.
* @enum {number}
*/
export const CheckResult: Readonly<{
/**
* The comment is not a spam (i.e. a ham).
*/
ham = 0,
ham: 0;
/**
* The comment is a spam.
*/
spam = 1,
spam: 1;
/**
* The comment is a pervasive spam (i.e. it can be safely discarded).
*/
pervasiveSpam = 2
}
pervasiveSpam: 2;
}>;
//# sourceMappingURL=check_result.d.ts.map

@@ -1,11 +0,28 @@

import type { Blog } from "./blog.js";
import { CheckResult } from "./check_result.js";
import type { Comment } from "./comment.js";
/**
* Submits comments to the [Akismet](https://akismet.com) service.
*/
export declare class Client {
#private;
export class Client {
/**
* The response returned by the `submit-ham` and `submit-spam` endpoints when the outcome is a success.
* @type {string}
* @readonly
*/
static readonly "__#1@#success": string;
/**
* The package version.
* @type {string}
* @readonly
*/
static readonly "__#1@#version": string;
/**
* Creates a new client.
* @param {string} apiKey The Akismet API key.
* @param {import("./blog.js").Blog} blog The front page or home URL of the instance making requests.
* @param {Partial<ClientOptions>} options An object providing values to initialize this instance.
*/
constructor(apiKey: string, blog: import("./blog.js").Blog, options?: Partial<ClientOptions>);
/**
* The Akismet API key.
* @type {string}
* @readonly
*/

@@ -15,2 +32,4 @@ readonly apiKey: string;

* The base URL of the remote API endpoint.
* @type {URL}
* @readonly
*/

@@ -20,6 +39,10 @@ readonly baseUrl: URL;

* The front page or home URL of the instance making requests.
* @type {import("./blog.js").Blog}
* @readonly
*/
readonly blog: Blog;
readonly blog: import("./blog.js").Blog;
/**
* Value indicating whether the client operates in test mode.
* @type {boolean}
* @readonly
*/

@@ -29,43 +52,39 @@ readonly isTest: boolean;

* The user agent string to use when making requests.
* @type {string}
* @readonly
*/
readonly userAgent: string;
/**
* Creates a new client.
* @param apiKey The Akismet API key.
* @param blog The front page or home URL of the instance making requests.
* @param options An object providing values to initialize this instance.
*/
constructor(apiKey: string, blog: Blog, options?: Partial<ClientOptions>);
/**
* Checks the specified comment against the service database, and returns a value indicating whether it is spam.
* @param comment The comment to be checked.
* @returns A value indicating whether the specified comment is spam.
* @param {import("./comment.js").Comment} comment The comment to be checked.
* @returns {Promise<CheckResult>} A value indicating whether the specified comment is spam.
*/
checkComment(comment: Comment): Promise<CheckResult>;
checkComment(comment: import("./comment.js").Comment): Promise<CheckResult>;
/**
* Submits the specified comment that was incorrectly marked as spam but should not have been.
* @param comment The comment to be submitted.
* @returns Resolves once the comment has been submitted.
* @param {import("./comment.js").Comment} comment The comment to be submitted.
* @returns {Promise<void>} Resolves once the comment has been submitted.
*/
submitHam(comment: Comment): Promise<void>;
submitHam(comment: import("./comment.js").Comment): Promise<void>;
/**
* Submits the specified comment that was not marked as spam but should have been.
* @param comment The comment to be submitted.
* @returns Resolves once the comment has been submitted.
* @param {import("./comment.js").Comment} comment The comment to be submitted.
* @returns {Promise<void>} Resolves once the comment has been submitted.
*/
submitSpam(comment: Comment): Promise<void>;
submitSpam(comment: import("./comment.js").Comment): Promise<void>;
/**
* Checks the API key against the service database, and returns a value indicating whether it is valid.
* @returns `true` if the specified API key is valid, otherwise `false`.
* @returns {Promise<boolean>} `true` if the specified API key is valid, otherwise `false`.
*/
verifyKey(): Promise<boolean>;
#private;
}
/**
* Defines the options of a {@link Client} instance.
* Defines the options of a {@link Client } instance.
*/
export interface ClientOptions {
export type ClientOptions = {
/**
* The base URL of the remote API endpoint.
*/
baseUrl: string;
baseUrl: URL | string;
/**

@@ -79,3 +98,4 @@ * Value indicating whether the client operates in test mode.

userAgent: string;
}
};
import { CheckResult } from "./check_result.js";
//# sourceMappingURL=client.d.ts.map

@@ -1,8 +0,19 @@

import { Author } from "./author.js";
/**
* Represents a comment submitted by an author.
*/
export declare class Comment {
export class Comment {
/**
* Creates a new comment from the specified JSON object.
* @param {Record<string, any>} json A JSON object representing a comment.
* @returns {Comment} The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Comment;
/**
* Creates a new comment.
* @param {Partial<CommentOptions>} options An object providing values to initialize this instance.
*/
constructor(options?: Partial<CommentOptions>);
/**
* The comment's author.
* @type {Author|null}
*/

@@ -12,2 +23,3 @@ author: Author | null;

* The comment's content.
* @type {string}
*/

@@ -17,2 +29,3 @@ content: string;

* The context in which this comment was posted.
* @type {string[]}
*/

@@ -22,2 +35,3 @@ context: string[];

* The UTC timestamp of the creation of the comment.
* @type {Date|null}
*/

@@ -27,2 +41,3 @@ date: Date | null;

* The permanent location of the entry the comment is submitted to.
* @type {URL|null}
*/

@@ -32,2 +47,3 @@ permalink: URL | null;

* The UTC timestamp of the publication time for the post, page or thread on which the comment was posted.
* @type {Date|null}
*/

@@ -37,2 +53,3 @@ postModified: Date | null;

* A string describing why the content is being rechecked.
* @type {string}
*/

@@ -42,2 +59,3 @@ recheckReason: string;

* The URL of the webpage that linked to the entry being requested.
* @type {URL|null}
*/

@@ -47,18 +65,8 @@ referrer: URL | null;

* The comment's type.
* @type {CommentType|string}
*/
type: CommentType | string;
/**
* Creates a new comment.
* @param options An object providing values to initialize this instance.
*/
constructor(options: Partial<CommentOptions>);
/**
* Creates a new comment from the specified JSON object.
* @param json A JSON object representing a comment.
* @returns The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Comment;
/**
* Converts this object to a map in JSON format.
* @returns The map in JSON format corresponding to this object.
* @returns {Record<string, any>} The map in JSON format corresponding to this object.
*/

@@ -68,6 +76,57 @@ toJSON(): Record<string, any>;

/**
* Specifies the type of a comment.
*/
export type CommentType = string;
/**
* Defines the options of a {@link Comment} instance.
* @typedef {object} CommentOptions
* @property {Author|null} author The comment's author.
* @property {string} content The comment's content.
* @property {string[]} context The context in which this comment was posted.
* @property {Date|null} date The UTC timestamp of the creation of the comment.
* @property {URL|string} permalink The permanent location of the entry the comment is submitted to.
* @property {Date|null} postModified The UTC timestamp of the publication time for the post, page or thread on which the comment was posted.
* @property {string} recheckReason A string describing why the content is being rechecked.
* @property {URL|string} referrer The URL of the webpage that linked to the entry being requested.
* @property {CommentType|string} type The comment's type.
*/
export interface CommentOptions {
/**
* Specifies the type of a comment.
* @enum {string}
*/
export const CommentType: Readonly<{
/**
* A blog post.
*/
blogPost: "blog-post";
/**
* A blog comment.
*/
comment: "comment";
/**
* A contact form or feedback form submission.
*/
contactForm: "contact-form";
/**
* A top-level forum post.
*/
forumPost: "forum-post";
/**
* A message sent between just a few users.
*/
message: "message";
/**
* A reply to a top-level forum post.
*/
reply: "reply";
/**
* A new user account.
*/
signup: "signup";
}>;
/**
* Defines the options of a {@link Comment } instance.
*/
export type CommentOptions = {
/**
* The comment's author.

@@ -91,3 +150,3 @@ */

*/
permalink: string;
permalink: URL | string;
/**

@@ -104,3 +163,3 @@ * The UTC timestamp of the publication time for the post, page or thread on which the comment was posted.

*/
referrer: string;
referrer: URL | string;
/**

@@ -110,36 +169,4 @@ * The comment's type.

type: CommentType | string;
}
/**
* Specifies the type of a comment.
*/
export declare enum CommentType {
/**
* A blog post.
*/
blogPost = "blog-post",
/**
* A blog comment.
*/
comment = "comment",
/**
* A contact form or feedback form submission.
*/
contactForm = "contact-form",
/**
* A top-level forum post.
*/
forumPost = "forum-post",
/**
* A message sent between just a few users.
*/
message = "message",
/**
* A reply to a top-level forum post.
*/
reply = "reply",
/**
* A new user account.
*/
signup = "signup"
}
};
import { Author } from "./author.js";
//# sourceMappingURL=comment.d.ts.map
/**
* Provides API usage for a given month.
*/
export declare class Usage {
export class Usage {
/**
* Creates a new usage from the specified JSON object.
* @param {Record<string, any>} json A JSON object representing a usage.
* @returns {Usage} The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Usage;
/**
* Creates a new usage.
* @param {Partial<UsageOptions>} options An object providing values to initialize this instance.
*/
constructor(options?: Partial<UsageOptions>);
/**
* The number of monthly API calls your plan entitles you to.
* @type {number}
*/

@@ -11,2 +23,3 @@ limit: number;

* The percentage of the limit used since the beginning of the month.
* @type {number}
*/

@@ -16,2 +29,3 @@ percentage: number;

* Value indicating whether the requests are being throttled for having consistently gone over the limit.
* @type {boolean}
*/

@@ -21,20 +35,10 @@ throttled: boolean;

* The number of calls (spam + ham) since the beginning of the month.
* @type {number}
*/
usage: number;
/**
* Creates a new usage.
* @param options An object providing values to initialize this instance.
*/
constructor(options: Partial<UsageOptions>);
/**
* Creates a new usage from the specified JSON object.
* @param json A JSON object representing a usage.
* @returns The instance corresponding to the specified JSON object.
*/
static fromJson(json: Record<string, any>): Usage;
}
/**
* Defines the options of a {@link Usage} instance.
* Defines the options of a {@link Usage } instance.
*/
export interface UsageOptions {
export type UsageOptions = {
/**

@@ -56,3 +60,3 @@ * The number of monthly API calls your plan entitles you to.

usage: number;
}
};
//# sourceMappingURL=usage.d.ts.map

@@ -9,3 +9,3 @@ {

"type": "module",
"version": "16.1.0",
"version": "16.1.1",
"author": {

@@ -17,15 +17,19 @@ "email": "cedric@belin.io",

"devDependencies": {
"@types/node": "^20.11.6",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"eslint": "^8.56.0",
"typedoc": "^0.25.7",
"typescript": "^5.3.3"
"@babel/eslint-parser": "^7.24.7",
"@babel/plugin-syntax-import-attributes": "^7.24.7",
"@types/gulp": "^4.0.17",
"@types/node": "^20.14.2",
"del": "^7.1.0",
"eslint": "^9.5.0",
"execa": "^9.2.0",
"globals": "^15.4.0",
"gulp": "^5.0.0",
"typescript": "^5.4.5"
},
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
},
"exports": {
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
"default": "./src/index.js"
},

@@ -36,8 +40,2 @@ "files": [

],
"imports": {
"#akismet": {
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
}
},
"keywords": [

@@ -52,11 +50,5 @@ "akismet",

"scripts": {
"build": "node tool/build.js && tsc --project src/tsconfig.json",
"clean": "node tool/clean.js",
"doc": "typedoc --options etc/typedoc.js && node tool/doc.js",
"dist": "npm run clean && npm run build",
"lint": "tsc --project tsconfig.json && eslint --config=etc/eslint.cjs example src test tool",
"postpublish": "node tool/publish.js",
"prepack": "npm run dist",
"test": "npm run build && node --test --test-reporter=spec"
"prepack": "gulp",
"test": "node --test --test-reporter=spec"
}
}

@@ -7,8 +7,7 @@ # Akismet for JS

## Documentation
- [User guide](https://cedx.github.io/akismet.js)
- [API reference](https://cedx.github.io/akismet.js/api)
- [User guide](https://github.com/cedx/akismet.js/wiki)
- [Examples](https://github.com/cedx/akismet.js/tree/main/example)
## Development
- [Git repository](https://github.com/cedx/akismet.js)
- [npm package](https://www.npmjs.com/package/@cedx/akismet)
- [Submit an issue](https://github.com/cedx/akismet.js/issues)

@@ -15,0 +14,0 @@

{
"extends": "../tsconfig",
"include": ["**/*.ts"],
"extends": "../tsconfig.json",
"include": ["**/*.js"],
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"incremental": true,
"noEmit": false,
"outDir": "../lib"
"outDir": "../lib",
"tsBuildInfoFile": "../var/tsbuildinfo.json"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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