@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.
- package/{decorator_utils-1yWqd_Gg.cjs → decorator_utils-U_rZo8tv.cjs} +47 -3
- package/decorator_utils-U_rZo8tv.cjs.map +1 -0
- package/{decorator_utils-BUuBwQYK.js → decorator_utils-YSb1EGJ6.js} +50 -4
- package/decorator_utils-YSb1EGJ6.js.map +1 -0
- package/index.cjs +131 -85
- package/index.cjs.map +1 -1
- package/index.mjs +120 -74
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/private/decorators.d.ts +2 -2
- package/private/prepare_consume_chain_builder.d.ts +36 -0
- package/private/types.d.ts +3 -0
- package/private/utils.d.ts +4 -0
- package/utils.cjs +1 -1
- package/utils.mjs +2 -2
- package/decorator_utils-1yWqd_Gg.cjs.map +0 -1
- package/decorator_utils-BUuBwQYK.js.map +0 -1
|
@@ -1096,7 +1096,7 @@ function normalizeZone(input, defaultZone2) {
|
|
|
1096
1096
|
return defaultZone2;
|
|
1097
1097
|
} else if (input instanceof Zone) {
|
|
1098
1098
|
return input;
|
|
1099
|
-
} else if (isString(input)) {
|
|
1099
|
+
} else if (isString$1(input)) {
|
|
1100
1100
|
const lowered = input.toLowerCase();
|
|
1101
1101
|
if (lowered === "default") return defaultZone2;
|
|
1102
1102
|
else if (lowered === "local" || lowered === "system") return SystemZone.instance;
|
|
@@ -1492,7 +1492,7 @@ function isNumber(o) {
|
|
|
1492
1492
|
function isInteger(o) {
|
|
1493
1493
|
return typeof o === "number" && o % 1 === 0;
|
|
1494
1494
|
}
|
|
1495
|
-
function isString(o) {
|
|
1495
|
+
function isString$1(o) {
|
|
1496
1496
|
return typeof o === "string";
|
|
1497
1497
|
}
|
|
1498
1498
|
function isDate(o) {
|
|
@@ -6400,6 +6400,43 @@ const type_guards = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
6400
6400
|
isObject,
|
|
6401
6401
|
isResourcefulModel
|
|
6402
6402
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6403
|
+
exports.CRUDOperationsEnum = /* @__PURE__ */ ((CRUDOperationsEnum2) => {
|
|
6404
|
+
CRUDOperationsEnum2["CREATE"] = "create";
|
|
6405
|
+
CRUDOperationsEnum2["READ"] = "read";
|
|
6406
|
+
CRUDOperationsEnum2["LIST"] = "list";
|
|
6407
|
+
CRUDOperationsEnum2["UPDATE"] = "update";
|
|
6408
|
+
CRUDOperationsEnum2["DELETE"] = "delete";
|
|
6409
|
+
return CRUDOperationsEnum2;
|
|
6410
|
+
})(exports.CRUDOperationsEnum || {});
|
|
6411
|
+
exports.ACLOperationsEnum = /* @__PURE__ */ ((ACLOperationsEnum2) => {
|
|
6412
|
+
ACLOperationsEnum2["WRITE"] = "write";
|
|
6413
|
+
ACLOperationsEnum2["READ"] = "read";
|
|
6414
|
+
return ACLOperationsEnum2;
|
|
6415
|
+
})(exports.ACLOperationsEnum || {});
|
|
6416
|
+
const operationCRUDToACL = (operation) => {
|
|
6417
|
+
if (operation === exports.CRUDOperationsEnum.READ || operation === exports.CRUDOperationsEnum.LIST) {
|
|
6418
|
+
return exports.ACLOperationsEnum.READ;
|
|
6419
|
+
}
|
|
6420
|
+
if (operation === exports.CRUDOperationsEnum.CREATE || operation === exports.CRUDOperationsEnum.UPDATE || operation === exports.CRUDOperationsEnum.DELETE) {
|
|
6421
|
+
return exports.ACLOperationsEnum.WRITE;
|
|
6422
|
+
}
|
|
6423
|
+
};
|
|
6424
|
+
const isString = (value) => {
|
|
6425
|
+
return typeof value === "string";
|
|
6426
|
+
};
|
|
6427
|
+
const isFunction = (value) => {
|
|
6428
|
+
return typeof value === "function";
|
|
6429
|
+
};
|
|
6430
|
+
const prepareFields = (fields, primaryKey) => {
|
|
6431
|
+
const defaultValue = [primaryKey];
|
|
6432
|
+
if (Array.isArray(fields)) {
|
|
6433
|
+
return fields.length ? fields : defaultValue;
|
|
6434
|
+
}
|
|
6435
|
+
if (isString(fields)) {
|
|
6436
|
+
return fields.length ? [fields] : defaultValue;
|
|
6437
|
+
}
|
|
6438
|
+
return defaultValue;
|
|
6439
|
+
};
|
|
6403
6440
|
const castValueAsString = (value) => {
|
|
6404
6441
|
if ("string" === typeof value) return value;
|
|
6405
6442
|
if ("number" === typeof value) return value.toString();
|
|
@@ -6733,6 +6770,9 @@ function consumeBoolean(key, value, nullable = false) {
|
|
|
6733
6770
|
function consumeObject(key, value, nullable = false) {
|
|
6734
6771
|
if (value === null && nullable === true) return null;
|
|
6735
6772
|
try {
|
|
6773
|
+
if (isString(value)) {
|
|
6774
|
+
value = JSON.parse(value);
|
|
6775
|
+
}
|
|
6736
6776
|
return castValueAsObject(value);
|
|
6737
6777
|
} catch {
|
|
6738
6778
|
if (true === nullable) {
|
|
@@ -6775,18 +6815,22 @@ exports.consumeNumber = consumeNumber;
|
|
|
6775
6815
|
exports.consumeObject = consumeObject;
|
|
6776
6816
|
exports.consumeString = consumeString;
|
|
6777
6817
|
exports.consumeUnsignedint = consumeUnsignedint;
|
|
6818
|
+
exports.isFunction = isFunction;
|
|
6778
6819
|
exports.isObject = isObject;
|
|
6779
6820
|
exports.isResourcefulModel = isResourcefulModel;
|
|
6821
|
+
exports.isString = isString;
|
|
6822
|
+
exports.operationCRUDToACL = operationCRUDToACL;
|
|
6780
6823
|
exports.prepareArray = prepareArray;
|
|
6781
6824
|
exports.prepareBigint = prepareBigint;
|
|
6782
6825
|
exports.prepareBinary = prepareBinary;
|
|
6783
6826
|
exports.prepareBoolean = prepareBoolean;
|
|
6784
6827
|
exports.prepareDate = prepareDate;
|
|
6785
6828
|
exports.prepareDateTime = prepareDateTime;
|
|
6829
|
+
exports.prepareFields = prepareFields;
|
|
6786
6830
|
exports.prepareInteger = prepareInteger;
|
|
6787
6831
|
exports.prepareNumber = prepareNumber;
|
|
6788
6832
|
exports.prepareObject = prepareObject;
|
|
6789
6833
|
exports.prepareString = prepareString;
|
|
6790
6834
|
exports.prepareUnsignedint = prepareUnsignedint;
|
|
6791
6835
|
exports.type_guards = type_guards;
|
|
6792
|
-
//# sourceMappingURL=decorator_utils-
|
|
6836
|
+
//# sourceMappingURL=decorator_utils-U_rZo8tv.cjs.map
|