deepline 0.3.494 → 0.3.496
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/bundling-sources/sdk/src/client-core.ts +103 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +5 -19
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +79 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-control.ts +19 -3
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +110 -66
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +57 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +8 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +15 -0
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +19 -10
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +26 -6
- package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +4 -1
- package/dist/cli/{auth-6X5YXMFN.mjs → auth-EU4EFRDJ.mjs} +5 -5
- package/dist/cli/auth-SHWC5FMY.js +43 -0
- package/dist/cli/{billing-5F5PZB77.js → billing-4JJLTVK4.js} +80 -80
- package/dist/cli/{billing-IN74SDSC.mjs → billing-GMVH3RBX.mjs} +7 -7
- package/dist/cli/{chunk-H46X7YDU.mjs → chunk-2HCZHIMT.mjs} +20 -0
- package/dist/cli/{chunk-3KVFOKPR.js → chunk-3HIPDJWJ.js} +53 -53
- package/dist/cli/{chunk-QOEI42IU.mjs → chunk-3KA466RV.mjs} +1 -1
- package/dist/cli/{chunk-GNSGDIA4.mjs → chunk-4NKAM4GX.mjs} +2 -2
- package/dist/cli/{chunk-BU5Y7HOD.js → chunk-5GK6J7MH.js} +5 -5
- package/dist/cli/{chunk-J2HOVZOE.mjs → chunk-5M4PLPTR.mjs} +53 -3
- package/dist/cli/{chunk-CAWOSHEC.js → chunk-5YSIHOGV.js} +26 -26
- package/dist/cli/{chunk-RPFNIMUO.mjs → chunk-6QIAEXRH.mjs} +1 -1
- package/dist/cli/{chunk-4RWH4LRQ.mjs → chunk-6UUZM4FY.mjs} +5 -5
- package/dist/cli/{chunk-S3XQH7DW.js → chunk-73CBLBNP.js} +1 -1
- package/dist/cli/{chunk-KR2XEI5T.mjs → chunk-7NBDLK3N.mjs} +1 -1
- package/dist/cli/{chunk-MWZNMWR2.mjs → chunk-7Q7VPFPR.mjs} +2 -2
- package/dist/cli/{chunk-6XZR2642.mjs → chunk-7U6W3CKT.mjs} +4 -4
- package/dist/cli/{chunk-CK5MA6S6.js → chunk-AOBAVBSX.js} +115 -65
- package/dist/cli/{chunk-L4QPBQUX.mjs → chunk-CNMIYEB4.mjs} +3 -3
- package/dist/cli/{chunk-DVQHG6AM.mjs → chunk-CS2AEAD6.mjs} +63 -11
- package/dist/cli/{chunk-ODWTFVE4.mjs → chunk-DFW6P6ZN.mjs} +2 -2
- package/dist/cli/{chunk-L2P2XRPO.mjs → chunk-E3KXXJWR.mjs} +6 -6
- package/dist/cli/{chunk-PKV5CD3W.js → chunk-EQR5O2D2.js} +87 -35
- package/dist/cli/{chunk-L6KA4ENU.js → chunk-EX4JEFYI.js} +16 -16
- package/dist/cli/{chunk-IPWYDANJ.mjs → chunk-FXPICCUU.mjs} +1 -1
- package/dist/cli/{chunk-5WYH2LAP.js → chunk-GKZUGHDK.js} +6 -6
- package/dist/cli/{chunk-HINVMRGQ.js → chunk-GRIHMNYM.js} +4 -4
- package/dist/cli/{chunk-VMPM2FKT.js → chunk-HIAFBOYA.js} +8 -8
- package/dist/cli/{chunk-FAT6CUZK.mjs → chunk-IMWJRBV5.mjs} +1 -1
- package/dist/cli/{chunk-IZJSX3SZ.mjs → chunk-IXPZROZX.mjs} +2 -2
- package/dist/cli/{chunk-Y4GRL533.js → chunk-J55ZM5CK.js} +3 -3
- package/dist/cli/{chunk-X6HIIHQO.js → chunk-JEPNE4N5.js} +5 -5
- package/dist/cli/{chunk-QSRWBOPV.js → chunk-JU4LIA2T.js} +7 -7
- package/dist/cli/{chunk-GSCCDGGT.js → chunk-KKI5GWED.js} +94 -94
- package/dist/cli/{chunk-WP45PUPW.js → chunk-MWQ3WQ4Q.js} +41 -41
- package/dist/cli/{chunk-AARXOBVD.js → chunk-N3T3L3WW.js} +20 -0
- package/dist/cli/{chunk-TLQXN4ZZ.mjs → chunk-O36ZPHJG.mjs} +10 -10
- package/dist/cli/{chunk-7B7A36XZ.js → chunk-PHVRS56F.js} +14 -14
- package/dist/cli/{chunk-GDNQXLBM.js → chunk-QEBQIGXP.js} +2 -2
- package/dist/cli/{chunk-USWLB4KV.js → chunk-QN6IULFT.js} +53 -53
- package/dist/cli/{chunk-BLHQRETG.mjs → chunk-QYXUZX5N.mjs} +4 -4
- package/dist/cli/{chunk-J3UHNUWI.js → chunk-QZ7I4NZZ.js} +2 -2
- package/dist/cli/{chunk-KVCQL6SP.mjs → chunk-R4H5MCG4.mjs} +4 -4
- package/dist/cli/{chunk-L6L57RSG.mjs → chunk-SH6HOR25.mjs} +2 -2
- package/dist/cli/{chunk-EG3OSUBO.mjs → chunk-U6SE6757.mjs} +1 -1
- package/dist/cli/{chunk-65NMOP4T.mjs → chunk-UT3ORL35.mjs} +3 -3
- package/dist/cli/{chunk-4ZKZS43N.js → chunk-UTG3STCR.js} +3 -3
- package/dist/cli/{chunk-GLDBMKTV.js → chunk-W7DZ6UGP.js} +3 -3
- package/dist/cli/{chunk-DKKAJ3U2.mjs → chunk-WCBZHSC4.mjs} +5 -5
- package/dist/cli/{chunk-BNI653WN.js → chunk-WEGGJMNF.js} +21 -21
- package/dist/cli/{chunk-6DMLWM7L.mjs → chunk-WTZ7Y3IZ.mjs} +2 -2
- package/dist/cli/{chunk-WCZBIE5L.mjs → chunk-YHFW7MBT.mjs} +1 -1
- package/dist/cli/{chunk-4A5WXQJK.js → chunk-Z27R2BG7.js} +16 -16
- package/dist/cli/{chunk-ZZD245Z2.js → chunk-ZL4Q4T3G.js} +7 -7
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-UBW4ID5D.mjs → csv-ET7ESAPM.mjs} +4 -4
- package/dist/cli/{csv-QD7JJGSP.js → csv-JWBLNEPC.js} +13 -13
- package/dist/cli/{db-AARR3WYD.js → db-3ZGQXWTQ.js} +28 -28
- package/dist/cli/{db-QFDXKIVD.mjs → db-4PIWQPR6.mjs} +7 -7
- package/dist/cli/describe-KO3OQBIR.js +50 -0
- package/dist/cli/{describe-OBVIAC2H.mjs → describe-OREUCFC2.mjs} +18 -18
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/{executions-IZYUDYTZ.mjs → executions-HW6PMZOF.mjs} +7 -7
- package/dist/cli/{executions-KXY7KMZY.js → executions-YR545MRU.js} +9 -9
- package/dist/cli/{feedback-IVCVBERN.mjs → feedback-B2FJ6HPA.mjs} +4 -4
- package/dist/cli/{feedback-3334HBPD.js → feedback-FNVHJQEC.js} +8 -8
- package/dist/cli/{git-JHNVET5A.mjs → git-CCNPW3CA.mjs} +5 -5
- package/dist/cli/git-X2QJ2B5O.js +25 -0
- package/dist/cli/index.js +141 -141
- package/dist/cli/index.mjs +41 -41
- package/dist/cli/{legacy-noops-DBA32JCV.js → legacy-noops-2EBZS45D.js} +8 -8
- package/dist/cli/{legacy-noops-WGVBUOCC.mjs → legacy-noops-VJLCXTPB.mjs} +5 -5
- package/dist/cli/{monitors-ZGANC7JY.mjs → monitors-4AMETRW7.mjs} +190 -8
- package/dist/cli/{monitors-GHWZ5AZS.js → monitors-JNWKPCN5.js} +318 -136
- package/dist/cli/{org-S7JWP264.js → org-7FUHVFYU.js} +73 -73
- package/dist/cli/{org-CUS42N2T.mjs → org-LO6GSCCG.mjs} +7 -7
- package/dist/cli/{pages-IH56T6L6.mjs → pages-PJ32M2PU.mjs} +21 -7
- package/dist/cli/{pages-QXRZDEJW.js → pages-TT4TZOOV.js} +33 -19
- package/dist/cli/{play-Z65ZFOQH.mjs → play-QJEZAIZB.mjs} +19 -48
- package/dist/cli/{play-4C5PYS62.js → play-VN7DFYDP.js} +618 -647
- package/dist/cli/{providers-FSZSJX4Z.mjs → providers-24ER3SND.mjs} +7 -7
- package/dist/cli/{providers-XYQGYF3O.js → providers-IDFN2FCR.js} +10 -10
- package/dist/cli/{quickstart-ZA25RJT3.js → quickstart-AQDCRVUQ.js} +6 -6
- package/dist/cli/{quickstart-DHWVE32I.mjs → quickstart-FKENQU34.mjs} +4 -4
- package/dist/cli/{run-5MP6LEHM.js → run-HCASJQZY.js} +37 -37
- package/dist/cli/{run-WRPPEPLG.mjs → run-KXMRE5ZD.mjs} +23 -23
- package/dist/cli/{search-A6NVJPKX.mjs → search-3F2T33OE.mjs} +8 -8
- package/dist/cli/search-OGY6SQDJ.js +32 -0
- package/dist/cli/{search-output-YA6TXWGO.js → search-output-GFCEGNCJ.js} +6 -6
- package/dist/cli/{search-output-PAOUMVXY.mjs → search-output-U6PM5KAH.mjs} +4 -4
- package/dist/cli/{secrets-AZYOGH3I.js → secrets-KYVUP755.js} +16 -16
- package/dist/cli/{secrets-ZGF7JOBI.mjs → secrets-ZZSOVXOX.mjs} +7 -7
- package/dist/cli/{sessions-RNEAXZPV.mjs → sessions-4Z62CVHL.mjs} +5 -5
- package/dist/cli/{sessions-GCIN5VXT.js → sessions-7JFKTUQS.js} +6 -6
- package/dist/cli/{settings-NO5KXQJF.mjs → settings-OXG7IRVC.mjs} +12 -12
- package/dist/cli/{settings-LMEZNLBB.js → settings-X4PSK4EW.js} +79 -79
- package/dist/cli/{setup-XKTZPYYH.js → setup-NCJEDW4W.js} +49 -49
- package/dist/cli/{setup-GCYB4IFS.mjs → setup-RB7JE6KA.mjs} +9 -9
- package/dist/cli/{skills-TY4HHIKH.mjs → skills-D4BR2WU2.mjs} +7 -7
- package/dist/cli/skills-WWWFRDCA.js +36 -0
- package/dist/cli/{tools-RDTHHYJ3.mjs → tools-CEOD7VD5.mjs} +17 -17
- package/dist/cli/tools-QMSAA3LC.js +57 -0
- package/dist/cli/update-HTDFPN7L.js +34 -0
- package/dist/cli/{update-BRLLTTCS.mjs → update-UKUMQ6FC.mjs} +9 -9
- package/dist/cli/{workflow-F72EVZWM.mjs → workflow-EKKTTSCJ.mjs} +8 -8
- package/dist/cli/{workflow-YHA4WE3K.js → workflow-LFWQWZKS.js} +18 -18
- package/dist/{client-97yTcdLl.d.ts → client-Cj3UqrCZ.d.ts} +1 -1
- package/dist/{client-CFo9qalW.d.mts → client-DSCTVVRj.d.mts} +1 -1
- package/dist/{client-core-Dl6xgfLq.d.mts → client-core-B-8DTIN1.d.mts} +49 -3
- package/dist/{client-core-BRZrY13B.d.ts → client-core-dI4KTuWS.d.ts} +49 -3
- package/dist/{compiler-manifest-CPEF48NM.d.ts → compiler-manifest-DlXDyndN.d.mts} +2 -0
- package/dist/{compiler-manifest-CPEF48NM.d.mts → compiler-manifest-DlXDyndN.d.ts} +2 -0
- package/dist/{errors-BWbPzqwo.d.mts → errors-BtriA2ld.d.mts} +1 -1
- package/dist/{errors-B-PJXveg.d.ts → errors-DmcLykM7.d.ts} +1 -1
- package/dist/{index-CvVxPpE8.d.ts → index--Jw-slHY.d.ts} +1 -1
- package/dist/{index-BJ8AA1F9.d.mts → index-DI0sR_fX.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +112 -112
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +2 -2
- package/dist/plays/run-request.mjs +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-RWLCLMDY.js +0 -43
- package/dist/cli/describe-RYJ6HDYD.js +0 -50
- package/dist/cli/git-4VLYFHNU.js +0 -25
- package/dist/cli/search-4SQFVNTB.js +0 -32
- package/dist/cli/skills-V4APQA2I.js +0 -36
- package/dist/cli/tools-HKQLQ7HT.js +0 -57
- package/dist/cli/update-Z4MUAHWM.js +0 -34
|
@@ -1297,6 +1297,31 @@ export type MonitorsListOptions = {
|
|
|
1297
1297
|
includeConsumers?: boolean;
|
|
1298
1298
|
};
|
|
1299
1299
|
|
|
1300
|
+
/** Options for `client.monitors.ledger(...)`. */
|
|
1301
|
+
export type MonitorsLedgerOptions = {
|
|
1302
|
+
/** Search name, key, subject, signal and deploy filters. */
|
|
1303
|
+
search?: string;
|
|
1304
|
+
/** Customer statuses to include; every status except `stopped` by default. */
|
|
1305
|
+
states?: string[];
|
|
1306
|
+
/** Signal keys, as the response's `signals[].key` lists them. */
|
|
1307
|
+
signals?: string[];
|
|
1308
|
+
/** A Play definition id, or `none` for monitors no Play listens to. */
|
|
1309
|
+
play?: string;
|
|
1310
|
+
/** `findings` orders by the most findings in `window`. */
|
|
1311
|
+
sort?: 'recent' | 'installed' | 'name' | 'findings';
|
|
1312
|
+
/** The span each row's findings count covers; `30d` by default. */
|
|
1313
|
+
window?: '1d' | '7d' | '30d' | '90d' | '1y';
|
|
1314
|
+
limit?: number | string;
|
|
1315
|
+
cursor?: string;
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
/** The Monitors list page: rows plus counts, options and failing Plays. */
|
|
1319
|
+
export type MonitorsLedgerResult = Record<string, unknown> & {
|
|
1320
|
+
monitors?: Array<Record<string, unknown>>;
|
|
1321
|
+
total?: number;
|
|
1322
|
+
next_cursor?: string | null;
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1300
1325
|
/**
|
|
1301
1326
|
* Server-owned monitor payload shapes returned by the deploy/check/get/mutation
|
|
1302
1327
|
* endpoints. Kept as open records because the render layer and the endpoints
|
|
@@ -1926,6 +1951,17 @@ export type MonitorsNamespace = {
|
|
|
1926
1951
|
list: (options?: MonitorsListOptions) => Promise<MonitorsListResult>;
|
|
1927
1952
|
/** Fetch one deployed monitor by public key with bounded current listener health. */
|
|
1928
1953
|
get: (key: string) => Promise<MonitorDetail>;
|
|
1954
|
+
/** The Monitors list: monitors with status, radar filters and the Plays
|
|
1955
|
+
* each triggers, plus status counts and failing Plays. */
|
|
1956
|
+
ledger: (options?: MonitorsLedgerOptions) => Promise<MonitorsLedgerResult>;
|
|
1957
|
+
/** One monitor as its Monitors page shows it, with every Play it triggers. */
|
|
1958
|
+
ledgerGet: (key: string) => Promise<Record<string, unknown>>;
|
|
1959
|
+
/** One page of a monitor's delivered findings, newest first, with each
|
|
1960
|
+
* Play's recorded run per finding. */
|
|
1961
|
+
ledgerFindings: (
|
|
1962
|
+
key: string,
|
|
1963
|
+
options?: { cursor?: string },
|
|
1964
|
+
) => Promise<Record<string, unknown>>;
|
|
1929
1965
|
/** Test a deployed monitor's callback envelope without side effects. */
|
|
1930
1966
|
test: (
|
|
1931
1967
|
key: string,
|
|
@@ -2807,6 +2843,7 @@ export type HostedPage = {
|
|
|
2807
2843
|
name: string;
|
|
2808
2844
|
url: string;
|
|
2809
2845
|
description: string | null;
|
|
2846
|
+
allowed_origins?: string[];
|
|
2810
2847
|
public: boolean;
|
|
2811
2848
|
state: 'active' | 'deleting';
|
|
2812
2849
|
has_document: boolean;
|
|
@@ -3016,6 +3053,10 @@ export class DeeplineClient {
|
|
|
3016
3053
|
? this.deployMonitor(definition, { dryRun: true })
|
|
3017
3054
|
: this.syncScalarMonitor(definition, options),
|
|
3018
3055
|
list: (options) => this.listMonitors(options),
|
|
3056
|
+
ledger: (options) => this.listMonitorLedger(options),
|
|
3057
|
+
ledgerGet: (key) => this.getMonitorLedgerEntry(key),
|
|
3058
|
+
ledgerFindings: (key, options) =>
|
|
3059
|
+
this.listMonitorLedgerFindings(key, options),
|
|
3019
3060
|
get: (key) => this.getMonitor(key),
|
|
3020
3061
|
test: (key, payload, options) =>
|
|
3021
3062
|
this.testMonitorWebhook(key, payload, options),
|
|
@@ -3151,6 +3192,17 @@ export class DeeplineClient {
|
|
|
3151
3192
|
);
|
|
3152
3193
|
}
|
|
3153
3194
|
|
|
3195
|
+
/** Replace the origins allowed to read this page in a browser when public. */
|
|
3196
|
+
async setPageAllowedOrigins(
|
|
3197
|
+
name: string,
|
|
3198
|
+
origins: string[],
|
|
3199
|
+
): Promise<{ allowed_origins: string[] }> {
|
|
3200
|
+
return await this.http.put<{ allowed_origins: string[] }>(
|
|
3201
|
+
`/api/v2/pages/${encodeURIComponent(name)}/origins`,
|
|
3202
|
+
{ allowed_origins: origins },
|
|
3203
|
+
);
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3154
3206
|
/** The explicit way to change who can see an existing page. */
|
|
3155
3207
|
async setPageVisibility(
|
|
3156
3208
|
name: string,
|
|
@@ -7210,6 +7262,51 @@ export class DeeplineClient {
|
|
|
7210
7262
|
);
|
|
7211
7263
|
}
|
|
7212
7264
|
|
|
7265
|
+
/** The Monitors list. Prefer `client.monitors.ledger(...)`. */
|
|
7266
|
+
async listMonitorLedger(
|
|
7267
|
+
options?: MonitorsLedgerOptions,
|
|
7268
|
+
): Promise<MonitorsLedgerResult> {
|
|
7269
|
+
const params = new URLSearchParams();
|
|
7270
|
+
if (options?.search) params.set('q', options.search);
|
|
7271
|
+
for (const state of options?.states ?? []) params.append('state', state);
|
|
7272
|
+
for (const signal of options?.signals ?? [])
|
|
7273
|
+
params.append('signal', signal);
|
|
7274
|
+
if (options?.play) params.set('play', options.play);
|
|
7275
|
+
if (options?.sort) params.set('sort', options.sort);
|
|
7276
|
+
if (options?.window) params.set('window', options.window);
|
|
7277
|
+
if (options?.limit !== undefined)
|
|
7278
|
+
params.set('limit', String(options.limit));
|
|
7279
|
+
if (options?.cursor) params.set('cursor', options.cursor);
|
|
7280
|
+
const query = params.toString();
|
|
7281
|
+
const suffix = query ? `?${query}` : '';
|
|
7282
|
+
return this.http.request<MonitorsLedgerResult>(
|
|
7283
|
+
`/api/v2/monitors/ledger${suffix}`,
|
|
7284
|
+
{ method: 'GET' },
|
|
7285
|
+
);
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7288
|
+
/** One Monitors list entry. Prefer `client.monitors.ledgerGet(...)`. */
|
|
7289
|
+
async getMonitorLedgerEntry(key: string): Promise<Record<string, unknown>> {
|
|
7290
|
+
return this.http.request<Record<string, unknown>>(
|
|
7291
|
+
`/api/v2/monitors/ledger/${encodeURIComponent(key)}`,
|
|
7292
|
+
{ method: 'GET' },
|
|
7293
|
+
);
|
|
7294
|
+
}
|
|
7295
|
+
|
|
7296
|
+
/** A monitor's recent findings. Prefer `client.monitors.ledgerFindings(...)`. */
|
|
7297
|
+
async listMonitorLedgerFindings(
|
|
7298
|
+
key: string,
|
|
7299
|
+
options?: { cursor?: string },
|
|
7300
|
+
): Promise<Record<string, unknown>> {
|
|
7301
|
+
const suffix = options?.cursor
|
|
7302
|
+
? `?cursor=${encodeURIComponent(options.cursor)}`
|
|
7303
|
+
: '';
|
|
7304
|
+
return this.http.request<Record<string, unknown>>(
|
|
7305
|
+
`/api/v2/monitors/ledger/${encodeURIComponent(key)}/findings${suffix}`,
|
|
7306
|
+
{ method: 'GET' },
|
|
7307
|
+
);
|
|
7308
|
+
}
|
|
7309
|
+
|
|
7213
7310
|
/** Fetch one deployed monitor by public key. Prefer `client.monitors.get(...)`. */
|
|
7214
7311
|
async getMonitor(key: string): Promise<MonitorDetail> {
|
|
7215
7312
|
return this.http.request<MonitorDetail>(
|
|
@@ -7695,7 +7792,12 @@ export class DeeplineClient {
|
|
|
7695
7792
|
const terminal: ReadonlySet<string> =
|
|
7696
7793
|
options?.until === 'deactivated'
|
|
7697
7794
|
? new Set(['deactivated', 'degraded', 'billing_suspended'])
|
|
7698
|
-
: new Set([
|
|
7795
|
+
: new Set([
|
|
7796
|
+
'converged',
|
|
7797
|
+
'degraded',
|
|
7798
|
+
'deactivated',
|
|
7799
|
+
'billing_suspended',
|
|
7800
|
+
]);
|
|
7699
7801
|
const startedAt = Date.now();
|
|
7700
7802
|
let latest = await this.getMonitorFleet(fleetId);
|
|
7701
7803
|
while (true) {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* passed in as explicit request fields.
|
|
17
17
|
*/
|
|
18
18
|
import { DeeplineError } from '../../../shared_libs/plays/tool-execution-error';
|
|
19
|
+
import { inputFieldsFromStaticCsvArgs } from '../../../shared_libs/plays/static-pipeline';
|
|
19
20
|
import { isTerminalPlayRunLifecycleStatus } from '../../../shared_libs/play-runtime/run-lifecycle-policy.js';
|
|
20
21
|
import {
|
|
21
22
|
buildCallerPlayWorkflowId,
|
|
@@ -683,20 +684,6 @@ function stringMetadata(
|
|
|
683
684
|
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
684
685
|
}
|
|
685
686
|
|
|
686
|
-
function inputFieldFromCsvArg(csvArg: unknown): string | null {
|
|
687
|
-
if (typeof csvArg !== 'string') return null;
|
|
688
|
-
// The static pipeline preserves the authored expression, not just the
|
|
689
|
-
// resolved source. A very common, valid form is
|
|
690
|
-
// `ctx.csv(input.csv ?? 'default.csv')`: when the caller supplies --csv, the
|
|
691
|
-
// input field still owns the staged file and must be rewritten to its logical
|
|
692
|
-
// path before the runner starts.
|
|
693
|
-
const match =
|
|
694
|
-
/^\(?\s*input\.([A-Za-z_$][\w$]*)\s*\)?(?:\s*\?\?[\s\S]+)?$/.exec(
|
|
695
|
-
csvArg.trim(),
|
|
696
|
-
);
|
|
697
|
-
return match?.[1] ?? null;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
687
|
/** The `csvInput` binding a `CsvInput<Row>` field compiles to. */
|
|
701
688
|
export function fileInputBindingsFromPlaySchema(
|
|
702
689
|
inputSchema: Record<string, unknown> | null | undefined,
|
|
@@ -710,7 +697,7 @@ export function fileInputBindingsFromPlaySchema(
|
|
|
710
697
|
];
|
|
711
698
|
}
|
|
712
699
|
|
|
713
|
-
/**
|
|
700
|
+
/** Every input field read by an authored `ctx.csv(input.x)` call. */
|
|
714
701
|
export function fileInputBindingsFromStaticPipeline(
|
|
715
702
|
staticPipeline: unknown,
|
|
716
703
|
): FileInputBinding[] {
|
|
@@ -721,10 +708,9 @@ export function fileInputBindingsFromStaticPipeline(
|
|
|
721
708
|
) {
|
|
722
709
|
return [];
|
|
723
710
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
);
|
|
727
|
-
return inputField ? [{ inputPath: inputField }] : [];
|
|
711
|
+
return inputFieldsFromStaticCsvArgs(
|
|
712
|
+
staticPipeline as Record<string, unknown>,
|
|
713
|
+
).map((inputPath) => ({ inputPath }));
|
|
728
714
|
}
|
|
729
715
|
|
|
730
716
|
/** Every file-input binding of a Play definition, in staging order. */
|
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.496',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -69,6 +69,85 @@ function isDirectCreditSuspension(input: {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* What a customer must fix for a billing-suspended monitor, from its public
|
|
74
|
+
* suspension reason. `payment_required` stays with credits: the dashboard has
|
|
75
|
+
* always told the customer to add credits for it, but it is never restored
|
|
76
|
+
* automatically (see `monitorRecoveryProjection`).
|
|
77
|
+
*/
|
|
78
|
+
export type MonitorPauseKind = 'credits' | 'cap' | 'billing';
|
|
79
|
+
|
|
80
|
+
export function monitorPauseKind(reason: string | undefined): MonitorPauseKind {
|
|
81
|
+
if (isMonitorCapSuspensionReason(reason)) return 'cap';
|
|
82
|
+
if (
|
|
83
|
+
isCreditExhaustionSuspensionReason(reason) ||
|
|
84
|
+
reason === POLICY_CREDIT_SUSPENSION_REASON ||
|
|
85
|
+
reason === 'payment_required'
|
|
86
|
+
) {
|
|
87
|
+
return 'credits';
|
|
88
|
+
}
|
|
89
|
+
return 'billing';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether a top-up or a cap change brings this suspended monitor back by
|
|
94
|
+
* itself, and if not, what is in the way. Customer copy promises an automatic
|
|
95
|
+
* resume only when `automatic` is true: it is the same selector credit and cap
|
|
96
|
+
* recovery run, so the promise and the behavior cannot drift apart.
|
|
97
|
+
*/
|
|
98
|
+
export type MonitorRecoveryProjection = {
|
|
99
|
+
automatic: boolean;
|
|
100
|
+
/** Set when the pause kind would normally recover but this row cannot yet. */
|
|
101
|
+
blocked_by: 'cleanup_pending' | 'customer_stop' | 'review' | null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export function monitorRecoveryProjection(input: {
|
|
105
|
+
fleetId?: string;
|
|
106
|
+
status: string;
|
|
107
|
+
desired?: 'active' | 'inactive';
|
|
108
|
+
deactivationReason?: string;
|
|
109
|
+
billingState: unknown;
|
|
110
|
+
providerBinding: unknown;
|
|
111
|
+
}): MonitorRecoveryProjection {
|
|
112
|
+
const billingState = parseStoredMonitorBillingState(input.billingState);
|
|
113
|
+
const reason = billingState.suspension_reason;
|
|
114
|
+
if (input.fleetId !== undefined) {
|
|
115
|
+
// Fleet members recover with their Fleet's lifecycle (KAR-43), which is
|
|
116
|
+
// selected from the Fleet's own suspension reason, not this row.
|
|
117
|
+
return {
|
|
118
|
+
automatic:
|
|
119
|
+
isCreditRestorableFleetSuspensionReason(reason) ||
|
|
120
|
+
isMonitorCapSuspensionReason(reason),
|
|
121
|
+
blocked_by: null,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (
|
|
125
|
+
isCreditRestorableDirectMonitorSuspension(input) ||
|
|
126
|
+
isCapRestorableDirectMonitorSuspension(input)
|
|
127
|
+
) {
|
|
128
|
+
return { automatic: true, blocked_by: null };
|
|
129
|
+
}
|
|
130
|
+
const kind = monitorPauseKind(reason);
|
|
131
|
+
const recoverableKind =
|
|
132
|
+
(kind === 'credits' && reason !== 'payment_required') || kind === 'cap';
|
|
133
|
+
if (!recoverableKind || billingState.state !== 'billing_suspended') {
|
|
134
|
+
return { automatic: false, blocked_by: null };
|
|
135
|
+
}
|
|
136
|
+
if (!hasConfirmedProviderMonitorUpstreamCleanup(input.providerBinding)) {
|
|
137
|
+
return { automatic: false, blocked_by: 'cleanup_pending' };
|
|
138
|
+
}
|
|
139
|
+
const policyProvenance =
|
|
140
|
+
input.deactivationReason === POLICY_CREDIT_SUSPENSION_REASON ||
|
|
141
|
+
input.deactivationReason === POLICY_CAP_SUSPENSION_REASON;
|
|
142
|
+
return {
|
|
143
|
+
automatic: false,
|
|
144
|
+
blocked_by:
|
|
145
|
+
input.desired === 'inactive' && !policyProvenance
|
|
146
|
+
? 'customer_stop'
|
|
147
|
+
: 'review',
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
72
151
|
/**
|
|
73
152
|
* A billing suspension is not itself proof that TamRadar accepted the delete.
|
|
74
153
|
* Keep this test beside the recovery selector so every automatic path rejects
|
|
@@ -472,6 +472,24 @@
|
|
|
472
472
|
"failureAlert": "github_workflow_run",
|
|
473
473
|
"domainReportRequired": true
|
|
474
474
|
},
|
|
475
|
+
{
|
|
476
|
+
"id": "github.release-train",
|
|
477
|
+
"name": "Release train",
|
|
478
|
+
"scheduler": "github_actions",
|
|
479
|
+
"cadence": "*/5 * * * *",
|
|
480
|
+
"timezone": "UTC",
|
|
481
|
+
"source": ".github/workflows/release-train.yml",
|
|
482
|
+
"locator": "schedule:",
|
|
483
|
+
"owner": "platform",
|
|
484
|
+
"criticality": "operational",
|
|
485
|
+
"purpose": "Recheck whether the latest main commit can start a release train after a cadence or capacity deferral.",
|
|
486
|
+
"successDefinition": "The starter is disabled, or it records a dispatch or deferral decision and GitHub accepts any selected train dispatch.",
|
|
487
|
+
"failureDefinition": "Git ref or train history lookup fails, the configured cadence is invalid, or GitHub rejects the selected dispatch.",
|
|
488
|
+
"startGraceMs": 600000,
|
|
489
|
+
"runTimeoutMs": 300000,
|
|
490
|
+
"failureAlert": "github_workflow_run",
|
|
491
|
+
"domainReportRequired": true
|
|
492
|
+
},
|
|
475
493
|
{
|
|
476
494
|
"id": "github.runtime-lifecycle",
|
|
477
495
|
"name": "On-Demand Runtime Lifecycle Load Check",
|
|
@@ -26,10 +26,24 @@ export type ScheduledWorkOrganizationTarget = {
|
|
|
26
26
|
readonly orgId: string;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
export type HistoricalSettlementManifest = {
|
|
30
|
+
readonly deployment: string;
|
|
31
|
+
readonly cutoffMs: number;
|
|
32
|
+
readonly liabilityShard: number;
|
|
33
|
+
readonly rows: readonly {
|
|
34
|
+
readonly workId: string;
|
|
35
|
+
readonly reservationId: string;
|
|
36
|
+
readonly version: number;
|
|
37
|
+
readonly expectedDebitMicros: number;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type ScheduledWorkPreviewMode = 'transactional' | 'read_only';
|
|
42
|
+
|
|
29
43
|
export type ScheduledWorkPreviewResult = {
|
|
30
44
|
readonly ok: boolean;
|
|
31
45
|
readonly dryRun: true;
|
|
32
|
-
readonly previewMode:
|
|
46
|
+
readonly previewMode: ScheduledWorkPreviewMode;
|
|
33
47
|
readonly state: 'unknown' | 'inProgress' | 'success' | 'failed' | 'canceled';
|
|
34
48
|
readonly processed: number;
|
|
35
49
|
readonly isDone: boolean;
|
|
@@ -46,6 +60,7 @@ export type ScheduledWorkControlContext = {
|
|
|
46
60
|
* lists in `orgScopedJobIds` accept it.
|
|
47
61
|
*/
|
|
48
62
|
readonly orgScope?: readonly string[];
|
|
63
|
+
readonly historicalSettlementManifest?: HistoricalSettlementManifest;
|
|
49
64
|
readonly requestedByUserId: string;
|
|
50
65
|
readonly requestedByEmail: string;
|
|
51
66
|
readonly reason: string;
|
|
@@ -68,6 +83,7 @@ export type ScheduledWorkControlConnector = {
|
|
|
68
83
|
/** Jobs whose run may be restricted to an organization allow-list. */
|
|
69
84
|
readonly orgScopedJobIds?: readonly string[];
|
|
70
85
|
readonly previewActions?: readonly ScheduledWorkControlAction[];
|
|
86
|
+
readonly previewMode?: ScheduledWorkPreviewMode;
|
|
71
87
|
preview?: (
|
|
72
88
|
context: ScheduledWorkControlContext,
|
|
73
89
|
action: ScheduledWorkControlAction,
|
|
@@ -98,7 +114,7 @@ export type ScheduledWorkControlCapability =
|
|
|
98
114
|
readonly connectorId: string;
|
|
99
115
|
readonly scheduler: string;
|
|
100
116
|
readonly targetKind?: 'organization';
|
|
101
|
-
readonly previewMode?:
|
|
117
|
+
readonly previewMode?: ScheduledWorkPreviewMode;
|
|
102
118
|
}
|
|
103
119
|
| {
|
|
104
120
|
readonly available: false;
|
|
@@ -219,7 +235,7 @@ export class ScheduledWorkControlRegistry {
|
|
|
219
235
|
scheduler: connector.scheduler,
|
|
220
236
|
...(connector.targetKind ? { targetKind: connector.targetKind } : {}),
|
|
221
237
|
...(connector.previewActions?.includes(action)
|
|
222
|
-
? { previewMode: 'transactional'
|
|
238
|
+
? { previewMode: connector.previewMode ?? 'transactional' }
|
|
223
239
|
: {}),
|
|
224
240
|
};
|
|
225
241
|
}
|
|
@@ -984,8 +984,14 @@ export class FlyMachinesClient {
|
|
|
984
984
|
async acquireMachineLease(
|
|
985
985
|
id: string,
|
|
986
986
|
options: { ttl: number; description: string },
|
|
987
|
+
leaseNonce?: string,
|
|
987
988
|
): Promise<string> {
|
|
988
|
-
const result = await this.request(
|
|
989
|
+
const result = await this.request(
|
|
990
|
+
'POST',
|
|
991
|
+
`/machines/${id}/lease`,
|
|
992
|
+
options,
|
|
993
|
+
leaseNonce,
|
|
994
|
+
);
|
|
989
995
|
const nonce =
|
|
990
996
|
result &&
|
|
991
997
|
typeof result === 'object' &&
|
|
@@ -155,6 +155,11 @@ export async function selectDrainedGatewaySourceMachines(input: {
|
|
|
155
155
|
return [...alreadyStopped, ...observed];
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// Continuation ownership is process-local; Fly owns expiry after a controller
|
|
159
|
+
// crash. Every pass refreshes the provider lease and re-reads source state.
|
|
160
|
+
const gatewayDrainLeaseNonces = new Map<string, string>();
|
|
161
|
+
const GATEWAY_DRAIN_LEASE_TTL_SECONDS = 120;
|
|
162
|
+
|
|
158
163
|
/** One bounded reconciliation pass. Nonzero work is normal and is retained
|
|
159
164
|
* for the next controller tick; metric/identity errors are intentionally loud
|
|
160
165
|
* so no release can quietly fall back to a timeout-based delete. */
|
|
@@ -166,89 +171,128 @@ export async function reconcileGatewaySourceDrain(input: {
|
|
|
166
171
|
inventory?: readonly FlyMachine[];
|
|
167
172
|
retryDelaysMs?: readonly number[];
|
|
168
173
|
sleep?: (delayMs: number) => Promise<void>;
|
|
174
|
+
leaseNonces?: Map<string, string>;
|
|
169
175
|
}): Promise<{ deletedMachineIds: string[]; pendingMachineIds: string[] }> {
|
|
170
176
|
const inventory = [
|
|
171
177
|
...(input.inventory ?? (await input.client.listMachines())),
|
|
172
178
|
];
|
|
173
179
|
const sourceIds = [...new Set(input.sourceMachineIds)];
|
|
174
180
|
const fetchImpl = input.fetchImpl ?? fetch;
|
|
175
|
-
const deletedMachineIds =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
const deletedMachineIds: string[] = [];
|
|
182
|
+
const leases = input.leaseNonces ?? gatewayDrainLeaseNonces;
|
|
183
|
+
const keyPrefix = `${input.app}/`;
|
|
184
|
+
for (const key of leases.keys()) {
|
|
185
|
+
if (
|
|
186
|
+
key.startsWith(keyPrefix) &&
|
|
187
|
+
!inventory.some((machine) => `${keyPrefix}${machine.id}` === key)
|
|
188
|
+
) {
|
|
189
|
+
leases.delete(key);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const machineId of sourceIds) {
|
|
193
|
+
if (!inventory.some((machine) => machine.id === machineId)) continue;
|
|
194
|
+
// Fly Proxy can restart a stopped source before deletion. Hold provider
|
|
195
|
+
// ownership across the fresh drain proof, stop, and deletion so autostart
|
|
196
|
+
// cannot race that sequence. Never carry a pre-lease emptiness proof.
|
|
197
|
+
const leaseKey = `${keyPrefix}${machineId}`;
|
|
198
|
+
let nonce = leases.get(leaseKey);
|
|
199
|
+
const refreshLease = async () => {
|
|
200
|
+
const prior = nonce;
|
|
201
|
+
try {
|
|
202
|
+
nonce = await input.client.acquireMachineLease(
|
|
203
|
+
machineId,
|
|
204
|
+
{
|
|
205
|
+
ttl: GATEWAY_DRAIN_LEASE_TTL_SECONDS,
|
|
206
|
+
description: 'Gateway source retirement',
|
|
207
|
+
},
|
|
208
|
+
prior,
|
|
209
|
+
);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
leases.delete(leaseKey);
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
leases.set(leaseKey, nonce);
|
|
215
|
+
if (prior && nonce !== prior) {
|
|
216
|
+
// Ownership lapsed. A restarted source needs a fresh state/work proof;
|
|
217
|
+
// this pass must not continue from observations made under the old lease.
|
|
218
|
+
leases.delete(leaseKey);
|
|
219
|
+
await input.client.releaseMachineLease(machineId, nonce);
|
|
220
|
+
throw new Error(
|
|
221
|
+
'Gateway drain lease changed; fresh source proof is required.',
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
await refreshLease();
|
|
226
|
+
let retainLease = false;
|
|
227
|
+
let providerConfirmedGone = false;
|
|
228
|
+
try {
|
|
229
|
+
const current = await input.client.getMachine(machineId);
|
|
230
|
+
if (current.cordoned !== true) {
|
|
231
|
+
throw new Error(
|
|
232
|
+
'Gateway drain source Machine became public before deletion.',
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
if (['stopping', 'destroying'].includes(current.state ?? '')) {
|
|
236
|
+
retainLease = true;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
const drained = await selectDrainedGatewaySourceMachines({
|
|
240
|
+
sourceMachineIds: [machineId],
|
|
241
|
+
inventory: [current],
|
|
242
|
+
readMetrics: () =>
|
|
243
|
+
readPrivateGatewayMetrics({
|
|
244
|
+
app: input.app,
|
|
245
|
+
machineId,
|
|
246
|
+
fetchImpl,
|
|
247
|
+
retryDelaysMs: input.retryDelaysMs,
|
|
248
|
+
sleep: input.sleep,
|
|
249
|
+
}),
|
|
185
250
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return !['stopped', 'suspended'].includes(machine?.state ?? '');
|
|
197
|
-
})
|
|
198
|
-
.map((machineId) =>
|
|
199
|
-
input.client.stopMachine(machineId, {
|
|
251
|
+
if (drained.length === 0) continue;
|
|
252
|
+
if (!['stopped', 'suspended'].includes(current.state ?? '')) {
|
|
253
|
+
// Refresh immediately before each effect. A provider request is bounded
|
|
254
|
+
// at 30 seconds, below this lease's 120 seconds; slow reads/retries cannot
|
|
255
|
+
// consume the fence needed by the following mutation.
|
|
256
|
+
await refreshLease();
|
|
257
|
+
retainLease = true;
|
|
258
|
+
await input.client.stopMachine(
|
|
259
|
+
machineId,
|
|
260
|
+
{
|
|
200
261
|
signal: 'SIGTERM',
|
|
201
262
|
timeout: '300s',
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const remaining = current.filter((machine) =>
|
|
209
|
-
deletedMachineIds.includes(machine.id ?? ''),
|
|
263
|
+
},
|
|
264
|
+
nonce,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
const stopped = (await input.client.listMachines()).find(
|
|
268
|
+
(machine) => machine.id === machineId,
|
|
210
269
|
);
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
['stopped', 'suspended'].includes(machine.state ?? ''),
|
|
214
|
-
)
|
|
215
|
-
) {
|
|
216
|
-
if (remaining.some((machine) => machine.cordoned !== true)) {
|
|
270
|
+
if (stopped) {
|
|
271
|
+
if (stopped.cordoned !== true) {
|
|
217
272
|
throw new Error(
|
|
218
273
|
'Gateway drain source Machine became public before deletion.',
|
|
219
274
|
);
|
|
220
275
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
276
|
+
// Stops and deletes are asynchronous. Resume from fresh provider truth
|
|
277
|
+
// next tick rather than blocking live capacity planning for ten minutes.
|
|
278
|
+
if (!['stopped', 'suspended'].includes(stopped.state ?? '')) continue;
|
|
279
|
+
await refreshLease();
|
|
280
|
+
retainLease = true;
|
|
281
|
+
await input.client.deleteMachine(machineId, false, nonce);
|
|
227
282
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
`Gateway drain sources did not stop within 600000 ms: ${remaining.map((machine) => `${machine.id}=${machine.state}`).join(', ')}.`,
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
await new Promise((resolve) => setTimeout(resolve, 5_000));
|
|
234
|
-
}
|
|
235
|
-
for (;;) {
|
|
236
|
-
const providerMachineIds = new Set(
|
|
237
|
-
(await input.client.listMachines())
|
|
238
|
-
.map((machine) => machine.id)
|
|
239
|
-
.filter((id): id is string => Boolean(id)),
|
|
283
|
+
providerConfirmedGone = !(await input.client.listMachines()).some(
|
|
284
|
+
(machine) => machine.id === machineId,
|
|
240
285
|
);
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
)
|
|
245
|
-
) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (Date.now() >= deadline) {
|
|
249
|
-
throw new Error('Gateway source deletion is not provider-confirmed.');
|
|
286
|
+
if (providerConfirmedGone) deletedMachineIds.push(machineId);
|
|
287
|
+
} finally {
|
|
288
|
+
if (providerConfirmedGone) {
|
|
289
|
+
leases.delete(leaseKey);
|
|
290
|
+
} else if (!retainLease && leases.get(leaseKey) === nonce) {
|
|
291
|
+
leases.delete(leaseKey);
|
|
292
|
+
await input.client.releaseMachineLease(machineId, nonce!);
|
|
250
293
|
}
|
|
251
|
-
|
|
294
|
+
// Keep the lease through asynchronous stopping/deletion and ambiguous
|
|
295
|
+
// mutation outcomes. The next tick refreshes it; a crash lets Fly expire it.
|
|
252
296
|
}
|
|
253
297
|
}
|
|
254
298
|
return {
|