@momentumcms/auth 0.5.1 → 0.5.3

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.
Files changed (3) hide show
  1. package/index.cjs +33 -0
  2. package/index.js +33 -0
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -1939,6 +1939,31 @@ function json(name, options = {}) {
1939
1939
  }
1940
1940
 
1941
1941
  // libs/core/src/lib/collections/media.collection.ts
1942
+ var validateFocalPoint = (value) => {
1943
+ if (value === null || value === void 0)
1944
+ return true;
1945
+ if (typeof value !== "object" || Array.isArray(value)) {
1946
+ return "Focal point must be an object with x and y coordinates";
1947
+ }
1948
+ const fp = Object.fromEntries(Object.entries(value));
1949
+ if (!("x" in fp) || !("y" in fp)) {
1950
+ return "Focal point must have both x and y properties";
1951
+ }
1952
+ const { x, y } = fp;
1953
+ if (typeof x !== "number" || !Number.isFinite(x)) {
1954
+ return "Focal point x must be a finite number";
1955
+ }
1956
+ if (typeof y !== "number" || !Number.isFinite(y)) {
1957
+ return "Focal point y must be a finite number";
1958
+ }
1959
+ if (x < 0 || x > 1) {
1960
+ return `Focal point x must be between 0 and 1 (received ${x})`;
1961
+ }
1962
+ if (y < 0 || y > 1) {
1963
+ return `Focal point y must be between 0 and 1 (received ${y})`;
1964
+ }
1965
+ return true;
1966
+ };
1942
1967
  var MediaCollection = defineCollection({
1943
1968
  slug: "media",
1944
1969
  labels: {
@@ -1993,6 +2018,14 @@ var MediaCollection = defineCollection({
1993
2018
  json("focalPoint", {
1994
2019
  label: "Focal Point",
1995
2020
  description: "Focal point coordinates for image cropping",
2021
+ validate: validateFocalPoint,
2022
+ admin: {
2023
+ hidden: true
2024
+ }
2025
+ }),
2026
+ json("sizes", {
2027
+ label: "Image Sizes",
2028
+ description: "Generated image size variants",
1996
2029
  admin: {
1997
2030
  hidden: true
1998
2031
  }
package/index.js CHANGED
@@ -1894,6 +1894,31 @@ function json(name, options = {}) {
1894
1894
  }
1895
1895
 
1896
1896
  // libs/core/src/lib/collections/media.collection.ts
1897
+ var validateFocalPoint = (value) => {
1898
+ if (value === null || value === void 0)
1899
+ return true;
1900
+ if (typeof value !== "object" || Array.isArray(value)) {
1901
+ return "Focal point must be an object with x and y coordinates";
1902
+ }
1903
+ const fp = Object.fromEntries(Object.entries(value));
1904
+ if (!("x" in fp) || !("y" in fp)) {
1905
+ return "Focal point must have both x and y properties";
1906
+ }
1907
+ const { x, y } = fp;
1908
+ if (typeof x !== "number" || !Number.isFinite(x)) {
1909
+ return "Focal point x must be a finite number";
1910
+ }
1911
+ if (typeof y !== "number" || !Number.isFinite(y)) {
1912
+ return "Focal point y must be a finite number";
1913
+ }
1914
+ if (x < 0 || x > 1) {
1915
+ return `Focal point x must be between 0 and 1 (received ${x})`;
1916
+ }
1917
+ if (y < 0 || y > 1) {
1918
+ return `Focal point y must be between 0 and 1 (received ${y})`;
1919
+ }
1920
+ return true;
1921
+ };
1897
1922
  var MediaCollection = defineCollection({
1898
1923
  slug: "media",
1899
1924
  labels: {
@@ -1948,6 +1973,14 @@ var MediaCollection = defineCollection({
1948
1973
  json("focalPoint", {
1949
1974
  label: "Focal Point",
1950
1975
  description: "Focal point coordinates for image cropping",
1976
+ validate: validateFocalPoint,
1977
+ admin: {
1978
+ hidden: true
1979
+ }
1980
+ }),
1981
+ json("sizes", {
1982
+ label: "Image Sizes",
1983
+ description: "Generated image size variants",
1951
1984
  admin: {
1952
1985
  hidden: true
1953
1986
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentumcms/auth",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Better Auth integration for Momentum CMS",
5
5
  "license": "MIT",
6
6
  "author": "Momentum CMS Contributors",
@@ -28,7 +28,7 @@
28
28
  "peerDependencies": {
29
29
  "@angular/core": ">=19.0.0",
30
30
  "@momentumcms/core": ">=0.0.1",
31
- "@momentumcms/email": ">=0.5.1",
31
+ "@momentumcms/email": ">=0.5.3",
32
32
  "@momentumcms/logger": ">=0.0.1",
33
33
  "better-auth": "^1.4.0",
34
34
  "better-sqlite3": "^12.0.0",