@gettersethya/mira-client 0.1.0-alpha.2 → 0.1.0-alpha.21
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 +147 -0
- package/dist/src/client/auth.d.ts +38 -13
- package/dist/src/client/auth.d.ts.map +1 -1
- package/dist/src/client/auth.js +25 -1
- package/dist/src/client/auth.js.map +1 -1
- package/dist/src/client/collection.d.ts +30 -13
- package/dist/src/client/collection.d.ts.map +1 -1
- package/dist/src/client/collection.js +17 -9
- package/dist/src/client/collection.js.map +1 -1
- package/dist/src/client/factory.d.ts +27 -3
- package/dist/src/client/factory.d.ts.map +1 -1
- package/dist/src/client/factory.js +19 -8
- package/dist/src/client/factory.js.map +1 -1
- package/dist/src/client/file.d.ts +2 -2
- package/dist/src/client/file.d.ts.map +1 -1
- package/dist/src/client/file.js +1 -1
- package/dist/src/client/file.js.map +1 -1
- package/dist/src/client/handler.d.ts +1 -1
- package/dist/src/client/handler.d.ts.map +1 -1
- package/dist/src/client/handler.js +3 -3
- package/dist/src/client/handler.js.map +1 -1
- package/dist/src/client/index.d.ts +10 -8
- package/dist/src/client/index.d.ts.map +1 -1
- package/dist/src/client/index.js +4 -3
- package/dist/src/client/index.js.map +1 -1
- package/dist/src/client/telemetry.d.ts +81 -0
- package/dist/src/client/telemetry.d.ts.map +1 -0
- package/dist/src/client/telemetry.js +34 -0
- package/dist/src/client/telemetry.js.map +1 -0
- package/dist/src/client/types.d.ts +2 -118
- package/dist/src/client/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- 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/tests/client/auth.test.js +64 -3
- package/dist/tests/client/auth.test.js.map +1 -1
- package/dist/tests/client/collection.test.js +101 -14
- package/dist/tests/client/collection.test.js.map +1 -1
- package/dist/tests/client/factory.test.d.ts +2 -0
- package/dist/tests/client/factory.test.d.ts.map +1 -0
- package/dist/tests/client/factory.test.js +48 -0
- package/dist/tests/client/factory.test.js.map +1 -0
- package/dist/tests/client/handler.test.js +3 -3
- package/dist/tests/client/handler.test.js.map +1 -1
- package/dist/tests/client/telemetry.test.d.ts +2 -0
- package/dist/tests/client/telemetry.test.d.ts.map +1 -0
- package/dist/tests/client/telemetry.test.js +30 -0
- package/dist/tests/client/telemetry.test.js.map +1 -0
- package/dist/tests/client/types.test.js +26 -3
- package/dist/tests/client/types.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# @gettersethya/mira-client
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@gettersethya/mira-client)
|
|
4
|
+
|
|
5
|
+
> **Early pre-alpha.** Breaking changes may occur without notice.
|
|
6
|
+
|
|
7
|
+
Type-safe client SDK for [Mira](https://github.com/gettersethya/mira). Works in the browser and Node.js (SSR). Every operation returns a handler with both a Promise interface (`.raw()`) and an Effect interface (`.toEffect()`).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @gettersethya/mira-client @gettersethya/mira-collection effect
|
|
13
|
+
# or
|
|
14
|
+
pnpm add @gettersethya/mira-client @gettersethya/mira-collection effect
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { createMiraClient } from "@gettersethya/mira-client"
|
|
21
|
+
import { Posts, Users } from "./collections.js"
|
|
22
|
+
|
|
23
|
+
// Browser — token stored automatically in a cookie
|
|
24
|
+
const mira = createMiraClient("/").withCollections({ posts: Posts, users: Users })
|
|
25
|
+
|
|
26
|
+
// Server — token managed manually
|
|
27
|
+
const mira = createMiraClient("http://localhost:3000", { type: "server" })
|
|
28
|
+
.withCollections({ posts: Posts, users: Users })
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Queries
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// Paginated list — returns { items, nextCursor }
|
|
35
|
+
const { items, nextCursor } = await mira.posts.getList({
|
|
36
|
+
filter: (f) => f.field("published").eq(true),
|
|
37
|
+
sort: "created",
|
|
38
|
+
order: "desc",
|
|
39
|
+
limit: 10,
|
|
40
|
+
cursor: null,
|
|
41
|
+
expand: ["authorId"],
|
|
42
|
+
select: ["id", "title", "authorId"],
|
|
43
|
+
}).raw()
|
|
44
|
+
|
|
45
|
+
// Single record by id
|
|
46
|
+
const post = await mira.posts.getOne("post-id").raw()
|
|
47
|
+
|
|
48
|
+
// First match or nothing (returns Option<T>)
|
|
49
|
+
const latest = await mira.posts.getFirstOrNone({
|
|
50
|
+
filter: (f) => f.field("published").eq(true),
|
|
51
|
+
sort: "created",
|
|
52
|
+
order: "desc",
|
|
53
|
+
}).raw()
|
|
54
|
+
|
|
55
|
+
// All records as a flat array (no pagination)
|
|
56
|
+
const all = await mira.posts.getFullList({ limit: 5000 }).raw()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Mutations
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Create
|
|
63
|
+
const post = await mira.posts.create().raw({ title: "Hello", published: false })
|
|
64
|
+
|
|
65
|
+
// Create with file upload — pass File or Blob for file fields
|
|
66
|
+
const post = await mira.posts.create().raw({
|
|
67
|
+
title: "With Image",
|
|
68
|
+
thumbnail: new File([bytes], "thumb.png", { type: "image/png" }),
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// Update
|
|
72
|
+
const updated = await mira.posts.update().raw({ id: "post-id", data: { title: "Updated" } })
|
|
73
|
+
|
|
74
|
+
// Delete
|
|
75
|
+
await mira.posts.delete().raw("post-id")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Authentication
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// Login — the server sets an HttpOnly cookie (browser) or returns a token (server)
|
|
82
|
+
const { token, record } = await mira.users.authWithPassword().raw({
|
|
83
|
+
email: "user@example.com",
|
|
84
|
+
password: "password123",
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// Browser: restore session state from the persisted cookie on app startup
|
|
88
|
+
await mira.auth.refresh() // hits GET /api/auth/me
|
|
89
|
+
mira.auth.isLoggedIn() // boolean — synchronous, reflects last known state
|
|
90
|
+
mira.auth.clear() // POST /api/auth/logout, then resets the flag
|
|
91
|
+
|
|
92
|
+
// Server: manage the token manually
|
|
93
|
+
mira.auth.setToken(token)
|
|
94
|
+
mira.auth.token // string | null
|
|
95
|
+
mira.auth.isValid() // boolean — checks the JWT exp claim
|
|
96
|
+
mira.auth.clear()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Effect-based usage
|
|
100
|
+
|
|
101
|
+
Every handler exposes `.toEffect()` for use inside Effect pipelines.
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { Effect } from "effect"
|
|
105
|
+
|
|
106
|
+
const effect = mira.posts.getList({ limit: 10 }).toEffect()
|
|
107
|
+
// Effect.Effect<{ items: Post[], nextCursor: number | null }, MiraError, HttpClient>
|
|
108
|
+
|
|
109
|
+
Effect.gen(function* () {
|
|
110
|
+
const { items } = yield* mira.posts.getList({ limit: 10 }).toEffect()
|
|
111
|
+
const post = yield* mira.posts.getOne("post-id").toEffect()
|
|
112
|
+
})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## File URLs
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { buildFileUrl } from "@gettersethya/mira-client"
|
|
119
|
+
|
|
120
|
+
// Public file
|
|
121
|
+
const url = buildFileUrl("posts", postId, "thumb.png")
|
|
122
|
+
|
|
123
|
+
// Protected file — request a short-lived token first
|
|
124
|
+
const res = await fetch("/api/files/token", {
|
|
125
|
+
method: "POST",
|
|
126
|
+
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
|
|
127
|
+
body: JSON.stringify({ collection: "posts" }),
|
|
128
|
+
})
|
|
129
|
+
const { token: fileToken } = await res.json()
|
|
130
|
+
const url = `${buildFileUrl("posts", postId, "thumb.png")}?token=${fileToken}`
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Type inference
|
|
134
|
+
|
|
135
|
+
These types now live in `@gettersethya/mira-collection` and are re-exported here for convenience.
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import type { InferRecord, InferCreateInput } from "@gettersethya/mira-collection"
|
|
139
|
+
// ...or import them from "@gettersethya/mira-client"
|
|
140
|
+
|
|
141
|
+
type Post = InferRecord<typeof Posts> // full record with system fields
|
|
142
|
+
type NewPost = InferCreateInput<typeof Posts> // creation input, no system fields
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## More
|
|
146
|
+
|
|
147
|
+
See the [Mira root README](https://github.com/gettersethya/mira) for full documentation.
|
|
@@ -1,28 +1,53 @@
|
|
|
1
|
-
import type { HttpClient } from "@effect/platform";
|
|
2
1
|
import { Effect, MutableRef } from "effect";
|
|
2
|
+
import type { HttpClient } from "effect/http";
|
|
3
3
|
import type { MiraError } from "./errors.js";
|
|
4
4
|
import type { ClientHandler, ExecuteFn } from "./handler.js";
|
|
5
5
|
/**
|
|
6
|
-
* Browser-side authentication helper.
|
|
7
|
-
* the client has authenticated.
|
|
6
|
+
* Browser-side authentication helper.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* The server sets an HttpOnly cookie (`mira_token`) on successful login. The
|
|
9
|
+
* browser sends it automatically on every same-origin request — the client
|
|
10
|
+
* never reads or writes it directly.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Because the cookie is HttpOnly, the client cannot tell on page load whether
|
|
13
|
+
* a session exists. Use `ensureSession()` (or `refresh()`) to re-validate the
|
|
14
|
+
* cookie against the server and restore `isLoggedIn()` state.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* // user is authenticated
|
|
19
|
-
* }
|
|
20
|
-
* mira.auth.clear() // sends POST /api/auth/logout
|
|
16
|
+
* `clear()` calls `POST /api/auth/logout` to clear the cookie server-side,
|
|
17
|
+
* then resets the in-memory login flag.
|
|
21
18
|
*
|
|
22
19
|
* @see ServerAuth — server-side alternative for SSR environments
|
|
23
20
|
*/
|
|
24
21
|
export type BrowserAuth = {
|
|
22
|
+
/** True if the user logged in during this page session or a session check confirmed a valid cookie. */
|
|
25
23
|
isLoggedIn(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Calls `GET /api/auth/me` to check whether a valid `mira_token` cookie exists.
|
|
26
|
+
* Sets the in-memory login flag to match the server's answer.
|
|
27
|
+
* Call this once on app startup to restore login state after a page reload.
|
|
28
|
+
*
|
|
29
|
+
* Always performs a fresh request (does not dedupe). Prefer `ensureSession()`
|
|
30
|
+
* in route guards so multiple guards share a single request per page load.
|
|
31
|
+
*
|
|
32
|
+
* @returns true if a valid session exists, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
refresh(): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Like `refresh()`, but memoized per page load: the first call issues a
|
|
37
|
+
* single `GET /api/auth/me` and every subsequent call returns the same
|
|
38
|
+
* in-flight/recently-resolved promise. Safe to call from many async route
|
|
39
|
+
* guards without triggering duplicate requests.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // TanStack Router guard
|
|
43
|
+
* beforeLoad: async () => {
|
|
44
|
+
* if (!(await client.auth.ensureSession())) throw redirect({ to: "/login" })
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* @returns true if a valid session exists, false otherwise
|
|
48
|
+
*/
|
|
49
|
+
ensureSession(): Promise<boolean>;
|
|
50
|
+
/** Calls `POST /api/auth/logout` to clear the server cookie, then resets the login flag. */
|
|
26
51
|
clear(): void;
|
|
27
52
|
};
|
|
28
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/client/auth.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/client/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,uGAAuG;IACvG,UAAU,IAAI,OAAO,CAAA;IACrB;;;;;;;;;OASG;IACH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3B;;;;;;;;;;;;;OAaG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC,4FAA4F;IAC5F,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,KAAK,IAAI,IAAI,CAAA;IACb,OAAO,IAAI,OAAO,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,EAClB,iBAAiB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,EACtG,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,GAC1C,WAAW,CAyCb;AAcD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,EAClD,iBAAiB,EAAE,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,GAC1F,UAAU,CAoBZ"}
|
package/dist/src/client/auth.js
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
|
-
import { HttpClientRequest as HCR } from "@effect/platform";
|
|
2
1
|
import { Effect, MutableRef } from "effect";
|
|
2
|
+
import { HttpClientRequest as HCR } from "effect/http";
|
|
3
3
|
/**
|
|
4
4
|
* Factory function for `BrowserAuth`. Called internally by `createMiraClient` in browser mode.
|
|
5
5
|
* @internal Use `createMiraClient()` instead of calling this directly
|
|
6
6
|
*/
|
|
7
7
|
export function makeBrowserAuth(execute, makeClientHandler, loggedInRef) {
|
|
8
|
+
let sessionPromise = null;
|
|
9
|
+
const checkSession = async () => {
|
|
10
|
+
try {
|
|
11
|
+
const effect = execute(HCR.get("/api/auth/me"));
|
|
12
|
+
await makeClientHandler(effect).raw();
|
|
13
|
+
MutableRef.set(loggedInRef, true);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
MutableRef.set(loggedInRef, false);
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
8
21
|
return {
|
|
9
22
|
isLoggedIn: () => MutableRef.get(loggedInRef),
|
|
23
|
+
refresh: () => {
|
|
24
|
+
sessionPromise = checkSession();
|
|
25
|
+
return sessionPromise;
|
|
26
|
+
},
|
|
27
|
+
ensureSession: () => {
|
|
28
|
+
if (sessionPromise === null) {
|
|
29
|
+
sessionPromise = checkSession();
|
|
30
|
+
}
|
|
31
|
+
return sessionPromise;
|
|
32
|
+
},
|
|
10
33
|
clear: () => {
|
|
34
|
+
sessionPromise = null;
|
|
11
35
|
const effect = Effect.gen(function* () {
|
|
12
36
|
yield* execute(HCR.post("/api/auth/logout"));
|
|
13
37
|
MutableRef.set(loggedInRef, false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/client/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/client/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAE3C,OAAO,EAAE,iBAAiB,IAAI,GAAG,EAAE,MAAM,aAAa,CAAA;AAgFtD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAkB,EAClB,iBAAsG,EACtG,WAA2C;IAE3C,IAAI,cAAc,GAA4B,IAAI,CAAA;IAElD,MAAM,YAAY,GAAG,KAAK,IAAsB,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CACxB,CAAA;YACD,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAA;YACrC,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;YACjC,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,MAAM,CAAC;YACP,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;YAClC,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC,CAAA;IAED,OAAO;QACL,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC;QAE7C,OAAO,EAAE,GAAG,EAAE;YACZ,cAAc,GAAG,YAAY,EAAE,CAAA;YAC/B,OAAO,cAAc,CAAA;QACvB,CAAC;QAED,aAAa,EAAE,GAAG,EAAE;YAClB,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;gBAC5B,cAAc,GAAG,YAAY,EAAE,CAAA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AC,CAAA;QACrC,CAAC;QACD,KAAK,EAAE,GAAS,EAAE;YAChB,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;YAClC,UAAU,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,GAAG,EAAE,CAAC,CAAA;QAC9C,CAAC;QACD,OAAO,EAAE,GAAY,EAAE;YACrB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;YAC1C,IAAI,KAAK,KAAK,IAAI;gBAAE,OAAO,KAAK,CAAA;YAChC,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;YAC/B,IAAI,GAAG,KAAK,IAAI;gBAAE,OAAO,KAAK,CAAA;YAC9B,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAAA;QAChC,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { AnyCollectionDef, FieldFilterOperand, FieldsMap, FilterNode, InferFieldValue } from "@gettersethya/mira-collection";
|
|
2
|
+
import type { Schedule } from "effect";
|
|
3
|
+
import { MutableRef, Option } from "effect";
|
|
3
4
|
import { MiraError } from "./errors.js";
|
|
4
5
|
import type { ClientHandler, ExecuteFn } from "./handler.js";
|
|
5
|
-
import type { CollectionFileFields,
|
|
6
|
+
import type { CollectionFileFields, CollectionKind, CreateInput, InferRecord, RegisterInput, RelationKeys, UpdateInput, WithExpand } from "./types.js";
|
|
6
7
|
/**
|
|
7
8
|
* Optional retry configuration for collection operations.
|
|
8
9
|
* Wraps an Effect `Schedule` that determines retry behavior when a `MiraError` occurs.
|
|
@@ -80,7 +81,7 @@ export type FilterBuilder<F extends FieldsMap> = {
|
|
|
80
81
|
* @see makeCollectionClient — constructs CollectionClient instances
|
|
81
82
|
* @see ClientHandler — return type of all methods
|
|
82
83
|
*/
|
|
83
|
-
export type CollectionClient<F extends FieldsMap> = {
|
|
84
|
+
export type CollectionClient<F extends FieldsMap, K extends CollectionKind = "base"> = {
|
|
84
85
|
/**
|
|
85
86
|
* List records with optional filtering, sorting, cursor pagination, and field selection.
|
|
86
87
|
*
|
|
@@ -106,7 +107,7 @@ export type CollectionClient<F extends FieldsMap> = {
|
|
|
106
107
|
* @returns ClientHandler for the paginated result
|
|
107
108
|
*/
|
|
108
109
|
getList<E extends ReadonlyArray<RelationKeys<F>> = []>(options?: GetListOptions<F, E>): ClientHandler<{
|
|
109
|
-
items: WithExpand<F, E
|
|
110
|
+
items: Array<WithExpand<F, E>>;
|
|
110
111
|
nextCursor: number | null;
|
|
111
112
|
}>;
|
|
112
113
|
/**
|
|
@@ -142,7 +143,7 @@ export type CollectionClient<F extends FieldsMap> = {
|
|
|
142
143
|
*/
|
|
143
144
|
getFullList<E extends ReadonlyArray<RelationKeys<F>> = []>(options?: Omit<GetListOptions<F, E>, "limit" | "cursor"> & {
|
|
144
145
|
limit?: number;
|
|
145
|
-
}): ClientHandler<WithExpand<F, E
|
|
146
|
+
}): ClientHandler<Array<WithExpand<F, E>>>;
|
|
146
147
|
/**
|
|
147
148
|
* Get a single record by its `id`.
|
|
148
149
|
* Returns a 404 `MiraError` if the record does not exist.
|
|
@@ -162,7 +163,7 @@ export type CollectionClient<F extends FieldsMap> = {
|
|
|
162
163
|
*
|
|
163
164
|
* @returns A mutation ClientHandler — call `.raw(input)` with the record data
|
|
164
165
|
*/
|
|
165
|
-
create(): ClientHandler<InferRecord<F>,
|
|
166
|
+
create(): ClientHandler<InferRecord<F>, CreateInput<F, K>>;
|
|
166
167
|
/**
|
|
167
168
|
* Update an existing record by ID.
|
|
168
169
|
* Only the fields present in `data` are updated (partial/patch semantics).
|
|
@@ -172,10 +173,7 @@ export type CollectionClient<F extends FieldsMap> = {
|
|
|
172
173
|
*
|
|
173
174
|
* @returns A mutation ClientHandler — call `.raw({ id, data })`
|
|
174
175
|
*/
|
|
175
|
-
update(): ClientHandler<InferRecord<F>,
|
|
176
|
-
id: string;
|
|
177
|
-
data: Partial<InferMutationInput<F>>;
|
|
178
|
-
}>;
|
|
176
|
+
update(): ClientHandler<InferRecord<F>, UpdateInput<F, K>>;
|
|
179
177
|
/**
|
|
180
178
|
* Delete a record by ID.
|
|
181
179
|
* Returns `void` on success. Throws `MiraError` (404) if the record does not exist.
|
|
@@ -203,6 +201,24 @@ export type CollectionClient<F extends FieldsMap> = {
|
|
|
203
201
|
email: string;
|
|
204
202
|
password: string;
|
|
205
203
|
}>;
|
|
204
|
+
/**
|
|
205
|
+
* Register (self-signup) a new user on an auth collection.
|
|
206
|
+
* Only available on collections defined with `AuthCollection.define()`.
|
|
207
|
+
*
|
|
208
|
+
* Wraps the create endpoint (`POST /api/collections/:name`) — open registration
|
|
209
|
+
* therefore requires the collection's create rule to permit it (e.g. `create: R.public()`).
|
|
210
|
+
* Does **not** auto-login; call `authWithPassword()` after if needed.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* const user = await mira.users.register().raw({
|
|
214
|
+
* email: "user@example.com",
|
|
215
|
+
* password: "secret123",
|
|
216
|
+
* passwordConfirm: "secret123"
|
|
217
|
+
* })
|
|
218
|
+
*
|
|
219
|
+
* @returns A mutation ClientHandler — call `.raw({ email, password, passwordConfirm, ... })`
|
|
220
|
+
*/
|
|
221
|
+
register?(): ClientHandler<InferRecord<F>, RegisterInput<F>>;
|
|
206
222
|
/**
|
|
207
223
|
* File field client interfaces for the collection.
|
|
208
224
|
* Provides `.url()` and `.asyncUrl()` methods for constructing file download URLs.
|
|
@@ -212,7 +228,7 @@ export type CollectionClient<F extends FieldsMap> = {
|
|
|
212
228
|
*/
|
|
213
229
|
fields: CollectionFileFields<F>;
|
|
214
230
|
};
|
|
215
|
-
type MakeCollectionClientParams<F extends FieldsMap> = {
|
|
231
|
+
type MakeCollectionClientParams<F extends FieldsMap, K extends CollectionKind = "base"> = {
|
|
216
232
|
collectionName: string;
|
|
217
233
|
schema: AnyCollectionDef["schema"];
|
|
218
234
|
fields: F;
|
|
@@ -225,6 +241,7 @@ type MakeCollectionClientParams<F extends FieldsMap> = {
|
|
|
225
241
|
expiresAt: number;
|
|
226
242
|
}>>;
|
|
227
243
|
isAuth: boolean;
|
|
244
|
+
kind?: K;
|
|
228
245
|
defaultRetryOptions?: RetryOptions;
|
|
229
246
|
};
|
|
230
247
|
/**
|
|
@@ -234,6 +251,6 @@ type MakeCollectionClientParams<F extends FieldsMap> = {
|
|
|
234
251
|
*
|
|
235
252
|
* @internal Use `createMiraClient().collection(def)` or `withCollections()` instead.
|
|
236
253
|
*/
|
|
237
|
-
export declare function makeCollectionClient<F extends FieldsMap>(params: MakeCollectionClientParams<F>): CollectionClient<F>;
|
|
254
|
+
export declare function makeCollectionClient<F extends FieldsMap, K extends CollectionKind = "base">(params: MakeCollectionClientParams<F, K>): CollectionClient<F, K>;
|
|
238
255
|
export {};
|
|
239
256
|
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/client/collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/client/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAC,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEhI,OAAO,KAAK,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAU,UAAU,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAK3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,WA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A0B,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,cAAc,GAAG,MAAM,IAAI;IACxF,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IAClC,MAAM,EAAE,CAAC,CAAA;IACT,OAAO,EAAE,SAAS,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;IACzD,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAClD,iBAAiB,EAAE,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAA;IAC3F,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,CAAC,CAAA;IACR,mBAAmB,CAAC,EAAE,YAAY,CAAA;CACnC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,cAAc,GAAG,MAAM,EACzF,MAAM,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,GACvC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CA2IxB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { HttpClientRequest as HCR } from "@effect/platform";
|
|
2
|
-
import { Effect, MutableRef, Option, Schema } from "effect";
|
|
3
1
|
import { Filter, FilterNodeSchema } from "@gettersethya/mira-collection";
|
|
2
|
+
import { Effect, MutableRef, Option, Schema } from "effect";
|
|
3
|
+
import { HttpClientRequest as HCR } from "effect/http";
|
|
4
4
|
import { MiraError } from "./errors.js";
|
|
5
|
-
import { makeClientHandler as makeHandler, makeMutationHandler } from "./handler.js";
|
|
6
5
|
import { makeFileFields } from "./file.js";
|
|
6
|
+
import { makeClientHandler as makeHandler, makeMutationHandler } from "./handler.js";
|
|
7
7
|
function toExecuteEffect(reqEffect, execute) {
|
|
8
8
|
return reqEffect.pipe(Effect.flatMap((req) => execute(req)), Effect.catchTag("HttpBodyError", (e) => Effect.fail(new MiraError({ status: 500, body: String(e) }))));
|
|
9
9
|
}
|
|
@@ -47,7 +47,7 @@ function buildQueryParams(params) {
|
|
|
47
47
|
* @internal Use `createMiraClient().collection(def)` or `withCollections()` instead.
|
|
48
48
|
*/
|
|
49
49
|
export function makeCollectionClient(params) {
|
|
50
|
-
const {
|
|
50
|
+
const { authTokenRef, baseUrl, collectionName, defaultRetryOptions, execute, fields, fileTokenCacheRef, isAuth, loggedInRef, schema } = params;
|
|
51
51
|
function withRetry(effect, methodOptions) {
|
|
52
52
|
const schedule = methodOptions?.retryOptions?.schedule ?? defaultRetryOptions?.schedule;
|
|
53
53
|
return schedule ? Effect.retry(effect, schedule) : effect;
|
|
@@ -56,7 +56,7 @@ export function makeCollectionClient(params) {
|
|
|
56
56
|
function getList(options) {
|
|
57
57
|
const filterNode = options?.filter?.(makeFilterBuilder());
|
|
58
58
|
const queryParams = buildQueryParams({
|
|
59
|
-
...(filterNode ? { filter: Schema.encodeSync(Schema.
|
|
59
|
+
...(filterNode ? { filter: Schema.encodeSync(Schema.fromJsonString(FilterNodeSchema))(filterNode) } : {}),
|
|
60
60
|
...(options?.sort ? { sort: options.sort } : {}),
|
|
61
61
|
...(options?.order ? { order: options.order } : {}),
|
|
62
62
|
...(options?.cursor != null ? { after: String(options.cursor) } : {}),
|
|
@@ -70,7 +70,7 @@ export function makeCollectionClient(params) {
|
|
|
70
70
|
function getFirstOrNone(filter, options) {
|
|
71
71
|
const effect = getList({ ...options, filter, limit: 1 })
|
|
72
72
|
.toEffect()
|
|
73
|
-
.pipe(Effect.map(({ items }) => Option.
|
|
73
|
+
.pipe(Effect.map(({ items }) => Option.fromNullishOr(items[0] ?? null)));
|
|
74
74
|
return makeHandler(effect);
|
|
75
75
|
}
|
|
76
76
|
function getFullList(options) {
|
|
@@ -96,7 +96,7 @@ export function makeCollectionClient(params) {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
function update() {
|
|
99
|
-
return makeMutationHandler(({
|
|
99
|
+
return makeMutationHandler(({ data, id }) => {
|
|
100
100
|
const reqEffect = hasFileOrBlob(data)
|
|
101
101
|
? Effect.succeed(HCR.bodyFormData(HCR.patch(`/api/collections/${collectionName}/${id}`), buildFormData(data)))
|
|
102
102
|
: HCR.bodyJson(HCR.patch(`/api/collections/${collectionName}/${id}`), data);
|
|
@@ -105,7 +105,7 @@ export function makeCollectionClient(params) {
|
|
|
105
105
|
}
|
|
106
106
|
function deleteFn() {
|
|
107
107
|
return makeMutationHandler((id) => {
|
|
108
|
-
const effect = execute(HCR.
|
|
108
|
+
const effect = execute(HCR.delete(`/api/collections/${collectionName}/${id}`));
|
|
109
109
|
return withRetry(effect);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -121,6 +121,14 @@ export function makeCollectionClient(params) {
|
|
|
121
121
|
return res;
|
|
122
122
|
})));
|
|
123
123
|
}
|
|
124
|
+
function register() {
|
|
125
|
+
return makeMutationHandler((input) => {
|
|
126
|
+
const reqEffect = hasFileOrBlob(input)
|
|
127
|
+
? Effect.succeed(HCR.bodyFormData(HCR.post(`/api/collections/${collectionName}`), buildFormData(input)))
|
|
128
|
+
: HCR.bodyJson(HCR.post(`/api/collections/${collectionName}`), input);
|
|
129
|
+
return withRetry(toExecuteEffect(reqEffect, execute));
|
|
130
|
+
});
|
|
131
|
+
}
|
|
124
132
|
const client = {
|
|
125
133
|
getList,
|
|
126
134
|
getFirstOrNone,
|
|
@@ -129,7 +137,7 @@ export function makeCollectionClient(params) {
|
|
|
129
137
|
create,
|
|
130
138
|
update,
|
|
131
139
|
delete: deleteFn,
|
|
132
|
-
...(isAuth ? { authWithPassword } : {}),
|
|
140
|
+
...(isAuth ? { authWithPassword, register } : {}),
|
|
133
141
|
fields: fileFields,
|
|
134
142
|
};
|
|
135
143
|
return client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/client/collection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/client/collection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAExE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE3D,OAAO,EAAE,iBAAiB,IAAI,GAAG,EAAE,MAAM,aAAa,CAAA;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE1C,OAAO,EAAE,iBAAiB,IAAI,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAKpF,SAAS,eAAe,CACtB,SAA0B,EAC1B,OAAkB;IAElB,OAAO,SAAS,CAAC,IAAI,CACnB,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAI,GAAG,CAAC,CAAC,EACxC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,CACrC,MAAM,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAC7D,CACF,CAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,IAAI,CAAC,CAAA;AAC5D,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,M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BAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,MAAM,EAAE,UAAU;KACnB,CAAA;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -2,17 +2,40 @@ import type { AnyCollectionDef, FieldsMap } from "@gettersethya/mira-collection"
|
|
|
2
2
|
import type { BrowserAuth, ServerAuth } from "./auth.js";
|
|
3
3
|
import type { CollectionClient, RetryOptions } from "./collection.js";
|
|
4
4
|
import type { ClientHandler } from "./handler.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { TelemetryClient } from "./telemetry.js";
|
|
6
|
+
import type { AnyAuthCollectionDef, InferRecord, RegisterInput } from "./types.js";
|
|
6
7
|
type CollectionAdapter = <F extends FieldsMap>(client: CollectionClient<F>, name: string) => CollectionClient<F>;
|
|
7
8
|
type BaseClient<A extends BrowserAuth | ServerAuth = BrowserAuth | ServerAuth> = {
|
|
8
|
-
collection<C extends AnyCollectionDef>(def: C): CollectionClient<C["fields"]>;
|
|
9
|
+
collection<C extends AnyCollectionDef>(def: C): CollectionClient<C["fields"], C["schema"]["x-collection-kind"]>;
|
|
9
10
|
auth: A;
|
|
11
|
+
telemetry: TelemetryClient;
|
|
10
12
|
withCollections<M extends Record<string, AnyCollectionDef>>(map: M, opts?: {
|
|
11
13
|
adapter?: CollectionAdapter;
|
|
12
14
|
}): BaseClient<A> & CollectionAccessors<M>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches the currently authenticated user from `GET /api/auth/me`.
|
|
17
|
+
*
|
|
18
|
+
* Pass an auth collection definition to get a typed response:
|
|
19
|
+
* @example
|
|
20
|
+
* const result = await mira.me(MyAuthCollection).raw()
|
|
21
|
+
* // result.record is typed as InferRecord<MyAuthCollection["fields"]>
|
|
22
|
+
*
|
|
23
|
+
* Or call with no args for an untyped response (backward compat):
|
|
24
|
+
* @example
|
|
25
|
+
* const result = await mira.me().raw()
|
|
26
|
+
* // result.record is Record<string, unknown>
|
|
27
|
+
*/
|
|
28
|
+
me<C extends AnyAuthCollectionDef>(def: C): ClientHandler<{
|
|
29
|
+
collection: string;
|
|
30
|
+
record: InferRecord<C["fields"]>;
|
|
31
|
+
}>;
|
|
32
|
+
me(): ClientHandler<{
|
|
33
|
+
collection: string;
|
|
34
|
+
record: Record<string, unknown>;
|
|
35
|
+
}>;
|
|
13
36
|
};
|
|
14
37
|
type CollectionAccessors<M extends Record<string, AnyCollectionDef>> = {
|
|
15
|
-
[K in keyof M]: CollectionClient<M[K]["fields"]> & (M[K]["schema"]["x-collection-kind"] extends "auth" ? {
|
|
38
|
+
[K in keyof M]: CollectionClient<M[K]["fields"], M[K]["schema"]["x-collection-kind"]> & (M[K]["schema"]["x-collection-kind"] extends "auth" ? {
|
|
16
39
|
authWithPassword(): ClientHandler<{
|
|
17
40
|
token: string;
|
|
18
41
|
record: InferRecord<M[K]["fields"]>;
|
|
@@ -20,6 +43,7 @@ type CollectionAccessors<M extends Record<string, AnyCollectionDef>> = {
|
|
|
20
43
|
email: string;
|
|
21
44
|
password: string;
|
|
22
45
|
}>;
|
|
46
|
+
register(): ClientHandler<InferRecord<M[K]["fields"]>, RegisterInput<M[K]["fields"]>>;
|
|
23
47
|
} : {});
|
|
24
48
|
};
|
|
25
49
|
type BrowserMiraClient = BaseClient<BrowserAuth>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/client/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/client/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAMhF,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAGrE,OAAO,KAAK,EAAE,aAAa,E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