GeoLeaf Core API - v3.19.0
    Preparing search index...

    Interface GeoLeafStorageDB

    GeoLeaf.Storage.DB — the IndexedDB engine, as far as the namespace names it.

    Hoisted so that DB and its lower-case alias db are ONE declaration: derived from the façade's getter, db would not carry listPendingEdits, and the two would disagree.

    interface GeoLeafStorageDB {
        listPendingEdits?(
            options?: { allProfiles?: boolean },
        ): Promise<
            {
                entryId: string;
                kind: string;
                layerId: string;
                localId: string;
                state: string;
                createdAt: number;
                feature: unknown;
                quarantine?: QuarantineReason;
                quarantineStatus?: number;
                profileId?: string;
            }[],
        >;
        getLayer?: (id: string) => Promise<LayerRecord | null | undefined>;
        cacheLayer?: (
            id: string,
            data: string | object | ArrayBuffer,
            profileId: string | null,
            metadata?: Record<string, unknown>,
        ) => Promise<unknown>;
        removeLayer?: (id: string) => Promise<unknown>;
        getLayersByProfile?: (profileId: string) => Promise<unknown>;
        getStorageStats?: () => Promise<StorageStatsReport>;
        storeImageLocally?: (imageData: LocalImageData) => Promise<unknown>;
        getLocalImage?: (id: string) => Promise<unknown>;
        getPendingImages?: () => Promise<unknown>;
        updateImageUploadStatus?: (
            id: string,
            status: { uploaded: boolean; url?: string },
        ) => Promise<unknown>;
        bindLocalImage?: (
            id: string,
            owner: { layerId: string; localId: string },
        ) => Promise<unknown>;
        cleanUploadedImages?: () => Promise<unknown>;
        [key: string]: unknown;
    }

    Indexable

    • [key: string]: unknown
    Index
    getLayer?: (id: string) => Promise<LayerRecord | null | undefined>

    A cached layer record by id.

    cacheLayer?: (
        id: string,
        data: string | object | ArrayBuffer,
        profileId: string | null,
        metadata?: Record<string, unknown>,
    ) => Promise<unknown>

    Caches a layer's payload under a profile — null when the layer belongs to none.

    removeLayer?: (id: string) => Promise<unknown>

    Removes a cached layer.

    getLayersByProfile?: (profileId: string) => Promise<unknown>

    Every cached layer of a profile.

    getStorageStats?: () => Promise<StorageStatsReport>

    What the stores hold, and the quota they are held against.

    Type Declaration

      • (): Promise<StorageStatsReport>
      • Relays the storage report of DB.Preferences.

        ⚠️ This relay declared LESS than what the module returns, and declared it wrong. Its shape was { used, quota, percentage, layersCount, syncQueueCount }: it named a counter of the v3 store — since removed — and omitted featuresCount and outboxCount, which preferences.ts fills. A caller on the degraded path thus received an object with two fields missing without the type saying so.

        Returns Promise<StorageStatsReport>

        Quota, usage, and the tallies of the four data-bearing stores.

    storeImageLocally?: (imageData: LocalImageData) => Promise<unknown>

    Stores an image awaiting its upload.

    getLocalImage?: (id: string) => Promise<unknown>

    One stored image, by id.

    Type Declaration

      • (id: string): Promise<unknown>
      • Reads one stored image back — the preview path for a locally-held capture.

        Parameters

        • id: string

          Local image id.

        Returns Promise<unknown>

    getPendingImages?: () => Promise<unknown>

    The images whose upload is still owed.

    updateImageUploadStatus?: (
        id: string,
        status: { uploaded: boolean; url?: string },
    ) => Promise<unknown>

    Records the outcome of an upload — status is an object, never a string.

    Type Declaration

      • (id: string, status: { uploaded: boolean; url?: string }): Promise<unknown>
      • Marks a local image uploaded, and records the URL the server gave it.

        🛑 THE status PARAMETER WAS TYPED string, AND THAT IS WHAT MADE THE BUG INVISIBLE. The module behind this relay reads status.uploaded and status.url; the editor plugin passed the STRING "uploaded". ("uploaded").uploaded is undefined, so the record was rewritten as still pending and the URL was never stored — the same photo left again on every reconnection and every boot, and cleanUploadedImages (a cursor over the index at 1) found nothing to purge, forever. Three layers declared it loose: this signature, the plugin's own local interface, and the index signature every module was typed with ((...args: unknown[]) => unknown). That last one is gone: each relay is now checked against the module it forwards to (DBModuleInstances).

        Parameters

        • id: string

          Local image id.

        • status: { uploaded: boolean; url?: string }

          { uploaded, url? } — an OBJECT, never a string.

        Returns Promise<unknown>

    bindLocalImage?: (
        id: string,
        owner: { layerId: string; localId: string },
    ) => Promise<unknown>

    Records which entity a stored image belongs to.

    Type Declaration

      • (id: string, owner: { layerId: string; localId: string }): Promise<unknown>
      • Binds a stored image to the feature that carries it — see the module's bindLocalImage.

        Parameters

        • id: string

          Local image id.

        • owner: { layerId: string; localId: string }

          Layer and client identity of the owning feature.

        Returns Promise<unknown>

    cleanUploadedImages?: () => Promise<unknown>

    Reclaims the images the server has acknowledged.

    • The edits still owed or set aside, oldest first — state says which. An entry set aside (state: "quarantined") also says why: quarantine is the motive, quarantineStatus the HTTP status of the refusal when a server caused it. Only the active profile's edits, unless allProfiles: true — then each says whose it is (profileId, absent on an edit captured before core 3.18.0).

      Parameters

      • Optionaloptions: { allProfiles?: boolean }

      Returns Promise<
          {
              entryId: string;
              kind: string;
              layerId: string;
              localId: string;
              state: string;
              createdAt: number;
              feature: unknown;
              quarantine?: QuarantineReason;
              quarantineStatus?: number;
              profileId?: string;
          }[],
      >