stacks 0.58.20 → 0.58.21

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.
Files changed (104) hide show
  1. package/core/src/actions/dist/src/generate/ide-helpers.js +1 -1
  2. package/core/src/actions/dist/src/generate/lib-entries.js +1 -1
  3. package/core/src/actions/dist/src/generate/vscode-custom-data.js +1 -1
  4. package/core/src/actions/dist/src/helpers/lib-entries.js +1 -1
  5. package/core/src/actions/dist/src/helpers/package-json.js +1 -1
  6. package/core/src/actions/dist/src/helpers/vscode-custom-data.js +1 -1
  7. package/core/src/actions/dist/src/upgrade.js +1 -1
  8. package/core/src/actions/package.json +1 -1
  9. package/core/src/ai/package.json +1 -1
  10. package/core/src/alias/package.json +1 -1
  11. package/core/src/analytics/package.json +1 -1
  12. package/core/src/api/package.json +1 -1
  13. package/core/src/arrays/package.json +1 -1
  14. package/core/src/auth/package.json +1 -1
  15. package/core/src/buddy/package.json +1 -1
  16. package/core/src/build/package.json +1 -1
  17. package/core/src/bun-create/bud/package.json +4 -3
  18. package/core/src/bun-create/buddy/package.json +4 -3
  19. package/core/src/bun-create/stack/package.json +4 -3
  20. package/core/src/bun-create/stacks/package.json +4 -3
  21. package/core/src/bun-create/stx/package.json +4 -3
  22. package/core/src/bun-plugin-yaml/dist/index.js +1 -1
  23. package/core/src/bun-plugin-yaml/package.json +1 -1
  24. package/core/src/cache/package.json +1 -1
  25. package/core/src/chat/package.json +1 -1
  26. package/core/src/cli/dist/index.js +1 -1
  27. package/core/src/cli/package.json +1 -1
  28. package/core/src/cloud/package.json +1 -1
  29. package/core/src/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +1 -1
  30. package/core/src/cloud/src/server/package.json +1 -1
  31. package/core/src/collections/package.json +1 -1
  32. package/core/src/config/dist/index.js +22 -22
  33. package/core/src/config/package.json +1 -1
  34. package/core/src/database/dist/index.js +1 -1
  35. package/core/src/database/package.json +1 -1
  36. package/core/src/datetime/package.json +1 -1
  37. package/core/src/desktop/dist/index.js +22 -22
  38. package/core/src/desktop/package.json +1 -1
  39. package/core/src/development/package.json +1 -1
  40. package/core/src/dns/package.json +1 -1
  41. package/core/src/docs/dist/index.js +5176 -170
  42. package/core/src/docs/package.json +1 -1
  43. package/core/src/email/package.json +1 -1
  44. package/core/src/enums/package.json +1 -1
  45. package/core/src/env/dist/index.js +4 -4
  46. package/core/src/env/package.json +1 -1
  47. package/core/src/error-handling/dist/index.js +1 -1
  48. package/core/src/error-handling/package.json +1 -1
  49. package/core/src/eslint-config/package.json +1 -1
  50. package/core/src/events/package.json +1 -1
  51. package/core/src/faker/package.json +1 -1
  52. package/core/src/git/package.json +1 -1
  53. package/core/src/health/package.json +1 -1
  54. package/core/src/http/package.json +1 -1
  55. package/core/src/lint/package.json +1 -1
  56. package/core/src/logging/dist/index.js +7 -7
  57. package/core/src/logging/package.json +1 -1
  58. package/core/src/music/package.json +1 -1
  59. package/core/src/notifications/package.json +1 -1
  60. package/core/src/objects/package.json +1 -1
  61. package/core/src/orm/package.json +1 -1
  62. package/core/src/path/package.json +1 -1
  63. package/core/src/payments/dist/index.js +144 -144
  64. package/core/src/payments/package.json +1 -1
  65. package/core/src/push/package.json +1 -1
  66. package/core/src/query-builder/package.json +1 -1
  67. package/core/src/queue/package.json +1 -1
  68. package/core/src/realtime/package.json +1 -1
  69. package/core/src/repl/package.json +1 -1
  70. package/core/src/router/dist/index.js +3 -3
  71. package/core/src/router/package.json +1 -1
  72. package/core/src/scheduler/package.json +1 -1
  73. package/core/src/search-engine/package.json +1 -1
  74. package/core/src/security/dist/index.js +11 -11
  75. package/core/src/security/package.json +1 -1
  76. package/core/src/server/package.json +1 -1
  77. package/core/src/signals/package.json +1 -1
  78. package/core/src/slug/package.json +1 -1
  79. package/core/src/sms/package.json +1 -1
  80. package/core/src/storage/dist/index.js +1 -1
  81. package/core/src/storage/package.json +1 -1
  82. package/core/src/strings/package.json +1 -1
  83. package/core/src/tables/package.json +2 -2
  84. package/core/src/testing/package.json +1 -1
  85. package/core/src/tinker/package.json +1 -1
  86. package/core/src/tunnel/package.json +1 -1
  87. package/core/src/types/dist/index.js +6 -6
  88. package/core/src/types/package.json +1 -1
  89. package/core/src/ui/package.json +1 -1
  90. package/core/src/utils/dist/index.js +4 -4
  91. package/core/src/utils/package.json +1 -1
  92. package/core/src/validation/package.json +1 -1
  93. package/core/src/vite/dist/index.js +2 -2
  94. package/core/src/vite/package.json +1 -1
  95. package/core/src/vite-plugin-vue-layouts/package.json +1 -1
  96. package/core/src/whois/package.json +1 -1
  97. package/core/src/x-ray/package.json +1 -1
  98. package/ide/vscode/package.json +1 -1
  99. package/package.json +1 -1
  100. package/core/.env +0 -38
  101. package/core/src/ai/dist/index.js +0 -10351
  102. package/core/src/api/dist/index.js +0 -636
  103. package/core/src/push/dist/index.js +0 -35
  104. package/core/src/sms/dist/index.js +0 -240
@@ -1,636 +0,0 @@
1
- // @bun
2
- // /Users/chrisbreuer/Code/stacks/node_modules/destr/dist/index.mjs
3
- var jsonParseTransform = function(key, value) {
4
- if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
5
- warnKeyDropped(key);
6
- return;
7
- }
8
- return value;
9
- };
10
- var warnKeyDropped = function(key) {
11
- console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
12
- };
13
- var destr = function(value, options = {}) {
14
- if (typeof value !== "string") {
15
- return value;
16
- }
17
- const _value = value.trim();
18
- if (value[0] === '"' && value.at(-1) === '"' && !value.includes("\\")) {
19
- return _value.slice(1, -1);
20
- }
21
- if (_value.length <= 9) {
22
- const _lval = _value.toLowerCase();
23
- if (_lval === "true") {
24
- return true;
25
- }
26
- if (_lval === "false") {
27
- return false;
28
- }
29
- if (_lval === "undefined") {
30
- return;
31
- }
32
- if (_lval === "null") {
33
- return null;
34
- }
35
- if (_lval === "nan") {
36
- return Number.NaN;
37
- }
38
- if (_lval === "infinity") {
39
- return Number.POSITIVE_INFINITY;
40
- }
41
- if (_lval === "-infinity") {
42
- return Number.NEGATIVE_INFINITY;
43
- }
44
- }
45
- if (!JsonSigRx.test(value)) {
46
- if (options.strict) {
47
- throw new SyntaxError("[destr] Invalid JSON");
48
- }
49
- return value;
50
- }
51
- try {
52
- if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
53
- if (options.strict) {
54
- throw new Error("[destr] Possible prototype pollution");
55
- }
56
- return JSON.parse(value, jsonParseTransform);
57
- }
58
- return JSON.parse(value);
59
- } catch (error) {
60
- if (options.strict) {
61
- throw error;
62
- }
63
- return value;
64
- }
65
- };
66
- var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
67
- var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
68
- var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
69
-
70
- // /Users/chrisbreuer/Code/stacks/node_modules/ufo/dist/index.mjs
71
- var encode = function(text) {
72
- return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
73
- };
74
- var encodeQueryValue = function(input) {
75
- return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^");
76
- };
77
- var encodeQueryKey = function(text) {
78
- return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
79
- };
80
- var decode = function(text = "") {
81
- try {
82
- return decodeURIComponent("" + text);
83
- } catch {
84
- return "" + text;
85
- }
86
- };
87
- var decodeQueryKey = function(text) {
88
- return decode(text.replace(PLUS_RE, " "));
89
- };
90
- var decodeQueryValue = function(text) {
91
- return decode(text.replace(PLUS_RE, " "));
92
- };
93
- var parseQuery = function(parametersString = "") {
94
- const object = {};
95
- if (parametersString[0] === "?") {
96
- parametersString = parametersString.slice(1);
97
- }
98
- for (const parameter of parametersString.split("&")) {
99
- const s = parameter.match(/([^=]+)=?(.*)/) || [];
100
- if (s.length < 2) {
101
- continue;
102
- }
103
- const key = decodeQueryKey(s[1]);
104
- if (key === "__proto__" || key === "constructor") {
105
- continue;
106
- }
107
- const value = decodeQueryValue(s[2] || "");
108
- if (object[key] === undefined) {
109
- object[key] = value;
110
- } else if (Array.isArray(object[key])) {
111
- object[key].push(value);
112
- } else {
113
- object[key] = [object[key], value];
114
- }
115
- }
116
- return object;
117
- };
118
- var encodeQueryItem = function(key, value) {
119
- if (typeof value === "number" || typeof value === "boolean") {
120
- value = String(value);
121
- }
122
- if (!value) {
123
- return encodeQueryKey(key);
124
- }
125
- if (Array.isArray(value)) {
126
- return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
127
- }
128
- return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
129
- };
130
- var stringifyQuery = function(query) {
131
- return Object.keys(query).filter((k) => query[k] !== undefined).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
132
- };
133
- var hasProtocol = function(inputString, opts = {}) {
134
- if (typeof opts === "boolean") {
135
- opts = { acceptRelative: opts };
136
- }
137
- if (opts.strict) {
138
- return PROTOCOL_STRICT_REGEX.test(inputString);
139
- }
140
- return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
141
- };
142
- var hasTrailingSlash = function(input = "", respectQueryAndFragment) {
143
- if (!respectQueryAndFragment) {
144
- return input.endsWith("/");
145
- }
146
- return TRAILING_SLASH_RE.test(input);
147
- };
148
- var withoutTrailingSlash = function(input = "", respectQueryAndFragment) {
149
- if (!respectQueryAndFragment) {
150
- return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
151
- }
152
- if (!hasTrailingSlash(input, true)) {
153
- return input || "/";
154
- }
155
- let path = input;
156
- let fragment = "";
157
- const fragmentIndex = input.indexOf("#");
158
- if (fragmentIndex >= 0) {
159
- path = input.slice(0, fragmentIndex);
160
- fragment = input.slice(fragmentIndex);
161
- }
162
- const [s0, ...s] = path.split("?");
163
- return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
164
- };
165
- var withTrailingSlash = function(input = "", respectQueryAndFragment) {
166
- if (!respectQueryAndFragment) {
167
- return input.endsWith("/") ? input : input + "/";
168
- }
169
- if (hasTrailingSlash(input, true)) {
170
- return input || "/";
171
- }
172
- let path = input;
173
- let fragment = "";
174
- const fragmentIndex = input.indexOf("#");
175
- if (fragmentIndex >= 0) {
176
- path = input.slice(0, fragmentIndex);
177
- fragment = input.slice(fragmentIndex);
178
- if (!path) {
179
- return fragment;
180
- }
181
- }
182
- const [s0, ...s] = path.split("?");
183
- return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
184
- };
185
- var withBase = function(input, base) {
186
- if (isEmptyURL(base) || hasProtocol(input)) {
187
- return input;
188
- }
189
- const _base = withoutTrailingSlash(base);
190
- if (input.startsWith(_base)) {
191
- return input;
192
- }
193
- return joinURL(_base, input);
194
- };
195
- var withQuery = function(input, query) {
196
- const parsed = parseURL(input);
197
- const mergedQuery = { ...parseQuery(parsed.search), ...query };
198
- parsed.search = stringifyQuery(mergedQuery);
199
- return stringifyParsedURL(parsed);
200
- };
201
- var isEmptyURL = function(url) {
202
- return !url || url === "/";
203
- };
204
- var isNonEmptyURL = function(url) {
205
- return url && url !== "/";
206
- };
207
- var joinURL = function(base, ...input) {
208
- let url = base || "";
209
- for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
210
- if (url) {
211
- const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
212
- url = withTrailingSlash(url) + _segment;
213
- } else {
214
- url = segment;
215
- }
216
- }
217
- return url;
218
- };
219
- var parseURL = function(input = "", defaultProto) {
220
- const _specialProtoMatch = input.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);
221
- if (_specialProtoMatch) {
222
- const [, _proto, _pathname = ""] = _specialProtoMatch;
223
- return {
224
- protocol: _proto.toLowerCase(),
225
- pathname: _pathname,
226
- href: _proto + _pathname,
227
- auth: "",
228
- host: "",
229
- search: "",
230
- hash: ""
231
- };
232
- }
233
- if (!hasProtocol(input, { acceptRelative: true })) {
234
- return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
235
- }
236
- const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
237
- const [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
238
- const { pathname, search, hash } = parsePath(path.replace(/\/(?=[A-Za-z]:)/, ""));
239
- return {
240
- protocol: protocol.toLowerCase(),
241
- auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
242
- host,
243
- pathname,
244
- search,
245
- hash
246
- };
247
- };
248
- var parsePath = function(input = "") {
249
- const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
250
- return {
251
- pathname,
252
- search,
253
- hash
254
- };
255
- };
256
- var stringifyParsedURL = function(parsed) {
257
- const pathname = parsed.pathname || "";
258
- const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
259
- const hash = parsed.hash || "";
260
- const auth = parsed.auth ? parsed.auth + "@" : "";
261
- const host = parsed.host || "";
262
- const proto = parsed.protocol ? parsed.protocol + "//" : "";
263
- return proto + auth + host + pathname + search + hash;
264
- };
265
- var r = String.fromCharCode;
266
- var HASH_RE = /#/g;
267
- var AMPERSAND_RE = /&/g;
268
- var EQUAL_RE = /=/g;
269
- var PLUS_RE = /\+/g;
270
- var ENC_CARET_RE = /%5e/gi;
271
- var ENC_BACKTICK_RE = /%60/gi;
272
- var ENC_PIPE_RE = /%7c/gi;
273
- var ENC_SPACE_RE = /%20/gi;
274
- var PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
275
- var PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
276
- var PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
277
- var TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
278
- var JOIN_LEADING_SLASH_RE = /^\.?\//;
279
-
280
- // /Users/chrisbreuer/Code/stacks/node_modules/ofetch/dist/shared/ofetch.00501375.mjs
281
- var createFetchError = function(ctx) {
282
- const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
283
- const method = ctx.request?.method || ctx.options?.method || "GET";
284
- const url = ctx.request?.url || String(ctx.request) || "/";
285
- const requestStr = `[${method}] ${JSON.stringify(url)}`;
286
- const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>";
287
- const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : ""}`;
288
- const fetchError = new FetchError(message, ctx.error ? { cause: ctx.error } : undefined);
289
- for (const key of ["request", "options", "response"]) {
290
- Object.defineProperty(fetchError, key, {
291
- get() {
292
- return ctx[key];
293
- }
294
- });
295
- }
296
- for (const [key, refKey] of [
297
- ["data", "_data"],
298
- ["status", "status"],
299
- ["statusCode", "status"],
300
- ["statusText", "statusText"],
301
- ["statusMessage", "statusText"]
302
- ]) {
303
- Object.defineProperty(fetchError, key, {
304
- get() {
305
- return ctx.response && ctx.response[refKey];
306
- }
307
- });
308
- }
309
- return fetchError;
310
- };
311
- var isPayloadMethod = function(method = "GET") {
312
- return payloadMethods.has(method.toUpperCase());
313
- };
314
- var isJSONSerializable = function(value) {
315
- if (value === undefined) {
316
- return false;
317
- }
318
- const t = typeof value;
319
- if (t === "string" || t === "number" || t === "boolean" || t === null) {
320
- return true;
321
- }
322
- if (t !== "object") {
323
- return false;
324
- }
325
- if (Array.isArray(value)) {
326
- return true;
327
- }
328
- if (value.buffer) {
329
- return false;
330
- }
331
- return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
332
- };
333
- var detectResponseType = function(_contentType = "") {
334
- if (!_contentType) {
335
- return "json";
336
- }
337
- const contentType = _contentType.split(";").shift() || "";
338
- if (JSON_RE.test(contentType)) {
339
- return "json";
340
- }
341
- if (textTypes.has(contentType) || contentType.startsWith("text/")) {
342
- return "text";
343
- }
344
- return "blob";
345
- };
346
- var mergeFetchOptions = function(input, defaults, Headers = globalThis.Headers) {
347
- const merged = {
348
- ...defaults,
349
- ...input
350
- };
351
- if (defaults?.params && input?.params) {
352
- merged.params = {
353
- ...defaults?.params,
354
- ...input?.params
355
- };
356
- }
357
- if (defaults?.query && input?.query) {
358
- merged.query = {
359
- ...defaults?.query,
360
- ...input?.query
361
- };
362
- }
363
- if (defaults?.headers && input?.headers) {
364
- merged.headers = new Headers(defaults?.headers || {});
365
- for (const [key, value] of new Headers(input?.headers || {})) {
366
- merged.headers.set(key, value);
367
- }
368
- }
369
- return merged;
370
- };
371
- var createFetch = function(globalOptions = {}) {
372
- const {
373
- fetch = globalThis.fetch,
374
- Headers = globalThis.Headers,
375
- AbortController = globalThis.AbortController
376
- } = globalOptions;
377
- async function onError(context) {
378
- const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
379
- if (context.options.retry !== false && !isAbort) {
380
- let retries;
381
- if (typeof context.options.retry === "number") {
382
- retries = context.options.retry;
383
- } else {
384
- retries = isPayloadMethod(context.options.method) ? 0 : 1;
385
- }
386
- const responseCode = context.response && context.response.status || 500;
387
- if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
388
- const retryDelay = context.options.retryDelay || 0;
389
- if (retryDelay > 0) {
390
- await new Promise((resolve) => setTimeout(resolve, retryDelay));
391
- }
392
- return $fetchRaw(context.request, {
393
- ...context.options,
394
- retry: retries - 1,
395
- timeout: context.options.timeout
396
- });
397
- }
398
- }
399
- const error = createFetchError(context);
400
- if (Error.captureStackTrace) {
401
- Error.captureStackTrace(error, $fetchRaw);
402
- }
403
- throw error;
404
- }
405
- const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {
406
- const context = {
407
- request: _request,
408
- options: mergeFetchOptions(_options, globalOptions.defaults, Headers),
409
- response: undefined,
410
- error: undefined
411
- };
412
- context.options.method = context.options.method?.toUpperCase();
413
- if (context.options.onRequest) {
414
- await context.options.onRequest(context);
415
- }
416
- if (typeof context.request === "string") {
417
- if (context.options.baseURL) {
418
- context.request = withBase(context.request, context.options.baseURL);
419
- }
420
- if (context.options.query || context.options.params) {
421
- context.request = withQuery(context.request, {
422
- ...context.options.params,
423
- ...context.options.query
424
- });
425
- }
426
- }
427
- if (context.options.body && isPayloadMethod(context.options.method)) {
428
- if (isJSONSerializable(context.options.body)) {
429
- context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body);
430
- context.options.headers = new Headers(context.options.headers || {});
431
- if (!context.options.headers.has("content-type")) {
432
- context.options.headers.set("content-type", "application/json");
433
- }
434
- if (!context.options.headers.has("accept")) {
435
- context.options.headers.set("accept", "application/json");
436
- }
437
- } else if ("pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || typeof context.options.body.pipe === "function") {
438
- if (!("duplex" in context.options)) {
439
- context.options.duplex = "half";
440
- }
441
- }
442
- }
443
- if (!context.options.signal && context.options.timeout) {
444
- const controller = new AbortController;
445
- setTimeout(() => controller.abort(), context.options.timeout);
446
- context.options.signal = controller.signal;
447
- }
448
- try {
449
- context.response = await fetch(context.request, context.options);
450
- } catch (error) {
451
- context.error = error;
452
- if (context.options.onRequestError) {
453
- await context.options.onRequestError(context);
454
- }
455
- return await onError(context);
456
- }
457
- const hasBody = context.response.body && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD";
458
- if (hasBody) {
459
- const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
460
- switch (responseType) {
461
- case "json": {
462
- const data = await context.response.text();
463
- const parseFunction = context.options.parseResponse || destr;
464
- context.response._data = parseFunction(data);
465
- break;
466
- }
467
- case "stream": {
468
- context.response._data = context.response.body;
469
- break;
470
- }
471
- default: {
472
- context.response._data = await context.response[responseType]();
473
- }
474
- }
475
- }
476
- if (context.options.onResponse) {
477
- await context.options.onResponse(context);
478
- }
479
- if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
480
- if (context.options.onResponseError) {
481
- await context.options.onResponseError(context);
482
- }
483
- return await onError(context);
484
- }
485
- return context.response;
486
- };
487
- const $fetch = async function $fetch2(request, options) {
488
- const r2 = await $fetchRaw(request, options);
489
- return r2._data;
490
- };
491
- $fetch.raw = $fetchRaw;
492
- $fetch.native = (...args) => fetch(...args);
493
- $fetch.create = (defaultOptions = {}) => createFetch({
494
- ...globalOptions,
495
- defaults: {
496
- ...globalOptions.defaults,
497
- ...defaultOptions
498
- }
499
- });
500
- return $fetch;
501
- };
502
-
503
- class FetchError extends Error {
504
- constructor(message, opts) {
505
- super(message, opts);
506
- this.name = "FetchError";
507
- if (opts?.cause && !this.cause) {
508
- this.cause = opts.cause;
509
- }
510
- }
511
- }
512
- var payloadMethods = new Set(Object.freeze(["PATCH", "POST", "PUT", "DELETE"]));
513
- var textTypes = new Set([
514
- "image/svg",
515
- "application/xml",
516
- "application/xhtml",
517
- "application/html"
518
- ]);
519
- var JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
520
- var retryStatusCodes = new Set([
521
- 408,
522
- 409,
523
- 425,
524
- 429,
525
- 500,
526
- 502,
527
- 503,
528
- 504
529
- ]);
530
- var nullBodyResponses = new Set([101, 204, 205, 304]);
531
-
532
- // /Users/chrisbreuer/Code/stacks/node_modules/ofetch/dist/index.mjs
533
- var _globalThis = function() {
534
- if (typeof globalThis !== "undefined") {
535
- return globalThis;
536
- }
537
- if (typeof self !== "undefined") {
538
- return self;
539
- }
540
- if (typeof window !== "undefined") {
541
- return window;
542
- }
543
- if (typeof global !== "undefined") {
544
- return global;
545
- }
546
- throw new Error("unable to locate global object");
547
- }();
548
- var fetch = _globalThis.fetch || (() => Promise.reject(new Error("[ofetch] global.fetch is not supported!")));
549
- var Headers = _globalThis.Headers;
550
- var AbortController = _globalThis.AbortController;
551
- var ofetch = createFetch({ fetch, Headers, AbortController });
552
-
553
- // src/index.ts
554
- async function useHttpFetch(endpoint = "") {
555
- let baseURL = "/";
556
- if (endpoint)
557
- baseURL = endpoint;
558
- async function post(url, params) {
559
- const headers = { Accept: "application/json" };
560
- if (token.value)
561
- headers.Authorization = `Bearer ${token.value}`;
562
- const parameters = {
563
- ...params,
564
- ...{
565
- headers,
566
- parseResponse: JSON.parse,
567
- method: "POST",
568
- baseURL
569
- }
570
- };
571
- loading.value = true;
572
- try {
573
- const result = await ofetch(url, parameters);
574
- loading.value = false;
575
- return result;
576
- } catch (err) {
577
- loading.value = false;
578
- throw err;
579
- }
580
- }
581
- async function get(url, params) {
582
- const headers = { Accept: "application/json" };
583
- if (token.value)
584
- headers.Authorization = `Bearer ${token.value}`;
585
- const parameters = {
586
- ...params,
587
- ...{
588
- headers,
589
- parseResponse: JSON.parse,
590
- method: "GET",
591
- baseURL
592
- }
593
- };
594
- return await ofetch(url, parameters);
595
- }
596
- async function patch(url, params) {
597
- const headers = { Accept: "application/json" };
598
- if (token.value)
599
- headers.Authorization = `Bearer ${token.value}`;
600
- const parameters = {
601
- ...params,
602
- ...{
603
- headers,
604
- parseResponse: JSON.parse,
605
- method: "PATCH",
606
- baseURL
607
- }
608
- };
609
- loading.value = true;
610
- return await ofetch(url, parameters);
611
- }
612
- async function destroy(url, params) {
613
- const headers = { Accept: "application/json" };
614
- if (token.value)
615
- headers.Authorization = `Bearer ${token.value}`;
616
- const parameters = {
617
- ...params,
618
- ...{
619
- headers,
620
- method: "DELETE",
621
- baseURL
622
- }
623
- };
624
- loading.value = true;
625
- return await ofetch(url, parameters);
626
- }
627
- function setToken(authToken) {
628
- token.value = authToken;
629
- }
630
- return { post, get, patch, destroy, baseURL, loading, token, setToken };
631
- }
632
- var loading = ref(false);
633
- var token = ref("");
634
- export {
635
- useHttpFetch
636
- };
@@ -1,35 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, {
5
- get: all[name],
6
- enumerable: true,
7
- configurable: true,
8
- set: (newValue) => all[name] = () => newValue
9
- });
10
- };
11
-
12
- // src/drivers/expo.ts
13
- var exports_expo = {};
14
- __export(exports_expo, {
15
- expoWip: () => {
16
- {
17
- return expoWip;
18
- }
19
- }
20
- });
21
- var expoWip = 1;
22
- // src/drivers/fcm.ts
23
- var exports_fcm = {};
24
- __export(exports_fcm, {
25
- fcmWip: () => {
26
- {
27
- return fcmWip;
28
- }
29
- }
30
- });
31
- var fcmWip = 1;
32
- export {
33
- exports_fcm as fcm,
34
- exports_expo as expo
35
- };