From 65cd851876746d88613e9bc4e5c7228ab1dfe7c2 Mon Sep 17 00:00:00 2001 From: John Dillick Date: Wed, 4 Jan 2023 15:29:19 -0500 Subject: [PATCH] Update sdk and docs --- docs/api_data.js | 1659 ++++++++++++++++++++++++++++++++++++++--- docs/api_data.json | 1659 ++++++++++++++++++++++++++++++++++++++--- docs/api_project.js | 2 +- docs/api_project.json | 2 +- package-lock.json | 6 +- package.json | 2 +- 6 files changed, 3148 insertions(+), 182 deletions(-) diff --git a/docs/api_data.js b/docs/api_data.js index 78cfd19b..22d30abe 100644 --- a/docs/api_data.js +++ b/docs/api_data.js @@ -1,4 +1,139 @@ define({ "api": [ + { + "type": "Async", + "url": "Capability.User.get(userID,refresh)", + "title": "Capability.User.get()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.User.get", + "description": "

Return an Array of capability names granted to the user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Reactium.User id. If empty the User.current id is used.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "refres", + "defaultValue": "false", + "description": "

Fetch capabilities from the server instead of cache.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage", + "content": "const canEditArticle = async userID => {\n const caps = await Reactium.Capability.User.get(userID);\n return caps.includes('content.article.update');\n};", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Static", + "url": "Capability.autosync", + "title": "Capability.autosync", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.autosync", + "description": "

Time in milliseconds that controls when registered capabilities are propagated to the server. If set to false, manually push registered capabilities with Capability.propagate(). Default: 10000.

", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Static", + "url": "Capability.cache", + "title": "Capability.cache", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.cache", + "description": "

Time in milliseconds that controls how long to cache capability request results. Default: 60000.

", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Function", + "url": "Capability.clearCache()", + "title": "Capability.clearCache()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.clearCache", + "description": "

Clear Capability related Cache keys.

", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Async", + "url": "Capability.propagate(force)", + "title": "Capability.propagate()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.propagate", + "description": "

Propagate registered capabilities to an Actinium server.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "force", + "defaultValue": "false", + "description": "

Execute the propagation regardless of if a current propagation operation is under way. The resolution of the previous propagation operation will be cancelled. If Capability.autosync is true, this function will be called whenever the autosync is initiated.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage", + "content": "await Capability.propagate();", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Function", + "url": "Capability.register(id)", + "title": "Capability.register()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.register", + "description": "

Register a new capability.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "id", + "description": "

String value used when checking for the capability. This function is limited in scope and regularly shouldn't be used. Server-side capability registration is preferred.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage", + "content": "Capability.register('my-ui.view')", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, { "type": "Hook", "url": "Hooks", @@ -853,6 +988,17 @@ define({ "api": [ "filename": ".core/app/index.js", "groupTitle": "Hooks" }, + { + "type": "Hook", + "url": "service-worker-init", + "title": "service-worker-init", + "name": "service-worker-init", + "description": "

Called after dependencies-load in Reactium.ServiceWorker to register any webapp service worker code for the app. By default, this hook is implemented to register the customizable Google Workbox implementation that will be compiled (to /assets/js/sw/sw.js). Also, async loads and instantiates a a google workbox-window Workbox object on Reactium.ServiceWorker.worker. async only - used in front-end webapp only

", + "group": "Hooks", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-service-worker/sdk/index.js", + "groupTitle": "Hooks" + }, { "type": "Hook", "url": "store-create", @@ -1690,7 +1836,7 @@ define({ "api": [ }, { "type": "ReactHook", - "url": "useSyncHandle(id)", + "url": "useSyncHandle(id,updateEvent)", "title": "useSyncHandle()", "description": "

React hook to subscribe to updates for a registered sync handle.

", "parameter": { @@ -1702,6 +1848,14 @@ define({ "api": [ "optional": false, "field": "id", "description": "

Array of properties, or . separated object path. e.g. ['path','to','handle'] or 'path.to.handle'. Identifies the full path to an imperative handle.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "updateEvent", + "defaultValue": "set", + "description": "

Trigger update of the consuming component when EventTarget event of this type is dispatched. Defaults tot 'set'.

" } ] } @@ -1716,47 +1870,60 @@ define({ "api": [ "type": "ReactHook", "url": "useSyncState(initialState,updateEvent)", "title": "useSyncState()", - "description": "

Intended to provide an object to get and set state synchrounously, while providing a EventTarget object that can dispatch a 'set' event when the state is updated. Dispatches 'before-set' before changing the state, and 'change' event if any shallow changes are detected.

", + "name": "useSyncState", + "group": "ReactHook", + "description": "

Intended to provide an object to get and set state synchrounously, while providing a EventTarget object that can dispatch a set event whenever the state is changed. The hook will also dispatch a change event whenever the synced state changes. The hook can also listen for a specified event on the EventTarget object, and update the synced state with the event.detail property when the event is dispatched.

The hook uses the ReactiumSyncState class to implement the synced state and EventTarget behavior. The class uses the object-path module to manipulate the state object, and provides the following methods:

", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", - "type": "Mixed", + "type": "Object", "optional": false, "field": "initialState", - "description": "

The initial state.

" + "description": "

The initial state of the synced state.

" }, { "group": "Parameter", - "type": "String", + "type": "string", "optional": true, "field": "updateEvent", "defaultValue": "set", - "description": "

Trigger update of the consuming component when EventTarget event of this type is dispatched. Defaults tot 'set'.

" + "description": "

The event name to listen for on the EventTarget object. When the event is dispatched, the hook will update the synced state with the event.detail property, and trigger a rerender of the React component.

" } ] } }, - "name": "useSyncState", - "group": "ReactHook", "examples": [ { - "title": "SimpleExample", - "content": "import React from 'react';\nimport { useSyncState } from 'reactium-core/sdk';\nexport const SimpleExample = () => {\n const clickState = useSyncState({ clicks: 1 });\n const clicks = clickState.get('clicks');\n return (\n
Clicked {clicks} times clickState.set('clicks', clicks + 1)}>Click Me\n
\n );\n };", + "title": "Simple", + "content": "import React from 'react';\nimport { useSyncState } from 'reactium-sdk-core';\n\nconst ExampleComponent = () => {\n const [syncState, setSyncState] = useSyncState({ count: 0 });\n\n return (\n <>\n
Count: {syncState.get('count')}
\n \n \n );\n};", "type": "json" }, { - "title": "EventTarget", - "content": "import React from 'react';\nimport { useSyncState, useRegisterHandle } from 'reactium-core/sdk';\nexport const Clicker = () => {\n const clickState = useSyncState({ clicks: 1 });\n const clicks = clickState.get('clicks');\n useRegisterHandle('ClickState', () => clickState);\n\n return (\n
Clicked {clicks} times clickState.set('clicks', clicks + 1)}>Click Me\n
\n );\n };", + "title": "get and set", + "content": "import { useSyncState } from 'reactium-sdk-core';\n\nfunction MyComponent() {\n const syncState = useSyncState({ foo: 'bar' });\n\n const handleClick = () => {\n // Get the entire synced state\n console.log(syncState.get()); // { foo: 'bar' }\n\n // Get a property of the synced state\n console.log(syncState.get('foo')); // 'bar'\n\n // Update a property of the synced state\n syncState.set('foo', 'baz');\n console.log(syncState.get('foo')); // 'baz'\n\n // Replace the entire synced state\n syncState.set({ foo: 'bar', baz: 'qux' });\n console.log(syncState.get()); // { foo: 'bar', baz: 'qux' }\n };\n\n return ;\n}", "type": "json" }, { - "title": "Consumer", - "content": "import React, { useState, useEventEffect } from 'react';\nimport { useHandle } from 'reactium-core/sdk';\n// communicate state with other components\nexport const Listener = () => {\n const [clicked, setClicked] = useState(false);\n const handle = useHandle('ClickState')\n const numClicks = handle.get('clicks');\n\n const remoteClicked = e => {\n if (numClicks < e.get('clicks')) {\n setClicked(true);\n }\n };\n\n useEventEffect(handle, { set: remoteClicked }, []);\n\n return (\n
Clicker {clicked ? 'unclicked' : 'clicked'}
\n );\n };", + "title": "Form Usage", + "content": "import { useSyncState } from 'reactium-sdk-core';\n\nfunction MyForm() {\n const syncState = useSyncState({\n user: {\n name: 'John Doe',\n age: 30,\n address: {\n street: '123 Main St',\n city: 'New York',\n state: 'NY',\n },\n },\n });\n\n const handleChange = (event) => {\n const { name, value } = event.target;\n syncState.set(name, value);\n };\n\n return (\n
\n \n \n
\n \n \n
\n \n \n
\n \n \n
\n \n \n
\n \n );\n}", "type": "json" } ], + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "ReactiumSyncState", + "optional": false, + "field": "syncState", + "description": "

The ReactiumSyncState instance returned by the hook.

" + } + ] + } + }, "version": "0.0.0", "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/useSyncState.js", "groupTitle": "ReactHook" @@ -2143,6 +2310,166 @@ define({ "api": [ "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/sdks/cache/index.js", "groupTitle": "Reactium.Cache" }, + { + "type": "Async", + "url": "Capability.check(capabilities,strict)", + "title": "Capability.check", + "version": "3.2.1", + "name": "Capability.check", + "group": "Reactium.Capability", + "description": "

Check a list of capabilities on the current user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Array", + "optional": false, + "field": "capabilities", + "description": "

list of string capabilities to check, returns true if current user is allowed, false if not allowed

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "strict", + "defaultValue": "true", + "description": "

When true all capabilities must be allowed for user for check to return true, otherwise only one capability is required to get a true value.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Reactium.User id to check.

" + } + ] + } + }, + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.check(capabilities,strict)", + "title": "Capability.check", + "version": "3.2.1", + "description": "

Retrieve an enumerated list of capabilities for the specified user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Array", + "optional": false, + "field": "capabilities", + "description": "

list of string capabilities to check, returns true if current user is allowed, false if not allowed.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Actinium.User id value. If empty the current user is used.

" + } + ] + } + }, + "name": "Capability.check", + "group": "Reactium.Capability", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.get(capability)", + "title": "Capability.get()", + "version": "3.2.1", + "description": "

Get allowed and excluded roles for a capability.

", + "name": "Capability.get", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "import Reactium from 'reactium-core/sdk';\nCapability.get('do-something').then(({allowed = [], excluded = []}) => {\n if (allowed.includes('contributor')) console.log('Contributor allowed to do something');\n})", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.grant(capability,role)", + "title": "Capability.grant()", + "version": "3.2.1", + "description": "

Add role(s) to the capability allowed list.

", + "name": "Capability.grant", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.grant('taxonomy.update', 'moderator');\nCapability.grant('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.restrict(capability,role)", + "title": "Capability.restrict()", + "version": "3.2.1", + "description": "

Add role(s) to the capability excluded list.

", + "name": "Capability.restrict", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.restrict('taxonomy.update', 'moderator');\nCapability.restrict('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.revoke(capability,role)", + "title": "Capability.revoke()", + "version": "3.2.1", + "description": "

Remove role(s) from the capability allowed list.

", + "name": "Capability.revoke", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.revoke('taxonomy.update', 'moderator');\nCapability.revoke('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.unrestrict(capability,role)", + "title": "Capability.unrestrict()", + "version": "3.2.1", + "description": "

Remove role(s) from the capability excluded list.

", + "name": "Capability.unrestrict", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.unrestrict('taxonomy.update', 'moderator');\nCapability.unrestrict('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, { "type": "Function", "url": "Component.register(hook,component,order)", @@ -3401,65 +3728,1253 @@ define({ "api": [ "groupTitle": "Reactium.Routing" }, { - "type": "Class", - "url": "Fullscreen", - "title": "Fullscreen", - "group": "Reactium.Utilities", - "name": "Fullscreen", - "description": "

Cross browser utility for toggling fullscreen mode.

", + "type": "Function", + "url": "Setting.get(key,defaultValue,refresh)", + "title": "Setting.get()", + "group": "Reactium.Setting", + "name": "Setting.get", + "description": "

Get a setting value.

", "parameter": { "fields": { - "Event": [ + "Parameter": [ { - "group": "Event", - "type": "Event", + "group": "Parameter", + "type": "String", "optional": false, - "field": "fullscreenchange", - "description": "

Triggered when the browser's fullscreen state changes.

" + "field": "key", + "description": "

The unique setting key.

" + }, + { + "group": "Parameter", + "type": "Mixed", + "optional": false, + "field": "defaultValue", + "description": "

The default value if the setting doesn't exist.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "refresh", + "description": "

if true, get a fresh value, even if already cached.

" } ] } }, "examples": [ { - "title": "Usage:", - "content": " // isExpanded()\n Reactium.Utils.Fullscreen.isExpanded();\n\n // isCollapsed()\n Reactium.Utils.Fullscreen.isCollapsed();\n\n // collapse()\n Reactium.Utils.Fullscreen.collapse();\n\n // expand()\n Reactium.Utils.Fullscreen.expand();\n\n // toggle()\n Reactium.Utils.Fullscreen.toggle();\n\n // Event: fullscreenchange\nimport React, { useEffect, useState } from 'react';\nimport Reactium from 'reactium-core/sdk';\n\nconst MyComponent = () => {\n const [state, setState] = useState(Reactium.Utils.Fullscreen.isExpanded());\n\n const update = () => {\n setState(Reactium.Utils.Fullscreen.isExpanded());\n }\n\n useEffect(() => {\n // ssr safety\n if (typeof document === 'undefined') return;\n\n // listen for fullscreenchange\n document.addEventListener('fullscreenchange', update);\n\n // prevent memory leak\n return () => {\n document.removeEventListener('fullscreenchange', update);\n };\n });\n\n return (
{state}
);\n};", + "title": "Example Usage:", + "content": "Reactium.Setting.get('site.hostname');", "type": "json" } ], "version": "0.0.0", - "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/fullscreen.js", - "groupTitle": "Reactium.Utilities" + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" }, { "type": "Function", - "url": "Reactium.Utils.abbreviatedNumber(number)", - "title": "Utils.abbreviatedNumber()", - "version": "3.1.14", - "group": "Reactium.Utils", - "name": "Utils.abbreviatedNumber", - "description": "

Abbreviate a long number to a string.

", + "url": "Setting.load(autoRefresh)", + "title": "Setting.load()", + "name": "Setting.load", + "group": "Reactium.Setting", + "description": "

Load all settings, with cache. When called multiple times in the cache period, the result will come from memory cache.

", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", - "type": "Number", - "optional": false, - "field": "number", - "description": "

The number to abbreviate.

" + "type": "Boolean", + "optional": true, + "field": "autoRefresh", + "defaultValue": "true", + "description": "

when true, settings will be automatically loaded again every Enums.cache.settings milliseconds. When false, auto reload of settings will not happen.

" } ] } }, - "examples": [ - { - "title": "Example Usage:", - "content": "Reactium.Utils.abbreviatedNumber(5000);\n// Returns: 5k\n\nReactium.Utils.abbreviatedNumber(500000);\n// Returns .5m", - "type": "json" + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "settings", + "description": "

an object with setting the current user has access to.

" + } + ] } - ], - "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/sdks/utils/index.js", + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" + }, + { + "type": "Function", + "url": "Setting.set(key,value)", + "title": "Setting.set()", + "group": "Reactium.Setting", + "name": "Setting.set", + "description": "

Create or update a setting value. Returns a {Promise}.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "key", + "description": "

The unique setting key.

" + }, + { + "group": "Parameter", + "type": "Mixed", + "optional": true, + "field": "value", + "description": "

The setting value.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "public", + "defaultValue": "false", + "description": "

When true, this settings will be readable by anonymous. Useful for global insensitive application settings, such as "site name".

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage:", + "content": "Reactium.Setting.set('site', { title: 'My Awesome Site', hostname: 'mysite.com' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" + }, + { + "type": "Function", + "url": "Setting.unset(key)", + "title": "Setting.unset()", + "group": "Reactium.Setting", + "name": "Setting.unset", + "description": "

Unset a setting value. Returns a {Promise}.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "key", + "description": "

The unique setting key.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage:", + "content": "Reactium.Setting.unset('site.title');", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" + }, + { + "type": "Asyncronous", + "url": "User.Meta.delete(params)", + "title": "User.Meta.delete()", + "group": "Reactium.User", + "name": "User.Meta.delete", + "description": "

Mutate the Actinium.User.meta object by deleting a key value pair. Calls the user-meta-delete cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user meta object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-meta-delete", + "description": "

Triggered before the user-meta-delete cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-meta-delete-response", + "description": "

Triggered after the user-meta-delete cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.Meta.update(params)", + "title": "User.Meta.update()", + "group": "Reactium.User", + "name": "User.Meta.update", + "description": "

Mutate the Actinium.User.meta object. Calls the user-meta-update cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user meta object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-meta-update", + "description": "

Triggered before the user-meta-update cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-meta-update-response", + "description": "

Triggered after the user-meta-update cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "examples": [ + { + "title": "const updatedUser = await User.Meta.update({ objectId: 'slertjt5wzb', random: 'meta value' });", + "content": "const updatedUser = await User.Meta.update({ objectId: 'slertjt5wzb', random: 'meta value' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.Pref.delete(params)", + "title": "User.Pref.delete()", + "group": "Reactium.User", + "name": "User.Pref.delete", + "description": "

Mutate the Actinium.User.pref object by deleting a key value pair. Calls the user-pref-delete cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user pref object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-pref-delete", + "description": "

Triggered before the user-pref-delete cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-pref-delete-response", + "description": "

Triggered after the user-pref-delete cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.Pref.update(params)", + "title": "User.Pref.update()", + "group": "Reactium.User", + "name": "User.Pref.update", + "description": "

Mutate the Actinium.User.pref object. Calls the user-pref-update cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user pref object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-pref-update", + "description": "

Triggered before the user-pref-update cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-pref-update-response", + "description": "

Triggered after the user-pref-update cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "examples": [ + { + "title": "const updatedUser = await User.Pref.update({ objectId: 'slertjt5wzb', random: 'pref value' });", + "content": "const updatedUser = await User.Pref.update({ objectId: 'slertjt5wzb', random: 'pref value' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.Role.add(role,objectId)", + "title": "User.Role.add()", + "description": "

Asyncronously add a user to a role.

", + "name": "User.Role.add", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "role", + "description": "

The role name. Example: 'super-admin'.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

The objectId of the user. If empty the current user is used.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Promise", + "optional": false, + "field": "user", + "description": "

The updated user object.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.Role.remove(role,objectId)", + "title": "User.Role.remove()", + "description": "

Asyncronously remove a user to a role.

", + "name": "User.Role.remove", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "role", + "description": "

The role name. Example: 'super-admin'.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

The objectId of the user. If empty the current user is used.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Promise", + "optional": false, + "field": "user", + "description": "

The updated user object.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.auth(username,password)", + "title": "User.auth()", + "description": "

Authenticate with the Actinium server.

", + "name": "User.auth", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "username", + "description": "" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "password", + "description": "" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.can(capabilities,strict)", + "title": "User.can()", + "description": "

Asyncronously find out if a user has a set of capabilities.

", + "name": "User.can", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Mixed", + "optional": false, + "field": "capabilities", + "description": "

The capability(s) to check for (string or array)

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "strict", + "defaultValue": "true", + "description": "

Compare capabilities where the user must have all capabilities [true], or at least 1 [false].

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.current(parseObject)", + "title": "User.current()", + "group": "Reactium.User", + "name": "User.current", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "user", + "description": "

the current user

" + } + ] + } + }, + "description": "

Retrieve the current authenticated user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "parseObject", + "defaultValue": "false", + "description": "

By default the return value is an object. If you need the Actinium.User object instead pass true.

" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.forgot()", + "title": "User.forgot()", + "group": "Reactium.User", + "name": "User.forgot", + "description": "

Intiates the forgot password routine.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "email", + "description": "

The email address associated with a user object.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "User.forgot('someone@email.com').then(response => {\n console.log(response);\n});", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.getSessionToken()", + "title": "User.getSessionToken()", + "description": "

If the user is logged in, get the current session token.

", + "name": "User.getSessionToken", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.hasValidSession()", + "title": "User.hasValidSession()", + "description": "

Check to make sure the current user and associated session are valid.

", + "name": "User.hasValidSession", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.isCurrent(user)", + "title": "User.isCurrent()", + "group": "Reactium.User", + "name": "User.isCurrent", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "The", + "description": "

User object to check.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "// if signed in as steveMcQu33n this will return true.\nconst isMe = User.isCurrent({ username: 'steveMcQu33n' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.isRole(role,objectId)", + "title": "User.isRole()", + "description": "

Asyncronously find out if a user is a member of a specific role.

", + "name": "User.isRole", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "role", + "description": "

The role to check for.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Actinium.User id. If empty, the User.current() id is used.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.list(params)", + "title": "User.list()", + "group": "Reactium.User", + "name": "User.list", + "description": "

Retrieve a list of Actinium.User objects. Calls the user-list cloud function.

", + "parameter": { + "fields": { + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "role", + "description": "

Filter the results to the specified Actinium.Role name.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "search", + "description": "

Search using logical or. The query will RegExp compare to the default fields: username, email, fname, lname.

Note: You can add or remove fields via the user-search-fields hook.

" + }, + { + "group": "params", + "type": "Mixed", + "optional": true, + "field": "objectId", + "description": "

{String|Array} Search for a specific objectId or array of objectIds.

Note: If search is specified, this value is ignored.

" + }, + { + "group": "params", + "type": "Mixed", + "optional": true, + "field": "email", + "description": "

{String|Array} Search for a specific email address or array of email addresses.

Note: If search is specified, this value is ignored.

" + }, + { + "group": "params", + "type": "Mixed", + "optional": true, + "field": "username", + "description": "

{String|Array} Search for a specific username or array of usernames.

Note: If search is specified, this value is ignored.

" + }, + { + "group": "params", + "type": "Boolean", + "optional": true, + "field": "optimize", + "defaultValue": "false", + "description": "

If the count of the results is less than or equal to 1000, all objects will be returned. The page number will be set to 1 and the number of pages will also be 1.

" + }, + { + "group": "params", + "type": "Boolean", + "optional": true, + "field": "refresh", + "defaultValue": "false", + "description": "

By default the results are cached for 90 seconds. You can flush the cache with this parameter.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "indexBy", + "description": "

Index the results by the specified field and return them as an Object.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "order", + "description": "

Order the results ascending or descending.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "orderBy", + "defaultValue": "username", + "description": "

Order the results by the specified field.

" + }, + { + "group": "params", + "type": "Number", + "optional": true, + "field": "page", + "defaultValue": "1", + "description": "

The page number of results to return.

" + }, + { + "group": "params", + "type": "Number", + "optional": true, + "field": "limit", + "defaultValue": "20", + "description": "

The number of results to return per page.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-list", + "description": "

Triggered before the user-list Cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-list-response", + "description": "

Triggered after the user-list Cloud function is called.

Arguments: response:Object, params:Object 
" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "const superAdmins = await User.list({ role: 'super-admin', refresh: true });\n\nconst user = await User.list({ objectId: 'tlakQ34VOI' });\n\nconst search = await User.list({ search: 'jeff' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.logOut()", + "title": "User.logOut()", + "description": "

Invalidate the current user.

", + "name": "User.logOut", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.login(username,password)", + "title": "User.login()", + "description": "

Alias of User.auth()

", + "name": "User.login", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.register(params)", + "title": "User.register()", + "description": "

Asyncronously create a new user.

", + "name": "User.register", + "parameter": { + "fields": { + "params": [ + { + "group": "params", + "type": "String", + "optional": false, + "field": "username", + "description": "

Unique username used when authenticating.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "password", + "description": "

Password used when authenticating.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "confirm", + "description": "

Password confirmation.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "email", + "description": "

Email address used when resetting password and for system messaging.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Promise", + "optional": false, + "field": "user", + "description": "

The new user object.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.reset()", + "title": "User.reset()", + "group": "Reactium.User", + "name": "User.reset", + "description": "

Reset the user password.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "token", + "description": "

The token received from the User.forgot() email message.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "password", + "description": "

The new password.

" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.retrieve(params,options)", + "title": "User.retrieve()", + "group": "Reactium.User", + "name": "User.retrieve", + "description": "

Retrieve a single Actinium.User object. Calls the user-retrieve cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Query parameters. See User.list() for more details.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Retrieve by the objectId field.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Retrieve by the username field.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Retrieve by the email address field.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-retrieve", + "description": "

Triggered before the user-retrieve cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-retrieve", + "description": "

Triggered after the user-retrieve cloud function is called.

Arguments: user:Object, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.save(params)", + "title": "User.save()", + "group": "Reactium.User", + "name": "User.save", + "description": "

Save a Actinium.User object.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Key value pairs to apply to the Actinium.User object. Calls the user-save cloud function.

Note: Any additional key value pairs will be added to the user object as a new column.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": false, + "field": "username", + "description": "

The unique username used when signing in.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "email", + "description": "

The email address to associate with the user account.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "password", + "description": "

The password used when signing in.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "role", + "description": "

The Actinium.Role name to add the user to.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-save", + "description": "

Mutate the Actinium.User object before save is complete.

Arguments:  req:Object:Actinium.User 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-save-response", + "description": "

Take action after the Actinium.User object has been saved.

Arguments: req:Object:Actinium.User 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-save-error", + "description": "

Take action after the Actinium.User returns an error.

Arguments: error:Object, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.serialize(user)", + "title": "User.serialize()", + "group": "Reactium.User", + "name": "User.serialize", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "Convert", + "description": "

a Actinium.User object into a JSON object. If the object is already serialized it is returned.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "const u = User.serialize(user);", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.trash(params)", + "title": "User.trash()", + "group": "Reactium.User", + "name": "User.trash", + "description": "

Send a single Actinium.User object to the recycle bin. Calls user-trash cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for deleting a user.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": false, + "field": "objectId", + "description": "

The Actinium.User objectId.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-trash", + "description": "

Triggered before the user-trash cloud function is run.

Arguments: user:Actinium.User 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-trash", + "description": "

Triggered after the user-trash cloud function is run.

Arguments: user:Actinium.User 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Class", + "url": "Fullscreen", + "title": "Fullscreen", + "group": "Reactium.Utilities", + "name": "Fullscreen", + "description": "

Cross browser utility for toggling fullscreen mode.

", + "parameter": { + "fields": { + "Event": [ + { + "group": "Event", + "type": "Event", + "optional": false, + "field": "fullscreenchange", + "description": "

Triggered when the browser's fullscreen state changes.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": " // isExpanded()\n Reactium.Utils.Fullscreen.isExpanded();\n\n // isCollapsed()\n Reactium.Utils.Fullscreen.isCollapsed();\n\n // collapse()\n Reactium.Utils.Fullscreen.collapse();\n\n // expand()\n Reactium.Utils.Fullscreen.expand();\n\n // toggle()\n Reactium.Utils.Fullscreen.toggle();\n\n // Event: fullscreenchange\nimport React, { useEffect, useState } from 'react';\nimport Reactium from 'reactium-core/sdk';\n\nconst MyComponent = () => {\n const [state, setState] = useState(Reactium.Utils.Fullscreen.isExpanded());\n\n const update = () => {\n setState(Reactium.Utils.Fullscreen.isExpanded());\n }\n\n useEffect(() => {\n // ssr safety\n if (typeof document === 'undefined') return;\n\n // listen for fullscreenchange\n document.addEventListener('fullscreenchange', update);\n\n // prevent memory leak\n return () => {\n document.removeEventListener('fullscreenchange', update);\n };\n });\n\n return (
{state}
);\n};", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/fullscreen.js", + "groupTitle": "Reactium.Utilities" + }, + { + "type": "Function", + "url": "Reactium.Utils.abbreviatedNumber(number)", + "title": "Utils.abbreviatedNumber()", + "version": "3.1.14", + "group": "Reactium.Utils", + "name": "Utils.abbreviatedNumber", + "description": "

Abbreviate a long number to a string.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Number", + "optional": false, + "field": "number", + "description": "

The number to abbreviate.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage:", + "content": "Reactium.Utils.abbreviatedNumber(5000);\n// Returns: 5k\n\nReactium.Utils.abbreviatedNumber(500000);\n// Returns .5m", + "type": "json" + } + ], + "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/sdks/utils/index.js", "groupTitle": "Reactium.Utils" }, { @@ -3584,61 +5099,29 @@ define({ "api": [ "groupTitle": "Reactium.Utils" }, { - "type": "Function", - "url": "Utils.splitParts(parts)", - "title": "Utils.splitParts()", - "description": "

Breaks formatted string (or array of strings), into flat array of parts/nodes, inserting an object in array in the place of %key%. Useful for tokenizing a translation string, and getting an array that can easily be mapped into React components. Returns an object with replace and value methods. Call replace(key,value) method (chaining) as many times as necessary to replace all tokens. Call value() method to get the final array of Part objects. Call reset() to reset the SlipParts object to the original string without replacements for reuse.

", + "type": "function", + "url": "Utils.splitParts", + "title": "splitParts", + "name": "Utils.splitParts", + "group": "Reactium.Utils", + "description": "

splitParts is a utility function that allows you to easily interpolate React components into a string. It works by tokenizing the string, allowing you to identify specific parts that you want to replace with a React component. You can then use the replace method to specify the values for these tokens, and the value method to get an array of the parts, which you can map over and return the appropriate React components for each part. This can be useful for situations where you want to dynamically render a string that includes both plain text and React components.

", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", - "type": "Mixed", - "optional": false, - "field": "parts", - "description": "

String containing tokens like %key% to be replaced.

" - } - ], - "replace": [ - { - "group": "replace", - "type": "String", - "optional": false, - "field": "key", - "description": "

when calling replace(key,value), the token %${key}% will be replaced with an Part object key->value pair.

" - }, - { - "group": "replace", - "type": "Mixed", - "optional": false, - "field": "value", - "description": "

the value to use in the key->pair replacement

" - } - ], - "Part": [ - { - "group": "Part", "type": "String", "optional": false, - "field": "key", - "description": "

the key in the keypair

" - }, - { - "group": "Part", - "type": "Mixed", - "optional": false, - "field": "value", - "description": "

the value in the keypair

" + "field": "strVal", + "description": "

The input string to tokenize

" } ] } }, - "name": "Utils.splitParts", - "group": "Reactium.Utils", "examples": [ { - "title": "Usage", - "content": "import React from 'react';\nimport Reactium, { __ } from 'reactium-core/sdk';\nimport moment from 'moment';\nimport md5 from 'md5';\n\nconst Gravatar = props => {\n const { email } = props;\n return (\n \n );\n};\n\nexport default props => {\n const description = __('%username% updated post %slug% at %time%');\n const parts = Reactium.Utils.splitParts(description)[\n ('email', 'slug', 'time')\n ].forEach(key => parts.replace(key, props[key]));\n\n return (\n \n {parts.value().map(part => {\n // arbitrary React component possible\n const { key, value } = part;\n\n switch (key) {\n case 'email': {\n return ;\n }\n case 'time': {\n return (\n \n {moment(value).fromNow()}\n \n );\n }\n default: {\n // plain string part\n return {value};\n }\n }\n })}\n \n );\n};", + "title": "import React from 'react';", + "content": "\nimport React from 'react';\nimport Reactium, { __ } from 'reactium-core/sdk';\nimport moment from 'moment';\nimport md5 from 'md5';\n\nconst Gravatar = props => {\n const { email } = props;\n return (\n \n );\n};\n\nexport default props => {\n const description = __('%email% updated post %slug% at %time%');\n const parts = Reactium.Utils.splitParts(description);\n Object.entries(props).forEach(([key, value]) => {\n parts.replace(key, value);\n });\n\n return (\n \n {parts.value().map(part => {\n // arbitrary React component possible\n const { key, value } = part;\n\n switch (key) {\n case 'email': {\n return ;\n }\n case 'time': {\n return (\n \n {moment(value).fromNow()}\n \n );\n }\n default: {\n // plain string part\n return {value};\n }\n }\n })}\n \n );\n};", "type": "json" } ], diff --git a/docs/api_data.json b/docs/api_data.json index 66e125b8..86bb5543 100644 --- a/docs/api_data.json +++ b/docs/api_data.json @@ -1,4 +1,139 @@ [ + { + "type": "Async", + "url": "Capability.User.get(userID,refresh)", + "title": "Capability.User.get()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.User.get", + "description": "

Return an Array of capability names granted to the user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Reactium.User id. If empty the User.current id is used.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "refres", + "defaultValue": "false", + "description": "

Fetch capabilities from the server instead of cache.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage", + "content": "const canEditArticle = async userID => {\n const caps = await Reactium.Capability.User.get(userID);\n return caps.includes('content.article.update');\n};", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Static", + "url": "Capability.autosync", + "title": "Capability.autosync", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.autosync", + "description": "

Time in milliseconds that controls when registered capabilities are propagated to the server. If set to false, manually push registered capabilities with Capability.propagate(). Default: 10000.

", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Static", + "url": "Capability.cache", + "title": "Capability.cache", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.cache", + "description": "

Time in milliseconds that controls how long to cache capability request results. Default: 60000.

", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Function", + "url": "Capability.clearCache()", + "title": "Capability.clearCache()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.clearCache", + "description": "

Clear Capability related Cache keys.

", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Async", + "url": "Capability.propagate(force)", + "title": "Capability.propagate()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.propagate", + "description": "

Propagate registered capabilities to an Actinium server.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "force", + "defaultValue": "false", + "description": "

Execute the propagation regardless of if a current propagation operation is under way. The resolution of the previous propagation operation will be cancelled. If Capability.autosync is true, this function will be called whenever the autosync is initiated.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage", + "content": "await Capability.propagate();", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, + { + "type": "Function", + "url": "Capability.register(id)", + "title": "Capability.register()", + "version": "3.1.2", + "group": "Capability", + "name": "Capability.register", + "description": "

Register a new capability.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "id", + "description": "

String value used when checking for the capability. This function is limited in scope and regularly shouldn't be used. Server-side capability registration is preferred.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage", + "content": "Capability.register('my-ui.view')", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Capability" + }, { "type": "Hook", "url": "Hooks", @@ -853,6 +988,17 @@ "filename": ".core/app/index.js", "groupTitle": "Hooks" }, + { + "type": "Hook", + "url": "service-worker-init", + "title": "service-worker-init", + "name": "service-worker-init", + "description": "

Called after dependencies-load in Reactium.ServiceWorker to register any webapp service worker code for the app. By default, this hook is implemented to register the customizable Google Workbox implementation that will be compiled (to /assets/js/sw/sw.js). Also, async loads and instantiates a a google workbox-window Workbox object on Reactium.ServiceWorker.worker. async only - used in front-end webapp only

", + "group": "Hooks", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-service-worker/sdk/index.js", + "groupTitle": "Hooks" + }, { "type": "Hook", "url": "store-create", @@ -1690,7 +1836,7 @@ }, { "type": "ReactHook", - "url": "useSyncHandle(id)", + "url": "useSyncHandle(id,updateEvent)", "title": "useSyncHandle()", "description": "

React hook to subscribe to updates for a registered sync handle.

", "parameter": { @@ -1702,6 +1848,14 @@ "optional": false, "field": "id", "description": "

Array of properties, or . separated object path. e.g. ['path','to','handle'] or 'path.to.handle'. Identifies the full path to an imperative handle.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "updateEvent", + "defaultValue": "set", + "description": "

Trigger update of the consuming component when EventTarget event of this type is dispatched. Defaults tot 'set'.

" } ] } @@ -1716,47 +1870,60 @@ "type": "ReactHook", "url": "useSyncState(initialState,updateEvent)", "title": "useSyncState()", - "description": "

Intended to provide an object to get and set state synchrounously, while providing a EventTarget object that can dispatch a 'set' event when the state is updated. Dispatches 'before-set' before changing the state, and 'change' event if any shallow changes are detected.

", + "name": "useSyncState", + "group": "ReactHook", + "description": "

Intended to provide an object to get and set state synchrounously, while providing a EventTarget object that can dispatch a set event whenever the state is changed. The hook will also dispatch a change event whenever the synced state changes. The hook can also listen for a specified event on the EventTarget object, and update the synced state with the event.detail property when the event is dispatched.

The hook uses the ReactiumSyncState class to implement the synced state and EventTarget behavior. The class uses the object-path module to manipulate the state object, and provides the following methods:

  • get(path, defaultValue): Gets the value at the specified path in the synced state, or the entire synced state if no path is provided. If the value at the specified path is undefined, returns the provided default value instead.
  • set(path, value): Sets the value at the specified path in the synced state, or replaces the entire synced state if no path is provided. The path parameter can be a string or array, representing a path in the object, or undefined to replace the entire object. Dispatches a set event. If the new value is different from the previous value, also dispatches a change event.
  • set(path, value, update): Sets the value at the specified path in the synced state, or replaces the entire synced state if no path is provided. If update is true, dispatches a set event. If the new value is different from the previous value and update is true, also dispatches a change event. The path parameter can be a string or array, representing a path in the object, or undefined to replace the entire object.
  • extend(prop, method): Extends the ReactiumSyncState instance with the provided method, bound to the instance.
", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", - "type": "Mixed", + "type": "Object", "optional": false, "field": "initialState", - "description": "

The initial state.

" + "description": "

The initial state of the synced state.

" }, { "group": "Parameter", - "type": "String", + "type": "string", "optional": true, "field": "updateEvent", "defaultValue": "set", - "description": "

Trigger update of the consuming component when EventTarget event of this type is dispatched. Defaults tot 'set'.

" + "description": "

The event name to listen for on the EventTarget object. When the event is dispatched, the hook will update the synced state with the event.detail property, and trigger a rerender of the React component.

" } ] } }, - "name": "useSyncState", - "group": "ReactHook", "examples": [ { - "title": "SimpleExample", - "content": "import React from 'react';\nimport { useSyncState } from 'reactium-core/sdk';\nexport const SimpleExample = () => {\n const clickState = useSyncState({ clicks: 1 });\n const clicks = clickState.get('clicks');\n return (\n
Clicked {clicks} times clickState.set('clicks', clicks + 1)}>Click Me\n
\n );\n };", + "title": "Simple", + "content": "import React from 'react';\nimport { useSyncState } from 'reactium-sdk-core';\n\nconst ExampleComponent = () => {\n const [syncState, setSyncState] = useSyncState({ count: 0 });\n\n return (\n <>\n
Count: {syncState.get('count')}
\n \n \n );\n};", "type": "json" }, { - "title": "EventTarget", - "content": "import React from 'react';\nimport { useSyncState, useRegisterHandle } from 'reactium-core/sdk';\nexport const Clicker = () => {\n const clickState = useSyncState({ clicks: 1 });\n const clicks = clickState.get('clicks');\n useRegisterHandle('ClickState', () => clickState);\n\n return (\n
Clicked {clicks} times clickState.set('clicks', clicks + 1)}>Click Me\n
\n );\n };", + "title": "get and set", + "content": "import { useSyncState } from 'reactium-sdk-core';\n\nfunction MyComponent() {\n const syncState = useSyncState({ foo: 'bar' });\n\n const handleClick = () => {\n // Get the entire synced state\n console.log(syncState.get()); // { foo: 'bar' }\n\n // Get a property of the synced state\n console.log(syncState.get('foo')); // 'bar'\n\n // Update a property of the synced state\n syncState.set('foo', 'baz');\n console.log(syncState.get('foo')); // 'baz'\n\n // Replace the entire synced state\n syncState.set({ foo: 'bar', baz: 'qux' });\n console.log(syncState.get()); // { foo: 'bar', baz: 'qux' }\n };\n\n return ;\n}", "type": "json" }, { - "title": "Consumer", - "content": "import React, { useState, useEventEffect } from 'react';\nimport { useHandle } from 'reactium-core/sdk';\n// communicate state with other components\nexport const Listener = () => {\n const [clicked, setClicked] = useState(false);\n const handle = useHandle('ClickState')\n const numClicks = handle.get('clicks');\n\n const remoteClicked = e => {\n if (numClicks < e.get('clicks')) {\n setClicked(true);\n }\n };\n\n useEventEffect(handle, { set: remoteClicked }, []);\n\n return (\n
Clicker {clicked ? 'unclicked' : 'clicked'}
\n );\n };", + "title": "Form Usage", + "content": "import { useSyncState } from 'reactium-sdk-core';\n\nfunction MyForm() {\n const syncState = useSyncState({\n user: {\n name: 'John Doe',\n age: 30,\n address: {\n street: '123 Main St',\n city: 'New York',\n state: 'NY',\n },\n },\n });\n\n const handleChange = (event) => {\n const { name, value } = event.target;\n syncState.set(name, value);\n };\n\n return (\n
\n \n \n
\n \n \n
\n \n \n
\n \n \n
\n \n \n
\n \n );\n}", "type": "json" } ], + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "ReactiumSyncState", + "optional": false, + "field": "syncState", + "description": "

The ReactiumSyncState instance returned by the hook.

" + } + ] + } + }, "version": "0.0.0", "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/useSyncState.js", "groupTitle": "ReactHook" @@ -2143,6 +2310,166 @@ "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/sdks/cache/index.js", "groupTitle": "Reactium.Cache" }, + { + "type": "Async", + "url": "Capability.check(capabilities,strict)", + "title": "Capability.check", + "version": "3.2.1", + "name": "Capability.check", + "group": "Reactium.Capability", + "description": "

Check a list of capabilities on the current user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Array", + "optional": false, + "field": "capabilities", + "description": "

list of string capabilities to check, returns true if current user is allowed, false if not allowed

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "strict", + "defaultValue": "true", + "description": "

When true all capabilities must be allowed for user for check to return true, otherwise only one capability is required to get a true value.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Reactium.User id to check.

" + } + ] + } + }, + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.check(capabilities,strict)", + "title": "Capability.check", + "version": "3.2.1", + "description": "

Retrieve an enumerated list of capabilities for the specified user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Array", + "optional": false, + "field": "capabilities", + "description": "

list of string capabilities to check, returns true if current user is allowed, false if not allowed.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Actinium.User id value. If empty the current user is used.

" + } + ] + } + }, + "name": "Capability.check", + "group": "Reactium.Capability", + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.get(capability)", + "title": "Capability.get()", + "version": "3.2.1", + "description": "

Get allowed and excluded roles for a capability.

", + "name": "Capability.get", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "import Reactium from 'reactium-core/sdk';\nCapability.get('do-something').then(({allowed = [], excluded = []}) => {\n if (allowed.includes('contributor')) console.log('Contributor allowed to do something');\n})", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.grant(capability,role)", + "title": "Capability.grant()", + "version": "3.2.1", + "description": "

Add role(s) to the capability allowed list.

", + "name": "Capability.grant", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.grant('taxonomy.update', 'moderator');\nCapability.grant('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.restrict(capability,role)", + "title": "Capability.restrict()", + "version": "3.2.1", + "description": "

Add role(s) to the capability excluded list.

", + "name": "Capability.restrict", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.restrict('taxonomy.update', 'moderator');\nCapability.restrict('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.revoke(capability,role)", + "title": "Capability.revoke()", + "version": "3.2.1", + "description": "

Remove role(s) from the capability allowed list.

", + "name": "Capability.revoke", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.revoke('taxonomy.update', 'moderator');\nCapability.revoke('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, + { + "type": "Async", + "url": "Capability.unrestrict(capability,role)", + "title": "Capability.unrestrict()", + "version": "3.2.1", + "description": "

Remove role(s) from the capability excluded list.

", + "name": "Capability.unrestrict", + "group": "Reactium.Capability", + "examples": [ + { + "title": "Usage", + "content": "Capability.unrestrict('taxonomy.update', 'moderator');\nCapability.unrestrict('taxonomy.update', ['moderator']);", + "type": "json" + } + ], + "filename": "reactium_modules/@atomic-reactor/reactium-capability/sdk/index.js", + "groupTitle": "Reactium.Capability" + }, { "type": "Function", "url": "Component.register(hook,component,order)", @@ -3401,65 +3728,1253 @@ "groupTitle": "Reactium.Routing" }, { - "type": "Class", - "url": "Fullscreen", - "title": "Fullscreen", - "group": "Reactium.Utilities", - "name": "Fullscreen", - "description": "

Cross browser utility for toggling fullscreen mode.

", + "type": "Function", + "url": "Setting.get(key,defaultValue,refresh)", + "title": "Setting.get()", + "group": "Reactium.Setting", + "name": "Setting.get", + "description": "

Get a setting value.

", "parameter": { "fields": { - "Event": [ + "Parameter": [ { - "group": "Event", - "type": "Event", + "group": "Parameter", + "type": "String", "optional": false, - "field": "fullscreenchange", - "description": "

Triggered when the browser's fullscreen state changes.

" + "field": "key", + "description": "

The unique setting key.

" + }, + { + "group": "Parameter", + "type": "Mixed", + "optional": false, + "field": "defaultValue", + "description": "

The default value if the setting doesn't exist.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "refresh", + "description": "

if true, get a fresh value, even if already cached.

" } ] } }, "examples": [ { - "title": "Usage:", - "content": " // isExpanded()\n Reactium.Utils.Fullscreen.isExpanded();\n\n // isCollapsed()\n Reactium.Utils.Fullscreen.isCollapsed();\n\n // collapse()\n Reactium.Utils.Fullscreen.collapse();\n\n // expand()\n Reactium.Utils.Fullscreen.expand();\n\n // toggle()\n Reactium.Utils.Fullscreen.toggle();\n\n // Event: fullscreenchange\nimport React, { useEffect, useState } from 'react';\nimport Reactium from 'reactium-core/sdk';\n\nconst MyComponent = () => {\n const [state, setState] = useState(Reactium.Utils.Fullscreen.isExpanded());\n\n const update = () => {\n setState(Reactium.Utils.Fullscreen.isExpanded());\n }\n\n useEffect(() => {\n // ssr safety\n if (typeof document === 'undefined') return;\n\n // listen for fullscreenchange\n document.addEventListener('fullscreenchange', update);\n\n // prevent memory leak\n return () => {\n document.removeEventListener('fullscreenchange', update);\n };\n });\n\n return (
{state}
);\n};", + "title": "Example Usage:", + "content": "Reactium.Setting.get('site.hostname');", "type": "json" } ], "version": "0.0.0", - "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/fullscreen.js", - "groupTitle": "Reactium.Utilities" + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" }, { "type": "Function", - "url": "Reactium.Utils.abbreviatedNumber(number)", - "title": "Utils.abbreviatedNumber()", - "version": "3.1.14", - "group": "Reactium.Utils", - "name": "Utils.abbreviatedNumber", - "description": "

Abbreviate a long number to a string.

", + "url": "Setting.load(autoRefresh)", + "title": "Setting.load()", + "name": "Setting.load", + "group": "Reactium.Setting", + "description": "

Load all settings, with cache. When called multiple times in the cache period, the result will come from memory cache.

", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", - "type": "Number", - "optional": false, - "field": "number", - "description": "

The number to abbreviate.

" + "type": "Boolean", + "optional": true, + "field": "autoRefresh", + "defaultValue": "true", + "description": "

when true, settings will be automatically loaded again every Enums.cache.settings milliseconds. When false, auto reload of settings will not happen.

" } ] } }, - "examples": [ - { - "title": "Example Usage:", - "content": "Reactium.Utils.abbreviatedNumber(5000);\n// Returns: 5k\n\nReactium.Utils.abbreviatedNumber(500000);\n// Returns .5m", - "type": "json" + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "settings", + "description": "

an object with setting the current user has access to.

" + } + ] } - ], - "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/sdks/utils/index.js", + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" + }, + { + "type": "Function", + "url": "Setting.set(key,value)", + "title": "Setting.set()", + "group": "Reactium.Setting", + "name": "Setting.set", + "description": "

Create or update a setting value. Returns a {Promise}.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "key", + "description": "

The unique setting key.

" + }, + { + "group": "Parameter", + "type": "Mixed", + "optional": true, + "field": "value", + "description": "

The setting value.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "public", + "defaultValue": "false", + "description": "

When true, this settings will be readable by anonymous. Useful for global insensitive application settings, such as "site name".

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage:", + "content": "Reactium.Setting.set('site', { title: 'My Awesome Site', hostname: 'mysite.com' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" + }, + { + "type": "Function", + "url": "Setting.unset(key)", + "title": "Setting.unset()", + "group": "Reactium.Setting", + "name": "Setting.unset", + "description": "

Unset a setting value. Returns a {Promise}.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "key", + "description": "

The unique setting key.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage:", + "content": "Reactium.Setting.unset('site.title');", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-setting/sdk/index.js", + "groupTitle": "Reactium.Setting" + }, + { + "type": "Asyncronous", + "url": "User.Meta.delete(params)", + "title": "User.Meta.delete()", + "group": "Reactium.User", + "name": "User.Meta.delete", + "description": "

Mutate the Actinium.User.meta object by deleting a key value pair. Calls the user-meta-delete cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user meta object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-meta-delete", + "description": "

Triggered before the user-meta-delete cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-meta-delete-response", + "description": "

Triggered after the user-meta-delete cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.Meta.update(params)", + "title": "User.Meta.update()", + "group": "Reactium.User", + "name": "User.Meta.update", + "description": "

Mutate the Actinium.User.meta object. Calls the user-meta-update cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user meta object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-meta-update", + "description": "

Triggered before the user-meta-update cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-meta-update-response", + "description": "

Triggered after the user-meta-update cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "examples": [ + { + "title": "const updatedUser = await User.Meta.update({ objectId: 'slertjt5wzb', random: 'meta value' });", + "content": "const updatedUser = await User.Meta.update({ objectId: 'slertjt5wzb', random: 'meta value' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.Pref.delete(params)", + "title": "User.Pref.delete()", + "group": "Reactium.User", + "name": "User.Pref.delete", + "description": "

Mutate the Actinium.User.pref object by deleting a key value pair. Calls the user-pref-delete cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user pref object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-pref-delete", + "description": "

Triggered before the user-pref-delete cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-pref-delete-response", + "description": "

Triggered after the user-pref-delete cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.Pref.update(params)", + "title": "User.Pref.update()", + "group": "Reactium.User", + "name": "User.Pref.update", + "description": "

Mutate the Actinium.User.pref object. Calls the user-pref-update cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for retrieving a user and the key value pair to apply to the user pref object.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Look up the user object by the objectId field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Look up the user object by the username field. See User.retrieve().

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Look up the user object by the email field. See User.retrieve().

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-pref-update", + "description": "

Triggered before the user-pref-update cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-pref-update-response", + "description": "

Triggered after the user-pref-update cloud function is called.

Arguments: user:Actinium.user, params:Object 
" + } + ] + } + }, + "examples": [ + { + "title": "const updatedUser = await User.Pref.update({ objectId: 'slertjt5wzb', random: 'pref value' });", + "content": "const updatedUser = await User.Pref.update({ objectId: 'slertjt5wzb', random: 'pref value' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.Role.add(role,objectId)", + "title": "User.Role.add()", + "description": "

Asyncronously add a user to a role.

", + "name": "User.Role.add", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "role", + "description": "

The role name. Example: 'super-admin'.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

The objectId of the user. If empty the current user is used.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Promise", + "optional": false, + "field": "user", + "description": "

The updated user object.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.Role.remove(role,objectId)", + "title": "User.Role.remove()", + "description": "

Asyncronously remove a user to a role.

", + "name": "User.Role.remove", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "role", + "description": "

The role name. Example: 'super-admin'.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

The objectId of the user. If empty the current user is used.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Promise", + "optional": false, + "field": "user", + "description": "

The updated user object.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.auth(username,password)", + "title": "User.auth()", + "description": "

Authenticate with the Actinium server.

", + "name": "User.auth", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "username", + "description": "" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "password", + "description": "" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.can(capabilities,strict)", + "title": "User.can()", + "description": "

Asyncronously find out if a user has a set of capabilities.

", + "name": "User.can", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Mixed", + "optional": false, + "field": "capabilities", + "description": "

The capability(s) to check for (string or array)

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "strict", + "defaultValue": "true", + "description": "

Compare capabilities where the user must have all capabilities [true], or at least 1 [false].

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.current(parseObject)", + "title": "User.current()", + "group": "Reactium.User", + "name": "User.current", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "user", + "description": "

the current user

" + } + ] + } + }, + "description": "

Retrieve the current authenticated user.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Boolean", + "optional": true, + "field": "parseObject", + "defaultValue": "false", + "description": "

By default the return value is an object. If you need the Actinium.User object instead pass true.

" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.forgot()", + "title": "User.forgot()", + "group": "Reactium.User", + "name": "User.forgot", + "description": "

Intiates the forgot password routine.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "email", + "description": "

The email address associated with a user object.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "User.forgot('someone@email.com').then(response => {\n console.log(response);\n});", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.getSessionToken()", + "title": "User.getSessionToken()", + "description": "

If the user is logged in, get the current session token.

", + "name": "User.getSessionToken", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.hasValidSession()", + "title": "User.hasValidSession()", + "description": "

Check to make sure the current user and associated session are valid.

", + "name": "User.hasValidSession", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.isCurrent(user)", + "title": "User.isCurrent()", + "group": "Reactium.User", + "name": "User.isCurrent", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "The", + "description": "

User object to check.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "// if signed in as steveMcQu33n this will return true.\nconst isMe = User.isCurrent({ username: 'steveMcQu33n' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.isRole(role,objectId)", + "title": "User.isRole()", + "description": "

Asyncronously find out if a user is a member of a specific role.

", + "name": "User.isRole", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "role", + "description": "

The role to check for.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": true, + "field": "userID", + "description": "

The Actinium.User id. If empty, the User.current() id is used.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.list(params)", + "title": "User.list()", + "group": "Reactium.User", + "name": "User.list", + "description": "

Retrieve a list of Actinium.User objects. Calls the user-list cloud function.

", + "parameter": { + "fields": { + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "role", + "description": "

Filter the results to the specified Actinium.Role name.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "search", + "description": "

Search using logical or. The query will RegExp compare to the default fields: username, email, fname, lname.

Note: You can add or remove fields via the user-search-fields hook.

" + }, + { + "group": "params", + "type": "Mixed", + "optional": true, + "field": "objectId", + "description": "

{String|Array} Search for a specific objectId or array of objectIds.

Note: If search is specified, this value is ignored.

" + }, + { + "group": "params", + "type": "Mixed", + "optional": true, + "field": "email", + "description": "

{String|Array} Search for a specific email address or array of email addresses.

Note: If search is specified, this value is ignored.

" + }, + { + "group": "params", + "type": "Mixed", + "optional": true, + "field": "username", + "description": "

{String|Array} Search for a specific username or array of usernames.

Note: If search is specified, this value is ignored.

" + }, + { + "group": "params", + "type": "Boolean", + "optional": true, + "field": "optimize", + "defaultValue": "false", + "description": "

If the count of the results is less than or equal to 1000, all objects will be returned. The page number will be set to 1 and the number of pages will also be 1.

" + }, + { + "group": "params", + "type": "Boolean", + "optional": true, + "field": "refresh", + "defaultValue": "false", + "description": "

By default the results are cached for 90 seconds. You can flush the cache with this parameter.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "indexBy", + "description": "

Index the results by the specified field and return them as an Object.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "order", + "description": "

Order the results ascending or descending.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "orderBy", + "defaultValue": "username", + "description": "

Order the results by the specified field.

" + }, + { + "group": "params", + "type": "Number", + "optional": true, + "field": "page", + "defaultValue": "1", + "description": "

The page number of results to return.

" + }, + { + "group": "params", + "type": "Number", + "optional": true, + "field": "limit", + "defaultValue": "20", + "description": "

The number of results to return per page.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-list", + "description": "

Triggered before the user-list Cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-list-response", + "description": "

Triggered after the user-list Cloud function is called.

Arguments: response:Object, params:Object 
" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "const superAdmins = await User.list({ role: 'super-admin', refresh: true });\n\nconst user = await User.list({ objectId: 'tlakQ34VOI' });\n\nconst search = await User.list({ search: 'jeff' });", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.logOut()", + "title": "User.logOut()", + "description": "

Invalidate the current user.

", + "name": "User.logOut", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.login(username,password)", + "title": "User.login()", + "description": "

Alias of User.auth()

", + "name": "User.login", + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.register(params)", + "title": "User.register()", + "description": "

Asyncronously create a new user.

", + "name": "User.register", + "parameter": { + "fields": { + "params": [ + { + "group": "params", + "type": "String", + "optional": false, + "field": "username", + "description": "

Unique username used when authenticating.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "password", + "description": "

Password used when authenticating.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "confirm", + "description": "

Password confirmation.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "email", + "description": "

Email address used when resetting password and for system messaging.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Promise", + "optional": false, + "field": "user", + "description": "

The new user object.

" + } + ] + } + }, + "group": "Reactium.User", + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.reset()", + "title": "User.reset()", + "group": "Reactium.User", + "name": "User.reset", + "description": "

Reset the user password.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "token", + "description": "

The token received from the User.forgot() email message.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "password", + "description": "

The new password.

" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.retrieve(params,options)", + "title": "User.retrieve()", + "group": "Reactium.User", + "name": "User.retrieve", + "description": "

Retrieve a single Actinium.User object. Calls the user-retrieve cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Query parameters. See User.list() for more details.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": true, + "field": "objectId", + "description": "

Retrieve by the objectId field.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "username", + "description": "

Retrieve by the username field.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "email", + "description": "

Retrieve by the email address field.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-retrieve", + "description": "

Triggered before the user-retrieve cloud function is called.

Arguments: params:Object 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-retrieve", + "description": "

Triggered after the user-retrieve cloud function is called.

Arguments: user:Object, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.save(params)", + "title": "User.save()", + "group": "Reactium.User", + "name": "User.save", + "description": "

Save a Actinium.User object.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Key value pairs to apply to the Actinium.User object. Calls the user-save cloud function.

Note: Any additional key value pairs will be added to the user object as a new column.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": false, + "field": "username", + "description": "

The unique username used when signing in.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "email", + "description": "

The email address to associate with the user account.

" + }, + { + "group": "params", + "type": "String", + "optional": false, + "field": "password", + "description": "

The password used when signing in.

" + }, + { + "group": "params", + "type": "String", + "optional": true, + "field": "role", + "description": "

The Actinium.Role name to add the user to.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-save", + "description": "

Mutate the Actinium.User object before save is complete.

Arguments:  req:Object:Actinium.User 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-save-response", + "description": "

Take action after the Actinium.User object has been saved.

Arguments: req:Object:Actinium.User 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-save-error", + "description": "

Take action after the Actinium.User returns an error.

Arguments: error:Object, params:Object 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Function", + "url": "User.serialize(user)", + "title": "User.serialize()", + "group": "Reactium.User", + "name": "User.serialize", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "Convert", + "description": "

a Actinium.User object into a JSON object. If the object is already serialized it is returned.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": "const u = User.serialize(user);", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Asyncronous", + "url": "User.trash(params)", + "title": "User.trash()", + "group": "Reactium.User", + "name": "User.trash", + "description": "

Send a single Actinium.User object to the recycle bin. Calls user-trash cloud function.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Object", + "optional": false, + "field": "params", + "description": "

Object containing parameters for deleting a user.

" + } + ], + "params": [ + { + "group": "params", + "type": "String", + "optional": false, + "field": "objectId", + "description": "

The Actinium.User objectId.

" + } + ], + "hooks": [ + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "before-user-trash", + "description": "

Triggered before the user-trash cloud function is run.

Arguments: user:Actinium.User 
" + }, + { + "group": "hooks", + "type": "Hook", + "optional": false, + "field": "user-trash", + "description": "

Triggered after the user-trash cloud function is run.

Arguments: user:Actinium.User 
" + } + ] + } + }, + "version": "0.0.0", + "filename": "reactium_modules/@atomic-reactor/reactium-user/sdk/index.js", + "groupTitle": "Reactium.User" + }, + { + "type": "Class", + "url": "Fullscreen", + "title": "Fullscreen", + "group": "Reactium.Utilities", + "name": "Fullscreen", + "description": "

Cross browser utility for toggling fullscreen mode.

", + "parameter": { + "fields": { + "Event": [ + { + "group": "Event", + "type": "Event", + "optional": false, + "field": "fullscreenchange", + "description": "

Triggered when the browser's fullscreen state changes.

" + } + ] + } + }, + "examples": [ + { + "title": "Usage:", + "content": " // isExpanded()\n Reactium.Utils.Fullscreen.isExpanded();\n\n // isCollapsed()\n Reactium.Utils.Fullscreen.isCollapsed();\n\n // collapse()\n Reactium.Utils.Fullscreen.collapse();\n\n // expand()\n Reactium.Utils.Fullscreen.expand();\n\n // toggle()\n Reactium.Utils.Fullscreen.toggle();\n\n // Event: fullscreenchange\nimport React, { useEffect, useState } from 'react';\nimport Reactium from 'reactium-core/sdk';\n\nconst MyComponent = () => {\n const [state, setState] = useState(Reactium.Utils.Fullscreen.isExpanded());\n\n const update = () => {\n setState(Reactium.Utils.Fullscreen.isExpanded());\n }\n\n useEffect(() => {\n // ssr safety\n if (typeof document === 'undefined') return;\n\n // listen for fullscreenchange\n document.addEventListener('fullscreenchange', update);\n\n // prevent memory leak\n return () => {\n document.removeEventListener('fullscreenchange', update);\n };\n });\n\n return (
{state}
);\n};", + "type": "json" + } + ], + "version": "0.0.0", + "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/fullscreen.js", + "groupTitle": "Reactium.Utilities" + }, + { + "type": "Function", + "url": "Reactium.Utils.abbreviatedNumber(number)", + "title": "Utils.abbreviatedNumber()", + "version": "3.1.14", + "group": "Reactium.Utils", + "name": "Utils.abbreviatedNumber", + "description": "

Abbreviate a long number to a string.

", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Number", + "optional": false, + "field": "number", + "description": "

The number to abbreviate.

" + } + ] + } + }, + "examples": [ + { + "title": "Example Usage:", + "content": "Reactium.Utils.abbreviatedNumber(5000);\n// Returns: 5k\n\nReactium.Utils.abbreviatedNumber(500000);\n// Returns .5m", + "type": "json" + } + ], + "filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/sdks/utils/index.js", "groupTitle": "Reactium.Utils" }, { @@ -3584,61 +5099,29 @@ "groupTitle": "Reactium.Utils" }, { - "type": "Function", - "url": "Utils.splitParts(parts)", - "title": "Utils.splitParts()", - "description": "

Breaks formatted string (or array of strings), into flat array of parts/nodes, inserting an object in array in the place of %key%. Useful for tokenizing a translation string, and getting an array that can easily be mapped into React components. Returns an object with replace and value methods. Call replace(key,value) method (chaining) as many times as necessary to replace all tokens. Call value() method to get the final array of Part objects. Call reset() to reset the SlipParts object to the original string without replacements for reuse.

", + "type": "function", + "url": "Utils.splitParts", + "title": "splitParts", + "name": "Utils.splitParts", + "group": "Reactium.Utils", + "description": "

splitParts is a utility function that allows you to easily interpolate React components into a string. It works by tokenizing the string, allowing you to identify specific parts that you want to replace with a React component. You can then use the replace method to specify the values for these tokens, and the value method to get an array of the parts, which you can map over and return the appropriate React components for each part. This can be useful for situations where you want to dynamically render a string that includes both plain text and React components.

", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", - "type": "Mixed", - "optional": false, - "field": "parts", - "description": "

String containing tokens like %key% to be replaced.

" - } - ], - "replace": [ - { - "group": "replace", - "type": "String", - "optional": false, - "field": "key", - "description": "

when calling replace(key,value), the token %${key}% will be replaced with an Part object key->value pair.

" - }, - { - "group": "replace", - "type": "Mixed", - "optional": false, - "field": "value", - "description": "

the value to use in the key->pair replacement

" - } - ], - "Part": [ - { - "group": "Part", "type": "String", "optional": false, - "field": "key", - "description": "

the key in the keypair

" - }, - { - "group": "Part", - "type": "Mixed", - "optional": false, - "field": "value", - "description": "

the value in the keypair

" + "field": "strVal", + "description": "

The input string to tokenize

" } ] } }, - "name": "Utils.splitParts", - "group": "Reactium.Utils", "examples": [ { - "title": "Usage", - "content": "import React from 'react';\nimport Reactium, { __ } from 'reactium-core/sdk';\nimport moment from 'moment';\nimport md5 from 'md5';\n\nconst Gravatar = props => {\n const { email } = props;\n return (\n \n );\n};\n\nexport default props => {\n const description = __('%username% updated post %slug% at %time%');\n const parts = Reactium.Utils.splitParts(description)[\n ('email', 'slug', 'time')\n ].forEach(key => parts.replace(key, props[key]));\n\n return (\n \n {parts.value().map(part => {\n // arbitrary React component possible\n const { key, value } = part;\n\n switch (key) {\n case 'email': {\n return ;\n }\n case 'time': {\n return (\n \n {moment(value).fromNow()}\n \n );\n }\n default: {\n // plain string part\n return {value};\n }\n }\n })}\n \n );\n};", + "title": "import React from 'react';", + "content": "\nimport React from 'react';\nimport Reactium, { __ } from 'reactium-core/sdk';\nimport moment from 'moment';\nimport md5 from 'md5';\n\nconst Gravatar = props => {\n const { email } = props;\n return (\n \n );\n};\n\nexport default props => {\n const description = __('%email% updated post %slug% at %time%');\n const parts = Reactium.Utils.splitParts(description);\n Object.entries(props).forEach(([key, value]) => {\n parts.replace(key, value);\n });\n\n return (\n \n {parts.value().map(part => {\n // arbitrary React component possible\n const { key, value } = part;\n\n switch (key) {\n case 'email': {\n return ;\n }\n case 'time': {\n return (\n \n {moment(value).fromNow()}\n \n );\n }\n default: {\n // plain string part\n return {value};\n }\n }\n })}\n \n );\n};", "type": "json" } ], diff --git a/docs/api_project.js b/docs/api_project.js index f831e93a..33ab6ac5 100644 --- a/docs/api_project.js +++ b/docs/api_project.js @@ -8,7 +8,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-17T16:33:40.461Z", + "time": "2023-01-04T20:26:25.984Z", "url": "https://apidocjs.com", "version": "0.25.0" } diff --git a/docs/api_project.json b/docs/api_project.json index c1d4d12f..1d7b72fd 100644 --- a/docs/api_project.json +++ b/docs/api_project.json @@ -8,7 +8,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-17T16:33:40.461Z", + "time": "2023-01-04T20:26:25.984Z", "url": "https://apidocjs.com", "version": "0.25.0" } diff --git a/package-lock.json b/package-lock.json index 8a224fda..8f9cfb2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -510,9 +510,9 @@ "version": "file:reactium_modules/@atomic-reactor/reactium-role/_npm" }, "@atomic-reactor/reactium-sdk-core": { - "version": "1.2.16", - "resolved": "https://registry.npmjs.org/@atomic-reactor/reactium-sdk-core/-/reactium-sdk-core-1.2.16.tgz", - "integrity": "sha512-/bsZovvNpJGF2slr2shbhahSdWl0Vtx6uqIqc7NwqfR9tmBz/j0jZjzx3Ig+kp3AqZIZ/gaGlmKwqIUI8IHA0g==", + "version": "1.2.18", + "resolved": "https://registry.npmjs.org/@atomic-reactor/reactium-sdk-core/-/reactium-sdk-core-1.2.18.tgz", + "integrity": "sha512-hmtBrsDPGI6JCiqeH3F2EQg10kX12IjnKx5XHrEmguKcrkUo/O5XM1KdLDVQxXa4ZOzgXGJqUZwOfQOKpwsZig==", "requires": { "action-sequence": "^1.1.2", "classnames": "^2.3.1", diff --git a/package.json b/package.json index a43ec4aa..cc3e6f99 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@atomic-reactor/reactium-capability": "file:reactium_modules/@atomic-reactor/reactium-capability/_npm", "@atomic-reactor/reactium-demo": "file:reactium_modules/@atomic-reactor/reactium-demo/_npm", "@atomic-reactor/reactium-role": "file:reactium_modules/@atomic-reactor/reactium-role/_npm", - "@atomic-reactor/reactium-sdk-core": "^1.2.16", + "@atomic-reactor/reactium-sdk-core": "^1.2.18", "@atomic-reactor/reactium-service-worker": "file:reactium_modules/@atomic-reactor/reactium-service-worker/_npm", "@atomic-reactor/reactium-setting": "file:reactium_modules/@atomic-reactor/reactium-setting/_npm", "@atomic-reactor/reactium-svg": "file:reactium_modules/@atomic-reactor/reactium-svg/_npm",