@contember/schema-utils 2.0.0-alpha.10 → 2.0.0-alpha.13
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/development/index.cjs +2 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2 -0
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/schemaChecksum.cjs +9 -0
- package/dist/development/src/schemaChecksum.cjs.map +1 -0
- package/dist/development/src/schemaChecksum.js +9 -0
- package/dist/development/src/schemaChecksum.js.map +1 -0
- package/dist/production/index.cjs +2 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +2 -0
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/schemaChecksum.cjs +9 -0
- package/dist/production/src/schemaChecksum.cjs.map +1 -0
- package/dist/production/src/schemaChecksum.js +9 -0
- package/dist/production/src/schemaChecksum.js.map +1 -0
- package/dist/tests/cases/unit/schemas/acl.d.ts +7 -7
- package/dist/tests/cases/unit/schemas/acl.d.ts.map +1 -1
- package/dist/tests/cases/unit/schemas/basic.d.ts +1 -1
- package/dist/tests/cases/unit/schemas/basic.d.ts.map +1 -1
- package/dist/tests/cases/unit/schemas/enum.d.ts +3 -3
- package/dist/tests/cases/unit/schemas/enum.d.ts.map +1 -1
- package/dist/tests/cases/unit/schemas/relations.d.ts +7 -7
- package/dist/tests/cases/unit/schemas/relations.d.ts.map +1 -1
- package/dist/tests/cases/unit/schemas/unique.d.ts +1 -1
- package/dist/tests/cases/unit/schemas/unique.d.ts.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/schemaChecksum.d.ts +3 -0
- package/dist/types/schemaChecksum.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/schemaChecksum.ts +12 -0
|
@@ -28,6 +28,7 @@ const SchemaValidator = require("./src/validation/SchemaValidator.cjs");
|
|
|
28
28
|
const MembershipResolver = require("./src/validation/MembershipResolver.cjs");
|
|
29
29
|
const schemaNormalizer = require("./src/schemaNormalizer.cjs");
|
|
30
30
|
const schemaFilter = require("./src/schemaFilter.cjs");
|
|
31
|
+
const schemaChecksum = require("./src/schemaChecksum.cjs");
|
|
31
32
|
const deepCompare = require("./src/utils/deepCompare.cjs");
|
|
32
33
|
function _interopNamespaceDefault(e) {
|
|
33
34
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -102,6 +103,7 @@ exports.MembershipValidationError = MembershipResolver.MembershipValidationError
|
|
|
102
103
|
exports.MembershipValidationErrorType = MembershipResolver.MembershipValidationErrorType;
|
|
103
104
|
exports.normalizeSchema = schemaNormalizer.normalizeSchema;
|
|
104
105
|
exports.filterSchemaByStage = schemaFilter.filterSchemaByStage;
|
|
106
|
+
exports.calculateSchemaChecksum = schemaChecksum.calculateSchemaChecksum;
|
|
105
107
|
exports.compareArraysIgnoreOrder = deepCompare.compareArraysIgnoreOrder;
|
|
106
108
|
exports.deepCompare = deepCompare.deepCompare;
|
|
107
109
|
exports.emptySchema = emptySchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":["emptyModelSchema","Typesafe","modelSchema","aclSchema","validationSchema","actionsSchema","settingsSchema"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport * from './schemaChecksum'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":["emptyModelSchema","Typesafe","modelSchema","aclSchema","validationSchema","actionsSchema","settingsSchema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAM,cAAsB;AAAA,EAClC,OAAOA,WAAA;AAAA,EACP,KAAK,EAAE,OAAO,GAAG;AAAA,EACjB,YAAY,CAAC;AAAA,EACb,SAAS,EAAE,UAAU,IAAI,SAAS,CAAA,EAAG;AAAA,EACrC,UAAU,CAAC;AACZ;AAEa,MAAA,aAAoCC,oBAAS,OAAO;AAAA,EAChE,OAAOC,MAAA;AAAA,EACP,KAAKC,IAAA;AAAA,EACL,YAAYC,WAAA;AAAA,EACZ,SAASH,oBAAS,SAASI,QAAe,eAAA,EAAE,UAAU,CAAI,GAAA,SAAS,CAAA,GAAI;AAAA,EACvE,UAAUJ,oBAAS,SAASK,SAAAA,gBAAgB,CAAA,CAAE;AAC/C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -27,6 +27,7 @@ import { SchemaValidator } from "./src/validation/SchemaValidator.js";
|
|
|
27
27
|
import { MembershipReadResult, MembershipResolver, MembershipValidationError, MembershipValidationErrorType } from "./src/validation/MembershipResolver.js";
|
|
28
28
|
import { normalizeSchema } from "./src/schemaNormalizer.js";
|
|
29
29
|
import { filterSchemaByStage } from "./src/schemaFilter.js";
|
|
30
|
+
import { calculateSchemaChecksum } from "./src/schemaChecksum.js";
|
|
30
31
|
import { compareArraysIgnoreOrder, deepCompare } from "./src/utils/deepCompare.js";
|
|
31
32
|
const emptySchema = {
|
|
32
33
|
model: emptyModelSchema,
|
|
@@ -67,6 +68,7 @@ export {
|
|
|
67
68
|
acceptEveryFieldVisitor,
|
|
68
69
|
acceptFieldVisitor,
|
|
69
70
|
acceptRelationTypeVisitor,
|
|
71
|
+
calculateSchemaChecksum,
|
|
70
72
|
compareArraysIgnoreOrder,
|
|
71
73
|
deepCompare,
|
|
72
74
|
emptyModelSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport * from './schemaChecksum'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAM,cAAsB;AAAA,EAClC,OAAO;AAAA,EACP,KAAK,EAAE,OAAO,GAAG;AAAA,EACjB,YAAY,CAAC;AAAA,EACb,SAAS,EAAE,UAAU,IAAI,SAAS,CAAA,EAAG;AAAA,EACrC,UAAU,CAAC;AACZ;AAEa,MAAA,aAAoC,SAAS,OAAO;AAAA,EAChE,OAAO;AAAA,EACP,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,SAAS,SAAS,SAAS,eAAe,EAAE,UAAU,CAAI,GAAA,SAAS,CAAA,GAAI;AAAA,EACvE,UAAU,SAAS,SAAS,gBAAgB,CAAA,CAAE;AAC/C,CAAC;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const crypto = require("node:crypto");
|
|
4
|
+
const calculateSchemaChecksum = (schema) => {
|
|
5
|
+
const jsonSchema = JSON.stringify(schema);
|
|
6
|
+
return crypto.createHash("md5").update(jsonSchema).digest("hex");
|
|
7
|
+
};
|
|
8
|
+
exports.calculateSchemaChecksum = calculateSchemaChecksum;
|
|
9
|
+
//# sourceMappingURL=schemaChecksum.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaChecksum.cjs","sources":["../../../../packages/schema-utils/src/schemaChecksum.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport crypto from 'node:crypto'\n\n\nexport const calculateSchemaChecksum = (schema: Schema): string => {\n\tconst jsonSchema = JSON.stringify(schema)\n\n\treturn crypto\n\t\t.createHash('md5')\n\t\t.update(jsonSchema)\n\t\t.digest('hex')\n}\n"],"names":[],"mappings":";;;AAIa,MAAA,0BAA0B,CAAC,WAA2B;AAC5D,QAAA,aAAa,KAAK,UAAU,MAAM;AAEjC,SAAA,OACL,WAAW,KAAK,EAChB,OAAO,UAAU,EACjB,OAAO,KAAK;AACf;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import crypto__default from "node:crypto";
|
|
2
|
+
const calculateSchemaChecksum = (schema) => {
|
|
3
|
+
const jsonSchema = JSON.stringify(schema);
|
|
4
|
+
return crypto__default.createHash("md5").update(jsonSchema).digest("hex");
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
calculateSchemaChecksum
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=schemaChecksum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaChecksum.js","sources":["../../../../packages/schema-utils/src/schemaChecksum.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport crypto from 'node:crypto'\n\n\nexport const calculateSchemaChecksum = (schema: Schema): string => {\n\tconst jsonSchema = JSON.stringify(schema)\n\n\treturn crypto\n\t\t.createHash('md5')\n\t\t.update(jsonSchema)\n\t\t.digest('hex')\n}\n"],"names":["crypto"],"mappings":";AAIa,MAAA,0BAA0B,CAAC,WAA2B;AAC5D,QAAA,aAAa,KAAK,UAAU,MAAM;AAEjC,SAAAA,gBACL,WAAW,KAAK,EAChB,OAAO,UAAU,EACjB,OAAO,KAAK;AACf;"}
|
|
@@ -28,6 +28,7 @@ const SchemaValidator = require("./src/validation/SchemaValidator.cjs");
|
|
|
28
28
|
const MembershipResolver = require("./src/validation/MembershipResolver.cjs");
|
|
29
29
|
const schemaNormalizer = require("./src/schemaNormalizer.cjs");
|
|
30
30
|
const schemaFilter = require("./src/schemaFilter.cjs");
|
|
31
|
+
const schemaChecksum = require("./src/schemaChecksum.cjs");
|
|
31
32
|
const deepCompare = require("./src/utils/deepCompare.cjs");
|
|
32
33
|
function _interopNamespaceDefault(e) {
|
|
33
34
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -102,6 +103,7 @@ exports.MembershipValidationError = MembershipResolver.MembershipValidationError
|
|
|
102
103
|
exports.MembershipValidationErrorType = MembershipResolver.MembershipValidationErrorType;
|
|
103
104
|
exports.normalizeSchema = schemaNormalizer.normalizeSchema;
|
|
104
105
|
exports.filterSchemaByStage = schemaFilter.filterSchemaByStage;
|
|
106
|
+
exports.calculateSchemaChecksum = schemaChecksum.calculateSchemaChecksum;
|
|
105
107
|
exports.compareArraysIgnoreOrder = deepCompare.compareArraysIgnoreOrder;
|
|
106
108
|
exports.deepCompare = deepCompare.deepCompare;
|
|
107
109
|
exports.emptySchema = emptySchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":["emptyModelSchema","Typesafe","modelSchema","aclSchema","validationSchema","actionsSchema","settingsSchema"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport * from './schemaChecksum'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":["emptyModelSchema","Typesafe","modelSchema","aclSchema","validationSchema","actionsSchema","settingsSchema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAM,cAAsB;AAAA,EAClC,OAAOA,WAAA;AAAA,EACP,KAAK,EAAE,OAAO,GAAG;AAAA,EACjB,YAAY,CAAC;AAAA,EACb,SAAS,EAAE,UAAU,IAAI,SAAS,CAAA,EAAG;AAAA,EACrC,UAAU,CAAC;AACZ;AAEa,MAAA,aAAoCC,oBAAS,OAAO;AAAA,EAChE,OAAOC,MAAA;AAAA,EACP,KAAKC,IAAA;AAAA,EACL,YAAYC,WAAA;AAAA,EACZ,SAASH,oBAAS,SAASI,QAAe,eAAA,EAAE,UAAU,CAAI,GAAA,SAAS,CAAA,GAAI;AAAA,EACvE,UAAUJ,oBAAS,SAASK,SAAAA,gBAAgB,CAAA,CAAE;AAC/C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import { SchemaValidator } from "./src/validation/SchemaValidator.js";
|
|
|
27
27
|
import { MembershipReadResult, MembershipResolver, MembershipValidationError, MembershipValidationErrorType } from "./src/validation/MembershipResolver.js";
|
|
28
28
|
import { normalizeSchema } from "./src/schemaNormalizer.js";
|
|
29
29
|
import { filterSchemaByStage } from "./src/schemaFilter.js";
|
|
30
|
+
import { calculateSchemaChecksum } from "./src/schemaChecksum.js";
|
|
30
31
|
import { compareArraysIgnoreOrder, deepCompare } from "./src/utils/deepCompare.js";
|
|
31
32
|
const emptySchema = {
|
|
32
33
|
model: emptyModelSchema,
|
|
@@ -67,6 +68,7 @@ export {
|
|
|
67
68
|
acceptEveryFieldVisitor,
|
|
68
69
|
acceptFieldVisitor,
|
|
69
70
|
acceptRelationTypeVisitor,
|
|
71
|
+
calculateSchemaChecksum,
|
|
70
72
|
compareArraysIgnoreOrder,
|
|
71
73
|
deepCompare,
|
|
72
74
|
emptyModelSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/schema-utils/src/index.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { emptyModelSchema } from './model'\nimport * as Typesafe from '@contember/typesafe'\nimport { aclSchema, modelSchema, validationSchema, settingsSchema } from './type-schema'\nimport { actionsSchema } from './type-schema/actions'\n\nexport * from './definition-generator'\nexport * from './lax'\nexport * from './model'\nexport * from './acl'\nexport * from './dataUtils'\nexport * from './validation'\nexport * from './schemaNormalizer'\nexport * from './schemaFilter'\nexport * from './schemaChecksum'\nexport { deepCompare, compareArraysIgnoreOrder } from './utils'\n\nexport const emptySchema: Schema = {\n\tmodel: emptyModelSchema,\n\tacl: { roles: {} },\n\tvalidation: {},\n\tactions: { triggers: {}, targets: {} },\n\tsettings: {},\n}\n\nexport const schemaType: Typesafe.Type<Schema> = Typesafe.object({\n\tmodel: modelSchema,\n\tacl: aclSchema,\n\tvalidation: validationSchema,\n\tactions: Typesafe.coalesce(actionsSchema, { triggers: {}, targets: {} }),\n\tsettings: Typesafe.coalesce(settingsSchema, {}),\n})\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAM,cAAsB;AAAA,EAClC,OAAO;AAAA,EACP,KAAK,EAAE,OAAO,GAAG;AAAA,EACjB,YAAY,CAAC;AAAA,EACb,SAAS,EAAE,UAAU,IAAI,SAAS,CAAA,EAAG;AAAA,EACrC,UAAU,CAAC;AACZ;AAEa,MAAA,aAAoC,SAAS,OAAO;AAAA,EAChE,OAAO;AAAA,EACP,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,SAAS,SAAS,SAAS,eAAe,EAAE,UAAU,CAAI,GAAA,SAAS,CAAA,GAAI;AAAA,EACvE,UAAU,SAAS,SAAS,gBAAgB,CAAA,CAAE;AAC/C,CAAC;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const crypto = require("node:crypto");
|
|
4
|
+
const calculateSchemaChecksum = (schema) => {
|
|
5
|
+
const jsonSchema = JSON.stringify(schema);
|
|
6
|
+
return crypto.createHash("md5").update(jsonSchema).digest("hex");
|
|
7
|
+
};
|
|
8
|
+
exports.calculateSchemaChecksum = calculateSchemaChecksum;
|
|
9
|
+
//# sourceMappingURL=schemaChecksum.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaChecksum.cjs","sources":["../../../../packages/schema-utils/src/schemaChecksum.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport crypto from 'node:crypto'\n\n\nexport const calculateSchemaChecksum = (schema: Schema): string => {\n\tconst jsonSchema = JSON.stringify(schema)\n\n\treturn crypto\n\t\t.createHash('md5')\n\t\t.update(jsonSchema)\n\t\t.digest('hex')\n}\n"],"names":[],"mappings":";;;AAIa,MAAA,0BAA0B,CAAC,WAA2B;AAC5D,QAAA,aAAa,KAAK,UAAU,MAAM;AAEjC,SAAA,OACL,WAAW,KAAK,EAChB,OAAO,UAAU,EACjB,OAAO,KAAK;AACf;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import crypto__default from "node:crypto";
|
|
2
|
+
const calculateSchemaChecksum = (schema) => {
|
|
3
|
+
const jsonSchema = JSON.stringify(schema);
|
|
4
|
+
return crypto__default.createHash("md5").update(jsonSchema).digest("hex");
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
calculateSchemaChecksum
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=schemaChecksum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaChecksum.js","sources":["../../../../packages/schema-utils/src/schemaChecksum.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport crypto from 'node:crypto'\n\n\nexport const calculateSchemaChecksum = (schema: Schema): string => {\n\tconst jsonSchema = JSON.stringify(schema)\n\n\treturn crypto\n\t\t.createHash('md5')\n\t\t.update(jsonSchema)\n\t\t.digest('hex')\n}\n"],"names":["crypto"],"mappings":";AAIa,MAAA,0BAA0B,CAAC,WAA2B;AAC5D,QAAA,aAAa,KAAK,UAAU,MAAM;AAEjC,SAAAA,gBACL,WAAW,KAAK,EAChB,OAAO,UAAU,EACjB,OAAO,KAAK;AACf;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare const readerRole: import("@contember/schema-definition
|
|
2
|
-
export declare const editorRole: import("@contember/schema-definition
|
|
3
|
-
export declare const categoryEditorVariable: import("@contember/schema-definition
|
|
1
|
+
export declare const readerRole: import("@contember/schema-definition").Role<"reader">;
|
|
2
|
+
export declare const editorRole: import("@contember/schema-definition").Role<"editor">;
|
|
3
|
+
export declare const categoryEditorVariable: import("@contember/schema-definition").VariableDefinition<"category", import("@contember/schema-definition").Role<"editor">, import("@contember/schema").Acl.EntityVariable>;
|
|
4
4
|
export declare class Article {
|
|
5
|
-
title: import("@contember/schema-definition
|
|
6
|
-
deletedAt: import("@contember/schema-definition
|
|
7
|
-
category: import("@contember/schema-definition
|
|
5
|
+
title: import("@contember/schema-definition").ColumnDefinition;
|
|
6
|
+
deletedAt: import("@contember/schema-definition").ColumnDefinition;
|
|
7
|
+
category: import("@contember/schema-definition").ManyHasOneDefinition;
|
|
8
8
|
}
|
|
9
9
|
export declare class Category {
|
|
10
|
-
name: import("@contember/schema-definition
|
|
10
|
+
name: import("@contember/schema-definition").ColumnDefinition;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=acl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acl.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/acl.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"acl.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/acl.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,uDAA0C,CAAA;AAEjE,eAAO,MAAM,UAAU,uDAA0C,CAAA;AAEjE,eAAO,MAAM,sBAAsB,8KAA6D,CAAA;AAGhG,qBASa,OAAO;IACnB,KAAK,0DAAmB;IACxB,SAAS,0DAAqB;IAC9B,QAAQ,8DAAyB;CACjC;AAGD,qBAMa,QAAQ;IACpB,IAAI,0DAAmB;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/basic.ts"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IACnB,KAAK,
|
|
1
|
+
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/basic.ts"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IACnB,KAAK,0DAAmB;CACxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const articleState: import("@contember/schema-definition
|
|
1
|
+
export declare const articleState: import("@contember/schema-definition").EnumDefinition<"draft" | "published">;
|
|
2
2
|
export declare class Article {
|
|
3
|
-
title: import("@contember/schema-definition
|
|
4
|
-
state: import("@contember/schema-definition
|
|
3
|
+
title: import("@contember/schema-definition").ColumnDefinition;
|
|
4
|
+
state: import("@contember/schema-definition").ColumnDefinition;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=enum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/enum.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/enum.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,8EAAqC,CAAA;AAE9D,qBAAa,OAAO;IACnB,KAAK,0DAAmB;IACxB,KAAK,0DAAwD;CAC7D"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export declare class Article {
|
|
2
|
-
title: import("@contember/schema-definition
|
|
3
|
-
category: import("@contember/schema-definition
|
|
4
|
-
tags: import("@contember/schema-definition
|
|
2
|
+
title: import("@contember/schema-definition").ColumnDefinition;
|
|
3
|
+
category: import("@contember/schema-definition").ManyHasOneDefinition;
|
|
4
|
+
tags: import("@contember/schema-definition").ManyHasManyDefinition;
|
|
5
5
|
}
|
|
6
6
|
export declare class Category {
|
|
7
|
-
name: import("@contember/schema-definition
|
|
8
|
-
articles: import("@contember/schema-definition
|
|
7
|
+
name: import("@contember/schema-definition").ColumnDefinition;
|
|
8
|
+
articles: import("@contember/schema-definition").OneHasManyDefinition;
|
|
9
9
|
}
|
|
10
10
|
export declare class Tag {
|
|
11
|
-
name: import("@contember/schema-definition
|
|
12
|
-
tags: import("@contember/schema-definition
|
|
11
|
+
name: import("@contember/schema-definition").ColumnDefinition;
|
|
12
|
+
tags: import("@contember/schema-definition").ManyHasManyInverseDefinition;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=relations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/relations.ts"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IACnB,KAAK,
|
|
1
|
+
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/relations.ts"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IACnB,KAAK,0DAAmB;IACxB,QAAQ,8DAAqC;IAC7C,IAAI,+DAAiC;CACrC;AAED,qBAAa,QAAQ;IACpB,IAAI,0DAAmB;IACvB,QAAQ,8DAAoC;CAC5C;AAED,qBAAa,GAAG;IACf,IAAI,0DAAmB;IACvB,IAAI,sEAAwC;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unique.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/unique.ts"],"names":[],"mappings":"AAEA,qBACa,OAAO;IACnB,KAAK,
|
|
1
|
+
{"version":3,"file":"unique.d.ts","sourceRoot":"","sources":["../../../../../tests/cases/unit/schemas/unique.ts"],"names":[],"mappings":"AAEA,qBACa,OAAO;IACnB,KAAK,0DAAmB;CACxB"}
|