@nuelink/nuelink-cli 1.4.0 → 1.4.2
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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +51 -29
- package/SECURITY.md +70 -0
- package/package.json +22 -4
- package/src/cli.js +37 -13
- package/src/commands.js +109 -67
- package/src/config.js +107 -38
- package/src/errors.js +47 -0
- package/src/http.js +95 -54
- package/src/postPayload.js +187 -175
- package/src/validation.js +53 -14
- package/test/cli.test.mjs +1235 -0
- package/test/mock-fetch.cjs +261 -0
- package/test/mock-fetch.mjs +261 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
const { writeFileSync } = require("node:fs");
|
|
2
|
+
|
|
3
|
+
let requestCount = 0;
|
|
4
|
+
let remainingFailures = Number(process.env.NUELINK_MOCK_FAIL_COUNT || 0);
|
|
5
|
+
|
|
6
|
+
function headersToObject(headersInput = {}) {
|
|
7
|
+
if (headersInput instanceof Headers) {
|
|
8
|
+
return Object.fromEntries(headersInput.entries());
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (Array.isArray(headersInput)) {
|
|
12
|
+
return Object.fromEntries(headersInput);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return { ...headersInput };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
globalThis.fetch = async (input, init = {}) => {
|
|
19
|
+
requestCount += 1;
|
|
20
|
+
|
|
21
|
+
const urlString =
|
|
22
|
+
typeof input === "string"
|
|
23
|
+
? input
|
|
24
|
+
: input instanceof URL
|
|
25
|
+
? input.toString()
|
|
26
|
+
: input.url;
|
|
27
|
+
const url = new URL(urlString);
|
|
28
|
+
|
|
29
|
+
const headers = headersToObject(init.headers);
|
|
30
|
+
let parsedBody;
|
|
31
|
+
|
|
32
|
+
if (typeof init.body === "string") {
|
|
33
|
+
try {
|
|
34
|
+
parsedBody = JSON.parse(init.body);
|
|
35
|
+
} catch {
|
|
36
|
+
parsedBody = init.body;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const capture = {
|
|
41
|
+
requestCount,
|
|
42
|
+
url: url.toString(),
|
|
43
|
+
method: init.method || "GET",
|
|
44
|
+
headers,
|
|
45
|
+
body: parsedBody,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (process.env.NUELINK_MOCK_CAPTURE_PATH) {
|
|
49
|
+
writeFileSync(process.env.NUELINK_MOCK_CAPTURE_PATH, JSON.stringify(capture, null, 2));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (process.env.NUELINK_MOCK_THROW_TIMEOUT === "1") {
|
|
53
|
+
const error = new Error("mock timeout");
|
|
54
|
+
error.name = "TimeoutError";
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const failPath = process.env.NUELINK_MOCK_FAIL_PATH;
|
|
59
|
+
if (remainingFailures > 0 && (!failPath || url.pathname.endsWith(failPath))) {
|
|
60
|
+
remainingFailures -= 1;
|
|
61
|
+
|
|
62
|
+
return new Response(JSON.stringify({
|
|
63
|
+
status: "error",
|
|
64
|
+
message: `Mock failure ${process.env.NUELINK_MOCK_FAIL_STATUS || "500"}`,
|
|
65
|
+
}), {
|
|
66
|
+
status: Number(process.env.NUELINK_MOCK_FAIL_STATUS || 500),
|
|
67
|
+
headers: {
|
|
68
|
+
"content-type": "application/json",
|
|
69
|
+
...(process.env.NUELINK_MOCK_RETRY_AFTER
|
|
70
|
+
? { "retry-after": process.env.NUELINK_MOCK_RETRY_AFTER }
|
|
71
|
+
: {}),
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (process.env.NUELINK_MOCK_MALFORMED_JSON === "1") {
|
|
77
|
+
return new Response("not-json", {
|
|
78
|
+
status: 200,
|
|
79
|
+
headers: {
|
|
80
|
+
"content-type": "application/json",
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (process.env.NUELINK_MOCK_EMPTY_BODY === "1") {
|
|
86
|
+
return new Response("", {
|
|
87
|
+
status: 200,
|
|
88
|
+
headers: {
|
|
89
|
+
"content-type": "application/json",
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const payload = {
|
|
95
|
+
status: "success",
|
|
96
|
+
data: {
|
|
97
|
+
mocked: true,
|
|
98
|
+
path: url.pathname,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
if (url.pathname.endsWith("/me")) {
|
|
103
|
+
payload.data = {
|
|
104
|
+
id: "mock-id",
|
|
105
|
+
name: "Mock User",
|
|
106
|
+
timezone: "Europe/London",
|
|
107
|
+
};
|
|
108
|
+
} else if (url.pathname.endsWith("/brands")) {
|
|
109
|
+
payload.data = [
|
|
110
|
+
{
|
|
111
|
+
id: 13493,
|
|
112
|
+
title: "new brand",
|
|
113
|
+
description: "new brand",
|
|
114
|
+
timezone: "Europe/London",
|
|
115
|
+
createdAt: "2023-07-20T13:05:31.000000Z",
|
|
116
|
+
updatedAt: "2026-04-15T13:45:23.000000Z",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 9682,
|
|
120
|
+
title: "zapier",
|
|
121
|
+
description: "zapier",
|
|
122
|
+
timezone: "Europe/London",
|
|
123
|
+
createdAt: "2023-05-16T10:42:28.000000Z",
|
|
124
|
+
updatedAt: "2026-03-30T01:07:43.000000Z",
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
payload.pagination = {
|
|
128
|
+
currentPage: 1,
|
|
129
|
+
perPage: 25,
|
|
130
|
+
total: 2,
|
|
131
|
+
lastPage: 1,
|
|
132
|
+
nextPageUrl: null,
|
|
133
|
+
prevPageUrl: null,
|
|
134
|
+
};
|
|
135
|
+
} else if (url.pathname.endsWith("/collections")) {
|
|
136
|
+
payload.data = [
|
|
137
|
+
{
|
|
138
|
+
id: 98843,
|
|
139
|
+
title: "API Brand",
|
|
140
|
+
description: "API Brand",
|
|
141
|
+
createdAt: "2026-04-08T09:46:21.000000Z",
|
|
142
|
+
updatedAt: "2026-04-08T09:46:21.000000Z",
|
|
143
|
+
channels: [],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: 40656,
|
|
147
|
+
title: "iron man",
|
|
148
|
+
description: "iron man",
|
|
149
|
+
createdAt: "2023-09-19T13:45:26.000000Z",
|
|
150
|
+
updatedAt: "2025-02-23T10:11:16.000000Z",
|
|
151
|
+
channels: [
|
|
152
|
+
{ id: 60111, name: "Abdelkarim", type: "X" },
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
];
|
|
156
|
+
payload.pagination = {
|
|
157
|
+
currentPage: 1,
|
|
158
|
+
perPage: 25,
|
|
159
|
+
total: 2,
|
|
160
|
+
lastPage: 1,
|
|
161
|
+
nextPageUrl: null,
|
|
162
|
+
prevPageUrl: null,
|
|
163
|
+
};
|
|
164
|
+
} else if (url.pathname.endsWith("/automations")) {
|
|
165
|
+
payload.data = [
|
|
166
|
+
{
|
|
167
|
+
id: 21682,
|
|
168
|
+
title: "NASA Breaking News",
|
|
169
|
+
description: "NASA Breaking News RSS Automation",
|
|
170
|
+
collectionId: 720,
|
|
171
|
+
status: "ACTIVE",
|
|
172
|
+
subType: "RSS",
|
|
173
|
+
feedUrl: "https://www.nasa.gov/rss/dyn/breaking_news.rss",
|
|
174
|
+
createdAt: "2026-06-29T14:24:13.000000Z",
|
|
175
|
+
updatedAt: "2026-06-29T14:24:13.000000Z",
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
payload.pagination = {
|
|
179
|
+
currentPage: 1,
|
|
180
|
+
perPage: 25,
|
|
181
|
+
total: 1,
|
|
182
|
+
lastPage: 1,
|
|
183
|
+
nextPageUrl: null,
|
|
184
|
+
prevPageUrl: null,
|
|
185
|
+
};
|
|
186
|
+
} else if (url.pathname.endsWith("/channels")) {
|
|
187
|
+
payload.data = [
|
|
188
|
+
{
|
|
189
|
+
id: 299664,
|
|
190
|
+
name: "nuelink-signups",
|
|
191
|
+
status: "ACTIVE",
|
|
192
|
+
type: "Social Media",
|
|
193
|
+
createdAt: "2026-04-16T10:32:53.000000Z",
|
|
194
|
+
updatedAt: "2026-04-16T10:32:53.000000Z",
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 60112,
|
|
198
|
+
name: "insta.kreatinc",
|
|
199
|
+
status: "INACTIVE",
|
|
200
|
+
type: "Instagram",
|
|
201
|
+
createdAt: "2023-08-10T11:39:10.000000Z",
|
|
202
|
+
updatedAt: "2025-04-06T11:00:17.000000Z",
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
payload.pagination = {
|
|
206
|
+
currentPage: 1,
|
|
207
|
+
perPage: 25,
|
|
208
|
+
total: 2,
|
|
209
|
+
lastPage: 1,
|
|
210
|
+
nextPageUrl: null,
|
|
211
|
+
prevPageUrl: null,
|
|
212
|
+
};
|
|
213
|
+
} else if (url.pathname.endsWith("/media")) {
|
|
214
|
+
payload.data = [
|
|
215
|
+
{
|
|
216
|
+
id: 37326956,
|
|
217
|
+
name: "test-image.png",
|
|
218
|
+
type: "image/png",
|
|
219
|
+
size: 70,
|
|
220
|
+
createdAt: "2026-04-24T11:04:27.000000Z",
|
|
221
|
+
updatedAt: "2026-04-24T11:09:44.000000Z",
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
payload.pagination = {
|
|
225
|
+
currentPage: 1,
|
|
226
|
+
perPage: 25,
|
|
227
|
+
total: 1,
|
|
228
|
+
lastPage: 1,
|
|
229
|
+
nextPageUrl: null,
|
|
230
|
+
prevPageUrl: null,
|
|
231
|
+
};
|
|
232
|
+
} else if (url.pathname.endsWith("/posts")) {
|
|
233
|
+
payload.data = [
|
|
234
|
+
{
|
|
235
|
+
id: 4439073,
|
|
236
|
+
title: null,
|
|
237
|
+
postType: "IMAGE",
|
|
238
|
+
postingType: "SCHEDULE",
|
|
239
|
+
status: "PUBLISHED",
|
|
240
|
+
postDate: "2026-05-12 14:00:00",
|
|
241
|
+
createdAt: "2026-05-11T08:59:13.000000Z",
|
|
242
|
+
updatedAt: "2026-05-12T14:00:53.000000Z",
|
|
243
|
+
},
|
|
244
|
+
];
|
|
245
|
+
payload.pagination = {
|
|
246
|
+
currentPage: 1,
|
|
247
|
+
perPage: 25,
|
|
248
|
+
total: 1,
|
|
249
|
+
lastPage: 1,
|
|
250
|
+
nextPageUrl: null,
|
|
251
|
+
prevPageUrl: null,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return new Response(JSON.stringify(payload), {
|
|
256
|
+
status: 200,
|
|
257
|
+
headers: {
|
|
258
|
+
"content-type": "application/json",
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
let requestCount = 0;
|
|
4
|
+
let remainingFailures = Number(process.env.NUELINK_MOCK_FAIL_COUNT || 0);
|
|
5
|
+
|
|
6
|
+
function headersToObject(headersInput = {}) {
|
|
7
|
+
if (headersInput instanceof Headers) {
|
|
8
|
+
return Object.fromEntries(headersInput.entries());
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (Array.isArray(headersInput)) {
|
|
12
|
+
return Object.fromEntries(headersInput);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return { ...headersInput };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
globalThis.fetch = async (input, init = {}) => {
|
|
19
|
+
requestCount += 1;
|
|
20
|
+
|
|
21
|
+
const urlString =
|
|
22
|
+
typeof input === "string"
|
|
23
|
+
? input
|
|
24
|
+
: input instanceof URL
|
|
25
|
+
? input.toString()
|
|
26
|
+
: input.url;
|
|
27
|
+
const url = new URL(urlString);
|
|
28
|
+
|
|
29
|
+
const headers = headersToObject(init.headers);
|
|
30
|
+
let parsedBody;
|
|
31
|
+
|
|
32
|
+
if (typeof init.body === "string") {
|
|
33
|
+
try {
|
|
34
|
+
parsedBody = JSON.parse(init.body);
|
|
35
|
+
} catch {
|
|
36
|
+
parsedBody = init.body;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const capture = {
|
|
41
|
+
requestCount,
|
|
42
|
+
url: url.toString(),
|
|
43
|
+
method: init.method || "GET",
|
|
44
|
+
headers,
|
|
45
|
+
body: parsedBody,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (process.env.NUELINK_MOCK_CAPTURE_PATH) {
|
|
49
|
+
writeFileSync(process.env.NUELINK_MOCK_CAPTURE_PATH, JSON.stringify(capture, null, 2));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (process.env.NUELINK_MOCK_THROW_TIMEOUT === "1") {
|
|
53
|
+
const error = new Error("mock timeout");
|
|
54
|
+
error.name = "TimeoutError";
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const failPath = process.env.NUELINK_MOCK_FAIL_PATH;
|
|
59
|
+
if (remainingFailures > 0 && (!failPath || url.pathname.endsWith(failPath))) {
|
|
60
|
+
remainingFailures -= 1;
|
|
61
|
+
|
|
62
|
+
return new Response(JSON.stringify({
|
|
63
|
+
status: "error",
|
|
64
|
+
message: `Mock failure ${process.env.NUELINK_MOCK_FAIL_STATUS || "500"}`,
|
|
65
|
+
}), {
|
|
66
|
+
status: Number(process.env.NUELINK_MOCK_FAIL_STATUS || 500),
|
|
67
|
+
headers: {
|
|
68
|
+
"content-type": "application/json",
|
|
69
|
+
...(process.env.NUELINK_MOCK_RETRY_AFTER
|
|
70
|
+
? { "retry-after": process.env.NUELINK_MOCK_RETRY_AFTER }
|
|
71
|
+
: {}),
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (process.env.NUELINK_MOCK_MALFORMED_JSON === "1") {
|
|
77
|
+
return new Response("not-json", {
|
|
78
|
+
status: 200,
|
|
79
|
+
headers: {
|
|
80
|
+
"content-type": "application/json",
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (process.env.NUELINK_MOCK_EMPTY_BODY === "1") {
|
|
86
|
+
return new Response("", {
|
|
87
|
+
status: 200,
|
|
88
|
+
headers: {
|
|
89
|
+
"content-type": "application/json",
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const payload = {
|
|
95
|
+
status: "success",
|
|
96
|
+
data: {
|
|
97
|
+
mocked: true,
|
|
98
|
+
path: url.pathname,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
if (url.pathname.endsWith("/me")) {
|
|
103
|
+
payload.data = {
|
|
104
|
+
id: "mock-id",
|
|
105
|
+
name: "Mock User",
|
|
106
|
+
timezone: "Europe/London",
|
|
107
|
+
};
|
|
108
|
+
} else if (url.pathname.endsWith("/brands")) {
|
|
109
|
+
payload.data = [
|
|
110
|
+
{
|
|
111
|
+
id: 13493,
|
|
112
|
+
title: "new brand",
|
|
113
|
+
description: "new brand",
|
|
114
|
+
timezone: "Europe/London",
|
|
115
|
+
createdAt: "2023-07-20T13:05:31.000000Z",
|
|
116
|
+
updatedAt: "2026-04-15T13:45:23.000000Z",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 9682,
|
|
120
|
+
title: "zapier",
|
|
121
|
+
description: "zapier",
|
|
122
|
+
timezone: "Europe/London",
|
|
123
|
+
createdAt: "2023-05-16T10:42:28.000000Z",
|
|
124
|
+
updatedAt: "2026-03-30T01:07:43.000000Z",
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
payload.pagination = {
|
|
128
|
+
currentPage: 1,
|
|
129
|
+
perPage: 25,
|
|
130
|
+
total: 2,
|
|
131
|
+
lastPage: 1,
|
|
132
|
+
nextPageUrl: null,
|
|
133
|
+
prevPageUrl: null,
|
|
134
|
+
};
|
|
135
|
+
} else if (url.pathname.endsWith("/collections")) {
|
|
136
|
+
payload.data = [
|
|
137
|
+
{
|
|
138
|
+
id: 98843,
|
|
139
|
+
title: "API Brand",
|
|
140
|
+
description: "API Brand",
|
|
141
|
+
createdAt: "2026-04-08T09:46:21.000000Z",
|
|
142
|
+
updatedAt: "2026-04-08T09:46:21.000000Z",
|
|
143
|
+
channels: [],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: 40656,
|
|
147
|
+
title: "iron man",
|
|
148
|
+
description: "iron man",
|
|
149
|
+
createdAt: "2023-09-19T13:45:26.000000Z",
|
|
150
|
+
updatedAt: "2025-02-23T10:11:16.000000Z",
|
|
151
|
+
channels: [
|
|
152
|
+
{ id: 60111, name: "Abdelkarim", type: "X" },
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
];
|
|
156
|
+
payload.pagination = {
|
|
157
|
+
currentPage: 1,
|
|
158
|
+
perPage: 25,
|
|
159
|
+
total: 2,
|
|
160
|
+
lastPage: 1,
|
|
161
|
+
nextPageUrl: null,
|
|
162
|
+
prevPageUrl: null,
|
|
163
|
+
};
|
|
164
|
+
} else if (url.pathname.endsWith("/automations")) {
|
|
165
|
+
payload.data = [
|
|
166
|
+
{
|
|
167
|
+
id: 21682,
|
|
168
|
+
title: "NASA Breaking News",
|
|
169
|
+
description: "NASA Breaking News RSS Automation",
|
|
170
|
+
collectionId: 720,
|
|
171
|
+
status: "ACTIVE",
|
|
172
|
+
subType: "RSS",
|
|
173
|
+
feedUrl: "https://www.nasa.gov/rss/dyn/breaking_news.rss",
|
|
174
|
+
createdAt: "2026-06-29T14:24:13.000000Z",
|
|
175
|
+
updatedAt: "2026-06-29T14:24:13.000000Z",
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
payload.pagination = {
|
|
179
|
+
currentPage: 1,
|
|
180
|
+
perPage: 25,
|
|
181
|
+
total: 1,
|
|
182
|
+
lastPage: 1,
|
|
183
|
+
nextPageUrl: null,
|
|
184
|
+
prevPageUrl: null,
|
|
185
|
+
};
|
|
186
|
+
} else if (url.pathname.endsWith("/channels")) {
|
|
187
|
+
payload.data = [
|
|
188
|
+
{
|
|
189
|
+
id: 299664,
|
|
190
|
+
name: "nuelink-signups",
|
|
191
|
+
status: "ACTIVE",
|
|
192
|
+
type: "Social Media",
|
|
193
|
+
createdAt: "2026-04-16T10:32:53.000000Z",
|
|
194
|
+
updatedAt: "2026-04-16T10:32:53.000000Z",
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 60112,
|
|
198
|
+
name: "insta.kreatinc",
|
|
199
|
+
status: "INACTIVE",
|
|
200
|
+
type: "Instagram",
|
|
201
|
+
createdAt: "2023-08-10T11:39:10.000000Z",
|
|
202
|
+
updatedAt: "2025-04-06T11:00:17.000000Z",
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
payload.pagination = {
|
|
206
|
+
currentPage: 1,
|
|
207
|
+
perPage: 25,
|
|
208
|
+
total: 2,
|
|
209
|
+
lastPage: 1,
|
|
210
|
+
nextPageUrl: null,
|
|
211
|
+
prevPageUrl: null,
|
|
212
|
+
};
|
|
213
|
+
} else if (url.pathname.endsWith("/media")) {
|
|
214
|
+
payload.data = [
|
|
215
|
+
{
|
|
216
|
+
id: 37326956,
|
|
217
|
+
name: "test-image.png",
|
|
218
|
+
type: "image/png",
|
|
219
|
+
size: 70,
|
|
220
|
+
createdAt: "2026-04-24T11:04:27.000000Z",
|
|
221
|
+
updatedAt: "2026-04-24T11:09:44.000000Z",
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
payload.pagination = {
|
|
225
|
+
currentPage: 1,
|
|
226
|
+
perPage: 25,
|
|
227
|
+
total: 1,
|
|
228
|
+
lastPage: 1,
|
|
229
|
+
nextPageUrl: null,
|
|
230
|
+
prevPageUrl: null,
|
|
231
|
+
};
|
|
232
|
+
} else if (url.pathname.endsWith("/posts")) {
|
|
233
|
+
payload.data = [
|
|
234
|
+
{
|
|
235
|
+
id: 4439073,
|
|
236
|
+
title: null,
|
|
237
|
+
postType: "IMAGE",
|
|
238
|
+
postingType: "SCHEDULE",
|
|
239
|
+
status: "PUBLISHED",
|
|
240
|
+
postDate: "2026-05-12 14:00:00",
|
|
241
|
+
createdAt: "2026-05-11T08:59:13.000000Z",
|
|
242
|
+
updatedAt: "2026-05-12T14:00:53.000000Z",
|
|
243
|
+
},
|
|
244
|
+
];
|
|
245
|
+
payload.pagination = {
|
|
246
|
+
currentPage: 1,
|
|
247
|
+
perPage: 25,
|
|
248
|
+
total: 1,
|
|
249
|
+
lastPage: 1,
|
|
250
|
+
nextPageUrl: null,
|
|
251
|
+
prevPageUrl: null,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return new Response(JSON.stringify(payload), {
|
|
256
|
+
status: 200,
|
|
257
|
+
headers: {
|
|
258
|
+
"content-type": "application/json",
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
};
|