script update
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -34,3 +34,5 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||
.DS_Store
|
||||
|
||||
.turbo
|
||||
|
||||
tmp.*
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "winos-config",
|
||||
"version": "0.0.1",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"packageManager": "bun@1.3.3",
|
||||
@@ -24,7 +23,6 @@
|
||||
"@biomejs/biome": "2.3.8",
|
||||
"@effect/language-service": "^0.57.1",
|
||||
"@types/bun": "latest",
|
||||
"quicktype": "^23.2.6",
|
||||
"turbo": "^2.6.1",
|
||||
"typescript": "^5.9.3",
|
||||
"ultracite": "6.3.8"
|
||||
|
||||
@@ -1,24 +1,120 @@
|
||||
import { Command, FileSystem, Path } from '@effect/platform';
|
||||
import { BunContext, BunRuntime } from '@effect/platform-bun';
|
||||
import { Effect, Logger, LogLevel } from 'effect';
|
||||
import { jsonSchemaToEffectSchema, runCommand } from './lib/script-utils';
|
||||
import { Effect, Logger, LogLevel, Schema as S } from 'effect';
|
||||
import { jsonSchemaToEffectSchema } from './lib/script-utils';
|
||||
|
||||
const getDscResourceJsonSchema = (resourceType: string) =>
|
||||
// Schema for DSC resource list output
|
||||
const DscResourceSchema = S.Struct({
|
||||
type: S.String,
|
||||
kind: S.String,
|
||||
version: S.String,
|
||||
capabilities: S.Array(S.String),
|
||||
path: S.String,
|
||||
description: S.NullOr(S.String),
|
||||
directory: S.String,
|
||||
manifest: S.Struct({
|
||||
$schema: S.String,
|
||||
type: S.String,
|
||||
version: S.String,
|
||||
description: S.optional(S.NullOr(S.String)),
|
||||
schema: S.optional(
|
||||
S.NullOr(
|
||||
S.Union(
|
||||
S.Struct({
|
||||
command: S.Struct({
|
||||
executable: S.String,
|
||||
args: S.NullOr(S.Array(S.String)),
|
||||
}),
|
||||
}),
|
||||
S.Struct({
|
||||
embedded: S.Unknown,
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
}),
|
||||
});
|
||||
|
||||
type DscResource = S.Schema.Type<typeof DscResourceSchema>;
|
||||
|
||||
/**
|
||||
* Sanitize a resource type name to be a valid TypeScript identifier and filename
|
||||
* e.g., "Microsoft.WinGet/Package" -> "MicrosoftWinGetPackage"
|
||||
*/
|
||||
const sanitizeTypeName = (resourceType: string): string => {
|
||||
return resourceType
|
||||
.replace(/[/\\]/g, '') // Remove slashes
|
||||
.replace(/\./g, '') // Remove dots
|
||||
.replace(/[^a-zA-Z0-9]/g, ''); // Remove any other invalid chars
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert resource type to a safe filename
|
||||
* e.g., "Microsoft.WinGet/Package" -> "microsoft-winget-package"
|
||||
*/
|
||||
const toSafeFilename = (resourceType: string): string => {
|
||||
return resourceType
|
||||
.replace(/[/\\]/g, '-') // Replace slashes with hyphens
|
||||
.replace(/\./g, '-') // Replace dots with hyphens
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get schema for a DSC resource - either from embedded schema or via `dsc resource schema`
|
||||
*/
|
||||
const getDscResourceSchema = (resource: DscResource) =>
|
||||
Effect.gen(function* () {
|
||||
const commandParts = [
|
||||
'dsc',
|
||||
'resource',
|
||||
'schema',
|
||||
'--resource',
|
||||
resourceType,
|
||||
] as const;
|
||||
yield* Effect.logDebug(`Running command: ${commandParts.join(' ')}`);
|
||||
const schemaString = yield* Command.make(...commandParts).pipe(
|
||||
Command.string,
|
||||
);
|
||||
return schemaString.trim();
|
||||
const schema = resource.manifest.schema;
|
||||
|
||||
if (!schema) {
|
||||
yield* Effect.logDebug(`No schema defined for ${resource.type}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check if it's an embedded schema
|
||||
if ('embedded' in schema) {
|
||||
yield* Effect.logDebug(`Using embedded schema for ${resource.type}`);
|
||||
return JSON.stringify(schema.embedded);
|
||||
}
|
||||
|
||||
// Otherwise, use dsc resource schema command (more reliable than running executable directly)
|
||||
if ('command' in schema) {
|
||||
yield* Effect.logDebug(`Getting schema via DSC CLI for ${resource.type}`);
|
||||
|
||||
const schemaString = yield* Command.make(
|
||||
'dsc',
|
||||
'resource',
|
||||
'schema',
|
||||
'--resource',
|
||||
resource.type,
|
||||
).pipe(Command.string);
|
||||
|
||||
return schemaString.trim();
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
/**
|
||||
* Parse NDJSON output (newline-delimited JSON) from dsc resource list
|
||||
*/
|
||||
const parseNdjson = (output: string): Array<unknown> =>
|
||||
output
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line.length > 0)
|
||||
.map((line) => {
|
||||
try {
|
||||
return JSON.parse(line);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter((obj): obj is unknown => obj !== null);
|
||||
|
||||
/**
|
||||
* Get available DSC resources from the system
|
||||
*/
|
||||
const getAvailableDscResources = () =>
|
||||
Effect.gen(function* () {
|
||||
yield* Effect.logDebug('Getting available DSC resources...');
|
||||
@@ -31,19 +127,104 @@ const getAvailableDscResources = () =>
|
||||
'json',
|
||||
).pipe(Command.string);
|
||||
|
||||
yield* Effect.logDebug(
|
||||
`DSC resources list output: ${dscrResourcesListOutput}`,
|
||||
);
|
||||
// Parse NDJSON output
|
||||
const rawResources = parseNdjson(dscrResourcesListOutput);
|
||||
yield* Effect.log(`Found ${rawResources.length} resources in DSC output`);
|
||||
|
||||
return [] as Array<string>;
|
||||
// Decode each resource with the schema
|
||||
const resources: Array<DscResource> = [];
|
||||
for (const raw of rawResources) {
|
||||
const decoded = S.decodeUnknownOption(DscResourceSchema)(raw);
|
||||
if (decoded._tag === 'Some') {
|
||||
resources.push(decoded.value);
|
||||
} else {
|
||||
// Log which resource failed to parse for debugging
|
||||
const maybeType =
|
||||
typeof raw === 'object' && raw !== null && 'type' in raw
|
||||
? (raw as { type: unknown }).type
|
||||
: 'unknown';
|
||||
yield* Effect.logDebug(`Failed to decode resource: ${maybeType}`);
|
||||
}
|
||||
}
|
||||
|
||||
yield* Effect.log(`Successfully decoded ${resources.length} resources`);
|
||||
return resources;
|
||||
});
|
||||
|
||||
/**
|
||||
* Generate index file that re-exports all types
|
||||
*/
|
||||
const generateIndexFile = (
|
||||
resourceTypes: Array<{ type: string; filename: string; typeName: string }>,
|
||||
) => {
|
||||
const lines = [
|
||||
'// This file is auto-generated. Do not edit manually.',
|
||||
'// Re-exports all DSC resource schema types',
|
||||
'',
|
||||
];
|
||||
|
||||
for (const { filename, typeName } of resourceTypes) {
|
||||
lines.push(`export * as ${typeName} from './${filename}';`);
|
||||
}
|
||||
|
||||
lines.push('');
|
||||
return lines.join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a types list file for all DSC resource configurations
|
||||
*/
|
||||
const generateDscConfigTypes = (
|
||||
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';",
|
||||
'',
|
||||
];
|
||||
|
||||
// Create a resource types literal
|
||||
lines.push('/**');
|
||||
lines.push(' * All available DSC resource types on this system');
|
||||
lines.push(' */');
|
||||
lines.push('export const DscResourceTypes = S.Literal(');
|
||||
for (const { type } of resourceTypes) {
|
||||
lines.push(` "${type}",`);
|
||||
}
|
||||
lines.push(');');
|
||||
lines.push('');
|
||||
lines.push(
|
||||
'export type DscResourceType = S.Schema.Type<typeof DscResourceTypes>;',
|
||||
);
|
||||
lines.push('');
|
||||
|
||||
// Create a map of type to schema import
|
||||
lines.push('/**');
|
||||
lines.push(' * Map of resource type to generated file');
|
||||
lines.push(' */');
|
||||
lines.push('export const ResourceTypeToFile = {');
|
||||
for (const { type, filename } of resourceTypes) {
|
||||
lines.push(` "${type}": "${filename}.gen",`);
|
||||
}
|
||||
lines.push('} as const;');
|
||||
lines.push('');
|
||||
|
||||
return lines.join('\n');
|
||||
};
|
||||
|
||||
const genDscResourcesTypes = Effect.gen(function* () {
|
||||
yield* Effect.log('Starting DSC resources types generation...');
|
||||
|
||||
const availableResourceTypes = yield* getAvailableDscResources();
|
||||
const resources = yield* getAvailableDscResources();
|
||||
|
||||
// Filter to only resources that have schemas and are not adapters
|
||||
// (adapters like PowerShell adapter don't have their own config schema)
|
||||
const resourcesWithSchemas = resources.filter(
|
||||
(r) => r.manifest.schema && r.kind !== 'adapter',
|
||||
);
|
||||
|
||||
yield* Effect.log(
|
||||
`Found available resource types: ${availableResourceTypes.join(', ')}`,
|
||||
`Found ${resourcesWithSchemas.length} resources with schemas (excluding adapters)`,
|
||||
);
|
||||
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
@@ -64,21 +245,92 @@ const genDscResourcesTypes = Effect.gen(function* () {
|
||||
|
||||
yield* fs.makeDirectory(outputDir, { recursive: true });
|
||||
|
||||
for (const schemaType of availableResourceTypes) {
|
||||
yield* Effect.logDebug(`Processing: ${schemaType}`);
|
||||
const generatedTypes: Array<{
|
||||
type: string;
|
||||
filename: string;
|
||||
typeName: string;
|
||||
}> = [];
|
||||
const errors: Array<{ type: string; error: string }> = [];
|
||||
|
||||
const jsonSchema = yield* getDscResourceJsonSchema(schemaType);
|
||||
const effectSchema = yield* jsonSchemaToEffectSchema({
|
||||
jsonSchema,
|
||||
name: schemaType,
|
||||
});
|
||||
for (const resource of resourcesWithSchemas) {
|
||||
yield* Effect.logDebug(`Processing: ${resource.type}`);
|
||||
|
||||
const outputPath = path.join(outputDir, `${schemaType}.gen.ts`);
|
||||
const schemaResult = yield* Effect.either(getDscResourceSchema(resource));
|
||||
|
||||
if (schemaResult._tag === 'Left') {
|
||||
errors.push({
|
||||
type: resource.type,
|
||||
error: String(schemaResult.left),
|
||||
});
|
||||
yield* Effect.logWarning(
|
||||
`Failed to get schema for ${resource.type}: ${schemaResult.left}`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
const jsonSchema = schemaResult.right;
|
||||
if (!jsonSchema) {
|
||||
yield* Effect.logDebug(`No schema available for ${resource.type}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const typeName = sanitizeTypeName(resource.type);
|
||||
const filename = toSafeFilename(resource.type);
|
||||
|
||||
const effectSchemaResult = yield* Effect.either(
|
||||
jsonSchemaToEffectSchema({
|
||||
jsonSchema,
|
||||
name: typeName,
|
||||
}),
|
||||
);
|
||||
|
||||
if (effectSchemaResult._tag === 'Left') {
|
||||
errors.push({
|
||||
type: resource.type,
|
||||
error: String(effectSchemaResult.left),
|
||||
});
|
||||
yield* Effect.logWarning(
|
||||
`Failed to convert schema for ${resource.type}: ${effectSchemaResult.left}`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
const effectSchema = effectSchemaResult.right;
|
||||
const outputPath = path.join(outputDir, `${filename}.gen.ts`);
|
||||
yield* fs.writeFileString(outputPath, effectSchema);
|
||||
|
||||
yield* Effect.log(`Generated: ${schemaType}.gen.ts`);
|
||||
generatedTypes.push({
|
||||
type: resource.type,
|
||||
filename,
|
||||
typeName,
|
||||
});
|
||||
|
||||
yield* Effect.log(`Generated: ${filename}.gen.ts (${resource.type})`);
|
||||
}
|
||||
|
||||
// Generate index file
|
||||
if (generatedTypes.length > 0) {
|
||||
const indexContent = generateIndexFile(generatedTypes);
|
||||
const indexPath = path.join(outputDir, 'index.ts');
|
||||
yield* fs.writeFileString(indexPath, indexContent);
|
||||
yield* Effect.log('Generated: index.ts');
|
||||
|
||||
// Generate types list file
|
||||
const typesListContent = generateDscConfigTypes(generatedTypes);
|
||||
const typesListPath = path.join(outputDir, '_resource-types.gen.ts');
|
||||
yield* fs.writeFileString(typesListPath, typesListContent);
|
||||
yield* Effect.log('Generated: _resource-types.gen.ts');
|
||||
}
|
||||
|
||||
yield* Effect.log('');
|
||||
yield* Effect.log('=== Generation Summary ===');
|
||||
yield* Effect.log(`Successfully generated: ${generatedTypes.length} types`);
|
||||
if (errors.length > 0) {
|
||||
yield* Effect.log(`Failed: ${errors.length} types`);
|
||||
for (const { type, error } of errors) {
|
||||
yield* Effect.logDebug(` - ${type}: ${error}`);
|
||||
}
|
||||
}
|
||||
yield* Effect.log('DSC types generation complete!');
|
||||
});
|
||||
|
||||
|
||||
@@ -17,16 +17,11 @@ const getPossibleDscSchemaTypes = () =>
|
||||
Effect.gen(function* () {
|
||||
yield* Effect.logDebug('Getting possible DSC schema types...');
|
||||
|
||||
const brokenCommand = Command.make(
|
||||
'dsc',
|
||||
'schema',
|
||||
'--type',
|
||||
'something-that-hopefully-never-exists',
|
||||
);
|
||||
const dscSchemaHelp = Command.make('dsc', 'schema', '--help');
|
||||
|
||||
const { stderr: brokenCommandOutput } = yield* runCommand(brokenCommand);
|
||||
const { stdout: dscHelpOutput } = yield* runCommand(dscSchemaHelp);
|
||||
|
||||
const possibleTypes = brokenCommandOutput
|
||||
const possibleTypes = dscHelpOutput
|
||||
.split('\n')
|
||||
.filter((line) => line.includes('possible values:'))
|
||||
.map((line) => {
|
||||
|
||||
34
src/bin.ts
34
src/bin.ts
@@ -3,24 +3,24 @@ import { BunContext, BunRuntime } from '@effect/platform-bun';
|
||||
import { Effect } from 'effect';
|
||||
import pkg from '../package.json' with { type: 'json' };
|
||||
|
||||
// import type { Configuration } from './dsc-schema-types/configuration.gen';
|
||||
import type { Configuration } from './dsc-schema-types/configuration.gen';
|
||||
|
||||
// const machineConfig: typeof Configuration.Type = {
|
||||
// $schema: 'https://aka.ms/dsc/schemas/v3/config/document.json',
|
||||
// resources: [
|
||||
// {
|
||||
// name: 'must be unique',
|
||||
// type: 'Microsoft.Windows/Registry',
|
||||
// properties: {
|
||||
// keyPath: 'HKCU\\example\\key',
|
||||
// valueName: 'Example',
|
||||
// valueData: {
|
||||
// String: 'Example Value',
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// };
|
||||
const machineConfig: typeof Configuration.Type = {
|
||||
$schema: 'https://aka.ms/dsc/schemas/v3/config/document.json',
|
||||
resources: [
|
||||
{
|
||||
name: 'must be unique',
|
||||
type: 'Microsoft.Windows/Registry',
|
||||
properties: {
|
||||
keyPath: 'HKCU\\example\\key',
|
||||
valueName: 'Example',
|
||||
valueData: {
|
||||
String: 'Example Value',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const diffCommand = Command.make('diff', {}, () =>
|
||||
Effect.gen(function* () {
|
||||
|
||||
@@ -1,81 +1,86 @@
|
||||
// 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<typeof Operation>;
|
||||
|
||||
export const ExecutionKind = S.Literal('actual', 'whatIf');
|
||||
export const ExecutionKind = S.Literal(
|
||||
"actual",
|
||||
"whatIf"
|
||||
);
|
||||
export type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||
|
||||
export const SecurityContextKind = S.Literal(
|
||||
'current',
|
||||
'elevated',
|
||||
'restricted',
|
||||
"current",
|
||||
"elevated",
|
||||
"restricted"
|
||||
);
|
||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||
|
||||
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<typeof MicrosoftDscMetadata>;
|
||||
|
||||
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<typeof Metadata>;
|
||||
|
||||
export const ResourceGetResponse = S.Struct({
|
||||
actualState: S.Unknown,
|
||||
"actualState": S.Unknown
|
||||
});
|
||||
export type ResourceGetResponse = S.Schema.Type<typeof ResourceGetResponse>;
|
||||
|
||||
export const MessageLevel = S.Literal('error', 'warning', 'information');
|
||||
export const MessageLevel = S.Literal(
|
||||
"error",
|
||||
"warning",
|
||||
"information"
|
||||
);
|
||||
export type MessageLevel = S.Schema.Type<typeof MessageLevel>;
|
||||
|
||||
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<typeof ResourceMessage>;
|
||||
|
||||
export const ConfigurationGetResult = S.Struct({
|
||||
metadata: S.optional(S.NullOr(Metadata)),
|
||||
results: S.Array(
|
||||
S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult),
|
||||
),
|
||||
messages: S.Array(ResourceMessage),
|
||||
hadErrors: S.Boolean,
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"results": S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult)),
|
||||
"messages": S.Array(ResourceMessage),
|
||||
"hadErrors": S.Boolean
|
||||
});
|
||||
export type ConfigurationGetResult = S.Schema.Type<
|
||||
typeof ConfigurationGetResult
|
||||
>;
|
||||
export type ConfigurationGetResult = S.Schema.Type<typeof ConfigurationGetResult>;
|
||||
|
||||
// Recursive type declarations
|
||||
type ResourceGetResult = {
|
||||
readonly metadata?: Metadata | null;
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly result: GetResult;
|
||||
};
|
||||
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>;
|
||||
interface ResourceGetResult {
|
||||
readonly "metadata"?: Metadata | null;
|
||||
readonly "name": string;
|
||||
readonly "type": string;
|
||||
readonly "result": GetResult
|
||||
}
|
||||
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>
|
||||
|
||||
// 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> => GetResult),
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"name": S.String,
|
||||
"type": S.String,
|
||||
"result": S.suspend((): S.Schema<GetResult> => GetResult)
|
||||
}) as unknown as S.Schema<ResourceGetResult>;
|
||||
|
||||
export const GetResult = S.Union(
|
||||
ResourceGetResponse,
|
||||
S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult)),
|
||||
) as unknown as S.Schema<GetResult>;
|
||||
export const GetResult = S.Union(ResourceGetResponse, S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult))) as unknown as S.Schema<GetResult>;
|
||||
|
||||
@@ -1,83 +1,88 @@
|
||||
// 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<typeof Operation>;
|
||||
|
||||
export const ExecutionKind = S.Literal('actual', 'whatIf');
|
||||
export const ExecutionKind = S.Literal(
|
||||
"actual",
|
||||
"whatIf"
|
||||
);
|
||||
export type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||
|
||||
export const SecurityContextKind = S.Literal(
|
||||
'current',
|
||||
'elevated',
|
||||
'restricted',
|
||||
"current",
|
||||
"elevated",
|
||||
"restricted"
|
||||
);
|
||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||
|
||||
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<typeof MicrosoftDscMetadata>;
|
||||
|
||||
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<typeof Metadata>;
|
||||
|
||||
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<typeof ResourceSetResponse>;
|
||||
|
||||
export const MessageLevel = S.Literal('error', 'warning', 'information');
|
||||
export const MessageLevel = S.Literal(
|
||||
"error",
|
||||
"warning",
|
||||
"information"
|
||||
);
|
||||
export type MessageLevel = S.Schema.Type<typeof MessageLevel>;
|
||||
|
||||
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<typeof ResourceMessage>;
|
||||
|
||||
export const ConfigurationSetResult = S.Struct({
|
||||
metadata: S.optional(S.NullOr(Metadata)),
|
||||
results: S.Array(
|
||||
S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult),
|
||||
),
|
||||
messages: S.Array(ResourceMessage),
|
||||
hadErrors: S.Boolean,
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"results": S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult)),
|
||||
"messages": S.Array(ResourceMessage),
|
||||
"hadErrors": S.Boolean
|
||||
});
|
||||
export type ConfigurationSetResult = S.Schema.Type<
|
||||
typeof ConfigurationSetResult
|
||||
>;
|
||||
export type ConfigurationSetResult = S.Schema.Type<typeof ConfigurationSetResult>;
|
||||
|
||||
// Recursive type declarations
|
||||
type ResourceSetResult = {
|
||||
readonly metadata?: Metadata | null;
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly result: SetResult;
|
||||
};
|
||||
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>;
|
||||
interface ResourceSetResult {
|
||||
readonly "metadata"?: Metadata | null;
|
||||
readonly "name": string;
|
||||
readonly "type": string;
|
||||
readonly "result": SetResult
|
||||
}
|
||||
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>
|
||||
|
||||
// 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> => SetResult),
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"name": S.String,
|
||||
"type": S.String,
|
||||
"result": S.suspend((): S.Schema<SetResult> => SetResult)
|
||||
}) as unknown as S.Schema<ResourceSetResult>;
|
||||
|
||||
export const SetResult = S.Union(
|
||||
ResourceSetResponse,
|
||||
S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult)),
|
||||
) as unknown as S.Schema<SetResult>;
|
||||
export const SetResult = S.Union(ResourceSetResponse, S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult))) as unknown as S.Schema<SetResult>;
|
||||
|
||||
@@ -1,84 +1,89 @@
|
||||
// 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<typeof Operation>;
|
||||
|
||||
export const ExecutionKind = S.Literal('actual', 'whatIf');
|
||||
export const ExecutionKind = S.Literal(
|
||||
"actual",
|
||||
"whatIf"
|
||||
);
|
||||
export type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||
|
||||
export const SecurityContextKind = S.Literal(
|
||||
'current',
|
||||
'elevated',
|
||||
'restricted',
|
||||
"current",
|
||||
"elevated",
|
||||
"restricted"
|
||||
);
|
||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||
|
||||
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<typeof MicrosoftDscMetadata>;
|
||||
|
||||
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<typeof Metadata>;
|
||||
|
||||
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<typeof ResourceTestResponse>;
|
||||
|
||||
export const MessageLevel = S.Literal('error', 'warning', 'information');
|
||||
export const MessageLevel = S.Literal(
|
||||
"error",
|
||||
"warning",
|
||||
"information"
|
||||
);
|
||||
export type MessageLevel = S.Schema.Type<typeof MessageLevel>;
|
||||
|
||||
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<typeof ResourceMessage>;
|
||||
|
||||
export const ConfigurationTestResult = S.Struct({
|
||||
metadata: S.optional(S.NullOr(Metadata)),
|
||||
results: S.Array(
|
||||
S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult),
|
||||
),
|
||||
messages: S.Array(ResourceMessage),
|
||||
hadErrors: S.Boolean,
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"results": S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult)),
|
||||
"messages": S.Array(ResourceMessage),
|
||||
"hadErrors": S.Boolean
|
||||
});
|
||||
export type ConfigurationTestResult = S.Schema.Type<
|
||||
typeof ConfigurationTestResult
|
||||
>;
|
||||
export type ConfigurationTestResult = S.Schema.Type<typeof ConfigurationTestResult>;
|
||||
|
||||
// Recursive type declarations
|
||||
type ResourceTestResult = {
|
||||
readonly metadata?: Metadata | null;
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly result: TestResult;
|
||||
};
|
||||
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>;
|
||||
interface ResourceTestResult {
|
||||
readonly "metadata"?: Metadata | null;
|
||||
readonly "name": string;
|
||||
readonly "type": string;
|
||||
readonly "result": TestResult
|
||||
}
|
||||
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>
|
||||
|
||||
// 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> => TestResult),
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"name": S.String,
|
||||
"type": S.String,
|
||||
"result": S.suspend((): S.Schema<TestResult> => TestResult)
|
||||
}) as unknown as S.Schema<ResourceTestResult>;
|
||||
|
||||
export const TestResult = S.Union(
|
||||
ResourceTestResponse,
|
||||
S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult)),
|
||||
) as unknown as S.Schema<TestResult>;
|
||||
export const TestResult = S.Union(ResourceTestResponse, S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult))) as unknown as S.Schema<TestResult>;
|
||||
|
||||
@@ -2,98 +2,81 @@
|
||||
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<typeof DataType>;
|
||||
|
||||
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<typeof Parameter>;
|
||||
|
||||
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<typeof Resource>;
|
||||
|
||||
export const Operation = S.Literal('get', 'set', 'test', 'export');
|
||||
export const Operation = S.Literal(
|
||||
"get",
|
||||
"set",
|
||||
"test",
|
||||
"export"
|
||||
);
|
||||
export type Operation = S.Schema.Type<typeof Operation>;
|
||||
|
||||
export const ExecutionKind = S.Literal('actual', 'whatIf');
|
||||
export const ExecutionKind = S.Literal(
|
||||
"actual",
|
||||
"whatIf"
|
||||
);
|
||||
export type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||
|
||||
export const SecurityContextKind = S.Literal(
|
||||
'current',
|
||||
'elevated',
|
||||
'restricted',
|
||||
"current",
|
||||
"elevated",
|
||||
"restricted"
|
||||
);
|
||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||
|
||||
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<typeof MicrosoftDscMetadata>;
|
||||
|
||||
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<typeof Metadata>;
|
||||
|
||||
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<typeof Configuration>;
|
||||
|
||||
@@ -2,41 +2,36 @@
|
||||
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<typeof Kind>;
|
||||
|
||||
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<typeof Capability>;
|
||||
|
||||
export const ImplementedAs = S.NullOr(S.String);
|
||||
export type ImplementedAs = S.Schema.Type<typeof ImplementedAs>;
|
||||
|
||||
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<typeof DscResource>;
|
||||
|
||||
@@ -2,57 +2,62 @@
|
||||
import * as S from 'effect/Schema';
|
||||
|
||||
export const ResourceGetResponse = S.Struct({
|
||||
actualState: S.Unknown,
|
||||
"actualState": S.Unknown
|
||||
});
|
||||
export type ResourceGetResponse = S.Schema.Type<typeof ResourceGetResponse>;
|
||||
|
||||
export const Operation = S.Literal('get', 'set', 'test', 'export');
|
||||
export const Operation = S.Literal(
|
||||
"get",
|
||||
"set",
|
||||
"test",
|
||||
"export"
|
||||
);
|
||||
export type Operation = S.Schema.Type<typeof Operation>;
|
||||
|
||||
export const ExecutionKind = S.Literal('actual', 'whatIf');
|
||||
export const ExecutionKind = S.Literal(
|
||||
"actual",
|
||||
"whatIf"
|
||||
);
|
||||
export type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||
|
||||
export const SecurityContextKind = S.Literal(
|
||||
'current',
|
||||
'elevated',
|
||||
'restricted',
|
||||
"current",
|
||||
"elevated",
|
||||
"restricted"
|
||||
);
|
||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||
|
||||
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<typeof MicrosoftDscMetadata>;
|
||||
|
||||
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<typeof Metadata>;
|
||||
|
||||
// Recursive type declarations
|
||||
type ResourceGetResult = {
|
||||
readonly metadata?: Metadata | null;
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly result: GetResult;
|
||||
};
|
||||
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>;
|
||||
interface ResourceGetResult {
|
||||
readonly "metadata"?: Metadata | null;
|
||||
readonly "name": string;
|
||||
readonly "type": string;
|
||||
readonly "result": GetResult
|
||||
}
|
||||
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>
|
||||
|
||||
// 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> => GetResult),
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"name": S.String,
|
||||
"type": S.String,
|
||||
"result": S.suspend((): S.Schema<GetResult> => GetResult)
|
||||
}) as unknown as S.Schema<ResourceGetResult>;
|
||||
|
||||
export const GetResult = S.Union(
|
||||
ResourceGetResponse,
|
||||
S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult)),
|
||||
) as unknown as S.Schema<GetResult>;
|
||||
export const GetResult = S.Union(ResourceGetResponse, S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult))) as unknown as S.Schema<GetResult>;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
// 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<typeof Include>;
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
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<typeof ResolveResult>;
|
||||
|
||||
@@ -2,152 +2,128 @@
|
||||
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<typeof Kind>;
|
||||
|
||||
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<typeof ArgKind>;
|
||||
|
||||
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<typeof InputKind>;
|
||||
|
||||
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<typeof GetMethod>;
|
||||
|
||||
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<typeof ReturnKind>;
|
||||
|
||||
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<typeof SetMethod>;
|
||||
|
||||
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<typeof TestMethod>;
|
||||
|
||||
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<typeof DeleteMethod>;
|
||||
|
||||
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<typeof ExportMethod>;
|
||||
|
||||
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<typeof ResolveMethod>;
|
||||
|
||||
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<typeof ValidateMethod>;
|
||||
|
||||
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<typeof ListMethod>;
|
||||
|
||||
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<typeof ConfigKind>;
|
||||
|
||||
export const Adapter = S.Struct({
|
||||
list: S.Struct({}),
|
||||
config: S.Struct({}),
|
||||
"list": S.Struct({
|
||||
|
||||
}),
|
||||
"config": S.Struct({
|
||||
|
||||
})
|
||||
});
|
||||
export type Adapter = S.Schema.Type<typeof Adapter>;
|
||||
|
||||
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<typeof SchemaCommand>;
|
||||
|
||||
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<typeof SchemaKind>;
|
||||
|
||||
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<typeof ResourceManifest>;
|
||||
|
||||
@@ -2,59 +2,64 @@
|
||||
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<typeof ResourceSetResponse>;
|
||||
|
||||
export const Operation = S.Literal('get', 'set', 'test', 'export');
|
||||
export const Operation = S.Literal(
|
||||
"get",
|
||||
"set",
|
||||
"test",
|
||||
"export"
|
||||
);
|
||||
export type Operation = S.Schema.Type<typeof Operation>;
|
||||
|
||||
export const ExecutionKind = S.Literal('actual', 'whatIf');
|
||||
export const ExecutionKind = S.Literal(
|
||||
"actual",
|
||||
"whatIf"
|
||||
);
|
||||
export type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||
|
||||
export const SecurityContextKind = S.Literal(
|
||||
'current',
|
||||
'elevated',
|
||||
'restricted',
|
||||
"current",
|
||||
"elevated",
|
||||
"restricted"
|
||||
);
|
||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||
|
||||
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<typeof MicrosoftDscMetadata>;
|
||||
|
||||
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<typeof Metadata>;
|
||||
|
||||
// Recursive type declarations
|
||||
type ResourceSetResult = {
|
||||
readonly metadata?: Metadata | null;
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly result: SetResult;
|
||||
};
|
||||
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>;
|
||||
interface ResourceSetResult {
|
||||
readonly "metadata"?: Metadata | null;
|
||||
readonly "name": string;
|
||||
readonly "type": string;
|
||||
readonly "result": SetResult
|
||||
}
|
||||
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>
|
||||
|
||||
// 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> => SetResult),
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"name": S.String,
|
||||
"type": S.String,
|
||||
"result": S.suspend((): S.Schema<SetResult> => SetResult)
|
||||
}) as unknown as S.Schema<ResourceSetResult>;
|
||||
|
||||
export const SetResult = S.Union(
|
||||
ResourceSetResponse,
|
||||
S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult)),
|
||||
) as unknown as S.Schema<SetResult>;
|
||||
export const SetResult = S.Union(ResourceSetResponse, S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult))) as unknown as S.Schema<SetResult>;
|
||||
|
||||
@@ -2,60 +2,65 @@
|
||||
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<typeof ResourceTestResponse>;
|
||||
|
||||
export const Operation = S.Literal('get', 'set', 'test', 'export');
|
||||
export const Operation = S.Literal(
|
||||
"get",
|
||||
"set",
|
||||
"test",
|
||||
"export"
|
||||
);
|
||||
export type Operation = S.Schema.Type<typeof Operation>;
|
||||
|
||||
export const ExecutionKind = S.Literal('actual', 'whatIf');
|
||||
export const ExecutionKind = S.Literal(
|
||||
"actual",
|
||||
"whatIf"
|
||||
);
|
||||
export type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||
|
||||
export const SecurityContextKind = S.Literal(
|
||||
'current',
|
||||
'elevated',
|
||||
'restricted',
|
||||
"current",
|
||||
"elevated",
|
||||
"restricted"
|
||||
);
|
||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||
|
||||
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<typeof MicrosoftDscMetadata>;
|
||||
|
||||
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<typeof Metadata>;
|
||||
|
||||
// Recursive type declarations
|
||||
type ResourceTestResult = {
|
||||
readonly metadata?: Metadata | null;
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly result: TestResult;
|
||||
};
|
||||
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>;
|
||||
interface ResourceTestResult {
|
||||
readonly "metadata"?: Metadata | null;
|
||||
readonly "name": string;
|
||||
readonly "type": string;
|
||||
readonly "result": TestResult
|
||||
}
|
||||
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>
|
||||
|
||||
// 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> => TestResult),
|
||||
"metadata": S.optional(S.NullOr(Metadata)),
|
||||
"name": S.String,
|
||||
"type": S.String,
|
||||
"result": S.suspend((): S.Schema<TestResult> => TestResult)
|
||||
}) as unknown as S.Schema<ResourceTestResult>;
|
||||
|
||||
export const TestResult = S.Union(
|
||||
ResourceTestResponse,
|
||||
S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult)),
|
||||
) as unknown as S.Schema<TestResult>;
|
||||
export const TestResult = S.Union(ResourceTestResponse, S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult))) as unknown as S.Schema<TestResult>;
|
||||
|
||||
Reference in New Issue
Block a user