From c47b62d6177146d544b5c6cf5a1a3c9f1f3cfa74 Mon Sep 17 00:00:00 2001 From: EthanShoeDev <13422990+EthanShoeDev@users.noreply.github.com> Date: Fri, 19 Dec 2025 04:25:04 -0500 Subject: [PATCH] signs of life --- docs/windows-ssh.md | 21 ++ package.json | 2 +- scripts/gen-dsc-resources-types.ts | 47 ++- scripts/lib/json-schema-to-effect.ts | 38 ++- src/bin.ts | 95 ++++-- .../_resource-types.gen.ts | 106 +++++++ .../_resource-union.gen.ts | 300 ++++++++++++++++++ src/dsc-resource-schema-types/index.ts | 37 +++ .../microsoft-dsc-debug-echo.gen.ts | 18 ++ ...ft-dsc-transitional-runcommandonset.gen.ts | 11 + .../microsoft-osinfo.gen.ts | 17 + ...oft-powertoys-advancedpastesettings.gen.ts | 10 + ...osoft-powertoys-alwaysontopsettings.gen.ts | 10 + .../microsoft-powertoys-appsettings.gen.ts | 10 + .../microsoft-powertoys-awakesettings.gen.ts | 10 + ...osoft-powertoys-colorpickersettings.gen.ts | 10 + ...osoft-powertoys-cropandlocksettings.gen.ts | 10 + ...ertoys-environmentvariablessettings.gen.ts | 10 + ...rosoft-powertoys-fancyzonessettings.gen.ts | 10 + ...oft-powertoys-filelocksmithsettings.gen.ts | 10 + ...osoft-powertoys-findmymousesettings.gen.ts | 10 + .../microsoft-powertoys-hostssettings.gen.ts | 10 + ...soft-powertoys-imageresizersettings.gen.ts | 10 + ...t-powertoys-keyboardmanagersettings.gen.ts | 10 + ...osoft-powertoys-measuretoolsettings.gen.ts | 10 + ...-powertoys-mousehighlightersettings.gen.ts | 10 + ...crosoft-powertoys-mousejumpsettings.gen.ts | 10 + ...toys-mousepointercrosshairssettings.gen.ts | 10 + .../microsoft-powertoys-peeksettings.gen.ts | 10 + ...osoft-powertoys-poweraccentsettings.gen.ts | 10 + ...icrosoft-powertoys-powerocrsettings.gen.ts | 10 + ...osoft-powertoys-powerrenamesettings.gen.ts | 10 + ...t-powertoys-registrypreviewsettings.gen.ts | 10 + ...oft-powertoys-shortcutguidesettings.gen.ts | 10 + ...rosoft-powertoys-workspacessettings.gen.ts | 10 + .../microsoft-powertoys-zoomitsettings.gen.ts | 10 + .../microsoft-windows-rebootpending.gen.ts | 11 + .../microsoft-windows-registry.gen.ts | 41 +++ .../microsoft-winget-adminsettings.gen.ts | 10 + .../microsoft-winget-package.gen.ts | 24 ++ .../microsoft-winget-source.gen.ts | 14 + .../microsoft-winget-usersettingsfile.gen.ts | 11 + .../configuration-get-result.gen.ts | 87 +++-- .../configuration-set-result.gen.ts | 91 +++--- .../configuration-test-result.gen.ts | 93 +++--- src/dsc-schema-types/configuration.gen.ts | 113 ++++--- src/dsc-schema-types/dsc-resource.gen.ts | 49 +-- src/dsc-schema-types/get-result.gen.ts | 59 ++-- src/dsc-schema-types/include.gen.ts | 13 +- src/dsc-schema-types/resolve-result.gen.ts | 6 +- src/dsc-schema-types/resource-manifest.gen.ts | 162 ++++++---- src/dsc-schema-types/set-result.gen.ts | 63 ++-- src/dsc-schema-types/test-result.gen.ts | 65 ++-- src/dsc-utils.ts | 123 +++++++ src/dsl.ts | 36 +++ src/utils.ts | 59 ++++ 56 files changed, 1649 insertions(+), 423 deletions(-) create mode 100644 docs/windows-ssh.md create mode 100644 src/dsc-resource-schema-types/_resource-types.gen.ts create mode 100644 src/dsc-resource-schema-types/_resource-union.gen.ts create mode 100644 src/dsc-resource-schema-types/index.ts create mode 100644 src/dsc-resource-schema-types/microsoft-dsc-debug-echo.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-dsc-transitional-runcommandonset.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-osinfo.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-advancedpastesettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-alwaysontopsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-appsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-awakesettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-colorpickersettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-cropandlocksettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-environmentvariablessettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-fancyzonessettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-filelocksmithsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-findmymousesettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-hostssettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-imageresizersettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-keyboardmanagersettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-measuretoolsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-mousehighlightersettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-mousejumpsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-mousepointercrosshairssettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-peeksettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-poweraccentsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-powerocrsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-powerrenamesettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-registrypreviewsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-shortcutguidesettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-workspacessettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-powertoys-zoomitsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-windows-rebootpending.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-windows-registry.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-winget-adminsettings.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-winget-package.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-winget-source.gen.ts create mode 100644 src/dsc-resource-schema-types/microsoft-winget-usersettingsfile.gen.ts create mode 100644 src/dsc-utils.ts create mode 100644 src/dsl.ts create mode 100644 src/utils.ts diff --git a/docs/windows-ssh.md b/docs/windows-ssh.md new file mode 100644 index 0000000..62989ac --- /dev/null +++ b/docs/windows-ssh.md @@ -0,0 +1,21 @@ +https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell&pivots=windows-server-2025 + + +if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) { + Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..." + New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 2222 +} else { + Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists." +} + + + +https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking + +New-NetFirewallHyperVRule -Name "WslSshServer" -DisplayName "WslSshServer" -Direction Inbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -LocalPorts 22 + + +Get-NetFirewallHyperVRule | + Where-Object { $_.Enabled -eq 'True' } | + Get-NetFirewallPortFilter | + Where-Object { $_.LocalPort -eq 22 } \ No newline at end of file diff --git a/package.json b/package.json index ea7f062..c39fbb2 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@biomejs/biome": "2.3.8", "@effect/language-service": "^0.57.1", "@types/bun": "latest", - "turbo": "^2.6.1", + "turbo": "^2.6.3", "typescript": "^5.9.3", "ultracite": "6.3.8" } diff --git a/scripts/gen-dsc-resources-types.ts b/scripts/gen-dsc-resources-types.ts index 2989fa0..b5eb5f9 100644 --- a/scripts/gen-dsc-resources-types.ts +++ b/scripts/gen-dsc-resources-types.ts @@ -164,7 +164,7 @@ const generateIndexFile = ( ]; for (const { filename, typeName } of resourceTypes) { - lines.push(`export * as ${typeName} from './${filename}';`); + lines.push(`export * as ${typeName} from './${filename}.gen';`); } lines.push(''); @@ -212,6 +212,45 @@ const generateDscConfigTypes = ( return lines.join('\n'); }; +/** + * Generate a resource union file that provides strong typing for the configuration DSL + */ +const generateResourceUnion = ( + resourceTypes: Array<{ type: string; filename: string; typeName: string }>, +) => { + const lines = [ + '// This file is auto-generated. Do not edit manually.', + "import * as S from 'effect/Schema';", + "import * as Resources from './index';", + '', + '/**', + ' * A discriminated union of all available DSC resources with their specific properties', + ' */', + 'export const ResourceUnion = S.Union(', + ]; + + for (const { type, typeName } of resourceTypes) { + lines.push(' S.Struct({'); + lines.push(` type: S.Literal("${type}"),`); + lines.push(' name: S.String,'); + lines.push(' dependsOn: S.optional(S.Array(S.String)),'); + lines.push(` properties: Resources.${typeName}.${typeName},`); + lines.push( + ' metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })),', + ); + lines.push(' }),'); + } + + lines.push(');'); + lines.push(''); + lines.push( + 'export type ResourceUnion = S.Schema.Type;', + ); + lines.push(''); + + return lines.join('\n'); +}; + const genDscResourcesTypes = Effect.gen(function* () { yield* Effect.log('Starting DSC resources types generation...'); @@ -320,6 +359,12 @@ const genDscResourcesTypes = Effect.gen(function* () { const typesListPath = path.join(outputDir, '_resource-types.gen.ts'); yield* fs.writeFileString(typesListPath, typesListContent); yield* Effect.log('Generated: _resource-types.gen.ts'); + + // Generate resource union file + const unionContent = generateResourceUnion(generatedTypes); + const unionPath = path.join(outputDir, '_resource-union.gen.ts'); + yield* fs.writeFileString(unionPath, unionContent); + yield* Effect.log('Generated: _resource-union.gen.ts'); } yield* Effect.log(''); diff --git a/scripts/lib/json-schema-to-effect.ts b/scripts/lib/json-schema-to-effect.ts index 11e44d2..8491d38 100644 --- a/scripts/lib/json-schema-to-effect.ts +++ b/scripts/lib/json-schema-to-effect.ts @@ -64,18 +64,28 @@ function getRefName(ref: string): string { return parts.at(-1) ?? ''; } +/** + * Check if a schema represents null + */ +function isJsonSchemaNull(s: JsonSchema): boolean { + return ( + typeof s === 'object' && + s !== null && + (s.type === 'null' || ('const' in s && s.const === null)) + ); +} + /** * Check if a schema is nullable (has null in type array, nullable: true, or null in oneOf/anyOf) */ function isNullable(schema: JsonSchema): boolean { + if (typeof schema !== 'object' || schema === null) return false; if (schema.nullable) return true; if (Array.isArray(schema.type) && schema.type.includes('null')) return true; // Check for null in oneOf/anyOf const items = schema.oneOf || schema.anyOf; if (items) { - return items.some( - (s) => s.type === 'null' || ('const' in s && s.const === null), - ); + return items.some(isJsonSchemaNull); } return false; } @@ -84,6 +94,7 @@ function isNullable(schema: JsonSchema): boolean { * Get the non-null type from a schema */ function getNonNullType(schema: JsonSchema): string | undefined { + if (typeof schema !== 'object' || schema === null) return; if (Array.isArray(schema.type)) { const nonNull = schema.type.filter((t) => t !== 'null'); return nonNull.length === 1 ? nonNull[0] : undefined; @@ -121,6 +132,7 @@ function findDependencies(schema: JsonSchema): Set { const deps = new Set(); function traverse(s: JsonSchema): void { + if (typeof s !== 'object' || s === null) return; if (s.$ref) { deps.add(getRefName(s.$ref)); } @@ -271,6 +283,9 @@ function sortDefinitions( * Generate TypeScript type for a JSON Schema (used for recursive type declarations) */ function generateTsType(schema: JsonSchema, _ctx: ConversionContext): string { + if (typeof schema === 'boolean') { + return schema ? 'any' : 'never'; + } if (schema.$ref) { const refName = getRefName(schema.$ref); const pascalName = toPascalCase(refName); @@ -290,7 +305,7 @@ function generateTsType(schema: JsonSchema, _ctx: ConversionContext): string { if (schema.oneOf || schema.anyOf) { const items = schema.oneOf || schema.anyOf || []; const types = items - .filter((s) => s.type !== 'null' && !('const' in s && s.const === null)) + .filter((s) => !isJsonSchemaNull(s)) .map((s) => generateTsType(s, _ctx)); return types.join(' | '); } @@ -362,6 +377,9 @@ function generateEffectSchema( schema: JsonSchema, ctx: ConversionContext, ): string { + if (typeof schema === 'boolean') { + return schema ? 'S.Unknown' : 'S.Never'; + } // Handle $ref if (schema.$ref) { const refName = getRefName(schema.$ref); @@ -394,9 +412,7 @@ function generateEffectSchema( // Handle oneOf / anyOf (union) if (schema.oneOf || schema.anyOf) { const items = schema.oneOf || schema.anyOf || []; - const nonNullItems = items.filter( - (s) => s.type !== 'null' && !('const' in s && s.const === null), - ); + const nonNullItems = items.filter((s) => !isJsonSchemaNull(s)); if (nonNullItems.length === 0) { return 'S.Null'; @@ -406,18 +422,14 @@ function generateEffectSchema( const firstItem = nonNullItems[0]; if (!firstItem) return 'S.Unknown'; const innerSchema = generateEffectSchema(firstItem, ctx); - const hasNull = items.some( - (s) => s.type === 'null' || ('const' in s && s.const === null), - ); + const hasNull = items.some(isJsonSchemaNull); return hasNull ? `S.NullOr(${innerSchema})` : innerSchema; } const members = nonNullItems .map((s) => generateEffectSchema(s, ctx)) .join(', '); - const hasNull = items.some( - (s) => s.type === 'null' || ('const' in s && s.const === null), - ); + const hasNull = items.some(isJsonSchemaNull); return hasNull ? `S.Union(${members}, S.Null)` : `S.Union(${members})`; } diff --git a/src/bin.ts b/src/bin.ts index 26d898a..6de075f 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -1,38 +1,97 @@ import { Command } from '@effect/cli'; +import { Command as PlatformCommand } from '@effect/platform'; import { BunContext, BunRuntime } from '@effect/platform-bun'; import { Effect } from 'effect'; import pkg from '../package.json' with { type: 'json' }; +import { defineConfig } from './dsl'; +import { CommandUtils } from './utils'; +import { + decodeAndPrettyLogTestResult, + decodeAndPrettyLogSetResult, +} from './dsc-utils'; -import type { Configuration } from './dsc-schema-types/configuration.gen'; - -const machineConfig: typeof Configuration.Type = { +const machineConfig = defineConfig({ $schema: 'https://aka.ms/dsc/schemas/v3/config/document.json', resources: [ + // { + // name: 'example-registry-key', + // type: 'Microsoft.Windows/Registry', + // properties: { + // keyPath: 'HKCU\\Software\\WinosConfig', + // valueName: 'Version', + // valueData: { + // String: pkg.version, + // }, + // _exist: true, + // }, + // }, { - name: 'must be unique', - type: 'Microsoft.Windows/Registry', + name: 'Ripgrep', + type: 'Microsoft.WinGet/Package', properties: { - keyPath: 'HKCU\\example\\key', - valueName: 'Example', - valueData: { - String: 'Example Value', - }, + id: 'BurntSushi.ripgrep.MSVC', + _exist: true, }, }, ], -}; +}); -const diffCommand = Command.make('diff', {}, () => +const runDscConfig = ( + subcommand: 'set' | 'test', + options: { whatIf?: boolean } = {}, +) => Effect.gen(function* () { - yield* Effect.log('diff'); - yield* Effect.log('diff2'); + const args = ['config', subcommand, '--file', '-']; + if (options.whatIf) { + args.push('--what-if'); + } + + yield* Effect.logDebug(`Running dsc ${args.join(' ')}`); + + const command = PlatformCommand.make('dsc', ...args).pipe( + PlatformCommand.feed(JSON.stringify(machineConfig)), + ); + + const { exitCode, stdout, stderr } = + yield* CommandUtils.runCommandBuffered(command); + + if (stderr) { + yield* Effect.logError(stderr); + } + + if (exitCode !== 0) { + yield* Effect.logError(`DSC exited with code ${exitCode}`); + } + + if (stdout) { + if (subcommand === 'test') { + yield* decodeAndPrettyLogTestResult(stdout); + } else if (subcommand === 'set') { + yield* decodeAndPrettyLogSetResult(stdout); + } else { + try { + const parsed = JSON.parse(stdout); + yield* Effect.log(JSON.stringify(parsed, null, 2)); + } catch { + yield* Effect.log(stdout); + } + } + } else if (exitCode === 0 && !stderr) { + yield* Effect.log('DSC completed successfully with no output.'); + } + }); + +const setCommand = Command.make('set', {}, () => + Effect.gen(function* () { + yield* Effect.log('Applying configuration changes...'); + yield* runDscConfig('set').pipe(Effect.scoped); }), ); -const applyCommand = Command.make('apply', {}, () => +const testCommand = Command.make('test', {}, () => Effect.gen(function* () { - yield* Effect.log('apply'); - yield* Effect.log('apply2'); + yield* Effect.log('Running configuration test...'); + yield* runDscConfig('test').pipe(Effect.scoped); }), ); @@ -40,7 +99,7 @@ const cliName = 'winos-config'; const app = Command.make(cliName, {}).pipe( Command.withDescription('NixOS-like tool for windows'), - Command.withSubcommands([diffCommand, applyCommand]), + Command.withSubcommands([setCommand, testCommand]), ); const cli = Command.run(app, { diff --git a/src/dsc-resource-schema-types/_resource-types.gen.ts b/src/dsc-resource-schema-types/_resource-types.gen.ts new file mode 100644 index 0000000..b0738dc --- /dev/null +++ b/src/dsc-resource-schema-types/_resource-types.gen.ts @@ -0,0 +1,106 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +/** + * All available DSC resource types on this system + */ +export const DscResourceTypes = S.Literal( + 'Microsoft.DSC.Debug/Echo', + 'Microsoft.DSC.Transitional/RunCommandOnSet', + 'Microsoft.PowerToys/AdvancedPasteSettings', + 'Microsoft.PowerToys/AlwaysOnTopSettings', + 'Microsoft.PowerToys/AppSettings', + 'Microsoft.PowerToys/AwakeSettings', + 'Microsoft.PowerToys/ColorPickerSettings', + 'Microsoft.PowerToys/CropAndLockSettings', + 'Microsoft.PowerToys/EnvironmentVariablesSettings', + 'Microsoft.PowerToys/FancyZonesSettings', + 'Microsoft.PowerToys/FileLocksmithSettings', + 'Microsoft.PowerToys/FindMyMouseSettings', + 'Microsoft.PowerToys/HostsSettings', + 'Microsoft.PowerToys/ImageResizerSettings', + 'Microsoft.PowerToys/KeyboardManagerSettings', + 'Microsoft.PowerToys/MeasureToolSettings', + 'Microsoft.PowerToys/MouseHighlighterSettings', + 'Microsoft.PowerToys/MouseJumpSettings', + 'Microsoft.PowerToys/MousePointerCrosshairsSettings', + 'Microsoft.PowerToys/PeekSettings', + 'Microsoft.PowerToys/PowerAccentSettings', + 'Microsoft.PowerToys/PowerOCRSettings', + 'Microsoft.PowerToys/PowerRenameSettings', + 'Microsoft.PowerToys/RegistryPreviewSettings', + 'Microsoft.PowerToys/ShortcutGuideSettings', + 'Microsoft.PowerToys/WorkspacesSettings', + 'Microsoft.PowerToys/ZoomItSettings', + 'Microsoft.WinGet/AdminSettings', + 'Microsoft.WinGet/Package', + 'Microsoft.WinGet/Source', + 'Microsoft.WinGet/UserSettingsFile', + 'Microsoft.Windows/RebootPending', + 'Microsoft.Windows/Registry', + 'Microsoft/OSInfo', +); + +export type DscResourceType = S.Schema.Type; + +/** + * Map of resource type to generated file + */ +export const ResourceTypeToFile = { + 'Microsoft.DSC.Debug/Echo': 'microsoft-dsc-debug-echo.gen', + 'Microsoft.DSC.Transitional/RunCommandOnSet': + 'microsoft-dsc-transitional-runcommandonset.gen', + 'Microsoft.PowerToys/AdvancedPasteSettings': + 'microsoft-powertoys-advancedpastesettings.gen', + 'Microsoft.PowerToys/AlwaysOnTopSettings': + 'microsoft-powertoys-alwaysontopsettings.gen', + 'Microsoft.PowerToys/AppSettings': 'microsoft-powertoys-appsettings.gen', + 'Microsoft.PowerToys/AwakeSettings': 'microsoft-powertoys-awakesettings.gen', + 'Microsoft.PowerToys/ColorPickerSettings': + 'microsoft-powertoys-colorpickersettings.gen', + 'Microsoft.PowerToys/CropAndLockSettings': + 'microsoft-powertoys-cropandlocksettings.gen', + 'Microsoft.PowerToys/EnvironmentVariablesSettings': + 'microsoft-powertoys-environmentvariablessettings.gen', + 'Microsoft.PowerToys/FancyZonesSettings': + 'microsoft-powertoys-fancyzonessettings.gen', + 'Microsoft.PowerToys/FileLocksmithSettings': + 'microsoft-powertoys-filelocksmithsettings.gen', + 'Microsoft.PowerToys/FindMyMouseSettings': + 'microsoft-powertoys-findmymousesettings.gen', + 'Microsoft.PowerToys/HostsSettings': 'microsoft-powertoys-hostssettings.gen', + 'Microsoft.PowerToys/ImageResizerSettings': + 'microsoft-powertoys-imageresizersettings.gen', + 'Microsoft.PowerToys/KeyboardManagerSettings': + 'microsoft-powertoys-keyboardmanagersettings.gen', + 'Microsoft.PowerToys/MeasureToolSettings': + 'microsoft-powertoys-measuretoolsettings.gen', + 'Microsoft.PowerToys/MouseHighlighterSettings': + 'microsoft-powertoys-mousehighlightersettings.gen', + 'Microsoft.PowerToys/MouseJumpSettings': + 'microsoft-powertoys-mousejumpsettings.gen', + 'Microsoft.PowerToys/MousePointerCrosshairsSettings': + 'microsoft-powertoys-mousepointercrosshairssettings.gen', + 'Microsoft.PowerToys/PeekSettings': 'microsoft-powertoys-peeksettings.gen', + 'Microsoft.PowerToys/PowerAccentSettings': + 'microsoft-powertoys-poweraccentsettings.gen', + 'Microsoft.PowerToys/PowerOCRSettings': + 'microsoft-powertoys-powerocrsettings.gen', + 'Microsoft.PowerToys/PowerRenameSettings': + 'microsoft-powertoys-powerrenamesettings.gen', + 'Microsoft.PowerToys/RegistryPreviewSettings': + 'microsoft-powertoys-registrypreviewsettings.gen', + 'Microsoft.PowerToys/ShortcutGuideSettings': + 'microsoft-powertoys-shortcutguidesettings.gen', + 'Microsoft.PowerToys/WorkspacesSettings': + 'microsoft-powertoys-workspacessettings.gen', + 'Microsoft.PowerToys/ZoomItSettings': + 'microsoft-powertoys-zoomitsettings.gen', + 'Microsoft.WinGet/AdminSettings': 'microsoft-winget-adminsettings.gen', + 'Microsoft.WinGet/Package': 'microsoft-winget-package.gen', + 'Microsoft.WinGet/Source': 'microsoft-winget-source.gen', + 'Microsoft.WinGet/UserSettingsFile': 'microsoft-winget-usersettingsfile.gen', + 'Microsoft.Windows/RebootPending': 'microsoft-windows-rebootpending.gen', + 'Microsoft.Windows/Registry': 'microsoft-windows-registry.gen', + 'Microsoft/OSInfo': 'microsoft-osinfo.gen', +} as const; diff --git a/src/dsc-resource-schema-types/_resource-union.gen.ts b/src/dsc-resource-schema-types/_resource-union.gen.ts new file mode 100644 index 0000000..d40bacc --- /dev/null +++ b/src/dsc-resource-schema-types/_resource-union.gen.ts @@ -0,0 +1,300 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; +import * as Resources from './index'; + +/** + * A discriminated union of all available DSC resources with their specific properties + */ +export const ResourceUnion = S.Union( + S.Struct({ + type: S.Literal('Microsoft.DSC.Debug/Echo'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: Resources.MicrosoftDSCDebugEcho.MicrosoftDSCDebugEcho, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.DSC.Transitional/RunCommandOnSet'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftDSCTransitionalRunCommandOnSet + .MicrosoftDSCTransitionalRunCommandOnSet, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/AdvancedPasteSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysAdvancedPasteSettings + .MicrosoftPowerToysAdvancedPasteSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/AlwaysOnTopSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysAlwaysOnTopSettings + .MicrosoftPowerToysAlwaysOnTopSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/AppSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysAppSettings.MicrosoftPowerToysAppSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/AwakeSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysAwakeSettings.MicrosoftPowerToysAwakeSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/ColorPickerSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysColorPickerSettings + .MicrosoftPowerToysColorPickerSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/CropAndLockSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysCropAndLockSettings + .MicrosoftPowerToysCropAndLockSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/EnvironmentVariablesSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysEnvironmentVariablesSettings + .MicrosoftPowerToysEnvironmentVariablesSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/FancyZonesSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysFancyZonesSettings + .MicrosoftPowerToysFancyZonesSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/FileLocksmithSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysFileLocksmithSettings + .MicrosoftPowerToysFileLocksmithSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/FindMyMouseSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysFindMyMouseSettings + .MicrosoftPowerToysFindMyMouseSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/HostsSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysHostsSettings.MicrosoftPowerToysHostsSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/ImageResizerSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysImageResizerSettings + .MicrosoftPowerToysImageResizerSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/KeyboardManagerSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysKeyboardManagerSettings + .MicrosoftPowerToysKeyboardManagerSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/MeasureToolSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysMeasureToolSettings + .MicrosoftPowerToysMeasureToolSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/MouseHighlighterSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysMouseHighlighterSettings + .MicrosoftPowerToysMouseHighlighterSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/MouseJumpSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysMouseJumpSettings + .MicrosoftPowerToysMouseJumpSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/MousePointerCrosshairsSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysMousePointerCrosshairsSettings + .MicrosoftPowerToysMousePointerCrosshairsSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/PeekSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysPeekSettings.MicrosoftPowerToysPeekSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/PowerAccentSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysPowerAccentSettings + .MicrosoftPowerToysPowerAccentSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/PowerOCRSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysPowerOCRSettings + .MicrosoftPowerToysPowerOCRSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/PowerRenameSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysPowerRenameSettings + .MicrosoftPowerToysPowerRenameSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/RegistryPreviewSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysRegistryPreviewSettings + .MicrosoftPowerToysRegistryPreviewSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/ShortcutGuideSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysShortcutGuideSettings + .MicrosoftPowerToysShortcutGuideSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/WorkspacesSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysWorkspacesSettings + .MicrosoftPowerToysWorkspacesSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.PowerToys/ZoomItSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftPowerToysZoomItSettings + .MicrosoftPowerToysZoomItSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.WinGet/AdminSettings'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftWinGetAdminSettings.MicrosoftWinGetAdminSettings, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.WinGet/Package'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: Resources.MicrosoftWinGetPackage.MicrosoftWinGetPackage, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.WinGet/Source'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: Resources.MicrosoftWinGetSource.MicrosoftWinGetSource, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.WinGet/UserSettingsFile'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftWinGetUserSettingsFile.MicrosoftWinGetUserSettingsFile, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.Windows/RebootPending'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: + Resources.MicrosoftWindowsRebootPending.MicrosoftWindowsRebootPending, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft.Windows/Registry'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: Resources.MicrosoftWindowsRegistry.MicrosoftWindowsRegistry, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), + S.Struct({ + type: S.Literal('Microsoft/OSInfo'), + name: S.String, + dependsOn: S.optional(S.Array(S.String)), + properties: Resources.MicrosoftOSInfo.MicrosoftOSInfo, + metadata: S.optional(S.Record({ key: S.String, value: S.Unknown })), + }), +); + +export type ResourceUnion = S.Schema.Type; diff --git a/src/dsc-resource-schema-types/index.ts b/src/dsc-resource-schema-types/index.ts new file mode 100644 index 0000000..ed1cc62 --- /dev/null +++ b/src/dsc-resource-schema-types/index.ts @@ -0,0 +1,37 @@ +// This file is auto-generated. Do not edit manually. +// Re-exports all DSC resource schema types + +export * as MicrosoftDSCDebugEcho from './microsoft-dsc-debug-echo.gen'; +export * as MicrosoftDSCTransitionalRunCommandOnSet from './microsoft-dsc-transitional-runcommandonset.gen'; +export * as MicrosoftOSInfo from './microsoft-osinfo.gen'; +export * as MicrosoftPowerToysAdvancedPasteSettings from './microsoft-powertoys-advancedpastesettings.gen'; +export * as MicrosoftPowerToysAlwaysOnTopSettings from './microsoft-powertoys-alwaysontopsettings.gen'; +export * as MicrosoftPowerToysAppSettings from './microsoft-powertoys-appsettings.gen'; +export * as MicrosoftPowerToysAwakeSettings from './microsoft-powertoys-awakesettings.gen'; +export * as MicrosoftPowerToysColorPickerSettings from './microsoft-powertoys-colorpickersettings.gen'; +export * as MicrosoftPowerToysCropAndLockSettings from './microsoft-powertoys-cropandlocksettings.gen'; +export * as MicrosoftPowerToysEnvironmentVariablesSettings from './microsoft-powertoys-environmentvariablessettings.gen'; +export * as MicrosoftPowerToysFancyZonesSettings from './microsoft-powertoys-fancyzonessettings.gen'; +export * as MicrosoftPowerToysFileLocksmithSettings from './microsoft-powertoys-filelocksmithsettings.gen'; +export * as MicrosoftPowerToysFindMyMouseSettings from './microsoft-powertoys-findmymousesettings.gen'; +export * as MicrosoftPowerToysHostsSettings from './microsoft-powertoys-hostssettings.gen'; +export * as MicrosoftPowerToysImageResizerSettings from './microsoft-powertoys-imageresizersettings.gen'; +export * as MicrosoftPowerToysKeyboardManagerSettings from './microsoft-powertoys-keyboardmanagersettings.gen'; +export * as MicrosoftPowerToysMeasureToolSettings from './microsoft-powertoys-measuretoolsettings.gen'; +export * as MicrosoftPowerToysMouseHighlighterSettings from './microsoft-powertoys-mousehighlightersettings.gen'; +export * as MicrosoftPowerToysMouseJumpSettings from './microsoft-powertoys-mousejumpsettings.gen'; +export * as MicrosoftPowerToysMousePointerCrosshairsSettings from './microsoft-powertoys-mousepointercrosshairssettings.gen'; +export * as MicrosoftPowerToysPeekSettings from './microsoft-powertoys-peeksettings.gen'; +export * as MicrosoftPowerToysPowerAccentSettings from './microsoft-powertoys-poweraccentsettings.gen'; +export * as MicrosoftPowerToysPowerOCRSettings from './microsoft-powertoys-powerocrsettings.gen'; +export * as MicrosoftPowerToysPowerRenameSettings from './microsoft-powertoys-powerrenamesettings.gen'; +export * as MicrosoftPowerToysRegistryPreviewSettings from './microsoft-powertoys-registrypreviewsettings.gen'; +export * as MicrosoftPowerToysShortcutGuideSettings from './microsoft-powertoys-shortcutguidesettings.gen'; +export * as MicrosoftPowerToysWorkspacesSettings from './microsoft-powertoys-workspacessettings.gen'; +export * as MicrosoftPowerToysZoomItSettings from './microsoft-powertoys-zoomitsettings.gen'; +export * as MicrosoftWindowsRebootPending from './microsoft-windows-rebootpending.gen'; +export * as MicrosoftWindowsRegistry from './microsoft-windows-registry.gen'; +export * as MicrosoftWinGetAdminSettings from './microsoft-winget-adminsettings.gen'; +export * as MicrosoftWinGetPackage from './microsoft-winget-package.gen'; +export * as MicrosoftWinGetSource from './microsoft-winget-source.gen'; +export * as MicrosoftWinGetUserSettingsFile from './microsoft-winget-usersettingsfile.gen'; diff --git a/src/dsc-resource-schema-types/microsoft-dsc-debug-echo.gen.ts b/src/dsc-resource-schema-types/microsoft-dsc-debug-echo.gen.ts new file mode 100644 index 0000000..cdd14ae --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-dsc-debug-echo.gen.ts @@ -0,0 +1,18 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const Output = S.Union( + S.Array(S.Unknown), + S.Boolean, + S.Number, + S.Unknown, + S.Unknown, + S.String, + S.String, +); +export type Output = S.Schema.Type; + +export const MicrosoftDSCDebugEcho = S.Struct({ + output: Output, +}); +export type MicrosoftDSCDebugEcho = S.Schema.Type; diff --git a/src/dsc-resource-schema-types/microsoft-dsc-transitional-runcommandonset.gen.ts b/src/dsc-resource-schema-types/microsoft-dsc-transitional-runcommandonset.gen.ts new file mode 100644 index 0000000..04ec331 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-dsc-transitional-runcommandonset.gen.ts @@ -0,0 +1,11 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftDSCTransitionalRunCommandOnSet = S.Struct({ + arguments: S.optional(S.Array(S.Unknown)), + executable: S.String, + exitCode: S.optional(S.Number), +}); +export type MicrosoftDSCTransitionalRunCommandOnSet = S.Schema.Type< + typeof MicrosoftDSCTransitionalRunCommandOnSet +>; diff --git a/src/dsc-resource-schema-types/microsoft-osinfo.gen.ts b/src/dsc-resource-schema-types/microsoft-osinfo.gen.ts new file mode 100644 index 0000000..9b702f4 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-osinfo.gen.ts @@ -0,0 +1,17 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +/** Returns information about the operating system. + +https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource + */ +export const MicrosoftOSInfo = S.Struct({ + $id: S.optional(S.String), + architecture: S.optional(S.String), + bitness: S.optional(S.Literal('32', '64', 'unknown')), + codename: S.optional(S.String), + edition: S.optional(S.String), + family: S.optional(S.Literal('Linux', 'macOS', 'Windows')), + version: S.optional(S.String), +}); +export type MicrosoftOSInfo = S.Schema.Type; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-advancedpastesettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-advancedpastesettings.gen.ts new file mode 100644 index 0000000..877727a --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-advancedpastesettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysAdvancedPasteSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysAdvancedPasteSettings = S.Schema.Type< + typeof MicrosoftPowerToysAdvancedPasteSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-alwaysontopsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-alwaysontopsettings.gen.ts new file mode 100644 index 0000000..3b82503 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-alwaysontopsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysAlwaysOnTopSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysAlwaysOnTopSettings = S.Schema.Type< + typeof MicrosoftPowerToysAlwaysOnTopSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-appsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-appsettings.gen.ts new file mode 100644 index 0000000..3a9ce95 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-appsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysAppSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysAppSettings = S.Schema.Type< + typeof MicrosoftPowerToysAppSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-awakesettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-awakesettings.gen.ts new file mode 100644 index 0000000..f162094 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-awakesettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysAwakeSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysAwakeSettings = S.Schema.Type< + typeof MicrosoftPowerToysAwakeSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-colorpickersettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-colorpickersettings.gen.ts new file mode 100644 index 0000000..d8969f1 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-colorpickersettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysColorPickerSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysColorPickerSettings = S.Schema.Type< + typeof MicrosoftPowerToysColorPickerSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-cropandlocksettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-cropandlocksettings.gen.ts new file mode 100644 index 0000000..17941f4 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-cropandlocksettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysCropAndLockSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysCropAndLockSettings = S.Schema.Type< + typeof MicrosoftPowerToysCropAndLockSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-environmentvariablessettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-environmentvariablessettings.gen.ts new file mode 100644 index 0000000..79ff992 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-environmentvariablessettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysEnvironmentVariablesSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysEnvironmentVariablesSettings = S.Schema.Type< + typeof MicrosoftPowerToysEnvironmentVariablesSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-fancyzonessettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-fancyzonessettings.gen.ts new file mode 100644 index 0000000..b9aeea1 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-fancyzonessettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysFancyZonesSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysFancyZonesSettings = S.Schema.Type< + typeof MicrosoftPowerToysFancyZonesSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-filelocksmithsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-filelocksmithsettings.gen.ts new file mode 100644 index 0000000..a2a2b40 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-filelocksmithsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysFileLocksmithSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysFileLocksmithSettings = S.Schema.Type< + typeof MicrosoftPowerToysFileLocksmithSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-findmymousesettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-findmymousesettings.gen.ts new file mode 100644 index 0000000..617a40a --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-findmymousesettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysFindMyMouseSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysFindMyMouseSettings = S.Schema.Type< + typeof MicrosoftPowerToysFindMyMouseSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-hostssettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-hostssettings.gen.ts new file mode 100644 index 0000000..f31cfe0 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-hostssettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysHostsSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysHostsSettings = S.Schema.Type< + typeof MicrosoftPowerToysHostsSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-imageresizersettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-imageresizersettings.gen.ts new file mode 100644 index 0000000..c4e64d1 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-imageresizersettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysImageResizerSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysImageResizerSettings = S.Schema.Type< + typeof MicrosoftPowerToysImageResizerSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-keyboardmanagersettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-keyboardmanagersettings.gen.ts new file mode 100644 index 0000000..9d675eb --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-keyboardmanagersettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysKeyboardManagerSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysKeyboardManagerSettings = S.Schema.Type< + typeof MicrosoftPowerToysKeyboardManagerSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-measuretoolsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-measuretoolsettings.gen.ts new file mode 100644 index 0000000..540aa5d --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-measuretoolsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysMeasureToolSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysMeasureToolSettings = S.Schema.Type< + typeof MicrosoftPowerToysMeasureToolSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-mousehighlightersettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-mousehighlightersettings.gen.ts new file mode 100644 index 0000000..7894434 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-mousehighlightersettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysMouseHighlighterSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysMouseHighlighterSettings = S.Schema.Type< + typeof MicrosoftPowerToysMouseHighlighterSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-mousejumpsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-mousejumpsettings.gen.ts new file mode 100644 index 0000000..6a6eb6a --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-mousejumpsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysMouseJumpSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysMouseJumpSettings = S.Schema.Type< + typeof MicrosoftPowerToysMouseJumpSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-mousepointercrosshairssettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-mousepointercrosshairssettings.gen.ts new file mode 100644 index 0000000..36833c3 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-mousepointercrosshairssettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysMousePointerCrosshairsSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysMousePointerCrosshairsSettings = S.Schema.Type< + typeof MicrosoftPowerToysMousePointerCrosshairsSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-peeksettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-peeksettings.gen.ts new file mode 100644 index 0000000..6326295 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-peeksettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysPeekSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysPeekSettings = S.Schema.Type< + typeof MicrosoftPowerToysPeekSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-poweraccentsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-poweraccentsettings.gen.ts new file mode 100644 index 0000000..67c5348 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-poweraccentsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysPowerAccentSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysPowerAccentSettings = S.Schema.Type< + typeof MicrosoftPowerToysPowerAccentSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-powerocrsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-powerocrsettings.gen.ts new file mode 100644 index 0000000..4e61d04 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-powerocrsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysPowerOCRSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysPowerOCRSettings = S.Schema.Type< + typeof MicrosoftPowerToysPowerOCRSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-powerrenamesettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-powerrenamesettings.gen.ts new file mode 100644 index 0000000..c235213 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-powerrenamesettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysPowerRenameSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysPowerRenameSettings = S.Schema.Type< + typeof MicrosoftPowerToysPowerRenameSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-registrypreviewsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-registrypreviewsettings.gen.ts new file mode 100644 index 0000000..2cd6272 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-registrypreviewsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysRegistryPreviewSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysRegistryPreviewSettings = S.Schema.Type< + typeof MicrosoftPowerToysRegistryPreviewSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-shortcutguidesettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-shortcutguidesettings.gen.ts new file mode 100644 index 0000000..fa478ef --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-shortcutguidesettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysShortcutGuideSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysShortcutGuideSettings = S.Schema.Type< + typeof MicrosoftPowerToysShortcutGuideSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-workspacessettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-workspacessettings.gen.ts new file mode 100644 index 0000000..9507ea4 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-workspacessettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysWorkspacesSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysWorkspacesSettings = S.Schema.Type< + typeof MicrosoftPowerToysWorkspacesSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-powertoys-zoomitsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-powertoys-zoomitsettings.gen.ts new file mode 100644 index 0000000..c9970fd --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-powertoys-zoomitsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftPowerToysZoomItSettings = S.Struct({ + _inDesiredState: S.optional(S.NullOr(S.Boolean)), + settings: S.Unknown, +}); +export type MicrosoftPowerToysZoomItSettings = S.Schema.Type< + typeof MicrosoftPowerToysZoomItSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-windows-rebootpending.gen.ts b/src/dsc-resource-schema-types/microsoft-windows-rebootpending.gen.ts new file mode 100644 index 0000000..ace424c --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-windows-rebootpending.gen.ts @@ -0,0 +1,11 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftWindowsRebootPending = S.NullOr( + S.Struct({ + rebootPending: S.optional(S.Boolean), + }), +); +export type MicrosoftWindowsRebootPending = S.Schema.Type< + typeof MicrosoftWindowsRebootPending +>; diff --git a/src/dsc-resource-schema-types/microsoft-windows-registry.gen.ts b/src/dsc-resource-schema-types/microsoft-windows-registry.gen.ts new file mode 100644 index 0000000..804c26a --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-windows-registry.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const Metadata = S.Struct({ + whatIf: S.optional(S.NullOr(S.Array(S.String))), +}); +export type Metadata = S.Schema.Type; + +export const RegistryValueData = S.Union( + S.Literal('None'), + S.Struct({ + String: S.String, + }), + S.Struct({ + ExpandString: S.String, + }), + S.Struct({ + Binary: S.Array(S.Number), + }), + S.Struct({ + DWord: S.Number, + }), + S.Struct({ + MultiString: S.Array(S.String), + }), + S.Struct({ + QWord: S.Number, + }), +); +export type RegistryValueData = S.Schema.Type; + +export const MicrosoftWindowsRegistry = S.Struct({ + _exist: S.optional(S.NullOr(S.Boolean)), + _metadata: S.optional(S.NullOr(Metadata)), + keyPath: S.String, + valueData: S.optional(S.NullOr(RegistryValueData)), + valueName: S.optional(S.NullOr(S.String)), +}); +export type MicrosoftWindowsRegistry = S.Schema.Type< + typeof MicrosoftWindowsRegistry +>; diff --git a/src/dsc-resource-schema-types/microsoft-winget-adminsettings.gen.ts b/src/dsc-resource-schema-types/microsoft-winget-adminsettings.gen.ts new file mode 100644 index 0000000..ef2110a --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-winget-adminsettings.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftWinGetAdminSettings = S.Struct({ + _inDesiredState: S.optional(S.Boolean), + settings: S.optional(S.Unknown), +}); +export type MicrosoftWinGetAdminSettings = S.Schema.Type< + typeof MicrosoftWinGetAdminSettings +>; diff --git a/src/dsc-resource-schema-types/microsoft-winget-package.gen.ts b/src/dsc-resource-schema-types/microsoft-winget-package.gen.ts new file mode 100644 index 0000000..2ab3374 --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-winget-package.gen.ts @@ -0,0 +1,24 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftWinGetPackage = S.Struct({ + _exist: S.optional(S.Boolean), + _inDesiredState: S.optional(S.Boolean), + acceptAgreements: S.optional(S.Boolean), + id: S.String, + installMode: S.optional(S.Literal('default', 'silent', 'interactive')), + matchOption: S.optional( + S.Literal( + 'equals', + 'equalsCaseInsensitive', + 'startsWithCaseInsensitive', + 'containsCaseInsensitive', + ), + ), + source: S.optional(S.String), + useLatest: S.optional(S.Boolean), + version: S.optional(S.String), +}); +export type MicrosoftWinGetPackage = S.Schema.Type< + typeof MicrosoftWinGetPackage +>; diff --git a/src/dsc-resource-schema-types/microsoft-winget-source.gen.ts b/src/dsc-resource-schema-types/microsoft-winget-source.gen.ts new file mode 100644 index 0000000..968a40c --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-winget-source.gen.ts @@ -0,0 +1,14 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftWinGetSource = S.Struct({ + _exist: S.optional(S.Boolean), + _inDesiredState: S.optional(S.Boolean), + acceptAgreements: S.optional(S.Boolean), + argument: S.optional(S.String), + explicit: S.optional(S.Boolean), + name: S.String, + trustLevel: S.optional(S.Literal('undefined', 'none', 'trusted')), + type: S.optional(S.String), +}); +export type MicrosoftWinGetSource = S.Schema.Type; diff --git a/src/dsc-resource-schema-types/microsoft-winget-usersettingsfile.gen.ts b/src/dsc-resource-schema-types/microsoft-winget-usersettingsfile.gen.ts new file mode 100644 index 0000000..9ab4bbd --- /dev/null +++ b/src/dsc-resource-schema-types/microsoft-winget-usersettingsfile.gen.ts @@ -0,0 +1,11 @@ +// This file is auto-generated. Do not edit manually. +import * as S from 'effect/Schema'; + +export const MicrosoftWinGetUserSettingsFile = S.Struct({ + _inDesiredState: S.optional(S.Boolean), + action: S.optional(S.Literal('Partial', 'Full')), + settings: S.Unknown, +}); +export type MicrosoftWinGetUserSettingsFile = S.Schema.Type< + typeof MicrosoftWinGetUserSettingsFile +>; diff --git a/src/dsc-schema-types/configuration-get-result.gen.ts b/src/dsc-schema-types/configuration-get-result.gen.ts index 375aac4..5608637 100644 --- a/src/dsc-schema-types/configuration-get-result.gen.ts +++ b/src/dsc-schema-types/configuration-get-result.gen.ts @@ -1,86 +1,81 @@ // This file is auto-generated. Do not edit manually. import * as S from 'effect/Schema'; -export const Operation = S.Literal( - "get", - "set", - "test", - "export" -); +export const Operation = S.Literal('get', 'set', 'test', 'export'); export type Operation = S.Schema.Type; -export const ExecutionKind = S.Literal( - "actual", - "whatIf" -); +export const ExecutionKind = S.Literal('actual', 'whatIf'); export type ExecutionKind = S.Schema.Type; export const SecurityContextKind = S.Literal( - "current", - "elevated", - "restricted" + 'current', + 'elevated', + 'restricted', ); export type SecurityContextKind = S.Schema.Type; export const MicrosoftDscMetadata = S.Struct({ - "version": S.optional(S.NullOr(S.String)), - "operation": S.optional(S.NullOr(Operation)), - "executionType": S.optional(S.NullOr(ExecutionKind)), - "startDatetime": S.optional(S.NullOr(S.String)), - "endDatetime": S.optional(S.NullOr(S.String)), - "duration": S.optional(S.NullOr(S.String)), - "securityContext": S.optional(S.NullOr(SecurityContextKind)) + version: S.optional(S.NullOr(S.String)), + operation: S.optional(S.NullOr(Operation)), + executionType: S.optional(S.NullOr(ExecutionKind)), + startDatetime: S.optional(S.NullOr(S.String)), + endDatetime: S.optional(S.NullOr(S.String)), + duration: S.optional(S.NullOr(S.String)), + securityContext: S.optional(S.NullOr(SecurityContextKind)), }); export type MicrosoftDscMetadata = S.Schema.Type; export const Metadata = S.Struct({ - "Microsoft.DSC": S.optional(S.NullOr(MicrosoftDscMetadata)) + 'Microsoft.DSC': S.optional(S.NullOr(MicrosoftDscMetadata)), }); export type Metadata = S.Schema.Type; export const ResourceGetResponse = S.Struct({ - "actualState": S.Unknown + actualState: S.Unknown, }); export type ResourceGetResponse = S.Schema.Type; -export const MessageLevel = S.Literal( - "error", - "warning", - "information" -); +export const MessageLevel = S.Literal('error', 'warning', 'information'); export type MessageLevel = S.Schema.Type; export const ResourceMessage = S.Struct({ - "name": S.String, - "type": S.String, - "message": S.String, - "level": MessageLevel + name: S.String, + type: S.String, + message: S.String, + level: MessageLevel, }); export type ResourceMessage = S.Schema.Type; export const ConfigurationGetResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "results": S.Array(S.suspend((): S.Schema => ResourceGetResult)), - "messages": S.Array(ResourceMessage), - "hadErrors": S.Boolean + metadata: S.optional(S.NullOr(Metadata)), + results: S.Array( + S.suspend((): S.Schema => ResourceGetResult), + ), + messages: S.Array(ResourceMessage), + hadErrors: S.Boolean, }); -export type ConfigurationGetResult = S.Schema.Type; +export type ConfigurationGetResult = S.Schema.Type< + typeof ConfigurationGetResult +>; // Recursive type declarations interface ResourceGetResult { - readonly "metadata"?: Metadata | null; - readonly "name": string; - readonly "type": string; - readonly "result": GetResult + readonly metadata?: Metadata | null; + readonly name: string; + readonly type: string; + readonly result: GetResult; } -type GetResult = ResourceGetResponse | ReadonlyArray +type GetResult = ResourceGetResponse | ReadonlyArray; // Recursive schema definitions export const ResourceGetResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "name": S.String, - "type": S.String, - "result": S.suspend((): S.Schema => GetResult) + metadata: S.optional(S.NullOr(Metadata)), + name: S.String, + type: S.String, + result: S.suspend((): S.Schema => GetResult), }) as unknown as S.Schema; -export const GetResult = S.Union(ResourceGetResponse, S.Array(S.suspend((): S.Schema => ResourceGetResult))) as unknown as S.Schema; +export const GetResult = S.Union( + ResourceGetResponse, + S.Array(S.suspend((): S.Schema => ResourceGetResult)), +) as unknown as S.Schema; diff --git a/src/dsc-schema-types/configuration-set-result.gen.ts b/src/dsc-schema-types/configuration-set-result.gen.ts index f4fadca..a8358cb 100644 --- a/src/dsc-schema-types/configuration-set-result.gen.ts +++ b/src/dsc-schema-types/configuration-set-result.gen.ts @@ -1,88 +1,83 @@ // This file is auto-generated. Do not edit manually. import * as S from 'effect/Schema'; -export const Operation = S.Literal( - "get", - "set", - "test", - "export" -); +export const Operation = S.Literal('get', 'set', 'test', 'export'); export type Operation = S.Schema.Type; -export const ExecutionKind = S.Literal( - "actual", - "whatIf" -); +export const ExecutionKind = S.Literal('actual', 'whatIf'); export type ExecutionKind = S.Schema.Type; export const SecurityContextKind = S.Literal( - "current", - "elevated", - "restricted" + 'current', + 'elevated', + 'restricted', ); export type SecurityContextKind = S.Schema.Type; export const MicrosoftDscMetadata = S.Struct({ - "version": S.optional(S.NullOr(S.String)), - "operation": S.optional(S.NullOr(Operation)), - "executionType": S.optional(S.NullOr(ExecutionKind)), - "startDatetime": S.optional(S.NullOr(S.String)), - "endDatetime": S.optional(S.NullOr(S.String)), - "duration": S.optional(S.NullOr(S.String)), - "securityContext": S.optional(S.NullOr(SecurityContextKind)) + version: S.optional(S.NullOr(S.String)), + operation: S.optional(S.NullOr(Operation)), + executionType: S.optional(S.NullOr(ExecutionKind)), + startDatetime: S.optional(S.NullOr(S.String)), + endDatetime: S.optional(S.NullOr(S.String)), + duration: S.optional(S.NullOr(S.String)), + securityContext: S.optional(S.NullOr(SecurityContextKind)), }); export type MicrosoftDscMetadata = S.Schema.Type; export const Metadata = S.Struct({ - "Microsoft.DSC": S.optional(S.NullOr(MicrosoftDscMetadata)) + 'Microsoft.DSC': S.optional(S.NullOr(MicrosoftDscMetadata)), }); export type Metadata = S.Schema.Type; export const ResourceSetResponse = S.Struct({ - "beforeState": S.Unknown, - "afterState": S.Unknown, - "changedProperties": S.optional(S.NullOr(S.Array(S.String))) + beforeState: S.Unknown, + afterState: S.Unknown, + changedProperties: S.optional(S.NullOr(S.Array(S.String))), }); export type ResourceSetResponse = S.Schema.Type; -export const MessageLevel = S.Literal( - "error", - "warning", - "information" -); +export const MessageLevel = S.Literal('error', 'warning', 'information'); export type MessageLevel = S.Schema.Type; export const ResourceMessage = S.Struct({ - "name": S.String, - "type": S.String, - "message": S.String, - "level": MessageLevel + name: S.String, + type: S.String, + message: S.String, + level: MessageLevel, }); export type ResourceMessage = S.Schema.Type; export const ConfigurationSetResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "results": S.Array(S.suspend((): S.Schema => ResourceSetResult)), - "messages": S.Array(ResourceMessage), - "hadErrors": S.Boolean + metadata: S.optional(S.NullOr(Metadata)), + results: S.Array( + S.suspend((): S.Schema => ResourceSetResult), + ), + messages: S.Array(ResourceMessage), + hadErrors: S.Boolean, }); -export type ConfigurationSetResult = S.Schema.Type; +export type ConfigurationSetResult = S.Schema.Type< + typeof ConfigurationSetResult +>; // Recursive type declarations interface ResourceSetResult { - readonly "metadata"?: Metadata | null; - readonly "name": string; - readonly "type": string; - readonly "result": SetResult + readonly metadata?: Metadata | null; + readonly name: string; + readonly type: string; + readonly result: SetResult; } -type SetResult = ResourceSetResponse | ReadonlyArray +type SetResult = ResourceSetResponse | ReadonlyArray; // Recursive schema definitions export const ResourceSetResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "name": S.String, - "type": S.String, - "result": S.suspend((): S.Schema => SetResult) + metadata: S.optional(S.NullOr(Metadata)), + name: S.String, + type: S.String, + result: S.suspend((): S.Schema => SetResult), }) as unknown as S.Schema; -export const SetResult = S.Union(ResourceSetResponse, S.Array(S.suspend((): S.Schema => ResourceSetResult))) as unknown as S.Schema; +export const SetResult = S.Union( + ResourceSetResponse, + S.Array(S.suspend((): S.Schema => ResourceSetResult)), +) as unknown as S.Schema; diff --git a/src/dsc-schema-types/configuration-test-result.gen.ts b/src/dsc-schema-types/configuration-test-result.gen.ts index d2b6138..950b0c4 100644 --- a/src/dsc-schema-types/configuration-test-result.gen.ts +++ b/src/dsc-schema-types/configuration-test-result.gen.ts @@ -1,89 +1,84 @@ // This file is auto-generated. Do not edit manually. import * as S from 'effect/Schema'; -export const Operation = S.Literal( - "get", - "set", - "test", - "export" -); +export const Operation = S.Literal('get', 'set', 'test', 'export'); export type Operation = S.Schema.Type; -export const ExecutionKind = S.Literal( - "actual", - "whatIf" -); +export const ExecutionKind = S.Literal('actual', 'whatIf'); export type ExecutionKind = S.Schema.Type; export const SecurityContextKind = S.Literal( - "current", - "elevated", - "restricted" + 'current', + 'elevated', + 'restricted', ); export type SecurityContextKind = S.Schema.Type; export const MicrosoftDscMetadata = S.Struct({ - "version": S.optional(S.NullOr(S.String)), - "operation": S.optional(S.NullOr(Operation)), - "executionType": S.optional(S.NullOr(ExecutionKind)), - "startDatetime": S.optional(S.NullOr(S.String)), - "endDatetime": S.optional(S.NullOr(S.String)), - "duration": S.optional(S.NullOr(S.String)), - "securityContext": S.optional(S.NullOr(SecurityContextKind)) + version: S.optional(S.NullOr(S.String)), + operation: S.optional(S.NullOr(Operation)), + executionType: S.optional(S.NullOr(ExecutionKind)), + startDatetime: S.optional(S.NullOr(S.String)), + endDatetime: S.optional(S.NullOr(S.String)), + duration: S.optional(S.NullOr(S.String)), + securityContext: S.optional(S.NullOr(SecurityContextKind)), }); export type MicrosoftDscMetadata = S.Schema.Type; export const Metadata = S.Struct({ - "Microsoft.DSC": S.optional(S.NullOr(MicrosoftDscMetadata)) + 'Microsoft.DSC': S.optional(S.NullOr(MicrosoftDscMetadata)), }); export type Metadata = S.Schema.Type; export const ResourceTestResponse = S.Struct({ - "desiredState": S.Unknown, - "actualState": S.Unknown, - "inDesiredState": S.Boolean, - "differingProperties": S.Array(S.String) + desiredState: S.Unknown, + actualState: S.Unknown, + inDesiredState: S.Boolean, + differingProperties: S.Array(S.String), }); export type ResourceTestResponse = S.Schema.Type; -export const MessageLevel = S.Literal( - "error", - "warning", - "information" -); +export const MessageLevel = S.Literal('error', 'warning', 'information'); export type MessageLevel = S.Schema.Type; export const ResourceMessage = S.Struct({ - "name": S.String, - "type": S.String, - "message": S.String, - "level": MessageLevel + name: S.String, + type: S.String, + message: S.String, + level: MessageLevel, }); export type ResourceMessage = S.Schema.Type; export const ConfigurationTestResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "results": S.Array(S.suspend((): S.Schema => ResourceTestResult)), - "messages": S.Array(ResourceMessage), - "hadErrors": S.Boolean + metadata: S.optional(S.NullOr(Metadata)), + results: S.Array( + S.suspend((): S.Schema => ResourceTestResult), + ), + messages: S.Array(ResourceMessage), + hadErrors: S.Boolean, }); -export type ConfigurationTestResult = S.Schema.Type; +export type ConfigurationTestResult = S.Schema.Type< + typeof ConfigurationTestResult +>; // Recursive type declarations interface ResourceTestResult { - readonly "metadata"?: Metadata | null; - readonly "name": string; - readonly "type": string; - readonly "result": TestResult + readonly metadata?: Metadata | null; + readonly name: string; + readonly type: string; + readonly result: TestResult; } -type TestResult = ResourceTestResponse | ReadonlyArray +type TestResult = ResourceTestResponse | ReadonlyArray; // Recursive schema definitions export const ResourceTestResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "name": S.String, - "type": S.String, - "result": S.suspend((): S.Schema => TestResult) + metadata: S.optional(S.NullOr(Metadata)), + name: S.String, + type: S.String, + result: S.suspend((): S.Schema => TestResult), }) as unknown as S.Schema; -export const TestResult = S.Union(ResourceTestResponse, S.Array(S.suspend((): S.Schema => ResourceTestResult))) as unknown as S.Schema; +export const TestResult = S.Union( + ResourceTestResponse, + S.Array(S.suspend((): S.Schema => ResourceTestResult)), +) as unknown as S.Schema; diff --git a/src/dsc-schema-types/configuration.gen.ts b/src/dsc-schema-types/configuration.gen.ts index 04659f7..d2d263f 100644 --- a/src/dsc-schema-types/configuration.gen.ts +++ b/src/dsc-schema-types/configuration.gen.ts @@ -2,81 +2,98 @@ import * as S from 'effect/Schema'; export const DataType = S.Literal( - "string", - "secureString", - "int", - "bool", - "object", - "secureObject", - "array" + 'string', + 'secureString', + 'int', + 'bool', + 'object', + 'secureObject', + 'array', ); export type DataType = S.Schema.Type; export const Parameter = S.Struct({ - "type": DataType, - "defaultValue": S.optional(S.Unknown), - "allowedValues": S.optional(S.NullOr(S.Array(S.Unknown))), - "minValue": S.optional(S.NullOr(S.Number)), - "maxValue": S.optional(S.NullOr(S.Number)), - "minLength": S.optional(S.NullOr(S.Number)), - "maxLength": S.optional(S.NullOr(S.Number)), - "description": S.optional(S.NullOr(S.String)), - "metadata": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))) + type: DataType, + defaultValue: S.optional(S.Unknown), + allowedValues: S.optional(S.NullOr(S.Array(S.Unknown))), + minValue: S.optional(S.NullOr(S.Number)), + maxValue: S.optional(S.NullOr(S.Number)), + minLength: S.optional(S.NullOr(S.Number)), + maxLength: S.optional(S.NullOr(S.Number)), + description: S.optional(S.NullOr(S.String)), + metadata: S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))), }); export type Parameter = S.Schema.Type; export const Resource = S.Struct({ - "type": S.String, - "name": S.String, - "dependsOn": S.optional(S.NullOr(S.Array(S.String))), - "properties": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))), - "metadata": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))) + type: S.String, + name: S.String, + dependsOn: S.optional(S.NullOr(S.Array(S.String))), + properties: S.optional( + S.NullOr(S.Record({ key: S.String, value: S.Unknown })), + ), + metadata: S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))), }); export type Resource = S.Schema.Type; -export const Operation = S.Literal( - "get", - "set", - "test", - "export" -); +export const Operation = S.Literal('get', 'set', 'test', 'export'); export type Operation = S.Schema.Type; -export const ExecutionKind = S.Literal( - "actual", - "whatIf" -); +export const ExecutionKind = S.Literal('actual', 'whatIf'); export type ExecutionKind = S.Schema.Type; export const SecurityContextKind = S.Literal( - "current", - "elevated", - "restricted" + 'current', + 'elevated', + 'restricted', ); export type SecurityContextKind = S.Schema.Type; export const MicrosoftDscMetadata = S.Struct({ - "version": S.optional(S.NullOr(S.String)), - "operation": S.optional(S.NullOr(Operation)), - "executionType": S.optional(S.NullOr(ExecutionKind)), - "startDatetime": S.optional(S.NullOr(S.String)), - "endDatetime": S.optional(S.NullOr(S.String)), - "duration": S.optional(S.NullOr(S.String)), - "securityContext": S.optional(S.NullOr(SecurityContextKind)) + version: S.optional(S.NullOr(S.String)), + operation: S.optional(S.NullOr(Operation)), + executionType: S.optional(S.NullOr(ExecutionKind)), + startDatetime: S.optional(S.NullOr(S.String)), + endDatetime: S.optional(S.NullOr(S.String)), + duration: S.optional(S.NullOr(S.String)), + securityContext: S.optional(S.NullOr(SecurityContextKind)), }); export type MicrosoftDscMetadata = S.Schema.Type; export const Metadata = S.Struct({ - "Microsoft.DSC": S.optional(S.NullOr(MicrosoftDscMetadata)) + 'Microsoft.DSC': S.optional(S.NullOr(MicrosoftDscMetadata)), }); export type Metadata = S.Schema.Type; export const Configuration = S.Struct({ - "$schema": S.Literal("https://aka.ms/dsc/schemas/v3/bundled/config/document.json", "https://aka.ms/dsc/schemas/v3.0/bundled/config/document.json", "https://aka.ms/dsc/schemas/v3.0.0/bundled/config/document.json", "https://aka.ms/dsc/schemas/v3/bundled/config/document.vscode.json", "https://aka.ms/dsc/schemas/v3.0/bundled/config/document.vscode.json", "https://aka.ms/dsc/schemas/v3.0.0/bundled/config/document.vscode.json", "https://aka.ms/dsc/schemas/v3/config/document.json", "https://aka.ms/dsc/schemas/v3.0/config/document.json", "https://aka.ms/dsc/schemas/v3.0.0/config/document.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/config/document.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/config/document.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/config/document.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/config/document.vscode.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/config/document.vscode.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/config/document.vscode.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/config/document.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/config/document.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/config/document.json"), - "contentVersion": S.optional(S.NullOr(S.String)), - "parameters": S.optional(S.NullOr(S.Record({ key: S.String, value: Parameter }))), - "variables": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))), - "resources": S.Array(Resource), - "metadata": S.optional(S.NullOr(Metadata)) + $schema: S.Literal( + 'https://aka.ms/dsc/schemas/v3/bundled/config/document.json', + 'https://aka.ms/dsc/schemas/v3.0/bundled/config/document.json', + 'https://aka.ms/dsc/schemas/v3.0.0/bundled/config/document.json', + 'https://aka.ms/dsc/schemas/v3/bundled/config/document.vscode.json', + 'https://aka.ms/dsc/schemas/v3.0/bundled/config/document.vscode.json', + 'https://aka.ms/dsc/schemas/v3.0.0/bundled/config/document.vscode.json', + 'https://aka.ms/dsc/schemas/v3/config/document.json', + 'https://aka.ms/dsc/schemas/v3.0/config/document.json', + 'https://aka.ms/dsc/schemas/v3.0.0/config/document.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/config/document.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/config/document.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/config/document.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/config/document.vscode.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/config/document.vscode.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/config/document.vscode.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/config/document.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/config/document.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/config/document.json', + ), + contentVersion: S.optional(S.NullOr(S.String)), + parameters: S.optional( + S.NullOr(S.Record({ key: S.String, value: Parameter })), + ), + variables: S.optional( + S.NullOr(S.Record({ key: S.String, value: S.Unknown })), + ), + resources: S.Array(Resource), + metadata: S.optional(S.NullOr(Metadata)), }); export type Configuration = S.Schema.Type; diff --git a/src/dsc-schema-types/dsc-resource.gen.ts b/src/dsc-schema-types/dsc-resource.gen.ts index 372b402..b70a335 100644 --- a/src/dsc-schema-types/dsc-resource.gen.ts +++ b/src/dsc-schema-types/dsc-resource.gen.ts @@ -2,36 +2,41 @@ import * as S from 'effect/Schema'; export const Kind = S.Literal( - "adapter", - "exporter", - "group", - "importer", - "resource" + 'adapter', + 'exporter', + 'group', + 'importer', + 'resource', ); export type Kind = S.Schema.Type; -export const Capability = S.Union(S.Literal("get"), S.Literal("set"), S.Literal("setHandlesExist"), S.Literal("whatIf"), S.Literal("test"), S.Literal("delete"), S.Literal("export"), S.Literal("resolve")); +export const Capability = S.Union( + S.Literal('get'), + S.Literal('set'), + S.Literal('setHandlesExist'), + S.Literal('whatIf'), + S.Literal('test'), + S.Literal('delete'), + S.Literal('export'), + S.Literal('resolve'), +); export type Capability = S.Schema.Type; export const ImplementedAs = S.NullOr(S.String); export type ImplementedAs = S.Schema.Type; export const DscResource = S.Struct({ - "type": S.String, - "kind": S.Struct({ - -}), - "version": S.String, - "capabilities": S.Array(Capability), - "path": S.String, - "description": S.optional(S.NullOr(S.String)), - "directory": S.String, - "implementedAs": S.Struct({ - -}), - "author": S.optional(S.NullOr(S.String)), - "properties": S.Array(S.String), - "requireAdapter": S.optional(S.NullOr(S.String)), - "manifest": S.optional(S.Unknown) + type: S.String, + kind: S.Struct({}), + version: S.String, + capabilities: S.Array(Capability), + path: S.String, + description: S.optional(S.NullOr(S.String)), + directory: S.String, + implementedAs: S.Struct({}), + author: S.optional(S.NullOr(S.String)), + properties: S.Array(S.String), + requireAdapter: S.optional(S.NullOr(S.String)), + manifest: S.optional(S.Unknown), }); export type DscResource = S.Schema.Type; diff --git a/src/dsc-schema-types/get-result.gen.ts b/src/dsc-schema-types/get-result.gen.ts index 59069b5..1f8da47 100644 --- a/src/dsc-schema-types/get-result.gen.ts +++ b/src/dsc-schema-types/get-result.gen.ts @@ -2,62 +2,57 @@ import * as S from 'effect/Schema'; export const ResourceGetResponse = S.Struct({ - "actualState": S.Unknown + actualState: S.Unknown, }); export type ResourceGetResponse = S.Schema.Type; -export const Operation = S.Literal( - "get", - "set", - "test", - "export" -); +export const Operation = S.Literal('get', 'set', 'test', 'export'); export type Operation = S.Schema.Type; -export const ExecutionKind = S.Literal( - "actual", - "whatIf" -); +export const ExecutionKind = S.Literal('actual', 'whatIf'); export type ExecutionKind = S.Schema.Type; export const SecurityContextKind = S.Literal( - "current", - "elevated", - "restricted" + 'current', + 'elevated', + 'restricted', ); export type SecurityContextKind = S.Schema.Type; export const MicrosoftDscMetadata = S.Struct({ - "version": S.optional(S.NullOr(S.String)), - "operation": S.optional(S.NullOr(Operation)), - "executionType": S.optional(S.NullOr(ExecutionKind)), - "startDatetime": S.optional(S.NullOr(S.String)), - "endDatetime": S.optional(S.NullOr(S.String)), - "duration": S.optional(S.NullOr(S.String)), - "securityContext": S.optional(S.NullOr(SecurityContextKind)) + version: S.optional(S.NullOr(S.String)), + operation: S.optional(S.NullOr(Operation)), + executionType: S.optional(S.NullOr(ExecutionKind)), + startDatetime: S.optional(S.NullOr(S.String)), + endDatetime: S.optional(S.NullOr(S.String)), + duration: S.optional(S.NullOr(S.String)), + securityContext: S.optional(S.NullOr(SecurityContextKind)), }); export type MicrosoftDscMetadata = S.Schema.Type; export const Metadata = S.Struct({ - "Microsoft.DSC": S.optional(S.NullOr(MicrosoftDscMetadata)) + 'Microsoft.DSC': S.optional(S.NullOr(MicrosoftDscMetadata)), }); export type Metadata = S.Schema.Type; // Recursive type declarations interface ResourceGetResult { - readonly "metadata"?: Metadata | null; - readonly "name": string; - readonly "type": string; - readonly "result": GetResult + readonly metadata?: Metadata | null; + readonly name: string; + readonly type: string; + readonly result: GetResult; } -type GetResult = ResourceGetResponse | ReadonlyArray +type GetResult = ResourceGetResponse | ReadonlyArray; // Recursive schema definitions export const ResourceGetResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "name": S.String, - "type": S.String, - "result": S.suspend((): S.Schema => GetResult) + metadata: S.optional(S.NullOr(Metadata)), + name: S.String, + type: S.String, + result: S.suspend((): S.Schema => GetResult), }) as unknown as S.Schema; -export const GetResult = S.Union(ResourceGetResponse, S.Array(S.suspend((): S.Schema => ResourceGetResult))) as unknown as S.Schema; +export const GetResult = S.Union( + ResourceGetResponse, + S.Array(S.suspend((): S.Schema => ResourceGetResult)), +) as unknown as S.Schema; diff --git a/src/dsc-schema-types/include.gen.ts b/src/dsc-schema-types/include.gen.ts index 9d60218..c4480b4 100644 --- a/src/dsc-schema-types/include.gen.ts +++ b/src/dsc-schema-types/include.gen.ts @@ -1,9 +1,12 @@ // This file is auto-generated. Do not edit manually. import * as S from 'effect/Schema'; -export const Include = S.Union(S.Struct({ - "configurationFile": S.String -}), S.Struct({ - "configurationContent": S.String -})); +export const Include = S.Union( + S.Struct({ + configurationFile: S.String, + }), + S.Struct({ + configurationContent: S.String, + }), +); export type Include = S.Schema.Type; diff --git a/src/dsc-schema-types/resolve-result.gen.ts b/src/dsc-schema-types/resolve-result.gen.ts index bd35c41..1913702 100644 --- a/src/dsc-schema-types/resolve-result.gen.ts +++ b/src/dsc-schema-types/resolve-result.gen.ts @@ -2,7 +2,9 @@ import * as S from 'effect/Schema'; export const ResolveResult = S.Struct({ - "configuration": S.Unknown, - "parameters": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))) + configuration: S.Unknown, + parameters: S.optional( + S.NullOr(S.Record({ key: S.String, value: S.Unknown })), + ), }); export type ResolveResult = S.Schema.Type; diff --git a/src/dsc-schema-types/resource-manifest.gen.ts b/src/dsc-schema-types/resource-manifest.gen.ts index aa090c3..a1d7f0a 100644 --- a/src/dsc-schema-types/resource-manifest.gen.ts +++ b/src/dsc-schema-types/resource-manifest.gen.ts @@ -2,128 +2,152 @@ import * as S from 'effect/Schema'; export const Kind = S.Literal( - "adapter", - "exporter", - "group", - "importer", - "resource" + 'adapter', + 'exporter', + 'group', + 'importer', + 'resource', ); export type Kind = S.Schema.Type; -export const ArgKind = S.Union(S.String, S.Struct({ - "jsonInputArg": S.String, - "mandatory": S.optional(S.NullOr(S.Boolean)) -})); +export const ArgKind = S.Union( + S.String, + S.Struct({ + jsonInputArg: S.String, + mandatory: S.optional(S.NullOr(S.Boolean)), + }), +); export type ArgKind = S.Schema.Type; -export const InputKind = S.Union(S.Literal("env"), S.Literal("stdin")); +export const InputKind = S.Union(S.Literal('env'), S.Literal('stdin')); export type InputKind = S.Schema.Type; export const GetMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(ArgKind))), - "input": S.optional(S.NullOr(InputKind)) + executable: S.String, + args: S.optional(S.NullOr(S.Array(ArgKind))), + input: S.optional(S.NullOr(InputKind)), }); export type GetMethod = S.Schema.Type; -export const ReturnKind = S.Union(S.Literal("state"), S.Literal("stateAndDiff")); +export const ReturnKind = S.Union( + S.Literal('state'), + S.Literal('stateAndDiff'), +); export type ReturnKind = S.Schema.Type; export const SetMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(ArgKind))), - "input": S.optional(S.NullOr(InputKind)), - "implementsPretest": S.optional(S.NullOr(S.Boolean)), - "handlesExist": S.optional(S.NullOr(S.Boolean)), - "return": S.optional(S.NullOr(ReturnKind)) + executable: S.String, + args: S.optional(S.NullOr(S.Array(ArgKind))), + input: S.optional(S.NullOr(InputKind)), + implementsPretest: S.optional(S.NullOr(S.Boolean)), + handlesExist: S.optional(S.NullOr(S.Boolean)), + return: S.optional(S.NullOr(ReturnKind)), }); export type SetMethod = S.Schema.Type; export const TestMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(ArgKind))), - "input": S.optional(S.NullOr(InputKind)), - "return": S.optional(S.NullOr(ReturnKind)) + executable: S.String, + args: S.optional(S.NullOr(S.Array(ArgKind))), + input: S.optional(S.NullOr(InputKind)), + return: S.optional(S.NullOr(ReturnKind)), }); export type TestMethod = S.Schema.Type; export const DeleteMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(ArgKind))), - "input": S.optional(S.NullOr(InputKind)) + executable: S.String, + args: S.optional(S.NullOr(S.Array(ArgKind))), + input: S.optional(S.NullOr(InputKind)), }); export type DeleteMethod = S.Schema.Type; export const ExportMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(ArgKind))), - "input": S.optional(S.NullOr(InputKind)) + executable: S.String, + args: S.optional(S.NullOr(S.Array(ArgKind))), + input: S.optional(S.NullOr(InputKind)), }); export type ExportMethod = S.Schema.Type; export const ResolveMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(ArgKind))), - "input": S.optional(S.NullOr(InputKind)) + executable: S.String, + args: S.optional(S.NullOr(S.Array(ArgKind))), + input: S.optional(S.NullOr(InputKind)), }); export type ResolveMethod = S.Schema.Type; export const ValidateMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(ArgKind))), - "input": S.optional(S.NullOr(InputKind)) + executable: S.String, + args: S.optional(S.NullOr(S.Array(ArgKind))), + input: S.optional(S.NullOr(InputKind)), }); export type ValidateMethod = S.Schema.Type; export const ListMethod = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(S.String))) + executable: S.String, + args: S.optional(S.NullOr(S.Array(S.String))), }); export type ListMethod = S.Schema.Type; -export const ConfigKind = S.Union(S.Literal("full"), S.Literal("sequence")); +export const ConfigKind = S.Union(S.Literal('full'), S.Literal('sequence')); export type ConfigKind = S.Schema.Type; export const Adapter = S.Struct({ - "list": S.Struct({ - -}), - "config": S.Struct({ - -}) + list: S.Struct({}), + config: S.Struct({}), }); export type Adapter = S.Schema.Type; export const SchemaCommand = S.Struct({ - "executable": S.String, - "args": S.optional(S.NullOr(S.Array(S.String))) + executable: S.String, + args: S.optional(S.NullOr(S.Array(S.String))), }); export type SchemaCommand = S.Schema.Type; -export const SchemaKind = S.Union(S.Struct({ - "command": SchemaCommand -}), S.Struct({ - "embedded": S.Unknown -})); +export const SchemaKind = S.Union( + S.Struct({ + command: SchemaCommand, + }), + S.Struct({ + embedded: S.Unknown, + }), +); export type SchemaKind = S.Schema.Type; export const ResourceManifest = S.Struct({ - "$schema": S.Literal("https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json", "https://aka.ms/dsc/schemas/v3.0/bundled/resource/manifest.json", "https://aka.ms/dsc/schemas/v3.0.0/bundled/resource/manifest.json", "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.vscode.json", "https://aka.ms/dsc/schemas/v3.0/bundled/resource/manifest.vscode.json", "https://aka.ms/dsc/schemas/v3.0.0/bundled/resource/manifest.vscode.json", "https://aka.ms/dsc/schemas/v3/resource/manifest.json", "https://aka.ms/dsc/schemas/v3.0/resource/manifest.json", "https://aka.ms/dsc/schemas/v3.0.0/resource/manifest.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/resource/manifest.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/resource/manifest.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/resource/manifest.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/resource/manifest.vscode.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/resource/manifest.vscode.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/resource/manifest.vscode.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/resource/manifest.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/resource/manifest.json", "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/resource/manifest.json"), - "type": S.String, - "kind": S.optional(S.NullOr(Kind)), - "version": S.String, - "description": S.optional(S.NullOr(S.String)), - "tags": S.optional(S.NullOr(S.Array(S.String))), - "get": S.optional(S.NullOr(GetMethod)), - "set": S.optional(S.NullOr(SetMethod)), - "whatIf": S.optional(S.NullOr(SetMethod)), - "test": S.optional(S.NullOr(TestMethod)), - "delete": S.optional(S.NullOr(DeleteMethod)), - "export": S.optional(S.NullOr(ExportMethod)), - "resolve": S.optional(S.NullOr(ResolveMethod)), - "validate": S.optional(S.NullOr(ValidateMethod)), - "adapter": S.optional(S.NullOr(Adapter)), - "exitCodes": S.optional(S.NullOr(S.Record({ key: S.String, value: S.String }))), - "schema": S.optional(S.NullOr(SchemaKind)) + $schema: S.Literal( + 'https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json', + 'https://aka.ms/dsc/schemas/v3.0/bundled/resource/manifest.json', + 'https://aka.ms/dsc/schemas/v3.0.0/bundled/resource/manifest.json', + 'https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.vscode.json', + 'https://aka.ms/dsc/schemas/v3.0/bundled/resource/manifest.vscode.json', + 'https://aka.ms/dsc/schemas/v3.0.0/bundled/resource/manifest.vscode.json', + 'https://aka.ms/dsc/schemas/v3/resource/manifest.json', + 'https://aka.ms/dsc/schemas/v3.0/resource/manifest.json', + 'https://aka.ms/dsc/schemas/v3.0.0/resource/manifest.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/resource/manifest.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/resource/manifest.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/resource/manifest.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/resource/manifest.vscode.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/resource/manifest.vscode.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/resource/manifest.vscode.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/resource/manifest.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/resource/manifest.json', + 'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/resource/manifest.json', + ), + type: S.String, + kind: S.optional(S.NullOr(Kind)), + version: S.String, + description: S.optional(S.NullOr(S.String)), + tags: S.optional(S.NullOr(S.Array(S.String))), + get: S.optional(S.NullOr(GetMethod)), + set: S.optional(S.NullOr(SetMethod)), + whatIf: S.optional(S.NullOr(SetMethod)), + test: S.optional(S.NullOr(TestMethod)), + delete: S.optional(S.NullOr(DeleteMethod)), + export: S.optional(S.NullOr(ExportMethod)), + resolve: S.optional(S.NullOr(ResolveMethod)), + validate: S.optional(S.NullOr(ValidateMethod)), + adapter: S.optional(S.NullOr(Adapter)), + exitCodes: S.optional(S.NullOr(S.Record({ key: S.String, value: S.String }))), + schema: S.optional(S.NullOr(SchemaKind)), }); export type ResourceManifest = S.Schema.Type; diff --git a/src/dsc-schema-types/set-result.gen.ts b/src/dsc-schema-types/set-result.gen.ts index 1727df1..50d26de 100644 --- a/src/dsc-schema-types/set-result.gen.ts +++ b/src/dsc-schema-types/set-result.gen.ts @@ -2,64 +2,59 @@ import * as S from 'effect/Schema'; export const ResourceSetResponse = S.Struct({ - "beforeState": S.Unknown, - "afterState": S.Unknown, - "changedProperties": S.optional(S.NullOr(S.Array(S.String))) + beforeState: S.Unknown, + afterState: S.Unknown, + changedProperties: S.optional(S.NullOr(S.Array(S.String))), }); export type ResourceSetResponse = S.Schema.Type; -export const Operation = S.Literal( - "get", - "set", - "test", - "export" -); +export const Operation = S.Literal('get', 'set', 'test', 'export'); export type Operation = S.Schema.Type; -export const ExecutionKind = S.Literal( - "actual", - "whatIf" -); +export const ExecutionKind = S.Literal('actual', 'whatIf'); export type ExecutionKind = S.Schema.Type; export const SecurityContextKind = S.Literal( - "current", - "elevated", - "restricted" + 'current', + 'elevated', + 'restricted', ); export type SecurityContextKind = S.Schema.Type; export const MicrosoftDscMetadata = S.Struct({ - "version": S.optional(S.NullOr(S.String)), - "operation": S.optional(S.NullOr(Operation)), - "executionType": S.optional(S.NullOr(ExecutionKind)), - "startDatetime": S.optional(S.NullOr(S.String)), - "endDatetime": S.optional(S.NullOr(S.String)), - "duration": S.optional(S.NullOr(S.String)), - "securityContext": S.optional(S.NullOr(SecurityContextKind)) + version: S.optional(S.NullOr(S.String)), + operation: S.optional(S.NullOr(Operation)), + executionType: S.optional(S.NullOr(ExecutionKind)), + startDatetime: S.optional(S.NullOr(S.String)), + endDatetime: S.optional(S.NullOr(S.String)), + duration: S.optional(S.NullOr(S.String)), + securityContext: S.optional(S.NullOr(SecurityContextKind)), }); export type MicrosoftDscMetadata = S.Schema.Type; export const Metadata = S.Struct({ - "Microsoft.DSC": S.optional(S.NullOr(MicrosoftDscMetadata)) + 'Microsoft.DSC': S.optional(S.NullOr(MicrosoftDscMetadata)), }); export type Metadata = S.Schema.Type; // Recursive type declarations interface ResourceSetResult { - readonly "metadata"?: Metadata | null; - readonly "name": string; - readonly "type": string; - readonly "result": SetResult + readonly metadata?: Metadata | null; + readonly name: string; + readonly type: string; + readonly result: SetResult; } -type SetResult = ResourceSetResponse | ReadonlyArray +type SetResult = ResourceSetResponse | ReadonlyArray; // Recursive schema definitions export const ResourceSetResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "name": S.String, - "type": S.String, - "result": S.suspend((): S.Schema => SetResult) + metadata: S.optional(S.NullOr(Metadata)), + name: S.String, + type: S.String, + result: S.suspend((): S.Schema => SetResult), }) as unknown as S.Schema; -export const SetResult = S.Union(ResourceSetResponse, S.Array(S.suspend((): S.Schema => ResourceSetResult))) as unknown as S.Schema; +export const SetResult = S.Union( + ResourceSetResponse, + S.Array(S.suspend((): S.Schema => ResourceSetResult)), +) as unknown as S.Schema; diff --git a/src/dsc-schema-types/test-result.gen.ts b/src/dsc-schema-types/test-result.gen.ts index 65d708b..71470ca 100644 --- a/src/dsc-schema-types/test-result.gen.ts +++ b/src/dsc-schema-types/test-result.gen.ts @@ -2,65 +2,60 @@ import * as S from 'effect/Schema'; export const ResourceTestResponse = S.Struct({ - "desiredState": S.Unknown, - "actualState": S.Unknown, - "inDesiredState": S.Boolean, - "differingProperties": S.Array(S.String) + desiredState: S.Unknown, + actualState: S.Unknown, + inDesiredState: S.Boolean, + differingProperties: S.Array(S.String), }); export type ResourceTestResponse = S.Schema.Type; -export const Operation = S.Literal( - "get", - "set", - "test", - "export" -); +export const Operation = S.Literal('get', 'set', 'test', 'export'); export type Operation = S.Schema.Type; -export const ExecutionKind = S.Literal( - "actual", - "whatIf" -); +export const ExecutionKind = S.Literal('actual', 'whatIf'); export type ExecutionKind = S.Schema.Type; export const SecurityContextKind = S.Literal( - "current", - "elevated", - "restricted" + 'current', + 'elevated', + 'restricted', ); export type SecurityContextKind = S.Schema.Type; export const MicrosoftDscMetadata = S.Struct({ - "version": S.optional(S.NullOr(S.String)), - "operation": S.optional(S.NullOr(Operation)), - "executionType": S.optional(S.NullOr(ExecutionKind)), - "startDatetime": S.optional(S.NullOr(S.String)), - "endDatetime": S.optional(S.NullOr(S.String)), - "duration": S.optional(S.NullOr(S.String)), - "securityContext": S.optional(S.NullOr(SecurityContextKind)) + version: S.optional(S.NullOr(S.String)), + operation: S.optional(S.NullOr(Operation)), + executionType: S.optional(S.NullOr(ExecutionKind)), + startDatetime: S.optional(S.NullOr(S.String)), + endDatetime: S.optional(S.NullOr(S.String)), + duration: S.optional(S.NullOr(S.String)), + securityContext: S.optional(S.NullOr(SecurityContextKind)), }); export type MicrosoftDscMetadata = S.Schema.Type; export const Metadata = S.Struct({ - "Microsoft.DSC": S.optional(S.NullOr(MicrosoftDscMetadata)) + 'Microsoft.DSC': S.optional(S.NullOr(MicrosoftDscMetadata)), }); export type Metadata = S.Schema.Type; // Recursive type declarations interface ResourceTestResult { - readonly "metadata"?: Metadata | null; - readonly "name": string; - readonly "type": string; - readonly "result": TestResult + readonly metadata?: Metadata | null; + readonly name: string; + readonly type: string; + readonly result: TestResult; } -type TestResult = ResourceTestResponse | ReadonlyArray +type TestResult = ResourceTestResponse | ReadonlyArray; // Recursive schema definitions export const ResourceTestResult = S.Struct({ - "metadata": S.optional(S.NullOr(Metadata)), - "name": S.String, - "type": S.String, - "result": S.suspend((): S.Schema => TestResult) + metadata: S.optional(S.NullOr(Metadata)), + name: S.String, + type: S.String, + result: S.suspend((): S.Schema => TestResult), }) as unknown as S.Schema; -export const TestResult = S.Union(ResourceTestResponse, S.Array(S.suspend((): S.Schema => ResourceTestResult))) as unknown as S.Schema; +export const TestResult = S.Union( + ResourceTestResponse, + S.Array(S.suspend((): S.Schema => ResourceTestResult)), +) as unknown as S.Schema; diff --git a/src/dsc-utils.ts b/src/dsc-utils.ts new file mode 100644 index 0000000..f5c0c41 --- /dev/null +++ b/src/dsc-utils.ts @@ -0,0 +1,123 @@ +import { Effect, Console, Schema as S } from 'effect'; +import type { + ConfigurationTestResult, + ResourceTestResponse, +} from './dsc-schema-types/configuration-test-result.gen'; +import { ConfigurationTestResult as ConfigurationTestResultSchema } from './dsc-schema-types/configuration-test-result.gen'; +import type { + ConfigurationSetResult, + ResourceSetResponse, +} from './dsc-schema-types/configuration-set-result.gen'; +import { ConfigurationSetResult as ConfigurationSetResultSchema } from './dsc-schema-types/configuration-set-result.gen'; + +/** + * Decodes and pretty-logs the result of a DSC configuration test operation. + */ +export const decodeAndPrettyLogTestResult = (stdout: string) => + Effect.gen(function* () { + const raw = JSON.parse(stdout); + const result = yield* S.decodeUnknown(ConfigurationTestResultSchema)(raw); + + const allInDesiredState = result.results.every((res) => + 'inDesiredState' in res.result + ? (res.result as ResourceTestResponse).inDesiredState + : true, + ); + + yield* Console.log('\n--- DSC Test Result Summary ---'); + + if (result.hadErrors) { + yield* Console.error('🔴 Execution errors occurred during testing.'); + } + + if (allInDesiredState) { + yield* Console.log('✅ All resources are in the desired state.'); + } else { + yield* Console.log('⚠️ Some resources are NOT in the desired state.'); + } + + for (const res of result.results) { + if ('inDesiredState' in res.result) { + const testResponse = res.result as ResourceTestResponse; + const status = testResponse.inDesiredState ? '✅' : '❌'; + yield* Console.log(`${status} [${res.type}] ${res.name}`); + + if ( + !testResponse.inDesiredState && + testResponse.differingProperties.length > 0 + ) { + yield* Console.log( + ` Differing properties: ${testResponse.differingProperties.join(', ')}`, + ); + + for (const prop of testResponse.differingProperties) { + const desired = (testResponse.desiredState as any)?.[prop]; + const actual = (testResponse.actualState as any)?.[prop]; + yield* Console.log(` - ${prop}:`); + yield* Console.log(` Desired: ${JSON.stringify(desired)}`); + yield* Console.log(` Actual: ${JSON.stringify(actual)}`); + } + } + } else { + yield* Console.log(`📦 [Group: ${res.type}] ${res.name}`); + } + } + + if (result.messages.length > 0) { + yield* Console.log('\nMessages:'); + for (const msg of result.messages) { + const icon = + msg.level === 'error' ? '🔴' : msg.level === 'warning' ? '🟠' : '🔵'; + yield* Console.log(`${icon} [${msg.type}] ${msg.message}`); + } + } + + yield* Console.log('-------------------------------\n'); + }); + +/** + * Decodes and pretty-logs the result of a DSC configuration set operation. + */ +export const decodeAndPrettyLogSetResult = (stdout: string) => + Effect.gen(function* () { + const raw = JSON.parse(stdout); + const result = yield* S.decodeUnknown(ConfigurationSetResultSchema)(raw); + + yield* Console.log('\n--- DSC Set Result Summary ---'); + + if (result.hadErrors) { + yield* Console.error('❌ Configuration set completed with errors.'); + } else { + yield* Console.log('✅ Configuration set completed successfully.'); + } + + for (const res of result.results) { + if ('afterState' in res.result) { + const setResponse = res.result as ResourceSetResponse; + const changed = + setResponse.changedProperties && + setResponse.changedProperties.length > 0; + const status = changed ? '🔄' : '✅'; + yield* Console.log(`${status} [${res.type}] ${res.name}`); + + if (changed) { + yield* Console.log( + ` Changed properties: ${setResponse.changedProperties!.join(', ')}`, + ); + } + } else { + yield* Console.log(`📦 [Group: ${res.type}] ${res.name}`); + } + } + + if (result.messages.length > 0) { + yield* Console.log('\nMessages:'); + for (const msg of result.messages) { + const icon = + msg.level === 'error' ? '🔴' : msg.level === 'warning' ? '🟠' : '🔵'; + yield* Console.log(`${icon} [${msg.type}] ${msg.message}`); + } + } + + yield* Console.log('-------------------------------\n'); + }); diff --git a/src/dsl.ts b/src/dsl.ts new file mode 100644 index 0000000..8d5a2f2 --- /dev/null +++ b/src/dsl.ts @@ -0,0 +1,36 @@ +import * as S from 'effect/Schema'; +import { ResourceUnion } from './dsc-resource-schema-types/_resource-union.gen'; +import { Configuration as DscConfiguration } from './dsc-schema-types/configuration.gen'; + +/** + * Enhanced configuration schema with strong typing for resources. + * This extends the base DSC Configuration schema but overrides the 'resources' + * field with our strongly-typed union of all resources available on this system. + */ +export const Configuration = S.Struct({ + ...DscConfiguration.fields, + resources: S.Array(ResourceUnion), +}); + +export type Configuration = S.Schema.Type; + +/** + * Helper to define a configuration with full type safety. + * This provides a nice developer experience when defining the system state. + * + * @example + * const myConfig = defineConfig({ + * $schema: 'https://aka.ms/dsc/schemas/v3/config/document.json', + * resources: [ + * { + * type: 'Microsoft.WinGet/Package', + * name: 'Install VSCode', + * properties: { + * id: 'Microsoft.VisualStudioCode', + * ensure: 'Present' + * } + * } + * ] + * }); + */ +export const defineConfig = (config: Configuration): Configuration => config; diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..fd4a949 --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,59 @@ +import { Command, Path } from '@effect/platform'; + +import { Effect, Option, pipe, Stream, String } from 'effect'; + +export const CommandUtils = { + withLog: ( + cmd: Command.Command, + runner: (cmd: Command.Command) => Effect.Effect, + ) => + Effect.gen(function* () { + const flattenedCmd = Command.flatten(cmd); + const [firstCmd] = flattenedCmd; + yield* Effect.logDebug( + `Running: '${flattenedCmd + .map((c) => `${c.command} ${c.args.join(' ')}`) + .join(' | ')}' in ${Option.getOrElse(firstCmd.cwd, () => '.')}`, + ); + return yield* runner(cmd); + }), + /** + * Command.workingDirectory does not set the PWD env var. + */ + withCwd: (cwd: string) => + Effect.gen(function* () { + const path = yield* Path.Path; + const absoluteCwd = path.resolve(path.join(process.cwd(), cwd)); + return (cmd: Command.Command) => + cmd.pipe( + Command.workingDirectory(absoluteCwd), + Command.env({ PWD: absoluteCwd }), + ); + }), + bufferStringStream: ( + stream: Stream.Stream, + ): Effect.Effect => + stream.pipe( + Stream.decodeText(), + Stream.runFold(String.empty, String.concat), + ), + runCommandBuffered: (command: Command.Command) => + pipe( + Command.start(command), + Effect.flatMap((process) => + Effect.all( + [ + process.exitCode, + CommandUtils.bufferStringStream(process.stdout), + CommandUtils.bufferStringStream(process.stderr), + ], + { concurrency: 3 }, + ), + ), + Effect.map(([exitCode, stdout, stderr]) => ({ + exitCode, + stdout, + stderr, + })), + ), +};