Compare commits
18 Commits
f17daa2c78
...
effect-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74f4da1d3d | ||
|
|
3ebb7ee796 | ||
|
|
02dd064d99 | ||
|
|
cbc220a968 | ||
|
|
ed3e6df4d2 | ||
|
|
371f5e879b | ||
|
|
2df7f2d924 | ||
|
|
6fd531d9c3 | ||
|
|
01edded95a | ||
|
|
046ad1555c | ||
|
|
284b8b6fc1 | ||
|
|
c4bb0d3304 | ||
|
|
0edbf53db3 | ||
|
|
882d437007 | ||
|
|
b42da83274 | ||
|
|
801bb1c194 | ||
|
|
92c3dc4a85 | ||
|
|
667f920cd2 |
@@ -7,10 +7,12 @@
|
||||
"start": "tsx src/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hono/node-server": "^1.19.5",
|
||||
"@effect/platform": "^0.93.2",
|
||||
"@effect/platform-node": "^0.101.1",
|
||||
"@effect/rpc": "^0.72.2",
|
||||
"@money/shared": "workspace:*",
|
||||
"better-auth": "^1.3.27",
|
||||
"hono": "^4.9.12",
|
||||
"effect": "^3.19.4",
|
||||
"plaid": "^39.0.0",
|
||||
"tsx": "^4.20.6"
|
||||
},
|
||||
|
||||
23
apps/api/src/auth/better-auth.ts
Normal file
23
apps/api/src/auth/better-auth.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Effect, Layer } from "effect";
|
||||
import { Authorization } from "./context";
|
||||
import { auth } from "./config";
|
||||
import { AuthorizationError, AuthorizationUnknownError } from "./errors";
|
||||
|
||||
export const make = () =>
|
||||
Effect.gen(function* () {
|
||||
return Authorization.of({
|
||||
use: (fn) =>
|
||||
Effect.gen(function* () {
|
||||
const data = yield* Effect.tryPromise({
|
||||
try: () => fn(auth),
|
||||
catch: (error) =>
|
||||
error instanceof Error
|
||||
? new AuthorizationError({ message: error.message })
|
||||
: new AuthorizationUnknownError(),
|
||||
});
|
||||
return data;
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
export const BetterAuthLive = Layer.scoped(Authorization, make());
|
||||
@@ -3,7 +3,7 @@ import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
import { bearer, deviceAuthorization, genericOAuth } from "better-auth/plugins";
|
||||
import { expo } from "@better-auth/expo";
|
||||
import { drizzleSchema } from "@money/shared/db";
|
||||
import { db } from "./db";
|
||||
import { db } from "../db";
|
||||
import { BASE_URL, HOST } from "@money/shared";
|
||||
|
||||
export const auth = betterAuth({
|
||||
@@ -20,25 +20,25 @@ export const auth = betterAuth({
|
||||
"money://",
|
||||
],
|
||||
advanced: {
|
||||
crossSubDomainCookies: {
|
||||
enabled: process.env.NODE_ENV == 'production',
|
||||
domain: "koon.us",
|
||||
},
|
||||
crossSubDomainCookies: {
|
||||
enabled: process.env.NODE_ENV == "production",
|
||||
domain: "koon.us",
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
expo(),
|
||||
genericOAuth({
|
||||
config: [
|
||||
{
|
||||
providerId: 'koon-family',
|
||||
providerId: "koon-family",
|
||||
clientId: process.env.OAUTH_CLIENT_ID!,
|
||||
clientSecret: process.env.OAUTH_CLIENT_SECRET!,
|
||||
discoveryUrl: process.env.OAUTH_DISCOVERY_URL!,
|
||||
scopes: ["profile", "email"],
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
}),
|
||||
deviceAuthorization(),
|
||||
bearer(),
|
||||
]
|
||||
],
|
||||
});
|
||||
14
apps/api/src/auth/context.ts
Normal file
14
apps/api/src/auth/context.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Context, type Effect } from "effect";
|
||||
import type { AuthorizationError, AuthorizationUnknownError } from "./errors";
|
||||
import type { auth } from "./config";
|
||||
|
||||
export class Authorization extends Context.Tag("Authorization")<
|
||||
Authorization,
|
||||
AuthorizationImpl
|
||||
>() {}
|
||||
|
||||
export interface AuthorizationImpl {
|
||||
use: <T>(
|
||||
fn: (client: typeof auth) => Promise<T>,
|
||||
) => Effect.Effect<T, AuthorizationUnknownError | AuthorizationError, never>;
|
||||
}
|
||||
8
apps/api/src/auth/errors.ts
Normal file
8
apps/api/src/auth/errors.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Data } from "effect";
|
||||
|
||||
export class AuthorizationUnknownError extends Data.TaggedError(
|
||||
"AuthClientUnknownError",
|
||||
) {}
|
||||
export class AuthorizationError extends Data.TaggedError("AuthorizationError")<{
|
||||
message: string;
|
||||
}> {}
|
||||
70
apps/api/src/auth/handler.ts
Normal file
70
apps/api/src/auth/handler.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import {
|
||||
HttpApi,
|
||||
HttpApiBuilder,
|
||||
HttpApiEndpoint,
|
||||
HttpApiGroup,
|
||||
HttpLayerRouter,
|
||||
HttpServerRequest,
|
||||
} from "@effect/platform";
|
||||
import * as NodeHttpServerRequest from "@effect/platform-node/NodeHttpServerRequest";
|
||||
import { toNodeHandler } from "better-auth/node";
|
||||
import { Effect, Layer } from "effect";
|
||||
import { AuthorizationError } from "./errors";
|
||||
import { auth } from "./config";
|
||||
|
||||
const authHandler = Effect.gen(function* () {
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const nodeRequest = NodeHttpServerRequest.toIncomingMessage(request);
|
||||
const nodeResponse = NodeHttpServerRequest.toServerResponse(request);
|
||||
|
||||
nodeResponse.setHeader("Access-Control-Allow-Origin", "http://laptop:8081");
|
||||
nodeResponse.setHeader(
|
||||
"Access-Control-Allow-Methods",
|
||||
"GET, POST, PUT, DELETE, OPTIONS",
|
||||
);
|
||||
nodeResponse.setHeader(
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Authorization, B3, traceparent, Cookie",
|
||||
);
|
||||
nodeResponse.setHeader("Access-Control-Max-Age", "600");
|
||||
nodeResponse.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
|
||||
// Handle preflight requests
|
||||
if (nodeRequest.method === "OPTIONS") {
|
||||
nodeResponse.statusCode = 200;
|
||||
nodeResponse.end();
|
||||
|
||||
return;
|
||||
// return nodeResponse;
|
||||
}
|
||||
|
||||
yield* Effect.tryPromise({
|
||||
try: () => toNodeHandler(auth)(nodeRequest, nodeResponse),
|
||||
catch: (error) => {
|
||||
return new AuthorizationError({ message: `${error}` });
|
||||
},
|
||||
});
|
||||
|
||||
// return nodeResponse;
|
||||
});
|
||||
|
||||
export class AuthContractGroup extends HttpApiGroup.make("auth")
|
||||
.add(HttpApiEndpoint.get("get", "/*"))
|
||||
.add(HttpApiEndpoint.post("post", "/*"))
|
||||
.add(HttpApiEndpoint.options("options", "/*"))
|
||||
.prefix("/api/auth") {}
|
||||
|
||||
export class DomainApi extends HttpApi.make("domain").add(AuthContractGroup) {}
|
||||
|
||||
export const Api = HttpApi.make("api").addHttpApi(DomainApi);
|
||||
|
||||
const AuthLive = HttpApiBuilder.group(Api, "auth", (handlers) =>
|
||||
handlers
|
||||
.handle("get", () => authHandler.pipe(Effect.orDie))
|
||||
.handle("post", () => authHandler.pipe(Effect.orDie))
|
||||
.handle("options", () => authHandler.pipe(Effect.orDie)),
|
||||
);
|
||||
|
||||
export const AuthRoute = HttpLayerRouter.addHttpApi(Api).pipe(
|
||||
Layer.provide(AuthLive),
|
||||
);
|
||||
@@ -1,5 +0,0 @@
|
||||
import type { AuthData } from "@money/shared/auth";
|
||||
import { Hono } from "hono";
|
||||
|
||||
export const getHono = () =>
|
||||
new Hono<{ Variables: { auth: AuthData | null } }>();
|
||||
@@ -1,56 +1,49 @@
|
||||
import { serve } from "@hono/node-server";
|
||||
import { authDataSchema } from "@money/shared/auth";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as HttpLayerRouter from "@effect/platform/HttpLayerRouter";
|
||||
import * as HttpServerResponse from "@effect/platform/HttpServerResponse";
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
||||
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
||||
import { createServer } from "http";
|
||||
import { AuthRoute } from "./auth/handler";
|
||||
import { BetterAuthLive } from "./auth/better-auth";
|
||||
import { WebhookReceiverRoute } from "./webhook";
|
||||
import { ZeroMutateRoute, ZeroQueryRoute } from "./zero/handler";
|
||||
import { RpcRoute } from "./rpc/handler";
|
||||
import { BASE_URL } from "@money/shared";
|
||||
import { cors } from "hono/cors";
|
||||
import { auth } from "./auth";
|
||||
import { getHono } from "./hono";
|
||||
import { zero } from "./zero";
|
||||
import { CurrentSession, SessionMiddleware } from "./middleware/session";
|
||||
|
||||
const app = getHono();
|
||||
const RootRoute = HttpLayerRouter.add(
|
||||
"GET",
|
||||
"/",
|
||||
Effect.gen(function* () {
|
||||
const d = yield* CurrentSession;
|
||||
|
||||
app.use(
|
||||
"/api/*",
|
||||
cors({
|
||||
origin: ['https://money.koon.us', `${BASE_URL}:8081`],
|
||||
allowMethods: ["POST", "GET", "OPTIONS"],
|
||||
allowHeaders: ["Content-Type", "Authorization"],
|
||||
credentials: true,
|
||||
return HttpServerResponse.text("OK");
|
||||
}),
|
||||
);
|
||||
|
||||
app.on(["GET", "POST"], "/api/auth/*", (c) => auth.handler(c.req.raw));
|
||||
|
||||
app.use("*", async (c, next) => {
|
||||
const authHeader = c.req.raw.headers.get("Authorization");
|
||||
const cookie = authHeader?.split("Bearer ")[1];
|
||||
|
||||
const newHeaders = new Headers(c.req.raw.headers);
|
||||
|
||||
if (cookie) {
|
||||
newHeaders.set("Cookie", cookie);
|
||||
}
|
||||
|
||||
const session = await auth.api.getSession({ headers: newHeaders });
|
||||
|
||||
if (!session) {
|
||||
c.set("auth", null);
|
||||
return next();
|
||||
}
|
||||
c.set("auth", authDataSchema.parse(session));
|
||||
return next();
|
||||
});
|
||||
|
||||
app.route("/api/zero", zero);
|
||||
|
||||
app.get("/api", (c) => c.text("OK"));
|
||||
app.get("/", (c) => c.text("OK"));
|
||||
|
||||
serve(
|
||||
{
|
||||
fetch: app.fetch,
|
||||
port: process.env.PORT ? parseInt(process.env.PORT) : 3000,
|
||||
},
|
||||
(info) => {
|
||||
console.log(`Server is running on ${info.address}:${info.port}`);
|
||||
},
|
||||
const AllRoutes = Layer.mergeAll(
|
||||
RootRoute,
|
||||
AuthRoute,
|
||||
ZeroQueryRoute,
|
||||
ZeroMutateRoute,
|
||||
RpcRoute,
|
||||
WebhookReceiverRoute,
|
||||
).pipe(
|
||||
Layer.provide(SessionMiddleware.layer),
|
||||
Layer.provide(
|
||||
HttpLayerRouter.cors({
|
||||
allowedOrigins: ["https://money.koon.us", `${BASE_URL}:8081`],
|
||||
allowedMethods: ["POST", "GET", "OPTIONS"],
|
||||
credentials: true,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
HttpLayerRouter.serve(AllRoutes).pipe(
|
||||
Layer.provide(NodeHttpServer.layer(createServer, { port: 3000 })),
|
||||
Layer.provide(BetterAuthLive),
|
||||
Layer.launch,
|
||||
NodeRuntime.runMain,
|
||||
);
|
||||
|
||||
12
apps/api/src/middleware/cors.ts
Normal file
12
apps/api/src/middleware/cors.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { HttpLayerRouter, HttpMiddleware } from "@effect/platform";
|
||||
import { BASE_URL } from "@money/shared";
|
||||
|
||||
export const CorsMiddleware = HttpLayerRouter.middleware(
|
||||
HttpMiddleware.cors({
|
||||
allowedOrigins: ["https://money.koon.us", `${BASE_URL}:8081`],
|
||||
allowedMethods: ["POST", "GET", "OPTIONS"],
|
||||
allowedHeaders: ["Content-Type", "Authorization"],
|
||||
credentials: true,
|
||||
}),
|
||||
{ global: true },
|
||||
);
|
||||
61
apps/api/src/middleware/session.ts
Normal file
61
apps/api/src/middleware/session.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { AuthSchema } from "@money/shared/auth";
|
||||
import { Context, Effect, Schema, Console } from "effect";
|
||||
import { Authorization } from "../auth/context";
|
||||
import { HttpLayerRouter, HttpServerRequest } from "@effect/platform";
|
||||
|
||||
export class CurrentSession extends Context.Tag("CurrentSession")<
|
||||
CurrentSession,
|
||||
{ readonly auth: Schema.Schema.Type<typeof AuthSchema> | null }
|
||||
>() {}
|
||||
|
||||
export const SessionMiddleware = HttpLayerRouter.middleware<{
|
||||
provides: CurrentSession;
|
||||
}>()(
|
||||
Effect.gen(function* () {
|
||||
const auth = yield* Authorization;
|
||||
|
||||
return (httpEffect) =>
|
||||
Effect.gen(function* () {
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const headers = { ...request.headers };
|
||||
|
||||
const token = yield* HttpServerRequest.schemaHeaders(
|
||||
Schema.Struct({
|
||||
authorization: Schema.optional(Schema.String),
|
||||
}),
|
||||
).pipe(
|
||||
Effect.tap(Console.debug),
|
||||
Effect.flatMap(({ authorization }) =>
|
||||
authorization != undefined
|
||||
? parseAuthorization(authorization)
|
||||
: Effect.succeed(undefined),
|
||||
),
|
||||
);
|
||||
if (token) {
|
||||
headers["cookie"] = token;
|
||||
}
|
||||
|
||||
const session = yield* auth
|
||||
.use((auth) => auth.api.getSession({ headers }))
|
||||
.pipe(
|
||||
Effect.flatMap((s) =>
|
||||
s == null ? Effect.succeed(null) : Schema.decode(AuthSchema)(s),
|
||||
),
|
||||
// Effect.tap((s) => Console.debug("Auth result", s)),
|
||||
);
|
||||
|
||||
return yield* Effect.provideService(httpEffect, CurrentSession, {
|
||||
auth: session,
|
||||
});
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
const parseAuthorization = (input: string) =>
|
||||
Effect.gen(function* () {
|
||||
const m = /^Bearer\s+(.+)$/.exec(input);
|
||||
if (!m) {
|
||||
return yield* Effect.fail(new Error("Invalid token"));
|
||||
}
|
||||
return m[1];
|
||||
});
|
||||
15
apps/api/src/plaid.ts
Normal file
15
apps/api/src/plaid.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Configuration, PlaidApi, PlaidEnvironments } from "plaid";
|
||||
|
||||
const configuration = new Configuration({
|
||||
basePath:
|
||||
process.env.PLAID_ENV == "production"
|
||||
? PlaidEnvironments.production
|
||||
: PlaidEnvironments.sandbox,
|
||||
baseOptions: {
|
||||
headers: {
|
||||
"PLAID-CLIENT-ID": process.env.PLAID_CLIENT_ID,
|
||||
"PLAID-SECRET": process.env.PLAID_SECRET,
|
||||
},
|
||||
},
|
||||
});
|
||||
export const plaidClient = new PlaidApi(configuration);
|
||||
76
apps/api/src/rpc/handler.ts
Normal file
76
apps/api/src/rpc/handler.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { RpcSerialization, RpcServer } from "@effect/rpc";
|
||||
import { Console, Effect, Layer, Schema } from "effect";
|
||||
import { LinkRpcs, Link, AuthMiddleware } from "@money/shared/rpc";
|
||||
import { CurrentSession } from "../middleware/session";
|
||||
import { Authorization } from "../auth/context";
|
||||
import { HttpServerRequest } from "@effect/platform";
|
||||
import { AuthSchema } from "@money/shared/auth";
|
||||
|
||||
const parseAuthorization = (input: string) =>
|
||||
Effect.gen(function* () {
|
||||
const m = /^Bearer\s+(.+)$/.exec(input);
|
||||
if (!m) {
|
||||
return yield* Effect.fail(new Error("Invalid token"));
|
||||
}
|
||||
return m[1];
|
||||
});
|
||||
|
||||
export const AuthLive = Layer.scoped(
|
||||
AuthMiddleware,
|
||||
Effect.gen(function* () {
|
||||
const auth = yield* Authorization;
|
||||
|
||||
return AuthMiddleware.of(({ headers, payload, rpc }) =>
|
||||
Effect.gen(function* () {
|
||||
const newHeaders = { ...headers };
|
||||
|
||||
const token = yield* Schema.decodeUnknown(
|
||||
Schema.Struct({
|
||||
authorization: Schema.optional(Schema.String),
|
||||
}),
|
||||
)(headers).pipe(
|
||||
// Effect.tap(Console.debug),
|
||||
Effect.flatMap(({ authorization }) =>
|
||||
authorization != undefined
|
||||
? parseAuthorization(authorization)
|
||||
: Effect.succeed(undefined),
|
||||
),
|
||||
);
|
||||
|
||||
if (token) {
|
||||
newHeaders["cookie"] = token;
|
||||
}
|
||||
|
||||
const session = yield* auth
|
||||
.use((auth) => auth.api.getSession({ headers: newHeaders }))
|
||||
.pipe(
|
||||
Effect.flatMap((s) =>
|
||||
s == null ? Effect.succeed(null) : Schema.decode(AuthSchema)(s),
|
||||
),
|
||||
Effect.tap((s) => Console.debug("Auth result", s)),
|
||||
);
|
||||
|
||||
return { auth: session };
|
||||
}).pipe(Effect.orDie),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
const LinkHandlers = LinkRpcs.toLayer({
|
||||
CreateLink: () =>
|
||||
Effect.gen(function* () {
|
||||
const session = yield* CurrentSession;
|
||||
|
||||
return new Link({ href: session.auth?.user.name || "anon" });
|
||||
}),
|
||||
});
|
||||
|
||||
export const RpcRoute = RpcServer.layerHttpRouter({
|
||||
group: LinkRpcs,
|
||||
path: "/rpc",
|
||||
protocol: "http",
|
||||
}).pipe(
|
||||
Layer.provide(LinkHandlers),
|
||||
Layer.provide(RpcSerialization.layerJson),
|
||||
Layer.provide(AuthLive),
|
||||
);
|
||||
21
apps/api/src/webhook.ts
Normal file
21
apps/api/src/webhook.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
HttpLayerRouter,
|
||||
HttpServerRequest,
|
||||
HttpServerResponse,
|
||||
} from "@effect/platform";
|
||||
import { Effect } from "effect";
|
||||
|
||||
import { plaidClient } from "./plaid";
|
||||
// import { LinkSessionFinishedWebhook, WebhookType } from "plaid";
|
||||
|
||||
export const WebhookReceiverRoute = HttpLayerRouter.add(
|
||||
"*",
|
||||
"/api/webhook_receiver",
|
||||
|
||||
Effect.gen(function* () {
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const body = yield* request.json;
|
||||
Effect.log("Got a webhook!", body);
|
||||
return HttpServerResponse.text("HELLO THERE");
|
||||
}),
|
||||
);
|
||||
@@ -1,218 +0,0 @@
|
||||
import {
|
||||
type ReadonlyJSONValue,
|
||||
type Transaction,
|
||||
withValidation,
|
||||
} from "@rocicorp/zero";
|
||||
import {
|
||||
handleGetQueriesRequest,
|
||||
PushProcessor,
|
||||
ZQLDatabase,
|
||||
} from "@rocicorp/zero/server";
|
||||
import { PostgresJSConnection } from '@rocicorp/zero/pg';
|
||||
import postgres from 'postgres';
|
||||
import {
|
||||
createMutators as createMutatorsShared,
|
||||
isLoggedIn,
|
||||
queries,
|
||||
schema,
|
||||
type Mutators,
|
||||
type Schema,
|
||||
} from "@money/shared";
|
||||
import type { AuthData } from "@money/shared/auth";
|
||||
import { getHono } from "./hono";
|
||||
import { Configuration, CountryCode, PlaidApi, PlaidEnvironments, Products } from "plaid";
|
||||
import { randomUUID } from "crypto";
|
||||
import { db } from "./db";
|
||||
import { balance, plaidAccessTokens, plaidLink, transaction } from "@money/shared/db";
|
||||
import { eq, inArray, sql, type InferInsertModel } from "drizzle-orm";
|
||||
|
||||
|
||||
const configuration = new Configuration({
|
||||
basePath: process.env.PLAID_ENV == 'production' ? PlaidEnvironments.production : PlaidEnvironments.sandbox,
|
||||
baseOptions: {
|
||||
headers: {
|
||||
'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID,
|
||||
'PLAID-SECRET': process.env.PLAID_SECRET,
|
||||
}
|
||||
}
|
||||
});
|
||||
const plaidClient = new PlaidApi(configuration);
|
||||
|
||||
|
||||
const processor = new PushProcessor(
|
||||
new ZQLDatabase(
|
||||
new PostgresJSConnection(postgres(process.env.ZERO_UPSTREAM_DB! as string)),
|
||||
schema,
|
||||
),
|
||||
);
|
||||
|
||||
type Tx = Transaction<Schema>;
|
||||
|
||||
const createMutators = (authData: AuthData | null) => {
|
||||
const mutators = createMutatorsShared(authData);
|
||||
return {
|
||||
...mutators,
|
||||
link: {
|
||||
...mutators.link,
|
||||
async create() {
|
||||
isLoggedIn(authData);
|
||||
console.log("Creating Link token");
|
||||
const r = await plaidClient.linkTokenCreate({
|
||||
user: {
|
||||
client_user_id: authData.user.id,
|
||||
},
|
||||
client_name: "Koon Money",
|
||||
language: "en",
|
||||
products: [Products.Transactions],
|
||||
country_codes: [CountryCode.Us],
|
||||
hosted_link: {}
|
||||
});
|
||||
console.log("Result", r);
|
||||
const { link_token, hosted_link_url } = r.data;
|
||||
|
||||
if (!hosted_link_url) throw Error("No link in response");
|
||||
|
||||
await db.insert(plaidLink).values({
|
||||
id: randomUUID() as string,
|
||||
user_id: authData.user.id,
|
||||
link: hosted_link_url,
|
||||
token: link_token,
|
||||
});
|
||||
},
|
||||
|
||||
async get(_, { link_token }) {
|
||||
isLoggedIn(authData);
|
||||
|
||||
const linkResp = await plaidClient.linkTokenGet({
|
||||
link_token,
|
||||
});
|
||||
if (!linkResp) throw Error("No link respo");
|
||||
console.log(JSON.stringify(linkResp.data, null, 4));
|
||||
const publicToken = linkResp.data.link_sessions?.at(0)?.results?.item_add_results.at(0)?.public_token;
|
||||
|
||||
if (!publicToken) throw Error("No public token");
|
||||
const { data } = await plaidClient.itemPublicTokenExchange({
|
||||
public_token: publicToken,
|
||||
})
|
||||
|
||||
await db.insert(plaidAccessTokens).values({
|
||||
id: randomUUID(),
|
||||
userId: authData.user.id,
|
||||
token: data.access_token,
|
||||
logoUrl: "",
|
||||
name: ""
|
||||
});
|
||||
},
|
||||
|
||||
async updateTransactions() {
|
||||
isLoggedIn(authData);
|
||||
const accounts = await db.query.plaidAccessTokens.findMany({
|
||||
where: eq(plaidAccessTokens.userId, authData.user.id),
|
||||
});
|
||||
if (accounts.length == 0) {
|
||||
console.error("No accounts");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const account of accounts) {
|
||||
const { data } = await plaidClient.transactionsGet({
|
||||
access_token: account.token,
|
||||
start_date: "2025-10-01",
|
||||
end_date: new Date().toISOString().split("T")[0],
|
||||
});
|
||||
|
||||
const transactions = data.transactions.map(tx => ({
|
||||
id: randomUUID(),
|
||||
user_id: authData.user.id,
|
||||
plaid_id: tx.transaction_id,
|
||||
account_id: tx.account_id,
|
||||
name: tx.name,
|
||||
amount: tx.amount as any,
|
||||
datetime: tx.datetime ? new Date(tx.datetime) : new Date(tx.date),
|
||||
authorized_datetime: tx.authorized_datetime ? new Date(tx.authorized_datetime) : undefined,
|
||||
json: JSON.stringify(tx),
|
||||
} satisfies InferInsertModel<typeof transaction>));
|
||||
|
||||
await db.insert(transaction).values(transactions).onConflictDoNothing({
|
||||
target: transaction.plaid_id,
|
||||
});
|
||||
|
||||
const txReplacingPendingIds = data.transactions
|
||||
.filter(t => t.pending_transaction_id)
|
||||
.map(t => t.pending_transaction_id!);
|
||||
|
||||
await db.delete(transaction)
|
||||
.where(inArray(transaction.plaid_id, txReplacingPendingIds));
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
async updateBalences() {
|
||||
isLoggedIn(authData);
|
||||
const accounts = await db.query.plaidAccessTokens.findMany({
|
||||
where: eq(plaidAccessTokens.userId, authData.user.id),
|
||||
});
|
||||
if (accounts.length == 0) {
|
||||
console.error("No accounts");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const account of accounts) {
|
||||
const { data } = await plaidClient.accountsBalanceGet({
|
||||
access_token: account.token
|
||||
});
|
||||
await db.insert(balance).values(data.accounts.map(bal => ({
|
||||
id: randomUUID(),
|
||||
user_id: authData.user.id,
|
||||
plaid_id: bal.account_id,
|
||||
avaliable: bal.balances.available as any,
|
||||
current: bal.balances.current as any,
|
||||
name: bal.name,
|
||||
}))).onConflictDoUpdate({
|
||||
target: balance.plaid_id,
|
||||
set: { current: sql.raw(`excluded.${balance.current.name}`), avaliable: sql.raw(`excluded.${balance.avaliable.name}`) }
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
} as const satisfies Mutators;
|
||||
}
|
||||
|
||||
const zero = getHono()
|
||||
.post("/mutate", async (c) => {
|
||||
const authData = c.get("auth");
|
||||
|
||||
const result = await processor.process(createMutators(authData), c.req.raw);
|
||||
|
||||
return c.json(result);
|
||||
})
|
||||
.post("/get-queries", async (c) => {
|
||||
const authData = c.get("auth");
|
||||
|
||||
const result = await handleGetQueriesRequest(
|
||||
(name, args) => ({ query: getQuery(authData, name, args) }),
|
||||
schema,
|
||||
c.req.raw,
|
||||
);
|
||||
|
||||
return c.json(result);
|
||||
});
|
||||
|
||||
const validatedQueries = Object.fromEntries(
|
||||
Object.values(queries).map((q) => [q.queryName, withValidation(q)]),
|
||||
);
|
||||
|
||||
function getQuery(
|
||||
authData: AuthData | null,
|
||||
name: string,
|
||||
args: readonly ReadonlyJSONValue[],
|
||||
) {
|
||||
if (name in validatedQueries) {
|
||||
const q = validatedQueries[name];
|
||||
return q(authData, ...args);
|
||||
}
|
||||
throw new Error(`Unknown query: ${name}`);
|
||||
}
|
||||
|
||||
export { zero };
|
||||
6
apps/api/src/zero/errors.ts
Normal file
6
apps/api/src/zero/errors.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Data } from "effect";
|
||||
|
||||
export class ZeroUnknownError extends Data.TaggedError("ZeroUnknownError") {}
|
||||
export class ZeroError extends Data.TaggedError("ZeroError")<{
|
||||
error: Error;
|
||||
}> {}
|
||||
106
apps/api/src/zero/handler.ts
Normal file
106
apps/api/src/zero/handler.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import {
|
||||
HttpLayerRouter,
|
||||
HttpServerRequest,
|
||||
HttpServerResponse,
|
||||
Url,
|
||||
} from "@effect/platform";
|
||||
import { Console, Effect, Layer } from "effect";
|
||||
import { CurrentSession, SessionMiddleware } from "../middleware/session";
|
||||
import { ZeroError, ZeroUnknownError } from "./errors";
|
||||
import { withValidation, type ReadonlyJSONValue } from "@rocicorp/zero";
|
||||
import {
|
||||
handleGetQueriesRequest,
|
||||
PushProcessor,
|
||||
ZQLDatabase,
|
||||
} from "@rocicorp/zero/server";
|
||||
import { BASE_URL, queries, schema } from "@money/shared";
|
||||
import type { AuthSchemaType } from "@money/shared/auth";
|
||||
import { PostgresJSConnection } from "@rocicorp/zero/pg";
|
||||
import postgres from "postgres";
|
||||
import { createMutators } from "./mutators";
|
||||
|
||||
const processor = new PushProcessor(
|
||||
new ZQLDatabase(
|
||||
new PostgresJSConnection(postgres(process.env.ZERO_UPSTREAM_DB! as string)),
|
||||
schema,
|
||||
),
|
||||
);
|
||||
|
||||
export const ZeroQueryRoute = HttpLayerRouter.add(
|
||||
"POST",
|
||||
"/api/zero/get-queries",
|
||||
|
||||
Effect.gen(function* () {
|
||||
const { auth } = yield* CurrentSession;
|
||||
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const body = yield* request.json;
|
||||
|
||||
const result = yield* Effect.tryPromise({
|
||||
try: () =>
|
||||
handleGetQueriesRequest(
|
||||
(name, args) => ({ query: getQuery(auth, name, args) }),
|
||||
schema,
|
||||
body as ReadonlyJSONValue,
|
||||
),
|
||||
catch: (error) =>
|
||||
error instanceof Error
|
||||
? new ZeroError({ error })
|
||||
: new ZeroUnknownError(),
|
||||
}).pipe(
|
||||
Effect.tapErrorTag("ZeroError", (err) =>
|
||||
Console.error("Zero Error", err.error),
|
||||
),
|
||||
);
|
||||
|
||||
return yield* HttpServerResponse.json(result);
|
||||
}),
|
||||
).pipe(Layer.provide(SessionMiddleware.layer));
|
||||
|
||||
function getQuery(
|
||||
authData: AuthSchemaType | null,
|
||||
name: string,
|
||||
args: readonly ReadonlyJSONValue[],
|
||||
) {
|
||||
if (name in validatedQueries) {
|
||||
const q = validatedQueries[name];
|
||||
return q(authData, ...args);
|
||||
}
|
||||
throw new Error(`Unknown query: ${name}`);
|
||||
}
|
||||
|
||||
export const validatedQueries = Object.fromEntries(
|
||||
Object.values(queries).map((q) => [q.queryName, withValidation(q)]),
|
||||
);
|
||||
|
||||
export const ZeroMutateRoute = HttpLayerRouter.add(
|
||||
"POST",
|
||||
"/api/zero/mutate",
|
||||
|
||||
Effect.gen(function* () {
|
||||
const { auth } = yield* CurrentSession;
|
||||
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const url = yield* Url.fromString(`${BASE_URL}${request.url}`);
|
||||
const body = yield* request.json;
|
||||
|
||||
const result = yield* Effect.tryPromise({
|
||||
try: () =>
|
||||
processor.process(
|
||||
createMutators(auth),
|
||||
url.searchParams,
|
||||
body as ReadonlyJSONValue,
|
||||
),
|
||||
catch: (error) =>
|
||||
error instanceof Error
|
||||
? new ZeroError({ error })
|
||||
: new ZeroUnknownError(),
|
||||
}).pipe(
|
||||
Effect.tapErrorTag("ZeroError", (err) =>
|
||||
Console.error("Zero Error", err.error),
|
||||
),
|
||||
);
|
||||
|
||||
return yield* HttpServerResponse.json(result);
|
||||
}),
|
||||
).pipe(Layer.provide(SessionMiddleware.layer));
|
||||
202
apps/api/src/zero/mutators.ts
Normal file
202
apps/api/src/zero/mutators.ts
Normal file
@@ -0,0 +1,202 @@
|
||||
import {
|
||||
createMutators as createMutatorsShared,
|
||||
isLoggedIn,
|
||||
queries,
|
||||
schema,
|
||||
type Mutators,
|
||||
type Schema,
|
||||
} from "@money/shared";
|
||||
import type { AuthSchemaType } from "@money/shared/auth";
|
||||
import {
|
||||
type ReadonlyJSONValue,
|
||||
type Transaction,
|
||||
withValidation,
|
||||
} from "@rocicorp/zero";
|
||||
import { plaidClient } from "../plaid";
|
||||
import { CountryCode, Products } from "plaid";
|
||||
import {
|
||||
balance,
|
||||
plaidAccessTokens,
|
||||
plaidLink,
|
||||
transaction,
|
||||
} from "@money/shared/db";
|
||||
import { db } from "../db";
|
||||
import { randomUUID } from "crypto";
|
||||
import { and, eq, inArray, sql, type InferInsertModel } from "drizzle-orm";
|
||||
|
||||
type Tx = Transaction<Schema>;
|
||||
|
||||
export const createMutators = (authData: AuthSchemaType | null) => {
|
||||
const mutators = createMutatorsShared(authData);
|
||||
return {
|
||||
...mutators,
|
||||
link: {
|
||||
...mutators.link,
|
||||
async create() {
|
||||
isLoggedIn(authData);
|
||||
const r = await plaidClient.linkTokenCreate({
|
||||
user: {
|
||||
client_user_id: authData.user.id,
|
||||
},
|
||||
client_name: "Koon Money",
|
||||
language: "en",
|
||||
products: [Products.Transactions],
|
||||
country_codes: [CountryCode.Us],
|
||||
webhook: "https://webhooks.koon.us/api/webhook_receiver",
|
||||
hosted_link: {},
|
||||
});
|
||||
const { link_token, hosted_link_url } = r.data;
|
||||
|
||||
if (!hosted_link_url) throw Error("No link in response");
|
||||
|
||||
await db.insert(plaidLink).values({
|
||||
id: randomUUID() as string,
|
||||
user_id: authData.user.id,
|
||||
link: hosted_link_url,
|
||||
token: link_token,
|
||||
});
|
||||
},
|
||||
|
||||
async get(_, { link_token }) {
|
||||
isLoggedIn(authData);
|
||||
|
||||
try {
|
||||
const token = await db.query.plaidLink.findFirst({
|
||||
where: and(
|
||||
eq(plaidLink.token, link_token),
|
||||
eq(plaidLink.user_id, authData.user.id),
|
||||
),
|
||||
});
|
||||
if (!token) throw Error("Link not found");
|
||||
if (token.completeAt) return;
|
||||
|
||||
const linkResp = await plaidClient.linkTokenGet({
|
||||
link_token,
|
||||
});
|
||||
if (!linkResp) throw Error("No link respo");
|
||||
|
||||
console.log(JSON.stringify(linkResp.data, null, 4));
|
||||
|
||||
const item_add_result = linkResp.data.link_sessions
|
||||
?.at(0)
|
||||
?.results?.item_add_results.at(0);
|
||||
|
||||
// We will assume its not done yet.
|
||||
if (!item_add_result) return;
|
||||
|
||||
const { data } = await plaidClient.itemPublicTokenExchange({
|
||||
public_token: item_add_result.public_token,
|
||||
});
|
||||
|
||||
await db.insert(plaidAccessTokens).values({
|
||||
id: randomUUID(),
|
||||
userId: authData.user.id,
|
||||
token: data.access_token,
|
||||
logoUrl: "",
|
||||
name: item_add_result.institution?.name || "Unknown",
|
||||
});
|
||||
|
||||
await db
|
||||
.update(plaidLink)
|
||||
.set({
|
||||
completeAt: new Date(),
|
||||
})
|
||||
.where(eq(plaidLink.token, link_token));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
throw Error("Plaid error");
|
||||
}
|
||||
},
|
||||
|
||||
async updateTransactions() {
|
||||
isLoggedIn(authData);
|
||||
const accounts = await db.query.plaidAccessTokens.findMany({
|
||||
where: eq(plaidAccessTokens.userId, authData.user.id),
|
||||
});
|
||||
if (accounts.length == 0) {
|
||||
console.error("No accounts");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const account of accounts) {
|
||||
const { data } = await plaidClient.transactionsGet({
|
||||
access_token: account.token,
|
||||
start_date: "2025-10-01",
|
||||
end_date: new Date().toISOString().split("T")[0],
|
||||
});
|
||||
|
||||
const transactions = data.transactions.map(
|
||||
(tx) =>
|
||||
({
|
||||
id: randomUUID(),
|
||||
user_id: authData.user.id,
|
||||
plaid_id: tx.transaction_id,
|
||||
account_id: tx.account_id,
|
||||
name: tx.name,
|
||||
amount: tx.amount as any,
|
||||
datetime: tx.datetime
|
||||
? new Date(tx.datetime)
|
||||
: new Date(tx.date),
|
||||
authorized_datetime: tx.authorized_datetime
|
||||
? new Date(tx.authorized_datetime)
|
||||
: undefined,
|
||||
json: JSON.stringify(tx),
|
||||
}) satisfies InferInsertModel<typeof transaction>,
|
||||
);
|
||||
|
||||
await db
|
||||
.insert(transaction)
|
||||
.values(transactions)
|
||||
.onConflictDoNothing({
|
||||
target: transaction.plaid_id,
|
||||
});
|
||||
|
||||
const txReplacingPendingIds = data.transactions
|
||||
.filter((t) => t.pending_transaction_id)
|
||||
.map((t) => t.pending_transaction_id!);
|
||||
|
||||
await db
|
||||
.delete(transaction)
|
||||
.where(inArray(transaction.plaid_id, txReplacingPendingIds));
|
||||
}
|
||||
},
|
||||
|
||||
async updateBalences() {
|
||||
isLoggedIn(authData);
|
||||
const accounts = await db.query.plaidAccessTokens.findMany({
|
||||
where: eq(plaidAccessTokens.userId, authData.user.id),
|
||||
});
|
||||
if (accounts.length == 0) {
|
||||
console.error("No accounts");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const account of accounts) {
|
||||
const { data } = await plaidClient.accountsBalanceGet({
|
||||
access_token: account.token,
|
||||
});
|
||||
await db
|
||||
.insert(balance)
|
||||
.values(
|
||||
data.accounts.map((bal) => ({
|
||||
id: randomUUID(),
|
||||
user_id: authData.user.id,
|
||||
plaid_id: bal.account_id,
|
||||
avaliable: bal.balances.available as any,
|
||||
current: bal.balances.current as any,
|
||||
name: bal.name,
|
||||
tokenId: account.id,
|
||||
})),
|
||||
)
|
||||
.onConflictDoUpdate({
|
||||
target: balance.plaid_id,
|
||||
set: {
|
||||
current: sql.raw(`excluded.${balance.current.name}`),
|
||||
avaliable: sql.raw(`excluded.${balance.avaliable.name}`),
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
} as const satisfies Mutators;
|
||||
};
|
||||
@@ -1,12 +1,13 @@
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { Text } from "react-native";
|
||||
import { App, type Route } from "@money/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
|
||||
export default function Page() {
|
||||
const { route: initalRoute } = useLocalSearchParams<{ route: string[] }>();
|
||||
const [route, setRoute] = useState(initalRoute ? "/" + initalRoute.join("/") : "/");
|
||||
const [route, setRoute] = useState(
|
||||
initalRoute ? "/" + initalRoute.join("/") : "/",
|
||||
);
|
||||
|
||||
const { data } = authClient.useSession();
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
import { Stack } from 'expo-router';
|
||||
import 'react-native-reanimated';
|
||||
import { Stack } from "expo-router";
|
||||
import "react-native-reanimated";
|
||||
|
||||
import { authClient } from '@/lib/auth-client';
|
||||
import { ZeroProvider } from '@rocicorp/zero/react';
|
||||
import { useMemo } from 'react';
|
||||
import { authDataSchema } from '@money/shared/auth';
|
||||
import { Platform } from 'react-native';
|
||||
import type { ZeroOptions } from '@rocicorp/zero';
|
||||
import { schema, type Schema, createMutators, type Mutators, BASE_URL } from '@money/shared';
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import { ZeroProvider } from "@rocicorp/zero/react";
|
||||
import { useMemo } from "react";
|
||||
import { AuthSchema } from "@money/shared/auth";
|
||||
import { Platform } from "react-native";
|
||||
import type { ZeroOptions } from "@rocicorp/zero";
|
||||
import {
|
||||
schema,
|
||||
type Schema,
|
||||
createMutators,
|
||||
type Mutators,
|
||||
BASE_URL,
|
||||
} from "@money/shared";
|
||||
import { expoSQLiteStoreProvider } from "@rocicorp/zero/react-native";
|
||||
import { Schema as S } from "effect";
|
||||
|
||||
export const unstable_settings = {
|
||||
anchor: 'index',
|
||||
anchor: "index",
|
||||
};
|
||||
|
||||
const kvStore = Platform.OS === "web" ? undefined : expoSQLiteStoreProvider();
|
||||
@@ -20,19 +27,22 @@ export default function RootLayout() {
|
||||
const { data: session, isPending } = authClient.useSession();
|
||||
|
||||
const authData = useMemo(() => {
|
||||
const result = authDataSchema.safeParse(session);
|
||||
return result.success ? result.data : null;
|
||||
const result = session ? S.decodeSync(AuthSchema)(session) : null;
|
||||
return result ? result : null;
|
||||
}, [session]);
|
||||
|
||||
const cookie = useMemo(() => {
|
||||
return Platform.OS == 'web' ? undefined : authClient.getCookie();
|
||||
return Platform.OS == "web" ? undefined : authClient.getCookie();
|
||||
}, [session, isPending]);
|
||||
|
||||
const zeroProps = useMemo(() => {
|
||||
return {
|
||||
storageKey: 'money',
|
||||
storageKey: "money",
|
||||
kvStore,
|
||||
server: process.env.NODE_ENV == 'production' ? 'https://zero.koon.us' : `${BASE_URL}:4848`,
|
||||
server:
|
||||
process.env.NODE_ENV == "production"
|
||||
? "https://zero.koon.us"
|
||||
: `${BASE_URL}:4848`,
|
||||
userID: authData?.user.id ?? "anon",
|
||||
schema,
|
||||
mutators: createMutators(authData),
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useEffect } from "react";
|
||||
import { Text } from "react-native";
|
||||
|
||||
export default function Page() {
|
||||
const { code } = useLocalSearchParams<{code: string }>();
|
||||
const { code } = useLocalSearchParams<{ code: string }>();
|
||||
const { isPending, data } = authClient.useSession();
|
||||
if (isPending) return <Text>Loading...</Text>;
|
||||
if (!isPending && !data) return <Text>Please log in</Text>;
|
||||
@@ -13,11 +13,7 @@ export default function Page() {
|
||||
authClient.device.approve({
|
||||
userCode: code,
|
||||
});
|
||||
|
||||
}, []);
|
||||
|
||||
return <Text>
|
||||
Approving: {code}
|
||||
</Text>
|
||||
return <Text>Approving: {code}</Text>;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,10 @@ export default function Auth() {
|
||||
const onLogin = () => {
|
||||
authClient.signIn.oauth2({
|
||||
providerId: "koon-family",
|
||||
callbackURL: process.env.NODE_ENV == 'production' ? 'https://money.koon.us' : `${BASE_URL}:8081`,
|
||||
callbackURL:
|
||||
process.env.NODE_ENV == "production"
|
||||
? "https://money.koon.us"
|
||||
: `${BASE_URL}:8081`,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -14,5 +17,5 @@ export default function Auth() {
|
||||
<View>
|
||||
<Button onPress={onLogin} title="Login with Koon Family" />
|
||||
</View>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { authClient } from '@/lib/auth-client';
|
||||
import { RefreshControl, ScrollView, StatusBar, Text, View } from 'react-native';
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import {
|
||||
RefreshControl,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
Text,
|
||||
View,
|
||||
} from "react-native";
|
||||
import { useQuery, useZero } from "@rocicorp/zero/react";
|
||||
import { queries, type Mutators, type Schema } from '@money/shared';
|
||||
import { useState } from 'react';
|
||||
import { queries, type Mutators, type Schema } from "@money/shared";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function HomeScreen() {
|
||||
const { data: session } = authClient.useSession();
|
||||
@@ -20,16 +26,43 @@ export default function HomeScreen() {
|
||||
return (
|
||||
<>
|
||||
<StatusBar barStyle="dark-content" />
|
||||
<ScrollView contentContainerStyle={{ paddingTop: StatusBar.currentHeight, flexGrow: 1 }} refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />} style={{ paddingHorizontal: 10 }}>
|
||||
{balances.map(balance => <Balance key={balance.id} balance={balance} />)}
|
||||
<ScrollView
|
||||
contentContainerStyle={{
|
||||
paddingTop: StatusBar.currentHeight,
|
||||
flexGrow: 1,
|
||||
}}
|
||||
refreshControl={
|
||||
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
|
||||
}
|
||||
style={{ paddingHorizontal: 10 }}
|
||||
>
|
||||
{balances.map((balance) => (
|
||||
<Balance key={balance.id} balance={balance} />
|
||||
))}
|
||||
</ScrollView>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Balance({ balance }: { balance: { name: string, current: number, avaliable: number } }) {
|
||||
return <View style={{ backgroundColor: "#eee", borderColor: "#ddd", borderWidth: 1, marginBottom: 10, borderRadius: 10 }}>
|
||||
<Text style={{ fontSize: 15, textAlign: "center" }}>{balance.name}</Text>
|
||||
<Text style={{ fontSize: 30, textAlign: "center" }}>{balance.current}</Text>
|
||||
</View>
|
||||
function Balance({
|
||||
balance,
|
||||
}: {
|
||||
balance: { name: string; current: number; avaliable: number };
|
||||
}) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: "#eee",
|
||||
borderColor: "#ddd",
|
||||
borderWidth: 1,
|
||||
marginBottom: 10,
|
||||
borderRadius: 10,
|
||||
}}
|
||||
>
|
||||
<Text style={{ fontSize: 15, textAlign: "center" }}>{balance.name}</Text>
|
||||
<Text style={{ fontSize: 30, textAlign: "center" }}>
|
||||
{balance.current}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import { queries } from "@money/shared";
|
||||
import { useQuery } from "@rocicorp/zero/react";
|
||||
import { Link, usePathname, useRouter, type LinkProps } from "expo-router";
|
||||
import { useEffect } from "react";
|
||||
import { View, Text, Platform } from "react-native";
|
||||
|
||||
type Page = { name: string, href: LinkProps['href'] };
|
||||
const PAGES: Page[] = [
|
||||
{
|
||||
name: "Home",
|
||||
href: "/",
|
||||
},
|
||||
{
|
||||
name: "Settings",
|
||||
href: "/settings",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export default function Header() {
|
||||
const router = useRouter();
|
||||
const { data: session } = authClient.useSession();
|
||||
const [user] = useQuery(queries.me(session));
|
||||
|
||||
useEffect(() => {
|
||||
if (Platform.OS != 'web') return;
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "1" && event.ctrlKey) {
|
||||
router.push(PAGES.at(0)!.href);
|
||||
} else if (event.key === "2" && event.ctrlKey) {
|
||||
router.push(PAGES.at(1)!.href);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("keydown", handleKeyDown);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<View style={{ flexDirection: "row", justifyContent: "space-between", backgroundColor: "#f7e2c8" }}>
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
{PAGES.map(page => <Page
|
||||
key={page.name}
|
||||
name={page.name}
|
||||
href={page.href}
|
||||
/>)}
|
||||
</View>
|
||||
|
||||
<Link href={"#" as any}>
|
||||
<Text style={{ fontFamily: 'mono' }}>{user?.name} </Text>
|
||||
</Link>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function Page({ name, href }: Page) {
|
||||
const path = usePathname();
|
||||
|
||||
return (
|
||||
<Link href={href }>
|
||||
<Text style={{ fontFamily: 'mono' }}>{path == href ? `[ ${name} ]` : ` ${name} `}</Text>
|
||||
</Link>
|
||||
)
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
// https://docs.expo.dev/guides/using-eslint/
|
||||
const { defineConfig } = require('eslint/config');
|
||||
const expoConfig = require('eslint-config-expo/flat');
|
||||
const { defineConfig } = require("eslint/config");
|
||||
const expoConfig = require("eslint-config-expo/flat");
|
||||
|
||||
module.exports = defineConfig([
|
||||
expoConfig,
|
||||
{
|
||||
ignores: ['dist/*'],
|
||||
ignores: ["dist/*"],
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import { createAuthClient } from "better-auth/react";
|
||||
import { deviceAuthorizationClient, genericOAuthClient } from "better-auth/client/plugins";
|
||||
import {
|
||||
deviceAuthorizationClient,
|
||||
genericOAuthClient,
|
||||
} from "better-auth/client/plugins";
|
||||
import { expoClient } from "@better-auth/expo/client";
|
||||
import * as SecureStore from "expo-secure-store";
|
||||
import { BASE_URL } from "@money/shared";
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
baseURL: process.env.NODE_ENV == 'production' ? 'https://money-api.koon.us' : `${BASE_URL}:3000`,
|
||||
baseURL:
|
||||
process.env.NODE_ENV == "production"
|
||||
? "https://money-api.koon.us"
|
||||
: `${BASE_URL}:3000`,
|
||||
plugins: [
|
||||
expoClient({
|
||||
scheme: "money",
|
||||
@@ -14,5 +20,5 @@ export const authClient = createAuthClient({
|
||||
}),
|
||||
genericOAuthClient(),
|
||||
deviceAuthorizationClient(),
|
||||
]
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { getDefaultConfig } = require("expo/metro-config");
|
||||
|
||||
const config = getDefaultConfig(__dirname)
|
||||
const config = getDefaultConfig(__dirname);
|
||||
|
||||
// Add wasm asset support
|
||||
config.resolver.assetExts.push("wasm");
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@better-auth/expo": "^1.3.27",
|
||||
"@effect-atom/atom-react": "^0.4.0",
|
||||
"@expo/vector-icons": "^15.0.2",
|
||||
"@money/shared": "workspace:*",
|
||||
"@money/ui": "workspace:*",
|
||||
|
||||
@@ -5,9 +5,12 @@ import path from "path";
|
||||
const aliasPlugin = {
|
||||
name: "alias-react-native",
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /^react-native$/ }, args => {
|
||||
build.onResolve({ filter: /^react-native$/ }, (args) => {
|
||||
return {
|
||||
path: path.resolve(__dirname, "../../packages/react-native-opentui/index.tsx"),
|
||||
path: path.resolve(
|
||||
__dirname,
|
||||
"../../packages/react-native-opentui/index.tsx",
|
||||
),
|
||||
};
|
||||
});
|
||||
},
|
||||
@@ -16,9 +19,9 @@ const aliasPlugin = {
|
||||
// Build configuration
|
||||
await esbuild.build({
|
||||
entryPoints: ["src/index.tsx"], // your app entry
|
||||
bundle: true, // inline all dependencies (ui included)
|
||||
platform: "node", // Node/Bun target
|
||||
format: "esm", // keep ESM for top-level await
|
||||
bundle: true, // inline all dependencies (ui included)
|
||||
platform: "node", // Node/Bun target
|
||||
format: "esm", // keep ESM for top-level await
|
||||
outfile: "dist/index.js",
|
||||
sourcemap: true,
|
||||
plugins: [aliasPlugin],
|
||||
@@ -32,7 +35,13 @@ await esbuild.build({
|
||||
"@opentui/core",
|
||||
"@opentui/react",
|
||||
"@opentui/react/jsx-runtime",
|
||||
"effect",
|
||||
"@effect/platform",
|
||||
"@effect/platform-bun",
|
||||
"bun:ffi",
|
||||
"@rocicorp/zero",
|
||||
"better-auth",
|
||||
"zod",
|
||||
// "./assets/**/*.scm",
|
||||
// "./assets/**/*.wasm",
|
||||
],
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { config } from "@/src/config";
|
||||
import { createAuthClient } from "better-auth/client";
|
||||
import { deviceAuthorizationClient } from "better-auth/client/plugins";
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
baseURL: "http://laptop:3000",
|
||||
plugins: [
|
||||
deviceAuthorizationClient(),
|
||||
]
|
||||
baseURL: config.apiUrl,
|
||||
plugins: [deviceAuthorizationClient()],
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
"@effect/platform-bun": "^0.83.0",
|
||||
"@money/shared": "workspace:*",
|
||||
"@money/ui": "workspace:*",
|
||||
"@opentui/core": "^0.1.39",
|
||||
"@opentui/react": "^0.1.39",
|
||||
"@opentui/core": "^0.1.47",
|
||||
"@opentui/react": "^0.1.47",
|
||||
"@types/qrcode": "^1.5.6",
|
||||
"effect": "^3.19.4",
|
||||
"qrcode": "^1.5.4",
|
||||
|
||||
@@ -1,49 +1,71 @@
|
||||
import { Context, Data, Effect, Layer, Schema, Console, Schedule, Match, Ref, Duration } from "effect";
|
||||
import {
|
||||
Context,
|
||||
Data,
|
||||
Effect,
|
||||
Layer,
|
||||
Schema,
|
||||
Console,
|
||||
Schedule,
|
||||
Ref,
|
||||
Duration,
|
||||
} from "effect";
|
||||
import { FileSystem } from "@effect/platform";
|
||||
import { config } from "./config";
|
||||
import { AuthState } from "./schema";
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import type { BetterFetchResponse } from "@better-fetch/fetch";
|
||||
import { AuthSchema } from "@money/shared/auth";
|
||||
import { encode } from "node:punycode";
|
||||
|
||||
const CLIENT_ID = "koon-family";
|
||||
|
||||
const getFromFromDisk = Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const content = yield* fs.readFileString(config.authPath);
|
||||
return yield* Schema.decode(Schema.parseJson(AuthState))(content);
|
||||
});
|
||||
|
||||
|
||||
class AuthClientErrorString extends Data.TaggedError("AuthClientErrorString")<{
|
||||
errorString: string,
|
||||
}> {};
|
||||
|
||||
|
||||
type ErrorType<E> = { [key in keyof ((E extends Record<string, any> ? E : {
|
||||
message?: string;
|
||||
}) & {
|
||||
status: number;
|
||||
statusText: string;
|
||||
})]: ((E extends Record<string, any> ? E : {
|
||||
message?: string;
|
||||
}) & {
|
||||
status: number;
|
||||
statusText: string;
|
||||
})[key]; };
|
||||
|
||||
class AuthClientUnknownError extends Data.TaggedError(
|
||||
"AuthClientUnknownError",
|
||||
) {}
|
||||
class AuthClientExpiredToken extends Data.TaggedError(
|
||||
"AuthClientExpiredToken",
|
||||
) {}
|
||||
class AuthClientNoData extends Data.TaggedError("AuthClientNoData") {}
|
||||
class AuthClientFetchError extends Data.TaggedError("AuthClientFetchError")<{
|
||||
message: string;
|
||||
}> {}
|
||||
class AuthClientError<T> extends Data.TaggedError("AuthClientError")<{
|
||||
error: T,
|
||||
}> {};
|
||||
error: T;
|
||||
}> {}
|
||||
|
||||
export class AuthClient extends Context.Tag("AuthClient")<AuthClient, AuthClientImpl>() {};
|
||||
type ErrorType<E> = {
|
||||
[key in keyof ((E extends Record<string, any>
|
||||
? E
|
||||
: {
|
||||
message?: string;
|
||||
}) & {
|
||||
status: number;
|
||||
statusText: string;
|
||||
})]: ((E extends Record<string, any>
|
||||
? E
|
||||
: {
|
||||
message?: string;
|
||||
}) & {
|
||||
status: number;
|
||||
statusText: string;
|
||||
})[key];
|
||||
};
|
||||
|
||||
export class AuthClient extends Context.Tag("AuthClient")<
|
||||
AuthClient,
|
||||
AuthClientImpl
|
||||
>() {}
|
||||
|
||||
export interface AuthClientImpl {
|
||||
use: <T, E>(
|
||||
fn: (client: typeof authClient) => Promise<BetterFetchResponse<T, E>>,
|
||||
) => Effect.Effect<T, AuthClientError<ErrorType<E>> | AuthClientErrorString, never>
|
||||
) => Effect.Effect<
|
||||
T,
|
||||
| AuthClientError<ErrorType<E>>
|
||||
| AuthClientFetchError
|
||||
| AuthClientUnknownError
|
||||
| AuthClientNoData,
|
||||
never
|
||||
>;
|
||||
}
|
||||
|
||||
|
||||
export const make = () =>
|
||||
Effect.gen(function* () {
|
||||
return AuthClient.of({
|
||||
@@ -51,86 +73,151 @@ export const make = () =>
|
||||
Effect.gen(function* () {
|
||||
const { data, error } = yield* Effect.tryPromise({
|
||||
try: () => fn(authClient),
|
||||
catch: () => new AuthClientErrorString({ errorString: "Bad" }),
|
||||
catch: (error) =>
|
||||
error instanceof Error
|
||||
? new AuthClientFetchError({ message: error.message })
|
||||
: new AuthClientUnknownError(),
|
||||
});
|
||||
if (error != null) return yield* Effect.fail(new AuthClientError({ error }));
|
||||
if (data == null) return yield* Effect.fail(new AuthClientErrorString({ errorString: "No data" }));
|
||||
if (error != null)
|
||||
return yield* Effect.fail(new AuthClientError({ error }));
|
||||
if (data == null) return yield* Effect.fail(new AuthClientNoData());
|
||||
return data;
|
||||
})
|
||||
})
|
||||
})
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
export const layer = () => Layer.scoped(AuthClient, make());
|
||||
export const AuthClientLayer = Layer.scoped(AuthClient, make());
|
||||
|
||||
const pollToken = ({ device_code }: { device_code: string }) => Effect.gen(function* () {
|
||||
const auth = yield* AuthClient;
|
||||
const intervalRef = yield* Ref.make(5);
|
||||
const pollToken = ({ device_code }: { device_code: string }) =>
|
||||
Effect.gen(function* () {
|
||||
const auth = yield* AuthClient;
|
||||
const intervalRef = yield* Ref.make(5);
|
||||
|
||||
const tokenEffect = auth.use(client => {
|
||||
Console.debug("Fetching");
|
||||
const tokenEffect = auth.use((client) => {
|
||||
Console.debug("Fetching");
|
||||
|
||||
return client.device.token({
|
||||
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
||||
device_code,
|
||||
client_id: CLIENT_ID,
|
||||
fetchOptions: { headers: { "user-agent": "CLI" } },
|
||||
})
|
||||
}
|
||||
);
|
||||
return client.device.token({
|
||||
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
||||
device_code,
|
||||
client_id: config.authClientId,
|
||||
fetchOptions: { headers: { "user-agent": config.authClientUserAgent } },
|
||||
});
|
||||
});
|
||||
|
||||
return yield* tokenEffect
|
||||
.pipe(
|
||||
Effect.tapError(error =>
|
||||
return yield* tokenEffect.pipe(
|
||||
Effect.tapError((error) =>
|
||||
error._tag == "AuthClientError" && error.error.error == "slow_down"
|
||||
? Ref.update(intervalRef, current => {
|
||||
Console.debug("updating delay to ", current + 5);
|
||||
return current + 5
|
||||
})
|
||||
: Effect.void
|
||||
? Ref.update(intervalRef, (current) => {
|
||||
Console.debug("updating delay to ", current + 5);
|
||||
return current + 5;
|
||||
})
|
||||
: Effect.void,
|
||||
),
|
||||
Effect.retry({
|
||||
schedule: Schedule.addDelayEffect(
|
||||
Schedule.recurWhile<Effect.Effect.Error<typeof tokenEffect>>(error =>
|
||||
error._tag == "AuthClientError" &&
|
||||
(error.error.error == "authorization_pending" || error.error.error == "slow_down")
|
||||
Schedule.recurWhile<Effect.Effect.Error<typeof tokenEffect>>(
|
||||
(error) =>
|
||||
error._tag == "AuthClientError" &&
|
||||
(error.error.error == "authorization_pending" ||
|
||||
error.error.error == "slow_down"),
|
||||
),
|
||||
() => Ref.get(intervalRef).pipe(Effect.map(Duration.seconds))
|
||||
)
|
||||
})
|
||||
|
||||
() => Ref.get(intervalRef).pipe(Effect.map(Duration.seconds)),
|
||||
),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
const getFromFromDisk = Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const content = yield* fs.readFileString(config.authPath);
|
||||
const auth = yield* Schema.decode(Schema.parseJson(AuthSchema))(content);
|
||||
if (auth.session.expiresAt < new Date())
|
||||
yield* Effect.fail(new AuthClientExpiredToken());
|
||||
return auth;
|
||||
});
|
||||
|
||||
const requestAuth = Effect.gen(function* () {
|
||||
const auth = yield* AuthClient;
|
||||
const { device_code, user_code } = yield* auth.use(client => client.device.code({
|
||||
client_id: CLIENT_ID,
|
||||
scope: "openid profile email",
|
||||
}));
|
||||
const { device_code, user_code } = yield* auth.use((client) =>
|
||||
client.device.code({
|
||||
client_id: config.authClientId,
|
||||
scope: "openid profile email",
|
||||
}),
|
||||
);
|
||||
|
||||
console.log(`Please use the code: ${user_code}`);
|
||||
|
||||
const { access_token } = yield* pollToken({ device_code });
|
||||
|
||||
const sessionData = yield* auth.use(client => client.getSession({
|
||||
fetchOptions: {
|
||||
auth: {
|
||||
type: "Bearer",
|
||||
token: access_token,
|
||||
}
|
||||
}
|
||||
}));
|
||||
if (sessionData == null) return yield* Effect.fail("Session was null");
|
||||
const sessionData = yield* auth.use((client) =>
|
||||
client.getSession({
|
||||
fetchOptions: {
|
||||
auth: {
|
||||
type: "Bearer",
|
||||
token: access_token,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
if (sessionData == null) return yield* Effect.fail(new AuthClientNoData());
|
||||
|
||||
const result = yield* Schema.decodeUnknown(AuthSchema)(sessionData);
|
||||
const encoded = yield* Schema.encode(AuthSchema)(result);
|
||||
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
yield* fs.writeFileString(config.authPath, JSON.stringify(sessionData));
|
||||
yield* fs.writeFileString(config.authPath, JSON.stringify(encoded));
|
||||
|
||||
return sessionData;
|
||||
return result;
|
||||
});
|
||||
|
||||
export const getAuth = Effect.gen(function* () {
|
||||
return yield* getFromFromDisk.pipe(
|
||||
Effect.catchAll(() => requestAuth)
|
||||
Effect.catchAll(() => requestAuth),
|
||||
Effect.catchTag("AuthClientFetchError", (err) =>
|
||||
Effect.gen(function* () {
|
||||
yield* Console.error("Authentication failed: " + err.message);
|
||||
process.exit(1);
|
||||
}),
|
||||
),
|
||||
Effect.catchTag("AuthClientNoData", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* Console.error(
|
||||
"Authentication failed: No error and no data was given by the auth server.",
|
||||
);
|
||||
process.exit(1);
|
||||
}),
|
||||
),
|
||||
Effect.catchTag("ParseError", (err) =>
|
||||
Effect.gen(function* () {
|
||||
yield* Console.error(
|
||||
"Authentication failed: Auth data failed: " + err.toString(),
|
||||
);
|
||||
process.exit(1);
|
||||
}),
|
||||
),
|
||||
Effect.catchTag("BadArgument", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* Console.error("Authentication failed: Bad argument");
|
||||
process.exit(1);
|
||||
}),
|
||||
),
|
||||
Effect.catchTag("SystemError", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* Console.error("Authentication failed: System error");
|
||||
process.exit(1);
|
||||
}),
|
||||
),
|
||||
Effect.catchTag("AuthClientError", ({ error }) =>
|
||||
Effect.gen(function* () {
|
||||
yield* Console.error("Authentication error: " + error.statusText);
|
||||
process.exit(1);
|
||||
}),
|
||||
),
|
||||
Effect.catchTag("AuthClientUnknownError", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* Console.error("Unknown authentication error");
|
||||
process.exit(1);
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -5,5 +5,10 @@ const PATH = join(homedir(), ".local", "share", "money");
|
||||
const AUTH_PATH = join(PATH, "auth.json");
|
||||
|
||||
export const config = {
|
||||
dir: PATH,
|
||||
authPath: AUTH_PATH,
|
||||
authClientId: "koon-family",
|
||||
authClientUserAgent: "CLI",
|
||||
zeroUrl: "http://laptop:4848",
|
||||
apiUrl: "http://laptop:3000",
|
||||
};
|
||||
|
||||
@@ -1,38 +1,43 @@
|
||||
import { createCliRenderer } from "@opentui/core";
|
||||
import { createRoot } from "@opentui/react";
|
||||
import { createRoot, useKeyboard } from "@opentui/react";
|
||||
import { App, type Route } from "@money/ui";
|
||||
import { ZeroProvider } from "@rocicorp/zero/react";
|
||||
import { schema } from '@money/shared';
|
||||
import { schema } from "@money/shared";
|
||||
import { useState } from "react";
|
||||
import { AuthClient, getAuth, layer } from "./auth";
|
||||
import { Effect, Layer } from "effect";
|
||||
import { AuthClientLayer, getAuth } from "./auth";
|
||||
import { Effect, Redacted } from "effect";
|
||||
import { BunContext } from "@effect/platform-bun";
|
||||
import type { AuthData } from "./schema";
|
||||
import { kvStore } from "./store";
|
||||
import { config } from "./config";
|
||||
import { type AuthSchemaType } from "@money/shared/auth";
|
||||
|
||||
const userID = "anon";
|
||||
const server = "http://laptop:4848";
|
||||
|
||||
function Main({ auth }: { auth: AuthData }) {
|
||||
function Main({ auth }: { auth: AuthSchemaType }) {
|
||||
const [route, setRoute] = useState<Route>("/");
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.name == "c" && key.ctrl) process.exit(0);
|
||||
});
|
||||
|
||||
return (
|
||||
<ZeroProvider {...{ userID, auth: auth.session.token, server, schema }}>
|
||||
<App
|
||||
auth={auth || null}
|
||||
route={route}
|
||||
setRoute={setRoute}
|
||||
/>
|
||||
<ZeroProvider
|
||||
{...{
|
||||
userID: auth.user.id,
|
||||
auth: Redacted.value(auth.session.token),
|
||||
server: config.zeroUrl,
|
||||
schema,
|
||||
kvStore,
|
||||
}}
|
||||
>
|
||||
<App auth={auth} route={route} setRoute={setRoute} />
|
||||
</ZeroProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const auth = await Effect.runPromise(
|
||||
getAuth.pipe(
|
||||
Effect.provide(BunContext.layer),
|
||||
Effect.provide(layer()),
|
||||
)
|
||||
Effect.provide(AuthClientLayer),
|
||||
),
|
||||
);
|
||||
const renderer = await createCliRenderer();
|
||||
const renderer = await createCliRenderer({ exitOnCtrlC: false });
|
||||
createRoot(renderer).render(<Main auth={auth} />);
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Schema } from "effect";
|
||||
|
||||
const SessionSchema = Schema.Struct({
|
||||
expiresAt: Schema.DateFromString,
|
||||
token: Schema.String,
|
||||
createdAt: Schema.DateFromString,
|
||||
updatedAt: Schema.DateFromString,
|
||||
ipAddress: Schema.optional(Schema.NullishOr(Schema.String)),
|
||||
userAgent: Schema.optional(Schema.NullishOr(Schema.String)),
|
||||
userId: Schema.String,
|
||||
id: Schema.String,
|
||||
});
|
||||
|
||||
const UserSchema = Schema.Struct({
|
||||
name: Schema.String,
|
||||
email: Schema.String,
|
||||
emailVerified: Schema.Boolean,
|
||||
image: Schema.optional(Schema.NullishOr(Schema.String)),
|
||||
createdAt: Schema.DateFromString,
|
||||
updatedAt: Schema.DateFromString,
|
||||
id: Schema.String,
|
||||
});
|
||||
|
||||
|
||||
export const AuthState = Schema.Struct({
|
||||
session: SessionSchema,
|
||||
user: UserSchema,
|
||||
});
|
||||
|
||||
export type AuthData = typeof AuthState.Type;
|
||||
|
||||
131
apps/tui/src/store.ts
Normal file
131
apps/tui/src/store.ts
Normal file
@@ -0,0 +1,131 @@
|
||||
import { promises as fs } from "fs";
|
||||
import path from "path";
|
||||
import type { ReadonlyJSONValue, ZeroOptions } from "@rocicorp/zero";
|
||||
import { config } from "./config";
|
||||
|
||||
type StoreProvider = ZeroOptions<any>["kvStore"];
|
||||
|
||||
const DATA_DIR = config.dir;
|
||||
|
||||
function deepFreeze<T>(obj: T): T {
|
||||
if (obj && typeof obj === "object" && !Object.isFrozen(obj)) {
|
||||
Object.freeze(obj);
|
||||
for (const value of Object.values(obj as any)) {
|
||||
deepFreeze(value);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
async function loadFile(name: string): Promise<Map<string, ReadonlyJSONValue>> {
|
||||
const filePath = path.join(DATA_DIR, `${name}.json`);
|
||||
try {
|
||||
const buf = await fs.readFile(filePath, "utf8");
|
||||
const obj = JSON.parse(buf) as Record<string, ReadonlyJSONValue>;
|
||||
const frozen = Object.fromEntries(
|
||||
Object.entries(obj).map(([k, v]) => [k, deepFreeze(v)]),
|
||||
);
|
||||
return new Map(Object.entries(frozen));
|
||||
} catch (err: any) {
|
||||
if (err.code === "ENOENT") {
|
||||
return new Map();
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async function saveFile(name: string, data: Map<string, ReadonlyJSONValue>) {
|
||||
const filePath = path.join(DATA_DIR, `${name}.json`);
|
||||
const obj = Object.fromEntries(data.entries());
|
||||
await fs.writeFile(filePath, JSON.stringify(obj, null, 2), "utf8");
|
||||
}
|
||||
|
||||
export const kvStore: StoreProvider = {
|
||||
create: (name: string) => {
|
||||
let closed = false;
|
||||
let dataPromise = loadFile(name);
|
||||
|
||||
const makeRead = async () => {
|
||||
const data = await dataPromise;
|
||||
let txClosed = false;
|
||||
return {
|
||||
closed: txClosed,
|
||||
async has(key: string) {
|
||||
if (txClosed) throw new Error("transaction closed");
|
||||
return data.has(key);
|
||||
},
|
||||
async get(key: string) {
|
||||
if (txClosed) throw new Error("transaction closed");
|
||||
return data.get(key);
|
||||
},
|
||||
release() {
|
||||
txClosed = true;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const makeWrite = async () => {
|
||||
const data = await dataPromise;
|
||||
let txClosed = false;
|
||||
const staging = new Map<string, ReadonlyJSONValue | undefined>();
|
||||
|
||||
return {
|
||||
closed: txClosed,
|
||||
async has(key: string) {
|
||||
if (txClosed) throw new Error("transaction closed");
|
||||
return staging.has(key)
|
||||
? staging.get(key) !== undefined
|
||||
: data.has(key);
|
||||
},
|
||||
async get(key: string) {
|
||||
if (txClosed) throw new Error("transaction closed");
|
||||
return staging.has(key) ? staging.get(key) : data.get(key);
|
||||
},
|
||||
async put(key: string, value: ReadonlyJSONValue) {
|
||||
if (txClosed) throw new Error("transaction closed");
|
||||
staging.set(key, deepFreeze(value)); // 🔒 freeze before staging
|
||||
},
|
||||
async del(key: string) {
|
||||
if (txClosed) throw new Error("transaction closed");
|
||||
staging.set(key, undefined);
|
||||
},
|
||||
async commit() {
|
||||
if (txClosed) throw new Error("transaction closed");
|
||||
for (const [k, v] of staging.entries()) {
|
||||
if (v === undefined) {
|
||||
data.delete(k);
|
||||
} else {
|
||||
data.set(k, v);
|
||||
}
|
||||
}
|
||||
await saveFile(name, data);
|
||||
txClosed = true;
|
||||
},
|
||||
release() {
|
||||
txClosed = true;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
return {
|
||||
closed,
|
||||
async read() {
|
||||
if (closed) throw new Error("store closed");
|
||||
return makeRead();
|
||||
},
|
||||
async write() {
|
||||
if (closed) throw new Error("store closed");
|
||||
return makeWrite();
|
||||
},
|
||||
async close() {
|
||||
closed = true;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
async drop(name: string) {
|
||||
const filePath = path.join(DATA_DIR, `${name}.json`);
|
||||
await fs.rm(filePath, { force: true });
|
||||
console.log("destroy db:", name);
|
||||
},
|
||||
};
|
||||
@@ -22,5 +22,3 @@ export function QR(value: string): string {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
15
biome.jsonc
Normal file
15
biome.jsonc
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.0.5/schema.json",
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "space"
|
||||
},
|
||||
"linter": {
|
||||
"enabled": false
|
||||
},
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": true
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,11 @@
|
||||
corepack
|
||||
nodejs_22
|
||||
bun
|
||||
biome
|
||||
|
||||
postgresql
|
||||
process-compose
|
||||
cloudflared
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,79 +1,243 @@
|
||||
import * as React from "react";
|
||||
import type { ViewProps, TextProps, PressableProps } from "react-native";
|
||||
import type {
|
||||
ViewProps,
|
||||
TextProps,
|
||||
PressableProps,
|
||||
ScrollViewProps,
|
||||
ModalProps,
|
||||
StyleProp,
|
||||
ViewStyle,
|
||||
LinkingImpl,
|
||||
} from "react-native";
|
||||
import { useTerminalDimensions } from "@opentui/react";
|
||||
import { RGBA } from "@opentui/core";
|
||||
import { platform } from "node:os";
|
||||
import { exec } from "node:child_process";
|
||||
|
||||
const RATIO_WIDTH = 8.433;
|
||||
const RATIO_HEIGHT = 17;
|
||||
|
||||
function attr<K extends keyof ViewStyle>(
|
||||
style: StyleProp<ViewStyle>,
|
||||
name: K,
|
||||
type: "string",
|
||||
): Extract<ViewStyle[K], string> | undefined;
|
||||
|
||||
function attr<K extends keyof ViewStyle>(
|
||||
style: StyleProp<ViewStyle>,
|
||||
name: K,
|
||||
type: "number",
|
||||
): Extract<ViewStyle[K], number> | undefined;
|
||||
|
||||
function attr<K extends keyof ViewStyle>(
|
||||
style: StyleProp<ViewStyle>,
|
||||
name: K,
|
||||
type: "boolean",
|
||||
): Extract<ViewStyle[K], boolean> | undefined;
|
||||
|
||||
function attr<K extends keyof ViewStyle>(
|
||||
style: StyleProp<ViewStyle>,
|
||||
name: K,
|
||||
type: "string" | "number" | "boolean",
|
||||
) {
|
||||
if (!style) return undefined;
|
||||
|
||||
const obj: ViewStyle = Array.isArray(style)
|
||||
? Object.assign({}, ...style.filter(Boolean))
|
||||
: (style as ViewStyle);
|
||||
|
||||
const v = obj[name];
|
||||
return typeof v === type ? v : undefined;
|
||||
}
|
||||
|
||||
export function View({ children, style }: ViewProps) {
|
||||
const bg = style &&
|
||||
'backgroundColor' in style
|
||||
? typeof style.backgroundColor == 'string'
|
||||
? style.backgroundColor
|
||||
: undefined
|
||||
: undefined;
|
||||
const flexDirection = style &&
|
||||
'flexDirection' in style
|
||||
? typeof style.flexDirection == 'string'
|
||||
? style.flexDirection
|
||||
: undefined
|
||||
: undefined;
|
||||
const flex = style &&
|
||||
'flex' in style
|
||||
? typeof style.flex == 'number'
|
||||
? style.flex
|
||||
: undefined
|
||||
: undefined;
|
||||
const bg =
|
||||
style && "backgroundColor" in style
|
||||
? typeof style.backgroundColor == "string"
|
||||
? style.backgroundColor.startsWith("rgba(")
|
||||
? (() => {
|
||||
const parts = style.backgroundColor.split("(")[1].split(")")[0];
|
||||
const [r, g, b, a] = parts.split(",").map(parseFloat);
|
||||
return RGBA.fromInts(r, g, b, a * 255);
|
||||
})()
|
||||
: style.backgroundColor
|
||||
: undefined
|
||||
: undefined;
|
||||
|
||||
return <box backgroundColor={bg} flexDirection={flexDirection} flexGrow={flex}>{children}</box>
|
||||
const padding = attr(style, "padding", "number");
|
||||
|
||||
const props = {
|
||||
overflow: attr(style, "overflow", "string"),
|
||||
position: attr(style, "position", "string"),
|
||||
alignSelf: attr(style, "alignSelf", "string"),
|
||||
alignItems: attr(style, "alignItems", "string"),
|
||||
justifyContent: attr(style, "justifyContent", "string"),
|
||||
flexShrink: attr(style, "flexShrink", "number"),
|
||||
flexDirection: attr(style, "flexDirection", "string"),
|
||||
flexGrow:
|
||||
attr(style, "flex", "number") || attr(style, "flexGrow", "number"),
|
||||
};
|
||||
|
||||
return (
|
||||
<box
|
||||
backgroundColor={bg}
|
||||
paddingTop={padding && Math.round(padding / RATIO_HEIGHT)}
|
||||
paddingBottom={padding && Math.round(padding / RATIO_HEIGHT)}
|
||||
paddingLeft={padding && Math.round(padding / RATIO_WIDTH)}
|
||||
paddingRight={padding && Math.round(padding / RATIO_WIDTH)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
export function Pressable({ children: childrenRaw, style, onPress }: PressableProps) {
|
||||
const bg = style &&
|
||||
'backgroundColor' in style
|
||||
? typeof style.backgroundColor == 'string'
|
||||
? style.backgroundColor
|
||||
: undefined
|
||||
: undefined;
|
||||
const flexDirection = style &&
|
||||
'flexDirection' in style
|
||||
? typeof style.flexDirection == 'string'
|
||||
? style.flexDirection
|
||||
: undefined
|
||||
: undefined;
|
||||
const flex = style &&
|
||||
'flex' in style
|
||||
? typeof style.flex == 'number'
|
||||
? style.flex
|
||||
: undefined
|
||||
: undefined;
|
||||
export function Pressable({
|
||||
children: childrenRaw,
|
||||
style,
|
||||
onPress,
|
||||
}: PressableProps) {
|
||||
const bg =
|
||||
style && "backgroundColor" in style
|
||||
? typeof style.backgroundColor == "string"
|
||||
? style.backgroundColor.startsWith("rgba(")
|
||||
? (() => {
|
||||
const parts = style.backgroundColor.split("(")[1].split(")")[0];
|
||||
const [r, g, b, a] = parts.split(",").map(parseFloat);
|
||||
return RGBA.fromInts(r, g, b, a * 255);
|
||||
})()
|
||||
: style.backgroundColor
|
||||
: undefined
|
||||
: undefined;
|
||||
const flexDirection =
|
||||
style && "flexDirection" in style
|
||||
? typeof style.flexDirection == "string"
|
||||
? style.flexDirection
|
||||
: undefined
|
||||
: undefined;
|
||||
const flex =
|
||||
style && "flex" in style
|
||||
? typeof style.flex == "number"
|
||||
? style.flex
|
||||
: undefined
|
||||
: undefined;
|
||||
const flexShrink =
|
||||
style && "flexShrink" in style
|
||||
? typeof style.flexShrink == "number"
|
||||
? style.flexShrink
|
||||
: undefined
|
||||
: undefined;
|
||||
const overflow =
|
||||
style && "overflow" in style
|
||||
? typeof style.overflow == "string"
|
||||
? style.overflow
|
||||
: undefined
|
||||
: undefined;
|
||||
const position =
|
||||
style && "position" in style
|
||||
? typeof style.position == "string"
|
||||
? style.position
|
||||
: undefined
|
||||
: undefined;
|
||||
const justifyContent =
|
||||
style && "justifyContent" in style
|
||||
? typeof style.justifyContent == "string"
|
||||
? style.justifyContent
|
||||
: undefined
|
||||
: undefined;
|
||||
const alignItems =
|
||||
style && "alignItems" in style
|
||||
? typeof style.alignItems == "string"
|
||||
? style.alignItems
|
||||
: undefined
|
||||
: undefined;
|
||||
|
||||
const children = childrenRaw instanceof Function ? childrenRaw({ pressed: true }) : childrenRaw;
|
||||
const padding =
|
||||
style && "padding" in style
|
||||
? typeof style.padding == "number"
|
||||
? style.padding
|
||||
: undefined
|
||||
: undefined;
|
||||
|
||||
return <box
|
||||
backgroundColor={bg}
|
||||
flexDirection={flexDirection}
|
||||
flexGrow={flex}
|
||||
onMouseDown={onPress ? ((_event) => {
|
||||
// @ts-ignore
|
||||
onPress();
|
||||
}) : undefined}
|
||||
>{children}</box>
|
||||
const children =
|
||||
childrenRaw instanceof Function
|
||||
? childrenRaw({ pressed: true })
|
||||
: childrenRaw;
|
||||
|
||||
return (
|
||||
<box
|
||||
onMouseDown={
|
||||
onPress
|
||||
? (_event) => {
|
||||
// @ts-ignore
|
||||
onPress();
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
backgroundColor={bg}
|
||||
flexDirection={flexDirection}
|
||||
flexGrow={flex}
|
||||
overflow={overflow}
|
||||
flexShrink={flexShrink}
|
||||
position={position}
|
||||
justifyContent={justifyContent}
|
||||
alignItems={alignItems}
|
||||
paddingTop={padding && Math.round(padding / RATIO_HEIGHT)}
|
||||
paddingBottom={padding && Math.round(padding / RATIO_HEIGHT)}
|
||||
paddingLeft={padding && Math.round(padding / RATIO_WIDTH)}
|
||||
paddingRight={padding && Math.round(padding / RATIO_WIDTH)}
|
||||
>
|
||||
{children}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export function Text({ style, children }: TextProps) {
|
||||
const fg = style &&
|
||||
'color' in style
|
||||
? typeof style.color == 'string'
|
||||
? style.color
|
||||
: undefined
|
||||
: undefined;
|
||||
return <text fg={fg || "black"}>{children}</text>
|
||||
const fg =
|
||||
style && "color" in style
|
||||
? typeof style.color == "string"
|
||||
? style.color
|
||||
: undefined
|
||||
: undefined;
|
||||
return <text fg={fg || "black"}>{children}</text>;
|
||||
}
|
||||
|
||||
export function ScrollView({ children }: ScrollViewProps) {
|
||||
return <scrollbox>{children}</scrollbox>;
|
||||
}
|
||||
|
||||
export function Modal({ children, visible }: ModalProps) {
|
||||
const { width, height } = useTerminalDimensions();
|
||||
return (
|
||||
<box
|
||||
visible={visible}
|
||||
position="absolute"
|
||||
width={width}
|
||||
height={height}
|
||||
zIndex={10}
|
||||
>
|
||||
{children}
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
export const Platform = {
|
||||
OS: "tui",
|
||||
};
|
||||
|
||||
export const Linking = {
|
||||
openURL: async (url: string) => {
|
||||
const cmd =
|
||||
platform() == "darwin"
|
||||
? `open ${url}`
|
||||
: platform() == "win32"
|
||||
? `start "" "${url}"`
|
||||
: `xdg-open "${url}"`;
|
||||
exec(cmd);
|
||||
},
|
||||
} satisfies Partial<LinkingImpl>;
|
||||
|
||||
export default {
|
||||
View,
|
||||
Text,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./auth": "./src/auth.ts",
|
||||
"./rpc": "./src/rpc.ts",
|
||||
"./db": "./src/db/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"drizzle-zero": "^0.14.3"
|
||||
},
|
||||
"scripts": {
|
||||
"generate:zero": "drizzle-zero generate -s ./src/db/schema/public.ts -o ./src/zero-schema.gen.ts -f && sed -i 's/enableLegacyQueries: true,/enableLegacyQueries: false,/g' src/zero-schema.gen.ts && sed -i 's/enableLegacyMutators: true,/enableLegacyMutators: false,/g' src/zero-schema.gen.ts",
|
||||
"db:gen": "drizzle-zero generate -s ./src/db/schema/public.ts -o ./src/zero-schema.gen.ts -f && sed -i 's/enableLegacyQueries: true,/enableLegacyQueries: false,/g' src/zero-schema.gen.ts && sed -i 's/enableLegacyMutators: true,/enableLegacyMutators: false,/g' src/zero-schema.gen.ts",
|
||||
"db:migrate": "drizzle-kit push"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,35 @@
|
||||
import { z } from "zod";
|
||||
import { Schema } from "effect";
|
||||
|
||||
export const sessionSchema = z.object({
|
||||
id: z.string(),
|
||||
userId: z.string(),
|
||||
expiresAt: z.date(),
|
||||
const DateFromDateOrString = Schema.Union(
|
||||
Schema.DateFromString,
|
||||
Schema.DateFromSelf,
|
||||
);
|
||||
|
||||
export const SessionSchema = Schema.Struct({
|
||||
expiresAt: DateFromDateOrString,
|
||||
token: Schema.Redacted(Schema.String),
|
||||
createdAt: DateFromDateOrString,
|
||||
updatedAt: DateFromDateOrString,
|
||||
ipAddress: Schema.optional(Schema.NullishOr(Schema.String)),
|
||||
userAgent: Schema.optional(Schema.NullishOr(Schema.String)),
|
||||
userId: Schema.String,
|
||||
id: Schema.String,
|
||||
});
|
||||
|
||||
export const userSchema = z.object({
|
||||
id: z.string(),
|
||||
email: z.string(),
|
||||
emailVerified: z.boolean(),
|
||||
name: z.string(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
export const UserSchema = Schema.Struct({
|
||||
name: Schema.String,
|
||||
email: Schema.String,
|
||||
emailVerified: Schema.Boolean,
|
||||
image: Schema.optional(Schema.NullishOr(Schema.String)),
|
||||
createdAt: DateFromDateOrString,
|
||||
updatedAt: DateFromDateOrString,
|
||||
id: Schema.String,
|
||||
});
|
||||
|
||||
export const authDataSchema = z.object({
|
||||
session: sessionSchema,
|
||||
user: userSchema,
|
||||
export const AuthSchema = Schema.Struct({
|
||||
session: SessionSchema,
|
||||
user: UserSchema,
|
||||
});
|
||||
|
||||
export type Session = z.infer<typeof sessionSchema>;
|
||||
export type User = z.infer<typeof userSchema>;
|
||||
export type AuthData = z.infer<typeof authDataSchema>;
|
||||
export type AuthSchemaType = Schema.Schema.Type<typeof AuthSchema>;
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export const HOST = process.env.EXPO_PUBLIC_TAILSCALE_MACHINE || "localhost";
|
||||
export const BASE_URL = `http://${HOST}`;
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
import { pgTable, text, boolean, timestamp, uniqueIndex, decimal } from "drizzle-orm/pg-core";
|
||||
import {
|
||||
boolean,
|
||||
decimal,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
pgEnum,
|
||||
uniqueIndex,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable(
|
||||
"user",
|
||||
@@ -33,6 +41,7 @@ export const plaidLink = pgTable("plaidLink", {
|
||||
user_id: text("user_id").notNull(),
|
||||
link: text("link").notNull(),
|
||||
token: text("token").notNull(),
|
||||
completeAt: timestamp("complete_at"),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
});
|
||||
|
||||
@@ -43,6 +52,7 @@ export const balance = pgTable("balance", {
|
||||
avaliable: decimal("avaliable").notNull(),
|
||||
current: decimal("current").notNull(),
|
||||
name: text("name").notNull(),
|
||||
tokenId: text("tokenId").notNull(),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { Transaction } from "@rocicorp/zero";
|
||||
import type { AuthData } from "./auth";
|
||||
import type { Schema } from ".";
|
||||
import { type Schema } from "./zero-schema.gen";
|
||||
import { isLoggedIn } from "./zql";
|
||||
|
||||
type Tx = Transaction<Schema>;
|
||||
|
||||
@@ -11,7 +12,33 @@ export function createMutators(authData: AuthData | null) {
|
||||
async get(tx: Tx, { link_token }: { link_token: string }) {},
|
||||
async updateTransactions() {},
|
||||
async updateBalences() {},
|
||||
}
|
||||
async deleteAccounts(tx: Tx, { accountIds }: { accountIds: string[] }) {
|
||||
isLoggedIn(authData);
|
||||
for (const id of accountIds) {
|
||||
const token = await tx.query.plaidAccessTokens
|
||||
.where("userId", "=", authData.user.id)
|
||||
.one();
|
||||
if (!token) continue;
|
||||
await tx.mutate.plaidAccessTokens.delete({ id });
|
||||
|
||||
const balances = await tx.query.balance
|
||||
.where("user_id", "=", authData.user.id)
|
||||
.where("tokenId", "=", token.id)
|
||||
.run();
|
||||
|
||||
for (const bal of balances) {
|
||||
await tx.mutate.balance.delete({ id: bal.id });
|
||||
const txs = await tx.query.transaction
|
||||
.where("user_id", "=", authData.user.id)
|
||||
.where("account_id", "=", bal.tokenId)
|
||||
.run();
|
||||
for (const transaction of txs) {
|
||||
await tx.mutate.transaction.delete({ id: transaction.id });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +1,63 @@
|
||||
import { syncedQueryWithContext } from "@rocicorp/zero";
|
||||
import { z } from "zod";
|
||||
import { builder } from ".";
|
||||
import { builder } from "./zero-schema.gen";
|
||||
import { type AuthData } from "./auth";
|
||||
import { isLoggedIn } from "./zql";
|
||||
|
||||
export const queries = {
|
||||
me: syncedQueryWithContext('me', z.tuple([]), (authData: AuthData | null) => {
|
||||
me: syncedQueryWithContext("me", z.tuple([]), (authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.users
|
||||
.where('id', '=', authData.user.id)
|
||||
.one();
|
||||
return builder.users.where("id", "=", authData.user.id).one();
|
||||
}),
|
||||
allTransactions: syncedQueryWithContext('allTransactions', z.tuple([]), (authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.transaction
|
||||
.where('user_id', '=', authData.user.id)
|
||||
.orderBy('datetime', 'desc')
|
||||
.limit(50)
|
||||
}),
|
||||
getPlaidLink: syncedQueryWithContext('getPlaidLink', z.tuple([]), (authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.plaidLink
|
||||
.where('user_id', '=', authData.user.id)
|
||||
.orderBy('createdAt', 'desc')
|
||||
.one();
|
||||
}),
|
||||
getBalances: syncedQueryWithContext('getBalances', z.tuple([]), (authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.balance
|
||||
.where('user_id', '=', authData.user.id)
|
||||
.orderBy('name', 'asc');
|
||||
}),
|
||||
getItems: syncedQueryWithContext('getItems', z.tuple([]), (authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.plaidAccessTokens
|
||||
.where('userId', '=', authData.user.id)
|
||||
.orderBy('createdAt', 'desc');
|
||||
})
|
||||
allTransactions: syncedQueryWithContext(
|
||||
"allTransactions",
|
||||
z.tuple([]),
|
||||
(authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.transaction
|
||||
.where("user_id", "=", authData.user.id)
|
||||
.orderBy("datetime", "desc")
|
||||
.limit(50);
|
||||
},
|
||||
),
|
||||
getPlaidLink: syncedQueryWithContext(
|
||||
"getPlaidLink",
|
||||
z.tuple([]),
|
||||
(authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.plaidLink
|
||||
.where(({ cmp, and, or }) =>
|
||||
and(
|
||||
cmp("user_id", "=", authData.user.id),
|
||||
cmp("createdAt", ">", new Date().getTime() - 1000 * 60 * 60 * 4),
|
||||
or(
|
||||
cmp("completeAt", ">", new Date().getTime() - 1000 * 5),
|
||||
cmp("completeAt", "IS", null),
|
||||
),
|
||||
),
|
||||
)
|
||||
.orderBy("createdAt", "desc")
|
||||
.one();
|
||||
},
|
||||
),
|
||||
getBalances: syncedQueryWithContext(
|
||||
"getBalances",
|
||||
z.tuple([]),
|
||||
(authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.balance
|
||||
.where("user_id", "=", authData.user.id)
|
||||
.orderBy("name", "asc");
|
||||
},
|
||||
),
|
||||
getItems: syncedQueryWithContext(
|
||||
"getItems",
|
||||
z.tuple([]),
|
||||
(authData: AuthData | null) => {
|
||||
isLoggedIn(authData);
|
||||
return builder.plaidAccessTokens
|
||||
.where("userId", "=", authData.user.id)
|
||||
.orderBy("createdAt", "desc");
|
||||
},
|
||||
),
|
||||
};
|
||||
|
||||
29
packages/shared/src/rpc.ts
Normal file
29
packages/shared/src/rpc.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Context, Schema } from "effect";
|
||||
import { Rpc, RpcGroup, RpcMiddleware } from "@effect/rpc";
|
||||
import type { AuthSchema } from "./auth";
|
||||
|
||||
export class Link extends Schema.Class<Link>("Link")({
|
||||
href: Schema.String,
|
||||
}) {}
|
||||
|
||||
export class CurrentSession extends Context.Tag("CurrentSession")<
|
||||
CurrentSession,
|
||||
{ readonly auth: Schema.Schema.Type<typeof AuthSchema> | null }
|
||||
>() {}
|
||||
|
||||
export class AuthMiddleware extends RpcMiddleware.Tag<AuthMiddleware>()(
|
||||
"AuthMiddleware",
|
||||
{
|
||||
// This middleware will provide the current user context
|
||||
provides: CurrentSession,
|
||||
// This middleware requires a client implementation too
|
||||
requiredForClient: true,
|
||||
},
|
||||
) {}
|
||||
|
||||
export class LinkRpcs extends RpcGroup.make(
|
||||
Rpc.make("CreateLink", {
|
||||
success: Link,
|
||||
error: Schema.String,
|
||||
}),
|
||||
).middleware(AuthMiddleware) {}
|
||||
@@ -80,6 +80,15 @@ export const schema = {
|
||||
"name"
|
||||
>,
|
||||
},
|
||||
tokenId: {
|
||||
type: "string",
|
||||
optional: false,
|
||||
customType: null as unknown as ZeroCustomType<
|
||||
ZeroSchema,
|
||||
"balance",
|
||||
"tokenId"
|
||||
>,
|
||||
},
|
||||
createdAt: {
|
||||
type: "number",
|
||||
optional: true,
|
||||
@@ -205,6 +214,16 @@ export const schema = {
|
||||
"token"
|
||||
>,
|
||||
},
|
||||
completeAt: {
|
||||
type: "number",
|
||||
optional: true,
|
||||
customType: null as unknown as ZeroCustomType<
|
||||
ZeroSchema,
|
||||
"plaidLink",
|
||||
"completeAt"
|
||||
>,
|
||||
serverName: "complete_at",
|
||||
},
|
||||
createdAt: {
|
||||
type: "number",
|
||||
optional: true,
|
||||
|
||||
@@ -3,7 +3,6 @@ import type { AuthData } from "./auth";
|
||||
export function isLoggedIn(
|
||||
authData: AuthData | null,
|
||||
): asserts authData is AuthData {
|
||||
console.log("AUTHDATA", authData);
|
||||
if (!authData?.user.id) {
|
||||
throw new Error("User is not logged in");
|
||||
}
|
||||
|
||||
38
packages/ui/components/Button.tsx
Normal file
38
packages/ui/components/Button.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import { useKeyboard } from "../src/useKeyboard";
|
||||
import type { ReactNode } from "react";
|
||||
import { Text, Pressable } from "react-native";
|
||||
|
||||
export interface ButtonProps {
|
||||
children: ReactNode;
|
||||
onPress?: () => void;
|
||||
variant?: "default" | "secondary" | "destructive";
|
||||
shortcut?: string;
|
||||
}
|
||||
|
||||
const STYLES: Record<
|
||||
NonNullable<ButtonProps["variant"]>,
|
||||
{ backgroundColor: string; color: string }
|
||||
> = {
|
||||
default: { backgroundColor: "black", color: "white" },
|
||||
secondary: { backgroundColor: "#ccc", color: "black" },
|
||||
destructive: { backgroundColor: "red", color: "white" },
|
||||
};
|
||||
|
||||
export function Button({ children, variant, onPress, shortcut }: ButtonProps) {
|
||||
const { backgroundColor, color } = STYLES[variant || "default"];
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (!shortcut || !onPress) return;
|
||||
if (key.name == shortcut) onPress();
|
||||
});
|
||||
|
||||
return (
|
||||
<Pressable onPress={onPress} style={{ backgroundColor }}>
|
||||
<Text style={{ fontFamily: "mono", color }}>
|
||||
{" "}
|
||||
{children}
|
||||
{shortcut && ` (${shortcut})`}{" "}
|
||||
</Text>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
54
packages/ui/components/Dialog.tsx
Normal file
54
packages/ui/components/Dialog.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import { createContext, type ReactNode } from "react";
|
||||
import { Modal, View, Text } from "react-native";
|
||||
import { useKeyboard } from "../src/useKeyboard";
|
||||
|
||||
export interface DialogState {
|
||||
close?: () => void;
|
||||
}
|
||||
export const Context = createContext<DialogState>({
|
||||
close: () => {},
|
||||
});
|
||||
|
||||
interface ProviderProps {
|
||||
children: ReactNode;
|
||||
visible?: boolean;
|
||||
close?: () => void;
|
||||
}
|
||||
export function Provider({ children, visible, close }: ProviderProps) {
|
||||
useKeyboard((key) => {
|
||||
if (key.name == "escape") {
|
||||
if (close) close();
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Context.Provider value={{ close }}>
|
||||
<Modal transparent visible={visible}>
|
||||
{/* <Pressable onPress={() => close && close()} style={{ justifyContent: 'center', alignItems: 'center', flex: 1, backgroundColor: 'rgba(0,0,0,0.2)', }}> */}
|
||||
<View
|
||||
style={{
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flex: 1,
|
||||
backgroundColor: "rgba(0,0,0,0.2)",
|
||||
}}
|
||||
>
|
||||
{visible && children}
|
||||
</View>
|
||||
</Modal>
|
||||
</Context.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
interface ContentProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
export function Content({ children }: ContentProps) {
|
||||
return (
|
||||
<View
|
||||
style={{ backgroundColor: "white", padding: 12, alignItems: "center" }}
|
||||
>
|
||||
{children}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
36
packages/ui/components/List.tsx
Normal file
36
packages/ui/components/List.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { useKeyboard } from "../src/useKeyboard";
|
||||
|
||||
export type ListProps<T> = {
|
||||
items: T[];
|
||||
renderItem: (props: { item: T; isSelected: boolean }) => ReactNode;
|
||||
};
|
||||
export function List<T>({ items, renderItem }: ListProps<T>) {
|
||||
const [idx, setIdx] = useState(0);
|
||||
|
||||
useKeyboard(
|
||||
(key) => {
|
||||
if (key.name == "j") {
|
||||
setIdx((prevIdx) =>
|
||||
prevIdx + 1 < items.length ? prevIdx + 1 : items.length - 1,
|
||||
);
|
||||
} else if (key.name == "k") {
|
||||
setIdx((prevIdx) => (prevIdx == 0 ? 0 : prevIdx - 1));
|
||||
} else if (key.name == "g" && key.shift) {
|
||||
setIdx(items.length - 1);
|
||||
}
|
||||
},
|
||||
[items],
|
||||
);
|
||||
|
||||
return (
|
||||
<View>
|
||||
{items.map((item, index) => (
|
||||
<View style={{ backgroundColor: index == idx ? "black" : undefined }}>
|
||||
{renderItem({ item, isSelected: index == idx })}
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
192
packages/ui/components/Table.tsx
Normal file
192
packages/ui/components/Table.tsx
Normal file
@@ -0,0 +1,192 @@
|
||||
import { createContext, use, useState, type ReactNode } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { useKeyboard } from "../src/useKeyboard";
|
||||
import type { KeyEvent } from "@opentui/core";
|
||||
|
||||
const HEADER_COLOR = "#7158e2";
|
||||
const TABLE_COLORS = ["#ddd", "#eee"];
|
||||
const SELECTED_COLOR = "#f7b730";
|
||||
|
||||
const EXTRA = 5;
|
||||
|
||||
export type ValidRecord = Record<string, string | number | null>;
|
||||
|
||||
interface TableState {
|
||||
data: unknown[];
|
||||
columns: Column[];
|
||||
columnMap: Map<string, number>;
|
||||
idx: number;
|
||||
selectedFrom: number | undefined;
|
||||
}
|
||||
|
||||
const INITAL_STATE = {
|
||||
data: [],
|
||||
columns: [],
|
||||
columnMap: new Map(),
|
||||
idx: 0,
|
||||
selectedFrom: undefined,
|
||||
} satisfies TableState;
|
||||
|
||||
export const Context = createContext<TableState>(INITAL_STATE);
|
||||
|
||||
export type Column = {
|
||||
name: string;
|
||||
label: string;
|
||||
render?: (i: number | string) => string;
|
||||
};
|
||||
|
||||
function renderCell(row: ValidRecord, column: Column): string {
|
||||
const cell = row[column.name];
|
||||
if (cell == undefined) return "n/a";
|
||||
if (cell == null) return "null";
|
||||
if (column.render) return column.render(cell);
|
||||
return cell.toString();
|
||||
}
|
||||
|
||||
export interface ProviderProps<T> {
|
||||
data: T[];
|
||||
columns: Column[];
|
||||
children: ReactNode;
|
||||
onKey?: (event: KeyEvent, selected: T[]) => void;
|
||||
}
|
||||
export function Provider<T extends ValidRecord>({
|
||||
data,
|
||||
columns,
|
||||
children,
|
||||
onKey,
|
||||
}: ProviderProps<T>) {
|
||||
const [idx, setIdx] = useState(0);
|
||||
const [selectedFrom, setSelectedFrom] = useState<number>();
|
||||
|
||||
useKeyboard(
|
||||
(key) => {
|
||||
if (key.name == "j" || key.name == "down") {
|
||||
if (key.shift && selectedFrom == undefined) {
|
||||
setSelectedFrom(idx);
|
||||
}
|
||||
setIdx((prev) => Math.min(prev + 1, data.length - 1));
|
||||
} else if (key.name == "k" || key.name == "up") {
|
||||
if (key.shift && selectedFrom == undefined) {
|
||||
setSelectedFrom(idx);
|
||||
}
|
||||
setIdx((prev) => Math.max(prev - 1, 0));
|
||||
} else if (key.name == "g" && key.shift) {
|
||||
setIdx(data.length - 1);
|
||||
} else if (key.name == "v") {
|
||||
setSelectedFrom(idx);
|
||||
} else if (key.name == "escape") {
|
||||
setSelectedFrom(undefined);
|
||||
} else {
|
||||
const from = selectedFrom ? Math.min(idx, selectedFrom) : idx;
|
||||
const to = selectedFrom ? Math.max(idx, selectedFrom) : idx;
|
||||
const selected = data.slice(from, to + 1);
|
||||
if (onKey) onKey(key, selected);
|
||||
}
|
||||
},
|
||||
[data, idx, selectedFrom],
|
||||
);
|
||||
|
||||
const columnMap = new Map(
|
||||
columns.map((col) => {
|
||||
return [
|
||||
col.name,
|
||||
Math.max(
|
||||
col.label.length,
|
||||
...data.map((row) => renderCell(row, col).length),
|
||||
),
|
||||
];
|
||||
}),
|
||||
);
|
||||
|
||||
return (
|
||||
<Context.Provider value={{ data, columns, columnMap, idx, selectedFrom }}>
|
||||
{children}
|
||||
</Context.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function Body() {
|
||||
const { columns, data, columnMap, idx, selectedFrom } = use(Context);
|
||||
return (
|
||||
<View>
|
||||
<View style={{ backgroundColor: HEADER_COLOR, flexDirection: "row" }}>
|
||||
{columns.map((column) => (
|
||||
<Text
|
||||
key={column.name}
|
||||
style={{ fontFamily: "mono", color: "white" }}
|
||||
>
|
||||
{rpad(
|
||||
column.label,
|
||||
columnMap.get(column.name)! - column.label.length + EXTRA,
|
||||
)}
|
||||
</Text>
|
||||
))}
|
||||
</View>
|
||||
{data.map((row, index) => {
|
||||
const isSelected =
|
||||
index == idx ||
|
||||
(selectedFrom != undefined &&
|
||||
((selectedFrom <= index && index <= idx) ||
|
||||
(idx <= index && index <= selectedFrom)));
|
||||
|
||||
return (
|
||||
<View
|
||||
key={index}
|
||||
style={{
|
||||
backgroundColor: isSelected
|
||||
? SELECTED_COLOR
|
||||
: TABLE_COLORS[index % 2],
|
||||
}}
|
||||
>
|
||||
<TableRow
|
||||
key={index}
|
||||
row={row as ValidRecord}
|
||||
index={index}
|
||||
isSelected={isSelected}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
interface RowProps<T> {
|
||||
row: T;
|
||||
index: number;
|
||||
isSelected: boolean;
|
||||
}
|
||||
function TableRow<T extends ValidRecord>({ row, isSelected }: RowProps<T>) {
|
||||
const { columns, columnMap } = use(Context);
|
||||
|
||||
return (
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
{columns.map((column) => {
|
||||
const rendered = renderCell(row, column);
|
||||
return (
|
||||
<Text
|
||||
key={column.name}
|
||||
style={{
|
||||
fontFamily: "mono",
|
||||
color: isSelected ? "black" : "black",
|
||||
}}
|
||||
>
|
||||
{rpad(
|
||||
rendered,
|
||||
columnMap.get(column.name)! - rendered.length + EXTRA,
|
||||
)}
|
||||
</Text>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function rpad(input: string, length: number): string {
|
||||
return (
|
||||
input +
|
||||
Array.from({ length })
|
||||
.map((_) => " ")
|
||||
.join("")
|
||||
);
|
||||
}
|
||||
@@ -1,79 +1,76 @@
|
||||
import { createContext, use, useState } from "react";
|
||||
import { createContext, use } from "react";
|
||||
import { Transactions } from "./transactions";
|
||||
import { View, Text } from "react-native";
|
||||
import { Settings } from "./settings";
|
||||
import { useKeyboard } from "./useKeyboard";
|
||||
import type { AuthData } from "@money/shared/auth";
|
||||
|
||||
import type { AuthSchemaType } from "@money/shared/auth";
|
||||
|
||||
const PAGES = {
|
||||
'/': {
|
||||
"/": {
|
||||
screen: <Transactions />,
|
||||
key: "1",
|
||||
},
|
||||
'/settings': {
|
||||
"/settings": {
|
||||
screen: <Settings />,
|
||||
key: "2",
|
||||
children: {
|
||||
"/accounts": {},
|
||||
"/family": {},
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
type Join<A extends string, B extends string> =
|
||||
`${A}${B}` extends `${infer X}` ? X : never;
|
||||
type Join<A extends string, B extends string> = `${A}${B}` extends `${infer X}`
|
||||
? X
|
||||
: never;
|
||||
|
||||
type ChildRoutes<Parent extends string, Children> =
|
||||
{
|
||||
[K in keyof Children & string]:
|
||||
K extends `/${string}`
|
||||
? Join<Parent, K>
|
||||
: never;
|
||||
}[keyof Children & string];
|
||||
type ChildRoutes<Parent extends string, Children> = {
|
||||
[K in keyof Children & string]: K extends `/${string}`
|
||||
? Join<Parent, K>
|
||||
: never;
|
||||
}[keyof Children & string];
|
||||
|
||||
type Routes<T> = {
|
||||
[K in keyof T & string]:
|
||||
| K
|
||||
| (T[K] extends { children: infer C }
|
||||
? ChildRoutes<K, C>
|
||||
: never)
|
||||
| (T[K] extends { children: infer C } ? ChildRoutes<K, C> : never);
|
||||
}[keyof T & string];
|
||||
|
||||
export type Route = Routes<typeof PAGES>;
|
||||
|
||||
interface RouterContextType {
|
||||
auth: AuthData | null;
|
||||
auth: AuthSchemaType | null;
|
||||
route: Route;
|
||||
setRoute: (route: Route) => void;
|
||||
}
|
||||
|
||||
|
||||
export const RouterContext = createContext<RouterContextType>({
|
||||
auth: null,
|
||||
route: '/',
|
||||
setRoute: () => {}
|
||||
route: "/",
|
||||
setRoute: () => {},
|
||||
});
|
||||
|
||||
|
||||
type AppProps = {
|
||||
auth: AuthData | null;
|
||||
auth: AuthSchemaType | null;
|
||||
route: Route;
|
||||
setRoute: (page: Route) => void;
|
||||
}
|
||||
};
|
||||
|
||||
export function App({ auth, route, setRoute }: AppProps) {
|
||||
return <RouterContext.Provider value={{ auth, route, setRoute }}>
|
||||
<Main />
|
||||
</RouterContext.Provider>
|
||||
return (
|
||||
<RouterContext.Provider value={{ auth, route, setRoute }}>
|
||||
<Main />
|
||||
</RouterContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
function Main() {
|
||||
const { route, setRoute } = use(RouterContext);
|
||||
|
||||
useKeyboard((key) => {
|
||||
const screen = Object.entries(PAGES)
|
||||
.find(([, screen]) => screen.key == key.name);
|
||||
const screen = Object.entries(PAGES).find(
|
||||
([, screen]) => screen.key == key.name,
|
||||
);
|
||||
|
||||
if (!screen) return;
|
||||
|
||||
@@ -85,10 +82,13 @@ function Main() {
|
||||
const match =
|
||||
route in PAGES
|
||||
? (route as keyof typeof PAGES)
|
||||
: (Object.keys(PAGES).sort((a, b) => b.length - a.length).find(p => route.startsWith(p)) as
|
||||
keyof typeof PAGES);
|
||||
: (Object.keys(PAGES)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.find((p) => route.startsWith(p)) as keyof typeof PAGES);
|
||||
|
||||
return PAGES[match].screen;
|
||||
return (
|
||||
<View style={{ backgroundColor: "white", flex: 1 }}>
|
||||
{PAGES[match].screen}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { useKeyboard } from "./useKeyboard";
|
||||
|
||||
export type ListProps<T> = {
|
||||
items: T[],
|
||||
renderItem: (props: { item: T, isSelected: boolean }) => ReactNode;
|
||||
};
|
||||
export function List<T>({ items, renderItem }: ListProps<T>) {
|
||||
const [idx, setIdx] = useState(0);
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.name == 'j') {
|
||||
setIdx((prevIdx) => prevIdx + 1 < items.length ? prevIdx + 1 : items.length - 1);
|
||||
} else if (key.name == 'k') {
|
||||
setIdx((prevIdx) => prevIdx == 0 ? 0 : prevIdx - 1);
|
||||
} else if (key.name == 'g' && key.shift) {
|
||||
setIdx(items.length - 1);
|
||||
}
|
||||
}, [items]);
|
||||
|
||||
return (
|
||||
<View>
|
||||
{items.map((item, index) => <View style={{ backgroundColor: index == idx ? 'black' : undefined }}>
|
||||
{renderItem({ item, isSelected: index == idx })}
|
||||
</View>)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
50
packages/ui/src/rpc.ts
Normal file
50
packages/ui/src/rpc.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { AtomRpc } from "@effect-atom/atom-react";
|
||||
import { AuthMiddleware, LinkRpcs } from "@money/shared/rpc";
|
||||
import { FetchHttpClient, Headers } from "@effect/platform";
|
||||
import { Rpc, RpcClient, RpcMiddleware, RpcSerialization } from "@effect/rpc";
|
||||
import * as Layer from "effect/Layer";
|
||||
import { Effect } from "effect";
|
||||
import { use } from "react";
|
||||
import { RouterContext } from "./index";
|
||||
import * as Redacted from "effect/Redacted";
|
||||
import { Platform } from "react-native";
|
||||
|
||||
const protocol = RpcClient.layerProtocolHttp({
|
||||
url: "http://laptop:3000/rpc",
|
||||
}).pipe(
|
||||
Layer.provide([
|
||||
RpcSerialization.layerJson,
|
||||
FetchHttpClient.layer.pipe(
|
||||
Layer.provide(
|
||||
Layer.succeed(FetchHttpClient.RequestInit, {
|
||||
credentials: "include",
|
||||
}),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
export const useRpc = () => {
|
||||
const { auth } = use(RouterContext);
|
||||
|
||||
return class Client extends AtomRpc.Tag<Client>()("RpcClient", {
|
||||
group: LinkRpcs,
|
||||
protocol: Layer.merge(
|
||||
protocol,
|
||||
RpcMiddleware.layerClient(AuthMiddleware, ({ request }) =>
|
||||
Effect.succeed({
|
||||
...request,
|
||||
...(auth && Platform.OS == ("TUI" as any)
|
||||
? {
|
||||
headers: Headers.set(
|
||||
request.headers,
|
||||
"authorization",
|
||||
"Bearer " + Redacted.value(auth.session.token),
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
}),
|
||||
),
|
||||
),
|
||||
}) {};
|
||||
};
|
||||
@@ -5,64 +5,83 @@ import { General } from "./settings/general";
|
||||
import { Accounts } from "./settings/accounts";
|
||||
import { Family } from "./settings/family";
|
||||
import { useKeyboard } from "./useKeyboard";
|
||||
import { Modal } from "react-native-opentui";
|
||||
|
||||
type SettingsRoute = Extract<Route, `/settings${string}`>;
|
||||
|
||||
const TABS = {
|
||||
"/settings": {
|
||||
label: "General",
|
||||
screen: <General />
|
||||
label: "💽 General",
|
||||
screen: <General />,
|
||||
},
|
||||
"/settings/accounts": {
|
||||
label: "Bank Accounts",
|
||||
screen: <Accounts />
|
||||
label: "🏦 Bank Accounts",
|
||||
screen: <Accounts />,
|
||||
},
|
||||
"/settings/family": {
|
||||
label: "Family",
|
||||
screen: <Family />
|
||||
label: "👑 Family",
|
||||
screen: <Family />,
|
||||
},
|
||||
} as const satisfies Record<SettingsRoute, { label: string, screen: ReactNode }>;
|
||||
} as const satisfies Record<
|
||||
SettingsRoute,
|
||||
{ label: string; screen: ReactNode }
|
||||
>;
|
||||
|
||||
type Tab = keyof typeof TABS;
|
||||
|
||||
export function Settings() {
|
||||
const { route, setRoute } = use(RouterContext);
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.name == 'h') {
|
||||
const currentIdx = Object.entries(TABS).findIndex(([tabRoute, _]) => tabRoute == route)
|
||||
const routes = Object.keys(TABS) as SettingsRoute[];
|
||||
const last = routes[currentIdx - 1]
|
||||
if (!last) return;
|
||||
setRoute(last);
|
||||
} else if (key.name == 'l') {
|
||||
const currentIdx = Object.entries(TABS).findIndex(([tabRoute, _]) => tabRoute == route)
|
||||
const routes = Object.keys(TABS) as SettingsRoute[];
|
||||
const next = routes[currentIdx + 1]
|
||||
if (!next) return;
|
||||
setRoute(next);
|
||||
}
|
||||
}, [route]);
|
||||
useKeyboard(
|
||||
(key) => {
|
||||
if (key.name == "h") {
|
||||
const currentIdx = Object.entries(TABS).findIndex(
|
||||
([tabRoute, _]) => tabRoute == route,
|
||||
);
|
||||
const routes = Object.keys(TABS) as SettingsRoute[];
|
||||
const last = routes[currentIdx - 1];
|
||||
if (!last) return;
|
||||
setRoute(last);
|
||||
} else if (key.name == "l") {
|
||||
const currentIdx = Object.entries(TABS).findIndex(
|
||||
([tabRoute, _]) => tabRoute == route,
|
||||
);
|
||||
const routes = Object.keys(TABS) as SettingsRoute[];
|
||||
const next = routes[currentIdx + 1];
|
||||
if (!next) return;
|
||||
setRoute(next);
|
||||
}
|
||||
},
|
||||
[route],
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
|
||||
<View>
|
||||
<View style={{ padding: 10 }}>
|
||||
{Object.entries(TABS).map(([tabRoute, tab]) => {
|
||||
const isSelected = tabRoute == route;
|
||||
|
||||
return (
|
||||
<Pressable key={tab.label} style={{ backgroundColor: isSelected ? 'black' : undefined }} onPress={() => setRoute(tabRoute as SettingsRoute)}>
|
||||
<Text style={{ fontFamily: 'mono', color: isSelected ? 'white' : 'black' }}>{tab.label}</Text>
|
||||
<Pressable
|
||||
key={tab.label}
|
||||
style={{ backgroundColor: isSelected ? "black" : undefined }}
|
||||
onPress={() => setRoute(tabRoute as SettingsRoute)}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontFamily: "mono",
|
||||
color: isSelected ? "white" : "black",
|
||||
}}
|
||||
>
|
||||
{" "}
|
||||
{tab.label}{" "}
|
||||
</Text>
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
|
||||
<View>
|
||||
{TABS[route as Tab].screen}
|
||||
</View>
|
||||
<View>{TABS[route as Tab].screen}</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,197 @@
|
||||
import { useQuery } from "@rocicorp/zero/react";
|
||||
import { queries } from '@money/shared';
|
||||
import * as Table from "../table";
|
||||
import { use } from "react";
|
||||
import { useQuery, useZero } from "@rocicorp/zero/react";
|
||||
import { queries, type Mutators, type Schema } from "@money/shared";
|
||||
import { use, useEffect, useState } from "react";
|
||||
import { RouterContext } from "..";
|
||||
import { View, Text, Linking } from "react-native";
|
||||
import { useKeyboard } from "../useKeyboard";
|
||||
import { Button } from "../../components/Button";
|
||||
import * as Table from "../../components/Table";
|
||||
import * as Dialog from "../../components/Dialog";
|
||||
import { useAtomSet } from "@effect-atom/atom-react";
|
||||
import { useRpc } from "../rpc";
|
||||
import * as Exit from "effect/Exit";
|
||||
|
||||
const COLUMNS: Table.Column[] = [
|
||||
{ name: 'name', label: 'Name' },
|
||||
{ name: 'createdAt', label: 'Added At', render: (n) => new Date(n).toLocaleString() },
|
||||
{ name: "name", label: "Name" },
|
||||
{
|
||||
name: "createdAt",
|
||||
label: "Added At",
|
||||
render: (n) => new Date(n).toLocaleString(),
|
||||
},
|
||||
];
|
||||
|
||||
export function Accounts() {
|
||||
const { auth } = use(RouterContext);
|
||||
const [items] = useQuery(queries.getItems(auth));
|
||||
const [deleting, setDeleting] = useState<typeof items>([]);
|
||||
const [isAddOpen, setIsAddOpen] = useState(false);
|
||||
|
||||
const z = useZero<Schema, Mutators>();
|
||||
|
||||
const onDelete = () => {
|
||||
if (!deleting) return;
|
||||
const accountIds = deleting.map((account) => account.id);
|
||||
z.mutate.link.deleteAccounts({ accountIds });
|
||||
setDeleting([]);
|
||||
};
|
||||
|
||||
const addAccount = () => {
|
||||
setIsAddOpen(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Table.Provider columns={COLUMNS} data={items}>
|
||||
<Table.Body />
|
||||
</Table.Provider>
|
||||
<>
|
||||
<Dialog.Provider
|
||||
visible={deleting.length > 0}
|
||||
close={() => setDeleting([])}
|
||||
>
|
||||
<Dialog.Content>
|
||||
<Text style={{ fontFamily: "mono" }}>Delete Account</Text>
|
||||
<Text style={{ fontFamily: "mono" }}> </Text>
|
||||
<Text style={{ fontFamily: "mono" }}>
|
||||
You are about to delete the following accounts:
|
||||
</Text>
|
||||
|
||||
<View>
|
||||
{deleting.map((account) => (
|
||||
<Text style={{ fontFamily: "mono" }}>- {account.name}</Text>
|
||||
))}
|
||||
</View>
|
||||
|
||||
<Text style={{ fontFamily: "mono" }}> </Text>
|
||||
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
<Button
|
||||
variant="secondary"
|
||||
onPress={() => {
|
||||
setDeleting([]);
|
||||
}}
|
||||
shortcut="n"
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
|
||||
<Text style={{ fontFamily: "mono" }}> </Text>
|
||||
|
||||
<Button
|
||||
variant="destructive"
|
||||
onPress={() => {
|
||||
onDelete();
|
||||
}}
|
||||
shortcut="y"
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
</View>
|
||||
</Dialog.Content>
|
||||
</Dialog.Provider>
|
||||
|
||||
<Dialog.Provider visible={isAddOpen} close={() => setIsAddOpen(false)}>
|
||||
<Dialog.Content>
|
||||
<Text style={{ fontFamily: "mono" }}>Add Account</Text>
|
||||
<AddAccount />
|
||||
</Dialog.Content>
|
||||
</Dialog.Provider>
|
||||
|
||||
<View style={{ padding: 10 }}>
|
||||
<View style={{ alignSelf: "flex-start" }}>
|
||||
<Button shortcut="a" onPress={addAccount}>
|
||||
Add Account
|
||||
</Button>
|
||||
</View>
|
||||
|
||||
<Text style={{ fontFamily: "mono" }}> </Text>
|
||||
|
||||
<Table.Provider
|
||||
columns={COLUMNS}
|
||||
data={items}
|
||||
onKey={(key, selected) => {
|
||||
if (key.name == "d") {
|
||||
setDeleting(selected);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Table.Body />
|
||||
</Table.Provider>
|
||||
</View>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function AddAccount() {
|
||||
const rpc = useRpc();
|
||||
const createLink = useAtomSet(rpc.mutation("CreateLink"), {
|
||||
mode: "promiseExit",
|
||||
});
|
||||
|
||||
const [href, setHref] = useState("");
|
||||
|
||||
// const [link, details] = useQuery(queries.getPlaidLink(auth));
|
||||
const { close } = use(Dialog.Context);
|
||||
|
||||
const init = () => {
|
||||
console.log("INIT");
|
||||
const p = createLink({ payload: void 0 })
|
||||
.then((link) => {
|
||||
console.log("my link", link);
|
||||
if (Exit.isSuccess(link)) {
|
||||
setHref(link.value.href);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
console.log("WHAT");
|
||||
});
|
||||
console.log(p);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log("useEffect");
|
||||
init();
|
||||
}, []);
|
||||
|
||||
// const openLink = () => {
|
||||
// if (!link) return;
|
||||
// Linking.openURL(link.link);
|
||||
// };
|
||||
|
||||
// const z = useZero<Schema, Mutators>();
|
||||
|
||||
// useEffect(() => {
|
||||
// console.log(link, details);
|
||||
// if (details.type != "complete") return;
|
||||
// if (link != undefined) {
|
||||
// if (!link.completeAt) {
|
||||
// const timer = setInterval(() => {
|
||||
// console.log("Checking for link");
|
||||
// z.mutate.link.get({ link_token: link.token });
|
||||
// }, 1000 * 5);
|
||||
// return () => clearInterval(timer);
|
||||
// } else {
|
||||
// if (close) close();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// console.log("Creating new link");
|
||||
// z.mutate.link.create();
|
||||
// }, [link, details]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Text>Href: {href}</Text>
|
||||
<Button onPress={() => close && close()}>close</Button>
|
||||
{/* {link ? ( */}
|
||||
{/* <> */}
|
||||
{/* <Text style={{ fontFamily: "mono" }}> */}
|
||||
{/* Please click the button to complete setup. */}
|
||||
{/* </Text> */}
|
||||
{/**/}
|
||||
{/* <Button shortcut="return" onPress={openLink}> */}
|
||||
{/* Open Plaid */}
|
||||
{/* </Button> */}
|
||||
{/* </> */}
|
||||
{/* ) : ( */}
|
||||
{/* <Text style={{ fontFamily: "mono" }}>Loading Plaid Link</Text> */}
|
||||
{/* )} */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Text } from "react-native";
|
||||
|
||||
export function Family() {
|
||||
return <Text style={{ fontFamily: 'mono' }}>Welcome to family</Text>
|
||||
return <Text style={{ fontFamily: "mono" }}>Welcome to family</Text>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Text } from "react-native";
|
||||
|
||||
export function General() {
|
||||
return <Text style={{ fontFamily: 'mono' }}>Welcome to settings</Text>
|
||||
return <Text style={{ fontFamily: "mono" }}>Welcome to settings</Text>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
import { createContext, use, useState, type ReactNode } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { useKeyboard } from "./useKeyboard";
|
||||
|
||||
const HEADER_COLOR = '#7158e2';
|
||||
const TABLE_COLORS = [
|
||||
'#ddd',
|
||||
'#eee'
|
||||
];
|
||||
const SELECTED_COLOR = '#f7b730';
|
||||
|
||||
|
||||
const EXTRA = 5;
|
||||
|
||||
export type ValidRecord = Record<string, string | number | null>;
|
||||
|
||||
interface TableState {
|
||||
data: unknown[];
|
||||
columns: Column[];
|
||||
columnMap: Map<string, number>;
|
||||
idx: number;
|
||||
selectedFrom: number | undefined;
|
||||
};
|
||||
|
||||
|
||||
const INITAL_STATE = {
|
||||
data: [],
|
||||
columns: [],
|
||||
columnMap: new Map(),
|
||||
idx: 0,
|
||||
selectedFrom: undefined,
|
||||
} satisfies TableState;
|
||||
|
||||
export const Context = createContext<TableState>(INITAL_STATE);
|
||||
|
||||
export type Column = { name: string, label: string, render?: (i: number | string) => string };
|
||||
|
||||
|
||||
function renderCell(row: ValidRecord, column: Column): string {
|
||||
const cell = row[column.name];
|
||||
if (cell == undefined) return 'n/a';
|
||||
if (cell == null) return 'null';
|
||||
if (column.render) return column.render(cell);
|
||||
return cell.toString();
|
||||
}
|
||||
|
||||
|
||||
export interface ProviderProps<T> {
|
||||
data: T[];
|
||||
columns: Column[];
|
||||
children: ReactNode;
|
||||
};
|
||||
export function Provider<T extends ValidRecord>({ data, columns, children }: ProviderProps<T>) {
|
||||
const [idx, setIdx] = useState(0);
|
||||
const [selectedFrom, setSelectedFrom] = useState<number>();
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.name == 'j' || key.name == 'down') {
|
||||
if (key.shift && selectedFrom == undefined) {
|
||||
setSelectedFrom(idx);
|
||||
}
|
||||
setIdx((prev) => Math.min(prev + 1, data.length - 1));
|
||||
} else if (key.name == 'k' || key.name == 'up') {
|
||||
if (key.shift && selectedFrom == undefined) {
|
||||
setSelectedFrom(idx);
|
||||
}
|
||||
setIdx((prev) => Math.max(prev - 1, 0));
|
||||
} else if (key.name == 'g' && key.shift) {
|
||||
setIdx(data.length - 1);
|
||||
} else if (key.name == 'v') {
|
||||
setSelectedFrom(idx);
|
||||
} else if (key.name == 'escape') {
|
||||
setSelectedFrom(undefined);
|
||||
}
|
||||
}, [data, idx]);
|
||||
|
||||
|
||||
const columnMap = new Map(columns.map(col => {
|
||||
return [col.name, Math.max(col.label.length, ...data.map(row => renderCell(row, col).length))]
|
||||
}));
|
||||
|
||||
|
||||
return (
|
||||
<Context.Provider value={{ data, columns, columnMap, idx, selectedFrom }}>
|
||||
{children}
|
||||
</Context.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function Body() {
|
||||
const { columns, data, columnMap, idx, selectedFrom } = use(Context);
|
||||
return (
|
||||
<View>
|
||||
<View style={{ backgroundColor: HEADER_COLOR, flexDirection: 'row' }}>
|
||||
{columns.map(column => <Text key={column.name} style={{ fontFamily: 'mono', color: 'white' }}>{rpad(column.label, columnMap.get(column.name)! - column.label.length + EXTRA)}</Text>)}
|
||||
</View>
|
||||
{data.map((row, index) => {
|
||||
const isSelected = index == idx || (selectedFrom != undefined && ((selectedFrom <= index && index <= idx) || (idx <= index && index <= selectedFrom)))
|
||||
|
||||
return (
|
||||
<View key={index} style={{ backgroundColor: isSelected ? SELECTED_COLOR : TABLE_COLORS[index % 2] }}>
|
||||
<TableRow key={index} row={row as ValidRecord} index={index} isSelected={isSelected} />
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
interface RowProps<T> {
|
||||
row: T;
|
||||
index: number;
|
||||
isSelected: boolean;
|
||||
}
|
||||
function TableRow<T extends ValidRecord>({ row, isSelected }: RowProps<T>) {
|
||||
const { data, columns, columnMap } = use(Context);
|
||||
|
||||
|
||||
return <View style={{ flexDirection: 'row' }}>
|
||||
{columns.map(column => {
|
||||
const rendered = renderCell(row, column);
|
||||
return <Text key={column.name} style={{ fontFamily: 'mono', color: isSelected ? 'black' : 'black' }}>{rpad(rendered, columnMap.get(column.name)! - rendered.length + EXTRA)}</Text>;
|
||||
})}
|
||||
</View>
|
||||
}
|
||||
|
||||
function rpad(input: string, length: number): string {
|
||||
return input + Array.from({ length })
|
||||
.map(_ => " ")
|
||||
.join("");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import * as Table from "./table";
|
||||
import { useQuery } from "@rocicorp/zero/react";
|
||||
import { queries, type Transaction } from '@money/shared';
|
||||
import * as Table from "../components/Table";
|
||||
import { useQuery, useZero } from "@rocicorp/zero/react";
|
||||
import {
|
||||
queries,
|
||||
type Mutators,
|
||||
type Schema,
|
||||
type Transaction,
|
||||
} from "@money/shared";
|
||||
import { use } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { RouterContext } from ".";
|
||||
|
||||
|
||||
const FORMAT = new Intl.NumberFormat("en-US", {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
@@ -14,40 +18,55 @@ const FORMAT = new Intl.NumberFormat("en-US", {
|
||||
export type Account = {
|
||||
name: string;
|
||||
createdAt: number;
|
||||
}
|
||||
};
|
||||
|
||||
const COLUMNS: Table.Column[] = [
|
||||
{ name: 'createdAt', label: 'Date', render: (n) => new Date(n).toDateString() },
|
||||
{ name: 'amount', label: 'Amount' },
|
||||
{ name: 'name', label: 'Name' },
|
||||
{
|
||||
name: "createdAt",
|
||||
label: "Date",
|
||||
render: (n) => new Date(n).toDateString(),
|
||||
},
|
||||
{ name: "amount", label: "Amount" },
|
||||
{ name: "name", label: "Name" },
|
||||
];
|
||||
|
||||
|
||||
export function Transactions() {
|
||||
const { auth } = use(RouterContext);
|
||||
const [items] = useQuery(queries.allTransactions(auth));
|
||||
|
||||
const z = useZero<Schema, Mutators>();
|
||||
|
||||
return (
|
||||
<Table.Provider
|
||||
data={items}
|
||||
columns={COLUMNS} >
|
||||
<Table.Body />
|
||||
{/* Spacer */}
|
||||
<View style={{ flex: 1 }} />
|
||||
<Selected />
|
||||
columns={COLUMNS}
|
||||
onKey={(key) => {
|
||||
if (key.name == "r" && key.shift) {
|
||||
z.mutate.link.updateTransactions();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<View style={{ flex: 1 }}>
|
||||
<View style={{ flexShrink: 0 }}>
|
||||
<Table.Body />
|
||||
</View>
|
||||
</View>
|
||||
<View style={{ flexShrink: 0 }}>
|
||||
<Selected />
|
||||
</View>
|
||||
</Table.Provider>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function Selected() {
|
||||
const { data, idx, selectedFrom } = use(Table.Context);
|
||||
|
||||
if (selectedFrom == undefined)
|
||||
return (
|
||||
<View style={{ backgroundColor: '#ddd' }}>
|
||||
<Text style={{ fontFamily: 'mono' }}>No items selected</Text>
|
||||
</View>
|
||||
);
|
||||
return (
|
||||
<View style={{ backgroundColor: "#ddd" }}>
|
||||
<Text style={{ fontFamily: "mono" }}>No items selected</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
const from = Math.min(idx, selectedFrom);
|
||||
const to = Math.max(idx, selectedFrom);
|
||||
@@ -56,10 +75,11 @@ function Selected() {
|
||||
const sum = selected.reduce((prev, curr) => prev + curr.amount, 0);
|
||||
|
||||
return (
|
||||
<View style={{ backgroundColor: '#9f9' }}>
|
||||
<Text style={{ fontFamily: 'mono' }}>{count} transaction{count == 1 ? "" : "s"} selected | ${FORMAT.format(sum)}</Text>
|
||||
<View style={{ backgroundColor: "#9f9" }}>
|
||||
<Text style={{ fontFamily: "mono" }}>
|
||||
{count} transaction{count == 1 ? "" : "s"} selected | $
|
||||
{FORMAT.format(sum)}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { useKeyboard as useOpentuiKeyboard } from "@opentui/react";
|
||||
|
||||
export function useKeyboard(handler: Parameters<typeof useOpentuiKeyboard>[0], _deps: any[] = []) {
|
||||
export function useKeyboard(
|
||||
handler: Parameters<typeof useOpentuiKeyboard>[0],
|
||||
_deps: any[] = [],
|
||||
) {
|
||||
return useOpentuiKeyboard(handler);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,17 @@ import { useEffect } from "react";
|
||||
import type { KeyboardEvent } from "react";
|
||||
import type { KeyEvent } from "@opentui/core";
|
||||
|
||||
|
||||
function convertName(keyName: string): string {
|
||||
const result = keyName.toLowerCase()
|
||||
if (result == 'arrowdown') return 'down';
|
||||
if (result == 'arrowup') return 'up';
|
||||
const result = keyName.toLowerCase();
|
||||
if (result == "arrowdown") return "down";
|
||||
if (result == "arrowup") return "up";
|
||||
return result;
|
||||
}
|
||||
|
||||
export function useKeyboard(handler: (key: KeyEvent) => void, deps: any[] = []) {
|
||||
export function useKeyboard(
|
||||
handler: (key: KeyEvent) => void,
|
||||
deps: any[] = [],
|
||||
) {
|
||||
useEffect(() => {
|
||||
const handlerWeb = (event: KeyboardEvent) => {
|
||||
// @ts-ignore
|
||||
@@ -20,10 +22,10 @@ export function useKeyboard(handler: (key: KeyEvent) => void, deps: any[] = [])
|
||||
meta: event.metaKey,
|
||||
shift: event.shiftKey,
|
||||
option: event.metaKey,
|
||||
sequence: '',
|
||||
sequence: "",
|
||||
number: false,
|
||||
raw: '',
|
||||
eventType: 'press',
|
||||
raw: "",
|
||||
eventType: "press",
|
||||
source: "raw",
|
||||
code: event.code,
|
||||
super: false,
|
||||
@@ -31,14 +33,15 @@ export function useKeyboard(handler: (key: KeyEvent) => void, deps: any[] = [])
|
||||
capsLock: false,
|
||||
numLock: false,
|
||||
baseCode: event.keyCode,
|
||||
preventDefault: () => event.preventDefault(),
|
||||
});
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
window.addEventListener("keydown", handlerWeb);
|
||||
return () => {
|
||||
// @ts-ignore
|
||||
window.removeEventListener("keydown", handlerWeb);
|
||||
// @ts-ignore
|
||||
window.removeEventListener("keydown", handlerWeb);
|
||||
};
|
||||
}, deps);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
},
|
||||
// Environment setup & latest features
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
|
||||
298
pnpm-lock.yaml
generated
298
pnpm-lock.yaml
generated
@@ -10,18 +10,24 @@ importers:
|
||||
|
||||
apps/api:
|
||||
dependencies:
|
||||
'@hono/node-server':
|
||||
specifier: ^1.19.5
|
||||
version: 1.19.6(hono@4.10.4)
|
||||
'@effect/platform':
|
||||
specifier: ^0.93.2
|
||||
version: 0.93.2(effect@3.19.4)
|
||||
'@effect/platform-node':
|
||||
specifier: ^0.101.1
|
||||
version: 0.101.1(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/rpc':
|
||||
specifier: ^0.72.2
|
||||
version: 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@money/shared':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/shared
|
||||
better-auth:
|
||||
specifier: ^1.3.27
|
||||
version: 1.3.34(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
hono:
|
||||
specifier: ^4.9.12
|
||||
version: 4.10.4
|
||||
effect:
|
||||
specifier: ^3.19.4
|
||||
version: 3.19.4
|
||||
plaid:
|
||||
specifier: ^39.0.0
|
||||
version: 39.1.0
|
||||
@@ -38,6 +44,9 @@ importers:
|
||||
'@better-auth/expo':
|
||||
specifier: ^1.3.27
|
||||
version: 1.3.34(better-auth@1.3.34(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(expo-constants@18.0.10)(expo-crypto@15.0.7(expo@54.0.23))(expo-linking@8.0.8)(expo-secure-store@15.0.7(expo@54.0.23))(expo-web-browser@15.0.9(expo@54.0.23)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0)))
|
||||
'@effect-atom/atom-react':
|
||||
specifier: ^0.4.0
|
||||
version: 0.4.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)(react@19.1.0)(scheduler@0.26.0)
|
||||
'@expo/vector-icons':
|
||||
specifier: ^15.0.2
|
||||
version: 15.0.3(expo-font@14.0.9(expo@54.0.23)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
||||
@@ -167,7 +176,7 @@ importers:
|
||||
version: 0.93.2(effect@3.19.4)
|
||||
'@effect/platform-bun':
|
||||
specifier: ^0.83.0
|
||||
version: 0.83.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
version: 0.83.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@money/shared':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/shared
|
||||
@@ -175,11 +184,11 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/ui
|
||||
'@opentui/core':
|
||||
specifier: ^0.1.39
|
||||
version: 0.1.39(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)
|
||||
specifier: ^0.1.47
|
||||
version: 0.1.47(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)
|
||||
'@opentui/react':
|
||||
specifier: ^0.1.39
|
||||
version: 0.1.39(react@19.1.0)(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)
|
||||
specifier: ^0.1.47
|
||||
version: 0.1.47(react@19.1.0)(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)
|
||||
'@types/qrcode':
|
||||
specifier: ^1.5.6
|
||||
version: 1.5.6
|
||||
@@ -798,6 +807,21 @@ packages:
|
||||
peerDependencies:
|
||||
'@noble/ciphers': ^1.0.0
|
||||
|
||||
'@effect-atom/atom-react@0.4.0':
|
||||
resolution: {integrity: sha512-5HpKLgXEG8EWr4sBDl7BZjm6koO/5HSb94C9+OkRLDE4mhH2357vNl4uPNqid0ZNGwVvS6bAvKFmBzc0bZU6yg==}
|
||||
peerDependencies:
|
||||
effect: ^3.19
|
||||
react: '>=18 <20'
|
||||
scheduler: '*'
|
||||
|
||||
'@effect-atom/atom@0.4.3':
|
||||
resolution: {integrity: sha512-0XOngJ+oDuJW7/Hgt09Kl8QunF1bGlEtV/K9hMB1MmQPUGb+ZtxfJwZkBeXjMPEL1Lgm04TDBlqB8+qgHz+y0w==}
|
||||
peerDependencies:
|
||||
'@effect/experimental': ^0.57.0
|
||||
'@effect/platform': ^0.93.0
|
||||
'@effect/rpc': ^0.72.1
|
||||
effect: ^3.19.0
|
||||
|
||||
'@effect/cluster@0.52.10':
|
||||
resolution: {integrity: sha512-csmU+4h2MXdxsFKF5eY4N52LDcjdpQp//QivOKNL9yNySUBVz/UrBr1FRgvbfHk+sxY03SNcoTNgkcbUaIp2Pg==}
|
||||
peerDependencies:
|
||||
@@ -838,16 +862,34 @@ packages:
|
||||
'@effect/sql': ^0.48.0
|
||||
effect: ^3.19.0
|
||||
|
||||
'@effect/platform-node-shared@0.54.0':
|
||||
resolution: {integrity: sha512-prTgG3CXqmrxB4Rg6utfwCTqjlGwjAEvK7R4g3HzVdFpfFRum+FQBpGHUcjyz7EejkDtBY2MWJC3Wr1QKDPjPw==}
|
||||
peerDependencies:
|
||||
'@effect/cluster': ^0.53.0
|
||||
'@effect/platform': ^0.93.3
|
||||
'@effect/rpc': ^0.72.2
|
||||
'@effect/sql': ^0.48.0
|
||||
effect: ^3.19.5
|
||||
|
||||
'@effect/platform-node@0.101.1':
|
||||
resolution: {integrity: sha512-uShujtpWU0VbdhRKhoo6tXzTG1xT0bnj8u5Q1BHpanwKPmzOhf4n0XLlMl5PaihH5Cp7xHuQlwgZlqHzhqSHzw==}
|
||||
peerDependencies:
|
||||
'@effect/cluster': ^0.53.4
|
||||
'@effect/platform': ^0.93.3
|
||||
'@effect/rpc': ^0.72.2
|
||||
'@effect/sql': ^0.48.0
|
||||
effect: ^3.19.6
|
||||
|
||||
'@effect/platform@0.93.2':
|
||||
resolution: {integrity: sha512-IFWF2xuz37tZbyEsf3hwBlcYYqbqJho+ZM871CG92lWJSjcTgvmjCy77qnV0QhTWVdh9BMs12QKzQCMlqz4cJQ==}
|
||||
peerDependencies:
|
||||
effect: ^3.19.3
|
||||
|
||||
'@effect/rpc@0.72.1':
|
||||
resolution: {integrity: sha512-crpiAxDvFxM/fGhLuAgB1V8JOtfCm8/6ZdOP4MIdkz14I/ff3LdLJpf8hHJpYIbwYXypglAeAaHpfuZOt5f+SA==}
|
||||
'@effect/rpc@0.72.2':
|
||||
resolution: {integrity: sha512-BmTXybXCOq96D2r9mvSW/YdiTQs5CStnd4II+lfVKrMr3pMNERKLZ2LG37Tfm4Sy3Q8ire6IVVKO/CN+VR0uQQ==}
|
||||
peerDependencies:
|
||||
'@effect/platform': ^0.93.0
|
||||
effect: ^3.19.0
|
||||
'@effect/platform': ^0.93.3
|
||||
effect: ^3.19.5
|
||||
|
||||
'@effect/sql@0.48.0':
|
||||
resolution: {integrity: sha512-tubdizHriDwzHUnER9UsZ/0TtF6O2WJckzeYDbVSRPeMkrpdpyEzEsoKctechTm65B3Bxy6JIixGPg2FszY72A==}
|
||||
@@ -1534,12 +1576,6 @@ packages:
|
||||
'@hexagon/base64@1.1.28':
|
||||
resolution: {integrity: sha512-lhqDEAvWixy3bZ+UOYbPwUbBkwBq5C1LAJ/xPC8Oi+lL54oyakv/npbA0aU2hgCsx/1NUd4IBvV03+aUBWxerw==}
|
||||
|
||||
'@hono/node-server@1.19.6':
|
||||
resolution: {integrity: sha512-Shz/KjlIeAhfiuE93NDKVdZ7HdBVLQAfdbaXEaoAVO3ic9ibRSLGIQGkcBbFyuLr+7/1D5ZCINM8B+6IvXeMtw==}
|
||||
engines: {node: '>=18.14.1'}
|
||||
peerDependencies:
|
||||
hono: ^4
|
||||
|
||||
'@humanfs/core@0.19.1':
|
||||
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
|
||||
engines: {node: '>=18.18.0'}
|
||||
@@ -2299,43 +2335,43 @@ packages:
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.1.0
|
||||
|
||||
'@opentui/core-darwin-arm64@0.1.39':
|
||||
resolution: {integrity: sha512-tDUdNdzGeylkDWTiDIy/CalM/9nIeDwMZGN0Q6FLqABnAplwBhdIH2w/gInAcMaTyagm7Qk88p398Wbnxa9uyg==}
|
||||
'@opentui/core-darwin-arm64@0.1.47':
|
||||
resolution: {integrity: sha512-0/u4VkJJPvW24cZzMaKf6Dm+VzeO1a94l6NV3AQ1Wb+pPTEyOmNWkRvj03ZrRLMCyQduaFVtlnor8DVCk6OHuQ==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@opentui/core-darwin-x64@0.1.39':
|
||||
resolution: {integrity: sha512-dWXXNUpdi3ndd+6WotQezsO7g54MLSc/6DmYcl0p7fZrQFct8fX0c9ny/S0xAusNHgBGVS5j5FWE75Mx79301Q==}
|
||||
'@opentui/core-darwin-x64@0.1.47':
|
||||
resolution: {integrity: sha512-y1+c/e+IaZAj5N02GnD+oaubbb5JiW5eKgF0h58kw73iXDMfynuoGOpREz58i1rUFYOMYJGdrSjEHtXk2pD2XA==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@opentui/core-linux-arm64@0.1.39':
|
||||
resolution: {integrity: sha512-ookQbxLjsg51iwGb6/KTxCfiVRtE9lSE2OVFLLYork8iVzxg81jX29Uoxe1knZ8FjOJ0+VqTzex2IqQH6mjJlw==}
|
||||
'@opentui/core-linux-arm64@0.1.47':
|
||||
resolution: {integrity: sha512-ZESHmqILtfb6FFEfi40JGKl8z0+LhOSoHgfOK1PPyuyRT9Mk8uXeQgPMF5W6Ac0pp4w+uWVC4TrFjijCCSiaUQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@opentui/core-linux-x64@0.1.39':
|
||||
resolution: {integrity: sha512-CeXVNa3hB7gTYKYoZAuMtxWMIXn2rPhmXLkHKpEvXvDRjODFDk8wN1AIVnT5tfncXbWNa5z35BhmqewpGkl4oQ==}
|
||||
'@opentui/core-linux-x64@0.1.47':
|
||||
resolution: {integrity: sha512-qfvy1qshgnZMcAHQ3MS093IBjxM2pPx+kEnW7icsyud60zoJgoUugdN2kjgJiIJiYX3f3PgE68J6CVW2MCtYfQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@opentui/core-win32-arm64@0.1.39':
|
||||
resolution: {integrity: sha512-eeBrVOHz7B+JNZ+w7GH6QxXhXQVBxI6jHmw3B05czG905Je62P0skZNHxiol2BZRawDljo1J/nXQdO5XPeAk2A==}
|
||||
'@opentui/core-win32-arm64@0.1.47':
|
||||
resolution: {integrity: sha512-f6OoPnaz303H6fudi8blS+iEcJtlFlcqdBoWnWnJQfN9rLmajW3Yf7RfpNOoLUlDcwxQLyTL/5EHwbcG8D4r7A==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@opentui/core-win32-x64@0.1.39':
|
||||
resolution: {integrity: sha512-lLXeQUBg6Wlenauwd+xaBD+0HT4YIcONeZUTHA+Gyd/rqVhxId97rhhzFikp3bBTvNJlYAscJI3yIF2JvRiFNQ==}
|
||||
'@opentui/core-win32-x64@0.1.47':
|
||||
resolution: {integrity: sha512-lQnJg7FucyyTbN/ybTj5FZ7S8OAfT5KxXDR5l9Sla7R5MIDY6nBXYM3GWeF81jzDd4K4Z/0hxNFtWSopEXRFYg==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@opentui/core@0.1.39':
|
||||
resolution: {integrity: sha512-5gPyg3X/8Nr80RfNEJFiMM8Tj01VFfvFwEMCMQrDiOhmSfFXSH2grF/KPl2bnd2Qa13maXWFEl6W3aATObnrnQ==}
|
||||
'@opentui/core@0.1.47':
|
||||
resolution: {integrity: sha512-gKcYX9EJ/e5VLEwBH2kalDr5xoI9MEanzQV7uV3Sb2Z9+ndwEUShKKna3odN8g4E20c4sX2VpwmB9hhl3Tsd9w==}
|
||||
peerDependencies:
|
||||
web-tree-sitter: 0.25.10
|
||||
|
||||
'@opentui/react@0.1.39':
|
||||
resolution: {integrity: sha512-+d7ftMccu3+jL4jytEEDUX0B0cQjR7PvDHIcdyysog+/WripJq/7q+g0TeNopvTWRWs+VkUrOyhODrT4ImhSYA==}
|
||||
'@opentui/react@0.1.47':
|
||||
resolution: {integrity: sha512-UU/3jnBFC5VGKn73aKEmOSIcaltIg7SnEImYv9Zte4cpA7IZmax/+nfQ+3596Z9K2iDyCUS2wOyZYjnSCDew9A==}
|
||||
peerDependencies:
|
||||
react: '>=19.0.0'
|
||||
|
||||
@@ -3598,8 +3634,8 @@ packages:
|
||||
buffer@6.0.3:
|
||||
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
||||
|
||||
bun-ffi-structs@0.1.0:
|
||||
resolution: {integrity: sha512-NoRfJ81pgLIHCzw624/2GS2FuxcU0G4SRJww/4PXvheNVUPSIUjkOC6v1/8rk66tJVCb9oR0D6rDNKK0qT5O2Q==}
|
||||
bun-ffi-structs@0.1.2:
|
||||
resolution: {integrity: sha512-Lh1oQAYHDcnesJauieA4UNkWGXY9hYck7OA5IaRwE3Bp6K2F2pJSNYqq+hIy7P3uOvo3km3oxS8304g5gDMl/w==}
|
||||
peerDependencies:
|
||||
typescript: ^5
|
||||
|
||||
@@ -3608,28 +3644,28 @@ packages:
|
||||
peerDependencies:
|
||||
'@types/react': ^19
|
||||
|
||||
bun-webgpu-darwin-arm64@0.1.3:
|
||||
resolution: {integrity: sha512-KkNQ9gT7dxGDndQaHTTHss9miukqpczML3pO2nZJoT/nITwe9lw3ZGFJMujkW41BUQ1mDYKFgo5nBGf9xYHPAg==}
|
||||
bun-webgpu-darwin-arm64@0.1.4:
|
||||
resolution: {integrity: sha512-eDgLN9teKTfmvrCqgwwmWNsNszxYs7IZdCqk0S1DCarvMhr4wcajoSBlA/nQA0/owwLduPTS8xxCnQp4/N/gDg==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
bun-webgpu-darwin-x64@0.1.3:
|
||||
resolution: {integrity: sha512-TODWnMUbCoqD/wqzlB3oGOBIUWIFly0lqMeBFz/MBV+ndjbnkNrP9huaZJCTkCVEPKGtd1FCM3ExZUtBbnGziA==}
|
||||
bun-webgpu-darwin-x64@0.1.4:
|
||||
resolution: {integrity: sha512-X+PjwJUWenUmdQBP8EtdItMyieQ6Nlpn+BH518oaouDiSnWj5+b0Y7DNDZJq7Ezom4EaxmqL/uGYZK3aCQ7CXg==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
bun-webgpu-linux-x64@0.1.3:
|
||||
resolution: {integrity: sha512-lVHORoVu1G61XVM8CRRqUsqr6w8kMlpuSpbPGpKUpmvrsoay6ymXAhT5lRPKyrGNamHUQTknmWdI59aRDCfLtQ==}
|
||||
bun-webgpu-linux-x64@0.1.4:
|
||||
resolution: {integrity: sha512-zMLs2YIGB+/jxrYFXaFhVKX/GBt05UTF45lc9srcHc9JXGjEj+12CIo1CHLTAWatXMTqt0Jsu6ukWEoWVT/ayA==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
bun-webgpu-win32-x64@0.1.3:
|
||||
resolution: {integrity: sha512-vlspsFffctJlBnFfs2lW3QgDD6LyFu8VT18ryID7Qka5poTj0clGVRxz7DFRi7yva3GovEGw/82z/WVc5US8Pw==}
|
||||
bun-webgpu-win32-x64@0.1.4:
|
||||
resolution: {integrity: sha512-Z5yAK28xrcm8Wb5k7TZ8FJKpOI/r+aVCRdlHYAqI2SDJFN3nD4mJs900X6kNVmG/xFzb5yOuKVYWGg+6ZXWbyA==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
bun-webgpu@0.1.3:
|
||||
resolution: {integrity: sha512-IXFxaIi4rgsEEpl9n/QVDm5RajCK/0FcOXZeMb52YRjoiAR1YVYK5hLrXT8cm+KDi6LVahA9GJFqOR4yiloVCw==}
|
||||
bun-webgpu@0.1.4:
|
||||
resolution: {integrity: sha512-Kw+HoXl1PMWJTh9wvh63SSRofTA8vYBFCw0XEP1V1fFdQEDhI8Sgf73sdndE/oDpN/7CMx0Yv/q8FCvO39ROMQ==}
|
||||
|
||||
bytes@3.1.2:
|
||||
resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
|
||||
@@ -4867,10 +4903,6 @@ packages:
|
||||
hoist-non-react-statics@3.3.2:
|
||||
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
|
||||
|
||||
hono@4.10.4:
|
||||
resolution: {integrity: sha512-YG/fo7zlU3KwrBL5vDpWKisLYiM+nVstBQqfr7gCPbSYURnNEP9BDxEMz8KfsDR9JX0lJWDRNc6nXX31v7ZEyg==}
|
||||
engines: {node: '>=16.9.0'}
|
||||
|
||||
hosted-git-info@7.0.2:
|
||||
resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==}
|
||||
engines: {node: ^16.14.0 || >=18.0.0}
|
||||
@@ -6888,6 +6920,10 @@ packages:
|
||||
resolution: {integrity: sha512-hU/10obOIu62MGYjdskASR3CUAiYaFTtC9Pa6vHyf//mAipSvSQg6od2CnJswq7fvzNS3zJhxoRkgNVaHurWKw==}
|
||||
engines: {node: '>=18.17'}
|
||||
|
||||
undici@7.16.0:
|
||||
resolution: {integrity: sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==}
|
||||
engines: {node: '>=20.18.1'}
|
||||
|
||||
unicode-canonical-property-names-ecmascript@2.0.1:
|
||||
resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -7895,12 +7931,30 @@ snapshots:
|
||||
dependencies:
|
||||
'@noble/ciphers': 1.3.0
|
||||
|
||||
'@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
'@effect-atom/atom-react@0.4.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)(react@19.1.0)(scheduler@0.26.0)':
|
||||
dependencies:
|
||||
'@effect-atom/atom': 0.4.3(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
effect: 3.19.4
|
||||
react: 19.1.0
|
||||
scheduler: 0.26.0
|
||||
transitivePeerDependencies:
|
||||
- '@effect/experimental'
|
||||
- '@effect/platform'
|
||||
- '@effect/rpc'
|
||||
|
||||
'@effect-atom/atom@0.4.3(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/experimental': 0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
effect: 3.19.4
|
||||
|
||||
'@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/sql': 0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/workflow': 0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/workflow': 0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
effect: 3.19.4
|
||||
|
||||
'@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)':
|
||||
@@ -7909,12 +7963,12 @@ snapshots:
|
||||
effect: 3.19.4
|
||||
uuid: 11.1.0
|
||||
|
||||
'@effect/platform-bun@0.83.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
'@effect/platform-bun@0.83.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/cluster': 0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/cluster': 0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
'@effect/platform-node-shared': 0.53.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/platform-node-shared': 0.53.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/sql': 0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
effect: 3.19.4
|
||||
multipasta: 0.2.7
|
||||
@@ -7922,11 +7976,11 @@ snapshots:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@effect/platform-node-shared@0.53.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
'@effect/platform-node-shared@0.53.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/cluster': 0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/cluster': 0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/sql': 0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@parcel/watcher': 2.5.1
|
||||
effect: 3.19.4
|
||||
@@ -7936,6 +7990,35 @@ snapshots:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@effect/platform-node-shared@0.54.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/cluster': 0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/sql': 0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@parcel/watcher': 2.5.1
|
||||
effect: 3.19.4
|
||||
multipasta: 0.2.7
|
||||
ws: 8.18.3
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@effect/platform-node@0.101.1(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/cluster': 0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
'@effect/platform-node-shared': 0.54.0(@effect/cluster@0.52.10(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/sql@0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/sql': 0.48.0(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
effect: 3.19.4
|
||||
mime: 3.0.0
|
||||
undici: 7.16.0
|
||||
ws: 8.18.3
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@effect/platform@0.93.2(effect@3.19.4)':
|
||||
dependencies:
|
||||
effect: 3.19.4
|
||||
@@ -7943,7 +8026,7 @@ snapshots:
|
||||
msgpackr: 1.11.5
|
||||
multipasta: 0.2.7
|
||||
|
||||
'@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)':
|
||||
'@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
effect: 3.19.4
|
||||
@@ -7956,11 +8039,11 @@ snapshots:
|
||||
effect: 3.19.4
|
||||
uuid: 11.1.0
|
||||
|
||||
'@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
'@effect/workflow@0.12.5(@effect/experimental@0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(@effect/platform@0.93.2(effect@3.19.4))(@effect/rpc@0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4))(effect@3.19.4)':
|
||||
dependencies:
|
||||
'@effect/experimental': 0.57.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/platform': 0.93.2(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.1(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
'@effect/rpc': 0.72.2(@effect/platform@0.93.2(effect@3.19.4))(effect@3.19.4)
|
||||
effect: 3.19.4
|
||||
|
||||
'@egjs/hammerjs@2.0.17':
|
||||
@@ -8414,6 +8497,7 @@ snapshots:
|
||||
- graphql
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
optional: true
|
||||
|
||||
'@expo/code-signing-certificates@0.0.5':
|
||||
dependencies:
|
||||
@@ -8480,6 +8564,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
react: 19.2.0
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
optional: true
|
||||
|
||||
'@expo/env@2.0.7':
|
||||
dependencies:
|
||||
@@ -8558,7 +8643,7 @@ snapshots:
|
||||
postcss: 8.4.49
|
||||
resolve-from: 5.0.0
|
||||
optionalDependencies:
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0))(react@19.2.0)
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
@@ -8637,7 +8722,7 @@ snapshots:
|
||||
'@expo/json-file': 10.0.7
|
||||
'@react-native/normalize-colors': 0.81.5
|
||||
debug: 4.4.3
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0))(react@19.2.0)
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
||||
resolve-from: 5.0.0
|
||||
semver: 7.7.3
|
||||
xml2js: 0.6.0
|
||||
@@ -8665,6 +8750,7 @@ snapshots:
|
||||
expo-font: 14.0.9(expo@54.0.23)(react-native@0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0))(react@19.2.0)
|
||||
react: 19.2.0
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
optional: true
|
||||
|
||||
'@expo/ws-tunnel@1.0.6': {}
|
||||
|
||||
@@ -8736,10 +8822,6 @@ snapshots:
|
||||
|
||||
'@hexagon/base64@1.1.28': {}
|
||||
|
||||
'@hono/node-server@1.19.6(hono@4.10.4)':
|
||||
dependencies:
|
||||
hono: 4.10.4
|
||||
|
||||
'@humanfs/core@0.19.1': {}
|
||||
|
||||
'@humanfs/node@0.16.7':
|
||||
@@ -9805,48 +9887,48 @@ snapshots:
|
||||
'@opentelemetry/api': 1.9.0
|
||||
'@opentelemetry/core': 2.2.0(@opentelemetry/api@1.9.0)
|
||||
|
||||
'@opentui/core-darwin-arm64@0.1.39':
|
||||
'@opentui/core-darwin-arm64@0.1.47':
|
||||
optional: true
|
||||
|
||||
'@opentui/core-darwin-x64@0.1.39':
|
||||
'@opentui/core-darwin-x64@0.1.47':
|
||||
optional: true
|
||||
|
||||
'@opentui/core-linux-arm64@0.1.39':
|
||||
'@opentui/core-linux-arm64@0.1.47':
|
||||
optional: true
|
||||
|
||||
'@opentui/core-linux-x64@0.1.39':
|
||||
'@opentui/core-linux-x64@0.1.47':
|
||||
optional: true
|
||||
|
||||
'@opentui/core-win32-arm64@0.1.39':
|
||||
'@opentui/core-win32-arm64@0.1.47':
|
||||
optional: true
|
||||
|
||||
'@opentui/core-win32-x64@0.1.39':
|
||||
'@opentui/core-win32-x64@0.1.47':
|
||||
optional: true
|
||||
|
||||
'@opentui/core@0.1.39(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)':
|
||||
'@opentui/core@0.1.47(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)':
|
||||
dependencies:
|
||||
bun-ffi-structs: 0.1.0(typescript@5.9.3)
|
||||
bun-ffi-structs: 0.1.2(typescript@5.9.3)
|
||||
jimp: 1.6.0
|
||||
web-tree-sitter: 0.25.10
|
||||
yoga-layout: 3.2.1
|
||||
optionalDependencies:
|
||||
'@dimforge/rapier2d-simd-compat': 0.17.3
|
||||
'@opentui/core-darwin-arm64': 0.1.39
|
||||
'@opentui/core-darwin-x64': 0.1.39
|
||||
'@opentui/core-linux-arm64': 0.1.39
|
||||
'@opentui/core-linux-x64': 0.1.39
|
||||
'@opentui/core-win32-arm64': 0.1.39
|
||||
'@opentui/core-win32-x64': 0.1.39
|
||||
bun-webgpu: 0.1.3
|
||||
'@opentui/core-darwin-arm64': 0.1.47
|
||||
'@opentui/core-darwin-x64': 0.1.47
|
||||
'@opentui/core-linux-arm64': 0.1.47
|
||||
'@opentui/core-linux-x64': 0.1.47
|
||||
'@opentui/core-win32-arm64': 0.1.47
|
||||
'@opentui/core-win32-x64': 0.1.47
|
||||
bun-webgpu: 0.1.4
|
||||
planck: 1.4.2(stage-js@1.0.0-alpha.17)
|
||||
three: 0.177.0
|
||||
transitivePeerDependencies:
|
||||
- stage-js
|
||||
- typescript
|
||||
|
||||
'@opentui/react@0.1.39(react@19.1.0)(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)':
|
||||
'@opentui/react@0.1.47(react@19.1.0)(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)':
|
||||
dependencies:
|
||||
'@opentui/core': 0.1.39(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)
|
||||
'@opentui/core': 0.1.47(stage-js@1.0.0-alpha.17)(typescript@5.9.3)(web-tree-sitter@0.25.10)
|
||||
react: 19.1.0
|
||||
react-reconciler: 0.32.0(react@19.1.0)
|
||||
transitivePeerDependencies:
|
||||
@@ -10671,6 +10753,7 @@ snapshots:
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
optionalDependencies:
|
||||
'@types/react': 19.1.17
|
||||
optional: true
|
||||
|
||||
'@react-navigation/bottom-tabs@7.8.4(@react-navigation/native@7.1.19(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-safe-area-context@5.6.2(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-screens@4.16.0(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)':
|
||||
dependencies:
|
||||
@@ -11536,7 +11619,7 @@ snapshots:
|
||||
resolve-from: 5.0.0
|
||||
optionalDependencies:
|
||||
'@babel/runtime': 7.28.4
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0))(react@19.2.0)
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
||||
transitivePeerDependencies:
|
||||
- '@babel/core'
|
||||
- supports-color
|
||||
@@ -11654,7 +11737,7 @@ snapshots:
|
||||
base64-js: 1.5.1
|
||||
ieee754: 1.2.1
|
||||
|
||||
bun-ffi-structs@0.1.0(typescript@5.9.3):
|
||||
bun-ffi-structs@0.1.2(typescript@5.9.3):
|
||||
dependencies:
|
||||
typescript: 5.9.3
|
||||
|
||||
@@ -11664,26 +11747,26 @@ snapshots:
|
||||
'@types/react': 19.1.17
|
||||
optional: true
|
||||
|
||||
bun-webgpu-darwin-arm64@0.1.3:
|
||||
bun-webgpu-darwin-arm64@0.1.4:
|
||||
optional: true
|
||||
|
||||
bun-webgpu-darwin-x64@0.1.3:
|
||||
bun-webgpu-darwin-x64@0.1.4:
|
||||
optional: true
|
||||
|
||||
bun-webgpu-linux-x64@0.1.3:
|
||||
bun-webgpu-linux-x64@0.1.4:
|
||||
optional: true
|
||||
|
||||
bun-webgpu-win32-x64@0.1.3:
|
||||
bun-webgpu-win32-x64@0.1.4:
|
||||
optional: true
|
||||
|
||||
bun-webgpu@0.1.3:
|
||||
bun-webgpu@0.1.4:
|
||||
dependencies:
|
||||
'@webgpu/types': 0.1.66
|
||||
optionalDependencies:
|
||||
bun-webgpu-darwin-arm64: 0.1.3
|
||||
bun-webgpu-darwin-x64: 0.1.3
|
||||
bun-webgpu-linux-x64: 0.1.3
|
||||
bun-webgpu-win32-x64: 0.1.3
|
||||
bun-webgpu-darwin-arm64: 0.1.4
|
||||
bun-webgpu-darwin-x64: 0.1.4
|
||||
bun-webgpu-linux-x64: 0.1.4
|
||||
bun-webgpu-win32-x64: 0.1.4
|
||||
optional: true
|
||||
|
||||
bytes@3.1.2: {}
|
||||
@@ -12537,6 +12620,7 @@ snapshots:
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
optional: true
|
||||
|
||||
expo-constants@18.0.10(expo@54.0.23)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0)):
|
||||
dependencies:
|
||||
@@ -12555,6 +12639,7 @@ snapshots:
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
optional: true
|
||||
|
||||
expo-crypto@15.0.7(expo@54.0.23):
|
||||
dependencies:
|
||||
@@ -12570,6 +12655,7 @@ snapshots:
|
||||
dependencies:
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0))(react@19.2.0)
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
optional: true
|
||||
|
||||
expo-font@14.0.9(expo@54.0.23)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
|
||||
dependencies:
|
||||
@@ -12584,6 +12670,7 @@ snapshots:
|
||||
fontfaceobserver: 2.3.0
|
||||
react: 19.2.0
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
optional: true
|
||||
|
||||
expo-haptics@15.0.7(expo@54.0.23):
|
||||
dependencies:
|
||||
@@ -12606,6 +12693,7 @@ snapshots:
|
||||
dependencies:
|
||||
expo: 54.0.23(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.14)(react-native@0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0))(react@19.2.0)
|
||||
react: 19.2.0
|
||||
optional: true
|
||||
|
||||
expo-linking@8.0.8(expo@54.0.23)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
|
||||
dependencies:
|
||||
@@ -12647,6 +12735,7 @@ snapshots:
|
||||
invariant: 2.2.4
|
||||
react: 19.2.0
|
||||
react-native: 0.82.1(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.2.0)
|
||||
optional: true
|
||||
|
||||
expo-router@6.0.14(@expo/metro-runtime@6.1.2)(@types/react@19.1.17)(expo-constants@18.0.10)(expo-linking@8.0.8)(expo@54.0.23)(react-dom@19.1.0(react@19.1.0))(react-native-gesture-handler@2.28.0(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-reanimated@4.1.3(@babel/core@7.28.5)(react-native-worklets@0.5.1(@babel/core@7.28.5)(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-safe-area-context@5.6.2(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-screens@4.16.0(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-web@0.21.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
|
||||
dependencies:
|
||||
@@ -12862,6 +12951,7 @@ snapshots:
|
||||
- graphql
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
optional: true
|
||||
|
||||
exponential-backoff@3.1.3: {}
|
||||
|
||||
@@ -13214,8 +13304,6 @@ snapshots:
|
||||
dependencies:
|
||||
react-is: 16.13.1
|
||||
|
||||
hono@4.10.4: {}
|
||||
|
||||
hosted-git-info@7.0.2:
|
||||
dependencies:
|
||||
lru-cache: 10.4.3
|
||||
@@ -14991,6 +15079,7 @@ snapshots:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
optional: true
|
||||
|
||||
react-reconciler@0.32.0(react@19.1.0):
|
||||
dependencies:
|
||||
@@ -15058,7 +15147,8 @@ snapshots:
|
||||
|
||||
react@19.1.0: {}
|
||||
|
||||
react@19.2.0: {}
|
||||
react@19.2.0:
|
||||
optional: true
|
||||
|
||||
readable-stream@3.6.2:
|
||||
dependencies:
|
||||
@@ -15764,6 +15854,8 @@ snapshots:
|
||||
|
||||
undici@6.22.0: {}
|
||||
|
||||
undici@7.16.0: {}
|
||||
|
||||
unicode-canonical-property-names-ecmascript@2.0.1: {}
|
||||
|
||||
unicode-match-property-ecmascript@2.0.0:
|
||||
|
||||
@@ -41,7 +41,10 @@ processes:
|
||||
command: |
|
||||
createdb -h localhost -p 5432 -U postgres money 2>/dev/null || true
|
||||
|
||||
psql -h localhost -p 5432 -U postgres -c "ALTER SYSTEM SET wal_level = 'logical';"
|
||||
psql -h localhost -p 5432 -U postgres \
|
||||
-c "ALTER SYSTEM SET wal_level = 'logical';" \
|
||||
-c "ALTER SYSTEM SET timezone = 'UTC'" \
|
||||
-c "SELECT pg_reload_conf();"
|
||||
|
||||
echo "Migration and seeding complete!"
|
||||
depends_on:
|
||||
@@ -59,3 +62,6 @@ processes:
|
||||
depends_on:
|
||||
db:
|
||||
condition: process_healthy
|
||||
|
||||
tunnel:
|
||||
command: cloudflared tunnel --config ~/.cloudflared/config.yml run
|
||||
|
||||
@@ -91,7 +91,7 @@ const moveDirectories = async (userInput) => {
|
||||
userInput === "y"
|
||||
? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
|
||||
: ""
|
||||
}`
|
||||
}`,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`❌ Error during script execution: ${error.message}`);
|
||||
@@ -108,5 +108,5 @@ rl.question(
|
||||
console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
|
||||
rl.close();
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -33,4 +33,3 @@ try {
|
||||
console.error("Failed to update .env.dev:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user