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

@chronark/zod-bird

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chronark/zod-bird - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

dist/index.d.mts

4

cmd/set-version.js

@@ -1,3 +0,3 @@

const fs = require("fs");
const path = require("path");
const fs = require("node:fs");
const path = require("node:path");

@@ -4,0 +4,0 @@ const root = process.argv[2]; // path to project root

@@ -107,2 +107,2 @@ import { z } from 'zod';

export { Config, NoopTinybird, Tinybird };
export { type Config, NoopTinybird, Tinybird };

@@ -75,17 +75,25 @@ "use strict";

}
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${this.token}`
},
cache: opts == null ? void 0 : opts.cache,
next: {
revalidate: opts == null ? void 0 : opts.revalidate
for (let i = 0; i < 10; i++) {
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${this.token}`
},
cache: opts?.cache,
// @ts-ignore
next: {
revalidate: opts?.revalidate
}
});
if (res.ok) {
return res.json();
}
});
if (!res.ok) {
const error = await res.json();
throw new Error(error.error);
if (res.status === 429) {
await new Promise((r) => setTimeout(r, 1e3 + i ** 2 * 50));
continue;
}
if (!res.ok) {
const error = await res.json();
throw new Error(error.error);
}
}
const body = await res.json();
return body;
}

@@ -133,3 +141,3 @@ buildPipe(req) {

const body = (Array.isArray(validatedEvents) ? validatedEvents : [validatedEvents]).map((p) => JSON.stringify(p)).join("\n");
let res = await fetch(url, {
const res = await fetch(url, {
method: "POST",

@@ -139,20 +147,2 @@ body,

});
if (res.status === 429) {
const limit = res.headers.get("X-RateLimit-Limit");
const remaining = res.headers.get("X-RateLimit-Remaining");
const reset = res.headers.get("X-RateLimit-Reset");
const retryAfter = res.headers.get("Retry-After");
console.warn(`Hit Tinybird ratelimit: ${url}`, {
limit,
remaining,
reset,
retryAfter
});
await new Promise((r) => setTimeout(r, retryAfter ? parseInt(retryAfter) : 1e3));
res = await fetch(url, {
method: "POST",
body,
headers: { Authorization: `Bearer ${this.token}` }
});
}
if (!res.ok) {

@@ -159,0 +149,0 @@ throw new Error(

{
"name": "@chronark/zod-bird",
"version": "0.3.3",
"version": "0.3.4",
"description": "",

@@ -12,10 +12,10 @@ "main": "dist/index.js",

"devDependencies": {
"@biomejs/biome": "^1.4.1",
"@types/node": "^20.2.1",
"tsup": "^6.2.3",
"tsx": "^3.10.1",
"typescript": "^5.0.4"
"@biomejs/biome": "^1.6.3",
"@types/node": "^20.11.30",
"tsup": "^8.0.2",
"tsx": "^4.7.1",
"typescript": "^5.4.3"
},
"dependencies": {
"zod": "^3.21.4"
"zod": "^3.22.4"
},

@@ -22,0 +22,0 @@ "scripts": {

@@ -45,19 +45,28 @@ import { z } from "zod";

}
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${this.token}`,
},
cache: opts?.cache,
// @ts-ignore
next: {
revalidate: opts?.revalidate,
},
});
if (!res.ok) {
const error = (await res.json()) as PipeErrorResponse;
throw new Error(error.error);
for (let i = 0; i < 10; i++) {
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${this.token}`,
},
cache: opts?.cache,
// @ts-ignore
next: {
revalidate: opts?.revalidate,
},
});
if (res.ok) {
return res.json();
}
if (res.status === 429) {
await new Promise((r) => setTimeout(r, 1000 + i ** 2 * 50));
continue;
}
if (!res.ok) {
const error = (await res.json()) as PipeErrorResponse;
throw new Error(error.error);
}
}
const body = await res.json();
return body;
}

@@ -133,3 +142,3 @@

let res = await fetch(url, {
const res = await fetch(url, {
method: "POST",

@@ -140,25 +149,2 @@ body,

/**
* Add one retry in case of 429 ratelimit response
*/
if (res.status === 429) {
const limit = res.headers.get("X-RateLimit-Limit");
const remaining = res.headers.get("X-RateLimit-Remaining");
const reset = res.headers.get("X-RateLimit-Reset");
const retryAfter = res.headers.get("Retry-After");
console.warn(`Hit Tinybird ratelimit: ${url}`, {
limit,
remaining,
reset,
retryAfter,
});
await new Promise((r) => setTimeout(r, retryAfter ? parseInt(retryAfter) : 1000));
res = await fetch(url, {
method: "POST",
body,
headers: { Authorization: `Bearer ${this.token}` },
});
}
if (!res.ok) {

@@ -165,0 +151,0 @@ throw new Error(

@@ -14,3 +14,3 @@ {

/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */

@@ -29,3 +29,3 @@ // "jsx": "preserve", /* Specify what JSX code is generated. */

/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "commonjs" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */

@@ -54,5 +54,5 @@ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */

// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
// "removeComments": true, /* Disable emitting comments. */
"noEmit": true, /* Disable emitting files from a compilation. */
"noEmit": true /* Disable emitting files from a compilation. */,
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */

@@ -77,13 +77,13 @@ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */

// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
"strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
"strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
"strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
"strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
"strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */,
"strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
"strictBindCallApply": true /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */,
"strictPropertyInitialization": true /* Check for class properties that are declared but not set in the constructor. */,
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */

@@ -94,3 +94,3 @@ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */

// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
"exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
"exactOptionalPropertyTypes": true /* Interpret optional property types as written, rather than adding 'undefined'. */,
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */

@@ -97,0 +97,0 @@ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */

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