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

@prismicio/editor-support

Package Overview
Dependencies
Maintainers
0
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prismicio/editor-support - npm Package Compare versions

Comparing version 0.4.33 to 0.4.34

2

dist/Http.cjs.js

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./Type.cjs.js");async function A(e,t){const{okType:n,signal:o,headers:b,body:f,timeout:m=2*6e4,...T}=t,r=new Headers(b);!r.has("Content-Type")&&f&&r.set("Content-Type","application/json"),r.get("Content-Type")==="multipart/form-data"&&r.delete("Content-Type");const d=g();d&&r.set("Authorization",`Bearer ${d}`);const w=r.get("Content-Type")==="application/json"?JSON.stringify(f):f;let h=!1;try{const i=!t.method||t.method==="GET"?new AbortController:void 0,E=R([i==null?void 0:i.signal,o].filter(q.isDefined));i&&setTimeout(()=>{h=!0,i.abort()},m);const c=await fetch(e,{...T,body:w,headers:r,signal:E}),{status:y}=c,k=c.clone(),p=await c.json().catch(u=>k.text());if(c.ok){const u=n.safeParse(p);if(!u.success)throw new a(e,{type:"validation",status:y,cause:u.error});return u.data}else throw new a(e,{type:"http",status:y,body:p})}catch(s){throw l(s)?s:v(s)?new a(e,{type:h?"timeout":"abort"}):new a(e,{type:"unknown",cause:C(s)})}}class a extends Error{constructor(t,n){super(JSON.stringify({url:t,...n},null,2)),this.detail=n,this.name="RequestError"}}function C(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e}function l(e){return e instanceof a}function O(e){return!l(e)||e.detail.type!=="http"?!1:e.detail.status===401||e.detail.status===403}function R(e){const t=new AbortController;function n(){t.abort();for(const o of e)o.removeEventListener("abort",n)}for(const o of e){if(o.aborted){n();break}o.addEventListener("abort",n)}return t.signal}function v(e){return e instanceof DOMException&&e.name==="AbortError"}let g=()=>"";function B(e){g=e}function S(e){return e==="token"?"omit":"include"}exports.getRequestCredentials=S;exports.isAuthError=O;exports.isRequestError=l;exports.registerBearerTokenGetter=B;exports.request=A;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./Type.cjs.js");async function v(e,t){const{okType:n,signal:r,headers:b,body:f,timeout:T=15e3,...m}=t,o=new Headers(b);!o.has("Content-Type")&&f&&o.set("Content-Type","application/json"),o.get("Content-Type")==="multipart/form-data"&&o.delete("Content-Type");const d=g();d&&o.set("Authorization",`Bearer ${d}`);const w=o.get("Content-Type")==="application/json"?JSON.stringify(f):f;let p=!1;try{const i=!t.method||t.method==="GET"?new AbortController:void 0,E=R([i==null?void 0:i.signal,r].filter(q.isDefined));i&&setTimeout(()=>{p=!0,i.abort()},T);const c=await fetch(e,{...m,body:w,headers:o,signal:E}),{status:y}=c,k=c.clone(),h=await c.json().catch(u=>k.text());if(c.ok){const u=n.safeParse(h);if(!u.success)throw new a(e,{type:"validation",status:y,cause:u.error});return u.data}else throw new a(e,{type:"http",status:y,body:h})}catch(s){throw l(s)?s:B(s)?new a(e,{type:p?"timeout":"abort"}):new a(e,A(s))}}class a extends Error{constructor(t,n){super(JSON.stringify({url:t,...n},null,2)),this.detail=n,this.name="RequestError"}}function A(e){var t;return{type:"unknown",cause:C(e),online:navigator.onLine,connectionType:(t=navigator.connection)==null?void 0:t.effectiveType}}function C(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e}function l(e){return e instanceof a}function O(e){return!l(e)||e.detail.type!=="http"?!1:e.detail.status===401||e.detail.status===403}function R(e){const t=new AbortController;function n(){t.abort();for(const r of e)r.removeEventListener("abort",n)}for(const r of e){if(r.aborted){n();break}r.addEventListener("abort",n)}return t.signal}function B(e){return e instanceof DOMException&&e.name==="AbortError"}let g=()=>"";function S(e){g=e}function j(e){return e==="token"?"omit":"include"}exports.getRequestCredentials=j;exports.isAuthError=O;exports.isRequestError=l;exports.registerBearerTokenGetter=S;exports.request=v;

@@ -23,2 +23,4 @@ import type { ZodError, ZodType, ZodTypeDef } from "zod";

cause: unknown;
online: boolean;
connectionType?: string;
} | {

@@ -25,0 +27,0 @@ type: "validation";

@@ -1,13 +0,13 @@

import { isDefined as A } from "./Type.es.js";
async function x(t, e) {
import { isDefined as v } from "./Type.es.js";
async function B(t, e) {
const {
okType: n,
signal: r,
headers: g,
headers: b,
body: u,
timeout: m = 2 * 6e4,
timeout: m = 15e3,
...w
} = e, o = new Headers(g);
} = e, o = new Headers(b);
!o.has("Content-Type") && u && o.set("Content-Type", "application/json"), o.get("Content-Type") === "multipart/form-data" && o.delete("Content-Type");
const l = b();
const l = g();
l && o.set("Authorization", `Bearer ${l}`);

@@ -18,3 +18,3 @@ const T = o.get("Content-Type") === "application/json" ? JSON.stringify(u) : u;

const i = !e.method || e.method === "GET" ? new AbortController() : void 0, E = O(
[i == null ? void 0 : i.signal, r].filter(A)
[i == null ? void 0 : i.signal, r].filter(v)
);

@@ -29,9 +29,9 @@ i && setTimeout(() => {

signal: E
}), { status: h } = c, k = c.clone(), p = await c.json().catch((f) => k.text());
}), { status: p } = c, k = c.clone(), h = await c.json().catch((f) => k.text());
if (c.ok) {
const f = n.safeParse(p);
const f = n.safeParse(h);
if (!f.success)
throw new a(t, {
type: "validation",
status: h,
status: p,
cause: f.error

@@ -41,8 +41,5 @@ });

} else
throw new a(t, { type: "http", status: h, body: p });
throw new a(t, { type: "http", status: p, body: h });
} catch (s) {
throw y(s) ? s : q(s) ? new a(t, { type: d ? "timeout" : "abort" }) : new a(t, {
type: "unknown",
cause: C(s)
});
throw y(s) ? s : q(s) ? new a(t, { type: d ? "timeout" : "abort" }) : new a(t, A(s));
}

@@ -55,2 +52,12 @@ }

}
function A(t) {
var e;
return {
type: "unknown",
cause: C(t),
online: navigator.onLine,
// Not all browsers support this
connectionType: (e = navigator.connection) == null ? void 0 : e.effectiveType
};
}
function C(t) {

@@ -66,3 +73,3 @@ return t instanceof Error ? {

}
function B(t) {
function R(t) {
return !y(t) || t.detail.type !== "http" ? !1 : t.detail.status === 401 || t.detail.status === 403;

@@ -89,15 +96,15 @@ }

}
let b = () => "";
function R(t) {
b = t;
let g = () => "";
function j(t) {
g = t;
}
function j(t) {
function S(t) {
return t === "token" ? "omit" : "include";
}
export {
j as getRequestCredentials,
B as isAuthError,
S as getRequestCredentials,
R as isAuthError,
y as isRequestError,
R as registerBearerTokenGetter,
x as request
j as registerBearerTokenGetter,
B as request
};

@@ -67,3 +67,3 @@ {

},
"version": "0.4.33"
"version": "0.4.34"
}
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