@bebopdev/core 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/bebop.d.ts +181 -0
- package/dist/bebop.js +10 -0
- package/dist/bebop.js.map +1 -0
- package/dist/client.d.ts +82 -0
- package/dist/client.js +158 -0
- package/dist/client.js.map +1 -0
- package/dist/compiler.d.ts +66 -0
- package/dist/compiler.js +388 -0
- package/dist/compiler.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Carlos Bensant
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @bebopdev/core
|
|
2
|
+
|
|
3
|
+
Payload-style collection configuration, schema compilation, and a typed client for Jazz.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @bebopdev/core jazz-tools
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Define collections with Payload-compatible field objects, then use `defineConfig` to create the config consumed by `bebop dev`:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { collection, defineConfig } from "@bebopdev/core";
|
|
13
|
+
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
collections: [
|
|
16
|
+
collection({
|
|
17
|
+
slug: "posts",
|
|
18
|
+
labels: { singular: "Post", plural: "Posts" },
|
|
19
|
+
fields: [
|
|
20
|
+
{ name: "title", type: "text", required: true },
|
|
21
|
+
{ name: "publishedAt", type: "date" },
|
|
22
|
+
],
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`@bebopdev/cli` reads this config to generate the Jazz schema and admin manifest. The exported `createBebopClient` factory provides typed queries and lifecycle-aware create, update, and delete methods. Lifecycle hooks run in the client; use trusted server code for authoritative side effects.
|
|
29
|
+
|
|
30
|
+
See the [Bebop repository](https://github.com/reezerdev/bebop) for the CLI, admin package, and examples.
|
package/dist/bebop.d.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { PermissionExpressionInput, RowContext, SessionContext } from "jazz-tools/permissions";
|
|
2
|
+
export type FieldOptions = {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
admin?: {
|
|
7
|
+
position?: "main" | "sidebar";
|
|
8
|
+
input?: "textarea";
|
|
9
|
+
date?: {
|
|
10
|
+
pickerAppearance?: "dayOnly" | "dayAndTime";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type TextField = FieldOptions & {
|
|
15
|
+
type: "text";
|
|
16
|
+
};
|
|
17
|
+
export type NumberField = FieldOptions & {
|
|
18
|
+
type: "number";
|
|
19
|
+
integer?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type CheckboxField = FieldOptions & {
|
|
22
|
+
type: "checkbox";
|
|
23
|
+
};
|
|
24
|
+
export type DateField = FieldOptions & {
|
|
25
|
+
type: "date";
|
|
26
|
+
};
|
|
27
|
+
export type JsonField = FieldOptions & {
|
|
28
|
+
type: "json";
|
|
29
|
+
};
|
|
30
|
+
export type SelectOption = string | {
|
|
31
|
+
label: string;
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
export type SelectField = FieldOptions & {
|
|
35
|
+
type: "select";
|
|
36
|
+
options: readonly [SelectOption, ...SelectOption[]];
|
|
37
|
+
};
|
|
38
|
+
export type RelationshipField = FieldOptions & {
|
|
39
|
+
type: "relationship";
|
|
40
|
+
relationTo: string;
|
|
41
|
+
};
|
|
42
|
+
export type JoinField = {
|
|
43
|
+
name: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
type: "join";
|
|
46
|
+
collection: string;
|
|
47
|
+
on: string;
|
|
48
|
+
admin?: {
|
|
49
|
+
defaultColumns?: readonly string[];
|
|
50
|
+
allowCreate?: boolean;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type FieldDefinition = TextField | NumberField | CheckboxField | DateField | JsonField | SelectField | RelationshipField | JoinField;
|
|
54
|
+
export type Fields = readonly FieldDefinition[];
|
|
55
|
+
type SelectValue<TOption> = TOption extends string ? TOption : TOption extends {
|
|
56
|
+
value: infer TValue extends string;
|
|
57
|
+
} ? TValue : never;
|
|
58
|
+
type FieldValue<TField> = TField extends {
|
|
59
|
+
type: "select";
|
|
60
|
+
options: readonly (infer TOption)[];
|
|
61
|
+
} ? SelectValue<TOption> : TField extends {
|
|
62
|
+
type: "text" | "relationship";
|
|
63
|
+
} ? string : TField extends {
|
|
64
|
+
type: "number";
|
|
65
|
+
} ? number : TField extends {
|
|
66
|
+
type: "checkbox";
|
|
67
|
+
} ? boolean : TField extends {
|
|
68
|
+
type: "date";
|
|
69
|
+
} ? Date : unknown;
|
|
70
|
+
type StoredFieldName<TField> = TField extends {
|
|
71
|
+
type: "join";
|
|
72
|
+
} ? never : TField extends {
|
|
73
|
+
type: "relationship";
|
|
74
|
+
name: infer TName extends string;
|
|
75
|
+
} ? `${TName}Id` : TField extends {
|
|
76
|
+
name: infer TName extends string;
|
|
77
|
+
} ? TName : never;
|
|
78
|
+
export type StoredFields<TFields extends Fields> = {
|
|
79
|
+
[TField in TFields[number] as TField extends {
|
|
80
|
+
required: true;
|
|
81
|
+
} ? StoredFieldName<TField> : never]-?: FieldValue<TField>;
|
|
82
|
+
} & {
|
|
83
|
+
[TField in TFields[number] as TField extends {
|
|
84
|
+
required: true;
|
|
85
|
+
} ? never : StoredFieldName<TField>]?: FieldValue<TField>;
|
|
86
|
+
};
|
|
87
|
+
export type CollectionDocument<TFields extends Fields> = StoredFields<TFields> & {
|
|
88
|
+
id: string;
|
|
89
|
+
$createdAt?: Date;
|
|
90
|
+
$updatedAt?: Date;
|
|
91
|
+
};
|
|
92
|
+
type AccessCondition<TFields extends Fields> = Partial<Record<keyof StoredFields<TFields> | "id", unknown>> | PermissionExpressionInput;
|
|
93
|
+
type BivariantCallback<TArguments extends unknown[], TResult> = {
|
|
94
|
+
bivarianceHack(...args: TArguments): TResult;
|
|
95
|
+
}["bivarianceHack"];
|
|
96
|
+
export type CollectionAccessContext<TFields extends Fields> = {
|
|
97
|
+
row: RowContext<StoredFields<TFields> & {
|
|
98
|
+
id: string;
|
|
99
|
+
}>;
|
|
100
|
+
session: SessionContext;
|
|
101
|
+
allOf: (conditions: readonly unknown[]) => PermissionExpressionInput;
|
|
102
|
+
anyOf: (conditions: readonly unknown[]) => PermissionExpressionInput;
|
|
103
|
+
exists: (collectionName: string, condition: Record<string, unknown>) => PermissionExpressionInput;
|
|
104
|
+
isCreator: PermissionExpressionInput;
|
|
105
|
+
};
|
|
106
|
+
export type CollectionAccess<TFields extends Fields> = Partial<{
|
|
107
|
+
read: BivariantCallback<[context: CollectionAccessContext<TFields>], AccessCondition<TFields>>;
|
|
108
|
+
create: BivariantCallback<[context: CollectionAccessContext<TFields>], AccessCondition<TFields>>;
|
|
109
|
+
update: BivariantCallback<[context: CollectionAccessContext<TFields>], AccessCondition<TFields>>;
|
|
110
|
+
delete: BivariantCallback<[context: CollectionAccessContext<TFields>], AccessCondition<TFields>>;
|
|
111
|
+
}>;
|
|
112
|
+
export type CollectionChangeContext<TFields extends Fields> = {
|
|
113
|
+
operation: "create" | "update";
|
|
114
|
+
id?: string;
|
|
115
|
+
data: Partial<StoredFields<TFields>>;
|
|
116
|
+
originalDoc?: Readonly<CollectionDocument<TFields>>;
|
|
117
|
+
};
|
|
118
|
+
export type CollectionHooks<TFields extends Fields> = {
|
|
119
|
+
beforeChange?: BivariantCallback<[
|
|
120
|
+
context: CollectionChangeContext<TFields>
|
|
121
|
+
], void | Partial<StoredFields<TFields>> | Promise<void | Partial<StoredFields<TFields>>>>;
|
|
122
|
+
afterChange?: BivariantCallback<[
|
|
123
|
+
context: {
|
|
124
|
+
operation: "create" | "update";
|
|
125
|
+
doc: Readonly<CollectionDocument<TFields>>;
|
|
126
|
+
originalDoc?: Readonly<CollectionDocument<TFields>>;
|
|
127
|
+
}
|
|
128
|
+
], void | Promise<void>>;
|
|
129
|
+
beforeDelete?: BivariantCallback<[
|
|
130
|
+
context: {
|
|
131
|
+
id: string;
|
|
132
|
+
doc?: Readonly<CollectionDocument<TFields>>;
|
|
133
|
+
}
|
|
134
|
+
], void | Promise<void>>;
|
|
135
|
+
afterDelete?: BivariantCallback<[
|
|
136
|
+
context: {
|
|
137
|
+
id: string;
|
|
138
|
+
doc?: Readonly<CollectionDocument<TFields>>;
|
|
139
|
+
}
|
|
140
|
+
], void | Promise<void>>;
|
|
141
|
+
};
|
|
142
|
+
export type CollectionAdminOptions = {
|
|
143
|
+
/** @deprecated Use collection labels.plural instead. */
|
|
144
|
+
label?: string;
|
|
145
|
+
useAsTitle?: string;
|
|
146
|
+
defaultColumns?: readonly string[];
|
|
147
|
+
listSearchableFields?: readonly string[];
|
|
148
|
+
};
|
|
149
|
+
export type CollectionDefinition<TFields extends Fields = Fields> = {
|
|
150
|
+
slug: string;
|
|
151
|
+
/** Payload-style collection names. Unspecified names are derived from the slug. */
|
|
152
|
+
labels?: {
|
|
153
|
+
singular?: string;
|
|
154
|
+
plural?: string;
|
|
155
|
+
};
|
|
156
|
+
fields: TFields;
|
|
157
|
+
/** Payload-compatible setting; Jazz records timestamps as built-in metadata. */
|
|
158
|
+
timestamps?: boolean;
|
|
159
|
+
admin?: CollectionAdminOptions;
|
|
160
|
+
/** Jazz row-level access predicates. Use "public" to grant all operations; omitted operations are denied. */
|
|
161
|
+
access?: "public" | CollectionAccess<TFields>;
|
|
162
|
+
/** Client-side lifecycle callbacks run by the generated Bebop mutation client. */
|
|
163
|
+
hooks?: CollectionHooks<TFields>;
|
|
164
|
+
};
|
|
165
|
+
export type BetterAuthDefinition = {
|
|
166
|
+
provider: "better-auth";
|
|
167
|
+
/** Path to the Better Auth CLI configuration, relative to the Bebop config. */
|
|
168
|
+
generateConfig?: string;
|
|
169
|
+
};
|
|
170
|
+
export type BebopConfig = {
|
|
171
|
+
collections: readonly CollectionDefinition[];
|
|
172
|
+
auth?: BetterAuthDefinition;
|
|
173
|
+
};
|
|
174
|
+
export declare function collection<const TSlug extends string, const TFields extends Fields>(definition: CollectionDefinition<TFields> & {
|
|
175
|
+
slug: TSlug;
|
|
176
|
+
}): CollectionDefinition<TFields> & {
|
|
177
|
+
slug: TSlug;
|
|
178
|
+
};
|
|
179
|
+
export declare function defineConfig<const T extends BebopConfig>(config: T): T;
|
|
180
|
+
export declare function betterAuth(options?: Omit<BetterAuthDefinition, "provider">): BetterAuthDefinition;
|
|
181
|
+
export {};
|
package/dist/bebop.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function collection(definition) {
|
|
2
|
+
return definition;
|
|
3
|
+
}
|
|
4
|
+
export function defineConfig(config) {
|
|
5
|
+
return config;
|
|
6
|
+
}
|
|
7
|
+
export function betterAuth(options = {}) {
|
|
8
|
+
return { provider: "better-auth", ...options };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=bebop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bebop.js","sourceRoot":"","sources":["../src/bebop.ts"],"names":[],"mappings":"AAsKA,MAAM,UAAU,UAAU,CACxB,UAA2D;IAE3D,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,YAAY,CAA8B,MAAS;IACjE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,UAAkD,EAAE;IAEpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;AACjD,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Db, MutationErrorEvent, QueryBuilder, WriteHandle } from "jazz-tools";
|
|
2
|
+
import type { BebopConfig, CollectionDocument, Fields, StoredFields } from "./bebop.ts";
|
|
3
|
+
type RequiredStoredKeys<TFields extends Fields> = {
|
|
4
|
+
[TName in keyof StoredFields<TFields>]-?: {} extends Pick<StoredFields<TFields>, TName> ? never : TName;
|
|
5
|
+
}[keyof StoredFields<TFields>];
|
|
6
|
+
export type CollectionCreateData<TFields extends Fields> = Pick<StoredFields<TFields>, RequiredStoredKeys<TFields>> & Partial<Omit<StoredFields<TFields>, RequiredStoredKeys<TFields>>>;
|
|
7
|
+
export type CollectionUpdateData<TFields extends Fields> = Partial<StoredFields<TFields>>;
|
|
8
|
+
type QueryValue<T> = Exclude<T, undefined> | (undefined extends T ? null : never);
|
|
9
|
+
type QueryPredicate<T> = QueryValue<T> | ({
|
|
10
|
+
eq?: QueryValue<T>;
|
|
11
|
+
ne?: QueryValue<T>;
|
|
12
|
+
in?: Exclude<QueryValue<T>, null>[];
|
|
13
|
+
notIn?: Exclude<QueryValue<T>, null>[];
|
|
14
|
+
} & (NonNullable<QueryValue<T>> extends string ? {
|
|
15
|
+
contains?: string;
|
|
16
|
+
} : {}) & (NonNullable<QueryValue<T>> extends number | Date ? {
|
|
17
|
+
gt?: NonNullable<QueryValue<T>>;
|
|
18
|
+
gte?: NonNullable<QueryValue<T>>;
|
|
19
|
+
lt?: NonNullable<QueryValue<T>>;
|
|
20
|
+
lte?: NonNullable<QueryValue<T>>;
|
|
21
|
+
} : {}));
|
|
22
|
+
export type BebopQueryOptions<TFields extends Fields> = {
|
|
23
|
+
where?: {
|
|
24
|
+
[TName in keyof StoredFields<TFields>]?: QueryPredicate<StoredFields<TFields>[TName]>;
|
|
25
|
+
} & {
|
|
26
|
+
id?: QueryPredicate<string>;
|
|
27
|
+
};
|
|
28
|
+
orderBy?: {
|
|
29
|
+
field: keyof StoredFields<TFields> | "id" | "$createdAt" | "$updatedAt";
|
|
30
|
+
direction?: "asc" | "desc";
|
|
31
|
+
};
|
|
32
|
+
limit?: number;
|
|
33
|
+
offset?: number;
|
|
34
|
+
includeTimestamps?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type BebopMutationResult<TDocument> = {
|
|
37
|
+
doc: TDocument;
|
|
38
|
+
/** The mutation has been applied locally; call waitForGlobal for server confirmation. */
|
|
39
|
+
durability: "local";
|
|
40
|
+
write: WriteHandle<unknown, unknown>;
|
|
41
|
+
waitForGlobal: () => Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
export type BebopDeleteResult<TDocument> = {
|
|
44
|
+
id: string;
|
|
45
|
+
doc?: TDocument;
|
|
46
|
+
durability: "local";
|
|
47
|
+
write: WriteHandle<unknown, unknown>;
|
|
48
|
+
waitForGlobal: () => Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
export type BebopCollectionClient<TFields extends Fields> = {
|
|
51
|
+
query(options?: BebopQueryOptions<TFields>): QueryBuilder<CollectionDocument<TFields>>;
|
|
52
|
+
queryIds(options?: Pick<BebopQueryOptions<TFields>, "where">): QueryBuilder<{
|
|
53
|
+
id: string;
|
|
54
|
+
}>;
|
|
55
|
+
find(options?: BebopQueryOptions<TFields>): Promise<CollectionDocument<TFields>[]>;
|
|
56
|
+
findById(id: string): Promise<CollectionDocument<TFields> | null>;
|
|
57
|
+
create(data: CollectionCreateData<TFields>): Promise<BebopMutationResult<CollectionDocument<TFields>>>;
|
|
58
|
+
update(id: string, data: CollectionUpdateData<TFields>): Promise<BebopMutationResult<CollectionDocument<TFields>>>;
|
|
59
|
+
delete(id: string): Promise<BebopDeleteResult<CollectionDocument<TFields>>>;
|
|
60
|
+
};
|
|
61
|
+
export type BebopClient<TConfig extends BebopConfig> = {
|
|
62
|
+
[TCollection in TConfig["collections"][number] as TCollection["slug"]]: BebopCollectionClient<TCollection["fields"]>;
|
|
63
|
+
} & {
|
|
64
|
+
onMutationError(listener: (event: MutationErrorEvent) => void): () => void;
|
|
65
|
+
};
|
|
66
|
+
export declare class BebopHookError extends Error {
|
|
67
|
+
readonly hook: "afterChange" | "afterDelete";
|
|
68
|
+
readonly write: WriteHandle<unknown, unknown>;
|
|
69
|
+
readonly localWriteApplied = true;
|
|
70
|
+
constructor(hook: "afterChange" | "afterDelete", cause: unknown, write: WriteHandle<unknown, unknown>);
|
|
71
|
+
}
|
|
72
|
+
export declare class BebopDocumentNotFoundError extends Error {
|
|
73
|
+
readonly collection: string;
|
|
74
|
+
readonly id: string;
|
|
75
|
+
constructor(collection: string, id: string);
|
|
76
|
+
}
|
|
77
|
+
export declare function createBebopClient<const TConfig extends BebopConfig>(options: {
|
|
78
|
+
app: Record<TConfig["collections"][number]["slug"], object>;
|
|
79
|
+
config: TConfig;
|
|
80
|
+
db: Db;
|
|
81
|
+
}): BebopClient<TConfig>;
|
|
82
|
+
export {};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export class BebopHookError extends Error {
|
|
2
|
+
hook;
|
|
3
|
+
write;
|
|
4
|
+
localWriteApplied = true;
|
|
5
|
+
constructor(hook, cause, write) {
|
|
6
|
+
super(`The ${hook} hook failed after the local Jazz write was applied.`, { cause });
|
|
7
|
+
this.hook = hook;
|
|
8
|
+
this.write = write;
|
|
9
|
+
this.name = "BebopHookError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function localWrite(write) {
|
|
13
|
+
return {
|
|
14
|
+
durability: "local",
|
|
15
|
+
write,
|
|
16
|
+
waitForGlobal: async () => { await write.wait({ tier: "global" }); },
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export class BebopDocumentNotFoundError extends Error {
|
|
20
|
+
collection;
|
|
21
|
+
id;
|
|
22
|
+
constructor(collection, id) {
|
|
23
|
+
super(`Could not find ${collection} document "${id}" in the local database.`);
|
|
24
|
+
this.collection = collection;
|
|
25
|
+
this.id = id;
|
|
26
|
+
this.name = "BebopDocumentNotFoundError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function nonnegativeInteger(value, name) {
|
|
30
|
+
if (value === undefined)
|
|
31
|
+
return undefined;
|
|
32
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
33
|
+
throw new RangeError(`${name} must be a non-negative safe integer.`);
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
export function createBebopClient(options) {
|
|
37
|
+
const { app, config, db } = options;
|
|
38
|
+
const collections = {};
|
|
39
|
+
for (const definition of config.collections) {
|
|
40
|
+
const collectionName = definition.slug;
|
|
41
|
+
const table = app[collectionName];
|
|
42
|
+
if (!table)
|
|
43
|
+
throw new Error(`Generated Bebop app is missing collection "${collectionName}".`);
|
|
44
|
+
const hooks = definition.hooks;
|
|
45
|
+
const readLocalDocument = (id) => db.one(table.where({ id }));
|
|
46
|
+
const storedFields = new Set(definition.fields.flatMap((field) => field.type === "join"
|
|
47
|
+
? []
|
|
48
|
+
: [field.type === "relationship" ? `${field.name}Id` : field.name]));
|
|
49
|
+
const validateWriteData = (data) => {
|
|
50
|
+
for (const name of Object.keys(data)) {
|
|
51
|
+
if (!storedFields.has(name))
|
|
52
|
+
throw new Error(`Unknown ${collectionName} write field "${name}".`);
|
|
53
|
+
}
|
|
54
|
+
return data;
|
|
55
|
+
};
|
|
56
|
+
const validatedWhere = (where) => {
|
|
57
|
+
if (!where)
|
|
58
|
+
return undefined;
|
|
59
|
+
for (const name of Object.keys(where)) {
|
|
60
|
+
if (name !== "id" && !storedFields.has(name))
|
|
61
|
+
throw new Error(`Unknown ${collectionName} query field "${name}".`);
|
|
62
|
+
}
|
|
63
|
+
return where;
|
|
64
|
+
};
|
|
65
|
+
const query = (options = {}) => {
|
|
66
|
+
let result = table.select("*", ...(options.includeTimestamps ? ["$createdAt", "$updatedAt"] : []));
|
|
67
|
+
const where = validatedWhere(options.where);
|
|
68
|
+
if (where)
|
|
69
|
+
result = result.where(where);
|
|
70
|
+
if (options.orderBy) {
|
|
71
|
+
const field = String(options.orderBy.field);
|
|
72
|
+
if (field !== "id" && field !== "$createdAt" && field !== "$updatedAt" && !storedFields.has(field)) {
|
|
73
|
+
throw new Error(`Unknown ${collectionName} sort field "${field}".`);
|
|
74
|
+
}
|
|
75
|
+
result = result.orderBy(field, options.orderBy.direction);
|
|
76
|
+
}
|
|
77
|
+
const limit = nonnegativeInteger(options.limit, "limit");
|
|
78
|
+
const offset = nonnegativeInteger(options.offset, "offset");
|
|
79
|
+
if (limit !== undefined)
|
|
80
|
+
result = result.limit(limit);
|
|
81
|
+
if (offset !== undefined)
|
|
82
|
+
result = result.offset(offset);
|
|
83
|
+
return result;
|
|
84
|
+
};
|
|
85
|
+
collections[collectionName] = {
|
|
86
|
+
query,
|
|
87
|
+
queryIds: (options = {}) => {
|
|
88
|
+
let result = table.select("id");
|
|
89
|
+
const where = validatedWhere(options.where);
|
|
90
|
+
if (where)
|
|
91
|
+
result = result.where(where);
|
|
92
|
+
return result;
|
|
93
|
+
},
|
|
94
|
+
find: (options) => db.all(query(options)),
|
|
95
|
+
findById: (id) => readLocalDocument(id),
|
|
96
|
+
async create(data) {
|
|
97
|
+
validateWriteData(data);
|
|
98
|
+
const context = {
|
|
99
|
+
operation: "create",
|
|
100
|
+
data: { ...data },
|
|
101
|
+
};
|
|
102
|
+
const patch = await hooks?.beforeChange?.(context);
|
|
103
|
+
const document = { ...context.data, ...patch };
|
|
104
|
+
validateWriteData(document);
|
|
105
|
+
const write = db.insert(table, document);
|
|
106
|
+
const doc = write.value;
|
|
107
|
+
try {
|
|
108
|
+
await hooks?.afterChange?.({ operation: "create", doc });
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw new BebopHookError("afterChange", error, write);
|
|
112
|
+
}
|
|
113
|
+
return { doc, ...localWrite(write) };
|
|
114
|
+
},
|
|
115
|
+
async update(id, data) {
|
|
116
|
+
validateWriteData(data);
|
|
117
|
+
const originalDoc = await readLocalDocument(id);
|
|
118
|
+
if (!originalDoc)
|
|
119
|
+
throw new BebopDocumentNotFoundError(collectionName, id);
|
|
120
|
+
const context = {
|
|
121
|
+
operation: "update",
|
|
122
|
+
id,
|
|
123
|
+
data: { ...data },
|
|
124
|
+
originalDoc,
|
|
125
|
+
};
|
|
126
|
+
const patch = await hooks?.beforeChange?.(context);
|
|
127
|
+
const document = { ...context.data, ...patch };
|
|
128
|
+
validateWriteData(document);
|
|
129
|
+
const write = db.update(table, id, document);
|
|
130
|
+
const doc = { ...originalDoc, ...document };
|
|
131
|
+
try {
|
|
132
|
+
await hooks?.afterChange?.({ operation: "update", doc, originalDoc });
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
throw new BebopHookError("afterChange", error, write);
|
|
136
|
+
}
|
|
137
|
+
return { doc, ...localWrite(write) };
|
|
138
|
+
},
|
|
139
|
+
async delete(id) {
|
|
140
|
+
const doc = await readLocalDocument(id) ?? undefined;
|
|
141
|
+
await hooks?.beforeDelete?.({ id, ...(doc ? { doc } : {}) });
|
|
142
|
+
const write = db.delete(table, id);
|
|
143
|
+
try {
|
|
144
|
+
await hooks?.afterDelete?.({ id, ...(doc ? { doc } : {}) });
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
throw new BebopHookError("afterDelete", error, write);
|
|
148
|
+
}
|
|
149
|
+
return { id, ...(doc ? { doc } : {}), ...localWrite(write) };
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
...collections,
|
|
155
|
+
onMutationError: (listener) => db.onMutationError(listener),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AA0EA,MAAM,OAAO,cAAe,SAAQ,KAAK;IAGlB;IAA8D;IAF1E,iBAAiB,GAAG,IAAI,CAAC;IAElC,YAAqB,IAAmC,EAAE,KAAc,EAAW,KAAoC;QACrH,KAAK,CAAC,OAAO,IAAI,sDAAsD,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QADjE,SAAI,GAAJ,IAAI,CAA+B;QAA2B,UAAK,GAAL,KAAK,CAA+B;QAErH,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,SAAS,UAAU,CAAC,KAAoC;IACtD,OAAO;QACL,UAAU,EAAE,OAAgB;QAC5B,KAAK;QACL,aAAa,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;KACrE,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC9B;IAA6B;IAAlD,YAAqB,UAAkB,EAAW,EA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,EAAE,EAAE,CAAkC,CAAC;gBACpE,IAAI,CAAC;oBACH,MAAM,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBAC9D,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAI,cAAc,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBACxD,CAAC;gBACD,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/D,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,WAAW;QACd,eAAe,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC;KACpC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { BebopConfig, FieldDefinition, Fields } from "./bebop.ts";
|
|
2
|
+
type StoredFieldKind = Exclude<FieldDefinition["type"], "join" | "relationship" | "checkbox"> | "relation" | "boolean" | "integer";
|
|
3
|
+
export declare function normalizeConfig(config: BebopConfig): {
|
|
4
|
+
auth: import("./bebop.ts").BetterAuthDefinition | undefined;
|
|
5
|
+
collections: {
|
|
6
|
+
name: string;
|
|
7
|
+
fields: ({
|
|
8
|
+
admin?: {
|
|
9
|
+
defaultColumns?: readonly string[];
|
|
10
|
+
allowCreate?: boolean;
|
|
11
|
+
} | undefined;
|
|
12
|
+
name: string;
|
|
13
|
+
label: string;
|
|
14
|
+
kind: "join";
|
|
15
|
+
required: boolean;
|
|
16
|
+
collection: string;
|
|
17
|
+
on: string;
|
|
18
|
+
} | {
|
|
19
|
+
relationTo?: string | undefined;
|
|
20
|
+
optionLabels?: {
|
|
21
|
+
[k: string]: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
options?: string[] | undefined;
|
|
24
|
+
admin?: {
|
|
25
|
+
position?: "main" | "sidebar";
|
|
26
|
+
input?: "textarea";
|
|
27
|
+
date?: {
|
|
28
|
+
pickerAppearance?: "dayOnly" | "dayAndTime";
|
|
29
|
+
};
|
|
30
|
+
} | undefined;
|
|
31
|
+
name: string;
|
|
32
|
+
storageName: string;
|
|
33
|
+
label: string;
|
|
34
|
+
kind: StoredFieldKind;
|
|
35
|
+
required: boolean;
|
|
36
|
+
definition: import("./bebop.ts").TextField | import("./bebop.ts").NumberField | import("./bebop.ts").CheckboxField | import("./bebop.ts").DateField | import("./bebop.ts").JsonField | import("./bebop.ts").SelectField | import("./bebop.ts").RelationshipField;
|
|
37
|
+
})[];
|
|
38
|
+
access: "public" | Partial<{
|
|
39
|
+
read: (context: import("./bebop.ts").CollectionAccessContext<Fields>) => import("jazz-tools").PermissionExpressionInput | Partial<Record<string | number, unknown>>;
|
|
40
|
+
create: (context: import("./bebop.ts").CollectionAccessContext<Fields>) => import("jazz-tools").PermissionExpressionInput | Partial<Record<string | number, unknown>>;
|
|
41
|
+
update: (context: import("./bebop.ts").CollectionAccessContext<Fields>) => import("jazz-tools").PermissionExpressionInput | Partial<Record<string | number, unknown>>;
|
|
42
|
+
delete: (context: import("./bebop.ts").CollectionAccessContext<Fields>) => import("jazz-tools").PermissionExpressionInput | Partial<Record<string | number, unknown>>;
|
|
43
|
+
}> | undefined;
|
|
44
|
+
admin: {
|
|
45
|
+
labels: {
|
|
46
|
+
singular: string;
|
|
47
|
+
plural: string;
|
|
48
|
+
};
|
|
49
|
+
timestamps: boolean;
|
|
50
|
+
useAsTitle: string | undefined;
|
|
51
|
+
defaultColumns: readonly string[];
|
|
52
|
+
listSearchableFields: readonly string[];
|
|
53
|
+
};
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
export declare function compileSchema(config: BebopConfig): string;
|
|
57
|
+
export declare function compileAdminManifest(config: BebopConfig): string;
|
|
58
|
+
export declare function compilePermissions(config: BebopConfig, configModuleSpecifier?: string): string;
|
|
59
|
+
export declare function compileArtifacts(config: BebopConfig, configModuleSpecifier?: string): {
|
|
60
|
+
schema: string;
|
|
61
|
+
adminManifest: string;
|
|
62
|
+
permissions: string;
|
|
63
|
+
clientFactory: string;
|
|
64
|
+
};
|
|
65
|
+
export declare function compileClientFactory(configModuleSpecifier?: string): string;
|
|
66
|
+
export {};
|
package/dist/compiler.js
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
const namePattern = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
2
|
+
function fieldKind(field) {
|
|
3
|
+
if (field.type === "relationship")
|
|
4
|
+
return "relation";
|
|
5
|
+
if (field.type === "checkbox")
|
|
6
|
+
return "boolean";
|
|
7
|
+
if (field.type === "number" && field.integer)
|
|
8
|
+
return "integer";
|
|
9
|
+
return field.type;
|
|
10
|
+
}
|
|
11
|
+
function selectOptionValue(option) {
|
|
12
|
+
return typeof option === "string" ? option : option.value;
|
|
13
|
+
}
|
|
14
|
+
export function normalizeConfig(config) {
|
|
15
|
+
validateConfig(config);
|
|
16
|
+
return {
|
|
17
|
+
auth: config.auth,
|
|
18
|
+
collections: config.collections.map((definition) => {
|
|
19
|
+
const name = definition.slug;
|
|
20
|
+
const pluralLabel = definition.labels?.plural ?? definition.admin?.label ?? humanize(name);
|
|
21
|
+
const singularLabel = definition.labels?.singular ?? singularize(pluralLabel);
|
|
22
|
+
const fields = definition.fields.map((field) => {
|
|
23
|
+
if (field.type === "join") {
|
|
24
|
+
return {
|
|
25
|
+
name: field.name,
|
|
26
|
+
label: field.label ?? humanize(field.name),
|
|
27
|
+
kind: "join",
|
|
28
|
+
required: false,
|
|
29
|
+
collection: field.collection,
|
|
30
|
+
on: field.on,
|
|
31
|
+
...(field.admin ? { admin: field.admin } : {}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
name: field.name,
|
|
36
|
+
storageName: field.type === "relationship" ? `${field.name}Id` : field.name,
|
|
37
|
+
label: field.label ?? humanize(field.name),
|
|
38
|
+
kind: fieldKind(field),
|
|
39
|
+
required: Boolean(field.required),
|
|
40
|
+
definition: field,
|
|
41
|
+
...(field.admin ? { admin: field.admin } : {}),
|
|
42
|
+
...(field.type === "select" ? { options: field.options.map(selectOptionValue) } : {}),
|
|
43
|
+
...(field.type === "select" && field.options.some((option) => typeof option !== "string")
|
|
44
|
+
? { optionLabels: Object.fromEntries(field.options.flatMap((option) => typeof option === "string" ? [] : [[option.value, option.label]])) }
|
|
45
|
+
: {}),
|
|
46
|
+
...(field.type === "relationship" ? { relationTo: field.relationTo } : {}),
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
const storedFields = fields.filter((field) => field.kind !== "join");
|
|
50
|
+
const fieldNames = storedFields.map((field) => field.name);
|
|
51
|
+
const useAsTitle = definition.admin?.useAsTitle ?? (fieldNames.includes("title") ? "title" : undefined);
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
fields,
|
|
55
|
+
access: definition.access,
|
|
56
|
+
admin: {
|
|
57
|
+
labels: { singular: singularLabel, plural: pluralLabel },
|
|
58
|
+
timestamps: definition.timestamps !== false,
|
|
59
|
+
useAsTitle,
|
|
60
|
+
defaultColumns: definition.admin?.defaultColumns ?? [
|
|
61
|
+
...(useAsTitle ? [useAsTitle] : []),
|
|
62
|
+
...fieldNames.filter((fieldName) => fieldName !== useAsTitle),
|
|
63
|
+
].slice(0, 4),
|
|
64
|
+
listSearchableFields: definition.admin?.listSearchableFields ?? (useAsTitle ? [useAsTitle] : []),
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function compileSchemaFromModel(model) {
|
|
71
|
+
const tables = model.collections.map((collection) => {
|
|
72
|
+
const columns = [];
|
|
73
|
+
const relations = [];
|
|
74
|
+
for (const field of collection.fields) {
|
|
75
|
+
if (field.kind === "join") {
|
|
76
|
+
relations.push(`${JSON.stringify(field.name)}: s.reverse(${JSON.stringify(field.collection)}, ${JSON.stringify(field.on)})`);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (field.kind === "relation") {
|
|
80
|
+
const columnName = field.storageName;
|
|
81
|
+
const optional = field.required ? "" : ".optional()";
|
|
82
|
+
columns.push(`${JSON.stringify(columnName)}: s.uuid()${optional}`);
|
|
83
|
+
relations.push(`${JSON.stringify(field.name)}: s.rel(${JSON.stringify(field.relationTo)}, ${JSON.stringify(columnName)})`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
columns.push(`${JSON.stringify(field.name)}: ${compileFieldType(field.definition)}${field.required ? "" : ".optional()"}`);
|
|
87
|
+
}
|
|
88
|
+
const relationObject = relations.length
|
|
89
|
+
? `{\n ${relations.join(",\n ")}\n }`
|
|
90
|
+
: "{}";
|
|
91
|
+
return ` ${JSON.stringify(collection.name)}: s.table(\n {\n ${columns.join(",\n ")}\n },\n ${relationObject},\n )`;
|
|
92
|
+
});
|
|
93
|
+
const authImport = model.auth
|
|
94
|
+
? 'import { schema as betterAuthSchema } from "./schema-better-auth/schema.js";\n'
|
|
95
|
+
: "";
|
|
96
|
+
const entries = [...(model.auth ? [" ...betterAuthSchema"] : []), ...tables];
|
|
97
|
+
return `// Generated in bebop-generated-schema.ts from bebop.config.ts. Edit that file, then run bebop generate.\nimport { schema as s } from "jazz-tools";\n${authImport}\nconst schema = {\n${entries.join(",\n")}\n} as const;\n\ntype AppSchema = s.Schema<typeof schema>;\nexport const app: s.App<AppSchema> = s.defineApp(schema);\n`;
|
|
98
|
+
}
|
|
99
|
+
function compileAdminManifestFromModel(model) {
|
|
100
|
+
const collections = model.collections.map((collection) => {
|
|
101
|
+
const { labels, timestamps, useAsTitle, defaultColumns, listSearchableFields } = collection.admin;
|
|
102
|
+
const fields = collection.fields.map((field) => field.kind === "join"
|
|
103
|
+
? {
|
|
104
|
+
name: field.name,
|
|
105
|
+
label: field.label,
|
|
106
|
+
kind: field.kind,
|
|
107
|
+
required: false,
|
|
108
|
+
collection: field.collection,
|
|
109
|
+
on: field.on,
|
|
110
|
+
...(field.admin ? { admin: field.admin } : {}),
|
|
111
|
+
}
|
|
112
|
+
: {
|
|
113
|
+
name: field.name,
|
|
114
|
+
storageName: field.storageName,
|
|
115
|
+
label: field.label,
|
|
116
|
+
kind: field.kind,
|
|
117
|
+
required: field.required,
|
|
118
|
+
...(field.admin ? { admin: field.admin } : {}),
|
|
119
|
+
...("options" in field && field.options ? { options: field.options } : {}),
|
|
120
|
+
...("optionLabels" in field && field.optionLabels ? { optionLabels: field.optionLabels } : {}),
|
|
121
|
+
...("relationTo" in field && field.relationTo ? { relationTo: field.relationTo } : {}),
|
|
122
|
+
});
|
|
123
|
+
return [collection.name, {
|
|
124
|
+
slug: collection.name,
|
|
125
|
+
labels,
|
|
126
|
+
fields,
|
|
127
|
+
timestamps,
|
|
128
|
+
...(useAsTitle ? { useAsTitle } : {}),
|
|
129
|
+
defaultColumns,
|
|
130
|
+
listSearchableFields,
|
|
131
|
+
}];
|
|
132
|
+
});
|
|
133
|
+
return `// Generated from bebop.config.ts. Do not edit this file.\nexport const bebopAdminManifest = ${JSON.stringify({ collections: Object.fromEntries(collections) }, null, 2)} as const;\n`;
|
|
134
|
+
}
|
|
135
|
+
function compilePermissionsFromModel(model, configModuleSpecifier = "./bebop.config.js") {
|
|
136
|
+
const hasAccessCallbacks = model.collections.some((collection) => collection.access && collection.access !== "public");
|
|
137
|
+
const grants = model.collections
|
|
138
|
+
.flatMap((collection, index) => {
|
|
139
|
+
const collectionName = collection.name;
|
|
140
|
+
const access = collection.access;
|
|
141
|
+
if (!access)
|
|
142
|
+
return [];
|
|
143
|
+
const operations = [
|
|
144
|
+
["read", "Read"],
|
|
145
|
+
["create", "Insert"],
|
|
146
|
+
["update", "Update"],
|
|
147
|
+
["delete", "Delete"],
|
|
148
|
+
];
|
|
149
|
+
if (access === "public") {
|
|
150
|
+
return operations.map(([, jazzOperation]) => ` policy.${collectionName}.allow${jazzOperation}.always();`);
|
|
151
|
+
}
|
|
152
|
+
const rules = [` const ${collectionName}Access: Exclude<CollectionDefinition["access"], "public"> = bebopConfig.collections[${index}].access;`];
|
|
153
|
+
for (const [accessOperation, jazzOperation] of operations) {
|
|
154
|
+
if (!access[accessOperation])
|
|
155
|
+
continue;
|
|
156
|
+
rules.push(` if (${collectionName}Access?.${accessOperation}) {\n` +
|
|
157
|
+
` policy.${collectionName}.allow${jazzOperation}.where((row) => ${collectionName}Access.${accessOperation}!({ row, session, allOf, anyOf, exists, isCreator }) as never);\n` +
|
|
158
|
+
` }`);
|
|
159
|
+
}
|
|
160
|
+
return rules;
|
|
161
|
+
})
|
|
162
|
+
.join("\n");
|
|
163
|
+
const authImport = model.auth
|
|
164
|
+
? 'import { permissions as betterAuthPermissions } from "./schema-better-auth/schema.js";\n'
|
|
165
|
+
: "";
|
|
166
|
+
const configImport = hasAccessCallbacks
|
|
167
|
+
? `import bebopConfig from ${JSON.stringify(configModuleSpecifier)};\nimport type { CollectionDefinition } from "@bebopdev/core";\n`
|
|
168
|
+
: "";
|
|
169
|
+
const existsHelper = hasAccessCallbacks
|
|
170
|
+
? `\n const exists = (collectionName: string, condition: Record<string, unknown>) => {\n` +
|
|
171
|
+
` const tablePolicy = (policy as unknown as Record<string, { exists: { where(input: Record<string, unknown>): unknown } }>)[collectionName];\n` +
|
|
172
|
+
` if (!tablePolicy) throw new Error(\`Unknown collection in access.exists(): \${collectionName}\`);\n` +
|
|
173
|
+
` return tablePolicy.exists.where(condition) as never;\n` +
|
|
174
|
+
` };\n`
|
|
175
|
+
: "";
|
|
176
|
+
const permissionContext = hasAccessCallbacks ? "policy, session, allOf, anyOf, isCreator" : "policy";
|
|
177
|
+
const appPermissions = `const appPermissions = s.definePermissions(app, ({ ${permissionContext} }) => {${existsHelper}\n${grants}\n});`;
|
|
178
|
+
return `// Generated from bebop.config.ts. Missing collection operations are denied by Jazz.\nimport { schema as s } from "jazz-tools";\nimport { app } from "./bebop-generated-schema.js";\n${authImport}${configImport}\n${appPermissions}\n${model.auth ? "export default { ...betterAuthPermissions, ...appPermissions };" : "export default appPermissions;"}\n`;
|
|
179
|
+
}
|
|
180
|
+
export function compileSchema(config) {
|
|
181
|
+
return compileSchemaFromModel(normalizeConfig(config));
|
|
182
|
+
}
|
|
183
|
+
export function compileAdminManifest(config) {
|
|
184
|
+
return compileAdminManifestFromModel(normalizeConfig(config));
|
|
185
|
+
}
|
|
186
|
+
export function compilePermissions(config, configModuleSpecifier = "./bebop.config.js") {
|
|
187
|
+
return compilePermissionsFromModel(normalizeConfig(config), configModuleSpecifier);
|
|
188
|
+
}
|
|
189
|
+
export function compileArtifacts(config, configModuleSpecifier = "./bebop.config.js") {
|
|
190
|
+
const model = normalizeConfig(config);
|
|
191
|
+
return {
|
|
192
|
+
schema: compileSchemaFromModel(model),
|
|
193
|
+
adminManifest: compileAdminManifestFromModel(model),
|
|
194
|
+
permissions: compilePermissionsFromModel(model, configModuleSpecifier),
|
|
195
|
+
clientFactory: compileClientFactory(configModuleSpecifier),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export function compileClientFactory(configModuleSpecifier = "./bebop.config.js") {
|
|
199
|
+
return `// Generated from bebop.config.ts. Do not edit this file.\nimport { createBebopClient as createClient } from "@bebopdev/core";\nimport type { Db } from "jazz-tools";\nimport { app } from "./bebop-generated-schema.js";\nimport bebopConfig from ${JSON.stringify(configModuleSpecifier)};\n\nexport function createBebopClient(db: Db) {\n return createClient({ app, config: bebopConfig, db });\n}\n`;
|
|
200
|
+
}
|
|
201
|
+
function compileFieldType(field) {
|
|
202
|
+
switch (field.type) {
|
|
203
|
+
case "text":
|
|
204
|
+
return "s.string()";
|
|
205
|
+
case "number":
|
|
206
|
+
return field.integer ? "s.int()" : "s.float()";
|
|
207
|
+
case "checkbox":
|
|
208
|
+
return "s.boolean()";
|
|
209
|
+
case "date":
|
|
210
|
+
return "s.timestamp()";
|
|
211
|
+
case "json":
|
|
212
|
+
return "s.json()";
|
|
213
|
+
case "select":
|
|
214
|
+
return `s.enum(${field.options.map((option) => JSON.stringify(selectOptionValue(option))).join(", ")})`;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function validateConfig(config) {
|
|
218
|
+
if (!Array.isArray(config.collections) || config.collections.length === 0) {
|
|
219
|
+
throw new Error("Bebop config must define at least one collection.");
|
|
220
|
+
}
|
|
221
|
+
const collections = config.collections;
|
|
222
|
+
const collectionNames = collections.map((collection) => collection.slug);
|
|
223
|
+
if (config.auth && config.auth.provider !== "better-auth") {
|
|
224
|
+
throw new Error(`Unsupported authentication provider "${config.auth.provider}".`);
|
|
225
|
+
}
|
|
226
|
+
if (new Set(collectionNames).size !== collectionNames.length) {
|
|
227
|
+
throw new Error("Collection slugs must be unique.");
|
|
228
|
+
}
|
|
229
|
+
for (const definition of collections) {
|
|
230
|
+
const collectionName = definition.slug;
|
|
231
|
+
if (!namePattern.test(collectionName)) {
|
|
232
|
+
throw new Error(`Invalid collection name "${collectionName}". Use letters, numbers, and underscores.`);
|
|
233
|
+
}
|
|
234
|
+
if (config.auth && collectionName.startsWith("better_auth_")) {
|
|
235
|
+
throw new Error(`Collection name "${collectionName}" uses the reserved Better Auth table prefix "better_auth_".`);
|
|
236
|
+
}
|
|
237
|
+
if (!Array.isArray(definition.fields) || definition.fields.length === 0) {
|
|
238
|
+
throw new Error(`Collection "${collectionName}" must define at least one field.`);
|
|
239
|
+
}
|
|
240
|
+
const fields = definition.fields;
|
|
241
|
+
if (definition.timestamps === false) {
|
|
242
|
+
throw new Error(`Collection "${collectionName}" cannot disable timestamps: Jazz records $createdAt and $updatedAt as built-in metadata.`);
|
|
243
|
+
}
|
|
244
|
+
if (definition.access !== undefined && definition.access !== "public" && (typeof definition.access !== "object" || definition.access === null)) {
|
|
245
|
+
throw new Error(`Collection "${collectionName}" access must be "public" or an operation callback object.`);
|
|
246
|
+
}
|
|
247
|
+
if (definition.access && definition.access !== "public") {
|
|
248
|
+
for (const operation of ["read", "create", "update", "delete"]) {
|
|
249
|
+
const rule = definition.access[operation];
|
|
250
|
+
if (rule !== undefined && typeof rule !== "function") {
|
|
251
|
+
throw new Error(`Collection "${collectionName}" access.${operation} must be a callback.`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
for (const hook of ["beforeChange", "afterChange", "beforeDelete", "afterDelete"]) {
|
|
256
|
+
const callback = definition.hooks?.[hook];
|
|
257
|
+
if (callback !== undefined && typeof callback !== "function") {
|
|
258
|
+
throw new Error(`Collection "${collectionName}" hooks.${hook} must be a callback.`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (definition.admin?.label !== undefined && !definition.admin.label.trim()) {
|
|
262
|
+
throw new Error(`Collection "${collectionName}" admin label cannot be empty.`);
|
|
263
|
+
}
|
|
264
|
+
for (const name of ["singular", "plural"]) {
|
|
265
|
+
if (definition.labels?.[name] !== undefined && !definition.labels[name]?.trim()) {
|
|
266
|
+
throw new Error(`Collection "${collectionName}" labels.${name} cannot be empty.`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const storedNames = new Set(["id"]);
|
|
270
|
+
const fieldNames = new Set();
|
|
271
|
+
for (const field of fields) {
|
|
272
|
+
const fieldName = field.name;
|
|
273
|
+
if (!["text", "number", "checkbox", "date", "json", "select", "relationship", "join"].includes(field.type)) {
|
|
274
|
+
throw new Error(`Unsupported field type "${field.type}" in collection "${collectionName}".`);
|
|
275
|
+
}
|
|
276
|
+
if (!namePattern.test(fieldName) || fieldName === "id") {
|
|
277
|
+
throw new Error(`Invalid field name "${fieldName}" in collection "${collectionName}".`);
|
|
278
|
+
}
|
|
279
|
+
if (field.label !== undefined && !field.label.trim()) {
|
|
280
|
+
throw new Error(`Field "${collectionName}.${fieldName}" label cannot be empty.`);
|
|
281
|
+
}
|
|
282
|
+
if (fieldNames.has(fieldName)) {
|
|
283
|
+
throw new Error(`Duplicate field name "${fieldName}" in collection "${collectionName}".`);
|
|
284
|
+
}
|
|
285
|
+
fieldNames.add(fieldName);
|
|
286
|
+
if (field.type !== "join") {
|
|
287
|
+
const storageName = field.type === "relationship" ? `${fieldName}Id` : fieldName;
|
|
288
|
+
if (storedNames.has(storageName)) {
|
|
289
|
+
throw new Error(`Field "${fieldName}" conflicts with another stored field in "${collectionName}".`);
|
|
290
|
+
}
|
|
291
|
+
storedNames.add(storageName);
|
|
292
|
+
}
|
|
293
|
+
if (field.type === "relationship" && !collectionNames.includes(field.relationTo) && !(config.auth?.provider === "better-auth" && field.relationTo === "better_auth_user")) {
|
|
294
|
+
throw new Error(`Relation "${collectionName}.${fieldName}" targets unknown collection "${field.relationTo}".`);
|
|
295
|
+
}
|
|
296
|
+
if (field.type === "join") {
|
|
297
|
+
const target = collections.find((candidate) => candidate.slug === field.collection);
|
|
298
|
+
if (!target) {
|
|
299
|
+
throw new Error(`Join field "${collectionName}.${fieldName}" targets unknown collection "${field.collection}".`);
|
|
300
|
+
}
|
|
301
|
+
const relationship = target.fields.find((candidate) => candidate.name === field.on);
|
|
302
|
+
if (!relationship) {
|
|
303
|
+
throw new Error(`Join field "${collectionName}.${fieldName}" references missing field "${field.collection}.${field.on}".`);
|
|
304
|
+
}
|
|
305
|
+
if (relationship.type !== "relationship") {
|
|
306
|
+
throw new Error(`Join field "${collectionName}.${fieldName}" on field "${field.collection}.${field.on}" must be a relationship.`);
|
|
307
|
+
}
|
|
308
|
+
if (relationship.relationTo !== collectionName) {
|
|
309
|
+
throw new Error(`Join field "${collectionName}.${fieldName}" on field "${field.collection}.${field.on}" must relate to "${collectionName}".`);
|
|
310
|
+
}
|
|
311
|
+
if (field.label !== undefined && !field.label.trim()) {
|
|
312
|
+
throw new Error(`Field "${collectionName}.${fieldName}" label cannot be empty.`);
|
|
313
|
+
}
|
|
314
|
+
for (const column of field.admin?.defaultColumns ?? []) {
|
|
315
|
+
const columnField = target.fields.find((candidate) => candidate.name === column);
|
|
316
|
+
if (!columnField || columnField.type === "join") {
|
|
317
|
+
throw new Error(`Join field "${collectionName}.${fieldName}" admin.defaultColumns references unknown stored field "${column}" in "${field.collection}".`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (field.admin?.allowCreate !== undefined && typeof field.admin.allowCreate !== "boolean") {
|
|
321
|
+
throw new Error(`Join field "${collectionName}.${fieldName}" admin.allowCreate must be a boolean.`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (field.type === "select") {
|
|
325
|
+
if (!Array.isArray(field.options) || field.options.length === 0) {
|
|
326
|
+
throw new Error(`Select field "${collectionName}.${fieldName}" must have at least one option.`);
|
|
327
|
+
}
|
|
328
|
+
const values = field.options.map(selectOptionValue);
|
|
329
|
+
if (values.some((value) => typeof value !== "string" || !value.trim()) || new Set(values).size !== values.length) {
|
|
330
|
+
throw new Error(`Select field "${collectionName}.${fieldName}" must have unique non-empty option values.`);
|
|
331
|
+
}
|
|
332
|
+
if (field.options.some((option) => typeof option !== "string" && (typeof option.label !== "string" || !option.label.trim()))) {
|
|
333
|
+
throw new Error(`Select field "${collectionName}.${fieldName}" must have non-empty option labels.`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (field.type !== "join") {
|
|
337
|
+
const fieldAdmin = field.admin;
|
|
338
|
+
if (fieldAdmin?.position !== undefined && fieldAdmin.position !== "main" && fieldAdmin.position !== "sidebar") {
|
|
339
|
+
throw new Error(`Field "${collectionName}.${fieldName}" admin.position must be "main" or "sidebar".`);
|
|
340
|
+
}
|
|
341
|
+
if (fieldAdmin?.input !== undefined && (field.type !== "text" || fieldAdmin.input !== "textarea")) {
|
|
342
|
+
throw new Error(`Field "${collectionName}.${fieldName}" admin.input must be "textarea" on a text field.`);
|
|
343
|
+
}
|
|
344
|
+
if (fieldAdmin?.date !== undefined && (field.type !== "date" || !["dayOnly", "dayAndTime", undefined].includes(fieldAdmin.date.pickerAppearance))) {
|
|
345
|
+
throw new Error(`Field "${collectionName}.${fieldName}" admin.date must configure a date field.`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const adminOptions = definition.admin;
|
|
350
|
+
if (adminOptions?.useAsTitle && !fieldNames.has(adminOptions.useAsTitle)) {
|
|
351
|
+
throw new Error(`Collection "${collectionName}" admin.useAsTitle references unknown field "${adminOptions.useAsTitle}".`);
|
|
352
|
+
}
|
|
353
|
+
for (const fieldName of adminOptions?.defaultColumns ?? []) {
|
|
354
|
+
if (fields.find((field) => field.name === fieldName)?.type === "join") {
|
|
355
|
+
throw new Error(`Collection "${collectionName}" admin.defaultColumns cannot include virtual join field "${fieldName}".`);
|
|
356
|
+
}
|
|
357
|
+
if (!fieldNames.has(fieldName)) {
|
|
358
|
+
throw new Error(`Collection "${collectionName}" admin.defaultColumns references unknown field "${fieldName}".`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
for (const fieldName of adminOptions?.listSearchableFields ?? []) {
|
|
362
|
+
if (!fieldNames.has(fieldName)) {
|
|
363
|
+
throw new Error(`Collection "${collectionName}" admin.listSearchableFields references unknown field "${fieldName}".`);
|
|
364
|
+
}
|
|
365
|
+
if (fields.find((field) => field.name === fieldName)?.type !== "text") {
|
|
366
|
+
throw new Error(`Collection "${collectionName}" admin.listSearchableFields field "${fieldName}" must be text.`);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function humanize(value) {
|
|
372
|
+
return value
|
|
373
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
374
|
+
.replace(/[_-]+/g, " ")
|
|
375
|
+
.replace(/\b\w/g, (character) => character.toUpperCase());
|
|
376
|
+
}
|
|
377
|
+
function singularize(value) {
|
|
378
|
+
if (/\b(news|series|species)$/i.test(value))
|
|
379
|
+
return value;
|
|
380
|
+
if (/(ches|shes|sses|xes|zes)$/i.test(value))
|
|
381
|
+
return value.slice(0, -2);
|
|
382
|
+
if (/ies$/i.test(value))
|
|
383
|
+
return `${value.slice(0, -3)}y`;
|
|
384
|
+
if (/s$/i.test(value) && !/(ss|us|is)$/i.test(value))
|
|
385
|
+
return value.slice(0, -1);
|
|
386
|
+
return value;
|
|
387
|
+
}
|
|
388
|
+
//# sourceMappingURL=compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAI9C,SAAS,SAAS,CAAC,KAAiD;IAClE,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,UAAmB,CAAC;IAC9D,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,SAAkB,CAAC;IACzD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,SAAkB,CAAC;IACxE,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAiD;IAC1E,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAmB;IACjD,cAAc,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;YACjD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;YAC7B,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,KAAK,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC3F,MAAM,aAAa,G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AE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bebopdev/core",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Payload-style collection configuration and Jazz schema compilation for Bebop.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/reezerdev/bebop.git",
|
|
9
|
+
"directory": "packages/bebop"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/reezerdev/bebop#readme",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"jazz-tools": "2.0.0-alpha.57"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"jazz-tools": "2.0.0-alpha.57",
|
|
33
|
+
"tsx": "^4.23.15",
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
|
+
"test": "tsx --test test/*.test.ts"
|
|
39
|
+
}
|
|
40
|
+
}
|