@capybara-hq/kernel 0.1.0-rc.121 → 0.1.0-rc.123
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/bootstrap.json +3 -3
- package/dist/background/finish.d.ts +5 -1
- package/dist/background/finish.js +29 -18
- package/dist/background/launch.d.ts +0 -5
- package/dist/background/launch.js +1 -6
- package/dist/background/managed.js +1 -4
- package/dist/background/poll.job.d.ts +3 -25
- package/dist/background/poll.job.js +20 -112
- package/dist/background/render.d.ts +2 -8
- package/dist/background/render.js +3 -17
- package/dist/background/stop.d.ts +15 -16
- package/dist/background/stop.js +39 -76
- package/dist/background/store.d.ts +17 -45
- package/dist/background/store.js +60 -94
- package/dist/background/tasks.service.d.ts +2 -5
- package/dist/background/tasks.service.js +9 -20
- package/dist/background/wake.js +3 -2
- package/dist/catalog/admin-catalog.controller.d.ts +2 -18
- package/dist/catalog/admin-catalog.controller.js +2 -28
- package/dist/catalog/catalog-content.d.ts +1 -5
- package/dist/catalog/catalog-items.d.ts +2 -6
- package/dist/catalog/catalog-items.js +5 -26
- package/dist/catalog/catalog-scope.service.d.ts +1 -121
- package/dist/catalog/catalog-scope.service.js +12 -552
- package/dist/catalog/catalog.service.d.ts +4 -15
- package/dist/catalog/catalog.service.js +7 -35
- package/dist/catalog/job-ids.d.ts +0 -18
- package/dist/catalog/job-ids.js +0 -20
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.js +6 -20
- package/dist/catalog/org-plugin-uploads.controller.d.ts +4 -19
- package/dist/catalog/org-plugin-uploads.controller.js +6 -34
- package/dist/catalog/org-plugin-uploads.d.ts +3 -10
- package/dist/catalog/org-plugin-uploads.js +4 -18
- package/dist/catalog/org-plugin-uploads.schemas.js +0 -1
- package/dist/catalog/owned-items.d.ts +6 -11
- package/dist/catalog/owned-items.js +10 -20
- package/dist/catalog/ownership.d.ts +3 -29
- package/dist/catalog/ownership.js +4 -54
- package/dist/catalog/platform-components.d.ts +5 -11
- package/dist/catalog/platform-components.js +8 -15
- package/dist/catalog/plugin-import.d.ts +3 -42
- package/dist/catalog/plugin-import.js +26 -195
- package/dist/catalog/plugin-install.js +1 -6
- package/dist/catalog/plugin-package.d.ts +1 -0
- package/dist/catalog/plugin-package.js +5 -0
- package/dist/catalog/plugin-upgrade.d.ts +3 -26
- package/dist/catalog/plugin-upgrade.js +20 -103
- package/dist/catalog/request-rules.js +4 -6
- package/dist/catalog/scope-sync.js +2 -4
- package/dist/catalog/scope.d.ts +2 -5
- package/dist/channels/jobs.d.ts +3 -3
- package/dist/channels/jobs.js +4 -3
- package/dist/channels/outbound.d.ts +1 -0
- package/dist/channels/outbound.js +32 -8
- package/dist/config/load.d.ts +0 -25
- package/dist/config/load.js +0 -57
- package/dist/config/schema.js +2 -3
- package/dist/conversations/attachments.service.js +3 -5
- package/dist/conversations/conversations.service.d.ts +3 -3
- package/dist/conversations/conversations.service.js +3 -3
- package/dist/conversations/job-org.d.ts +3 -0
- package/dist/conversations/job-org.js +11 -0
- package/dist/conversations/prompt-suggestions.d.ts +2 -7
- package/dist/conversations/prompt-suggestions.js +29 -27
- package/dist/conversations/titles.d.ts +3 -4
- package/dist/conversations/titles.js +19 -30
- package/dist/db/kernel-schema.d.ts +6 -16
- package/dist/db/pool.js +7 -2
- package/dist/devices/devices.controller.d.ts +0 -5
- package/dist/devices/devices.controller.js +2 -20
- package/dist/devices/devices.service.d.ts +1 -17
- package/dist/devices/devices.service.js +0 -22
- package/dist/errors.d.ts +1 -5
- package/dist/errors.js +1 -5
- package/dist/evals/judge.d.ts +3 -0
- package/dist/evals/judge.js +1 -1
- package/dist/evals/run-replay.d.ts +1 -1
- package/dist/evals/run-replay.js +26 -29
- package/dist/evals/step-replay.d.ts +3 -1
- package/dist/evals/step-replay.js +10 -1
- package/dist/evals/worker.d.ts +3 -1
- package/dist/evals/worker.js +53 -21
- package/dist/extensions/deployment-config-store.js +18 -14
- package/dist/extensions/effective-config.d.ts +1 -5
- package/dist/extensions/effective-config.js +1 -5
- package/dist/extensions/hooks.d.ts +3 -1
- package/dist/extensions/hooks.js +7 -2
- package/dist/extensions/installs.d.ts +2 -14
- package/dist/extensions/installs.js +10 -32
- package/dist/extensions/org-config.d.ts +3 -4
- package/dist/extensions/org-config.js +3 -4
- package/dist/extensions/plugin-guides.d.ts +0 -1
- package/dist/extensions/plugin-guides.js +0 -1
- package/dist/extensions/plugin-icons.d.ts +0 -1
- package/dist/extensions/plugin-icons.js +0 -3
- package/dist/files/blob-sweep.job.d.ts +2 -11
- package/dist/files/blob-sweep.job.js +7 -21
- package/dist/files/hash-job.d.ts +5 -15
- package/dist/files/hash-job.js +14 -33
- package/dist/files/library-jobs.module.d.ts +1 -6
- package/dist/files/library-jobs.module.js +3 -9
- package/dist/identity/api-tokens.js +54 -40
- package/dist/identity/auth.guard.js +2 -2
- package/dist/identity/sessions.js +7 -3
- package/dist/identity/settings.js +5 -21
- package/dist/inbox/inbox.service.d.ts +2 -3
- package/dist/inbox/org-notices.d.ts +0 -14
- package/dist/inbox/platform-inbox.service.d.ts +1 -8
- package/dist/inbox/platform-inbox.service.js +2 -6
- package/dist/inbox/platform-notices.d.ts +3 -3
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -3
- package/dist/infra/database/database.module.js +2 -1
- package/dist/infra/database/org-scope.d.ts +5 -3
- package/dist/infra/database/org-scope.js +7 -1
- package/dist/infra/database/scoped-dialect.d.ts +3 -1
- package/dist/infra/database/scoped-dialect.js +17 -5
- package/dist/infra/events/kernel-events.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.js +10 -0
- package/dist/infra/outbox/registry.d.ts +0 -41
- package/dist/infra/outbox/registry.js +0 -37
- package/dist/models/embeddings.d.ts +0 -5
- package/dist/models/embeddings.js +28 -35
- package/dist/models/images.d.ts +3 -8
- package/dist/models/images.js +19 -37
- package/dist/models/purposes.d.ts +7 -2
- package/dist/models/purposes.js +16 -3
- package/dist/orgs/device-network-setting.d.ts +0 -44
- package/dist/orgs/device-network-setting.js +0 -83
- package/dist/orgs/invitations.service.js +34 -30
- package/dist/orgs/offboarding.d.ts +2 -2
- package/dist/orgs/offboarding.js +2 -2
- package/dist/orgs/orgs.service.d.ts +1 -1
- package/dist/orgs/orgs.service.js +19 -15
- package/dist/orgs/settings.service.d.ts +19 -14
- package/dist/orgs/settings.service.js +12 -37
- package/dist/platform/exclusions.js +0 -11
- package/dist/platform/ops/catalog-admin.ops.js +0 -8
- package/dist/platform/ops/devices.ops.js +0 -28
- package/dist/platform/ops/extensions-admin.ops.js +3 -3
- package/dist/platform/ops/inbox.ops.js +5 -22
- package/dist/platform/ops/org-plugins.ops.d.ts +1 -3
- package/dist/platform/ops/org-plugins.ops.js +11 -67
- package/dist/roles/worker.module.js +0 -9
- package/dist/runtime/hook-calls.d.ts +13 -6
- package/dist/runtime/hook-calls.js +26 -4
- package/dist/runtime/maintenance.d.ts +3 -12
- package/dist/runtime/maintenance.js +25 -55
- package/dist/runtime/model-call.d.ts +4 -2
- package/dist/runtime/model-call.js +59 -58
- package/dist/runtime/providers.d.ts +27 -1
- package/dist/runtime/providers.js +57 -0
- package/dist/runtime/run-jobs.d.ts +1 -1
- package/dist/runtime/run-processors.d.ts +3 -9
- package/dist/runtime/run-worker.d.ts +2 -0
- package/dist/runtime/run-worker.js +23 -8
- package/dist/runtime/subagents/deliveries.js +6 -1
- package/dist/runtime/subagents/dispatch.d.ts +3 -3
- package/dist/runtime/write-base.service.d.ts +2 -3
- package/dist/runtime/write-base.service.js +3 -5
- package/dist/sandbox/device-sandbox-settings.d.ts +38 -92
- package/dist/sandbox/device-sandbox-settings.js +19 -325
- package/dist/sandbox/jobs.d.ts +3 -14
- package/dist/sandbox/jobs.js +2 -20
- package/dist/sandbox/modes.d.ts +5 -45
- package/dist/sandbox/modes.js +3 -60
- package/dist/sandbox/operation-authority.js +0 -11
- package/dist/sandbox/operation-intents.d.ts +32 -9
- package/dist/sandbox/operation-intents.js +241 -32
- package/dist/sandbox/operation-intents.module.js +2 -1
- package/dist/sandbox/operation-reconcile.job.d.ts +9 -11
- package/dist/sandbox/operation-reconcile.job.js +119 -33
- package/dist/sandbox/operation-revoke.d.ts +20 -0
- package/dist/sandbox/operation-revoke.js +3 -0
- package/dist/sandbox/permission-ceiling-writes.d.ts +1 -2
- package/dist/sandbox/permission-ceiling-writes.js +3 -6
- package/dist/sandbox/permission-config-publication.d.ts +1 -28
- package/dist/sandbox/permission-config-publication.js +14 -211
- package/dist/sandbox/permission-facts.d.ts +4 -15
- package/dist/sandbox/permission-facts.js +7 -29
- package/dist/sandbox/permission-instance-writes.d.ts +1 -4
- package/dist/sandbox/permission-instance-writes.js +1 -55
- package/dist/sandbox/providers.d.ts +1 -6
- package/dist/sandbox/providers.js +1 -15
- package/dist/sandbox/review/classifier.js +12 -13
- package/dist/sandbox/sandbox.module.js +3 -6
- package/dist/sandbox/sandbox.service.d.ts +17 -123
- package/dist/sandbox/sandbox.service.js +239 -998
- package/dist/shares/liveness.d.ts +1 -2
- package/dist/shares/liveness.js +1 -2
- package/dist/shares/shares.module.d.ts +1 -2
- package/dist/shares/shares.module.js +2 -5
- package/dist/shares/shares.service.js +1 -2
- package/dist/tools/builtins/image/generate.js +7 -15
- package/dist/tools/builtins/sandbox/common.d.ts +0 -2
- package/dist/tools/builtins/sandbox/common.js +1 -27
- package/dist/tools/builtins/sandbox/task-list.js +10 -10
- package/dist/tools/builtins/sandbox/task-output.d.ts +3 -10
- package/dist/tools/builtins/sandbox/task-output.js +13 -83
- package/dist/tools/builtins/sandbox/task-stop.js +18 -22
- package/dist/tools/builtins/vision/read-image.js +9 -10
- package/dist/tools/builtins/web/extract.js +9 -10
- package/package.json +3 -3
- package/src/migrations/0206_retire_org_extension_uploads.sql +125 -0
- package/src/migrations/0207_confirm_device_instance_destruction.sql +25 -0
- package/src/migrations/0208_convert_stored_permission_settings.sql +189 -0
- package/dist/background/retire-legacy-tasks.job.d.ts +0 -57
- package/dist/background/retire-legacy-tasks.job.js +0 -149
- package/dist/catalog/owned-plugin-cleanup.d.ts +0 -47
- package/dist/catalog/owned-plugin-cleanup.js +0 -140
- package/dist/config/permission-migration.d.ts +0 -34
- package/dist/config/permission-migration.js +0 -115
- package/dist/devices/legacy-cleanup.job.d.ts +0 -34
- package/dist/devices/legacy-cleanup.job.js +0 -147
- package/dist/files/library-backfill.d.ts +0 -63
- package/dist/files/library-backfill.js +0 -143
- package/dist/infra/cli/permission-cutover.d.ts +0 -59
- package/dist/infra/cli/permission-cutover.js +0 -107
- package/dist/sandbox/cloud-permission-snapshot.d.ts +0 -159
- package/dist/sandbox/cloud-permission-snapshot.js +0 -430
- package/dist/sandbox/cloud-permission-snapshot.module.d.ts +0 -8
- package/dist/sandbox/cloud-permission-snapshot.module.js +0 -34
- package/dist/sandbox/legacy-retirement.d.ts +0 -284
- package/dist/sandbox/legacy-retirement.js +0 -1165
- package/dist/sandbox/legacy-retirement.module.d.ts +0 -8
- package/dist/sandbox/legacy-retirement.module.js +0 -25
- package/dist/shares/share-objects.d.ts +0 -47
- package/dist/shares/share-objects.js +0 -93
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
-
};
|
|
10
|
-
// Taking out the extension of a removed org-owned plugin (plugin scope phase 3, spec §14, P3-20,
|
|
11
|
-
// P3-21; pre-flight F9, F10): the one-off job `owned-plugin-cleanup-<itemId>` on
|
|
12
|
-
// `cap-kernel-maintenance` (dispatched by `MaintenanceProcessor`), owed in the outbox by the
|
|
13
|
-
// removal's transaction (transactional outbox spec §8.1). Worker-only: `OwnedPluginCleanupModule`
|
|
14
|
-
// is imported only by `MaintenanceModule`, which only `WorkerModule` imports.
|
|
15
|
-
import { Inject, Injectable, Module } from "@nestjs/common";
|
|
16
|
-
import { ApiError } from "../errors.js";
|
|
17
|
-
import { ExtensionAdminOps } from "../extensions/admin-ops.js";
|
|
18
|
-
import { ExtensionsModule } from "../extensions/extensions.module.js";
|
|
19
|
-
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
20
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
21
|
-
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
22
|
-
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
23
|
-
import { CatalogImportModule } from "./catalog.module.js";
|
|
24
|
-
import { CatalogItemLock } from "./locks.js";
|
|
25
|
-
import { releaseExtensionClaim } from "./ownership.js";
|
|
26
|
-
/** Codes that mean another run (or the confirmation's own take-out) got there first. */
|
|
27
|
-
const GONE = new Set(["extension.not_found", "extension.not_disabled"]);
|
|
28
|
-
/**
|
|
29
|
-
* The cleanup of a removed org-owned plugin: {@link run} disables and uninstalls its extension (an
|
|
30
|
-
* install of the item's name from the item's package) when no live catalog item uses it any more
|
|
31
|
-
* ({@link OwnedPluginCleanup.referenced}), then releases the extension name claim, in one
|
|
32
|
-
* transaction under the import's item name lock (pre-flight F10: the claim of an installed
|
|
33
|
-
* extension is released here, never at the removal). Idempotent: a live item (a transferred one),
|
|
34
|
-
* a platform item or nothing installed changes nothing but the claim. The extension's data,
|
|
35
|
-
* secrets and configs stay, as with every uninstall.
|
|
36
|
-
*/
|
|
37
|
-
let OwnedPluginCleanup = class OwnedPluginCleanup {
|
|
38
|
-
kdb;
|
|
39
|
-
ops;
|
|
40
|
-
itemLock;
|
|
41
|
-
log;
|
|
42
|
-
txHost;
|
|
43
|
-
constructor(kdb, ops,
|
|
44
|
-
/** The import's item name lock (M5: no uninstall racing a re-import of the package). */
|
|
45
|
-
itemLock, log, txHost) {
|
|
46
|
-
this.kdb = kdb;
|
|
47
|
-
this.ops = ops;
|
|
48
|
-
this.itemLock = itemLock;
|
|
49
|
-
this.log = log;
|
|
50
|
-
this.txHost = txHost;
|
|
51
|
-
}
|
|
52
|
-
get db() {
|
|
53
|
-
return this.kdb.db;
|
|
54
|
-
}
|
|
55
|
-
/** Takes out the extension of removed item `itemId` (see the class). */
|
|
56
|
-
async run(itemId) {
|
|
57
|
-
const item = await this.db
|
|
58
|
-
.selectFrom("catalog_items")
|
|
59
|
-
.select(["name", "package_name", "deleted_at", "owner_org_id"])
|
|
60
|
-
.where("id", "=", itemId)
|
|
61
|
-
.executeTakeFirst();
|
|
62
|
-
if (!item || item.deleted_at === null || item.owner_org_id === null)
|
|
63
|
-
return;
|
|
64
|
-
if (item.package_name === null)
|
|
65
|
-
return;
|
|
66
|
-
await this.takeOut(itemId, item.name, item.package_name, item.owner_org_id);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* {@link run}'s one transaction, under the catalog item name lock an import of that name takes
|
|
70
|
-
* to write its item: a re-import of the package either committed first (a live item: nothing
|
|
71
|
-
* is taken out) or waits until this commits, so a newly imported extension is never uninstalled.
|
|
72
|
-
*/
|
|
73
|
-
async takeOut(itemId, name, pkg, ownerOrgId) {
|
|
74
|
-
await this.itemLock.lock(name);
|
|
75
|
-
if (await this.referenced(this.db, name, pkg, ownerOrgId))
|
|
76
|
-
return;
|
|
77
|
-
const install = await this.db
|
|
78
|
-
.selectFrom("extension_installs as x")
|
|
79
|
-
.innerJoin("extension_packages as p", "p.sha256", "x.sha256")
|
|
80
|
-
.select(["x.desired_state", "p.package_name"])
|
|
81
|
-
.where("x.name", "=", name)
|
|
82
|
-
.executeTakeFirst();
|
|
83
|
-
if (install !== undefined && install.package_name === pkg) {
|
|
84
|
-
try {
|
|
85
|
-
if (install.desired_state !== "disabled")
|
|
86
|
-
await this.ops.disable(name, null);
|
|
87
|
-
await this.ops.uninstall(name, null);
|
|
88
|
-
this.log.info("extension of a removed org plugin uninstalled", { itemId, name });
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
if (!(e instanceof ApiError && GONE.has(e.code)))
|
|
92
|
-
throw e;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
await releaseExtensionClaim(this.db, name, pkg);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* A live catalog item still uses the extension: one named like it (a plugin and its extension
|
|
99
|
-
* share one name) from the same package whose owner is the removed item's owner (a re-upload)
|
|
100
|
-
* or the platform (the super admin imported it over the install). Never any item of the package
|
|
101
|
-
* name alone: another org choosing the same package name keeps nothing installed (ruling P3-51).
|
|
102
|
-
*/
|
|
103
|
-
async referenced(db, name, packageName, ownerOrgId) {
|
|
104
|
-
const live = await db
|
|
105
|
-
.selectFrom("catalog_items")
|
|
106
|
-
.select("id")
|
|
107
|
-
.where("name", "=", name)
|
|
108
|
-
.where("package_name", "=", packageName)
|
|
109
|
-
.where("deleted_at", "is", null)
|
|
110
|
-
.where((eb) => eb.or([eb("owner_org_id", "is", null), eb("owner_org_id", "=", ownerOrgId)]))
|
|
111
|
-
.executeTakeFirst();
|
|
112
|
-
return live !== undefined;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
__decorate([
|
|
116
|
-
Transactional()
|
|
117
|
-
], OwnedPluginCleanup.prototype, "takeOut", null);
|
|
118
|
-
OwnedPluginCleanup = __decorate([
|
|
119
|
-
Injectable(),
|
|
120
|
-
__param(0, Inject(KernelDb)),
|
|
121
|
-
__param(1, Inject(ExtensionAdminOps)),
|
|
122
|
-
__param(2, Inject(CatalogItemLock)),
|
|
123
|
-
__param(3, Inject(KERNEL_LOGGER)),
|
|
124
|
-
__param(4, Inject(TransactionHost))
|
|
125
|
-
], OwnedPluginCleanup);
|
|
126
|
-
export { OwnedPluginCleanup };
|
|
127
|
-
/**
|
|
128
|
-
* {@link OwnedPluginCleanup}: imported only by `MaintenanceModule` (the job's dispatcher), which
|
|
129
|
-
* only the worker role imports.
|
|
130
|
-
*/
|
|
131
|
-
let OwnedPluginCleanupModule = class OwnedPluginCleanupModule {
|
|
132
|
-
};
|
|
133
|
-
OwnedPluginCleanupModule = __decorate([
|
|
134
|
-
Module({
|
|
135
|
-
imports: [ExtensionsModule, CatalogImportModule],
|
|
136
|
-
providers: [OwnedPluginCleanup],
|
|
137
|
-
exports: [OwnedPluginCleanup],
|
|
138
|
-
})
|
|
139
|
-
], OwnedPluginCleanupModule);
|
|
140
|
-
export { OwnedPluginCleanupModule };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/** What {@link migratePermissionConfigText} did: the converted text and the keys it renamed. */
|
|
2
|
-
export interface PermissionConfigMigration {
|
|
3
|
-
text: string;
|
|
4
|
-
/** `old -> new` per converted key; empty when the document has no old key. */
|
|
5
|
-
changed: string[];
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* The offline conversion of one config document (a config file, or a Nacos data id's content) to
|
|
9
|
-
* the permission keys of the approval-only profiles design (`capybara config migrate-permissions`):
|
|
10
|
-
* every old key (`devices.autoMode`, `devices.fullAccess`) is renamed in place to
|
|
11
|
-
* `devices.outsideSandbox`, so unrelated keys, values, order and comments stay as they were. An
|
|
12
|
-
* old key equal to an already present new key is dropped; a different one, or an invalid old
|
|
13
|
-
* value, is refused (never pick the wider one, never guess). An old `off` also kept every device on
|
|
14
|
-
* the allowlist, so the conversion sets `devices.network.ceiling: allowlist` (and narrows an open
|
|
15
|
-
* `devices.network.default`): nothing widens. Nothing is read from or written to the environment,
|
|
16
|
-
* PG or Nacos here: applying the result is the operator's reviewed change.
|
|
17
|
-
*/
|
|
18
|
-
export declare function migratePermissionConfigText(text: string): PermissionConfigMigration;
|
|
19
|
-
/** One environment variable the operator must rename before the old one stops being read. */
|
|
20
|
-
export type PermissionEnvRename = {
|
|
21
|
-
from: string;
|
|
22
|
-
to: string;
|
|
23
|
-
}
|
|
24
|
-
/** A variable to add (name=value; the value is a fixed narrowing, never an operator's value). */
|
|
25
|
-
| {
|
|
26
|
-
add: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* The old permission environment variables set in `env`, each with its replacement, plus the
|
|
30
|
-
* network ceiling variable to add when an old one is `off` (never wider). The values are never
|
|
31
|
-
* returned (the operator renames the variable and keeps its value). An old and a new variable, or
|
|
32
|
-
* two old ones, with different values are refused, like the startup config does.
|
|
33
|
-
*/
|
|
34
|
-
export declare function legacyPermissionEnvRenames(env: NodeJS.ProcessEnv): PermissionEnvRename[];
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { isMap, isScalar, parseDocument } from "yaml";
|
|
2
|
-
import { LEGACY_OFF_NETWORK_CEILING, LEGACY_PERMISSION_KEYS } from "./load.js";
|
|
3
|
-
import { ConfigError } from "./types.js";
|
|
4
|
-
const VALUES = ["allowed", "off"];
|
|
5
|
-
/**
|
|
6
|
-
* The offline conversion of one config document (a config file, or a Nacos data id's content) to
|
|
7
|
-
* the permission keys of the approval-only profiles design (`capybara config migrate-permissions`):
|
|
8
|
-
* every old key (`devices.autoMode`, `devices.fullAccess`) is renamed in place to
|
|
9
|
-
* `devices.outsideSandbox`, so unrelated keys, values, order and comments stay as they were. An
|
|
10
|
-
* old key equal to an already present new key is dropped; a different one, or an invalid old
|
|
11
|
-
* value, is refused (never pick the wider one, never guess). An old `off` also kept every device on
|
|
12
|
-
* the allowlist, so the conversion sets `devices.network.ceiling: allowlist` (and narrows an open
|
|
13
|
-
* `devices.network.default`): nothing widens. Nothing is read from or written to the environment,
|
|
14
|
-
* PG or Nacos here: applying the result is the operator's reviewed change.
|
|
15
|
-
*/
|
|
16
|
-
export function migratePermissionConfigText(text) {
|
|
17
|
-
const doc = parseDocument(text);
|
|
18
|
-
if (doc.errors.length > 0)
|
|
19
|
-
throw new ConfigError("invalid YAML in the config document");
|
|
20
|
-
const changed = [];
|
|
21
|
-
let off = false;
|
|
22
|
-
for (const key of LEGACY_PERMISSION_KEYS) {
|
|
23
|
-
const [section, old] = key.path;
|
|
24
|
-
const [, next] = key.replacement;
|
|
25
|
-
const parent = doc.get(section, true);
|
|
26
|
-
if (!isMap(parent) || !parent.has(old))
|
|
27
|
-
continue;
|
|
28
|
-
const from = key.path.join(".");
|
|
29
|
-
const to = key.replacement.join(".");
|
|
30
|
-
const value = parent.get(old);
|
|
31
|
-
if (typeof value !== "string" || !VALUES.includes(value))
|
|
32
|
-
throw new ConfigError(`${from} must be allowed or off; fix it before converting`);
|
|
33
|
-
if (value === "off")
|
|
34
|
-
off = true;
|
|
35
|
-
if (parent.has(next)) {
|
|
36
|
-
if (parent.get(next) !== value)
|
|
37
|
-
throw new ConfigError(`${from} and ${to} are both set and differ; keep one of them before converting`);
|
|
38
|
-
parent.delete(old);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const pair = parent.items.find((p) => (isScalar(p.key) ? p.key.value : p.key) === old);
|
|
42
|
-
if (pair === undefined)
|
|
43
|
-
continue;
|
|
44
|
-
if (isScalar(pair.key))
|
|
45
|
-
pair.key.value = next;
|
|
46
|
-
else
|
|
47
|
-
pair.key = doc.createNode(next);
|
|
48
|
-
}
|
|
49
|
-
changed.push(`${from} -> ${to}`);
|
|
50
|
-
}
|
|
51
|
-
if (off && narrowNetworkToAllowlist(doc))
|
|
52
|
-
changed.push(`${LEGACY_OFF_NETWORK_CEILING.path.join(".")}: ${LEGACY_OFF_NETWORK_CEILING.value} (an old off kept every device on the allowlist)`);
|
|
53
|
-
return { text: changed.length === 0 ? text : doc.toString(), changed };
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Sets `devices.network.ceiling` (and an open `devices.network.default`) to the allowlist, adding
|
|
57
|
-
* the `network` map right after `devices.outsideSandbox` when there is none. Returns whether it
|
|
58
|
-
* changed anything.
|
|
59
|
-
*/
|
|
60
|
-
function narrowNetworkToAllowlist(doc) {
|
|
61
|
-
const devices = doc.get("devices", true);
|
|
62
|
-
if (!isMap(devices))
|
|
63
|
-
return false;
|
|
64
|
-
const network = devices.get("network", true);
|
|
65
|
-
if (network === undefined || network === null) {
|
|
66
|
-
const node = doc.createNode({ ceiling: LEGACY_OFF_NETWORK_CEILING.value });
|
|
67
|
-
const at = devices.items.findIndex((p) => (isScalar(p.key) ? p.key.value : p.key) === "outsideSandbox");
|
|
68
|
-
devices.items.splice(at + 1, 0, doc.createPair("network", node));
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
if (!isMap(network))
|
|
72
|
-
throw new ConfigError("devices.network must be a mapping; fix it before converting");
|
|
73
|
-
let changed = false;
|
|
74
|
-
for (const field of ["default", "ceiling"]) {
|
|
75
|
-
const value = network.get(field);
|
|
76
|
-
if (field === "default" && value === undefined)
|
|
77
|
-
continue;
|
|
78
|
-
if (value === LEGACY_OFF_NETWORK_CEILING.value)
|
|
79
|
-
continue;
|
|
80
|
-
if (value !== undefined && value !== "open")
|
|
81
|
-
throw new ConfigError(`devices.network.${field} must be open or allowlist; fix it before converting`);
|
|
82
|
-
network.set(field, LEGACY_OFF_NETWORK_CEILING.value);
|
|
83
|
-
changed = true;
|
|
84
|
-
}
|
|
85
|
-
return changed;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* The old permission environment variables set in `env`, each with its replacement, plus the
|
|
89
|
-
* network ceiling variable to add when an old one is `off` (never wider). The values are never
|
|
90
|
-
* returned (the operator renames the variable and keeps its value). An old and a new variable, or
|
|
91
|
-
* two old ones, with different values are refused, like the startup config does.
|
|
92
|
-
*/
|
|
93
|
-
export function legacyPermissionEnvRenames(env) {
|
|
94
|
-
const out = [];
|
|
95
|
-
let off = false;
|
|
96
|
-
const seen = new Map();
|
|
97
|
-
for (const key of LEGACY_PERMISSION_KEYS) {
|
|
98
|
-
const old = env[key.env];
|
|
99
|
-
if (old === undefined)
|
|
100
|
-
continue;
|
|
101
|
-
const current = env[key.replacementEnv];
|
|
102
|
-
if (current !== undefined && current !== old)
|
|
103
|
-
throw new ConfigError(`${key.env} and ${key.replacementEnv} are both set and differ; keep one of them`);
|
|
104
|
-
for (const [other, value] of seen)
|
|
105
|
-
if (value !== old)
|
|
106
|
-
throw new ConfigError(`${other} and ${key.env} are both set and differ; keep one of them`);
|
|
107
|
-
seen.set(key.env, old);
|
|
108
|
-
if (old === "off")
|
|
109
|
-
off = true;
|
|
110
|
-
out.push({ from: key.env, to: key.replacementEnv });
|
|
111
|
-
}
|
|
112
|
-
if (off)
|
|
113
|
-
out.push({ add: `${LEGACY_OFF_NETWORK_CEILING.env}=${LEGACY_OFF_NETWORK_CEILING.value}` });
|
|
114
|
-
return out;
|
|
115
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
2
|
-
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
3
|
-
import { LockService } from "../infra/lock/lock.service.js";
|
|
4
|
-
import type { KernelLogger } from "../log.js";
|
|
5
|
-
import { DeviceProviders } from "../sandbox/providers.js";
|
|
6
|
-
/** The job's name (`@LockedInterval`, run lock `cron:devices-legacy-cleanup`). */
|
|
7
|
-
export declare const LEGACY_CLEANUP_JOB = "devices-legacy-cleanup";
|
|
8
|
-
/** What one run did: rows destroyed and deleted, rows kept because their provider is not loaded. */
|
|
9
|
-
export interface LegacyCleanupResult {
|
|
10
|
-
destroyed: number;
|
|
11
|
-
kept: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The cleanup of the per-conversation sandboxes of before devices (spec
|
|
15
|
-
* 2026-11-07-environments-design §4.2 item 9): for up to {@link BATCH} rows of the legacy
|
|
16
|
-
* `sandboxes` table per tick, the row's provider destroys the instance and the file system named
|
|
17
|
-
* `cap-<conversationId>` (`destroyByName`, `destroyFileSystemByName`; also the instance of the
|
|
18
|
-
* provider it replaced, `prev_provider`, when that one is loaded), then the row is deleted. No
|
|
19
|
-
* lease is taken: nothing holds a legacy row after the upgrade. A row whose provider is not loaded
|
|
20
|
-
* is kept (warned once per hour: on the tick in the first {@link PERIOD_MS} of each hour); a row
|
|
21
|
-
* whose destruction failed is retried at a later tick, after the others (`sweep_failed_at`). With
|
|
22
|
-
* no rows left a tick is one `SELECT … LIMIT 1`. The table is dropped by a later migration.
|
|
23
|
-
*/
|
|
24
|
-
export declare class LegacySandboxCleanupJob {
|
|
25
|
-
private readonly db;
|
|
26
|
-
private readonly providers;
|
|
27
|
-
readonly config: KernelConfigService;
|
|
28
|
-
readonly lockService: LockService;
|
|
29
|
-
readonly log: KernelLogger;
|
|
30
|
-
constructor(db: KernelDb, providers: Pick<DeviceProviders, "forDevice">, config: KernelConfigService, lockService: LockService, log: KernelLogger);
|
|
31
|
-
tick(signal?: AbortSignal): Promise<void>;
|
|
32
|
-
/** One run (see the class); `signal` (the stop, or a lost run lock) is read between rows. */
|
|
33
|
-
runOnce(now?: Date, signal?: AbortSignal): Promise<LegacyCleanupResult>;
|
|
34
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
-
};
|
|
10
|
-
import { Inject, Injectable } from "@nestjs/common";
|
|
11
|
-
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
12
|
-
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
13
|
-
import { asPlatform } from "../infra/database/org-scope.js";
|
|
14
|
-
import { LockService } from "../infra/lock/lock.service.js";
|
|
15
|
-
import { LockedInterval } from "../infra/schedule/locked-interval.js";
|
|
16
|
-
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
17
|
-
import { DeviceProviders } from "../sandbox/providers.js";
|
|
18
|
-
/** The job's name (`@LockedInterval`, run lock `cron:devices-legacy-cleanup`). */
|
|
19
|
-
export const LEGACY_CLEANUP_JOB = "devices-legacy-cleanup";
|
|
20
|
-
/** Every 5 minutes, once per tick across replicas. */
|
|
21
|
-
const PERIOD_MS = 5 * 60_000;
|
|
22
|
-
/** Rows handled per tick. */
|
|
23
|
-
const BATCH = 50;
|
|
24
|
-
/** The time limit of one provider call. */
|
|
25
|
-
const CALL_TIMEOUT_MS = 120_000;
|
|
26
|
-
/**
|
|
27
|
-
* The cleanup of the per-conversation sandboxes of before devices (spec
|
|
28
|
-
* 2026-11-07-environments-design §4.2 item 9): for up to {@link BATCH} rows of the legacy
|
|
29
|
-
* `sandboxes` table per tick, the row's provider destroys the instance and the file system named
|
|
30
|
-
* `cap-<conversationId>` (`destroyByName`, `destroyFileSystemByName`; also the instance of the
|
|
31
|
-
* provider it replaced, `prev_provider`, when that one is loaded), then the row is deleted. No
|
|
32
|
-
* lease is taken: nothing holds a legacy row after the upgrade. A row whose provider is not loaded
|
|
33
|
-
* is kept (warned once per hour: on the tick in the first {@link PERIOD_MS} of each hour); a row
|
|
34
|
-
* whose destruction failed is retried at a later tick, after the others (`sweep_failed_at`). With
|
|
35
|
-
* no rows left a tick is one `SELECT … LIMIT 1`. The table is dropped by a later migration.
|
|
36
|
-
*/
|
|
37
|
-
let LegacySandboxCleanupJob = class LegacySandboxCleanupJob {
|
|
38
|
-
db;
|
|
39
|
-
providers;
|
|
40
|
-
config;
|
|
41
|
-
lockService;
|
|
42
|
-
log;
|
|
43
|
-
constructor(db, providers, config, lockService, log) {
|
|
44
|
-
this.db = db;
|
|
45
|
-
this.providers = providers;
|
|
46
|
-
this.config = config;
|
|
47
|
-
this.lockService = lockService;
|
|
48
|
-
this.log = log;
|
|
49
|
-
}
|
|
50
|
-
async tick(signal) {
|
|
51
|
-
const res = await this.runOnce(new Date(), signal);
|
|
52
|
-
if (res.destroyed > 0)
|
|
53
|
-
this.log.info("legacy sandboxes destroyed", { ...res });
|
|
54
|
-
}
|
|
55
|
-
/** One run (see the class); `signal` (the stop, or a lost run lock) is read between rows. */
|
|
56
|
-
// org-filter: deployment-wide sweep of the legacy sandboxes table across all orgs
|
|
57
|
-
// (LockedInterval), each row keyed by its own conversation id
|
|
58
|
-
async runOnce(now = new Date(), signal) {
|
|
59
|
-
return asPlatform("deployment-wide sweep of the legacy sandboxes table across all orgs", async () => {
|
|
60
|
-
const any = await this.db
|
|
61
|
-
.selectFrom("sandboxes")
|
|
62
|
-
.select("conversation_id")
|
|
63
|
-
.limit(1)
|
|
64
|
-
.executeTakeFirst();
|
|
65
|
-
if (any === undefined)
|
|
66
|
-
return { destroyed: 0, kept: 0 };
|
|
67
|
-
const byProvider = await this.db
|
|
68
|
-
.selectFrom("sandboxes")
|
|
69
|
-
.select(["provider", (eb) => eb.fn.countAll().as("n")])
|
|
70
|
-
.groupBy("provider")
|
|
71
|
-
.execute();
|
|
72
|
-
const loaded = byProvider.filter((p) => this.providers.forDevice(p.provider) !== undefined);
|
|
73
|
-
const unloaded = byProvider.filter((p) => this.providers.forDevice(p.provider) === undefined);
|
|
74
|
-
const kept = unloaded.reduce((sum, p) => sum + Number(p.n), 0);
|
|
75
|
-
if (unloaded.length > 0 && now.getTime() % 3_600_000 < PERIOD_MS) {
|
|
76
|
-
this.log.warn("legacy sandboxes kept: their provider is not loaded", {
|
|
77
|
-
providers: unloaded.map((p) => p.provider),
|
|
78
|
-
count: kept,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (loaded.length === 0)
|
|
82
|
-
return { destroyed: 0, kept };
|
|
83
|
-
const rows = await this.db
|
|
84
|
-
.selectFrom("sandboxes")
|
|
85
|
-
.select(["conversation_id", "provider", "prev_provider"])
|
|
86
|
-
.where("provider", "in", loaded.map((p) => p.provider))
|
|
87
|
-
.orderBy("sweep_failed_at", (o) => o.asc().nullsFirst())
|
|
88
|
-
.orderBy("conversation_id")
|
|
89
|
-
.limit(BATCH)
|
|
90
|
-
.execute();
|
|
91
|
-
let destroyed = 0;
|
|
92
|
-
for (const row of rows) {
|
|
93
|
-
if (signal?.aborted)
|
|
94
|
-
break;
|
|
95
|
-
const name = `cap-${row.conversation_id}`;
|
|
96
|
-
const impl = this.providers.forDevice(row.provider)?.impl;
|
|
97
|
-
if (impl === undefined)
|
|
98
|
-
continue; // unloaded since the query: kept for a later tick
|
|
99
|
-
const callSignal = () => signal
|
|
100
|
-
? AbortSignal.any([signal, AbortSignal.timeout(CALL_TIMEOUT_MS)])
|
|
101
|
-
: AbortSignal.timeout(CALL_TIMEOUT_MS);
|
|
102
|
-
try {
|
|
103
|
-
// no device lease holds a legacy row: nothing to fence the destroy with
|
|
104
|
-
await impl.destroyByName(name, callSignal(), null);
|
|
105
|
-
await impl.destroyFileSystemByName(name, callSignal());
|
|
106
|
-
if (row.prev_provider !== null && row.prev_provider !== row.provider) {
|
|
107
|
-
const prev = this.providers.forDevice(row.prev_provider)?.impl;
|
|
108
|
-
if (prev !== undefined)
|
|
109
|
-
await prev.destroyByName(name, callSignal(), null);
|
|
110
|
-
else {
|
|
111
|
-
this.log.warn("legacy sandbox of a replaced provider left: provider not loaded", {
|
|
112
|
-
name,
|
|
113
|
-
provider: row.prev_provider,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
await this.db
|
|
118
|
-
.deleteFrom("sandboxes")
|
|
119
|
-
.where("conversation_id", "=", row.conversation_id)
|
|
120
|
-
.execute();
|
|
121
|
-
destroyed++;
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
this.log.warn("cannot destroy legacy sandbox; will retry", { name, err });
|
|
125
|
-
await this.db
|
|
126
|
-
.updateTable("sandboxes")
|
|
127
|
-
.set({ sweep_failed_at: now })
|
|
128
|
-
.where("conversation_id", "=", row.conversation_id)
|
|
129
|
-
.execute();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return { destroyed, kept };
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
__decorate([
|
|
137
|
-
LockedInterval(LEGACY_CLEANUP_JOB, () => PERIOD_MS, { ttl: CALL_TIMEOUT_MS })
|
|
138
|
-
], LegacySandboxCleanupJob.prototype, "tick", null);
|
|
139
|
-
LegacySandboxCleanupJob = __decorate([
|
|
140
|
-
Injectable(),
|
|
141
|
-
__param(0, Inject(KernelDb)),
|
|
142
|
-
__param(1, Inject(DeviceProviders)),
|
|
143
|
-
__param(2, Inject(KernelConfigService)),
|
|
144
|
-
__param(3, Inject(LockService)),
|
|
145
|
-
__param(4, Inject(KERNEL_LOGGER))
|
|
146
|
-
], LegacySandboxCleanupJob);
|
|
147
|
-
export { LegacySandboxCleanupJob };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
2
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
3
|
-
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
4
|
-
import type { KernelLogger } from "../log.js";
|
|
5
|
-
/** The one-off catch-up copy's job name and deterministic id (no `:`). */
|
|
6
|
-
export declare const FILE_LIBRARY_BACKFILL_JOB = "file-library-backfill";
|
|
7
|
-
/**
|
|
8
|
-
* The `deployment_settings` key that records the catch-up copy settled (it ran, or it was skipped
|
|
9
|
-
* because the deploy is too long ago). Not a setting a person edits: the settings reader ignores
|
|
10
|
-
* keys it does not know.
|
|
11
|
-
*/
|
|
12
|
-
export declare const FILE_LIBRARY_COPY_SETTLED = "fileLibraryCopySettled";
|
|
13
|
-
/** The migration that created the file library and its copy function. */
|
|
14
|
-
export declare const FILE_LIBRARY_MIGRATION = "0190_file_library.sql";
|
|
15
|
-
/** How long after it is owed the catch-up runs: once the rolling window of the deploy is over. */
|
|
16
|
-
export declare const BACKFILL_DELAY_MS: number;
|
|
17
|
-
/** After this many days since the migration the catch-up is skipped (nothing old is left). */
|
|
18
|
-
export declare const BACKFILL_WINDOW_DAYS = 7;
|
|
19
|
-
/** The value stored under {@link FILE_LIBRARY_COPY_SETTLED}. */
|
|
20
|
-
interface CopySettled {
|
|
21
|
-
outcome: "copied" | "skipped";
|
|
22
|
-
at: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The one-off catch-up of the file library's data copy (plan amendment K9). During a rolling deploy
|
|
26
|
-
* old replicas keep writing chat attachments, artifacts and shares the old way after migration
|
|
27
|
-
* 0191 copied them; once the window is over this job runs `file_library_copy(<0190 applied_at - 1
|
|
28
|
-
* hour>)` (idempotent) so those rows become library files, blobs and references too. It runs once
|
|
29
|
-
* (deterministic job id `file-library-backfill`, the settled marker in the copy's own transaction)
|
|
30
|
-
* and is skipped more than {@link BACKFILL_WINDOW_DAYS} days after the migration.
|
|
31
|
-
*
|
|
32
|
-
* The hashing job merges no blob before the marker exists ({@link settled}): the copy re-points a
|
|
33
|
-
* share whose blob differs from the blob of its legacy `object_key`, so a share merged before the
|
|
34
|
-
* copy would be pointed back at the merged duplicate.
|
|
35
|
-
*/
|
|
36
|
-
export declare class FileLibraryBackfill {
|
|
37
|
-
private readonly db;
|
|
38
|
-
readonly txHost: TransactionHost;
|
|
39
|
-
private readonly outbox;
|
|
40
|
-
private readonly log;
|
|
41
|
-
constructor(db: KernelDb, txHost: TransactionHost, outbox: Pick<OutboxService, "add">, log: Pick<KernelLogger, "info">);
|
|
42
|
-
/** Whether the catch-up copy settled (ran or was skipped): the hashing job may merge blobs. */
|
|
43
|
-
settled(): Promise<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* Owes the catch-up unless it settled: {@link BACKFILL_DELAY_MS} from now while the migration is
|
|
46
|
-
* within the window (the worker start of a deploy), at once otherwise (it only records the skip).
|
|
47
|
-
* Owing it again while it is waiting is a no-op (the same job id). Returns whether a row was
|
|
48
|
-
* written.
|
|
49
|
-
*/
|
|
50
|
-
ensureOwed(): Promise<boolean>;
|
|
51
|
-
private owe;
|
|
52
|
-
/**
|
|
53
|
-
* The job (deployment-wide): the copy from an hour before the migration, or the skip when the
|
|
54
|
-
* migration is older than the window; either way the settled marker, in the same transaction.
|
|
55
|
-
* Nothing to do once settled.
|
|
56
|
-
*/
|
|
57
|
-
run(): Promise<CopySettled["outcome"] | "settled">;
|
|
58
|
-
private copyOnce;
|
|
59
|
-
/** When the migration was applied (the migrator's own bookkeeping), undefined when it was not. */
|
|
60
|
-
private appliedAt;
|
|
61
|
-
private withinWindow;
|
|
62
|
-
}
|
|
63
|
-
export {};
|