Skip to content

Fis modularization #3638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Sep 3, 2020
Merged

Fis modularization #3638

merged 23 commits into from
Sep 3, 2020

Conversation

ChaoqunCHEN
Copy link
Contributor

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Aug 14, 2020

💥 No Changeset

Latest commit: 19bab1c

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 14, 2020

Binary Size Report

Affected SDKs

No changes between base commit (57739ae) and head commit (1bd1c08).

Test Logs

Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration with app-exp looks pretty good. I didn't look into the implementation which, I assume, didn't change?

Can you please integrate with api-extractor, which generates api reports and documentation. You can look at functions-exp. You want to copy this file, and add these scripts in the package.json. Let me know if you need any help.

@ChaoqunCHEN ChaoqunCHEN requested a review from Feiyang1 August 26, 2020 00:07
Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you haven't integrated with api-extractor. Let me know if you need help

Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since installations is a dependency for other SDKs, we need to register another component for internal consumption. It should return an object with getId() and getToken().

So in the function/config.ts, you should register another component:

// define an internal API
interface InstallationsInternal {
  getId: () => Promise<string>
  getToken: (force?: boolean) => Promise<string>
}

// register an internal component
_registerComponent(new Component(
     'installations-internal-exp',
      container => {
        const installations = container.getProvider('installation-exp').getImmediate();
        const installationsInternalService: InstallationsInternal = {
          // bind to the correct installations instance
          getId: getId.bind(null, installations), 
          getToken: getToken.bind(null, installations)
        };

        return installationsService;
      },
      ComponentType.INTERNAL
    )
  );)

In FCM/Perf/RC, they will get the instance of the internal installations by:

const installations = _getProvider('installations-internal-exp').getImmediate();
installations.getId();
installations.getToken();

Does it make sense? Let me know if you want to chat offline

@ChaoqunCHEN ChaoqunCHEN requested a review from Feiyang1 August 27, 2020 20:02
Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was some confusion on public component vs internal component. I added some comments to hopefully clear things up.

@ChaoqunCHEN ChaoqunCHEN requested a review from Feiyang1 September 1, 2020 17:42
@ChaoqunCHEN ChaoqunCHEN requested a review from Feiyang1 September 2, 2020 00:14
…3733)

* integrate api-extractor into installations-exp

* add release tag to APIs

* add _ prefix to the internal interface

* update api report
@google-oss-bot
Copy link
Contributor

Size Analysis Report

Affected Products

@firebase/installations-exp

  • deleteInstallations

    Size

    Type Base (1df547b) Head (2601106) Diff
    size ? 8.90 kB ? (?)
    size_with_ext_deps ? 17.3 kB ? (?)

    Dependencies

    Type Base (1df547b) Head (2601106) Diff
    functions ?
    Click to show 52 depsbroadcastFidChange
    bufferToBase64UrlSafe
    callFidChangeCallbacks
    clearTimedOutRequest
    closeBroadcastChannel
    completeInstallationRegistration
    createInstallationRequest
    deleteInstallationRequest
    deleteInstallations
    encode
    extractAppConfig
    extractAuthTokenInfoFromResponse
    fetchAuthTokenFromServer
    fidChanged
    generateAuthTokenRequest
    generateFid
    getAuthorizationHeader
    getBroadcastChannel
    getDbPromise
    getDeleteEndpoint
    getErrorFromResponse
    getExpiresInFromResponseExpiresIn
    getGenerateAuthTokenEndpoint
    getHeaders
    getHeadersWithAuth
    getId
    getInstallationEntry
    getInstallationsEndpoint
    getKey
    getMissingValueError
    getToken
    hasAuthTokenRequestTimedOut
    hasInstallationRequestTimedOut
    isAuthTokenExpired
    isAuthTokenValid
    isEntryRegistered
    isServerError
    makeAuthTokenRequestInProgressEntry
    refreshAuthToken
    registerInstallation
    registerInstallations
    remove
    retryIfServerError
    set
    sleep
    triggerRegistrationIfNecessary
    update
    updateAuthTokenRequest
    updateInstallationRequest
    updateOrCreateInstallationEntry
    waitUntilAuthTokenRequest
    waitUntilFidRegistration
    ?
    variables ?
    Click to show 23 depsDATABASE_NAME
    DATABASE_VERSION
    ERROR_DESCRIPTION_MAP
    ERROR_FACTORY
    INSTALLATIONS_API_URL
    INSTALLATIONS_NAME
    INSTALLATIONS_NAME_INTERNAL
    INTERNAL_AUTH_VERSION
    INVALID_FID
    OBJECT_STORE_NAME
    PACKAGE_VERSION
    PENDING_TIMEOUT_MS
    SERVICE
    SERVICE_NAME
    TOKEN_EXPIRATION_BUFFER
    VALID_FID_PATTERN
    broadcastChannel
    dbPromise
    fidChangeCallbacks
    internalFactory
    name
    publicFactory
    version
    ?

    External Dependencies

    Module Base (1df547b) Head (2601106) Diff
    @firebase/util ? ErrorFactory
    FirebaseError
    ?
    idb ? openDb ?
    @firebase/app-exp ? _getProvider
    _registerComponent
    registerVersion
    ?
    @firebase/component ? Component ?
  • getId

    Size

    Type Base (1df547b) Head (2601106) Diff
    size ? 8.34 kB ? (?)
    size_with_ext_deps ? 16.8 kB ? (?)

    Dependencies

    Type Base (1df547b) Head (2601106) Diff
    functions ?
    Click to show 49 depsbroadcastFidChange
    bufferToBase64UrlSafe
    callFidChangeCallbacks
    clearTimedOutRequest
    closeBroadcastChannel
    completeInstallationRegistration
    createInstallationRequest
    encode
    extractAppConfig
    extractAuthTokenInfoFromResponse
    fetchAuthTokenFromServer
    fidChanged
    generateAuthTokenRequest
    generateFid
    getAuthorizationHeader
    getBroadcastChannel
    getDbPromise
    getErrorFromResponse
    getExpiresInFromResponseExpiresIn
    getGenerateAuthTokenEndpoint
    getHeaders
    getHeadersWithAuth
    getId
    getInstallationEntry
    getInstallationsEndpoint
    getKey
    getMissingValueError
    getToken
    hasAuthTokenRequestTimedOut
    hasInstallationRequestTimedOut
    isAuthTokenExpired
    isAuthTokenValid
    isEntryRegistered
    isServerError
    makeAuthTokenRequestInProgressEntry
    refreshAuthToken
    registerInstallation
    registerInstallations
    remove
    retryIfServerError
    set
    sleep
    triggerRegistrationIfNecessary
    update
    updateAuthTokenRequest
    updateInstallationRequest
    updateOrCreateInstallationEntry
    waitUntilAuthTokenRequest
    waitUntilFidRegistration
    ?
    variables ?
    Click to show 23 depsDATABASE_NAME
    DATABASE_VERSION
    ERROR_DESCRIPTION_MAP
    ERROR_FACTORY
    INSTALLATIONS_API_URL
    INSTALLATIONS_NAME
    INSTALLATIONS_NAME_INTERNAL
    INTERNAL_AUTH_VERSION
    INVALID_FID
    OBJECT_STORE_NAME
    PACKAGE_VERSION
    PENDING_TIMEOUT_MS
    SERVICE
    SERVICE_NAME
    TOKEN_EXPIRATION_BUFFER
    VALID_FID_PATTERN
    broadcastChannel
    dbPromise
    fidChangeCallbacks
    internalFactory
    name
    publicFactory
    version
    ?

    External Dependencies

    Module Base (1df547b) Head (2601106) Diff
    @firebase/util ? ErrorFactory
    FirebaseError
    ?
    idb ? openDb ?
    @firebase/app-exp ? _getProvider
    _registerComponent
    registerVersion
    ?
    @firebase/component ? Component ?
  • getInstallations

    Size

    Type Base (1df547b) Head (2601106) Diff
    size ? 8.43 kB ? (?)
    size_with_ext_deps ? 16.9 kB ? (?)

    Dependencies

    Type Base (1df547b) Head (2601106) Diff
    functions ?
    Click to show 50 depsbroadcastFidChange
    bufferToBase64UrlSafe
    callFidChangeCallbacks
    clearTimedOutRequest
    closeBroadcastChannel
    completeInstallationRegistration
    createInstallationRequest
    encode
    extractAppConfig
    extractAuthTokenInfoFromResponse
    fetchAuthTokenFromServer
    fidChanged
    generateAuthTokenRequest
    generateFid
    getAuthorizationHeader
    getBroadcastChannel
    getDbPromise
    getErrorFromResponse
    getExpiresInFromResponseExpiresIn
    getGenerateAuthTokenEndpoint
    getHeaders
    getHeadersWithAuth
    getId
    getInstallationEntry
    getInstallations
    getInstallationsEndpoint
    getKey
    getMissingValueError
    getToken
    hasAuthTokenRequestTimedOut
    hasInstallationRequestTimedOut
    isAuthTokenExpired
    isAuthTokenValid
    isEntryRegistered
    isServerError
    makeAuthTokenRequestInProgressEntry
    refreshAuthToken
    registerInstallation
    registerInstallations
    remove
    retryIfServerError
    set
    sleep
    triggerRegistrationIfNecessary
    update
    updateAuthTokenRequest
    updateInstallationRequest
    updateOrCreateInstallationEntry
    waitUntilAuthTokenRequest
    waitUntilFidRegistration
    ?
    variables ?
    Click to show 23 depsDATABASE_NAME
    DATABASE_VERSION
    ERROR_DESCRIPTION_MAP
    ERROR_FACTORY
    INSTALLATIONS_API_URL
    INSTALLATIONS_NAME
    INSTALLATIONS_NAME_INTERNAL
    INTERNAL_AUTH_VERSION
    INVALID_FID
    OBJECT_STORE_NAME
    PACKAGE_VERSION
    PENDING_TIMEOUT_MS
    SERVICE
    SERVICE_NAME
    TOKEN_EXPIRATION_BUFFER
    VALID_FID_PATTERN
    broadcastChannel
    dbPromise
    fidChangeCallbacks
    internalFactory
    name
    publicFactory
    version
    ?

    External Dependencies

    Module Base (1df547b) Head (2601106) Diff
    @firebase/util ? ErrorFactory
    FirebaseError
    ?
    idb ? openDb ?
    @firebase/app-exp ? _getProvider
    _registerComponent
    registerVersion
    ?
    @firebase/component ? Component ?
  • getToken

    Size

    Type Base (1df547b) Head (2601106) Diff
    size ? 8.35 kB ? (?)
    size_with_ext_deps ? 16.8 kB ? (?)

    Dependencies

    Type Base (1df547b) Head (2601106) Diff
    functions ?
    Click to show 49 depsbroadcastFidChange
    bufferToBase64UrlSafe
    callFidChangeCallbacks
    clearTimedOutRequest
    closeBroadcastChannel
    completeInstallationRegistration
    createInstallationRequest
    encode
    extractAppConfig
    extractAuthTokenInfoFromResponse
    fetchAuthTokenFromServer
    fidChanged
    generateAuthTokenRequest
    generateFid
    getAuthorizationHeader
    getBroadcastChannel
    getDbPromise
    getErrorFromResponse
    getExpiresInFromResponseExpiresIn
    getGenerateAuthTokenEndpoint
    getHeaders
    getHeadersWithAuth
    getId
    getInstallationEntry
    getInstallationsEndpoint
    getKey
    getMissingValueError
    getToken
    hasAuthTokenRequestTimedOut
    hasInstallationRequestTimedOut
    isAuthTokenExpired
    isAuthTokenValid
    isEntryRegistered
    isServerError
    makeAuthTokenRequestInProgressEntry
    refreshAuthToken
    registerInstallation
    registerInstallations
    remove
    retryIfServerError
    set
    sleep
    triggerRegistrationIfNecessary
    update
    updateAuthTokenRequest
    updateInstallationRequest
    updateOrCreateInstallationEntry
    waitUntilAuthTokenRequest
    waitUntilFidRegistration
    ?
    variables ?
    Click to show 23 depsDATABASE_NAME
    DATABASE_VERSION
    ERROR_DESCRIPTION_MAP
    ERROR_FACTORY
    INSTALLATIONS_API_URL
    INSTALLATIONS_NAME
    INSTALLATIONS_NAME_INTERNAL
    INTERNAL_AUTH_VERSION
    INVALID_FID
    OBJECT_STORE_NAME
    PACKAGE_VERSION
    PENDING_TIMEOUT_MS
    SERVICE
    SERVICE_NAME
    TOKEN_EXPIRATION_BUFFER
    VALID_FID_PATTERN
    broadcastChannel
    dbPromise
    fidChangeCallbacks
    internalFactory
    name
    publicFactory
    version
    ?

    External Dependencies

    Module Base (1df547b) Head (2601106) Diff
    @firebase/util ? ErrorFactory
    FirebaseError
    ?
    idb ? openDb ?
    @firebase/app-exp ? _getProvider
    _registerComponent
    registerVersion
    ?
    @firebase/component ? Component ?
  • onIdChange

    Size

    Type Base (1df547b) Head (2601106) Diff
    size ? 8.60 kB ? (?)
    size_with_ext_deps ? 17.0 kB ? (?)

    Dependencies

    Type Base (1df547b) Head (2601106) Diff
    functions ?
    Click to show 52 depsaddCallback
    broadcastFidChange
    bufferToBase64UrlSafe
    callFidChangeCallbacks
    clearTimedOutRequest
    closeBroadcastChannel
    completeInstallationRegistration
    createInstallationRequest
    encode
    extractAppConfig
    extractAuthTokenInfoFromResponse
    fetchAuthTokenFromServer
    fidChanged
    generateAuthTokenRequest
    generateFid
    getAuthorizationHeader
    getBroadcastChannel
    getDbPromise
    getErrorFromResponse
    getExpiresInFromResponseExpiresIn
    getGenerateAuthTokenEndpoint
    getHeaders
    getHeadersWithAuth
    getId
    getInstallationEntry
    getInstallationsEndpoint
    getKey
    getMissingValueError
    getToken
    hasAuthTokenRequestTimedOut
    hasInstallationRequestTimedOut
    isAuthTokenExpired
    isAuthTokenValid
    isEntryRegistered
    isServerError
    makeAuthTokenRequestInProgressEntry
    onIdChange
    refreshAuthToken
    registerInstallation
    registerInstallations
    remove
    removeCallback
    retryIfServerError
    set
    sleep
    triggerRegistrationIfNecessary
    update
    updateAuthTokenRequest
    updateInstallationRequest
    updateOrCreateInstallationEntry
    waitUntilAuthTokenRequest
    waitUntilFidRegistration
    ?
    variables ?
    Click to show 23 depsDATABASE_NAME
    DATABASE_VERSION
    ERROR_DESCRIPTION_MAP
    ERROR_FACTORY
    INSTALLATIONS_API_URL
    INSTALLATIONS_NAME
    INSTALLATIONS_NAME_INTERNAL
    INTERNAL_AUTH_VERSION
    INVALID_FID
    OBJECT_STORE_NAME
    PACKAGE_VERSION
    PENDING_TIMEOUT_MS
    SERVICE
    SERVICE_NAME
    TOKEN_EXPIRATION_BUFFER
    VALID_FID_PATTERN
    broadcastChannel
    dbPromise
    fidChangeCallbacks
    internalFactory
    name
    publicFactory
    version
    ?

    External Dependencies

    Module Base (1df547b) Head (2601106) Diff
    @firebase/util ? ErrorFactory
    FirebaseError
    ?
    idb ? openDb ?
    @firebase/app-exp ? _getProvider
    _registerComponent
    registerVersion
    ?
    @firebase/component ? Component ?

Test Logs

@ChaoqunCHEN ChaoqunCHEN merged commit f506e18 into master Sep 3, 2020
@firebase firebase locked and limited conversation to collaborators Oct 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants