@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,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The legacy-launch freeze and the retirement obligations (permission runtime cutover 8.5), with
|
|
3
|
-
* only the authority lock they publish and check under: the sandbox service gates every
|
|
4
|
-
* lifecycle acquisition on it (the same for every provider), the legacy launch checks the freeze
|
|
5
|
-
* and the worker's retirement job drives it.
|
|
6
|
-
*/
|
|
7
|
-
export declare class LegacyRetirementModule {
|
|
8
|
-
}
|
|
@@ -1,25 +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
|
-
import { Module } from "@nestjs/common";
|
|
8
|
-
import { LegacyRetirementStore } from "./legacy-retirement.js";
|
|
9
|
-
import { PermissionCeilingWritesModule } from "./permission-authority.module.js";
|
|
10
|
-
/**
|
|
11
|
-
* The legacy-launch freeze and the retirement obligations (permission runtime cutover 8.5), with
|
|
12
|
-
* only the authority lock they publish and check under: the sandbox service gates every
|
|
13
|
-
* lifecycle acquisition on it (the same for every provider), the legacy launch checks the freeze
|
|
14
|
-
* and the worker's retirement job drives it.
|
|
15
|
-
*/
|
|
16
|
-
let LegacyRetirementModule = class LegacyRetirementModule {
|
|
17
|
-
};
|
|
18
|
-
LegacyRetirementModule = __decorate([
|
|
19
|
-
Module({
|
|
20
|
-
imports: [PermissionCeilingWritesModule],
|
|
21
|
-
providers: [LegacyRetirementStore],
|
|
22
|
-
exports: [LegacyRetirementStore],
|
|
23
|
-
})
|
|
24
|
-
], LegacyRetirementModule);
|
|
25
|
-
export { LegacyRetirementModule };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
2
|
-
import { StorageService } from "../storage/storage.service.js";
|
|
3
|
-
/**
|
|
4
|
-
* Share snapshots of before the file library (file sharing spec §1, §2): generation `n` of share
|
|
5
|
-
* `id` was the object `shares/<id>/<n>` under the org's kernel prefix (`kernel/<orgId>/`), and
|
|
6
|
-
* deleting one was owed through the outbox ({@link SHARE_OBJECT_DELETE_JOB}). Shares now point at
|
|
7
|
-
* blobs (file library spec §1; 0190 made every snapshot a blob keeping its key) and nothing owes this
|
|
8
|
-
* job any more; its handler stays for the rows owed before the deploy and for old replicas during
|
|
9
|
-
* a rolling deploy, and never deletes a key a blob uses.
|
|
10
|
-
*/
|
|
11
|
-
/** The object key of a share's generation, relative to the org's kernel prefix. */
|
|
12
|
-
export declare const shareObjectKey: (shareId: string, generation: number) => string;
|
|
13
|
-
/**
|
|
14
|
-
* The lock (`LockService`) a refresh of one share holds while it picks and commits its next
|
|
15
|
-
* generation, so two refreshes of one share never race for the same generation.
|
|
16
|
-
*/
|
|
17
|
-
export declare const shareRefreshLockKey: (shareId: string) => string;
|
|
18
|
-
/** The maintenance job that deletes one share snapshot. */
|
|
19
|
-
export declare const SHARE_OBJECT_DELETE_JOB = "share-object-delete";
|
|
20
|
-
/** Deterministic outbox / BullMQ id of a snapshot's deletion (no `:`). */
|
|
21
|
-
export declare const shareObjectDeleteJobId: (shareId: string, generation: number) => string;
|
|
22
|
-
/** The data of a {@link SHARE_OBJECT_DELETE_JOB}. */
|
|
23
|
-
export interface ShareObjectDeleteData {
|
|
24
|
-
orgId: string;
|
|
25
|
-
shareId: string;
|
|
26
|
-
generation: number;
|
|
27
|
-
objectKey: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Runs a {@link SHARE_OBJECT_DELETE_JOB} (the maintenance processor dispatches it here) for the rows
|
|
31
|
-
* owed before the file library (or by an old replica during the rolling deploy). Delivered twice, it
|
|
32
|
-
* is harmless: deleting a missing object is a no-op. A key any blob of the org uses (0190 made every
|
|
33
|
-
* snapshot a blob keeping its key) is never deleted: the blob sweep owns it. A snapshot an old
|
|
34
|
-
* replica's share may still serve (the row is neither revoked nor expired and names the key) is never
|
|
35
|
-
* deleted either. `object_key` is never cleared (file library amendment K7: the contract migration
|
|
36
|
-
* drops the column).
|
|
37
|
-
*/
|
|
38
|
-
export declare class ShareObjects {
|
|
39
|
-
private readonly db;
|
|
40
|
-
private readonly storage;
|
|
41
|
-
constructor(db: KernelDb, storage: Pick<StorageService, "kernel">);
|
|
42
|
-
/** Deletes the snapshot of one share generation; see the class comment. */
|
|
43
|
-
deleteObject(data: ShareObjectDeleteData): Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
/** {@link ShareObjects} for the maintenance worker (storage and the database only). */
|
|
46
|
-
export declare class ShareObjectsModule {
|
|
47
|
-
}
|
|
@@ -1,93 +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, Module } from "@nestjs/common";
|
|
11
|
-
import { sql } from "kysely";
|
|
12
|
-
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
13
|
-
import { StorageModule } from "../storage/storage.module.js";
|
|
14
|
-
import { StorageService } from "../storage/storage.service.js";
|
|
15
|
-
/**
|
|
16
|
-
* Share snapshots of before the file library (file sharing spec §1, §2): generation `n` of share
|
|
17
|
-
* `id` was the object `shares/<id>/<n>` under the org's kernel prefix (`kernel/<orgId>/`), and
|
|
18
|
-
* deleting one was owed through the outbox ({@link SHARE_OBJECT_DELETE_JOB}). Shares now point at
|
|
19
|
-
* blobs (file library spec §1; 0190 made every snapshot a blob keeping its key) and nothing owes this
|
|
20
|
-
* job any more; its handler stays for the rows owed before the deploy and for old replicas during
|
|
21
|
-
* a rolling deploy, and never deletes a key a blob uses.
|
|
22
|
-
*/
|
|
23
|
-
/** The object key of a share's generation, relative to the org's kernel prefix. */
|
|
24
|
-
export const shareObjectKey = (shareId, generation) => `shares/${shareId}/${generation}`;
|
|
25
|
-
/**
|
|
26
|
-
* The lock (`LockService`) a refresh of one share holds while it picks and commits its next
|
|
27
|
-
* generation, so two refreshes of one share never race for the same generation.
|
|
28
|
-
*/
|
|
29
|
-
export const shareRefreshLockKey = (shareId) => `share-refresh-${shareId}`;
|
|
30
|
-
/** The maintenance job that deletes one share snapshot. */
|
|
31
|
-
export const SHARE_OBJECT_DELETE_JOB = "share-object-delete";
|
|
32
|
-
/** Deterministic outbox / BullMQ id of a snapshot's deletion (no `:`). */
|
|
33
|
-
export const shareObjectDeleteJobId = (shareId, generation) => `share-object-delete-${shareId}-${generation}`;
|
|
34
|
-
/**
|
|
35
|
-
* Runs a {@link SHARE_OBJECT_DELETE_JOB} (the maintenance processor dispatches it here) for the rows
|
|
36
|
-
* owed before the file library (or by an old replica during the rolling deploy). Delivered twice, it
|
|
37
|
-
* is harmless: deleting a missing object is a no-op. A key any blob of the org uses (0190 made every
|
|
38
|
-
* snapshot a blob keeping its key) is never deleted: the blob sweep owns it. A snapshot an old
|
|
39
|
-
* replica's share may still serve (the row is neither revoked nor expired and names the key) is never
|
|
40
|
-
* deleted either. `object_key` is never cleared (file library amendment K7: the contract migration
|
|
41
|
-
* drops the column).
|
|
42
|
-
*/
|
|
43
|
-
let ShareObjects = class ShareObjects {
|
|
44
|
-
db;
|
|
45
|
-
storage;
|
|
46
|
-
constructor(db, storage) {
|
|
47
|
-
this.db = db;
|
|
48
|
-
this.storage = storage;
|
|
49
|
-
}
|
|
50
|
-
/** Deletes the snapshot of one share generation; see the class comment. */
|
|
51
|
-
async deleteObject(data) {
|
|
52
|
-
if (data.objectKey !== shareObjectKey(data.shareId, data.generation)) {
|
|
53
|
-
// never delete anything outside the share's own key, whatever the job data says
|
|
54
|
-
throw new Error(`share-object-delete: unexpected object key for share ${data.shareId}`);
|
|
55
|
-
}
|
|
56
|
-
const blob = await this.db
|
|
57
|
-
.selectFrom("blobs")
|
|
58
|
-
.select("id")
|
|
59
|
-
.where("org_id", "=", data.orgId)
|
|
60
|
-
.where("object_key", "=", data.objectKey)
|
|
61
|
-
.executeTakeFirst();
|
|
62
|
-
if (blob)
|
|
63
|
-
return;
|
|
64
|
-
const row = await this.db
|
|
65
|
-
.selectFrom("file_shares")
|
|
66
|
-
.select([
|
|
67
|
-
"object_key",
|
|
68
|
-
"revoked_at",
|
|
69
|
-
sql `expires_at IS NOT NULL AND expires_at <= now()`.as("expired"),
|
|
70
|
-
])
|
|
71
|
-
.where("id", "=", data.shareId)
|
|
72
|
-
.where("org_id", "=", data.orgId)
|
|
73
|
-
.executeTakeFirst();
|
|
74
|
-
if (row && row.revoked_at === null && !row.expired && row.object_key === data.objectKey)
|
|
75
|
-
return;
|
|
76
|
-
const store = this.storage.kernel(data.orgId);
|
|
77
|
-
if (await store.head(data.objectKey))
|
|
78
|
-
await store.delete(data.objectKey);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
ShareObjects = __decorate([
|
|
82
|
-
Injectable(),
|
|
83
|
-
__param(0, Inject(KernelDb)),
|
|
84
|
-
__param(1, Inject(StorageService))
|
|
85
|
-
], ShareObjects);
|
|
86
|
-
export { ShareObjects };
|
|
87
|
-
/** {@link ShareObjects} for the maintenance worker (storage and the database only). */
|
|
88
|
-
let ShareObjectsModule = class ShareObjectsModule {
|
|
89
|
-
};
|
|
90
|
-
ShareObjectsModule = __decorate([
|
|
91
|
-
Module({ imports: [StorageModule], providers: [ShareObjects], exports: [ShareObjects] })
|
|
92
|
-
], ShareObjectsModule);
|
|
93
|
-
export { ShareObjectsModule };
|