@heroku/sdk 0.12.2 → 0.12.4
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/resources/data/database-credential/index.d.ts +0 -1
- package/dist/resources/data/database-credential/index.js +0 -1
- package/dist/resources/data/database-credential/list.d.ts +0 -15
- package/dist/resources/data/database-credential/list.js +2 -20
- package/dist/resources/data/database-credential/rotate.d.ts +1 -3
- package/dist/resources/data/internal/postgres-utils.d.ts +27 -11
- package/dist/resources/data/internal/postgres-utils.js +19 -7
- package/dist/resources/data/internal/resolve-pg-database.js +2 -2
- package/dist/resources/data/postgres-database.d.ts +107 -1
- package/dist/resources/data/postgres-database.js +207 -1
- package/dist/resources/data/postgres-migration.d.ts +182 -0
- package/dist/resources/data/postgres-migration.js +313 -0
- package/dist/resources/data/postgres-pool.d.ts +77 -0
- package/dist/resources/data/postgres-pool.js +50 -0
- package/dist/resources/data/postgres-quota.d.ts +45 -0
- package/dist/resources/data/postgres-quota.js +61 -0
- package/dist/resources/data/postgres-settings.d.ts +33 -0
- package/dist/resources/data/postgres-settings.js +47 -0
- package/dist/resources/data/postgres.d.ts +229 -0
- package/dist/resources/data/postgres.js +273 -0
- package/dist/resources/data/redis/index.d.ts +1 -1
- package/dist/resources/extensions/data.d.ts +5 -0
- package/dist/resources/extensions/data.js +5 -0
- package/dist/resources/platform/add-on/destroy-and-wait.d.ts +2 -3
- package/dist/resources/platform/add-on/destroy-and-wait.js +7 -1
- package/dist/resources/platform/add-on/errors.d.ts +35 -2
- package/dist/resources/platform/add-on/errors.js +52 -0
- package/dist/resources/platform/add-on/index.d.ts +3 -3
- package/dist/resources/platform/add-on/index.js +1 -1
- package/dist/resources/platform/add-on/types.d.ts +14 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,11 @@ export { databaseCredentialExtensions } from '../data/database-credential/index.
|
|
|
2
2
|
export { databaseExtensions } from '../data/database.js';
|
|
3
3
|
export { maintenanceExtensions } from '../data/maintenance.js';
|
|
4
4
|
export { postgresDatabaseExtensions } from '../data/postgres-database.js';
|
|
5
|
+
export { isCancellable, isRunnable, MigrationInvalidError, MigrationNotCancellableError, MigrationNotRunnableError, postgresMigrationExtensions, } from '../data/postgres-migration.js';
|
|
6
|
+
export { LEADER_POOL_NAME, MAX_POOL_INSTANCES, postgresPoolExtensions, } from '../data/postgres-pool.js';
|
|
7
|
+
export { postgresQuotaExtensions } from '../data/postgres-quota.js';
|
|
8
|
+
export { postgresSettingsExtensions } from '../data/postgres-settings.js';
|
|
9
|
+
export { postgresExtensions, } from '../data/postgres.js';
|
|
5
10
|
export { redisExtensions } from '../data/redis/index.js';
|
|
6
11
|
export { transferScheduleExtensions } from '../data/transfer-schedule.js';
|
|
7
12
|
export { backupExtensions, restoreExtensions, transferExtensions, TransferFailedError, TransferTimeoutError, } from '../data/transfer/index.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { AddOn } from '@heroku/types/3.sdk';
|
|
2
1
|
import type { ResourceCtx } from '../../../core/extend-resource.js';
|
|
3
|
-
import type { DestroyAndWaitOptions } from './types.js';
|
|
2
|
+
import type { DeprovisioningAddOn, DestroyAndWaitOptions } from './types.js';
|
|
4
3
|
/**
|
|
5
4
|
* Delete an add-on and optionally wait for deprovisioning to complete.
|
|
6
5
|
*
|
|
@@ -19,4 +18,4 @@ import type { DestroyAndWaitOptions } from './types.js';
|
|
|
19
18
|
*
|
|
20
19
|
* Both the delete and the poll requests send `Accept-Expansion: plan`.
|
|
21
20
|
*/
|
|
22
|
-
export declare function destroyAndWait(ctx: Pick<ResourceCtx, 'platform'>, appIdentity: string, addonIdentity: string, options?: DestroyAndWaitOptions): Promise<
|
|
21
|
+
export declare function destroyAndWait(ctx: Pick<ResourceCtx, 'platform'>, appIdentity: string, addonIdentity: string, options?: DestroyAndWaitOptions): Promise<DeprovisioningAddOn>;
|
|
@@ -29,7 +29,13 @@ export async function destroyAndWait(ctx, appIdentity, addonIdentity, options =
|
|
|
29
29
|
? platform.withOptions({ body: { force: true } })
|
|
30
30
|
: platform;
|
|
31
31
|
const deleted = await deleteClient.addOn.delete(appIdentity, addonIdentity);
|
|
32
|
-
|
|
32
|
+
if (!deleted) {
|
|
33
|
+
// The platform returns the (possibly still-deprovisioning) add-on on a
|
|
34
|
+
// successful delete; an empty body means we can't report a result, so fail
|
|
35
|
+
// loudly rather than fabricate a stateless phantom add-on.
|
|
36
|
+
throw new Error(`Deleting add-on ${addonIdentity} returned no response body.`);
|
|
37
|
+
}
|
|
38
|
+
let addon = deleted;
|
|
33
39
|
if (!options.wait || (addon.state !== 'deprovisioning' && addon.state !== 'provisioning')) {
|
|
34
40
|
return addon;
|
|
35
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AddOn } from '@heroku/types/3.sdk';
|
|
2
|
+
import type { DeprovisioningAddOn, ResolvedAddOn } from './types.js';
|
|
2
3
|
export declare class AddonNotFoundError extends Error {
|
|
3
4
|
readonly resource: string;
|
|
4
5
|
readonly id = "not_found";
|
|
@@ -36,14 +37,46 @@ export declare class AddonConfirmationRequiredError extends Error {
|
|
|
36
37
|
message: string;
|
|
37
38
|
};
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Thrown by `postgresDatabase.destroy` when the database can't be found under
|
|
42
|
+
* the requested app but does exist under another app. Restores the CLI's
|
|
43
|
+
* historical "is on <app> not <app>" guidance so a database scoped to the
|
|
44
|
+
* wrong app surfaces a targeted error rather than a bare not-found.
|
|
45
|
+
*/
|
|
46
|
+
export declare class AddonAppMismatchError extends Error {
|
|
47
|
+
readonly addon: ResolvedAddOn;
|
|
48
|
+
readonly requestedApp: string;
|
|
49
|
+
readonly id = "app_mismatch";
|
|
50
|
+
constructor(addon: ResolvedAddOn, requestedApp: string);
|
|
51
|
+
get body(): {
|
|
52
|
+
id: string;
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Thrown by `postgresDatabase.destroy` when the delete request (or its
|
|
58
|
+
* deprovisioning wait) fails after the database was resolved and any
|
|
59
|
+
* `beforeDestroy` confirmation passed. Carries the resolved add-on so callers
|
|
60
|
+
* can render tier-specific guidance without re-resolving; the underlying
|
|
61
|
+
* failure is preserved as the standard `cause`.
|
|
62
|
+
*/
|
|
63
|
+
export declare class AddonDestroyFailedError extends Error {
|
|
64
|
+
readonly addon: ResolvedAddOn;
|
|
65
|
+
readonly id = "destroy_failed";
|
|
66
|
+
constructor(addon: ResolvedAddOn, cause: unknown);
|
|
67
|
+
get body(): {
|
|
68
|
+
id: string;
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
39
72
|
/**
|
|
40
73
|
* Thrown by `createAndWait` when the Platform reports the add-on
|
|
41
74
|
* settled into a non-provisioned terminal state (e.g. `deprovisioned`).
|
|
42
75
|
*/
|
|
43
76
|
export declare class AddonProvisioningFailedError extends Error {
|
|
44
|
-
readonly addon: AddOn;
|
|
77
|
+
readonly addon: AddOn | DeprovisioningAddOn;
|
|
45
78
|
readonly id = "provisioning_failed";
|
|
46
|
-
constructor(addon: AddOn);
|
|
79
|
+
constructor(addon: AddOn | DeprovisioningAddOn);
|
|
47
80
|
get body(): {
|
|
48
81
|
id: string;
|
|
49
82
|
message: string;
|
|
@@ -43,6 +43,58 @@ export class AddonConfirmationRequiredError extends Error {
|
|
|
43
43
|
return { id: this.id, message: this.message };
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Thrown by `postgresDatabase.destroy` when the database can't be found under
|
|
48
|
+
* the requested app but does exist under another app. Restores the CLI's
|
|
49
|
+
* historical "is on <app> not <app>" guidance so a database scoped to the
|
|
50
|
+
* wrong app surfaces a targeted error rather than a bare not-found.
|
|
51
|
+
*/
|
|
52
|
+
export class AddonAppMismatchError extends Error {
|
|
53
|
+
addon;
|
|
54
|
+
requestedApp;
|
|
55
|
+
id = 'app_mismatch';
|
|
56
|
+
constructor(addon, requestedApp) {
|
|
57
|
+
super(`Database ${addon.name} is on ${addon.app.name} not ${requestedApp}. Try again with the correct app.`);
|
|
58
|
+
this.addon = addon;
|
|
59
|
+
this.requestedApp = requestedApp;
|
|
60
|
+
this.name = 'AddonAppMismatchError';
|
|
61
|
+
}
|
|
62
|
+
get body() {
|
|
63
|
+
return { id: this.id, message: this.message };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Thrown by `postgresDatabase.destroy` when the delete request (or its
|
|
68
|
+
* deprovisioning wait) fails after the database was resolved and any
|
|
69
|
+
* `beforeDestroy` confirmation passed. Carries the resolved add-on so callers
|
|
70
|
+
* can render tier-specific guidance without re-resolving; the underlying
|
|
71
|
+
* failure is preserved as the standard `cause`.
|
|
72
|
+
*/
|
|
73
|
+
export class AddonDestroyFailedError extends Error {
|
|
74
|
+
addon;
|
|
75
|
+
id = 'destroy_failed';
|
|
76
|
+
constructor(addon, cause) {
|
|
77
|
+
super(messageFromCause(cause), { cause });
|
|
78
|
+
this.addon = addon;
|
|
79
|
+
this.name = 'AddonDestroyFailedError';
|
|
80
|
+
}
|
|
81
|
+
get body() {
|
|
82
|
+
return { id: this.id, message: this.message };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function messageFromCause(cause) {
|
|
86
|
+
if (typeof cause === 'object' && cause !== null) {
|
|
87
|
+
const { body } = cause;
|
|
88
|
+
if (body?.message) {
|
|
89
|
+
return body.message;
|
|
90
|
+
}
|
|
91
|
+
const { message } = cause;
|
|
92
|
+
if (message) {
|
|
93
|
+
return message;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return String(cause);
|
|
97
|
+
}
|
|
46
98
|
/**
|
|
47
99
|
* Thrown by `createAndWait` when the Platform reports the add-on
|
|
48
100
|
* settled into a non-provisioned terminal state (e.g. `deprovisioned`).
|
|
@@ -5,17 +5,17 @@ import { formatPlanPriceLabel, priceForPlan } from './pricing.js';
|
|
|
5
5
|
export { createAndWait } from './create-and-wait.js';
|
|
6
6
|
export { describeAddon } from './describe.js';
|
|
7
7
|
export { destroyAndWait } from './destroy-and-wait.js';
|
|
8
|
-
export { AddonAmbiguousError, AddonConfirmationRequiredError, AddonNotFoundError, AddonProvisioningFailedError, } from './errors.js';
|
|
8
|
+
export { AddonAmbiguousError, AddonAppMismatchError, AddonConfirmationRequiredError, AddonDestroyFailedError, AddonNotFoundError, AddonProvisioningFailedError, } from './errors.js';
|
|
9
9
|
export { listPlans, listPlansForAddon, type ListPlansForAddonOptions } from './list-plans.js';
|
|
10
10
|
export { formatPlanPriceLabel, type FormatPlanPriceLabelOptions, type PlanPriceBreakdown, type PlanPriceKind, priceForPlan, } from './pricing.js';
|
|
11
11
|
export { resolveAddon } from './resolve.js';
|
|
12
|
-
export type { AddOnOptions, CreateAndWaitOptions, DescribedAddOn, DestroyAndWaitOptions, ResolveAddonOptions, ResolvedAddOn, UpgradeAddOnOptions, WaitForProvisioningOptions, } from './types.js';
|
|
12
|
+
export type { AddOnOptions, CreateAndWaitOptions, DeprovisioningAddOn, DescribedAddOn, DestroyAndWaitOptions, ResolveAddonOptions, ResolvedAddOn, UpgradeAddOnOptions, WaitForProvisioningOptions, } from './types.js';
|
|
13
13
|
export { upgrade } from './upgrade.js';
|
|
14
14
|
export { waitForProvisioning } from './wait-for-provisioning.js';
|
|
15
15
|
export declare const addOnExtensions: import("../../../core/extend-resource.js").ResourceExtension<"platform", "addOn", {
|
|
16
16
|
createAndWait: (appIdentity: string, body: AddOnCreateOpts, options?: CreateAndWaitOptions) => Promise<AddOn>;
|
|
17
17
|
describe: (addonIdentity: string, options?: ResolveAddonOptions) => Promise<import("./types.js").DescribedAddOn>;
|
|
18
|
-
destroyAndWait: (appIdentity: string, addonIdentity: string, options?: DestroyAndWaitOptions) => Promise<
|
|
18
|
+
destroyAndWait: (appIdentity: string, addonIdentity: string, options?: DestroyAndWaitOptions) => Promise<import("./types.js").DeprovisioningAddOn>;
|
|
19
19
|
formatPlanPriceLabel: typeof formatPlanPriceLabel;
|
|
20
20
|
listPlans: (serviceIdentity: string, options?: AddOnOptions) => Promise<import("@heroku/types/3.sdk").Plan[]>;
|
|
21
21
|
listPlansForAddon: (addonIdentity: string, options?: ListPlansForAddonOptions) => Promise<import("@heroku/types/3.sdk").Plan[]>;
|
|
@@ -10,7 +10,7 @@ import { waitForProvisioning } from './wait-for-provisioning.js';
|
|
|
10
10
|
export { createAndWait } from './create-and-wait.js';
|
|
11
11
|
export { describeAddon } from './describe.js';
|
|
12
12
|
export { destroyAndWait } from './destroy-and-wait.js';
|
|
13
|
-
export { AddonAmbiguousError, AddonConfirmationRequiredError, AddonNotFoundError, AddonProvisioningFailedError, } from './errors.js';
|
|
13
|
+
export { AddonAmbiguousError, AddonAppMismatchError, AddonConfirmationRequiredError, AddonDestroyFailedError, AddonNotFoundError, AddonProvisioningFailedError, } from './errors.js';
|
|
14
14
|
export { listPlans, listPlansForAddon } from './list-plans.js';
|
|
15
15
|
export { formatPlanPriceLabel, priceForPlan, } from './pricing.js';
|
|
16
16
|
export { resolveAddon } from './resolve.js';
|
|
@@ -25,6 +25,19 @@ export type ResolvedAddOn = AddOn & {
|
|
|
25
25
|
export type DescribedAddOn = ResolvedAddOn & {
|
|
26
26
|
attachments: AddOnAttachment[];
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* An add-on that may still be deprovisioning. The platform returns
|
|
30
|
+
* `deprovisioning` as a transient `state` while a delete is in flight, but
|
|
31
|
+
* `@heroku/types` models only the terminal states. Methods that surface an
|
|
32
|
+
* in-flight delete response (e.g. `destroyAndWait` returning before the poll)
|
|
33
|
+
* return this so callers can branch on `deprovisioning` without casting `state`.
|
|
34
|
+
*
|
|
35
|
+
* Stopgap: once `@heroku/types`' `AddOn['state']` includes `deprovisioning`,
|
|
36
|
+
* this type collapses to `AddOn` and should be deleted.
|
|
37
|
+
*/
|
|
38
|
+
export type DeprovisioningAddOn = Omit<AddOn, 'state'> & {
|
|
39
|
+
state: 'deprovisioning' | AddOn['state'];
|
|
40
|
+
};
|
|
28
41
|
export type UpgradeAddOnOptions = ResolveAddonOptions & {
|
|
29
42
|
onResolved?: (addon: ResolvedAddOn) => Promise<void> | void;
|
|
30
43
|
};
|
|
@@ -43,7 +56,7 @@ export type DestroyAndWaitOptions = {
|
|
|
43
56
|
* Only invoked when `wait: true` and the delete response state is
|
|
44
57
|
* `deprovisioning`.
|
|
45
58
|
*/
|
|
46
|
-
onDeprovisioning?: (addon:
|
|
59
|
+
onDeprovisioning?: (addon: DeprovisioningAddOn) => Promise<void> | void;
|
|
47
60
|
/**
|
|
48
61
|
* If true, poll until the add-on leaves `deprovisioning`. If the
|
|
49
62
|
* terminal state is not `deprovisioned`, throws `AddonProvisioningFailedError`.
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.12.
|
|
1
|
+
export declare const SDK_VERSION = "0.12.4";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated from package.json by scripts/write-version.mjs (build prebuild). Do not edit.
|
|
2
|
-
export const SDK_VERSION = '0.12.
|
|
2
|
+
export const SDK_VERSION = '0.12.4';
|