@namera-ai/api 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/common.js +13 -0
- package/dist/common.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/middlewares/admin.d.ts +25 -0
- package/dist/middlewares/admin.d.ts.map +1 -0
- package/dist/middlewares/admin.js +18 -0
- package/dist/middlewares/admin.js.map +1 -0
- package/dist/middlewares/auth.d.ts +640 -0
- package/dist/middlewares/auth.d.ts.map +1 -0
- package/dist/middlewares/auth.js +26 -0
- package/dist/middlewares/auth.js.map +1 -0
- package/dist/middlewares/index.d.ts +3 -0
- package/dist/routes/address-metadata.d.ts +147 -0
- package/dist/routes/address-metadata.d.ts.map +1 -0
- package/dist/routes/address-metadata.js +24 -0
- package/dist/routes/address-metadata.js.map +1 -0
- package/dist/routes/api-key.d.ts +864 -0
- package/dist/routes/api-key.d.ts.map +1 -0
- package/dist/routes/api-key.js +31 -0
- package/dist/routes/api-key.js.map +1 -0
- package/dist/routes/auth/core/index.d.ts +4 -0
- package/dist/routes/auth/core/magic-link.d.ts +34 -0
- package/dist/routes/auth/core/magic-link.d.ts.map +1 -0
- package/dist/routes/auth/core/magic-link.js +25 -0
- package/dist/routes/auth/core/magic-link.js.map +1 -0
- package/dist/routes/auth/core/session.d.ts +805 -0
- package/dist/routes/auth/core/session.d.ts.map +1 -0
- package/dist/routes/auth/core/session.js +31 -0
- package/dist/routes/auth/core/session.js.map +1 -0
- package/dist/routes/auth/core/user.d.ts +45 -0
- package/dist/routes/auth/core/user.d.ts.map +1 -0
- package/dist/routes/auth/core/user.js +15 -0
- package/dist/routes/auth/core/user.js.map +1 -0
- package/dist/routes/auth/index.d.ts +11 -0
- package/dist/routes/auth/notification.d.ts +392 -0
- package/dist/routes/auth/notification.d.ts.map +1 -0
- package/dist/routes/auth/notification.js +40 -0
- package/dist/routes/auth/notification.js.map +1 -0
- package/dist/routes/auth/oauth.d.ts +1347 -0
- package/dist/routes/auth/oauth.d.ts.map +1 -0
- package/dist/routes/auth/oauth.js +62 -0
- package/dist/routes/auth/oauth.js.map +1 -0
- package/dist/routes/auth/organization/index.d.ts +4 -0
- package/dist/routes/auth/organization/invitation.d.ts +400 -0
- package/dist/routes/auth/organization/invitation.d.ts.map +1 -0
- package/dist/routes/auth/organization/invitation.js +55 -0
- package/dist/routes/auth/organization/invitation.js.map +1 -0
- package/dist/routes/auth/organization/members.d.ts +250 -0
- package/dist/routes/auth/organization/members.d.ts.map +1 -0
- package/dist/routes/auth/organization/members.js +37 -0
- package/dist/routes/auth/organization/members.js.map +1 -0
- package/dist/routes/auth/organization/organization.d.ts +196 -0
- package/dist/routes/auth/organization/organization.d.ts.map +1 -0
- package/dist/routes/auth/organization/organization.js +31 -0
- package/dist/routes/auth/organization/organization.js.map +1 -0
- package/dist/routes/beta-invite.d.ts +24 -0
- package/dist/routes/beta-invite.d.ts.map +1 -0
- package/dist/routes/beta-invite.js +20 -0
- package/dist/routes/beta-invite.js.map +1 -0
- package/dist/routes/billing.d.ts +34 -0
- package/dist/routes/billing.d.ts.map +1 -0
- package/dist/routes/billing.js +14 -0
- package/dist/routes/billing.js.map +1 -0
- package/dist/routes/dashboard.d.ts +58 -0
- package/dist/routes/dashboard.d.ts.map +1 -0
- package/dist/routes/dashboard.js +14 -0
- package/dist/routes/dashboard.js.map +1 -0
- package/dist/routes/ens.d.ts +14 -0
- package/dist/routes/ens.d.ts.map +1 -0
- package/dist/routes/ens.js +15 -0
- package/dist/routes/ens.js.map +1 -0
- package/dist/routes/execution.d.ts +816 -0
- package/dist/routes/execution.d.ts.map +1 -0
- package/dist/routes/execution.js +50 -0
- package/dist/routes/execution.js.map +1 -0
- package/dist/routes/health.d.ts +10 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +10 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/index.d.ts +23 -0
- package/dist/routes/portfolio.d.ts +94 -0
- package/dist/routes/portfolio.d.ts.map +1 -0
- package/dist/routes/portfolio.js +16 -0
- package/dist/routes/portfolio.js.map +1 -0
- package/dist/routes/session-key.d.ts +1844 -0
- package/dist/routes/session-key.d.ts.map +1 -0
- package/dist/routes/session-key.js +55 -0
- package/dist/routes/session-key.js.map +1 -0
- package/dist/routes/signature.d.ts +195 -0
- package/dist/routes/signature.d.ts.map +1 -0
- package/dist/routes/signature.js +38 -0
- package/dist/routes/signature.js.map +1 -0
- package/dist/routes/waitlist.d.ts +42 -0
- package/dist/routes/waitlist.d.ts.map +1 -0
- package/dist/routes/waitlist.js +27 -0
- package/dist/routes/waitlist.js.map +1 -0
- package/dist/routes/wallet.d.ts +547 -0
- package/dist/routes/wallet.d.ts.map +1 -0
- package/dist/routes/wallet.js +50 -0
- package/dist/routes/wallet.js.map +1 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @namera-ai/api
|
|
2
|
+
|
|
3
|
+
The typed HTTP contract for Namera, built with Effect `HttpApi`. Generate OpenAPI
|
|
4
|
+
documentation and derive client types from the same endpoint schemas used by the
|
|
5
|
+
server. This package defines the API; it does not start a server.
|
|
6
|
+
|
|
7
|
+
For ordinary application integration, use [@namera-ai/sdk](https://www.npmjs.com/package/@namera-ai/sdk).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Requires Node.js 24.14+ for Node applications. Use the matching Effect 4 beta.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @namera-ai/api effect@4.0.0-beta.105
|
|
15
|
+
pnpm add @namera-ai/api effect@4.0.0-beta.105
|
|
16
|
+
yarn add @namera-ai/api effect@4.0.0-beta.105
|
|
17
|
+
bun add @namera-ai/api effect@4.0.0-beta.105
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Choose the command for your package manager.
|
|
21
|
+
|
|
22
|
+
## Generate OpenAPI documentation
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { writeFile } from "node:fs/promises";
|
|
26
|
+
import { OpenApi } from "effect/unstable/httpapi";
|
|
27
|
+
import { NameraApi } from "@namera-ai/api";
|
|
28
|
+
|
|
29
|
+
const document = OpenApi.fromApi(NameraApi);
|
|
30
|
+
await writeFile("openapi.json", JSON.stringify(document, null, 2));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The contract covers wallets, session keys, executions, signatures, authorization,
|
|
34
|
+
organizations, billing, and the public waitlist. Authentication is defined per
|
|
35
|
+
endpoint; installing this package grants no access.
|
|
36
|
+
|
|
37
|
+
## Derive client types
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import type { HttpApiClient } from "effect/unstable/httpapi";
|
|
41
|
+
import { NameraApi } from "@namera-ai/api";
|
|
42
|
+
|
|
43
|
+
type Client = HttpApiClient.ForApi<typeof NameraApi>;
|
|
44
|
+
type WalletClient = Client["wallet"];
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Effect integrations can construct clients with `HttpApiClient.make` and supply
|
|
48
|
+
the required client middleware layers. Most consumers should use the SDK, which
|
|
49
|
+
handles authentication and returns promise-based results.
|
|
50
|
+
|
|
51
|
+
## Related packages
|
|
52
|
+
|
|
53
|
+
- [protocol](https://www.npmjs.com/package/@namera-ai/protocol): runtime schemas and types.
|
|
54
|
+
- [sdk](https://www.npmjs.com/package/@namera-ai/sdk): application client.
|
|
55
|
+
- [cli](https://www.npmjs.com/package/@namera-ai/cli): terminal commands and local MCP.
|
|
56
|
+
|
|
57
|
+
Use matching versions of the four packages starting with 1.0.0.
|
|
58
|
+
[Contributor architecture](https://github.com/thenamespace/namera-core/blob/main/architecture/packages/contracts.md).
|
package/dist/common.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpApiError } from "effect/unstable/httpapi";
|
|
2
|
+
import { RateLimitExceeded } from "@namera-ai/protocol";
|
|
3
|
+
|
|
4
|
+
//#region src/common.ts
|
|
5
|
+
const CommonErrors = [
|
|
6
|
+
HttpApiError.ForbiddenNoContent,
|
|
7
|
+
HttpApiError.InternalServerErrorNoContent,
|
|
8
|
+
RateLimitExceeded
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { CommonErrors };
|
|
13
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","names":[],"sources":["../src/common.ts"],"sourcesContent":["import { HttpApiError } from \"effect/unstable/httpapi\";\n\nimport { RateLimitExceeded } from \"@namera-ai/protocol\";\n\nexport const CommonErrors = [\n HttpApiError.ForbiddenNoContent,\n HttpApiError.InternalServerErrorNoContent,\n RateLimitExceeded,\n] as const;\n"],"mappings":";;;;AAIA,MAAa,eAAe;CAC1B,aAAa;CACb,aAAa;CACb;AACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HealthGroup } from "./routes/health.js";
|
|
2
|
+
import { ApiKeySecurity, AuthTokenSecurity, Authorization, BearerSecurity, CurrentActor } from "./middlewares/auth.js";
|
|
3
|
+
import { AdminAuthorization, CurrentAdmin } from "./middlewares/admin.js";
|
|
4
|
+
import "./middlewares/index.js";
|
|
5
|
+
import { AddressMetadataGroup } from "./routes/address-metadata.js";
|
|
6
|
+
import { ExecutionGroup } from "./routes/execution.js";
|
|
7
|
+
import { EnsGroup } from "./routes/ens.js";
|
|
8
|
+
import { ApiKeyGroup } from "./routes/api-key.js";
|
|
9
|
+
import { BillingGroup } from "./routes/billing.js";
|
|
10
|
+
import { DashboardGroup } from "./routes/dashboard.js";
|
|
11
|
+
import { PortfolioGroup } from "./routes/portfolio.js";
|
|
12
|
+
import { WalletGroup } from "./routes/wallet.js";
|
|
13
|
+
import { SessionKeyGroup } from "./routes/session-key.js";
|
|
14
|
+
import { SignatureGroup } from "./routes/signature.js";
|
|
15
|
+
import { MagicLinkGroup } from "./routes/auth/core/magic-link.js";
|
|
16
|
+
import { SessionGroup } from "./routes/auth/core/session.js";
|
|
17
|
+
import { UserGroup } from "./routes/auth/core/user.js";
|
|
18
|
+
import { NotificationGroup } from "./routes/auth/notification.js";
|
|
19
|
+
import { OAuthGroup } from "./routes/auth/oauth.js";
|
|
20
|
+
import { InvitationGroup } from "./routes/auth/organization/invitation.js";
|
|
21
|
+
import { MemberGroup } from "./routes/auth/organization/members.js";
|
|
22
|
+
import { OrganizationGroup } from "./routes/auth/organization/organization.js";
|
|
23
|
+
import { BetaInviteGroup } from "./routes/beta-invite.js";
|
|
24
|
+
import { AdminWaitlistGroup, WaitlistGroup } from "./routes/waitlist.js";
|
|
25
|
+
import "./routes/index.js";
|
|
26
|
+
import { HttpApi } from "effect/unstable/httpapi";
|
|
27
|
+
//#region src/index.d.ts
|
|
28
|
+
declare const NameraApi_base: HttpApi.HttpApi<"NameraAPI", typeof AddressMetadataGroup | typeof ApiKeyGroup | typeof BillingGroup | typeof BetaInviteGroup | typeof WaitlistGroup | typeof AdminWaitlistGroup | typeof DashboardGroup | typeof ExecutionGroup | typeof EnsGroup | typeof HealthGroup | typeof InvitationGroup | typeof MagicLinkGroup | typeof MemberGroup | typeof NotificationGroup | typeof PortfolioGroup | typeof OAuthGroup | typeof OrganizationGroup | typeof SessionKeyGroup | typeof SessionGroup | typeof SignatureGroup | typeof UserGroup | typeof WalletGroup>;
|
|
29
|
+
declare class NameraApi extends NameraApi_base {}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AdminAuthorization, ApiKeySecurity, AuthTokenSecurity, Authorization, BearerSecurity, CurrentActor, CurrentAdmin, NameraApi };
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgCa,kBAAkB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HealthGroup } from "./routes/health.js";
|
|
2
|
+
import { ApiKeySecurity, AuthTokenSecurity, Authorization, BearerSecurity, CurrentActor } from "./middlewares/auth.js";
|
|
3
|
+
import { AdminAuthorization, CurrentAdmin } from "./middlewares/admin.js";
|
|
4
|
+
import { AddressMetadataGroup } from "./routes/address-metadata.js";
|
|
5
|
+
import { ExecutionGroup } from "./routes/execution.js";
|
|
6
|
+
import { EnsGroup } from "./routes/ens.js";
|
|
7
|
+
import { ApiKeyGroup } from "./routes/api-key.js";
|
|
8
|
+
import { BillingGroup } from "./routes/billing.js";
|
|
9
|
+
import { DashboardGroup } from "./routes/dashboard.js";
|
|
10
|
+
import { PortfolioGroup } from "./routes/portfolio.js";
|
|
11
|
+
import { WalletGroup } from "./routes/wallet.js";
|
|
12
|
+
import { SessionKeyGroup } from "./routes/session-key.js";
|
|
13
|
+
import { SignatureGroup } from "./routes/signature.js";
|
|
14
|
+
import { MagicLinkGroup } from "./routes/auth/core/magic-link.js";
|
|
15
|
+
import { SessionGroup } from "./routes/auth/core/session.js";
|
|
16
|
+
import { UserGroup } from "./routes/auth/core/user.js";
|
|
17
|
+
import { NotificationGroup } from "./routes/auth/notification.js";
|
|
18
|
+
import { OAuthGroup } from "./routes/auth/oauth.js";
|
|
19
|
+
import { InvitationGroup } from "./routes/auth/organization/invitation.js";
|
|
20
|
+
import { MemberGroup } from "./routes/auth/organization/members.js";
|
|
21
|
+
import { OrganizationGroup } from "./routes/auth/organization/organization.js";
|
|
22
|
+
import { BetaInviteGroup } from "./routes/beta-invite.js";
|
|
23
|
+
import { AdminWaitlistGroup, WaitlistGroup } from "./routes/waitlist.js";
|
|
24
|
+
import { HttpApi, OpenApi } from "effect/unstable/httpapi";
|
|
25
|
+
|
|
26
|
+
//#region src/index.ts
|
|
27
|
+
var NameraApi = class extends HttpApi.make("NameraAPI").add(AddressMetadataGroup, ApiKeyGroup, BillingGroup, BetaInviteGroup, WaitlistGroup, AdminWaitlistGroup, DashboardGroup, ExecutionGroup, EnsGroup, HealthGroup, InvitationGroup, MagicLinkGroup, MemberGroup, NotificationGroup, PortfolioGroup, OAuthGroup, OrganizationGroup, SessionKeyGroup, SessionGroup, SignatureGroup, UserGroup, WalletGroup).annotate(OpenApi.Title, "Namera API").annotate(OpenApi.Description, "Backend API for Namera built using Effect and Drizzle").annotate(OpenApi.Summary, "Namera is a programmable wallet infrastructure that lets agents execute onchain transactions within rules you define. Instead of giving full wallet access, you define permissions upfront and let agents operate within those boundaries.").annotate(OpenApi.Servers, [{
|
|
28
|
+
url: "https://api.namera.ai",
|
|
29
|
+
description: "Production server"
|
|
30
|
+
}, {
|
|
31
|
+
url: "http://localhost:8080",
|
|
32
|
+
description: "Local development server"
|
|
33
|
+
}]).annotate(OpenApi.License, {
|
|
34
|
+
name: "Apache-2.0",
|
|
35
|
+
url: "https://opensource.org/licenses/Apache-2.0"
|
|
36
|
+
}) {};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { AdminAuthorization, ApiKeySecurity, AuthTokenSecurity, Authorization, BearerSecurity, CurrentActor, CurrentAdmin, NameraApi };
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { HttpApi, OpenApi } from \"effect/unstable/httpapi\";\n\nimport {\n AddressMetadataGroup,\n ApiKeyGroup,\n BillingGroup,\n BetaInviteGroup,\n WaitlistGroup,\n AdminWaitlistGroup,\n DashboardGroup,\n ExecutionGroup,\n EnsGroup,\n HealthGroup,\n InvitationGroup,\n MagicLinkGroup,\n MemberGroup,\n NotificationGroup,\n OAuthGroup,\n OrganizationGroup,\n PortfolioGroup,\n SessionKeyGroup,\n SessionGroup,\n SignatureGroup,\n UserGroup,\n WalletGroup,\n} from \"./routes/index.js\";\n\nexport * from \"./middlewares/index.js\";\n\n// This class is the transport contract shared by the server, OpenAPI output,\n// dashboard atoms, and public SDK. Handlers and business logic deliberately\n// live outside this package so every client is generated from the same schema.\nexport class NameraApi extends HttpApi.make(\"NameraAPI\")\n .add(\n AddressMetadataGroup,\n ApiKeyGroup,\n BillingGroup,\n BetaInviteGroup,\n WaitlistGroup,\n AdminWaitlistGroup,\n DashboardGroup,\n ExecutionGroup,\n EnsGroup,\n HealthGroup,\n InvitationGroup,\n MagicLinkGroup,\n MemberGroup,\n NotificationGroup,\n PortfolioGroup,\n OAuthGroup,\n OrganizationGroup,\n SessionKeyGroup,\n SessionGroup,\n SignatureGroup,\n UserGroup,\n WalletGroup,\n )\n .annotate(OpenApi.Title, \"Namera API\")\n .annotate(OpenApi.Description, \"Backend API for Namera built using Effect and Drizzle\")\n .annotate(\n OpenApi.Summary,\n \"Namera is a programmable wallet infrastructure that lets agents execute onchain transactions within rules you define. Instead of giving full wallet access, you define permissions upfront and let agents operate within those boundaries.\",\n )\n .annotate(OpenApi.Servers, [\n {\n url: \"https://api.namera.ai\",\n description: \"Production server\",\n },\n {\n url: \"http://localhost:8080\",\n description: \"Local development server\",\n },\n ])\n .annotate(OpenApi.License, {\n name: \"Apache-2.0\",\n url: \"https://opensource.org/licenses/Apache-2.0\",\n }) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,YAAb,cAA+B,QAAQ,KAAK,WAAW,CAAC,CACrD,IACC,sBACA,aACA,cACA,iBACA,eACA,oBACA,gBACA,gBACA,UACA,aACA,iBACA,gBACA,aACA,mBACA,gBACA,YACA,mBACA,iBACA,cACA,gBACA,WACA,WACF,CAAC,CACA,SAAS,QAAQ,OAAO,YAAY,CAAC,CACrC,SAAS,QAAQ,aAAa,uDAAuD,CAAC,CACtF,SACC,QAAQ,SACR,4OACF,CAAC,CACA,SAAS,QAAQ,SAAS,CACzB;CACE,KAAK;CACL,aAAa;AACf,GACA;CACE,KAAK;CACL,aAAa;AACf,CACF,CAAC,CAAC,CACD,SAAS,QAAQ,SAAS;CACzB,MAAM;CACN,KAAK;AACP,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HttpApiError, HttpApiMiddleware, HttpApiSecurity } from "effect/unstable/httpapi";
|
|
2
|
+
import { Context } from "effect";
|
|
3
|
+
import { RateLimitExceeded } from "@namera-ai/protocol";
|
|
4
|
+
//#region src/middlewares/admin.d.ts
|
|
5
|
+
declare const CurrentAdmin_base: Context.ServiceClass<CurrentAdmin, "@namera-ai/api/CurrentAdmin", {
|
|
6
|
+
readonly type: "admin";
|
|
7
|
+
readonly credential: "shared-token";
|
|
8
|
+
}>;
|
|
9
|
+
declare class CurrentAdmin extends CurrentAdmin_base {}
|
|
10
|
+
declare const AdminAuthorization_base: HttpApiMiddleware.ServiceClass<AdminAuthorization, "@namera-ai/api/AdminAuthorization", {
|
|
11
|
+
requires: never;
|
|
12
|
+
provides: CurrentAdmin;
|
|
13
|
+
error: readonly [import("effect/unstable/httpapi/HttpApiSchema").asNoContent<typeof HttpApiError.Unauthorized>, import("effect/unstable/httpapi/HttpApiSchema").asNoContent<typeof HttpApiError.InternalServerError>, typeof RateLimitExceeded];
|
|
14
|
+
clientError: never;
|
|
15
|
+
requiredForClient: false;
|
|
16
|
+
security: {
|
|
17
|
+
readonly bearer: HttpApiSecurity.Http;
|
|
18
|
+
};
|
|
19
|
+
}, HttpApiMiddleware.HttpApiMiddlewareSecurity<{
|
|
20
|
+
readonly bearer: HttpApiSecurity.Http;
|
|
21
|
+
}, CurrentAdmin, readonly [import("effect/unstable/httpapi/HttpApiSchema").asNoContent<typeof HttpApiError.Unauthorized>, import("effect/unstable/httpapi/HttpApiSchema").asNoContent<typeof HttpApiError.InternalServerError>, typeof RateLimitExceeded], never>>;
|
|
22
|
+
declare class AdminAuthorization extends AdminAuthorization_base {}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { AdminAuthorization, CurrentAdmin };
|
|
25
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","names":[],"sources":["../../src/middlewares/admin.ts"],"mappings":";;;;;WAOmB;WAA8B;;cAFpC,qBAAqB;;;;;;;;;;;;;cAKrB,2BAA2B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpApiError, HttpApiMiddleware, HttpApiSecurity } from "effect/unstable/httpapi";
|
|
2
|
+
import { Context } from "effect";
|
|
3
|
+
import { RateLimitExceeded } from "@namera-ai/protocol";
|
|
4
|
+
|
|
5
|
+
//#region src/middlewares/admin.ts
|
|
6
|
+
var CurrentAdmin = class extends Context.Service()("@namera-ai/api/CurrentAdmin") {};
|
|
7
|
+
var AdminAuthorization = class extends HttpApiMiddleware.Service()("@namera-ai/api/AdminAuthorization", {
|
|
8
|
+
error: [
|
|
9
|
+
HttpApiError.UnauthorizedNoContent,
|
|
10
|
+
HttpApiError.InternalServerErrorNoContent,
|
|
11
|
+
RateLimitExceeded
|
|
12
|
+
],
|
|
13
|
+
security: { bearer: HttpApiSecurity.bearer }
|
|
14
|
+
}) {};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { AdminAuthorization, CurrentAdmin };
|
|
18
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","names":[],"sources":["../../src/middlewares/admin.ts"],"sourcesContent":["import { Context } from \"effect\";\nimport { HttpApiError, HttpApiMiddleware, HttpApiSecurity } from \"effect/unstable/httpapi\";\n\nimport { RateLimitExceeded } from \"@namera-ai/protocol\";\n\nexport class CurrentAdmin extends Context.Service<\n CurrentAdmin,\n { readonly type: \"admin\"; readonly credential: \"shared-token\" }\n>()(\"@namera-ai/api/CurrentAdmin\") {}\n\nexport class AdminAuthorization extends HttpApiMiddleware.Service<\n AdminAuthorization,\n { provides: CurrentAdmin }\n>()(\"@namera-ai/api/AdminAuthorization\", {\n error: [\n HttpApiError.UnauthorizedNoContent,\n HttpApiError.InternalServerErrorNoContent,\n RateLimitExceeded,\n ],\n security: { bearer: HttpApiSecurity.bearer },\n}) {}\n"],"mappings":";;;;;AAKA,IAAa,eAAb,cAAkC,QAAQ,QAGxC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAEpC,IAAa,qBAAb,cAAwC,kBAAkB,QAGxD,CAAC,CAAC,qCAAqC;CACvC,OAAO;EACL,aAAa;EACb,aAAa;EACb;CACF;CACA,UAAU,EAAE,QAAQ,gBAAgB,OAAO;AAC7C,CAAC,CAAC,CAAC,CAAC"}
|