Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: refactor exports
  • Loading branch information
jjarvisp committed May 21, 2025
commit 069893e7aad135e90c57e0622bea26d8887a0713
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getIsNativeError } from '@aws-amplify/react-native/internals/utils';
import { getIsNativeError } from '@aws-amplify/react-native';

import {
PasskeyError,
Expand All @@ -12,7 +12,7 @@ import { MockNativeError } from '../../../../mockData';
const mockHandlePasskeyError = jest.mocked(handlePasskeyError);
jest.mock('../../../../../src/client/utils/passkey/errors/handlePasskeyError');

jest.mock('@aws-amplify/react-native/internals/utils', () => ({
jest.mock('@aws-amplify/react-native', () => ({
getIsNativeError: jest.fn(() => true),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { handlePasskeyError } from '../../../../../src/client/utils/passkey/erro
import { passkeyErrorMap } from '../../../../../src/client/utils/passkey/errors/passkeyError';
import { MockNativeError } from '../../../../mockData';

jest.mock('@aws-amplify/react-native/internals/utils', () => ({
jest.mock('@aws-amplify/react-native', () => ({
getIsNativeError: jest.fn(() => true),
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getIsNativeError } from '@aws-amplify/react-native/internals/utils';
import { getIsNativeError } from '@aws-amplify/react-native';

import {
PasskeyError,
Expand All @@ -12,7 +12,7 @@ import { MockNativeError } from '../../../../mockData';
const mockHandlePasskeyError = jest.mocked(handlePasskeyError);
jest.mock('../../../../../src/client/utils/passkey/errors/handlePasskeyError');

jest.mock('@aws-amplify/react-native/internals/utils', () => ({
jest.mock('@aws-amplify/react-native', () => ({
getIsNativeError: jest.fn(() => true),
}));

Expand Down Expand Up @@ -46,6 +46,7 @@ describe('handlePasskeyRegistrationError', () => {
);
expect(mockGetIsNativeError).toHaveBeenCalledWith(err);
});

it('returns new instance of PasskeyError with correct attributes when input error code is DUPLICATE', () => {
const err = new MockNativeError();
err.code = 'DUPLICATE';
Expand Down
8 changes: 7 additions & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@
"tslib": "^2.5.0"
},
"peerDependencies": {
"@aws-amplify/core": "^6.1.0"
"@aws-amplify/core": "^6.1.0",
"@aws-amplify/react-native": "^1.1.10"
},
"peerDependenciesMeta": {
"@aws-amplify/react-native": {
"optional": true
}
},
"devDependencies": {
"@aws-amplify/core": "6.11.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { getIsNativeError } from '@aws-amplify/react-native/internals/utils';
import { getIsNativeError } from '@aws-amplify/react-native';

import { handlePasskeyError } from './handlePasskeyError';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { AmplifyErrorCode } from '@aws-amplify/core/internals/utils';
import { getIsNativeError } from '@aws-amplify/react-native/internals/utils';
import { getIsNativeError } from '@aws-amplify/react-native';

import {
PasskeyError,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { getIsNativeError } from '@aws-amplify/react-native/internals/utils';
import { getIsNativeError } from '@aws-amplify/react-native';

import { handlePasskeyError } from './handlePasskeyError';
import {
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> INTERNAL USE ONLY

This package contains AWS Amplify React Native utilities and is intended for internal use only. Please ensure this package is installed alongside [aws-amplify](https://www.npmjs.com/package/aws-amplify). We do not advise using any exports from this package directly.
8 changes: 0 additions & 8 deletions packages/react-native/internals/utils/package.json

This file was deleted.

23 changes: 7 additions & 16 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,6 @@
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"react-native": "./dist/cjs/index.js",
"types": "./dist/esm/index.d.ts",
"import": "./dist/esm/index.mjs",
"require": "./dist/cjs/index.js"
},
"./internals/utils": {
"react-native": "./dist/cjs/utils/index.js",
"types": "./dist/esm/utils/index.d.ts",
"import": "./dist/esm/utils/index.mjs",
"require": "./dist/cjs/utils/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"prepare:ios": "cd example && npx pod-install",
"prepare:android": "echo 'no-op'",
Expand All @@ -48,7 +33,13 @@
},
"peerDependencies": {
"react-native": ">=0.70",
"react-native-get-random-values": ">=1.8.0"
"react-native-get-random-values": ">=1.8.0",
"@aws-amplify/rtn-passkeys": "^1.0.0"
},
"peerDependenciesMeta": {
"@aws-amplify/rtn-passkeys": {
"optional": true
}
},
"devDependencies": {
"@aws-amplify/rtn-passkeys": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

export interface NativeError extends Error {
interface NativeError extends Error {
code: string;
domain?: string;
userInfo?: Record<string, unknown>;
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/src/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { computeModPow } from './computeModPow';
export { computeS } from './computeS';
export { getOperatingSystem } from './getOperatingSystem';
export { getDeviceName } from './getDeviceName';
export { getIsNativeError } from './getIsNativeError';
1 change: 1 addition & 0 deletions packages/react-native/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export {
computeS,
getOperatingSystem,
getDeviceName,
getIsNativeError,
} from './apis';
export {
loadAmplifyRtnPasskeys,
Expand Down
4 changes: 0 additions & 4 deletions packages/react-native/src/utils/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/rtn-passkeys/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> INTERNAL USE ONLY

This package contains AWS Amplify React Native utilities and is intended for internal use only. Please ensure this package is installed alongside [aws-amplify](https://www.npmjs.com/package/aws-amplify) and [@aws-amplify/react-native](https://www.npmjs.com/package/@aws-amplify/react-native). We do not advise using any exports from this package directly.
2 changes: 1 addition & 1 deletion packages/rtn-passkeys/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-amplify/rtn-passkeys",
"version": "0.1.0",
"version": "1.0.0",
"description": "React Native module for aws-amplify webauthn support",
"source": "./src/index.ts",
"main": "./dist/cjs/index.js",
Expand Down
Loading