@ecosy/core 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/agents/skills/ecosy-core-fetcher/SKILL.md +93 -0
- package/agents/skills/ecosy-core-serialize/SKILL.md +93 -0
- package/agents/skills/ecosy-core-subscriber/SKILL.md +66 -0
- package/dist/ecosy-core.umd.js +2 -0
- package/dist/ecosy-core.umd.js.map +1 -0
- package/dist/http/array.d.ts +2 -0
- package/dist/http/array.js +1 -0
- package/dist/http/array.mjs +1 -0
- package/dist/http/client.d.ts +38 -0
- package/dist/http/client.js +1 -0
- package/dist/http/client.mjs +1 -0
- package/dist/http/endpoint.d.ts +8 -0
- package/dist/http/endpoint.js +1 -0
- package/dist/http/endpoint.mjs +1 -0
- package/dist/http/fetcher.d.ts +84 -0
- package/dist/http/fetcher.js +1 -0
- package/dist/http/fetcher.mjs +1 -0
- package/dist/http/http-core.d.ts +5 -0
- package/dist/http/http-core.js +1 -0
- package/dist/http/http-core.mjs +1 -0
- package/dist/http/http-static.d.ts +20 -0
- package/dist/http/http-static.js +1 -0
- package/dist/http/http-static.mjs +1 -0
- package/dist/http/http.d.ts +56 -0
- package/dist/http/http.js +1 -0
- package/dist/http/http.mjs +1 -0
- package/dist/http/index.d.ts +14 -0
- package/dist/http/index.js +1 -0
- package/dist/http/index.mjs +1 -0
- package/dist/http/init.d.ts +83 -0
- package/dist/http/init.js +1 -0
- package/dist/http/init.mjs +1 -0
- package/dist/http/method.d.ts +15 -0
- package/dist/http/method.js +1 -0
- package/dist/http/method.mjs +1 -0
- package/dist/http/plugins/cache.d.ts +13 -0
- package/dist/http/plugins/cache.js +1 -0
- package/dist/http/plugins/cache.mjs +1 -0
- package/dist/http/plugins/dedupe.d.ts +7 -0
- package/dist/http/plugins/dedupe.js +1 -0
- package/dist/http/plugins/dedupe.mjs +1 -0
- package/dist/http/plugins/index.d.ts +3 -0
- package/dist/http/plugins/index.js +1 -0
- package/dist/http/plugins/index.mjs +1 -0
- package/dist/http/plugins/logger.d.ts +24 -0
- package/dist/http/plugins/logger.js +1 -0
- package/dist/http/plugins/logger.mjs +1 -0
- package/dist/http/request.d.ts +26 -0
- package/dist/http/request.js +1 -0
- package/dist/http/request.mjs +1 -0
- package/dist/http/response.d.ts +9 -0
- package/dist/http/response.js +1 -0
- package/dist/http/response.mjs +1 -0
- package/dist/http/utils.d.ts +21 -0
- package/dist/http/utils.js +1 -0
- package/dist/http/utils.mjs +1 -0
- package/dist/http/xml.d.ts +24 -0
- package/dist/http/xml.js +1 -0
- package/dist/http/xml.mjs +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +1 -0
- package/dist/node_modules/tslib/tslib.es6.mjs +1 -0
- package/package.json +29 -14
- package/dist/http.d.ts +0 -294
- package/dist/http.js +0 -1
- package/dist/http.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("../node_modules/tslib/tslib.es6.js"),s=require("../utilities/formdata.js"),r=require("./array.js"),e=require("./init.js"),o=require("./method.js"),a=require("./utils.js");exports.HttpCore=class{static async request(i){var n,l,c,u,d;const f=e.getHttpInitSlice(i),{interceptors:p}=f,h=t.__rest(f,["interceptors"]);try{let t=Object.assign({},h);const e=r.asArray(null!==(n=null==p?void 0:p.request)&&void 0!==n?n:[]);for(const s of e)t=await s(t);const i=a.HttpUtils.normalizeURL(t),d=a.HttpUtils.normalizeHeaders(t.headers||{},s.isFormData(t.body)),f=await fetch(i,Object.assign(Object.assign({},a.HttpUtils.extractFetchOptions(t)),{method:t.method||o.Methods.GET,headers:d,body:a.HttpUtils.normalizeBody(t),signal:t.signal}));a.HttpUtils.assertSameOriginResponse(i,f,d);const v=f.headers.get("Content-Type")||"";let y=null;y=v.includes("application/json")?await f.json():await f.text();const j=r.asArray(null!==(l=null==p?void 0:p.transform)&&void 0!==l?l:[]);let m=y;for(const t of j)m=await t(m);const g=r.asArray(null!==(c=null==p?void 0:p.response)&&void 0!==c?c:[]);let w=f;for(const t of g)w=await t(w);const q={};w.headers.forEach((t,s)=>{q[s]=t});const H=w.ok;let b=null;if(!H){b=y.error||y;const t=r.asArray(null!==(u=null==p?void 0:p.error)&&void 0!==u?u:[]);for(const s of t)b=await s(b)}return{data:m,success:H,error:H?null:b,status:w.status,statusText:w.statusText,headers:q}}catch(t){let s=t instanceof Error?t:new Error(String(t));const e=r.asArray(null!==(d=null==p?void 0:p.error)&&void 0!==d?d:[]);for(const t of e)s=await t(s);return{data:null,status:0,statusText:"Error",headers:{},error:s,success:!1}}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as t}from"../node_modules/tslib/tslib.es6.mjs";import{isFormData as o}from"../utilities/formdata.mjs";import{asArray as s}from"./array.mjs";import{getHttpInitSlice as r}from"./init.mjs";import{Methods as e}from"./method.mjs";import{HttpUtils as n}from"./utils.mjs";class a{static async request(a){var i,l,c,u,d;const m=r(a),{interceptors:f}=m,p=t(m,["interceptors"]);try{let t=Object.assign({},p);const r=s(null!==(i=null==f?void 0:f.request)&&void 0!==i?i:[]);for(const o of r)t=await o(t);const a=n.normalizeURL(t),d=n.normalizeHeaders(t.headers||{},o(t.body)),m=await fetch(a,Object.assign(Object.assign({},n.extractFetchOptions(t)),{method:t.method||e.GET,headers:d,body:n.normalizeBody(t),signal:t.signal}));n.assertSameOriginResponse(a,m,d);const h=m.headers.get("Content-Type")||"";let j=null;j=h.includes("application/json")?await m.json():await m.text();const v=s(null!==(l=null==f?void 0:f.transform)&&void 0!==l?l:[]);let w=j;for(const t of v)w=await t(w);const g=s(null!==(c=null==f?void 0:f.response)&&void 0!==c?c:[]);let b=m;for(const t of g)b=await t(b);const y={};b.headers.forEach((t,o)=>{y[o]=t});const x=b.ok;let E=null;if(!x){E=j.error||j;const t=s(null!==(u=null==f?void 0:f.error)&&void 0!==u?u:[]);for(const o of t)E=await o(E)}return{data:w,success:x,error:x?null:E,status:b.status,statusText:b.statusText,headers:y}}catch(t){let o=t instanceof Error?t:new Error(String(t));const r=s(null!==(d=null==f?void 0:f.error)&&void 0!==d?d:[]);for(const t of r)o=await t(o);return{data:null,status:0,statusText:"Error",headers:{},error:o,success:!1}}}}export{a as HttpCore};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpXML } from "./xml";
|
|
2
|
+
import type { HttpInit } from "./init";
|
|
3
|
+
export declare abstract class HttpStatic extends HttpXML {
|
|
4
|
+
static method: {
|
|
5
|
+
readonly GET: "GET";
|
|
6
|
+
readonly POST: "POST";
|
|
7
|
+
readonly PUT: "PUT";
|
|
8
|
+
readonly DELETE: "DELETE";
|
|
9
|
+
readonly PATCH: "PATCH";
|
|
10
|
+
readonly HEAD: "HEAD";
|
|
11
|
+
readonly OPTIONS: "OPTIONS";
|
|
12
|
+
};
|
|
13
|
+
static get<DataType = unknown, Err = unknown>(url: string, init?: Omit<HttpInit, "url" | "method">): Promise<import("./response").HttpResponse<DataType, Err>>;
|
|
14
|
+
static post<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<import("./response").HttpResponse<DataType, Err>>;
|
|
15
|
+
static put<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<import("./response").HttpResponse<DataType, Err>>;
|
|
16
|
+
static patch<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<import("./response").HttpResponse<DataType, Err>>;
|
|
17
|
+
static delete<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<import("./response").HttpResponse<DataType, Err>>;
|
|
18
|
+
static head<DataType = unknown, Err = unknown>(url: string, init?: Omit<HttpInit, "url" | "method">): Promise<import("./response").HttpResponse<DataType, Err>>;
|
|
19
|
+
static options<DataType = unknown, Err = unknown>(url: string, init?: Omit<HttpInit, "url" | "method">): Promise<import("./response").HttpResponse<DataType, Err>>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("./method.js"),s=require("./xml.js");class e extends s.HttpXML{static get(s,e){return this.request(Object.assign(Object.assign({},e),{url:s,method:t.Methods.GET}))}static post(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.Methods.POST,body:e}))}static put(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.Methods.PUT,body:e}))}static patch(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.Methods.PATCH,body:e}))}static delete(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.Methods.DELETE,body:e}))}static head(s,e){return this.request(Object.assign(Object.assign({},e),{url:s,method:t.Methods.HEAD}))}static options(s,e){return this.request(Object.assign(Object.assign({},e),{url:s,method:t.Methods.OPTIONS}))}}e.method=t.Methods,exports.HttpStatic=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Methods as t}from"./method.mjs";import{HttpXML as s}from"./xml.mjs";class e extends s{static get(s,e){return this.request(Object.assign(Object.assign({},e),{url:s,method:t.GET}))}static post(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.POST,body:e}))}static put(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.PUT,body:e}))}static patch(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.PATCH,body:e}))}static delete(s,e,r){return this.request(Object.assign(Object.assign({},r),{url:s,method:t.DELETE,body:e}))}static head(s,e){return this.request(Object.assign(Object.assign({},e),{url:s,method:t.HEAD}))}static options(s,e){return this.request(Object.assign(Object.assign({},e),{url:s,method:t.OPTIONS}))}}e.method=t;export{e as HttpStatic};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HttpStatic } from "./http-static";
|
|
2
|
+
import { Endpoint } from "./endpoint";
|
|
3
|
+
import type { HttpInit } from "./init";
|
|
4
|
+
import type { HttpResponse } from "./response";
|
|
5
|
+
import type { HttpUploadOptions, HttpRelatedOptions } from "./xml";
|
|
6
|
+
import type { HttpInterceptorParameters } from "./init";
|
|
7
|
+
import type { FileListLike } from "../utilities/filelist";
|
|
8
|
+
export interface HttpOptions {
|
|
9
|
+
baseURL?: string;
|
|
10
|
+
allowedOrigins?: ReadonlyArray<string>;
|
|
11
|
+
configs?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export declare class Http extends HttpStatic {
|
|
14
|
+
static readonly method: {
|
|
15
|
+
readonly GET: "GET";
|
|
16
|
+
readonly POST: "POST";
|
|
17
|
+
readonly PUT: "PUT";
|
|
18
|
+
readonly DELETE: "DELETE";
|
|
19
|
+
readonly PATCH: "PATCH";
|
|
20
|
+
readonly HEAD: "HEAD";
|
|
21
|
+
readonly OPTIONS: "OPTIONS";
|
|
22
|
+
};
|
|
23
|
+
static readonly Endpoint: typeof Endpoint;
|
|
24
|
+
private static interceptors;
|
|
25
|
+
readonly method: {
|
|
26
|
+
readonly GET: "GET";
|
|
27
|
+
readonly POST: "POST";
|
|
28
|
+
readonly PUT: "PUT";
|
|
29
|
+
readonly DELETE: "DELETE";
|
|
30
|
+
readonly PATCH: "PATCH";
|
|
31
|
+
readonly HEAD: "HEAD";
|
|
32
|
+
readonly OPTIONS: "OPTIONS";
|
|
33
|
+
};
|
|
34
|
+
readonly baseURL: string;
|
|
35
|
+
private readonly allowedOrigins;
|
|
36
|
+
private readonly defaultConfigs;
|
|
37
|
+
private defaultHeaders;
|
|
38
|
+
private interceptors;
|
|
39
|
+
constructor(init?: string | HttpOptions);
|
|
40
|
+
static on(...params: HttpInterceptorParameters): void;
|
|
41
|
+
static off(...params: HttpInterceptorParameters): void;
|
|
42
|
+
on(...params: HttpInterceptorParameters): this;
|
|
43
|
+
off(...params: HttpInterceptorParameters): this;
|
|
44
|
+
addHeaders(headers: Record<string, string>): void;
|
|
45
|
+
private mergeConfig;
|
|
46
|
+
request<DataType = unknown, Err = unknown>(init: HttpInit): Promise<HttpResponse<DataType, Err>>;
|
|
47
|
+
get<DataType = unknown, Err = unknown>(url: string, init?: Omit<HttpInit, "url" | "method">): Promise<HttpResponse<DataType, Err>>;
|
|
48
|
+
post<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
49
|
+
put<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
50
|
+
patch<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
51
|
+
delete<DataType = unknown, Err = unknown>(url: string, body?: unknown, init?: Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
52
|
+
head<DataType = unknown, Err = unknown>(url: string, init?: Omit<HttpInit, "url" | "method">): Promise<HttpResponse<DataType, Err>>;
|
|
53
|
+
options<DataType = unknown, Err = unknown>(url: string, init?: Omit<HttpInit, "url" | "method">): Promise<HttpResponse<DataType, Err>>;
|
|
54
|
+
upload<DataType = unknown, Err = unknown>(url: string, file: File | File[] | FileListLike, options?: HttpUploadOptions & Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
55
|
+
related<DataType = unknown, Err = unknown>(url: string, fileData: ArrayBuffer | Uint8Array, options: HttpRelatedOptions & Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./method.js"),t=require("./http-static.js"),s=require("./xml.js"),r=require("./endpoint.js"),i=require("./utils.js");class o extends t.HttpStatic{constructor(e){var t,s,r;super(),this.method=o.method,this.defaultHeaders={},this.interceptors={request:[],response:[],transform:[],error:[]};const n="string"==typeof e||void 0===e?{baseURL:null!=e?e:"/"}:e;this.baseURL=null!==(s=null!==(t=n.baseURL)&&void 0!==t?t:"/")&&void 0!==s?s:"/";const a=new Set;for(const e of null!==(r=n.allowedOrigins)&&void 0!==r?r:[]){const t=i.HttpUtils.safeOrigin(e);if(!t)throw new Error(`Http: invalid allowedOrigins entry: ${e}`);a.add(t)}const d=i.HttpUtils.safeOrigin(this.baseURL);d&&a.add(d),this.allowedOrigins=a,this.defaultConfigs=n.configs||{},a.forEach(e=>i.HttpUtils.AllowedOrigins.add(e))}static on(...e){const[t,s]=e,r=o.interceptors[t];r.includes(s)||r.push(s),o.interceptors[t]=r}static off(...e){const[t,s]=e,r=o.interceptors[t];o.interceptors[t]=r.filter(e=>e!==s)}on(...e){const[t,s]=e,r=this.interceptors[t];return r.includes(s)||r.push(s),this.interceptors[t]=r,this}off(...e){const[t,s]=e,r=this.interceptors[t];return this.interceptors[t]=r.filter(e=>e!==s),this}addHeaders(e){this.defaultHeaders=Object.assign(Object.assign({},this.defaultHeaders),e)}mergeConfig(t){const s=[...o.interceptors.request,...this.interceptors.request,...t.request?Array.isArray(t.request)?t.request:[t.request]:[]],r=[...o.interceptors.transform,...this.interceptors.transform,...t.transform?Array.isArray(t.transform)?t.transform:[t.transform]:[]],i=[...o.interceptors.response,...this.interceptors.response,...t.response?Array.isArray(t.response)?t.response:[t.response]:[]],n=[...o.interceptors.error,...this.interceptors.error,...t.error?Array.isArray(t.error)?t.error:[t.error]:[]];let a=t.url;if(a.startsWith("//"))throw new Error(`Http: protocol-relative URLs are not allowed: ${a}`);if(!/^[a-z][a-z0-9+.-]*:/i.test(a)){const e=this.baseURL.replace(/\/+$/,""),t=a.replace(/^\/+/,"");a=e?`${e}/${t}`:`/${t}`}const d=Object.assign(Object.assign({},this.defaultHeaders),t.headers);return Object.assign(Object.assign(Object.assign({},this.defaultConfigs),t),{url:a,headers:d,request:s,transform:r,response:i,error:n,method:t.method||e.Methods.GET})}request(e){return t.HttpStatic.request(this.mergeConfig(e))}get(t,s){return this.request(Object.assign(Object.assign({},s),{url:t,method:e.Methods.GET}))}post(t,s,r){return this.request(Object.assign(Object.assign({},r),{url:t,method:e.Methods.POST,body:s}))}put(t,s,r){return this.request(Object.assign(Object.assign({},r),{url:t,method:e.Methods.PUT,body:s}))}patch(t,s,r){return this.request(Object.assign(Object.assign({},r),{url:t,method:e.Methods.PATCH,body:s}))}delete(t,s,r){return this.request(Object.assign(Object.assign({},r),{url:t,method:e.Methods.DELETE,body:s}))}head(t,s){return this.request(Object.assign(Object.assign({},s),{url:t,method:e.Methods.HEAD}))}options(t,s){return this.request(Object.assign(Object.assign({},s),{url:t,method:e.Methods.OPTIONS}))}upload(t,r,i){return s.HttpXML.upload(t,r,this.mergeConfig(Object.assign(Object.assign({},i),{url:t,method:e.Methods.POST})))}related(t,r,i){return s.HttpXML.related(t,r,this.mergeConfig(Object.assign(Object.assign({},i),{url:t,method:e.Methods.POST})))}}o.method=e.Methods,o.Endpoint=r.Endpoint,o.interceptors={request:[],response:[],transform:[],error:[]},exports.Http=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Methods as e}from"./method.mjs";import{HttpStatic as r}from"./http-static.mjs";import{HttpXML as t}from"./xml.mjs";import{Endpoint as s}from"./endpoint.mjs";import{HttpUtils as o}from"./utils.mjs";class i extends r{constructor(e){var r,t,s;super(),this.method=i.method,this.defaultHeaders={},this.interceptors={request:[],response:[],transform:[],error:[]};const n="string"==typeof e||void 0===e?{baseURL:null!=e?e:"/"}:e;this.baseURL=null!==(t=null!==(r=n.baseURL)&&void 0!==r?r:"/")&&void 0!==t?t:"/";const a=new Set;for(const e of null!==(s=n.allowedOrigins)&&void 0!==s?s:[]){const r=o.safeOrigin(e);if(!r)throw new Error(`Http: invalid allowedOrigins entry: ${e}`);a.add(r)}const c=o.safeOrigin(this.baseURL);c&&a.add(c),this.allowedOrigins=a,this.defaultConfigs=n.configs||{},a.forEach(e=>o.AllowedOrigins.add(e))}static on(...e){const[r,t]=e,s=i.interceptors[r];s.includes(t)||s.push(t),i.interceptors[r]=s}static off(...e){const[r,t]=e,s=i.interceptors[r];i.interceptors[r]=s.filter(e=>e!==t)}on(...e){const[r,t]=e,s=this.interceptors[r];return s.includes(t)||s.push(t),this.interceptors[r]=s,this}off(...e){const[r,t]=e,s=this.interceptors[r];return this.interceptors[r]=s.filter(e=>e!==t),this}addHeaders(e){this.defaultHeaders=Object.assign(Object.assign({},this.defaultHeaders),e)}mergeConfig(r){const t=[...i.interceptors.request,...this.interceptors.request,...r.request?Array.isArray(r.request)?r.request:[r.request]:[]],s=[...i.interceptors.transform,...this.interceptors.transform,...r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:[]],o=[...i.interceptors.response,...this.interceptors.response,...r.response?Array.isArray(r.response)?r.response:[r.response]:[]],n=[...i.interceptors.error,...this.interceptors.error,...r.error?Array.isArray(r.error)?r.error:[r.error]:[]];let a=r.url;if(a.startsWith("//"))throw new Error(`Http: protocol-relative URLs are not allowed: ${a}`);if(!/^[a-z][a-z0-9+.-]*:/i.test(a)){const e=this.baseURL.replace(/\/+$/,""),r=a.replace(/^\/+/,"");a=e?`${e}/${r}`:`/${r}`}const c=Object.assign(Object.assign({},this.defaultHeaders),r.headers);return Object.assign(Object.assign(Object.assign({},this.defaultConfigs),r),{url:a,headers:c,request:t,transform:s,response:o,error:n,method:r.method||e.GET})}request(e){return r.request(this.mergeConfig(e))}get(r,t){return this.request(Object.assign(Object.assign({},t),{url:r,method:e.GET}))}post(r,t,s){return this.request(Object.assign(Object.assign({},s),{url:r,method:e.POST,body:t}))}put(r,t,s){return this.request(Object.assign(Object.assign({},s),{url:r,method:e.PUT,body:t}))}patch(r,t,s){return this.request(Object.assign(Object.assign({},s),{url:r,method:e.PATCH,body:t}))}delete(r,t,s){return this.request(Object.assign(Object.assign({},s),{url:r,method:e.DELETE,body:t}))}head(r,t){return this.request(Object.assign(Object.assign({},t),{url:r,method:e.HEAD}))}options(r,t){return this.request(Object.assign(Object.assign({},t),{url:r,method:e.OPTIONS}))}upload(r,s,o){return t.upload(r,s,this.mergeConfig(Object.assign(Object.assign({},o),{url:r,method:e.POST})))}related(r,s,o){return t.related(r,s,this.mergeConfig(Object.assign(Object.assign({},o),{url:r,method:e.POST})))}}i.method=e,i.Endpoint=s,i.interceptors={request:[],response:[],transform:[],error:[]};export{i as Http};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./array";
|
|
2
|
+
export * from "./client";
|
|
3
|
+
export * from "./endpoint";
|
|
4
|
+
export * from "./fetcher";
|
|
5
|
+
export * from "./http-static";
|
|
6
|
+
export * from "./http";
|
|
7
|
+
export * from "./init";
|
|
8
|
+
export * from "./method";
|
|
9
|
+
export * from "./plugins";
|
|
10
|
+
export * from "./request";
|
|
11
|
+
export * from "./response";
|
|
12
|
+
export * from "./utils";
|
|
13
|
+
export * from "./xml";
|
|
14
|
+
export * from "./http-core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./array.js"),t=require("./client.js"),r=require("./endpoint.js"),s=require("./fetcher.js"),i=require("./http-static.js"),p=require("./http.js"),o=require("./init.js"),u=require("./method.js"),l=require("./plugins/logger.js"),n=require("./plugins/dedupe.js"),c=require("./plugins/cache.js"),a=require("./utils.js"),g=require("./xml.js"),x=require("./http-core.js");exports.asArray=e.asArray,exports.createClient=t.createClient,exports.Endpoint=r.Endpoint,exports.Fetcher=s.Fetcher,exports.HttpStatic=i.HttpStatic,exports.Http=p.Http,exports.getHttpInitSlice=o.getHttpInitSlice,exports.Methods=u.Methods,exports.Uploads=u.Uploads,exports.loggerPlugin=l.loggerPlugin,exports.dedupePlugin=n.dedupePlugin,exports.cachePlugin=c.cachePlugin,exports.HttpUtils=a.HttpUtils,exports.HttpXML=g.HttpXML,exports.HttpCore=x.HttpCore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{asArray}from"./array.mjs";export{createClient}from"./client.mjs";export{Endpoint}from"./endpoint.mjs";export{Fetcher}from"./fetcher.mjs";export{HttpStatic}from"./http-static.mjs";export{Http}from"./http.mjs";export{getHttpInitSlice}from"./init.mjs";export{Methods,Uploads}from"./method.mjs";export{loggerPlugin}from"./plugins/logger.mjs";export{dedupePlugin}from"./plugins/dedupe.mjs";export{cachePlugin}from"./plugins/cache.mjs";export{HttpUtils}from"./utils.mjs";export{HttpXML}from"./xml.mjs";export{HttpCore}from"./http-core.mjs";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { HttpMethod } from "./method";
|
|
2
|
+
import type { MaybeArray } from "./array";
|
|
3
|
+
import type { Promisable } from "../types";
|
|
4
|
+
export type HttpCredentials = "same-origin" | "include" | "omit";
|
|
5
|
+
export type HttpCache = "force-cache" | "no-store";
|
|
6
|
+
export type HttpMode = "cors" | "no-cors" | "same-origin";
|
|
7
|
+
export type HttpRedirect = "follow" | "manual" | "error";
|
|
8
|
+
export type HttpPriority = "auto" | "high" | "low";
|
|
9
|
+
export type HttpDuplex = "half" | "full";
|
|
10
|
+
export type HttpImageFit = "scale-down" | "contain" | "cover" | "crop";
|
|
11
|
+
export type HttpPolish = "lossless" | "lossy" | "off";
|
|
12
|
+
export type HttpReferrerPolicy = "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
13
|
+
export interface HttpInitNext {
|
|
14
|
+
revalidate?: number;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface HttpInitCf {
|
|
18
|
+
cacheEverything?: boolean;
|
|
19
|
+
cacheTtl?: number;
|
|
20
|
+
cacheKey?: string;
|
|
21
|
+
cacheTtlByStatus?: Record<string, number>;
|
|
22
|
+
cacheTags?: string[];
|
|
23
|
+
resolveOverride?: boolean;
|
|
24
|
+
image?: {
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
fit?: HttpImageFit;
|
|
28
|
+
format?: string;
|
|
29
|
+
quality?: number;
|
|
30
|
+
};
|
|
31
|
+
apps?: boolean;
|
|
32
|
+
scrapeShield?: boolean;
|
|
33
|
+
polish?: HttpPolish;
|
|
34
|
+
minify?: {
|
|
35
|
+
javascript?: boolean;
|
|
36
|
+
html?: boolean;
|
|
37
|
+
css?: boolean;
|
|
38
|
+
};
|
|
39
|
+
colo?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Interceptor that can modify a request before it is sent. */
|
|
42
|
+
export type HttpInterceptorRequest = (options: Omit<HttpInitSlice, "url">) => Promisable<Omit<HttpInitSlice, "url">>;
|
|
43
|
+
/** Interceptor that can modify a `Response` after it is received. */
|
|
44
|
+
export type HttpInterceptorResponse = (response: Response) => Promisable<Response>;
|
|
45
|
+
/** Interceptor that transforms the parsed response data. */
|
|
46
|
+
export type HttpInterceptorTransform = (data: Record<string, unknown>) => Promisable<any>;
|
|
47
|
+
/** Interceptor that handles errors from requests. */
|
|
48
|
+
export type HttpInterceptorError = (error: unknown) => Promisable<any>;
|
|
49
|
+
/** Tuple type for registering interceptors by phase. */
|
|
50
|
+
export type HttpInterceptorParameters = ["request", HttpInterceptorRequest] | ["response", HttpInterceptorResponse] | ["transform", HttpInterceptorTransform] | ["error", HttpInterceptorError];
|
|
51
|
+
export interface HttpInitInterceptors {
|
|
52
|
+
transform?: MaybeArray<HttpInterceptorTransform>;
|
|
53
|
+
request?: MaybeArray<HttpInterceptorRequest>;
|
|
54
|
+
response?: MaybeArray<HttpInterceptorResponse>;
|
|
55
|
+
error?: MaybeArray<HttpInterceptorError>;
|
|
56
|
+
}
|
|
57
|
+
export interface HttpInit extends HttpInitNext, HttpInitCf, HttpInitInterceptors {
|
|
58
|
+
url: string;
|
|
59
|
+
method?: HttpMethod;
|
|
60
|
+
query?: Record<string, string | number | boolean | null | undefined>;
|
|
61
|
+
params?: Record<string, unknown>;
|
|
62
|
+
headers?: Record<string, string>;
|
|
63
|
+
body?: unknown;
|
|
64
|
+
signal?: AbortSignal;
|
|
65
|
+
credentials?: HttpCredentials;
|
|
66
|
+
cache?: HttpCache;
|
|
67
|
+
mode?: HttpMode;
|
|
68
|
+
redirect?: HttpRedirect;
|
|
69
|
+
referrer?: string;
|
|
70
|
+
referrerPolicy?: HttpReferrerPolicy;
|
|
71
|
+
integrity?: string;
|
|
72
|
+
keepalive?: boolean;
|
|
73
|
+
priority?: HttpPriority;
|
|
74
|
+
duplex?: HttpDuplex;
|
|
75
|
+
window?: null;
|
|
76
|
+
dispatcher?: unknown;
|
|
77
|
+
}
|
|
78
|
+
export type HttpInitSlice = Omit<HttpInit, keyof HttpInitNext | keyof HttpInitCf | keyof HttpInitInterceptors> & {
|
|
79
|
+
next?: HttpInitNext;
|
|
80
|
+
cf?: HttpInitCf;
|
|
81
|
+
interceptors?: HttpInitInterceptors;
|
|
82
|
+
};
|
|
83
|
+
export declare function getHttpInitSlice(init: Partial<HttpInit>): HttpInitSlice;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={interceptors:["request","response","transform","error"],next:["revalidate","tags"],cf:["cacheEverything","cacheTtl","cacheKey","cacheTtlByStatus","cacheTags","resolveOverride","image","apps","scrapeShield","polish","minify","colo"]};exports.getHttpInitSlice=function(t){const c={},s={},r={},n={};return Object.entries(t).forEach(([t,i])=>{e.next.includes(t)?s[t]=i:e.interceptors.includes(t)?n[t]=i:e.cf.includes(t)?r[t]=i:c[t]=i}),Object.keys(s).length&&(c.next=s),Object.keys(r).length&&(c.cf=r),Object.keys(n)&&(c.interceptors=n),c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={interceptors:["request","response","transform","error"],next:["revalidate","tags"],cf:["cacheEverything","cacheTtl","cacheKey","cacheTtlByStatus","cacheTags","resolveOverride","image","apps","scrapeShield","polish","minify","colo"]};function t(t){const c={},r={},s={},n={};return Object.entries(t).forEach(([t,i])=>{e.next.includes(t)?r[t]=i:e.interceptors.includes(t)?n[t]=i:e.cf.includes(t)?s[t]=i:c[t]=i}),Object.keys(r).length&&(c.next=r),Object.keys(s).length&&(c.cf=s),Object.keys(n)&&(c.interceptors=n),c}export{t as getHttpInitSlice};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const Methods: {
|
|
2
|
+
readonly GET: "GET";
|
|
3
|
+
readonly POST: "POST";
|
|
4
|
+
readonly PUT: "PUT";
|
|
5
|
+
readonly DELETE: "DELETE";
|
|
6
|
+
readonly PATCH: "PATCH";
|
|
7
|
+
readonly HEAD: "HEAD";
|
|
8
|
+
readonly OPTIONS: "OPTIONS";
|
|
9
|
+
};
|
|
10
|
+
export type HttpMethod = keyof typeof Methods;
|
|
11
|
+
export declare const Uploads: {
|
|
12
|
+
UPLOAD: string;
|
|
13
|
+
RELATED: string;
|
|
14
|
+
};
|
|
15
|
+
export type HttpUpload = keyof typeof Uploads;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.Methods={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",HEAD:"HEAD",OPTIONS:"OPTIONS"},exports.Uploads={UPLOAD:"UPLOAD",RELATED:"RELATED"};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const E={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",HEAD:"HEAD",OPTIONS:"OPTIONS"},T={UPLOAD:"UPLOAD",RELATED:"RELATED"};export{E as Methods,T as Uploads};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FetcherMiddleware } from "../fetcher";
|
|
2
|
+
/**
|
|
3
|
+
* Options for configuring the cache plugin.
|
|
4
|
+
*/
|
|
5
|
+
export interface CachePluginOptions {
|
|
6
|
+
/** Time-to-live for cached responses in milliseconds (default: 60000ms) */
|
|
7
|
+
ttl?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Middleware plugin that provides lightweight in-memory caching.
|
|
11
|
+
* Responses are cached based on the action key and arguments.
|
|
12
|
+
*/
|
|
13
|
+
export declare function cachePlugin(options?: CachePluginOptions): FetcherMiddleware;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.cachePlugin=function(t={}){var e;const n=null!==(e=t.ttl)&&void 0!==e?e:6e4,a=new Map;return async(t,e,r)=>{const s=`${t.key}_${JSON.stringify(e)}`,i=a.get(s);if(i&&i.expiresAt>Date.now())return i.data;const c=await r();return a.set(s,{data:c,expiresAt:Date.now()+n}),c}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t={}){var e;const n=null!==(e=t.ttl)&&void 0!==e?e:6e4,a=new Map;return async(t,e,r)=>{const i=`${t.key}_${JSON.stringify(e)}`,o=a.get(i);if(o&&o.expiresAt>Date.now())return o.data;const s=await r();return a.set(i,{data:s,expiresAt:Date.now()+n}),s}}export{t as cachePlugin};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FetcherMiddleware } from "../fetcher";
|
|
2
|
+
/**
|
|
3
|
+
* Middleware plugin that prevents the "Thundering Herd" problem.
|
|
4
|
+
* It deduplicates identical concurrent requests and shares the same Promise
|
|
5
|
+
* among all callers, ensuring only one network request is made.
|
|
6
|
+
*/
|
|
7
|
+
export declare function dedupePlugin(): FetcherMiddleware;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.dedupePlugin=function(){const e=new Map;return async(t,n,s)=>{const r=`${t.key}_${JSON.stringify(n)}`;if(e.has(r))return e.get(r);const i=s().finally(()=>{e.delete(r)});return e.set(r,i),i}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(){const n=new Map;return async(t,e,r)=>{const s=`${t.key}_${JSON.stringify(e)}`;if(n.has(s))return n.get(s);const c=r().finally(()=>{n.delete(s)});return n.set(s,c),c}}export{n as dedupePlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./logger.js"),r=require("./dedupe.js"),u=require("./cache.js");exports.loggerPlugin=e.loggerPlugin,exports.dedupePlugin=r.dedupePlugin,exports.cachePlugin=u.cachePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{loggerPlugin}from"./logger.mjs";export{dedupePlugin}from"./dedupe.mjs";export{cachePlugin}from"./cache.mjs";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FetcherMiddleware } from "../fetcher";
|
|
2
|
+
/**
|
|
3
|
+
* Interface defining the logging methods required by the loggerPlugin.
|
|
4
|
+
*/
|
|
5
|
+
export interface LoggerPluginOptions {
|
|
6
|
+
/** The logger instance to use (e.g. console, winston, @ecosy/logger). Fallbacks to native console if available. */
|
|
7
|
+
logger?: any;
|
|
8
|
+
/** The method name to call on the logger for successful requests. Defaults to "info" or "log". */
|
|
9
|
+
successLevel?: string;
|
|
10
|
+
/** The method name to call on the logger for failed requests. Defaults to "error". */
|
|
11
|
+
errorLevel?: string;
|
|
12
|
+
/** Custom formatter for the request start log. Returns an array of arguments to be spread into the logger. */
|
|
13
|
+
formatStart?: (key: string, args: any[]) => any[];
|
|
14
|
+
/** Custom formatter for a successful response log. */
|
|
15
|
+
formatSuccess?: (key: string, res: any, durationMs: number) => any[];
|
|
16
|
+
/** Custom formatter for a failed response log. */
|
|
17
|
+
formatError?: (key: string, err: any, durationMs: number) => any[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Middleware plugin that logs the lifecycle and execution time of requests.
|
|
21
|
+
* Uses Dependency Inversion Principle (DIP) to allow passing any custom logger.
|
|
22
|
+
* Supports custom log levels mapping and custom formatting.
|
|
23
|
+
*/
|
|
24
|
+
export declare function loggerPlugin(options?: LoggerPluginOptions | any): FetcherMiddleware;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.loggerPlugin=function(o={}){var e,r,t;const n=o&&!o.info&&!o.log&&Object.getPrototypeOf(o)===Object.prototype?o:{logger:o},l="undefined"!=typeof console?console:void 0,c=n.logger||l,i=n.successLevel||"info",s=n.errorLevel||"error",d=(null===(e=null==c?void 0:c[i])||void 0===e?void 0:e.bind(c))||(null===(r=null==c?void 0:c.log)||void 0===r?void 0:r.bind(c))||(()=>{}),u=(null===(t=null==c?void 0:c[s])||void 0===t?void 0:t.bind(c))||(()=>{}),a=n.formatStart||((o,e)=>[`[Fetcher] 🚀 Start: ${o}`,e]),v=n.formatSuccess||((o,e,r)=>[`[Fetcher] ✅ Success: ${o} (${r}ms)`,e]),g=n.formatError||((o,e,r)=>[`[Fetcher] ❌ Error: ${o} (${r}ms)`,e]);return async(o,e,r)=>{const t=Date.now();d(...a(o.key,e));try{const e=await r();return d(...v(o.key,e,Date.now()-t)),e}catch(e){throw u(...g(o.key,e,Date.now()-t)),e}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(o={}){var e,r,t;const n=o&&!o.info&&!o.log&&Object.getPrototypeOf(o)===Object.prototype?o:{logger:o},c="undefined"!=typeof console?console:void 0,l=n.logger||c,i=n.successLevel||"info",d=n.errorLevel||"error",s=(null===(e=null==l?void 0:l[i])||void 0===e?void 0:e.bind(l))||(null===(r=null==l?void 0:l.log)||void 0===r?void 0:r.bind(l))||(()=>{}),a=(null===(t=null==l?void 0:l[d])||void 0===t?void 0:t.bind(l))||(()=>{}),u=n.formatStart||((o,e)=>[`[Fetcher] 🚀 Start: ${o}`,e]),v=n.formatSuccess||((o,e,r)=>[`[Fetcher] ✅ Success: ${o} (${r}ms)`,e]),f=n.formatError||((o,e,r)=>[`[Fetcher] ❌ Error: ${o} (${r}ms)`,e]);return async(o,e,r)=>{const t=Date.now();s(...u(o.key,e));try{const e=await r();return s(...v(o.key,e,Date.now()-t)),e}catch(e){throw a(...f(o.key,e,Date.now()-t)),e}}}export{o as loggerPlugin};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HttpMethod } from "./method";
|
|
2
|
+
/** Accepted query parameter formats for HTTP requests. */
|
|
3
|
+
export type HttpQuery = string | Record<string, string | number | boolean | undefined> | Array<[string, string | number | boolean | undefined]> | URLSearchParams;
|
|
4
|
+
/** Configuration object for an HTTP request. */
|
|
5
|
+
export interface HttpRequest<Body = unknown, Params = Record<string, unknown>, Query = HttpQuery, Headers = Record<string, string>> {
|
|
6
|
+
method: HttpMethod;
|
|
7
|
+
url: string;
|
|
8
|
+
headers?: Headers;
|
|
9
|
+
body?: Body;
|
|
10
|
+
query?: Query;
|
|
11
|
+
params?: Params;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
/**
|
|
14
|
+
* Pass-through bag for `fetch`'s `RequestInit` options that the
|
|
15
|
+
* library does not manage itself (`credentials`, `cache`, `mode`,
|
|
16
|
+
* `redirect`, `referrer`, `referrerPolicy`, `integrity`, `keepalive`,
|
|
17
|
+
* `priority`, `duplex`) plus framework extensions (`next` on Next.js,
|
|
18
|
+
* `cf` on Cloudflare Workers, `dispatcher` on undici).
|
|
19
|
+
*
|
|
20
|
+
* Lib-level fields (`method`, `headers`, `body`, `signal`) cannot be
|
|
21
|
+
* overridden here — they are applied after this bag is spread.
|
|
22
|
+
* Unknown keys are silently dropped, so a compromised caller cannot
|
|
23
|
+
* smuggle arbitrary fields into `fetch`.
|
|
24
|
+
*/
|
|
25
|
+
configs?: Record<string, unknown>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HttpInit, HttpInitSlice } from "./init";
|
|
2
|
+
import type { HttpQuery } from "./request";
|
|
3
|
+
export declare class HttpUtils {
|
|
4
|
+
static readonly AllowedOrigins: Set<unknown>;
|
|
5
|
+
static defaultHeaders: Record<string, string>;
|
|
6
|
+
static isAllowedOrigin(origin: string): boolean;
|
|
7
|
+
static isValidQuery(query: unknown): query is HttpQuery;
|
|
8
|
+
/** Strip prototype-pollution vectors from a plain object shallowly. */
|
|
9
|
+
static stripUnsafeKeys<T extends Record<string, unknown>>(source: T): T;
|
|
10
|
+
static normalizeQuery(options: HttpInit): string;
|
|
11
|
+
static normalizeURL(options: HttpInitSlice): string;
|
|
12
|
+
static normalizeHeaders(headers?: Record<string, string>, isFormData?: boolean): {
|
|
13
|
+
[x: string]: string;
|
|
14
|
+
};
|
|
15
|
+
static removeURL(options: Omit<HttpInitSlice, "url">): HttpInitSlice;
|
|
16
|
+
static extractFetchOptions(options: Omit<HttpInitSlice, "url">): RequestInit;
|
|
17
|
+
static normalizeBody(options: Omit<HttpInitSlice, "url">): string | FormData | Uint8Array | ArrayBuffer | URLSearchParams | undefined;
|
|
18
|
+
/** Parse a URL string into its origin, returning `null` if the input is relative or invalid. */
|
|
19
|
+
static safeOrigin(url: string): string | null;
|
|
20
|
+
static assertSameOriginResponse(requestURL: string, response: Response, sentHeaders: Record<string, string>): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../serialize.js"),t=require("../utilities/get.js"),r=require("./method.js"),i=require("../utilities/formdata.js");const s=new Set(["__proto__","constructor","prototype"]),o=new Set(["credentials","cache","mode","redirect","referrer","referrerPolicy","integrity","keepalive","priority","duplex","window","next","cf","dispatcher"]);class n{static isAllowedOrigin(e){return 0===this.AllowedOrigins.size||this.AllowedOrigins.has(e)}static isValidQuery(t){return"string"==typeof t||t instanceof URLSearchParams||(Array.isArray(t)?t.every(t=>Array.isArray(t)&&2===t.length&&"string"==typeof t[0]&&e.Serialize.Primitive.isPrimitive(t[1])):"object"==typeof t&&null!==t&&Object.values(t).every(t=>e.Serialize.Primitive.isPrimitive(t)))}static stripUnsafeKeys(e){const t=Object.create(null);for(const r of Object.keys(e))s.has(r)||(t[r]=e[r]);return t}static normalizeQuery(t){const{method:i,body:s,query:o}=t,a=i===r.Methods.GET&&n.isValidQuery(s)?s:o;if(!a||"object"!=typeof a)return"string"==typeof a?a:"";if(a instanceof URLSearchParams)return a.toString();const c=n.stripUnsafeKeys(a);return e.Serialize.queryString.stringify(c,{skipNull:!0,skipEmptyString:!0})}static normalizeURL(r){const{url:i="",params:s={}}=r,o=n.normalizeQuery(r);let a;if(i){if(i.startsWith("//"))throw new Error(`Http: protocol-relative URLs are not allowed: ${i}`);if(/^[a-z][a-z0-9+.-]*:/i.test(i)){let e;try{e=new URL(i)}catch(e){throw new Error(`Http: invalid absolute URL: ${i}`)}if("http:"!==e.protocol&&"https:"!==e.protocol)throw new Error(`Http: unsupported URL scheme: ${e.protocol}`);if(!n.isAllowedOrigin(e.origin))throw new Error(`Http: URL origin '${e.origin}' is not in allowedOrigins`);a=e.toString()}else{const e=(r.url||"/").replace(/\/+$/,""),t=i.replace(/^\/+/,"");a=e?`${e}/${t}`:`/${t}`}}else a=r.url||"/";if(o){const e=a.includes("?")?"&":"?";a+=`${e}${o}`}if(!a.includes("{")||!a.includes("}"))return a;const c=Array.isArray(s)?s:n.stripUnsafeKeys(s);return a.replace(/\{([a-zA-Z0-9_.-]+)\}/g,(r,i)=>{const s=t.get(c,i);return null==s||"object"==typeof s?"":e.Serialize.URL.encode(String(s))})}static normalizeHeaders(e={},t){return t&&"Content-Type"in e?delete e["Content-Type"]:e["Content-Type"]=e["Content-Type"]||"application/json",Object.assign(Object.assign({},this.defaultHeaders),e)}static removeURL(e){return Object.entries(e).reduce((e,[t,r])=>("url"!==t&&(e[t]=r),e),{})}static extractFetchOptions(e){const t={};for(const r of Object.keys(e))o.has(r)&&(t[r]=e[r]);return t}static normalizeBody(e){const{method:t,body:s}=e;if(t!==r.Methods.GET&&t!==r.Methods.HEAD&&t!==r.Methods.OPTIONS)return t!==r.Methods.POST&&t!==r.Methods.PUT&&t!==r.Methods.PATCH&&t!==r.Methods.DELETE||!i.isFormData(s)?s instanceof URLSearchParams||s instanceof Uint8Array||s instanceof ArrayBuffer?s:void 0!==s?JSON.stringify(s):void 0:s}static safeOrigin(e){try{return new URL(e).origin}catch(e){return null}}static assertSameOriginResponse(e,t,r){const i=Object.keys(r).some(e=>"authorization"===e.toLowerCase()&&!!r[e]),s=Object.keys(r).some(e=>"cookie"===e.toLowerCase()&&!!r[e]);if(!i&&!s)return;const o=n.safeOrigin(e);if(!o)return;const a=t.url?n.safeOrigin(t.url):null;if(a&&a!==o&&!this.isAllowedOrigin(a))throw new Error(`Http: credentialed request was redirected from ${o} to untrusted origin ${a}`)}}n.AllowedOrigins=new Set,n.defaultHeaders={"Content-Type":"application/json"},exports.HttpUtils=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Serialize as e}from"../serialize.mjs";import{get as t}from"../utilities/get.mjs";import{Methods as r}from"./method.mjs";import{isFormData as i}from"../utilities/formdata.mjs";const o=new Set(["__proto__","constructor","prototype"]),n=new Set(["credentials","cache","mode","redirect","referrer","referrerPolicy","integrity","keepalive","priority","duplex","window","next","cf","dispatcher"]);class s{static isAllowedOrigin(e){return 0===this.AllowedOrigins.size||this.AllowedOrigins.has(e)}static isValidQuery(t){return"string"==typeof t||t instanceof URLSearchParams||(Array.isArray(t)?t.every(t=>Array.isArray(t)&&2===t.length&&"string"==typeof t[0]&&e.Primitive.isPrimitive(t[1])):"object"==typeof t&&null!==t&&Object.values(t).every(t=>e.Primitive.isPrimitive(t)))}static stripUnsafeKeys(e){const t=Object.create(null);for(const r of Object.keys(e))o.has(r)||(t[r]=e[r]);return t}static normalizeQuery(t){const{method:i,body:o,query:n}=t,a=i===r.GET&&s.isValidQuery(o)?o:n;if(!a||"object"!=typeof a)return"string"==typeof a?a:"";if(a instanceof URLSearchParams)return a.toString();const c=s.stripUnsafeKeys(a);return e.queryString.stringify(c,{skipNull:!0,skipEmptyString:!0})}static normalizeURL(r){const{url:i="",params:o={}}=r,n=s.normalizeQuery(r);let a;if(i){if(i.startsWith("//"))throw new Error(`Http: protocol-relative URLs are not allowed: ${i}`);if(/^[a-z][a-z0-9+.-]*:/i.test(i)){let e;try{e=new URL(i)}catch(e){throw new Error(`Http: invalid absolute URL: ${i}`)}if("http:"!==e.protocol&&"https:"!==e.protocol)throw new Error(`Http: unsupported URL scheme: ${e.protocol}`);if(!s.isAllowedOrigin(e.origin))throw new Error(`Http: URL origin '${e.origin}' is not in allowedOrigins`);a=e.toString()}else{const e=(r.url||"/").replace(/\/+$/,""),t=i.replace(/^\/+/,"");a=e?`${e}/${t}`:`/${t}`}}else a=r.url||"/";if(n){const e=a.includes("?")?"&":"?";a+=`${e}${n}`}if(!a.includes("{")||!a.includes("}"))return a;const c=Array.isArray(o)?o:s.stripUnsafeKeys(o);return a.replace(/\{([a-zA-Z0-9_.-]+)\}/g,(r,i)=>{const o=t(c,i);return null==o||"object"==typeof o?"":e.URL.encode(String(o))})}static normalizeHeaders(e={},t){return t&&"Content-Type"in e?delete e["Content-Type"]:e["Content-Type"]=e["Content-Type"]||"application/json",Object.assign(Object.assign({},this.defaultHeaders),e)}static removeURL(e){return Object.entries(e).reduce((e,[t,r])=>("url"!==t&&(e[t]=r),e),{})}static extractFetchOptions(e){const t={};for(const r of Object.keys(e))n.has(r)&&(t[r]=e[r]);return t}static normalizeBody(e){const{method:t,body:o}=e;if(t!==r.GET&&t!==r.HEAD&&t!==r.OPTIONS)return t!==r.POST&&t!==r.PUT&&t!==r.PATCH&&t!==r.DELETE||!i(o)?o instanceof URLSearchParams||o instanceof Uint8Array||o instanceof ArrayBuffer?o:void 0!==o?JSON.stringify(o):void 0:o}static safeOrigin(e){try{return new URL(e).origin}catch(e){return null}}static assertSameOriginResponse(e,t,r){const i=Object.keys(r).some(e=>"authorization"===e.toLowerCase()&&!!r[e]),o=Object.keys(r).some(e=>"cookie"===e.toLowerCase()&&!!r[e]);if(!i&&!o)return;const n=s.safeOrigin(e);if(!n)return;const a=t.url?s.safeOrigin(t.url):null;if(a&&a!==n&&!this.isAllowedOrigin(a))throw new Error(`Http: credentialed request was redirected from ${n} to untrusted origin ${a}`)}}s.AllowedOrigins=new Set,s.defaultHeaders={"Content-Type":"application/json"};export{s as HttpUtils};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type FileListLike } from "../utilities/filelist";
|
|
2
|
+
import type { HttpInit } from "./init";
|
|
3
|
+
import type { HttpResponse } from "./response";
|
|
4
|
+
import type { HttpRequest } from "./request";
|
|
5
|
+
export interface HttpProgress {
|
|
6
|
+
loaded: number;
|
|
7
|
+
total: number;
|
|
8
|
+
percentage: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HttpUploadOptions extends Pick<HttpRequest, "headers" | "params" | "signal" | "query"> {
|
|
11
|
+
onProgress?: (progress: HttpProgress) => void;
|
|
12
|
+
name?: string;
|
|
13
|
+
body?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface HttpRelatedOptions extends Pick<HttpRequest, "headers" | "params" | "signal" | "query"> {
|
|
16
|
+
metadata: Record<string, unknown>;
|
|
17
|
+
metadataMimeType?: string;
|
|
18
|
+
contentType: string;
|
|
19
|
+
}
|
|
20
|
+
import { HttpCore } from "./http-core";
|
|
21
|
+
export declare abstract class HttpXML extends HttpCore {
|
|
22
|
+
static upload<DataType = unknown, Err = unknown>(url: string, file: File | File[] | FileListLike, options?: HttpUploadOptions & Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
23
|
+
static related<DataType = unknown, Err = unknown>(url: string, fileData: ArrayBuffer | Uint8Array, options: HttpRelatedOptions & Omit<HttpInit, "url" | "method" | "body">): Promise<HttpResponse<DataType, Err>>;
|
|
24
|
+
}
|
package/dist/http/xml.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../node_modules/tslib/tslib.es6.js"),t=require("../utilities/formdata.js"),s=require("../utilities/flatten.js"),r=require("../utilities/filelist.js"),n=require("../utilities/sanitize-mime.js"),a=require("./array.js"),o=require("./init.js"),i=require("./method.js"),l=require("./utils.js"),d=require("./http-core.js");class u extends d.HttpCore{static upload(n,d,u){const c=(null==u?void 0:u.body)?t.objectToFormData(u.body):new FormData;let p=(null==u?void 0:u.name)||"file";if(Array.isArray(d)?(p.endsWith("[]")&&(p=p.slice(0,-2)),d.forEach((e,t)=>{c.append(`${p}[${t}]`,e,e.name)})):r.isFileList(d)?(p.endsWith("[]")&&(p=p.slice(0,-2)),Array.from(d).forEach((e,t)=>{c.append(`${p}[${t}]`,e,e.name)})):c.append(p,d,d.name),null==u?void 0:u.body){const e=s.flatten(u.body);Object.entries(e).forEach(([e,t])=>{null!=t&&c.append(e,String(t))})}return(null==u?void 0:u.onProgress)&&"undefined"!=typeof XMLHttpRequest?new Promise(async t=>{var s;try{const r=Object.assign(Object.assign({},u),{method:i.Methods.POST,url:n,body:c}),d=o.getHttpInitSlice(r),{interceptors:p}=d,h=e.__rest(d,["interceptors"]);let y=Object.assign({},h);const f=a.asArray(null!==(s=null==p?void 0:p.request)&&void 0!==s?s:[]);for(const e of f)y=await e(y);const m=l.HttpUtils.normalizeURL(y),T=l.HttpUtils.normalizeHeaders(y.headers||{},!0),b=new XMLHttpRequest;b.upload.addEventListener("progress",e=>{var t;if(e.lengthComputable){const s=Math.round(e.loaded/e.total*100);null===(t=u.onProgress)||void 0===t||t.call(u,{loaded:e.loaded,total:e.total,percentage:s})}}),b.addEventListener("load",async()=>{var e,s,r;try{const n=b.getResponseHeader("Content-Type")||"";let o=null;o=n.includes("application/json")?JSON.parse(b.responseText):b.responseText;const i=a.asArray(null!==(e=null==p?void 0:p.transform)&&void 0!==e?e:[]);let l=o;for(const e of i)l=await e(l);const d=a.asArray(null!==(s=null==p?void 0:p.response)&&void 0!==s?s:[]);let u=new Response(b.responseText,{status:b.status,statusText:b.statusText});for(const e of d)u=await e(u);const c={};u.headers.forEach((e,t)=>{c[t]=e});const h=u.ok||b.status>=200&&b.status<300;let y=null;if(!h){y=o.error||o;const e=a.asArray(null!==(r=null==p?void 0:p.error)&&void 0!==r?r:[]);for(const t of e)y=await t(y)}t({data:l,success:h,error:h?null:y,status:u.status,statusText:u.statusText,headers:c})}catch(e){t({data:null,success:!1,status:b.status,statusText:b.statusText,headers:{},error:e})}}),b.addEventListener("error",()=>{t({data:null,success:!1,status:b.status,statusText:b.statusText||"Network Error",headers:{},error:new Error("Network Error")})}),b.open(y.method||i.Methods.POST,m,!0),Object.entries(T).forEach(([e,t])=>{b.setRequestHeader(e,t)}),b.send(c)}catch(e){t({data:null,success:!1,status:0,statusText:"Error",headers:{},error:e})}}):this.request(Object.assign(Object.assign({},u),{method:i.Methods.POST,url:n,body:c}))}static related(e,t,s){const r=n.sanitizeMime(s.contentType),a=n.sanitizeMime(s.metadataMimeType||"application/json"),o=`----related-boundary-${Date.now()}-${Math.random().toString(36).slice(2)}`,l=JSON.stringify(s.metadata),d=new TextEncoder,u=d.encode(`--${o}\r\nContent-Type: ${a}; charset=UTF-8\r\n\r\n`+l+"\r\n"),c=d.encode(`--${o}\r\nContent-Type: ${r}\r\nContent-Transfer-Encoding: binary\r\n\r\n`),p=d.encode(`\r\n--${o}--`),h=t instanceof Uint8Array?t:new Uint8Array(t),y=new Uint8Array(u.length+c.length+h.length+p.length);return[u,c,h,p].reduce((e,t)=>(y.set(t,e),e+t.length),0),this.request(Object.assign(Object.assign({},s),{method:i.Methods.POST,url:e,body:y,headers:Object.assign(Object.assign({},s.headers||{}),{"Content-Type":`multipart/related; boundary=${o}`})}))}}exports.HttpXML=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as t}from"../node_modules/tslib/tslib.es6.mjs";import{objectToFormData as e}from"../utilities/formdata.mjs";import{flatten as s}from"../utilities/flatten.mjs";import{isFileList as r}from"../utilities/filelist.mjs";import{sanitizeMime as n}from"../utilities/sanitize-mime.mjs";import{asArray as o}from"./array.mjs";import{getHttpInitSlice as a}from"./init.mjs";import{Methods as i}from"./method.mjs";import{HttpUtils as l}from"./utils.mjs";import{HttpCore as d}from"./http-core.mjs";class u extends d{static upload(n,d,u){const c=(null==u?void 0:u.body)?e(u.body):new FormData;let m=(null==u?void 0:u.name)||"file";if(Array.isArray(d)?(m.endsWith("[]")&&(m=m.slice(0,-2)),d.forEach((t,e)=>{c.append(`${m}[${e}]`,t,t.name)})):r(d)?(m.endsWith("[]")&&(m=m.slice(0,-2)),Array.from(d).forEach((t,e)=>{c.append(`${m}[${e}]`,t,t.name)})):c.append(m,d,d.name),null==u?void 0:u.body){const t=s(u.body);Object.entries(t).forEach(([t,e])=>{null!=e&&c.append(t,String(e))})}return(null==u?void 0:u.onProgress)&&"undefined"!=typeof XMLHttpRequest?new Promise(async e=>{var s;try{const r=Object.assign(Object.assign({},u),{method:i.POST,url:n,body:c}),d=a(r),{interceptors:m}=d,p=t(d,["interceptors"]);let f=Object.assign({},p);const h=o(null!==(s=null==m?void 0:m.request)&&void 0!==s?s:[]);for(const t of h)f=await t(f);const y=l.normalizeURL(f),T=l.normalizeHeaders(f.headers||{},!0),b=new XMLHttpRequest;b.upload.addEventListener("progress",t=>{var e;if(t.lengthComputable){const s=Math.round(t.loaded/t.total*100);null===(e=u.onProgress)||void 0===e||e.call(u,{loaded:t.loaded,total:t.total,percentage:s})}}),b.addEventListener("load",async()=>{var t,s,r;try{const n=b.getResponseHeader("Content-Type")||"";let a=null;a=n.includes("application/json")?JSON.parse(b.responseText):b.responseText;const i=o(null!==(t=null==m?void 0:m.transform)&&void 0!==t?t:[]);let l=a;for(const t of i)l=await t(l);const d=o(null!==(s=null==m?void 0:m.response)&&void 0!==s?s:[]);let u=new Response(b.responseText,{status:b.status,statusText:b.statusText});for(const t of d)u=await t(u);const c={};u.headers.forEach((t,e)=>{c[e]=t});const p=u.ok||b.status>=200&&b.status<300;let f=null;if(!p){f=a.error||a;const t=o(null!==(r=null==m?void 0:m.error)&&void 0!==r?r:[]);for(const e of t)f=await e(f)}e({data:l,success:p,error:p?null:f,status:u.status,statusText:u.statusText,headers:c})}catch(t){e({data:null,success:!1,status:b.status,statusText:b.statusText,headers:{},error:t})}}),b.addEventListener("error",()=>{e({data:null,success:!1,status:b.status,statusText:b.statusText||"Network Error",headers:{},error:new Error("Network Error")})}),b.open(f.method||i.POST,y,!0),Object.entries(T).forEach(([t,e])=>{b.setRequestHeader(t,e)}),b.send(c)}catch(t){e({data:null,success:!1,status:0,statusText:"Error",headers:{},error:t})}}):this.request(Object.assign(Object.assign({},u),{method:i.POST,url:n,body:c}))}static related(t,e,s){const r=n(s.contentType),o=n(s.metadataMimeType||"application/json"),a=`----related-boundary-${Date.now()}-${Math.random().toString(36).slice(2)}`,l=JSON.stringify(s.metadata),d=new TextEncoder,u=d.encode(`--${a}\r\nContent-Type: ${o}; charset=UTF-8\r\n\r\n`+l+"\r\n"),c=d.encode(`--${a}\r\nContent-Type: ${r}\r\nContent-Transfer-Encoding: binary\r\n\r\n`),m=d.encode(`\r\n--${a}--`),p=e instanceof Uint8Array?e:new Uint8Array(e),f=new Uint8Array(u.length+c.length+p.length+m.length);return[u,c,p,m].reduce((t,e)=>(f.set(e,t),t+e.length),0),this.request(Object.assign(Object.assign({},s),{method:i.POST,url:t,body:f,headers:Object.assign(Object.assign({},s.headers||{}),{"Content-Type":`multipart/related; boundary=${a}`})}))}}export{u as HttpXML};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./env.js"),t=require("./http.js"),r=require("./logger.js");require("./searchify.js");var
|
|
1
|
+
"use strict";var e=require("./env.js"),t=require("./http/array.js"),r=require("./http/client.js"),i=require("./http/endpoint.js"),s=require("./http/fetcher.js"),p=require("./http/http-static.js"),o=require("./http/http.js"),u=require("./http/init.js"),l=require("./http/method.js"),a=require("./http/plugins/logger.js"),x=require("./http/plugins/dedupe.js"),c=require("./http/plugins/cache.js"),n=require("./http/utils.js"),j=require("./http/xml.js"),g=require("./http/http-core.js"),q=require("./logger.js");require("./searchify.js");var h=require("./serialize.js"),b=require("./slugify.js"),f=require("./subscriber.js"),d=require("./utilities/clone.js"),m=require("./utilities/defer.js"),E=require("./utilities/filelist.js"),y=require("./utilities/flatten.js"),F=require("./utilities/freeze.js"),H=require("./utilities/get.js"),M=require("./utilities/is-equal.js"),O=require("./utilities/is-function.js"),S=require("./utilities/object.js"),A=require("./utilities/merge.js"),L=require("./utilities/formdata.js"),R=require("./utilities/sanitize-mime.js"),T=require("./utilities/string.js");exports.getEnv=e.getEnv,exports.asArray=t.asArray,exports.createClient=r.createClient,exports.Endpoint=i.Endpoint,exports.Fetcher=s.Fetcher,exports.HttpStatic=p.HttpStatic,exports.Http=o.Http,exports.getHttpInitSlice=u.getHttpInitSlice,exports.Methods=l.Methods,exports.Uploads=l.Uploads,exports.loggerPlugin=a.loggerPlugin,exports.dedupePlugin=x.dedupePlugin,exports.cachePlugin=c.cachePlugin,exports.HttpUtils=n.HttpUtils,exports.HttpXML=j.HttpXML,exports.HttpCore=g.HttpCore,exports.Logger=q.Logger,exports.Serialize=h.Serialize,exports.DEFAULT_TRANSFORMER=b.DEFAULT_TRANSFORMER,exports.slugify=b.slugify,exports.Subscriber=f.Subscriber,exports.clone=d.clone,exports.defer=m.defer,exports.deferAsync=m.deferAsync,exports.isFileList=E.isFileList,exports.escapeRegexKey=y.escapeRegexKey,exports.flatten=y.flatten,exports.flattenToArray=y.flattenToArray,exports.freeze=F.freeze,exports.get=H.get,exports.isEqual=M.isEqual,exports.isFunction=O.isFunction,exports.hasOwnProperty=S.hasOwnProperty,exports.isComplexObject=S.isComplexObject,exports.isLiteralObject=S.isLiteralObject,exports.isObject=S.isObject,exports.isObjectable=S.isObjectable,exports.merge=A.merge,exports.isFormData=L.isFormData,exports.objectToFormData=L.objectToFormData,exports.MIME_REGEX=R.MIME_REGEX,exports.sanitizeMime=R.sanitizeMime,exports.pascalToKebab=T.pascalToKebab,exports.toString=T.toString,exports.ucfirst=T.ucfirst;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getEnv}from"./env.mjs";export{
|
|
1
|
+
export{getEnv}from"./env.mjs";export{asArray}from"./http/array.mjs";export{createClient}from"./http/client.mjs";export{Endpoint}from"./http/endpoint.mjs";export{Fetcher}from"./http/fetcher.mjs";export{HttpStatic}from"./http/http-static.mjs";export{Http}from"./http/http.mjs";export{getHttpInitSlice}from"./http/init.mjs";export{Methods,Uploads}from"./http/method.mjs";export{loggerPlugin}from"./http/plugins/logger.mjs";export{dedupePlugin}from"./http/plugins/dedupe.mjs";export{cachePlugin}from"./http/plugins/cache.mjs";export{HttpUtils}from"./http/utils.mjs";export{HttpXML}from"./http/xml.mjs";export{HttpCore}from"./http/http-core.mjs";export{Logger}from"./logger.mjs";import"./searchify.mjs";export{Serialize}from"./serialize.mjs";export{DEFAULT_TRANSFORMER,slugify}from"./slugify.mjs";export{Subscriber}from"./subscriber.mjs";export{clone}from"./utilities/clone.mjs";export{defer,deferAsync}from"./utilities/defer.mjs";export{isFileList}from"./utilities/filelist.mjs";export{escapeRegexKey,flatten,flattenToArray}from"./utilities/flatten.mjs";export{freeze}from"./utilities/freeze.mjs";export{get}from"./utilities/get.mjs";export{isEqual}from"./utilities/is-equal.mjs";export{isFunction}from"./utilities/is-function.mjs";export{hasOwnProperty,isComplexObject,isLiteralObject,isObject,isObjectable}from"./utilities/object.mjs";export{merge}from"./utilities/merge.mjs";export{isFormData,objectToFormData}from"./utilities/formdata.mjs";export{MIME_REGEX,sanitizeMime}from"./utilities/sanitize-mime.mjs";export{pascalToKebab,toString,ucfirst}from"./utilities/string.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"function"==typeof SuppressedError&&SuppressedError,exports.__rest=function(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]])}return t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]])}return t}"function"==typeof SuppressedError&&SuppressedError;export{r as __rest};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecosy/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A modular, tree-shakable collection of essential utilities, serialization primitives, and event-driven patterns for modern TypeScript applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/index.js",
|
|
11
11
|
"module": "./dist/index.mjs",
|
|
12
|
+
"unpkg": "./dist/ecosy-core.umd.js",
|
|
12
13
|
"types": "./dist/index.d.ts",
|
|
13
14
|
"files": [
|
|
14
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"agents"
|
|
15
17
|
],
|
|
16
18
|
"exports": {
|
|
17
19
|
".": {
|
|
@@ -39,10 +41,16 @@
|
|
|
39
41
|
"require": "./dist/subscriber.js"
|
|
40
42
|
},
|
|
41
43
|
"./http": {
|
|
42
|
-
"source": "./src/http.ts",
|
|
43
|
-
"types": "./dist/http.d.ts",
|
|
44
|
-
"import": "./dist/http.mjs",
|
|
45
|
-
"require": "./dist/http.js"
|
|
44
|
+
"source": "./src/http/index.ts",
|
|
45
|
+
"types": "./dist/http/index.d.ts",
|
|
46
|
+
"import": "./dist/http/index.mjs",
|
|
47
|
+
"require": "./dist/http/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./http/plugins": {
|
|
50
|
+
"source": "./src/http/plugins/index.ts",
|
|
51
|
+
"types": "./dist/http/plugins/index.d.ts",
|
|
52
|
+
"import": "./dist/http/plugins/index.mjs",
|
|
53
|
+
"require": "./dist/http/plugins/index.js"
|
|
46
54
|
},
|
|
47
55
|
"./logger": {
|
|
48
56
|
"source": "./src/logger.ts",
|
|
@@ -106,17 +114,24 @@
|
|
|
106
114
|
"@eslint/js": "^10.0.1",
|
|
107
115
|
"@rollup/plugin-terser": "^1.0.0",
|
|
108
116
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
109
|
-
"@types/node": "^
|
|
110
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
111
|
-
"@typescript-eslint/parser": "^8.
|
|
112
|
-
"eslint": "^10.
|
|
117
|
+
"@types/node": "^26.2.0",
|
|
118
|
+
"@typescript-eslint/eslint-plugin": "^8.67.0",
|
|
119
|
+
"@typescript-eslint/parser": "^8.67.0",
|
|
120
|
+
"eslint": "^10.9.0",
|
|
113
121
|
"eslint-config-prettier": "^10.1.8",
|
|
114
|
-
"eslint-plugin-prettier": "^5.5.
|
|
122
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
115
123
|
"glob": "^13.0.6",
|
|
116
|
-
"prettier": "^3.
|
|
124
|
+
"prettier": "^3.9.6",
|
|
117
125
|
"rimraf": "^6.1.3",
|
|
118
|
-
"rollup": "^4.
|
|
126
|
+
"rollup": "^4.62.5",
|
|
119
127
|
"tslib": "^2.8.1",
|
|
120
|
-
"typescript": "
|
|
128
|
+
"typescript": "6"
|
|
129
|
+
},
|
|
130
|
+
"agents": {
|
|
131
|
+
"skills": [
|
|
132
|
+
"$this://agents/skills/ecosy-core-fetcher/SKILL.md",
|
|
133
|
+
"$this://agents/skills/ecosy-core-subscriber/SKILL.md",
|
|
134
|
+
"$this://agents/skills/ecosy-core-serialize/SKILL.md"
|
|
135
|
+
]
|
|
121
136
|
}
|
|
122
137
|
}
|