@ampless/backend 0.2.0-alpha.3 → 0.2.0-alpha.5
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/auth/user-admin.d.ts +36 -4
- package/dist/auth/user-admin.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Handler } from 'aws-lambda';
|
|
2
2
|
|
|
3
3
|
type AdminRole = 'admin' | 'editor' | 'none';
|
|
4
4
|
interface AdminUserDto {
|
|
@@ -6,12 +6,44 @@ interface AdminUserDto {
|
|
|
6
6
|
email: string;
|
|
7
7
|
role: AdminRole;
|
|
8
8
|
}
|
|
9
|
-
interface ListArgs {
|
|
10
|
-
}
|
|
11
9
|
interface SetArgs {
|
|
12
10
|
userId: string;
|
|
13
11
|
role: string;
|
|
14
12
|
}
|
|
15
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Event shape that Amplify Gen 2 actually delivers to a Lambda data
|
|
15
|
+
* source attached via `a.handler.function()`. The CDK generated
|
|
16
|
+
* AppSync resource is a PIPELINE resolver whose Lambda-invocation
|
|
17
|
+
* function uses a VTL request mapping template that emits a flat
|
|
18
|
+
* payload:
|
|
19
|
+
*
|
|
20
|
+
* {
|
|
21
|
+
* "operation": "Invoke",
|
|
22
|
+
* "payload": {
|
|
23
|
+
* "typeName": "Query",
|
|
24
|
+
* "fieldName": "listAdminUsers",
|
|
25
|
+
* "arguments": { ... },
|
|
26
|
+
* "identity": { ... },
|
|
27
|
+
* "source": ..., "request": ..., "prev": ...
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* Notably this is NOT the canonical `AppSyncResolverEvent` shape
|
|
32
|
+
* (which has `event.info.fieldName`). The `aws-lambda` package's
|
|
33
|
+
* `AppSyncResolverHandler` type is misleading here — typing the
|
|
34
|
+
* handler with it sends `event.info.fieldName` to `undefined` and
|
|
35
|
+
* blows up at runtime with
|
|
36
|
+
* `Cannot read properties of undefined (reading 'fieldName')`.
|
|
37
|
+
*/
|
|
38
|
+
interface UserAdminEvent {
|
|
39
|
+
typeName: string;
|
|
40
|
+
fieldName: string;
|
|
41
|
+
arguments: Partial<SetArgs>;
|
|
42
|
+
identity?: unknown;
|
|
43
|
+
source?: unknown;
|
|
44
|
+
request?: unknown;
|
|
45
|
+
prev?: unknown;
|
|
46
|
+
}
|
|
47
|
+
declare const handler: Handler<UserAdminEvent, AdminUserDto | AdminUserDto[] | null>;
|
|
16
48
|
|
|
17
49
|
export { handler };
|
package/dist/auth/user-admin.js
CHANGED
|
@@ -76,7 +76,7 @@ async function setAdminUserRole(userPoolId, userId, role) {
|
|
|
76
76
|
}
|
|
77
77
|
var handler = async (event) => {
|
|
78
78
|
const userPoolId = requireUserPoolId();
|
|
79
|
-
const field = event.
|
|
79
|
+
const field = event.fieldName;
|
|
80
80
|
try {
|
|
81
81
|
if (field === "listAdminUsers") {
|
|
82
82
|
return await listAdminUsers(userPoolId);
|
package/dist/index.js
CHANGED
|
@@ -218,7 +218,7 @@ function amplessSchemaModels(a, opts = {}) {
|
|
|
218
218
|
slug: a.string().required(),
|
|
219
219
|
title: a.string().required(),
|
|
220
220
|
excerpt: a.string(),
|
|
221
|
-
format: a.enum(["tiptap", "markdown", "html"]),
|
|
221
|
+
format: a.enum(["tiptap", "markdown", "html", "static"]),
|
|
222
222
|
body: a.json(),
|
|
223
223
|
status: a.enum(["draft", "published"]),
|
|
224
224
|
publishedAt: a.datetime(),
|
|
@@ -252,7 +252,7 @@ function amplessSchemaModels(a, opts = {}) {
|
|
|
252
252
|
pageId: a.id().required(),
|
|
253
253
|
slug: a.string().required(),
|
|
254
254
|
title: a.string().required(),
|
|
255
|
-
format: a.enum(["tiptap", "markdown", "html"]),
|
|
255
|
+
format: a.enum(["tiptap", "markdown", "html", "static"]),
|
|
256
256
|
body: a.json(),
|
|
257
257
|
status: a.enum(["draft", "published"]),
|
|
258
258
|
publishedAt: a.datetime()
|
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.5",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@aws-sdk/client-sqs": "^3.717.0",
|
|
57
57
|
"@aws-sdk/lib-dynamodb": "^3.717.0",
|
|
58
58
|
"@aws-sdk/util-dynamodb": "^3.717.0",
|
|
59
|
-
"ampless": "0.2.0-alpha.
|
|
59
|
+
"ampless": "0.2.0-alpha.3"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@aws-amplify/backend": "^1",
|