opacacms 0.1.4 → 0.1.5

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.
@@ -93,17 +93,7 @@ export declare class BlockBuilder<TSlug extends string, TNames extends string =
93
93
  fields<NewSub extends readonly FieldBuilder<any, any, any, any>[]>(...fields: NewSub): BlockBuilder<TSlug, ExtractNames<NewSub>, NewSub>;
94
94
  build(): Record<string, any>;
95
95
  }
96
- export declare class VirtualFieldBuilder<TName extends string, TData = any> extends FieldBuilder<"virtual", TName, any> {
97
- constructor(name: TName);
98
- resolve(fn: (args: {
99
- data: TData;
100
- req: any;
101
- user: any;
102
- session: any;
103
- apiKey?: any;
104
- }) => any | Promise<any>): this;
105
- returnType(type: "string" | "number" | "boolean" | "json"): this;
106
- }
96
+ export { VirtualFieldBuilder } from "./virtual";
107
97
  export declare class BlocksFieldBuilder<TName extends string, TBlocks extends readonly any[] = any[]> extends FieldBuilder<"blocks", TName, any[], TBlocks> {
108
98
  constructor(name: TName);
109
99
  blocks<NewBlocks extends readonly BlockBuilder<any, any, any>[]>(...blocks: NewBlocks): BlocksFieldBuilder<TName, NewBlocks>;
@@ -0,0 +1,22 @@
1
+ import { FieldBuilder } from "./base";
2
+ /**
3
+ * A builder for virtual/computed fields.
4
+ * These fields are not stored in the database but are resolved at runtime.
5
+ */
6
+ export declare class VirtualFieldBuilder<TName extends string, TData = any> extends FieldBuilder<"virtual", TName, any> {
7
+ constructor(name: TName);
8
+ /**
9
+ * Defines the resolver function for this virtual field.
10
+ */
11
+ resolve(fn: (args: {
12
+ data: TData;
13
+ req: any;
14
+ user: any;
15
+ session: any;
16
+ apiKey?: any;
17
+ }) => any | Promise<any>): this;
18
+ /**
19
+ * Sets the return type hint for the API/Client.
20
+ */
21
+ returnType(type: "string" | "number" | "boolean" | "json"): this;
22
+ }
@@ -1,5 +1,5 @@
1
1
  import type { AccessConfig, Global as GlobalType, IconName } from "../types";
2
- import { type FieldBuilder } from "./fields";
2
+ import { type FieldBuilder } from "./fields/base";
3
3
  import type { InferFields } from "./infer";
4
4
  export type Global = GlobalType;
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opacacms",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "build": "bun run ../../scripts/build.ts && tsc --emitDeclarationOnly",