@datrix/core 0.1.0 → 0.1.1
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/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -37,7 +37,7 @@ type FallbackWhereClause = {
|
|
|
37
37
|
$not?: FallbackWhereClause;
|
|
38
38
|
};
|
|
39
39
|
type TypedWhereClause<T extends DatrixEntry> = Writable<{
|
|
40
|
-
[K in keyof T]?: T[K] extends RelationInput<infer R extends DatrixEntry> ? WhereClause<R> : T[K] extends ScalarValue ? T[K] | ComparisonOperators<T[K]> : never;
|
|
40
|
+
[K in keyof T]?: T[K] extends RelationInput<infer R extends DatrixEntry> ? WhereClause<R> : NonNullable<T[K]> extends DatrixEntry ? WhereClause<NonNullable<T[K]>> : NonNullable<T[K]> extends DatrixEntry[] ? WhereClause<NonNullable<T[K]>[number]> : T[K] extends ScalarValue ? T[K] | ComparisonOperators<T[K]> : never;
|
|
41
41
|
}> & LogicalOperators<T>;
|
|
42
42
|
type WhereClause<T extends DatrixEntry = DatrixRecord> = DatrixRecord extends T ? FallbackWhereClause : TypedWhereClause<T>;
|
|
43
43
|
type SelectClause<T extends DatrixEntry = DatrixRecord> = (DatrixRecord extends T ? readonly string[] : readonly (keyof T)[]) | "*" | (DatrixRecord extends T ? string : keyof T);
|
|
@@ -49,9 +49,11 @@ type PopulateOptions<T extends DatrixEntry> = {
|
|
|
49
49
|
readonly offset?: number | undefined;
|
|
50
50
|
readonly orderBy?: QueryOrderBy | undefined;
|
|
51
51
|
};
|
|
52
|
-
type
|
|
53
|
-
|
|
52
|
+
type TypedPopulateValue<T> = NonNullable<T> extends DatrixEntry ? PopulateOptions<NonNullable<T>> | "*" | boolean : NonNullable<T> extends DatrixEntry[] ? PopulateOptions<NonNullable<T>[number]> | "*" | boolean : PopulateOptions<DatrixRecord> | "*" | boolean;
|
|
53
|
+
type TypedPopulateClause<T extends DatrixEntry> = {
|
|
54
|
+
readonly [K in keyof T]?: TypedPopulateValue<T[K]>;
|
|
54
55
|
};
|
|
56
|
+
type PopulateClause<T extends DatrixEntry = DatrixRecord> = boolean | "*" | "true" | (DatrixRecord extends T ? readonly string[] : readonly (keyof T)[]) | (DatrixRecord extends T ? Record<string, PopulateOptions<DatrixRecord> | "*" | boolean> : TypedPopulateClause<T>);
|
|
55
57
|
type OrderDirection = "asc" | "desc";
|
|
56
58
|
type OrderByItem<T extends DatrixEntry> = {
|
|
57
59
|
readonly field: keyof T;
|
|
@@ -857,8 +859,8 @@ declare function isLogicalOperator(operator: string): operator is (typeof LOGICA
|
|
|
857
859
|
declare function requiresArrayValue(operator: string): boolean;
|
|
858
860
|
declare function requiresConditions(operator: string): boolean;
|
|
859
861
|
declare function getOperatorValueType(operator: string): OperatorValueType | undefined;
|
|
860
|
-
declare const
|
|
861
|
-
declare const
|
|
862
|
+
declare const DATRIX_META_MODEL = "_datrix";
|
|
863
|
+
declare const DATRIX_META_KEY_PREFIX = "_schema_";
|
|
862
864
|
declare const FIELD_NAME_PATTERN: RegExp;
|
|
863
865
|
declare const CONTROL_CHARS_PATTERN: RegExp;
|
|
864
866
|
declare const RESERVED_FIELD_NAMES: readonly ["__proto__", "constructor", "prototype"];
|
|
@@ -1932,4 +1934,4 @@ declare function getDatrixMetaSchema(): {
|
|
|
1932
1934
|
};
|
|
1933
1935
|
};
|
|
1934
1936
|
|
|
1935
|
-
export { ALL_WHERE_OPERATORS, ARRAY_OPERATORS, type AdapterErrorCode, type AdapterErrorContext, type AdapterName, type AdapterOperation, type AlterOperation, type AlterTableOperation, type AmbiguousAction, type AmbiguousActionType, type AmbiguousChange, type AmbiguousChangeType, type AnyRelationInput, type AnyRelationInputObject, type ArrayField, type AuthContext, type AuthErrorCode, type AuthErrorContext, type AuthStrategy, type AuthUser, type AuthenticatedUser, type BaseCommandOptions, type BaseErrorContext, type BaseMigrationOperation, BasePlugin, type BaseSchemaDiff, type BooleanField, CLIError, COMPARISON_OPERATORS, CONTROL_CHARS_PATTERN, type ComparisonOperators, type ConfigErrorCode, type ConfigErrorContext, type ConfigFactory, type ConfigFileExport, type ConnectionState, type CreateIndexOperation, type CreateTableOperation, type CrudErrorCode, type CrudErrorContext, type CrudOperation, DEFAULT_API_AUTH_CONFIG, DEFAULT_API_CONFIG, DEFAULT_DEV_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_MIGRATION_MODEL, type DataTransferOperation, type DatabaseAdapter, type DateField, Datrix, DatrixAdapterError, type DatrixAdapterErrorOptions, DatrixAuthError, type DatrixAuthErrorOptions, type DatrixConfig, DatrixConfigError, type DatrixConfigErrorOptions, DatrixConfigValidationError, DatrixCrudError, type DatrixCrudErrorOptions, type DatrixEntry, DatrixError, type DatrixErrorOptions, type DatrixInitOptions, type DatrixPlugin, DatrixQueryBuilderError, type DatrixQueryBuilderErrorOptions, type DatrixRecord, DatrixValidationError, type DatrixValidationErrorOptions, type DefaultPermission, type DevCommandOptions, type DevConfig, type DropIndexOperation, type DropTableOperation, type EnumField, type ErrorLocation, type ExportMeta, type ExportWriter, FIELD_NAME_PATTERN,
|
|
1937
|
+
export { ALL_WHERE_OPERATORS, ARRAY_OPERATORS, type AdapterErrorCode, type AdapterErrorContext, type AdapterName, type AdapterOperation, type AlterOperation, type AlterTableOperation, type AmbiguousAction, type AmbiguousActionType, type AmbiguousChange, type AmbiguousChangeType, type AnyRelationInput, type AnyRelationInputObject, type ArrayField, type AuthContext, type AuthErrorCode, type AuthErrorContext, type AuthStrategy, type AuthUser, type AuthenticatedUser, type BaseCommandOptions, type BaseErrorContext, type BaseMigrationOperation, BasePlugin, type BaseSchemaDiff, type BooleanField, CLIError, COMPARISON_OPERATORS, CONTROL_CHARS_PATTERN, type ComparisonOperators, type ConfigErrorCode, type ConfigErrorContext, type ConfigFactory, type ConfigFileExport, type ConnectionState, type CreateIndexOperation, type CreateTableOperation, type CrudErrorCode, type CrudErrorContext, type CrudOperation, DATRIX_META_KEY_PREFIX, DATRIX_META_MODEL, DEFAULT_API_AUTH_CONFIG, DEFAULT_API_CONFIG, DEFAULT_DEV_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_MIGRATION_MODEL, type DataTransferOperation, type DatabaseAdapter, type DateField, Datrix, DatrixAdapterError, type DatrixAdapterErrorOptions, DatrixAuthError, type DatrixAuthErrorOptions, type DatrixConfig, DatrixConfigError, type DatrixConfigErrorOptions, DatrixConfigValidationError, DatrixCrudError, type DatrixCrudErrorOptions, type DatrixEntry, DatrixError, type DatrixErrorOptions, type DatrixInitOptions, type DatrixPlugin, DatrixQueryBuilderError, type DatrixQueryBuilderErrorOptions, type DatrixRecord, DatrixValidationError, type DatrixValidationErrorOptions, type DefaultPermission, type DevCommandOptions, type DevConfig, type DropIndexOperation, type DropTableOperation, type EnumField, type ErrorLocation, type ExportMeta, type ExportWriter, FIELD_NAME_PATTERN, type FallbackInput, type FallbackOrderByItem, type FallbackScalar, type FallbackValue, type FallbackWhereClause, type FieldAddedDiff, type FieldDefinition, type FieldInvalidReason, type FieldMetadata, type FieldModifiedDiff, type FieldPermission, type FieldPermissionAction, type FieldPermissionCheckResult, type FieldRemovedDiff, type FieldRenamedDiff, type FieldType, type FieldValidationResult, type FieldsErrorContext, type FileField, type FileFieldOptions, type ForeignKeyReference, type GenerateCommandOptions, type IApiPlugin, type IAuthManager, type IDatrix, type IRawCrud, type ISchemaRegistry, type IUpload, type ImportReader, type IndexAddedDiff, type IndexDefinition, type IndexRemovedDiff, type JsonField, LOGICAL_OPERATORS, type LifecycleHooks, type LoadConfigOptions, type LocalProviderOptions, type LogicalOperators, type LoginResult, MAX_ARRAY_INDEX, MAX_FIELD_NAME_LENGTH, MAX_LOGICAL_NESTING_DEPTH, MAX_WHERE_VALUE_LENGTH, type MediaEntry, type MediaVariant, type MediaVariants, type MigrateCommandOptions, type Migration, type MigrationConfig, type MigrationContext, type MigrationExecutionResult, type MigrationFilePlan, type MigrationGenerator, type MigrationHistory, type MigrationHistoryRecord, type MigrationMetadata, type MigrationOperation, type MigrationOperationType, type MigrationPlan, type MigrationRunner, MigrationSession, type MigrationStatus, MigrationSystemError, NULL_OPERATORS, type NormalizedNestedData, type NormalizedRelationId, type NormalizedRelationOperations, type NormalizedRelationUpdate, type NumberField, OPERATOR_VALUE_TYPES, type OperatorValueType, type OrderByClause, type OrderByItem, type OrderDirection, type PaginationErrorContext, type PaginationParams, type ParameterStyle, type ParsedArgs, type ParsedPagination, type ParsedQuery, type ParsedSort, ParserError, type ParserErrorCode, type ParserErrorContext, type ParserErrorOptions, type ParserOptions, type ParserType, type PermissionAction, type PermissionCheckResult, type PermissionContext, type PermissionFn, type PermissionValue, type PluginContext, PluginError, type PluginFactory, PluginRegistry, type PopulateClause, type PopulateErrorContext, type PopulateOptions, type QueryAction, type QueryBuilderComponent, type QueryBuilderErrorCode, type QueryBuilderErrorContext, type QueryContext, type QueryCountObject, type QueryDeleteObject, type QueryInsertObject, type QueryMetadata, type QueryObject, type QueryObjectForType, type QueryOrderBy, type QueryPopulate, type QueryPopulateOptions, type QueryPrimitive, type QueryRelations, type QueryResult, type QueryRunner, type QuerySelect, type QuerySelectObject, type QueryTranslator, type QueryType, type QueryUpdateObject, RESERVED_FIELDS, RESERVED_FIELD_NAMES, type RawCrudOptions, type RawFindManyOptions, type RawQueryParams, type RawSQLOperation, type RelationBelongsTo, type RelationField, type RelationHasMany, type RelationHasOne, type RelationIdRef, type RelationIdRefs, type RelationInput, type RelationKind, type RelationManyToMany, type RenameTableOperation, type ReservedFieldName, type ResponseData, type S3ProviderOptions, STRING_OPERATORS, type ScalarValue, type SchemaComparison, type SchemaDefinition, type SchemaDefinitionValidationResult, type SchemaDiff, type SchemaDiffType, type SchemaDiffer, type SchemaExtension, type SchemaExtensionContext, type SchemaModifier, type SchemaOperations, type SchemaPattern, type SchemaPermission, type SchemaValidationError, type SelectClause, type SerializedDatrixAdapterError, type SerializedDatrixAuthError, type SerializedDatrixConfigError, type SerializedDatrixCrudError, type SerializedDatrixError, type SerializedDatrixQueryBuilderError, type SerializedDatrixValidationError, type SerializedParserError, type SortErrorContext, type SortParam, type SqlDialect, type StorageProvider, type StringField, type TableAddedDiff, type TableRemovedDiff, type TableRenamedDiff, type Transaction, type UploadConfig, UploadError, type UploadFile, type UploadResult, WHERE_OPERATORS, type WhereClause, type WhereErrorContext, type WhereOperator, buildErrorLocation, createMigrationSession, defineConfig, defineSchema, generateUniqueFilename, getDatrixMetaSchema, getFileExtension, getMigrationSchema, getOperatorValueType, hasDefaultExport, isDatabaseAdapter, isDatrixConfig, isDatrixPlugin, isLogicalOperator, isPermissionFn, isRelationIdRef, isRelationIdRefs, isStorageProvider, isValidFieldName, isValidWhereOperator, isWhereOperator, normalizeRelationId, normalizeRelationIds, requiresArrayValue, requiresConditions, sanitizeFilename, sortSchemasByDependency, throwConnectionError, throwFileNotFound, throwFileReadError, throwFileWriteError, throwForeignKeyConstraint, throwIntrospectionError, throwInvalidPopulateOptions, throwInvalidRelationType, throwInvalidRelationWhereSyntax, throwInvalidWhereField, throwJoinBuildError, throwJsonAggregationError, throwJunctionTableNotFound, throwLateralJoinError, throwLockError, throwLockTimeout, throwMaxDepthExceeded, throwMetaFieldAlreadyExists, throwMetaFieldNotFound, throwMigrationError, throwModelNotFound, throwNotConnected, throwPopulateQueryError, throwQueryError, throwQueryMissingData, throwRawQueryNotSupported, throwRelationNotFound, throwResultProcessingError, throwSchemaNotFound, throwTargetModelNotFound, throwTransactionAlreadyCommitted, throwTransactionAlreadyRolledBack, throwTransactionError, throwTransactionSavepointNotSupported, throwUniqueConstraintField, throwUniqueConstraintIndex, truncateSqlForError, validateFieldName, validateQueryObject, validateSchemaDefinition };
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ type FallbackWhereClause = {
|
|
|
37
37
|
$not?: FallbackWhereClause;
|
|
38
38
|
};
|
|
39
39
|
type TypedWhereClause<T extends DatrixEntry> = Writable<{
|
|
40
|
-
[K in keyof T]?: T[K] extends RelationInput<infer R extends DatrixEntry> ? WhereClause<R> : T[K] extends ScalarValue ? T[K] | ComparisonOperators<T[K]> : never;
|
|
40
|
+
[K in keyof T]?: T[K] extends RelationInput<infer R extends DatrixEntry> ? WhereClause<R> : NonNullable<T[K]> extends DatrixEntry ? WhereClause<NonNullable<T[K]>> : NonNullable<T[K]> extends DatrixEntry[] ? WhereClause<NonNullable<T[K]>[number]> : T[K] extends ScalarValue ? T[K] | ComparisonOperators<T[K]> : never;
|
|
41
41
|
}> & LogicalOperators<T>;
|
|
42
42
|
type WhereClause<T extends DatrixEntry = DatrixRecord> = DatrixRecord extends T ? FallbackWhereClause : TypedWhereClause<T>;
|
|
43
43
|
type SelectClause<T extends DatrixEntry = DatrixRecord> = (DatrixRecord extends T ? readonly string[] : readonly (keyof T)[]) | "*" | (DatrixRecord extends T ? string : keyof T);
|
|
@@ -49,9 +49,11 @@ type PopulateOptions<T extends DatrixEntry> = {
|
|
|
49
49
|
readonly offset?: number | undefined;
|
|
50
50
|
readonly orderBy?: QueryOrderBy | undefined;
|
|
51
51
|
};
|
|
52
|
-
type
|
|
53
|
-
|
|
52
|
+
type TypedPopulateValue<T> = NonNullable<T> extends DatrixEntry ? PopulateOptions<NonNullable<T>> | "*" | boolean : NonNullable<T> extends DatrixEntry[] ? PopulateOptions<NonNullable<T>[number]> | "*" | boolean : PopulateOptions<DatrixRecord> | "*" | boolean;
|
|
53
|
+
type TypedPopulateClause<T extends DatrixEntry> = {
|
|
54
|
+
readonly [K in keyof T]?: TypedPopulateValue<T[K]>;
|
|
54
55
|
};
|
|
56
|
+
type PopulateClause<T extends DatrixEntry = DatrixRecord> = boolean | "*" | "true" | (DatrixRecord extends T ? readonly string[] : readonly (keyof T)[]) | (DatrixRecord extends T ? Record<string, PopulateOptions<DatrixRecord> | "*" | boolean> : TypedPopulateClause<T>);
|
|
55
57
|
type OrderDirection = "asc" | "desc";
|
|
56
58
|
type OrderByItem<T extends DatrixEntry> = {
|
|
57
59
|
readonly field: keyof T;
|
|
@@ -857,8 +859,8 @@ declare function isLogicalOperator(operator: string): operator is (typeof LOGICA
|
|
|
857
859
|
declare function requiresArrayValue(operator: string): boolean;
|
|
858
860
|
declare function requiresConditions(operator: string): boolean;
|
|
859
861
|
declare function getOperatorValueType(operator: string): OperatorValueType | undefined;
|
|
860
|
-
declare const
|
|
861
|
-
declare const
|
|
862
|
+
declare const DATRIX_META_MODEL = "_datrix";
|
|
863
|
+
declare const DATRIX_META_KEY_PREFIX = "_schema_";
|
|
862
864
|
declare const FIELD_NAME_PATTERN: RegExp;
|
|
863
865
|
declare const CONTROL_CHARS_PATTERN: RegExp;
|
|
864
866
|
declare const RESERVED_FIELD_NAMES: readonly ["__proto__", "constructor", "prototype"];
|
|
@@ -1932,4 +1934,4 @@ declare function getDatrixMetaSchema(): {
|
|
|
1932
1934
|
};
|
|
1933
1935
|
};
|
|
1934
1936
|
|
|
1935
|
-
export { ALL_WHERE_OPERATORS, ARRAY_OPERATORS, type AdapterErrorCode, type AdapterErrorContext, type AdapterName, type AdapterOperation, type AlterOperation, type AlterTableOperation, type AmbiguousAction, type AmbiguousActionType, type AmbiguousChange, type AmbiguousChangeType, type AnyRelationInput, type AnyRelationInputObject, type ArrayField, type AuthContext, type AuthErrorCode, type AuthErrorContext, type AuthStrategy, type AuthUser, type AuthenticatedUser, type BaseCommandOptions, type BaseErrorContext, type BaseMigrationOperation, BasePlugin, type BaseSchemaDiff, type BooleanField, CLIError, COMPARISON_OPERATORS, CONTROL_CHARS_PATTERN, type ComparisonOperators, type ConfigErrorCode, type ConfigErrorContext, type ConfigFactory, type ConfigFileExport, type ConnectionState, type CreateIndexOperation, type CreateTableOperation, type CrudErrorCode, type CrudErrorContext, type CrudOperation, DEFAULT_API_AUTH_CONFIG, DEFAULT_API_CONFIG, DEFAULT_DEV_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_MIGRATION_MODEL, type DataTransferOperation, type DatabaseAdapter, type DateField, Datrix, DatrixAdapterError, type DatrixAdapterErrorOptions, DatrixAuthError, type DatrixAuthErrorOptions, type DatrixConfig, DatrixConfigError, type DatrixConfigErrorOptions, DatrixConfigValidationError, DatrixCrudError, type DatrixCrudErrorOptions, type DatrixEntry, DatrixError, type DatrixErrorOptions, type DatrixInitOptions, type DatrixPlugin, DatrixQueryBuilderError, type DatrixQueryBuilderErrorOptions, type DatrixRecord, DatrixValidationError, type DatrixValidationErrorOptions, type DefaultPermission, type DevCommandOptions, type DevConfig, type DropIndexOperation, type DropTableOperation, type EnumField, type ErrorLocation, type ExportMeta, type ExportWriter, FIELD_NAME_PATTERN,
|
|
1937
|
+
export { ALL_WHERE_OPERATORS, ARRAY_OPERATORS, type AdapterErrorCode, type AdapterErrorContext, type AdapterName, type AdapterOperation, type AlterOperation, type AlterTableOperation, type AmbiguousAction, type AmbiguousActionType, type AmbiguousChange, type AmbiguousChangeType, type AnyRelationInput, type AnyRelationInputObject, type ArrayField, type AuthContext, type AuthErrorCode, type AuthErrorContext, type AuthStrategy, type AuthUser, type AuthenticatedUser, type BaseCommandOptions, type BaseErrorContext, type BaseMigrationOperation, BasePlugin, type BaseSchemaDiff, type BooleanField, CLIError, COMPARISON_OPERATORS, CONTROL_CHARS_PATTERN, type ComparisonOperators, type ConfigErrorCode, type ConfigErrorContext, type ConfigFactory, type ConfigFileExport, type ConnectionState, type CreateIndexOperation, type CreateTableOperation, type CrudErrorCode, type CrudErrorContext, type CrudOperation, DATRIX_META_KEY_PREFIX, DATRIX_META_MODEL, DEFAULT_API_AUTH_CONFIG, DEFAULT_API_CONFIG, DEFAULT_DEV_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_MIGRATION_MODEL, type DataTransferOperation, type DatabaseAdapter, type DateField, Datrix, DatrixAdapterError, type DatrixAdapterErrorOptions, DatrixAuthError, type DatrixAuthErrorOptions, type DatrixConfig, DatrixConfigError, type DatrixConfigErrorOptions, DatrixConfigValidationError, DatrixCrudError, type DatrixCrudErrorOptions, type DatrixEntry, DatrixError, type DatrixErrorOptions, type DatrixInitOptions, type DatrixPlugin, DatrixQueryBuilderError, type DatrixQueryBuilderErrorOptions, type DatrixRecord, DatrixValidationError, type DatrixValidationErrorOptions, type DefaultPermission, type DevCommandOptions, type DevConfig, type DropIndexOperation, type DropTableOperation, type EnumField, type ErrorLocation, type ExportMeta, type ExportWriter, FIELD_NAME_PATTERN, type FallbackInput, type FallbackOrderByItem, type FallbackScalar, type FallbackValue, type FallbackWhereClause, type FieldAddedDiff, type FieldDefinition, type FieldInvalidReason, type FieldMetadata, type FieldModifiedDiff, type FieldPermission, type FieldPermissionAction, type FieldPermissionCheckResult, type FieldRemovedDiff, type FieldRenamedDiff, type FieldType, type FieldValidationResult, type FieldsErrorContext, type FileField, type FileFieldOptions, type ForeignKeyReference, type GenerateCommandOptions, type IApiPlugin, type IAuthManager, type IDatrix, type IRawCrud, type ISchemaRegistry, type IUpload, type ImportReader, type IndexAddedDiff, type IndexDefinition, type IndexRemovedDiff, type JsonField, LOGICAL_OPERATORS, type LifecycleHooks, type LoadConfigOptions, type LocalProviderOptions, type LogicalOperators, type LoginResult, MAX_ARRAY_INDEX, MAX_FIELD_NAME_LENGTH, MAX_LOGICAL_NESTING_DEPTH, MAX_WHERE_VALUE_LENGTH, type MediaEntry, type MediaVariant, type MediaVariants, type MigrateCommandOptions, type Migration, type MigrationConfig, type MigrationContext, type MigrationExecutionResult, type MigrationFilePlan, type MigrationGenerator, type MigrationHistory, type MigrationHistoryRecord, type MigrationMetadata, type MigrationOperation, type MigrationOperationType, type MigrationPlan, type MigrationRunner, MigrationSession, type MigrationStatus, MigrationSystemError, NULL_OPERATORS, type NormalizedNestedData, type NormalizedRelationId, type NormalizedRelationOperations, type NormalizedRelationUpdate, type NumberField, OPERATOR_VALUE_TYPES, type OperatorValueType, type OrderByClause, type OrderByItem, type OrderDirection, type PaginationErrorContext, type PaginationParams, type ParameterStyle, type ParsedArgs, type ParsedPagination, type ParsedQuery, type ParsedSort, ParserError, type ParserErrorCode, type ParserErrorContext, type ParserErrorOptions, type ParserOptions, type ParserType, type PermissionAction, type PermissionCheckResult, type PermissionContext, type PermissionFn, type PermissionValue, type PluginContext, PluginError, type PluginFactory, PluginRegistry, type PopulateClause, type PopulateErrorContext, type PopulateOptions, type QueryAction, type QueryBuilderComponent, type QueryBuilderErrorCode, type QueryBuilderErrorContext, type QueryContext, type QueryCountObject, type QueryDeleteObject, type QueryInsertObject, type QueryMetadata, type QueryObject, type QueryObjectForType, type QueryOrderBy, type QueryPopulate, type QueryPopulateOptions, type QueryPrimitive, type QueryRelations, type QueryResult, type QueryRunner, type QuerySelect, type QuerySelectObject, type QueryTranslator, type QueryType, type QueryUpdateObject, RESERVED_FIELDS, RESERVED_FIELD_NAMES, type RawCrudOptions, type RawFindManyOptions, type RawQueryParams, type RawSQLOperation, type RelationBelongsTo, type RelationField, type RelationHasMany, type RelationHasOne, type RelationIdRef, type RelationIdRefs, type RelationInput, type RelationKind, type RelationManyToMany, type RenameTableOperation, type ReservedFieldName, type ResponseData, type S3ProviderOptions, STRING_OPERATORS, type ScalarValue, type SchemaComparison, type SchemaDefinition, type SchemaDefinitionValidationResult, type SchemaDiff, type SchemaDiffType, type SchemaDiffer, type SchemaExtension, type SchemaExtensionContext, type SchemaModifier, type SchemaOperations, type SchemaPattern, type SchemaPermission, type SchemaValidationError, type SelectClause, type SerializedDatrixAdapterError, type SerializedDatrixAuthError, type SerializedDatrixConfigError, type SerializedDatrixCrudError, type SerializedDatrixError, type SerializedDatrixQueryBuilderError, type SerializedDatrixValidationError, type SerializedParserError, type SortErrorContext, type SortParam, type SqlDialect, type StorageProvider, type StringField, type TableAddedDiff, type TableRemovedDiff, type TableRenamedDiff, type Transaction, type UploadConfig, UploadError, type UploadFile, type UploadResult, WHERE_OPERATORS, type WhereClause, type WhereErrorContext, type WhereOperator, buildErrorLocation, createMigrationSession, defineConfig, defineSchema, generateUniqueFilename, getDatrixMetaSchema, getFileExtension, getMigrationSchema, getOperatorValueType, hasDefaultExport, isDatabaseAdapter, isDatrixConfig, isDatrixPlugin, isLogicalOperator, isPermissionFn, isRelationIdRef, isRelationIdRefs, isStorageProvider, isValidFieldName, isValidWhereOperator, isWhereOperator, normalizeRelationId, normalizeRelationIds, requiresArrayValue, requiresConditions, sanitizeFilename, sortSchemasByDependency, throwConnectionError, throwFileNotFound, throwFileReadError, throwFileWriteError, throwForeignKeyConstraint, throwIntrospectionError, throwInvalidPopulateOptions, throwInvalidRelationType, throwInvalidRelationWhereSyntax, throwInvalidWhereField, throwJoinBuildError, throwJsonAggregationError, throwJunctionTableNotFound, throwLateralJoinError, throwLockError, throwLockTimeout, throwMaxDepthExceeded, throwMetaFieldAlreadyExists, throwMetaFieldNotFound, throwMigrationError, throwModelNotFound, throwNotConnected, throwPopulateQueryError, throwQueryError, throwQueryMissingData, throwRawQueryNotSupported, throwRelationNotFound, throwResultProcessingError, throwSchemaNotFound, throwTargetModelNotFound, throwTransactionAlreadyCommitted, throwTransactionAlreadyRolledBack, throwTransactionError, throwTransactionSavepointNotSupported, throwUniqueConstraintField, throwUniqueConstraintIndex, truncateSqlForError, validateFieldName, validateQueryObject, validateSchemaDefinition };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,8 @@ __export(index_exports, {
|
|
|
26
26
|
CLIError: () => CLIError,
|
|
27
27
|
COMPARISON_OPERATORS: () => COMPARISON_OPERATORS2,
|
|
28
28
|
CONTROL_CHARS_PATTERN: () => CONTROL_CHARS_PATTERN,
|
|
29
|
+
DATRIX_META_KEY_PREFIX: () => DATRIX_META_KEY_PREFIX,
|
|
30
|
+
DATRIX_META_MODEL: () => DATRIX_META_MODEL,
|
|
29
31
|
DEFAULT_API_AUTH_CONFIG: () => DEFAULT_API_AUTH_CONFIG,
|
|
30
32
|
DEFAULT_API_CONFIG: () => DEFAULT_API_CONFIG,
|
|
31
33
|
DEFAULT_DEV_CONFIG: () => DEFAULT_DEV_CONFIG,
|
|
@@ -41,8 +43,6 @@ __export(index_exports, {
|
|
|
41
43
|
DatrixQueryBuilderError: () => DatrixQueryBuilderError,
|
|
42
44
|
DatrixValidationError: () => DatrixValidationError,
|
|
43
45
|
FIELD_NAME_PATTERN: () => FIELD_NAME_PATTERN,
|
|
44
|
-
FORJA_META_KEY_PREFIX: () => FORJA_META_KEY_PREFIX,
|
|
45
|
-
FORJA_META_MODEL: () => FORJA_META_MODEL,
|
|
46
46
|
LOGICAL_OPERATORS: () => LOGICAL_OPERATORS,
|
|
47
47
|
MAX_ARRAY_INDEX: () => MAX_ARRAY_INDEX,
|
|
48
48
|
MAX_FIELD_NAME_LENGTH: () => MAX_FIELD_NAME_LENGTH,
|
|
@@ -5131,8 +5131,8 @@ function requiresConditions(operator) {
|
|
|
5131
5131
|
function getOperatorValueType(operator) {
|
|
5132
5132
|
return OPERATOR_VALUE_TYPES[operator];
|
|
5133
5133
|
}
|
|
5134
|
-
var
|
|
5135
|
-
var
|
|
5134
|
+
var DATRIX_META_MODEL = "_datrix";
|
|
5135
|
+
var DATRIX_META_KEY_PREFIX = "_schema_";
|
|
5136
5136
|
var FIELD_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_.]*$/;
|
|
5137
5137
|
var CONTROL_CHARS_PATTERN = /[\x00-\x1F\x7F]/;
|
|
5138
5138
|
var RESERVED_FIELD_NAMES = [
|
|
@@ -5317,12 +5317,12 @@ var SchemaRegistry = class {
|
|
|
5317
5317
|
const allSchemas = Array.from(this.schemas.values());
|
|
5318
5318
|
const sorted = sortSchemasByDependency(allSchemas);
|
|
5319
5319
|
const entries = /* @__PURE__ */ new Map();
|
|
5320
|
-
const metaSchema = this.schemas.get(
|
|
5320
|
+
const metaSchema = this.schemas.get(DATRIX_META_MODEL);
|
|
5321
5321
|
if (metaSchema) {
|
|
5322
|
-
entries.set(
|
|
5322
|
+
entries.set(DATRIX_META_MODEL, metaSchema);
|
|
5323
5323
|
}
|
|
5324
5324
|
for (const schema of sorted) {
|
|
5325
|
-
if (schema.name ===
|
|
5325
|
+
if (schema.name === DATRIX_META_MODEL) continue;
|
|
5326
5326
|
entries.set(schema.name, schema);
|
|
5327
5327
|
}
|
|
5328
5328
|
this.schemas.clear();
|
|
@@ -5879,8 +5879,8 @@ function getMigrationSchema(modelName = DEFAULT_MIGRATION_MODEL) {
|
|
|
5879
5879
|
}
|
|
5880
5880
|
function getDatrixMetaSchema() {
|
|
5881
5881
|
return defineSchema({
|
|
5882
|
-
name:
|
|
5883
|
-
tableName:
|
|
5882
|
+
name: DATRIX_META_MODEL,
|
|
5883
|
+
tableName: DATRIX_META_MODEL,
|
|
5884
5884
|
fields: {
|
|
5885
5885
|
key: {
|
|
5886
5886
|
type: "string",
|
|
@@ -6818,12 +6818,12 @@ var ForgeMigrationHistory = class {
|
|
|
6818
6818
|
);
|
|
6819
6819
|
}
|
|
6820
6820
|
const adapter = this.datrix.getAdapter();
|
|
6821
|
-
const metaExists = await adapter.tableExists(
|
|
6821
|
+
const metaExists = await adapter.tableExists(DATRIX_META_MODEL);
|
|
6822
6822
|
if (!metaExists) {
|
|
6823
|
-
const metaSchema = this.datrix.getSchemas().get(
|
|
6823
|
+
const metaSchema = this.datrix.getSchemas().get(DATRIX_META_MODEL);
|
|
6824
6824
|
if (!metaSchema) {
|
|
6825
6825
|
throw new MigrationSystemError(
|
|
6826
|
-
`Schema '${
|
|
6826
|
+
`Schema '${DATRIX_META_MODEL}' not found in registry`,
|
|
6827
6827
|
"MIGRATION_ERROR"
|
|
6828
6828
|
);
|
|
6829
6829
|
}
|
|
@@ -8833,6 +8833,8 @@ var BasePlugin = class {
|
|
|
8833
8833
|
CLIError,
|
|
8834
8834
|
COMPARISON_OPERATORS,
|
|
8835
8835
|
CONTROL_CHARS_PATTERN,
|
|
8836
|
+
DATRIX_META_KEY_PREFIX,
|
|
8837
|
+
DATRIX_META_MODEL,
|
|
8836
8838
|
DEFAULT_API_AUTH_CONFIG,
|
|
8837
8839
|
DEFAULT_API_CONFIG,
|
|
8838
8840
|
DEFAULT_DEV_CONFIG,
|
|
@@ -8848,8 +8850,6 @@ var BasePlugin = class {
|
|
|
8848
8850
|
DatrixQueryBuilderError,
|
|
8849
8851
|
DatrixValidationError,
|
|
8850
8852
|
FIELD_NAME_PATTERN,
|
|
8851
|
-
FORJA_META_KEY_PREFIX,
|
|
8852
|
-
FORJA_META_MODEL,
|
|
8853
8853
|
LOGICAL_OPERATORS,
|
|
8854
8854
|
MAX_ARRAY_INDEX,
|
|
8855
8855
|
MAX_FIELD_NAME_LENGTH,
|