strapi-plugin-xquik 1.0.0 → 1.0.1
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/server/index.js +6 -0
- package/dist/server/index.mjs +6 -0
- package/package.json +2 -1
package/dist/server/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const config = {
|
|
|
14
14
|
const XQUIK_URL = "https://xquik.com";
|
|
15
15
|
const API_URL = `${XQUIK_URL}/api/v1/x`;
|
|
16
16
|
const REQUEST_TIMEOUT_MS = 3e4;
|
|
17
|
+
const NO_USER_IDS = /* @__PURE__ */ new Set(["", ".", ".."]);
|
|
17
18
|
class XquikError extends Error {
|
|
18
19
|
name = "XquikError";
|
|
19
20
|
code;
|
|
@@ -99,6 +100,11 @@ const xquikService = ({ strapi }) => ({
|
|
|
99
100
|
);
|
|
100
101
|
},
|
|
101
102
|
getUser(id) {
|
|
103
|
+
if (NO_USER_IDS.has(id)) {
|
|
104
|
+
return Promise.reject(
|
|
105
|
+
new XquikError("invalid_user", "Pass a user ID or username.")
|
|
106
|
+
);
|
|
107
|
+
}
|
|
102
108
|
return readApi(
|
|
103
109
|
strapi,
|
|
104
110
|
`/users/${encodeURIComponent(id)}`,
|
package/dist/server/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ const config = {
|
|
|
12
12
|
const XQUIK_URL = "https://xquik.com";
|
|
13
13
|
const API_URL = `${XQUIK_URL}/api/v1/x`;
|
|
14
14
|
const REQUEST_TIMEOUT_MS = 3e4;
|
|
15
|
+
const NO_USER_IDS = /* @__PURE__ */ new Set(["", ".", ".."]);
|
|
15
16
|
class XquikError extends Error {
|
|
16
17
|
name = "XquikError";
|
|
17
18
|
code;
|
|
@@ -97,6 +98,11 @@ const xquikService = ({ strapi }) => ({
|
|
|
97
98
|
);
|
|
98
99
|
},
|
|
99
100
|
getUser(id) {
|
|
101
|
+
if (NO_USER_IDS.has(id)) {
|
|
102
|
+
return Promise.reject(
|
|
103
|
+
new XquikError("invalid_user", "Pass a user ID or username.")
|
|
104
|
+
);
|
|
105
|
+
}
|
|
100
106
|
return readApi(
|
|
101
107
|
strapi,
|
|
102
108
|
`/users/${encodeURIComponent(id)}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-xquik",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Search X posts & read profiles from Strapi 5 with the Xquik X Twitter data API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@strapi/sdk-plugin": "6.1.1",
|
|
47
47
|
"@types/bun": "1.4.4",
|
|
48
|
+
"fast-check": "4.10.2",
|
|
48
49
|
"oxlint": "1.90.0",
|
|
49
50
|
"typescript": "5.9.3"
|
|
50
51
|
},
|