Squid constructor

  1. @protected
Squid(
  1. SquidOptions _options
)

Implementation

@protected
Squid(this._options) {
  final shouldAddDeveloperId =
      _options.environmentId != EnvironmentId.production &&
          _options.squidDeveloperId != null;
  final appId =
      appIdWithEnvironmentId(_options.appId, _options.environmentId) +
          (shouldAddDeveloperId ? _options.squidDeveloperId! : '');
  final regionPrefix = _options.region.toString();
  final httpHeaders = getApplicationHttpHeaders(regionPrefix, appId);

  _clientIdService = ClientIdService(_destructManager);
  _authManager = AuthManager(_destructManager, _options.apiKey);
  _socketManager = SocketManager(
      _clientIdService,
      _options.region,
      _options.appId,
      _options.messageNotificationWrapper,
      _destructManager,
      _authManager);
  _rpcManager = RpcManager(_options.region, _options.appId, _destructManager,
      httpHeaders, _authManager, _clientIdService);
  _documentStore = DocumentStore();
  _lockManager = LockManager();
  _distributedLockManager =
      DistributedLockManager(_socketManager, _destructManager);
  _documentIdentityService =
      DocumentIdentityService(_documentStore, _destructManager);
  _documentReferenceFactory =
      DocumentReferenceFactory(_documentIdentityService);
  _querySender = QuerySender(_rpcManager, _destructManager);
  _querySubscriptionManager = QuerySubscriptionManager(
      _rpcManager,
      _clientIdService,
      _documentStore,
      _querySender,
      _destructManager,
      _documentIdentityService);
  _localQueryManager = LocalQueryManager(
      _documentStore, _documentReferenceFactory, _querySubscriptionManager);
  final mutationSender =
      MutationSender(_rpcManager, _lockManager, _querySender);
  _queryBuilderFactory = QueryBuilderFactory(
      _querySubscriptionManager,
      _localQueryManager,
      _documentReferenceFactory,
      _documentIdentityService);
  _collectionReferenceFactory = CollectionReferenceFactory(
      _documentReferenceFactory,
      _queryBuilderFactory,
      _querySubscriptionManager);
  _dataManager = DataManager(
      _documentStore,
      mutationSender,
      _socketManager,
      _querySubscriptionManager,
      _queryBuilderFactory,
      _lockManager,
      _querySender,
      _destructManager,
      _documentIdentityService);
  _documentReferenceFactory.dataManager = _dataManager;
  _backendFunctionManager =
      BackendFunctionManager(_clientIdService, _rpcManager, _socketManager);
  _namedQueryManager =
      NamedQueryManager(_clientIdService, _rpcManager, _socketManager);
  _apiManager = ApiManager(_clientIdService, _rpcManager, _socketManager,
      _options.apiServerUrlOverrideMapping);
  _graphqlClientFactory = GraphQLClientFactory(
      _options.region, _options.appId, _rpcManager.staticHeaders);
  _aiClient = AiClient(_clientIdService, _rpcManager, _socketManager);
  _secretClient = SecretClient(_rpcManager);
}