@stndrds/schema 1.0.0-alpha.190 → 1.0.0-alpha.191
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.js +7 -8
- package/dist/index.mjs +8 -9
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2593,18 +2593,17 @@ var ObjectBuilder = class {
|
|
|
2593
2593
|
throw new Error("[ObjectBuilder] Missing required field: label");
|
|
2594
2594
|
}
|
|
2595
2595
|
if (!this._labelExpression) {
|
|
2596
|
-
throw new
|
|
2597
|
-
`
|
|
2598
|
-
|
|
2599
|
-
\u2705 Example: .labelExpression("{{ name }}")
|
|
2600
|
-
\u2705 Example: .labelExpression("{{ firstName }} {{ lastName }}")`
|
|
2596
|
+
throw new chunkFQ2ZYOVS_js.SchemaError(
|
|
2597
|
+
`Object "${this.obj.name}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,
|
|
2598
|
+
chunkFQ2ZYOVS_js.SchemaErrorCode.VALIDATION_FAILED
|
|
2601
2599
|
);
|
|
2602
2600
|
}
|
|
2603
2601
|
const labelResult = labelExpressionSchema.safeParse(this._labelExpression);
|
|
2604
2602
|
if (!labelResult.success) {
|
|
2605
2603
|
const errorMsg = labelResult.error.issues[0]?.message ?? "Invalid labelExpression";
|
|
2606
|
-
throw new
|
|
2607
|
-
`
|
|
2604
|
+
throw new chunkFQ2ZYOVS_js.SchemaError(
|
|
2605
|
+
`Invalid labelExpression for "${this.obj.name}": ${errorMsg}`,
|
|
2606
|
+
chunkFQ2ZYOVS_js.SchemaErrorCode.VALIDATION_FAILED
|
|
2608
2607
|
);
|
|
2609
2608
|
}
|
|
2610
2609
|
const sortedVersions = [...this._migrations].sort((a, b) => a.version - b.version);
|
|
@@ -2641,7 +2640,7 @@ The labelExpression defines how records are displayed in lists and relations.
|
|
|
2641
2640
|
objectNameSchema.parse(name);
|
|
2642
2641
|
} catch (error) {
|
|
2643
2642
|
if (error instanceof z3__default.default.ZodError) {
|
|
2644
|
-
throw new
|
|
2643
|
+
throw new chunkFQ2ZYOVS_js.SchemaError(error.issues[0].message, chunkFQ2ZYOVS_js.SchemaErrorCode.INVALID_OBJECT_NAME);
|
|
2645
2644
|
}
|
|
2646
2645
|
throw error;
|
|
2647
2646
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { generateId } from './chunk-QY6QFRRV.mjs';
|
|
|
2
2
|
export { asTenantId, asUserId, deepEqual, generateId, indexBy } from './chunk-QY6QFRRV.mjs';
|
|
3
3
|
import './chunk-SP3PNHYF.mjs';
|
|
4
4
|
export { parseAttributeConfig } from './chunk-U4JC7P6D.mjs';
|
|
5
|
-
import { createObjectValidator, ValidationError, createAttributeValidator } from './chunk-LTHSU4NF.mjs';
|
|
5
|
+
import { createObjectValidator, SchemaError, SchemaErrorCode, ValidationError, createAttributeValidator } from './chunk-LTHSU4NF.mjs';
|
|
6
6
|
export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, RecordReferencedError, RepositoryError, RoleNotFoundError, SchemaError, SchemaErrorCode, StorageError, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, computeRecordStatus, createFormAttributeValidator, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from './chunk-LTHSU4NF.mjs';
|
|
7
7
|
import './chunk-TMYBEXBT.mjs';
|
|
8
8
|
import './chunk-4KRLCWJM.mjs';
|
|
@@ -2589,18 +2589,17 @@ var ObjectBuilder = class {
|
|
|
2589
2589
|
throw new Error("[ObjectBuilder] Missing required field: label");
|
|
2590
2590
|
}
|
|
2591
2591
|
if (!this._labelExpression) {
|
|
2592
|
-
throw new
|
|
2593
|
-
`
|
|
2594
|
-
|
|
2595
|
-
\u2705 Example: .labelExpression("{{ name }}")
|
|
2596
|
-
\u2705 Example: .labelExpression("{{ firstName }} {{ lastName }}")`
|
|
2592
|
+
throw new SchemaError(
|
|
2593
|
+
`Object "${this.obj.name}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,
|
|
2594
|
+
SchemaErrorCode.VALIDATION_FAILED
|
|
2597
2595
|
);
|
|
2598
2596
|
}
|
|
2599
2597
|
const labelResult = labelExpressionSchema.safeParse(this._labelExpression);
|
|
2600
2598
|
if (!labelResult.success) {
|
|
2601
2599
|
const errorMsg = labelResult.error.issues[0]?.message ?? "Invalid labelExpression";
|
|
2602
|
-
throw new
|
|
2603
|
-
`
|
|
2600
|
+
throw new SchemaError(
|
|
2601
|
+
`Invalid labelExpression for "${this.obj.name}": ${errorMsg}`,
|
|
2602
|
+
SchemaErrorCode.VALIDATION_FAILED
|
|
2604
2603
|
);
|
|
2605
2604
|
}
|
|
2606
2605
|
const sortedVersions = [...this._migrations].sort((a, b) => a.version - b.version);
|
|
@@ -2637,7 +2636,7 @@ The labelExpression defines how records are displayed in lists and relations.
|
|
|
2637
2636
|
objectNameSchema.parse(name);
|
|
2638
2637
|
} catch (error) {
|
|
2639
2638
|
if (error instanceof z3.ZodError) {
|
|
2640
|
-
throw new
|
|
2639
|
+
throw new SchemaError(error.issues[0].message, SchemaErrorCode.INVALID_OBJECT_NAME);
|
|
2641
2640
|
}
|
|
2642
2641
|
throw error;
|
|
2643
2642
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stndrds/schema",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.191",
|
|
4
4
|
"description": "Standard schema definitions and utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"expr-eval": "^2.0.2",
|
|
132
132
|
"libphonenumber-js": "^1.12.31",
|
|
133
133
|
"zod": "^4.2.1",
|
|
134
|
-
"@stndrds/constants": "1.0.0-alpha.
|
|
134
|
+
"@stndrds/constants": "1.0.0-alpha.191"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
137
|
"@types/node": "^25.0.3",
|