Protected
The Entity
token.
The EntityMap
.
The TranscodeMap
identifying transcodable property types. Only Entity
properties of these types can be components of an index or a generated property.
Optional
defaultThe default maximum number of records to return from a query.
10
Can be overridden at QueryOptions.limit
.
In cross-shard queries, the actual number of records returned is heavily influenced by query pageSize and the number of shards queried. Actual results may significantly exceed this limit.
Optional
defaultThe default maximum number of records to return per data page on an individual shard query.
10
Shard queries will be repeated internally until either the shard is exhausted or the number of records returned exceeds the query limit.
Can be overridden at QueryOptions.pageSize
.
Optional
elementThis object assigns transcodes to Entity
generated property & ungenerated index elements.
These transcodes are used to encode and decode generated property values & pageKeys.
The keys of this object must be transcodable properties of the Entity
.
The values of this object must be one of the keys of the Config
T
type parameter (the config's TranscodeMap
).
The types of the related Entity
and TranscodeMap
properties should match.
If any entity generated property element or ungenerated index element is not included here, the Config
object will fail to parse.
// Default transcodable types.
interface DefaultTranscodeMap extends TranscodeMap {
string: string;
number: number;
boolean: boolean;
bigint: bigint;
}
interface MyEntityMap extends EntityMap {
user: {
created: number;
data?: Json; // Not a Stringifiable type
userId: string;
};
}
// T type param defaults to DefaultTranscodeMap.
const config: Config<MyEntityMap> = {
entities: {
user: {
...,
types: { // All Stringafiable properties required!
created: 'number',
userId: 'string',
// 'data' not allowed: not a Stringifiable type
}
}
},
...
};
Optional
indexes?: Record<string, (Indexes defined for the Entity
. Should reflect the underlying database table indexes.
Each key is the name of an index, and each value is a non-empty array of Entity
property names that define the index.
Related property types must be align with the Config
T
type parameter. Note tha all generated property types are transcodable by definition.
Optional
shardAn array of ShardBump
objects representing the Entity
's sharding strategy.
If omitted, or if configured without a zero-timestamp
ShardBump
, this array will be initialized with the following ShardBump
as its first member:
{ timestamp: 0, charBits: 0, chars: 1 }
Members must be unique by timestamp
.
chars
must increase monotonically with timestamp
Array will be sorted in ascending order by timestamp
on initialization.
Future ShardBumps
can be changed as required, but past ShardBumps
should not be modified or data integrity will be compromised!
Identifies the Entity
property used as the timestamp for shard key calculations.
This property must be of type number
. Its value should not change over the life of the record. A created
timestamp is ideal.
Once in production, this configuration property should not be changed or data integrity will be compromised!
Identifies the Entity
used as the basis for both shard key calculations and the table's range key.
This property must be of type string
or number
. Its value should be a unique record identifier and should not change over the life of the record.
Once in production, this configuration property should not be changed or data integrity will be compromised!
Returns a Config entity type.