Skip to content

Commit

Permalink
Doc updates, re-enable NPM publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebroberts committed Sep 6, 2023
1 parent 03af10c commit 94a622f
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 65 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
# Modify package.json, inserting version attribute
- run: npm version $RELEASE_VERSION --no-git-tag-version
# Perform publish, which will also run prepublishOnly
# - run: npm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm run generate-docs

Expand Down
167 changes: 113 additions & 54 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/lib/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export type EntityParser<T> = (
) => T

/**
* Every object stored via Entity Store must have a corresponding Entity
* Each entity must be related to type (TItem) that must at least define the table key fields, and optionally
* all the other fields of the internal representation of an object
* Every object stored via Entity Store must have a corresponding Entity.
* Each entity must be related to a type (`TItem`) that must at least define the table key fields, and optionally
* the other fields of the internal representation of an object
*/
export interface Entity<TItem extends TPKSource & TSKSource, TPKSource, TSKSource> {
/**
Expand Down
21 changes: 21 additions & 0 deletions src/lib/entityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,34 @@ import { MultipleEntityOperations } from './multipleEntityOperations'
import { SingleEntityOperations } from './singleEntityOperations'
import { TransactionOperations } from './transactionOperations'

/**
* Top-level interface for all operations in dynamodb-entity-store.
* Typically use the `for(entity)` method, but use the other methods here for more advanced usage
*/
export interface AllEntitiesStore {
/**
* Build an object to work with one specific Entity. To work with multiple entities in one operation
* use one of the other methods on this type. But to perform multiple operations that each use
* an individual entity type then just call this for each entity type.
* This method is fairly cheap, so feel free to either call it for every operation, or call it and
* cache it - it's up to you and your style
* @param entity
*/
for<TItem extends TPKSource & TSKSource, TPKSource, TSKSource>(
entity: Entity<TItem, TPKSource, TSKSource>
): SingleEntityOperations<TItem, TPKSource, TSKSource>

/**
* Build an object to work with multiple entities in one (non-transactional) operation.
* This can be useful, for example, if you want to use
* one query to return multiple entities that each share a common partition key.
* @param entities
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
forMultiple(entities: Entity<any, any, any>[]): MultipleEntityOperations

/**
* An object to wrap all transactional operations
*/
transactions: TransactionOperations
}
6 changes: 6 additions & 0 deletions src/lib/singleEntityOperations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { DynamoDBValues } from './entities'
import { SingleEntityAdvancedOperations } from './singleEntityAdvancedOperations'

/**
* All the operations available when working with one entity at a time.
* This interface contains the "simple" versions of equivalent DynamoDB operations,
* but if you need more advanced behavior - e.g. for reading DynamoDB metadata - then use
* the versions on `advancedOperations`
*/
export interface SingleEntityOperations<TItem extends TPKSource & TSKSource, TPKSource, TSKSource> {
advancedOperations: SingleEntityAdvancedOperations<TItem, TPKSource, TSKSource>

Expand Down
8 changes: 3 additions & 5 deletions src/lib/tableBackedStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ import { TableBackedGetTransactionBuilder } from './internal/transactions/tableB
import { GetTransactionBuilder, WriteTransactionBuilder } from './transactionOperations'

/**
* Entry point to dynamodb-entity-store. Given a configuration, create the entity store interface on
* top of DynamoDB.
* A Table Backed Store can use either one DynamoDB backing store, or several; and can be used to persist
* one entity type, or several.
* @param config - either using objects created from configSupport.ts, or you can fully customize
* Entry point to dynamodb-entity-store. A Table Backed Store can use either one DynamoDB backing table,
* or several; and can be used to persist one entity type, or several.
* @param config - either using objects created from configSupport.ts, (e.g. `createStandardSingleTableStoreConfig`) or you can fully customize
*/
export function createStore(config: TableBackedStoreConfiguration): AllEntitiesStore {
const tableConfigResolver = resolverFor(config)
Expand Down

0 comments on commit 94a622f

Please sign in to comment.