Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: api docs for foudnation utils PTL-1548 #1990

Merged
merged 5 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
className: 'hidden'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [activeColorScheme](./foundation-utils.activecolorscheme.md)

## activeColorScheme variable

A design token that represents the active color scheme (light or dark).

**Signature:**

```typescript
activeColorScheme: import("@microsoft/fast-foundation").CSSDesignToken<string>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [API\_HOST](./foundation-utils.api_host.md)

## API\_HOST variable

The Genesis Server URL (WebSocket or HTTP).

**Signature:**

```typescript
_API_HOST: string
```

## Remarks

Optional.

## Example

ws://localhost/gwf/, ws://localhost:9064

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [assureDesignSystem](./foundation-utils.assuredesignsystem.md)

## assureDesignSystem() function

assureDesignSystem.

**Signature:**

```typescript
export declare function assureDesignSystem(module: DesignSystemModule): DesignSystemModule;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| module | [DesignSystemModule](./foundation-utils.designsystemmodule.md) | |

**Returns:**

[DesignSystemModule](./foundation-utils.designsystemmodule.md)

## Remarks

Webpack caching strategies can backfill missing modules with placeholders in an attempt to prevent errors. In the case of offline remotes, we rely on the error to fall back to local versions. This utility assures we have a design system.

## Example 1


```ts
async function zeroDesignSystemImport(): Promise<DesignSystemModule> {
let module: DesignSystemModule;
let type: ResourceType = ResourceType.remote;
try {
module = await import('foundationZero/ZeroDesignSystem');
return assureDesignSystem(module);
} catch (e) {
logger.info(
`Please note remoteEntry.js load errors are expected if module federated dependencies are offline. Falling back to locally bundled versions.`,
);
type = ResourceType.local;
module = await import('@genesislcap/foundation-zero');
return assureDesignSystem(module);
} finally {
logger.debug(`Using '${type}' version of foundation-zero`);
}
}
```

## Example 2

You should also instruct webpack to use strict module handling.

```ts
output: {
strictModuleErrorHandling: true,
strictModuleExceptionHandling: true,
}
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [ConstructableLifecycleHandler](./foundation-utils.constructablelifecyclehandler.md)

## ConstructableLifecycleHandler type


**Signature:**

```typescript
export type ConstructableLifecycleHandler = Constructable<FASTElement & HTMLElement>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [ConstructablePendingState](./foundation-utils.constructablependingstate.md)

## ConstructablePendingState type

A mixin that provides functionality for raising `pending-state` events.

**Signature:**

```typescript
export declare type ConstructablePendingState = Constructable<FASTElement & HTMLElement>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [ConversionType](./foundation-utils.conversiontype.md)

## ConversionType type

Represents the possible types of value conversion for data synchronization.

**Signature:**

```typescript
export type ConversionType = 'string' | 'number' | 'time' | 'boolean';
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [createErrorMap](./foundation-utils.createerrormap.md)

## createErrorMap variable

A factory to create the error map.

**Signature:**

```typescript
createErrorMap: <TErrorDetailMap extends ErrorDetailMap>(logger: ErrorMapLogger) => ErrorMap<TErrorDetailMap>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [createLogger](./foundation-utils.createlogger.md)

## createLogger() function

> Warning: This API is now obsolete.
>
> - Use `createLogger` from `@genesislcap/foundation-logger` instead.
>

Creates a logger with the given name and options.

**Signature:**

```typescript
export declare function createLogger(name: string, options?: LoggerOptions): Logger;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| name | string | The name to give the logger. |
| options | [LoggerOptions](./foundation-utils.loggeroptions.md) | _(Optional)_ The options to use when creating the logger. |

**Returns:**

[Logger](./foundation-utils.logger.md)

The resulting logger.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [createObserver](./foundation-utils.createobserver.md)

## createObserver variable

Creates a new event observer instance.

**Signature:**

```typescript
createObserver: <EventType>() => Observer<EventType>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [customNumberParser](./foundation-utils.customnumberparser.md)

## customNumberParser() function

A Default Number Parser for deserializing objects.

**Signature:**

```typescript
export declare function customNumberParser(value: any): number | bigint;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | any | |

**Returns:**

number \| bigint

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [Database](./foundation-utils.database.md) &gt; [create](./foundation-utils.database.create.md)

## Database.create() method

**Signature:**

```typescript
create(newValue: Omit<T, 'id'>): Promise<DatabaseAccessResult.Create<T>>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| newValue | Omit&lt;T, 'id'&gt; | |

**Returns:**

Promise&lt;[DatabaseAccessResult.Create](./foundation-utils.databaseaccessresult.create.md)&lt;T&gt;&gt;

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [Database](./foundation-utils.database.md) &gt; [delete](./foundation-utils.database.delete.md)

## Database.delete() method

**Signature:**

```typescript
delete(id: string): Promise<DatabaseAccessResult.Delete>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| id | string | |

**Returns:**

Promise&lt;[DatabaseAccessResult.Delete](./foundation-utils.databaseaccessresult.delete.md)&gt;

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [Database](./foundation-utils.database.md) &gt; [isWorking](./foundation-utils.database.isworking.md)

## Database.isWorking property

**Signature:**

```typescript
isWorking: boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [Database](./foundation-utils.database.md)

## Database interface

Represents a database with basic CRUD operations.

**Signature:**

```typescript
export interface Database<T extends DatabaseRecord>
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [isWorking](./foundation-utils.database.isworking.md) | | boolean | |

## Methods

| Method | Description |
| --- | --- |
| [create(newValue)](./foundation-utils.database.create.md) | |
| [delete(id)](./foundation-utils.database.delete.md) | |
| [onAfterUpdate(listener)](./foundation-utils.database.onafterupdate.md) | |
| [onBeforeUpdate(listener)](./foundation-utils.database.onbeforeupdate.md) | |
| [read(id)](./foundation-utils.database.read.md) | |
| [update(id, newValue)](./foundation-utils.database.update.md) | |
| [visit(visitor)](./foundation-utils.database.visit.md) | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
format: md
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [Database](./foundation-utils.database.md) &gt; [onAfterUpdate](./foundation-utils.database.onafterupdate.md)

## Database.onAfterUpdate() method

**Signature:**

```typescript
onAfterUpdate(listener: Listener<DatabaseEvent.AfterUpdate<T>>): () => void;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| listener | [Listener](./foundation-utils.listener.md)&lt;[DatabaseEvent.AfterUpdate](./foundation-utils.databaseevent.afterupdate.md)&lt;T&gt;&gt; | |

**Returns:**

() =&gt; void

Loading