@anthusai/papyrus 5.43.0-next.52 → 5.43.0-next.53
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
1
2
|
import { a } from "@aws-amplify/backend";
|
|
2
3
|
/**
|
|
3
4
|
* Messages belong to their author, and the backend says so. The browser cannot create, edit or delete a Message through the
|
|
@@ -10,8 +11,11 @@ import { a } from "@aws-amplify/backend";
|
|
|
10
11
|
*/
|
|
11
12
|
const people = (allow) => [allow.group("editor"), allow.group("admin")];
|
|
12
13
|
const adminsOnly = (allow) => [allow.group("admin")];
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
// Absolute paths: when a site loads this file from the package, its call site carries a loader query
|
|
15
|
+
// (`?tsx-namespace=...`) that Amplify cannot turn back into a directory, so a relative entry fails to deploy.
|
|
16
|
+
export const resolverEntry = (relative) => fileURLToPath(new URL(relative, import.meta.url));
|
|
17
|
+
const onMessages = (entry) => a.handler.custom({ dataSource: a.ref("Message"), entry: resolverEntry(entry) });
|
|
18
|
+
const onThreads = (entry) => a.handler.custom({ dataSource: a.ref("MessageThread"), entry: resolverEntry(entry) });
|
|
15
19
|
export const messageActionsSchemaDefinitions = {
|
|
16
20
|
postMessage: a
|
|
17
21
|
.mutation()
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
1
2
|
import { a } from "@aws-amplify/backend";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -11,8 +12,11 @@ import { a } from "@aws-amplify/backend";
|
|
|
11
12
|
*/
|
|
12
13
|
const people = (allow: any) => [allow.group("editor"), allow.group("admin")];
|
|
13
14
|
const adminsOnly = (allow: any) => [allow.group("admin")];
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
// Absolute paths: when a site loads this file from the package, its call site carries a loader query
|
|
16
|
+
// (`?tsx-namespace=...`) that Amplify cannot turn back into a directory, so a relative entry fails to deploy.
|
|
17
|
+
export const resolverEntry = (relative: string) => fileURLToPath(new URL(relative, import.meta.url));
|
|
18
|
+
const onMessages = (entry: string) => a.handler.custom({ dataSource: a.ref("Message"), entry: resolverEntry(entry) });
|
|
19
|
+
const onThreads = (entry: string) => a.handler.custom({ dataSource: a.ref("MessageThread"), entry: resolverEntry(entry) });
|
|
16
20
|
|
|
17
21
|
export const messageActionsSchemaDefinitions = {
|
|
18
22
|
postMessage: a
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED