@rubytech/create-maxy-code 0.1.457 → 0.1.459
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/package.json +1 -1
- package/payload/platform/lib/mcp-lifeline/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/mcp-lifeline/dist/index.js +22 -1
- package/payload/platform/lib/mcp-lifeline/dist/index.js.map +1 -1
- package/payload/platform/lib/mcp-lifeline/src/__tests__/lifeline.test.ts +26 -0
- package/payload/platform/lib/mcp-lifeline/src/index.ts +24 -1
- package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js +322 -2
- package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.d.ts +2 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.d.ts.map +1 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js +59 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js.map +1 -0
- package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts +12 -1
- package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts.map +1 -1
- package/payload/platform/lib/storage-broker/dist/cf-exec.js +156 -26
- package/payload/platform/lib/storage-broker/dist/cf-exec.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/house-credential.d.ts.map +1 -1
- package/payload/platform/lib/storage-broker/dist/house-credential.js +8 -2
- package/payload/platform/lib/storage-broker/dist/house-credential.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/index.d.ts +1 -0
- package/payload/platform/lib/storage-broker/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/storage-broker/dist/index.js +1 -0
- package/payload/platform/lib/storage-broker/dist/index.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/object-limits.d.ts +53 -0
- package/payload/platform/lib/storage-broker/dist/object-limits.d.ts.map +1 -0
- package/payload/platform/lib/storage-broker/dist/object-limits.js +72 -0
- package/payload/platform/lib/storage-broker/dist/object-limits.js.map +1 -0
- package/payload/platform/lib/storage-broker/src/__tests__/cf-exec.test.ts +362 -3
- package/payload/platform/lib/storage-broker/src/__tests__/object-limits.test.ts +76 -0
- package/payload/platform/lib/storage-broker/src/cf-exec.ts +230 -44
- package/payload/platform/lib/storage-broker/src/house-credential.ts +8 -2
- package/payload/platform/lib/storage-broker/src/index.ts +1 -0
- package/payload/platform/lib/storage-broker/src/object-limits.ts +75 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +5 -5
- package/payload/platform/plugins/cloudflare/bin/__tests__/cf-token.test.sh +145 -4
- package/payload/platform/plugins/cloudflare/bin/cf-token.sh +61 -3
- package/payload/platform/plugins/cloudflare/references/api.md +1 -1
- package/payload/platform/plugins/cloudflare/skills/cloudflare/SKILL.md +1 -1
- package/payload/platform/plugins/docs/references/outlook-guide.md +4 -4
- package/payload/platform/plugins/outlook/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/outlook/PLUGIN.md +2 -2
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.js +138 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.js +121 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.js +102 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js +16 -3
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/graph-client.test.js +108 -1
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/graph-client.test.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.js +209 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/index.js +10 -7
- package/payload/platform/plugins/outlook/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.d.ts +37 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.js +79 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.d.ts +42 -15
- package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.js +32 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts +8 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.js +4 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts +31 -8
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.js +40 -13
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.d.ts +9 -5
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.js +12 -8
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-event.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-event.js +3 -5
- package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-event.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts +36 -4
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js +56 -9
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts +13 -2
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js +18 -4
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js +3 -4
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js +2 -4
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js +3 -20
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.d.ts +27 -3
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js +53 -8
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js.map +1 -1
- package/payload/platform/plugins/outlook/references/graph-surfaces.md +41 -6
- package/payload/platform/plugins/outlook/skills/outlook/SKILL.md +22 -5
- package/payload/platform/plugins/storage-broker/PLUGIN.md +41 -2
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.d.ts +2 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.js +85 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.js.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.d.ts +2 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.js +77 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.js.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.d.ts +12 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js +107 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/index.js +86 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.d.ts +11 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.js +35 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.js.map +1 -0
- package/payload/platform/scripts/logs-read-jsonl.test.sh +118 -0
- package/payload/platform/scripts/logs-read.sh +63 -9
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +4 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/server/{chunk-F4D35LKL.js → chunk-POBXIHOF.js} +34 -0
- package/payload/server/{chunk-SDYRKIYY.js → chunk-Q6W4U6HL.js} +153 -27
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/server.js +206 -6
- package/payload/server/{src-554BYJMN.js → src-3I2RYZFB.js} +9 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
7
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
8
|
+
const object_limits_js_1 = require("../object-limits.js");
|
|
9
|
+
(0, node_test_1.default)("the cap is 100 MiB", () => {
|
|
10
|
+
strict_1.default.equal(object_limits_js_1.R2_OBJECT_MAX_BYTES, 100 * 1024 * 1024);
|
|
11
|
+
});
|
|
12
|
+
// The cap is set independently of email's 25 MiB. This pins that they are not
|
|
13
|
+
// the same number, so a future edit that "unifies" them fails here and has to
|
|
14
|
+
// read the design note rather than silently coupling two unrelated limits.
|
|
15
|
+
(0, node_test_1.default)("the cap is not email's attachment cap", () => {
|
|
16
|
+
strict_1.default.notEqual(object_limits_js_1.R2_OBJECT_MAX_BYTES, 25 * 1024 * 1024);
|
|
17
|
+
});
|
|
18
|
+
(0, node_test_1.default)("base64Ceiling matches base64's 4-out-per-3-in expansion, rounded up", () => {
|
|
19
|
+
strict_1.default.equal((0, object_limits_js_1.base64Ceiling)(0), 0);
|
|
20
|
+
strict_1.default.equal((0, object_limits_js_1.base64Ceiling)(1), 4);
|
|
21
|
+
strict_1.default.equal((0, object_limits_js_1.base64Ceiling)(3), 4);
|
|
22
|
+
strict_1.default.equal((0, object_limits_js_1.base64Ceiling)(4), 8);
|
|
23
|
+
strict_1.default.equal((0, object_limits_js_1.base64Ceiling)(6), 8);
|
|
24
|
+
});
|
|
25
|
+
// The ceiling must never sit below what a legal at-cap object actually encodes
|
|
26
|
+
// to, or a legitimate put would be rejected by its own encoding.
|
|
27
|
+
(0, node_test_1.default)("base64Ceiling is never below Node's own base64 length", () => {
|
|
28
|
+
for (const n of [0, 1, 2, 3, 4, 5, 100, 1023, 4096]) {
|
|
29
|
+
const encoded = Buffer.alloc(n).toString("base64").length;
|
|
30
|
+
strict_1.default.ok((0, object_limits_js_1.base64Ceiling)(n) >= encoded, `base64Ceiling(${n}) = ${(0, object_limits_js_1.base64Ceiling)(n)} < ${encoded}`);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
(0, node_test_1.default)("the put body ceiling admits a cap-sized object plus an envelope allowance", () => {
|
|
34
|
+
strict_1.default.equal(object_limits_js_1.R2_OBJECT_PUT_MAX_BODY_BYTES, (0, object_limits_js_1.base64Ceiling)(object_limits_js_1.R2_OBJECT_MAX_BYTES) + 64 * 1024);
|
|
35
|
+
strict_1.default.ok(object_limits_js_1.R2_OBJECT_PUT_MAX_BODY_BYTES > (0, object_limits_js_1.base64Ceiling)(object_limits_js_1.R2_OBJECT_MAX_BYTES));
|
|
36
|
+
});
|
|
37
|
+
// The allowance is for a key and JSON punctuation, not for smuggling a bigger
|
|
38
|
+
// object: it must stay far below the cap it guards.
|
|
39
|
+
(0, node_test_1.default)("the envelope allowance is negligible against the cap", () => {
|
|
40
|
+
const allowance = object_limits_js_1.R2_OBJECT_PUT_MAX_BODY_BYTES - (0, object_limits_js_1.base64Ceiling)(object_limits_js_1.R2_OBJECT_MAX_BYTES);
|
|
41
|
+
strict_1.default.ok(allowance < object_limits_js_1.R2_OBJECT_MAX_BYTES / 1000);
|
|
42
|
+
});
|
|
43
|
+
(0, node_test_1.default)("the over-cap message names the object and the limit", () => {
|
|
44
|
+
const msg = (0, object_limits_js_1.tooLargeMessage)("photo.jpg", 150 * 1024 * 1024);
|
|
45
|
+
strict_1.default.match(msg, /photo\.jpg/);
|
|
46
|
+
strict_1.default.match(msg, /150\.0 MiB/);
|
|
47
|
+
strict_1.default.match(msg, /100\.0 MiB/);
|
|
48
|
+
});
|
|
49
|
+
// Code review — MiB alone rounds, so an object one byte over the cap rendered as
|
|
50
|
+
// "100.0 MiB, which exceeds the 100.0 MiB limit": a message that contradicts
|
|
51
|
+
// itself and reads as a bug rather than a rejection. The exact bytes are what
|
|
52
|
+
// disambiguate it, so they are pinned rather than left to formatting taste.
|
|
53
|
+
(0, node_test_1.default)("the message stays legible for an object one byte over the cap", () => {
|
|
54
|
+
const msg = (0, object_limits_js_1.tooLargeMessage)("photo.jpg", object_limits_js_1.R2_OBJECT_MAX_BYTES + 1);
|
|
55
|
+
strict_1.default.match(msg, /104857601 bytes/);
|
|
56
|
+
strict_1.default.match(msg, /104857600 bytes/);
|
|
57
|
+
strict_1.default.notEqual(msg.match(/100\.0 MiB \(104857601 bytes\)/), null, "the actual size must carry its exact byte count");
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=object-limits.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-limits.test.js","sourceRoot":"","sources":["../../src/__tests__/object-limits.test.ts"],"names":[],"mappings":";;;;;AAAA,0DAA6B;AAC7B,gEAAwC;AACxC,0DAK6B;AAE7B,IA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G,IAAA,kCAAe,EAAC,WAAW,EAAE,sCAAmB,GAAG,CAAC,CAAC,CAAC;IAClE,gBAAM,CAAC,KAAK,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IACrC,gBAAM,CAAC,KAAK,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IACrC,gBAAM,CAAC,QAAQ,CACb,GAAG,CAAC,KAAK,CAAC,gCAAgC,CAAC,EAC3C,IAAI,EACJ,iDAAiD,CAClD,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -5,12 +5,19 @@ export type RunFn = (cmd: string, args: string[], env: Record<string, string>) =
|
|
|
5
5
|
export type FetchFn = (url: string, init: {
|
|
6
6
|
method: string;
|
|
7
7
|
headers: Record<string, string>;
|
|
8
|
-
body?: string;
|
|
8
|
+
body?: string | Uint8Array;
|
|
9
9
|
}) => Promise<{
|
|
10
10
|
ok: boolean;
|
|
11
11
|
status: number;
|
|
12
12
|
text(): Promise<string>;
|
|
13
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
13
14
|
}>;
|
|
15
|
+
export interface R2Object {
|
|
16
|
+
key: string;
|
|
17
|
+
size: number;
|
|
18
|
+
etag: string;
|
|
19
|
+
lastModified: string;
|
|
20
|
+
}
|
|
14
21
|
export interface CfExec {
|
|
15
22
|
d1List(): Promise<{
|
|
16
23
|
name: string;
|
|
@@ -24,6 +31,10 @@ export interface CfExec {
|
|
|
24
31
|
name: string;
|
|
25
32
|
}[]>;
|
|
26
33
|
r2Create(name: string): Promise<void>;
|
|
34
|
+
r2ObjectList(bucket: string, prefix?: string): Promise<R2Object[]>;
|
|
35
|
+
r2ObjectGet(bucket: string, key: string): Promise<Uint8Array>;
|
|
36
|
+
r2ObjectPut(bucket: string, key: string, body: Uint8Array): Promise<void>;
|
|
37
|
+
r2ObjectDelete(bucket: string, key: string): Promise<void>;
|
|
27
38
|
}
|
|
28
39
|
export declare function makeCfExec(cred: HouseCredential, run?: RunFn, fetchFn?: FetchFn): CfExec;
|
|
29
40
|
export declare function makeHouseCfExec(platformRoot: string, run?: RunFn, fetchFn?: FetchFn): Promise<CfExec>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cf-exec.d.ts","sourceRoot":"","sources":["../src/cf-exec.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,MAAM,MAAM,KAAK,GAAG,CAClB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACxB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cf-exec.d.ts","sourceRoot":"","sources":["../src/cf-exec.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,MAAM,MAAM,KAAK,GAAG,CAClB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACxB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAYjC,MAAM,MAAM,OAAO,GAAG,CACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,KAClF,OAAO,CAAC;IACX,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CACrC,CAAC,CAAC;AAEH,MAAM,WAAW,QAAQ;IACvB,GAA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AAO,GAAE,OAAsB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAMjB"}
|
|
@@ -9,6 +9,24 @@ const node_child_process_1 = require("node:child_process");
|
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
10
10
|
const house_credential_js_1 = require("./house-credential.js");
|
|
11
11
|
const house_scoped_token_js_1 = require("./house-scoped-token.js");
|
|
12
|
+
// An object key carries `/` as a real path separator (the data portal's
|
|
13
|
+
// per-person prefixes), so it is encoded segment-wise rather than whole:
|
|
14
|
+
// separators stay separators, and spaces and specials are escaped. This
|
|
15
|
+
// encoding is not doc-confirmed; it is chosen so that a wrong guess surfaces as
|
|
16
|
+
// a 404 carrying its body, never as a silently misfiled object.
|
|
17
|
+
function encodeObjectKey(key) {
|
|
18
|
+
return key.split("/").map(encodeURIComponent).join("/");
|
|
19
|
+
}
|
|
20
|
+
// The single-object endpoint, shared by get/put/delete so the three cannot drift
|
|
21
|
+
// apart on encoding.
|
|
22
|
+
function objectUrl(accountId, bucket, key) {
|
|
23
|
+
return `https://api.cloudflare.com/client/v4/accounts/${accountId}/r2/buckets/${encodeURIComponent(bucket)}/objects/${encodeObjectKey(key)}`;
|
|
24
|
+
}
|
|
25
|
+
// The cast is confined to this adapter. A Uint8Array is a valid fetch body at
|
|
26
|
+
// runtime, but the DOM lib's BodyInit does not admit TypeScript's generic
|
|
27
|
+
// Uint8Array<ArrayBufferLike>, so consumers compiled against DOM typings (the
|
|
28
|
+
// ui server) reject the call the Node typings accept. Casting here keeps the
|
|
29
|
+
// seam's own type honest for every caller and test.
|
|
12
30
|
const defaultFetch = (url, init) => fetch(url, init);
|
|
13
31
|
const defaultRun = (cmd, args, env) => new Promise((resolve, reject) => {
|
|
14
32
|
(0, node_child_process_1.execFile)(cmd, args, { env }, (err, stdout, stderr) => {
|
|
@@ -27,6 +45,28 @@ function parseJson(raw, context) {
|
|
|
27
45
|
throw new Error(`storage-broker: ${context} returned non-JSON output: ${raw}`);
|
|
28
46
|
}
|
|
29
47
|
}
|
|
48
|
+
// The Cloudflare-API envelope, in one place. Both API-backed methods (r2List,
|
|
49
|
+
// d1Create) share it: read the body exactly once, surface a non-2xx with its
|
|
50
|
+
// body, parse, then require an explicit `success:true`. A 2xx whose body is not
|
|
51
|
+
// a well-formed success envelope is an anomaly to surface with its body, never
|
|
52
|
+
// a silently empty/uuid-less result. The raw `body` is returned alongside the
|
|
53
|
+
// parsed value so callers can raise their own shaping errors on the original
|
|
54
|
+
// bytes rather than a re-serialised copy.
|
|
55
|
+
async function cfApiJson(fetchFn, url, init, context) {
|
|
56
|
+
const res = await fetchFn(url, init);
|
|
57
|
+
const body = await res.text();
|
|
58
|
+
if (!res.ok) {
|
|
59
|
+
throw new Error(`storage-broker: ${context} failed: ${res.status}\n${body}`);
|
|
60
|
+
}
|
|
61
|
+
// `null` is valid JSON and survives parseJson, so the guard is optional-
|
|
62
|
+
// chained: a null parsed value must surface its body like any other malformed
|
|
63
|
+
// 2xx shape, never a bare TypeError with the body dropped.
|
|
64
|
+
const parsed = parseJson(body, context);
|
|
65
|
+
if (parsed?.success !== true) {
|
|
66
|
+
throw new Error(`storage-broker: ${context} API error: ${body}`);
|
|
67
|
+
}
|
|
68
|
+
return { parsed, body };
|
|
69
|
+
}
|
|
30
70
|
function makeCfExec(cred, run = defaultRun, fetchFn = defaultFetch) {
|
|
31
71
|
const env = {
|
|
32
72
|
...process.env,
|
|
@@ -46,26 +86,21 @@ function makeCfExec(cred, run = defaultRun, fetchFn = defaultFetch) {
|
|
|
46
86
|
// so shelling it with --json is always rejected. The D1 API creates the
|
|
47
87
|
// database and returns its record — incl. the uuid — as JSON directly.
|
|
48
88
|
const url = `https://api.cloudflare.com/client/v4/accounts/${cred.accountId}/d1/database`;
|
|
49
|
-
const
|
|
89
|
+
const { parsed, body } = await cfApiJson(fetchFn, url, {
|
|
50
90
|
method: "POST",
|
|
51
91
|
headers: {
|
|
52
92
|
Authorization: `Bearer ${cred.apiToken}`,
|
|
53
93
|
"Content-Type": "application/json",
|
|
54
94
|
},
|
|
55
95
|
body: JSON.stringify({ name }),
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const parsed = parseJson(body, "d1 create");
|
|
62
|
-
// Require an explicit success envelope with a uuid. A 2xx whose body is
|
|
63
|
-
// not a well-formed `success:true` response is an anomaly to surface with
|
|
64
|
-
// its body, never a silently uuid-less create.
|
|
65
|
-
if (parsed.success !== true || typeof parsed.result?.uuid !== "string") {
|
|
96
|
+
}, "d1 create");
|
|
97
|
+
// The envelope guard lives in cfApiJson; a uuid-less 2xx success envelope
|
|
98
|
+
// is still an anomaly to surface with its body, never a silent create.
|
|
99
|
+
const uuid = parsed.result?.uuid;
|
|
100
|
+
if (typeof uuid !== "string") {
|
|
66
101
|
throw new Error(`storage-broker: d1 create API error: ${body}`);
|
|
67
102
|
}
|
|
68
|
-
return { uuid
|
|
103
|
+
return { uuid };
|
|
69
104
|
},
|
|
70
105
|
async d1Query(name, sql) {
|
|
71
106
|
const { stdout } = await run("npx", ["wrangler", "d1", "execute", name, "--remote", "--json", "--command", sql], env);
|
|
@@ -75,26 +110,121 @@ function makeCfExec(cred, run = defaultRun, fetchFn = defaultFetch) {
|
|
|
75
110
|
// `wrangler r2 bucket list` has no --json flag and emits human prose, so
|
|
76
111
|
// it can neither be parsed nor honour the "never grep a CLI's prose"
|
|
77
112
|
// doctrine. The R2 API returns the bucket set as JSON directly.
|
|
78
|
-
|
|
79
|
-
|
|
113
|
+
//
|
|
114
|
+
// The endpoint paginates: a single request returns only the first page,
|
|
115
|
+
// and the audit reads the missing remainder as "absent", under-reporting
|
|
116
|
+
// strays. Follow result_info.cursor to exhaustion instead. per_page is
|
|
117
|
+
// deliberately never sent — its default and maximum are unconfirmed, and
|
|
118
|
+
// omitting it takes whatever page size Cloudflare serves, so the loop is
|
|
119
|
+
// complete without guessing a value that could 400 the request.
|
|
120
|
+
const base = `https://api.cloudflare.com/client/v4/accounts/${cred.accountId}/r2/buckets`;
|
|
121
|
+
const buckets = [];
|
|
122
|
+
const seen = new Set();
|
|
123
|
+
let cursor;
|
|
124
|
+
for (;;) {
|
|
125
|
+
const url = cursor === undefined ? base : `${base}?cursor=${encodeURIComponent(cursor)}`;
|
|
126
|
+
const { parsed } = await cfApiJson(fetchFn, url, { method: "GET", headers: { Authorization: `Bearer ${cred.apiToken}` } }, "r2 bucket list");
|
|
127
|
+
const page = parsed;
|
|
128
|
+
for (const b of page.result?.buckets ?? [])
|
|
129
|
+
buckets.push({ name: b.name });
|
|
130
|
+
// A missing, null, or empty cursor all mean "last page" — accept every
|
|
131
|
+
// documented last-page signal rather than depend on which one is sent.
|
|
132
|
+
const next = page.result_info?.cursor;
|
|
133
|
+
if (!next)
|
|
134
|
+
return buckets;
|
|
135
|
+
// Any cursor seen before means the API is cycling rather than advancing,
|
|
136
|
+
// which would loop forever and re-append the same buckets each pass.
|
|
137
|
+
// Tracking every cursor (not just the last) also catches a cycle of
|
|
138
|
+
// period >= 2, which never repeats consecutively. Surface it instead of
|
|
139
|
+
// hanging the broker on an unbounded wait.
|
|
140
|
+
if (seen.has(next)) {
|
|
141
|
+
throw new Error(`storage-broker: r2 bucket list returned a repeated pagination cursor: ${next}`);
|
|
142
|
+
}
|
|
143
|
+
seen.add(next);
|
|
144
|
+
cursor = next;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
async r2Create(name) {
|
|
148
|
+
await run("npx", ["wrangler", "r2", "bucket", "create", name], env);
|
|
149
|
+
},
|
|
150
|
+
// --- R2 objects (Task 1691) -------------------------------------------
|
|
151
|
+
//
|
|
152
|
+
// The v4 REST API exposes the object surface under
|
|
153
|
+
// /accounts/{id}/r2/buckets/{bucket}/objects and accepts the same Bearer
|
|
154
|
+
// token as the bucket endpoints (account-level Workers R2 Storage Write).
|
|
155
|
+
// The r2/api/tokens/ note that "Object Read & Write" is S3-only constrains
|
|
156
|
+
// the bucket-item-scoped *permission types*, not these endpoints.
|
|
157
|
+
//
|
|
158
|
+
// Doc-confirmed, never measured: no house Cloudflare credential exists on
|
|
159
|
+
// the dev machine. The design keeps the unmeasured facts unable to affect
|
|
160
|
+
// correctness — per_page is never sent, and nothing fails silently.
|
|
161
|
+
async r2ObjectList(bucket, prefix) {
|
|
162
|
+
// Mirrors r2List: follow the cursor to exhaustion, never send per_page.
|
|
163
|
+
// A truncated object listing reads as "those objects are absent" to the
|
|
164
|
+
// data portal's standing audit, producing false phantom rows and hiding
|
|
165
|
+
// real orphans — the same bug r2List had, one endpoint over.
|
|
166
|
+
const base = `https://api.cloudflare.com/client/v4/accounts/${cred.accountId}/r2/buckets/${encodeURIComponent(bucket)}/objects`;
|
|
167
|
+
const objects = [];
|
|
168
|
+
const seen = new Set();
|
|
169
|
+
let cursor;
|
|
170
|
+
for (;;) {
|
|
171
|
+
const params = new URLSearchParams();
|
|
172
|
+
if (prefix !== undefined)
|
|
173
|
+
params.set("prefix", prefix);
|
|
174
|
+
if (cursor !== undefined)
|
|
175
|
+
params.set("cursor", cursor);
|
|
176
|
+
const qs = params.toString();
|
|
177
|
+
const { parsed, body } = await cfApiJson(fetchFn, qs ? `${base}?${qs}` : base, { method: "GET", headers: { Authorization: `Bearer ${cred.apiToken}` } }, "r2 object list");
|
|
178
|
+
const page = parsed;
|
|
179
|
+
for (const o of page.result ?? []) {
|
|
180
|
+
objects.push({ key: o.key, size: o.size, etag: o.etag, lastModified: o.last_modified });
|
|
181
|
+
}
|
|
182
|
+
const truncated = page.result_info?.is_truncated;
|
|
183
|
+
const next = page.result_info?.cursor;
|
|
184
|
+
// is_truncated is authoritative *when present*: a last page may still
|
|
185
|
+
// carry a cursor, and following it would issue a pointless request or
|
|
186
|
+
// trip the cycle guard below on a healthy response.
|
|
187
|
+
if (truncated === false)
|
|
188
|
+
return objects;
|
|
189
|
+
// The API says there is more but names no cursor: the response is not
|
|
190
|
+
// the shape we understand. Surface it rather than return a partial
|
|
191
|
+
// list, which is the failure this loop exists to prevent.
|
|
192
|
+
if (truncated === true && !next) {
|
|
193
|
+
throw new Error(`storage-broker: r2 object list reported truncated but gave no pagination cursor: ${body}`);
|
|
194
|
+
}
|
|
195
|
+
// is_truncated absent: it is itself an unmeasured fact, so it must not
|
|
196
|
+
// be what decides correctness. Fall back to cursor presence — the rule
|
|
197
|
+
// r2List uses on the same envelope — so an envelope without the flag
|
|
198
|
+
// paginates rather than truncating silently.
|
|
199
|
+
if (!next)
|
|
200
|
+
return objects;
|
|
201
|
+
// A cursor seen before means the API is cycling rather than advancing:
|
|
202
|
+
// it would loop forever, re-appending the same objects each pass.
|
|
203
|
+
if (seen.has(next)) {
|
|
204
|
+
throw new Error(`storage-broker: r2 object list returned a repeated pagination cursor: ${next}`);
|
|
205
|
+
}
|
|
206
|
+
seen.add(next);
|
|
207
|
+
cursor = next;
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
async r2ObjectGet(bucket, key) {
|
|
211
|
+
// The one method cfApiJson cannot wrap: get returns the raw object body,
|
|
212
|
+
// not a success envelope, so there is nothing to parse or assert
|
|
213
|
+
// success:true on. The error body is still retained on a non-2xx.
|
|
214
|
+
const res = await fetchFn(objectUrl(cred.accountId, bucket, key), {
|
|
80
215
|
method: "GET",
|
|
81
216
|
headers: { Authorization: `Bearer ${cred.apiToken}` },
|
|
82
217
|
});
|
|
83
|
-
const body = await res.text();
|
|
84
218
|
if (!res.ok) {
|
|
85
|
-
throw new Error(`storage-broker: r2
|
|
219
|
+
throw new Error(`storage-broker: r2 object get failed: ${res.status}\n${await res.text()}`);
|
|
86
220
|
}
|
|
87
|
-
|
|
88
|
-
// Require an explicit success envelope. A 2xx whose body is not a
|
|
89
|
-
// well-formed `success:true` response is an anomaly to surface with its
|
|
90
|
-
// body, never a silent empty bucket set.
|
|
91
|
-
if (parsed.success !== true) {
|
|
92
|
-
throw new Error(`storage-broker: r2 bucket list API error: ${body}`);
|
|
93
|
-
}
|
|
94
|
-
return (parsed.result?.buckets ?? []).map((b) => ({ name: b.name }));
|
|
221
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
95
222
|
},
|
|
96
|
-
async
|
|
97
|
-
await
|
|
223
|
+
async r2ObjectPut(bucket, key, body) {
|
|
224
|
+
await cfApiJson(fetchFn, objectUrl(cred.accountId, bucket, key), { method: "PUT", headers: { Authorization: `Bearer ${cred.apiToken}` }, body }, "r2 object put");
|
|
225
|
+
},
|
|
226
|
+
async r2ObjectDelete(bucket, key) {
|
|
227
|
+
await cfApiJson(fetchFn, objectUrl(cred.accountId, bucket, key), { method: "DELETE", headers: { Authorization: `Bearer ${cred.apiToken}` } }, "r2 object delete");
|
|
98
228
|
},
|
|
99
229
|
};
|
|
100
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cf-exec.js","sourceRoot":"","sources":["../src/cf-exec.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,iFAAiF;AACjF,iFAAiF;;
|
|
1
|
+
{"version":3,"file":"cf-exec.js","sourceRoot":"","sources":["../src/cf-exec.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,iFAAiF;AACjF,iFAAiF;;AA0HjF,gCA2MC;AASD,0CAUC;AAtVD,2DAA8C;AAC9C,yCAAiC;AAEjC,+DAA4D;AAC5D,mEAAkE;AA+ClE,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,gFAAgF;AAChF,gEAAgE;AAChE,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,iFAAiF;AACjF,qBAAqB;AACrB,SAAS,SAAS,CAAC,SAAiB,EAAE,MAAc,EAAE,GAAW;IAC/D,OAAO,iDAAiD,SAAS,eAAe,kBAAkB,CAAC,MAAM,CAAC,YAAY,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/I,CAAC;AAED,8EAA8E;AAC9E,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AAE,oCAAoC,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,MAAM,IAAA,+CAAuB,EAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACtF,OAAO,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"house-credential.d.ts","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"house-credential.d.ts","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,CAkBzE"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Reads the single account-wide Cloudflare credential from the house-only
|
|
3
3
|
// config directory. This file is the one place the account-wide capability
|
|
4
|
-
// lives
|
|
5
|
-
//
|
|
4
|
+
// lives. House-only is a location convention plus the cf-token.sh caller gate,
|
|
5
|
+
// NOT an OS permission: every account's session runs as the same unix user, so
|
|
6
|
+
// a sub-account agent holding Bash can read this path directly. That is a
|
|
7
|
+
// permanent property, not a pending gap: OS user separation was costed and
|
|
8
|
+
// declined as disproportionate (Task 1690, archived undone), so nothing tracks
|
|
9
|
+
// it. Do not cite this file's location or mode as a boundary. Parses
|
|
10
|
+
// KEY=value lines without polluting process.env (same discipline as
|
|
11
|
+
// reconcile-bookings' readEnvFile).
|
|
6
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
13
|
exports.readHouseCredential = readHouseCredential;
|
|
8
14
|
const node_fs_1 = require("node:fs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"house-credential.js","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"house-credential.js","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,qEAAqE;AACrE,oEAAoE;AACpE,oCAAoC;;AAUpC,kDAkBC;AA1BD,qCAAuC;AACvC,yCAAiC;AAOjC,SAAgB,mBAAmB,CAAC,YAAoB;IACtD,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC;IAClE,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC3D,IAAI,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,CAAC,oBAAoB,CAAC;IAC1C,MAAM,SAAS,GAAG,GAAG,CAAC,qBAAqB,CAAC;IAC5C,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,EAAE,CAAC,CAAC;IAC1F,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,IAAI,EAAE,CAAC,CAAC;IAC5F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
@@ -22,6 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
__exportStar(require("./authorize.js"), exports);
|
|
25
|
+
__exportStar(require("./object-limits.js"), exports);
|
|
25
26
|
__exportStar(require("./registry.js"), exports);
|
|
26
27
|
__exportStar(require("./house-credential.js"), exports);
|
|
27
28
|
__exportStar(require("./cf-exec.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,4DAA4D;;;;;;;;;;;;;;;;AAE5D,iDAA+B;AAC/B,gDAA8B;AAC9B,wDAAsC;AACtC,+CAA6B;AAC7B,0DAAwC;AACxC,6CAA2B;AAC3B,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,4DAA4D;;;;;;;;;;;;;;;;AAE5D,iDAA+B;AAC/B,qDAAmC;AACnC,gDAA8B;AAC9B,wDAAsC;AACtC,+CAA6B;AAC7B,0DAAwC;AACxC,6CAA2B;AAC3B,iDAA+B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The byte cap on R2 object transfer, and the arithmetic the routes need to
|
|
3
|
+
* enforce it before they buffer anything.
|
|
4
|
+
*
|
|
5
|
+
* One number, one home (Task 1695). The storage-broker MCP tools and the house
|
|
6
|
+
* ui routes both read the cap from here, so the process that rejects a too-large
|
|
7
|
+
* file and the process that would otherwise buffer it cannot drift apart.
|
|
8
|
+
*
|
|
9
|
+
* Deliberately dependency-free: the MCP imports this module directly, without
|
|
10
|
+
* the rest of the lib (cf-exec, registry, audit, remediate), which it has no use
|
|
11
|
+
* for. The ui route reads it through the barrel.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The maximum size, in bytes, of an object moved through storage-r2-object-get
|
|
15
|
+
* or storage-r2-object-put.
|
|
16
|
+
*
|
|
17
|
+
* Set independently of the email plugin's OUTBOUND_ATTACHMENT_MAX_BYTES (25 MiB)
|
|
18
|
+
* even though the payload class is the same. The two exist for different reasons
|
|
19
|
+
* and must be free to move for different reasons: email's tracks an SMTP-side
|
|
20
|
+
* rejection threshold, this one tracks house-process memory. Do not couple them.
|
|
21
|
+
*
|
|
22
|
+
* Not bounded by R2. A single-part upload may be up to 5 GiB (doc-confirmed:
|
|
23
|
+
* developers.cloudflare.com/r2/platform/limits/), roughly fifty times this, and
|
|
24
|
+
* the v4 REST API states no separate object-size limit. This cap is the only
|
|
25
|
+
* bound on either transfer.
|
|
26
|
+
*
|
|
27
|
+
* The bound is not small: at the cap a get still leaves the house process
|
|
28
|
+
* holding the object and its base64 form, roughly 2.4x the object. That cost was
|
|
29
|
+
* weighed and accepted when the number was chosen.
|
|
30
|
+
*/
|
|
31
|
+
export declare const R2_OBJECT_MAX_BYTES: number;
|
|
32
|
+
/** base64 emits 4 characters per 3 input bytes, padded up to the next quantum. */
|
|
33
|
+
export declare function base64Ceiling(bytes: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* The largest JSON body /r2/object/put can legitimately carry.
|
|
36
|
+
*
|
|
37
|
+
* This bounds house memory; it does not adjudicate the last kilobyte. The exact
|
|
38
|
+
* decoded-byte rule lives in the MCP, which knows the source's size exactly.
|
|
39
|
+
*/
|
|
40
|
+
export declare const R2_OBJECT_PUT_MAX_BODY_BYTES: number;
|
|
41
|
+
/**
|
|
42
|
+
* The over-cap message, worded once so the MCP and the routes agree. Names the
|
|
43
|
+
* offending object and the limit, which is what makes the failure actionable
|
|
44
|
+
* rather than an opaque out-of-memory kill.
|
|
45
|
+
*
|
|
46
|
+
* Exact bytes accompany the MiB figures because MiB alone rounds: an object one
|
|
47
|
+
* byte over the cap reads "100.0 MiB, which exceeds the 100.0 MiB limit", which
|
|
48
|
+
* is a message that appears to contradict itself and invites the reader to treat
|
|
49
|
+
* the rejection as a bug. The bytes are what make it legible; the MiB is what
|
|
50
|
+
* makes it quick.
|
|
51
|
+
*/
|
|
52
|
+
export declare function tooLargeMessage(what: string, actualBytes: number): string;
|
|
53
|
+
//# sourceMappingURL=object-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-limits.d.ts","sourceRoot":"","sources":["../src/object-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,QAAoB,CAAC;AAErD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAUD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAC0B,CAAC;AAMpE;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAIzE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The byte cap on R2 object transfer, and the arithmetic the routes need to
|
|
4
|
+
* enforce it before they buffer anything.
|
|
5
|
+
*
|
|
6
|
+
* One number, one home (Task 1695). The storage-broker MCP tools and the house
|
|
7
|
+
* ui routes both read the cap from here, so the process that rejects a too-large
|
|
8
|
+
* file and the process that would otherwise buffer it cannot drift apart.
|
|
9
|
+
*
|
|
10
|
+
* Deliberately dependency-free: the MCP imports this module directly, without
|
|
11
|
+
* the rest of the lib (cf-exec, registry, audit, remediate), which it has no use
|
|
12
|
+
* for. The ui route reads it through the barrel.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.R2_OBJECT_PUT_MAX_BODY_BYTES = exports.R2_OBJECT_MAX_BYTES = void 0;
|
|
16
|
+
exports.base64Ceiling = base64Ceiling;
|
|
17
|
+
exports.tooLargeMessage = tooLargeMessage;
|
|
18
|
+
/**
|
|
19
|
+
* The maximum size, in bytes, of an object moved through storage-r2-object-get
|
|
20
|
+
* or storage-r2-object-put.
|
|
21
|
+
*
|
|
22
|
+
* Set independently of the email plugin's OUTBOUND_ATTACHMENT_MAX_BYTES (25 MiB)
|
|
23
|
+
* even though the payload class is the same. The two exist for different reasons
|
|
24
|
+
* and must be free to move for different reasons: email's tracks an SMTP-side
|
|
25
|
+
* rejection threshold, this one tracks house-process memory. Do not couple them.
|
|
26
|
+
*
|
|
27
|
+
* Not bounded by R2. A single-part upload may be up to 5 GiB (doc-confirmed:
|
|
28
|
+
* developers.cloudflare.com/r2/platform/limits/), roughly fifty times this, and
|
|
29
|
+
* the v4 REST API states no separate object-size limit. This cap is the only
|
|
30
|
+
* bound on either transfer.
|
|
31
|
+
*
|
|
32
|
+
* The bound is not small: at the cap a get still leaves the house process
|
|
33
|
+
* holding the object and its base64 form, roughly 2.4x the object. That cost was
|
|
34
|
+
* weighed and accepted when the number was chosen.
|
|
35
|
+
*/
|
|
36
|
+
exports.R2_OBJECT_MAX_BYTES = 100 * 1024 * 1024;
|
|
37
|
+
/** base64 emits 4 characters per 3 input bytes, padded up to the next quantum. */
|
|
38
|
+
function base64Ceiling(bytes) {
|
|
39
|
+
return 4 * Math.ceil(bytes / 3);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Room for the put envelope's bucket, key and JSON punctuation, so a legal
|
|
43
|
+
* at-cap put is not rejected by its own key. Far above any realistic bucket+key
|
|
44
|
+
* length and far below the cap, so it cannot smuggle a meaningfully larger
|
|
45
|
+
* object.
|
|
46
|
+
*/
|
|
47
|
+
const PUT_ENVELOPE_ALLOWANCE_BYTES = 64 * 1024;
|
|
48
|
+
/**
|
|
49
|
+
* The largest JSON body /r2/object/put can legitimately carry.
|
|
50
|
+
*
|
|
51
|
+
* This bounds house memory; it does not adjudicate the last kilobyte. The exact
|
|
52
|
+
* decoded-byte rule lives in the MCP, which knows the source's size exactly.
|
|
53
|
+
*/
|
|
54
|
+
exports.R2_OBJECT_PUT_MAX_BODY_BYTES = base64Ceiling(exports.R2_OBJECT_MAX_BYTES) + PUT_ENVELOPE_ALLOWANCE_BYTES;
|
|
55
|
+
function formatMiB(bytes) {
|
|
56
|
+
return (bytes / 1024 / 1024).toFixed(1);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The over-cap message, worded once so the MCP and the routes agree. Names the
|
|
60
|
+
* offending object and the limit, which is what makes the failure actionable
|
|
61
|
+
* rather than an opaque out-of-memory kill.
|
|
62
|
+
*
|
|
63
|
+
* Exact bytes accompany the MiB figures because MiB alone rounds: an object one
|
|
64
|
+
* byte over the cap reads "100.0 MiB, which exceeds the 100.0 MiB limit", which
|
|
65
|
+
* is a message that appears to contradict itself and invites the reader to treat
|
|
66
|
+
* the rejection as a bug. The bytes are what make it legible; the MiB is what
|
|
67
|
+
* makes it quick.
|
|
68
|
+
*/
|
|
69
|
+
function tooLargeMessage(what, actualBytes) {
|
|
70
|
+
return `${what} is ${formatMiB(actualBytes)} MiB (${actualBytes} bytes), which exceeds the ${formatMiB(exports.R2_OBJECT_MAX_BYTES)} MiB (${exports.R2_OBJECT_MAX_BYTES} bytes) R2 object limit.`;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=object-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-limits.js","sourceRoot":"","sources":["../src/object-limits.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAuBH,sCAEC;AAkCD,0CAIC;AA7DD;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,mBAAmB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,kFAAkF;AAClF,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,4BAA4B,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C;;;;;GAKG;AACU,QAAA,4BAA4B,GACvC,aAAa,CAAC,2BAAmB,CAAC,GAAG,4BAA4B,CAAC;AAEpE,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,WAAmB;IAC/D,OAAO,GAAG,IAAI,OAAO,SAAS,CAAC,WAAW,CAAC,SAAS,WAAW,8BAA8B,SAAS,CACpG,2BAAmB,CACpB,SAAS,2BAAmB,0BAA0B,CAAC;AAC1D,CAAC"}
|