Skip to content

Commit 4988d51

Browse files
authored
fix(pubsub): Vite build issues (#10353)
1 parent 3798cea commit 4988d51

File tree

8 files changed

+69
-67
lines changed

8 files changed

+69
-67
lines changed

packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { GraphQLError } from 'graphql';
1515
import * as url from 'url';
1616
import { v4 as uuid } from 'uuid';
1717
import { Buffer } from 'buffer';
18-
import { ProviderOptions } from '../../types';
18+
import { ProviderOptions } from '../../types/Provider';
1919
import {
2020
Logger,
2121
Credentials,
@@ -30,7 +30,7 @@ import {
3030
import Cache from '@aws-amplify/cache';
3131
import Auth, { GRAPHQL_AUTH_MODE } from '@aws-amplify/auth';
3232
import { AbstractPubSubProvider } from '../PubSubProvider';
33-
import { CONNECTION_STATE_CHANGE, CONTROL_MSG } from '../../index';
33+
import { CONTROL_MSG } from '../../types/PubSub';
3434

3535
import {
3636
AMPLIFY_SYMBOL,
@@ -44,6 +44,7 @@ import {
4444
SOCKET_STATUS,
4545
START_ACK_TIMEOUT,
4646
SUBSCRIPTION_STATUS,
47+
CONNECTION_STATE_CHANGE,
4748
} from '../constants';
4849
import {
4950
ConnectionStateMonitor,

packages/pubsub/src/Providers/MqttOverWSProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import { v4 as uuid } from 'uuid';
1515
import Observable from 'zen-observable-ts';
1616

1717
import { AbstractPubSubProvider } from './PubSubProvider';
18-
import { ProviderOptions, SubscriptionObserver } from '../types';
18+
import { SubscriptionObserver } from '../types/PubSub';
19+
import { ProviderOptions } from '../types/Provider';
1920
import { ConsoleLogger as Logger, Hub } from '@aws-amplify/core';
2021
import {
2122
ConnectionStateMonitor,

packages/pubsub/src/Providers/PubSubProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* and limitations under the License.
1212
*/
1313
import Observable from 'zen-observable-ts';
14-
import { PubSubProvider, ProviderOptions } from '../types';
14+
import { PubSubProvider, ProviderOptions } from '../types/Provider';
1515
import { ConsoleLogger as Logger } from '@aws-amplify/core';
1616

1717
const logger = new Logger('AbstractPubSubProvider');

packages/pubsub/src/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,11 @@ import { PubSub } from './PubSub';
1414

1515
export * from './Providers';
1616

17-
enum CONTROL_MSG {
18-
CONNECTION_CLOSED = 'Connection closed',
19-
CONNECTION_FAILED = 'Connection failed',
20-
REALTIME_SUBSCRIPTION_INIT_ERROR = 'AppSync Realtime subscription init error',
21-
SUBSCRIPTION_ACK = 'Subscription ack',
22-
TIMEOUT_DISCONNECT = 'Timeout disconnect',
23-
}
24-
2517
export { CONNECTION_STATE_CHANGE } from './Providers/constants';
2618

27-
export { ConnectionState } from './types';
19+
export { ConnectionState, CONTROL_MSG } from './types';
2820

29-
export { PubSub, CONTROL_MSG };
21+
export { PubSub };
3022

3123
/**
3224
* @deprecated use named import

packages/pubsub/src/types/Provider.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@
1111
* and limitations under the License.
1212
*/
1313
import Observable from 'zen-observable-ts';
14-
import { ProviderOptions } from './PubSub';
14+
15+
export interface PubSubOptions {
16+
[key: string]: any;
17+
}
18+
19+
export interface ProviderOptions {
20+
[key: string]: any;
21+
}
22+
23+
/**
24+
* @deprecated Migrated to ProviderOptions
25+
*/
26+
export type ProvidertOptions = ProviderOptions;
1527

1628
export interface PubSubProvider {
1729
// configure your provider

packages/pubsub/src/types/PubSub.ts

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,54 @@
1010
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
1111
* and limitations under the License.
1212
*/
13-
export interface PubSubOptions {
14-
[key: string]: any;
13+
14+
export interface SubscriptionObserver<T> {
15+
closed: boolean;
16+
next(value: T): void;
17+
error(errorValue: any): void;
18+
complete(): void;
1519
}
1620

17-
export interface ProviderOptions {
18-
[key: string]: any;
21+
export enum CONTROL_MSG {
22+
CONNECTION_CLOSED = 'Connection closed',
23+
CONNECTION_FAILED = 'Connection failed',
24+
REALTIME_SUBSCRIPTION_INIT_ERROR = 'AppSync Realtime subscription init error',
25+
SUBSCRIPTION_ACK = 'Subscription ack',
26+
TIMEOUT_DISCONNECT = 'Timeout disconnect',
1927
}
2028

21-
/**
22-
* @deprecated Migrated to ProviderOptions
23-
*/
24-
export type ProvidertOptions = ProviderOptions;
29+
/** @enum {string} */
30+
export enum ConnectionState {
31+
/*
32+
* The connection is alive and healthy
33+
*/
34+
Connected = 'Connected',
35+
/*
36+
* The connection is alive, but the connection is offline
37+
*/
38+
ConnectedPendingNetwork = 'ConnectedPendingNetwork',
39+
/*
40+
* The connection has been disconnected while in use
41+
*/
42+
ConnectionDisrupted = 'ConnectionDisrupted',
43+
/*
44+
* The connection has been disconnected and the network is offline
45+
*/
46+
ConnectionDisruptedPendingNetwork = 'ConnectionDisruptedPendingNetwork',
47+
/*
48+
* The connection is in the process of connecting
49+
*/
50+
Connecting = 'Connecting',
51+
/*
52+
* The connection is not in use and is being disconnected
53+
*/
54+
ConnectedPendingDisconnect = 'ConnectedPendingDisconnect',
55+
/*
56+
* The connection is not in use and has been disconnected
57+
*/
58+
Disconnected = 'Disconnected',
59+
/*
60+
* The connection is alive, but a keep alive message has been missed
61+
*/
62+
ConnectedPendingKeepAlive = 'ConnectedPendingKeepAlive',
63+
}

packages/pubsub/src/types/index.ts

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,3 @@
1212
*/
1313
export * from './Provider';
1414
export * from './PubSub';
15-
16-
export interface SubscriptionObserver<T> {
17-
closed: boolean;
18-
next(value: T): void;
19-
error(errorValue: any): void;
20-
complete(): void;
21-
}
22-
23-
/** @enum {string} */
24-
export enum ConnectionState {
25-
/*
26-
* The connection is alive and healthy
27-
*/
28-
Connected = 'Connected',
29-
/*
30-
* The connection is alive, but the connection is offline
31-
*/
32-
ConnectedPendingNetwork = 'ConnectedPendingNetwork',
33-
/*
34-
* The connection has been disconnected while in use
35-
*/
36-
ConnectionDisrupted = 'ConnectionDisrupted',
37-
/*
38-
* The connection has been disconnected and the network is offline
39-
*/
40-
ConnectionDisruptedPendingNetwork = 'ConnectionDisruptedPendingNetwork',
41-
/*
42-
* The connection is in the process of connecting
43-
*/
44-
Connecting = 'Connecting',
45-
/*
46-
* The connection is not in use and is being disconnected
47-
*/
48-
ConnectedPendingDisconnect = 'ConnectedPendingDisconnect',
49-
/*
50-
* The connection is not in use and has been disconnected
51-
*/
52-
Disconnected = 'Disconnected',
53-
/*
54-
* The connection is alive, but a keep alive message has been missed
55-
*/
56-
ConnectedPendingKeepAlive = 'ConnectedPendingKeepAlive',
57-
}

packages/pubsub/src/utils/ConnectionStateMonitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import { Reachability } from '@aws-amplify/core';
1515
import Observable, { ZenObservable } from 'zen-observable-ts';
16-
import { ConnectionState } from '../index';
16+
import { ConnectionState } from '../types/PubSub';
1717
import { ReachabilityMonitor } from './ReachabilityMonitor';
1818

1919
// Internal types for tracking different connection states

0 commit comments

Comments
 (0)