0.5.0 • Published 6 years ago

@tingcore/awsome v0.5.0

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
6 years ago

awsome

AWSome AWS utilities for web browsers and React Native.

Notes

This library assumes a somewhat standards-compliant, browser-like environment. It will not work by default in Node. Missing features must to be polyfilled.

In React Native, you will need to link the native dependencies first.

react-native link amazon-cognito-identity-js

Required features:

The list may be incomplete.

  • Browser
    • XMLHttpRequest
    • navigator
  • ECMAScript 2015
    • Map
    • Promise
    • Symbol, Symbol.for, Symbol.iterator
    • Array.from
    • ArrayBuffer, Uint8Array, Uint32Array, Int32Array
  • WHATWG Fetch
    • fetch
    • Request
    • Headers
    • Headers.prototype[Symbol.iterator]
  • WHATWG URL
    • URL (Must have the searchParams getter/setter)
    • URLSearchParams
    • URLSearchParams.prototype[Symbol.iterator]

Optional features:

Example

import { SignInResultType, UserPool } from '@tingcore/awsome';

const userPool = new UserPool({
  region: '<REGION>',
  clientId: '<CLIENT_ID>',
  userPoolId: '<USER_POOL_ID>',
  identityPoolId: '<IDENTITY_POOL_ID>',
});

(async () => {
  const signInResult = await userPool.signIn('<USERNAME>', '<PASSWORD>');

  if (signInResult.type === SignInResultType.Authenticated) {
    const { user } = signInResult;

    // Call an API behind API Gateway
    // The request will be signed with the current credentials using AWS Signature V4
    const url = 'https://<API_ID>.execute-api.<REGION>.amazonaws.com/<STAGE_NAME>/<RESOURCE_PATH>';

    const response = await user.fetchWithSignature(url);
    const data = await response.json();

    console.log(data);
  }
})();
0.5.0

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago