@niscorp/prism 0.3.0 → 0.3.1

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { MAPPING_OPS, getConfigJsonSchema, getNodeJsonSchema, getProfileJsonSchema } from './chunk-BKXCULZV.js';
2
- import { PrismError, ErrorCode, ConfigSchema, isWithNode, isRenameKeysNode, isConstNode, isSumNode, isAvgNode, isCountNode, isMinNode, isMaxNode, isPluckNode, isTakeNode, isDropNode, isMatchNode, isFlatMapNode, isJsonObject, isRefNode, parseJsonPath, isVarNode, isPlainObject, OPTIONAL_FIELDS_KEY, isGetNode, isMapNode, isFilterNode, isReduceNode, isSliceNode, isFlattenNode, isUniqueNode, isSortByNode, isAddNode, isSubNode, isMulNode, isDivNode, isRoundNode, isModNode, isToNumberNode, isJoinNode, isToStringNode, isInterpolateNode, isFillNode, isTrimNode, isLowerNode, isUpperNode, isSplitNode, isReplaceNode, isEqNode, isNeqNode, isGtNode, isGteNode, isLtNode, isLteNode, isEmptyNode, isStartsWithNode, isEndsWithNode, isContainsNode, isNotNode, isAndNode, isOrNode, isMergeNode, isCoalesceNode, isCaseNode, isEntriesOfNode, isKeyByNode, isGroupByNode, isKeysNode, isValuesNode, isFromEntriesNode, isPickNode, isOmitNode, isTypeNode, isLengthNode, isHasNode, isUpdateNode, isAssertNode, isWalkNode, isDateNode, isDateAddNode, isDateDiffNode, isLocaleDateNode, isLocaleMoneyNode, isLocaleNumberNode, parseJsonPathCached, getByPath, isJsonArray } from './chunk-7VMFSXBM.js';
3
- export { ConfigSchema, ErrorCode, NodeSchema, OP_KEYS, PrismError } from './chunk-7VMFSXBM.js';
1
+ export { MAPPING_OPS, getConfigJsonSchema, getNodeJsonSchema, getProfileJsonSchema } from './chunk-GK4CIKKT.js';
2
+ import { PrismError, ErrorCode, ConfigSchema, isWithNode, isRenameKeysNode, isConstNode, isSumNode, isAvgNode, isCountNode, isMinNode, isMaxNode, isPluckNode, isTakeNode, isDropNode, isMatchNode, isFlatMapNode, isJsonObject, isRefNode, parseJsonPath, isVarNode, isPlainObject, OPTIONAL_FIELDS_KEY, isGetNode, isMapNode, isFilterNode, isReduceNode, isSliceNode, isFlattenNode, isUniqueNode, isSortByNode, isAddNode, isSubNode, isMulNode, isDivNode, isRoundNode, isModNode, isToNumberNode, isJoinNode, isToStringNode, isInterpolateNode, isFillNode, isTrimNode, isLowerNode, isUpperNode, isSplitNode, isReplaceNode, isEqNode, isNeqNode, isGtNode, isGteNode, isLtNode, isLteNode, isEmptyNode, isStartsWithNode, isEndsWithNode, isContainsNode, isNotNode, isAndNode, isOrNode, isMergeNode, isCoalesceNode, isCaseNode, isEntriesOfNode, isKeyByNode, isGroupByNode, isKeysNode, isValuesNode, isFromEntriesNode, isPickNode, isOmitNode, isTypeNode, isLengthNode, isHasNode, isUpdateNode, isAssertNode, isWalkNode, isDateNode, isDateAddNode, isDateDiffNode, isLocaleDateNode, isLocaleMoneyNode, isLocaleNumberNode, parseJsonPathCached, getByPath, isJsonArray } from './chunk-WKS4OCKN.js';
3
+ export { ConfigSchema, ErrorCode, NodeSchema, OP_KEYS, PrismError } from './chunk-WKS4OCKN.js';
4
4
  import { exceedsDepth, depthRefusal } from '@niscorp/strata';
5
5
  import dayjs from 'dayjs';
6
6
  import utc from 'dayjs/plugin/utc.js';
@@ -933,7 +933,6 @@ var attachNonEnumerable = (target, key, value) => {
933
933
  configurable: true
934
934
  });
935
935
  };
936
- var isPlainObject2 = (value) => isJsonObject(value);
937
936
  var freezeConstant = (value) => {
938
937
  if (value === null || typeof value !== "object" || Object.isFrozen(value)) return;
939
938
  Object.freeze(value);
@@ -1012,7 +1011,7 @@ var isFoldableLiteral = (node) => {
1012
1011
  const t = typeof node;
1013
1012
  if (t === "string" || t === "number" || t === "boolean") return true;
1014
1013
  if (Array.isArray(node)) return node.every(isFoldableLiteral);
1015
- if (!isPlainObject2(node)) return false;
1014
+ if (!isJsonObject(node)) return false;
1016
1015
  if (isConstNode(node)) return isFoldableLiteral(node.$const);
1017
1016
  if (Object.keys(node).some((k) => k.startsWith("$"))) return false;
1018
1017
  return Object.values(node).every(isFoldableLiteral);
@@ -1025,7 +1024,7 @@ var optimizeNode = (node, stats, evaluate2) => {
1025
1024
  for (const child of node) out.push(optimizeNode(child, stats, evaluate2));
1026
1025
  return out;
1027
1026
  }
1028
- if (!isPlainObject2(node)) return node;
1027
+ if (!isJsonObject(node)) return node;
1029
1028
  if (isConstNode(node)) {
1030
1029
  const literal = { ...node };
1031
1030
  freezeConstant(literal["$const"]);
@@ -1088,7 +1087,7 @@ var annotateNode = (node) => {
1088
1087
  for (const child of node) annotateNode(child);
1089
1088
  return;
1090
1089
  }
1091
- if (!isPlainObject2(node)) return;
1090
+ if (!isJsonObject(node)) return;
1092
1091
  if (isWithNode(node)) {
1093
1092
  for (const value of Object.values(node.$with.let)) annotateNode(value);
1094
1093
  annotateNode(node.$with.value);
@@ -1362,8 +1361,6 @@ var validate = (config) => {
1362
1361
  if (!parsed.success) {
1363
1362
  return {
1364
1363
  ok: false,
1365
- // The branch the config meant, with its full path — not the root union's
1366
- // "Invalid input" (see utils/issues).
1367
1364
  issues: explainIssues(parsed.error.issues)
1368
1365
  };
1369
1366
  }