A TypeScript library for managing and resolving dataviews in the Global Fishing Watch application ecosystem. This library provides utilities for handling dataview configurations, URL workspace state management, and resource fetching.
yarn add @globalfishingwatch/dataviews-client
The library provides utilities to resolve dataviews with their configurations and datasets:
import { resolveDataviews } from '@globalfishingwatch/dataviews-client'
const resolvedDataviews = resolveDataviews(dataviewInstances, dataviews, datasets, vesselGroups)
The library includes utilities for managing workspace state:
import { parseWorkspace, stringifyWorkspace } from '@globalfishingwatch/dataviews-client'
// Parse URL query string to workspace object
const workspace = parseWorkspace(queryString)
// Stringify workspace object to URL query string
const queryString = stringifyWorkspace(workspace)
Provides Redux slice and utilities for managing dataview resources:
import { fetchResourceThunk, resourcesReducer } from '@globalfishingwatch/dataviews-client'
// Fetch a resource
dispatch(fetchResourceThunk({ resource }))
// Add resources reducer to your Redux store
const store = configureStore({
reducer: {
resources: resourcesReducer,
},
})
Provides utilities for migrating dataviews from old to new format:
import { runDatasetMigrations } from '@globalfishingwatch/dataviews-client'
// Migrate legacy dataset ID to current version
const newDatasetId = runDatasetMigrations(legacyDatasetId)
See the rest of the features in the source code.
nx build dataviews-client
nx publish dataviews-client
@globalfishingwatch/api-types
@globalfishingwatch/api-client
@globalfishingwatch/data-transforms
@globalfishingwatch/datasets-client
@reduxjs/toolkit
lodash
luxon
qs
MIT