Global

Members

# assetLinkIncludedLibraries

Libraries that are available for import in Asset Link plugins.

  • 'buffer/' 6.0.3 - https://www.npmjs.com/package/buffer
  • 'assetlink-plugin-api' - https://symbioquine.github.io/farmOS_asset_link/global.html
  • 'vue' 3.4.15 - https://vuejs.org/api/
  • 'vue-router' 4.0.0 - https://router.vuejs.org/api/
  • 'quasar' 2.6.0 - https://quasar.dev/docs
  • 'ngeohash' 0.6.3 - https://www.npmjs.com/package/ngeohash
  • 'haversine-distance' 1.2.1 - https://www.npmjs.com/package/haversine-distance
  • 'jmespath' 0.16.0 - https://www.npmjs.com/package/jmespath
  • 'micromustache' 8.0.3 - https://www.npmjs.com/package/micromustache

Usage in webpack.config.js

const { assetLinkIncludedLibraries } = require('assetlink-plugin-dev-support');

module.exports = {
  ...
  externals: {
    ...assetLinkIncludedLibraries,
  }
};

Usage in Plugins

import { h } from 'vue';
import { QBtn } from 'quasar';

View Source assetlink-plugin-dev-support/src/index.js, line 11

# EventBus

A simple async event bus.

The Vue 3 framework recommended event buses - https://github.com/developit/mitt https://github.com/scottcorgan/tiny-emitter do not support async handlers well.

View Source assetlink-plugin-api/src/EventBus.js, line 1

Methods

# createDevServerConfig()

Generate a Webpack dev server configuration to serve our plugins with live-reload and (optionally) https.

Usage

const { createDevServerConfig } = require('assetlink-plugin-dev-support');

module.exports = {
  ...
  devServer: createDevServerConfig({
    pluginDir: __dirname,
  }),
};

View Source assetlink-plugin-dev-support/src/index.js, line 130

# createDrupalUrl(pathSuffix) → {external:URL}

Creates a url relative to the base url of the Drupal site in which Asset Link is installed.

  • Usage

import { createDrupalUrl } from "assetlink-plugin-api";

createDrupalUrl('/api') // might return `URL { href: "https://myfarm.example.com/drupal-site-a/api" ... }`
Parameters:
Name Type Description
pathSuffix String

The path suffix of the URL to be created

View Source assetlink-plugin-api/src/createDrupalUrl.js, line 1

the fully qualified URL instance.

external:URL

# currentEpochSecond() → {Number}

Returns the current epoch second as an integer number.

  • Usage

import { currentEpochSecond } from "assetlink-plugin-api";

currentEpochSecond() // might return 1660580261

View Source assetlink-plugin-api/src/currentEpochSecond.js, line 1

the current epoch second

Number

# GenerateDefaultPluginConfigYmlFilesPlugin()

Custom Webpack plugin to generate configuration entity yml files for each of our included Asset Link plugins.

Usage

const { GenerateDefaultPluginConfigYmlFilesPlugin } = require('assetlink-plugin-dev-support');

module.exports = {
  ...
  plugins: [
    new GenerateDefaultPluginConfigYmlFilesPlugin({
      pluginDir: __dirname,
      // This must match your drupal module name for Asset Link to be able to serve your plugins
      drupalModuleName: 'example_alink_plugins',
    }),
  ]
};

View Source assetlink-plugin-dev-support/src/index.js, line 56

# getDrupalBasePath() → {string}

Returns the base path of the farmOS Drupal site in which Asset Link is installed. Always starts and ends with a '/'.

  • Usage

import { getDrupalBasePath } from "assetlink-plugin-api";

getDrupalBasePath() // might return "/" or "/site-a/"

View Source assetlink-plugin-api/src/getDrupalBasePath.js, line 1

the base path of the farmOS Drupal site

string

# summarizeAssetNames(assets) → {String}

Roughly implements the same convention encoded in farm_log.module#L74-L88

  • Usage

import { summarizeAssetNames } from "assetlink-plugin-api";

summarizeAssetNames([
  { attributes: { name: "A" ... }, ... },
  { attributes: { name: "B" ... }, ... },
  { attributes: { name: "C" ... }, ... },
]) // Returns "A, B, C"

summarizeAssetNames([
  { attributes: { name: "A" ... }, ... },
  { attributes: { name: "B" ... }, ... },
  { attributes: { name: "C" ... }, ... },
  { attributes: { name: "D" ... }, ... },
  { attributes: { name: "E" ... }, ... },
]) // Returns "A (+4 more)"
Parameters:
Name Type Description
assets Array.<Asset>

The array of assets to be summarized

View Source assetlink-plugin-api/src/summarizeAssetNames.js, line 1

the asset names summary string

String

Type Definitions

# attributedHandlerFn(attributedHandle)

Parameters:
Name Type Description
attributedHandle IAssetLinkPluginHandle

The handle used to define a route

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 146

# GetOrCreateTaxonomyTermByNameOptions

Options that can be passed to IAssetLink.getOrCreateTaxonomyTermByName

Usage
const term = await assetLink.getOrCreateTaxonomyTermByName('taxonomy_term--plant_type', 'Beans', {
 idToCreate: 'bccd50a8-a017-4cad-b2df-712e40e4d263',
});
Properties:
Name Type Description
idToCreate Boolean

The unique id of the term to create if one cannot be found with the specified name.

View Source assetlink-plugin-api/src/IAssetLink.js, line 107

# pluginIngestorDefiner(pluginIngestorHandle)

Parameters:
Name Type Description
pluginIngestorHandle IAssetLinkPluginIngestorHandle

The handle used to define a route

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 101

# pluginIngestorFn(plugin)

Parameters:
Name Type Description
plugin IAssetLinkPlugin

The ingested plugin

View Source assetlink-plugin-api/src/IAssetLinkPluginIngestorHandle.js, line 11

# RenderableDef

A combination of a Vue component plus the information needed to render it in the requested context - id and props.

Usage
<component
    :key="renderableDef.id"
    :is="renderableDef.id.component"
    v-bind="renderableDef.id.props"></component>
Properties:
Name Type Description
id String

The unique (for this context) id of the thing to render

component VueComponent

The component to render

props Object

The props to render the component with

weight Number

The weight of this renderable

View Source assetlink-plugin-api/src/IAssetLink.js, line 164

# routeDefiner(routeHandle)

Parameters:
Name Type Description
routeHandle IAssetLinkPluginRouteHandle

The handle used to define a route

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 12

# slotDefiner(slotHandle)

Parameters:
Name Type Description
slotHandle IAssetLinkPluginSlotHandle

The handle used to define a route

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 41

# widgetDecoratorDefiner(widgetDecoratorHandle)

Parameters:
Name Type Description
widgetDecoratorHandle IAssetLinkPluginWidgetDecoratorHandle

The handle used to define a route

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 71