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

@miniflare/shared

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@miniflare/shared - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0-d1.1

62

dist/src/index.d.ts
import { Awaitable as Awaitable_2 } from '@miniflare/shared';
import type { Database } from 'better-sqlite3';

@@ -33,5 +34,5 @@ export declare function addAll<T>(set: Set<T>, values: Iterable<T>): void;

export declare type CompatibilityDisableFlag = "durable_object_fetch_allows_relative_url" | "fetch_treats_unknown_protocols_as_http" | "formdata_parser_converts_files_to_strings";
export declare type CompatibilityDisableFlag = "no_global_navigator" | "durable_object_fetch_allows_relative_url" | "fetch_treats_unknown_protocols_as_http" | "formdata_parser_converts_files_to_strings";
export declare type CompatibilityEnableFlag = "durable_object_fetch_requires_full_url" | "fetch_refuses_unknown_protocols" | "formdata_parser_supports_files" | "html_rewriter_treats_esi_include_as_void_tag";
export declare type CompatibilityEnableFlag = "global_navigator" | "durable_object_fetch_requires_full_url" | "fetch_refuses_unknown_protocols" | "formdata_parser_supports_files" | "html_rewriter_treats_esi_include_as_void_tag";

@@ -52,2 +53,6 @@ export declare interface CompatibilityFeature {

export declare const EXTERNAL_SUBREQUEST_LIMIT_BUNDLED = 50;
export declare const EXTERNAL_SUBREQUEST_LIMIT_UNBOUND = 1000;
export declare type ExtractOptions<Instance> = Instance extends Plugin<infer Options> ? Options : never;

@@ -57,2 +62,4 @@

export declare function getSQLiteNativeBindingLocation(): string;
export declare function globsToMatcher(globs?: string[]): Matcher;

@@ -79,2 +86,4 @@

export declare const INTERNAL_SUBREQUEST_LIMIT = 1000;
export declare function kebabCase(s: string): string;

@@ -139,2 +148,3 @@

dispatchFetch?: (request: Request) => Promise<Response>;
usageModel?: UsageModel;
}

@@ -174,3 +184,3 @@

fromEntries?: Type extends OptionType.OBJECT ? (entries: [key: string, value: string][]) => Value : undefined;
fromWrangler?: (config: WranglerConfig, configDir: string) => Value | undefined;
fromWrangler?: (config: WranglerConfig, configDir: string, log: Log) => Value | undefined;
}

@@ -222,2 +232,3 @@

rootPath: string;
usageModel?: UsageModel;
globalAsyncIO?: boolean;

@@ -262,6 +273,12 @@ }

readonly durableObject: boolean;
constructor({ requestDepth, pipelineDepth, durableObject, }?: RequestContextOptions);
readonly externalSubrequestLimit: number | false;
readonly internalSubrequestLimit: number | false;
constructor({ requestDepth, pipelineDepth, durableObject, externalSubrequestLimit, internalSubrequestLimit, }?: RequestContextOptions);
runWith<T>(closure: () => T): T;
get subrequests(): number;
incrementSubrequests(count?: number): void;
get externalSubrequests(): number;
get internalSubrequests(): number;
incrementExternalSubrequests(count?: number): void;
incrementInternalSubrequests(count?: number): void;
get currentTime(): number;
advanceCurrentTime(): void;
}

@@ -287,2 +304,6 @@

durableObject?: boolean;
/** Maximum external subrequests (`fetch`, Cache API) allowed. */
externalSubrequestLimit?: number | false;
/** Maximum internal subrequests (KV, Durable Objects) allowed. */
internalSubrequestLimit?: number | false;
}

@@ -339,2 +360,4 @@

abstract list(options: StorageListOptions, skipMetadata: true): Awaitable<StorageListResult<StoredKey>>;
getSqliteDatabase(): Database;
getRangeMaybeExpired?<Meta = unknown>(key: string, start: number, length: number): Promise<StoredValueMeta<Meta> | undefined>;
hasMany(keys: string[]): Promise<number>;

@@ -416,2 +439,6 @@ getMany<Meta = unknown>(keys: string[], skipMetadata?: false): Promise<(StoredValueMeta<Meta> | undefined)[]>;

export declare type UsageModel = "bundled" | "unbound";
export declare function usageModelExternalSubrequestLimit(model?: UsageModel): number;
export declare type ValueOf<T> = T[keyof T];

@@ -479,2 +506,7 @@

}[];
d1_databases?: {
binding: string;
database_name: string;
database_id: string;
}[];
site?: {

@@ -496,11 +528,9 @@ bucket: string;

};
usage_model?: "bundled" | "unbound";
usage_model?: UsageModel;
wasm_modules?: Record<string, string>;
text_blobs?: Record<string, string>;
data_blobs?: Record<string, string>;
experimental_services?: {
name: string;
service: string;
environment: string;
}[];
services?: WranglerServiceConfig[];
/** @deprecated Use `services` instead */
experimental_services?: WranglerServiceConfig[];
miniflare?: {

@@ -512,2 +542,3 @@ globals?: Record<string, any>;

kv_persist?: boolean | string;
d1_persist?: boolean | string;
cache?: boolean;

@@ -537,5 +568,12 @@ cache_persist?: boolean | string;

global_random?: boolean;
actual_time?: boolean;
};
}
export declare interface WranglerServiceConfig {
name: string;
service: string;
environment: string;
}
export { }

@@ -28,2 +28,5 @@ var __create = Object.create;

Compatibility: () => Compatibility,
EXTERNAL_SUBREQUEST_LIMIT_BUNDLED: () => EXTERNAL_SUBREQUEST_LIMIT_BUNDLED,
EXTERNAL_SUBREQUEST_LIMIT_UNBOUND: () => EXTERNAL_SUBREQUEST_LIMIT_UNBOUND,
INTERNAL_SUBREQUEST_LIMIT: () => INTERNAL_SUBREQUEST_LIMIT,
InputGate: () => InputGate,

@@ -51,2 +54,3 @@ InputGatedEventTarget: () => InputGatedEventTarget,

getRequestContext: () => getRequestContext,
getSQLiteNativeBindingLocation: () => getSQLiteNativeBindingLocation,
globsToMatcher: () => globsToMatcher,

@@ -67,2 +71,3 @@ kWrapListener: () => kWrapListener,

titleCase: () => titleCase,
usageModelExternalSubrequestLimit: () => usageModelExternalSubrequestLimit,
viewToArray: () => viewToArray,

@@ -155,2 +160,7 @@ viewToBuffer: () => viewToBuffer,

{
defaultAsOf: "2022-03-21",
enableFlag: "global_navigator",
disableFlag: "no_global_navigator"
},
{
defaultAsOf: "2021-11-10",

@@ -215,4 +225,18 @@ enableFlag: "durable_object_fetch_requires_full_url",

var import_async_hooks = __toModule(require("async_hooks"));
var subrequestLimit = parseInt(process.env.MINIFLARE_SUBREQUEST_LIMIT);
var MAX_SUBREQUESTS = isNaN(subrequestLimit) ? 50 : subrequestLimit;
function parseSubrequestOverride(limit) {
const parsed = parseInt(limit);
if (Number.isNaN(parsed))
return void 0;
if (parsed < 0)
return false;
return parsed;
}
var EXTERNAL_SUBREQUEST_LIMIT_OVERRIDE = parseSubrequestOverride(process.env.MINIFLARE_SUBREQUEST_LIMIT);
var INTERNAL_SUBREQUEST_LIMIT_OVERRIDE = parseSubrequestOverride(process.env.MINIFLARE_INTERNAL_SUBREQUEST_LIMIT);
var EXTERNAL_SUBREQUEST_LIMIT_BUNDLED = 50;
var EXTERNAL_SUBREQUEST_LIMIT_UNBOUND = 1e3;
var INTERNAL_SUBREQUEST_LIMIT = 1e3;
function usageModelExternalSubrequestLimit(model) {
return model === "unbound" ? EXTERNAL_SUBREQUEST_LIMIT_UNBOUND : EXTERNAL_SUBREQUEST_LIMIT_BUNDLED;
}
var MAX_REQUEST_DEPTH = 16;

@@ -234,6 +258,13 @@ var MAX_PIPELINE_DEPTH = 32;

durableObject;
externalSubrequestLimit;
internalSubrequestLimit;
#internalSubrequests = 0;
#externalSubrequests = 0;
#currentTime;
constructor({
requestDepth = 1,
pipelineDepth = 1,
durableObject = false
durableObject = false,
externalSubrequestLimit = EXTERNAL_SUBREQUEST_LIMIT_BUNDLED,
internalSubrequestLimit = INTERNAL_SUBREQUEST_LIMIT
} = {}) {

@@ -254,2 +285,5 @@ (0, import_assert.default)(requestDepth >= 1);

this.durableObject = durableObject;
this.externalSubrequestLimit = EXTERNAL_SUBREQUEST_LIMIT_OVERRIDE !== void 0 ? EXTERNAL_SUBREQUEST_LIMIT_OVERRIDE : externalSubrequestLimit;
this.internalSubrequestLimit = INTERNAL_SUBREQUEST_LIMIT_OVERRIDE !== void 0 ? INTERNAL_SUBREQUEST_LIMIT_OVERRIDE : internalSubrequestLimit;
this.#currentTime = Date.now();
}

@@ -259,13 +293,27 @@ runWith(closure) {

}
#subrequests = 0;
get subrequests() {
return this.#subrequests;
get externalSubrequests() {
return this.#externalSubrequests;
}
incrementSubrequests(count = 1) {
this.#subrequests += count;
if (MAX_SUBREQUESTS >= 0 && this.#subrequests > MAX_SUBREQUESTS) {
throw new Error(`Too many subrequests. Workers can make up to ${MAX_SUBREQUESTS} subrequests per request.
get internalSubrequests() {
return this.#internalSubrequests;
}
incrementExternalSubrequests(count = 1) {
this.#externalSubrequests += count;
if (this.externalSubrequestLimit !== false && this.#externalSubrequests > this.externalSubrequestLimit) {
throw new Error(`Too many subrequests. Workers can make up to ${this.externalSubrequestLimit} subrequests per request.
A subrequest is a call to fetch(), a redirect, or a call to any Cache API method.`);
}
}
incrementInternalSubrequests(count = 1) {
this.#internalSubrequests += count;
if (this.internalSubrequestLimit !== false && this.#internalSubrequests > this.internalSubrequestLimit) {
throw new Error(`Too many API requests by single worker invocation. Workers can make up to ${this.internalSubrequestLimit} KV and Durable Object requests per invocation.`);
}
}
get currentTime() {
return this.#currentTime;
}
advanceCurrentTime() {
this.#currentTime = Date.now();
}
};

@@ -498,3 +546,7 @@

// packages/shared/src/storage.ts
var import_node_path = __toModule(require("node:path"));
var Storage = class {
getSqliteDatabase() {
throw new Error("D1 not implemented for this Storage class");
}
async hasMany(keys) {

@@ -523,2 +575,5 @@ const results = keys.map(this.has.bind(this));

};
function getSQLiteNativeBindingLocation() {
return import_node_path.default.resolve(import_node_path.default.dirname(require.resolve("better-sqlite3")), "../build/Release/better_sqlite3.node");
}

@@ -669,2 +724,5 @@ // packages/shared/src/sync/clock.ts

Compatibility,
EXTERNAL_SUBREQUEST_LIMIT_BUNDLED,
EXTERNAL_SUBREQUEST_LIMIT_UNBOUND,
INTERNAL_SUBREQUEST_LIMIT,
InputGate,

@@ -692,2 +750,3 @@ InputGatedEventTarget,

getRequestContext,
getSQLiteNativeBindingLocation,
globsToMatcher,

@@ -708,2 +767,3 @@ kWrapListener,

titleCase,
usageModelExternalSubrequestLimit,
viewToArray,

@@ -710,0 +770,0 @@ viewToBuffer,

6

package.json
{
"name": "@miniflare/shared",
"version": "2.5.1",
"version": "2.6.0-d1.1",
"description": "Shared utility module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers",

@@ -38,2 +38,4 @@ "keywords": [

"dependencies": {
"@types/better-sqlite3": "^7.5.0",
"better-sqlite3": "^7.5.3",
"ignore": "^5.1.8",

@@ -43,4 +45,4 @@ "kleur": "^4.1.4"

"devDependencies": {
"@miniflare/shared-test": "2.5.1"
"@miniflare/shared-test": "2.6.0-d1.1"
}
}

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