@nerdware/ddb-single-table
Version:
A schema-based DynamoDB modeling tool, high-level API, and type-generator built to supercharge single-table designs!⚡
24 lines • 1.01 kB
TypeScript
import type { TableKeysSchemaType, ModelSchemaType, AttributeFunctionDefault } from "../../Schema/types/index.js";
import type { AttrAliasOrName, AttrValue } from "../../types/index.js";
/**
* This generic is used by the `Model` class to provide intellisense for the aliased
* key-parameters that methods like `getItem()` and `deleteItem()` accept as input.
*/
export type KeyParameters<Schema extends TableKeysSchemaType | ModelSchemaType> = {
-readonly [Key in keyof Schema as Schema[Key] extends {
isHashKey: true;
} | {
isRangeKey: true;
default?: undefined;
} ? AttrAliasOrName<Schema, Key, {
aliasKeys: true;
}> : never]-?: AttrValue<Schema[Key], object, 0>;
} & {
-readonly [Key in keyof Schema as Schema[Key] extends {
isRangeKey: true;
default: AttributeFunctionDefault;
} ? AttrAliasOrName<Schema, Key, {
aliasKeys: true;
}> : never]+?: AttrValue<Schema[Key], object, 0>;
};
//# sourceMappingURL=KeyParameters.d.ts.map