fimo 0.2.3-staging.9 → 0.2.4-staging.12
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/assets/content-templates/hooks-template.eta +22 -10
- package/assets/skills/fimo/references/content.md +19 -6
- package/assets/skills/fimo-cli/references/content.md +6 -3
- package/assets/skills/fimo-studio/references/code-editor.md +1 -1
- package/dist/cli/bundle.json +2 -2
- package/dist/cli/index.js +9 -10
- package/dist/runtime/primitives/lib/index.d.ts +1 -1
- package/dist/runtime/primitives/lib/index.d.ts.map +1 -1
- package/dist/runtime/primitives/lib/query.d.ts +10 -1
- package/dist/runtime/primitives/lib/query.d.ts.map +1 -1
- package/dist/runtime/templates.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/react-router/package.json +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
%>
|
|
10
10
|
// AUTO-GENERATED ⚠️ – do not edit by hand
|
|
11
11
|
import { useSuspenseQuery, useQuery, useMutation, useQueryClient, QueryKey } from "@tanstack/react-query";
|
|
12
|
-
import { FimoString, FimoDate, FimoMedia, FimoBoolean, FimoRichText, type Query, type Sort, type Where } from "fimo/ui";
|
|
12
|
+
import { FimoString, FimoDate, FimoMedia, FimoBoolean, FimoRichText, type Fields, type Projected, type Query, type Sort, type Where } from "fimo/ui";
|
|
13
13
|
|
|
14
14
|
/*───────────────────────────────────────────────────────────────*/
|
|
15
15
|
/* ──────────── 📄 Type definitions ──────────── */
|
|
@@ -21,6 +21,9 @@ import { FimoString, FimoDate, FimoMedia, FimoBoolean, FimoRichText, type Query,
|
|
|
21
21
|
export interface <%= model.pascal %> {
|
|
22
22
|
id: string;
|
|
23
23
|
slug: FimoString;
|
|
24
|
+
contentType: string;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
24
27
|
<%
|
|
25
28
|
// Generate interface properties based on fields
|
|
26
29
|
if (model.fields) {
|
|
@@ -65,7 +68,9 @@ function getTypeForField(field) {
|
|
|
65
68
|
|
|
66
69
|
export type <%= model.pascal %>Where = Where<<%= model.pascal %>>;
|
|
67
70
|
export type <%= model.pascal %>Sort = Sort<<%= model.pascal %>>;
|
|
68
|
-
export type <%= model.pascal %>
|
|
71
|
+
export type <%= model.pascal %>Fields = Fields<<%= model.pascal %>>;
|
|
72
|
+
export type <%= model.pascal %>Query<TFields extends <%= model.pascal %>Fields | undefined = <%= model.pascal %>Fields | undefined> = Query<<%= model.pascal %>, TFields>;
|
|
73
|
+
export type <%= model.pascal %>Result<TFields extends <%= model.pascal %>Fields | undefined = undefined> = Projected<<%= model.pascal %>, TFields>;
|
|
69
74
|
|
|
70
75
|
/*───────────────────────────────────────────────────────────────*/
|
|
71
76
|
/* ──────────── 🎁 Source wrapping ──────────── */
|
|
@@ -81,6 +86,9 @@ function wrapWithSource(entry: Record<string, any>): <%= model.pascal %> {
|
|
|
81
86
|
return {
|
|
82
87
|
id,
|
|
83
88
|
slug: entry.slug != null ? new FimoString(entry.slug, `${sourcePrefix}.slug`) : entry.slug,
|
|
89
|
+
contentType: entry.contentType,
|
|
90
|
+
createdAt: entry.createdAt,
|
|
91
|
+
updatedAt: entry.updatedAt,
|
|
84
92
|
<%
|
|
85
93
|
if (model.fields) {
|
|
86
94
|
Object.entries(model.fields).forEach(([key, field]) => {
|
|
@@ -160,8 +168,8 @@ export async function getByField(fieldName: string, value: string): Promise<<%=
|
|
|
160
168
|
return wrapWithSource(data.data);
|
|
161
169
|
}
|
|
162
170
|
|
|
163
|
-
function toQueryString(params: <%= model.pascal %>Query = {}): string {
|
|
164
|
-
const { where, sort, ...flat } = params;
|
|
171
|
+
function toQueryString<TFields extends <%= model.pascal %>Fields | undefined = undefined>(params: <%= model.pascal %>Query<TFields> = {} as <%= model.pascal %>Query<TFields>): string {
|
|
172
|
+
const { where, sort, fields, ...flat } = params;
|
|
165
173
|
const query = new URLSearchParams();
|
|
166
174
|
|
|
167
175
|
for (const [key, value] of Object.entries(flat)) {
|
|
@@ -173,6 +181,10 @@ function toQueryString(params: <%= model.pascal %>Query = {}): string {
|
|
|
173
181
|
query.set("sort", Array.isArray(sort) ? sort.join(",") : sort);
|
|
174
182
|
}
|
|
175
183
|
|
|
184
|
+
if (fields != null) {
|
|
185
|
+
query.set("fields", Array.isArray(fields) ? fields.join(",") : fields);
|
|
186
|
+
}
|
|
187
|
+
|
|
176
188
|
if (where && Object.keys(where).length > 0) {
|
|
177
189
|
query.set("where", JSON.stringify(where));
|
|
178
190
|
}
|
|
@@ -180,12 +192,12 @@ function toQueryString(params: <%= model.pascal %>Query = {}): string {
|
|
|
180
192
|
return query.toString();
|
|
181
193
|
}
|
|
182
194
|
|
|
183
|
-
export async function get(params: <%= model.pascal %>Query = {}): Promise<<%= model.pascal %>[]> {
|
|
195
|
+
export async function get<TFields extends <%= model.pascal %>Fields | undefined = undefined>(params: <%= model.pascal %>Query<TFields> = {} as <%= model.pascal %>Query<TFields>): Promise<<%= model.pascal %>Result<TFields>[]> {
|
|
184
196
|
const qs = toQueryString(params);
|
|
185
197
|
const res = await fetch(`${base}/entries/<%= model.uid %>${qs ? "?" + qs : ""}`, { headers: fimoHeaders() });
|
|
186
198
|
if (!res.ok) throw new Error(await res.text());
|
|
187
199
|
const data = await res.json();
|
|
188
|
-
return data.data.map(wrapWithSource);
|
|
200
|
+
return data.data.map(wrapWithSource) as <%= model.pascal %>Result<TFields>[];
|
|
189
201
|
}
|
|
190
202
|
|
|
191
203
|
export async function create(payload: Partial<<%= model.pascal %>>): Promise<<%= model.pascal %>> {
|
|
@@ -239,8 +251,8 @@ export function useGetByField(fieldName: string, value: string) {
|
|
|
239
251
|
return useQuery<<%= model.pascal %> | null, Error>({ queryKey: qk.byField(fieldName, value), queryFn: () => getByField(fieldName, value), enabled: !!value });
|
|
240
252
|
}
|
|
241
253
|
|
|
242
|
-
export function useGet(params: <%= model.pascal %>Query = {}) {
|
|
243
|
-
return useQuery<<%= model.pascal %>[], Error>({ queryKey: qk.list(params), queryFn: () => get(params) });
|
|
254
|
+
export function useGet<TFields extends <%= model.pascal %>Fields | undefined = undefined>(params: <%= model.pascal %>Query<TFields> = {} as <%= model.pascal %>Query<TFields>) {
|
|
255
|
+
return useQuery<<%= model.pascal %>Result<TFields>[], Error>({ queryKey: qk.list(params), queryFn: () => get(params) });
|
|
244
256
|
}
|
|
245
257
|
|
|
246
258
|
export function useSuspenseGetById(id: string) {
|
|
@@ -255,8 +267,8 @@ export function useSuspenseGetByField(fieldName: string, value: string) {
|
|
|
255
267
|
return useSuspenseQuery<<%= model.pascal %> | null, Error>({ queryKey: qk.byField(fieldName, value), queryFn: () => getByField(fieldName, value) });
|
|
256
268
|
}
|
|
257
269
|
|
|
258
|
-
export function useSuspenseGet(params: <%= model.pascal %>Query = {}) {
|
|
259
|
-
return useSuspenseQuery<<%= model.pascal %>[], Error>({ queryKey: qk.list(params), queryFn: () => get(params) });
|
|
270
|
+
export function useSuspenseGet<TFields extends <%= model.pascal %>Fields | undefined = undefined>(params: <%= model.pascal %>Query<TFields> = {} as <%= model.pascal %>Query<TFields>) {
|
|
271
|
+
return useSuspenseQuery<<%= model.pascal %>Result<TFields>[], Error>({ queryKey: qk.list(params), queryFn: () => get(params) });
|
|
260
272
|
}
|
|
261
273
|
|
|
262
274
|
export function useCreate() {
|
|
@@ -114,6 +114,10 @@ After pre-build (or `fimo deploy`), `src/schemas/{Uid}.ts` exports typed helpers
|
|
|
114
114
|
```ts
|
|
115
115
|
interface BlogPost {
|
|
116
116
|
id: string;
|
|
117
|
+
slug: FimoString;
|
|
118
|
+
contentType: string;
|
|
119
|
+
createdAt: string;
|
|
120
|
+
updatedAt: string;
|
|
117
121
|
title: FimoString;
|
|
118
122
|
body: FimoRichText;
|
|
119
123
|
coverImage: FimoMedia;
|
|
@@ -130,7 +134,7 @@ interface BlogPost {
|
|
|
130
134
|
getById(id: string): Promise<BlogPost>
|
|
131
135
|
getBySlug(slug: string): Promise<BlogPost | null>
|
|
132
136
|
getByField(fieldName: string, value: string): Promise<BlogPost | null>
|
|
133
|
-
get(params?: BlogPostQuery): Promise<
|
|
137
|
+
get<TFields extends BlogPostFields | undefined>(params?: BlogPostQuery<TFields>): Promise<BlogPostResult<TFields>[]>
|
|
134
138
|
create(payload: Partial<BlogPost>): Promise<BlogPost>
|
|
135
139
|
update(id: string, payload: Partial<BlogPost>): Promise<BlogPost>
|
|
136
140
|
remove(id: string): Promise<void>
|
|
@@ -139,7 +143,7 @@ remove(id: string): Promise<void>
|
|
|
139
143
|
useGetById(id) // → { data: BlogPost | undefined, isLoading, ... }
|
|
140
144
|
useGetBySlug(slug) // → { data: BlogPost | null | undefined, ... } — ideal for /:slug detail routes
|
|
141
145
|
useGetByField(fieldName, value) // → { data: BlogPost | null | undefined, ... }
|
|
142
|
-
useGet(params?)
|
|
146
|
+
useGet<TFields>(params?) // → { data: BlogPostResult<TFields>[] | undefined, isLoading, ... }
|
|
143
147
|
useCreate() / useUpdate() / useRemove()
|
|
144
148
|
|
|
145
149
|
// Suspense variants (same signatures, throw to a <Suspense> boundary instead of returning isLoading)
|
|
@@ -154,9 +158,9 @@ if (isLoading || !posts) return null;
|
|
|
154
158
|
posts.map((post) => /* ... */); // BlogPost[]
|
|
155
159
|
```
|
|
156
160
|
|
|
157
|
-
Query params supported: `limit` (1-100, default 20), `offset` (default 0), `search`, `sort`, and `
|
|
161
|
+
Query params supported: `limit` (1-100, default 20), `offset` (default 0), `search`, `sort`, `where`, and `fields`. Use these canonical names in new code.
|
|
158
162
|
|
|
159
|
-
`where` filters on the server. Use scalar values for equality and operator objects for ranges, lists, text matches, or null checks:
|
|
163
|
+
`where` filters on the server. Use scalar values for equality and operator objects for ranges, lists, text matches, or null checks. Keep boolean, string, and number values typed in the object:
|
|
160
164
|
|
|
161
165
|
```ts
|
|
162
166
|
BlogPost.useGet({
|
|
@@ -174,7 +178,16 @@ BlogPost.useGet({
|
|
|
174
178
|
|
|
175
179
|
Operators: scalar equality, `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in`, `$nin`, `$contains`, `$startsWith`, `$null`.
|
|
176
180
|
|
|
177
|
-
|
|
181
|
+
Use `fields` to keep list payloads small. The API always keeps `id`, and returns only the requested fields beyond that:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
const { data: summaries = [] } = BlogPost.useGet({
|
|
185
|
+
fields: ['slug', 'title', 'excerpt', 'coverImage'] as const,
|
|
186
|
+
sort: '-publishedAt',
|
|
187
|
+
limit: 12,
|
|
188
|
+
});
|
|
189
|
+
// summaries: Array<Pick<BlogPost, 'id' | 'slug' | 'title' | 'excerpt' | 'coverImage'>>
|
|
190
|
+
```
|
|
178
191
|
|
|
179
192
|
The generated hooks do **not** surface pagination meta (`total`, `hasMore`, `limit`, `offset`). If you need it, read it from a raw fetch to `/entries/<typeName>` (see the **Read path** section below), which returns the full `{ data, meta }` envelope.
|
|
180
193
|
|
|
@@ -248,7 +261,7 @@ For the `<Text>` / `<RichText>` / `<Image>` / `<Date>` components and the rules
|
|
|
248
261
|
## Read path (published app, no auth)
|
|
249
262
|
|
|
250
263
|
```ts
|
|
251
|
-
const res = await fetch(`${import.meta.env.VITE_API_URL}/entries/<typeName
|
|
264
|
+
const res = await fetch(`${import.meta.env.VITE_API_URL}/entries/<typeName>?fields=slug,title&limit=12`);
|
|
252
265
|
const { data, meta } = await res.json();
|
|
253
266
|
// data: Entry[] — fields flattened at top level (id, slug, title, ...)
|
|
254
267
|
// meta: { limit, offset, total, hasMore }
|
|
@@ -33,8 +33,7 @@ Entries are NOT JSON-file-driven. Create/update them via CLI.
|
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
fimo entries create <TypeName> --body '<json>'
|
|
36
|
-
fimo entries list <TypeName> [--limit N] [--offset N] [--search Q] [--where JSON] [--sort F]
|
|
37
|
-
fimo entries list <TypeName> [--sort-by F] [--sort-direction asc|desc] # legacy sort flags
|
|
36
|
+
fimo entries list <TypeName> [--limit N] [--offset N] [--search Q] [--where JSON] [--sort F] [--fields FIELDS]
|
|
38
37
|
fimo entries get <TypeName> <id>
|
|
39
38
|
fimo entries update <TypeName> <id> --body '<json>'
|
|
40
39
|
fimo entries delete <TypeName> <id>
|
|
@@ -48,9 +47,13 @@ fimo entries delete <TypeName> <id>
|
|
|
48
47
|
fimo entries list BlogPost --where '{"featured":true}' --sort -publishedAt
|
|
49
48
|
fimo entries list BlogPost --where '{"rank":{"$gte":3}}' --sort rank
|
|
50
49
|
fimo entries list BlogPost --search "launch"
|
|
50
|
+
fimo entries list BlogPost --limit 10 --offset 20 --sort title
|
|
51
|
+
fimo entries list BlogPost --fields slug,title,excerpt,coverImage --sort -publishedAt --limit 12
|
|
51
52
|
```
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
Use the canonical read query flags: `--search`, `--sort`, `--where`, `--limit`, `--offset`, and `--fields`.
|
|
55
|
+
`--where` is a JSON object keyed by schema field name. Simple values mean equality, so booleans, strings, and numbers should stay typed inside the JSON (`{"featured":true}`, `{"category":"react"}`, `{"rank":{"$gte":3}}`). Operator objects support `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in`, `$nin`, `$contains`, `$startsWith`, and `$null`, subject to the field type. Use `--sort field` for ascending and `--sort -field` for descending.
|
|
56
|
+
`--fields` is a comma-separated projection for list payloads. The API always keeps `id`; pass only the fields your view needs, such as `slug,title,excerpt,coverImage`.
|
|
54
57
|
|
|
55
58
|
## "Add a blog" recipe
|
|
56
59
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Browsing Your Files
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Click the **Code** tab (the code icon) in the workspace navigation, or press **Option+4** (Mac) / **Alt+4** (Windows/Linux). A file tree appears showing all your project files and folders.
|
|
4
4
|
|
|
5
5
|
Inside the Code workspace, the left sidebar shows the **Files** tree. If you ever switch the sidebar to another view, press **Cmd+Shift+E** (Mac) / **Ctrl+Shift+E** (Windows/Linux) to bring the Files explorer back.
|
|
6
6
|
|
package/dist/cli/bundle.json
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -100555,6 +100555,7 @@ init_auth_errors();
|
|
|
100555
100555
|
import fs19 from "node:fs";
|
|
100556
100556
|
import path23 from "node:path";
|
|
100557
100557
|
var DEP_FIELDS = ["dependencies", "devDependencies"];
|
|
100558
|
+
var FALLBACK_FIMO_DEP = "latest";
|
|
100558
100559
|
function prepareDevFimoDependencyForDeploy(cwd) {
|
|
100559
100560
|
const packagePath = path23.join(cwd, "package.json");
|
|
100560
100561
|
if (!fs19.existsSync(packagePath)) {
|
|
@@ -100568,16 +100569,11 @@ function prepareDevFimoDependencyForDeploy(cwd) {
|
|
|
100568
100569
|
}
|
|
100569
100570
|
const localPackageRoot = resolveFileSpec(fileSpec, cwd);
|
|
100570
100571
|
const devJsonPath = findDevJson(localPackageRoot);
|
|
100571
|
-
|
|
100572
|
-
|
|
100573
|
-
`Found local fimo dependency "${fileSpec}", but no .fimo/dev.json exists above ${localPackageRoot}. Publish an experimental CLI build from the Fimo repo first.`
|
|
100574
|
-
);
|
|
100575
|
-
}
|
|
100576
|
-
const state = readDevReleaseState(devJsonPath);
|
|
100577
|
-
if (!state.version) {
|
|
100572
|
+
const version2 = devJsonPath ? readDevReleaseState(devJsonPath).version : FALLBACK_FIMO_DEP;
|
|
100573
|
+
if (!version2) {
|
|
100578
100574
|
throw new Error(`Missing "version" in ${devJsonPath}. Publish an experimental CLI build again.`);
|
|
100579
100575
|
}
|
|
100580
|
-
const changed = replaceLocalFimoSpecs(pkg,
|
|
100576
|
+
const changed = replaceLocalFimoSpecs(pkg, version2);
|
|
100581
100577
|
if (!changed) {
|
|
100582
100578
|
return null;
|
|
100583
100579
|
}
|
|
@@ -100585,7 +100581,7 @@ function prepareDevFimoDependencyForDeploy(cwd) {
|
|
|
100585
100581
|
return {
|
|
100586
100582
|
devJsonPath,
|
|
100587
100583
|
packagePath,
|
|
100588
|
-
version:
|
|
100584
|
+
version: version2,
|
|
100589
100585
|
restore: /* @__PURE__ */ __name(() => fs19.writeFileSync(packagePath, original), "restore")
|
|
100590
100586
|
};
|
|
100591
100587
|
}
|
|
@@ -104451,6 +104447,9 @@ async function entriesListCommand(typeName, options, cmd) {
|
|
|
104451
104447
|
JSON.parse(options.where);
|
|
104452
104448
|
params.where = options.where;
|
|
104453
104449
|
}
|
|
104450
|
+
if (options.fields) {
|
|
104451
|
+
params.fields = options.fields;
|
|
104452
|
+
}
|
|
104454
104453
|
const result = await api.listEntries(ctx.projectId, typeName, Object.keys(params).length > 0 ? params : void 0);
|
|
104455
104454
|
ui.result({ command: "entries list", data: result, render: /* @__PURE__ */ __name(() => renderPrettyJson5(result), "render") });
|
|
104456
104455
|
}
|
|
@@ -108491,7 +108490,7 @@ schemas2.command("get").description("Get a schema by type name").argument("<type
|
|
|
108491
108490
|
schemas2.command("push").description("Push schema JSON files to the API (create or update)").argument("[typeName]", "Schema name to push (omit to push all)").option("-C, --cwd <dir>", "Project directory").action(schemaPushCommand);
|
|
108492
108491
|
schemas2.command("delete").description("Delete a schema by type name").argument("<typeName>", "Content type name").option("-C, --cwd <dir>", "Project directory").action(schemaDeleteCommand);
|
|
108493
108492
|
var entries = program.command("entries").description("Manage content entries");
|
|
108494
|
-
entries.command("list").description("List entries of a content type").argument("<typeName>", "Content type name").option("-C, --cwd <dir>", "Project directory").option("--limit <n>", "Max entries to return").option("--offset <n>", "Offset for pagination").option("--search <query>", "Search query").option("--where <json>", `JSON filter object, e.g. '{"featured":true}'`).option("--sort <field>", "Sort field, prefix with - for descending").option("--sort-by <field>", "Sort field").option("--sort-direction <dir>", "Sort direction (asc|desc)").action(entriesListCommand);
|
|
108493
|
+
entries.command("list").description("List entries of a content type").argument("<typeName>", "Content type name").option("-C, --cwd <dir>", "Project directory").option("--limit <n>", "Max entries to return").option("--offset <n>", "Offset for pagination").option("--search <query>", "Search query").option("--where <json>", `JSON filter object, e.g. '{"featured":true}'`).option("--sort <field>", "Sort field, prefix with - for descending").option("--fields <fields>", "Comma-separated fields to return, e.g. slug,title,excerpt").option("--sort-by <field>", "Sort field").option("--sort-direction <dir>", "Sort direction (asc|desc)").action(entriesListCommand);
|
|
108495
108494
|
entries.command("get").description("Get a single entry").argument("<typeName>", "Content type name").argument("<id>", "Entry ID").option("-C, --cwd <dir>", "Project directory").action(entriesGetCommand);
|
|
108496
108495
|
entries.command("create").description("Create a new entry").argument("<typeName>", "Content type name").option("-C, --cwd <dir>", "Project directory").requiredOption("--body <json>", "Entry JSON body (slug + data)").action(entriesCreateCommand);
|
|
108497
108496
|
entries.command("update").description("Update an existing entry").argument("<typeName>", "Content type name").argument("<id>", "Entry ID").option("-C, --cwd <dir>", "Project directory").requiredOption("--body <json>", "Updated entry JSON body").action(entriesUpdateCommand);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { FimoString, FimoDate, FimoMedia, FimoBoolean, FimoRichText, type FimoSource, type FimoPart, type FimoRichTextContent, type FimoRichTextNodeProps, type FimoRichTextMarkProps, type FimoRichTextComponents, FIMO_SOURCE, FIMO_PARTS, isFimoString, isFimoDate, hasFimoSource, getFimoSource, getFimoParts, } from './primitives.js';
|
|
2
2
|
export { fimo } from './template.js';
|
|
3
3
|
export { useFimoLiveValue } from './useFimoLiveValue.js';
|
|
4
|
-
export type { BoolOps, DateOps, FilterFor, NullOnlyOps, NumberOps, Query, ScalarOps, Sort, SortField, StringOps, Where, } from './query.js';
|
|
4
|
+
export type { BoolOps, DateOps, Field, Fields, FilterFor, NullOnlyOps, NumberOps, Projected, Query, ScalarOps, Sort, SortField, StringOps, Where, } from './query.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/primitives/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,WAAW,EACX,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,YAAY,EACV,OAAO,EACP,OAAO,EACP,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EACT,SAAS,EACT,KAAK,GACN,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/primitives/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,WAAW,EACX,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,YAAY,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EACT,SAAS,EACT,KAAK,GACN,MAAM,YAAY,CAAC"}
|
|
@@ -35,12 +35,21 @@ export type Where<T> = TopLevelWhere & {
|
|
|
35
35
|
};
|
|
36
36
|
export type SortField<T> = Extract<keyof T, string> | 'createdAt' | 'updatedAt';
|
|
37
37
|
export type Sort<T> = SortField<T> | `-${SortField<T>}`;
|
|
38
|
-
export type
|
|
38
|
+
export type Field<T> = Extract<keyof T, string> | 'createdAt' | 'updatedAt' | 'contentType';
|
|
39
|
+
export type Fields<T> = Field<T> | readonly Field<T>[];
|
|
40
|
+
type SelectedFields<TFields> = TFields extends readonly (infer K)[] ? K : TFields;
|
|
41
|
+
export type Projected<T extends {
|
|
42
|
+
id: string;
|
|
43
|
+
}, TFields extends Fields<T> | undefined> = [TFields] extends [undefined] ? T : Pick<T, Extract<'id' | SelectedFields<TFields>, keyof T>>;
|
|
44
|
+
export type Query<T extends {
|
|
45
|
+
id: string;
|
|
46
|
+
}, TFields extends Fields<T> | undefined = Fields<T> | undefined> = {
|
|
39
47
|
where?: Where<T>;
|
|
40
48
|
search?: string;
|
|
41
49
|
sort?: Sort<T> | Sort<T>[];
|
|
42
50
|
limit?: number;
|
|
43
51
|
offset?: number;
|
|
52
|
+
fields?: TFields;
|
|
44
53
|
};
|
|
45
54
|
export {};
|
|
46
55
|
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/runtime/primitives/lib/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACzB,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;IACV,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAA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IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/runtime/templates.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,mBAAmB,oDAAqD,CAAC;AACtF,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AACrE,eAAO,MAAM,gBAAgB,EAAE,iBAAkC,CAAC;AAElE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,SAAS,GAAE,iBAAoC,GAAG,MAAM,CAEvF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/runtime/templates.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,mBAAmB,oDAAqD,CAAC;AACtF,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AACrE,eAAO,MAAM,gBAAgB,EAAE,iBAAkC,CAAC;AAElE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,SAAS,GAAE,iBAAoC,GAAG,MAAM,CAEvF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;AAqBD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAgB,eAAe,IAAI,WAAW,CAS7C;AAED,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAW7C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GA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