You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

nuxt-api-party

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-api-party - npm Package Compare versions

Comparing version

to
2.2.1

dist/runtime/hooks.d.ts

4

dist/module.json

@@ -7,7 +7,7 @@ {

},
"version": "2.1.2",
"version": "2.2.1",
"builder": {
"@nuxt/module-builder": "1.0.0-alpha.1",
"unbuild": "3.3.1"
"unbuild": "3.5.0"
}
}

@@ -6,2 +6,3 @@ import { useNuxtApp, useRequestHeaders, useRuntimeConfig } from "#imports";

import { isFormData } from "../form-data.js";
import { mergeFetchHooks } from "../hooks.js";
import { resolvePathParams } from "../openapi.js";

@@ -39,4 +40,15 @@ import { headersToObject, serializeMaybeEncodedBody } from "../utils.js";

const endpoint = (apiParty.endpoints || {})[endpointId];
const fetchHooks = mergeFetchHooks(fetchOptions, {
async onRequest(ctx) {
await nuxt.callHook("api-party:request", ctx);
await nuxt.callHook(`api-party:request:${endpointId}`, ctx);
},
async onResponse(ctx) {
await nuxt.callHook(`api-party:response:${endpointId}`, ctx);
await nuxt.callHook("api-party:response", ctx);
}
});
const clientFetcher = () => globalThis.$fetch(resolvePathParams(path, pathParams), {
...fetchOptions,
...fetchHooks,
baseURL: endpoint.url,

@@ -57,2 +69,3 @@ method,

...fetchOptions,
...fetchHooks,
method: "POST",

@@ -59,0 +72,0 @@ body: {

@@ -41,3 +41,3 @@ import type { NitroFetchOptions } from 'nitropack';

};
export type UseApiDataOptions<T> = Pick<ComputedOptions<NitroFetchOptions<string>>, 'onRequest' | 'onRequestError' | 'onResponse' | 'onResponseError' | 'query' | 'headers' | 'method' | 'retry' | 'retryDelay' | 'retryStatusCodes' | 'timeout'> & {
export type UseApiDataOptions<T> = Pick<ComputedOptions<NitroFetchOptions<string>>, 'query' | 'headers' | 'method' | 'retry' | 'retryDelay' | 'retryStatusCodes' | 'timeout'> & Pick<NitroFetchOptions<string>, 'onRequest' | 'onRequestError' | 'onResponse' | 'onResponseError'> & {
path?: MaybeRefOrGetter<Record<string, string>>;

@@ -44,0 +44,0 @@ body?: MaybeRef<string | Record<string, any> | FormData | null>;

@@ -7,2 +7,3 @@ import { useAsyncData, useRequestHeaders, useRuntimeConfig } from "#imports";

import { isFormData } from "../form-data.js";
import { mergeFetchHooks } from "../hooks.js";
import { resolvePathParams } from "../openapi.js";

@@ -75,2 +76,12 @@ import { headersToObject, serializeMaybeEncodedBody } from "../utils.js";

let result;
const fetchHooks = mergeFetchHooks(fetchOptions, {
async onRequest(ctx) {
await nuxt?.callHook("api-party:request", ctx);
await nuxt?.callHook(`api-party:request:${endpointId}`, ctx);
},
async onResponse(ctx) {
await nuxt?.callHook(`api-party:response:${endpointId}`, ctx);
await nuxt?.callHook("api-party:response", ctx);
}
});
try {

@@ -80,2 +91,3 @@ if (client) {

..._fetchOptions,
...fetchHooks,
signal: controller.signal,

@@ -100,2 +112,3 @@ baseURL: endpoint.url,

..._fetchOptions,
...fetchHooks,
signal: controller.signal,

@@ -102,0 +115,0 @@ method: "POST",

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

import { useRuntimeConfig } from "#imports";
import { useRuntimeConfig } from "nitropack/runtime";
import { resolvePathParams } from "../openapi.js";

@@ -3,0 +3,0 @@ import { headersToObject } from "../utils.js";

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

import { useRuntimeConfig } from "#imports";
import {

@@ -14,2 +13,3 @@ createError,

} from "h3";
import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
import { deserializeMaybeEncodedBody } from "../utils.js";

@@ -22,2 +22,3 @@ const ALLOWED_REQUEST_HEADERS = [

export default defineEventHandler(async (event) => {
const nitro = useNitroApp();
const endpointId = getRouterParam(event, "endpointId");

@@ -79,3 +80,11 @@ const apiParty = useRuntimeConfig().apiParty;

responseType: "arrayBuffer",
ignoreResponseError: true
ignoreResponseError: true,
async onRequest(ctx) {
await nitro.hooks.callHook("api-party:request", ctx, event);
await nitro.hooks.callHook(`api-party:request:${endpointId}`, ctx, event);
},
async onResponse(ctx) {
await nitro.hooks.callHook(`api-party:response:${endpointId}`, ctx, event);
await nitro.hooks.callHook("api-party:response", ctx, event);
}
}

@@ -82,0 +91,0 @@ );

{
"name": "nuxt-api-party",
"type": "module",
"version": "2.1.2",
"packageManager": "pnpm@9.15.4",
"version": "2.2.1",
"packageManager": "pnpm@10.6.5",
"description": "Securely connect to any API with a server proxy and generated composables",

@@ -26,3 +26,3 @@ "author": "Johann Schopplich <hello@johannschopplich.com>",

"types": "./dist/types.d.mts",
"import": "./dist/module.mjs"
"default": "./dist/module.mjs"
}

@@ -53,9 +53,9 @@ },

"dependencies": {
"@nuxt/kit": "^3.15.2",
"@nuxt/kit": "^3.16.1",
"defu": "^6.1.4",
"jiti": "^2.4.2",
"ofetch": "^1.4.1",
"ohash": "^1.1.4",
"ohash": "^2.0.11",
"openapi-typescript-helpers": "0.0.13",
"pathe": "^2.0.2",
"pathe": "^2.0.3",
"scule": "^1.3.0",

@@ -65,14 +65,14 @@ "ufo": "^1.5.4"

"devDependencies": {
"@antfu/eslint-config": "^3.14.0",
"@antfu/eslint-config": "^4.10.1",
"@nuxt/module-builder": "^1.0.0-alpha.1",
"@nuxt/test-utils": "^3.15.4",
"@types/node": "^22.10.7",
"bumpp": "^9.10.1",
"eslint": "^9.18.0",
"nuxt": "^3.15.2",
"openapi-typescript": "^7.5.2",
"typescript": "^5.7.3",
"vitest": "^2.1.8",
"vue-tsc": "^2.2.0"
"@nuxt/test-utils": "^3.17.2",
"@types/node": "^22.13.10",
"bumpp": "^10.1.0",
"eslint": "^9.22.0",
"nuxt": "^3.16.1",
"openapi-typescript": "^7.6.1",
"typescript": "^5.8.2",
"vitest": "^3.0.9",
"vue-tsc": "^2.2.8"
}
}

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