@moneypot/hub 1.15.0 → 1.16.0-dev.4

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.
Files changed (39) hide show
  1. package/dist/src/__generated__/gql.d.ts +2 -2
  2. package/dist/src/__generated__/gql.js +1 -1
  3. package/dist/src/__generated__/graphql.d.ts +240 -27
  4. package/dist/src/__generated__/graphql.js +30 -1
  5. package/dist/src/db/index.d.ts +1 -0
  6. package/dist/src/db/index.js +10 -2
  7. package/dist/src/db/public.d.ts +6 -10
  8. package/dist/src/db/public.js +24 -36
  9. package/dist/src/db/types.d.ts +24 -0
  10. package/dist/src/express.d.ts +1 -0
  11. package/dist/src/graphql-queries.js +4 -0
  12. package/dist/src/index.d.ts +2 -1
  13. package/dist/src/index.js +2 -1
  14. package/dist/src/pg-advisory-lock.d.ts +5 -0
  15. package/dist/src/pg-advisory-lock.js +5 -0
  16. package/dist/src/pg-versions/013-chat.sql +221 -0
  17. package/dist/src/plugins/chat/hub-chat-after-id-condition.d.ts +1 -0
  18. package/dist/src/plugins/chat/hub-chat-after-id-condition.js +15 -0
  19. package/dist/src/plugins/chat/hub-chat-create-system-message.d.ts +1 -0
  20. package/dist/src/plugins/chat/hub-chat-create-system-message.js +124 -0
  21. package/dist/src/plugins/chat/hub-chat-create-user-message.d.ts +1 -0
  22. package/dist/src/plugins/chat/hub-chat-create-user-message.js +231 -0
  23. package/dist/src/plugins/chat/hub-chat-mute-user.d.ts +1 -0
  24. package/dist/src/plugins/chat/hub-chat-mute-user.js +186 -0
  25. package/dist/src/plugins/chat/hub-chat-subscription.d.ts +14 -0
  26. package/dist/src/plugins/chat/hub-chat-subscription.js +133 -0
  27. package/dist/src/plugins/chat/hub-chat-unmute-user.d.ts +1 -0
  28. package/dist/src/plugins/chat/hub-chat-unmute-user.js +146 -0
  29. package/dist/src/plugins/hub-authenticate.js +38 -17
  30. package/dist/src/plugins/hub-create-playground-session.js +44 -13
  31. package/dist/src/plugins/hub-make-outcome-bet.js +39 -33
  32. package/dist/src/server/graphile.config.d.ts +13 -1
  33. package/dist/src/server/graphile.config.js +38 -12
  34. package/dist/src/server/index.d.ts +3 -1
  35. package/dist/src/server/index.js +3 -1
  36. package/dist/src/server/middleware/authentication.js +1 -0
  37. package/dist/src/util.d.ts +3 -0
  38. package/dist/src/util.js +9 -0
  39. package/package.json +1 -1
@@ -45,7 +45,7 @@ function createExpressServer(context) {
45
45
  });
46
46
  return app;
47
47
  }
48
- export function createHubServer({ configureApp, plugins, exportSchemaSDLPath, extraPgSchemas, abortSignal, context, }) {
48
+ export function createHubServer({ configureApp, plugins, exportSchemaSDLPath, extraPgSchemas, abortSignal, context, enableChat, enablePlayground, }) {
49
49
  const expressServer = createExpressServer(context);
50
50
  const preset = createPreset({
51
51
  plugins: plugins ?? defaultPlugins,
@@ -53,6 +53,8 @@ export function createHubServer({ configureApp, plugins, exportSchemaSDLPath, ex
53
53
  extraPgSchemas: extraPgSchemas ?? [],
54
54
  abortSignal,
55
55
  context,
56
+ enableChat,
57
+ enablePlayground,
56
58
  });
57
59
  const pgl = postgraphile.default(preset);
58
60
  const serv = pgl.createServ(grafserv);
@@ -35,6 +35,7 @@ const authentication = (context) => {
35
35
  user: result.user,
36
36
  sessionId: result.sessionId,
37
37
  isPlayground: result.isPlayground,
38
+ isExperienceOwner: result.isExperienceOwner,
38
39
  };
39
40
  }
40
41
  return next();
@@ -1,3 +1,4 @@
1
+ import z from "zod/v4";
1
2
  export declare function isUuid(input: any): boolean;
2
3
  export type Result<V, E> = {
3
4
  ok: true;
@@ -6,3 +7,5 @@ export type Result<V, E> = {
6
7
  ok: false;
7
8
  error: E;
8
9
  };
10
+ export declare function extractFirstZodErrorMessage(e: z.ZodError): string;
11
+ export declare function uuidEqual(a: string, b: string): boolean;
package/dist/src/util.js CHANGED
@@ -2,3 +2,12 @@ const UUID_REGEX = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA
2
2
  export function isUuid(input) {
3
3
  return typeof input === "string" && UUID_REGEX.test(input);
4
4
  }
5
+ export function extractFirstZodErrorMessage(e) {
6
+ return e.issues[0].message;
7
+ }
8
+ export function uuidEqual(a, b) {
9
+ return normalizeUuid(a) === normalizeUuid(b);
10
+ }
11
+ function normalizeUuid(uuid) {
12
+ return uuid.toLowerCase();
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneypot/hub",
3
- "version": "1.15.0",
3
+ "version": "1.16.0-dev.4",
4
4
  "author": "moneypot.com",
5
5
  "homepage": "https://moneypot.com/hub",
6
6
  "keywords": [