@arcote.tech/arc 0.1.8 → 0.1.10

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.
Files changed (55) hide show
  1. package/dist/context/context.d.ts +1 -0
  2. package/dist/context/element.d.ts +21 -1
  3. package/dist/context/event.d.ts +2 -1
  4. package/dist/context/query-builders.d.ts +1 -0
  5. package/dist/data-storage/data-storage-master.d.ts +2 -0
  6. package/dist/database/database-mappers.d.ts +39 -0
  7. package/dist/database/database-store.d.ts +58 -0
  8. package/dist/database/index.d.ts +3 -0
  9. package/dist/database/schema-extraction.d.ts +12 -0
  10. package/dist/db/index.d.ts +1 -0
  11. package/dist/db/interface.d.ts +1 -0
  12. package/dist/db/postgresAdapter.d.ts +90 -0
  13. package/dist/db/sqliteAdapter.d.ts +47 -3
  14. package/dist/elements/abstract.d.ts +28 -0
  15. package/dist/elements/any.d.ts +2 -0
  16. package/dist/elements/array.d.ts +3 -0
  17. package/dist/elements/blob.d.ts +2 -0
  18. package/dist/elements/boolean.d.ts +3 -0
  19. package/dist/elements/branded.d.ts +2 -0
  20. package/dist/elements/date.d.ts +3 -0
  21. package/dist/elements/default.d.ts +2 -0
  22. package/dist/elements/file.d.ts +2 -0
  23. package/dist/elements/number.d.ts +3 -0
  24. package/dist/elements/object.d.ts +5 -0
  25. package/dist/elements/optional.d.ts +2 -0
  26. package/dist/elements/or.d.ts +2 -0
  27. package/dist/elements/record.d.ts +2 -0
  28. package/dist/elements/string-enum.d.ts +2 -0
  29. package/dist/elements/string.d.ts +3 -0
  30. package/dist/index.d.ts +0 -1
  31. package/dist/index.js +1574 -658
  32. package/dist/telemetry/context.d.ts +65 -0
  33. package/dist/telemetry/index.d.ts +47 -0
  34. package/dist/telemetry/interfaces.d.ts +84 -0
  35. package/dist/telemetry/logger.d.ts +67 -0
  36. package/dist/telemetry/no-op.d.ts +54 -0
  37. package/dist/telemetry/tracer.d.ts +85 -0
  38. package/dist/utils.d.ts +0 -19
  39. package/dist/view/view.d.ts +5 -3
  40. package/package.json +1 -1
  41. package/dist/collection/collection.d.ts +0 -81
  42. package/dist/collection/index.d.ts +0 -4
  43. package/dist/collection/queries/abstract-collection-query.d.ts +0 -14
  44. package/dist/collection/queries/find.d.ts +0 -29
  45. package/dist/collection/queries/one-item.d.ts +0 -2
  46. package/dist/collection/queries/util.d.ts +0 -3
  47. package/dist/collection/query-builders/find-by-id.d.ts +0 -2
  48. package/dist/collection/query-builders/find-one.d.ts +0 -2
  49. package/dist/collection/query-builders/find.d.ts +0 -13
  50. package/dist/context/simple-query.d.ts +0 -33
  51. package/dist/data-storage/data-storage-builder.d.ts +0 -16
  52. package/dist/data-storage/query-processor.d.ts +0 -22
  53. package/dist/data-storage/store-state-authorized.d.ts +0 -26
  54. package/dist/utils/arcObjectToStoreSchema.d.ts +0 -4
  55. package/dist/utils/index.d.ts +0 -2
@@ -23,6 +23,7 @@ export type RemoveFalseAndResolvedPromiseFromArray<T extends any[]> = T extends
23
23
  }> ? RemoveFalseAndResolvedPromiseFromArray<[Inner, ...Rest]> : [First, ...RemoveFalseAndResolvedPromiseFromArray<Rest>] : [];
24
24
  export declare class ArcContext<const E extends ArcContextElementAny[]> {
25
25
  readonly elements: E;
26
+ private elementsSet;
26
27
  constructor(elements: E);
27
28
  get<Element extends E[number]>(name: Element["name"]): Element;
28
29
  getSyncListeners(eventType: string, authContext: AuthContext): EventListener<any>[];
@@ -21,6 +21,7 @@ export type EventAuthorizationRestrictions = {
21
21
  read?: boolean | WhereCondition;
22
22
  write?: boolean | WhereCondition;
23
23
  };
24
+ import type { ArcObject } from "../elements/object";
24
25
  export type StoreColumn = {
25
26
  name: string;
26
27
  type: string;
@@ -45,6 +46,25 @@ export type StoreSchema = {
45
46
  tables: StoreTable[];
46
47
  relations?: StoreRelation[];
47
48
  };
49
+ /**
50
+ * New database-agnostic schema definition
51
+ */
52
+ export type DatabaseStoreTable = {
53
+ name: string;
54
+ schema: ArcObject<any>;
55
+ version?: number;
56
+ options?: {
57
+ /** Include soft delete columns */
58
+ softDelete?: boolean;
59
+ /** Include per-table version tracking for data syncing */
60
+ versioning?: boolean;
61
+ };
62
+ };
63
+ export type DatabaseStoreSchema = {
64
+ tables: DatabaseStoreTable[];
65
+ relations?: StoreRelation[];
66
+ reinitTable?: (tableName: string, dataStorage: DataStorage) => Promise<void>;
67
+ };
48
68
  export declare abstract class ArcContextElement<const Event, const Name extends string | undefined = undefined> {
49
69
  readonly $event: Event;
50
70
  readonly name?: Name;
@@ -54,7 +74,7 @@ export declare abstract class ArcContextElement<const Event, const Name extends
54
74
  observer?: (authContext: AuthContext) => Record<string, ListenerConfig>;
55
75
  }
56
76
  export declare abstract class ArcContextElementWithStore<const Event, const Name extends string | undefined = undefined> extends ArcContextElement<Event, Name> {
57
- abstract storeSchema(): StoreSchema;
77
+ abstract databaseStoreSchema(): DatabaseStoreSchema;
58
78
  }
59
79
  export type ArcContextElementAny = ArcContextElement<any, any>;
60
80
  //# sourceMappingURL=element.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { DataStorage } from "../data-storage";
2
2
  import { ArcObject, type ArcObjectAny, type ArcRawShape } from "../elements/object";
3
3
  import type { $type } from "../utils";
4
- import { ArcContextElementWithStore, type AuthContext, type AuthorizationRestrictions, type EventAuthorizationRestrictions, type StoreSchema } from "./element";
4
+ import { ArcContextElementWithStore, type AuthContext, type AuthorizationRestrictions, type EventAuthorizationRestrictions, type StoreSchema, type DatabaseStoreSchema } from "./element";
5
5
  export type EventMetadata = {
6
6
  createdAt: Date;
7
7
  };
@@ -10,6 +10,7 @@ export declare class ArcEvent<const Name extends string, const PayloadShape exte
10
10
  readonly payload: PayloadShape;
11
11
  private _restrictions?;
12
12
  storeSchema: () => StoreSchema;
13
+ databaseStoreSchema: () => DatabaseStoreSchema;
13
14
  constructor(name: Name, payload: PayloadShape);
14
15
  /**
15
16
  * Default restrictions for events - deny all operations except for system users
@@ -13,4 +13,5 @@ export declare abstract class ArcQueryBuilder implements IArcQueryBuilder {
13
13
  }
14
14
  export type UnaryFunction<T, R> = (input: T) => R;
15
15
  export type QueryFactoryFunction<C extends ArcContextAny> = UnaryFunction<ReturnType<C["queryBuilder"]>, IArcQueryBuilder>;
16
+ export type QueryBuilderFunctionResult<QueryBuilderFn extends QueryFactoryFunction<any>> = QueryBuilderFn extends QueryFactoryFunction<infer C> ? Promise<ReturnType<ReturnType<QueryBuilderFn>["toQuery"]>["lastResult"]> : never;
16
17
  //# sourceMappingURL=query-builders.d.ts.map
@@ -9,7 +9,9 @@ export declare class MasterDataStorage extends DataStorage {
9
9
  private arcContext;
10
10
  private stores;
11
11
  private rtcAdapter;
12
+ private reinitTablesExecuted;
12
13
  constructor(dbAdapter: Promise<DatabaseAdapter> | DatabaseAdapter, rtcAdapterFactory: RealTimeCommunicationAdapterFactory, arcContext: ArcContextAny);
14
+ private executeReinitTablesOnReady;
13
15
  getReadTransaction(): Promise<ReadTransaction>;
14
16
  getReadWriteTransaction(): Promise<ReadWriteTransaction>;
15
17
  getStore<Item extends {
@@ -0,0 +1,39 @@
1
+ import type { DatabaseType, DatabaseTypeMapper, DatabaseFeatures, DatabaseStoreData, DatabaseColumnDefinition } from "./database-store";
2
+ /**
3
+ * SQLite Type Mapper
4
+ */
5
+ export declare class SQLiteTypeMapper implements DatabaseTypeMapper {
6
+ databaseType: DatabaseType;
7
+ features: DatabaseFeatures;
8
+ mapType(arcTypeName: string, storeData?: DatabaseStoreData): string;
9
+ mapConstraints(storeData: DatabaseStoreData): string[];
10
+ generateColumnDefinition(column: DatabaseColumnDefinition): string;
11
+ generateCreateTableSQL(tableName: string, columns: DatabaseColumnDefinition[]): string;
12
+ }
13
+ /**
14
+ * PostgreSQL Type Mapper
15
+ */
16
+ export declare class PostgreSQLTypeMapper implements DatabaseTypeMapper {
17
+ databaseType: DatabaseType;
18
+ features: DatabaseFeatures;
19
+ mapType(arcTypeName: string, storeData?: DatabaseStoreData): string;
20
+ mapConstraints(storeData: DatabaseStoreData): string[];
21
+ generateColumnDefinition(column: DatabaseColumnDefinition): string;
22
+ generateCreateTableSQL(tableName: string, columns: DatabaseColumnDefinition[]): string;
23
+ }
24
+ /**
25
+ * MySQL Type Mapper
26
+ */
27
+ export declare class MySQLTypeMapper implements DatabaseTypeMapper {
28
+ databaseType: DatabaseType;
29
+ features: DatabaseFeatures;
30
+ mapType(arcTypeName: string, storeData?: DatabaseStoreData): string;
31
+ mapConstraints(storeData: DatabaseStoreData): string[];
32
+ generateColumnDefinition(column: DatabaseColumnDefinition): string;
33
+ generateCreateTableSQL(tableName: string, columns: DatabaseColumnDefinition[]): string;
34
+ }
35
+ /**
36
+ * Database Type Mapper Factory
37
+ */
38
+ export declare function createDatabaseTypeMapper(databaseType: DatabaseType): DatabaseTypeMapper;
39
+ //# sourceMappingURL=database-mappers.d.ts.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Database-agnostic store data types and interfaces
3
+ */
4
+ export type DatabaseType = "sqlite" | "postgresql" | "mysql";
5
+ export interface DatabaseStoreData {
6
+ /** Mark this field as primary key */
7
+ isPrimaryKey?: boolean;
8
+ /** Mark this field as auto-increment */
9
+ isAutoIncrement?: boolean;
10
+ /** Mark this field as unique */
11
+ isUnique?: boolean;
12
+ /** Add index to this field */
13
+ hasIndex?: boolean;
14
+ /** Foreign key relationship */
15
+ foreignKey?: {
16
+ table: string;
17
+ column: string;
18
+ onDelete?: "CASCADE" | "SET NULL" | "RESTRICT";
19
+ onUpdate?: "CASCADE" | "SET NULL" | "RESTRICT";
20
+ };
21
+ /** Database-specific type overrides */
22
+ databaseType?: {
23
+ sqlite?: string;
24
+ postgresql?: string;
25
+ mysql?: string;
26
+ };
27
+ /** Database-specific column options */
28
+ columnOptions?: {
29
+ sqlite?: string[];
30
+ postgresql?: string[];
31
+ mysql?: string[];
32
+ };
33
+ }
34
+ /**
35
+ * Database-agnostic column information returned by ArcObject elements
36
+ */
37
+ export interface DatabaseAgnosticColumnInfo {
38
+ /** ArcObject type name (string, number, boolean, etc.) */
39
+ type: string;
40
+ /** Database store configuration (primary key, unique, etc.) */
41
+ storeData?: DatabaseStoreData & {
42
+ /** Whether the field is nullable */
43
+ isNullable?: boolean;
44
+ };
45
+ /** Default value for the field */
46
+ defaultValue?: any;
47
+ /** Validation information that might affect database constraints */
48
+ validationInfo?: {
49
+ minLength?: number;
50
+ maxLength?: number;
51
+ min?: number;
52
+ max?: number;
53
+ enumValues?: string[];
54
+ pattern?: string;
55
+ [key: string]: any;
56
+ };
57
+ }
58
+ //# sourceMappingURL=database-store.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from "./database-store";
2
+ export * from "./schema-extraction";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { ArcObject } from "../elements/object";
2
+ import type { DatabaseAgnosticColumnInfo } from "./database-store";
3
+ /**
4
+ * Extract database-agnostic schema information from ArcObject
5
+ */
6
+ export declare function extractDatabaseAgnosticSchema(arcObject: ArcObject<any>, tableName: string): {
7
+ tableName: string;
8
+ columns: (DatabaseAgnosticColumnInfo & {
9
+ name: string;
10
+ })[];
11
+ };
12
+ //# sourceMappingURL=schema-extraction.d.ts.map
@@ -1,3 +1,4 @@
1
1
  export * from "./interface";
2
+ export * from "./postgresAdapter";
2
3
  export * from "./sqliteAdapter";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -11,6 +11,7 @@ export interface ReadWriteTransaction extends ReadTransaction {
11
11
  export interface DatabaseAdapter {
12
12
  readWriteTransaction(stores?: string[]): ReadWriteTransaction;
13
13
  readTransaction(stores?: string[]): ReadTransaction;
14
+ executeReinitTables(dataStorage: any): Promise<void>;
14
15
  }
15
16
  export type DBAdapterFactory = (context: ArcContextAny) => Promise<DatabaseAdapter>;
16
17
  //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1,90 @@
1
+ import { type ArcContextAny } from "../context";
2
+ import type { StoreColumn, StoreTable } from "../context/element";
3
+ import type { FindOptions, WhereCondition } from "../data-storage/types";
4
+ import type { DatabaseAdapter, DBAdapterFactory, ReadTransaction, ReadWriteTransaction } from "./interface";
5
+ export interface PostgreSQLDatabase {
6
+ exec(sql: string, params?: any[]): Promise<any>;
7
+ execBatch(queries: Array<{
8
+ sql: string;
9
+ params?: any[];
10
+ }>): Promise<any>;
11
+ }
12
+ declare class PostgreSQLReadTransaction implements ReadTransaction {
13
+ protected db: PostgreSQLDatabase;
14
+ protected tables: Map<string, StoreTable>;
15
+ protected adapter?: PostgreSQLAdapter | undefined;
16
+ constructor(db: PostgreSQLDatabase, tables: Map<string, StoreTable>, adapter?: PostgreSQLAdapter | undefined);
17
+ protected hasSoftDelete(tableName: string): boolean;
18
+ protected deserializeValue(value: any, column: StoreColumn): any;
19
+ protected deserializeRow(row: any, table: StoreTable): any;
20
+ protected getId(store: string, id: any): any;
21
+ protected buildWhereClause(where?: WhereCondition, tableName?: string): {
22
+ sql: string;
23
+ params: any[];
24
+ };
25
+ protected getOperatorSymbol(operator: string): string;
26
+ protected buildOrderByClause(orderBy?: Record<string, "asc" | "desc">): string;
27
+ find<T>(store: string, options: FindOptions<T>): Promise<T[]>;
28
+ }
29
+ declare class PostgreSQLReadWriteTransaction extends PostgreSQLReadTransaction implements ReadWriteTransaction {
30
+ protected adapter: PostgreSQLAdapter;
31
+ private queries;
32
+ constructor(db: PostgreSQLDatabase, tables: Map<string, StoreTable>, adapter: PostgreSQLAdapter);
33
+ remove(store: string, id: any): Promise<void>;
34
+ set(store: string, item: any): Promise<void>;
35
+ private setWithoutVersioning;
36
+ private setWithVersioning;
37
+ commit(): Promise<void>;
38
+ private serializeValue;
39
+ }
40
+ export declare class PostgreSQLAdapter implements DatabaseAdapter {
41
+ private db;
42
+ private context;
43
+ private tables;
44
+ private tableSchemas;
45
+ private pendingReinitTables;
46
+ private mapType;
47
+ private buildConstraints;
48
+ private generateColumnSQL;
49
+ private generateCreateTableSQL;
50
+ constructor(db: PostgreSQLDatabase, context: ArcContextAny);
51
+ initialize(): Promise<void>;
52
+ private createTableIfNotExistsNew;
53
+ /**
54
+ * Create the version counter table for tracking per-table version sequences
55
+ */
56
+ private createVersionCounterTable;
57
+ /**
58
+ * Create the table versions tracking table for schema versioning
59
+ */
60
+ private createTableVersionsTable;
61
+ /**
62
+ * Generate physical table name with version suffix
63
+ */
64
+ private getPhysicalTableName;
65
+ /**
66
+ * Check if a versioned table exists
67
+ */
68
+ private checkVersionedTableExists;
69
+ /**
70
+ * Register a new table version
71
+ */
72
+ private registerTableVersion;
73
+ /**
74
+ * Check if a table has versioning enabled
75
+ */
76
+ hasVersioning(tableName: string): boolean;
77
+ /**
78
+ * Check if a table has soft delete enabled
79
+ */
80
+ hasSoftDelete(tableName: string): boolean;
81
+ /**
82
+ * Execute all pending reinitTable functions
83
+ */
84
+ executeReinitTables(dataStorage: any): Promise<void>;
85
+ readWriteTransaction(stores?: string[]): PostgreSQLReadWriteTransaction;
86
+ readTransaction(stores?: string[]): PostgreSQLReadTransaction;
87
+ }
88
+ export declare const createPostgreSQLAdapterFactory: (db: PostgreSQLDatabase) => DBAdapterFactory;
89
+ export {};
90
+ //# sourceMappingURL=postgresAdapter.d.ts.map
@@ -8,11 +8,13 @@ export interface SQLiteDatabase {
8
8
  declare class SQLiteReadTransaction implements ReadTransaction {
9
9
  protected db: SQLiteDatabase;
10
10
  protected tables: Map<string, StoreTable>;
11
- constructor(db: SQLiteDatabase, tables: Map<string, StoreTable>);
11
+ protected adapter?: SQLiteAdapter | undefined;
12
+ constructor(db: SQLiteDatabase, tables: Map<string, StoreTable>, adapter?: SQLiteAdapter | undefined);
13
+ protected hasSoftDelete(tableName: string): boolean;
12
14
  protected deserializeValue(value: any, column: StoreColumn): any;
13
15
  protected deserializeRow(row: any, table: StoreTable): any;
14
16
  protected getId(store: string, id: any): any;
15
- protected buildWhereClause(where?: WhereCondition): {
17
+ protected buildWhereClause(where?: WhereCondition, tableName?: string): {
16
18
  sql: string;
17
19
  params: any[];
18
20
  };
@@ -21,8 +23,12 @@ declare class SQLiteReadTransaction implements ReadTransaction {
21
23
  find<T>(store: string, options: FindOptions<T>): Promise<T[]>;
22
24
  }
23
25
  declare class SQLiteReadWriteTransaction extends SQLiteReadTransaction implements ReadWriteTransaction {
26
+ protected adapter: SQLiteAdapter;
27
+ constructor(db: SQLiteDatabase, tables: Map<string, StoreTable>, adapter: SQLiteAdapter);
24
28
  remove(store: string, id: any): Promise<void>;
25
29
  set(store: string, item: any): Promise<void>;
30
+ private setWithoutVersioning;
31
+ private setWithVersioning;
26
32
  commit(): Promise<void>;
27
33
  private serializeValue;
28
34
  }
@@ -30,9 +36,47 @@ export declare class SQLiteAdapter implements DatabaseAdapter {
30
36
  private db;
31
37
  private context;
32
38
  private tables;
39
+ private tableSchemas;
40
+ private pendingReinitTables;
41
+ private mapType;
42
+ private buildConstraints;
43
+ private generateColumnSQL;
44
+ private generateCreateTableSQL;
33
45
  constructor(db: SQLiteDatabase, context: ArcContextAny);
34
46
  initialize(): Promise<void>;
35
- private createTableIfNotExists;
47
+ private createTableIfNotExistsNew;
48
+ /**
49
+ * Create the version counter table for tracking per-table version sequences
50
+ */
51
+ private createVersionCounterTable;
52
+ /**
53
+ * Create the table versions tracking table for schema versioning
54
+ */
55
+ private createTableVersionsTable;
56
+ /**
57
+ * Generate physical table name with version suffix
58
+ */
59
+ private getPhysicalTableName;
60
+ /**
61
+ * Check if a versioned table exists
62
+ */
63
+ private checkVersionedTableExists;
64
+ /**
65
+ * Register a new table version
66
+ */
67
+ private registerTableVersion;
68
+ /**
69
+ * Check if a table has versioning enabled
70
+ */
71
+ hasVersioning(tableName: string): boolean;
72
+ /**
73
+ * Check if a table has soft delete enabled
74
+ */
75
+ hasSoftDelete(tableName: string): boolean;
76
+ /**
77
+ * Execute all pending reinitTable functions
78
+ */
79
+ executeReinitTables(dataStorage: any): Promise<void>;
36
80
  readWriteTransaction(stores?: string[]): SQLiteReadWriteTransaction;
37
81
  readTransaction(stores?: string[]): SQLiteReadTransaction;
38
82
  }
@@ -1,3 +1,4 @@
1
+ import type { DatabaseAgnosticColumnInfo, DatabaseStoreData } from "../database/database-store";
1
2
  import { ArcBranded } from "./branded";
2
3
  import { ArcDefault } from "./default";
3
4
  import type { ArcElement } from "./element";
@@ -12,6 +13,7 @@ export type GetValidator<A extends ArcAbstract<any>> = A extends ArcAbstract<inf
12
13
  export declare abstract class ArcAbstract<V extends Validators> implements ArcElement {
13
14
  protected validations: V;
14
15
  protected _description?: string;
16
+ protected _storeData?: DatabaseStoreData;
15
17
  constructor(validations?: V);
16
18
  abstract serialize(value: any): any;
17
19
  abstract deserialize(value: any): any;
@@ -31,6 +33,32 @@ export declare abstract class ArcAbstract<V extends Validators> implements ArcEl
31
33
  */
32
34
  toJsonSchema(): any;
33
35
  getValidations(): V;
36
+ /**
37
+ * Database store configuration methods
38
+ */
39
+ /** Mark this field as primary key */
40
+ primaryKey(): this;
41
+ /** Mark this field as auto-increment */
42
+ autoIncrement(): this;
43
+ /** Mark this field as unique */
44
+ unique(): this;
45
+ /** Add index to this field */
46
+ index(): this;
47
+ /** Add foreign key relationship */
48
+ foreignKey(table: string, column: string, options?: {
49
+ onDelete?: "CASCADE" | "SET NULL" | "RESTRICT";
50
+ onUpdate?: "CASCADE" | "SET NULL" | "RESTRICT";
51
+ }): this;
52
+ /** Override database type for specific database */
53
+ databaseType(overrides: DatabaseStoreData["databaseType"]): this;
54
+ /** Add database-specific column options */
55
+ columnOptions(options: DatabaseStoreData["columnOptions"]): this;
56
+ /** Get store data for database schema generation */
57
+ getStoreData(): DatabaseStoreData | undefined;
58
+ /**
59
+ * Generate database-agnostic column information from this ArcObject
60
+ */
61
+ abstract getColumnData(): DatabaseAgnosticColumnInfo;
34
62
  }
35
63
  export type ArcAbstractAny = ArcAbstract<any>;
36
64
  //# sourceMappingURL=abstract.d.ts.map
@@ -1,10 +1,12 @@
1
1
  import { ArcAbstract, type Validators } from "./abstract";
2
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
2
3
  export declare class ArcAny<T, V extends Validators = []> extends ArcAbstract<V> {
3
4
  constructor();
4
5
  parse(value: T): any;
5
6
  serialize(value: T): any;
6
7
  deserialize(value: any): T;
7
8
  toJsonSchema(): any;
9
+ getColumnData(): DatabaseAgnosticColumnInfo;
8
10
  }
9
11
  export declare function any<T extends any>(): ArcAny<T, any>;
10
12
  //# sourceMappingURL=any.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { type util } from "../utils";
2
2
  import { ArcAbstract, type CheckFn, type GetValidator, type Validators } from "./abstract";
3
3
  import type { ArcElement } from "./element";
4
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
4
5
  declare const arrayValidator: {
5
6
  name: "type";
6
7
  validator: (value: any) => false | {
@@ -55,6 +56,8 @@ export declare class ArcArray<E extends ArcElement, V extends Validators = [
55
56
  validator: Fn;
56
57
  }]>>>;
57
58
  toJsonSchema(): any;
59
+ /** Generate database-agnostic column information */
60
+ getColumnData(): DatabaseAgnosticColumnInfo;
58
61
  }
59
62
  export type ArcArrayAny = ArcArray<any>;
60
63
  export declare function array<E extends ArcElement>(element: E): ArcArray<E, [{
@@ -1,5 +1,6 @@
1
1
  import type { CheckFn, GetValidator, Validators } from "./abstract";
2
2
  import { ArcPrimitive } from "./abstract-primitive";
3
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
3
4
  declare const blobValidator: {
4
5
  readonly name: "blob";
5
6
  readonly validator: (value: any) => {
@@ -68,6 +69,7 @@ export declare class ArcBlob<V extends Validators = [typeof blobValidator]> exte
68
69
  */
69
70
  parse(value: any): Blob;
70
71
  toJsonSchema(): any;
72
+ getColumnData(): DatabaseAgnosticColumnInfo;
71
73
  }
72
74
  export declare function blob(): ArcBlob<[{
73
75
  readonly name: "blob";
@@ -1,3 +1,4 @@
1
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
1
2
  import type { CheckFn, GetValidator, Validators } from "./abstract";
2
3
  import { ArcPrimitive } from "./abstract-primitive";
3
4
  export declare class ArcBoolean<V extends Validators> extends ArcPrimitive<V, boolean> {
@@ -12,6 +13,8 @@ export declare class ArcBoolean<V extends Validators> extends ArcPrimitive<V, bo
12
13
  validator: Fn;
13
14
  }]>>>;
14
15
  toJsonSchema(): any;
16
+ /** Generate database-agnostic column information */
17
+ getColumnData(): DatabaseAgnosticColumnInfo;
15
18
  }
16
19
  export declare function boolean(): ArcBoolean<Validators>;
17
20
  //# sourceMappingURL=boolean.d.ts.map
@@ -2,6 +2,7 @@ import { type util } from "../utils";
2
2
  import { type ArcAbstractAny } from "./abstract";
3
3
  import type { ArcElement } from "./element";
4
4
  import { ArcOptional } from "./optional";
5
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
5
6
  export declare class ArcBranded<E extends ArcAbstractAny, Brand extends string | symbol> implements ArcElement {
6
7
  private parent;
7
8
  private brand;
@@ -18,6 +19,7 @@ export declare class ArcBranded<E extends ArcAbstractAny, Brand extends string |
18
19
  optional(): ArcOptional<this>;
19
20
  validate(value: unknown): unknown;
20
21
  toJsonSchema(): any;
22
+ getColumnData(): DatabaseAgnosticColumnInfo;
21
23
  }
22
24
  export type ArcBrandedAny = ArcBranded<ArcAbstractAny, any>;
23
25
  //# sourceMappingURL=branded.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import type { CheckFn, GetValidator, Validators } from "./abstract";
2
2
  import { ArcAbstract } from "./abstract";
3
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
3
4
  declare const dateValidator: {
4
5
  name: "type";
5
6
  validator: (value: any) => false | {
@@ -31,6 +32,8 @@ export declare class ArcDate<V extends Validators = [typeof dateValidator]> exte
31
32
  validator: Fn;
32
33
  }]>>>;
33
34
  toJsonSchema(): any;
35
+ /** Generate database-agnostic column information */
36
+ getColumnData(): DatabaseAgnosticColumnInfo;
34
37
  }
35
38
  export declare function date(): ArcDate<[{
36
39
  name: "type";
@@ -1,5 +1,6 @@
1
1
  import { type util } from "../utils";
2
2
  import type { ArcElement } from "./element";
3
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
3
4
  export declare class ArcDefault<E extends ArcElement> implements ArcElement {
4
5
  private parent;
5
6
  private defaultValueOrCallback;
@@ -9,5 +10,6 @@ export declare class ArcDefault<E extends ArcElement> implements ArcElement {
9
10
  serialize(value: util.FirstArgument<E["serialize"]> | undefined): ReturnType<E["serialize"]>;
10
11
  deserialize(value: util.FirstArgument<E["deserialize"]> | undefined): ReturnType<E["deserialize"]>;
11
12
  toJsonSchema(): any;
13
+ getColumnData(): DatabaseAgnosticColumnInfo;
12
14
  }
13
15
  //# sourceMappingURL=default.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import type { CheckFn, GetValidator, Validators } from "./abstract";
2
2
  import { ArcPrimitive } from "./abstract-primitive";
3
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
3
4
  declare const fileValidator: {
4
5
  readonly name: "file";
5
6
  readonly validator: (value: any) => {
@@ -128,6 +129,7 @@ export declare class ArcFile<V extends Validators = [typeof fileValidator]> exte
128
129
  */
129
130
  parse(value: any): File;
130
131
  toJsonSchema(): any;
132
+ getColumnData(): DatabaseAgnosticColumnInfo;
131
133
  }
132
134
  export declare function file(): ArcFile<[{
133
135
  readonly name: "file";
@@ -1,5 +1,6 @@
1
1
  import type { CheckFn, GetValidator, Validators } from "./abstract";
2
2
  import { ArcPrimitive } from "./abstract-primitive";
3
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
3
4
  declare const numberValidator: {
4
5
  name: "type";
5
6
  validator: (value: any) => false | {
@@ -28,6 +29,8 @@ export declare class ArcNumber<V extends Validators = [typeof numberValidator]>
28
29
  validator: Fn;
29
30
  }]>>>;
30
31
  toJsonSchema(): any;
32
+ /** Generate database-agnostic column information */
33
+ getColumnData(): DatabaseAgnosticColumnInfo;
31
34
  }
32
35
  export declare function number(): ArcNumber<[{
33
36
  name: "type";
@@ -1,3 +1,4 @@
1
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
1
2
  import { type objectUtil, type util } from "../utils";
2
3
  import { ArcAbstract, type Validators } from "./abstract";
3
4
  import type { ArcElement } from "./element";
@@ -64,6 +65,10 @@ export declare class ArcObject<E extends ArcRawShape, V extends Validators = [
64
65
  omit<Keys extends keyof E>(...keys: Keys[]): ArcObject<Omit<E, Keys>, V>;
65
66
  entries(): [string, ArcElement][];
66
67
  toJsonSchema(): any;
68
+ /** Generate database-agnostic column information */
69
+ getColumnData(): DatabaseAgnosticColumnInfo;
70
+ /** Merge this ArcObject with another shape */
71
+ merge<OtherShape extends ArcRawShape>(otherShape: OtherShape): ArcObject<E & OtherShape, V>;
67
72
  }
68
73
  export type ArcObjectAny = ArcObject<any, any>;
69
74
  export type ArcObjectKeys<T extends ArcObjectAny> = T extends ArcObject<infer E, any> ? Exclude<keyof E, symbol> : never;
@@ -1,6 +1,7 @@
1
1
  import { type util } from "../utils";
2
2
  import { type ArcAbstractAny } from "./abstract";
3
3
  import type { ArcElement } from "./element";
4
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
4
5
  export declare class ArcOptional<E extends ArcElement> implements ArcElement {
5
6
  private parent;
6
7
  constructor(parent: E);
@@ -11,6 +12,7 @@ export declare class ArcOptional<E extends ArcElement> implements ArcElement {
11
12
  toJsonSchema(): {
12
13
  anyOf: any[];
13
14
  };
15
+ getColumnData(): DatabaseAgnosticColumnInfo;
14
16
  }
15
17
  export type ArcOptionalAny = ArcOptional<ArcAbstractAny>;
16
18
  //# sourceMappingURL=optional.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { type util } from "../utils";
2
2
  import type { ArcElement } from "./element";
3
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
3
4
  /**
4
5
  * ArcOr allows you to create a union schema from existing Arc elements.
5
6
  * The generic parameter keeps the type-information of every provided
@@ -30,6 +31,7 @@ export declare class ArcOr<T extends ArcElement[]> implements ArcElement {
30
31
  toJsonSchema(): {
31
32
  anyOf: any[];
32
33
  };
34
+ getColumnData(): DatabaseAgnosticColumnInfo;
33
35
  private pickElement;
34
36
  private isTypeOf;
35
37
  }
@@ -4,6 +4,7 @@ import type { ArcElement } from "./element";
4
4
  import type { ArcId } from "./id";
5
5
  import type { ArcNumber } from "./number";
6
6
  import type { ArcString } from "./string";
7
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
7
8
  type ArcKey = ArcString<any> | ArcNumber | ArcId<any>;
8
9
  export declare class ArcRecord<Key extends ArcKey, E extends ArcElement, V extends Validators = [
9
10
  {
@@ -20,6 +21,7 @@ export declare class ArcRecord<Key extends ArcKey, E extends ArcElement, V exten
20
21
  serialize(value: Record<ReturnType<Key["serialize"]>, ReturnType<E["serialize"]>>): Record<ReturnType<Key["serialize"]>, ReturnType<E["serialize"]>>;
21
22
  deserialize(value: Record<ReturnType<Key["deserialize"]>, ReturnType<E["deserialize"]>>): Record<ReturnType<Key["deserialize"]>, ReturnType<E["deserialize"]>>;
22
23
  toJsonSchema(): any;
24
+ getColumnData(): DatabaseAgnosticColumnInfo;
23
25
  }
24
26
  export type ArcRecordAny = ArcRecord<any, any>;
25
27
  export declare function record<Key extends ArcKey, E extends ArcElement>(key: Key, element: E): ArcRecord<Key, E, [{
@@ -1,4 +1,5 @@
1
1
  import { ArcAbstract, type Validators } from "./abstract";
2
+ import type { DatabaseAgnosticColumnInfo } from "../database/database-store";
2
3
  export declare class ArcStringEnum<const T extends string[], V extends Validators = [
3
4
  {
4
5
  name: "schema";
@@ -15,6 +16,7 @@ export declare class ArcStringEnum<const T extends string[], V extends Validator
15
16
  deserialize<Value extends T[number]>(value: Value): Value;
16
17
  toJsonSchema(): any;
17
18
  getEnumerators(): T;
19
+ getColumnData(): DatabaseAgnosticColumnInfo;
18
20
  }
19
21
  export type ArcStringEnumAny = ArcStringEnum<any>;
20
22
  export declare function stringEnum<const T extends string[]>(...values: T): ArcStringEnum<T, [{