Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More β†’
Socket
Book a DemoInstallSign in
Socket

@aws-amplify/datastore

Package Overview
Dependencies
Maintainers
6
Versions
1951
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/datastore

AppSyncLocal support for aws-amplify

Source
npmnpm
Version
5.0.88
Version published
Weekly downloads
925K
0.02%
Maintainers
6
Weekly downloads
Β 
Created
Source

INTERNAL USE ONLY

This package contains the AWS Amplify DataStore category and is intended for internal use only. To integrate Amplify into your app, please use aws-amplify.

AWS Amplify DataStore Docs

Amplify DataStore provides a programming model for leveraging shared and distributed data without writing additional code for offline and online scenarios, which makes working with distributed, cross-user data just as simple as working with local-only data.

packageversionopen issuesclosed issues
@aws-amplify/datastorenpmOpen IssuesClosed Issues

πŸ‘‹ Note For Contributers: πŸ‘‹

Please update these docs any time you find something that is incorrect or lacking. In particular, if a line in the docs prompts a question, take a moment to figure out the answer, then update the docs with the necessary detail.

Getting Started

Before you start reading through these docs, take a moment to understand how DataStore works at a high level. Additionally, we recommend first reading through docs.amplify.aws. The purpose of these docs is to dive deep into the codebase itself and understand the inner workings of DataStore for the purpose of contributing. Understanding these docs is not necessary for using DataStore. Lastly, before reading, take a look at the diagrams below.

Docs

Diagrams

Note: relationships with dotted lines are explained more in a separate diagram.

How the DataStore API and Storage Engine Interact

flowchart TD
  %% API and Storage
  api[[DS API]]-- observe -->storage{Storage Engine}
  storage-- next -->adapter[[Adapter]]
  adapter-->db[[Local DB]]
  db-->api
  sync[[Sync Engine*]]-.-storage
  sync-.-appSync[(AppSync)]

How the Sync Engine Observes Changes in Storage and AppSync

Note: All green nodes belong to the Sync Engine.

* Merger first checks outbox

** Outbox sends outgoing messages to AppSync

flowchart TD

  subgraph SyncEngine
  index{index.ts}-- observe -->reach[Core reachability]

  subgraph processors
  mp[Mutation Processor]
  sp[Subscription Processor]
  syp[Sync Processor]
  end

  reach--next-->mp[Mutation Processor]
  reach--next-->sp[Subscription Processor]
  reach--next-->syp[Sync Processor]

  subgraph outbox / merger
  outbox[Outbox]
  merger[Merger]
  outbox---merger
  end

  end

  api[DS API]-.->storage
  mp-- 1. observe -->storage{Storage Engine}
  storage-- 2. next -->merger[merger*]-- next -->storage


  sp-- observe -->appsync[(AppSync)]
  appsync-- next -->sp

  syp---appsync

  mp-->outbox[outbox**]

  appsync<--->outbox
  %% styling
  classDef syncEngineClass fill:#8FB,stroke:#333,stroke-width:4px,color:#333;
  class index,mp,sp,syp,merger,outbox syncEngineClass;

Project Structure

amplify-js/packages/datastore/src
β”œβ”€β”€ authModeStrategies
β”‚   └── defaultAuthStraegy.ts
β”‚   └── index.ts
β”‚   └── multiAuthStrategy.ts
β”œβ”€β”€ datastore
β”‚   └── datastore.ts # Entry point for DataStore
β”œβ”€β”€ predicates
β”‚   └── index.ts
β”‚   └── sort.ts
β”œβ”€β”€ ssr
β”œβ”€β”€ storage # Storage Engine
β”‚   └── adapter # Platform-specific Storage Adapters
β”‚      └── getDefaultAdapter
β”‚      └── AsyncStorageAdapter.ts
β”‚      └── AsyncStorageDatabase.ts
β”‚      └── index.ts
β”‚      └── IndexedDBAdapter.ts
β”‚      └── InMemoryStore.native.ts
β”‚      └── InMemoryStore.ts
β”‚   └── storage.ts # Entry point for Storage
β”œβ”€β”€ sync # Sync Engine
β”‚   └── dataStoreReachability
β”‚      └── index.native.ts
β”‚      └── index.ts
β”‚   └── processors # Sync Engine Processors
β”‚      └── mutation.ts
β”‚      └── subscription.ts
β”‚      └── sync.ts
β”‚   └── datastoreConnectivity.ts # Subscribe to reachability monitor
β”‚   └── index.ts # Entry point for Sync Engine
β”‚   └── merger.ts # doc
β”‚   └── outbox.ts # doc

Other Resources:

FAQs

Package last updated on 06 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts