eddev 0.2.0-beta.1 → 0.2.0-beta.10

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 (55) hide show
  1. package/build/build-favicon.d.ts +1 -0
  2. package/build/build-favicon.js +71 -0
  3. package/build/create-serverless-dev-worker.d.ts +3 -0
  4. package/build/create-serverless-dev-worker.js +99 -0
  5. package/build/get-webpack-config.js +15 -10
  6. package/build/reporter.js +0 -109
  7. package/build/serverless/create-next-app.d.ts +2 -0
  8. package/build/serverless/create-next-app.js +212 -76
  9. package/build/state/serverless-state.d.ts +26 -0
  10. package/build/state/serverless-state.js +2 -0
  11. package/build/workers/serverless-worker-dev-script.d.ts +1 -0
  12. package/build/workers/serverless-worker-dev-script.js +21 -0
  13. package/{cli/prepare-next.d.ts → build/workers/serverless-worker-script.d.ts} +0 -0
  14. package/{cli/prepare-next.js → build/workers/serverless-worker-script.js} +0 -0
  15. package/cli/build.dev.js +30 -7
  16. package/cli/build.prod.js +5 -0
  17. package/cli/cli.js +22 -14
  18. package/cli/display/components/DevCLIDisplay.d.ts +3 -0
  19. package/cli/display/components/DevCLIDisplay.js +20 -1
  20. package/cli/display/components/ServerlessDisplay.d.ts +9 -0
  21. package/cli/display/components/ServerlessDisplay.js +68 -0
  22. package/config/config-schema.d.ts +65 -0
  23. package/config/config-schema.js +23 -0
  24. package/config/create-schema-file.d.ts +1 -0
  25. package/config/create-schema-file.js +20 -0
  26. package/config/get-config.d.ts +45 -0
  27. package/config/get-config.js +32 -0
  28. package/config/index.d.ts +2 -0
  29. package/config/index.js +14 -0
  30. package/config/parse-config.d.ts +29 -0
  31. package/config/parse-config.js +8 -0
  32. package/config/print-zod-errors.d.ts +2 -0
  33. package/config/print-zod-errors.js +14 -0
  34. package/hooks/useAppData.js +0 -1
  35. package/package.json +7 -7
  36. package/serverless/create-rpc-client.d.ts +33 -0
  37. package/serverless/create-rpc-client.js +20 -0
  38. package/serverless/define-api.d.ts +2 -0
  39. package/serverless/define-api.js +66 -0
  40. package/serverless/define-rpc-router.d.ts +2 -0
  41. package/serverless/define-rpc-router.js +27 -0
  42. package/serverless/error-codes.d.ts +2 -0
  43. package/serverless/error-codes.js +14 -0
  44. package/serverless/index.d.ts +4 -0
  45. package/serverless/index.js +16 -0
  46. package/serverless/rpc-provider.d.ts +1 -0
  47. package/serverless/rpc-provider.js +5 -0
  48. package/serverless-template/_utils/ed-config.ts +5 -0
  49. package/serverless-template/_utils/fetch-wordpress-props.ts +30 -6
  50. package/serverless-template/next.config.js +63 -52
  51. package/serverless-template/pages/_document.tsx +19 -0
  52. package/utils/getRepoName.d.ts +2 -2
  53. package/utils/getRepoName.js +6 -52
  54. package/fields/ImageWell.d.ts +0 -8
  55. package/fields/ImageWell.js +0 -64
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.ServerlessLog = exports.ServerlessDisplay = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var ink_1 = require("ink");
17
+ var react_1 = require("react");
18
+ var useObservable_1 = require("../../../utils/useObservable");
19
+ var StatusIcon_1 = require("./StatusIcon");
20
+ var statusLabels = {
21
+ starting: "Starting",
22
+ compiling: "Compiling...",
23
+ error: "Error! See log for details.",
24
+ packaging: "Updating packages...",
25
+ preparing: "Preparing...",
26
+ success: "Success!",
27
+ waiting: "Waiting...",
28
+ };
29
+ function StatusLabel(props) {
30
+ var color = (0, react_1.useMemo)(function () {
31
+ if (props.status === "packaging" ||
32
+ props.status === "preparing" ||
33
+ props.status === "waiting" ||
34
+ props.status === "compiling") {
35
+ return "yellowBright";
36
+ }
37
+ else if (props.status === "error") {
38
+ return "redBright";
39
+ }
40
+ else if (props.status === "success") {
41
+ return "greenBright";
42
+ }
43
+ else {
44
+ return "whiteBright";
45
+ }
46
+ }, [props.status]);
47
+ var label = props.statusLabel || statusLabels[props.status];
48
+ if (props.duration) {
49
+ label += " (".concat(props.duration, "ms)");
50
+ }
51
+ return ((0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ paddingX: 1, width: "100%", flexGrow: 1, flexDirection: "row", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ color: color }, { children: label }), void 0), props.url && (0, jsx_runtime_1.jsxs)(ink_1.Text, __assign({ color: "white" }, { children: ["\u2728 ", props.url] }), void 0)] }), void 0));
52
+ }
53
+ function ServerlessDisplay(props) {
54
+ var data = (0, useObservable_1.useObservable)(props.serverless);
55
+ return ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: "100%", flexDirection: "column" }, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: 2, flexGrow: 0, flexShrink: 0 }, { children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success"
56
+ ? "tick"
57
+ : data.status === "preparing" || data.status === "packaging" || data.status === "compiling"
58
+ ? "loading"
59
+ : data.status === "error"
60
+ ? "error"
61
+ : "none" }, void 0) }), void 0), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ flexDirection: "row" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ bold: true }, { children: data.title }), void 0), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: "", duration: data.status === "success" ? data.duration : undefined, url: data.url }, void 0)] }), void 0) }, void 0)] }), void 0) }), void 0));
62
+ }
63
+ exports.ServerlessDisplay = ServerlessDisplay;
64
+ function ServerlessLog(props) {
65
+ var log = (0, useObservable_1.useObservable)(props.serverless).log;
66
+ return (0, jsx_runtime_1.jsx)(ink_1.Text, { children: log }, void 0);
67
+ }
68
+ exports.ServerlessLog = ServerlessLog;
@@ -0,0 +1,65 @@
1
+ import { z } from "zod";
2
+ export declare const EDConfigSchema: z.ZodObject<{
3
+ $schema: z.ZodOptional<z.ZodString>;
4
+ serverless: z.ZodOptional<z.ZodObject<{
5
+ enabled: z.ZodBoolean;
6
+ uploads: z.ZodEnum<["proxy", "remote"]>;
7
+ plugins: z.ZodEnum<["proxy", "remote"]>;
8
+ theme: z.ZodEnum<["proxy", "copy", "remote"]>;
9
+ devAssets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
+ apiOnly: z.ZodOptional<z.ZodBoolean>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ devAssets?: string[] | undefined;
13
+ apiOnly?: boolean | undefined;
14
+ plugins: "proxy" | "remote";
15
+ enabled: boolean;
16
+ uploads: "proxy" | "remote";
17
+ theme: "copy" | "proxy" | "remote";
18
+ }, {
19
+ devAssets?: string[] | undefined;
20
+ apiOnly?: boolean | undefined;
21
+ plugins: "proxy" | "remote";
22
+ enabled: boolean;
23
+ uploads: "proxy" | "remote";
24
+ theme: "copy" | "proxy" | "remote";
25
+ }>>;
26
+ favicon: z.ZodOptional<z.ZodObject<{
27
+ icoSource: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
28
+ svg: z.ZodOptional<z.ZodString>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ svg?: string | undefined;
31
+ icoSource?: string | string[] | undefined;
32
+ }, {
33
+ svg?: string | undefined;
34
+ icoSource?: string | string[] | undefined;
35
+ }>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ $schema?: string | undefined;
38
+ serverless?: {
39
+ devAssets?: string[] | undefined;
40
+ apiOnly?: boolean | undefined;
41
+ plugins: "proxy" | "remote";
42
+ enabled: boolean;
43
+ uploads: "proxy" | "remote";
44
+ theme: "copy" | "proxy" | "remote";
45
+ } | undefined;
46
+ favicon?: {
47
+ svg?: string | undefined;
48
+ icoSource?: string | string[] | undefined;
49
+ } | undefined;
50
+ }, {
51
+ $schema?: string | undefined;
52
+ serverless?: {
53
+ devAssets?: string[] | undefined;
54
+ apiOnly?: boolean | undefined;
55
+ plugins: "proxy" | "remote";
56
+ enabled: boolean;
57
+ uploads: "proxy" | "remote";
58
+ theme: "copy" | "proxy" | "remote";
59
+ } | undefined;
60
+ favicon?: {
61
+ svg?: string | undefined;
62
+ icoSource?: string | string[] | undefined;
63
+ } | undefined;
64
+ }>;
65
+ export declare type EDConfig = z.infer<typeof EDConfigSchema>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EDConfigSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ exports.EDConfigSchema = zod_1.z.object({
6
+ $schema: zod_1.z.string().optional(),
7
+ serverless: zod_1.z
8
+ .object({
9
+ enabled: zod_1.z.boolean(),
10
+ uploads: zod_1.z.enum(["proxy", "remote"]),
11
+ plugins: zod_1.z.enum(["proxy", "remote"]),
12
+ theme: zod_1.z.enum(["proxy", "copy", "remote"]),
13
+ devAssets: zod_1.z.array(zod_1.z.string()).optional(),
14
+ apiOnly: zod_1.z.boolean().optional(),
15
+ })
16
+ .optional(),
17
+ favicon: zod_1.z
18
+ .object({
19
+ icoSource: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
20
+ svg: zod_1.z.string().optional(),
21
+ })
22
+ .optional(),
23
+ });
@@ -0,0 +1 @@
1
+ export declare function createConfigSchemaFile(location: string): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createConfigSchemaFile = void 0;
7
+ var fs_1 = require("fs");
8
+ var zod_to_json_schema_1 = __importDefault(require("zod-to-json-schema"));
9
+ var config_schema_1 = require("./config-schema");
10
+ function createConfigSchemaFile(location) {
11
+ var schema = (0, zod_to_json_schema_1.default)(config_schema_1.EDConfigSchema);
12
+ var content = JSON.stringify(schema, null, 2);
13
+ if ((0, fs_1.existsSync)(location)) {
14
+ var existingContent = (0, fs_1.readFileSync)(location).toString();
15
+ if (existingContent === content)
16
+ return;
17
+ }
18
+ (0, fs_1.writeFileSync)(location, content);
19
+ }
20
+ exports.createConfigSchemaFile = createConfigSchemaFile;
@@ -0,0 +1,45 @@
1
+ export declare function getEDConfig(dir?: string): import("zod").SafeParseReturnType<{
2
+ $schema?: string | undefined;
3
+ serverless?: {
4
+ devAssets?: string[] | undefined;
5
+ apiOnly?: boolean | undefined;
6
+ plugins: "proxy" | "remote";
7
+ enabled: boolean;
8
+ uploads: "proxy" | "remote";
9
+ theme: "copy" | "proxy" | "remote";
10
+ } | undefined;
11
+ favicon?: {
12
+ svg?: string | undefined;
13
+ icoSource?: string | string[] | undefined;
14
+ } | undefined;
15
+ }, {
16
+ $schema?: string | undefined;
17
+ serverless?: {
18
+ devAssets?: string[] | undefined;
19
+ apiOnly?: boolean | undefined;
20
+ plugins: "proxy" | "remote";
21
+ enabled: boolean;
22
+ uploads: "proxy" | "remote";
23
+ theme: "copy" | "proxy" | "remote";
24
+ } | undefined;
25
+ favicon?: {
26
+ svg?: string | undefined;
27
+ icoSource?: string | string[] | undefined;
28
+ } | undefined;
29
+ }>;
30
+ export declare function getEDConfigUnwrapped(dir?: string): {
31
+ $schema?: string | undefined;
32
+ serverless?: {
33
+ devAssets?: string[] | undefined;
34
+ apiOnly?: boolean | undefined;
35
+ plugins: "proxy" | "remote";
36
+ enabled: boolean;
37
+ uploads: "proxy" | "remote";
38
+ theme: "copy" | "proxy" | "remote";
39
+ } | undefined;
40
+ favicon?: {
41
+ svg?: string | undefined;
42
+ icoSource?: string | string[] | undefined;
43
+ } | undefined;
44
+ };
45
+ export declare function getEDConfigFile(dir?: string): string;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEDConfigFile = exports.getEDConfigUnwrapped = exports.getEDConfig = void 0;
4
+ var fs_1 = require("fs");
5
+ var path_1 = require("path");
6
+ var parse_config_1 = require("./parse-config");
7
+ function getEDConfig(dir) {
8
+ if (dir === void 0) { dir = process.cwd(); }
9
+ var configFile = getEDConfigFile(dir);
10
+ if (!(0, fs_1.existsSync)(configFile)) {
11
+ throw new Error("No config file found at ".concat(configFile));
12
+ }
13
+ var config = JSON.parse((0, fs_1.readFileSync)(configFile).toString());
14
+ return (0, parse_config_1.parseConfig)(config);
15
+ }
16
+ exports.getEDConfig = getEDConfig;
17
+ function getEDConfigUnwrapped(dir) {
18
+ if (dir === void 0) { dir = process.cwd(); }
19
+ var result = getEDConfig(dir);
20
+ if (result.success) {
21
+ return result.data;
22
+ }
23
+ else {
24
+ throw new Error(result.error.toString());
25
+ }
26
+ }
27
+ exports.getEDConfigUnwrapped = getEDConfigUnwrapped;
28
+ function getEDConfigFile(dir) {
29
+ if (dir === void 0) { dir = process.cwd(); }
30
+ return (0, path_1.join)(dir, "ed.config.json");
31
+ }
32
+ exports.getEDConfigFile = getEDConfigFile;
@@ -0,0 +1,2 @@
1
+ export * from "./config-schema";
2
+ export * from "./parse-config";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./config-schema"), exports);
14
+ __exportStar(require("./parse-config"), exports);
@@ -0,0 +1,29 @@
1
+ export declare function parseConfig(config: any): import("zod").SafeParseReturnType<{
2
+ $schema?: string | undefined;
3
+ serverless?: {
4
+ devAssets?: string[] | undefined;
5
+ apiOnly?: boolean | undefined;
6
+ plugins: "proxy" | "remote";
7
+ enabled: boolean;
8
+ uploads: "proxy" | "remote";
9
+ theme: "copy" | "proxy" | "remote";
10
+ } | undefined;
11
+ favicon?: {
12
+ svg?: string | undefined;
13
+ icoSource?: string | string[] | undefined;
14
+ } | undefined;
15
+ }, {
16
+ $schema?: string | undefined;
17
+ serverless?: {
18
+ devAssets?: string[] | undefined;
19
+ apiOnly?: boolean | undefined;
20
+ plugins: "proxy" | "remote";
21
+ enabled: boolean;
22
+ uploads: "proxy" | "remote";
23
+ theme: "copy" | "proxy" | "remote";
24
+ } | undefined;
25
+ favicon?: {
26
+ svg?: string | undefined;
27
+ icoSource?: string | string[] | undefined;
28
+ } | undefined;
29
+ }>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseConfig = void 0;
4
+ var config_schema_1 = require("./config-schema");
5
+ function parseConfig(config) {
6
+ return config_schema_1.EDConfigSchema.safeParse(config);
7
+ }
8
+ exports.parseConfig = parseConfig;
@@ -0,0 +1,2 @@
1
+ import type { ZodError } from "zod";
2
+ export declare function printZodErrors(err: ZodError): void;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.printZodErrors = void 0;
7
+ var chalk_1 = __importDefault(require("chalk"));
8
+ function printZodErrors(err) {
9
+ console.log(chalk_1.default.red("Error parsing ed.config.json:"));
10
+ err.issues.forEach(function (issue) {
11
+ console.log("- ".concat(issue.path.join("."), ": ").concat(issue.message));
12
+ });
13
+ }
14
+ exports.printZodErrors = printZodErrors;
@@ -18,7 +18,6 @@ function useAppData(selector) {
18
18
  // @ts-ignore
19
19
  if (process.serverless) {
20
20
  var value = (0, react_1.useContext)(serverlessAppContext_1.ServerlessAppDataContext);
21
- console.log("VALUE IS", value);
22
21
  if (selector)
23
22
  return selector(value);
24
23
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.10",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -16,6 +16,7 @@
16
16
  "@types/babel__traverse": "^7.14.2",
17
17
  "@types/chokidar": "^2.1.3",
18
18
  "@types/fs-extra": "^9.0.13",
19
+ "@types/git-repo-name": "^1.0.1",
19
20
  "@types/inquirer": "^8.1.1",
20
21
  "@types/loadable__component": "^5.13.4",
21
22
  "@types/node": "^16.7.10",
@@ -36,7 +37,6 @@
36
37
  "@babel/preset-react": "^7.14.5",
37
38
  "@babel/preset-typescript": "^7.15.0",
38
39
  "@babel/traverse": "^7.15.4",
39
- "@boost/log": "^3.0.0",
40
40
  "@graphql-codegen/cli": "^2.2.0",
41
41
  "@graphql-codegen/core": "^2.1.0",
42
42
  "@graphql-codegen/typescript": "^2.2.1",
@@ -61,34 +61,34 @@
61
61
  "dotenv": "^10.0.0",
62
62
  "error-overlay-webpack-plugin": "^1.0.0",
63
63
  "error-stack-parser": "^2.0.6",
64
- "execa": "^6.0.0",
65
64
  "friendly-errors-webpack-plugin": "^1.7.0",
66
65
  "fs-extra": "^10.0.0",
67
- "git-remote-origin-url": "^3.1.0",
66
+ "git-repo-name": "^1.0.1",
68
67
  "glob": "^7.1.7",
69
68
  "glob-promise": "^4.2.0",
70
69
  "graphql": "^15.5.3",
71
- "history": "^5.0.1",
72
70
  "ink": "^3.2.0",
73
71
  "inquirer": "^8.1.2",
74
72
  "mini-css-extract-plugin": "^2.2.2",
75
73
  "next-transpile-modules": "^9.0.0",
76
74
  "postcss-loader": "^6.1.1",
77
75
  "qs": "^6.10.1",
78
- "react-dev-utils": "^12.0.0-next.37",
79
76
  "react-error-overlay": "^6.0.9",
80
77
  "react-inspector": "^5.1.1",
81
78
  "react-merge-refs": "^1.1.0",
82
79
  "react-refresh": "^0.10.0",
83
80
  "rimraf": "^3.0.2",
84
81
  "swr": "^1.0.1",
85
- "typescript": "^4.4.2",
82
+ "to-icon": "^1.1.4",
83
+ "typescript": "^4.5.5",
86
84
  "url-parse": "^1.5.3",
87
85
  "webpack": "^5.52.0",
88
86
  "webpack-bundle-analyzer": "^4.5.0",
89
87
  "webpack-dev-server": "^3.11.2",
90
88
  "webpack-hot-middleware": "^2.25.0",
91
89
  "webpack-virtual-modules": "^0.4.3",
90
+ "zod": "^3.11.6",
91
+ "zod-to-json-schema": "^3.11.3",
92
92
  "zustand": "^3.5.10"
93
93
  },
94
94
  "peerDependencies": {
@@ -0,0 +1,33 @@
1
+ /// <reference types="react" />
2
+ export declare function createRPCClient(): {
3
+ Provider: ({ client, queryClient, children, isPrepass, ssrContext, }: {
4
+ queryClient: QueryClient;
5
+ client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
6
+ children: import("react").ReactNode;
7
+ isPrepass?: boolean | undefined;
8
+ ssrContext?: unknown;
9
+ }) => JSX.Element;
10
+ createClient: (opts: import("@trpc/react").CreateTRPCClientOptions<import("@trpc/server").AnyRouter<any>>) => import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
11
+ useContext: () => import("@trpc/react/dist/declarations/src/internals/context").TRPCContextState<import("@trpc/server").AnyRouter<any>, unknown>;
12
+ useQuery: <TPath extends string>(pathAndInput: [TPath, (null | undefined)?], opts?: import("@trpc/react").UseTRPCQueryOptions<TPath, unknown, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => UseQueryResult<{ [TPath_1 in keyof TRouter["_def"]["queries"]]: {
13
+ input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["queries"][TPath_1]>;
14
+ output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["queries"][TPath_1]["call"]>>;
15
+ }; }[TPath_2]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>>;
16
+ useMutation: <TPath_1 extends string>(path: TPath_1 | [TPath_1], opts?: import("@trpc/react").UseTRPCMutationOptions<unknown, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>, any> | undefined) => UseMutationResult<{ [TPath_3 in keyof TRouter["_def"]["mutations"]]: {
17
+ input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["mutations"][TPath_3]>;
18
+ output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["mutations"][TPath_3]["call"]>>;
19
+ }; }[TPath_1_1]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>, { [TPath_3 in keyof TRouter["_def"]["mutations"]]: {
20
+ input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["mutations"][TPath_3]>;
21
+ output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["mutations"][TPath_3]["call"]>>;
22
+ }; }[TPath_1_1]["input"], unknown>;
23
+ useSubscription: <TPath_2 extends string, TOutput extends any>(pathAndInput: [TPath_2, (null | undefined)?], opts: {
24
+ enabled?: boolean | undefined;
25
+ onError?: ((err: import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>) => void) | undefined;
26
+ onNext: (data: TOutput) => void;
27
+ }) => void;
28
+ useDehydratedState: (client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>, trpcState: any) => any;
29
+ useInfiniteQuery: <TPath_3 extends never>(pathAndInput: [path: TPath_3, input: Omit<unknown, "cursor">], opts?: import("@trpc/react").UseTRPCInfiniteQueryOptions<TPath_3, Omit<unknown, "cursor">, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => UseInfiniteQueryResult<{ [TPath_1 in keyof TRouter["_def"]["queries"]]: {
30
+ input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["queries"][TPath_1]>;
31
+ output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["queries"][TPath_1]["call"]>>;
32
+ }; }[TPath_3_1]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>>;
33
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.createRPCClient = void 0;
15
+ var react_1 = require("@trpc/react");
16
+ function createRPCClient() {
17
+ var trpc = (0, react_1.createReactQueryHooks)();
18
+ return __assign({}, trpc);
19
+ }
20
+ exports.createRPCClient = createRPCClient;
@@ -0,0 +1,2 @@
1
+ import { NextApiHandler } from "next/types";
2
+ export declare function defineAPI(handler: NextApiHandler): NextApiHandler<any>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineAPI = void 0;
4
+ // import { ZodSchema, z, AnyZodObject, ZodError } from "zod"
5
+ // import { RESTErrorCodes } from "./error-codes"
6
+ function defineAPI(handler) {
7
+ return handler;
8
+ }
9
+ exports.defineAPI = defineAPI;
10
+ // type RESTAPIRequest<
11
+ // TQuery extends ZodSchema<any> | undefined,
12
+ // TBody extends ZodSchema<any> | undefined
13
+ // > = NextApiRequest & {
14
+ // query: TQuery extends AnyZodObject ? z.infer<TQuery> : NextApiRequest["query"]
15
+ // body: TBody extends AnyZodObject ? z.infer<TBody> : NextApiRequest["body"]
16
+ // }
17
+ // type RESTAPIResponse = NextApiResponse & {
18
+ // error(type: keyof typeof RESTErrorCodes, message: string, data: any): void
19
+ // }
20
+ // type AnyRESTAPIRequest = RESTAPIRequest<any, any>
21
+ // const CacheKeyGenerators = {
22
+ // url: (req: AnyRESTAPIRequest) => req.url,
23
+ // query: (req: AnyRESTAPIRequest) => req.url + "." + JSON.stringify(req.query),
24
+ // }
25
+ // type RESTOptions<TResult, TQuery extends ZodSchema<any> | undefined, TBody extends ZodSchema<any> | undefined> = {
26
+ // method: "get" | "post" | "put" | "delete" | "patch"
27
+ // cacheKey?: keyof typeof CacheKeyGenerators
28
+ // cacheTime?: number
29
+ // querystring?: TQuery
30
+ // handle(req: RESTAPIRequest<TQuery, TBody>, res: RESTAPIResponse): void
31
+ // }
32
+ // function stringifyZodError(err: ZodError) {
33
+ // return err.toString()
34
+ // }
35
+ // export function defineRESTAPI<
36
+ // TResult,
37
+ // TQuery extends ZodSchema<any> | undefined,
38
+ // TBody extends ZodSchema<any> | undefined
39
+ // >(opts: RESTOptions<TResult, TQuery, TBody>) {
40
+ // return (_req: NextApiRequest, _res: NextApiResponse) => {
41
+ // // Standard function for error codes/messages
42
+ // const sendError = (type: keyof typeof RESTErrorCodes, message: string, details?: any) => {
43
+ // _res.status(RESTErrorCodes[type] || 500)
44
+ // _res.json({
45
+ // error: true,
46
+ // message,
47
+ // details,
48
+ // })
49
+ // }
50
+ // // Ensure the correct method
51
+ // if (_req.method?.toLowerCase() !== opts.method) {
52
+ // return sendError("invalidverb", `Invalid verb: ${_req.method}`)
53
+ // }
54
+ // // Validate the querystring
55
+ // try {
56
+ // _req.query = opts.querystring ? (opts.querystring.safeParse(_req.query) as any) : _req.query
57
+ // } catch (err) {
58
+ // if (err instanceof ZodError) {
59
+ // return sendError("querystring", stringifyZodError(err), _req.query)
60
+ // } else {
61
+ // return sendError("querystring", err instanceof Error ? err.message : String(err))
62
+ // }
63
+ // }
64
+ // opts.handle(req, res)
65
+ // }
66
+ // }
@@ -0,0 +1,2 @@
1
+ import * as trpc from "@trpc/server";
2
+ export declare function defineRPC<TContext>(): import("@trpc/server/dist/declarations/src/router").Router<TContext, TContext, {}, {}, {}, trpc.DefaultErrorShape>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.defineRPC = void 0;
23
+ var trpc = __importStar(require("@trpc/server"));
24
+ function defineRPC() {
25
+ return trpc.router();
26
+ }
27
+ exports.defineRPC = defineRPC;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // export const RESTErrorCodes = {
3
+ // notfound: 404,
4
+ // badrequest: 400,
5
+ // unauthorized: 401,
6
+ // forbidden: 403,
7
+ // invalidverb: 400,
8
+ // querystring: 400,
9
+ // body: 400,
10
+ // params: 400,
11
+ // internal: 500,
12
+ // }
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = {};
@@ -0,0 +1,4 @@
1
+ export * from "./define-api";
2
+ export * from "./define-rpc-router";
3
+ export * from "./create-rpc-client";
4
+ export * from "./error-codes";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./define-api"), exports);
14
+ __exportStar(require("./define-rpc-router"), exports);
15
+ __exportStar(require("./create-rpc-client"), exports);
16
+ __exportStar(require("./error-codes"), exports);
@@ -0,0 +1 @@
1
+ export declare function RPCProvider(): void;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RPCProvider = void 0;
4
+ function RPCProvider() { }
5
+ exports.RPCProvider = RPCProvider;
@@ -0,0 +1,5 @@
1
+ // @ts-ignore
2
+ const settings = require("../ed.config.json")
3
+ import { EDConfig } from "eddev/config"
4
+
5
+ export default settings as EDConfig