How to use the @aws-amplify/core.register function in @aws-amplify/core

To help you get started, we’ve selected a few @aws-amplify/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-js / packages / storage / src / index.ts View on Github external
logger.debug('storage configure called');
        const vaultConfig = {...old_configure.call(_instance, options)};

        // set level private for each provider for the vault
        Object.keys(vaultConfig).forEach((providerName) => {
            if (typeof vaultConfig[providerName] !== 'string') {
                vaultConfig[providerName] = { ...vaultConfig[providerName], level: "private" };
            }
        });
        logger.debug('storage vault configure called');
        _instance.vault.configure(vaultConfig);
    };
}

const Storage = _instance;
Amplify.register(Storage);

export default Storage;
export { StorageClass };
export { StorageProvider };
export * from './Providers';
github aws-amplify / amplify-js / packages / api / src / index.ts View on Github external
import APIClass, { graphqlOperation } from './API';
import { GraphQLResult } from './types';

import Amplify, { ConsoleLogger as Logger } from '@aws-amplify/core';

const logger = new Logger('API');

let _instance: APIClass = null;

if (!_instance) {
	logger.debug('Create API Instance');
	_instance = new APIClass(null);
}

const API = _instance;
Amplify.register(API);

export default API;
export { APIClass, graphqlOperation, GraphQLResult };
github aws-amplify / amplify-js / packages / cache / src / index.ts View on Github external
*     http://aws.amazon.com/apache2.0/
 *
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

import Amplify from '@aws-amplify/core';
import BrowserStorageCache from './BrowserStorageCache';
import InMemoryCache from './InMemoryCache';
import { CacheConfig } from './types';

export { BrowserStorageCache, InMemoryCache, CacheConfig };
export default BrowserStorageCache;

Amplify.register(BrowserStorageCache);
github aws-amplify / amplify-js / packages / predictions / src / index.ts View on Github external
AmazonAIConvertPredictionsProvider, AmazonAIIdentifyPredictionsProvider,
    AmazonAIPredictionsProvider, AmazonAIInterpretPredictionsProvider,
} from './Providers';

import { InterpretTextCategories } from './types';
const logger = new Logger('PubSub');

let _instance: PredictionsClass = null;

if (!_instance) {
    logger.debug('Create Predictions Instance');
    _instance = new PredictionsClass({});
}

const Predictions = _instance;
Amplify.register(Predictions);

export default Predictions;
export {
    AmazonAIIdentifyPredictionsProvider, AmazonAIConvertPredictionsProvider,
    AmazonAIPredictionsProvider, AmazonAIInterpretPredictionsProvider, InterpretTextCategories
};
github aws-amplify / amplify-js / packages / api-graphql / src / GraphQLAPI.ts View on Github external
return true;
			})
			.catch(err => {
				logger.warn('ensure credentials error', err);
				return false;
			});
	}
}

let _instance: GraphQLAPIClass = null;

if (!_instance) {
	logger.debug('Creating GraphQL API Instance');
	_instance = new GraphQLAPIClass(null);
	Amplify.register(_instance);
}

export { _instance as GraphQLAPI };
github aws-amplify / amplify-js / packages / analytics / src / index.ts View on Github external
} from '@aws-amplify/core';

const logger = new Logger('Analytics');
let endpointUpdated = false;
let authConfigured = false;
let analyticsConfigured = false;

let _instance: AnalyticsClass = null;

if (!_instance) {
    logger.debug('Create Analytics Instance');
    _instance = new AnalyticsClass();
}

const Analytics = _instance;
Amplify.register(Analytics);

export default Analytics;
export { AnalyticsProvider };
export { AnalyticsClass };
export * from './Providers';

const listener = (capsule) => {
    const { channel, payload, source } = capsule;
    logger.debug('on hub capsule ' + channel, payload);

    switch(channel) {
        case 'auth':
            authEvent(payload);
            break;
        case 'storage':
            storageEvent(payload);
github aws-amplify / amplify-js / packages / analytics / src / index.ts View on Github external
import Amplify, { ConsoleLogger as Logger, Hub } from '@aws-amplify/core';

const logger = new Logger('Analytics');
let endpointUpdated = false;
let authConfigured = false;
let analyticsConfigured = false;

let _instance: AnalyticsClass = null;

if (!_instance) {
	logger.debug('Create Analytics Instance');
	_instance = new AnalyticsClass();
}

const Analytics = _instance;
Amplify.register(Analytics);

export default Analytics;
export { AnalyticsProvider };
export { AnalyticsClass };
export * from './Providers';

const listener = capsule => {
	const { channel, payload, source } = capsule;
	logger.debug('on hub capsule ' + channel, payload);

	switch (channel) {
		case 'auth':
			authEvent(payload);
			break;
		case 'storage':
			storageEvent(payload);
github aws-amplify / amplify-js / packages / auth / src / index.ts View on Github external
import AuthClass from './Auth';
import { CookieStorage }from 'amazon-cognito-identity-js';
import Amplify, { ConsoleLogger as Logger, Credentials } from '@aws-amplify/core';

const logger = new Logger('Auth');

let _instance: AuthClass = null;

if (!_instance) {
    logger.debug('Create Auth Instance');
    _instance = new AuthClass(null);
}

const Auth = _instance;
Amplify.register(Auth);

export default Auth;
export { AuthClass, CookieStorage };
github aws-amplify / amplify-js / packages / xr / src / index.ts View on Github external
*/
import XRClass from './XR';

import Amplify, { ConsoleLogger as Logger } from '@aws-amplify/core';

const logger = new Logger('XR');

let _instance: XRClass = null;

if (!_instance) {
    logger.debug('Create XR Instance');
    _instance = new XRClass(null);
}

const XR = _instance;
Amplify.register(XR);

export default XR;

export * from './Providers/SumerianProvider';

export {XRClass};

export * from './Errors';
github aws-amplify / amplify-js / packages / predictions / src / index.ts View on Github external
AmazonAIPredictionsProvider,
	AmazonAIInterpretPredictionsProvider,
} from './Providers';

import { InterpretTextCategories } from './types';
const logger = new Logger('Predictions');

let _instance: PredictionsClass = null;

if (!_instance) {
	logger.debug('Create Predictions Instance');
	_instance = new PredictionsClass({});
}

const Predictions = _instance;
Amplify.register(Predictions);

export default Predictions;
export {
	AmazonAIIdentifyPredictionsProvider,
	AmazonAIConvertPredictionsProvider,
	AmazonAIPredictionsProvider,
	AmazonAIInterpretPredictionsProvider,
	InterpretTextCategories,
};