@dropthis/cli 0.26.0 → 0.28.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 +209 -8
- package/dist/cli.cjs.map +1 -1
- package/node_modules/@dropthis/node/README.md +63 -1
- package/node_modules/@dropthis/node/dist/{drops-gUdVVDX6.d.cts → drops-YhYy2f6R.d.cts} +69 -7
- package/node_modules/@dropthis/node/dist/{drops-gUdVVDX6.d.ts → drops-YhYy2f6R.d.ts} +69 -7
- package/node_modules/@dropthis/node/dist/edge.cjs +26 -7
- package/node_modules/@dropthis/node/dist/edge.cjs.map +1 -1
- package/node_modules/@dropthis/node/dist/edge.d.cts +3 -1
- package/node_modules/@dropthis/node/dist/edge.d.ts +3 -1
- package/node_modules/@dropthis/node/dist/edge.mjs +26 -7
- package/node_modules/@dropthis/node/dist/edge.mjs.map +1 -1
- package/node_modules/@dropthis/node/dist/index.cjs +62 -9
- package/node_modules/@dropthis/node/dist/index.cjs.map +1 -1
- package/node_modules/@dropthis/node/dist/index.d.cts +18 -3
- package/node_modules/@dropthis/node/dist/index.d.ts +18 -3
- package/node_modules/@dropthis/node/dist/index.mjs +61 -9
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AccountLimits, b as AccountResponse, c as AccountWorkspace, d as ActionResolve, g as CursorPage, D as DeploymentContentFile, h as DeploymentContentManifest, j as DnsRecord, k as DomainDeletedResponse, l as DomainListResponse, m as DomainResponse, o as DropAction, p as DropContentFile, q as DropDeploymentResponse, r as DropOptions, s as DropResponse,
|
|
1
|
+
import { W as Transport, x as DropthisResult, E as EmailOtpResponse, U as SessionResponse, C as CreateUploadSessionRequest, f as CreateUploadSessionResponse, _ as UploadSessionResponse, a0 as Workspace, v as DropthisClientOptions, e as ApiKeysResource, a as AccountResource, u as DropsResource, M as PublishInput, i as DeploymentsResource, n as DomainsResource, O as PublishOptions, F as PreparedPublishRequest } from './drops-YhYy2f6R.cjs';
|
|
2
|
+
export { A as AccountLimits, b as AccountResponse, c as AccountWorkspace, d as ActionResolve, g as CursorPage, D as DeploymentContentFile, h as DeploymentContentManifest, j as DnsRecord, k as DomainDeletedResponse, l as DomainListResponse, m as DomainResponse, o as DropAction, p as DropContentFile, q as DropDeploymentResponse, r as DropOptions, s as DropResponse, t as DropWorkspace, w as DropthisErrorResponse, G as GetContentOptions, I as InMemoryPublishInput, K as KeyType, L as Limitations, y as ListDeploymentsParams, z as ListDeploymentsResponse, B as ListPage, N as NextHint, P as PrepareOptions, H as PreparedUploadFile, J as PublishFileInput, R as RequestControls, Q as RequestOptions, S as RevokeImpact, T as SHARED_POOL, V as TierInfo, X as UpdateContentOptions, Y as UploadManifestFile, Z as UploadSessionFileResponse, $ as UploadTarget } from './drops-YhYy2f6R.cjs';
|
|
3
3
|
|
|
4
4
|
declare class AuthResource {
|
|
5
5
|
private readonly transport;
|
|
@@ -38,8 +38,21 @@ declare class UploadsResource {
|
|
|
38
38
|
cancel(uploadId: string): Promise<DropthisResult<null>>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
declare class WorkspacesResource {
|
|
42
|
+
private readonly transport;
|
|
43
|
+
constructor(transport: Transport);
|
|
44
|
+
list(): Promise<DropthisResult<{
|
|
45
|
+
object: "list";
|
|
46
|
+
data: Workspace[];
|
|
47
|
+
}>>;
|
|
48
|
+
use(workspace: string): Promise<DropthisResult<Workspace>>;
|
|
49
|
+
active(): Promise<DropthisResult<Workspace | null>>;
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
declare class Dropthis {
|
|
42
53
|
private readonly transport;
|
|
54
|
+
/** Client-level workspace default; applied when a publish call omits `options.workspace`. */
|
|
55
|
+
private readonly defaultWorkspace;
|
|
43
56
|
private authResource?;
|
|
44
57
|
private apiKeysResource?;
|
|
45
58
|
private accountResource?;
|
|
@@ -47,6 +60,7 @@ declare class Dropthis {
|
|
|
47
60
|
private deploymentsResource?;
|
|
48
61
|
private uploadsResource?;
|
|
49
62
|
private domainsResource?;
|
|
63
|
+
private workspacesResource?;
|
|
50
64
|
constructor(options?: DropthisClientOptions | string);
|
|
51
65
|
get auth(): AuthResource;
|
|
52
66
|
get apiKeys(): ApiKeysResource;
|
|
@@ -55,6 +69,7 @@ declare class Dropthis {
|
|
|
55
69
|
get deployments(): DeploymentsResource;
|
|
56
70
|
get uploads(): UploadsResource;
|
|
57
71
|
get domains(): DomainsResource;
|
|
72
|
+
get workspaces(): WorkspacesResource;
|
|
58
73
|
prepare(input: PublishInput, options?: PublishOptions): Promise<PreparedPublishRequest>;
|
|
59
74
|
}
|
|
60
75
|
|
|
@@ -79,4 +94,4 @@ declare class PublishInputError extends Error {
|
|
|
79
94
|
constructor(code: string, message: string, param?: string | undefined, suggestion?: string | undefined);
|
|
80
95
|
}
|
|
81
96
|
|
|
82
|
-
export { CreateUploadSessionRequest, CreateUploadSessionResponse, DeploymentsResource, DomainsResource, Dropthis, DropthisClientOptions, DropthisResult, PreparedPublishRequest, PublishInput, PublishInputError, PublishOptions, UploadSessionResponse, UploadsResource, createErrorResult, redactSecrets };
|
|
97
|
+
export { CreateUploadSessionRequest, CreateUploadSessionResponse, DeploymentsResource, DomainsResource, Dropthis, DropthisClientOptions, DropthisResult, PreparedPublishRequest, PublishInput, PublishInputError, PublishOptions, UploadSessionResponse, UploadsResource, Workspace, WorkspacesResource, createErrorResult, redactSecrets };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AccountLimits, b as AccountResponse, c as AccountWorkspace, d as ActionResolve, g as CursorPage, D as DeploymentContentFile, h as DeploymentContentManifest, j as DnsRecord, k as DomainDeletedResponse, l as DomainListResponse, m as DomainResponse, o as DropAction, p as DropContentFile, q as DropDeploymentResponse, r as DropOptions, s as DropResponse,
|
|
1
|
+
import { W as Transport, x as DropthisResult, E as EmailOtpResponse, U as SessionResponse, C as CreateUploadSessionRequest, f as CreateUploadSessionResponse, _ as UploadSessionResponse, a0 as Workspace, v as DropthisClientOptions, e as ApiKeysResource, a as AccountResource, u as DropsResource, M as PublishInput, i as DeploymentsResource, n as DomainsResource, O as PublishOptions, F as PreparedPublishRequest } from './drops-YhYy2f6R.js';
|
|
2
|
+
export { A as AccountLimits, b as AccountResponse, c as AccountWorkspace, d as ActionResolve, g as CursorPage, D as DeploymentContentFile, h as DeploymentContentManifest, j as DnsRecord, k as DomainDeletedResponse, l as DomainListResponse, m as DomainResponse, o as DropAction, p as DropContentFile, q as DropDeploymentResponse, r as DropOptions, s as DropResponse, t as DropWorkspace, w as DropthisErrorResponse, G as GetContentOptions, I as InMemoryPublishInput, K as KeyType, L as Limitations, y as ListDeploymentsParams, z as ListDeploymentsResponse, B as ListPage, N as NextHint, P as PrepareOptions, H as PreparedUploadFile, J as PublishFileInput, R as RequestControls, Q as RequestOptions, S as RevokeImpact, T as SHARED_POOL, V as TierInfo, X as UpdateContentOptions, Y as UploadManifestFile, Z as UploadSessionFileResponse, $ as UploadTarget } from './drops-YhYy2f6R.js';
|
|
3
3
|
|
|
4
4
|
declare class AuthResource {
|
|
5
5
|
private readonly transport;
|
|
@@ -38,8 +38,21 @@ declare class UploadsResource {
|
|
|
38
38
|
cancel(uploadId: string): Promise<DropthisResult<null>>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
declare class WorkspacesResource {
|
|
42
|
+
private readonly transport;
|
|
43
|
+
constructor(transport: Transport);
|
|
44
|
+
list(): Promise<DropthisResult<{
|
|
45
|
+
object: "list";
|
|
46
|
+
data: Workspace[];
|
|
47
|
+
}>>;
|
|
48
|
+
use(workspace: string): Promise<DropthisResult<Workspace>>;
|
|
49
|
+
active(): Promise<DropthisResult<Workspace | null>>;
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
declare class Dropthis {
|
|
42
53
|
private readonly transport;
|
|
54
|
+
/** Client-level workspace default; applied when a publish call omits `options.workspace`. */
|
|
55
|
+
private readonly defaultWorkspace;
|
|
43
56
|
private authResource?;
|
|
44
57
|
private apiKeysResource?;
|
|
45
58
|
private accountResource?;
|
|
@@ -47,6 +60,7 @@ declare class Dropthis {
|
|
|
47
60
|
private deploymentsResource?;
|
|
48
61
|
private uploadsResource?;
|
|
49
62
|
private domainsResource?;
|
|
63
|
+
private workspacesResource?;
|
|
50
64
|
constructor(options?: DropthisClientOptions | string);
|
|
51
65
|
get auth(): AuthResource;
|
|
52
66
|
get apiKeys(): ApiKeysResource;
|
|
@@ -55,6 +69,7 @@ declare class Dropthis {
|
|
|
55
69
|
get deployments(): DeploymentsResource;
|
|
56
70
|
get uploads(): UploadsResource;
|
|
57
71
|
get domains(): DomainsResource;
|
|
72
|
+
get workspaces(): WorkspacesResource;
|
|
58
73
|
prepare(input: PublishInput, options?: PublishOptions): Promise<PreparedPublishRequest>;
|
|
59
74
|
}
|
|
60
75
|
|
|
@@ -79,4 +94,4 @@ declare class PublishInputError extends Error {
|
|
|
79
94
|
constructor(code: string, message: string, param?: string | undefined, suggestion?: string | undefined);
|
|
80
95
|
}
|
|
81
96
|
|
|
82
|
-
export { CreateUploadSessionRequest, CreateUploadSessionResponse, DeploymentsResource, DomainsResource, Dropthis, DropthisClientOptions, DropthisResult, PreparedPublishRequest, PublishInput, PublishInputError, PublishOptions, UploadSessionResponse, UploadsResource, createErrorResult, redactSecrets };
|
|
97
|
+
export { CreateUploadSessionRequest, CreateUploadSessionResponse, DeploymentsResource, DomainsResource, Dropthis, DropthisClientOptions, DropthisResult, PreparedPublishRequest, PublishInput, PublishInputError, PublishOptions, UploadSessionResponse, UploadsResource, Workspace, WorkspacesResource, createErrorResult, redactSecrets };
|
|
@@ -251,7 +251,8 @@ function buildStagedRequest(files, options, entry) {
|
|
|
251
251
|
const manifest = {
|
|
252
252
|
schemaVersion: 1,
|
|
253
253
|
files: manifestFiles,
|
|
254
|
-
...resolvedEntry ? { entry: resolvedEntry } : {}
|
|
254
|
+
...resolvedEntry ? { entry: resolvedEntry } : {},
|
|
255
|
+
...options.workspace !== void 0 ? { workspace: options.workspace } : {}
|
|
255
256
|
};
|
|
256
257
|
const prepared = {
|
|
257
258
|
kind: "staged",
|
|
@@ -260,6 +261,7 @@ function buildStagedRequest(files, options, entry) {
|
|
|
260
261
|
options: optionsBody(options)
|
|
261
262
|
};
|
|
262
263
|
if (options.metadata) prepared.metadata = options.metadata;
|
|
264
|
+
if (options.workspace !== void 0) prepared.workspace = options.workspace;
|
|
263
265
|
return prepared;
|
|
264
266
|
}
|
|
265
267
|
function buildSourceRequest(sourceUrl, options) {
|
|
@@ -277,6 +279,7 @@ function buildSourceRequest(sourceUrl, options) {
|
|
|
277
279
|
options: optionsBody(options)
|
|
278
280
|
};
|
|
279
281
|
if (options.metadata) prepared.metadata = options.metadata;
|
|
282
|
+
if (options.workspace !== void 0) prepared.workspace = options.workspace;
|
|
280
283
|
return prepared;
|
|
281
284
|
}
|
|
282
285
|
function decodeBase64(value) {
|
|
@@ -501,6 +504,7 @@ async function publishSource(transport, prepared, finalPath, options = {}) {
|
|
|
501
504
|
sourceUrl: prepared.sourceUrl,
|
|
502
505
|
...Object.keys(prepared.options).length > 0 ? { options: prepared.options } : {},
|
|
503
506
|
...prepared.metadata ? { metadata: prepared.metadata } : {},
|
|
507
|
+
...prepared.workspace !== void 0 ? { workspace: prepared.workspace } : {},
|
|
504
508
|
...partialUpdateBody(options)
|
|
505
509
|
},
|
|
506
510
|
idempotencyKey: `${baseKey}:publish`,
|
|
@@ -687,7 +691,12 @@ var ApiKeysResource = class {
|
|
|
687
691
|
return this.transport.request("GET", "/api-keys");
|
|
688
692
|
}
|
|
689
693
|
create(input) {
|
|
690
|
-
|
|
694
|
+
const body = { label: input.label };
|
|
695
|
+
if (input.type !== void 0) body.key_type = input.type;
|
|
696
|
+
if (input.workspace !== void 0) body.workspace = input.workspace;
|
|
697
|
+
if (input.allowedWorkspaces !== void 0)
|
|
698
|
+
body.allowed_workspace_ids = input.allowedWorkspaces;
|
|
699
|
+
return this.transport.request("POST", "/api-keys", { body });
|
|
691
700
|
}
|
|
692
701
|
/** Revoke an API key. 204 No Content — data is null on success. */
|
|
693
702
|
delete(keyId) {
|
|
@@ -865,12 +874,14 @@ var CursorPage = class {
|
|
|
865
874
|
|
|
866
875
|
// src/resources/drops.ts
|
|
867
876
|
var DropsResource = class {
|
|
868
|
-
constructor(transport, resolveInput2) {
|
|
877
|
+
constructor(transport, resolveInput2, defaultWorkspace) {
|
|
869
878
|
this.transport = transport;
|
|
870
879
|
this.resolveInput = resolveInput2;
|
|
880
|
+
this.defaultWorkspace = defaultWorkspace;
|
|
871
881
|
}
|
|
872
882
|
transport;
|
|
873
883
|
resolveInput;
|
|
884
|
+
defaultWorkspace;
|
|
874
885
|
/**
|
|
875
886
|
* Publish content to a NEW permanent public URL; returns the created drop (with its `drop_…` id).
|
|
876
887
|
* Use to publish / share / post / put online / make public a report, dashboard, site, or file.
|
|
@@ -888,13 +899,14 @@ var DropsResource = class {
|
|
|
888
899
|
* collections. To stream bytes through the SDK for any drop kind, use {@link getContent}.
|
|
889
900
|
*/
|
|
890
901
|
async publish(input, options = {}) {
|
|
902
|
+
const merged = this.defaultWorkspace !== void 0 && options.workspace === void 0 ? { ...options, workspace: this.defaultWorkspace } : options;
|
|
891
903
|
let prepared;
|
|
892
904
|
try {
|
|
893
|
-
prepared = await this.resolveInput(input,
|
|
905
|
+
prepared = await this.resolveInput(input, merged);
|
|
894
906
|
} catch (e) {
|
|
895
907
|
return toErrorResult(e);
|
|
896
908
|
}
|
|
897
|
-
return prepared.kind === "source" ? publishSource(this.transport, prepared, "/drops",
|
|
909
|
+
return prepared.kind === "source" ? publishSource(this.transport, prepared, "/drops", merged) : publishStaged(this.transport, prepared, "/drops", merged);
|
|
898
910
|
}
|
|
899
911
|
/**
|
|
900
912
|
* Replace the content of an EXISTING drop, keeping its URL (ships a new deployment). Requires the
|
|
@@ -1077,6 +1089,30 @@ var UploadsResource = class {
|
|
|
1077
1089
|
}
|
|
1078
1090
|
};
|
|
1079
1091
|
|
|
1092
|
+
// src/resources/workspaces.ts
|
|
1093
|
+
var WorkspacesResource = class {
|
|
1094
|
+
constructor(transport) {
|
|
1095
|
+
this.transport = transport;
|
|
1096
|
+
}
|
|
1097
|
+
transport;
|
|
1098
|
+
list() {
|
|
1099
|
+
return this.transport.request("GET", "/workspaces");
|
|
1100
|
+
}
|
|
1101
|
+
use(workspace) {
|
|
1102
|
+
return this.transport.request("PUT", "/account/active-workspace", {
|
|
1103
|
+
body: { workspace }
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
async active() {
|
|
1107
|
+
const result = await this.list();
|
|
1108
|
+
if (result.error !== null) {
|
|
1109
|
+
return result;
|
|
1110
|
+
}
|
|
1111
|
+
const found = result.data.data.find((ws) => ws.isActive) ?? null;
|
|
1112
|
+
return { data: found, error: null, headers: result.headers };
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1080
1116
|
// src/case.ts
|
|
1081
1117
|
function toCamelKey(key) {
|
|
1082
1118
|
return key.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
@@ -1112,7 +1148,7 @@ function toSnakeCase(value) {
|
|
|
1112
1148
|
|
|
1113
1149
|
// src/transport.ts
|
|
1114
1150
|
var DEFAULT_BASE_URL = "https://api.dropthis.app";
|
|
1115
|
-
var SDK_VERSION = "0.
|
|
1151
|
+
var SDK_VERSION = "0.24.0";
|
|
1116
1152
|
var Transport = class {
|
|
1117
1153
|
apiKey;
|
|
1118
1154
|
baseUrl;
|
|
@@ -1352,6 +1388,8 @@ function booleanValue(value) {
|
|
|
1352
1388
|
// src/dropthis.ts
|
|
1353
1389
|
var Dropthis = class {
|
|
1354
1390
|
transport;
|
|
1391
|
+
/** Client-level workspace default; applied when a publish call omits `options.workspace`. */
|
|
1392
|
+
defaultWorkspace;
|
|
1355
1393
|
authResource;
|
|
1356
1394
|
apiKeysResource;
|
|
1357
1395
|
accountResource;
|
|
@@ -1359,8 +1397,10 @@ var Dropthis = class {
|
|
|
1359
1397
|
deploymentsResource;
|
|
1360
1398
|
uploadsResource;
|
|
1361
1399
|
domainsResource;
|
|
1400
|
+
workspacesResource;
|
|
1362
1401
|
constructor(options = {}) {
|
|
1363
1402
|
this.transport = new Transport(options);
|
|
1403
|
+
this.defaultWorkspace = typeof options === "string" ? void 0 : options.workspace;
|
|
1364
1404
|
}
|
|
1365
1405
|
get auth() {
|
|
1366
1406
|
if (!this.authResource)
|
|
@@ -1378,8 +1418,13 @@ var Dropthis = class {
|
|
|
1378
1418
|
return this.accountResource;
|
|
1379
1419
|
}
|
|
1380
1420
|
get drops() {
|
|
1381
|
-
if (!this.dropsResource)
|
|
1382
|
-
this.dropsResource = new DropsResource(
|
|
1421
|
+
if (!this.dropsResource) {
|
|
1422
|
+
this.dropsResource = new DropsResource(
|
|
1423
|
+
this.transport,
|
|
1424
|
+
resolveInput,
|
|
1425
|
+
this.defaultWorkspace
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1383
1428
|
return this.dropsResource;
|
|
1384
1429
|
}
|
|
1385
1430
|
get deployments() {
|
|
@@ -1397,8 +1442,14 @@ var Dropthis = class {
|
|
|
1397
1442
|
this.domainsResource = new DomainsResource(this.transport);
|
|
1398
1443
|
return this.domainsResource;
|
|
1399
1444
|
}
|
|
1445
|
+
get workspaces() {
|
|
1446
|
+
if (!this.workspacesResource)
|
|
1447
|
+
this.workspacesResource = new WorkspacesResource(this.transport);
|
|
1448
|
+
return this.workspacesResource;
|
|
1449
|
+
}
|
|
1400
1450
|
async prepare(input, options = {}) {
|
|
1401
|
-
|
|
1451
|
+
const merged = this.defaultWorkspace !== void 0 && options.workspace === void 0 ? { ...options, workspace: this.defaultWorkspace } : options;
|
|
1452
|
+
return resolveInput(input, merged);
|
|
1402
1453
|
}
|
|
1403
1454
|
};
|
|
1404
1455
|
|
|
@@ -1412,6 +1463,7 @@ export {
|
|
|
1412
1463
|
PublishInputError,
|
|
1413
1464
|
SHARED_POOL,
|
|
1414
1465
|
UploadsResource,
|
|
1466
|
+
WorkspacesResource,
|
|
1415
1467
|
createErrorResult,
|
|
1416
1468
|
redactSecrets
|
|
1417
1469
|
};
|