@gettersethya/mira-dashboard 0.1.0-alpha.16 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/api/auth.d.ts +1 -1
- package/dist/src/api/auth.d.ts.map +1 -1
- package/dist/src/api/auth.js +2 -2
- package/dist/src/api/auth.js.map +1 -1
- package/dist/src/api/bootstrap-status.d.ts +1 -1
- package/dist/src/api/bootstrap-status.d.ts.map +1 -1
- package/dist/src/api/bootstrap-status.js +2 -2
- package/dist/src/api/bootstrap-status.js.map +1 -1
- package/dist/src/api/config.d.ts +1 -1
- package/dist/src/api/config.d.ts.map +1 -1
- package/dist/src/api/config.js +2 -2
- package/dist/src/api/config.js.map +1 -1
- package/dist/src/api/crons.d.ts +1 -1
- package/dist/src/api/crons.d.ts.map +1 -1
- package/dist/src/api/crons.js +3 -3
- package/dist/src/api/crons.js.map +1 -1
- package/dist/src/api/register.d.ts +3 -3
- package/dist/src/api/register.d.ts.map +1 -1
- package/dist/src/api/register.js +7 -8
- package/dist/src/api/register.js.map +1 -1
- package/dist/src/api/superadmin.d.ts +3 -3
- package/dist/src/api/superadmin.d.ts.map +1 -1
- package/dist/src/api/superadmin.js +10 -11
- package/dist/src/api/superadmin.js.map +1 -1
- package/dist/src/collection.d.ts +30 -0
- package/dist/src/collection.d.ts.map +1 -0
- package/dist/src/collection.js +15 -0
- package/dist/src/collection.js.map +1 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/router.d.ts +6 -3
- package/dist/src/router.d.ts.map +1 -1
- package/dist/src/router.js +26 -14
- package/dist/src/router.js.map +1 -1
- package/dist/src/superadmin.d.ts +7 -5
- package/dist/src/superadmin.d.ts.map +1 -1
- package/dist/src/superadmin.js +5 -4
- package/dist/src/superadmin.js.map +1 -1
- package/package.json +8 -8
package/dist/src/api/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpServerRequest } from "
|
|
2
|
+
import { HttpServerRequest } from "effect/http";
|
|
3
3
|
import { AppConfig } from "@gettersethya/mira";
|
|
4
4
|
declare const DashboardUnauthorizedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
5
5
|
readonly _tag: "DashboardUnauthorizedError";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAoB,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAoB,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAa,MAAM,oBAAoB,CAAA;;;;AAEzD,qBAAa,0BAA2B,SAAQ,gCAA+C,EAAE,CAAC;CAAG;AAiBrG,eAAO,MAAM,oBAAoB;;;+EAuB0B,CAAA"}
|
package/dist/src/api/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Data, Effect, Redacted } from "effect";
|
|
2
|
-
import { HttpServerRequest } from "
|
|
2
|
+
import { HttpServerRequest } from "effect/http";
|
|
3
3
|
import { AppConfig, verifyJwt } from "@gettersethya/mira";
|
|
4
4
|
export class DashboardUnauthorizedError extends Data.TaggedError("DashboardUnauthorizedError") {
|
|
5
5
|
}
|
|
@@ -21,7 +21,7 @@ export const requireDashboardAuth = Effect.gen(function* () {
|
|
|
21
21
|
return yield* new DashboardUnauthorizedError();
|
|
22
22
|
}
|
|
23
23
|
const config = yield* AppConfig;
|
|
24
|
-
const payload = yield* verifyJwt(token, Redacted.value(config.jwtSecret)).pipe(Effect.
|
|
24
|
+
const payload = yield* verifyJwt(token, Redacted.value(config.jwtSecret)).pipe(Effect.catch(() => new DashboardUnauthorizedError()));
|
|
25
25
|
if (payload.col !== "_superadmin") {
|
|
26
26
|
yield* annotateCurrentSpan("auth.result", "invalid_token");
|
|
27
27
|
return yield* new DashboardUnauthorizedError();
|
package/dist/src/api/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEzD,MAAM,OAAO,0BAA2B,SAAQ,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAK;CAAG;AAErG,SAAS,YAAY,CAAC,GAAwC;IAC5D,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IACzC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACxC,IAAI,CAAC,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,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AAE,eAAe,CAAC,CAAA;IAC1D,KAAK,CAAC,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAA;IAE5D,OAAO,OAAO,CAAA;AAChB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpServerResponse } from "
|
|
2
|
+
import { HttpServerResponse } from "effect/http";
|
|
3
3
|
import { CollectionService } from "@gettersethya/mira";
|
|
4
4
|
export declare const bootstrapStatusRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, import("@gettersethya/mira").CollectionError, CollectionService>;
|
|
5
5
|
//# sourceMappingURL=bootstrap-status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-status.d.ts","sourceRoot":"","sources":["../../../src/api/bootstrap-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bootstrap-status.d.ts","sourceRoot":"","sources":["../../../src/api/bootstrap-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAGtD,eAAO,MAAM,oBAAoB,uHAQ/B,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpServerResponse } from "
|
|
2
|
+
import { HttpServerResponse } from "effect/http";
|
|
3
3
|
import { CollectionService } from "@gettersethya/mira";
|
|
4
4
|
import { SuperAdminCollection } from "../superadmin.js";
|
|
5
5
|
export const bootstrapStatusRoute = Effect.gen(function* () {
|
|
6
6
|
const svc = yield* CollectionService;
|
|
7
7
|
const result = yield* svc.list(SuperAdminCollection, null, 1, { headers: {}, query: {}, admin: true });
|
|
8
8
|
const hasAdmin = result.items.length > 0;
|
|
9
|
-
return HttpServerResponse.
|
|
9
|
+
return HttpServerResponse.jsonUnsafe({
|
|
10
10
|
bootstrapped: hasAdmin,
|
|
11
11
|
message: hasAdmin ? undefined : "No superadmin found. Register the first superadmin account."
|
|
12
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-status.js","sourceRoot":"","sources":["../../../src/api/bootstrap-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bootstrap-status.js","sourceRoot":"","sources":["../../../src/api/bootstrap-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACtD,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAA;IACpC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACtG,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;IACxC,OAAO,kBAAkB,CAAC,UAAU,CAAC;QACnC,YAAY,EAAE,QAAQ;QACtB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,6DAA6D;KAC9F,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/src/api/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpServerResponse } from "
|
|
2
|
+
import { HttpServerResponse } from "effect/http";
|
|
3
3
|
import { AppConfig } from "@gettersethya/mira";
|
|
4
4
|
export declare const configRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, never, AppConfig>;
|
|
5
5
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/api/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/api/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,eAAO,MAAM,WAAW,wEAetB,CAAA"}
|
package/dist/src/api/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Redacted } from "effect";
|
|
2
|
-
import { HttpServerResponse } from "
|
|
2
|
+
import { HttpServerResponse } from "effect/http";
|
|
3
3
|
import { AppConfig } from "@gettersethya/mira";
|
|
4
4
|
export const configRoute = Effect.gen(function* () {
|
|
5
5
|
const config = yield* AppConfig;
|
|
@@ -10,7 +10,7 @@ export const configRoute = Effect.gen(function* () {
|
|
|
10
10
|
jwtSecret: `${Redacted.value(config.jwtSecret).slice(0, 4)}***`,
|
|
11
11
|
useS3: config.useS3
|
|
12
12
|
};
|
|
13
|
-
return HttpServerResponse.
|
|
13
|
+
return HttpServerResponse.jsonUnsafe({
|
|
14
14
|
config: allConfig,
|
|
15
15
|
keys: Object.keys(allConfig)
|
|
16
16
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/api/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/api/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,SAAS,CAAA;IAE/B,MAAM,SAAS,GAA4B;QACzC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,SAAS,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK;QAC/D,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAA;IAED,OAAO,kBAAkB,CAAC,UAAU,CAAC;QACnC,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;KAC7B,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/src/api/crons.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpRouter, HttpServerResponse } from "
|
|
2
|
+
import { HttpRouter, HttpServerResponse } from "effect/http";
|
|
3
3
|
import { CronService } from "@gettersethya/mira";
|
|
4
4
|
export declare const cronsRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, never, CronService>;
|
|
5
5
|
export declare const cronRunNowRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpRouter.RouteContext | CronService>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../../src/api/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../../src/api/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAqB,MAAM,oBAAoB,CAAA;AAEnE,eAAO,MAAM,UAAU,0EAerB,CAAA;AAEF,eAAO,MAAM,eAAe,oGAa3B,CAAA"}
|
package/dist/src/api/crons.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpRouter, HttpServerResponse } from "
|
|
2
|
+
import { HttpRouter, HttpServerResponse } from "effect/http";
|
|
3
3
|
import { CronService } from "@gettersethya/mira";
|
|
4
4
|
export const cronsRoute = Effect.gen(function* () {
|
|
5
5
|
const cronService = yield* CronService;
|
|
6
6
|
const states = yield* cronService.getAll();
|
|
7
|
-
return HttpServerResponse.
|
|
7
|
+
return HttpServerResponse.jsonUnsafe(states.map((s) => ({
|
|
8
8
|
name: s.name,
|
|
9
9
|
description: s.description ?? null,
|
|
10
10
|
status: s.status,
|
|
@@ -17,6 +17,6 @@ export const cronsRoute = Effect.gen(function* () {
|
|
|
17
17
|
export const cronRunNowRoute = Effect.flatMap(HttpRouter.RouteContext, (routeCtx) => Effect.gen(function* () {
|
|
18
18
|
const name = routeCtx.params["name"] ?? "";
|
|
19
19
|
const cronService = yield* CronService;
|
|
20
|
-
return yield* cronService.runNow(name).pipe(Effect.as(HttpServerResponse.empty({ status: 204 })), Effect.catchTag("CronNotFoundError", (_) => Effect.succeed(HttpServerResponse.
|
|
20
|
+
return yield* cronService.runNow(name).pipe(Effect.as(HttpServerResponse.empty({ status: 204 })), Effect.catchTag("CronNotFoundError", (_) => Effect.succeed(HttpServerResponse.jsonUnsafe({ error: "not_found" }, { status: 404 }))));
|
|
21
21
|
}));
|
|
22
22
|
//# sourceMappingURL=crons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crons.js","sourceRoot":"","sources":["../../../src/api/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"crons.js","sourceRoot":"","sources":["../../../src/api/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAqB,MAAM,oBAAoB,CAAA;AAEnE,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,WAAW,CAAA;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;IAE1C,OAAO,kBAAkB,C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AE,GAAG,EAAE,CAAC,CAAC,CACvF,CACF,CAAA;AACH,CAAC,CAAC,CACH,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { HttpServerRequest, HttpServerResponse } from "
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
3
|
import { CollectionService } from "@gettersethya/mira";
|
|
4
|
-
export declare const registerRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, import("@gettersethya/mira").CollectionError | import("
|
|
4
|
+
export declare const registerRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, import("@gettersethya/mira").CollectionError | import("effect/http/HttpServerError").HttpServerError | Schema.SchemaError, CollectionService | HttpServerRequest.HttpServerRequest>;
|
|
5
5
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/api/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/api/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAatD,eAAO,MAAM,aAAa,0OA4BxB,CAAA"}
|
package/dist/src/api/register.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import { HttpServerRequest, HttpServerResponse } from "
|
|
3
|
-
import { CollectionService
|
|
2
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
|
+
import { CollectionService } from "@gettersethya/mira";
|
|
4
4
|
import { getRegisterToken } from "../superadmin.js";
|
|
5
5
|
import { SuperAdminCollection } from "../superadmin.js";
|
|
6
6
|
const RegisterBodySchema = Schema.Struct({
|
|
@@ -12,23 +12,22 @@ const RegisterBodySchema = Schema.Struct({
|
|
|
12
12
|
const adminCtx = { headers: {}, query: {}, admin: true };
|
|
13
13
|
export const registerRoute = Effect.gen(function* () {
|
|
14
14
|
const req = yield* HttpServerRequest.HttpServerRequest;
|
|
15
|
-
const body = yield* req.json.pipe(Effect.flatMap(Schema.
|
|
15
|
+
const body = yield* req.json.pipe(Effect.flatMap(Schema.decodeUnknownEffect(RegisterBodySchema)));
|
|
16
16
|
const svc = yield* CollectionService;
|
|
17
17
|
if (body.token !== getRegisterToken()) {
|
|
18
|
-
return HttpServerResponse.
|
|
18
|
+
return HttpServerResponse.jsonUnsafe({ error: "invalid_token" }, { status: 403 });
|
|
19
19
|
}
|
|
20
20
|
const bootstrapped = yield* svc
|
|
21
21
|
.list(SuperAdminCollection, null, 1, adminCtx)
|
|
22
22
|
.pipe(Effect.orElseSucceed(() => ({ items: [] })));
|
|
23
23
|
if (bootstrapped.items.length > 0) {
|
|
24
|
-
return HttpServerResponse.
|
|
24
|
+
return HttpServerResponse.jsonUnsafe({ error: "already_bootstrapped" }, { status: 403 });
|
|
25
25
|
}
|
|
26
|
-
const hashedPassword = yield* hashPassword(body.password);
|
|
27
26
|
const record = yield* svc.create(SuperAdminCollection, {
|
|
28
27
|
email: body.email,
|
|
29
|
-
password:
|
|
28
|
+
password: body.password,
|
|
30
29
|
name: body.name
|
|
31
30
|
}, adminCtx);
|
|
32
|
-
return HttpServerResponse.
|
|
31
|
+
return HttpServerResponse.jsonUnsafe({ id: record["id"], email: record["email"] }, { status: 201 });
|
|
33
32
|
});
|
|
34
33
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/api/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM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AAE,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACnF,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,GAAG;SAC5B,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC;SAC7C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAA4C,EAAE,CAAC,CAAC,CAAC,CAAA;IAE9F,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,kBAAkB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IAC1F,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAC9B,oBAAoB,EACpB;QACE,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,EACD,QAAQ,CACT,CAAA;IAED,OAAO,kBAAkB,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;AACrG,CAAC,CAAC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
3
|
import { CollectionService } from "@gettersethya/mira";
|
|
4
|
-
export declare const createSuperadminRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, import("@gettersethya/mira").CollectionError | import("
|
|
4
|
+
export declare const createSuperadminRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, import("@gettersethya/mira").CollectionError | import("effect/http/HttpServerError").HttpServerError | Schema.SchemaError, CollectionService | HttpServerRequest.HttpServerRequest>;
|
|
5
5
|
export declare const listSuperadminsRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, import("@gettersethya/mira").CollectionError, CollectionService>;
|
|
6
6
|
export declare const deleteSuperadminRoute: Effect.Effect<HttpServerResponse.HttpServerResponse, never, CollectionService | HttpRouter.RouteContext>;
|
|
7
7
|
//# sourceMappingURL=superadmin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"superadmin.d.ts","sourceRoot":"","sources":["../../../src/api/superadmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"superadmin.d.ts","sourceRoot":"","sources":["../../../src/api/superadmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAWtD,eAAO,MAAM,qBAAqB,0OAuBhC,CAAA;AAEF,eAAO,MAAM,oBAAoB,uHAW/B,CAAA;AAEF,eAAO,MAAM,qBAAqB,0GAsBjC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "
|
|
3
|
-
import { CollectionService
|
|
2
|
+
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
|
+
import { CollectionService } from "@gettersethya/mira";
|
|
4
4
|
import { Filter } from "@gettersethya/mira-client";
|
|
5
5
|
import { SuperAdminCollection } from "../superadmin.js";
|
|
6
6
|
const CreateSuperadminSchema = Schema.Struct({
|
|
@@ -10,20 +10,19 @@ const CreateSuperadminSchema = Schema.Struct({
|
|
|
10
10
|
const adminCtx = { headers: {}, query: {}, admin: true };
|
|
11
11
|
export const createSuperadminRoute = Effect.gen(function* () {
|
|
12
12
|
const req = yield* HttpServerRequest.HttpServerRequest;
|
|
13
|
-
const body = yield* req.json.pipe(Effect.flatMap(Schema.
|
|
13
|
+
const body = yield* req.json.pipe(Effect.flatMap(Schema.decodeUnknownEffect(CreateSuperadminSchema)));
|
|
14
14
|
const svc = yield* CollectionService;
|
|
15
15
|
const existing = yield* svc
|
|
16
16
|
.list(SuperAdminCollection, null, 1, adminCtx, Filter.field("email").eq(body.email))
|
|
17
17
|
.pipe(Effect.orElseSucceed(() => ({ items: [] })));
|
|
18
18
|
if (existing.items.length > 0) {
|
|
19
|
-
return HttpServerResponse.
|
|
19
|
+
return HttpServerResponse.jsonUnsafe({ error: "email_taken" }, { status: 409 });
|
|
20
20
|
}
|
|
21
|
-
const hashedPassword = yield* hashPassword(body.password);
|
|
22
21
|
const record = yield* svc.create(SuperAdminCollection, {
|
|
23
22
|
email: body.email,
|
|
24
|
-
password:
|
|
23
|
+
password: body.password
|
|
25
24
|
}, adminCtx);
|
|
26
|
-
return HttpServerResponse.
|
|
25
|
+
return HttpServerResponse.jsonUnsafe({ id: record["id"], email: record["email"] }, { status: 201 });
|
|
27
26
|
});
|
|
28
27
|
export const listSuperadminsRoute = Effect.gen(function* () {
|
|
29
28
|
const svc = yield* CollectionService;
|
|
@@ -33,19 +32,19 @@ export const listSuperadminsRoute = Effect.gen(function* () {
|
|
|
33
32
|
email: String(r["email"]),
|
|
34
33
|
created: String(r["created"])
|
|
35
34
|
}));
|
|
36
|
-
return HttpServerResponse.
|
|
35
|
+
return HttpServerResponse.jsonUnsafe({ items }, { status: 200 });
|
|
37
36
|
});
|
|
38
37
|
export const deleteSuperadminRoute = Effect.flatMap(HttpRouter.RouteContext, (routeCtx) => Effect.gen(function* () {
|
|
39
38
|
const id = routeCtx.params["id"];
|
|
40
39
|
if (id === undefined) {
|
|
41
|
-
return HttpServerResponse.
|
|
40
|
+
return HttpServerResponse.jsonUnsafe({ error: "not_found" }, { status: 404 });
|
|
42
41
|
}
|
|
43
42
|
const svc = yield* CollectionService;
|
|
44
43
|
const total = yield* svc.list(SuperAdminCollection, null, 2, adminCtx).pipe(Effect.map((r) => r.items.length), Effect.orElseSucceed(() => 0));
|
|
45
44
|
if (total <= 1) {
|
|
46
|
-
return HttpServerResponse.
|
|
45
|
+
return HttpServerResponse.jsonUnsafe({ error: "last_superadmin" }, { status: 409 });
|
|
47
46
|
}
|
|
48
|
-
yield* svc.delete(SuperAdminCollection, id, adminCtx).pipe(Effect.
|
|
47
|
+
yield* svc.delete(SuperAdminCollection, id, adminCtx).pipe(Effect.catch(() => Effect.void));
|
|
49
48
|
return HttpServerResponse.empty({ status: 204 });
|
|
50
49
|
}));
|
|
51
50
|
//# sourceMappingURL=superadmin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"superadmin.js","sourceRoot":"","sources":["../../../src/api/superadmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"superadmin.js","sourceRoot":"","sources":["../../../src/api/superadmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM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AC;QACrB,OAAO,kBAAkB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IAC/E,CAAC;IAED,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAA;IAEpC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CACzE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EACjC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAC9B,CAAA;IAED,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACf,OAAO,kBAAkB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACrF,CAAC;IAED,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,oBAAoB,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAE3F,OAAO,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;AAClD,CAAC,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe collection definition for the dashboard's superadmin collection.
|
|
3
|
+
*
|
|
4
|
+
* Kept in its own module (importing only `@gettersethya/mira-client`) so the
|
|
5
|
+
* dashboard UI bundle can import it without pulling in `@gettersethya/mira`,
|
|
6
|
+
* which transitively reaches Node-only APIs (`node:crypto`,
|
|
7
|
+
* `@effect/platform-node`) and breaks the browser build.
|
|
8
|
+
*
|
|
9
|
+
* Rules are attached server-side in `superadmin.ts` via `defineRule`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SuperAdminDef: import("@gettersethya/mira-client").AuthCollectionBuilder<{
|
|
12
|
+
name: import("@gettersethya/mira-client").FieldDef & {
|
|
13
|
+
kind: "text";
|
|
14
|
+
} & {
|
|
15
|
+
default: string;
|
|
16
|
+
} & {
|
|
17
|
+
error?: (kind: import("@gettersethya/mira-client").TextConstraintKind) => string | undefined;
|
|
18
|
+
} & {
|
|
19
|
+
view(): import("@gettersethya/mira-client").FieldDef & {
|
|
20
|
+
kind: "text";
|
|
21
|
+
} & {
|
|
22
|
+
default: string;
|
|
23
|
+
} & {
|
|
24
|
+
error?: (kind: import("@gettersethya/mira-client").TextConstraintKind) => string | undefined;
|
|
25
|
+
} & {
|
|
26
|
+
viewOnly: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/collection.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAExB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AuthCollection, Field } from "@gettersethya/mira-client";
|
|
2
|
+
/**
|
|
3
|
+
* Browser-safe collection definition for the dashboard's superadmin collection.
|
|
4
|
+
*
|
|
5
|
+
* Kept in its own module (importing only `@gettersethya/mira-client`) so the
|
|
6
|
+
* dashboard UI bundle can import it without pulling in `@gettersethya/mira`,
|
|
7
|
+
* which transitively reaches Node-only APIs (`node:crypto`,
|
|
8
|
+
* `@effect/platform-node`) and breaks the browser build.
|
|
9
|
+
*
|
|
10
|
+
* Rules are attached server-side in `superadmin.ts` via `defineRule`.
|
|
11
|
+
*/
|
|
12
|
+
export const SuperAdminDef = AuthCollection.define("_superadmin", {
|
|
13
|
+
name: Field.text({ default: "" })
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAEjE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE;IAChE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAClC,CAAC,CAAA"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiraPlugin } from "@gettersethya/mira";
|
|
2
|
-
export declare const MiraDashboard: MiraPlugin<
|
|
1
|
+
import { MiraPlugin, AppConfig, CollectionService } from "@gettersethya/mira";
|
|
2
|
+
export declare const MiraDashboard: MiraPlugin<CollectionService | import("effect/FileSystem").FileSystem | import("effect/Path").Path | AppConfig | import("@gettersethya/mira").CronService>;
|
|
3
3
|
export { SuperAdminCollection } from "./superadmin.js";
|
|
4
4
|
export { getRegisterToken, setRegisterToken, generateRegisterToken } from "./superadmin.js";
|
|
5
5
|
export { makeDashboardRouter } from "./router.js";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAI7E,eAAO,MAAM,aAAa,4JA6CxB,CAAA;AAEF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { MiraPlugin, AppConfig, CollectionService } from "@gettersethya/mira";
|
|
|
3
3
|
import { SuperAdminCollection, setRegisterToken, generateRegisterToken } from "./superadmin.js";
|
|
4
4
|
import { makeDashboardRouter } from "./router.js";
|
|
5
5
|
export const MiraDashboard = MiraPlugin.define({
|
|
6
|
-
|
|
6
|
+
adminCollections: [SuperAdminCollection],
|
|
7
7
|
routes: makeDashboardRouter([SuperAdminCollection]),
|
|
8
8
|
onBootstrap: () => Effect.gen(function* () {
|
|
9
9
|
const token = generateRegisterToken();
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC;IAC7C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OA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1
|
-
import { HttpRouter } from "
|
|
2
|
-
import { FileSystem, Path } from "
|
|
1
|
+
import { HttpRouter } from "effect/http";
|
|
2
|
+
import { FileSystem, Path } from "effect";
|
|
3
|
+
import type { AppConfig, CollectionService, CronService } from "@gettersethya/mira";
|
|
3
4
|
import type { AnyCollectionDef } from "@gettersethya/mira-client";
|
|
4
|
-
|
|
5
|
+
type DashboardRouteServices = FileSystem.FileSystem | Path.Path | CollectionService | AppConfig | CronService;
|
|
6
|
+
export declare function makeDashboardRouter(_collections: ReadonlyArray<AnyCollectionDef>): ReadonlyArray<HttpRouter.Route<never, DashboardRouteServices>>;
|
|
7
|
+
export {};
|
|
5
8
|
//# sourceMappingURL=router.d.ts.map
|
package/dist/src/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyC,MAAM,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAC/E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AA4GjE,KAAK,sBAAsB,GACvB,UAAU,CAAC,UAAU,GACrB,IAAI,CAAC,IAAI,GACT,iBAAiB,GACjB,SAAS,GACT,WAAW,CAAA;AAEf,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAC5C,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAYhE"}
|
package/dist/src/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "
|
|
2
|
-
import { FileSystem, Path } from "
|
|
1
|
+
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
2
|
+
import { FileSystem, Path } from "effect";
|
|
3
3
|
import { Cause, Effect, Option } from "effect";
|
|
4
4
|
import { bootstrapStatusRoute } from "./api/bootstrap-status.js";
|
|
5
5
|
import { registerRoute } from "./api/register.js";
|
|
@@ -23,22 +23,22 @@ function makeContentType(ext) {
|
|
|
23
23
|
return types[ext] ?? "application/octet-stream";
|
|
24
24
|
}
|
|
25
25
|
function wrapRoute(operation, effect) {
|
|
26
|
-
return Effect.
|
|
27
|
-
const failure = Cause.
|
|
26
|
+
return Effect.catchCause(effect, (cause) => {
|
|
27
|
+
const failure = Cause.findErrorOption(cause);
|
|
28
28
|
if (Option.isSome(failure)) {
|
|
29
29
|
if (failure.value instanceof DashboardUnauthorizedError) {
|
|
30
|
-
return Effect.succeed(HttpServerResponse.
|
|
30
|
+
return Effect.succeed(HttpServerResponse.jsonUnsafe({ error: "unauthorized" }, { status: 401 }));
|
|
31
31
|
}
|
|
32
|
-
return Effect.succeed(HttpServerResponse.
|
|
32
|
+
return Effect.succeed(HttpServerResponse.jsonUnsafe({ error: "bad_request" }, { status: 400 }));
|
|
33
33
|
}
|
|
34
|
-
return Effect.succeed(HttpServerResponse.
|
|
34
|
+
return Effect.succeed(HttpServerResponse.jsonUnsafe({ error: "internal" }, { status: 500 }));
|
|
35
35
|
}).pipe(Effect.withSpan("http.handler", { kind: "server", attributes: { operation } }));
|
|
36
36
|
}
|
|
37
37
|
function wrapAuthRoute(operation, effect) {
|
|
38
38
|
return Effect.gen(function* () {
|
|
39
39
|
const authResult = yield* requireDashboardAuth.pipe(Effect.catchTag("DashboardUnauthorizedError", () => Effect.succeed(null)));
|
|
40
40
|
if (authResult === null) {
|
|
41
|
-
return HttpServerResponse.
|
|
41
|
+
return HttpServerResponse.jsonUnsafe({ error: "unauthorized" }, { status: 401 });
|
|
42
42
|
}
|
|
43
43
|
yield* Effect.currentSpan.pipe(Effect.tap((span) => Effect.sync(() => {
|
|
44
44
|
span.attribute("auth.collection", authResult.col);
|
|
@@ -47,12 +47,12 @@ function wrapAuthRoute(operation, effect) {
|
|
|
47
47
|
parent.value.attribute("auth.collection", authResult.col);
|
|
48
48
|
}
|
|
49
49
|
})), Effect.ignore);
|
|
50
|
-
return yield* Effect.
|
|
51
|
-
const failure = Cause.
|
|
50
|
+
return yield* Effect.catchCause(effect, (cause) => {
|
|
51
|
+
const failure = Cause.findErrorOption(cause);
|
|
52
52
|
if (Option.isSome(failure)) {
|
|
53
|
-
return Effect.succeed(HttpServerResponse.
|
|
53
|
+
return Effect.succeed(HttpServerResponse.jsonUnsafe({ error: "bad_request" }, { status: 400 }));
|
|
54
54
|
}
|
|
55
|
-
return Effect.succeed(HttpServerResponse.
|
|
55
|
+
return Effect.succeed(HttpServerResponse.jsonUnsafe({ error: "internal" }, { status: 500 }));
|
|
56
56
|
});
|
|
57
57
|
}).pipe(Effect.withSpan("http.handler", { kind: "server", attributes: { operation } }));
|
|
58
58
|
}
|
|
@@ -80,9 +80,21 @@ function makeDashboardSpaRoute() {
|
|
|
80
80
|
headers: { "content-type": contentType }
|
|
81
81
|
});
|
|
82
82
|
}));
|
|
83
|
-
return
|
|
83
|
+
return [
|
|
84
|
+
HttpRouter.route("GET", "/_dashboard/*", spaHandler)
|
|
85
|
+
];
|
|
84
86
|
}
|
|
85
87
|
export function makeDashboardRouter(_collections) {
|
|
86
|
-
return
|
|
88
|
+
return [
|
|
89
|
+
...makeDashboardSpaRoute(),
|
|
90
|
+
HttpRouter.route("GET", "/_dashboard/api/bootstrap-status", wrapRoute("bootstrap_status", bootstrapStatusRoute)),
|
|
91
|
+
HttpRouter.route("POST", "/_dashboard/api/register", wrapRoute("register", registerRoute)),
|
|
92
|
+
HttpRouter.route("POST", "/_dashboard/api/superadmin/create", wrapAuthRoute("superadmin_create", createSuperadminRoute)),
|
|
93
|
+
HttpRouter.route("GET", "/_dashboard/api/superadmin", wrapAuthRoute("superadmin_list", listSuperadminsRoute)),
|
|
94
|
+
HttpRouter.route("DELETE", "/_dashboard/api/superadmin/:id", wrapAuthRoute("superadmin_delete", deleteSuperadminRoute)),
|
|
95
|
+
HttpRouter.route("GET", "/_dashboard/api/config", wrapAuthRoute("config", configRoute)),
|
|
96
|
+
HttpRouter.route("GET", "/_dashboard/api/crons", wrapAuthRoute("crons_list", cronsRoute)),
|
|
97
|
+
HttpRouter.route("POST", "/_dashboard/api/crons/:name/run", wrapAuthRoute("crons_run", cronRunNowRoute))
|
|
98
|
+
];
|
|
87
99
|
}
|
|
88
100
|
//# sourceMappingURL=router.js.map
|
package/dist/src/router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;A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CAAC,KAAK,EAAE,kCAAkC,EAAE,SAAS,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;QAChH,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,0BAA0B,EAAE,SAAS,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;QAC1F,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,mCAAmC,EAAE,aAAa,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;QACxH,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,4BAA4B,EAAE,aAAa,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;QAC7G,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,gCAAgC,EAAE,aAAa,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;QACvH,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,wBAAwB,EAAE,aAAa,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACvF,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,uBAAuB,EAAE,aAAa,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACzF,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,iCAAiC,EAAE,aAAa,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;KACzG,CAAA;AACH,CAAC"}
|
package/dist/src/superadmin.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
1
|
+
export declare const SuperAdminRules: import("@gettersethya/mira").RuleBinding;
|
|
2
|
+
export declare const SuperAdminCollection: import("@gettersethya/mira").AuthCollectionBuilder<{
|
|
3
|
+
name: import("@gettersethya/mira").FieldDef & {
|
|
3
4
|
kind: "text";
|
|
4
5
|
} & {
|
|
5
6
|
default: string;
|
|
6
7
|
} & {
|
|
7
|
-
error?: (kind: import("@gettersethya/mira
|
|
8
|
+
error?: (kind: import("@gettersethya/mira").TextConstraintKind) => string | undefined;
|
|
8
9
|
} & {
|
|
9
|
-
view(): import("@gettersethya/mira
|
|
10
|
+
view(): import("@gettersethya/mira").FieldDef & {
|
|
10
11
|
kind: "text";
|
|
11
12
|
} & {
|
|
12
13
|
default: string;
|
|
13
14
|
} & {
|
|
14
|
-
error?: (kind: import("@gettersethya/mira
|
|
15
|
+
error?: (kind: import("@gettersethya/mira").TextConstraintKind) => string | undefined;
|
|
15
16
|
} & {
|
|
16
17
|
viewOnly: true;
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
20
|
}>;
|
|
21
|
+
export { SuperAdminDef } from "./collection.js";
|
|
20
22
|
export declare function getRegisterToken(): string;
|
|
21
23
|
export declare function setRegisterToken(token: string): void;
|
|
22
24
|
export declare function generateRegisterToken(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"superadmin.d.ts","sourceRoot":"","sources":["../../src/superadmin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"superadmin.d.ts","sourceRoot":"","sources":["../../src/superadmin.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,0CAMzB,CAAA;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAAiE,CAAA;AAElG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI/C,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAI9C"}
|
package/dist/src/superadmin.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}).rules((R) => ({
|
|
1
|
+
import { defineRule, applyRulesToCollections } from "@gettersethya/mira";
|
|
2
|
+
import { SuperAdminDef } from "./collection.js";
|
|
3
|
+
export const SuperAdminRules = defineRule(SuperAdminDef, (R) => ({
|
|
5
4
|
list: R.authCollection().eq(R.literal("_superadmin")),
|
|
6
5
|
view: R.authCollection().eq(R.literal("_superadmin")),
|
|
7
6
|
create: R.public(),
|
|
8
7
|
update: R.authCollection().eq(R.literal("_superadmin")),
|
|
9
8
|
delete: R.authCollection().eq(R.literal("_superadmin"))
|
|
10
9
|
}));
|
|
10
|
+
export const SuperAdminCollection = applyRulesToCollections([SuperAdminDef], [SuperAdminRules])[0];
|
|
11
|
+
export { SuperAdminDef } from "./collection.js";
|
|
11
12
|
let _registerToken = "";
|
|
12
13
|
export function getRegisterToken() {
|
|
13
14
|
return _registerToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"superadmin.js","sourceRoot":"","sources":["../../src/superadmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"superadmin.js","sourceRoot":"","sources":["../../src/superadmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/D,IAAI,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACrD,IAAI,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACrD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACvD,MAAM,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACxD,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAElG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,IAAI,cAAc,GAAG,EAAE,CAAA;AAEvB,MAAM,UAAU,gBAAgB;IAC9B,OAAO,cAAc,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,cAAc,GAAG,KAAK,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAA;IAC9B,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;IACtC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gettersethya/mira-dashboard",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Admin dashboard plugin for Mira",
|
|
6
6
|
"author": "Getter Sethya",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@effect/language-service": "^0.
|
|
19
|
-
"@effect/platform": "^0.96.1",
|
|
18
|
+
"@effect/language-service": "^0.87.3",
|
|
20
19
|
"@tanstack/svelte-table": "^8.21.3",
|
|
21
20
|
"@tanstack/table-core": "^8.21.3",
|
|
22
21
|
"jose": "^6.2.3",
|
|
23
|
-
"@gettersethya/mira": "0.1.0-alpha.
|
|
24
|
-
"@gettersethya/mira-client": "0.1.0-alpha.
|
|
22
|
+
"@gettersethya/mira": "0.1.0-alpha.20",
|
|
23
|
+
"@gettersethya/mira-client": "0.1.0-alpha.20"
|
|
25
24
|
},
|
|
26
25
|
"peerDependencies": {
|
|
27
|
-
"effect": "
|
|
26
|
+
"effect": "^4.0.0"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
|
-
"@effect/vitest": "^0.
|
|
29
|
+
"@effect/vitest": "^4.0.0",
|
|
31
30
|
"@types/node": "^25.7.0",
|
|
31
|
+
"effect": "^4.0.0",
|
|
32
32
|
"typescript": "^6.0.3",
|
|
33
|
-
"vitest": "^
|
|
33
|
+
"vitest": "^5.0.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|