@dropthis/cli 0.16.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 +106 -28
- package/dist/cli.cjs.map +1 -1
- package/node_modules/@dropthis/node/README.md +45 -7
- package/node_modules/@dropthis/node/dist/{drops-BtAGkA9A.d.cts → drops-DmTdQTnd.d.cts} +27 -15
- package/node_modules/@dropthis/node/dist/{drops-BtAGkA9A.d.ts → drops-DmTdQTnd.d.ts} +27 -15
- package/node_modules/@dropthis/node/dist/edge.cjs +23 -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 +23 -59
- package/node_modules/@dropthis/node/dist/edge.mjs.map +1 -1
- package/node_modules/@dropthis/node/dist/index.cjs +23 -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 +23 -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.
|
|
@@ -804,6 +787,12 @@ var DropsResource = class {
|
|
|
804
787
|
*
|
|
805
788
|
* Mount target: `options.domain` accepts a connected custom hostname, or `SHARED_POOL`
|
|
806
789
|
* (`"shared"`) to publish to the shared pool even when the account has a default domain.
|
|
790
|
+
*
|
|
791
|
+
* Two URLs come back on the response: `url` is the canonical, **always-branded** human
|
|
792
|
+
* view (badge guaranteed, no client detection); `rawUrl` is the drop's exact bytes at
|
|
793
|
+
* their natural path — hand it to other agents. `rawUrl` is populated only for single
|
|
794
|
+
* non-HTML files (`renderMode: "file_viewer"`) and is `null` for HTML drops and
|
|
795
|
+
* collections. To stream bytes through the SDK for any drop kind, use {@link getContent}.
|
|
807
796
|
*/
|
|
808
797
|
async publish(input, options = {}) {
|
|
809
798
|
let prepared;
|
|
@@ -858,31 +847,25 @@ var DropsResource = class {
|
|
|
858
847
|
);
|
|
859
848
|
}
|
|
860
849
|
/**
|
|
861
|
-
* Resolve a
|
|
862
|
-
*
|
|
863
|
-
*
|
|
864
|
-
*
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
* 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.
|
|
868
859
|
*/
|
|
869
|
-
async resolve(
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
null
|
|
876
|
-
);
|
|
877
|
-
}
|
|
878
|
-
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
|
+
);
|
|
879
866
|
if (result.error)
|
|
880
867
|
return { data: null, error: result.error, headers: result.headers };
|
|
881
|
-
return {
|
|
882
|
-
data: result.data.drops[0] ?? null,
|
|
883
|
-
error: null,
|
|
884
|
-
headers: result.headers
|
|
885
|
-
};
|
|
868
|
+
return { data: result.data.data, error: null, headers: result.headers };
|
|
886
869
|
}
|
|
887
870
|
async getContent(dropId, options = {}) {
|
|
888
871
|
const base = options.deploymentId !== void 0 ? `/drops/${encodeURIComponent(dropId)}/deployments/${encodeURIComponent(options.deploymentId)}/content` : `/drops/${encodeURIComponent(dropId)}/content`;
|
|
@@ -941,25 +924,6 @@ var DropsResource = class {
|
|
|
941
924
|
);
|
|
942
925
|
}
|
|
943
926
|
};
|
|
944
|
-
var CANONICAL_VIEWER_HOST = "dropthis.app";
|
|
945
|
-
function parseSlug(input, allowedParents) {
|
|
946
|
-
const value = input.trim();
|
|
947
|
-
if (!value) return null;
|
|
948
|
-
if (!/[./]/.test(value)) return value;
|
|
949
|
-
const withScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(value) ? value : `https://${value}`;
|
|
950
|
-
let hostname;
|
|
951
|
-
try {
|
|
952
|
-
hostname = new URL(withScheme).hostname;
|
|
953
|
-
} catch {
|
|
954
|
-
return null;
|
|
955
|
-
}
|
|
956
|
-
hostname = hostname.replace(/\.$/, "");
|
|
957
|
-
const dot = hostname.indexOf(".");
|
|
958
|
-
if (dot <= 0) return null;
|
|
959
|
-
const slug = hostname.slice(0, dot);
|
|
960
|
-
const parent = hostname.slice(dot + 1);
|
|
961
|
-
return allowedParents.has(parent) ? slug : null;
|
|
962
|
-
}
|
|
963
927
|
var SETTINGS = [
|
|
964
928
|
"title",
|
|
965
929
|
"visibility",
|
|
@@ -1054,7 +1018,7 @@ function toSnakeCase(value) {
|
|
|
1054
1018
|
|
|
1055
1019
|
// src/transport.ts
|
|
1056
1020
|
var DEFAULT_BASE_URL = "https://api.dropthis.app";
|
|
1057
|
-
var SDK_VERSION = "0.
|
|
1021
|
+
var SDK_VERSION = "0.17.0";
|
|
1058
1022
|
var Transport = class {
|
|
1059
1023
|
apiKey;
|
|
1060
1024
|
baseUrl;
|