@levo-so/core 0.1.78 → 0.1.80
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/index.js +697 -42
- package/package.json +1 -1
- package/dist/client.js +0 -66
- package/dist/constants/collection/defaultByKind.js +0 -33
- package/dist/constants/collection/fieldInterfaceFormat.js +0 -34
- package/dist/constants/collection/fieldInterfaces.js +0 -48
- package/dist/constants/collection/fieldKind.js +0 -78
- package/dist/constants/integration.js +0 -13
- package/dist/constants/media.js +0 -8
- package/dist/constants/oauthProvider.js +0 -4
- package/dist/control/index.js +0 -42
- package/dist/httpClient.js +0 -26
- package/dist/logger/batch.js +0 -52
- package/dist/logger/index.js +0 -77
- package/dist/modules/blog.js +0 -20
- package/dist/modules/collection.js +0 -51
- package/dist/modules/media.js +0 -12
- package/dist/modules/membership.js +0 -50
- package/dist/types/audience.js +0 -40
- package/dist/types/forum/comment.js +0 -10
- package/dist/types/forum/post.js +0 -18
- package/dist/utils/LevoError.js +0 -25
- package/dist/utils/formatImagePath.js +0 -12
- package/dist/utils/getLevoError.js +0 -66
- package/dist/utils/listToX.js +0 -5
package/dist/types/forum/post.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const e = {
|
|
2
|
-
post: "post",
|
|
3
|
-
poll: "poll",
|
|
4
|
-
gallery: "gallery",
|
|
5
|
-
link: "link"
|
|
6
|
-
}, d = Object.keys(e), l = {
|
|
7
|
-
draft: "draft",
|
|
8
|
-
published: "published",
|
|
9
|
-
unpublished: "unpublished",
|
|
10
|
-
archived: "archived",
|
|
11
|
-
flagged: "flagged",
|
|
12
|
-
pending_moderation: "pending_moderation"
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
e as FORUM_POST_KIND,
|
|
16
|
-
l as FORUM_POST_STATUS,
|
|
17
|
-
d as ForumPostKindExpandedList
|
|
18
|
-
};
|
package/dist/utils/LevoError.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
class s extends Error {
|
|
2
|
-
code;
|
|
3
|
-
title;
|
|
4
|
-
status;
|
|
5
|
-
type;
|
|
6
|
-
errors;
|
|
7
|
-
constructor(r) {
|
|
8
|
-
super(r.description), this.name = "Levo Request Error", this.status = r.status, this.code = r.code, this.title = r.title, this.type = r.type, this.errors = r.errors;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Get validation errors for form fields
|
|
12
|
-
*/
|
|
13
|
-
get fieldErrors() {
|
|
14
|
-
return this.errors || [];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Check if this is a validation error with field-specific errors
|
|
18
|
-
*/
|
|
19
|
-
get hasFieldErrors() {
|
|
20
|
-
return !!this.errors?.length;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
s as LevoError
|
|
25
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { WretchError as i } from "wretch/resolver";
|
|
2
|
-
import { LevoError as e } from "./LevoError.js";
|
|
3
|
-
const c = (t) => t instanceof i || t instanceof Error && "response" in t && "status" in t && "url" in t, u = (t) => {
|
|
4
|
-
if (t instanceof e)
|
|
5
|
-
return t;
|
|
6
|
-
if (c(t)) {
|
|
7
|
-
let n = t?.json;
|
|
8
|
-
if (!n && (t?.text || t?.message))
|
|
9
|
-
try {
|
|
10
|
-
n = JSON.parse(t.text || t.message);
|
|
11
|
-
} catch {
|
|
12
|
-
}
|
|
13
|
-
if (n) {
|
|
14
|
-
const s = n;
|
|
15
|
-
return new e({
|
|
16
|
-
status: s?.content?.status || t?.status || 500,
|
|
17
|
-
code: s?.content?.code || "Unknown",
|
|
18
|
-
title: s?.content?.title || `HTTP ${t?.status || 500} Error`,
|
|
19
|
-
description: s?.content?.description || s?.content?.errors?.[0]?.message || `Request failed with status ${t?.status || 500}`,
|
|
20
|
-
type: s?.content?.type,
|
|
21
|
-
errors: s?.content?.errors
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return new e({
|
|
25
|
-
status: t?.status || 500,
|
|
26
|
-
code: "HTTP_ERROR",
|
|
27
|
-
title: `HTTP ${t?.status || 500} Error`,
|
|
28
|
-
description: `Request failed with status ${t?.status || 500}`
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
if (t instanceof TypeError) {
|
|
32
|
-
if (t?.message.includes("Failed to fetch") || t?.message.includes("Network request failed") || t?.message.includes("fetch"))
|
|
33
|
-
return new e({
|
|
34
|
-
status: 0,
|
|
35
|
-
code: "NETWORK_ERROR",
|
|
36
|
-
title: "Network Error",
|
|
37
|
-
description: "Unable to connect to the server. Please check your internet connection."
|
|
38
|
-
});
|
|
39
|
-
if (t?.message.includes("CORS") || t?.message.includes("cross-origin"))
|
|
40
|
-
return new e({
|
|
41
|
-
status: 0,
|
|
42
|
-
code: "CORS_ERROR",
|
|
43
|
-
title: "CORS Error",
|
|
44
|
-
description: "Cross-origin request blocked. Please contact support."
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return t?.name === "AbortError" || t instanceof DOMException ? new e({
|
|
48
|
-
status: 408,
|
|
49
|
-
code: "REQUEST_TIMEOUT",
|
|
50
|
-
title: "Request Timeout",
|
|
51
|
-
description: "The request was cancelled or timed out. Please try again."
|
|
52
|
-
}) : t?.request ? new e({
|
|
53
|
-
status: t?.response?.status || 500,
|
|
54
|
-
code: t?.code || "REQUEST_ERROR",
|
|
55
|
-
title: "Request Error",
|
|
56
|
-
description: t?.message || "An error occurred while making the request"
|
|
57
|
-
}) : new e({
|
|
58
|
-
status: 500,
|
|
59
|
-
code: "UNKNOWN_ERROR",
|
|
60
|
-
title: "Unexpected Error",
|
|
61
|
-
description: t?.message || "Something unexpected happened"
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
u as getLevoError
|
|
66
|
-
};
|