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

@raycast/utils

Package Overview
Dependencies
Maintainers
8
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@raycast/utils - npm Package Compare versions

Comparing version 1.4.11 to 1.4.12

4

dist/suspense/usePromise.d.ts

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

import { FunctionReturningPromise, PromiseType } from "../types";
export declare function usePromise<T extends FunctionReturningPromise>(fn: T, args: Parameters<T>, lifespan?: number): PromiseType<ReturnType<T>>;
import { FunctionReturningPromise } from "../types";
export declare function usePromise<T extends FunctionReturningPromise>(fn: T, args: Parameters<T>, lifespan?: number): Awaited<ReturnType<T>>;
//# sourceMappingURL=usePromise.d.ts.map

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

export declare type PromiseType<P extends Promise<any>> = P extends Promise<infer T> ? T : never;
export declare type FunctionReturningPromise<T extends any[] = any[]> = (...args: T) => Promise<any>;
export declare type PromiseReturnType<T extends FunctionReturningPromise> = PromiseType<ReturnType<T>>;
export declare type AsyncState<T> = {

@@ -5,0 +3,0 @@ isLoading: boolean;

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

import { FunctionReturningPromise, PromiseReturnType, UseCachedPromiseReturnType } from "./types";
import { FunctionReturningPromise, UseCachedPromiseReturnType } from "./types";
import { PromiseOptions } from "./usePromise";

@@ -51,4 +51,4 @@ export declare type CachedPromiseOptions<T extends FunctionReturningPromise, U> = PromiseOptions<T> & {

*/
export declare function useCachedPromise<T extends FunctionReturningPromise<[]>>(fn: T): UseCachedPromiseReturnType<PromiseReturnType<T>, undefined>;
export declare function useCachedPromise<T extends FunctionReturningPromise, U = undefined>(fn: T, args: Parameters<T>, options?: CachedPromiseOptions<T, U>): UseCachedPromiseReturnType<PromiseReturnType<T>, U>;
export declare function useCachedPromise<T extends FunctionReturningPromise<[]>>(fn: T): UseCachedPromiseReturnType<Awaited<ReturnType<T>>, undefined>;
export declare function useCachedPromise<T extends FunctionReturningPromise, U = undefined>(fn: T, args: Parameters<T>, options?: CachedPromiseOptions<T, U>): UseCachedPromiseReturnType<Awaited<ReturnType<T>>, U>;
//# sourceMappingURL=useCachedPromise.d.ts.map

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

}, [parseOutputRef]);
// @ts-expect-error T can't be a Promise so it's actually the same
return (0, useCachedPromise_1.useCachedPromise)(fn, [command, Array.isArray(optionsOrArgs) ? optionsOrArgs : [], execOptions, input], {

@@ -156,0 +157,0 @@ ...useCachedPromiseOptions,

@@ -94,4 +94,5 @@ "use strict";

}, [parseResponseRef]);
// @ts-expect-error T can't be a Promise so it's actually the same
return (0, useCachedPromise_1.useCachedPromise)(fn, [url, fetchOptions], { ...useCachedPromiseOptions, abortable });
}
exports.useFetch = useFetch;
import { MutableRefObject } from "react";
import { FunctionReturningPromise, PromiseReturnType, UsePromiseReturnType } from "./types";
import { FunctionReturningPromise, UsePromiseReturnType } from "./types";
export declare type PromiseOptions<T extends FunctionReturningPromise> = {

@@ -24,3 +24,3 @@ /**

*/
onData?: (data: PromiseReturnType<T>) => void | Promise<void>;
onData?: (data: Awaited<ReturnType<T>>) => void | Promise<void>;
/**

@@ -66,4 +66,4 @@ * Called when an execution will start

*/
export declare function usePromise<T extends FunctionReturningPromise<[]>>(fn: T): UsePromiseReturnType<PromiseReturnType<T>>;
export declare function usePromise<T extends FunctionReturningPromise>(fn: T, args: Parameters<T>, options?: PromiseOptions<T>): UsePromiseReturnType<PromiseReturnType<T>>;
export declare function usePromise<T extends FunctionReturningPromise<[]>>(fn: T): UsePromiseReturnType<Awaited<ReturnType<T>>>;
export declare function usePromise<T extends FunctionReturningPromise>(fn: T, args: Parameters<T>, options?: PromiseOptions<T>): UsePromiseReturnType<Awaited<ReturnType<T>>>;
//# sourceMappingURL=usePromise.d.ts.map

@@ -93,10 +93,12 @@ "use strict";

}
let tempFolder = undefined;
let workaroundCopiedDb = undefined;
return async (query) => {
const abortSignal = abortable.current?.signal;
const spawned = node_child_process_1.default.spawn("sqlite3", ["--json", "--readonly", databasePath, query], {
signal: abortable.current?.signal,
signal: abortSignal,
});
const spawnedPromise = (0, exec_utils_1.getSpawnedPromise)(spawned);
let [{ error, exitCode, signal }, stdoutResult, stderrResult] = await (0, exec_utils_1.getSpawnedResult)(spawned, { encoding: "utf-8" }, spawnedPromise);
if (stderrResult.match("(5)")) {
checkAborted(abortSignal);
if (stderrResult.match("(5)") || stderrResult.match("14")) {
// That means that the DB is busy because of another app is locking it

@@ -106,13 +108,16 @@ // This happens when Chrome or Arc is opened: they lock the History db.

// (with vfs unix - none to just not care about locks)
if (!tempFolder) {
tempFolder = node_path_1.default.join(node_os_1.default.tmpdir(), "useSQL", (0, object_hash_1.default)(databasePath));
if (!workaroundCopiedDb) {
const tempFolder = node_path_1.default.join(node_os_1.default.tmpdir(), "useSQL", (0, object_hash_1.default)(databasePath));
await (0, promises_1.mkdir)(tempFolder, { recursive: true });
checkAborted(abortSignal);
workaroundCopiedDb = node_path_1.default.join(tempFolder, "db");
await (0, promises_1.copyFile)(databasePath, workaroundCopiedDb);
checkAborted(abortSignal);
}
const newDbPath = node_path_1.default.join(tempFolder, "db");
await (0, promises_1.copyFile)(databasePath, newDbPath);
const spawned = node_child_process_1.default.spawn("sqlite3", ["--json", "--readonly", "--vfs", "unix-none", newDbPath, query], {
signal: abortable.current?.signal,
const spawned = node_child_process_1.default.spawn("sqlite3", ["--json", "--readonly", "--vfs", "unix-none", workaroundCopiedDb, query], {
signal: abortSignal,
});
const spawnedPromise = (0, exec_utils_1.getSpawnedPromise)(spawned);
[{ error, exitCode, signal }, stdoutResult, stderrResult] = await (0, exec_utils_1.getSpawnedResult)(spawned, { encoding: "utf-8" }, spawnedPromise);
checkAborted(abortSignal);
}

@@ -162,1 +167,8 @@ if (error || exitCode !== 0 || signal !== null) {

}
function checkAborted(signal) {
if (signal?.aborted) {
const error = new Error("aborted");
error.name = "AbortError";
throw error;
}
}
{
"name": "@raycast/utils",
"version": "1.4.11",
"version": "1.4.12",
"description": "Set of utilities to streamline building Raycast extensions",

@@ -5,0 +5,0 @@ "author": "Raycast Technologies Ltd.",

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

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