@pithy-sh/storage 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capability.d.ts +45 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +76 -0
- package/dist/config/config.d.ts +27 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +49 -0
- package/dist/data/share.d.ts +27 -0
- package/dist/data/share.d.ts.map +1 -0
- package/dist/data/share.js +28 -0
- package/dist/data/storageObject.d.ts +55 -0
- package/dist/data/storageObject.d.ts.map +1 -0
- package/dist/data/storageObject.js +44 -0
- package/dist/data/tables.d.ts +23 -0
- package/dist/data/tables.d.ts.map +1 -0
- package/dist/data/tables.js +26 -0
- package/dist/error/errors.d.ts +60 -0
- package/dist/error/errors.d.ts.map +1 -0
- package/dist/error/errors.js +89 -0
- package/dist/http/guard.d.ts +20 -0
- package/dist/http/guard.d.ts.map +1 -0
- package/dist/http/guard.js +29 -0
- package/dist/http/handlers.d.ts +232 -0
- package/dist/http/handlers.d.ts.map +1 -0
- package/dist/http/handlers.js +507 -0
- package/dist/http/routes.d.ts +70 -0
- package/dist/http/routes.d.ts.map +1 -0
- package/dist/http/routes.js +135 -0
- package/dist/http/schemas.d.ts +74 -0
- package/dist/http/schemas.d.ts.map +1 -0
- package/dist/http/schemas.js +93 -0
- package/dist/http/serve.d.ts +121 -0
- package/dist/http/serve.d.ts.map +1 -0
- package/dist/http/serve.js +209 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/migrations/0001_objects.d.ts +24 -0
- package/dist/migrations/0001_objects.d.ts.map +1 -0
- package/dist/migrations/0001_objects.js +41 -0
- package/dist/object/cloudflare.d.ts +23 -0
- package/dist/object/cloudflare.d.ts.map +1 -0
- package/dist/object/cloudflare.js +48 -0
- package/dist/object/key.d.ts +29 -0
- package/dist/object/key.d.ts.map +1 -0
- package/dist/object/key.js +37 -0
- package/dist/object/multipart.d.ts +78 -0
- package/dist/object/multipart.d.ts.map +1 -0
- package/dist/object/multipart.js +131 -0
- package/dist/object/store.d.ts +203 -0
- package/dist/object/store.d.ts.map +1 -0
- package/dist/object/store.js +178 -0
- package/dist/provision/provisionStorage.d.ts +139 -0
- package/dist/provision/provisionStorage.d.ts.map +1 -0
- package/dist/provision/provisionStorage.js +112 -0
- package/dist/provision/resolveStorageConfig.d.ts +45 -0
- package/dist/provision/resolveStorageConfig.d.ts.map +1 -0
- package/dist/provision/resolveStorageConfig.js +33 -0
- package/dist/quota/quota.d.ts +127 -0
- package/dist/quota/quota.d.ts.map +1 -0
- package/dist/quota/quota.js +102 -0
- package/dist/secret/registry.d.ts +72 -0
- package/dist/secret/registry.d.ts.map +1 -0
- package/dist/secret/registry.js +84 -0
- package/dist/seeds/example.d.ts +5 -0
- package/dist/seeds/example.d.ts.map +1 -0
- package/dist/seeds/example.js +111 -0
- package/dist/test-utils/liveStorage.d.ts +52 -0
- package/dist/test-utils/liveStorage.d.ts.map +1 -0
- package/dist/test-utils/liveStorage.js +198 -0
- package/dist/version.generated.d.ts +7 -0
- package/dist/version.generated.d.ts.map +1 -0
- package/dist/version.generated.js +9 -0
- package/dist/workflows/retryPolicy.d.ts +39 -0
- package/dist/workflows/retryPolicy.d.ts.map +1 -0
- package/dist/workflows/retryPolicy.js +43 -0
- package/dist/workflows/specs.d.ts +57 -0
- package/dist/workflows/specs.d.ts.map +1 -0
- package/dist/workflows/specs.js +60 -0
- package/dist/workflows/sweep.d.ts +84 -0
- package/dist/workflows/sweep.d.ts.map +1 -0
- package/dist/workflows/sweep.js +145 -0
- package/dist/workflows/worker.d.ts +51 -0
- package/dist/workflows/worker.d.ts.map +1 -0
- package/dist/workflows/worker.js +52 -0
- package/package.json +22 -11
- package/src/version.generated.ts +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import { StorageObject } from "../data/storageObject.js";
|
|
4
|
+
import { STORAGE_OBJECTS_TABLE } from "../data/tables.js";
|
|
5
|
+
import { OBJECT_KEY_PREFIX, isDerivedObjectKey } from "../object/key.js";
|
|
6
|
+
import { QUOTA_COUNTED_STATUSES } from "../quota/quota.js";
|
|
7
|
+
import { SQLiteDate } from "@pithy-sh/core/src/data/codecs";
|
|
8
|
+
import { chunkByBoundParameters } from "@pithy-sh/core/src/data/boundParameters";
|
|
9
|
+
//#region src/workflows/sweep.ts
|
|
10
|
+
/** R2's own cap on a list page. Asking for more is silently clamped, so ask for exactly this. */
|
|
11
|
+
const LIST_PAGE_SIZE = 1e3;
|
|
12
|
+
/** Default cap on pages per run: a million keys, which is a long sweep and a sane bound. */
|
|
13
|
+
const DEFAULT_MAX_PAGES = 1e3;
|
|
14
|
+
/**
|
|
15
|
+
* The membership lookup binds its status filter besides the key list, so the chunk gets D1's budget
|
|
16
|
+
* less those two. Add another `where` to that query and this number moves with it.
|
|
17
|
+
*/
|
|
18
|
+
const CLAIMED_KEYS_FIXED_PARAMETERS = QUOTA_COUNTED_STATUSES.length;
|
|
19
|
+
/**
|
|
20
|
+
* Reclaim `pending` rows older than the cutoff.
|
|
21
|
+
*
|
|
22
|
+
* Each row's in-flight multipart is aborted (R2 bills stored parts, so leaving them is a real cost),
|
|
23
|
+
* then any bytes that did land are deleted, then the row goes — object first, row second, so a
|
|
24
|
+
* failure part-way leaves an object with no row, which the second phase collects. The other order
|
|
25
|
+
* would leave a row pointing at nothing, which nothing collects.
|
|
26
|
+
*
|
|
27
|
+
* Both R2 calls are best-effort. An upload id R2 has already forgotten, or a key that was never
|
|
28
|
+
* written, must not stop the row from being reclaimed — the whole point of the run is to unwedge
|
|
29
|
+
* state, not to insist it was tidy.
|
|
30
|
+
*/
|
|
31
|
+
async function reclaimPendingRows(deps, cutoff) {
|
|
32
|
+
const rows = await deps.db.selectFrom(STORAGE_OBJECTS_TABLE).selectAll().where("status", "=", "pending").where("createdAt", "<", SQLiteDate.encode(cutoff)).execute();
|
|
33
|
+
if (deps.dryRun) return rows.length;
|
|
34
|
+
let reclaimed = 0;
|
|
35
|
+
for (const row of rows) {
|
|
36
|
+
const object = StorageObject.parse(row);
|
|
37
|
+
if (object.uploadId) await deps.store.abortMultipart(object.key, object.uploadId).catch(() => {});
|
|
38
|
+
await deps.store.delete(object.key).catch(() => {});
|
|
39
|
+
await deps.db.deleteFrom(STORAGE_OBJECTS_TABLE).where("id", "=", object.id).execute();
|
|
40
|
+
reclaimed += 1;
|
|
41
|
+
}
|
|
42
|
+
return reclaimed;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Delete bucket objects that no row claims.
|
|
46
|
+
*
|
|
47
|
+
* **A row claims a key only while it bills for it.** The membership test filters on the same statuses
|
|
48
|
+
* the quota sums ({@link QUOTA_COUNTED_STATUSES}), so a `failed` row — the record an abort or a refused
|
|
49
|
+
* completion leaves behind — reserves nothing *and* shields nothing. Without that filter the two
|
|
50
|
+
* predicates disagree, and the disagreement is a leak with no floor: abort a single-PUT upload, PUT to
|
|
51
|
+
* the presigned URL you still hold, and the surviving `failed` row marks the key as claimed forever
|
|
52
|
+
* while `usedBytes` counts none of it. Phase one skips it (it only reclaims `pending` rows), so nothing
|
|
53
|
+
* automated would ever collect those bytes again.
|
|
54
|
+
*
|
|
55
|
+
* The row itself is left alone either way. It is the owner's record that an upload was attempted and
|
|
56
|
+
* abandoned; only its claim on the bytes is withdrawn.
|
|
57
|
+
*
|
|
58
|
+
* The membership test is a batched `WHERE key IN (…)` rather than one query per key: a page is a
|
|
59
|
+
* thousand keys, and a thousand round trips to D1 is the difference between a sweep that finishes and
|
|
60
|
+
* one that times out. It is batched rather than one query per page because D1 caps a statement at 100
|
|
61
|
+
* bound parameters and a page carries up to a thousand keys — so the page is chunked under that cap
|
|
62
|
+
* and the claimed sets unioned before anything is deleted. The two limits are unrelated knobs: the
|
|
63
|
+
* page size is R2's listing cost, the chunk size is D1's statement cost, and tying one to the other
|
|
64
|
+
* would be a coincidence rather than a reason.
|
|
65
|
+
*
|
|
66
|
+
* Only keys this capability derived are considered, and only ones older than the cutoff — see the
|
|
67
|
+
* module comment on why the age check is load-bearing rather than cautious.
|
|
68
|
+
*/
|
|
69
|
+
async function deleteOrphanedObjects(deps, cutoff) {
|
|
70
|
+
const maxPages = deps.maxPages ?? DEFAULT_MAX_PAGES;
|
|
71
|
+
let cursor;
|
|
72
|
+
let deleted = 0;
|
|
73
|
+
let scanned = 0;
|
|
74
|
+
let pages = 0;
|
|
75
|
+
for (;;) {
|
|
76
|
+
const page = await deps.store.list({
|
|
77
|
+
prefix: OBJECT_KEY_PREFIX,
|
|
78
|
+
cursor,
|
|
79
|
+
limit: deps.pageSize ?? LIST_PAGE_SIZE
|
|
80
|
+
});
|
|
81
|
+
pages += 1;
|
|
82
|
+
scanned += page.objects.length;
|
|
83
|
+
const candidates = page.objects.filter((object) => isDerivedObjectKey(object.key) && object.uploaded.getTime() < cutoff.getTime());
|
|
84
|
+
if (candidates.length > 0) {
|
|
85
|
+
const keys = candidates.map((object) => object.key);
|
|
86
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
87
|
+
for (const group of chunkByBoundParameters(keys, CLAIMED_KEYS_FIXED_PARAMETERS)) {
|
|
88
|
+
const known = await deps.db.selectFrom(STORAGE_OBJECTS_TABLE).select("key").where("key", "in", group).where("status", "in", [...QUOTA_COUNTED_STATUSES]).execute();
|
|
89
|
+
for (const row of known) claimed.add(row.key);
|
|
90
|
+
}
|
|
91
|
+
for (const object of candidates) {
|
|
92
|
+
if (claimed.has(object.key)) continue;
|
|
93
|
+
if (!deps.dryRun) await deps.store.delete(object.key).catch(() => {});
|
|
94
|
+
deleted += 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
cursor = page.cursor;
|
|
98
|
+
if (!cursor) return {
|
|
99
|
+
deleted,
|
|
100
|
+
scanned,
|
|
101
|
+
truncated: false
|
|
102
|
+
};
|
|
103
|
+
if (pages >= maxPages) return {
|
|
104
|
+
deleted,
|
|
105
|
+
scanned,
|
|
106
|
+
truncated: true
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Run one sweep. Idempotent by construction — a second run over a reconciled bucket finds nothing and
|
|
112
|
+
* deletes nothing — so a retried Workflow step, a manual trigger after a cron, and a nervous operator
|
|
113
|
+
* running it twice all cost the same.
|
|
114
|
+
*/
|
|
115
|
+
async function sweepStorage(deps) {
|
|
116
|
+
const cutoff = /* @__PURE__ */ new Date(deps.now().getTime() - deps.ttlSeconds * 1e3);
|
|
117
|
+
const reclaimedRows = await reclaimPendingRows(deps, cutoff);
|
|
118
|
+
const objects = await deleteOrphanedObjects(deps, cutoff);
|
|
119
|
+
return {
|
|
120
|
+
reclaimedRows,
|
|
121
|
+
deletedObjects: objects.deleted,
|
|
122
|
+
scannedObjects: objects.scanned,
|
|
123
|
+
truncated: objects.truncated,
|
|
124
|
+
dryRun: deps.dryRun === true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Report a finished run. The tally is the sweep's only visible output — a sweep whose findings are
|
|
129
|
+
* invisible is a sweep nobody can tell has stopped working — so it goes out as fields, which is what
|
|
130
|
+
* makes "how much quota did we reclaim this month" a query rather than a grep.
|
|
131
|
+
*
|
|
132
|
+
* A truncated run is `warn`, not `info`. It succeeded and left part of the bucket unexamined, so the
|
|
133
|
+
* orphans it did not reach are paid for until a later pass gets to them. That is the one outcome an
|
|
134
|
+
* operator should be able to find without reading every run that went fine.
|
|
135
|
+
*/
|
|
136
|
+
function reportSweep(log, result) {
|
|
137
|
+
const fields = { ...result };
|
|
138
|
+
if (result.truncated) {
|
|
139
|
+
log.warn("storage sweep stopped at its page cap", fields);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
log.info("storage sweep complete", fields);
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { reportSweep, sweepStorage };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import { WorkflowEntrypoint, type WorkflowEvent, type WorkflowStep } from "cloudflare:workers";
|
|
4
|
+
import type { D1Database, R2Bucket } from "@cloudflare/workers-types";
|
|
5
|
+
import type { SecretsStoreEnv } from "@pithy-sh/secrets/src/env/bindings";
|
|
6
|
+
import { StorageSweepParams } from "./specs";
|
|
7
|
+
/**
|
|
8
|
+
* The prebuilt storage sweep worker. `pithy storage provision` deploys one per environment; the
|
|
9
|
+
* adopter authors none of it. It hosts a single Workflow — the orphan sweep — and fires it on a daily
|
|
10
|
+
* cron.
|
|
11
|
+
*
|
|
12
|
+
* **Why its own worker rather than the app worker's `scheduled()`.** The sweep lists an entire bucket
|
|
13
|
+
* and can delete from it. Keeping it out of the request-serving deployment means it cannot compete
|
|
14
|
+
* with a user's download for CPU, and — more to the point — the app worker never needs a binding that
|
|
15
|
+
* can delete arbitrary objects. It is also a Workflow rather than a plain scheduled pass because a
|
|
16
|
+
* Worker invocation is wall-clock bounded while a Workflow step is not: a bucket with a million keys
|
|
17
|
+
* is a thousand list pages, and that is a job you want checkpointed rather than restarted.
|
|
18
|
+
*
|
|
19
|
+
* This module imports `cloudflare:workers`, so it runs only in the Workers runtime and is excluded
|
|
20
|
+
* from the node `.describe()` meta-test.
|
|
21
|
+
*/
|
|
22
|
+
/** The sweep worker's env: the app database, the bucket, the master key, and the resolved config. */
|
|
23
|
+
export interface StorageWorkerEnv extends SecretsStoreEnv {
|
|
24
|
+
/** The app database the `pithy_storage_*` tables live in. */
|
|
25
|
+
DB: D1Database;
|
|
26
|
+
/** The bucket the sweep lists and deletes from. */
|
|
27
|
+
STORAGE_BUCKET: R2Bucket;
|
|
28
|
+
/** The resolved storage config as a JSON string, filled at provision. Absent falls back to defaults. */
|
|
29
|
+
STORAGE_CONFIG?: string;
|
|
30
|
+
/** This worker's own Workflow binding — how `scheduled()` starts an instance. */
|
|
31
|
+
STORAGE_SWEEP: {
|
|
32
|
+
create(options?: {
|
|
33
|
+
id?: string;
|
|
34
|
+
params?: unknown;
|
|
35
|
+
}): Promise<unknown>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** The orphan sweep, as a cron-triggered Workflow. One step, because one run is one reconciliation. */
|
|
39
|
+
export declare class StorageSweepWorkflow extends WorkflowEntrypoint<StorageWorkerEnv, StorageSweepParams> {
|
|
40
|
+
run(event: WorkflowEvent<StorageSweepParams>, step: WorkflowStep): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
declare const _default: {
|
|
43
|
+
/**
|
|
44
|
+
* Cron entry: start one sweep instance per fire, with empty parameters — the defaults are the
|
|
45
|
+
* scheduled behavior. The same Workflow stays dispatchable with a payload (`dryRun`, a shorter
|
|
46
|
+
* TTL, a page cap), which is how the sweep is exercised in staging without waiting for 03:00.
|
|
47
|
+
*/
|
|
48
|
+
scheduled(_controller: unknown, env: StorageWorkerEnv): Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
export default _default;
|
|
51
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/workflows/worker.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE/F,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAO1E,OAAO,EAAsB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGjE;;;;;;;;;;;;;;GAcG;AAEH,qGAAqG;AACrG,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,6DAA6D;IAC7D,EAAE,EAAE,UAAU,CAAC;IACf,mDAAmD;IACnD,cAAc,EAAE,QAAQ,CAAC;IACzB,wGAAwG;IACxG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,aAAa,EAAE;QAAE,MAAM,CAAC,OAAO,CAAC,EAAE;YAAE,EAAE,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,OAAO,CAAA;SAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;CAC1F;AAMD,uGAAuG;AACvG,qBAAa,oBAAqB,SAAQ,kBAAkB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;IACjF,GAAG,CAAC,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsC9F;CACF;;IAGC;;;;OAIG;IACG,SAAS,cAAc,OAAO,OAAO,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import { StorageConfig } from "../config/config.js";
|
|
4
|
+
import { storageDatabase } from "../data/tables.js";
|
|
5
|
+
import { STORAGE_R2_SECRET, storageSecretsRegistry } from "../secret/registry.js";
|
|
6
|
+
import { objectStore } from "../object/store.js";
|
|
7
|
+
import { STORAGE_CAPABILITY, StorageSweepParams } from "./specs.js";
|
|
8
|
+
import { reportSweep, sweepStorage } from "./sweep.js";
|
|
9
|
+
import { storageWorkflowRetry } from "./retryPolicy.js";
|
|
10
|
+
import { configureSharedSecrets } from "@pithy-sh/secrets/src/sharedSecretsStore";
|
|
11
|
+
import { WorkflowEntrypoint } from "cloudflare:workers";
|
|
12
|
+
import { NonRetryableError } from "cloudflare:workflows";
|
|
13
|
+
import { bindWorkflowContext, createWorkerLogger } from "@pithy-sh/core/src/logger/worker";
|
|
14
|
+
import { classifiedSteps } from "@pithy-sh/core/src/workflow/faults";
|
|
15
|
+
//#region src/workflows/worker.ts
|
|
16
|
+
configureSharedSecrets({ registry: storageSecretsRegistry });
|
|
17
|
+
/** The orphan sweep, as a cron-triggered Workflow. One step, because one run is one reconciliation. */
|
|
18
|
+
var StorageSweepWorkflow = class extends WorkflowEntrypoint {
|
|
19
|
+
async run(event, step) {
|
|
20
|
+
const params = StorageSweepParams.parse(event.payload ?? {});
|
|
21
|
+
const config = StorageConfig.parse(this.env.STORAGE_CONFIG ? JSON.parse(this.env.STORAGE_CONFIG) : {});
|
|
22
|
+
const log = bindWorkflowContext(createWorkerLogger({ name: STORAGE_CAPABILITY }), {
|
|
23
|
+
workflow: event.workflowName,
|
|
24
|
+
instance: event.instanceId,
|
|
25
|
+
env: this.env.ENVIRONMENT ?? "unknown"
|
|
26
|
+
});
|
|
27
|
+
const result = await classifiedSteps(step, storageWorkflowRetry, NonRetryableError).do("sweep", async () => sweepStorage({
|
|
28
|
+
db: storageDatabase(this.env.DB),
|
|
29
|
+
store: objectStore({
|
|
30
|
+
bucket: this.env.STORAGE_BUCKET,
|
|
31
|
+
env: this.env,
|
|
32
|
+
secretName: STORAGE_R2_SECRET
|
|
33
|
+
}),
|
|
34
|
+
now: () => /* @__PURE__ */ new Date(),
|
|
35
|
+
ttlSeconds: params.olderThanSeconds ?? config.pendingTtlSeconds,
|
|
36
|
+
dryRun: params.dryRun,
|
|
37
|
+
maxPages: params.maxPages
|
|
38
|
+
}));
|
|
39
|
+
reportSweep(log, result);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var worker_default = {
|
|
43
|
+
/**
|
|
44
|
+
* Cron entry: start one sweep instance per fire, with empty parameters — the defaults are the
|
|
45
|
+
* scheduled behavior. The same Workflow stays dispatchable with a payload (`dryRun`, a shorter
|
|
46
|
+
* TTL, a page cap), which is how the sweep is exercised in staging without waiting for 03:00.
|
|
47
|
+
*/
|
|
48
|
+
async scheduled(_controller, env) {
|
|
49
|
+
await env.STORAGE_SWEEP.create({ params: {} });
|
|
50
|
+
} };
|
|
51
|
+
//#endregion
|
|
52
|
+
export { StorageSweepWorkflow, worker_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/storage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,19 +8,24 @@
|
|
|
8
8
|
"directory": "packages/storage"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
+
"dist",
|
|
11
12
|
"src",
|
|
12
13
|
"pithy.manifest.json",
|
|
13
|
-
"!src/**/*.test.*"
|
|
14
|
+
"!src/**/*.test.*",
|
|
15
|
+
"!dist/**/*.test.*"
|
|
14
16
|
],
|
|
15
17
|
"type": "module",
|
|
16
18
|
"engines": {
|
|
17
19
|
"node": ">=22"
|
|
18
20
|
},
|
|
19
21
|
"exports": {
|
|
20
|
-
"./src/*":
|
|
22
|
+
"./src/*": {
|
|
23
|
+
"types": "./dist/*.d.ts",
|
|
24
|
+
"default": "./dist/*.js"
|
|
25
|
+
}
|
|
21
26
|
},
|
|
22
27
|
"scripts": {
|
|
23
|
-
"build": "tsc -p tsconfig.json
|
|
28
|
+
"build": "tsdown && tsc -p tsconfig.build.json && bun ../../tooling/build/src/stampDeclarations.ts",
|
|
24
29
|
"typecheck": "tsc -p tsconfig.json",
|
|
25
30
|
"test": "vitest run",
|
|
26
31
|
"test:node": "vitest run --project=node",
|
|
@@ -32,21 +37,27 @@
|
|
|
32
37
|
"dependencies": {
|
|
33
38
|
"@cloudflare/workers-types": "^5.20260729.1",
|
|
34
39
|
"@hono/zod-validator": "^0.9.0",
|
|
35
|
-
"@pithy-sh/cloudflare": "^0.1.
|
|
36
|
-
"@pithy-sh/core": "^0.1.
|
|
37
|
-
"@pithy-sh/secrets": "^0.1.
|
|
38
|
-
"hono": "^4.13.2",
|
|
39
|
-
"kysely": "^0.29.0",
|
|
40
|
-
"zod": "^4.0.0"
|
|
40
|
+
"@pithy-sh/cloudflare": "^0.1.4",
|
|
41
|
+
"@pithy-sh/core": "^0.1.5",
|
|
42
|
+
"@pithy-sh/secrets": "^0.1.4"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@cloudflare/vitest-plugin": "^1.0.0",
|
|
44
46
|
"@pithy-sh/tsconfig": "workspace:*",
|
|
45
47
|
"@types/node": "^22.15.0",
|
|
46
48
|
"@vitest/coverage-v8": "^4.1.0",
|
|
49
|
+
"hono": "^4.13.2",
|
|
50
|
+
"kysely": "^0.29.0",
|
|
47
51
|
"kysely-d1": "^0.4.0",
|
|
52
|
+
"tsdown": "^0.23.0",
|
|
48
53
|
"typescript": "^7.0.2",
|
|
49
54
|
"vitest": "^4.1.0",
|
|
50
|
-
"wrangler": "^4.115.0"
|
|
55
|
+
"wrangler": "^4.115.0",
|
|
56
|
+
"zod": "^4.4.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"hono": "^4.13.2",
|
|
60
|
+
"kysely": "^0.29.0",
|
|
61
|
+
"zod": "^4.4.0"
|
|
51
62
|
}
|
|
52
63
|
}
|
package/src/version.generated.ts
CHANGED