Skip to content

Commit

Permalink
chore!: fix typings for mocker
Browse files Browse the repository at this point in the history
  • Loading branch information
Caele committed Jan 13, 2023
1 parent e5c3366 commit 8ec8d03
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 34 deletions.
3 changes: 2 additions & 1 deletion apis/conversion/src/index.js
Expand Up @@ -82,7 +82,8 @@ export const convertTo = async ({ halo, model, cellRef, newType }) => {
*/

/**
* @interface
* @entry
* @namespace
* @alias Conversion
* @since 1.1.0
* @description Provides conversion functionality to extensions.
Expand Down
7 changes: 4 additions & 3 deletions apis/enigma-mocker/src/index.js
Expand Up @@ -10,10 +10,11 @@ import fGO from './from-generic-objects';

/**
* @entry
* @namespace
* @alias EnigmaMocker
* @description Mocks Engima app functionality for demo and testing purposes.
*/
const api = /** @lends EnigmaMocker# */ {
const mocker = /** @lends EnigmaMocker# */ {
/**
* Mocks Engima app functionality. It accepts one / many generic objects as input argument and returns the mocked Enigma app. Each generic object represents one visulization and specifies how it behaves. For example, what layout to use the data to present.
*
Expand All @@ -24,7 +25,7 @@ const api = /** @lends EnigmaMocker# */ {
* @experimental
* @since 3.0.0
* @param {Array<object>} genericObjects Generic objects controling behaviour of visualizations.
* @param {EnigmaMockerOptions} options Options
* @param {EnigmaMockerOptions=} options Options
* @returns {Promise<EngineAPI.IApp>}
* @example
* const genericObject = {
Expand All @@ -48,4 +49,4 @@ const api = /** @lends EnigmaMocker# */ {
},
};

export default api;
export default mocker;
41 changes: 21 additions & 20 deletions apis/stardust/api-spec/spec.json
Expand Up @@ -512,9 +512,28 @@
"import { useKeyboard } from '@nebula.js/stardust';\n// ...\nconst keyboard = useKeyboard();\nuseEffect(() => {\n // Set a tab stop on our button if in focus or if Nebulas navigation is disabled\n button.setAttribute('tabIndex', keyboard.active || !keyboard.enabled ? 0 : -1);\n // If navigation is enabled and focus has shifted, lets focus the button\n keyboard.enabled && keyboard.active && button.focus();\n}, [keyboard])"
]
},
"Conversion": {
"description": "Provides conversion functionality to extensions.",
"availability": {
"since": "1.1.0"
},
"kind": "namespace",
"entries": {
"hypercube": {
"description": "Provides conversion functionality to extensions with hyperCubes.",
"availability": {
"since": "1.1.0"
},
"type": "#/definitions/hyperCubeConversion"
}
},
"examples": [
"import { conversion } from '@nebula.js/stardust';\n\nexport default function() {\n return {\n qae: {\n ...\n importProperties: ( exportFormat, initialProperties ) => conversion.hyperCube.importProperties(exportFormat, initialProperties),\n exportProperties: ( fullPropertyTree ) => conversion.hyperCube.exportProperties(fullPropertyTree)\n },\n ...\n };\n}"
]
},
"EnigmaMocker": {
"description": "Mocks Engima app functionality for demo and testing purposes.",
"kind": "object",
"kind": "namespace",
"entries": {
"fromGenericObjects": {
"description": "Mocks Engima app functionality. It accepts one / many generic objects as input argument and returns the mocked Enigma app. Each generic object represents one visulization and specifies how it behaves. For example, what layout to use the data to present.\n\nThe generic object is represented with a Javascript object with a number of properties. The name of the property correlates to the name in the Enigma model for `app.getObject(id)`. For example, the property `getLayout` in the generic object is used to define `app.getObject(id).getLayout()`. Any property can be added to the fixture (just make sure it exists and behaves as in the Enigma model!).\n\nThe value for each property is either fixed (string / boolean / number / object) or a function. Arguments are forwarded to the function to allow for greater flexibility. For example, this can be used to return different hypercube data when scrolling in the chart.",
Expand All @@ -535,6 +554,7 @@
{
"name": "options",
"description": "Options",
"optional": true,
"type": "#/definitions/EnigmaMockerOptions"
}
],
Expand Down Expand Up @@ -2441,25 +2461,6 @@
}
}
},
"Conversion": {
"description": "Provides conversion functionality to extensions.",
"availability": {
"since": "1.1.0"
},
"kind": "interface",
"entries": {
"hypercube": {
"description": "Provides conversion functionality to extensions with hyperCubes.",
"availability": {
"since": "1.1.0"
},
"type": "#/definitions/hyperCubeConversion"
}
},
"examples": [
"import { conversion } from '@nebula.js/stardust';\n\nexport default function() {\n return {\n qae: {\n ...\n importProperties: ( exportFormat, initialProperties ) => conversion.hyperCube.importProperties(exportFormat, initialProperties),\n exportProperties: ( fullPropertyTree ) => conversion.hyperCube.exportProperties(fullPropertyTree)\n },\n ...\n };\n}"
]
},
"hyperCubeConversion": {
"availability": {
"since": "1.1.0"
Expand Down
28 changes: 18 additions & 10 deletions apis/stardust/types/index.d.ts
Expand Up @@ -169,7 +169,21 @@ export function useRenderState(): stardust.RenderState;
*/
export function useKeyboard(): stardust.Keyboard;

declare type EnigmaMocker = {
/**
* Provides conversion functionality to extensions.
*/
export namespace Conversion {
/**
* Provides conversion functionality to extensions with hyperCubes.
*/
const hypercube: stardust.hyperCubeConversion;

}

/**
* Mocks Engima app functionality for demo and testing purposes.
*/
export namespace EnigmaMocker {
/**
* Mocks Engima app functionality. It accepts one / many generic objects as input argument and returns the mocked Enigma app. Each generic object represents one visulization and specifies how it behaves. For example, what layout to use the data to present.
*
Expand All @@ -179,8 +193,9 @@ declare type EnigmaMocker = {
* @param genericObjects Generic objects controling behaviour of visualizations.
* @param options Options
*/
fromGenericObjects(genericObjects: object[], options: stardust.EnigmaMockerOptions): Promise<EngineAPI.IApp>;
};
function fromGenericObjects(genericObjects: object[], options?: stardust.EnigmaMockerOptions): Promise<EngineAPI.IApp>;

}

declare namespace stardust {
interface Context {
Expand Down Expand Up @@ -725,13 +740,6 @@ declare namespace stardust {
exportProperties: stardust.exportProperties;
}

/**
* Provides conversion functionality to extensions.
*/
interface Conversion {
hypercube: stardust.hyperCubeConversion;
}

interface hyperCubeConversion {
}

Expand Down

0 comments on commit 8ec8d03

Please sign in to comment.