@ripwords/myinvois-client 0.0.2 → 0.0.3

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.
@@ -1,181 +0,0 @@
1
- "use strict";
2
- const require_node = require('./node-BMeCs5nV.js');
3
- const node_http = require_node.__toESM(require("node:http"));
4
- const node_https = require_node.__toESM(require("node:https"));
5
- const node_zlib = require_node.__toESM(require("node:zlib"));
6
- const node_stream = require_node.__toESM(require("node:stream"));
7
- const node_buffer = require_node.__toESM(require("node:buffer"));
8
- const node_util = require_node.__toESM(require("node:util"));
9
- const node_url = require_node.__toESM(require("node:url"));
10
- const node_net = require_node.__toESM(require("node:net"));
11
- const node_fs = require_node.__toESM(require("node:fs"));
12
- const node_path = require_node.__toESM(require("node:path"));
13
-
14
- //#region node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs
15
- var U = Object.defineProperty;
16
- var E = (_, o) => U(_, "name", {
17
- value: o,
18
- configurable: !0
19
- });
20
- let D = 0;
21
- const t = {
22
- START_BOUNDARY: D++,
23
- HEADER_FIELD_START: D++,
24
- HEADER_FIELD: D++,
25
- HEADER_VALUE_START: D++,
26
- HEADER_VALUE: D++,
27
- HEADER_VALUE_ALMOST_DONE: D++,
28
- HEADERS_ALMOST_DONE: D++,
29
- PART_DATA_START: D++,
30
- PART_DATA: D++,
31
- END: D++
32
- };
33
- let F = 1;
34
- const u = {
35
- PART_BOUNDARY: F,
36
- LAST_BOUNDARY: F *= 2
37
- }, g = 10, N = 13, V = 32, S = 45, Y = 58, x = 97, C = 122, I = E((_) => _ | 32, "lower"), p = E(() => {}, "noop");
38
- var M = class {
39
- static {
40
- E(this, "MultipartParser");
41
- }
42
- constructor(o) {
43
- this.index = 0, this.flags = 0, this.onHeaderEnd = p, this.onHeaderField = p, this.onHeadersEnd = p, this.onHeaderValue = p, this.onPartBegin = p, this.onPartData = p, this.onPartEnd = p, this.boundaryChars = {}, o = `\r
44
- --` + o;
45
- const n = new Uint8Array(o.length);
46
- for (let r = 0; r < o.length; r++) n[r] = o.charCodeAt(r), this.boundaryChars[n[r]] = !0;
47
- this.boundary = n, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = t.START_BOUNDARY;
48
- }
49
- write(o) {
50
- let n = 0;
51
- const r = o.length;
52
- let d = this.index, { lookbehind: l, boundary: c, boundaryChars: m, index: e, state: i, flags: A } = this;
53
- const H = this.boundary.length, O = H - 1, y = o.length;
54
- let a, L;
55
- const f = E((h) => {
56
- this[h + "Mark"] = n;
57
- }, "mark"), s = E((h) => {
58
- delete this[h + "Mark"];
59
- }, "clear"), T = E((h, P, R, k) => {
60
- (P === void 0 || P !== R) && this[h](k && k.subarray(P, R));
61
- }, "callback"), b = E((h, P) => {
62
- const R = h + "Mark";
63
- R in this && (P ? (T(h, this[R], n, o), delete this[R]) : (T(h, this[R], o.length, o), this[R] = 0));
64
- }, "dataCallback");
65
- for (n = 0; n < r; n++) switch (a = o[n], i) {
66
- case t.START_BOUNDARY:
67
- if (e === c.length - 2) {
68
- if (a === S) A |= u.LAST_BOUNDARY;
69
- else if (a !== N) return;
70
- e++;
71
- break;
72
- } else if (e - 1 === c.length - 2) {
73
- if (A & u.LAST_BOUNDARY && a === S) i = t.END, A = 0;
74
- else if (!(A & u.LAST_BOUNDARY) && a === g) e = 0, T("onPartBegin"), i = t.HEADER_FIELD_START;
75
- else return;
76
- break;
77
- }
78
- a !== c[e + 2] && (e = -2), a === c[e + 2] && e++;
79
- break;
80
- case t.HEADER_FIELD_START: i = t.HEADER_FIELD, f("onHeaderField"), e = 0;
81
- case t.HEADER_FIELD:
82
- if (a === N) {
83
- s("onHeaderField"), i = t.HEADERS_ALMOST_DONE;
84
- break;
85
- }
86
- if (e++, a === S) break;
87
- if (a === Y) {
88
- if (e === 1) return;
89
- b("onHeaderField", !0), i = t.HEADER_VALUE_START;
90
- break;
91
- }
92
- if (L = I(a), L < x || L > C) return;
93
- break;
94
- case t.HEADER_VALUE_START:
95
- if (a === V) break;
96
- f("onHeaderValue"), i = t.HEADER_VALUE;
97
- case t.HEADER_VALUE:
98
- a === N && (b("onHeaderValue", !0), T("onHeaderEnd"), i = t.HEADER_VALUE_ALMOST_DONE);
99
- break;
100
- case t.HEADER_VALUE_ALMOST_DONE:
101
- if (a !== g) return;
102
- i = t.HEADER_FIELD_START;
103
- break;
104
- case t.HEADERS_ALMOST_DONE:
105
- if (a !== g) return;
106
- T("onHeadersEnd"), i = t.PART_DATA_START;
107
- break;
108
- case t.PART_DATA_START: i = t.PART_DATA, f("onPartData");
109
- case t.PART_DATA:
110
- if (d = e, e === 0) {
111
- for (n += O; n < y && !(o[n] in m);) n += H;
112
- n -= O, a = o[n];
113
- }
114
- if (e < c.length) c[e] === a ? (e === 0 && b("onPartData", !0), e++) : e = 0;
115
- else if (e === c.length) e++, a === N ? A |= u.PART_BOUNDARY : a === S ? A |= u.LAST_BOUNDARY : e = 0;
116
- else if (e - 1 === c.length) if (A & u.PART_BOUNDARY) {
117
- if (e = 0, a === g) {
118
- A &= ~u.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), i = t.HEADER_FIELD_START;
119
- break;
120
- }
121
- } else A & u.LAST_BOUNDARY && a === S ? (T("onPartEnd"), i = t.END, A = 0) : e = 0;
122
- if (e > 0) l[e - 1] = a;
123
- else if (d > 0) {
124
- const h = new Uint8Array(l.buffer, l.byteOffset, l.byteLength);
125
- T("onPartData", 0, d, h), d = 0, f("onPartData"), n--;
126
- }
127
- break;
128
- case t.END: break;
129
- default: throw new Error(`Unexpected state entered: ${i}`);
130
- }
131
- b("onHeaderField"), b("onHeaderValue"), b("onPartData"), this.index = e, this.state = i, this.flags = A;
132
- }
133
- end() {
134
- if (this.state === t.HEADER_FIELD_START && this.index === 0 || this.state === t.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
135
- else if (this.state !== t.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
136
- }
137
- };
138
- function $(_) {
139
- const o = _.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
140
- if (!o) return;
141
- const n = o[2] || o[3] || "";
142
- let r = n.slice(n.lastIndexOf("\\") + 1);
143
- return r = r.replace(/%22/g, "\""), r = r.replace(/&#(\d{4});/g, (d, l) => String.fromCharCode(l)), r;
144
- }
145
- E($, "_fileName");
146
- async function v(_, o) {
147
- if (!/multipart/i.test(o)) throw new TypeError("Failed to fetch");
148
- const n = o.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
149
- if (!n) throw new TypeError("no or bad content-type header, no multipart boundary");
150
- const r = new M(n[1] || n[2]);
151
- let d, l, c, m, e, i;
152
- const A = [], H = new require_node.Zt(), O = E((s) => {
153
- c += f.decode(s, { stream: !0 });
154
- }, "onPartData"), y = E((s) => {
155
- A.push(s);
156
- }, "appendToFile"), a = E(() => {
157
- const s = new require_node.Yr(A, i, { type: e });
158
- H.append(m, s);
159
- }, "appendFileToFormData"), L = E(() => {
160
- H.append(m, c);
161
- }, "appendEntryToFormData"), f = new TextDecoder("utf-8");
162
- f.decode(), r.onPartBegin = function() {
163
- r.onPartData = O, r.onPartEnd = L, d = "", l = "", c = "", m = "", e = "", i = null, A.length = 0;
164
- }, r.onHeaderField = function(s) {
165
- d += f.decode(s, { stream: !0 });
166
- }, r.onHeaderValue = function(s) {
167
- l += f.decode(s, { stream: !0 });
168
- }, r.onHeaderEnd = function() {
169
- if (l += f.decode(), d = d.toLowerCase(), d === "content-disposition") {
170
- const s = l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
171
- s && (m = s[2] || s[3] || ""), i = $(l), i && (r.onPartData = y, r.onPartEnd = a);
172
- } else d === "content-type" && (e = l);
173
- l = "", d = "";
174
- };
175
- for await (const s of _) r.write(s);
176
- return r.end(), H;
177
- }
178
- E(v, "toFormData");
179
-
180
- //#endregion
181
- exports.toFormData = v