@momentumcms/migrations 0.5.1 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentumcms/migrations",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Database migration system for Momentum CMS",
5
5
  "license": "MIT",
6
6
  "main": "./src/index.cjs",
@@ -88,6 +88,31 @@ function json(name, options = {}) {
88
88
  }
89
89
 
90
90
  // libs/core/src/lib/collections/media.collection.ts
91
+ var validateFocalPoint = (value) => {
92
+ if (value === null || value === void 0)
93
+ return true;
94
+ if (typeof value !== "object" || Array.isArray(value)) {
95
+ return "Focal point must be an object with x and y coordinates";
96
+ }
97
+ const fp = Object.fromEntries(Object.entries(value));
98
+ if (!("x" in fp) || !("y" in fp)) {
99
+ return "Focal point must have both x and y properties";
100
+ }
101
+ const { x, y } = fp;
102
+ if (typeof x !== "number" || !Number.isFinite(x)) {
103
+ return "Focal point x must be a finite number";
104
+ }
105
+ if (typeof y !== "number" || !Number.isFinite(y)) {
106
+ return "Focal point y must be a finite number";
107
+ }
108
+ if (x < 0 || x > 1) {
109
+ return `Focal point x must be between 0 and 1 (received ${x})`;
110
+ }
111
+ if (y < 0 || y > 1) {
112
+ return `Focal point y must be between 0 and 1 (received ${y})`;
113
+ }
114
+ return true;
115
+ };
91
116
  var MediaCollection = defineCollection({
92
117
  slug: "media",
93
118
  labels: {
@@ -142,6 +167,14 @@ var MediaCollection = defineCollection({
142
167
  json("focalPoint", {
143
168
  label: "Focal Point",
144
169
  description: "Focal point coordinates for image cropping",
170
+ validate: validateFocalPoint,
171
+ admin: {
172
+ hidden: true
173
+ }
174
+ }),
175
+ json("sizes", {
176
+ label: "Image Sizes",
177
+ description: "Generated image size variants",
145
178
  admin: {
146
179
  hidden: true
147
180
  }
@@ -86,6 +86,31 @@ function json(name, options = {}) {
86
86
  }
87
87
 
88
88
  // libs/core/src/lib/collections/media.collection.ts
89
+ var validateFocalPoint = (value) => {
90
+ if (value === null || value === void 0)
91
+ return true;
92
+ if (typeof value !== "object" || Array.isArray(value)) {
93
+ return "Focal point must be an object with x and y coordinates";
94
+ }
95
+ const fp = Object.fromEntries(Object.entries(value));
96
+ if (!("x" in fp) || !("y" in fp)) {
97
+ return "Focal point must have both x and y properties";
98
+ }
99
+ const { x, y } = fp;
100
+ if (typeof x !== "number" || !Number.isFinite(x)) {
101
+ return "Focal point x must be a finite number";
102
+ }
103
+ if (typeof y !== "number" || !Number.isFinite(y)) {
104
+ return "Focal point y must be a finite number";
105
+ }
106
+ if (x < 0 || x > 1) {
107
+ return `Focal point x must be between 0 and 1 (received ${x})`;
108
+ }
109
+ if (y < 0 || y > 1) {
110
+ return `Focal point y must be between 0 and 1 (received ${y})`;
111
+ }
112
+ return true;
113
+ };
89
114
  var MediaCollection = defineCollection({
90
115
  slug: "media",
91
116
  labels: {
@@ -140,6 +165,14 @@ var MediaCollection = defineCollection({
140
165
  json("focalPoint", {
141
166
  label: "Focal Point",
142
167
  description: "Focal point coordinates for image cropping",
168
+ validate: validateFocalPoint,
169
+ admin: {
170
+ hidden: true
171
+ }
172
+ }),
173
+ json("sizes", {
174
+ label: "Image Sizes",
175
+ description: "Generated image size variants",
143
176
  admin: {
144
177
  hidden: true
145
178
  }
@@ -48,6 +48,31 @@ function json(name, options = {}) {
48
48
  }
49
49
 
50
50
  // libs/core/src/lib/collections/media.collection.ts
51
+ var validateFocalPoint = (value) => {
52
+ if (value === null || value === void 0)
53
+ return true;
54
+ if (typeof value !== "object" || Array.isArray(value)) {
55
+ return "Focal point must be an object with x and y coordinates";
56
+ }
57
+ const fp = Object.fromEntries(Object.entries(value));
58
+ if (!("x" in fp) || !("y" in fp)) {
59
+ return "Focal point must have both x and y properties";
60
+ }
61
+ const { x, y } = fp;
62
+ if (typeof x !== "number" || !Number.isFinite(x)) {
63
+ return "Focal point x must be a finite number";
64
+ }
65
+ if (typeof y !== "number" || !Number.isFinite(y)) {
66
+ return "Focal point y must be a finite number";
67
+ }
68
+ if (x < 0 || x > 1) {
69
+ return `Focal point x must be between 0 and 1 (received ${x})`;
70
+ }
71
+ if (y < 0 || y > 1) {
72
+ return `Focal point y must be between 0 and 1 (received ${y})`;
73
+ }
74
+ return true;
75
+ };
51
76
  var MediaCollection = defineCollection({
52
77
  slug: "media",
53
78
  labels: {
@@ -102,6 +127,14 @@ var MediaCollection = defineCollection({
102
127
  json("focalPoint", {
103
128
  label: "Focal Point",
104
129
  description: "Focal point coordinates for image cropping",
130
+ validate: validateFocalPoint,
131
+ admin: {
132
+ hidden: true
133
+ }
134
+ }),
135
+ json("sizes", {
136
+ label: "Image Sizes",
137
+ description: "Generated image size variants",
105
138
  admin: {
106
139
  hidden: true
107
140
  }
@@ -46,6 +46,31 @@ function json(name, options = {}) {
46
46
  }
47
47
 
48
48
  // libs/core/src/lib/collections/media.collection.ts
49
+ var validateFocalPoint = (value) => {
50
+ if (value === null || value === void 0)
51
+ return true;
52
+ if (typeof value !== "object" || Array.isArray(value)) {
53
+ return "Focal point must be an object with x and y coordinates";
54
+ }
55
+ const fp = Object.fromEntries(Object.entries(value));
56
+ if (!("x" in fp) || !("y" in fp)) {
57
+ return "Focal point must have both x and y properties";
58
+ }
59
+ const { x, y } = fp;
60
+ if (typeof x !== "number" || !Number.isFinite(x)) {
61
+ return "Focal point x must be a finite number";
62
+ }
63
+ if (typeof y !== "number" || !Number.isFinite(y)) {
64
+ return "Focal point y must be a finite number";
65
+ }
66
+ if (x < 0 || x > 1) {
67
+ return `Focal point x must be between 0 and 1 (received ${x})`;
68
+ }
69
+ if (y < 0 || y > 1) {
70
+ return `Focal point y must be between 0 and 1 (received ${y})`;
71
+ }
72
+ return true;
73
+ };
49
74
  var MediaCollection = defineCollection({
50
75
  slug: "media",
51
76
  labels: {
@@ -100,6 +125,14 @@ var MediaCollection = defineCollection({
100
125
  json("focalPoint", {
101
126
  label: "Focal Point",
102
127
  description: "Focal point coordinates for image cropping",
128
+ validate: validateFocalPoint,
129
+ admin: {
130
+ hidden: true
131
+ }
132
+ }),
133
+ json("sizes", {
134
+ label: "Image Sizes",
135
+ description: "Generated image size variants",
103
136
  admin: {
104
137
  hidden: true
105
138
  }
package/src/cli/run.cjs CHANGED
@@ -48,6 +48,31 @@ function json(name, options = {}) {
48
48
  }
49
49
 
50
50
  // libs/core/src/lib/collections/media.collection.ts
51
+ var validateFocalPoint = (value) => {
52
+ if (value === null || value === void 0)
53
+ return true;
54
+ if (typeof value !== "object" || Array.isArray(value)) {
55
+ return "Focal point must be an object with x and y coordinates";
56
+ }
57
+ const fp = Object.fromEntries(Object.entries(value));
58
+ if (!("x" in fp) || !("y" in fp)) {
59
+ return "Focal point must have both x and y properties";
60
+ }
61
+ const { x, y } = fp;
62
+ if (typeof x !== "number" || !Number.isFinite(x)) {
63
+ return "Focal point x must be a finite number";
64
+ }
65
+ if (typeof y !== "number" || !Number.isFinite(y)) {
66
+ return "Focal point y must be a finite number";
67
+ }
68
+ if (x < 0 || x > 1) {
69
+ return `Focal point x must be between 0 and 1 (received ${x})`;
70
+ }
71
+ if (y < 0 || y > 1) {
72
+ return `Focal point y must be between 0 and 1 (received ${y})`;
73
+ }
74
+ return true;
75
+ };
51
76
  var MediaCollection = defineCollection({
52
77
  slug: "media",
53
78
  labels: {
@@ -102,6 +127,14 @@ var MediaCollection = defineCollection({
102
127
  json("focalPoint", {
103
128
  label: "Focal Point",
104
129
  description: "Focal point coordinates for image cropping",
130
+ validate: validateFocalPoint,
131
+ admin: {
132
+ hidden: true
133
+ }
134
+ }),
135
+ json("sizes", {
136
+ label: "Image Sizes",
137
+ description: "Generated image size variants",
105
138
  admin: {
106
139
  hidden: true
107
140
  }
package/src/cli/run.js CHANGED
@@ -54,6 +54,31 @@ function json(name, options = {}) {
54
54
  }
55
55
 
56
56
  // libs/core/src/lib/collections/media.collection.ts
57
+ var validateFocalPoint = (value) => {
58
+ if (value === null || value === void 0)
59
+ return true;
60
+ if (typeof value !== "object" || Array.isArray(value)) {
61
+ return "Focal point must be an object with x and y coordinates";
62
+ }
63
+ const fp = Object.fromEntries(Object.entries(value));
64
+ if (!("x" in fp) || !("y" in fp)) {
65
+ return "Focal point must have both x and y properties";
66
+ }
67
+ const { x, y } = fp;
68
+ if (typeof x !== "number" || !Number.isFinite(x)) {
69
+ return "Focal point x must be a finite number";
70
+ }
71
+ if (typeof y !== "number" || !Number.isFinite(y)) {
72
+ return "Focal point y must be a finite number";
73
+ }
74
+ if (x < 0 || x > 1) {
75
+ return `Focal point x must be between 0 and 1 (received ${x})`;
76
+ }
77
+ if (y < 0 || y > 1) {
78
+ return `Focal point y must be between 0 and 1 (received ${y})`;
79
+ }
80
+ return true;
81
+ };
57
82
  var MediaCollection = defineCollection({
58
83
  slug: "media",
59
84
  labels: {
@@ -108,6 +133,14 @@ var MediaCollection = defineCollection({
108
133
  json("focalPoint", {
109
134
  label: "Focal Point",
110
135
  description: "Focal point coordinates for image cropping",
136
+ validate: validateFocalPoint,
137
+ admin: {
138
+ hidden: true
139
+ }
140
+ }),
141
+ json("sizes", {
142
+ label: "Image Sizes",
143
+ description: "Generated image size variants",
111
144
  admin: {
112
145
  hidden: true
113
146
  }
@@ -48,6 +48,31 @@ function json(name, options = {}) {
48
48
  }
49
49
 
50
50
  // libs/core/src/lib/collections/media.collection.ts
51
+ var validateFocalPoint = (value) => {
52
+ if (value === null || value === void 0)
53
+ return true;
54
+ if (typeof value !== "object" || Array.isArray(value)) {
55
+ return "Focal point must be an object with x and y coordinates";
56
+ }
57
+ const fp = Object.fromEntries(Object.entries(value));
58
+ if (!("x" in fp) || !("y" in fp)) {
59
+ return "Focal point must have both x and y properties";
60
+ }
61
+ const { x, y } = fp;
62
+ if (typeof x !== "number" || !Number.isFinite(x)) {
63
+ return "Focal point x must be a finite number";
64
+ }
65
+ if (typeof y !== "number" || !Number.isFinite(y)) {
66
+ return "Focal point y must be a finite number";
67
+ }
68
+ if (x < 0 || x > 1) {
69
+ return `Focal point x must be between 0 and 1 (received ${x})`;
70
+ }
71
+ if (y < 0 || y > 1) {
72
+ return `Focal point y must be between 0 and 1 (received ${y})`;
73
+ }
74
+ return true;
75
+ };
51
76
  var MediaCollection = defineCollection({
52
77
  slug: "media",
53
78
  labels: {
@@ -102,6 +127,14 @@ var MediaCollection = defineCollection({
102
127
  json("focalPoint", {
103
128
  label: "Focal Point",
104
129
  description: "Focal point coordinates for image cropping",
130
+ validate: validateFocalPoint,
131
+ admin: {
132
+ hidden: true
133
+ }
134
+ }),
135
+ json("sizes", {
136
+ label: "Image Sizes",
137
+ description: "Generated image size variants",
105
138
  admin: {
106
139
  hidden: true
107
140
  }
package/src/cli/status.js CHANGED
@@ -46,6 +46,31 @@ function json(name, options = {}) {
46
46
  }
47
47
 
48
48
  // libs/core/src/lib/collections/media.collection.ts
49
+ var validateFocalPoint = (value) => {
50
+ if (value === null || value === void 0)
51
+ return true;
52
+ if (typeof value !== "object" || Array.isArray(value)) {
53
+ return "Focal point must be an object with x and y coordinates";
54
+ }
55
+ const fp = Object.fromEntries(Object.entries(value));
56
+ if (!("x" in fp) || !("y" in fp)) {
57
+ return "Focal point must have both x and y properties";
58
+ }
59
+ const { x, y } = fp;
60
+ if (typeof x !== "number" || !Number.isFinite(x)) {
61
+ return "Focal point x must be a finite number";
62
+ }
63
+ if (typeof y !== "number" || !Number.isFinite(y)) {
64
+ return "Focal point y must be a finite number";
65
+ }
66
+ if (x < 0 || x > 1) {
67
+ return `Focal point x must be between 0 and 1 (received ${x})`;
68
+ }
69
+ if (y < 0 || y > 1) {
70
+ return `Focal point y must be between 0 and 1 (received ${y})`;
71
+ }
72
+ return true;
73
+ };
49
74
  var MediaCollection = defineCollection({
50
75
  slug: "media",
51
76
  labels: {
@@ -100,6 +125,14 @@ var MediaCollection = defineCollection({
100
125
  json("focalPoint", {
101
126
  label: "Focal Point",
102
127
  description: "Focal point coordinates for image cropping",
128
+ validate: validateFocalPoint,
129
+ admin: {
130
+ hidden: true
131
+ }
132
+ }),
133
+ json("sizes", {
134
+ label: "Image Sizes",
135
+ description: "Generated image size variants",
103
136
  admin: {
104
137
  hidden: true
105
138
  }
package/src/index.cjs CHANGED
@@ -528,6 +528,31 @@ function json(name, options = {}) {
528
528
  }
529
529
 
530
530
  // libs/core/src/lib/collections/media.collection.ts
531
+ var validateFocalPoint = (value) => {
532
+ if (value === null || value === void 0)
533
+ return true;
534
+ if (typeof value !== "object" || Array.isArray(value)) {
535
+ return "Focal point must be an object with x and y coordinates";
536
+ }
537
+ const fp = Object.fromEntries(Object.entries(value));
538
+ if (!("x" in fp) || !("y" in fp)) {
539
+ return "Focal point must have both x and y properties";
540
+ }
541
+ const { x, y } = fp;
542
+ if (typeof x !== "number" || !Number.isFinite(x)) {
543
+ return "Focal point x must be a finite number";
544
+ }
545
+ if (typeof y !== "number" || !Number.isFinite(y)) {
546
+ return "Focal point y must be a finite number";
547
+ }
548
+ if (x < 0 || x > 1) {
549
+ return `Focal point x must be between 0 and 1 (received ${x})`;
550
+ }
551
+ if (y < 0 || y > 1) {
552
+ return `Focal point y must be between 0 and 1 (received ${y})`;
553
+ }
554
+ return true;
555
+ };
531
556
  var MediaCollection = defineCollection({
532
557
  slug: "media",
533
558
  labels: {
@@ -582,6 +607,14 @@ var MediaCollection = defineCollection({
582
607
  json("focalPoint", {
583
608
  label: "Focal Point",
584
609
  description: "Focal point coordinates for image cropping",
610
+ validate: validateFocalPoint,
611
+ admin: {
612
+ hidden: true
613
+ }
614
+ }),
615
+ json("sizes", {
616
+ label: "Image Sizes",
617
+ description: "Generated image size variants",
585
618
  admin: {
586
619
  hidden: true
587
620
  }
package/src/index.js CHANGED
@@ -463,6 +463,31 @@ function json(name, options = {}) {
463
463
  }
464
464
 
465
465
  // libs/core/src/lib/collections/media.collection.ts
466
+ var validateFocalPoint = (value) => {
467
+ if (value === null || value === void 0)
468
+ return true;
469
+ if (typeof value !== "object" || Array.isArray(value)) {
470
+ return "Focal point must be an object with x and y coordinates";
471
+ }
472
+ const fp = Object.fromEntries(Object.entries(value));
473
+ if (!("x" in fp) || !("y" in fp)) {
474
+ return "Focal point must have both x and y properties";
475
+ }
476
+ const { x, y } = fp;
477
+ if (typeof x !== "number" || !Number.isFinite(x)) {
478
+ return "Focal point x must be a finite number";
479
+ }
480
+ if (typeof y !== "number" || !Number.isFinite(y)) {
481
+ return "Focal point y must be a finite number";
482
+ }
483
+ if (x < 0 || x > 1) {
484
+ return `Focal point x must be between 0 and 1 (received ${x})`;
485
+ }
486
+ if (y < 0 || y > 1) {
487
+ return `Focal point y must be between 0 and 1 (received ${y})`;
488
+ }
489
+ return true;
490
+ };
466
491
  var MediaCollection = defineCollection({
467
492
  slug: "media",
468
493
  labels: {
@@ -517,6 +542,14 @@ var MediaCollection = defineCollection({
517
542
  json("focalPoint", {
518
543
  label: "Focal Point",
519
544
  description: "Focal point coordinates for image cropping",
545
+ validate: validateFocalPoint,
546
+ admin: {
547
+ hidden: true
548
+ }
549
+ }),
550
+ json("sizes", {
551
+ label: "Image Sizes",
552
+ description: "Generated image size variants",
520
553
  admin: {
521
554
  hidden: true
522
555
  }