Skip to content

Commit

Permalink
fix: generate docs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Oct 18, 2023
1 parent 05d82b4 commit 1e9147d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
62 changes: 33 additions & 29 deletions docs/guide/mqtt.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async getSchedules(
nodeId: number,
opts: { mode?: ZUIScheduleEntryLockMode; fromCache: boolean } = {
fromCache: true,
}
},
): Promise<ZUISchedule>;
```

Expand Down Expand Up @@ -165,7 +165,7 @@ async setSchedule(
| ScheduleEntryLockDailyRepeatingSchedule
| ScheduleEntryLockWeekDaySchedule
| ScheduleEntryLockYearDaySchedule
)
),
): Promise<SupervisionResult>;
```

Expand All @@ -191,7 +191,7 @@ Payload:
#### `setEnabledSchedule`

```ts
async setEnabledSchedule(nodeId: number, enabled: boolean, userId: number): Promise<{ status: SupervisionStatus.NoSupport | SupervisionStatus.Fail | SupervisionStatus.Success; remainingDuration?: undefined; } | ({ status: SupervisionStatus.Working; remainingDuration: Duration; } & { status: SupervisionStatus.Working | SupervisionStatus.Success; })>;
async setEnabledSchedule(nodeId: number, enabled: boolean, userId: number): Promise<SupervisionResult>;
```

<details>
Expand All @@ -218,7 +218,7 @@ Payload:
```ts
async getAssociations(
nodeId: number,
refresh = false
refresh = false,
): Promise<ZUIGroupAssociation[]>;
```

Expand Down Expand Up @@ -248,7 +248,7 @@ Payload:
async addAssociations(
source: AssociationAddress,
groupId: number,
associations: AssociationAddress[]
associations: AssociationAddress[],
): Promise<boolean>;
```

Expand Down Expand Up @@ -279,7 +279,7 @@ Payload:
async removeAssociations(
source: AssociationAddress,
groupId: number,
associations: AssociationAddress[]
associations: AssociationAddress[],
): Promise<void>;
```

Expand Down Expand Up @@ -439,7 +439,7 @@ Payload:
async getNodeNeighbors(
nodeId: number,
preventThrow = false,
emitNodeUpdate = true
emitNodeUpdate = true,
): Promise<readonly number[]>;
```

Expand Down Expand Up @@ -572,7 +572,7 @@ Payload:
```ts
setNodeDefaultSetValueOptions(
nodeId: number,
props: Pick<ZUINode, 'defaultTransitionDuration' | 'defaultVolume'>
props: Pick<ZUINode, 'defaultTransitionDuration' | 'defaultVolume'>,
): void;
```

Expand Down Expand Up @@ -724,7 +724,7 @@ async _addSceneValue(
sceneid: number,
valueId: ZUIValueIdScene,
value: any,
timeout: number
timeout: number,
): Promise<any>;
```

Expand Down Expand Up @@ -1023,7 +1023,10 @@ Payload:
async replaceFailedNode(
nodeId: number,
strategy: InclusionStrategy = InclusionStrategy.Security_S2,
options?: { qrString?: string; provisioning?: PlannedProvisioningEntry }
options?: {
qrString?: string
provisioning?: PlannedProvisioningEntry
},
): Promise<boolean>;
```

Expand Down Expand Up @@ -1053,7 +1056,7 @@ Payload:
```ts
async getAvailableFirmwareUpdates(
nodeId: number,
options?: GetFirmwareUpdatesOptions
options?: GetFirmwareUpdatesOptions,
): Promise<{ version: string; changelog: string; channel: "stable" | "beta"; files: FirmwareUpdateFileInfo[]; downgrade: boolean; normalizedVersion: string; device: { manufacturerId: number; productType: number; productId: number; firmwareVersion: string; rfRegion?: RFRegion; }; }[]>;
```

Expand Down Expand Up @@ -1104,7 +1107,7 @@ Payload:
```ts
async setPowerlevel(
powerlevel: number,
measured0dBm: number
measured0dBm: number,
): Promise<boolean>;
```

Expand Down Expand Up @@ -1161,7 +1164,7 @@ async startInclusion(
name?: string
dsk?: string
location?: string
}
},
): Promise<boolean>;
```

Expand Down Expand Up @@ -1191,7 +1194,7 @@ Payload:
async startExclusion(
options: ExclusionOptions = {
strategy: ExclusionStrategy.DisableProvisioningEntry,
}
},
): Promise<boolean>;
```

Expand Down Expand Up @@ -1318,7 +1321,7 @@ async assignPriorityReturnRoute(
nodeId: number,
destinationNodeId: number,
repeaters: number[],
routeSpeed: ZWaveDataRate
routeSpeed: ZWaveDataRate,
): Promise<boolean>;
```

Expand Down Expand Up @@ -1375,7 +1378,7 @@ Payload:
async assignPrioritySUCReturnRoute(
nodeId: number,
repeaters: number[],
routeSpeed: ZWaveDataRate
routeSpeed: ZWaveDataRate,
): Promise<boolean>;
```

Expand Down Expand Up @@ -1433,7 +1436,7 @@ async assignCustomReturnRoutes(
nodeId: number,
destinationNodeId: number,
routes: Route[],
priorityRoute?: Route
priorityRoute?: Route,
): Promise<boolean>;
```

Expand Down Expand Up @@ -1490,7 +1493,7 @@ Payload:
async assignCustomSUCReturnRoutes(
nodeId: number,
routes: Route[],
priorityRoute?: Route
priorityRoute?: Route,
): Promise<boolean>;
```

Expand Down Expand Up @@ -1622,7 +1625,7 @@ Payload:
async setPriorityRoute(
nodeId: number,
repeaters: number[],
routeSpeed: ZWaveDataRate
routeSpeed: ZWaveDataRate,
): Promise<boolean>;
```

Expand Down Expand Up @@ -1677,7 +1680,7 @@ Payload:
```ts
async checkLifelineHealth(
nodeId: number,
rounds = 5
rounds = 5,
): Promise<LifelineHealthCheckSummary & { targetNodeId: number }>;
```

Expand Down Expand Up @@ -1707,7 +1710,7 @@ Payload:
async checkRouteHealth(
nodeId: number,
targetNodeId: number,
rounds = 5
rounds = 5,
): Promise<RouteHealthCheckSummary & { targetNodeId: number }>;
```

Expand Down Expand Up @@ -1837,7 +1840,7 @@ Payload:

```ts
async firmwareUpdateOTW(
file: FwFile
file: FwFile,
): Promise<ControllerFirmwareUpdateResult>;
```

Expand Down Expand Up @@ -1865,7 +1868,7 @@ Payload:
```ts
updateFirmware(
nodeId: number,
files: FwFile[]
files: FwFile[],
): Promise<FirmwareUpdateResult>;
```

Expand Down Expand Up @@ -2006,7 +2009,7 @@ async sendCommand(
commandClass: CommandClasses | keyof typeof CommandClasses
},
command: string,
args: any[]
args: any[],
): Promise<any>;
```

Expand Down Expand Up @@ -2090,8 +2093,8 @@ Payload:
async writeValue(
valueId: ZUIValueId,
value: any,
options?: SetValueAPIOptions
): Promise<{ status: SetValueStatus.NoDeviceSupport | SetValueStatus.Fail | SetValueStatus.Success; remainingDuration?: undefined; message?: undefined; } | { status: SetValueStatus.Working; remainingDuration: Duration; message?: undefined; } | { status: SetValueStatus.SuccessUnsupervised; remainingDuration?: undefined; message?: undefined; } | ({ status: SetValueStatus.EndpointNotFound | SetValueStatus.NotImplemented | SetValueStatus.InvalidValue; remainingDuration?: undefined; message: string; } & { status: SetValueStatus.NoDeviceSupport | SetValueStatus.Fail | SetValueStatus.EndpointNotFound | SetValueStatus.NotImplemented | SetValueStatus.InvalidValue; })>;
options?: SetValueAPIOptions,
): Promise<SetValueResult>;
```

Set a value of a specific zwave valueId.
Expand Down Expand Up @@ -2206,7 +2209,7 @@ Payload:
#### `restoreNVM`

```ts
async restoreNVM(data: Buffer): Promise<void>;
async restoreNVM(data: Buffer, useRaw = false): Promise<void>;
```

<details>
Expand All @@ -2219,7 +2222,8 @@ Payload:
```json
{
"args": [
data
data,
useRaw
]
}
```
Expand Down Expand Up @@ -2348,7 +2352,7 @@ Payload:
```ts
async updateControllerNodeProps(
node?: ZUINode,
props: Array<'powerlevel' | 'RFRegion'> = ['powerlevel', 'RFRegion']
props: Array<'powerlevel' | 'RFRegion'> = ['powerlevel', 'RFRegion'],
): Promise<void>;
```

Expand Down
8 changes: 4 additions & 4 deletions genereteDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import * as prettier from 'prettier'
import { join } from 'path'

// Make the linter happy
export function formatWithPrettier(
export async function formatWithPrettier(
filename: string,
sourceText: string,
): string {
): Promise<string> {
const prettierOptions = {
...require(join(__dirname, '.prettierrc.js')),
// To infer the correct parser
filepath: filename,
}
return prettier.format(sourceText, prettierOptions)
return await prettier.format(sourceText, prettierOptions)
}

// Inpired by https://github.com/zwave-js/node-zwave-js/blob/master/packages/maintenance/src/generateTypedDocs.ts#L334
Expand All @@ -27,7 +27,7 @@ async function main() {

const sourceFile = program.getSourceFileOrThrow(fileName)

const text = formatWithPrettier(docsFile, mqttApis(sourceFile))
const text = await formatWithPrettier(docsFile, mqttApis(sourceFile))

const content = await readFile(docsFile, 'utf8')

Expand Down

0 comments on commit 1e9147d

Please sign in to comment.