@dropthis/cli 0.17.0 → 0.18.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/cli.cjs +89 -28
- package/dist/cli.cjs.map +1 -1
- package/node_modules/@dropthis/node/README.md +10 -6
- package/node_modules/@dropthis/node/dist/{drops-BxDQRrvu.d.cts → drops-DmTdQTnd.d.cts} +10 -15
- package/node_modules/@dropthis/node/dist/{drops-BxDQRrvu.d.ts → drops-DmTdQTnd.d.ts} +10 -15
- package/node_modules/@dropthis/node/dist/edge.cjs +17 -59
- package/node_modules/@dropthis/node/dist/edge.cjs.map +1 -1
- package/node_modules/@dropthis/node/dist/edge.d.cts +1 -1
- package/node_modules/@dropthis/node/dist/edge.d.ts +1 -1
- package/node_modules/@dropthis/node/dist/edge.mjs +17 -59
- package/node_modules/@dropthis/node/dist/edge.mjs.map +1 -1
- package/node_modules/@dropthis/node/dist/index.cjs +17 -59
- package/node_modules/@dropthis/node/dist/index.cjs.map +1 -1
- package/node_modules/@dropthis/node/dist/index.d.cts +2 -2
- package/node_modules/@dropthis/node/dist/index.d.ts +2 -2
- package/node_modules/@dropthis/node/dist/index.mjs +17 -59
- package/node_modules/@dropthis/node/dist/index.mjs.map +1 -1
- package/node_modules/@dropthis/node/package.json +1 -1
- package/package.json +2 -2
|
@@ -778,23 +778,6 @@ var DropsResource = class {
|
|
|
778
778
|
}
|
|
779
779
|
transport;
|
|
780
780
|
resolveInput;
|
|
781
|
-
parentHosts;
|
|
782
|
-
/**
|
|
783
|
-
* Hostnames the SDK can attribute to dropthis for slug parsing: the canonical
|
|
784
|
-
* viewer domain plus the configured baseUrl's host (covers staging/self-hosted
|
|
785
|
-
* setups where drops are served under the API's own domain).
|
|
786
|
-
*/
|
|
787
|
-
allowedParentHosts() {
|
|
788
|
-
if (!this.parentHosts) {
|
|
789
|
-
const hosts = /* @__PURE__ */ new Set([CANONICAL_VIEWER_HOST]);
|
|
790
|
-
try {
|
|
791
|
-
hosts.add(new URL(this.transport.baseUrl).hostname.replace(/\.$/, ""));
|
|
792
|
-
} catch {
|
|
793
|
-
}
|
|
794
|
-
this.parentHosts = hosts;
|
|
795
|
-
}
|
|
796
|
-
return this.parentHosts;
|
|
797
|
-
}
|
|
798
781
|
/**
|
|
799
782
|
* Publish content to a NEW permanent public URL; returns the created drop (with its `drop_…` id).
|
|
800
783
|
* Use to publish / share / post / put online / make public a report, dashboard, site, or file.
|
|
@@ -864,31 +847,25 @@ var DropsResource = class {
|
|
|
864
847
|
);
|
|
865
848
|
}
|
|
866
849
|
/**
|
|
867
|
-
* Resolve a
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
* not
|
|
850
|
+
* Resolve a public locator (a drop URL, a custom-domain URL, or a bare vanity/shared
|
|
851
|
+
* slug) back to the drop — the way to recover a lost `drop_…` id. Sends the raw target
|
|
852
|
+
* to the server (POST /drops/resolve), which owner-scopes and decomposes it. Returns the
|
|
853
|
+
* full drop, or `data: null` when nothing of yours matches. A `drop_…` id passed as the
|
|
854
|
+
* target round-trips to an owner-scoped id lookup (null instead of 404).
|
|
855
|
+
*
|
|
856
|
+
* Persist the drop_… id. URLs, raw_url, and slugs are locators, not identifiers — a vanity
|
|
857
|
+
* slug is renameable and the pool host rotates, so a stored URL can drift; the id never
|
|
858
|
+
* moves. Treat drop_… as an opaque case-sensitive string.
|
|
874
859
|
*/
|
|
875
|
-
async resolve(
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
null
|
|
882
|
-
);
|
|
883
|
-
}
|
|
884
|
-
const result = await this.transport.request("GET", "/drops", { params: { slug } });
|
|
860
|
+
async resolve(target) {
|
|
861
|
+
const result = await this.transport.request(
|
|
862
|
+
"POST",
|
|
863
|
+
"/drops/resolve",
|
|
864
|
+
{ body: { target } }
|
|
865
|
+
);
|
|
885
866
|
if (result.error)
|
|
886
867
|
return { data: null, error: result.error, headers: result.headers };
|
|
887
|
-
return {
|
|
888
|
-
data: result.data.drops[0] ?? null,
|
|
889
|
-
error: null,
|
|
890
|
-
headers: result.headers
|
|
891
|
-
};
|
|
868
|
+
return { data: result.data.data, error: null, headers: result.headers };
|
|
892
869
|
}
|
|
893
870
|
async getContent(dropId, options = {}) {
|
|
894
871
|
const base = options.deploymentId !== void 0 ? `/drops/${encodeURIComponent(dropId)}/deployments/${encodeURIComponent(options.deploymentId)}/content` : `/drops/${encodeURIComponent(dropId)}/content`;
|
|
@@ -947,25 +924,6 @@ var DropsResource = class {
|
|
|
947
924
|
);
|
|
948
925
|
}
|
|
949
926
|
};
|
|
950
|
-
var CANONICAL_VIEWER_HOST = "dropthis.app";
|
|
951
|
-
function parseSlug(input, allowedParents) {
|
|
952
|
-
const value = input.trim();
|
|
953
|
-
if (!value) return null;
|
|
954
|
-
if (!/[./]/.test(value)) return value;
|
|
955
|
-
const withScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(value) ? value : `https://${value}`;
|
|
956
|
-
let hostname;
|
|
957
|
-
try {
|
|
958
|
-
hostname = new URL(withScheme).hostname;
|
|
959
|
-
} catch {
|
|
960
|
-
return null;
|
|
961
|
-
}
|
|
962
|
-
hostname = hostname.replace(/\.$/, "");
|
|
963
|
-
const dot = hostname.indexOf(".");
|
|
964
|
-
if (dot <= 0) return null;
|
|
965
|
-
const slug = hostname.slice(0, dot);
|
|
966
|
-
const parent = hostname.slice(dot + 1);
|
|
967
|
-
return allowedParents.has(parent) ? slug : null;
|
|
968
|
-
}
|
|
969
927
|
var SETTINGS = [
|
|
970
928
|
"title",
|
|
971
929
|
"visibility",
|
|
@@ -1060,7 +1018,7 @@ function toSnakeCase(value) {
|
|
|
1060
1018
|
|
|
1061
1019
|
// src/transport.ts
|
|
1062
1020
|
var DEFAULT_BASE_URL = "https://api.dropthis.app";
|
|
1063
|
-
var SDK_VERSION = "0.
|
|
1021
|
+
var SDK_VERSION = "0.17.0";
|
|
1064
1022
|
var Transport = class {
|
|
1065
1023
|
apiKey;
|
|
1066
1024
|
baseUrl;
|