@heroku/sdk 0.8.1 → 0.9.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,8 +1,15 @@
1
- import type { BackupCreateResult, TransferInfoByAppResult } from '@heroku/types/data';
1
+ import type { TransferInfoByAppResult } from '@heroku/types/data';
2
2
  import type { ResourceCtx } from '../../../core/extend-resource.js';
3
3
  import type { ResolvedPgDatabase } from '../internal/resolve-pg-database.js';
4
- import type { WaitForTransferOptions } from '../wait-for-transfer.js';
4
+ import type { WaitForTransferOptions } from './wait-for-transfer.js';
5
5
  import { Poller } from '../../../utils/poller.js';
6
+ /**
7
+ * `data.backup.create`'s declared return type, `BackupCreateResult`, only
8
+ * lists `uuid`/`from_type`/`to_type`, but the actual response includes the
9
+ * full transfer record. Widen the type here so callers (e.g. `waitPoller`) can
10
+ * use the full transfer record.
11
+ */
12
+ export type BackupCreateInfo = TransferInfoByAppResult;
6
13
  export type CaptureAndWaitOptions = WaitForTransferOptions & {
7
14
  /**
8
15
  * Progress hooks fired once before capturing the backup `poller.onStart(addon)`
@@ -14,6 +21,6 @@ export type CaptureAndWaitOptions = WaitForTransferOptions & {
14
21
  * complete `poller.onStart(backup)` and once after the transfer
15
22
  * finishes successfully `poller.onStop(backup)`.
16
23
  */
17
- waitPoller?: Poller<BackupCreateResult>;
24
+ waitPoller?: Poller<BackupCreateInfo>;
18
25
  };
19
26
  export declare function captureAndWait(ctx: Pick<ResourceCtx, 'data' | 'platform'>, appIdentity: string, addonIdentity?: string, options?: CaptureAndWaitOptions): Promise<TransferInfoByAppResult>;
@@ -1,5 +1,5 @@
1
1
  import { resolvePgDatabase } from '../internal/resolve-pg-database.js';
2
- import { waitForTransfer } from '../wait-for-transfer.js';
2
+ import { waitForTransfer } from './wait-for-transfer.js';
3
3
  export async function captureAndWait(ctx, appIdentity, addonIdentity, options = {}) {
4
4
  const { capturePoller, signal, waitPoller } = options;
5
5
  signal?.throwIfAborted();
@@ -0,0 +1,11 @@
1
+ import type { CaptureAndWaitOptions } from './capture-and-wait.js';
2
+ import type { RestoreAndWaitOptions } from './restore-and-wait.js';
3
+ export { captureAndWait, type CaptureAndWaitOptions } from './capture-and-wait.js';
4
+ export { restoreAndWait, type RestoreAndWaitOptions } from './restore-and-wait.js';
5
+ export { transferExtensions, TransferFailedError, TransferTimeoutError, type WaitForTransferOptions, } from './wait-for-transfer.js';
6
+ export declare const restoreExtensions: import("../../../core/extend-resource.js").ResourceExtension<"data", "restore", {
7
+ restoreAndWait: (appIdentity: string, addonIdentity: string | undefined, backupUrl: string, options?: RestoreAndWaitOptions) => Promise<import("@heroku/types/data").TransferInfoByAppResult>;
8
+ }>;
9
+ export declare const backupExtensions: import("../../../core/extend-resource.js").ResourceExtension<"data", "backup", {
10
+ captureAndWait: (appIdentity: string, addonIdentity?: string, options?: CaptureAndWaitOptions) => Promise<import("@heroku/types/data").TransferInfoByAppResult>;
11
+ }>;
@@ -0,0 +1,12 @@
1
+ import { extendResource } from '../../../core/extend-resource.js';
2
+ import { captureAndWait } from './capture-and-wait.js';
3
+ import { restoreAndWait } from './restore-and-wait.js';
4
+ export { captureAndWait } from './capture-and-wait.js';
5
+ export { restoreAndWait } from './restore-and-wait.js';
6
+ export { transferExtensions, TransferFailedError, TransferTimeoutError, } from './wait-for-transfer.js';
7
+ export const restoreExtensions = extendResource('data', 'restore', ctx => ({
8
+ restoreAndWait: (appIdentity, addonIdentity, backupUrl, options) => restoreAndWait(ctx, appIdentity, addonIdentity, backupUrl, options),
9
+ }));
10
+ export const backupExtensions = extendResource('data', 'backup', ctx => ({
11
+ captureAndWait: (appIdentity, addonIdentity, options) => captureAndWait(ctx, appIdentity, addonIdentity, options),
12
+ }));
@@ -1,8 +1,15 @@
1
- import type { RestoreCreateResult, TransferInfoByAppResult } from '@heroku/types/data';
1
+ import type { TransferInfoByAppResult } from '@heroku/types/data';
2
2
  import type { ResourceCtx } from '../../../core/extend-resource.js';
3
3
  import type { ResolvedPgDatabase } from '../internal/resolve-pg-database.js';
4
- import type { WaitForTransferOptions } from '../wait-for-transfer.js';
4
+ import type { WaitForTransferOptions } from './wait-for-transfer.js';
5
5
  import { Poller } from '../../../utils/poller.js';
6
+ /**
7
+ * `data.restore.create`'s declared return type, `RestoreCreateResult`, only
8
+ * lists `uuid`/`from_type`/`to_type`, but the actual response includes the
9
+ * full transfer record. Widen the type here so callers (e.g. `waitPoller`) can
10
+ * use the full transfer record.
11
+ */
12
+ export type RestoreCreateInfo = TransferInfoByAppResult;
6
13
  export type RestoreAndWaitOptions = WaitForTransferOptions & {
7
14
  /**
8
15
  * Extension names to preinstall on the restore target.
@@ -19,6 +26,6 @@ export type RestoreAndWaitOptions = WaitForTransferOptions & {
19
26
  * complete `poller.onStart(restore)` and once after the restore
20
27
  * reaches a terminal state `poller.onStop(restore)`.
21
28
  */
22
- waitPoller?: Poller<RestoreCreateResult>;
29
+ waitPoller?: Poller<RestoreCreateInfo>;
23
30
  };
24
31
  export declare function restoreAndWait(ctx: Pick<ResourceCtx, 'data' | 'platform'>, appIdentity: string, addonIdentity: string | undefined, backupUrl: string, options?: RestoreAndWaitOptions): Promise<TransferInfoByAppResult>;
@@ -1,5 +1,5 @@
1
1
  import { resolvePgDatabase } from '../internal/resolve-pg-database.js';
2
- import { waitForTransfer } from '../wait-for-transfer.js';
2
+ import { waitForTransfer } from './wait-for-transfer.js';
3
3
  export async function restoreAndWait(ctx, appIdentity, addonIdentity, backupUrl, options = {}) {
4
4
  const { extensions, restorePoller, signal, waitPoller } = options;
5
5
  signal?.throwIfAborted();
@@ -1,5 +1,5 @@
1
1
  import type { TransferInfoByAppResult } from '@heroku/types/data';
2
- import type { ResourceCtx } from '../../core/extend-resource.js';
2
+ import type { ResourceCtx } from '../../../core/extend-resource.js';
3
3
  /**
4
4
  * Thrown by `waitForTransfer` when the transfer reaches a terminal state
5
5
  * with `succeeded: false`.
@@ -59,6 +59,6 @@ export type WaitForTransferOptions = {
59
59
  * if the transfer does not finish before timeout.
60
60
  */
61
61
  export declare function waitForTransfer(ctx: Pick<ResourceCtx, 'data'>, appIdentity: string, transferId: string, options?: WaitForTransferOptions): Promise<TransferInfoByAppResult>;
62
- export declare const transferExtensions: import("../../core/extend-resource.js").ResourceExtension<"data", "transfer", {
62
+ export declare const transferExtensions: import("../../../core/extend-resource.js").ResourceExtension<"data", "transfer", {
63
63
  waitForTransfer: (appIdentity: string, transferId: string, options?: WaitForTransferOptions) => Promise<TransferInfoByAppResult>;
64
64
  }>;
@@ -1,5 +1,5 @@
1
- import { extendResource } from '../../core/extend-resource.js';
2
- import { wait } from '../../utils/wait.js';
1
+ import { extendResource } from '../../../core/extend-resource.js';
2
+ import { wait } from '../../../utils/wait.js';
3
3
  const DEFAULT_INTERVAL_MS = 3000;
4
4
  const MAX_FAILURES = 20;
5
5
  /**
@@ -1,8 +1,6 @@
1
- export { backupExtensions } from '../data/backup/index.js';
2
1
  export { databaseExtensions } from '../data/database.js';
3
2
  export { maintenanceExtensions } from '../data/maintenance.js';
4
3
  export { postgresDatabaseExtensions } from '../data/postgres-database.js';
5
4
  export { redisExtensions } from '../data/redis/index.js';
6
- export { restoreExtensions } from '../data/restore/index.js';
7
5
  export { type TransferSchedule, transferScheduleExtensions } from '../data/transfer-schedule.js';
8
- export { transferExtensions, TransferFailedError, TransferTimeoutError, } from '../data/wait-for-transfer.js';
6
+ export { backupExtensions, type CaptureAndWaitOptions, type RestoreAndWaitOptions, restoreExtensions, transferExtensions, TransferFailedError, TransferTimeoutError, type WaitForTransferOptions, } from '../data/transfer/index.js';
@@ -1,8 +1,6 @@
1
- export { backupExtensions } from '../data/backup/index.js';
2
1
  export { databaseExtensions } from '../data/database.js';
3
2
  export { maintenanceExtensions } from '../data/maintenance.js';
4
3
  export { postgresDatabaseExtensions } from '../data/postgres-database.js';
5
4
  export { redisExtensions } from '../data/redis/index.js';
6
- export { restoreExtensions } from '../data/restore/index.js';
7
5
  export { transferScheduleExtensions } from '../data/transfer-schedule.js';
8
- export { transferExtensions, TransferFailedError, TransferTimeoutError, } from '../data/wait-for-transfer.js';
6
+ export { backupExtensions, restoreExtensions, transferExtensions, TransferFailedError, TransferTimeoutError, } from '../data/transfer/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/sdk",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Heroku SDK",
5
5
  "author": "Heroku",
6
6
  "type": "module",
@@ -102,17 +102,13 @@
102
102
  "types": "./dist/resources/platform/vpn-connection/index.d.ts",
103
103
  "default": "./dist/resources/platform/vpn-connection/index.js"
104
104
  },
105
- "./resources/data/backup": {
106
- "types": "./dist/resources/data/backup/index.d.ts",
107
- "default": "./dist/resources/data/backup/index.js"
108
- },
109
105
  "./resources/data/redis": {
110
106
  "types": "./dist/resources/data/redis/index.d.ts",
111
107
  "default": "./dist/resources/data/redis/index.js"
112
108
  },
113
- "./resources/data/restore": {
114
- "types": "./dist/resources/data/restore/index.d.ts",
115
- "default": "./dist/resources/data/restore/index.js"
109
+ "./resources/data/transfer": {
110
+ "types": "./dist/resources/data/transfer/index.d.ts",
111
+ "default": "./dist/resources/data/transfer/index.js"
116
112
  },
117
113
  "./resources/*": {
118
114
  "types": "./dist/resources/*.d.ts",
@@ -1,5 +0,0 @@
1
- import type { CaptureAndWaitOptions } from './capture-and-wait.js';
2
- export { captureAndWait, type CaptureAndWaitOptions } from './capture-and-wait.js';
3
- export declare const backupExtensions: import("../../../core/extend-resource.js").ResourceExtension<"data", "backup", {
4
- captureAndWait: (appIdentity: string, addonIdentity?: string, options?: CaptureAndWaitOptions) => Promise<import("@heroku/types/data").TransferInfoByAppResult>;
5
- }>;
@@ -1,6 +0,0 @@
1
- import { extendResource } from '../../../core/extend-resource.js';
2
- import { captureAndWait } from './capture-and-wait.js';
3
- export { captureAndWait } from './capture-and-wait.js';
4
- export const backupExtensions = extendResource('data', 'backup', ctx => ({
5
- captureAndWait: (appIdentity, addonIdentity, options) => captureAndWait(ctx, appIdentity, addonIdentity, options),
6
- }));
@@ -1,5 +0,0 @@
1
- import type { RestoreAndWaitOptions } from './restore-and-wait.js';
2
- export { restoreAndWait, type RestoreAndWaitOptions } from './restore-and-wait.js';
3
- export declare const restoreExtensions: import("../../../core/extend-resource.js").ResourceExtension<"data", "restore", {
4
- restoreAndWait: (appIdentity: string, addonIdentity: string | undefined, backupUrl: string, options?: RestoreAndWaitOptions) => Promise<import("@heroku/types/data").TransferInfoByAppResult>;
5
- }>;
@@ -1,6 +0,0 @@
1
- import { extendResource } from '../../../core/extend-resource.js';
2
- import { restoreAndWait } from './restore-and-wait.js';
3
- export { restoreAndWait } from './restore-and-wait.js';
4
- export const restoreExtensions = extendResource('data', 'restore', ctx => ({
5
- restoreAndWait: (appIdentity, addonIdentity, backupUrl, options) => restoreAndWait(ctx, appIdentity, addonIdentity, backupUrl, options),
6
- }));