@ampless/backend 0.2.0-alpha.14 → 0.2.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/mcp-handler.js +11 -27
- package/package.json +3 -3
|
@@ -4,10 +4,12 @@ import "../chunk-BYXBJQAS.js";
|
|
|
4
4
|
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
5
5
|
import { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb";
|
|
6
6
|
import { createHash } from "crypto";
|
|
7
|
+
import { decodeAwsJson as decodeAwsJson2 } from "ampless";
|
|
7
8
|
|
|
8
|
-
// ../mcp-server/dist/chunk-
|
|
9
|
-
import {
|
|
10
|
-
import { composeSiteIdStatus
|
|
9
|
+
// ../mcp-server/dist/chunk-6LH275IC.js
|
|
10
|
+
import { decodeAwsJson } from "ampless";
|
|
11
|
+
import { composeSiteIdStatus, composeSiteIdSlug, encodeAwsJson } from "ampless";
|
|
12
|
+
import { composeSiteIdStatus as composeSiteIdStatus2, composeSiteIdSlug as composeSiteIdSlug2, encodeAwsJson as encodeAwsJson2 } from "ampless";
|
|
11
13
|
var POST_FIELDS = (
|
|
12
14
|
/* GraphQL */
|
|
13
15
|
`
|
|
@@ -25,18 +27,6 @@ var POST_FIELDS = (
|
|
|
25
27
|
}
|
|
26
28
|
`
|
|
27
29
|
);
|
|
28
|
-
function decodeBody(value) {
|
|
29
|
-
if (typeof value !== "string") return value;
|
|
30
|
-
try {
|
|
31
|
-
return JSON.parse(value);
|
|
32
|
-
} catch {
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function encodeBody(value) {
|
|
37
|
-
if (typeof value === "string") return value;
|
|
38
|
-
return JSON.stringify(value ?? null);
|
|
39
|
-
}
|
|
40
30
|
function toCorePost(p) {
|
|
41
31
|
return {
|
|
42
32
|
siteId: p.siteId,
|
|
@@ -45,7 +35,7 @@ function toCorePost(p) {
|
|
|
45
35
|
title: p.title,
|
|
46
36
|
excerpt: p.excerpt ?? void 0,
|
|
47
37
|
format: p.format ?? "markdown",
|
|
48
|
-
body:
|
|
38
|
+
body: decodeAwsJson(p.body),
|
|
49
39
|
status: p.status ?? "draft",
|
|
50
40
|
publishedAt: p.publishedAt ?? void 0,
|
|
51
41
|
tags: (p.tags ?? []).filter((t) => typeof t === "string")
|
|
@@ -266,7 +256,7 @@ async function createPost(client, defaultSiteId, args) {
|
|
|
266
256
|
title: args.title,
|
|
267
257
|
excerpt: args.excerpt,
|
|
268
258
|
format: args.format,
|
|
269
|
-
body:
|
|
259
|
+
body: encodeAwsJson(args.body),
|
|
270
260
|
status,
|
|
271
261
|
publishedAt,
|
|
272
262
|
tags: args.tags,
|
|
@@ -314,7 +304,7 @@ async function updatePost(client, defaultSiteId, args) {
|
|
|
314
304
|
if (args.title !== void 0) input.title = args.title;
|
|
315
305
|
if (args.excerpt !== void 0) input.excerpt = args.excerpt;
|
|
316
306
|
if (args.format !== void 0) input.format = args.format;
|
|
317
|
-
if (args.body !== void 0) input.body =
|
|
307
|
+
if (args.body !== void 0) input.body = encodeAwsJson2(args.body);
|
|
318
308
|
if (args.status !== void 0) input.status = args.status;
|
|
319
309
|
if (args.publishedAt !== void 0) input.publishedAt = args.publishedAt;
|
|
320
310
|
if (args.tags !== void 0) input.tags = args.tags;
|
|
@@ -637,15 +627,9 @@ async function validateBearer(plaintext) {
|
|
|
637
627
|
return meta;
|
|
638
628
|
}
|
|
639
629
|
function decodeTokenMeta(value) {
|
|
640
|
-
|
|
641
|
-
if (typeof
|
|
642
|
-
|
|
643
|
-
return JSON.parse(value);
|
|
644
|
-
} catch {
|
|
645
|
-
return null;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
return null;
|
|
630
|
+
const parsed = decodeAwsJson2(value);
|
|
631
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
632
|
+
return parsed;
|
|
649
633
|
}
|
|
650
634
|
var cachedCtx = null;
|
|
651
635
|
function makeContext(meta) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ampless/backend",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.15",
|
|
4
4
|
"description": "Amplify Gen 2 backend factories for ampless: auth, data, storage, event processors, API key renewer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"@aws-sdk/util-dynamodb": "^3.717.0",
|
|
65
65
|
"@smithy/protocol-http": "^5.3.0",
|
|
66
66
|
"@smithy/signature-v4": "^5.4.0",
|
|
67
|
-
"ampless": "0.2.0-alpha.
|
|
68
|
-
"@ampless/mcp-server": "0.2.0-alpha.
|
|
67
|
+
"ampless": "0.2.0-alpha.7",
|
|
68
|
+
"@ampless/mcp-server": "0.2.0-alpha.7"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@aws-amplify/backend": "^1",
|