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
|
.DS_Store
|
||||||
|
|
||||||
.turbo
|
.turbo
|
||||||
|
|
||||||
|
tmp.*
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "winos-config",
|
"name": "winos-config",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"module": "index.ts",
|
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "bun@1.3.3",
|
"packageManager": "bun@1.3.3",
|
||||||
@@ -24,7 +23,6 @@
|
|||||||
"@biomejs/biome": "2.3.8",
|
"@biomejs/biome": "2.3.8",
|
||||||
"@effect/language-service": "^0.57.1",
|
"@effect/language-service": "^0.57.1",
|
||||||
"@types/bun": "latest",
|
"@types/bun": "latest",
|
||||||
"quicktype": "^23.2.6",
|
|
||||||
"turbo": "^2.6.1",
|
"turbo": "^2.6.1",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"ultracite": "6.3.8"
|
"ultracite": "6.3.8"
|
||||||
|
|||||||
@@ -1,24 +1,120 @@
|
|||||||
import { Command, FileSystem, Path } from '@effect/platform';
|
import { Command, FileSystem, Path } from '@effect/platform';
|
||||||
import { BunContext, BunRuntime } from '@effect/platform-bun';
|
import { BunContext, BunRuntime } from '@effect/platform-bun';
|
||||||
import { Effect, Logger, LogLevel } from 'effect';
|
import { Effect, Logger, LogLevel, Schema as S } from 'effect';
|
||||||
import { jsonSchemaToEffectSchema, runCommand } from './lib/script-utils';
|
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* () {
|
Effect.gen(function* () {
|
||||||
const commandParts = [
|
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',
|
'dsc',
|
||||||
'resource',
|
'resource',
|
||||||
'schema',
|
'schema',
|
||||||
'--resource',
|
'--resource',
|
||||||
resourceType,
|
resource.type,
|
||||||
] as const;
|
).pipe(Command.string);
|
||||||
yield* Effect.logDebug(`Running command: ${commandParts.join(' ')}`);
|
|
||||||
const schemaString = yield* Command.make(...commandParts).pipe(
|
|
||||||
Command.string,
|
|
||||||
);
|
|
||||||
return schemaString.trim();
|
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 = () =>
|
const getAvailableDscResources = () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
yield* Effect.logDebug('Getting available DSC resources...');
|
yield* Effect.logDebug('Getting available DSC resources...');
|
||||||
@@ -31,19 +127,104 @@ const getAvailableDscResources = () =>
|
|||||||
'json',
|
'json',
|
||||||
).pipe(Command.string);
|
).pipe(Command.string);
|
||||||
|
|
||||||
yield* Effect.logDebug(
|
// Parse NDJSON output
|
||||||
`DSC resources list output: ${dscrResourcesListOutput}`,
|
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* () {
|
const genDscResourcesTypes = Effect.gen(function* () {
|
||||||
yield* Effect.log('Starting DSC resources types generation...');
|
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(
|
yield* Effect.log(
|
||||||
`Found available resource types: ${availableResourceTypes.join(', ')}`,
|
`Found ${resourcesWithSchemas.length} resources with schemas (excluding adapters)`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const fs = yield* FileSystem.FileSystem;
|
const fs = yield* FileSystem.FileSystem;
|
||||||
@@ -64,21 +245,92 @@ const genDscResourcesTypes = Effect.gen(function* () {
|
|||||||
|
|
||||||
yield* fs.makeDirectory(outputDir, { recursive: true });
|
yield* fs.makeDirectory(outputDir, { recursive: true });
|
||||||
|
|
||||||
for (const schemaType of availableResourceTypes) {
|
const generatedTypes: Array<{
|
||||||
yield* Effect.logDebug(`Processing: ${schemaType}`);
|
type: string;
|
||||||
|
filename: string;
|
||||||
|
typeName: string;
|
||||||
|
}> = [];
|
||||||
|
const errors: Array<{ type: string; error: string }> = [];
|
||||||
|
|
||||||
const jsonSchema = yield* getDscResourceJsonSchema(schemaType);
|
for (const resource of resourcesWithSchemas) {
|
||||||
const effectSchema = yield* jsonSchemaToEffectSchema({
|
yield* Effect.logDebug(`Processing: ${resource.type}`);
|
||||||
jsonSchema,
|
|
||||||
name: schemaType,
|
const schemaResult = yield* Effect.either(getDscResourceSchema(resource));
|
||||||
|
|
||||||
|
if (schemaResult._tag === 'Left') {
|
||||||
|
errors.push({
|
||||||
|
type: resource.type,
|
||||||
|
error: String(schemaResult.left),
|
||||||
});
|
});
|
||||||
|
yield* Effect.logWarning(
|
||||||
const outputPath = path.join(outputDir, `${schemaType}.gen.ts`);
|
`Failed to get schema for ${resource.type}: ${schemaResult.left}`,
|
||||||
yield* fs.writeFileString(outputPath, effectSchema);
|
);
|
||||||
|
continue;
|
||||||
yield* Effect.log(`Generated: ${schemaType}.gen.ts`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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!');
|
yield* Effect.log('DSC types generation complete!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -17,16 +17,11 @@ const getPossibleDscSchemaTypes = () =>
|
|||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
yield* Effect.logDebug('Getting possible DSC schema types...');
|
yield* Effect.logDebug('Getting possible DSC schema types...');
|
||||||
|
|
||||||
const brokenCommand = Command.make(
|
const dscSchemaHelp = Command.make('dsc', 'schema', '--help');
|
||||||
'dsc',
|
|
||||||
'schema',
|
|
||||||
'--type',
|
|
||||||
'something-that-hopefully-never-exists',
|
|
||||||
);
|
|
||||||
|
|
||||||
const { stderr: brokenCommandOutput } = yield* runCommand(brokenCommand);
|
const { stdout: dscHelpOutput } = yield* runCommand(dscSchemaHelp);
|
||||||
|
|
||||||
const possibleTypes = brokenCommandOutput
|
const possibleTypes = dscHelpOutput
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((line) => line.includes('possible values:'))
|
.filter((line) => line.includes('possible values:'))
|
||||||
.map((line) => {
|
.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 { Effect } from 'effect';
|
||||||
import pkg from '../package.json' with { type: 'json' };
|
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 = {
|
const machineConfig: typeof Configuration.Type = {
|
||||||
// $schema: 'https://aka.ms/dsc/schemas/v3/config/document.json',
|
$schema: 'https://aka.ms/dsc/schemas/v3/config/document.json',
|
||||||
// resources: [
|
resources: [
|
||||||
// {
|
{
|
||||||
// name: 'must be unique',
|
name: 'must be unique',
|
||||||
// type: 'Microsoft.Windows/Registry',
|
type: 'Microsoft.Windows/Registry',
|
||||||
// properties: {
|
properties: {
|
||||||
// keyPath: 'HKCU\\example\\key',
|
keyPath: 'HKCU\\example\\key',
|
||||||
// valueName: 'Example',
|
valueName: 'Example',
|
||||||
// valueData: {
|
valueData: {
|
||||||
// String: 'Example Value',
|
String: 'Example Value',
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// ],
|
],
|
||||||
// };
|
};
|
||||||
|
|
||||||
const diffCommand = Command.make('diff', {}, () =>
|
const diffCommand = Command.make('diff', {}, () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
|
|||||||
@@ -1,81 +1,86 @@
|
|||||||
// This file is auto-generated. Do not edit manually.
|
// This file is auto-generated. Do not edit manually.
|
||||||
import * as S from 'effect/Schema';
|
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 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 type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||||
|
|
||||||
export const SecurityContextKind = S.Literal(
|
export const SecurityContextKind = S.Literal(
|
||||||
'current',
|
"current",
|
||||||
'elevated',
|
"elevated",
|
||||||
'restricted',
|
"restricted"
|
||||||
);
|
);
|
||||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||||
|
|
||||||
export const MicrosoftDscMetadata = S.Struct({
|
export const MicrosoftDscMetadata = S.Struct({
|
||||||
version: S.optional(S.NullOr(S.String)),
|
"version": S.optional(S.NullOr(S.String)),
|
||||||
operation: S.optional(S.NullOr(Operation)),
|
"operation": S.optional(S.NullOr(Operation)),
|
||||||
executionType: S.optional(S.NullOr(ExecutionKind)),
|
"executionType": S.optional(S.NullOr(ExecutionKind)),
|
||||||
startDatetime: S.optional(S.NullOr(S.String)),
|
"startDatetime": S.optional(S.NullOr(S.String)),
|
||||||
endDatetime: S.optional(S.NullOr(S.String)),
|
"endDatetime": S.optional(S.NullOr(S.String)),
|
||||||
duration: S.optional(S.NullOr(S.String)),
|
"duration": S.optional(S.NullOr(S.String)),
|
||||||
securityContext: S.optional(S.NullOr(SecurityContextKind)),
|
"securityContext": S.optional(S.NullOr(SecurityContextKind))
|
||||||
});
|
});
|
||||||
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
||||||
|
|
||||||
export const Metadata = S.Struct({
|
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 type Metadata = S.Schema.Type<typeof Metadata>;
|
||||||
|
|
||||||
export const ResourceGetResponse = S.Struct({
|
export const ResourceGetResponse = S.Struct({
|
||||||
actualState: S.Unknown,
|
"actualState": S.Unknown
|
||||||
});
|
});
|
||||||
export type ResourceGetResponse = S.Schema.Type<typeof ResourceGetResponse>;
|
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 type MessageLevel = S.Schema.Type<typeof MessageLevel>;
|
||||||
|
|
||||||
export const ResourceMessage = S.Struct({
|
export const ResourceMessage = S.Struct({
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
message: S.String,
|
"message": S.String,
|
||||||
level: MessageLevel,
|
"level": MessageLevel
|
||||||
});
|
});
|
||||||
export type ResourceMessage = S.Schema.Type<typeof ResourceMessage>;
|
export type ResourceMessage = S.Schema.Type<typeof ResourceMessage>;
|
||||||
|
|
||||||
export const ConfigurationGetResult = S.Struct({
|
export const ConfigurationGetResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
results: S.Array(
|
"results": S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult)),
|
||||||
S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult),
|
"messages": S.Array(ResourceMessage),
|
||||||
),
|
"hadErrors": S.Boolean
|
||||||
messages: S.Array(ResourceMessage),
|
|
||||||
hadErrors: S.Boolean,
|
|
||||||
});
|
});
|
||||||
export type ConfigurationGetResult = S.Schema.Type<
|
export type ConfigurationGetResult = S.Schema.Type<typeof ConfigurationGetResult>;
|
||||||
typeof ConfigurationGetResult
|
|
||||||
>;
|
|
||||||
|
|
||||||
// Recursive type declarations
|
// Recursive type declarations
|
||||||
type ResourceGetResult = {
|
interface ResourceGetResult {
|
||||||
readonly metadata?: Metadata | null;
|
readonly "metadata"?: Metadata | null;
|
||||||
readonly name: string;
|
readonly "name": string;
|
||||||
readonly type: string;
|
readonly "type": string;
|
||||||
readonly result: GetResult;
|
readonly "result": GetResult
|
||||||
};
|
}
|
||||||
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>;
|
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>
|
||||||
|
|
||||||
// Recursive schema definitions
|
// Recursive schema definitions
|
||||||
export const ResourceGetResult = S.Struct({
|
export const ResourceGetResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
result: S.suspend((): S.Schema<GetResult> => GetResult),
|
"result": S.suspend((): S.Schema<GetResult> => GetResult)
|
||||||
}) as unknown as S.Schema<ResourceGetResult>;
|
}) as unknown as S.Schema<ResourceGetResult>;
|
||||||
|
|
||||||
export const GetResult = S.Union(
|
export const GetResult = S.Union(ResourceGetResponse, S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult))) as unknown as S.Schema<GetResult>;
|
||||||
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.
|
// This file is auto-generated. Do not edit manually.
|
||||||
import * as S from 'effect/Schema';
|
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 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 type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||||
|
|
||||||
export const SecurityContextKind = S.Literal(
|
export const SecurityContextKind = S.Literal(
|
||||||
'current',
|
"current",
|
||||||
'elevated',
|
"elevated",
|
||||||
'restricted',
|
"restricted"
|
||||||
);
|
);
|
||||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||||
|
|
||||||
export const MicrosoftDscMetadata = S.Struct({
|
export const MicrosoftDscMetadata = S.Struct({
|
||||||
version: S.optional(S.NullOr(S.String)),
|
"version": S.optional(S.NullOr(S.String)),
|
||||||
operation: S.optional(S.NullOr(Operation)),
|
"operation": S.optional(S.NullOr(Operation)),
|
||||||
executionType: S.optional(S.NullOr(ExecutionKind)),
|
"executionType": S.optional(S.NullOr(ExecutionKind)),
|
||||||
startDatetime: S.optional(S.NullOr(S.String)),
|
"startDatetime": S.optional(S.NullOr(S.String)),
|
||||||
endDatetime: S.optional(S.NullOr(S.String)),
|
"endDatetime": S.optional(S.NullOr(S.String)),
|
||||||
duration: S.optional(S.NullOr(S.String)),
|
"duration": S.optional(S.NullOr(S.String)),
|
||||||
securityContext: S.optional(S.NullOr(SecurityContextKind)),
|
"securityContext": S.optional(S.NullOr(SecurityContextKind))
|
||||||
});
|
});
|
||||||
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
||||||
|
|
||||||
export const Metadata = S.Struct({
|
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 type Metadata = S.Schema.Type<typeof Metadata>;
|
||||||
|
|
||||||
export const ResourceSetResponse = S.Struct({
|
export const ResourceSetResponse = S.Struct({
|
||||||
beforeState: S.Unknown,
|
"beforeState": S.Unknown,
|
||||||
afterState: S.Unknown,
|
"afterState": S.Unknown,
|
||||||
changedProperties: S.optional(S.NullOr(S.Array(S.String))),
|
"changedProperties": S.optional(S.NullOr(S.Array(S.String)))
|
||||||
});
|
});
|
||||||
export type ResourceSetResponse = S.Schema.Type<typeof ResourceSetResponse>;
|
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 type MessageLevel = S.Schema.Type<typeof MessageLevel>;
|
||||||
|
|
||||||
export const ResourceMessage = S.Struct({
|
export const ResourceMessage = S.Struct({
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
message: S.String,
|
"message": S.String,
|
||||||
level: MessageLevel,
|
"level": MessageLevel
|
||||||
});
|
});
|
||||||
export type ResourceMessage = S.Schema.Type<typeof ResourceMessage>;
|
export type ResourceMessage = S.Schema.Type<typeof ResourceMessage>;
|
||||||
|
|
||||||
export const ConfigurationSetResult = S.Struct({
|
export const ConfigurationSetResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
results: S.Array(
|
"results": S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult)),
|
||||||
S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult),
|
"messages": S.Array(ResourceMessage),
|
||||||
),
|
"hadErrors": S.Boolean
|
||||||
messages: S.Array(ResourceMessage),
|
|
||||||
hadErrors: S.Boolean,
|
|
||||||
});
|
});
|
||||||
export type ConfigurationSetResult = S.Schema.Type<
|
export type ConfigurationSetResult = S.Schema.Type<typeof ConfigurationSetResult>;
|
||||||
typeof ConfigurationSetResult
|
|
||||||
>;
|
|
||||||
|
|
||||||
// Recursive type declarations
|
// Recursive type declarations
|
||||||
type ResourceSetResult = {
|
interface ResourceSetResult {
|
||||||
readonly metadata?: Metadata | null;
|
readonly "metadata"?: Metadata | null;
|
||||||
readonly name: string;
|
readonly "name": string;
|
||||||
readonly type: string;
|
readonly "type": string;
|
||||||
readonly result: SetResult;
|
readonly "result": SetResult
|
||||||
};
|
}
|
||||||
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>;
|
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>
|
||||||
|
|
||||||
// Recursive schema definitions
|
// Recursive schema definitions
|
||||||
export const ResourceSetResult = S.Struct({
|
export const ResourceSetResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
result: S.suspend((): S.Schema<SetResult> => SetResult),
|
"result": S.suspend((): S.Schema<SetResult> => SetResult)
|
||||||
}) as unknown as S.Schema<ResourceSetResult>;
|
}) as unknown as S.Schema<ResourceSetResult>;
|
||||||
|
|
||||||
export const SetResult = S.Union(
|
export const SetResult = S.Union(ResourceSetResponse, S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult))) as unknown as S.Schema<SetResult>;
|
||||||
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.
|
// This file is auto-generated. Do not edit manually.
|
||||||
import * as S from 'effect/Schema';
|
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 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 type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||||
|
|
||||||
export const SecurityContextKind = S.Literal(
|
export const SecurityContextKind = S.Literal(
|
||||||
'current',
|
"current",
|
||||||
'elevated',
|
"elevated",
|
||||||
'restricted',
|
"restricted"
|
||||||
);
|
);
|
||||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||||
|
|
||||||
export const MicrosoftDscMetadata = S.Struct({
|
export const MicrosoftDscMetadata = S.Struct({
|
||||||
version: S.optional(S.NullOr(S.String)),
|
"version": S.optional(S.NullOr(S.String)),
|
||||||
operation: S.optional(S.NullOr(Operation)),
|
"operation": S.optional(S.NullOr(Operation)),
|
||||||
executionType: S.optional(S.NullOr(ExecutionKind)),
|
"executionType": S.optional(S.NullOr(ExecutionKind)),
|
||||||
startDatetime: S.optional(S.NullOr(S.String)),
|
"startDatetime": S.optional(S.NullOr(S.String)),
|
||||||
endDatetime: S.optional(S.NullOr(S.String)),
|
"endDatetime": S.optional(S.NullOr(S.String)),
|
||||||
duration: S.optional(S.NullOr(S.String)),
|
"duration": S.optional(S.NullOr(S.String)),
|
||||||
securityContext: S.optional(S.NullOr(SecurityContextKind)),
|
"securityContext": S.optional(S.NullOr(SecurityContextKind))
|
||||||
});
|
});
|
||||||
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
||||||
|
|
||||||
export const Metadata = S.Struct({
|
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 type Metadata = S.Schema.Type<typeof Metadata>;
|
||||||
|
|
||||||
export const ResourceTestResponse = S.Struct({
|
export const ResourceTestResponse = S.Struct({
|
||||||
desiredState: S.Unknown,
|
"desiredState": S.Unknown,
|
||||||
actualState: S.Unknown,
|
"actualState": S.Unknown,
|
||||||
inDesiredState: S.Boolean,
|
"inDesiredState": S.Boolean,
|
||||||
differingProperties: S.Array(S.String),
|
"differingProperties": S.Array(S.String)
|
||||||
});
|
});
|
||||||
export type ResourceTestResponse = S.Schema.Type<typeof ResourceTestResponse>;
|
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 type MessageLevel = S.Schema.Type<typeof MessageLevel>;
|
||||||
|
|
||||||
export const ResourceMessage = S.Struct({
|
export const ResourceMessage = S.Struct({
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
message: S.String,
|
"message": S.String,
|
||||||
level: MessageLevel,
|
"level": MessageLevel
|
||||||
});
|
});
|
||||||
export type ResourceMessage = S.Schema.Type<typeof ResourceMessage>;
|
export type ResourceMessage = S.Schema.Type<typeof ResourceMessage>;
|
||||||
|
|
||||||
export const ConfigurationTestResult = S.Struct({
|
export const ConfigurationTestResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
results: S.Array(
|
"results": S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult)),
|
||||||
S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult),
|
"messages": S.Array(ResourceMessage),
|
||||||
),
|
"hadErrors": S.Boolean
|
||||||
messages: S.Array(ResourceMessage),
|
|
||||||
hadErrors: S.Boolean,
|
|
||||||
});
|
});
|
||||||
export type ConfigurationTestResult = S.Schema.Type<
|
export type ConfigurationTestResult = S.Schema.Type<typeof ConfigurationTestResult>;
|
||||||
typeof ConfigurationTestResult
|
|
||||||
>;
|
|
||||||
|
|
||||||
// Recursive type declarations
|
// Recursive type declarations
|
||||||
type ResourceTestResult = {
|
interface ResourceTestResult {
|
||||||
readonly metadata?: Metadata | null;
|
readonly "metadata"?: Metadata | null;
|
||||||
readonly name: string;
|
readonly "name": string;
|
||||||
readonly type: string;
|
readonly "type": string;
|
||||||
readonly result: TestResult;
|
readonly "result": TestResult
|
||||||
};
|
}
|
||||||
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>;
|
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>
|
||||||
|
|
||||||
// Recursive schema definitions
|
// Recursive schema definitions
|
||||||
export const ResourceTestResult = S.Struct({
|
export const ResourceTestResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
result: S.suspend((): S.Schema<TestResult> => TestResult),
|
"result": S.suspend((): S.Schema<TestResult> => TestResult)
|
||||||
}) as unknown as S.Schema<ResourceTestResult>;
|
}) as unknown as S.Schema<ResourceTestResult>;
|
||||||
|
|
||||||
export const TestResult = S.Union(
|
export const TestResult = S.Union(ResourceTestResponse, S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult))) as unknown as S.Schema<TestResult>;
|
||||||
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';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const DataType = S.Literal(
|
export const DataType = S.Literal(
|
||||||
'string',
|
"string",
|
||||||
'secureString',
|
"secureString",
|
||||||
'int',
|
"int",
|
||||||
'bool',
|
"bool",
|
||||||
'object',
|
"object",
|
||||||
'secureObject',
|
"secureObject",
|
||||||
'array',
|
"array"
|
||||||
);
|
);
|
||||||
export type DataType = S.Schema.Type<typeof DataType>;
|
export type DataType = S.Schema.Type<typeof DataType>;
|
||||||
|
|
||||||
export const Parameter = S.Struct({
|
export const Parameter = S.Struct({
|
||||||
type: DataType,
|
"type": DataType,
|
||||||
defaultValue: S.optional(S.Unknown),
|
"defaultValue": S.optional(S.Unknown),
|
||||||
allowedValues: S.optional(S.NullOr(S.Array(S.Unknown))),
|
"allowedValues": S.optional(S.NullOr(S.Array(S.Unknown))),
|
||||||
minValue: S.optional(S.NullOr(S.Number)),
|
"minValue": S.optional(S.NullOr(S.Number)),
|
||||||
maxValue: S.optional(S.NullOr(S.Number)),
|
"maxValue": S.optional(S.NullOr(S.Number)),
|
||||||
minLength: S.optional(S.NullOr(S.Number)),
|
"minLength": S.optional(S.NullOr(S.Number)),
|
||||||
maxLength: S.optional(S.NullOr(S.Number)),
|
"maxLength": S.optional(S.NullOr(S.Number)),
|
||||||
description: S.optional(S.NullOr(S.String)),
|
"description": S.optional(S.NullOr(S.String)),
|
||||||
metadata: 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 Parameter = S.Schema.Type<typeof Parameter>;
|
export type Parameter = S.Schema.Type<typeof Parameter>;
|
||||||
|
|
||||||
export const Resource = S.Struct({
|
export const Resource = S.Struct({
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
dependsOn: S.optional(S.NullOr(S.Array(S.String))),
|
"dependsOn": S.optional(S.NullOr(S.Array(S.String))),
|
||||||
properties: S.optional(
|
"properties": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))),
|
||||||
S.NullOr(S.Record({ key: S.String, value: S.Unknown })),
|
"metadata": 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 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 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 type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||||
|
|
||||||
export const SecurityContextKind = S.Literal(
|
export const SecurityContextKind = S.Literal(
|
||||||
'current',
|
"current",
|
||||||
'elevated',
|
"elevated",
|
||||||
'restricted',
|
"restricted"
|
||||||
);
|
);
|
||||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||||
|
|
||||||
export const MicrosoftDscMetadata = S.Struct({
|
export const MicrosoftDscMetadata = S.Struct({
|
||||||
version: S.optional(S.NullOr(S.String)),
|
"version": S.optional(S.NullOr(S.String)),
|
||||||
operation: S.optional(S.NullOr(Operation)),
|
"operation": S.optional(S.NullOr(Operation)),
|
||||||
executionType: S.optional(S.NullOr(ExecutionKind)),
|
"executionType": S.optional(S.NullOr(ExecutionKind)),
|
||||||
startDatetime: S.optional(S.NullOr(S.String)),
|
"startDatetime": S.optional(S.NullOr(S.String)),
|
||||||
endDatetime: S.optional(S.NullOr(S.String)),
|
"endDatetime": S.optional(S.NullOr(S.String)),
|
||||||
duration: S.optional(S.NullOr(S.String)),
|
"duration": S.optional(S.NullOr(S.String)),
|
||||||
securityContext: S.optional(S.NullOr(SecurityContextKind)),
|
"securityContext": S.optional(S.NullOr(SecurityContextKind))
|
||||||
});
|
});
|
||||||
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
||||||
|
|
||||||
export const Metadata = S.Struct({
|
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 type Metadata = S.Schema.Type<typeof Metadata>;
|
||||||
|
|
||||||
export const Configuration = S.Struct({
|
export const Configuration = S.Struct({
|
||||||
$schema: S.Literal(
|
"$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"),
|
||||||
'https://aka.ms/dsc/schemas/v3/bundled/config/document.json',
|
"contentVersion": S.optional(S.NullOr(S.String)),
|
||||||
'https://aka.ms/dsc/schemas/v3.0/bundled/config/document.json',
|
"parameters": S.optional(S.NullOr(S.Record({ key: S.String, value: Parameter }))),
|
||||||
'https://aka.ms/dsc/schemas/v3.0.0/bundled/config/document.json',
|
"variables": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown }))),
|
||||||
'https://aka.ms/dsc/schemas/v3/bundled/config/document.vscode.json',
|
"resources": S.Array(Resource),
|
||||||
'https://aka.ms/dsc/schemas/v3.0/bundled/config/document.vscode.json',
|
"metadata": S.optional(S.NullOr(Metadata))
|
||||||
'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>;
|
export type Configuration = S.Schema.Type<typeof Configuration>;
|
||||||
|
|||||||
@@ -2,41 +2,36 @@
|
|||||||
import * as S from 'effect/Schema';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const Kind = S.Literal(
|
export const Kind = S.Literal(
|
||||||
'adapter',
|
"adapter",
|
||||||
'exporter',
|
"exporter",
|
||||||
'group',
|
"group",
|
||||||
'importer',
|
"importer",
|
||||||
'resource',
|
"resource"
|
||||||
);
|
);
|
||||||
export type Kind = S.Schema.Type<typeof Kind>;
|
export type Kind = S.Schema.Type<typeof Kind>;
|
||||||
|
|
||||||
export const Capability = S.Union(
|
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"));
|
||||||
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 type Capability = S.Schema.Type<typeof Capability>;
|
||||||
|
|
||||||
export const ImplementedAs = S.NullOr(S.String);
|
export const ImplementedAs = S.NullOr(S.String);
|
||||||
export type ImplementedAs = S.Schema.Type<typeof ImplementedAs>;
|
export type ImplementedAs = S.Schema.Type<typeof ImplementedAs>;
|
||||||
|
|
||||||
export const DscResource = S.Struct({
|
export const DscResource = S.Struct({
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
kind: S.Struct({}),
|
"kind": S.Struct({
|
||||||
version: S.String,
|
|
||||||
capabilities: S.Array(Capability),
|
}),
|
||||||
path: S.String,
|
"version": S.String,
|
||||||
description: S.optional(S.NullOr(S.String)),
|
"capabilities": S.Array(Capability),
|
||||||
directory: S.String,
|
"path": S.String,
|
||||||
implementedAs: S.Struct({}),
|
"description": S.optional(S.NullOr(S.String)),
|
||||||
author: S.optional(S.NullOr(S.String)),
|
"directory": S.String,
|
||||||
properties: S.Array(S.String),
|
"implementedAs": S.Struct({
|
||||||
requireAdapter: S.optional(S.NullOr(S.String)),
|
|
||||||
manifest: S.optional(S.Unknown),
|
}),
|
||||||
|
"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>;
|
export type DscResource = S.Schema.Type<typeof DscResource>;
|
||||||
|
|||||||
@@ -2,57 +2,62 @@
|
|||||||
import * as S from 'effect/Schema';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const ResourceGetResponse = S.Struct({
|
export const ResourceGetResponse = S.Struct({
|
||||||
actualState: S.Unknown,
|
"actualState": S.Unknown
|
||||||
});
|
});
|
||||||
export type ResourceGetResponse = S.Schema.Type<typeof ResourceGetResponse>;
|
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 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 type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||||
|
|
||||||
export const SecurityContextKind = S.Literal(
|
export const SecurityContextKind = S.Literal(
|
||||||
'current',
|
"current",
|
||||||
'elevated',
|
"elevated",
|
||||||
'restricted',
|
"restricted"
|
||||||
);
|
);
|
||||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||||
|
|
||||||
export const MicrosoftDscMetadata = S.Struct({
|
export const MicrosoftDscMetadata = S.Struct({
|
||||||
version: S.optional(S.NullOr(S.String)),
|
"version": S.optional(S.NullOr(S.String)),
|
||||||
operation: S.optional(S.NullOr(Operation)),
|
"operation": S.optional(S.NullOr(Operation)),
|
||||||
executionType: S.optional(S.NullOr(ExecutionKind)),
|
"executionType": S.optional(S.NullOr(ExecutionKind)),
|
||||||
startDatetime: S.optional(S.NullOr(S.String)),
|
"startDatetime": S.optional(S.NullOr(S.String)),
|
||||||
endDatetime: S.optional(S.NullOr(S.String)),
|
"endDatetime": S.optional(S.NullOr(S.String)),
|
||||||
duration: S.optional(S.NullOr(S.String)),
|
"duration": S.optional(S.NullOr(S.String)),
|
||||||
securityContext: S.optional(S.NullOr(SecurityContextKind)),
|
"securityContext": S.optional(S.NullOr(SecurityContextKind))
|
||||||
});
|
});
|
||||||
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
||||||
|
|
||||||
export const Metadata = S.Struct({
|
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 type Metadata = S.Schema.Type<typeof Metadata>;
|
||||||
|
|
||||||
// Recursive type declarations
|
// Recursive type declarations
|
||||||
type ResourceGetResult = {
|
interface ResourceGetResult {
|
||||||
readonly metadata?: Metadata | null;
|
readonly "metadata"?: Metadata | null;
|
||||||
readonly name: string;
|
readonly "name": string;
|
||||||
readonly type: string;
|
readonly "type": string;
|
||||||
readonly result: GetResult;
|
readonly "result": GetResult
|
||||||
};
|
}
|
||||||
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>;
|
type GetResult = ResourceGetResponse | ReadonlyArray<ResourceGetResult>
|
||||||
|
|
||||||
// Recursive schema definitions
|
// Recursive schema definitions
|
||||||
export const ResourceGetResult = S.Struct({
|
export const ResourceGetResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
result: S.suspend((): S.Schema<GetResult> => GetResult),
|
"result": S.suspend((): S.Schema<GetResult> => GetResult)
|
||||||
}) as unknown as S.Schema<ResourceGetResult>;
|
}) as unknown as S.Schema<ResourceGetResult>;
|
||||||
|
|
||||||
export const GetResult = S.Union(
|
export const GetResult = S.Union(ResourceGetResponse, S.Array(S.suspend((): S.Schema<ResourceGetResult> => ResourceGetResult))) as unknown as S.Schema<GetResult>;
|
||||||
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.
|
// This file is auto-generated. Do not edit manually.
|
||||||
import * as S from 'effect/Schema';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const Include = S.Union(
|
export const Include = S.Union(S.Struct({
|
||||||
S.Struct({
|
"configurationFile": S.String
|
||||||
configurationFile: S.String,
|
}), S.Struct({
|
||||||
}),
|
"configurationContent": S.String
|
||||||
S.Struct({
|
}));
|
||||||
configurationContent: S.String,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
export type Include = S.Schema.Type<typeof Include>;
|
export type Include = S.Schema.Type<typeof Include>;
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
import * as S from 'effect/Schema';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const ResolveResult = S.Struct({
|
export const ResolveResult = S.Struct({
|
||||||
configuration: S.Unknown,
|
"configuration": S.Unknown,
|
||||||
parameters: S.optional(
|
"parameters": S.optional(S.NullOr(S.Record({ key: S.String, value: S.Unknown })))
|
||||||
S.NullOr(S.Record({ key: S.String, value: S.Unknown })),
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
export type ResolveResult = S.Schema.Type<typeof ResolveResult>;
|
export type ResolveResult = S.Schema.Type<typeof ResolveResult>;
|
||||||
|
|||||||
@@ -2,152 +2,128 @@
|
|||||||
import * as S from 'effect/Schema';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const Kind = S.Literal(
|
export const Kind = S.Literal(
|
||||||
'adapter',
|
"adapter",
|
||||||
'exporter',
|
"exporter",
|
||||||
'group',
|
"group",
|
||||||
'importer',
|
"importer",
|
||||||
'resource',
|
"resource"
|
||||||
);
|
);
|
||||||
export type Kind = S.Schema.Type<typeof Kind>;
|
export type Kind = S.Schema.Type<typeof Kind>;
|
||||||
|
|
||||||
export const ArgKind = S.Union(
|
export const ArgKind = S.Union(S.String, S.Struct({
|
||||||
S.String,
|
"jsonInputArg": S.String,
|
||||||
S.Struct({
|
"mandatory": S.optional(S.NullOr(S.Boolean))
|
||||||
jsonInputArg: S.String,
|
}));
|
||||||
mandatory: S.optional(S.NullOr(S.Boolean)),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
export type ArgKind = S.Schema.Type<typeof ArgKind>;
|
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 type InputKind = S.Schema.Type<typeof InputKind>;
|
||||||
|
|
||||||
export const GetMethod = S.Struct({
|
export const GetMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(ArgKind))),
|
"args": S.optional(S.NullOr(S.Array(ArgKind))),
|
||||||
input: S.optional(S.NullOr(InputKind)),
|
"input": S.optional(S.NullOr(InputKind))
|
||||||
});
|
});
|
||||||
export type GetMethod = S.Schema.Type<typeof GetMethod>;
|
export type GetMethod = S.Schema.Type<typeof GetMethod>;
|
||||||
|
|
||||||
export const ReturnKind = S.Union(
|
export const ReturnKind = S.Union(S.Literal("state"), S.Literal("stateAndDiff"));
|
||||||
S.Literal('state'),
|
|
||||||
S.Literal('stateAndDiff'),
|
|
||||||
);
|
|
||||||
export type ReturnKind = S.Schema.Type<typeof ReturnKind>;
|
export type ReturnKind = S.Schema.Type<typeof ReturnKind>;
|
||||||
|
|
||||||
export const SetMethod = S.Struct({
|
export const SetMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(ArgKind))),
|
"args": S.optional(S.NullOr(S.Array(ArgKind))),
|
||||||
input: S.optional(S.NullOr(InputKind)),
|
"input": S.optional(S.NullOr(InputKind)),
|
||||||
implementsPretest: S.optional(S.NullOr(S.Boolean)),
|
"implementsPretest": S.optional(S.NullOr(S.Boolean)),
|
||||||
handlesExist: S.optional(S.NullOr(S.Boolean)),
|
"handlesExist": S.optional(S.NullOr(S.Boolean)),
|
||||||
return: S.optional(S.NullOr(ReturnKind)),
|
"return": S.optional(S.NullOr(ReturnKind))
|
||||||
});
|
});
|
||||||
export type SetMethod = S.Schema.Type<typeof SetMethod>;
|
export type SetMethod = S.Schema.Type<typeof SetMethod>;
|
||||||
|
|
||||||
export const TestMethod = S.Struct({
|
export const TestMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(ArgKind))),
|
"args": S.optional(S.NullOr(S.Array(ArgKind))),
|
||||||
input: S.optional(S.NullOr(InputKind)),
|
"input": S.optional(S.NullOr(InputKind)),
|
||||||
return: S.optional(S.NullOr(ReturnKind)),
|
"return": S.optional(S.NullOr(ReturnKind))
|
||||||
});
|
});
|
||||||
export type TestMethod = S.Schema.Type<typeof TestMethod>;
|
export type TestMethod = S.Schema.Type<typeof TestMethod>;
|
||||||
|
|
||||||
export const DeleteMethod = S.Struct({
|
export const DeleteMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(ArgKind))),
|
"args": S.optional(S.NullOr(S.Array(ArgKind))),
|
||||||
input: S.optional(S.NullOr(InputKind)),
|
"input": S.optional(S.NullOr(InputKind))
|
||||||
});
|
});
|
||||||
export type DeleteMethod = S.Schema.Type<typeof DeleteMethod>;
|
export type DeleteMethod = S.Schema.Type<typeof DeleteMethod>;
|
||||||
|
|
||||||
export const ExportMethod = S.Struct({
|
export const ExportMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(ArgKind))),
|
"args": S.optional(S.NullOr(S.Array(ArgKind))),
|
||||||
input: S.optional(S.NullOr(InputKind)),
|
"input": S.optional(S.NullOr(InputKind))
|
||||||
});
|
});
|
||||||
export type ExportMethod = S.Schema.Type<typeof ExportMethod>;
|
export type ExportMethod = S.Schema.Type<typeof ExportMethod>;
|
||||||
|
|
||||||
export const ResolveMethod = S.Struct({
|
export const ResolveMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(ArgKind))),
|
"args": S.optional(S.NullOr(S.Array(ArgKind))),
|
||||||
input: S.optional(S.NullOr(InputKind)),
|
"input": S.optional(S.NullOr(InputKind))
|
||||||
});
|
});
|
||||||
export type ResolveMethod = S.Schema.Type<typeof ResolveMethod>;
|
export type ResolveMethod = S.Schema.Type<typeof ResolveMethod>;
|
||||||
|
|
||||||
export const ValidateMethod = S.Struct({
|
export const ValidateMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(ArgKind))),
|
"args": S.optional(S.NullOr(S.Array(ArgKind))),
|
||||||
input: S.optional(S.NullOr(InputKind)),
|
"input": S.optional(S.NullOr(InputKind))
|
||||||
});
|
});
|
||||||
export type ValidateMethod = S.Schema.Type<typeof ValidateMethod>;
|
export type ValidateMethod = S.Schema.Type<typeof ValidateMethod>;
|
||||||
|
|
||||||
export const ListMethod = S.Struct({
|
export const ListMethod = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(S.String))),
|
"args": S.optional(S.NullOr(S.Array(S.String)))
|
||||||
});
|
});
|
||||||
export type ListMethod = S.Schema.Type<typeof ListMethod>;
|
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 type ConfigKind = S.Schema.Type<typeof ConfigKind>;
|
||||||
|
|
||||||
export const Adapter = S.Struct({
|
export const Adapter = S.Struct({
|
||||||
list: S.Struct({}),
|
"list": S.Struct({
|
||||||
config: S.Struct({}),
|
|
||||||
|
}),
|
||||||
|
"config": S.Struct({
|
||||||
|
|
||||||
|
})
|
||||||
});
|
});
|
||||||
export type Adapter = S.Schema.Type<typeof Adapter>;
|
export type Adapter = S.Schema.Type<typeof Adapter>;
|
||||||
|
|
||||||
export const SchemaCommand = S.Struct({
|
export const SchemaCommand = S.Struct({
|
||||||
executable: S.String,
|
"executable": S.String,
|
||||||
args: S.optional(S.NullOr(S.Array(S.String))),
|
"args": S.optional(S.NullOr(S.Array(S.String)))
|
||||||
});
|
});
|
||||||
export type SchemaCommand = S.Schema.Type<typeof SchemaCommand>;
|
export type SchemaCommand = S.Schema.Type<typeof SchemaCommand>;
|
||||||
|
|
||||||
export const SchemaKind = S.Union(
|
export const SchemaKind = S.Union(S.Struct({
|
||||||
S.Struct({
|
"command": SchemaCommand
|
||||||
command: SchemaCommand,
|
}), S.Struct({
|
||||||
}),
|
"embedded": S.Unknown
|
||||||
S.Struct({
|
}));
|
||||||
embedded: S.Unknown,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
export type SchemaKind = S.Schema.Type<typeof SchemaKind>;
|
export type SchemaKind = S.Schema.Type<typeof SchemaKind>;
|
||||||
|
|
||||||
export const ResourceManifest = S.Struct({
|
export const ResourceManifest = S.Struct({
|
||||||
$schema: S.Literal(
|
"$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"),
|
||||||
'https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json',
|
"type": S.String,
|
||||||
'https://aka.ms/dsc/schemas/v3.0/bundled/resource/manifest.json',
|
"kind": S.optional(S.NullOr(Kind)),
|
||||||
'https://aka.ms/dsc/schemas/v3.0.0/bundled/resource/manifest.json',
|
"version": S.String,
|
||||||
'https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.vscode.json',
|
"description": S.optional(S.NullOr(S.String)),
|
||||||
'https://aka.ms/dsc/schemas/v3.0/bundled/resource/manifest.vscode.json',
|
"tags": S.optional(S.NullOr(S.Array(S.String))),
|
||||||
'https://aka.ms/dsc/schemas/v3.0.0/bundled/resource/manifest.vscode.json',
|
"get": S.optional(S.NullOr(GetMethod)),
|
||||||
'https://aka.ms/dsc/schemas/v3/resource/manifest.json',
|
"set": S.optional(S.NullOr(SetMethod)),
|
||||||
'https://aka.ms/dsc/schemas/v3.0/resource/manifest.json',
|
"whatIf": S.optional(S.NullOr(SetMethod)),
|
||||||
'https://aka.ms/dsc/schemas/v3.0.0/resource/manifest.json',
|
"test": S.optional(S.NullOr(TestMethod)),
|
||||||
'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/resource/manifest.json',
|
"delete": S.optional(S.NullOr(DeleteMethod)),
|
||||||
'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/resource/manifest.json',
|
"export": S.optional(S.NullOr(ExportMethod)),
|
||||||
'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/resource/manifest.json',
|
"resolve": S.optional(S.NullOr(ResolveMethod)),
|
||||||
'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/resource/manifest.vscode.json',
|
"validate": S.optional(S.NullOr(ValidateMethod)),
|
||||||
'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0/bundled/resource/manifest.vscode.json',
|
"adapter": S.optional(S.NullOr(Adapter)),
|
||||||
'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.0.0/bundled/resource/manifest.vscode.json',
|
"exitCodes": S.optional(S.NullOr(S.Record({ key: S.String, value: S.String }))),
|
||||||
'https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/resource/manifest.json',
|
"schema": S.optional(S.NullOr(SchemaKind))
|
||||||
'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>;
|
export type ResourceManifest = S.Schema.Type<typeof ResourceManifest>;
|
||||||
|
|||||||
@@ -2,59 +2,64 @@
|
|||||||
import * as S from 'effect/Schema';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const ResourceSetResponse = S.Struct({
|
export const ResourceSetResponse = S.Struct({
|
||||||
beforeState: S.Unknown,
|
"beforeState": S.Unknown,
|
||||||
afterState: S.Unknown,
|
"afterState": S.Unknown,
|
||||||
changedProperties: S.optional(S.NullOr(S.Array(S.String))),
|
"changedProperties": S.optional(S.NullOr(S.Array(S.String)))
|
||||||
});
|
});
|
||||||
export type ResourceSetResponse = S.Schema.Type<typeof ResourceSetResponse>;
|
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 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 type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||||
|
|
||||||
export const SecurityContextKind = S.Literal(
|
export const SecurityContextKind = S.Literal(
|
||||||
'current',
|
"current",
|
||||||
'elevated',
|
"elevated",
|
||||||
'restricted',
|
"restricted"
|
||||||
);
|
);
|
||||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||||
|
|
||||||
export const MicrosoftDscMetadata = S.Struct({
|
export const MicrosoftDscMetadata = S.Struct({
|
||||||
version: S.optional(S.NullOr(S.String)),
|
"version": S.optional(S.NullOr(S.String)),
|
||||||
operation: S.optional(S.NullOr(Operation)),
|
"operation": S.optional(S.NullOr(Operation)),
|
||||||
executionType: S.optional(S.NullOr(ExecutionKind)),
|
"executionType": S.optional(S.NullOr(ExecutionKind)),
|
||||||
startDatetime: S.optional(S.NullOr(S.String)),
|
"startDatetime": S.optional(S.NullOr(S.String)),
|
||||||
endDatetime: S.optional(S.NullOr(S.String)),
|
"endDatetime": S.optional(S.NullOr(S.String)),
|
||||||
duration: S.optional(S.NullOr(S.String)),
|
"duration": S.optional(S.NullOr(S.String)),
|
||||||
securityContext: S.optional(S.NullOr(SecurityContextKind)),
|
"securityContext": S.optional(S.NullOr(SecurityContextKind))
|
||||||
});
|
});
|
||||||
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
||||||
|
|
||||||
export const Metadata = S.Struct({
|
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 type Metadata = S.Schema.Type<typeof Metadata>;
|
||||||
|
|
||||||
// Recursive type declarations
|
// Recursive type declarations
|
||||||
type ResourceSetResult = {
|
interface ResourceSetResult {
|
||||||
readonly metadata?: Metadata | null;
|
readonly "metadata"?: Metadata | null;
|
||||||
readonly name: string;
|
readonly "name": string;
|
||||||
readonly type: string;
|
readonly "type": string;
|
||||||
readonly result: SetResult;
|
readonly "result": SetResult
|
||||||
};
|
}
|
||||||
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>;
|
type SetResult = ResourceSetResponse | ReadonlyArray<ResourceSetResult>
|
||||||
|
|
||||||
// Recursive schema definitions
|
// Recursive schema definitions
|
||||||
export const ResourceSetResult = S.Struct({
|
export const ResourceSetResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
result: S.suspend((): S.Schema<SetResult> => SetResult),
|
"result": S.suspend((): S.Schema<SetResult> => SetResult)
|
||||||
}) as unknown as S.Schema<ResourceSetResult>;
|
}) as unknown as S.Schema<ResourceSetResult>;
|
||||||
|
|
||||||
export const SetResult = S.Union(
|
export const SetResult = S.Union(ResourceSetResponse, S.Array(S.suspend((): S.Schema<ResourceSetResult> => ResourceSetResult))) as unknown as S.Schema<SetResult>;
|
||||||
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';
|
import * as S from 'effect/Schema';
|
||||||
|
|
||||||
export const ResourceTestResponse = S.Struct({
|
export const ResourceTestResponse = S.Struct({
|
||||||
desiredState: S.Unknown,
|
"desiredState": S.Unknown,
|
||||||
actualState: S.Unknown,
|
"actualState": S.Unknown,
|
||||||
inDesiredState: S.Boolean,
|
"inDesiredState": S.Boolean,
|
||||||
differingProperties: S.Array(S.String),
|
"differingProperties": S.Array(S.String)
|
||||||
});
|
});
|
||||||
export type ResourceTestResponse = S.Schema.Type<typeof ResourceTestResponse>;
|
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 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 type ExecutionKind = S.Schema.Type<typeof ExecutionKind>;
|
||||||
|
|
||||||
export const SecurityContextKind = S.Literal(
|
export const SecurityContextKind = S.Literal(
|
||||||
'current',
|
"current",
|
||||||
'elevated',
|
"elevated",
|
||||||
'restricted',
|
"restricted"
|
||||||
);
|
);
|
||||||
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
export type SecurityContextKind = S.Schema.Type<typeof SecurityContextKind>;
|
||||||
|
|
||||||
export const MicrosoftDscMetadata = S.Struct({
|
export const MicrosoftDscMetadata = S.Struct({
|
||||||
version: S.optional(S.NullOr(S.String)),
|
"version": S.optional(S.NullOr(S.String)),
|
||||||
operation: S.optional(S.NullOr(Operation)),
|
"operation": S.optional(S.NullOr(Operation)),
|
||||||
executionType: S.optional(S.NullOr(ExecutionKind)),
|
"executionType": S.optional(S.NullOr(ExecutionKind)),
|
||||||
startDatetime: S.optional(S.NullOr(S.String)),
|
"startDatetime": S.optional(S.NullOr(S.String)),
|
||||||
endDatetime: S.optional(S.NullOr(S.String)),
|
"endDatetime": S.optional(S.NullOr(S.String)),
|
||||||
duration: S.optional(S.NullOr(S.String)),
|
"duration": S.optional(S.NullOr(S.String)),
|
||||||
securityContext: S.optional(S.NullOr(SecurityContextKind)),
|
"securityContext": S.optional(S.NullOr(SecurityContextKind))
|
||||||
});
|
});
|
||||||
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
export type MicrosoftDscMetadata = S.Schema.Type<typeof MicrosoftDscMetadata>;
|
||||||
|
|
||||||
export const Metadata = S.Struct({
|
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 type Metadata = S.Schema.Type<typeof Metadata>;
|
||||||
|
|
||||||
// Recursive type declarations
|
// Recursive type declarations
|
||||||
type ResourceTestResult = {
|
interface ResourceTestResult {
|
||||||
readonly metadata?: Metadata | null;
|
readonly "metadata"?: Metadata | null;
|
||||||
readonly name: string;
|
readonly "name": string;
|
||||||
readonly type: string;
|
readonly "type": string;
|
||||||
readonly result: TestResult;
|
readonly "result": TestResult
|
||||||
};
|
}
|
||||||
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>;
|
type TestResult = ResourceTestResponse | ReadonlyArray<ResourceTestResult>
|
||||||
|
|
||||||
// Recursive schema definitions
|
// Recursive schema definitions
|
||||||
export const ResourceTestResult = S.Struct({
|
export const ResourceTestResult = S.Struct({
|
||||||
metadata: S.optional(S.NullOr(Metadata)),
|
"metadata": S.optional(S.NullOr(Metadata)),
|
||||||
name: S.String,
|
"name": S.String,
|
||||||
type: S.String,
|
"type": S.String,
|
||||||
result: S.suspend((): S.Schema<TestResult> => TestResult),
|
"result": S.suspend((): S.Schema<TestResult> => TestResult)
|
||||||
}) as unknown as S.Schema<ResourceTestResult>;
|
}) as unknown as S.Schema<ResourceTestResult>;
|
||||||
|
|
||||||
export const TestResult = S.Union(
|
export const TestResult = S.Union(ResourceTestResponse, S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult))) as unknown as S.Schema<TestResult>;
|
||||||
ResourceTestResponse,
|
|
||||||
S.Array(S.suspend((): S.Schema<ResourceTestResult> => ResourceTestResult)),
|
|
||||||
) as unknown as S.Schema<TestResult>;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user