@se-studio/contentful-cms 3.0.3 → 3.1.0
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/CHANGELOG.md +6 -0
- package/dist/commands/asset.d.ts.map +1 -1
- package/dist/commands/asset.js +40 -7
- package/dist/commands/asset.js.map +1 -1
- package/dist/commands/host-scaffold.d.ts.map +1 -1
- package/dist/commands/host-scaffold.js +2 -0
- package/dist/commands/host-scaffold.js.map +1 -1
- package/dist/generated/hosted-guide.d.ts +1 -1
- package/dist/generated/hosted-guide.d.ts.map +1 -1
- package/dist/generated/hosted-guide.js +1 -1
- package/dist/generated/hosted-guide.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/hosted/index.d.ts +3 -0
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +3 -0
- package/dist/hosted/index.js.map +1 -1
- package/dist/hosted/next/redis.d.ts.map +1 -1
- package/dist/hosted/next/redis.js +4 -0
- package/dist/hosted/next/redis.js.map +1 -1
- package/dist/hosted/next/routes/mcp.d.ts.map +1 -1
- package/dist/hosted/next/routes/mcp.js +2 -0
- package/dist/hosted/next/routes/mcp.js.map +1 -1
- package/dist/hosted/next/routes/staged-upload.d.ts +2 -0
- package/dist/hosted/next/routes/staged-upload.d.ts.map +1 -0
- package/dist/hosted/next/routes/staged-upload.js +83 -0
- package/dist/hosted/next/routes/staged-upload.js.map +1 -0
- package/dist/mcp/http-handler.d.ts.map +1 -1
- package/dist/mcp/http-handler.js +19 -19
- package/dist/mcp/http-handler.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/cms-edit.d.ts +1 -1
- package/dist/mcp/tools/cms-edit.d.ts.map +1 -1
- package/dist/mcp/tools/cms-edit.js +3 -1
- package/dist/mcp/tools/cms-edit.js.map +1 -1
- package/dist/mcp/tools/staged-upload.d.ts +4 -0
- package/dist/mcp/tools/staged-upload.d.ts.map +1 -0
- package/dist/mcp/tools/staged-upload.js +77 -0
- package/dist/mcp/tools/staged-upload.js.map +1 -0
- package/dist/runtime/context.d.ts +3 -0
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js.map +1 -1
- package/dist/session/session-store.d.ts +2 -0
- package/dist/session/session-store.d.ts.map +1 -1
- package/dist/session/session-store.js.map +1 -1
- package/dist/staged-upload/hmac.d.ts +6 -0
- package/dist/staged-upload/hmac.d.ts.map +1 -0
- package/dist/staged-upload/hmac.js +43 -0
- package/dist/staged-upload/hmac.js.map +1 -0
- package/dist/staged-upload/limits.d.ts +6 -0
- package/dist/staged-upload/limits.d.ts.map +1 -0
- package/dist/staged-upload/limits.js +9 -0
- package/dist/staged-upload/limits.js.map +1 -0
- package/dist/staged-upload/mime.d.ts +2 -0
- package/dist/staged-upload/mime.d.ts.map +1 -0
- package/dist/staged-upload/mime.js +10 -0
- package/dist/staged-upload/mime.js.map +1 -0
- package/dist/staged-upload/request.d.ts +11 -0
- package/dist/staged-upload/request.d.ts.map +1 -0
- package/dist/staged-upload/request.js +40 -0
- package/dist/staged-upload/request.js.map +1 -0
- package/dist/staged-upload/store.d.ts +19 -0
- package/dist/staged-upload/store.d.ts.map +1 -0
- package/dist/staged-upload/store.js +124 -0
- package/dist/staged-upload/store.js.map +1 -0
- package/dist/staged-upload/types.d.ts +27 -0
- package/dist/staged-upload/types.d.ts.map +1 -0
- package/dist/staged-upload/types.js +2 -0
- package/dist/staged-upload/types.js.map +1 -0
- package/docs/editor-tasks/media-reuse-and-upload.md +16 -9
- package/docs/mcp/hosted-guide.md +18 -5
- package/package.json +1 -1
- package/skills/core/SKILL.md +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-upload.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/staged-upload.ts"],"names":[],"mappings":"AAkDA,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqD9D"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getUploadHmacSecret, verifyUploadSignature } from '../../../staged-upload/hmac.js';
|
|
2
|
+
import { hostedStagedMaxBytes } from '../../../staged-upload/limits.js';
|
|
3
|
+
import { StagedUploadStore } from '../../../staged-upload/store.js';
|
|
4
|
+
import { createRedisClient } from '../redis.js';
|
|
5
|
+
const redisClient = createRedisClient();
|
|
6
|
+
const stagedStore = new StagedUploadStore(redisClient);
|
|
7
|
+
function parseUploadQuery(url) {
|
|
8
|
+
const uploadId = url.searchParams.get('id')?.trim();
|
|
9
|
+
const userId = url.searchParams.get('uid')?.trim();
|
|
10
|
+
const expRaw = url.searchParams.get('exp')?.trim();
|
|
11
|
+
const sig = url.searchParams.get('sig')?.trim();
|
|
12
|
+
if (!uploadId || !userId || !expRaw || !sig) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const exp = Number.parseInt(expRaw, 10);
|
|
16
|
+
if (!Number.isFinite(exp)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return { uploadId, userId, exp, sig };
|
|
20
|
+
}
|
|
21
|
+
async function readUploadBody(request) {
|
|
22
|
+
const contentType = request.headers.get('content-type') ?? '';
|
|
23
|
+
if (contentType.includes('multipart/form-data')) {
|
|
24
|
+
const form = await request.formData();
|
|
25
|
+
const file = form.get('file');
|
|
26
|
+
if (!(file instanceof File)) {
|
|
27
|
+
throw new Error('multipart upload requires a "file" field.');
|
|
28
|
+
}
|
|
29
|
+
const buffer = Buffer.from(await file.arrayBuffer());
|
|
30
|
+
const mimeType = file.type || 'application/octet-stream';
|
|
31
|
+
return { buffer, mimeType };
|
|
32
|
+
}
|
|
33
|
+
const buffer = Buffer.from(await request.arrayBuffer());
|
|
34
|
+
if (buffer.length === 0) {
|
|
35
|
+
throw new Error('Upload body is empty.');
|
|
36
|
+
}
|
|
37
|
+
const mimeType = contentType.split(';')[0]?.trim() || 'application/octet-stream';
|
|
38
|
+
return { buffer, mimeType };
|
|
39
|
+
}
|
|
40
|
+
export async function POST(request) {
|
|
41
|
+
try {
|
|
42
|
+
const url = new URL(request.url);
|
|
43
|
+
const query = parseUploadQuery(url);
|
|
44
|
+
if (!query) {
|
|
45
|
+
return Response.json({ ok: false, error: 'Missing upload query parameters.' }, { status: 400 });
|
|
46
|
+
}
|
|
47
|
+
const now = Math.floor(Date.now() / 1000);
|
|
48
|
+
if (query.exp < now) {
|
|
49
|
+
return Response.json({ ok: false, error: 'Upload URL expired.' }, { status: 401 });
|
|
50
|
+
}
|
|
51
|
+
const secret = getUploadHmacSecret();
|
|
52
|
+
if (!verifyUploadSignature(query.uploadId, query.userId, query.exp, query.sig, secret)) {
|
|
53
|
+
return Response.json({ ok: false, error: 'Invalid upload signature.' }, { status: 401 });
|
|
54
|
+
}
|
|
55
|
+
const { buffer, mimeType } = await readUploadBody(request);
|
|
56
|
+
if (buffer.length > hostedStagedMaxBytes()) {
|
|
57
|
+
return Response.json({
|
|
58
|
+
ok: false,
|
|
59
|
+
error: `File exceeds hosted staged upload limit (${String(hostedStagedMaxBytes())} bytes).`,
|
|
60
|
+
}, { status: 413 });
|
|
61
|
+
}
|
|
62
|
+
const record = await stagedStore.storeFile(query.userId, query.uploadId, buffer, mimeType);
|
|
63
|
+
return Response.json({
|
|
64
|
+
ok: true,
|
|
65
|
+
uploadId: record.uploadId,
|
|
66
|
+
byteLength: record.byteLength,
|
|
67
|
+
mimeType: record.mimeType,
|
|
68
|
+
fileName: record.fileName,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
73
|
+
const status = message.includes('not found') ||
|
|
74
|
+
message.includes('expired') ||
|
|
75
|
+
message.includes('already received')
|
|
76
|
+
? 409
|
|
77
|
+
: message.includes('not allowed') || message.includes('requires')
|
|
78
|
+
? 400
|
|
79
|
+
: 500;
|
|
80
|
+
return Response.json({ ok: false, error: message }, { status });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=staged-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-upload.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/staged-upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAC;AACxC,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAEvD,SAAS,gBAAgB,CAAC,GAAQ;IAMhC,MAAM,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IACpD,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAChD,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GA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EA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,WAAW,uBAAuB;IACtC,sFAAsF;IACtF,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrE,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,aAAa,GAAG,SAAS,CAAC;IAC7C,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAOD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"http-handler.d.ts","sourceRoot":"","sources":["../../src/mcp/http-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,WAAW,uBAAuB;IACtC,sFAAsF;IACtF,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrE,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,aAAa,GAAG,SAAS,CAAC;IAC7C,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAOD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,QAAQ,CAAC,CA2BnB"}
|
package/dist/mcp/http-handler.js
CHANGED
|
@@ -11,28 +11,28 @@ async function defaultRunCmsEdit(args) {
|
|
|
11
11
|
* Handles a Streamable HTTP MCP request in stateless mode (suitable for Vercel serverless).
|
|
12
12
|
*/
|
|
13
13
|
export async function handleHostedMcpRequest(request, options) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const context = await options.resolveContext(request);
|
|
15
|
+
return runWithCmsEditContext(context, async () => {
|
|
16
|
+
const runCmsEdit = async (args) => {
|
|
17
|
+
sessionLogVerbose('hosted mcp cms_edit', {
|
|
18
|
+
args,
|
|
19
|
+
userId: context.user?.userId,
|
|
20
|
+
store: context.sessionStore?.constructor.name ?? 'FileSessionStore',
|
|
21
|
+
});
|
|
22
22
|
process.env['CMS_EDIT_JSON'] = '1';
|
|
23
23
|
return defaultRunCmsEdit(args);
|
|
24
|
+
};
|
|
25
|
+
const server = createMcpServer({
|
|
26
|
+
runCmsEdit,
|
|
27
|
+
hosted: options.getMcpInfo?.(),
|
|
28
|
+
editorPackPath: options.editorPackPath,
|
|
24
29
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
32
|
-
sessionIdGenerator: undefined,
|
|
33
|
-
enableJsonResponse: true,
|
|
30
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
31
|
+
sessionIdGenerator: undefined,
|
|
32
|
+
enableJsonResponse: true,
|
|
33
|
+
});
|
|
34
|
+
await server.connect(transport);
|
|
35
|
+
return transport.handleRequest(request);
|
|
34
36
|
});
|
|
35
|
-
await server.connect(transport);
|
|
36
|
-
return transport.handleRequest(request);
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=http-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-handler.js","sourceRoot":"","sources":["../../src/mcp/http-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC;AACzH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;A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AC,CAAC;IAEtD,OAAO,qBAAqB,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,UAAU,GAAG,KAAK,EAAE,IAAc,EAAE,EAAE;YAC1C,iBAAiB,CAAC,qBAAqB,EAAE;gBACvC,IAAI;gBACJ,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM;gBAC5B,KAAK,EAAE,OAAO,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,IAAI,kBAAkB;aACpE,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC;YACnC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC;QAEF,MAAM,MAAM,GAAG,eAAe,CAAC;YAC7B,UAAU;YACV,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE;YAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,CAAC,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,wCAAwC,CAAC;YAC7D,kBAAkB,EAAE,SAAS;YAC7B,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,8FAA8F;IAC9F,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,yFAAyF;IACzF,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,SAAS,CAiB/E;AA8BD,sDAAsD;AACtD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAIzE"}
|
package/dist/mcp/server.js
CHANGED
|
@@ -10,6 +10,7 @@ import { registerGuideResource } from './resources/guide.js';
|
|
|
10
10
|
import { getMcpServerInfo, registerCmsEditTools } from './tools/cms-edit.js';
|
|
11
11
|
import { registerCustomerTool } from './tools/customer.js';
|
|
12
12
|
import { registerHelpTool } from './tools/help.js';
|
|
13
|
+
import { registerStagedUploadTools } from './tools/staged-upload.js';
|
|
13
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
15
|
const CMS_EDIT_BIN = path.resolve(__dirname, '..', 'bin', 'cms-edit.js');
|
|
15
16
|
export function createMcpServer(options = {}) {
|
|
@@ -17,6 +18,7 @@ export function createMcpServer(options = {}) {
|
|
|
17
18
|
const server = new McpServer({ name: serverInfo.name, version: serverInfo.version });
|
|
18
19
|
const runCmsEdit = options.runCmsEdit ?? spawnRunCmsEdit;
|
|
19
20
|
registerCmsEditTools(server, runCmsEdit, options.hosted);
|
|
21
|
+
registerStagedUploadTools(server, options.hosted);
|
|
20
22
|
registerCustomerTool(server, {
|
|
21
23
|
editorPackPath: options.editorPackPath,
|
|
22
24
|
hosted: options.hosted,
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAA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AAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvD,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,gBAAgB,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACvB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAc;IACtD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC;IACnC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IACxD,OAAO,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,gBAAgB,QAAQ,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;AACxE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { HostedMcpInfo } from '../guide.js';
|
|
3
3
|
import type { RunCmsEditFn } from '../types.js';
|
|
4
|
-
export declare const TOOL_DESCRIPTION = "Run any cms-edit command. cms-edit edits Contentful draft content (no publishing).\n\nUse cms_edit_version (no args) to check the installed version.\nUse cms_edit_help to read the getting-started guide by topic.\nUse cms_edit_customer to read site-specific playbooks (articles, routing, blog-tag-matrix, etc.).\nIf Integrations only exposes cms_edit, use [\"customer\", \"index\"] or [\"customer\", \"resource=index\"] instead.\nRead the cms-edit://guide resource for the full guide.\n\nWorkflow: open \u2192 snapshot \u2192 read/set/rtf/add/remove \u2192 diff \u2192 save\nAll saves create drafts only \u2014 a human must publish in Contentful.\n\nCommon command sequences:\n [\"open\", \"--page-slug\", \"/\"] \u2014 homepage (CMS slug index; /index is equivalent)\n [\"open\", \"--page-slug\", \"/pricing\"] \u2014 load a page by slug\n [\"open\", \"--id\", \"<entry-id>\"] \u2014 load by Contentful entry ID\n [\"snapshot\"] \u2014 print content tree with @refs\n [\"read\", \"@c0\"] \u2014 read all fields of a component (requires open session)\n [\"read\", \"@c0\", \"heading\"] \u2014 read a specific field (requires open session)\n [\"read\", \"@root\"] \u2014 read root entry fields (requires open session)\n [\"read\", \"<entry-id>\", \"--id\"] \u2014 read entry by ID (no session)\n [\"read\", \"<entry-id>\", \"--id\", \"heading\"] \u2014 read one field by entry ID (no session)\n [\"peek\", \"--page-slug\", \"/pricing\"] \u2014 preview tree + root fields (no session)\n [\"peek\", \"--id\", \"<entry-id>\"] \u2014 preview by entry ID with rootFields in JSON\n [\"set\", \"@c0\", \"heading\", \"New heading\"] \u2014 set a scalar field\n [\"rtf\", \"@c0\", \"body\", \"--content\", \"# H1\\n\\nBody.\"] \u2014 set rich text (preferred for AI)\n [\"rtf\", \"@c0\", \"body\", \"--base64\", \"<encoded>\"] \u2014 set rich text via base64 (no filesystem)\n [\"diff\"] \u2014 show pending changes\n [\"save\"] \u2014 write drafts to Contentful\n [\"discard\"] \u2014 discard unsaved changes\n [\"links\", \"set\", \"@c0\", \"0\", \"variant\", \"link\"] \u2014 set scalar field on link at index 0\n [\"batch\", \"set\", \"<entry-id>:variant=link\"] \u2014 queue scalar edit by entry ID\n [\"batch\", \"diff\"] \u2014 show pending batch edits\n [\"batch\", \"save\"] \u2014 save all batch edits as drafts\n [\"health\"] \u2014 verify config and connectivity\n [\"diagnose\"] \u2014 session/MCP diagnostics (store, userId, active session)\n [\"version\"] \u2014 print installed cms-edit version\n [\"guide\"] \u2014 print getting-started guide\n [\"guide\", \"workflow\"] \u2014 print a guide section\n [\"customer\", \"index\"] \u2014 list site editor playbooks\n [\"customer\", \"articles\"] \u2014 read articles playbook\n [\"customer\", \"resource=index\"] \u2014 same as index (Integrations fallback)\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"] \u2014 recent articles by publication date\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\"] \u2014 list articles (preview index includes drafts)\n [\"peek\", \"--article-slug\", \"<slug>\"] \u2014 preview draft or published article (CMA)\n [\"preview\", \"url\", \"/pricing\"] \u2014 staging page URL (open in browser MCP)\n [\"preview\", \"urls\", \"/pricing\"] \u2014 all preview targets (staging, production, site live preview, Contentful)\n [\"preview\", \"showcase\", \"--component\", \"HeroSimple\"] \u2014 component showcase URL (mock data)\n [\"preview\", \"showcase\", \"--collection\", \"CardGrid\", \"--param\", \"backgroundColour=Navy\"]\n\nDiscovery notes:\n Visual checks: use preview url / preview showcase, then open the returned URL with a browser MCP (cms-edit does not capture screenshots).\n peek/open/read --id load draft content via CMA \u2014 NOT published-only.\n Only list --published / resolve --published use the published-only Delivery API index.\n Articles: use --article-slug (not --page-slug). search --type article sorts by publication date.\n\nSessions persist between MCP calls (Redis on hosted, disk locally). MCP auto-uses session \"_mcp\" unless you pass --session.\nUse --session <name> before the subcommand to isolate concurrent workflows, e.g. [\"--session\", \"my-work\", \"open\", \"/\"].\nUse --space <name> to target a specific Contentful space (local MCP only \u2014 omit for hosted Integrations).\nStateless read (no open required): [\"read\", \"<entry-id>\", \"--id\"] or [\"read\", \"<entry-id>\", \"--id\", \"heading\"].\npeek is one-shot (no session): use [\"peek\", \"--page-slug\", \"<slug>\"] or [\"peek\", \"--id\", \"<entry-id>\"]. Includes rootFields in JSON \u2014 no follow-up read required.\nOutput is always JSON (CMS_EDIT_JSON=1 is forced by the MCP server).\n\nRich text tips:\n --content \"<markdown>\" preferred named flag for inline content (any length)\n --base64 \"<encoded>\" fully environment-agnostic, no filesystem needed\n\nJSON bulk input (create from-json, batch run, taxonomy/person/article-tags imports, set object fields, rtf patch):\n --json \"<string>\" inline JSON (small payloads)\n --json-base64 \"<b64>\" base64-encoded JSON (large payloads)\n\nAsset upload (hosted MCP)
|
|
4
|
+
export declare const TOOL_DESCRIPTION = "Run any cms-edit command. cms-edit edits Contentful draft content (no publishing).\n\nUse cms_edit_version (no args) to check the installed version.\nUse cms_edit_help to read the getting-started guide by topic.\nUse cms_edit_customer to read site-specific playbooks (articles, routing, blog-tag-matrix, etc.).\nIf Integrations only exposes cms_edit, use [\"customer\", \"index\"] or [\"customer\", \"resource=index\"] instead.\nRead the cms-edit://guide resource for the full guide.\n\nWorkflow: open \u2192 snapshot \u2192 read/set/rtf/add/remove \u2192 diff \u2192 save\nAll saves create drafts only \u2014 a human must publish in Contentful.\n\nCommon command sequences:\n [\"open\", \"--page-slug\", \"/\"] \u2014 homepage (CMS slug index; /index is equivalent)\n [\"open\", \"--page-slug\", \"/pricing\"] \u2014 load a page by slug\n [\"open\", \"--id\", \"<entry-id>\"] \u2014 load by Contentful entry ID\n [\"snapshot\"] \u2014 print content tree with @refs\n [\"read\", \"@c0\"] \u2014 read all fields of a component (requires open session)\n [\"read\", \"@c0\", \"heading\"] \u2014 read a specific field (requires open session)\n [\"read\", \"@root\"] \u2014 read root entry fields (requires open session)\n [\"read\", \"<entry-id>\", \"--id\"] \u2014 read entry by ID (no session)\n [\"read\", \"<entry-id>\", \"--id\", \"heading\"] \u2014 read one field by entry ID (no session)\n [\"peek\", \"--page-slug\", \"/pricing\"] \u2014 preview tree + root fields (no session)\n [\"peek\", \"--id\", \"<entry-id>\"] \u2014 preview by entry ID with rootFields in JSON\n [\"set\", \"@c0\", \"heading\", \"New heading\"] \u2014 set a scalar field\n [\"rtf\", \"@c0\", \"body\", \"--content\", \"# H1\\n\\nBody.\"] \u2014 set rich text (preferred for AI)\n [\"rtf\", \"@c0\", \"body\", \"--base64\", \"<encoded>\"] \u2014 set rich text via base64 (no filesystem)\n [\"diff\"] \u2014 show pending changes\n [\"save\"] \u2014 write drafts to Contentful\n [\"discard\"] \u2014 discard unsaved changes\n [\"links\", \"set\", \"@c0\", \"0\", \"variant\", \"link\"] \u2014 set scalar field on link at index 0\n [\"batch\", \"set\", \"<entry-id>:variant=link\"] \u2014 queue scalar edit by entry ID\n [\"batch\", \"diff\"] \u2014 show pending batch edits\n [\"batch\", \"save\"] \u2014 save all batch edits as drafts\n [\"health\"] \u2014 verify config and connectivity\n [\"diagnose\"] \u2014 session/MCP diagnostics (store, userId, active session)\n [\"version\"] \u2014 print installed cms-edit version\n [\"guide\"] \u2014 print getting-started guide\n [\"guide\", \"workflow\"] \u2014 print a guide section\n [\"customer\", \"index\"] \u2014 list site editor playbooks\n [\"customer\", \"articles\"] \u2014 read articles playbook\n [\"customer\", \"resource=index\"] \u2014 same as index (Integrations fallback)\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"] \u2014 recent articles by publication date\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\"] \u2014 list articles (preview index includes drafts)\n [\"peek\", \"--article-slug\", \"<slug>\"] \u2014 preview draft or published article (CMA)\n [\"preview\", \"url\", \"/pricing\"] \u2014 staging page URL (open in browser MCP)\n [\"preview\", \"urls\", \"/pricing\"] \u2014 all preview targets (staging, production, site live preview, Contentful)\n [\"preview\", \"showcase\", \"--component\", \"HeroSimple\"] \u2014 component showcase URL (mock data)\n [\"preview\", \"showcase\", \"--collection\", \"CardGrid\", \"--param\", \"backgroundColour=Navy\"]\n\nDiscovery notes:\n Visual checks: use preview url / preview showcase, then open the returned URL with a browser MCP (cms-edit does not capture screenshots).\n peek/open/read --id load draft content via CMA \u2014 NOT published-only.\n Only list --published / resolve --published use the published-only Delivery API index.\n Articles: use --article-slug (not --page-slug). search --type article sorts by publication date.\n\nSessions persist between MCP calls (Redis on hosted, disk locally). MCP auto-uses session \"_mcp\" unless you pass --session.\nUse --session <name> before the subcommand to isolate concurrent workflows, e.g. [\"--session\", \"my-work\", \"open\", \"/\"].\nUse --space <name> to target a specific Contentful space (local MCP only \u2014 omit for hosted Integrations).\nStateless read (no open required): [\"read\", \"<entry-id>\", \"--id\"] or [\"read\", \"<entry-id>\", \"--id\", \"heading\"].\npeek is one-shot (no session): use [\"peek\", \"--page-slug\", \"<slug>\"] or [\"peek\", \"--id\", \"<entry-id>\"]. Includes rootFields in JSON \u2014 no follow-up read required.\nOutput is always JSON (CMS_EDIT_JSON=1 is forced by the MCP server).\n\nRich text tips:\n --content \"<markdown>\" preferred named flag for inline content (any length)\n --base64 \"<encoded>\" fully environment-agnostic, no filesystem needed\n\nJSON bulk input (create from-json, batch run, taxonomy/person/article-tags imports, set object fields, rtf patch):\n --json \"<string>\" inline JSON (small payloads)\n --json-base64 \"<b64>\" base64-encoded JSON (large payloads)\n\nAsset upload (hosted MCP):\n Prefer cms_edit_request_staged_upload for files >~500 KB (curl upload, then --staged).\n Otherwise --url <https> or --base64 with --mime and --file-name";
|
|
5
5
|
export declare function registerCmsEditTools(server: McpServer, runCmsEdit: RunCmsEditFn, hosted?: HostedMcpInfo): void;
|
|
6
6
|
export declare function getMcpServerInfo(hosted?: HostedMcpInfo): {
|
|
7
7
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-edit.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"cms-edit.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,yxMAwEqC,CAAC;AAEnE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,YAAY,EACxB,MAAM,CAAC,EAAE,aAAa,GACrB,IAAI,CAsCN;AAED,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAE1F"}
|
|
@@ -73,7 +73,9 @@ JSON bulk input (create from-json, batch run, taxonomy/person/article-tags impor
|
|
|
73
73
|
--json "<string>" inline JSON (small payloads)
|
|
74
74
|
--json-base64 "<b64>" base64-encoded JSON (large payloads)
|
|
75
75
|
|
|
76
|
-
Asset upload (hosted MCP):
|
|
76
|
+
Asset upload (hosted MCP):
|
|
77
|
+
Prefer cms_edit_request_staged_upload for files >~500 KB (curl upload, then --staged).
|
|
78
|
+
Otherwise --url <https> or --base64 with --mime and --file-name`;
|
|
77
79
|
export function registerCmsEditTools(server, runCmsEdit, hosted) {
|
|
78
80
|
server.tool('cms_edit_version', prefixHostedToolDescription('Return the installed cms-edit package version and site identity (projectKey, displayName, spaceId on hosted). No session or Contentful credentials required.', hosted), {}, async () => {
|
|
79
81
|
const info = getVersionInfo();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-edit.js","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,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,EAAE,EAAE,EAAE;QACjB,MAAM,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;QAC5C,iBAAiB,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAC3E,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACxD,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAsB;IACrD,OAAO,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-upload.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/staged-upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAejD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,IAAI,CAmEzF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getRuntimeContext } from '../../runtime/context.js';
|
|
3
|
+
import { createStagedUploadRequest } from '../../staged-upload/request.js';
|
|
4
|
+
import { prefixHostedToolDescription } from '../hosted-metadata.js';
|
|
5
|
+
const TOOL_DESCRIPTION = `Request a presigned staged upload URL for large files on hosted cms-edit.
|
|
6
|
+
|
|
7
|
+
Use this instead of --base64 when the file is large (~500 KB+) or base64 in cms_edit args fails.
|
|
8
|
+
|
|
9
|
+
Workflow:
|
|
10
|
+
1. Call this tool with fileName, mimeType, and optional byteLength
|
|
11
|
+
2. Run the returned curlCommand in a shell (POST multipart file to uploadUrl)
|
|
12
|
+
3. Call cms_edit with the returned consumeArgs (asset upload --staged)
|
|
13
|
+
4. Link the asset (asset set) and save as usual
|
|
14
|
+
|
|
15
|
+
The MCP tool args stay small — only uploadId is passed to Contentful upload.`;
|
|
16
|
+
export function registerStagedUploadTools(server, hosted) {
|
|
17
|
+
server.tool('cms_edit_request_staged_upload', prefixHostedToolDescription(TOOL_DESCRIPTION, hosted), {
|
|
18
|
+
fileName: z.string().describe('Target file name in Contentful (e.g. headshot-name-1200.png)'),
|
|
19
|
+
mimeType: z.string().describe('MIME type (e.g. image/png)'),
|
|
20
|
+
byteLength: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.positive()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Optional declared file size in bytes for pre-validation'),
|
|
26
|
+
title: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Optional asset title — included in consumeArgs when provided'),
|
|
30
|
+
}, async ({ fileName, mimeType, byteLength, title }) => {
|
|
31
|
+
const context = getRuntimeContext();
|
|
32
|
+
const userId = context?.user?.userId;
|
|
33
|
+
const store = context?.stagedUploadStore;
|
|
34
|
+
if (!userId || !store) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: 'text',
|
|
39
|
+
text: JSON.stringify({
|
|
40
|
+
ok: false,
|
|
41
|
+
error: 'Staged upload requires hosted MCP context (authenticated user and Redis store).',
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const result = await createStagedUploadRequest(store, {
|
|
49
|
+
userId,
|
|
50
|
+
fileName,
|
|
51
|
+
mimeType,
|
|
52
|
+
byteLength,
|
|
53
|
+
title,
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: 'text',
|
|
59
|
+
text: JSON.stringify({ ok: true, ...result }),
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
66
|
+
return {
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: 'text',
|
|
70
|
+
text: JSON.stringify({ ok: false, error: message }),
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=staged-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-upload.js","sourceRoot":"","sources":["../../../src/mcp/tools/staged-upload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEpE,MAAM,gBAAgB,GAAG;;;;;;;;;;6EAUoD,CAAC;AAE9E,MAAM,UAAU,yBAAyB,CAAC,MAAiB,EAAE,MAAsB;IACjF,MAAM,CAAC,IAAI,CACT,gCAAgC,EAChC,2BAA2B,CAAC,gBAAgB,EAAE,MAAM,CAAC,EACrD;QACE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8DAA8D,CAAC;QAC7F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QAC3D,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CAAC,yDAAyD,CAAC;QACtE,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;a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;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { AsyncLocalStorage } from 'node:async_hooks';
|
|
|
2
2
|
import type { CmsEditConfig } from '../config/types.js';
|
|
3
3
|
import type { IndexCacheStore } from '../index/cache-store.js';
|
|
4
4
|
import type { SessionStore } from '../session/session-store.js';
|
|
5
|
+
import type { StagedUploadStore } from '../staged-upload/store.js';
|
|
5
6
|
export interface ContentfulUserIdentity {
|
|
6
7
|
userId: string;
|
|
7
8
|
email: string;
|
|
@@ -15,6 +16,8 @@ export interface CmsEditRuntimeContext {
|
|
|
15
16
|
indexCacheStore?: IndexCacheStore;
|
|
16
17
|
/** Contentful user for session key isolation in hosted mode. */
|
|
17
18
|
user?: ContentfulUserIdentity;
|
|
19
|
+
/** Staged file uploads for hosted asset upload (Redis). */
|
|
20
|
+
stagedUploadStore?: StagedUploadStore;
|
|
18
21
|
}
|
|
19
22
|
export declare const cmsEditContext: AsyncLocalStorage<CmsEditRuntimeContext>;
|
|
20
23
|
export declare function getRuntimeContext(): CmsEditRuntimeContext | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,sEAAsE;IACtE,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,qEAAqE;IACrE,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gEAAgE;IAChE,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,0CAAiD,CAAC;AAE7E,wBAAgB,iBAAiB,IAAI,qBAAqB,GAAG,SAAS,CAErE;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,OAAO,EAAE,qBAAqB,EAC9B,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAwBrD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAyB,CAAC;AAE7E,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAA8B,EAC9B,EAAwB;IAExB,OAAO,cAAc,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -14,6 +14,8 @@ export interface RedisClient {
|
|
|
14
14
|
}): Promise<boolean | void>;
|
|
15
15
|
del(key: string): Promise<void>;
|
|
16
16
|
keys(pattern: string): Promise<string[]>;
|
|
17
|
+
incr(key: string): Promise<number>;
|
|
18
|
+
expire(key: string, seconds: number): Promise<void>;
|
|
17
19
|
}
|
|
18
20
|
export declare function buildSessionKey(userId: string | undefined, spaceId: string, rootEntryId: string, sessionName?: string): string;
|
|
19
21
|
export declare function buildSessionNameSuffix(sessionName: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/session/session-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,IAAI,CACF,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,QAAQ,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,uFAAuF;IACvF,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,O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E,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAClG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAIR;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.js","sourceRoot":"","sources":["../../src/session/session-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-store.js","sourceRoot":"","sources":["../../src/session/session-store.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,eAAe,CAC7B,MAA0B,EAC1B,OAAe,EACf,WAAmB,EACnB,WAAoB;IAEpB,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,MAAM,IAAI,GAAG,GAAG,OAAO,IAAI,WAAW,GAAG,MAAM,EAAE,CAAC;IAClD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,WAAmB;IACxD,OAAO,IAAI,WAAW,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function getUploadHmacSecret(): string;
|
|
2
|
+
export declare function buildUploadSignaturePayload(uploadId: string, userId: string, exp: number): string;
|
|
3
|
+
export declare function signUploadUrl(uploadId: string, userId: string, exp: number, secret: string): string;
|
|
4
|
+
export declare function verifyUploadSignature(uploadId: string, userId: string, exp: number, sig: string, secret: string): boolean;
|
|
5
|
+
export declare function buildStagedUploadUrl(origin: string, uploadId: string, userId: string, exp: number, secret: string): string;
|
|
6
|
+
//# sourceMappingURL=hmac.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src/staged-upload/hmac.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,IAAI,MAAM,CAM5C;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjG;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,MAAM,CAGR;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,OAAO,CAeT;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,MAAM,CASR"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as crypto from 'node:crypto';
|
|
2
|
+
export function getUploadHmacSecret() {
|
|
3
|
+
const value = process.env['CMS_EDIT_UPLOAD_HMAC_SECRET']?.trim();
|
|
4
|
+
if (!value) {
|
|
5
|
+
throw new Error('Missing required environment variable: CMS_EDIT_UPLOAD_HMAC_SECRET');
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
export function buildUploadSignaturePayload(uploadId, userId, exp) {
|
|
10
|
+
return `${uploadId}:${userId}:${String(exp)}`;
|
|
11
|
+
}
|
|
12
|
+
export function signUploadUrl(uploadId, userId, exp, secret) {
|
|
13
|
+
const payload = buildUploadSignaturePayload(uploadId, userId, exp);
|
|
14
|
+
return crypto.createHmac('sha256', secret).update(payload).digest('hex');
|
|
15
|
+
}
|
|
16
|
+
export function verifyUploadSignature(uploadId, userId, exp, sig, secret) {
|
|
17
|
+
if (!sig || !uploadId || !userId) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const expected = signUploadUrl(uploadId, userId, exp, secret);
|
|
21
|
+
try {
|
|
22
|
+
const expectedBuf = Buffer.from(expected, 'hex');
|
|
23
|
+
const actualBuf = Buffer.from(sig, 'hex');
|
|
24
|
+
if (expectedBuf.length !== actualBuf.length) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return crypto.timingSafeEqual(expectedBuf, actualBuf);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function buildStagedUploadUrl(origin, uploadId, userId, exp, secret) {
|
|
34
|
+
const sig = signUploadUrl(uploadId, userId, exp, secret);
|
|
35
|
+
const params = new URLSearchParams({
|
|
36
|
+
id: uploadId,
|
|
37
|
+
uid: userId,
|
|
38
|
+
exp: String(exp),
|
|
39
|
+
sig,
|
|
40
|
+
});
|
|
41
|
+
return `${origin.replace(/\/$/, '')}/api/staged-upload?${params.toString()}`;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=hmac.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,WAAW,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,QAAgB,EAChB,MAAc,EACd,GAAW,EACX,MAAc;IAEd,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;QACjC,EAAE,EAAE,QAAQ;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;QAChB,GAAG;KACJ,CAAC,CAAC;IACH,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Hosted Vercel body limit — keep under platform ~4.5 MB ceiling. */
|
|
2
|
+
export declare const HOSTED_STAGED_MAX_BYTES: number;
|
|
3
|
+
export declare const STAGED_UPLOAD_TTL_SECONDS: number;
|
|
4
|
+
export declare const STAGED_UPLOAD_RATE_LIMIT_PER_HOUR = 30;
|
|
5
|
+
export declare function hostedStagedMaxBytes(): number;
|
|
6
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/staged-upload/limits.ts"],"names":[],"mappings":"AAEA,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AAEvD,eAAO,MAAM,yBAAyB,QAAU,CAAC;AAEjD,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MAX_UPLOAD_BYTES } from '../contentful/upload-limits.js';
|
|
2
|
+
/** Hosted Vercel body limit — keep under platform ~4.5 MB ceiling. */
|
|
3
|
+
export const HOSTED_STAGED_MAX_BYTES = 4 * 1024 * 1024;
|
|
4
|
+
export const STAGED_UPLOAD_TTL_SECONDS = 15 * 60;
|
|
5
|
+
export const STAGED_UPLOAD_RATE_LIMIT_PER_HOUR = 30;
|
|
6
|
+
export function hostedStagedMaxBytes() {
|
|
7
|
+
return Math.min(MAX_UPLOAD_BYTES, HOSTED_STAGED_MAX_BYTES);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/staged-upload/limits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,sEAAsE;AACtE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,EAAE,CAAC;AAEjD,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAEpD,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../src/staged-upload/mime.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAUjE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function isAllowedStagedMimeType(mimeType) {
|
|
2
|
+
const normalized = mimeType.trim().toLowerCase();
|
|
3
|
+
if (!normalized) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
return (normalized.startsWith('image/') ||
|
|
7
|
+
normalized.startsWith('video/') ||
|
|
8
|
+
normalized === 'application/pdf');
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=mime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.js","sourceRoot":"","sources":["../../src/staged-upload/mime.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC/B,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC/B,UAAU,KAAK,iBAAiB,CACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StagedUploadStore } from './store.js';
|
|
2
|
+
import type { StagedUploadRequestResult } from './types.js';
|
|
3
|
+
export interface CreateStagedUploadRequestParams {
|
|
4
|
+
userId: string;
|
|
5
|
+
fileName: string;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
byteLength?: number;
|
|
8
|
+
title?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function createStagedUploadRequest(store: StagedUploadStore, params: CreateStagedUploadRequestParams): Promise<StagedUploadRequestResult>;
|
|
11
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/staged-upload/request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,yBAAyB,CAAC,CAoCpC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getPublicOrigin } from '../hosted/oauth/config.js';
|
|
2
|
+
import { buildStagedUploadUrl, getUploadHmacSecret } from './hmac.js';
|
|
3
|
+
import { hostedStagedMaxBytes, STAGED_UPLOAD_TTL_SECONDS } from './limits.js';
|
|
4
|
+
function shellQuote(value) {
|
|
5
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
6
|
+
}
|
|
7
|
+
export async function createStagedUploadRequest(store, params) {
|
|
8
|
+
const uploadId = await store.createPending({
|
|
9
|
+
userId: params.userId,
|
|
10
|
+
fileName: params.fileName,
|
|
11
|
+
mimeType: params.mimeType,
|
|
12
|
+
byteLength: params.byteLength,
|
|
13
|
+
});
|
|
14
|
+
const secret = getUploadHmacSecret();
|
|
15
|
+
const origin = getPublicOrigin();
|
|
16
|
+
const exp = Math.floor(Date.now() / 1000) + STAGED_UPLOAD_TTL_SECONDS;
|
|
17
|
+
const uploadUrl = buildStagedUploadUrl(origin, uploadId, params.userId, exp, secret);
|
|
18
|
+
const consumeArgs = [
|
|
19
|
+
'asset',
|
|
20
|
+
'upload',
|
|
21
|
+
'--staged',
|
|
22
|
+
uploadId,
|
|
23
|
+
'--mime',
|
|
24
|
+
params.mimeType,
|
|
25
|
+
'--file-name',
|
|
26
|
+
params.fileName,
|
|
27
|
+
...(params.title ? ['--title', params.title] : []),
|
|
28
|
+
];
|
|
29
|
+
const curlCommand = `curl -f -X POST -F ${shellQuote(`file=@/path/to/${params.fileName}`)} ${shellQuote(uploadUrl)}`;
|
|
30
|
+
return {
|
|
31
|
+
uploadId,
|
|
32
|
+
uploadUrl,
|
|
33
|
+
expiresIn: STAGED_UPLOAD_TTL_SECONDS,
|
|
34
|
+
expiresAt: exp,
|
|
35
|
+
maxBytes: hostedStagedMaxBytes(),
|
|
36
|
+
curlCommand,
|
|
37
|
+
consumeArgs,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/staged-upload/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAY9E,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,KAAwB,EACxB,MAAuC;IAEvC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC;QACzC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GA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