@alessiofrittoli/fetcher 0.1.0-alpha.1 → 1.1.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/dist/error.d.mts CHANGED
@@ -1,11 +1,20 @@
1
- import { ErrorCode as ErrorCode$1 } from '@alessiofrittoli/exception/code';
2
-
3
1
  declare enum Request {
4
2
  XHR_NOT_AVAILABLE = "ERR:XHRNOTAVAILABLE",
5
3
  XHR_INVALID_STATE = "ERR:XHRINVALIDSTATE"
6
4
  }
7
5
  declare const ErrorCode: {
8
- Exception: typeof ErrorCode$1;
6
+ Exception: {
7
+ readonly UNKNOWN: "ERR:UNKNOWN";
8
+ readonly ABORT: "ERR:ABORT";
9
+ readonly EMPTY_VALUE: "ERR:EMPTYVALUE";
10
+ readonly WRONG_VALUE: "ERR:WRONGVALUE";
11
+ readonly EXPIRED: "ERR:EXPIRED";
12
+ readonly TOO_EARLY: "ERR:TOOEARLY";
13
+ readonly TOO_MANY: "ERR:TOOMANY";
14
+ readonly QUOTA_REACHED: "ERR:QUOTAREACHED";
15
+ readonly NOT_FOUND: "ERR:NOTFOUND";
16
+ readonly OFFLINE: "ERR:INTERNETDISCONNECTED";
17
+ };
9
18
  Request: typeof Request;
10
19
  };
11
20
  type ErrorCode = MergedEnumValue<typeof ErrorCode>;
package/dist/error.d.ts CHANGED
@@ -1,11 +1,20 @@
1
- import { ErrorCode as ErrorCode$1 } from '@alessiofrittoli/exception/code';
2
-
3
1
  declare enum Request {
4
2
  XHR_NOT_AVAILABLE = "ERR:XHRNOTAVAILABLE",
5
3
  XHR_INVALID_STATE = "ERR:XHRINVALIDSTATE"
6
4
  }
7
5
  declare const ErrorCode: {
8
- Exception: typeof ErrorCode$1;
6
+ Exception: {
7
+ readonly UNKNOWN: "ERR:UNKNOWN";
8
+ readonly ABORT: "ERR:ABORT";
9
+ readonly EMPTY_VALUE: "ERR:EMPTYVALUE";
10
+ readonly WRONG_VALUE: "ERR:WRONGVALUE";
11
+ readonly EXPIRED: "ERR:EXPIRED";
12
+ readonly TOO_EARLY: "ERR:TOOEARLY";
13
+ readonly TOO_MANY: "ERR:TOOMANY";
14
+ readonly QUOTA_REACHED: "ERR:QUOTAREACHED";
15
+ readonly NOT_FOUND: "ERR:NOTFOUND";
16
+ readonly OFFLINE: "ERR:INTERNETDISCONNECTED";
17
+ };
9
18
  Request: typeof Request;
10
19
  };
11
20
  type ErrorCode = MergedEnumValue<typeof ErrorCode>;
package/dist/fetch.d.mts CHANGED
@@ -1,11 +1,10 @@
1
1
  import { AbortSignal } from '@alessiofrittoli/abort-controller';
2
- import { F as Fetch } from './types-DuGUXaTD.mjs';
2
+ import { F as Fetch } from './types-DAKtp5Tp.mjs';
3
3
  import '@alessiofrittoli/event-emitter';
4
4
  import '@alessiofrittoli/exception';
5
5
  import '@alessiofrittoli/exception/abort';
6
6
  import '@alessiofrittoli/url-utils';
7
7
  import './error.mjs';
8
- import '@alessiofrittoli/exception/code';
9
8
 
10
9
  interface RequestInit extends globalThis.RequestInit {
11
10
  signal?: AbortSignal;
package/dist/fetch.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import { AbortSignal } from '@alessiofrittoli/abort-controller';
2
- import { F as Fetch } from './types-CVc-rxXe.js';
2
+ import { F as Fetch } from './types-B7TKkr2l.js';
3
3
  import '@alessiofrittoli/event-emitter';
4
4
  import '@alessiofrittoli/exception';
5
5
  import '@alessiofrittoli/exception/abort';
6
6
  import '@alessiofrittoli/url-utils';
7
7
  import './error.js';
8
- import '@alessiofrittoli/exception/code';
9
8
 
10
9
  interface RequestInit extends globalThis.RequestInit {
11
10
  signal?: AbortSignal;
@@ -0,0 +1,8 @@
1
+ import { UrlInput } from '@alessiofrittoli/url-utils';
2
+
3
+ /**
4
+ * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon)
5
+ */
6
+ declare const ping: (url: UrlInput, data?: BodyInit | null) => void;
7
+
8
+ export { ping };
package/dist/ping.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { UrlInput } from '@alessiofrittoli/url-utils';
2
+
3
+ /**
4
+ * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon)
5
+ */
6
+ declare const ping: (url: UrlInput, data?: BodyInit | null) => void;
7
+
8
+ export { ping };
package/dist/ping.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _urlutils = require('@alessiofrittoli/url-utils');var l=(n,t)=>{navigator.sendBeacon(_urlutils.Url.format(n),t)};exports.ping = l;
package/dist/ping.mjs ADDED
@@ -0,0 +1 @@
1
+ import{Url as o}from"@alessiofrittoli/url-utils";var a=(n,t)=>{navigator.sendBeacon(o.format(n),t)};export{a as ping};
@@ -15,7 +15,7 @@ declare class Xhr<TReturn = unknown> extends EventEmitter<XHR.Event.Map<TReturn>
15
15
  request: XMLHttpRequest;
16
16
  url: _alessiofrittoli_url_utils.UrlInput;
17
17
  method: RequestMethod;
18
- body: XMLHttpRequestBodyInit | Document | undefined;
18
+ body: Document | XMLHttpRequestBodyInit | undefined;
19
19
  headers: Headers;
20
20
  credentials: {
21
21
  username?: string | null;
@@ -15,7 +15,7 @@ declare class Xhr<TReturn = unknown> extends EventEmitter<XHR.Event.Map<TReturn>
15
15
  request: XMLHttpRequest;
16
16
  url: _alessiofrittoli_url_utils.UrlInput;
17
17
  method: RequestMethod;
18
- body: XMLHttpRequestBodyInit | Document | undefined;
18
+ body: Document | XMLHttpRequestBodyInit | undefined;
19
19
  headers: Headers;
20
20
  credentials: {
21
21
  username?: string | null;
package/dist/types.d.mts CHANGED
@@ -4,5 +4,4 @@ import '@alessiofrittoli/exception/abort';
4
4
  import '@alessiofrittoli/url-utils';
5
5
  import '@alessiofrittoli/abort-controller';
6
6
  import './error.mjs';
7
- export { F as Fetch, R as RequestMethod, a as XHR } from './types-DuGUXaTD.mjs';
8
- import '@alessiofrittoli/exception/code';
7
+ export { F as Fetch, R as RequestMethod, a as XHR } from './types-DAKtp5Tp.mjs';
package/dist/types.d.ts CHANGED
@@ -4,5 +4,4 @@ import '@alessiofrittoli/exception/abort';
4
4
  import '@alessiofrittoli/url-utils';
5
5
  import '@alessiofrittoli/abort-controller';
6
6
  import './error.js';
7
- export { F as Fetch, R as RequestMethod, a as XHR } from './types-CVc-rxXe.js';
8
- import '@alessiofrittoli/exception/code';
7
+ export { F as Fetch, R as RequestMethod, a as XHR } from './types-B7TKkr2l.js';
@@ -1,8 +1,7 @@
1
- export { X as Xhr } from '../types-DuGUXaTD.mjs';
1
+ export { X as Xhr } from '../types-DAKtp5Tp.mjs';
2
2
  import '@alessiofrittoli/url-utils';
3
3
  import '@alessiofrittoli/event-emitter';
4
4
  import '@alessiofrittoli/exception/abort';
5
5
  import '@alessiofrittoli/abort-controller';
6
6
  import '../error.mjs';
7
7
  import '@alessiofrittoli/exception';
8
- import '@alessiofrittoli/exception/code';
@@ -1,8 +1,7 @@
1
- export { X as Xhr } from '../types-CVc-rxXe.js';
1
+ export { X as Xhr } from '../types-B7TKkr2l.js';
2
2
  import '@alessiofrittoli/url-utils';
3
3
  import '@alessiofrittoli/event-emitter';
4
4
  import '@alessiofrittoli/exception/abort';
5
5
  import '@alessiofrittoli/abort-controller';
6
6
  import '../error.js';
7
7
  import '@alessiofrittoli/exception';
8
- import '@alessiofrittoli/exception/code';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alessiofrittoli/fetcher",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "1.1.0",
4
4
  "description": "Typescript fetch/xhr utilities",
5
5
  "author": {
6
6
  "name": "Alessio Frittoli",
@@ -16,7 +16,8 @@
16
16
  ],
17
17
  "keywords": [
18
18
  "fetch",
19
- "ajax"
19
+ "ajax",
20
+ "ping"
20
21
  ],
21
22
  "homepage": "https://github.com/alessiofrittoli/fetcher#readme",
22
23
  "bugs": {
@@ -36,27 +37,62 @@
36
37
  ],
37
38
  "exports": {
38
39
  ".": {
39
- "types": "./dist/index.d.ts",
40
- "import": "./dist/index.mjs",
41
- "require": "./dist/index.js"
40
+ "import": {
41
+ "types": "./dist/index.d.mts",
42
+ "default": "./dist/index.mjs"
43
+ },
44
+ "require": {
45
+ "types": "./dist/index.d.ts",
46
+ "default": "./dist/index.js"
47
+ }
42
48
  },
43
49
  "./fetch": {
44
- "types": "./dist/fetch.d.ts",
45
- "import": "./dist/fetch.mjs",
46
- "require": "./dist/fetch.js"
50
+ "import": {
51
+ "types": "./dist/fetch.d.mts",
52
+ "default": "./dist/fetch.mjs"
53
+ },
54
+ "require": {
55
+ "types": "./dist/fetch.d.ts",
56
+ "default": "./dist/fetch.js"
57
+ }
58
+ },
59
+ "./ping": {
60
+ "import": {
61
+ "types": "./dist/ping.d.mts",
62
+ "default": "./dist/ping.mjs"
63
+ },
64
+ "require": {
65
+ "types": "./dist/ping.d.ts",
66
+ "default": "./dist/ping.js"
67
+ }
47
68
  },
48
69
  "./xhr": {
49
- "types": "./dist/xhr/index.d.ts",
50
- "import": "./dist/xhr/index.mjs",
51
- "require": "./dist/xhr/index.js"
70
+ "import": {
71
+ "types": "./dist/xhr/index.d.mts",
72
+ "default": "./dist/xhr/index.mjs"
73
+ },
74
+ "require": {
75
+ "types": "./dist/xhr/index.d.ts",
76
+ "default": "./dist/xhr/index.js"
77
+ }
52
78
  },
53
79
  "./error": {
54
- "types": "./dist/error.d.ts",
55
- "import": "./dist/error.mjs",
56
- "require": "./dist/error.js"
80
+ "import": {
81
+ "types": "./dist/error.d.mts",
82
+ "default": "./dist/error.mjs"
83
+ },
84
+ "require": {
85
+ "types": "./dist/error.d.ts",
86
+ "default": "./dist/error.js"
87
+ }
57
88
  },
58
89
  "./types": {
59
- "types": "./dist/types.d.ts"
90
+ "import": {
91
+ "types": "./dist/types.d.mts"
92
+ },
93
+ "require": {
94
+ "types": "./dist/types.d.ts"
95
+ }
60
96
  }
61
97
  },
62
98
  "sideEffects": false,
@@ -64,11 +100,12 @@
64
100
  "//1a": "*********************************************************************",
65
101
  "//1b": "******************** DEV - BUILD - LINT - RELEASE *******************",
66
102
  "//1c": "*********************************************************************",
67
- "dev": "NODE_ENV=development tsup --watch",
68
- "build:prod": "NODE_ENV=production tsup",
103
+ "dev": "cross-env NODE_ENV=development tsup --watch",
104
+ "build:prod": "cross-env NODE_ENV=production tsup",
69
105
  "build": "pnpm lint && pnpm test:ci && pnpm build:prod",
70
106
  "lint": "eslint",
71
- "release": "node scripts/publish.js --verbose --npm",
107
+ "postinstall": "node scripts/postinstall/index.js",
108
+ "release": "node scripts/release.js --verbose --npm",
72
109
  "//2a": "*********************************************************************",
73
110
  "//2b": "***************************** UNIT TESTS ****************************",
74
111
  "//2c": "*********************************************************************",
@@ -88,38 +125,33 @@
88
125
  "test:fetch": "pnpm test:watch fetch.test.ts"
89
126
  },
90
127
  "devDependencies": {
91
- "@alessiofrittoli/crypto-buffer": "^3.6.0",
92
- "@eslint/js": "^9.27.0",
93
- "@jest/globals": "^29.7.0",
94
- "@types/jest": "^29.5.14",
95
- "@types/node": "^22.15.21",
96
- "concurrently": "^9.1.2",
97
- "dotenv": "^16.5.0",
98
- "eslint": "^9.27.0",
99
- "globals": "^16.1.0",
128
+ "@alessiofrittoli/crypto-buffer": "^3.11.0",
129
+ "@eslint/js": "^10.0.1",
130
+ "@jest/globals": "^30.2.0",
131
+ "@types/jest": "^30.0.0",
132
+ "@types/node": "^25.2.3",
133
+ "concurrently": "^9.2.1",
134
+ "cross-env": "^10.1.0",
135
+ "dotenv": "^17.3.1",
136
+ "eslint": "^10.0.0",
137
+ "globals": "^17.3.0",
100
138
  "http-server": "^14.1.1",
101
- "jest": "^29.7.0",
102
- "jest-environment-jsdom": "^29.7.0",
103
- "ts-jest": "^29.3.4",
139
+ "jest": "^30.2.0",
140
+ "jest-environment-jsdom": "^30.2.0",
141
+ "ts-jest": "^29.4.6",
104
142
  "ts-node": "^10.9.2",
105
- "tsup": "^8.5.0",
106
- "typescript": "^5.8.3",
107
- "typescript-eslint": "^8.32.1"
143
+ "tsup": "^8.5.1",
144
+ "typescript": "^5.9.3",
145
+ "typescript-eslint": "^8.55.0"
108
146
  },
109
147
  "dependencies": {
110
148
  "@alessiofrittoli/abort-controller": "^0.1.0",
111
- "@alessiofrittoli/chain-functions": "^2.3.0",
112
- "@alessiofrittoli/event-emitter": "^1.4.0",
113
- "@alessiofrittoli/exception": "^3.2.0",
114
- "@alessiofrittoli/node-scripts": "^2.6.0",
115
- "@alessiofrittoli/type-utils": "^1.8.0",
116
- "@alessiofrittoli/url-utils": "^3.4.0",
117
- "@alessiofrittoli/web-utils": "^1.11.0"
118
- },
119
- "pnpm": {
120
- "onlyBuiltDependencies": [
121
- "@alessiofrittoli/type-utils",
122
- "esbuild"
123
- ]
149
+ "@alessiofrittoli/chain-functions": "^2.5.0",
150
+ "@alessiofrittoli/event-emitter": "^1.6.0",
151
+ "@alessiofrittoli/exception": "^3.5.0",
152
+ "@alessiofrittoli/node-scripts": "^3.3.0",
153
+ "@alessiofrittoli/type-utils": "^1.9.0",
154
+ "@alessiofrittoli/url-utils": "^3.7.1",
155
+ "@alessiofrittoli/web-utils": "^1.20.0"
124
156
  }
125
157
  }