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

arcjet

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arcjet - npm Package Compare versions

Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7

16

index.d.ts
import { ArcjetContext, ArcjetBotType, ArcjetEmailType, ArcjetMode, ArcjetStack, ArcjetDecision, ArcjetRule, ArcjetRequestDetails } from "@arcjet/protocol";
import { Transport } from "@arcjet/protocol/proto.js";
export * from "@arcjet/protocol";
export type Simplify<T> = {
type Simplify<T> = {
[KeyType in keyof T]: T[KeyType];
} & {};
declare const emptyObjectSymbol: unique symbol;
export type EmptyObject = {
[emptyObjectSymbol]?: never;
};
export type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends (mergedIntersection: infer Intersection) => void ? // The `& Union` is to allow indexing by the resulting type
type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends (mergedIntersection: infer Intersection) => void ? // The `& Union` is to allow indexing by the resulting type
Intersection & Union : never;

@@ -128,3 +124,3 @@ export interface RemoteClient {

export type ExtraProps<Rules> = Rules extends [] ? {} : Rules extends ArcjetRule[][] ? UnionToIntersection<PropsForRule<Rules[number][number]>> : Rules extends ArcjetRule[] ? UnionToIntersection<PropsForRule<Rules[number]>> : never;
export type ArcjetRequest<Rules> = Simplify<Partial<ArcjetRequestDetails & ExtraProps<Rules>>>;
export type ArcjetRequest<Props extends PlainObject> = Simplify<Partial<ArcjetRequestDetails & Props>>;
export type Primitive<Props extends PlainObject = {}> = ArcjetRule<Props>[];

@@ -164,3 +160,3 @@ export type Product<Props extends PlainObject = {}> = ArcjetRule<Props>[];

*/
export interface Arcjet<Rules extends [...(Primitive | Product)[]]> {
export interface Arcjet<Props extends PlainObject> {
get runtime(): Runtime;

@@ -182,3 +178,3 @@ /**

*/
protect(request: ArcjetRequest<Rules>): Promise<ArcjetDecision>;
protect(request: ArcjetRequest<Props>): Promise<ArcjetDecision>;
}

@@ -190,2 +186,2 @@ /**

*/
export default function arcjet<const Rules extends [...(Primitive | Product)[]] = []>(options: ArcjetOptions<Rules>): Arcjet<Rules>;
export default function arcjet<const Rules extends [...(Primitive | Product)[]] = []>(options: ArcjetOptions<Rules>): Arcjet<Simplify<ExtraProps<Rules>>>;

@@ -75,3 +75,3 @@ import { ArcjetErrorDecision, ArcjetErrorReason, ArcjetRuleResult, ArcjetReason, ArcjetDenyDecision, ArcjetEmailReason, ArcjetBotType, ArcjetBotReason } from '@arcjet/protocol';

const sdkStack = ArcjetStackToProtocol(options?.sdkStack ?? "NODEJS");
const sdkVersion = "1.0.0-alpha.6";
const sdkVersion = "1.0.0-alpha.7";
const client = createPromiseClient(DecideService, options.transport);

@@ -78,0 +78,0 @@ return Object.freeze({

@@ -104,9 +104,7 @@ import {

// Simplify, EmptyObject, and UnionToIntersection from
// https://github.com/sindresorhus/type-fest
// Type helpers from https://github.com/sindresorhus/type-fest but adjusted for
// our use.
//
// Simplify:
// https://github.com/sindresorhus/type-fest/blob/964466c9d59c711da57a5297ad954c13132a0001/source/simplify.d.ts
// EmptyObject:
// https://github.com/sindresorhus/type-fest/blob/b9723d4785f01f8d2487c09ee5871a1f615781aa/source/empty-object.d.ts
// UnionToIntersection:

@@ -134,6 +132,4 @@ // https://github.com/sindresorhus/type-fest/blob/017bf38ebb52df37c297324d97bcc693ec22e920/source/union-to-intersection.d.ts

// SOFTWARE.
export type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
declare const emptyObjectSymbol: unique symbol;
export type EmptyObject = { [emptyObjectSymbol]?: never };
export type UnionToIntersection<Union> =
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
type UnionToIntersection<Union> =
// `extends unknown` is always going to be the case and is used to convert the

@@ -484,4 +480,4 @@ // `Union` into a [distributive conditional

export type ArcjetRequest<Rules> = Simplify<
Partial<ArcjetRequestDetails & ExtraProps<Rules>>
export type ArcjetRequest<Props extends PlainObject> = Simplify<
Partial<ArcjetRequestDetails & Props>
>;

@@ -754,3 +750,3 @@

*/
export interface Arcjet<Rules extends [...(Primitive | Product)[]]> {
export interface Arcjet<Props extends PlainObject> {
get runtime(): Runtime;

@@ -772,3 +768,3 @@ /**

*/
protect(request: ArcjetRequest<Rules>): Promise<ArcjetDecision>;
protect(request: ArcjetRequest<Props>): Promise<ArcjetDecision>;
}

@@ -783,3 +779,3 @@

const Rules extends [...(Primitive | Product)[]] = [],
>(options: ArcjetOptions<Rules>): Arcjet<Rules> {
>(options: ArcjetOptions<Rules>): Arcjet<Simplify<ExtraProps<Rules>>> {
const log = new Logger();

@@ -807,3 +803,5 @@

},
async protect(request: ArcjetRequest<Rules>): Promise<ArcjetDecision> {
async protect(
request: ArcjetRequest<ExtraProps<Rules>>,
): Promise<ArcjetDecision> {
// This goes against the type definition above, but users might call

@@ -810,0 +808,0 @@ // `protect()` with no value and we don't want to crash

{
"name": "arcjet",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.7",
"description": "Arcjet TypeScript and JavaScript SDK core",

@@ -34,13 +34,13 @@ "license": "Apache-2.0",

"dependencies": {
"@arcjet/analyze": "1.0.0-alpha.6",
"@arcjet/logger": "1.0.0-alpha.6",
"@arcjet/protocol": "1.0.0-alpha.6"
"@arcjet/analyze": "1.0.0-alpha.7",
"@arcjet/logger": "1.0.0-alpha.7",
"@arcjet/protocol": "1.0.0-alpha.7"
},
"devDependencies": {
"@arcjet/eslint-config": "1.0.0-alpha.6",
"@arcjet/rollup-config": "1.0.0-alpha.6",
"@arcjet/tsconfig": "1.0.0-alpha.6",
"@arcjet/eslint-config": "1.0.0-alpha.7",
"@arcjet/rollup-config": "1.0.0-alpha.7",
"@arcjet/tsconfig": "1.0.0-alpha.7",
"@edge-runtime/jest-environment": "2.3.7",
"@jest/globals": "29.7.0",
"@rollup/wasm-node": "4.9.0",
"@rollup/wasm-node": "4.9.1",
"@types/node": "18.18.0",

@@ -47,0 +47,0 @@ "jest": "29.7.0",

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