@moneypot/hub 0.0.1
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/README.md +108 -0
- package/dist/cli/add-casino.d.ts +2 -0
- package/dist/cli/add-casino.js +116 -0
- package/dist/dashboard/assets/index-BtrbrisP.js +360 -0
- package/dist/dashboard/assets/index-tK7EUtyc.css +5 -0
- package/dist/dashboard/index.html +13 -0
- package/dist/src/GraphQLError.d.ts +8 -0
- package/dist/src/GraphQLError.js +79 -0
- package/dist/src/__generated__/fragment-masking.d.ts +19 -0
- package/dist/src/__generated__/fragment-masking.js +16 -0
- package/dist/src/__generated__/gql.d.ts +26 -0
- package/dist/src/__generated__/gql.js +15 -0
- package/dist/src/__generated__/graphql.d.ts +3129 -0
- package/dist/src/__generated__/graphql.js +454 -0
- package/dist/src/__generated__/index.d.ts +2 -0
- package/dist/src/__generated__/index.js +2 -0
- package/dist/src/config.d.ts +14 -0
- package/dist/src/config.js +57 -0
- package/dist/src/db/index.d.ts +89 -0
- package/dist/src/db/index.js +339 -0
- package/dist/src/db/internal.d.ts +7 -0
- package/dist/src/db/internal.js +33 -0
- package/dist/src/db/public.d.ts +7 -0
- package/dist/src/db/public.js +20 -0
- package/dist/src/db/types.d.ts +80 -0
- package/dist/src/db/types.js +1 -0
- package/dist/src/db/util.d.ts +6 -0
- package/dist/src/db/util.js +9 -0
- package/dist/src/express.d.ts +13 -0
- package/dist/src/express.js +1 -0
- package/dist/src/grafast.d.ts +1 -0
- package/dist/src/grafast.js +1 -0
- package/dist/src/graphile.d.ts +1 -0
- package/dist/src/graphile.js +1 -0
- package/dist/src/graphql-client.d.ts +6 -0
- package/dist/src/graphql-client.js +8 -0
- package/dist/src/graphql-queries.d.ts +18 -0
- package/dist/src/graphql-queries.js +123 -0
- package/dist/src/graphql.d.ts +1 -0
- package/dist/src/graphql.js +1 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.js +65 -0
- package/dist/src/logger.d.ts +9 -0
- package/dist/src/logger.js +21 -0
- package/dist/src/pg-versions/001-schema.sql +456 -0
- package/dist/src/plugins/caas-add-casino.d.ts +1 -0
- package/dist/src/plugins/caas-add-casino.js +150 -0
- package/dist/src/plugins/caas-authenticate.d.ts +1 -0
- package/dist/src/plugins/caas-authenticate.js +175 -0
- package/dist/src/plugins/caas-balance-alert.d.ts +1 -0
- package/dist/src/plugins/caas-balance-alert.js +43 -0
- package/dist/src/plugins/caas-claim-faucet.d.ts +1 -0
- package/dist/src/plugins/caas-claim-faucet.js +85 -0
- package/dist/src/plugins/caas-current-x.d.ts +1 -0
- package/dist/src/plugins/caas-current-x.js +62 -0
- package/dist/src/plugins/caas-schema-prefix.d.ts +1 -0
- package/dist/src/plugins/caas-schema-prefix.js +25 -0
- package/dist/src/plugins/caas-user-balance-by-currency.d.ts +1 -0
- package/dist/src/plugins/caas-user-balance-by-currency.js +55 -0
- package/dist/src/plugins/caas-withdraw.d.ts +1 -0
- package/dist/src/plugins/caas-withdraw.js +133 -0
- package/dist/src/plugins/debug.d.ts +1 -0
- package/dist/src/plugins/debug.js +14 -0
- package/dist/src/plugins/hub-add-casino.d.ts +1 -0
- package/dist/src/plugins/hub-add-casino.js +150 -0
- package/dist/src/plugins/hub-authenticate.d.ts +1 -0
- package/dist/src/plugins/hub-authenticate.js +175 -0
- package/dist/src/plugins/hub-balance-alert.d.ts +1 -0
- package/dist/src/plugins/hub-balance-alert.js +43 -0
- package/dist/src/plugins/hub-claim-faucet.d.ts +1 -0
- package/dist/src/plugins/hub-claim-faucet.js +85 -0
- package/dist/src/plugins/hub-current-x.d.ts +1 -0
- package/dist/src/plugins/hub-current-x.js +62 -0
- package/dist/src/plugins/hub-schema-prefix.d.ts +1 -0
- package/dist/src/plugins/hub-schema-prefix.js +25 -0
- package/dist/src/plugins/hub-user-balance-by-currency.d.ts +1 -0
- package/dist/src/plugins/hub-user-balance-by-currency.js +55 -0
- package/dist/src/plugins/hub-withdraw.d.ts +1 -0
- package/dist/src/plugins/hub-withdraw.js +133 -0
- package/dist/src/plugins/id-to-node-id.d.ts +1 -0
- package/dist/src/plugins/id-to-node-id.js +31 -0
- package/dist/src/plugins/validate-fields.d.ts +1 -0
- package/dist/src/plugins/validate-fields.js +61 -0
- package/dist/src/process-transfers.d.ts +7 -0
- package/dist/src/process-transfers.js +413 -0
- package/dist/src/process-withdrawal-request.d.ts +5 -0
- package/dist/src/process-withdrawal-request.js +129 -0
- package/dist/src/server/graphile.config.d.ts +33 -0
- package/dist/src/server/graphile.config.js +166 -0
- package/dist/src/server/handle-errors.d.ts +10 -0
- package/dist/src/server/handle-errors.js +88 -0
- package/dist/src/server/index.d.ts +2 -0
- package/dist/src/server/index.js +69 -0
- package/dist/src/server/middleware/authentication.d.ts +4 -0
- package/dist/src/server/middleware/authentication.js +55 -0
- package/dist/src/server/middleware/cors.d.ts +3 -0
- package/dist/src/server/middleware/cors.js +14 -0
- package/dist/src/services/jwt-service.d.ts +13 -0
- package/dist/src/services/jwt-service.js +131 -0
- package/dist/src/smart-tags.d.ts +1 -0
- package/dist/src/smart-tags.js +55 -0
- package/dist/src/util.d.ts +12 -0
- package/dist/src/util.js +4 -0
- package/dist/src/validate.d.ts +9 -0
- package/dist/src/validate.js +91 -0
- package/package.json +69 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as Yup from "yup";
|
|
2
|
+
import * as util from "./util.js";
|
|
3
|
+
export const isUuid = {
|
|
4
|
+
name: "uuid",
|
|
5
|
+
message: "Must be a valid UUID",
|
|
6
|
+
test(value) {
|
|
7
|
+
return value === undefined || util.isUuid(value);
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
const isUrl = {
|
|
11
|
+
name: "url",
|
|
12
|
+
message: "URL must be valid",
|
|
13
|
+
test(value, _ctx) {
|
|
14
|
+
if (value === undefined)
|
|
15
|
+
return true;
|
|
16
|
+
try {
|
|
17
|
+
new URL(value || "");
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const isHttpProtocol = {
|
|
26
|
+
name: "http-protocol",
|
|
27
|
+
message: "URL must use http or https protocol",
|
|
28
|
+
test(value) {
|
|
29
|
+
if (value === undefined)
|
|
30
|
+
return true;
|
|
31
|
+
try {
|
|
32
|
+
const url = new URL(value || "");
|
|
33
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const isBaseUrl = {
|
|
41
|
+
name: "base-url",
|
|
42
|
+
message: "URL must be a base URL with no path, query, nor hash",
|
|
43
|
+
test(value) {
|
|
44
|
+
if (value === undefined)
|
|
45
|
+
return true;
|
|
46
|
+
try {
|
|
47
|
+
const url = new URL(value || "");
|
|
48
|
+
return url.pathname === "/" && url.search === "" && url.hash === "";
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const isGraphqlUrl = {
|
|
56
|
+
name: "graphql-url-path",
|
|
57
|
+
message: "URL must be have /graphql path",
|
|
58
|
+
test(value) {
|
|
59
|
+
if (value === undefined)
|
|
60
|
+
return true;
|
|
61
|
+
try {
|
|
62
|
+
const url = new URL(value || "");
|
|
63
|
+
return url.pathname === "/graphql";
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const doesNotHaveTrailingSlash = {
|
|
71
|
+
name: "does-not-have-trailing-slash",
|
|
72
|
+
message: "URL must not have a trailing slash",
|
|
73
|
+
test(value) {
|
|
74
|
+
if (value === undefined)
|
|
75
|
+
return true;
|
|
76
|
+
return !value.endsWith("/");
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export const graphqlUrl = () => Yup.string()
|
|
80
|
+
.trim()
|
|
81
|
+
.test(isUrl)
|
|
82
|
+
.test(isHttpProtocol)
|
|
83
|
+
.test(isGraphqlUrl)
|
|
84
|
+
.test(doesNotHaveTrailingSlash);
|
|
85
|
+
export const baseUrl = () => Yup.string()
|
|
86
|
+
.trim()
|
|
87
|
+
.test(isUrl)
|
|
88
|
+
.test(isHttpProtocol)
|
|
89
|
+
.test(isBaseUrl)
|
|
90
|
+
.test(doesNotHaveTrailingSlash);
|
|
91
|
+
export const uuid = () => Yup.string().trim().test(isUuid);
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@moneypot/hub",
|
|
3
|
+
"author": "",
|
|
4
|
+
"keywords": [],
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"description": "",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/src/index.js",
|
|
9
|
+
"types": "dist/src/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/src/index.js",
|
|
12
|
+
"./db": "./dist/src/db/index.js",
|
|
13
|
+
"./db/types": "./dist/src/db/types.js",
|
|
14
|
+
"./db/util": "./dist/src/db/util.js",
|
|
15
|
+
"./config": "./dist/src/config.js",
|
|
16
|
+
"./graphile": "./dist/src/graphile.js",
|
|
17
|
+
"./graphql": "./dist/src/graphql.js",
|
|
18
|
+
"./grafast": "./dist/src/grafast.js",
|
|
19
|
+
"./express": "./dist/src/express.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"/dist"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"add-casino": "./dist/cli/add-casino.js"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc && cp -R src/pg-versions dist/src/ && npm run build-dashboard",
|
|
29
|
+
"check": "tsc --noEmit && npm run check-dashboard",
|
|
30
|
+
"check-dashboard": "cd ./dashboard && npm run check",
|
|
31
|
+
"lint": "eslint . && npm run lint-dashboard",
|
|
32
|
+
"lint-dashboard": "cd ./dashboard && npm run lint",
|
|
33
|
+
"prepublishOnly": "npm run build",
|
|
34
|
+
"codegen": "npx graphql-codegen",
|
|
35
|
+
"codegen-watch": "graphql-codegen --watch",
|
|
36
|
+
"build-dashboard": "cd ./dashboard && npm run build && rm -rf ../dist/dashboard && cp -Rv dist ../dist/dashboard"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@graphile-contrib/pg-omit-archived": "^4.0.0-beta.2",
|
|
40
|
+
"@moneypot/hash-herald": "^1.0.0",
|
|
41
|
+
"@moneypot/pg-upgrade-schema": "^2.0.1",
|
|
42
|
+
"@noble/curves": "^1.5.0",
|
|
43
|
+
"dotenv": "^16.4.5",
|
|
44
|
+
"express": "^5.0.1",
|
|
45
|
+
"graphql": "^16.8.1",
|
|
46
|
+
"graphql-request": "^7.0.0",
|
|
47
|
+
"jose": "^5.10.0",
|
|
48
|
+
"pg": "^8.12.0",
|
|
49
|
+
"pg-connection-string": "^2.6.4",
|
|
50
|
+
"postgraphile": "^5.0.0-beta.37",
|
|
51
|
+
"tsafe": "^1.6.6",
|
|
52
|
+
"yup": "^1.6.1",
|
|
53
|
+
"zod": "^3.23.5"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@eslint/js": "^9.8.0",
|
|
57
|
+
"@graphql-codegen/cli": "^5.0.2",
|
|
58
|
+
"@graphql-codegen/client-preset": "^4.2.5",
|
|
59
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
|
60
|
+
"@types/express": "^5.0.0",
|
|
61
|
+
"@types/node": "^22.1.0",
|
|
62
|
+
"@types/pg": "^8.11.5",
|
|
63
|
+
"eslint": "^9.8.0",
|
|
64
|
+
"globals": "^15.9.0",
|
|
65
|
+
"typescript": "^5.4.5",
|
|
66
|
+
"typescript-eslint": "^8.0.1"
|
|
67
|
+
},
|
|
68
|
+
"license": ""
|
|
69
|
+
}
|