@stardeck-customer-apps/testing 0.6.2 → 0.7.0
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.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +37 -11
- package/dist/index.mjs +37 -11
- package/dist/setup.js +37 -11
- package/dist/setup.mjs +37 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -184,6 +184,10 @@ interface CapturedMessage {
|
|
|
184
184
|
threadTs?: string;
|
|
185
185
|
messagingType?: string;
|
|
186
186
|
tag?: string;
|
|
187
|
+
/** LINE image push — HTTPS URL of the full-size image. */
|
|
188
|
+
originalContentUrl?: string;
|
|
189
|
+
/** LINE image push — HTTPS URL of the preview; may be omitted when not sent. */
|
|
190
|
+
previewImageUrl?: string;
|
|
187
191
|
};
|
|
188
192
|
connectionId?: string;
|
|
189
193
|
sentAt: Date;
|
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,10 @@ interface CapturedMessage {
|
|
|
184
184
|
threadTs?: string;
|
|
185
185
|
messagingType?: string;
|
|
186
186
|
tag?: string;
|
|
187
|
+
/** LINE image push — HTTPS URL of the full-size image. */
|
|
188
|
+
originalContentUrl?: string;
|
|
189
|
+
/** LINE image push — HTTPS URL of the preview; may be omitted when not sent. */
|
|
190
|
+
previewImageUrl?: string;
|
|
187
191
|
};
|
|
188
192
|
connectionId?: string;
|
|
189
193
|
sentAt: Date;
|
package/dist/index.js
CHANGED
|
@@ -1695,6 +1695,15 @@ function createStorage() {
|
|
|
1695
1695
|
|
|
1696
1696
|
// src/simulator/messaging.ts
|
|
1697
1697
|
var import_node_crypto7 = __toESM(require("crypto"));
|
|
1698
|
+
function isValidLineImageUrl(url) {
|
|
1699
|
+
if (url.length > 2e3 || !url.startsWith("https://")) return false;
|
|
1700
|
+
try {
|
|
1701
|
+
new URL(url);
|
|
1702
|
+
return true;
|
|
1703
|
+
} catch {
|
|
1704
|
+
return false;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1698
1707
|
function captureMessage(channel, recipient, body, connectionId) {
|
|
1699
1708
|
const message = {
|
|
1700
1709
|
channel,
|
|
@@ -1704,7 +1713,9 @@ function captureMessage(channel, recipient, body, connectionId) {
|
|
|
1704
1713
|
blocks: body.blocks,
|
|
1705
1714
|
threadTs: body.threadTs ? String(body.threadTs) : void 0,
|
|
1706
1715
|
messagingType: body.messagingType ? String(body.messagingType) : void 0,
|
|
1707
|
-
tag: body.tag ? String(body.tag) : void 0
|
|
1716
|
+
tag: body.tag ? String(body.tag) : void 0,
|
|
1717
|
+
originalContentUrl: body.originalContentUrl ? String(body.originalContentUrl) : void 0,
|
|
1718
|
+
previewImageUrl: body.previewImageUrl ? String(body.previewImageUrl) : void 0
|
|
1708
1719
|
},
|
|
1709
1720
|
connectionId,
|
|
1710
1721
|
sentAt: /* @__PURE__ */ new Date()
|
|
@@ -1742,18 +1753,33 @@ async function handleMessagingRequest(request, channel, subPath) {
|
|
|
1742
1753
|
const userId = String(body.userId ?? "");
|
|
1743
1754
|
const message = body.message;
|
|
1744
1755
|
if (!userId) return failure("userId is required");
|
|
1745
|
-
if (!message || message.type !== "text"
|
|
1746
|
-
return failure("message must be { type: 'text',
|
|
1756
|
+
if (!message || message.type !== "text" && message.type !== "image") {
|
|
1757
|
+
return failure("message must be { type: 'text' | 'image', ... }");
|
|
1747
1758
|
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1759
|
+
const connectionId = body.connectionId ? String(body.connectionId) : void 0;
|
|
1760
|
+
if (message.type === "text") {
|
|
1761
|
+
if (!message.text) {
|
|
1762
|
+
return failure("message must be { type: 'text', text: string }");
|
|
1763
|
+
}
|
|
1764
|
+
if (message.text.length > 5e3) {
|
|
1765
|
+
return failure("message text exceeds maximum length");
|
|
1766
|
+
}
|
|
1767
|
+
captureMessage("line", userId, { text: message.text }, connectionId);
|
|
1768
|
+
} else {
|
|
1769
|
+
const originalContentUrl = message.originalContentUrl;
|
|
1770
|
+
if (!originalContentUrl || !isValidLineImageUrl(originalContentUrl)) {
|
|
1771
|
+
return failure("originalContentUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1772
|
+
}
|
|
1773
|
+
if (message.previewImageUrl !== void 0 && !isValidLineImageUrl(message.previewImageUrl)) {
|
|
1774
|
+
return failure("previewImageUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1775
|
+
}
|
|
1776
|
+
captureMessage(
|
|
1777
|
+
"line",
|
|
1778
|
+
userId,
|
|
1779
|
+
{ originalContentUrl, previewImageUrl: message.previewImageUrl ?? originalContentUrl },
|
|
1780
|
+
connectionId
|
|
1781
|
+
);
|
|
1750
1782
|
}
|
|
1751
|
-
captureMessage(
|
|
1752
|
-
"line",
|
|
1753
|
-
userId,
|
|
1754
|
-
{ text: message.text },
|
|
1755
|
-
body.connectionId ? String(body.connectionId) : void 0
|
|
1756
|
-
);
|
|
1757
1783
|
return success({ success: true });
|
|
1758
1784
|
}
|
|
1759
1785
|
if (channel === "facebook" && subPath === "/send" && method === "POST") {
|
package/dist/index.mjs
CHANGED
|
@@ -1649,6 +1649,15 @@ function createStorage() {
|
|
|
1649
1649
|
|
|
1650
1650
|
// src/simulator/messaging.ts
|
|
1651
1651
|
import crypto7 from "crypto";
|
|
1652
|
+
function isValidLineImageUrl(url) {
|
|
1653
|
+
if (url.length > 2e3 || !url.startsWith("https://")) return false;
|
|
1654
|
+
try {
|
|
1655
|
+
new URL(url);
|
|
1656
|
+
return true;
|
|
1657
|
+
} catch {
|
|
1658
|
+
return false;
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1652
1661
|
function captureMessage(channel, recipient, body, connectionId) {
|
|
1653
1662
|
const message = {
|
|
1654
1663
|
channel,
|
|
@@ -1658,7 +1667,9 @@ function captureMessage(channel, recipient, body, connectionId) {
|
|
|
1658
1667
|
blocks: body.blocks,
|
|
1659
1668
|
threadTs: body.threadTs ? String(body.threadTs) : void 0,
|
|
1660
1669
|
messagingType: body.messagingType ? String(body.messagingType) : void 0,
|
|
1661
|
-
tag: body.tag ? String(body.tag) : void 0
|
|
1670
|
+
tag: body.tag ? String(body.tag) : void 0,
|
|
1671
|
+
originalContentUrl: body.originalContentUrl ? String(body.originalContentUrl) : void 0,
|
|
1672
|
+
previewImageUrl: body.previewImageUrl ? String(body.previewImageUrl) : void 0
|
|
1662
1673
|
},
|
|
1663
1674
|
connectionId,
|
|
1664
1675
|
sentAt: /* @__PURE__ */ new Date()
|
|
@@ -1696,18 +1707,33 @@ async function handleMessagingRequest(request, channel, subPath) {
|
|
|
1696
1707
|
const userId = String(body.userId ?? "");
|
|
1697
1708
|
const message = body.message;
|
|
1698
1709
|
if (!userId) return failure("userId is required");
|
|
1699
|
-
if (!message || message.type !== "text"
|
|
1700
|
-
return failure("message must be { type: 'text',
|
|
1710
|
+
if (!message || message.type !== "text" && message.type !== "image") {
|
|
1711
|
+
return failure("message must be { type: 'text' | 'image', ... }");
|
|
1701
1712
|
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1713
|
+
const connectionId = body.connectionId ? String(body.connectionId) : void 0;
|
|
1714
|
+
if (message.type === "text") {
|
|
1715
|
+
if (!message.text) {
|
|
1716
|
+
return failure("message must be { type: 'text', text: string }");
|
|
1717
|
+
}
|
|
1718
|
+
if (message.text.length > 5e3) {
|
|
1719
|
+
return failure("message text exceeds maximum length");
|
|
1720
|
+
}
|
|
1721
|
+
captureMessage("line", userId, { text: message.text }, connectionId);
|
|
1722
|
+
} else {
|
|
1723
|
+
const originalContentUrl = message.originalContentUrl;
|
|
1724
|
+
if (!originalContentUrl || !isValidLineImageUrl(originalContentUrl)) {
|
|
1725
|
+
return failure("originalContentUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1726
|
+
}
|
|
1727
|
+
if (message.previewImageUrl !== void 0 && !isValidLineImageUrl(message.previewImageUrl)) {
|
|
1728
|
+
return failure("previewImageUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1729
|
+
}
|
|
1730
|
+
captureMessage(
|
|
1731
|
+
"line",
|
|
1732
|
+
userId,
|
|
1733
|
+
{ originalContentUrl, previewImageUrl: message.previewImageUrl ?? originalContentUrl },
|
|
1734
|
+
connectionId
|
|
1735
|
+
);
|
|
1704
1736
|
}
|
|
1705
|
-
captureMessage(
|
|
1706
|
-
"line",
|
|
1707
|
-
userId,
|
|
1708
|
-
{ text: message.text },
|
|
1709
|
-
body.connectionId ? String(body.connectionId) : void 0
|
|
1710
|
-
);
|
|
1711
1737
|
return success({ success: true });
|
|
1712
1738
|
}
|
|
1713
1739
|
if (channel === "facebook" && subPath === "/send" && method === "POST") {
|
package/dist/setup.js
CHANGED
|
@@ -1321,6 +1321,15 @@ async function handleStorageRequest(request, url) {
|
|
|
1321
1321
|
|
|
1322
1322
|
// src/simulator/messaging.ts
|
|
1323
1323
|
var import_node_crypto7 = __toESM(require("crypto"));
|
|
1324
|
+
function isValidLineImageUrl(url) {
|
|
1325
|
+
if (url.length > 2e3 || !url.startsWith("https://")) return false;
|
|
1326
|
+
try {
|
|
1327
|
+
new URL(url);
|
|
1328
|
+
return true;
|
|
1329
|
+
} catch {
|
|
1330
|
+
return false;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1324
1333
|
function captureMessage(channel, recipient, body, connectionId) {
|
|
1325
1334
|
const message = {
|
|
1326
1335
|
channel,
|
|
@@ -1330,7 +1339,9 @@ function captureMessage(channel, recipient, body, connectionId) {
|
|
|
1330
1339
|
blocks: body.blocks,
|
|
1331
1340
|
threadTs: body.threadTs ? String(body.threadTs) : void 0,
|
|
1332
1341
|
messagingType: body.messagingType ? String(body.messagingType) : void 0,
|
|
1333
|
-
tag: body.tag ? String(body.tag) : void 0
|
|
1342
|
+
tag: body.tag ? String(body.tag) : void 0,
|
|
1343
|
+
originalContentUrl: body.originalContentUrl ? String(body.originalContentUrl) : void 0,
|
|
1344
|
+
previewImageUrl: body.previewImageUrl ? String(body.previewImageUrl) : void 0
|
|
1334
1345
|
},
|
|
1335
1346
|
connectionId,
|
|
1336
1347
|
sentAt: /* @__PURE__ */ new Date()
|
|
@@ -1368,18 +1379,33 @@ async function handleMessagingRequest(request, channel, subPath) {
|
|
|
1368
1379
|
const userId = String(body.userId ?? "");
|
|
1369
1380
|
const message = body.message;
|
|
1370
1381
|
if (!userId) return failure("userId is required");
|
|
1371
|
-
if (!message || message.type !== "text"
|
|
1372
|
-
return failure("message must be { type: 'text',
|
|
1382
|
+
if (!message || message.type !== "text" && message.type !== "image") {
|
|
1383
|
+
return failure("message must be { type: 'text' | 'image', ... }");
|
|
1373
1384
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1385
|
+
const connectionId = body.connectionId ? String(body.connectionId) : void 0;
|
|
1386
|
+
if (message.type === "text") {
|
|
1387
|
+
if (!message.text) {
|
|
1388
|
+
return failure("message must be { type: 'text', text: string }");
|
|
1389
|
+
}
|
|
1390
|
+
if (message.text.length > 5e3) {
|
|
1391
|
+
return failure("message text exceeds maximum length");
|
|
1392
|
+
}
|
|
1393
|
+
captureMessage("line", userId, { text: message.text }, connectionId);
|
|
1394
|
+
} else {
|
|
1395
|
+
const originalContentUrl = message.originalContentUrl;
|
|
1396
|
+
if (!originalContentUrl || !isValidLineImageUrl(originalContentUrl)) {
|
|
1397
|
+
return failure("originalContentUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1398
|
+
}
|
|
1399
|
+
if (message.previewImageUrl !== void 0 && !isValidLineImageUrl(message.previewImageUrl)) {
|
|
1400
|
+
return failure("previewImageUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1401
|
+
}
|
|
1402
|
+
captureMessage(
|
|
1403
|
+
"line",
|
|
1404
|
+
userId,
|
|
1405
|
+
{ originalContentUrl, previewImageUrl: message.previewImageUrl ?? originalContentUrl },
|
|
1406
|
+
connectionId
|
|
1407
|
+
);
|
|
1376
1408
|
}
|
|
1377
|
-
captureMessage(
|
|
1378
|
-
"line",
|
|
1379
|
-
userId,
|
|
1380
|
-
{ text: message.text },
|
|
1381
|
-
body.connectionId ? String(body.connectionId) : void 0
|
|
1382
|
-
);
|
|
1383
1409
|
return success({ success: true });
|
|
1384
1410
|
}
|
|
1385
1411
|
if (channel === "facebook" && subPath === "/send" && method === "POST") {
|
package/dist/setup.mjs
CHANGED
|
@@ -1297,6 +1297,15 @@ async function handleStorageRequest(request, url) {
|
|
|
1297
1297
|
|
|
1298
1298
|
// src/simulator/messaging.ts
|
|
1299
1299
|
import crypto7 from "crypto";
|
|
1300
|
+
function isValidLineImageUrl(url) {
|
|
1301
|
+
if (url.length > 2e3 || !url.startsWith("https://")) return false;
|
|
1302
|
+
try {
|
|
1303
|
+
new URL(url);
|
|
1304
|
+
return true;
|
|
1305
|
+
} catch {
|
|
1306
|
+
return false;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1300
1309
|
function captureMessage(channel, recipient, body, connectionId) {
|
|
1301
1310
|
const message = {
|
|
1302
1311
|
channel,
|
|
@@ -1306,7 +1315,9 @@ function captureMessage(channel, recipient, body, connectionId) {
|
|
|
1306
1315
|
blocks: body.blocks,
|
|
1307
1316
|
threadTs: body.threadTs ? String(body.threadTs) : void 0,
|
|
1308
1317
|
messagingType: body.messagingType ? String(body.messagingType) : void 0,
|
|
1309
|
-
tag: body.tag ? String(body.tag) : void 0
|
|
1318
|
+
tag: body.tag ? String(body.tag) : void 0,
|
|
1319
|
+
originalContentUrl: body.originalContentUrl ? String(body.originalContentUrl) : void 0,
|
|
1320
|
+
previewImageUrl: body.previewImageUrl ? String(body.previewImageUrl) : void 0
|
|
1310
1321
|
},
|
|
1311
1322
|
connectionId,
|
|
1312
1323
|
sentAt: /* @__PURE__ */ new Date()
|
|
@@ -1344,18 +1355,33 @@ async function handleMessagingRequest(request, channel, subPath) {
|
|
|
1344
1355
|
const userId = String(body.userId ?? "");
|
|
1345
1356
|
const message = body.message;
|
|
1346
1357
|
if (!userId) return failure("userId is required");
|
|
1347
|
-
if (!message || message.type !== "text"
|
|
1348
|
-
return failure("message must be { type: 'text',
|
|
1358
|
+
if (!message || message.type !== "text" && message.type !== "image") {
|
|
1359
|
+
return failure("message must be { type: 'text' | 'image', ... }");
|
|
1349
1360
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1361
|
+
const connectionId = body.connectionId ? String(body.connectionId) : void 0;
|
|
1362
|
+
if (message.type === "text") {
|
|
1363
|
+
if (!message.text) {
|
|
1364
|
+
return failure("message must be { type: 'text', text: string }");
|
|
1365
|
+
}
|
|
1366
|
+
if (message.text.length > 5e3) {
|
|
1367
|
+
return failure("message text exceeds maximum length");
|
|
1368
|
+
}
|
|
1369
|
+
captureMessage("line", userId, { text: message.text }, connectionId);
|
|
1370
|
+
} else {
|
|
1371
|
+
const originalContentUrl = message.originalContentUrl;
|
|
1372
|
+
if (!originalContentUrl || !isValidLineImageUrl(originalContentUrl)) {
|
|
1373
|
+
return failure("originalContentUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1374
|
+
}
|
|
1375
|
+
if (message.previewImageUrl !== void 0 && !isValidLineImageUrl(message.previewImageUrl)) {
|
|
1376
|
+
return failure("previewImageUrl must be a valid HTTPS URL (max 2000 chars)");
|
|
1377
|
+
}
|
|
1378
|
+
captureMessage(
|
|
1379
|
+
"line",
|
|
1380
|
+
userId,
|
|
1381
|
+
{ originalContentUrl, previewImageUrl: message.previewImageUrl ?? originalContentUrl },
|
|
1382
|
+
connectionId
|
|
1383
|
+
);
|
|
1352
1384
|
}
|
|
1353
|
-
captureMessage(
|
|
1354
|
-
"line",
|
|
1355
|
-
userId,
|
|
1356
|
-
{ text: message.text },
|
|
1357
|
-
body.connectionId ? String(body.connectionId) : void 0
|
|
1358
|
-
);
|
|
1359
1385
|
return success({ success: true });
|
|
1360
1386
|
}
|
|
1361
1387
|
if (channel === "facebook" && subPath === "/send" && method === "POST") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stardeck-customer-apps/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Vitest test harness for Stardeck customer apps — in-process Postgres (PGlite) plus a control-plane simulator so the real Stardeck SDKs run unmodified in tests",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|