@arcjet/protocol
Advanced tools
Comparing version 1.0.0-alpha.8 to 1.0.0-alpha.9
@@ -166,2 +166,4 @@ import { Timestamp } from '@bufbuild/protobuf'; | ||
remaining: reason.remaining, | ||
reset: reason.resetInSeconds, | ||
window: reason.windowInSeconds, | ||
resetTime: reason.resetTime?.toDate(), | ||
@@ -219,2 +221,4 @@ }); | ||
remaining: reason.remaining, | ||
resetInSeconds: reason.reset, | ||
windowInSeconds: reason.window, | ||
resetTime: reason.resetTime | ||
@@ -221,0 +225,0 @@ ? Timestamp.fromDate(reason.resetTime) |
@@ -243,2 +243,4 @@ import { Timestamp } from "@bufbuild/protobuf"; | ||
remaining: reason.remaining, | ||
reset: reason.resetInSeconds, | ||
window: reason.windowInSeconds, | ||
resetTime: reason.resetTime?.toDate(), | ||
@@ -297,2 +299,4 @@ }); | ||
remaining: reason.remaining, | ||
resetInSeconds: reason.reset, | ||
windowInSeconds: reason.window, | ||
resetTime: reason.resetTime | ||
@@ -299,0 +303,0 @@ ? Timestamp.fromDate(reason.resetTime) |
@@ -427,6 +427,23 @@ // @generated by protoc-gen-es v1.7.1 | ||
* | ||
* @generated from field: google.protobuf.Timestamp reset_time = 4; | ||
* Deprecated: Use `reset_in_seconds` instead. | ||
* | ||
* @generated from field: google.protobuf.Timestamp reset_time = 4 [deprecated = true]; | ||
* @deprecated | ||
*/ | ||
resetTime?: Timestamp; | ||
/** | ||
* The duration in seconds until this rate limit window will reset. | ||
* | ||
* @generated from field: uint32 reset_in_seconds = 5; | ||
*/ | ||
resetInSeconds: number; | ||
/** | ||
* The time window in seconds of this rate limit. | ||
* | ||
* @generated from field: uint32 window_in_seconds = 6; | ||
*/ | ||
windowInSeconds: number; | ||
constructor(data?: PartialMessage<RateLimitReason>); | ||
@@ -963,6 +980,6 @@ | ||
/** | ||
* The duration in milliseconds this result should be considered valid, also | ||
* The duration in seconds this result should be considered valid, also | ||
* known as time-to-live. | ||
* | ||
* @generated from field: int32 ttl = 5; | ||
* @generated from field: uint32 ttl = 5; | ||
*/ | ||
@@ -1103,6 +1120,6 @@ ttl: number; | ||
/** | ||
* The duration in milliseconds this decision should be considered valid, | ||
* The duration in seconds this decision should be considered valid, | ||
* also known as time-to-live. | ||
* | ||
* @generated from field: int32 ttl = 5; | ||
* @generated from field: uint32 ttl = 5; | ||
*/ | ||
@@ -1109,0 +1126,0 @@ ttl: number; |
@@ -153,2 +153,4 @@ // @generated by protoc-gen-es v1.7.1 | ||
{ no: 4, name: "reset_time", kind: "message", T: Timestamp }, | ||
{ no: 5, name: "reset_in_seconds", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, | ||
{ no: 6, name: "window_in_seconds", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, | ||
], | ||
@@ -310,3 +312,3 @@ ); | ||
{ no: 4, name: "reason", kind: "message", T: Reason }, | ||
{ no: 5, name: "ttl", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, | ||
{ no: 5, name: "ttl", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, | ||
], | ||
@@ -349,3 +351,3 @@ ); | ||
{ no: 4, name: "rule_results", kind: "message", T: RuleResult, repeated: true }, | ||
{ no: 5, name: "ttl", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, | ||
{ no: 5, name: "ttl", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, | ||
], | ||
@@ -352,0 +354,0 @@ ); |
@@ -1,2 +0,1 @@ | ||
import type { Logger } from "@arcjet/logger"; | ||
type ArcjetEnum<T extends string> = { | ||
@@ -34,2 +33,4 @@ readonly [Key in T]: T; | ||
remaining: number; | ||
reset: number; | ||
window: number; | ||
resetTime?: Date; | ||
@@ -39,2 +40,4 @@ constructor(init: { | ||
remaining: number; | ||
reset: number; | ||
window: number; | ||
resetTime?: Date; | ||
@@ -181,3 +184,2 @@ }); | ||
export interface ArcjetRequestDetails { | ||
[key: string]: unknown; | ||
ip: string; | ||
@@ -191,2 +193,6 @@ method: string; | ||
query: string; | ||
extra: { | ||
[key: string]: string; | ||
}; | ||
email?: string; | ||
} | ||
@@ -247,4 +253,3 @@ export type ArcjetRule<Props extends {} = {}> = { | ||
fingerprint: string; | ||
log: Logger; | ||
}; | ||
export {}; |
@@ -72,2 +72,4 @@ import { typeid } from 'typeid-js'; | ||
remaining; | ||
reset; | ||
window; | ||
resetTime; | ||
@@ -78,2 +80,4 @@ constructor(init) { | ||
this.remaining = init.remaining; | ||
this.reset = init.reset; | ||
this.window = init.window; | ||
this.resetTime = init.resetTime; | ||
@@ -80,0 +84,0 @@ } |
19
index.ts
import { typeid } from "typeid-js"; | ||
import { Reason } from "./gen/es/decide/v1alpha1/decide_pb.js"; | ||
import type { Logger } from "@arcjet/logger"; | ||
@@ -113,5 +112,13 @@ type ArcjetEnum<T extends string> = { readonly [Key in T]: T }; | ||
remaining: number; | ||
reset: number; | ||
window: number; | ||
resetTime?: Date; | ||
constructor(init: { max: number; remaining: number; resetTime?: Date }) { | ||
constructor(init: { | ||
max: number; | ||
remaining: number; | ||
reset: number; | ||
window: number; | ||
resetTime?: Date; | ||
}) { | ||
super(); | ||
@@ -121,2 +128,4 @@ | ||
this.remaining = init.remaining; | ||
this.reset = init.reset; | ||
this.window = init.window; | ||
this.resetTime = init.resetTime; | ||
@@ -376,3 +385,2 @@ } | ||
export interface ArcjetRequestDetails { | ||
[key: string]: unknown; | ||
ip: string; | ||
@@ -383,6 +391,8 @@ method: string; | ||
path: string; | ||
// TODO(#215): Allow `Record<string, string>` and `Record<string, string[]>`? | ||
headers: Headers; | ||
cookies: string; | ||
query: string; | ||
extra: { [key: string]: string }; | ||
// TODO: Consider moving email to `extra` map | ||
email?: string; | ||
} | ||
@@ -469,3 +479,2 @@ | ||
fingerprint: string; | ||
log: Logger; | ||
}; |
{ | ||
"name": "@arcjet/protocol", | ||
"version": "1.0.0-alpha.8", | ||
"version": "1.0.0-alpha.9", | ||
"description": "The TypeScript & JavaScript interface into the Arcjet protocol", | ||
@@ -12,2 +12,11 @@ "license": "Apache-2.0", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/arcjet/arcjet-js/issues", | ||
"email": "support@arcjet.com" | ||
}, | ||
"author": { | ||
"name": "Arcjet", | ||
"email": "support@arcjet.com", | ||
"url": "https://arcjet.com" | ||
}, | ||
"engines": { | ||
@@ -36,3 +45,2 @@ "node": ">=18" | ||
"dependencies": { | ||
"@arcjet/logger": "1.0.0-alpha.8", | ||
"@bufbuild/protobuf": "1.7.2", | ||
@@ -43,7 +51,7 @@ "@connectrpc/connect": "1.3.0", | ||
"devDependencies": { | ||
"@arcjet/eslint-config": "1.0.0-alpha.8", | ||
"@arcjet/rollup-config": "1.0.0-alpha.8", | ||
"@arcjet/tsconfig": "1.0.0-alpha.8", | ||
"@arcjet/eslint-config": "1.0.0-alpha.9", | ||
"@arcjet/rollup-config": "1.0.0-alpha.9", | ||
"@arcjet/tsconfig": "1.0.0-alpha.9", | ||
"@jest/globals": "29.7.0", | ||
"@rollup/wasm-node": "4.9.6", | ||
"@rollup/wasm-node": "4.12.0", | ||
"@types/node": "18.18.0", | ||
@@ -50,0 +58,0 @@ "jest": "29.7.0", |
@@ -11,6 +11,8 @@ <a href="https://arcjet.com" target="_arcjet-home"> | ||
<p> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/%40arcjet%2Fprotocol?style=flat-square&label=%E2%9C%A6Aj&labelColor=000000&color=5C5866"> | ||
<img alt="npm badge" src="https://img.shields.io/npm/v/%40arcjet%2Fprotocol?style=flat-square&label=%E2%9C%A6Aj&labelColor=ECE6F0&color=ECE6F0"> | ||
</picture> | ||
<a href="https://www.npmjs.com/package/@arcjet/protocol"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/%40arcjet%2Fprotocol?style=flat-square&label=%E2%9C%A6Aj&labelColor=000000&color=5C5866"> | ||
<img alt="npm badge" src="https://img.shields.io/npm/v/%40arcjet%2Fprotocol?style=flat-square&label=%E2%9C%A6Aj&labelColor=ECE6F0&color=ECE6F0"> | ||
</picture> | ||
</a> | ||
</p> | ||
@@ -17,0 +19,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
130816
3
3519
0
46
- Removed@arcjet/logger@1.0.0-alpha.8
- Removed@arcjet/logger@1.0.0-alpha.8(transitive)