graphddb 0.2.0 → 0.2.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.
@@ -525,6 +525,51 @@ var TableMapping = class {
525
525
  }
526
526
  };
527
527
 
528
+ // src/define/param.ts
529
+ function makeParam(kind, literals) {
530
+ return literals === void 0 ? { kind } : { kind, literals };
531
+ }
532
+ var param = {
533
+ /** A placeholder for a `string` value. */
534
+ string() {
535
+ return makeParam("string");
536
+ },
537
+ /** A placeholder for a `number` value. */
538
+ number() {
539
+ return makeParam("number");
540
+ },
541
+ /**
542
+ * A placeholder constrained to one of the given literal values. The value
543
+ * type of the resulting {@link Param} is the **union of the literals**, so it
544
+ * is preserved precisely in the IR and the inferred definition types.
545
+ *
546
+ * @example
547
+ * ```ts
548
+ * param.literal('active', 'disabled'); // Param<'active' | 'disabled'>
549
+ * ```
550
+ */
551
+ literal(...values) {
552
+ return makeParam("literal", values);
553
+ },
554
+ /**
555
+ * A placeholder for an **array** parameter whose elements have the given field
556
+ * shape. Used by `defineTransaction`'s `tx.forEach(p.<arrayParam>, …)` to bind
557
+ * each element's fields to `{item.<field>}` templates.
558
+ *
559
+ * @example
560
+ * ```ts
561
+ * param.array({ userId: param.string(), role: param.string() });
562
+ * // Param<{ userId: string; role: string }[]>
563
+ * ```
564
+ */
565
+ array(element) {
566
+ return { kind: "array", element };
567
+ }
568
+ };
569
+ function isParam(value) {
570
+ return typeof value === "object" && value !== null && "kind" in value && (value.kind === "string" || value.kind === "number" || value.kind === "literal" || value.kind === "array");
571
+ }
572
+
528
573
  // src/client/lib-dynamodb.ts
529
574
  var cached = null;
530
575
  async function loadLibDynamoDB() {
@@ -825,20 +870,20 @@ async function executeQuery(docClient, operation) {
825
870
  };
826
871
  for (let i = 0; i < keyEntries.length; i++) {
827
872
  const [attrName, value] = keyEntries[i];
828
- const nameAlias = `#k${i}`;
829
- const valueAlias = `:k${i}`;
830
- exprAttrNames[nameAlias] = attrName;
831
- exprAttrValues[valueAlias] = value;
832
- conditionParts.push(`${nameAlias} = ${valueAlias}`);
873
+ const nameAlias2 = `#k${i}`;
874
+ const valueAlias2 = `:k${i}`;
875
+ exprAttrNames[nameAlias2] = attrName;
876
+ exprAttrValues[valueAlias2] = value;
877
+ conditionParts.push(`${nameAlias2} = ${valueAlias2}`);
833
878
  }
834
879
  if (operation.rangeCondition) {
835
880
  const rc = operation.rangeCondition;
836
881
  const idx = keyEntries.length;
837
- const nameAlias = `#k${idx}`;
838
- const valueAlias = `:k${idx}`;
839
- exprAttrNames[nameAlias] = rc.key;
840
- exprAttrValues[valueAlias] = rc.value;
841
- conditionParts.push(`begins_with(${nameAlias}, ${valueAlias})`);
882
+ const nameAlias2 = `#k${idx}`;
883
+ const valueAlias2 = `:k${idx}`;
884
+ exprAttrNames[nameAlias2] = rc.key;
885
+ exprAttrValues[valueAlias2] = rc.value;
886
+ conditionParts.push(`begins_with(${nameAlias2}, ${valueAlias2})`);
842
887
  }
843
888
  const cmd = new QueryCommand({
844
889
  TableName: operation.tableName,
@@ -860,14 +905,290 @@ async function executeQuery(docClient, operation) {
860
905
  };
861
906
  }
862
907
 
908
+ // src/select/cond.ts
909
+ var RAW_COND = /* @__PURE__ */ Symbol.for("graphddb.rawCond");
910
+ function isRawCondition(value) {
911
+ return typeof value === "object" && value !== null && value[RAW_COND] === true;
912
+ }
913
+ function cond(template, ...parts) {
914
+ return {
915
+ [RAW_COND]: true,
916
+ template,
917
+ parts
918
+ };
919
+ }
920
+ function compileRawCondition(raw, allocName, allocValue) {
921
+ let out = raw.template[0];
922
+ for (let i = 0; i < raw.parts.length; i++) {
923
+ const part = raw.parts[i];
924
+ if (isColumn(part)) {
925
+ out += allocName(part.name);
926
+ } else {
927
+ out += allocValue(part);
928
+ }
929
+ out += raw.template[i + 1];
930
+ }
931
+ return out;
932
+ }
933
+ function condParamName(index) {
934
+ return `cond_p${index}`;
935
+ }
936
+ function serializeRawCondition(raw, renderSlot) {
937
+ const names = {};
938
+ const values = {};
939
+ let valueCounter = 0;
940
+ let paramIndex = 0;
941
+ const nameAlias2 = (column) => {
942
+ const alias = `#cr_${column}`;
943
+ names[alias] = column;
944
+ return alias;
945
+ };
946
+ const valueAlias2 = (value) => {
947
+ const alias = `:cr${valueCounter++}`;
948
+ values[alias] = value;
949
+ return alias;
950
+ };
951
+ let out = raw.template[0];
952
+ for (let i = 0; i < raw.parts.length; i++) {
953
+ const part = raw.parts[i];
954
+ if (isColumn(part)) {
955
+ out += nameAlias2(part.name);
956
+ } else {
957
+ const custom = renderSlot?.(part, paramIndex);
958
+ if (custom !== void 0) {
959
+ if (isParam(part)) paramIndex++;
960
+ out += valueAlias2(custom);
961
+ } else if (isParam(part)) {
962
+ out += valueAlias2({ $param: condParamName(paramIndex++) });
963
+ } else if (part instanceof Date) {
964
+ out += valueAlias2(part.toISOString());
965
+ } else {
966
+ out += valueAlias2(part);
967
+ }
968
+ }
969
+ out += raw.template[i + 1];
970
+ }
971
+ return { expression: out, names, values };
972
+ }
973
+ function collectRawConditionParams(raw) {
974
+ const out = [];
975
+ let paramIndex = 0;
976
+ for (const part of raw.parts) {
977
+ if (isColumn(part)) continue;
978
+ if (isParam(part)) {
979
+ out.push({ name: condParamName(paramIndex++), param: part });
980
+ }
981
+ }
982
+ return out;
983
+ }
984
+
863
985
  // src/expression/condition-expression.ts
986
+ var OPERATOR_KEYS = /* @__PURE__ */ new Set([
987
+ "eq",
988
+ "ne",
989
+ "gt",
990
+ "ge",
991
+ "lt",
992
+ "le",
993
+ "between",
994
+ "in",
995
+ "beginsWith",
996
+ "contains",
997
+ "notContains",
998
+ "attributeExists",
999
+ "attributeType",
1000
+ "size"
1001
+ ]);
1002
+ function nameAlias(ctx, field) {
1003
+ const alias = `#cond_${field}`;
1004
+ ctx.names[alias] = field;
1005
+ return alias;
1006
+ }
1007
+ function valueAlias(ctx, value) {
1008
+ const alias = `:cond${ctx.valueCounter.n++}`;
1009
+ ctx.values[alias] = value;
1010
+ return alias;
1011
+ }
1012
+ function isOperatorObject(value) {
1013
+ if (typeof value !== "object" || value === null || Array.isArray(value) || value instanceof Date || value instanceof Uint8Array || value instanceof Set) {
1014
+ return false;
1015
+ }
1016
+ const keys = Object.keys(value);
1017
+ if (keys.length === 0) return false;
1018
+ return keys.every((k2) => OPERATOR_KEYS.has(k2));
1019
+ }
1020
+ function joinAnd(clauses) {
1021
+ if (clauses.length === 1) return clauses[0];
1022
+ return clauses.map((c) => wrap(c)).join(" AND ");
1023
+ }
1024
+ function wrap(expr) {
1025
+ if (isAlreadyWrapped(expr)) return expr;
1026
+ if (expr.includes(" AND ") || expr.includes(" OR ")) return `(${expr})`;
1027
+ return expr;
1028
+ }
1029
+ function isAlreadyWrapped(expr) {
1030
+ if (!expr.startsWith("(") || !expr.endsWith(")")) return false;
1031
+ let depth = 0;
1032
+ for (let i = 0; i < expr.length; i++) {
1033
+ if (expr[i] === "(") depth++;
1034
+ else if (expr[i] === ")") {
1035
+ depth--;
1036
+ if (depth === 0 && i < expr.length - 1) return false;
1037
+ }
1038
+ }
1039
+ return depth === 0;
1040
+ }
1041
+ function compileField(ctx, field, condition) {
1042
+ const n = nameAlias(ctx, field);
1043
+ if (!isOperatorObject(condition)) {
1044
+ return `${n} = ${valueAlias(ctx, condition)}`;
1045
+ }
1046
+ const ops = condition;
1047
+ const clauses = [];
1048
+ for (const [op, value] of Object.entries(ops)) {
1049
+ switch (op) {
1050
+ case "eq":
1051
+ clauses.push(`${n} = ${valueAlias(ctx, value)}`);
1052
+ break;
1053
+ case "ne":
1054
+ clauses.push(`${n} <> ${valueAlias(ctx, value)}`);
1055
+ break;
1056
+ case "gt":
1057
+ clauses.push(`${n} > ${valueAlias(ctx, value)}`);
1058
+ break;
1059
+ case "ge":
1060
+ clauses.push(`${n} >= ${valueAlias(ctx, value)}`);
1061
+ break;
1062
+ case "lt":
1063
+ clauses.push(`${n} < ${valueAlias(ctx, value)}`);
1064
+ break;
1065
+ case "le":
1066
+ clauses.push(`${n} <= ${valueAlias(ctx, value)}`);
1067
+ break;
1068
+ case "between": {
1069
+ const [lo, hi] = value;
1070
+ clauses.push(
1071
+ `${n} BETWEEN ${valueAlias(ctx, lo)} AND ${valueAlias(ctx, hi)}`
1072
+ );
1073
+ break;
1074
+ }
1075
+ case "in": {
1076
+ const aliases = value.map((v) => valueAlias(ctx, v));
1077
+ clauses.push(`${n} IN (${aliases.join(", ")})`);
1078
+ break;
1079
+ }
1080
+ case "beginsWith":
1081
+ clauses.push(`begins_with(${n}, ${valueAlias(ctx, value)})`);
1082
+ break;
1083
+ case "contains":
1084
+ clauses.push(`contains(${n}, ${valueAlias(ctx, value)})`);
1085
+ break;
1086
+ case "notContains":
1087
+ clauses.push(`NOT contains(${n}, ${valueAlias(ctx, value)})`);
1088
+ break;
1089
+ case "attributeExists":
1090
+ clauses.push(
1091
+ value === false ? `attribute_not_exists(${n})` : `attribute_exists(${n})`
1092
+ );
1093
+ break;
1094
+ case "attributeType":
1095
+ clauses.push(`attribute_type(${n}, ${valueAlias(ctx, value)})`);
1096
+ break;
1097
+ case "size":
1098
+ clauses.push(`size(${n}) = ${valueAlias(ctx, value)}`);
1099
+ break;
1100
+ default:
1101
+ throw new Error(`Unknown condition operator '${op}' on field '${field}'`);
1102
+ }
1103
+ }
1104
+ return joinAnd(clauses);
1105
+ }
1106
+ function compileRaw(ctx, raw) {
1107
+ return compileRawCondition(
1108
+ raw,
1109
+ (column) => nameAlias(ctx, column),
1110
+ (value) => valueAlias(ctx, value)
1111
+ );
1112
+ }
1113
+ function compileNode(ctx, node) {
1114
+ if (isRawCondition(node)) {
1115
+ return compileRaw(ctx, node);
1116
+ }
1117
+ const clauses = [];
1118
+ for (const [key2, value] of Object.entries(node)) {
1119
+ if (value === void 0) continue;
1120
+ if (key2 === "and" || key2 === "or") {
1121
+ const parts = value.map((sub) => compileNode(ctx, sub)).filter((s) => s.length > 0);
1122
+ if (parts.length === 0) continue;
1123
+ if (parts.length === 1) {
1124
+ clauses.push(parts[0]);
1125
+ } else {
1126
+ const sep = key2 === "and" ? " AND " : " OR ";
1127
+ clauses.push(`(${parts.map((p) => wrap(p)).join(sep)})`);
1128
+ }
1129
+ continue;
1130
+ }
1131
+ if (key2 === "not") {
1132
+ const inner = compileNode(ctx, value);
1133
+ if (inner.length > 0) clauses.push(`NOT ${wrap(inner)}`);
1134
+ continue;
1135
+ }
1136
+ const clause = compileField(ctx, key2, value);
1137
+ if (clause.length > 0) clauses.push(clause);
1138
+ }
1139
+ return joinAnd(clauses);
1140
+ }
1141
+ function resolveConditionTree(declarative, resolveParam) {
1142
+ return resolveNode(declarative, resolveParam);
1143
+ }
1144
+ function isParamLeaf(value) {
1145
+ return typeof value === "object" && value !== null && !Array.isArray(value) && typeof value.$param === "string";
1146
+ }
1147
+ function resolveLeaf(value, resolveParam) {
1148
+ if (isParamLeaf(value)) return resolveParam(value.$param);
1149
+ return value;
1150
+ }
1151
+ function resolveNode(node, resolveParam) {
1152
+ const obj = node;
1153
+ const out = {};
1154
+ for (const [key2, value] of Object.entries(obj)) {
1155
+ if (key2 === "and" || key2 === "or") {
1156
+ out[key2] = value.map((s) => resolveNode(s, resolveParam));
1157
+ } else if (key2 === "not") {
1158
+ out[key2] = resolveNode(value, resolveParam);
1159
+ } else {
1160
+ const ops = value;
1161
+ const rendered = {};
1162
+ for (const [op, opVal] of Object.entries(ops)) {
1163
+ if (op === "between") {
1164
+ const [lo, hi] = opVal;
1165
+ rendered[op] = [
1166
+ resolveLeaf(lo, resolveParam),
1167
+ resolveLeaf(hi, resolveParam)
1168
+ ];
1169
+ } else if (op === "in") {
1170
+ rendered[op] = opVal.map(
1171
+ (v) => resolveLeaf(v, resolveParam)
1172
+ );
1173
+ } else if (op === "attributeExists") {
1174
+ rendered[op] = opVal;
1175
+ } else {
1176
+ rendered[op] = resolveLeaf(opVal, resolveParam);
1177
+ }
1178
+ }
1179
+ out[key2] = rendered;
1180
+ }
1181
+ }
1182
+ return out;
1183
+ }
864
1184
  function buildConditionExpression(condition) {
1185
+ if (isRawCondition(condition)) {
1186
+ const ctx2 = { names: {}, values: {}, valueCounter: { n: 0 } };
1187
+ const expression2 = compileRaw(ctx2, condition);
1188
+ return { expression: expression2, names: ctx2.names, values: ctx2.values };
1189
+ }
865
1190
  if (condition.notExists === true) {
866
- return {
867
- expression: "attribute_not_exists(PK)",
868
- names: {},
869
- values: {}
870
- };
1191
+ return { expression: "attribute_not_exists(PK)", names: {}, values: {} };
871
1192
  }
872
1193
  if (typeof condition.attributeExists === "string") {
873
1194
  const field = condition.attributeExists;
@@ -887,22 +1208,9 @@ function buildConditionExpression(condition) {
887
1208
  values: {}
888
1209
  };
889
1210
  }
890
- const clauses = [];
891
- const names = {};
892
- const values = {};
893
- let counter = 0;
894
- for (const [fieldName, value] of Object.entries(condition)) {
895
- const nameKey = `#cond_${fieldName}`;
896
- const valueKey = `:cond${counter++}`;
897
- names[nameKey] = fieldName;
898
- values[valueKey] = value;
899
- clauses.push(`${nameKey} = ${valueKey}`);
900
- }
901
- return {
902
- expression: clauses.join(" AND "),
903
- names,
904
- values
905
- };
1211
+ const ctx = { names: {}, values: {}, valueCounter: { n: 0 } };
1212
+ const expression = compileNode(ctx, condition);
1213
+ return { expression, names: ctx.names, values: ctx.values };
906
1214
  }
907
1215
 
908
1216
  // src/operations/serialize.ts
@@ -1719,17 +2027,17 @@ var TransactionContext = class {
1719
2027
  this.assertWithinLimit();
1720
2028
  const modelClass = resolveModelClass(model);
1721
2029
  const { TableName, Key } = buildDeleteInput(modelClass, key2);
1722
- const cond = buildConditionExpression(options.condition);
2030
+ const cond2 = buildConditionExpression(options.condition);
1723
2031
  const check = {
1724
2032
  TableName,
1725
2033
  Key,
1726
- ConditionExpression: cond.expression
2034
+ ConditionExpression: cond2.expression
1727
2035
  };
1728
- if (Object.keys(cond.names).length > 0) {
1729
- check.ExpressionAttributeNames = cond.names;
2036
+ if (Object.keys(cond2.names).length > 0) {
2037
+ check.ExpressionAttributeNames = cond2.names;
1730
2038
  }
1731
- if (Object.keys(cond.values).length > 0) {
1732
- check.ExpressionAttributeValues = cond.values;
2039
+ if (Object.keys(cond2.values).length > 0) {
2040
+ check.ExpressionAttributeValues = cond2.values;
1733
2041
  }
1734
2042
  this.items.push({ ConditionCheck: check });
1735
2043
  }
@@ -1791,10 +2099,18 @@ export {
1791
2099
  pkTemplate,
1792
2100
  skTemplate,
1793
2101
  resolveSegmentedKey,
2102
+ param,
2103
+ isParam,
1794
2104
  BATCH_GET_MAX_KEYS,
1795
2105
  BATCH_WRITE_MAX_ITEMS,
1796
2106
  DynamoExecutor,
1797
2107
  ClientManager,
2108
+ isRawCondition,
2109
+ cond,
2110
+ compileRawCondition,
2111
+ serializeRawCondition,
2112
+ collectRawConditionParams,
2113
+ resolveConditionTree,
1798
2114
  buildConditionExpression,
1799
2115
  serializeFieldValue,
1800
2116
  ChangeCaptureRegistry,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ChangeCaptureRegistry,
3
3
  resolveModelClass
4
- } from "./chunk-347U24SB.js";
4
+ } from "./chunk-PWV7JDMR.js";
5
5
 
6
6
  // src/cdc/prng.ts
7
7
  var SeededRandom = class {
package/dist/cli.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  buildBridgeBundle,
4
4
  normalizeSelectSpec
5
- } from "./chunk-F27INYI2.js";
5
+ } from "./chunk-4B4MUPUJ.js";
6
6
  import {
7
7
  MetadataRegistry
8
- } from "./chunk-347U24SB.js";
8
+ } from "./chunk-PWV7JDMR.js";
9
9
 
10
10
  // src/cli.ts
11
11
  import { createRequire } from "module";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SelectableOf, f as PrimaryKeyOf, E as Executor, g as ExecutionPlanSpec, h as SegmentedKey, i as SelectBuilderSpec, j as TransactionSpec, k as Manifest, l as ExecutionPlan, R as ResolvedKey, D as DynamoDBOperation, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, T as TransactWriteExecItem, m as CdcEmulatorOptions, n as ChangeHandler, o as Unsubscribe, F as FaultSpec, p as ConcurrentRecomputeRef, C as ChangeEvent, q as EventLog, r as ReplayOptions, s as ShardId, t as TransactionItemSpec, u as Param, v as ParamDescriptor, w as DefinitionMap, O as OperationDefinition, e as DDBModel, M as ModelStatic, x as WriteDefinitionOptions, y as PartialQueryKeyOf, z as StrictSelectSpec, A as EntityInput, G as UniqueQueryKeyOf, H as EntityRef, I as ConditionInput, Q as QueryModelContract, J as QueryMethodSpec, K as CommandModelContract, L as CommandMethodSpec, N as ContractSpec, V as QuerySpec, X as CommandSpec, Y as ContextSpec, Z as OperationsDocument, _ as AnyOperationDefinition, $ as BridgeBundle, a0 as ConditionSpec } from './types-D6qLpw2M.js';
2
- export { a1 as BatchDeleteRequest, a2 as BatchGetRequest, a3 as BatchGetResult, a4 as BatchPutRequest, a5 as BatchResult, a6 as BatchWriteRequest, a7 as CONTRACT_RANGE_FANOUT_CONCURRENCY, a8 as CdcMode, a9 as ChangeBatch, aa as ChangeEventName, ab as ClockMode, ac as Column, ad as ColumnMap, ae as CommandContractMethodSpec, af as CommandInputShape, ag as CommandMethod, ah as CommandPlan, ai as CommandResolutionTarget, aj as CommandResultKind, ak as CommandSelectShape, al as CompiledFragment, am as ComposeSpec, an as CondSlot, ao as ConditionCheckInput, ap as Connection, aq as ContractCallSignature, ar as ContractCardinality, as as ContractCommandParams, at as ContractCommandResult, au as ContractComposeNode, av as ContractFromRef, aw as ContractInputArity, ax as ContractItem, ay as ContractKeyFieldRef, az as ContractKeyInput, aA as ContractKeyRef, aB as ContractKeySpec, aC as ContractKind, aD as ContractMethodOp, aE as ContractParamRef, aF as ContractQueryParams, aG as ContractResolution, aH as DeleteOptions, aI as DeriveEffect, aJ as DerivedEdgeWrite, aK as DerivedUpdate, aL as DescriptorBinding, aM as ENTITY_WRITES_MARKER, aN as EdgeEffect, aO as EffectPath, aP as EmitEffect, aQ as EntityWritesDefinition, aR as EntityWritesShape, aS as ExecutableCommandContract, aT as ExecutableQueryContract, aU as FilterInput, aV as FilterSpec, aW as FragmentInput, aX as GsiDefinitionMarker, aY as GsiOptions, aZ as IdempotencyEffect, a_ as InProcessWriteDescriptor, a$ as InputArity, b0 as KeyDefinitionMarker, b1 as KeySegment, b2 as KeySlot, b3 as KeyStructure, b4 as KeyedResult, b5 as LIFECYCLE_CONTRACT_MARKER, b6 as LifecycleContract, b7 as LifecycleEffects, b8 as LiteralParam, b9 as ManifestEntity, ba as ManifestField, bb as ManifestFieldType, bc as ManifestGsi, bd as ManifestKey, be as ManifestRelation, bf as ManifestTable, bg as ModelRef, bh as MutateMode, bi as MutateOptions, bj as MutateParallelResult, bk as MutateTransactionResult, bl as MutationBody, bm as MutationDescriptorMap, bn as MutationFragment, bo as MutationInputProxy, bp as MutationInputRef, bq as MutationIntent, br as NumberParam, bs as OperationKind, bt as OperationSpec, bu as ParallelOpResult, bv as ParamKind, bw as ParamSpec, bx as ParamStructure, by as PlannedCommandMethod, bz as PutOptions, bA as QueryContractMethodSpec, bB as QueryEnvelopeResult, bC as QueryKeyOf, bD as QueryMethod, bE as QueryResult, bF as RangeConditionSpec, bG as RawCondition, bH as ReadEnvelope, bI as ReadOperationType, bJ as ReadRouteDescriptor, bK as ReadRouteOptions, bL as ReadRouteResult, bM as RecordedCompose, bN as RelationBuilder, bO as RelationSelect, bP as RelationSpec, bQ as RequiresEffect, bR as Resolution, bS as SPEC_VERSION, bT as SegmentSpec, bU as SelectBuilder, bV as SelectOf, bW as StartingPosition, bX as StreamViewType, bY as StringParam, bZ as TransactionContext, b_ as TransactionItemType, b$ as UniqueEffect, c0 as Updatable, c1 as UpdateOptions, c2 as WhenSpec, c3 as WriteDescriptor, c4 as WriteEnvelope, c5 as WriteLifecyclePhase, c6 as WriteOperationType, c7 as WriteRecorder, c8 as WriteResultProjection, c9 as attachModelClass, ca as buildDeleteInput, cb as buildPutInput, cc as buildUpdateInput, cd as compileFragment, ce as compileMutationPlan, cf as compileSingleFragmentPlan, cg as cond, ch as contractOfMethodSpec, ci as definePlan, cj as entityWrites, ck as executeBatchGet, cl as executeBatchWrite, cm as executeCommandMethod, cn as executeDelete, co as executeKeyedBatchGet, cp as executePut, cq as executeQueryMethod, cr as executeRangeFanout, cs as executeTransaction, ct as executeUpdate, cu as from, cv as getEntityWrites, cw as gsi, cx as isColumn, cy as isCommandModelContract, cz as isCommandPlan, cA as isContractComposeNode, cB as isContractFromRef, cC as isContractKeyFieldRef, cD as isContractKeyRef, cE as isContractParamRef, cF as isEntityWritesDefinition, cG as isKeySegment, cH as isLifecycleContract, cI as isMutationFragment, cJ as isMutationInputRef, cK as isParam, cL as isPlannedCommandMethod, cM as isQueryModelContract, cN as k, cO as key, cP as lifecyclePhaseForIntent, cQ as mintContractKeyFieldRef, cR as mintContractParamRef, cS as mutation, cT as param, cU as publicCommandModel, cV as publicQueryModel, cW as query, cX as resolveLifecycle, cY as wholeKeysSentinel } from './types-D6qLpw2M.js';
1
+ import { S as SelectableOf, f as PrimaryKeyOf, E as Executor, g as ExecutionPlanSpec, h as SegmentedKey, i as SelectBuilderSpec, R as RawCondition, j as TransactionSpec, k as Manifest, l as ExecutionPlan, m as ResolvedKey, D as DynamoDBOperation, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, T as TransactWriteExecItem, n as CdcEmulatorOptions, o as ChangeHandler, p as Unsubscribe, F as FaultSpec, q as ConcurrentRecomputeRef, C as ChangeEvent, r as EventLog, s as ReplayOptions, t as ShardId, u as TransactionItemSpec, v as Param, w as ParamDescriptor, x as DefinitionMap, O as OperationDefinition, e as DDBModel, M as ModelStatic, y as WriteDefinitionOptions, z as PartialQueryKeyOf, A as StrictSelectSpec, G as EntityInput, H as UniqueQueryKeyOf, I as EntityRef, J as ConditionInput, Q as QueryModelContract, K as QueryMethodSpec, L as CommandModelContract, N as CommandMethodSpec, V as ContractSpec, X as QuerySpec, Y as CommandSpec, Z as ContextSpec, _ as OperationsDocument, $ as AnyOperationDefinition, a0 as BridgeBundle, a1 as ConditionSpec } from './types-DPJ4tPjX.js';
2
+ export { a2 as BatchDeleteRequest, a3 as BatchGetRequest, a4 as BatchGetResult, a5 as BatchPutRequest, a6 as BatchResult, a7 as BatchWriteRequest, a8 as CONTRACT_RANGE_FANOUT_CONCURRENCY, a9 as CdcMode, aa as ChangeBatch, ab as ChangeEventName, ac as ClockMode, ad as Column, ae as ColumnMap, af as CommandContractMethodSpec, ag as CommandInputShape, ah as CommandMethod, ai as CommandPlan, aj as CommandResolutionTarget, ak as CommandResultKind, al as CommandSelectShape, am as CompiledFragment, an as ComposeSpec, ao as CondSlot, ap as ConditionCheckInput, aq as Connection, ar as ContractCallSignature, as as ContractCardinality, at as ContractCommandParams, au as ContractCommandResult, av as ContractComposeNode, aw as ContractFromRef, ax as ContractInputArity, ay as ContractItem, az as ContractKeyFieldRef, aA as ContractKeyInput, aB as ContractKeyRef, aC as ContractKeySpec, aD as ContractKind, aE as ContractMethodOp, aF as ContractParamRef, aG as ContractQueryParams, aH as ContractResolution, aI as DeleteOptions, aJ as DeriveEffect, aK as DerivedEdgeWrite, aL as DerivedUpdate, aM as DescriptorBinding, aN as ENTITY_WRITES_MARKER, aO as EdgeEffect, aP as EffectPath, aQ as EmitEffect, aR as EntityWritesDefinition, aS as EntityWritesShape, aT as ExecutableCommandContract, aU as ExecutableQueryContract, aV as FilterInput, aW as FilterSpec, aX as FragmentInput, aY as GsiDefinitionMarker, aZ as GsiOptions, a_ as IdempotencyEffect, a$ as InProcessWriteDescriptor, b0 as InputArity, b1 as KeyDefinitionMarker, b2 as KeySegment, b3 as KeySlot, b4 as KeyStructure, b5 as KeyedResult, b6 as LIFECYCLE_CONTRACT_MARKER, b7 as LifecycleContract, b8 as LifecycleEffects, b9 as LiteralParam, ba as ManifestEntity, bb as ManifestField, bc as ManifestFieldType, bd as ManifestGsi, be as ManifestKey, bf as ManifestRelation, bg as ManifestTable, bh as ModelRef, bi as MutateMode, bj as MutateOptions, bk as MutateParallelResult, bl as MutateTransactionResult, bm as MutationBody, bn as MutationDescriptorMap, bo as MutationFragment, bp as MutationInputProxy, bq as MutationInputRef, br as MutationIntent, bs as NumberParam, bt as OperationKind, bu as OperationSpec, bv as ParallelOpResult, bw as ParamKind, bx as ParamSpec, by as ParamStructure, bz as PlannedCommandMethod, bA as PutOptions, bB as QueryContractMethodSpec, bC as QueryEnvelopeResult, bD as QueryKeyOf, bE as QueryMethod, bF as QueryResult, bG as RangeConditionSpec, bH as ReadEnvelope, bI as ReadOperationType, bJ as ReadRouteDescriptor, bK as ReadRouteOptions, bL as ReadRouteResult, bM as RecordedCompose, bN as RelationBuilder, bO as RelationSelect, bP as RelationSpec, bQ as RequiresEffect, bR as Resolution, bS as SPEC_VERSION, bT as SegmentSpec, bU as SelectBuilder, bV as SelectOf, bW as StartingPosition, bX as StreamViewType, bY as StringParam, bZ as TransactionContext, b_ as TransactionItemType, b$ as UniqueEffect, c0 as Updatable, c1 as UpdateOptions, c2 as WhenSpec, c3 as WriteDescriptor, c4 as WriteEnvelope, c5 as WriteLifecyclePhase, c6 as WriteOperationType, c7 as WriteRecorder, c8 as WriteResultProjection, c9 as attachModelClass, ca as buildDeleteInput, cb as buildPutInput, cc as buildUpdateInput, cd as compileFragment, ce as compileMutationPlan, cf as compileSingleFragmentPlan, cg as cond, ch as contractOfMethodSpec, ci as definePlan, cj as entityWrites, ck as executeBatchGet, cl as executeBatchWrite, cm as executeCommandMethod, cn as executeDelete, co as executeKeyedBatchGet, cp as executePut, cq as executeQueryMethod, cr as executeRangeFanout, cs as executeTransaction, ct as executeUpdate, cu as from, cv as getEntityWrites, cw as gsi, cx as isColumn, cy as isCommandModelContract, cz as isCommandPlan, cA as isContractComposeNode, cB as isContractFromRef, cC as isContractKeyFieldRef, cD as isContractKeyRef, cE as isContractParamRef, cF as isEntityWritesDefinition, cG as isKeySegment, cH as isLifecycleContract, cI as isMutationFragment, cJ as isMutationInputRef, cK as isParam, cL as isPlannedCommandMethod, cM as isQueryModelContract, cN as k, cO as key, cP as lifecyclePhaseForIntent, cQ as mintContractKeyFieldRef, cR as mintContractParamRef, cS as mutation, cT as param, cU as publicCommandModel, cV as publicQueryModel, cW as query, cX as resolveLifecycle, cY as wholeKeysSentinel } from './types-DPJ4tPjX.js';
3
3
  import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
4
4
  import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
5
5
 
@@ -420,22 +420,8 @@ interface ConditionExpressionResult {
420
420
  names: Record<string, string>;
421
421
  values: Record<string, unknown>;
422
422
  }
423
- /**
424
- * Build a DynamoDB ConditionExpression from a condition object (issues #46, #81).
425
- *
426
- * - `{ notExists: true }` → `attribute_not_exists(PK)` (legacy whole-row guard)
427
- * - `{ attributeExists: 'email' }` → `attribute_exists(#cond_email)` (any field,
428
- * incl. PK/SK)
429
- * - `{ attributeNotExists: 'email' }` → `attribute_not_exists(#cond_email)`
430
- * - `{ version: 3 }` → `#cond_version = :cond0`
431
- * - `{ version: 3, status: 'active' }` → `#cond_version = :cond0 AND #cond_status = :cond1`
432
- *
433
- * Attribute name/value keys use the `cond_` prefix to avoid collisions with
434
- * UpdateExpression names/values. The existence primitives go through a `#name`
435
- * placeholder rather than a bare attribute so reserved-word fields (and PK/SK)
436
- * are always legal.
437
- */
438
- declare function buildConditionExpression(condition: Record<string, unknown>): ConditionExpressionResult;
423
+
424
+ declare function buildConditionExpression(condition: Record<string, unknown> | RawCondition): ConditionExpressionResult;
439
425
 
440
426
  /**
441
427
  * Compiled DynamoDB `FilterExpression`. Names are `#`-aliased column
@@ -2047,4 +2033,4 @@ declare function assertBundleSerializable(bundle: BridgeBundle): void;
2047
2033
  */
2048
2034
  declare function buildBridgeBundle(queries?: DefinitionMap, commands?: DefinitionMap, registry?: typeof MetadataRegistry, transactions?: Record<string, TransactionDefinition>, contractInputs?: ContractInputs): BridgeBundle;
2049
2035
 
2050
- export { type AnyModelContract, AnyOperationDefinition, BATCH_GET_MAX_KEYS, BATCH_WRITE_MAX_ITEMS, BatchGetExecInput, BatchWriteExecItem, BridgeBundle, type BuiltContracts, CdcEmulator, CdcEmulatorOptions, ChangeEvent, ChangeHandler, ClientManager, type CollectParams, CommandMethodSpec, CommandModelContract, CommandSpec, ConcurrentRecomputeRef, type ConditionExpressionResult, ConditionInput, ConditionSpec, type ContextOwnership, type ContextOwnershipMap, ContextSpec, type ContractBoundaryViolation, type ContractInputs, type ContractMap, type ContractN1Violation, ContractSpec, DDBModel, DefinitionMap, DeleteInput, DynamoDBOperation, DynamoExecutor, type DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, type EmbeddedMetadata, type EntityMetadata, EntityRef, EventLog, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FaultSpec, type FieldMetadata, type FieldOptions, type FilterExpressionResult, type GsiDefinition, type KeyDefinition, type LintResult, type LintRule, Linter, type ListInput, type ListOptions, MAX_TRANSACT_ITEMS, Manifest, MetadataRegistry, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, OperationsDocument, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PrimaryKeyOf, type ProjectionResult, PutInput, QueryMethodSpec, QueryModelContract, type QueryOptions$1 as QueryOptions, QuerySpec, type RelationLimitOptions, type RelationMetadata, type RelationOptions, type RelationTraversalOptions, ReplayOptions, ResolvedKey, SegmentedKey, SelectableOf, ShardId, TableMapping, TransactWriteExecItem, type TransactionDefinition, TransactionItemSpec, type TransactionParamShape, type TransactionRef, TransactionSpec, type TxConditionCheckOptions, type TxForEachInstruction, type TxForEachOptions, type TxInstruction, type TxRecorder, type TxWriteInstruction, type TxWriteOptions, UniqueQueryKeyOf, type UpdateExpressionResult, UpdateInput, type WhenComparison, WriteDefinitionOptions, WriteExecOptions, WriteResult, assertBundleSerializable, assertContractBoundaries, assertContractN1Safe, assertJsonSerializable, assertSupportedCondition, belongsTo, binary, boolean, buildBridgeBundle, buildConditionExpression, buildContexts, buildContracts, buildManifest, buildOperations, buildProjection, buildQuerySpec, buildTransactionSpec, buildTransactions, buildUpdateExpression, collectContractBoundaryViolations, collectContractN1Violations, compileFilterExpression, createCdcEmulator, createDefaultLinter, datetime, decodeCursor, decodePerKeyCursor, defineCommands, defineDelete, defineList, definePut, defineQueries, defineQuery, defineTransaction, defineTransactions, defineUpdate, deriveEdgeWriteItems, deriveEdgeWriteItemsFor, deriveModelEdgeWriteItems, derivePrefix, detectRelationFields, edgeWrites, embedded, encodeCursor, encodePerKeyCursor, evaluateFilter, execute, executeDeclarativeTransaction, executeExplain, executeList, executeQuery, expandTransaction, field, getEdgeWrites, getImplicitKeyFields, gsiAmbiguityRule, hasMany, hasOne, hydrate, isEdgeWritesDefinition, isSelectBuilder, isTransactionRef, list, literal, map, missingGsiRule, model, noScanRule, number, numberSet, plan, queryBoundaryRule, relationDepthRule, requireLimitRule, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, validateDepth, validateGsiAmbiguity, when };
2036
+ export { type AnyModelContract, AnyOperationDefinition, BATCH_GET_MAX_KEYS, BATCH_WRITE_MAX_ITEMS, BatchGetExecInput, BatchWriteExecItem, BridgeBundle, type BuiltContracts, CdcEmulator, CdcEmulatorOptions, ChangeEvent, ChangeHandler, ClientManager, type CollectParams, CommandMethodSpec, CommandModelContract, CommandSpec, ConcurrentRecomputeRef, type ConditionExpressionResult, ConditionInput, ConditionSpec, type ContextOwnership, type ContextOwnershipMap, ContextSpec, type ContractBoundaryViolation, type ContractInputs, type ContractMap, type ContractN1Violation, ContractSpec, DDBModel, DefinitionMap, DeleteInput, DynamoDBOperation, DynamoExecutor, type DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, type EmbeddedMetadata, type EntityMetadata, EntityRef, EventLog, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FaultSpec, type FieldMetadata, type FieldOptions, type FilterExpressionResult, type GsiDefinition, type KeyDefinition, type LintResult, type LintRule, Linter, type ListInput, type ListOptions, MAX_TRANSACT_ITEMS, Manifest, MetadataRegistry, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, OperationsDocument, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PrimaryKeyOf, type ProjectionResult, PutInput, QueryMethodSpec, QueryModelContract, type QueryOptions$1 as QueryOptions, QuerySpec, RawCondition, type RelationLimitOptions, type RelationMetadata, type RelationOptions, type RelationTraversalOptions, ReplayOptions, ResolvedKey, SegmentedKey, SelectableOf, ShardId, TableMapping, TransactWriteExecItem, type TransactionDefinition, TransactionItemSpec, type TransactionParamShape, type TransactionRef, TransactionSpec, type TxConditionCheckOptions, type TxForEachInstruction, type TxForEachOptions, type TxInstruction, type TxRecorder, type TxWriteInstruction, type TxWriteOptions, UniqueQueryKeyOf, type UpdateExpressionResult, UpdateInput, type WhenComparison, WriteDefinitionOptions, WriteExecOptions, WriteResult, assertBundleSerializable, assertContractBoundaries, assertContractN1Safe, assertJsonSerializable, assertSupportedCondition, belongsTo, binary, boolean, buildBridgeBundle, buildConditionExpression, buildContexts, buildContracts, buildManifest, buildOperations, buildProjection, buildQuerySpec, buildTransactionSpec, buildTransactions, buildUpdateExpression, collectContractBoundaryViolations, collectContractN1Violations, compileFilterExpression, createCdcEmulator, createDefaultLinter, datetime, decodeCursor, decodePerKeyCursor, defineCommands, defineDelete, defineList, definePut, defineQueries, defineQuery, defineTransaction, defineTransactions, defineUpdate, deriveEdgeWriteItems, deriveEdgeWriteItemsFor, deriveModelEdgeWriteItems, derivePrefix, detectRelationFields, edgeWrites, embedded, encodeCursor, encodePerKeyCursor, evaluateFilter, execute, executeDeclarativeTransaction, executeExplain, executeList, executeQuery, expandTransaction, field, getEdgeWrites, getImplicitKeyFields, gsiAmbiguityRule, hasMany, hasOne, hydrate, isEdgeWritesDefinition, isSelectBuilder, isTransactionRef, list, literal, map, missingGsiRule, model, noScanRule, number, numberSet, plan, queryBoundaryRule, relationDepthRule, requireLimitRule, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, validateDepth, validateGsiAmbiguity, when };