@nhtio/lucid-resourceful 1.20250718.0 → 1.20250718.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.
@@ -1095,7 +1095,7 @@ function normalizeZone(input, defaultZone2) {
1095
1095
  return defaultZone2;
1096
1096
  } else if (input instanceof Zone) {
1097
1097
  return input;
1098
- } else if (isString(input)) {
1098
+ } else if (isString$1(input)) {
1099
1099
  const lowered = input.toLowerCase();
1100
1100
  if (lowered === "default") return defaultZone2;
1101
1101
  else if (lowered === "local" || lowered === "system") return SystemZone.instance;
@@ -1491,7 +1491,7 @@ function isNumber(o) {
1491
1491
  function isInteger(o) {
1492
1492
  return typeof o === "number" && o % 1 === 0;
1493
1493
  }
1494
- function isString(o) {
1494
+ function isString$1(o) {
1495
1495
  return typeof o === "string";
1496
1496
  }
1497
1497
  function isDate(o) {
@@ -6399,6 +6399,43 @@ const type_guards = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
6399
6399
  isObject,
6400
6400
  isResourcefulModel
6401
6401
  }, Symbol.toStringTag, { value: "Module" }));
6402
+ var CRUDOperationsEnum = /* @__PURE__ */ ((CRUDOperationsEnum2) => {
6403
+ CRUDOperationsEnum2["CREATE"] = "create";
6404
+ CRUDOperationsEnum2["READ"] = "read";
6405
+ CRUDOperationsEnum2["LIST"] = "list";
6406
+ CRUDOperationsEnum2["UPDATE"] = "update";
6407
+ CRUDOperationsEnum2["DELETE"] = "delete";
6408
+ return CRUDOperationsEnum2;
6409
+ })(CRUDOperationsEnum || {});
6410
+ var ACLOperationsEnum = /* @__PURE__ */ ((ACLOperationsEnum2) => {
6411
+ ACLOperationsEnum2["WRITE"] = "write";
6412
+ ACLOperationsEnum2["READ"] = "read";
6413
+ return ACLOperationsEnum2;
6414
+ })(ACLOperationsEnum || {});
6415
+ const operationCRUDToACL = (operation) => {
6416
+ if (operation === CRUDOperationsEnum.READ || operation === CRUDOperationsEnum.LIST) {
6417
+ return ACLOperationsEnum.READ;
6418
+ }
6419
+ if (operation === CRUDOperationsEnum.CREATE || operation === CRUDOperationsEnum.UPDATE || operation === CRUDOperationsEnum.DELETE) {
6420
+ return ACLOperationsEnum.WRITE;
6421
+ }
6422
+ };
6423
+ const isString = (value) => {
6424
+ return typeof value === "string";
6425
+ };
6426
+ const isFunction = (value) => {
6427
+ return typeof value === "function";
6428
+ };
6429
+ const prepareFields = (fields, primaryKey) => {
6430
+ const defaultValue = [primaryKey];
6431
+ if (Array.isArray(fields)) {
6432
+ return fields.length ? fields : defaultValue;
6433
+ }
6434
+ if (isString(fields)) {
6435
+ return fields.length ? [fields] : defaultValue;
6436
+ }
6437
+ return defaultValue;
6438
+ };
6402
6439
  const castValueAsString = (value) => {
6403
6440
  if ("string" === typeof value) return value;
6404
6441
  if ("number" === typeof value) return value.toString();
@@ -6732,6 +6769,9 @@ function consumeBoolean(key, value, nullable = false) {
6732
6769
  function consumeObject(key, value, nullable = false) {
6733
6770
  if (value === null && nullable === true) return null;
6734
6771
  try {
6772
+ if (isString(value)) {
6773
+ value = JSON.parse(value);
6774
+ }
6735
6775
  return castValueAsObject(value);
6736
6776
  } catch {
6737
6777
  if (true === nullable) {
@@ -6762,7 +6802,13 @@ export {
6762
6802
  type_guards as H,
6763
6803
  isObject as I,
6764
6804
  isResourcefulModel as J,
6765
- DateTime as K,
6805
+ CRUDOperationsEnum as K,
6806
+ operationCRUDToACL as L,
6807
+ ACLOperationsEnum as M,
6808
+ isFunction as N,
6809
+ prepareFields as O,
6810
+ isString as P,
6811
+ DateTime as Q,
6766
6812
  castValueAsBigint as a,
6767
6813
  castValueAsBinary as b,
6768
6814
  castValueAsArray as c,
@@ -6790,4 +6836,4 @@ export {
6790
6836
  consumeBinary as y,
6791
6837
  consumeBoolean as z
6792
6838
  };
6793
- //# sourceMappingURL=decorator_utils-BUuBwQYK.js.map
6839
+ //# sourceMappingURL=decorator_utils-YSb1EGJ6.js.map