@datrix/core 0.1.0 → 0.1.2
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 +15 -6
- package/dist/index.d.ts +15 -6
- package/dist/index.js +36 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1036,13 +1036,16 @@ function throwInvalidQueryType(receivedType) {
|
|
|
1036
1036
|
});
|
|
1037
1037
|
}
|
|
1038
1038
|
function throwSchemaNotFound2(modelName) {
|
|
1039
|
-
throw new DatrixQueryBuilderError(
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1039
|
+
throw new DatrixQueryBuilderError(
|
|
1040
|
+
`Schema not found for model: ${modelName}`,
|
|
1041
|
+
{
|
|
1042
|
+
code: "SCHEMA_NOT_FOUND",
|
|
1043
|
+
component: "builder",
|
|
1044
|
+
context: { modelName },
|
|
1045
|
+
suggestion: `Check that '${modelName}' is registered in the schema registry`,
|
|
1046
|
+
received: modelName
|
|
1047
|
+
}
|
|
1048
|
+
);
|
|
1046
1049
|
}
|
|
1047
1050
|
function throwInvalidFields(component, invalidFields, availableFields) {
|
|
1048
1051
|
const fieldList = invalidFields.join(", ");
|
|
@@ -4999,8 +5002,8 @@ function requiresConditions(operator) {
|
|
|
4999
5002
|
function getOperatorValueType(operator) {
|
|
5000
5003
|
return OPERATOR_VALUE_TYPES[operator];
|
|
5001
5004
|
}
|
|
5002
|
-
var
|
|
5003
|
-
var
|
|
5005
|
+
var DATRIX_META_MODEL = "_datrix";
|
|
5006
|
+
var DATRIX_META_KEY_PREFIX = "_schema_";
|
|
5004
5007
|
var FIELD_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_.]*$/;
|
|
5005
5008
|
var CONTROL_CHARS_PATTERN = /[\x00-\x1F\x7F]/;
|
|
5006
5009
|
var RESERVED_FIELD_NAMES = [
|
|
@@ -5185,12 +5188,12 @@ var SchemaRegistry = class {
|
|
|
5185
5188
|
const allSchemas = Array.from(this.schemas.values());
|
|
5186
5189
|
const sorted = sortSchemasByDependency(allSchemas);
|
|
5187
5190
|
const entries = /* @__PURE__ */ new Map();
|
|
5188
|
-
const metaSchema = this.schemas.get(
|
|
5191
|
+
const metaSchema = this.schemas.get(DATRIX_META_MODEL);
|
|
5189
5192
|
if (metaSchema) {
|
|
5190
|
-
entries.set(
|
|
5193
|
+
entries.set(DATRIX_META_MODEL, metaSchema);
|
|
5191
5194
|
}
|
|
5192
5195
|
for (const schema of sorted) {
|
|
5193
|
-
if (schema.name ===
|
|
5196
|
+
if (schema.name === DATRIX_META_MODEL) continue;
|
|
5194
5197
|
entries.set(schema.name, schema);
|
|
5195
5198
|
}
|
|
5196
5199
|
this.schemas.clear();
|
|
@@ -5747,8 +5750,8 @@ function getMigrationSchema(modelName = DEFAULT_MIGRATION_MODEL) {
|
|
|
5747
5750
|
}
|
|
5748
5751
|
function getDatrixMetaSchema() {
|
|
5749
5752
|
return defineSchema({
|
|
5750
|
-
name:
|
|
5751
|
-
tableName:
|
|
5753
|
+
name: DATRIX_META_MODEL,
|
|
5754
|
+
tableName: DATRIX_META_MODEL,
|
|
5752
5755
|
fields: {
|
|
5753
5756
|
key: {
|
|
5754
5757
|
type: "string",
|
|
@@ -6686,12 +6689,12 @@ var ForgeMigrationHistory = class {
|
|
|
6686
6689
|
);
|
|
6687
6690
|
}
|
|
6688
6691
|
const adapter = this.datrix.getAdapter();
|
|
6689
|
-
const metaExists = await adapter.tableExists(
|
|
6692
|
+
const metaExists = await adapter.tableExists(DATRIX_META_MODEL);
|
|
6690
6693
|
if (!metaExists) {
|
|
6691
|
-
const metaSchema = this.datrix.getSchemas().get(
|
|
6694
|
+
const metaSchema = this.datrix.getSchemas().get(DATRIX_META_MODEL);
|
|
6692
6695
|
if (!metaSchema) {
|
|
6693
6696
|
throw new MigrationSystemError(
|
|
6694
|
-
`Schema '${
|
|
6697
|
+
`Schema '${DATRIX_META_MODEL}' not found in registry`,
|
|
6695
6698
|
"MIGRATION_ERROR"
|
|
6696
6699
|
);
|
|
6697
6700
|
}
|
|
@@ -6825,10 +6828,13 @@ var ForgeMigrationHistory = class {
|
|
|
6825
6828
|
*/
|
|
6826
6829
|
async isApplied(version) {
|
|
6827
6830
|
try {
|
|
6828
|
-
const count = await this.datrix.raw.count(
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6831
|
+
const count = await this.datrix.raw.count(
|
|
6832
|
+
this.modelName,
|
|
6833
|
+
{
|
|
6834
|
+
version,
|
|
6835
|
+
status: "completed"
|
|
6836
|
+
}
|
|
6837
|
+
);
|
|
6832
6838
|
return count > 0;
|
|
6833
6839
|
} catch (error) {
|
|
6834
6840
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -8575,7 +8581,12 @@ var DEFAULT_API_AUTH_CONFIG = {
|
|
|
8575
8581
|
register: "/auth/register",
|
|
8576
8582
|
logout: "/auth/logout",
|
|
8577
8583
|
me: "/auth/me",
|
|
8584
|
+
forgotPassword: "/auth/forgot-password",
|
|
8585
|
+
resetPassword: "/auth/reset-password",
|
|
8578
8586
|
disableRegister: false
|
|
8587
|
+
},
|
|
8588
|
+
passwordReset: {
|
|
8589
|
+
tokenExpirySeconds: 3600
|
|
8579
8590
|
}
|
|
8580
8591
|
};
|
|
8581
8592
|
|
|
@@ -8700,6 +8711,8 @@ export {
|
|
|
8700
8711
|
CLIError,
|
|
8701
8712
|
COMPARISON_OPERATORS2 as COMPARISON_OPERATORS,
|
|
8702
8713
|
CONTROL_CHARS_PATTERN,
|
|
8714
|
+
DATRIX_META_KEY_PREFIX,
|
|
8715
|
+
DATRIX_META_MODEL,
|
|
8703
8716
|
DEFAULT_API_AUTH_CONFIG,
|
|
8704
8717
|
DEFAULT_API_CONFIG,
|
|
8705
8718
|
DEFAULT_DEV_CONFIG,
|
|
@@ -8715,8 +8728,6 @@ export {
|
|
|
8715
8728
|
DatrixQueryBuilderError,
|
|
8716
8729
|
DatrixValidationError,
|
|
8717
8730
|
FIELD_NAME_PATTERN,
|
|
8718
|
-
FORJA_META_KEY_PREFIX,
|
|
8719
|
-
FORJA_META_MODEL,
|
|
8720
8731
|
LOGICAL_OPERATORS,
|
|
8721
8732
|
MAX_ARRAY_INDEX,
|
|
8722
8733
|
MAX_FIELD_NAME_LENGTH,
|