@lupinum/ginko-server 0.0.0-stage → 0.18.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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +176 -2
- package/convex/_generated/api.d.ts +185 -0
- package/convex/_generated/api.js +23 -0
- package/convex/_generated/dataModel.d.ts +60 -0
- package/convex/_generated/server.d.ts +162 -0
- package/convex/_generated/server.js +101 -0
- package/convex/account.ts +110 -0
- package/convex/agent.ts +814 -0
- package/convex/auth.config.ts +4 -0
- package/convex/auth.ts +62 -0
- package/convex/backup.ts +94 -0
- package/convex/betterAuth/_generated/api.ts +56 -0
- package/convex/betterAuth/_generated/component.ts +431 -0
- package/convex/betterAuth/_generated/dataModel.ts +60 -0
- package/convex/betterAuth/_generated/server.ts +169 -0
- package/convex/betterAuth/adapter.ts +7 -0
- package/convex/betterAuth/convex.config.ts +3 -0
- package/convex/betterAuth/schema.ts +102 -0
- package/convex/betterAuth/schemaMetadata.ts +697 -0
- package/convex/betterAuth/schemaOptions.ts +13 -0
- package/convex/betterAuth/schemaPlugins.ts +13 -0
- package/convex/bundle.ts +183 -0
- package/convex/changes.ts +136 -0
- package/convex/cleanup.ts +44 -0
- package/convex/connect.ts +143 -0
- package/convex/convex.config.ts +7 -0
- package/convex/crons.ts +14 -0
- package/convex/demo.ts +72 -0
- package/convex/entries.ts +1770 -0
- package/convex/facts.ts +129 -0
- package/convex/files.ts +631 -0
- package/convex/http.ts +21 -0
- package/convex/image.ts +45 -0
- package/convex/images.ts +54 -0
- package/convex/invites.ts +227 -0
- package/convex/lib/access.ts +180 -0
- package/convex/lib/agentTools.ts +331 -0
- package/convex/lib/content.ts +317 -0
- package/convex/lib/corpus.ts +83 -0
- package/convex/lib/diff.ts +50 -0
- package/convex/lib/fail.ts +27 -0
- package/convex/lib/files.ts +70 -0
- package/convex/lib/history.ts +103 -0
- package/convex/lib/i18n.ts +52 -0
- package/convex/lib/input.ts +57 -0
- package/convex/lib/library.ts +28 -0
- package/convex/lib/lifecycle.ts +100 -0
- package/convex/lib/list.ts +112 -0
- package/convex/lib/migrations.ts +126 -0
- package/convex/lib/names.ts +56 -0
- package/convex/lib/pending.ts +84 -0
- package/convex/lib/policy.ts +155 -0
- package/convex/lib/publicness.ts +87 -0
- package/convex/lib/reminders.ts +27 -0
- package/convex/lib/search.ts +132 -0
- package/convex/lib/siteUrl.ts +95 -0
- package/convex/lib/status.ts +109 -0
- package/convex/lib/translation.ts +56 -0
- package/convex/lib/trees.ts +43 -0
- package/convex/lib/write.ts +296 -0
- package/convex/mail.ts +136 -0
- package/convex/members.ts +129 -0
- package/convex/migrations.ts +105 -0
- package/convex/navigation.ts +276 -0
- package/convex/ops.ts +50 -0
- package/convex/proposals.ts +753 -0
- package/convex/refresh.ts +163 -0
- package/convex/release.ts +435 -0
- package/convex/reminders.ts +116 -0
- package/convex/retention.ts +121 -0
- package/convex/routes/bundle.ts +62 -0
- package/convex/routes/connect.ts +80 -0
- package/convex/routes/export.ts +23 -0
- package/convex/routes/file.ts +34 -0
- package/convex/routes/key.ts +53 -0
- package/convex/routes/mcp.ts +300 -0
- package/convex/routes/release.ts +66 -0
- package/convex/routes/upload.ts +94 -0
- package/convex/schema.ts +443 -0
- package/convex/search.ts +58 -0
- package/convex/seed.ts +624 -0
- package/convex/siteDeletion.ts +78 -0
- package/convex/sites.ts +393 -0
- package/convex/tasks.ts +51 -0
- package/convex/tsconfig.json +27 -0
- package/convex/uploads.ts +429 -0
- package/convex/uploadsNode.ts +86 -0
- package/convex/views.ts +111 -0
- package/i18n/de.json +364 -0
- package/i18n/en.json +364 -0
- package/i18n/es.json +364 -0
- package/i18n/fr.json +364 -0
- package/package.json +45 -3
package/convex/auth.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Better Auth (SPEC 10): email one-time codes, one `email` hook, sign-up only for admins and invitees,
|
|
2
|
+
// admin bootstrap on the first sign-in.
|
|
3
|
+
import {
|
|
4
|
+
createBetterConvexAuth,
|
|
5
|
+
type AuthFunctions,
|
|
6
|
+
type BetterConvexAuth,
|
|
7
|
+
} from '@lupinum/better-convex-nuxt/better-auth/server'
|
|
8
|
+
|
|
9
|
+
import { components, internal } from './_generated/api'
|
|
10
|
+
import type { DataModel } from './_generated/dataModel'
|
|
11
|
+
import { normalizeEmail } from './members'
|
|
12
|
+
|
|
13
|
+
const authFunctions: AuthFunctions = internal.auth
|
|
14
|
+
type UserCreateDecision = { readonly allowed: false } | { readonly allowed: true; readonly user: { readonly email: string } }
|
|
15
|
+
|
|
16
|
+
// Return types are annotated: `internal` includes this module, so inference through it would be circular.
|
|
17
|
+
export const auth: BetterConvexAuth<DataModel> = createBetterConvexAuth<DataModel>(components.betterAuth, {
|
|
18
|
+
authFunctions,
|
|
19
|
+
// The session token carries the email for Convex identity; access checks read the live user row instead
|
|
20
|
+
// (lib/access.ts currentUser), so a changed or unproven address never grants anything.
|
|
21
|
+
defineSessionClaims: ({ user }) => ({ email: user.email }),
|
|
22
|
+
emailOTP: { otpLength: 6, expiresIn: 5 * 60, allowedAttempts: 3 },
|
|
23
|
+
// Codes are the only way in: a code proves the mailbox, which the sign-up gate below relies on. The library turns
|
|
24
|
+
// email and password on unless it is switched off, and a password sign-up proves nothing about the address.
|
|
25
|
+
emailAndPassword: false,
|
|
26
|
+
// Sign-up is limited to admin addresses and pending invitations; anyone else gets no account (and no code, see mail.queueCode).
|
|
27
|
+
beforeUserCreate: async ({ ctx, user }): Promise<UserCreateDecision> => {
|
|
28
|
+
// Never decide access from an address the person has not proven. A code sign-in creates a verified user.
|
|
29
|
+
if (!user.emailVerified) return { allowed: false }
|
|
30
|
+
const email = normalizeEmail(user.email)
|
|
31
|
+
const allowed: boolean = await ctx.runQuery(internal.invites.mayJoin, { email })
|
|
32
|
+
return allowed ? { allowed: true, user: { email } } : { allowed: false }
|
|
33
|
+
},
|
|
34
|
+
// The one delivery hook. Without a mail way (GINKO_MAIL) the mail step fails, so no code is sent.
|
|
35
|
+
email: async (ctx, message) => {
|
|
36
|
+
if (message.type !== 'email-otp') throw new Error(`Unsupported auth email: ${message.type}`)
|
|
37
|
+
await ctx.runMutation(internal.mail.queueCode, { to: message.to, otp: message.otp })
|
|
38
|
+
},
|
|
39
|
+
triggers: {
|
|
40
|
+
user: {
|
|
41
|
+
onCreate: async (ctx, doc) => {
|
|
42
|
+
// The trigger document is the Better Auth user row; `id`, `email` and `emailVerified` are its fields.
|
|
43
|
+
const user = doc as unknown as { id: string; email: string; emailVerified: boolean }
|
|
44
|
+
if (!user.emailVerified) return
|
|
45
|
+
await ctx.runMutation(internal.members.bootstrapAdmin, { user: user.id, email: normalizeEmail(user.email) })
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
// Every sign-in creates a session, so an existing user listed in GINKO_ADMIN_EMAILS later becomes admin here.
|
|
49
|
+
// bootstrapAdmin is idempotent. The session row holds only the user id, so the email is read from the user row.
|
|
50
|
+
session: {
|
|
51
|
+
onCreate: async (ctx, doc) => {
|
|
52
|
+
const session = doc as unknown as { userId: string }
|
|
53
|
+
const user = await ctx.runQuery(components.betterAuth.adapter.findOne, { model: 'user', where: [{ field: 'id', value: session.userId }] })
|
|
54
|
+
if (!user?.emailVerified) return
|
|
55
|
+
await ctx.runMutation(internal.members.bootstrapAdmin, { user: session.userId, email: normalizeEmail(String(user.email)) })
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
export const createAuth = auth.createAuth
|
|
61
|
+
export const { ensureSigningKey, pruneSigningKeys, rotateSigningKey } = auth.jwksOperatorFunctions()
|
|
62
|
+
export const { onCreate, onUpdate, onDelete } = auth.triggerFunctions()
|
package/convex/backup.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Read side of `ginko export`, `pnpm local:pull` and the Studio's backup download (SPEC 9, 12). The CLI reaches
|
|
2
|
+
// `snapshot` through GET /export (routes/export.ts), which resolves the push key to its site first; the Studio calls
|
|
3
|
+
// `download` with the person's session. Both answer with the same shape, so a Studio backup is a `ginko export` folder.
|
|
4
|
+
import type { Json } from '@lupinum/ginko'
|
|
5
|
+
import { v } from 'convex/values'
|
|
6
|
+
import type { Id } from './_generated/dataModel'
|
|
7
|
+
import { internalQuery, query, type QueryCtx } from './_generated/server'
|
|
8
|
+
import { actorFor, fail } from './lib/access'
|
|
9
|
+
|
|
10
|
+
/** The format of the export file. It changes only with an incompatible change of the shape below. */
|
|
11
|
+
export const EXPORT_FORMAT = 1
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Everything of one site in one read: schema, every entry (deleted ones too) and every ready upload
|
|
15
|
+
* that an entry references, each with a signed storage URL. People, changes and ops are not part of it.
|
|
16
|
+
* A processed image is a WebP copy, so `mime` names the exported bytes, not the original upload.
|
|
17
|
+
*/
|
|
18
|
+
export const snapshot = internalQuery({
|
|
19
|
+
args: { site: v.id('sites') },
|
|
20
|
+
handler: (ctx, args) => snapshotOf(ctx, args.site),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The same snapshot for an owner or admin in the Studio (Team > Sicherung), who builds the ZIP in the browser.
|
|
25
|
+
* Staff get FORBIDDEN: a backup holds every entry, also those of areas they cannot open. Signed file URLs are fetched
|
|
26
|
+
* right after this answer, so the Studio calls it once (not as a subscription).
|
|
27
|
+
*/
|
|
28
|
+
export const download = query({
|
|
29
|
+
args: { site: v.string() },
|
|
30
|
+
handler: async (ctx, args) => {
|
|
31
|
+
const actor = await actorFor(ctx, args.site)
|
|
32
|
+
if (actor.role === 'staff') fail('FORBIDDEN', 'errors.backupOwnersOnly')
|
|
33
|
+
return snapshotOf(ctx, actor.site._id)
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
async function snapshotOf(ctx: QueryCtx, siteId: Id<'sites'>) {
|
|
38
|
+
const site = await ctx.db.get(siteId)
|
|
39
|
+
if (!site) fail('SITE_NOT_FOUND', 'errors.siteNotFound')
|
|
40
|
+
const entries = await ctx.db.query('entries').withIndex('by_site_brick_order', (q) => q.eq('site', siteId)).collect()
|
|
41
|
+
|
|
42
|
+
const referenced = new Set<Id<'uploads'>>()
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
const refs = await ctx.db.query('fileRefs').withIndex('by_holder', (q) => q.eq('holder', 'entry').eq('holderId', entry._id)).collect()
|
|
45
|
+
for (const ref of refs) referenced.add(ref.file)
|
|
46
|
+
}
|
|
47
|
+
// Library files that no entry uses yet (kept or in a folder) belong to a backup too.
|
|
48
|
+
const library = await ctx.db.query('uploads').withIndex('by_site', (q) => q.eq('site', siteId)).collect()
|
|
49
|
+
for (const upload of library) if ((upload.kept || upload.folder) && !upload.trashedAt) referenced.add(upload._id)
|
|
50
|
+
const files = []
|
|
51
|
+
for (const id of referenced) {
|
|
52
|
+
const upload = await ctx.db.get(id)
|
|
53
|
+
if (!upload || upload.site !== siteId || upload.status !== 'ready') continue
|
|
54
|
+
const stored = upload.processedId ?? upload.storageId
|
|
55
|
+
const url = await ctx.storage.getUrl(stored)
|
|
56
|
+
if (!url) continue
|
|
57
|
+
files.push({
|
|
58
|
+
id: upload._id,
|
|
59
|
+
name: upload.name,
|
|
60
|
+
mime: stored === upload.storageId ? upload.mime : 'image/webp',
|
|
61
|
+
size: upload.size,
|
|
62
|
+
...(upload.width === undefined ? {} : { width: upload.width }),
|
|
63
|
+
...(upload.height === undefined ? {} : { height: upload.height }),
|
|
64
|
+
url,
|
|
65
|
+
...(upload.folder === undefined ? {} : { folder: upload.folder }),
|
|
66
|
+
...(upload.kept ? { kept: true } : {}),
|
|
67
|
+
...(upload.focus === undefined ? {} : { focus: upload.focus }),
|
|
68
|
+
...(upload.sha256 === undefined ? {} : { sha256: upload.sha256 }),
|
|
69
|
+
...(upload.alt && Object.keys(upload.alt).length ? { alt: upload.alt } : {}),
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
format: EXPORT_FORMAT,
|
|
75
|
+
site: site.slug,
|
|
76
|
+
name: site.name,
|
|
77
|
+
schema: site.schema as Json,
|
|
78
|
+
schemaRev: site.schemaRev,
|
|
79
|
+
contentRev: site.contentRev,
|
|
80
|
+
exportedAt: new Date().toISOString(),
|
|
81
|
+
entries: entries.map((e) => ({
|
|
82
|
+
id: e._id, brick: e.brick, kind: e.kind, order: e.order, data: e.data as Json, prints: e.prints, rev: e.rev,
|
|
83
|
+
...(e.deletedAt === undefined ? {} : { deletedAt: e.deletedAt }),
|
|
84
|
+
// Drafts keep their state in a backup (SPEC 15); a missing state means live.
|
|
85
|
+
...(e.state === undefined ? {} : { state: e.state }),
|
|
86
|
+
...(e.publishAt === undefined ? {} : { publishAt: e.publishAt }),
|
|
87
|
+
// What the bundle shows as updatedAt, so a restored site keeps it (an entry from before contentAt counts from its creation).
|
|
88
|
+
contentAt: e.contentAt ?? e._creationTime,
|
|
89
|
+
})),
|
|
90
|
+
folders: (await ctx.db.query('folders').withIndex('by_site_parent', (q) => q.eq('site', siteId)).collect())
|
|
91
|
+
.map((f) => ({ id: f._id, name: f.name, ...(f.parent === undefined ? {} : { parent: f.parent }) })),
|
|
92
|
+
files,
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `api` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type * as adapter from "../adapter.js";
|
|
12
|
+
import type * as schemaMetadata from "../schemaMetadata.js";
|
|
13
|
+
import type * as schemaOptions from "../schemaOptions.js";
|
|
14
|
+
import type * as schemaPlugins from "../schemaPlugins.js";
|
|
15
|
+
|
|
16
|
+
import type {
|
|
17
|
+
ApiFromModules,
|
|
18
|
+
FilterApi,
|
|
19
|
+
FunctionReference,
|
|
20
|
+
} from "convex/server";
|
|
21
|
+
import { anyApi, componentsGeneric } from "convex/server";
|
|
22
|
+
|
|
23
|
+
const fullApi: ApiFromModules<{
|
|
24
|
+
adapter: typeof adapter;
|
|
25
|
+
schemaMetadata: typeof schemaMetadata;
|
|
26
|
+
schemaOptions: typeof schemaOptions;
|
|
27
|
+
schemaPlugins: typeof schemaPlugins;
|
|
28
|
+
}> = anyApi as any;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
32
|
+
*
|
|
33
|
+
* Usage:
|
|
34
|
+
* ```js
|
|
35
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const api: FilterApi<
|
|
39
|
+
typeof fullApi,
|
|
40
|
+
FunctionReference<any, "public">
|
|
41
|
+
> = anyApi as any;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
45
|
+
*
|
|
46
|
+
* Usage:
|
|
47
|
+
* ```js
|
|
48
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export const internal: FilterApi<
|
|
52
|
+
typeof fullApi,
|
|
53
|
+
FunctionReference<any, "internal">
|
|
54
|
+
> = anyApi as any;
|
|
55
|
+
|
|
56
|
+
export const components = componentsGeneric() as unknown as {};
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `ComponentApi` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { FunctionReference } from "convex/server";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A utility for referencing a Convex component's exposed API.
|
|
15
|
+
*
|
|
16
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```ts
|
|
19
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
20
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
25
|
+
{
|
|
26
|
+
adapter: {
|
|
27
|
+
consumeOne: FunctionReference<
|
|
28
|
+
"mutation",
|
|
29
|
+
"internal",
|
|
30
|
+
{
|
|
31
|
+
model: string;
|
|
32
|
+
onDeleteHandle?: string;
|
|
33
|
+
onDeleteModels?: Array<string>;
|
|
34
|
+
onUpdateHandle?: string;
|
|
35
|
+
onUpdateModels?: Array<string>;
|
|
36
|
+
where: Array<{
|
|
37
|
+
connector?: "AND" | "OR";
|
|
38
|
+
field: string;
|
|
39
|
+
mode?: "sensitive" | "insensitive";
|
|
40
|
+
operator?:
|
|
41
|
+
| "lt"
|
|
42
|
+
| "lte"
|
|
43
|
+
| "gt"
|
|
44
|
+
| "gte"
|
|
45
|
+
| "eq"
|
|
46
|
+
| "in"
|
|
47
|
+
| "not_in"
|
|
48
|
+
| "ne"
|
|
49
|
+
| "contains"
|
|
50
|
+
| "starts_with"
|
|
51
|
+
| "ends_with";
|
|
52
|
+
value:
|
|
53
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
54
|
+
}>;
|
|
55
|
+
},
|
|
56
|
+
Record<
|
|
57
|
+
string,
|
|
58
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
59
|
+
> | null,
|
|
60
|
+
Name
|
|
61
|
+
>;
|
|
62
|
+
consumeRateLimit: FunctionReference<
|
|
63
|
+
"mutation",
|
|
64
|
+
"internal",
|
|
65
|
+
{ key: string; max: number; retentionWindow: number; window: number },
|
|
66
|
+
{ allowed: boolean; retryAfter: number | null },
|
|
67
|
+
Name
|
|
68
|
+
>;
|
|
69
|
+
count: FunctionReference<
|
|
70
|
+
"query",
|
|
71
|
+
"internal",
|
|
72
|
+
{
|
|
73
|
+
model: string;
|
|
74
|
+
where?: Array<{
|
|
75
|
+
connector?: "AND" | "OR";
|
|
76
|
+
field: string;
|
|
77
|
+
mode?: "sensitive" | "insensitive";
|
|
78
|
+
operator?:
|
|
79
|
+
| "lt"
|
|
80
|
+
| "lte"
|
|
81
|
+
| "gt"
|
|
82
|
+
| "gte"
|
|
83
|
+
| "eq"
|
|
84
|
+
| "in"
|
|
85
|
+
| "not_in"
|
|
86
|
+
| "ne"
|
|
87
|
+
| "contains"
|
|
88
|
+
| "starts_with"
|
|
89
|
+
| "ends_with";
|
|
90
|
+
value:
|
|
91
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
92
|
+
}>;
|
|
93
|
+
},
|
|
94
|
+
number,
|
|
95
|
+
Name
|
|
96
|
+
>;
|
|
97
|
+
create: FunctionReference<
|
|
98
|
+
"mutation",
|
|
99
|
+
"internal",
|
|
100
|
+
{
|
|
101
|
+
data: any;
|
|
102
|
+
model: string;
|
|
103
|
+
oauthRefreshParentId?: string;
|
|
104
|
+
onCreateHandle?: string;
|
|
105
|
+
},
|
|
106
|
+
Record<
|
|
107
|
+
string,
|
|
108
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
109
|
+
>,
|
|
110
|
+
Name
|
|
111
|
+
>;
|
|
112
|
+
deleteMany: FunctionReference<
|
|
113
|
+
"mutation",
|
|
114
|
+
"internal",
|
|
115
|
+
{
|
|
116
|
+
model: string;
|
|
117
|
+
oauthRefreshGrantId?: string;
|
|
118
|
+
onDeleteHandle?: string;
|
|
119
|
+
onDeleteModels?: Array<string>;
|
|
120
|
+
onUpdateHandle?: string;
|
|
121
|
+
onUpdateModels?: Array<string>;
|
|
122
|
+
where: Array<{
|
|
123
|
+
connector?: "AND" | "OR";
|
|
124
|
+
field: string;
|
|
125
|
+
mode?: "sensitive" | "insensitive";
|
|
126
|
+
operator?:
|
|
127
|
+
| "lt"
|
|
128
|
+
| "lte"
|
|
129
|
+
| "gt"
|
|
130
|
+
| "gte"
|
|
131
|
+
| "eq"
|
|
132
|
+
| "in"
|
|
133
|
+
| "not_in"
|
|
134
|
+
| "ne"
|
|
135
|
+
| "contains"
|
|
136
|
+
| "starts_with"
|
|
137
|
+
| "ends_with";
|
|
138
|
+
value:
|
|
139
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
140
|
+
}>;
|
|
141
|
+
},
|
|
142
|
+
number,
|
|
143
|
+
Name
|
|
144
|
+
>;
|
|
145
|
+
deleteOne: FunctionReference<
|
|
146
|
+
"mutation",
|
|
147
|
+
"internal",
|
|
148
|
+
{
|
|
149
|
+
model: string;
|
|
150
|
+
onDeleteHandle?: string;
|
|
151
|
+
onDeleteModels?: Array<string>;
|
|
152
|
+
onUpdateHandle?: string;
|
|
153
|
+
onUpdateModels?: Array<string>;
|
|
154
|
+
where: Array<{
|
|
155
|
+
connector?: "AND" | "OR";
|
|
156
|
+
field: string;
|
|
157
|
+
mode?: "sensitive" | "insensitive";
|
|
158
|
+
operator?:
|
|
159
|
+
| "lt"
|
|
160
|
+
| "lte"
|
|
161
|
+
| "gt"
|
|
162
|
+
| "gte"
|
|
163
|
+
| "eq"
|
|
164
|
+
| "in"
|
|
165
|
+
| "not_in"
|
|
166
|
+
| "ne"
|
|
167
|
+
| "contains"
|
|
168
|
+
| "starts_with"
|
|
169
|
+
| "ends_with";
|
|
170
|
+
value:
|
|
171
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
172
|
+
}>;
|
|
173
|
+
},
|
|
174
|
+
Record<
|
|
175
|
+
string,
|
|
176
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
177
|
+
> | null,
|
|
178
|
+
Name
|
|
179
|
+
>;
|
|
180
|
+
findMany: FunctionReference<
|
|
181
|
+
"query",
|
|
182
|
+
"internal",
|
|
183
|
+
{
|
|
184
|
+
join?: any;
|
|
185
|
+
limit?: number;
|
|
186
|
+
model: string;
|
|
187
|
+
offset?: number;
|
|
188
|
+
paginationOpts: {
|
|
189
|
+
cursor: string | null;
|
|
190
|
+
endCursor?: string | null;
|
|
191
|
+
id?: number;
|
|
192
|
+
maximumBytesRead?: number;
|
|
193
|
+
maximumRowsRead?: number;
|
|
194
|
+
numItems: number;
|
|
195
|
+
};
|
|
196
|
+
select?: Array<string>;
|
|
197
|
+
sortBy?: { direction: "asc" | "desc"; field: string };
|
|
198
|
+
where?: Array<{
|
|
199
|
+
connector?: "AND" | "OR";
|
|
200
|
+
field: string;
|
|
201
|
+
mode?: "sensitive" | "insensitive";
|
|
202
|
+
operator?:
|
|
203
|
+
| "lt"
|
|
204
|
+
| "lte"
|
|
205
|
+
| "gt"
|
|
206
|
+
| "gte"
|
|
207
|
+
| "eq"
|
|
208
|
+
| "in"
|
|
209
|
+
| "not_in"
|
|
210
|
+
| "ne"
|
|
211
|
+
| "contains"
|
|
212
|
+
| "starts_with"
|
|
213
|
+
| "ends_with";
|
|
214
|
+
value:
|
|
215
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
216
|
+
}>;
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
continueCursor: string;
|
|
220
|
+
isDone: boolean;
|
|
221
|
+
page: Array<
|
|
222
|
+
Record<
|
|
223
|
+
string,
|
|
224
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
225
|
+
>
|
|
226
|
+
>;
|
|
227
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
228
|
+
splitCursor?: string | null;
|
|
229
|
+
},
|
|
230
|
+
Name
|
|
231
|
+
>;
|
|
232
|
+
findOne: FunctionReference<
|
|
233
|
+
"query",
|
|
234
|
+
"internal",
|
|
235
|
+
{
|
|
236
|
+
join?: any;
|
|
237
|
+
model: string;
|
|
238
|
+
offset?: number;
|
|
239
|
+
select?: Array<string>;
|
|
240
|
+
sortBy?: { direction: "asc" | "desc"; field: string };
|
|
241
|
+
where?: Array<{
|
|
242
|
+
connector?: "AND" | "OR";
|
|
243
|
+
field: string;
|
|
244
|
+
mode?: "sensitive" | "insensitive";
|
|
245
|
+
operator?:
|
|
246
|
+
| "lt"
|
|
247
|
+
| "lte"
|
|
248
|
+
| "gt"
|
|
249
|
+
| "gte"
|
|
250
|
+
| "eq"
|
|
251
|
+
| "in"
|
|
252
|
+
| "not_in"
|
|
253
|
+
| "ne"
|
|
254
|
+
| "contains"
|
|
255
|
+
| "starts_with"
|
|
256
|
+
| "ends_with";
|
|
257
|
+
value:
|
|
258
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
259
|
+
}>;
|
|
260
|
+
},
|
|
261
|
+
Record<
|
|
262
|
+
string,
|
|
263
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
264
|
+
> | null,
|
|
265
|
+
Name
|
|
266
|
+
>;
|
|
267
|
+
incrementOne: FunctionReference<
|
|
268
|
+
"mutation",
|
|
269
|
+
"internal",
|
|
270
|
+
{
|
|
271
|
+
increment: any;
|
|
272
|
+
model: string;
|
|
273
|
+
onUpdateHandle?: string;
|
|
274
|
+
set?: any;
|
|
275
|
+
where: Array<{
|
|
276
|
+
connector?: "AND" | "OR";
|
|
277
|
+
field: string;
|
|
278
|
+
mode?: "sensitive" | "insensitive";
|
|
279
|
+
operator?:
|
|
280
|
+
| "lt"
|
|
281
|
+
| "lte"
|
|
282
|
+
| "gt"
|
|
283
|
+
| "gte"
|
|
284
|
+
| "eq"
|
|
285
|
+
| "in"
|
|
286
|
+
| "not_in"
|
|
287
|
+
| "ne"
|
|
288
|
+
| "contains"
|
|
289
|
+
| "starts_with"
|
|
290
|
+
| "ends_with";
|
|
291
|
+
value:
|
|
292
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
293
|
+
}>;
|
|
294
|
+
},
|
|
295
|
+
Record<
|
|
296
|
+
string,
|
|
297
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
298
|
+
> | null,
|
|
299
|
+
Name
|
|
300
|
+
>;
|
|
301
|
+
oauthLiveAccess: FunctionReference<
|
|
302
|
+
"query",
|
|
303
|
+
"internal",
|
|
304
|
+
{
|
|
305
|
+
clientId: string;
|
|
306
|
+
grantId: string;
|
|
307
|
+
resource: string;
|
|
308
|
+
scopes: Array<string>;
|
|
309
|
+
sessionId: string;
|
|
310
|
+
userId: string;
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
grantId: string;
|
|
314
|
+
user: Record<
|
|
315
|
+
string,
|
|
316
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
317
|
+
>;
|
|
318
|
+
} | null,
|
|
319
|
+
Name
|
|
320
|
+
>;
|
|
321
|
+
pruneSigningKeys: FunctionReference<
|
|
322
|
+
"mutation",
|
|
323
|
+
"internal",
|
|
324
|
+
{ batchSize?: number },
|
|
325
|
+
{ deleted: number; deletedKids: Array<string>; hasMore: boolean },
|
|
326
|
+
Name
|
|
327
|
+
>;
|
|
328
|
+
rotateSigningKey: FunctionReference<
|
|
329
|
+
"mutation",
|
|
330
|
+
"internal",
|
|
331
|
+
{
|
|
332
|
+
next: {
|
|
333
|
+
alg: "RS256";
|
|
334
|
+
crv: null;
|
|
335
|
+
id: string;
|
|
336
|
+
privateKey: string;
|
|
337
|
+
publicKey: string;
|
|
338
|
+
};
|
|
339
|
+
onlyIfEmpty?: boolean;
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
created?: boolean;
|
|
343
|
+
createdAt: number;
|
|
344
|
+
newKid: string;
|
|
345
|
+
previousKids: Array<string>;
|
|
346
|
+
previousVerifyUntil: number;
|
|
347
|
+
rotatedAt: number;
|
|
348
|
+
},
|
|
349
|
+
Name
|
|
350
|
+
>;
|
|
351
|
+
sessionAdmission: FunctionReference<
|
|
352
|
+
"query",
|
|
353
|
+
"internal",
|
|
354
|
+
{ sessionId: string; userId?: string },
|
|
355
|
+
{
|
|
356
|
+
session: Record<
|
|
357
|
+
string,
|
|
358
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
359
|
+
>;
|
|
360
|
+
user: Record<
|
|
361
|
+
string,
|
|
362
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
363
|
+
>;
|
|
364
|
+
} | null,
|
|
365
|
+
Name
|
|
366
|
+
>;
|
|
367
|
+
updateMany: FunctionReference<
|
|
368
|
+
"mutation",
|
|
369
|
+
"internal",
|
|
370
|
+
{
|
|
371
|
+
model: string;
|
|
372
|
+
onUpdateHandle?: string;
|
|
373
|
+
update: any;
|
|
374
|
+
where: Array<{
|
|
375
|
+
connector?: "AND" | "OR";
|
|
376
|
+
field: string;
|
|
377
|
+
mode?: "sensitive" | "insensitive";
|
|
378
|
+
operator?:
|
|
379
|
+
| "lt"
|
|
380
|
+
| "lte"
|
|
381
|
+
| "gt"
|
|
382
|
+
| "gte"
|
|
383
|
+
| "eq"
|
|
384
|
+
| "in"
|
|
385
|
+
| "not_in"
|
|
386
|
+
| "ne"
|
|
387
|
+
| "contains"
|
|
388
|
+
| "starts_with"
|
|
389
|
+
| "ends_with";
|
|
390
|
+
value:
|
|
391
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
392
|
+
}>;
|
|
393
|
+
},
|
|
394
|
+
number,
|
|
395
|
+
Name
|
|
396
|
+
>;
|
|
397
|
+
updateOne: FunctionReference<
|
|
398
|
+
"mutation",
|
|
399
|
+
"internal",
|
|
400
|
+
{
|
|
401
|
+
model: string;
|
|
402
|
+
onUpdateHandle?: string;
|
|
403
|
+
update: any;
|
|
404
|
+
where: Array<{
|
|
405
|
+
connector?: "AND" | "OR";
|
|
406
|
+
field: string;
|
|
407
|
+
mode?: "sensitive" | "insensitive";
|
|
408
|
+
operator?:
|
|
409
|
+
| "lt"
|
|
410
|
+
| "lte"
|
|
411
|
+
| "gt"
|
|
412
|
+
| "gte"
|
|
413
|
+
| "eq"
|
|
414
|
+
| "in"
|
|
415
|
+
| "not_in"
|
|
416
|
+
| "ne"
|
|
417
|
+
| "contains"
|
|
418
|
+
| "starts_with"
|
|
419
|
+
| "ends_with";
|
|
420
|
+
value:
|
|
421
|
+
string | number | boolean | Array<string> | Array<number> | null;
|
|
422
|
+
}>;
|
|
423
|
+
},
|
|
424
|
+
Record<
|
|
425
|
+
string,
|
|
426
|
+
string | number | boolean | Array<string> | Array<number> | null
|
|
427
|
+
> | null,
|
|
428
|
+
Name
|
|
429
|
+
>;
|
|
430
|
+
};
|
|
431
|
+
};
|