renanlecaro / mermaid-gdocs

Mermaidsjs wrapper for gdocs.
https://mermaid-gdocs.lecaro.me/
86 stars 14 forks source link

The plugin fails to render a big sequence diagram #30

Open xSAVIKx opened 1 year ago

xSAVIKx commented 1 year ago

Here's a diagram that I was trying to render in the docs:

sequenceDiagram
    participant a as Phone
    box Public-Facing API
    participant proxy as Cloud Run
    participant fcm as FCM
    participant fs as Firestore
    end
    box Cloud Node internal services
    participant pubsub as Pub/Sub
    participant b as HTSS
    participant sql as Cloud SQL
    participant redis as Memory Store
    participant kms as Cloud KMS
    participant iam as Cloud IAM
    participant audit as Cloud Audit Log
    end
    a->>a: Start Workload
    a->>proxy: Send Public Key and Device ID
    proxy->>pubsub: Forward Public Key and Device ID
    b->>pubsub: Receive Public Key and Device ID
    b->>fs: Store Node Public Key under Device ID key
    b->>fcm: Send Public Key notification
    fcm->>a: Notify about Node Public Key
    a->>proxy: Init keygen
    proxy->>pubsub: Forward Keygen init
    b->>pubsub: Receive Keygen init
    b->>b: Create KeyGen
    b->>redis: Cache KeyGen
    b->>sql: Authenticate
    sql->>iam: Verify token
    alt token OK:
        iam->>sql: OK
    else wrong token:
        break when wrong token:
            iam->>audit: Attestation failed: Wrong Token
        end
    end
    b->>sql: Store KeyGen
    par Between Nodes:
        loop Each node to each other:
            b->>fcm: Ask for a KeyGen
            a->>a: Encrypts a KeyGen using Node Public Key
            a->>proxy: Send encrypted KeyGen
            proxy->>pubsub: Forward encrypted KeyGen
            b->>pubsub: Receive encrypted KeyGen
            b->>b: Decrypt KeyGen
            b->>b: Generate key share
            b->>kms: Encrypt key share
            kms->> iam: Verify token
            alt token OK:
                iam->>kms: OK
            else wrong token:
                break when wrong token:         
                    iam->>audit: Attestation failed: Wrong Token
                end
            end
            b->>fs: Store encrypted key share for Phone
            b->>fcm: Send notification about encrypted key share
            fcm->>a: Notify about key share
            b->>sql: Authenticate
            sql->>iam: Verify token
            alt token OK:
                iam->>sql: OK
            else wrong token:
                break when wrong token:         
                    iam->>audit: Attestation failed: Wrong Token
                end
            end
            b->>sql: Store Encrypted Key Share
            b->>redis: Clear KeyGen
        end
    end
sequenceDiagram
    participant a as Phone
    box Public-Facing API
    participant proxy as Cloud Run
    participant fcm as FCM
    participant fs as Firestore
    end
    box Cloud Node internal services
    participant pubsub as Pub/Sub
    participant b as HTSS
    participant sql as Cloud SQL
    participant redis as Memory Store
    participant kms as Cloud KMS
    participant iam as Cloud IAM
    participant audit as Cloud Audit Log
    end
    a->>a: Start Workload
    a->>proxy: Send Public Key and Device ID
    proxy->>pubsub: Forward Public Key and Device ID
    b->>pubsub: Receive Public Key and Device ID
    b->>fs: Store Node Public Key under Device ID key
    b->>fcm: Send Public Key notification
    fcm->>a: Notify about Node Public Key
    a->>proxy: Init keygen
    proxy->>pubsub: Forward Keygen init
    b->>pubsub: Receive Keygen init
    b->>b: Create KeyGen
    b->>redis: Cache KeyGen
    b->>sql: Authenticate
    sql->>iam: Verify token
    alt token OK:
        iam->>sql: OK
    else wrong token:
        break when wrong token:
            iam->>audit: Attestation failed: Wrong Token
        end
    end
    b->>sql: Store KeyGen
    par Between Nodes:
        loop Each node to each other:
            b->>fcm: Ask for a KeyGen
            a->>a: Encrypts a KeyGen using Node Public Key
            a->>proxy: Send encrypted KeyGen
            proxy->>pubsub: Forward encrypted KeyGen
            b->>pubsub: Receive encrypted KeyGen
            b->>b: Decrypt KeyGen
            b->>b: Generate key share
            b->>kms: Encrypt key share
            kms->> iam: Verify token
            alt token OK:
                iam->>kms: OK
            else wrong token:
                break when wrong token:         
                    iam->>audit: Attestation failed: Wrong Token
                end
            end
            b->>fs: Store encrypted key share for Phone
            b->>fcm: Send notification about encrypted key share
            fcm->>a: Notify about key share
            b->>sql: Authenticate
            sql->>iam: Verify token
            alt token OK:
                iam->>sql: OK
            else wrong token:
                break when wrong token:         
                    iam->>audit: Attestation failed: Wrong Token
                end
            end
            b->>sql: Store Encrypted Key Share
            b->>redis: Clear KeyGen
        end
    end

As you can see, GH as well as mermaid.js live editor are able to render it without a glitch. Any help is appreciated.

I assume this may be smth just related to the size of the diagram.

renanlecaro commented 1 year ago

Yeah the picture gets too large for gdocs. I'll see if i can do something about it one of those days, in the meantime i'd recommend using multiple smaller diagrams or manually generating them