@dropthis/cli 0.24.0 → 0.24.1
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 +5 -5
- package/node_modules/@dropthis/node/README.md +14 -13
- package/node_modules/@dropthis/node/dist/{drops-O6ymlqmb.d.cts → drops-BVoN5MaZ.d.cts} +16 -21
- package/node_modules/@dropthis/node/dist/{drops-O6ymlqmb.d.ts → drops-BVoN5MaZ.d.ts} +16 -21
- package/node_modules/@dropthis/node/dist/edge.cjs +33 -22
- 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 +33 -22
- package/node_modules/@dropthis/node/dist/edge.mjs.map +1 -1
- package/node_modules/@dropthis/node/dist/index.cjs +33 -24
- 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 +33 -23
- 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
package/dist/cli.cjs
CHANGED
|
@@ -918,13 +918,13 @@ async function runDoctor(_input, deps) {
|
|
|
918
918
|
const authSource = credential?.source ?? "missing";
|
|
919
919
|
const storageBackend = stored?.storage ?? "none";
|
|
920
920
|
const pairs = [
|
|
921
|
-
["Version", "0.24.
|
|
921
|
+
["Version", "0.24.1"],
|
|
922
922
|
["Auth", authSource],
|
|
923
923
|
["Storage", storageBackend]
|
|
924
924
|
];
|
|
925
925
|
writeKv(deps, pairs, {
|
|
926
926
|
ok: true,
|
|
927
|
-
version: "0.24.
|
|
927
|
+
version: "0.24.1",
|
|
928
928
|
auth: { source: authSource },
|
|
929
929
|
storage: { backend: storageBackend }
|
|
930
930
|
});
|
|
@@ -2777,7 +2777,7 @@ function buildProgram(options = {}) {
|
|
|
2777
2777
|
` ${import_picocolors6.default.cyan("dropthis login")}`,
|
|
2778
2778
|
` ${import_picocolors6.default.cyan("dropthis publish ./dist")}`
|
|
2779
2779
|
].join("\n")
|
|
2780
|
-
).version("0.24.
|
|
2780
|
+
).version("0.24.1").configureHelp({
|
|
2781
2781
|
subcommandTerm(cmd) {
|
|
2782
2782
|
const args = cmd.registeredArguments.map((a) => {
|
|
2783
2783
|
const name = a.name();
|
|
@@ -3379,7 +3379,7 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
|
|
|
3379
3379
|
);
|
|
3380
3380
|
const result = await runUpgrade(commandOptions, {
|
|
3381
3381
|
...deps,
|
|
3382
|
-
currentVersion: "0.24.
|
|
3382
|
+
currentVersion: "0.24.1"
|
|
3383
3383
|
});
|
|
3384
3384
|
process.exitCode = result.exitCode;
|
|
3385
3385
|
});
|
|
@@ -3633,7 +3633,7 @@ var showNotice = shouldShowNotice({
|
|
|
3633
3633
|
if (showNotice) {
|
|
3634
3634
|
const notice = noticeFromCache({
|
|
3635
3635
|
cache: updateCache,
|
|
3636
|
-
currentVersion: "0.24.
|
|
3636
|
+
currentVersion: "0.24.1"
|
|
3637
3637
|
});
|
|
3638
3638
|
if (notice) {
|
|
3639
3639
|
process.stderr.write(`
|
|
@@ -324,19 +324,20 @@ List results support auto-pagination:
|
|
|
324
324
|
|
|
325
325
|
```typescript
|
|
326
326
|
const page = await dropthis.drops.list();
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
console.log(drop.url);
|
|
327
|
+
const all = await page.data.autoPagingToArray({ limit: 100 });
|
|
328
|
+
if (all.error) {
|
|
329
|
+
// a later page failed to fetch — inspect all.error.code / statusCode / requestId
|
|
330
|
+
} else {
|
|
331
|
+
for (const drop of all.data) console.log(drop.url);
|
|
332
332
|
}
|
|
333
333
|
```
|
|
334
334
|
|
|
335
|
-
|
|
336
|
-
`
|
|
337
|
-
|
|
338
|
-
`
|
|
339
|
-
to
|
|
335
|
+
Like every call in this SDK, `autoPagingToArray()` **never throws** for an API error — it
|
|
336
|
+
returns the same `{ data, error }` result shape. On success you get `{ data: items, error: null }`;
|
|
337
|
+
if fetching a later page fails you get `{ data: null, error }` carrying the underlying
|
|
338
|
+
`code` / `statusCode` / `retryable` / `requestId`. So you can never be handed a silently
|
|
339
|
+
truncated list, and you never have to wrap pagination in `try/catch`. (For manual control,
|
|
340
|
+
loop on `dropthis.drops.list({ cursor })` and check each result's `.error`.)
|
|
340
341
|
|
|
341
342
|
> To change a drop's content, use `client.drops.updateContent(dropId, newInput)`. `drops.updateSettings()` is for settings only (title, visibility, password, noindex, expiresAt, metadata).
|
|
342
343
|
|
|
@@ -490,11 +491,11 @@ import type {
|
|
|
490
491
|
} from "@dropthis/node";
|
|
491
492
|
```
|
|
492
493
|
|
|
493
|
-
|
|
494
|
-
|
|
494
|
+
`PublishInputError` (thrown only for programmer errors when building a publish input,
|
|
495
|
+
never for API failures) is a runtime export:
|
|
495
496
|
|
|
496
497
|
```typescript
|
|
497
|
-
import {
|
|
498
|
+
import { PublishInputError } from "@dropthis/node";
|
|
498
499
|
```
|
|
499
500
|
|
|
500
501
|
## Agent skills
|
|
@@ -135,8 +135,7 @@ type ListPage<T> = {
|
|
|
135
135
|
nextCursor: string | null;
|
|
136
136
|
autoPagingToArray(options?: {
|
|
137
137
|
limit?: number;
|
|
138
|
-
}): Promise<T[]
|
|
139
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
138
|
+
}): Promise<DropthisResult<T[]>>;
|
|
140
139
|
};
|
|
141
140
|
type Action = {
|
|
142
141
|
code: string;
|
|
@@ -727,38 +726,34 @@ declare class DomainsResource {
|
|
|
727
726
|
delete(idOrHostname: string): Promise<DropthisResult<DomainDeletedResponse>>;
|
|
728
727
|
}
|
|
729
728
|
|
|
730
|
-
/**
|
|
731
|
-
* Thrown by the auto-pagination iterator (`for await` / `autoPagingToArray`) when
|
|
732
|
-
* fetching a later page fails. Carries the underlying {@link DropthisErrorResponse}
|
|
733
|
-
* on `.error` so an agent can inspect `code`/`statusCode`/`retryable`/`requestId`
|
|
734
|
-
* instead of silently receiving a truncated list. The already-yielded items are not
|
|
735
|
-
* lost — the items consumed before the failure remain consumed; only the continuation
|
|
736
|
-
* rejects.
|
|
737
|
-
*/
|
|
738
|
-
declare class CursorPaginationError extends Error {
|
|
739
|
-
readonly error: DropthisErrorResponse;
|
|
740
|
-
/** Response headers from the failed page fetch (rate-limit, trace, request id). */
|
|
741
|
-
readonly headers: Record<string, string>;
|
|
742
|
-
constructor(error: DropthisErrorResponse,
|
|
743
|
-
/** Response headers from the failed page fetch (rate-limit, trace, request id). */
|
|
744
|
-
headers?: Record<string, string>);
|
|
745
|
-
}
|
|
746
729
|
declare class CursorPage<T> implements ListPage<T> {
|
|
747
730
|
readonly object: "list";
|
|
748
731
|
readonly data: T[];
|
|
749
732
|
readonly hasMore: boolean;
|
|
750
733
|
readonly nextCursor: string | null;
|
|
734
|
+
/** Response headers from the fetch that produced this page. */
|
|
735
|
+
readonly headers: Record<string, string>;
|
|
751
736
|
private readonly fetchNextPage;
|
|
752
737
|
constructor(input: {
|
|
753
738
|
data: T[];
|
|
754
739
|
hasMore: boolean;
|
|
755
740
|
nextCursor: string | null;
|
|
741
|
+
headers?: Record<string, string>;
|
|
756
742
|
fetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;
|
|
757
743
|
});
|
|
744
|
+
/**
|
|
745
|
+
* Collect items across every page into a single array.
|
|
746
|
+
*
|
|
747
|
+
* No-throw, consistent with the rest of the SDK's {@link DropthisResult}
|
|
748
|
+
* contract: returns `{ data: items, error: null }` on success, or
|
|
749
|
+
* `{ data: null, error }` if fetching a later page fails — never a thrown
|
|
750
|
+
* exception, and never a silently truncated list. Inspect `.error`
|
|
751
|
+
* (`code`/`statusCode`/`retryable`/`requestId`) exactly as you would for any
|
|
752
|
+
* other call. Pass `limit` to stop once that many items are collected.
|
|
753
|
+
*/
|
|
758
754
|
autoPagingToArray(options?: {
|
|
759
755
|
limit?: number;
|
|
760
|
-
}): Promise<T[]
|
|
761
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
756
|
+
}): Promise<DropthisResult<T[]>>;
|
|
762
757
|
}
|
|
763
758
|
|
|
764
759
|
/**
|
|
@@ -846,4 +841,4 @@ declare class DropsResource<TInput = PublishInput> {
|
|
|
846
841
|
delete(dropId: string): Promise<DropthisResult<null>>;
|
|
847
842
|
}
|
|
848
843
|
|
|
849
|
-
export { type AccountLimits as A, type
|
|
844
|
+
export { type AccountLimits as A, type PreparedUploadFile as B, type CreateUploadSessionRequest as C, type DeploymentContentFile as D, type EmailOtpResponse as E, type PublishFileInput as F, type GetContentOptions as G, type PublishInput as H, type InMemoryPublishInput as I, type PublishOptions as J, type KeyType as K, type Limitations as L, type RequestOptions as M, type NextHint as N, type RevokeImpact as O, type PrepareOptions as P, type SessionResponse as Q, type RequestControls as R, SHARED_POOL as S, type TierInfo as T, Transport as U, type UpdateContentOptions as V, type UploadManifestFile as W, type UploadSessionFileResponse as X, type UploadSessionResponse as Y, type UploadTarget as Z, AccountResource as a, type AccountResponse as b, type ActionResolve as c, ApiKeysResource as d, type CreateUploadSessionResponse as e, CursorPage as f, type DeploymentContentManifest as g, DeploymentsResource as h, type DnsRecord as i, type DomainDeletedResponse as j, type DomainListResponse as k, type DomainResponse as l, DomainsResource as m, type DropAction as n, type DropContentFile as o, type DropDeploymentResponse as p, type DropOptions as q, type DropResponse as r, DropsResource as s, type DropthisClientOptions as t, type DropthisErrorResponse as u, type DropthisResult as v, type ListDeploymentsParams as w, type ListDeploymentsResponse as x, type ListPage as y, type PreparedPublishRequest as z };
|
|
@@ -135,8 +135,7 @@ type ListPage<T> = {
|
|
|
135
135
|
nextCursor: string | null;
|
|
136
136
|
autoPagingToArray(options?: {
|
|
137
137
|
limit?: number;
|
|
138
|
-
}): Promise<T[]
|
|
139
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
138
|
+
}): Promise<DropthisResult<T[]>>;
|
|
140
139
|
};
|
|
141
140
|
type Action = {
|
|
142
141
|
code: string;
|
|
@@ -727,38 +726,34 @@ declare class DomainsResource {
|
|
|
727
726
|
delete(idOrHostname: string): Promise<DropthisResult<DomainDeletedResponse>>;
|
|
728
727
|
}
|
|
729
728
|
|
|
730
|
-
/**
|
|
731
|
-
* Thrown by the auto-pagination iterator (`for await` / `autoPagingToArray`) when
|
|
732
|
-
* fetching a later page fails. Carries the underlying {@link DropthisErrorResponse}
|
|
733
|
-
* on `.error` so an agent can inspect `code`/`statusCode`/`retryable`/`requestId`
|
|
734
|
-
* instead of silently receiving a truncated list. The already-yielded items are not
|
|
735
|
-
* lost — the items consumed before the failure remain consumed; only the continuation
|
|
736
|
-
* rejects.
|
|
737
|
-
*/
|
|
738
|
-
declare class CursorPaginationError extends Error {
|
|
739
|
-
readonly error: DropthisErrorResponse;
|
|
740
|
-
/** Response headers from the failed page fetch (rate-limit, trace, request id). */
|
|
741
|
-
readonly headers: Record<string, string>;
|
|
742
|
-
constructor(error: DropthisErrorResponse,
|
|
743
|
-
/** Response headers from the failed page fetch (rate-limit, trace, request id). */
|
|
744
|
-
headers?: Record<string, string>);
|
|
745
|
-
}
|
|
746
729
|
declare class CursorPage<T> implements ListPage<T> {
|
|
747
730
|
readonly object: "list";
|
|
748
731
|
readonly data: T[];
|
|
749
732
|
readonly hasMore: boolean;
|
|
750
733
|
readonly nextCursor: string | null;
|
|
734
|
+
/** Response headers from the fetch that produced this page. */
|
|
735
|
+
readonly headers: Record<string, string>;
|
|
751
736
|
private readonly fetchNextPage;
|
|
752
737
|
constructor(input: {
|
|
753
738
|
data: T[];
|
|
754
739
|
hasMore: boolean;
|
|
755
740
|
nextCursor: string | null;
|
|
741
|
+
headers?: Record<string, string>;
|
|
756
742
|
fetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;
|
|
757
743
|
});
|
|
744
|
+
/**
|
|
745
|
+
* Collect items across every page into a single array.
|
|
746
|
+
*
|
|
747
|
+
* No-throw, consistent with the rest of the SDK's {@link DropthisResult}
|
|
748
|
+
* contract: returns `{ data: items, error: null }` on success, or
|
|
749
|
+
* `{ data: null, error }` if fetching a later page fails — never a thrown
|
|
750
|
+
* exception, and never a silently truncated list. Inspect `.error`
|
|
751
|
+
* (`code`/`statusCode`/`retryable`/`requestId`) exactly as you would for any
|
|
752
|
+
* other call. Pass `limit` to stop once that many items are collected.
|
|
753
|
+
*/
|
|
758
754
|
autoPagingToArray(options?: {
|
|
759
755
|
limit?: number;
|
|
760
|
-
}): Promise<T[]
|
|
761
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
756
|
+
}): Promise<DropthisResult<T[]>>;
|
|
762
757
|
}
|
|
763
758
|
|
|
764
759
|
/**
|
|
@@ -846,4 +841,4 @@ declare class DropsResource<TInput = PublishInput> {
|
|
|
846
841
|
delete(dropId: string): Promise<DropthisResult<null>>;
|
|
847
842
|
}
|
|
848
843
|
|
|
849
|
-
export { type AccountLimits as A, type
|
|
844
|
+
export { type AccountLimits as A, type PreparedUploadFile as B, type CreateUploadSessionRequest as C, type DeploymentContentFile as D, type EmailOtpResponse as E, type PublishFileInput as F, type GetContentOptions as G, type PublishInput as H, type InMemoryPublishInput as I, type PublishOptions as J, type KeyType as K, type Limitations as L, type RequestOptions as M, type NextHint as N, type RevokeImpact as O, type PrepareOptions as P, type SessionResponse as Q, type RequestControls as R, SHARED_POOL as S, type TierInfo as T, Transport as U, type UpdateContentOptions as V, type UploadManifestFile as W, type UploadSessionFileResponse as X, type UploadSessionResponse as Y, type UploadTarget as Z, AccountResource as a, type AccountResponse as b, type ActionResolve as c, ApiKeysResource as d, type CreateUploadSessionResponse as e, CursorPage as f, type DeploymentContentManifest as g, DeploymentsResource as h, type DnsRecord as i, type DomainDeletedResponse as j, type DomainListResponse as k, type DomainResponse as l, DomainsResource as m, type DropAction as n, type DropContentFile as o, type DropDeploymentResponse as p, type DropOptions as q, type DropResponse as r, DropsResource as s, type DropthisClientOptions as t, type DropthisErrorResponse as u, type DropthisResult as v, type ListDeploymentsParams as w, type ListDeploymentsResponse as x, type ListPage as y, type PreparedPublishRequest as z };
|
|
@@ -631,45 +631,55 @@ var DomainsResource = class {
|
|
|
631
631
|
};
|
|
632
632
|
|
|
633
633
|
// src/pagination.ts
|
|
634
|
-
var CursorPaginationError = class extends Error {
|
|
635
|
-
constructor(error, headers = {}) {
|
|
636
|
-
super(`Failed to fetch next page: ${error.code} \u2014 ${error.message}`);
|
|
637
|
-
this.error = error;
|
|
638
|
-
this.headers = headers;
|
|
639
|
-
this.name = "CursorPaginationError";
|
|
640
|
-
}
|
|
641
|
-
error;
|
|
642
|
-
headers;
|
|
643
|
-
};
|
|
644
634
|
var CursorPage = class {
|
|
645
635
|
object = "list";
|
|
646
636
|
data;
|
|
647
637
|
hasMore;
|
|
648
638
|
nextCursor;
|
|
639
|
+
/** Response headers from the fetch that produced this page. */
|
|
640
|
+
headers;
|
|
649
641
|
fetchNextPage;
|
|
650
642
|
constructor(input) {
|
|
651
643
|
this.data = input.data;
|
|
652
644
|
this.hasMore = input.hasMore;
|
|
653
645
|
this.nextCursor = input.nextCursor;
|
|
646
|
+
this.headers = input.headers ?? {};
|
|
654
647
|
this.fetchNextPage = input.fetchNextPage;
|
|
655
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Collect items across every page into a single array.
|
|
651
|
+
*
|
|
652
|
+
* No-throw, consistent with the rest of the SDK's {@link DropthisResult}
|
|
653
|
+
* contract: returns `{ data: items, error: null }` on success, or
|
|
654
|
+
* `{ data: null, error }` if fetching a later page fails — never a thrown
|
|
655
|
+
* exception, and never a silently truncated list. Inspect `.error`
|
|
656
|
+
* (`code`/`statusCode`/`retryable`/`requestId`) exactly as you would for any
|
|
657
|
+
* other call. Pass `limit` to stop once that many items are collected.
|
|
658
|
+
*/
|
|
656
659
|
async autoPagingToArray(options = {}) {
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
if (options.limit !== void 0 && items.length >= options.limit) break;
|
|
660
|
+
const { limit } = options;
|
|
661
|
+
if (limit !== void 0 && limit <= 0) {
|
|
662
|
+
return { data: [], error: null, headers: this.headers };
|
|
661
663
|
}
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
async *[Symbol.asyncIterator]() {
|
|
665
|
-
for (const item of this.data) yield item;
|
|
664
|
+
const items = [];
|
|
666
665
|
let current = this;
|
|
667
|
-
|
|
666
|
+
let lastHeaders = this.headers;
|
|
667
|
+
while (current) {
|
|
668
|
+
for (const item of current.data) {
|
|
669
|
+
items.push(item);
|
|
670
|
+
if (limit !== void 0 && items.length >= limit) {
|
|
671
|
+
return { data: items, error: null, headers: lastHeaders };
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (!current.hasMore || !current.fetchNextPage) break;
|
|
668
675
|
const next = await current.fetchNextPage();
|
|
669
|
-
if (next.error)
|
|
676
|
+
if (next.error) {
|
|
677
|
+
return { data: null, error: next.error, headers: next.headers };
|
|
678
|
+
}
|
|
679
|
+
lastHeaders = next.headers;
|
|
670
680
|
current = next.data;
|
|
671
|
-
for (const item of current.data) yield item;
|
|
672
681
|
}
|
|
682
|
+
return { data: items, error: null, headers: lastHeaders };
|
|
673
683
|
}
|
|
674
684
|
};
|
|
675
685
|
|
|
@@ -738,6 +748,7 @@ var DropsResource = class {
|
|
|
738
748
|
data: result.data.drops,
|
|
739
749
|
nextCursor: result.data.nextCursor,
|
|
740
750
|
hasMore: result.data.nextCursor !== null,
|
|
751
|
+
headers: result.headers,
|
|
741
752
|
fetchNextPage: result.data.nextCursor ? () => this.list({ ...params, cursor: result.data.nextCursor }) : void 0
|
|
742
753
|
});
|
|
743
754
|
return { data: page, error: null, headers: result.headers };
|
|
@@ -881,7 +892,7 @@ function toSnakeCase(value) {
|
|
|
881
892
|
|
|
882
893
|
// src/transport.ts
|
|
883
894
|
var DEFAULT_BASE_URL = "https://api.dropthis.app";
|
|
884
|
-
var SDK_VERSION = "0.
|
|
895
|
+
var SDK_VERSION = "0.22.0";
|
|
885
896
|
var Transport = class {
|
|
886
897
|
apiKey;
|
|
887
898
|
baseUrl;
|