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

@badrap/libapp

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@badrap/libapp - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

49

.eslintrc.json

@@ -6,6 +6,9 @@ {

},
"extends": ["plugin:prettier/recommended"],
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
"project": true
},

@@ -19,29 +22,17 @@ "rules": {

"ForInStatement"
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
},
"overrides": [
{
"files": ["src/**/*.{ts,tsx}"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"extends": ["plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
}
}
]
}
}

@@ -39,3 +39,3 @@ import * as v from "@badrap/valita";

private readonly stateType;
readonly experimentalKv: Kv;
readonly kv: Kv;
constructor(config: Config<InstallationState>);

@@ -47,4 +47,2 @@ checkAuthToken(token: string): Promise<{

}>;
seal(data: unknown, expiresIn: number): Promise<string>;
unseal(data: string): Promise<unknown>;
listInstallations(): AsyncIterable<{

@@ -51,0 +49,0 @@ id: string;

@@ -43,3 +43,3 @@ "use strict";

config.stateType ?? v.record();
this.experimentalKv = new kv_js_1.Kv(this.client);
this.kv = new kv_js_1.Kv(this.client);
}

@@ -64,20 +64,2 @@ async checkAuthToken(token) {

}
async seal(data, expiresIn) {
return this.client.request({
method: "POST",
path: ["seal"],
idempotent: true,
json: { expires_in: expiresIn, data },
responseType: v.object({ data: v.string() }).map((r) => r.data),
});
}
async unseal(data) {
return this.client.request({
method: "POST",
path: ["unseal"],
idempotent: true,
json: { data },
responseType: v.object({ data: v.unknown() }).map((r) => r.data),
});
}
async *listInstallations() {

@@ -84,0 +66,0 @@ yield* await this.client.request({

@@ -1,2 +0,2 @@

import type { Client } from "./client.js";
import { Client } from "./client.js";
type KvKey = (number | string | boolean)[];

@@ -3,0 +3,0 @@ type KvEntry<T> = {

@@ -28,2 +28,3 @@ "use strict";

const v = __importStar(require("@badrap/valita"));
const client_js_1 = require("./client.js");
const Key = v.array(v.union(v.string(), v.number(), v.boolean()));

@@ -37,3 +38,3 @@ const GetManyResponse = v.object({

});
const CommitResponse = v.union(v.object({ ok: v.literal(true), versionstamp: v.string() }), v.object({ ok: v.literal(false) }));
const CommitResponse = v.union(v.object({ versionstamp: v.string() }));
class Kv {

@@ -116,3 +117,4 @@ constructor(client) {

async commit() {
return this.base.request({
return this.base
.request({
method: "POST",

@@ -125,2 +127,10 @@ path: ["kv", "mutate"],

responseType: CommitResponse,
})
.then(({ versionstamp }) => {
return { ok: true, versionstamp };
}, (err) => {
if (err instanceof client_js_1.HTTPError && err.statusCode === 409) {
return { ok: false };
}
throw err;
});

@@ -127,0 +137,0 @@ }

{
"name": "@badrap/libapp",
"version": "0.5.0",
"version": "0.6.0",
"description": "TypeScript helpers for creating Badrap apps",

@@ -10,3 +10,3 @@ "repository": {

"engines": {
"node": ">= 16"
"node": ">=18"
},

@@ -21,3 +21,3 @@ "main": "dist/index.js",

"scripts": {
"lint": "eslint --ignore-path .gitignore --max-warnings 0 --ext=.js,.ts .",
"lint": "eslint --max-warnings 0 .",
"typecheck": "tsc --skipLibCheck --noEmit",

@@ -34,15 +34,15 @@ "build": "rm -rf dist/* && tsc",

"devDependencies": {
"@types/node": "^20.10.0",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"prettier": "^3.1.0",
"typescript": "^5.3.2"
"@types/node": "^20.11.13",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.4",
"typescript": "^5.3.3"
},
"dependencies": {
"@badrap/valita": "^0.3.0",
"undici": "^5.28.1"
"undici": "^6.5.0"
}
}

@@ -46,3 +46,3 @@ import * as v from "@badrap/valita";

private readonly stateType: v.Type<InstallationState>;
readonly experimentalKv: Kv;
readonly kv: Kv;

@@ -53,3 +53,3 @@ constructor(config: Config<InstallationState>) {

config.stateType ?? (v.record() as v.Type<InstallationState>);
this.experimentalKv = new Kv(this.client);
this.kv = new Kv(this.client);
}

@@ -79,22 +79,2 @@

async seal(data: unknown, expiresIn: number): Promise<string> {
return this.client.request({
method: "POST",
path: ["seal"],
idempotent: true,
json: { expires_in: expiresIn, data },
responseType: v.object({ data: v.string() }).map((r) => r.data),
});
}
async unseal(data: string): Promise<unknown> {
return this.client.request({
method: "POST",
path: ["unseal"],
idempotent: true,
json: { data },
responseType: v.object({ data: v.unknown() }).map((r) => r.data),
});
}
async *listInstallations(): AsyncIterable<{

@@ -101,0 +81,0 @@ id: string;

import * as v from "@badrap/valita";
import type { Client } from "./client.js";
import { Client, HTTPError } from "./client.js";

@@ -46,6 +46,3 @@ type KvKey = (number | string | boolean)[];

const CommitResponse = v.union(
v.object({ ok: v.literal(true), versionstamp: v.string() }),
v.object({ ok: v.literal(false) }),
);
const CommitResponse = v.union(v.object({ versionstamp: v.string() }));

@@ -141,12 +138,24 @@ export class Kv {

async commit(): Promise<KvCommitResult | KvCommitError> {
return this.base.request({
method: "POST",
path: ["kv", "mutate"],
json: {
checks: this._checks,
mutations: this._mutations,
},
responseType: CommitResponse,
});
return this.base
.request({
method: "POST",
path: ["kv", "mutate"],
json: {
checks: this._checks,
mutations: this._mutations,
},
responseType: CommitResponse,
})
.then(
({ versionstamp }) => {
return { ok: true, versionstamp };
},
(err) => {
if (err instanceof HTTPError && err.statusCode === 409) {
return { ok: false };
}
throw err;
},
);
}
}

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