@dropthis/cli 0.24.0 → 0.25.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.
@@ -1,5 +1,5 @@
1
- import { V as Transport, w as DropthisResult, E as EmailOtpResponse, T as SessionResponse, C as CreateUploadSessionRequest, e as CreateUploadSessionResponse, Z as UploadSessionResponse, u as DropthisClientOptions, d as ApiKeysResource, a as AccountResource, t as DropsResource, J as PublishInput, i as DeploymentsResource, n as DomainsResource, M as PublishOptions, B as PreparedPublishRequest } from './drops-O6ymlqmb.cjs';
2
- export { A as AccountLimits, b as AccountResponse, c as ActionResolve, f as CursorPage, g as CursorPaginationError, 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, v as DropthisErrorResponse, G as GetContentOptions, I as InMemoryPublishInput, K as KeyType, L as Limitations, x as ListDeploymentsParams, y as ListDeploymentsResponse, z as ListPage, N as NextHint, P as PrepareOptions, F as PreparedUploadFile, H as PublishFileInput, R as RequestControls, O as RequestOptions, Q as RevokeImpact, S as SHARED_POOL, U as TierInfo, W as UpdateContentOptions, X as UploadManifestFile, Y as UploadSessionFileResponse, _ as UploadTarget } from './drops-O6ymlqmb.cjs';
1
+ import { U as Transport, v as DropthisResult, E as EmailOtpResponse, Q as SessionResponse, C as CreateUploadSessionRequest, e as CreateUploadSessionResponse, Y as UploadSessionResponse, t as DropthisClientOptions, d as ApiKeysResource, a as AccountResource, s as DropsResource, H as PublishInput, h as DeploymentsResource, m as DomainsResource, J as PublishOptions, z as PreparedPublishRequest } from './drops-BVoN5MaZ.cjs';
2
+ export { A as AccountLimits, b as AccountResponse, c as ActionResolve, f as CursorPage, D as DeploymentContentFile, g as DeploymentContentManifest, i as DnsRecord, j as DomainDeletedResponse, k as DomainListResponse, l as DomainResponse, n as DropAction, o as DropContentFile, p as DropDeploymentResponse, q as DropOptions, r as DropResponse, u as DropthisErrorResponse, G as GetContentOptions, I as InMemoryPublishInput, K as KeyType, L as Limitations, w as ListDeploymentsParams, x as ListDeploymentsResponse, y as ListPage, N as NextHint, P as PrepareOptions, B as PreparedUploadFile, F as PublishFileInput, R as RequestControls, M as RequestOptions, O as RevokeImpact, S as SHARED_POOL, T as TierInfo, V as UpdateContentOptions, W as UploadManifestFile, X as UploadSessionFileResponse, Z as UploadTarget } from './drops-BVoN5MaZ.cjs';
3
3
 
4
4
  declare class AuthResource {
5
5
  private readonly transport;
@@ -1,5 +1,5 @@
1
- import { V as Transport, w as DropthisResult, E as EmailOtpResponse, T as SessionResponse, C as CreateUploadSessionRequest, e as CreateUploadSessionResponse, Z as UploadSessionResponse, u as DropthisClientOptions, d as ApiKeysResource, a as AccountResource, t as DropsResource, J as PublishInput, i as DeploymentsResource, n as DomainsResource, M as PublishOptions, B as PreparedPublishRequest } from './drops-O6ymlqmb.js';
2
- export { A as AccountLimits, b as AccountResponse, c as ActionResolve, f as CursorPage, g as CursorPaginationError, 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, v as DropthisErrorResponse, G as GetContentOptions, I as InMemoryPublishInput, K as KeyType, L as Limitations, x as ListDeploymentsParams, y as ListDeploymentsResponse, z as ListPage, N as NextHint, P as PrepareOptions, F as PreparedUploadFile, H as PublishFileInput, R as RequestControls, O as RequestOptions, Q as RevokeImpact, S as SHARED_POOL, U as TierInfo, W as UpdateContentOptions, X as UploadManifestFile, Y as UploadSessionFileResponse, _ as UploadTarget } from './drops-O6ymlqmb.js';
1
+ import { U as Transport, v as DropthisResult, E as EmailOtpResponse, Q as SessionResponse, C as CreateUploadSessionRequest, e as CreateUploadSessionResponse, Y as UploadSessionResponse, t as DropthisClientOptions, d as ApiKeysResource, a as AccountResource, s as DropsResource, H as PublishInput, h as DeploymentsResource, m as DomainsResource, J as PublishOptions, z as PreparedPublishRequest } from './drops-BVoN5MaZ.js';
2
+ export { A as AccountLimits, b as AccountResponse, c as ActionResolve, f as CursorPage, D as DeploymentContentFile, g as DeploymentContentManifest, i as DnsRecord, j as DomainDeletedResponse, k as DomainListResponse, l as DomainResponse, n as DropAction, o as DropContentFile, p as DropDeploymentResponse, q as DropOptions, r as DropResponse, u as DropthisErrorResponse, G as GetContentOptions, I as InMemoryPublishInput, K as KeyType, L as Limitations, w as ListDeploymentsParams, x as ListDeploymentsResponse, y as ListPage, N as NextHint, P as PrepareOptions, B as PreparedUploadFile, F as PublishFileInput, R as RequestControls, M as RequestOptions, O as RevokeImpact, S as SHARED_POOL, T as TierInfo, V as UpdateContentOptions, W as UploadManifestFile, X as UploadSessionFileResponse, Z as UploadTarget } from './drops-BVoN5MaZ.js';
3
3
 
4
4
  declare class AuthResource {
5
5
  private readonly transport;
@@ -811,45 +811,55 @@ var DomainsResource = class {
811
811
  };
812
812
 
813
813
  // src/pagination.ts
814
- var CursorPaginationError = class extends Error {
815
- constructor(error, headers = {}) {
816
- super(`Failed to fetch next page: ${error.code} \u2014 ${error.message}`);
817
- this.error = error;
818
- this.headers = headers;
819
- this.name = "CursorPaginationError";
820
- }
821
- error;
822
- headers;
823
- };
824
814
  var CursorPage = class {
825
815
  object = "list";
826
816
  data;
827
817
  hasMore;
828
818
  nextCursor;
819
+ /** Response headers from the fetch that produced this page. */
820
+ headers;
829
821
  fetchNextPage;
830
822
  constructor(input) {
831
823
  this.data = input.data;
832
824
  this.hasMore = input.hasMore;
833
825
  this.nextCursor = input.nextCursor;
826
+ this.headers = input.headers ?? {};
834
827
  this.fetchNextPage = input.fetchNextPage;
835
828
  }
829
+ /**
830
+ * Collect items across every page into a single array.
831
+ *
832
+ * No-throw, consistent with the rest of the SDK's {@link DropthisResult}
833
+ * contract: returns `{ data: items, error: null }` on success, or
834
+ * `{ data: null, error }` if fetching a later page fails — never a thrown
835
+ * exception, and never a silently truncated list. Inspect `.error`
836
+ * (`code`/`statusCode`/`retryable`/`requestId`) exactly as you would for any
837
+ * other call. Pass `limit` to stop once that many items are collected.
838
+ */
836
839
  async autoPagingToArray(options = {}) {
837
- const items = [];
838
- for await (const item of this) {
839
- items.push(item);
840
- if (options.limit !== void 0 && items.length >= options.limit) break;
840
+ const { limit } = options;
841
+ if (limit !== void 0 && limit <= 0) {
842
+ return { data: [], error: null, headers: this.headers };
841
843
  }
842
- return items;
843
- }
844
- async *[Symbol.asyncIterator]() {
845
- for (const item of this.data) yield item;
844
+ const items = [];
846
845
  let current = this;
847
- while (current.hasMore && current.fetchNextPage) {
846
+ let lastHeaders = this.headers;
847
+ while (current) {
848
+ for (const item of current.data) {
849
+ items.push(item);
850
+ if (limit !== void 0 && items.length >= limit) {
851
+ return { data: items, error: null, headers: lastHeaders };
852
+ }
853
+ }
854
+ if (!current.hasMore || !current.fetchNextPage) break;
848
855
  const next = await current.fetchNextPage();
849
- if (next.error) throw new CursorPaginationError(next.error, next.headers);
856
+ if (next.error) {
857
+ return { data: null, error: next.error, headers: next.headers };
858
+ }
859
+ lastHeaders = next.headers;
850
860
  current = next.data;
851
- for (const item of current.data) yield item;
852
861
  }
862
+ return { data: items, error: null, headers: lastHeaders };
853
863
  }
854
864
  };
855
865
 
@@ -918,6 +928,7 @@ var DropsResource = class {
918
928
  data: result.data.drops,
919
929
  nextCursor: result.data.nextCursor,
920
930
  hasMore: result.data.nextCursor !== null,
931
+ headers: result.headers,
921
932
  fetchNextPage: result.data.nextCursor ? () => this.list({ ...params, cursor: result.data.nextCursor }) : void 0
922
933
  });
923
934
  return { data: page, error: null, headers: result.headers };
@@ -1101,7 +1112,7 @@ function toSnakeCase(value) {
1101
1112
 
1102
1113
  // src/transport.ts
1103
1114
  var DEFAULT_BASE_URL = "https://api.dropthis.app";
1104
- var SDK_VERSION = "0.21.0";
1115
+ var SDK_VERSION = "0.22.0";
1105
1116
  var Transport = class {
1106
1117
  apiKey;
1107
1118
  baseUrl;
@@ -1395,7 +1406,6 @@ var Dropthis = class {
1395
1406
  var SHARED_POOL = "shared";
1396
1407
  export {
1397
1408
  CursorPage,
1398
- CursorPaginationError,
1399
1409
  DeploymentsResource,
1400
1410
  DomainsResource,
1401
1411
  Dropthis,