graphddb 0.4.0 → 0.4.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/README.md +339 -482
- package/dist/{chunk-GWFZVNAV.js → chunk-BROCT574.js} +1 -1
- package/dist/{chunk-72VZYOSG.js → chunk-CPTV3H2U.js} +29 -11
- package/dist/{chunk-PC54CW5P.js → chunk-G5RWWBAL.js} +41 -19
- package/dist/cli.js +51 -14
- package/dist/index.d.ts +11 -4
- package/dist/index.js +29 -12
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +2 -2
- package/dist/{types-CpCo8yHP.d.ts → types-BWOrWcbd.d.ts} +170 -7
- package/package.json +1 -1
|
@@ -984,30 +984,46 @@ var TableMapping = class {
|
|
|
984
984
|
};
|
|
985
985
|
|
|
986
986
|
// src/define/param.ts
|
|
987
|
-
function
|
|
988
|
-
return
|
|
987
|
+
function isParamOptions(value) {
|
|
988
|
+
return typeof value === "object" && value !== null;
|
|
989
|
+
}
|
|
990
|
+
function makeParam(kind, literals, description) {
|
|
991
|
+
const param2 = { kind };
|
|
992
|
+
if (literals !== void 0) param2.literals = literals;
|
|
993
|
+
if (description !== void 0) param2.description = description;
|
|
994
|
+
return param2;
|
|
989
995
|
}
|
|
990
996
|
var param = {
|
|
991
997
|
/** A placeholder for a `string` value. */
|
|
992
|
-
string() {
|
|
993
|
-
return makeParam("string");
|
|
998
|
+
string(options) {
|
|
999
|
+
return makeParam("string", void 0, options?.description);
|
|
994
1000
|
},
|
|
995
1001
|
/** A placeholder for a `number` value. */
|
|
996
|
-
number() {
|
|
997
|
-
return makeParam("number");
|
|
1002
|
+
number(options) {
|
|
1003
|
+
return makeParam("number", void 0, options?.description);
|
|
998
1004
|
},
|
|
999
1005
|
/**
|
|
1000
1006
|
* A placeholder constrained to one of the given literal values. The value
|
|
1001
1007
|
* type of the resulting {@link Param} is the **union of the literals**, so it
|
|
1002
|
-
* is preserved precisely in the IR and the inferred definition types.
|
|
1008
|
+
* is preserved precisely in the IR and the inferred definition types. A final
|
|
1009
|
+
* plain-object argument is read as {@link ParamOptions} (a `description`),
|
|
1010
|
+
* distinguished from the `string` / `number` literal values.
|
|
1003
1011
|
*
|
|
1004
1012
|
* @example
|
|
1005
1013
|
* ```ts
|
|
1006
1014
|
* param.literal('active', 'disabled'); // Param<'active' | 'disabled'>
|
|
1015
|
+
* param.literal('active', 'disabled', { description: 'Account state.' });
|
|
1007
1016
|
* ```
|
|
1008
1017
|
*/
|
|
1009
|
-
literal(...
|
|
1010
|
-
|
|
1018
|
+
literal(...valuesAndOptions) {
|
|
1019
|
+
const args = [...valuesAndOptions];
|
|
1020
|
+
const last = args[args.length - 1];
|
|
1021
|
+
const options = isParamOptions(last) ? args.pop() : void 0;
|
|
1022
|
+
return makeParam(
|
|
1023
|
+
"literal",
|
|
1024
|
+
args,
|
|
1025
|
+
options?.description
|
|
1026
|
+
);
|
|
1011
1027
|
},
|
|
1012
1028
|
/**
|
|
1013
1029
|
* A placeholder for an **array** parameter whose elements have the given field
|
|
@@ -1020,8 +1036,10 @@ var param = {
|
|
|
1020
1036
|
* // Param<{ userId: string; role: string }[]>
|
|
1021
1037
|
* ```
|
|
1022
1038
|
*/
|
|
1023
|
-
array(element) {
|
|
1024
|
-
|
|
1039
|
+
array(element, options) {
|
|
1040
|
+
const param2 = { kind: "array", element };
|
|
1041
|
+
if (options?.description !== void 0) param2.description = options.description;
|
|
1042
|
+
return param2;
|
|
1025
1043
|
}
|
|
1026
1044
|
};
|
|
1027
1045
|
function isParam(value) {
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
serializeFieldValue,
|
|
43
43
|
serializeRawCondition,
|
|
44
44
|
skTemplate
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-CPTV3H2U.js";
|
|
46
46
|
|
|
47
47
|
// src/spec/types.ts
|
|
48
48
|
var SPEC_VERSION = "1.0";
|
|
@@ -111,7 +111,12 @@ function buildFields(metadata) {
|
|
|
111
111
|
const fields = {};
|
|
112
112
|
for (const field of metadata.fields) {
|
|
113
113
|
const format = field.options?.format;
|
|
114
|
-
|
|
114
|
+
const description = field.options?.description;
|
|
115
|
+
fields[field.propertyName] = {
|
|
116
|
+
type: DYNAMO_TYPE_TO_FIELD_TYPE[field.dynamoType],
|
|
117
|
+
...format ? { format } : {},
|
|
118
|
+
...description !== void 0 ? { description } : {}
|
|
119
|
+
};
|
|
115
120
|
}
|
|
116
121
|
return sortedRecord(fields);
|
|
117
122
|
}
|
|
@@ -123,7 +128,8 @@ function buildEntity(metadata) {
|
|
|
123
128
|
fields: buildFields(metadata),
|
|
124
129
|
key: buildKey(metadata.primaryKey),
|
|
125
130
|
gsis: buildGsis(metadata),
|
|
126
|
-
relations: buildRelations(metadata)
|
|
131
|
+
relations: buildRelations(metadata),
|
|
132
|
+
...metadata.description !== void 0 ? { description: metadata.description } : {}
|
|
127
133
|
};
|
|
128
134
|
}
|
|
129
135
|
function buildManifest(registry = MetadataRegistry) {
|
|
@@ -3572,7 +3578,8 @@ function buildQueryContract(methods) {
|
|
|
3572
3578
|
op,
|
|
3573
3579
|
resolution,
|
|
3574
3580
|
inputArity,
|
|
3575
|
-
__methodName: name
|
|
3581
|
+
__methodName: name,
|
|
3582
|
+
...op.description !== void 0 ? { description: op.description } : {}
|
|
3576
3583
|
};
|
|
3577
3584
|
}
|
|
3578
3585
|
const contract = { __isContract: true, kind: "query", methods: resolved };
|
|
@@ -3586,8 +3593,8 @@ function buildCommandContract(methods) {
|
|
|
3586
3593
|
const resolved = {};
|
|
3587
3594
|
for (const [name, body] of Object.entries(methods)) {
|
|
3588
3595
|
if (isPublicWriteDescriptor(body)) {
|
|
3589
|
-
const { plan: plan2, select, condition, mode } = writeDescriptorToPlan(name, body);
|
|
3590
|
-
resolved[name] = finalizeDescriptorCommand(name, plan2, select, condition, mode);
|
|
3596
|
+
const { plan: plan2, select, condition, mode, description } = writeDescriptorToPlan(name, body);
|
|
3597
|
+
resolved[name] = finalizeDescriptorCommand(name, plan2, select, condition, mode, description);
|
|
3591
3598
|
continue;
|
|
3592
3599
|
}
|
|
3593
3600
|
if (isPublicComposeDescriptor(body)) {
|
|
@@ -3597,7 +3604,8 @@ function buildCommandContract(methods) {
|
|
|
3597
3604
|
body.command,
|
|
3598
3605
|
select,
|
|
3599
3606
|
void 0,
|
|
3600
|
-
body.mode ?? "transaction"
|
|
3607
|
+
body.mode ?? "transaction",
|
|
3608
|
+
body.description
|
|
3601
3609
|
);
|
|
3602
3610
|
continue;
|
|
3603
3611
|
}
|
|
@@ -3662,7 +3670,7 @@ function buildPlannedCommandMethod(name, planned) {
|
|
|
3662
3670
|
...returnSelection !== void 0 ? { returnSelection } : {}
|
|
3663
3671
|
};
|
|
3664
3672
|
}
|
|
3665
|
-
function finalizeDescriptorCommand(name, plan2, select, condition, mode) {
|
|
3673
|
+
function finalizeDescriptorCommand(name, plan2, select, condition, mode, description) {
|
|
3666
3674
|
const planned = {
|
|
3667
3675
|
[PLANNED_COMMAND_BRAND]: true,
|
|
3668
3676
|
plan: plan2,
|
|
@@ -3674,7 +3682,8 @@ function finalizeDescriptorCommand(name, plan2, select, condition, mode) {
|
|
|
3674
3682
|
return {
|
|
3675
3683
|
...built,
|
|
3676
3684
|
op,
|
|
3677
|
-
mode
|
|
3685
|
+
mode,
|
|
3686
|
+
...description !== void 0 ? { description } : {}
|
|
3678
3687
|
};
|
|
3679
3688
|
}
|
|
3680
3689
|
function normalizeReturnSelection(select) {
|
|
@@ -3760,7 +3769,8 @@ function readDescriptorToOp(name, d) {
|
|
|
3760
3769
|
keys,
|
|
3761
3770
|
...isQuery ? { keyFields: keyFieldNames2 } : {},
|
|
3762
3771
|
...select !== void 0 ? { select } : {},
|
|
3763
|
-
...compose.length > 0 ? { compose } : {}
|
|
3772
|
+
...compose.length > 0 ? { compose } : {},
|
|
3773
|
+
...d.description !== void 0 ? { description: d.description } : {}
|
|
3764
3774
|
};
|
|
3765
3775
|
}
|
|
3766
3776
|
function writeDescriptorToPlan(name, d) {
|
|
@@ -3794,7 +3804,7 @@ function writeDescriptorToPlan(name, d) {
|
|
|
3794
3804
|
});
|
|
3795
3805
|
const select = d.result !== void 0 && d.result.select !== void 0 ? d.result.select : void 0;
|
|
3796
3806
|
const condition = d.condition !== void 0 ? descriptorConditionRecord(d.condition, name) : void 0;
|
|
3797
|
-
return { plan: plan2, select, condition, mode: d.mode ?? "transaction" };
|
|
3807
|
+
return { plan: plan2, select, condition, mode: d.mode ?? "transaction", description: d.description };
|
|
3798
3808
|
}
|
|
3799
3809
|
|
|
3800
3810
|
// src/spec/mutation-command.ts
|
|
@@ -5697,10 +5707,12 @@ function paramSpecs(params) {
|
|
|
5697
5707
|
const out = {};
|
|
5698
5708
|
for (const name of Object.keys(params).sort()) {
|
|
5699
5709
|
const d = params[name];
|
|
5700
|
-
out[name] =
|
|
5710
|
+
out[name] = {
|
|
5701
5711
|
type: d.kind,
|
|
5702
5712
|
required: d.required,
|
|
5703
|
-
literals: d.literals
|
|
5713
|
+
...d.literals !== void 0 ? { literals: d.literals } : {},
|
|
5714
|
+
// Pure-documentation description (issue #154); absent → byte-identical spec.
|
|
5715
|
+
...d.description !== void 0 ? { description: d.description } : {}
|
|
5704
5716
|
};
|
|
5705
5717
|
}
|
|
5706
5718
|
return out;
|
|
@@ -5929,6 +5941,7 @@ function buildCommandSpec(def) {
|
|
|
5929
5941
|
const params = paramSpecs(def.params);
|
|
5930
5942
|
const entity = def.entity.name;
|
|
5931
5943
|
const condition = extractCondition(def);
|
|
5944
|
+
const description = def.description !== void 0 ? { description: def.description } : {};
|
|
5932
5945
|
if (def.operation === "put") {
|
|
5933
5946
|
const item = templateRecord3(def.key);
|
|
5934
5947
|
return {
|
|
@@ -5937,7 +5950,8 @@ function buildCommandSpec(def) {
|
|
|
5937
5950
|
entity,
|
|
5938
5951
|
params,
|
|
5939
5952
|
item,
|
|
5940
|
-
...condition ? { condition } : {}
|
|
5953
|
+
...condition ? { condition } : {},
|
|
5954
|
+
...description
|
|
5941
5955
|
};
|
|
5942
5956
|
}
|
|
5943
5957
|
if (def.operation === "delete") {
|
|
@@ -5947,7 +5961,8 @@ function buildCommandSpec(def) {
|
|
|
5947
5961
|
entity,
|
|
5948
5962
|
params,
|
|
5949
5963
|
keyCondition: writeKeyCondition(metadata, def.key, entity),
|
|
5950
|
-
...condition ? { condition } : {}
|
|
5964
|
+
...condition ? { condition } : {},
|
|
5965
|
+
...description
|
|
5951
5966
|
};
|
|
5952
5967
|
}
|
|
5953
5968
|
return {
|
|
@@ -5957,7 +5972,8 @@ function buildCommandSpec(def) {
|
|
|
5957
5972
|
params,
|
|
5958
5973
|
keyCondition: writeKeyCondition(metadata, def.key, entity),
|
|
5959
5974
|
changes: templateRecord3(def.changes),
|
|
5960
|
-
...condition ? { condition } : {}
|
|
5975
|
+
...condition ? { condition } : {},
|
|
5976
|
+
...description
|
|
5961
5977
|
};
|
|
5962
5978
|
}
|
|
5963
5979
|
function writeKeyCondition(metadata, key, entity) {
|
|
@@ -6024,7 +6040,9 @@ function buildQuerySpec(def) {
|
|
|
6024
6040
|
operations,
|
|
6025
6041
|
// `defineQuery` → a single entity object; `defineList` → a connection.
|
|
6026
6042
|
cardinality: def.operation === "query" ? "one" : "many",
|
|
6027
|
-
...executionPlan !== void 0 ? { executionPlan } : {}
|
|
6043
|
+
...executionPlan !== void 0 ? { executionPlan } : {},
|
|
6044
|
+
// Pure-documentation description (issue #154); absent → byte-identical spec.
|
|
6045
|
+
...def.description !== void 0 ? { description: def.description } : {}
|
|
6028
6046
|
};
|
|
6029
6047
|
}
|
|
6030
6048
|
function mergeSpecs(base, synthesized, kind) {
|
|
@@ -6788,7 +6806,9 @@ function serializeQueryContract(contractName, contract, querySpecs, contracts) {
|
|
|
6788
6806
|
cardinality: method.resolution === "point" ? "one" : "many",
|
|
6789
6807
|
operation: opName,
|
|
6790
6808
|
...compose.length > 0 ? { compose } : {},
|
|
6791
|
-
...compositionPlan !== void 0 ? { compositionPlan } : {}
|
|
6809
|
+
...compositionPlan !== void 0 ? { compositionPlan } : {},
|
|
6810
|
+
// Pure-documentation description (issue #154); absent → byte-identical spec.
|
|
6811
|
+
...method.description !== void 0 ? { description: method.description } : {}
|
|
6792
6812
|
};
|
|
6793
6813
|
}
|
|
6794
6814
|
return {
|
|
@@ -6876,7 +6896,9 @@ function serializeCommandContract(contractName, contract, commandSpecs, transact
|
|
|
6876
6896
|
result: method.result,
|
|
6877
6897
|
single,
|
|
6878
6898
|
...batch !== void 0 ? { batch } : {},
|
|
6879
|
-
...returnSelection !== void 0 && Object.keys(returnSelection).length > 0 ? { returnSelection: sortedReturnSelection(returnSelection) } : {}
|
|
6899
|
+
...returnSelection !== void 0 && Object.keys(returnSelection).length > 0 ? { returnSelection: sortedReturnSelection(returnSelection) } : {},
|
|
6900
|
+
// Pure-documentation description (issue #154); absent → byte-identical spec.
|
|
6901
|
+
...method.description !== void 0 ? { description: method.description } : {}
|
|
6880
6902
|
};
|
|
6881
6903
|
}
|
|
6882
6904
|
return {
|
package/dist/cli.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
buildBridgeBundle,
|
|
4
4
|
normalizeSelectSpec
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-G5RWWBAL.js";
|
|
6
6
|
import {
|
|
7
7
|
MetadataRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CPTV3H2U.js";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
11
11
|
import { createRequire } from "module";
|
|
@@ -467,9 +467,16 @@ function pyTransactionParamType(txName, paramName, spec) {
|
|
|
467
467
|
}
|
|
468
468
|
return pyParamType(spec);
|
|
469
469
|
}
|
|
470
|
+
function pyDocLine(text) {
|
|
471
|
+
return text.replace(/\\/g, "\\\\").replace(/"""/g, '\\"\\"\\"').replace(/\r?\n/g, " ").trim();
|
|
472
|
+
}
|
|
473
|
+
function pyCommentLine(text) {
|
|
474
|
+
return text.replace(/\r?\n/g, " ").trim();
|
|
475
|
+
}
|
|
470
476
|
function collectResultTypes(manifest, entity, select, typeName, out, seen) {
|
|
471
477
|
const meta = manifest.entities[entity];
|
|
472
478
|
const fields = [];
|
|
479
|
+
const fieldDescriptions = {};
|
|
473
480
|
for (const field of Object.keys(select).sort()) {
|
|
474
481
|
const value = select[field];
|
|
475
482
|
const relation = meta?.relations[field];
|
|
@@ -504,13 +511,23 @@ function collectResultTypes(manifest, entity, select, typeName, out, seen) {
|
|
|
504
511
|
continue;
|
|
505
512
|
}
|
|
506
513
|
if (value === true) {
|
|
507
|
-
const
|
|
514
|
+
const manifestField = meta?.fields[field];
|
|
515
|
+
const fieldType = manifestField?.type ?? "string";
|
|
508
516
|
fields.push([field, pyScalarType(fieldType)]);
|
|
517
|
+
if (manifestField?.description !== void 0) {
|
|
518
|
+
fieldDescriptions[field] = manifestField.description;
|
|
519
|
+
}
|
|
509
520
|
}
|
|
510
521
|
}
|
|
511
522
|
if (!seen.has(typeName)) {
|
|
512
523
|
seen.add(typeName);
|
|
513
|
-
out.push({
|
|
524
|
+
out.push({
|
|
525
|
+
name: typeName,
|
|
526
|
+
fields,
|
|
527
|
+
...Object.keys(fieldDescriptions).length > 0 ? { fieldDescriptions } : {},
|
|
528
|
+
// The entity's own description (issue #154) becomes the result class docstring.
|
|
529
|
+
...meta?.description !== void 0 ? { docstring: meta.description } : {}
|
|
530
|
+
});
|
|
514
531
|
}
|
|
515
532
|
}
|
|
516
533
|
function selectOf(def) {
|
|
@@ -519,29 +536,44 @@ function selectOf(def) {
|
|
|
519
536
|
function queryResultTypeName(queryName) {
|
|
520
537
|
return `${toPascalCase(queryName)}Result`;
|
|
521
538
|
}
|
|
539
|
+
function classDocstringLines(cls) {
|
|
540
|
+
return cls.docstring !== void 0 ? [` """${pyDocLine(cls.docstring)}"""`] : [];
|
|
541
|
+
}
|
|
542
|
+
function withFieldComment(cls, name, line) {
|
|
543
|
+
const desc = cls.fieldDescriptions?.[name];
|
|
544
|
+
return desc !== void 0 ? `${line} # ${pyCommentLine(desc)}` : line;
|
|
545
|
+
}
|
|
522
546
|
function renderTypedDict(cls) {
|
|
547
|
+
const doc = classDocstringLines(cls);
|
|
523
548
|
if (cls.fields.length === 0) {
|
|
524
|
-
return `class ${cls.name}(TypedDict):
|
|
549
|
+
return doc.length > 0 ? `class ${cls.name}(TypedDict):
|
|
550
|
+
${doc.join("\n")}` : `class ${cls.name}(TypedDict):
|
|
525
551
|
pass`;
|
|
526
552
|
}
|
|
527
|
-
const lines = cls.fields.map(
|
|
553
|
+
const lines = cls.fields.map(
|
|
554
|
+
([name, type]) => withFieldComment(cls, name, ` ${name}: ${type}`)
|
|
555
|
+
);
|
|
528
556
|
return `class ${cls.name}(TypedDict):
|
|
529
|
-
${lines.join("\n")}`;
|
|
557
|
+
${[...doc, ...lines].join("\n")}`;
|
|
530
558
|
}
|
|
531
559
|
function renderDataclass(cls) {
|
|
560
|
+
const doc = classDocstringLines(cls);
|
|
532
561
|
if (cls.fields.length === 0) {
|
|
533
|
-
return `@dataclass
|
|
562
|
+
return doc.length > 0 ? `@dataclass
|
|
563
|
+
class ${cls.name}:
|
|
564
|
+
${doc.join("\n")}` : `@dataclass
|
|
534
565
|
class ${cls.name}:
|
|
535
566
|
pass`;
|
|
536
567
|
}
|
|
537
568
|
const lines = cls.fields.map(
|
|
538
|
-
([name, type]) => type.endsWith("| None") ? ` ${name}: ${type} = None` : ` ${name}: ${type}`
|
|
569
|
+
([name, type]) => type.endsWith("| None") ? withFieldComment(cls, name, ` ${name}: ${type} = None`) : withFieldComment(cls, name, ` ${name}: ${type}`)
|
|
539
570
|
);
|
|
540
|
-
const
|
|
541
|
-
const
|
|
571
|
+
const isOptional = (l) => /:\s.*\| None\s*=\sNone(\s+#.*)?$/.test(l);
|
|
572
|
+
const required = lines.filter((l) => !isOptional(l));
|
|
573
|
+
const optional = lines.filter(isOptional);
|
|
542
574
|
return `@dataclass
|
|
543
575
|
class ${cls.name}:
|
|
544
|
-
${[...required, ...optional].join("\n")}`;
|
|
576
|
+
${[...doc, ...required, ...optional].join("\n")}`;
|
|
545
577
|
}
|
|
546
578
|
function collectTransactionElementTypes(transactions, out, seen) {
|
|
547
579
|
for (const txName of Object.keys(transactions).sort()) {
|
|
@@ -625,7 +657,8 @@ function collectRepositories(queries, commands) {
|
|
|
625
657
|
params: methodParams(def),
|
|
626
658
|
returnType: `${queryResultTypeName(name)} | None`,
|
|
627
659
|
kind: "query",
|
|
628
|
-
operationId: name
|
|
660
|
+
operationId: name,
|
|
661
|
+
...def.description !== void 0 ? { description: def.description } : {}
|
|
629
662
|
});
|
|
630
663
|
}
|
|
631
664
|
for (const name of Object.keys(commands).sort()) {
|
|
@@ -635,7 +668,8 @@ function collectRepositories(queries, commands) {
|
|
|
635
668
|
params: methodParams(def),
|
|
636
669
|
returnType: "None",
|
|
637
670
|
kind: "command",
|
|
638
|
-
operationId: name
|
|
671
|
+
operationId: name,
|
|
672
|
+
...def.description !== void 0 ? { description: def.description } : {}
|
|
639
673
|
});
|
|
640
674
|
}
|
|
641
675
|
return [...byEntity.keys()].sort().map((className) => ({
|
|
@@ -646,11 +680,13 @@ function collectRepositories(queries, commands) {
|
|
|
646
680
|
function renderMethod(m) {
|
|
647
681
|
const sig = m.params.map((p) => `${p.argName}: ${p.pyType}`).join(", ");
|
|
648
682
|
const head = ` def ${m.methodName}(self${sig ? ", " + sig : ""}) -> ${m.returnType}:`;
|
|
683
|
+
const doc = m.description !== void 0 ? [` """${pyDocLine(m.description)}"""`] : [];
|
|
649
684
|
const paramsDict = m.params.map((p) => `"${p.originalName}": ${p.argName}`).join(", ");
|
|
650
685
|
const paramsArg = paramsDict ? `{${paramsDict}}` : "{}";
|
|
651
686
|
if (m.kind === "query") {
|
|
652
687
|
return [
|
|
653
688
|
head,
|
|
689
|
+
...doc,
|
|
654
690
|
` return self._runtime.execute_query(`,
|
|
655
691
|
` query_id="${m.operationId}",`,
|
|
656
692
|
` params=${paramsArg},`,
|
|
@@ -659,6 +695,7 @@ function renderMethod(m) {
|
|
|
659
695
|
}
|
|
660
696
|
return [
|
|
661
697
|
head,
|
|
698
|
+
...doc,
|
|
662
699
|
` self._runtime.execute_command(`,
|
|
663
700
|
` command_id="${m.operationId}",`,
|
|
664
701
|
` params=${paramsArg},`,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SelectableOf, g as PrimaryKeyOf, h as RequestContext, i as Middleware, j as ReadRequestKind, k as CtxModel, l as ReadParams, m as ReadRequestCtx, D as DynamoDBOperation, I as Item, E as Executor, n as RetryPolicy, o as ExecutionPlanSpec, p as EntityMetadata, K as KeyDefinition, G as GsiDefinition, q as ModelKind, F as FieldOptions, r as DynamoType, s as ProjectionTransform, t as MaintainEvent, u as MembershipPredicate, v as MaintainConsistency, w as MaintainUpdateMode, x as MembershipPredicateOp, y as RelationOptions, A as AggregateOptions, z as AggregateValue, H as SelectBuilderSpec, J as RawCondition, L as TransactionSpec, N as Manifest, O as RetryOverride, Q as ExecutionPlan, V as FieldMetadata, X as ResolvedKey, R as ReadExecOptions, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, e as BatchExecOptions, T as TransactWriteExecItem, Y as CdcEmulatorOptions, Z as ChangeHandler, _ as Unsubscribe, $ as FaultSpec, a0 as ConcurrentRecomputeRef, C as ChangeEvent, a1 as EventLog, a2 as ReplayOptions, a3 as ShardId, a4 as ViewDefinition, a5 as RelationMetadata, a6 as TransactionItemSpec, a7 as MaintainEffect, M as ModelStatic, f as DDBModel, a8 as Param, a9 as ParamDescriptor, aa as DefinitionMap, ab as OperationDefinition, ac as WriteDefinitionOptions, ad as PartialQueryKeyOf, ae as StrictSelectSpec, af as
|
|
2
|
-
export {
|
|
1
|
+
import { S as SelectableOf, g as PrimaryKeyOf, h as RequestContext, i as Middleware, j as ReadRequestKind, k as CtxModel, l as ReadParams, m as ReadRequestCtx, D as DynamoDBOperation, I as Item, E as Executor, n as RetryPolicy, o as ExecutionPlanSpec, p as EntityMetadata, K as KeyDefinition, G as GsiDefinition, q as ModelKind, F as FieldOptions, r as DynamoType, s as ProjectionTransform, t as MaintainEvent, u as MembershipPredicate, v as MaintainConsistency, w as MaintainUpdateMode, x as MembershipPredicateOp, y as RelationOptions, A as AggregateOptions, z as AggregateValue, H as SelectBuilderSpec, J as RawCondition, L as TransactionSpec, N as Manifest, O as RetryOverride, Q as ExecutionPlan, V as FieldMetadata, X as ResolvedKey, R as ReadExecOptions, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, e as BatchExecOptions, T as TransactWriteExecItem, Y as CdcEmulatorOptions, Z as ChangeHandler, _ as Unsubscribe, $ as FaultSpec, a0 as ConcurrentRecomputeRef, C as ChangeEvent, a1 as EventLog, a2 as ReplayOptions, a3 as ShardId, a4 as ViewDefinition, a5 as RelationMetadata, a6 as TransactionItemSpec, a7 as MaintainEffect, M as ModelStatic, f as DDBModel, a8 as Param, a9 as ParamDescriptor, aa as DefinitionMap, ab as OperationDefinition, ac as WriteDefinitionOptions, ad as PartialQueryKeyOf, ae as StrictSelectSpec, af as ReadDefinitionOptions, ag as EntityInput, ah as UniqueQueryKeyOf, ai as EntityRef, aj as ConditionInput, ak as QueryModelContract, al as QueryMethodSpec, am as CommandModelContract, an as CommandMethodSpec, ao as ContractSpec, ap as QuerySpec, aq as CommandSpec, ar as ContextSpec, as as OperationsDocument, at as AnyOperationDefinition, au as BridgeBundle, av as ConditionSpec } from './types-BWOrWcbd.js';
|
|
2
|
+
export { aw as AggregateMetadata, ax as BatchDeleteRequest, ay as BatchGetOptions, az as BatchGetRequest, aA as BatchGetResult, aB as BatchPutRequest, aC as BatchResult, aD as BatchWriteRequest, aE as CONTRACT_RANGE_FANOUT_CONCURRENCY, aF as CdcMode, aG as Change, aH as ChangeBatch, aI as ChangeEventName, aJ as ClockMode, aK as CollectionEffect, aL as CollectionOptions, aM as Column, aN as ColumnMap, aO as CommandContractMethodSpec, aP as CommandInputShape, aQ as CommandMethod, aR as CommandPlan, aS as CommandResolutionTarget, aT as CommandResultKind, aU as CommandSelectShape, aV as CompiledFragment, aW as ComposeSpec, aX as CondSlot, aY as ConditionCheckInput, aZ as Connection, a_ as ContractCallSignature, a$ as ContractCardinality, b0 as ContractCommandParams, b1 as ContractCommandResult, b2 as ContractComposeNode, b3 as ContractFromRef, b4 as ContractInputArity, b5 as ContractItem, b6 as ContractKeyFieldRef, b7 as ContractKeyInput, b8 as ContractKeyRef, b9 as ContractKeySpec, ba as ContractKind, bb as ContractMethodOp, bc as ContractParamRef, bd as ContractQueryParams, be as ContractResolution, bf as CounterAggregate, bg as CounterEffect, bh as CtxBase, bi as DEFAULT_MAX_ATTEMPTS, bj as DEFAULT_RETRY_POLICY, bk as DeleteOptions, bl as DeriveEffect, bm as DerivedEdgeWrite, bn as DerivedUpdate, bo as DescriptorBinding, bp as ENTITY_WRITES_MARKER, bq as EdgeEffect, br as EffectPath, bs as EmbeddedMetadata, bt as EmitEffect, bu as EntityWritesDefinition, bv as EntityWritesShape, bw as ExecutableCommandContract, bx as ExecutableQueryContract, by as FilterInput, bz as FilterSpec, bA as FragmentInput, bB as GsiDefinitionMarker, bC as GsiOptions, bD as IdempotencyEffect, bE as InProcessWriteDescriptor, bF as InputArity, bG as KeyDefinitionMarker, bH as KeySegment, bI as KeySlot, bJ as KeyStructure, bK as KeyedResult, bL as LIFECYCLE_CONTRACT_MARKER, bM as LifecycleContract, bN as LifecycleEffects, bO as LiteralParam, bP as MaintainItem, bQ as MaintainTrigger, bR as MaintenanceGraph, bS as ManifestEntity, bT as ManifestField, bU as ManifestFieldType, bV as ManifestGsi, bW as ManifestKey, bX as ManifestRelation, bY as ManifestTable, bZ as MembershipEffect, b_ as ModelRef, b$ as MutateMode, c0 as MutateOptions, c1 as MutateParallelResult, c2 as MutateTransactionResult, c3 as MutationBody, c4 as MutationDescriptorMap, c5 as MutationFragment, c6 as MutationInputProxy, c7 as MutationInputRef, c8 as MutationIntent, c9 as NumberParam, ca as OperationKind, cb as OperationSpec, cc as ParallelOpResult, cd as ParamKind, ce as ParamSpec, cf as ParamStructure, cg as PersistCtx, ch as PersistOrigin, ci as PlannedCommandMethod, cj as ProjectionMap, ck as ProjectionTransformOp, cl as PutOptions, cm as QueryContractMethodSpec, cn as QueryEnvelopeResult, co as QueryKeyOf, cp as QueryMethod, cq as QueryResult, cr as RangeConditionSpec, cs as ReadEnvelope, ct as ReadOpCtx, cu as ReadOpKind, cv as ReadOperationType, cw as ReadRouteDescriptor, cx as ReadRouteOptions, cy as ReadRouteResult, cz as RecordedCompose, cA as RelationBuilder, cB as RelationConsistency, cC as RelationLimitOptions, cD as RelationPattern, cE as RelationProjection, cF as RelationReadOptions, cG as RelationSelect, cH as RelationSpec, cI as RelationUpdateMode, cJ as RelationWriteOptions, cK as RequiresEffect, cL as Resolution, cM as RetryInfo, cN as RetryOperationKind, cO as SPEC_VERSION, cP as SegmentSpec, cQ as SegmentedKey, cR as SelectBuilder, cS as SelectOf, cT as SnapshotEffect, cU as StartingPosition, cV as StreamViewType, cW as StringParam, cX as TransactionContext, cY as TransactionItemType, cZ as UniqueEffect, c_ as Updatable, c$ as UpdateOptions, d0 as ViewSourceSlice, d1 as WhenSpec, d2 as WriteCtx, d3 as WriteDescriptor, d4 as WriteEnvelope, d5 as WriteInput, d6 as WriteKind, d7 as WriteLifecyclePhase, d8 as WriteMiddleware, d9 as WriteOperationType, da as WriteRecorder, db as WriteResultProjection, dc as attachModelClass, dd as buildDeleteInput, de as buildMaintenanceGraph, df as buildPutInput, dg as buildUpdateInput, dh as collectViewDefinitions, di as compileFragment, dj as compileMutationPlan, dk as compileSingleFragmentPlan, dl as cond, dm as contractOfMethodSpec, dn as definePlan, dp as entityWrites, dq as executeBatchGet, dr as executeBatchWrite, ds as executeCommandMethod, dt as executeDelete, du as executeKeyedBatchGet, dv as executePut, dw as executeQueryMethod, dx as executeRangeFanout, dy as executeTransaction, dz as executeUpdate, dA as from, dB as getEntityWrites, dC as gsi, dD as identity, dE as isColumn, dF as isCommandModelContract, dG as isCommandPlan, dH as isContractComposeNode, dI as isContractFromRef, dJ as isContractKeyFieldRef, dK as isContractKeyRef, dL as isContractParamRef, dM as isEntityWritesDefinition, dN as isKeySegment, dO as isLifecycleContract, dP as isMaintainTrigger, dQ as isMutationFragment, dR as isMutationInputRef, dS as isParam, dT as isPlannedCommandMethod, dU as isQueryModelContract, dV as isRetryableError, dW as isRetryableTransactionCancellation, dX as k, dY as key, dZ as lifecyclePhaseForIntent, d_ as maintainTrigger, d$ as mintContractKeyFieldRef, e0 as mintContractParamRef, e1 as mutation, e2 as param, e3 as preview, e4 as publicCommandModel, e5 as publicQueryModel, e6 as query, e7 as resolveLifecycle, e8 as wholeKeysSentinel } from './types-BWOrWcbd.js';
|
|
3
3
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
4
4
|
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
|
|
5
5
|
|
|
@@ -386,6 +386,13 @@ interface ModelOptions {
|
|
|
386
386
|
* adapter validates this).
|
|
387
387
|
*/
|
|
388
388
|
kind?: ModelKind;
|
|
389
|
+
/**
|
|
390
|
+
* Optional human-readable description of the entity (issue #154). Pure
|
|
391
|
+
* documentation metadata — recorded into {@link EntityMetadata.description} and
|
|
392
|
+
* propagated to `manifest.json` + the generated Python class docstring. It does
|
|
393
|
+
* NOT affect storage, keys, or any runtime behaviour. Omit for unchanged output.
|
|
394
|
+
*/
|
|
395
|
+
description?: string;
|
|
389
396
|
}
|
|
390
397
|
declare function model(options: ModelOptions): (target: Function, context: ClassDecoratorContext) => void;
|
|
391
398
|
|
|
@@ -2262,13 +2269,13 @@ type EntityOf<M> = M extends ModelStatic<infer T, infer _C> ? T : never;
|
|
|
2262
2269
|
* the model's unique-key boundary (`UniqueQueryKeyOf`); `select` is the strict
|
|
2263
2270
|
* projection (#37) typed against the entity.
|
|
2264
2271
|
*/
|
|
2265
|
-
declare function defineQuery<M extends ModelStatic<DDBModel, AnyModelClass>, const K extends Parameterize<UniqueQueryKeyOf<ClassOf<M>>>, const S extends SelectableOf<EntityOf<M>>>(model: M, key: K & ExactParam<UniqueQueryKeyOf<ClassOf<M>>, K>, select: S & StrictSelectSpec<EntityOf<M>, S
|
|
2272
|
+
declare function defineQuery<M extends ModelStatic<DDBModel, AnyModelClass>, const K extends Parameterize<UniqueQueryKeyOf<ClassOf<M>>>, const S extends SelectableOf<EntityOf<M>>>(model: M, key: K & ExactParam<UniqueQueryKeyOf<ClassOf<M>>, K>, select: S & StrictSelectSpec<EntityOf<M>, S>, options?: ReadDefinitionOptions): OperationDefinition<EntityOf<M>, 'query', K, S, undefined, CollectParams<K>>;
|
|
2266
2273
|
/**
|
|
2267
2274
|
* Define a parameterized **partition read** (`list`). The `key` accepts a
|
|
2268
2275
|
* partial (partition-key) input with {@link Param} placeholders; `select` is
|
|
2269
2276
|
* the strict projection typed against the entity.
|
|
2270
2277
|
*/
|
|
2271
|
-
declare function defineList<M extends ModelStatic<DDBModel, AnyModelClass>, const K extends Parameterize<PartialQueryKeyOf<ClassOf<M>>>, const S extends SelectableOf<EntityOf<M>>>(model: M, key: K & ExactParam<PartialQueryKeyOf<ClassOf<M>>, K>, select: S & StrictSelectSpec<EntityOf<M>, S
|
|
2278
|
+
declare function defineList<M extends ModelStatic<DDBModel, AnyModelClass>, const K extends Parameterize<PartialQueryKeyOf<ClassOf<M>>>, const S extends SelectableOf<EntityOf<M>>>(model: M, key: K & ExactParam<PartialQueryKeyOf<ClassOf<M>>, K>, select: S & StrictSelectSpec<EntityOf<M>, S>, options?: ReadDefinitionOptions): OperationDefinition<EntityOf<M>, 'list', K, S, undefined, CollectParams<K>>;
|
|
2272
2279
|
/**
|
|
2273
2280
|
* Define a parameterized **put** (`put`). The `item` accepts {@link Param}
|
|
2274
2281
|
* placeholders at scalar leaves and is otherwise checked against `EntityInput`
|
package/dist/index.js
CHANGED
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
validateDepth,
|
|
80
80
|
when,
|
|
81
81
|
wholeKeysSentinel
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-G5RWWBAL.js";
|
|
83
83
|
import {
|
|
84
84
|
CdcEmulator,
|
|
85
85
|
MAINT_OUTBOX_PK_PREFIX,
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
orderAndTrimCollection,
|
|
92
92
|
pathField,
|
|
93
93
|
projectFrom
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-BROCT574.js";
|
|
95
95
|
import {
|
|
96
96
|
BATCH_GET_MAX_KEYS,
|
|
97
97
|
BATCH_WRITE_MAX_ITEMS,
|
|
@@ -154,7 +154,7 @@ import {
|
|
|
154
154
|
resolveModelClass,
|
|
155
155
|
segmentFieldNames,
|
|
156
156
|
serializeFieldValue
|
|
157
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-CPTV3H2U.js";
|
|
158
158
|
|
|
159
159
|
// src/metadata/prefix.ts
|
|
160
160
|
function derivePrefix(customPrefix, className) {
|
|
@@ -277,6 +277,7 @@ function model(options) {
|
|
|
277
277
|
aggregates,
|
|
278
278
|
embeddedFields,
|
|
279
279
|
kind,
|
|
280
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
280
281
|
maintainedFrom: maintainedFrom2
|
|
281
282
|
});
|
|
282
283
|
};
|
|
@@ -1596,7 +1597,15 @@ function collectParams(structure, out = {}) {
|
|
|
1596
1597
|
return out;
|
|
1597
1598
|
}
|
|
1598
1599
|
function descriptorFromParam(name, value, existing) {
|
|
1599
|
-
const descriptor =
|
|
1600
|
+
const descriptor = {
|
|
1601
|
+
kind: value.kind,
|
|
1602
|
+
...value.literals !== void 0 ? { literals: value.literals } : {},
|
|
1603
|
+
// Pure-documentation description (issue #154); carried through verbatim. Does
|
|
1604
|
+
// not participate in the conflicting-kind check below (it is not part of the
|
|
1605
|
+
// execution-relevant descriptor identity).
|
|
1606
|
+
...value.description !== void 0 ? { description: value.description } : {},
|
|
1607
|
+
required: true
|
|
1608
|
+
};
|
|
1600
1609
|
if (existing !== void 0 && existing.kind !== descriptor.kind) {
|
|
1601
1610
|
throw new Error(
|
|
1602
1611
|
`Parameter '${name}' is declared with conflicting types ('${existing.kind}' and '${descriptor.kind}'). A parameter name must have a single type across a definition.`
|
|
@@ -1693,7 +1702,7 @@ function collectConditionTreeParams(obj, out) {
|
|
|
1693
1702
|
}
|
|
1694
1703
|
}
|
|
1695
1704
|
}
|
|
1696
|
-
function makeDefinition(model2, operation, key2, select, changes, condition) {
|
|
1705
|
+
function makeDefinition(model2, operation, key2, select, changes, condition, description) {
|
|
1697
1706
|
const params = collectParams(key2);
|
|
1698
1707
|
if (changes !== void 0) collectParams(changes, params);
|
|
1699
1708
|
collectConditionParams(condition, params);
|
|
@@ -1705,25 +1714,30 @@ function makeDefinition(model2, operation, key2, select, changes, condition) {
|
|
|
1705
1714
|
select,
|
|
1706
1715
|
changes,
|
|
1707
1716
|
...condition !== void 0 ? { condition } : {},
|
|
1717
|
+
...description !== void 0 ? { description } : {},
|
|
1708
1718
|
params
|
|
1709
1719
|
};
|
|
1710
1720
|
}
|
|
1711
|
-
function defineQuery(model2, key2, select) {
|
|
1721
|
+
function defineQuery(model2, key2, select, options) {
|
|
1712
1722
|
return makeDefinition(
|
|
1713
1723
|
model2,
|
|
1714
1724
|
"query",
|
|
1715
1725
|
key2,
|
|
1716
1726
|
select,
|
|
1717
|
-
void 0
|
|
1727
|
+
void 0,
|
|
1728
|
+
void 0,
|
|
1729
|
+
options?.description
|
|
1718
1730
|
);
|
|
1719
1731
|
}
|
|
1720
|
-
function defineList(model2, key2, select) {
|
|
1732
|
+
function defineList(model2, key2, select, options) {
|
|
1721
1733
|
return makeDefinition(
|
|
1722
1734
|
model2,
|
|
1723
1735
|
"list",
|
|
1724
1736
|
key2,
|
|
1725
1737
|
select,
|
|
1726
|
-
void 0
|
|
1738
|
+
void 0,
|
|
1739
|
+
void 0,
|
|
1740
|
+
options?.description
|
|
1727
1741
|
);
|
|
1728
1742
|
}
|
|
1729
1743
|
function definePut(model2, item, options) {
|
|
@@ -1733,7 +1747,8 @@ function definePut(model2, item, options) {
|
|
|
1733
1747
|
item,
|
|
1734
1748
|
void 0,
|
|
1735
1749
|
void 0,
|
|
1736
|
-
options?.condition
|
|
1750
|
+
options?.condition,
|
|
1751
|
+
options?.description
|
|
1737
1752
|
);
|
|
1738
1753
|
}
|
|
1739
1754
|
function defineUpdate(model2, key2, changes, options) {
|
|
@@ -1743,7 +1758,8 @@ function defineUpdate(model2, key2, changes, options) {
|
|
|
1743
1758
|
key2,
|
|
1744
1759
|
void 0,
|
|
1745
1760
|
changes,
|
|
1746
|
-
options?.condition
|
|
1761
|
+
options?.condition,
|
|
1762
|
+
options?.description
|
|
1747
1763
|
);
|
|
1748
1764
|
}
|
|
1749
1765
|
function defineDelete(model2, key2, options) {
|
|
@@ -1753,7 +1769,8 @@ function defineDelete(model2, key2, options) {
|
|
|
1753
1769
|
key2,
|
|
1754
1770
|
void 0,
|
|
1755
1771
|
void 0,
|
|
1756
|
-
options?.condition
|
|
1772
|
+
options?.condition,
|
|
1773
|
+
options?.description
|
|
1757
1774
|
);
|
|
1758
1775
|
}
|
|
1759
1776
|
function defineQueries(definitions) {
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Executor, D as DynamoDBOperation, R as ReadExecOptions, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, e as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, f as DDBModel, C as ChangeEvent } from '../types-
|
|
1
|
+
import { E as Executor, D as DynamoDBOperation, R as ReadExecOptions, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, e as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, f as DDBModel, C as ChangeEvent } from '../types-BWOrWcbd.js';
|
|
2
2
|
import '@aws-sdk/client-dynamodb';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/testing/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCdcEmulator
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-BROCT574.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientManager,
|
|
6
6
|
MetadataRegistry,
|
|
7
7
|
TableMapping,
|
|
8
8
|
resolveModelClass
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-CPTV3H2U.js";
|
|
10
10
|
|
|
11
11
|
// src/memory/memory-store.ts
|
|
12
12
|
function deepClone(value) {
|