@hasna/shortlinks 0.2.3 → 0.2.4
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/cli/index.js +16 -2
- package/dist/index.js +16 -2
- package/dist/mcp/index.js +16 -2
- package/dist/serve/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -10552,7 +10552,11 @@ class CloudShortlinksStore {
|
|
|
10552
10552
|
const domain = await this.getDomain(hostnameOrId);
|
|
10553
10553
|
if (!domain)
|
|
10554
10554
|
throw new Error("Domain not found.");
|
|
10555
|
-
|
|
10555
|
+
try {
|
|
10556
|
+
await this.transport.del(`/domains/${enc(domain.hostname)}`);
|
|
10557
|
+
} catch (error) {
|
|
10558
|
+
throw missingRouteError(error, "domain", `DELETE /domains/${domain.hostname}`);
|
|
10559
|
+
}
|
|
10556
10560
|
return domain;
|
|
10557
10561
|
}
|
|
10558
10562
|
async createLink(input) {
|
|
@@ -10606,7 +10610,11 @@ class CloudShortlinksStore {
|
|
|
10606
10610
|
const link = maybeSlug ? await this.getLink(domainOrSlug, maybeSlug) : await this.getLink(domainOrSlug);
|
|
10607
10611
|
if (!link)
|
|
10608
10612
|
throw new Error("Link not found.");
|
|
10609
|
-
|
|
10613
|
+
try {
|
|
10614
|
+
await this.transport.del(`/links/${enc(link.slug)}`, undefined, maybeSlug ? { query: { domain: domainOrSlug } } : {});
|
|
10615
|
+
} catch (error) {
|
|
10616
|
+
throw missingRouteError(error, "link", `DELETE /links/${link.slug}`);
|
|
10617
|
+
}
|
|
10610
10618
|
return link;
|
|
10611
10619
|
}
|
|
10612
10620
|
async recordClick(_link, _input = {}) {
|
|
@@ -10626,6 +10634,12 @@ class CloudShortlinksStore {
|
|
|
10626
10634
|
function isNotFound(error) {
|
|
10627
10635
|
return typeof error === "object" && error !== null && "status" in error && error.status === 404;
|
|
10628
10636
|
}
|
|
10637
|
+
function missingRouteError(error, resource, request) {
|
|
10638
|
+
if (isNotFound(error)) {
|
|
10639
|
+
return new Error(`Cloud server rejected ${request} with 404 even though the ${resource} exists. ` + `The deployed shortlinks server predates the ${resource}-delete route \u2014 redeploy the ` + `cloud service (ECS) to a version that exposes it, then retry.`);
|
|
10640
|
+
}
|
|
10641
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
10642
|
+
}
|
|
10629
10643
|
|
|
10630
10644
|
// src/client-store.ts
|
|
10631
10645
|
class LocalStore {
|
package/dist/index.js
CHANGED
|
@@ -7659,7 +7659,11 @@ class CloudShortlinksStore {
|
|
|
7659
7659
|
const domain = await this.getDomain(hostnameOrId);
|
|
7660
7660
|
if (!domain)
|
|
7661
7661
|
throw new Error("Domain not found.");
|
|
7662
|
-
|
|
7662
|
+
try {
|
|
7663
|
+
await this.transport.del(`/domains/${enc(domain.hostname)}`);
|
|
7664
|
+
} catch (error) {
|
|
7665
|
+
throw missingRouteError(error, "domain", `DELETE /domains/${domain.hostname}`);
|
|
7666
|
+
}
|
|
7663
7667
|
return domain;
|
|
7664
7668
|
}
|
|
7665
7669
|
async createLink(input) {
|
|
@@ -7713,7 +7717,11 @@ class CloudShortlinksStore {
|
|
|
7713
7717
|
const link = maybeSlug ? await this.getLink(domainOrSlug, maybeSlug) : await this.getLink(domainOrSlug);
|
|
7714
7718
|
if (!link)
|
|
7715
7719
|
throw new Error("Link not found.");
|
|
7716
|
-
|
|
7720
|
+
try {
|
|
7721
|
+
await this.transport.del(`/links/${enc(link.slug)}`, undefined, maybeSlug ? { query: { domain: domainOrSlug } } : {});
|
|
7722
|
+
} catch (error) {
|
|
7723
|
+
throw missingRouteError(error, "link", `DELETE /links/${link.slug}`);
|
|
7724
|
+
}
|
|
7717
7725
|
return link;
|
|
7718
7726
|
}
|
|
7719
7727
|
async recordClick(_link, _input = {}) {
|
|
@@ -7733,6 +7741,12 @@ class CloudShortlinksStore {
|
|
|
7733
7741
|
function isNotFound(error) {
|
|
7734
7742
|
return typeof error === "object" && error !== null && "status" in error && error.status === 404;
|
|
7735
7743
|
}
|
|
7744
|
+
function missingRouteError(error, resource, request) {
|
|
7745
|
+
if (isNotFound(error)) {
|
|
7746
|
+
return new Error(`Cloud server rejected ${request} with 404 even though the ${resource} exists. ` + `The deployed shortlinks server predates the ${resource}-delete route \u2014 redeploy the ` + `cloud service (ECS) to a version that exposes it, then retry.`);
|
|
7747
|
+
}
|
|
7748
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
7749
|
+
}
|
|
7736
7750
|
|
|
7737
7751
|
// src/client-store.ts
|
|
7738
7752
|
class LocalStore {
|
package/dist/mcp/index.js
CHANGED
|
@@ -6501,7 +6501,11 @@ class CloudShortlinksStore {
|
|
|
6501
6501
|
const domain = await this.getDomain(hostnameOrId);
|
|
6502
6502
|
if (!domain)
|
|
6503
6503
|
throw new Error("Domain not found.");
|
|
6504
|
-
|
|
6504
|
+
try {
|
|
6505
|
+
await this.transport.del(`/domains/${enc(domain.hostname)}`);
|
|
6506
|
+
} catch (error) {
|
|
6507
|
+
throw missingRouteError(error, "domain", `DELETE /domains/${domain.hostname}`);
|
|
6508
|
+
}
|
|
6505
6509
|
return domain;
|
|
6506
6510
|
}
|
|
6507
6511
|
async createLink(input) {
|
|
@@ -6555,7 +6559,11 @@ class CloudShortlinksStore {
|
|
|
6555
6559
|
const link = maybeSlug ? await this.getLink(domainOrSlug, maybeSlug) : await this.getLink(domainOrSlug);
|
|
6556
6560
|
if (!link)
|
|
6557
6561
|
throw new Error("Link not found.");
|
|
6558
|
-
|
|
6562
|
+
try {
|
|
6563
|
+
await this.transport.del(`/links/${enc(link.slug)}`, undefined, maybeSlug ? { query: { domain: domainOrSlug } } : {});
|
|
6564
|
+
} catch (error) {
|
|
6565
|
+
throw missingRouteError(error, "link", `DELETE /links/${link.slug}`);
|
|
6566
|
+
}
|
|
6559
6567
|
return link;
|
|
6560
6568
|
}
|
|
6561
6569
|
async recordClick(_link, _input = {}) {
|
|
@@ -6575,6 +6583,12 @@ class CloudShortlinksStore {
|
|
|
6575
6583
|
function isNotFound(error) {
|
|
6576
6584
|
return typeof error === "object" && error !== null && "status" in error && error.status === 404;
|
|
6577
6585
|
}
|
|
6586
|
+
function missingRouteError(error, resource, request) {
|
|
6587
|
+
if (isNotFound(error)) {
|
|
6588
|
+
return new Error(`Cloud server rejected ${request} with 404 even though the ${resource} exists. ` + `The deployed shortlinks server predates the ${resource}-delete route \u2014 redeploy the ` + `cloud service (ECS) to a version that exposes it, then retry.`);
|
|
6589
|
+
}
|
|
6590
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
6591
|
+
}
|
|
6578
6592
|
|
|
6579
6593
|
// src/store.ts
|
|
6580
6594
|
import { createHash } from "crypto";
|
package/dist/serve/index.js
CHANGED
|
@@ -4907,7 +4907,7 @@ var require_lib2 = __commonJS((exports, module) => {
|
|
|
4907
4907
|
var require_package = __commonJS((exports, module) => {
|
|
4908
4908
|
module.exports = {
|
|
4909
4909
|
name: "@hasna/shortlinks",
|
|
4910
|
-
version: "0.2.
|
|
4910
|
+
version: "0.2.4",
|
|
4911
4911
|
description: "Shortlink manager for custom domains and click tracking, with local SQLite or self-hosted cloud (/v1 API + bearer key) storage and Cloudflare setup helpers",
|
|
4912
4912
|
type: "module",
|
|
4913
4913
|
main: "dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/shortlinks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Shortlink manager for custom domains and click tracking, with local SQLite or self-hosted cloud (/v1 API + bearer key) storage and Cloudflare setup helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|