create-supaslidev 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,241 @@
1
+ import { Document } from "yaml";
2
+ import { ArrayLiteralExpression, ExportDeclaration, ImportDeclaration, ObjectLiteralExpression, Project, PropertyAssignment, SourceFile } from "ts-morph";
3
+
4
+ //#region src/cli.d.ts
5
+ declare function run$1(): Promise<void>;
6
+ //#endregion
7
+ //#region src/state.d.ts
8
+ interface AppliedMigration {
9
+ id: string;
10
+ appliedAt: string;
11
+ }
12
+ interface ImportedPresentation {
13
+ name: string;
14
+ importedAt: string;
15
+ sourcePath: string;
16
+ }
17
+ interface StateSchema {
18
+ cliVersion: string;
19
+ createdAt: string;
20
+ lastUpdatedAt: string;
21
+ appliedMigrations: AppliedMigration[];
22
+ importedPresentations?: ImportedPresentation[];
23
+ }
24
+ declare function createInitialState(): StateSchema;
25
+ declare function readState(workspaceDir: string): StateSchema | null;
26
+ declare function writeState(workspaceDir: string, state: StateSchema): void;
27
+ declare function initializeState(workspaceDir: string): StateSchema;
28
+ declare function stateExists(workspaceDir: string): boolean;
29
+ declare function addMigration(workspaceDir: string, migrationId: string): void;
30
+ declare function hasMigration(workspaceDir: string, migrationId: string): boolean;
31
+ declare function updateCliVersion(workspaceDir: string): void;
32
+ declare function findWorkspaceRoot(startDir?: string): string | null;
33
+ declare function addImportedPresentation(workspaceDir: string, presentation: ImportedPresentation): void;
34
+ declare function getImportedPresentations(workspaceDir: string): ImportedPresentation[];
35
+ declare function removeImportedPresentation(workspaceDir: string, name: string): void;
36
+ //#endregion
37
+ //#region src/migrations/types.d.ts
38
+ interface MigrationContext {
39
+ workspaceDir: string;
40
+ state: StateSchema;
41
+ backupPath: string | null;
42
+ options?: Record<string, unknown>;
43
+ }
44
+ interface PresentationInfo {
45
+ name: string;
46
+ path: string;
47
+ currentVersion: string;
48
+ }
49
+ interface InteractiveMigration {
50
+ id: string;
51
+ description: string;
52
+ getAffectedPresentations: (workspaceDir: string) => PresentationInfo[];
53
+ up: (context: MigrationContext) => Promise<void>;
54
+ down?: (context: MigrationContext) => Promise<void>;
55
+ }
56
+ interface Migration {
57
+ id: string;
58
+ description: string;
59
+ up: (context: MigrationContext) => Promise<void>;
60
+ down?: (context: MigrationContext) => Promise<void>;
61
+ }
62
+ interface MigrationResult {
63
+ migrationId: string;
64
+ success: boolean;
65
+ error?: Error;
66
+ rolledBack: boolean;
67
+ }
68
+ interface BackupMetadata {
69
+ backupId: string;
70
+ createdAt: string;
71
+ workspaceDir: string;
72
+ cliVersion: string;
73
+ files: string[];
74
+ }
75
+ interface JournalEntry {
76
+ migrationId: string;
77
+ appliedAt: string;
78
+ backupId: string | null;
79
+ success: boolean;
80
+ rolledBack: boolean;
81
+ error?: string;
82
+ }
83
+ //#endregion
84
+ //#region src/migrations/backup.d.ts
85
+ declare function createBackup(workspaceDir: string): string;
86
+ declare function restoreBackup(workspaceDir: string, backupId: string): void;
87
+ declare function deleteBackup(workspaceDir: string, backupId: string): void;
88
+ declare function listBackups(workspaceDir: string): BackupMetadata[];
89
+ declare function getBackupMetadata(workspaceDir: string, backupId: string): BackupMetadata | null;
90
+ declare function backupExists(workspaceDir: string, backupId: string): boolean;
91
+ //#endregion
92
+ //#region src/migrations/journal.d.ts
93
+ interface JournalSchema {
94
+ entries: JournalEntry[];
95
+ }
96
+ declare function readJournal(workspaceDir: string): JournalSchema;
97
+ declare function writeJournal(workspaceDir: string, journal: JournalSchema): void;
98
+ declare function addJournalEntry(workspaceDir: string, entry: JournalEntry): void;
99
+ declare function createJournalEntry(migrationId: string, backupId: string | null, success: boolean, rolledBack?: boolean, error?: Error): JournalEntry;
100
+ declare function getJournalEntries(workspaceDir: string): JournalEntry[];
101
+ declare function getLastSuccessfulEntry(workspaceDir: string): JournalEntry | null;
102
+ declare function getMigrationHistory(workspaceDir: string, migrationId: string): JournalEntry[];
103
+ declare function wasMigrationSuccessful(workspaceDir: string, migrationId: string): boolean;
104
+ declare function getFailedMigrations(workspaceDir: string): JournalEntry[];
105
+ declare function clearJournal(workspaceDir: string): void;
106
+ //#endregion
107
+ //#region src/migrations/loader.d.ts
108
+ interface LoadedMigrations {
109
+ migrations: Migration[];
110
+ order: string[];
111
+ }
112
+ interface LoadedInteractiveMigration {
113
+ migration: Migration;
114
+ getAffectedPresentations?: (workspaceDir: string) => PresentationInfo[];
115
+ }
116
+ declare function loadMigrations(): Promise<LoadedMigrations>;
117
+ declare function getMigrationById(id: string): Promise<Migration | null>;
118
+ declare function loadInteractiveMigration(id: string): Promise<LoadedInteractiveMigration | null>;
119
+ //#endregion
120
+ //#region src/migrations/manifest.d.ts
121
+ interface MigrationManifestEntry {
122
+ id: string;
123
+ description: string;
124
+ version: string;
125
+ breaking?: boolean;
126
+ dependencies?: string[];
127
+ }
128
+ interface MigrationsManifest {
129
+ version: string;
130
+ migrations: MigrationManifestEntry[];
131
+ }
132
+ declare function readManifest(migrationsDir: string): MigrationsManifest | null;
133
+ declare function writeManifest(migrationsDir: string, manifest: MigrationsManifest): void;
134
+ declare function createEmptyManifest(): MigrationsManifest;
135
+ declare function validateManifest(manifest: MigrationsManifest): string[];
136
+ declare function getMigrationOrder(manifest: MigrationsManifest): string[];
137
+ //#endregion
138
+ //#region src/migrations/runner.d.ts
139
+ interface RunnerOptions {
140
+ workspaceDir: string;
141
+ migrationsDir: string;
142
+ apply?: boolean;
143
+ migrations?: Migration[];
144
+ migrationOptions?: Record<string, Record<string, unknown>>;
145
+ }
146
+ interface DryRunResult {
147
+ migrationId: string;
148
+ description: string;
149
+ wouldApply: boolean;
150
+ alreadyApplied: boolean;
151
+ breaking?: boolean;
152
+ }
153
+ interface RunResult {
154
+ success: boolean;
155
+ applied: MigrationResult[];
156
+ skipped: string[];
157
+ failed: MigrationResult | null;
158
+ backupId: string | null;
159
+ rolledBack: boolean;
160
+ }
161
+ declare function dryRun(options: RunnerOptions): DryRunResult[];
162
+ declare function formatDryRunOutput(results: DryRunResult[]): string;
163
+ declare function run(options: RunnerOptions): Promise<RunResult>;
164
+ declare function formatRunOutput(result: RunResult): string;
165
+ //#endregion
166
+ //#region src/transformers/json.d.ts
167
+ interface JsonTransformResult<T = unknown> {
168
+ original: T;
169
+ transformed: T;
170
+ changed: boolean;
171
+ }
172
+ declare function readJsonFile<T = unknown>(filePath: string): T;
173
+ declare function writeJsonFile<T>(filePath: string, data: T, indent?: number): void;
174
+ declare function transformJson<T = unknown>(filePath: string, transformer: (data: T) => T): JsonTransformResult<T>;
175
+ declare function getJsonValue<T = unknown>(data: unknown, path: string): T | undefined;
176
+ declare function setJsonValue<T>(data: T, path: string, value: unknown): T;
177
+ declare function deleteJsonValue<T>(data: T, path: string): T;
178
+ declare function mergeJson<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
179
+ //#endregion
180
+ //#region src/transformers/yaml.d.ts
181
+ interface YamlTransformResult<T = unknown> {
182
+ original: T;
183
+ transformed: T;
184
+ changed: boolean;
185
+ }
186
+ declare function readYamlFile<T = unknown>(filePath: string): T;
187
+ declare function writeYamlFile<T>(filePath: string, data: T): void;
188
+ declare function readYamlDocument(filePath: string): Document;
189
+ declare function writeYamlDocument(filePath: string, doc: Document): void;
190
+ declare function transformYaml<T = unknown>(filePath: string, transformer: (data: T) => T): YamlTransformResult<T>;
191
+ declare function transformYamlDocument(filePath: string, transformer: (doc: Document) => void): {
192
+ changed: boolean;
193
+ };
194
+ declare function getYamlValue<T = unknown>(data: unknown, path: string): T | undefined;
195
+ declare function setYamlValue<T>(data: T, path: string, value: unknown): T;
196
+ declare function deleteYamlValue<T>(data: T, path: string): T;
197
+ declare function mergeYaml<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
198
+ //#endregion
199
+ //#region src/transformers/typescript.d.ts
200
+ interface TypeScriptTransformResult {
201
+ changed: boolean;
202
+ originalContent: string;
203
+ newContent: string;
204
+ }
205
+ interface TypeScriptTransformer {
206
+ project: Project;
207
+ sourceFile: SourceFile;
208
+ save: () => TypeScriptTransformResult;
209
+ }
210
+ declare function createTransformer(filePath: string): TypeScriptTransformer;
211
+ declare function transformTypeScript(filePath: string, transformer: (sourceFile: SourceFile) => void): TypeScriptTransformResult;
212
+ declare function addImport(sourceFile: SourceFile, moduleSpecifier: string, namedImports: string[]): ImportDeclaration | null;
213
+ declare function removeImport(sourceFile: SourceFile, moduleSpecifier: string, namedImports?: string[]): boolean;
214
+ declare function addExport(sourceFile: SourceFile, moduleSpecifier: string, namedExports: string[]): ExportDeclaration;
215
+ declare function findObjectLiteral(sourceFile: SourceFile, variableName: string): ObjectLiteralExpression | undefined;
216
+ declare function findArrayLiteral(sourceFile: SourceFile, variableName: string): ArrayLiteralExpression | undefined;
217
+ declare function getObjectProperty(obj: ObjectLiteralExpression, propertyName: string): PropertyAssignment | undefined;
218
+ declare function setObjectProperty(obj: ObjectLiteralExpression, propertyName: string, value: string): void;
219
+ declare function removeObjectProperty(obj: ObjectLiteralExpression, propertyName: string): boolean;
220
+ declare function addArrayElement(arr: ArrayLiteralExpression, element: string): void;
221
+ declare function removeArrayElement(arr: ArrayLiteralExpression, element: string): boolean;
222
+ declare function findDefaultExportObject(sourceFile: SourceFile): ObjectLiteralExpression | undefined;
223
+ declare function findCallExpression(sourceFile: SourceFile, functionName: string): ObjectLiteralExpression | undefined;
224
+ //#endregion
225
+ //#region src/commands/status.d.ts
226
+ interface StatusResult {
227
+ cliVersion: string;
228
+ stateVersion: string | null;
229
+ createdAt: string | null;
230
+ lastUpdatedAt: string | null;
231
+ pendingMigrations: number;
232
+ latestVersion: string | null;
233
+ updateAvailable: boolean;
234
+ nativePresentations: string[];
235
+ importedPresentations: ImportedPresentation[];
236
+ }
237
+ declare function getStatus(workspaceDir?: string): Promise<StatusResult>;
238
+ declare function formatStatus(status: StatusResult): string;
239
+ declare function status(workspaceDir?: string): Promise<void>;
240
+ //#endregion
241
+ export { AppliedMigration, BackupMetadata, DryRunResult, ImportedPresentation, InteractiveMigration, JournalEntry, JsonTransformResult, LoadedInteractiveMigration, LoadedMigrations, Migration, MigrationContext, MigrationManifestEntry, MigrationResult, MigrationsManifest, PresentationInfo, RunResult, RunnerOptions, StateSchema, StatusResult, TypeScriptTransformResult, TypeScriptTransformer, YamlTransformResult, addArrayElement, addExport, addImport, addImportedPresentation, addJournalEntry, addMigration, backupExists, clearJournal, createBackup, createEmptyManifest, createInitialState, createJournalEntry, createTransformer, deleteBackup, deleteJsonValue, deleteYamlValue, dryRun, findArrayLiteral, findCallExpression, findDefaultExportObject, findObjectLiteral, findWorkspaceRoot, formatDryRunOutput, formatRunOutput, formatStatus, getBackupMetadata, getFailedMigrations, getImportedPresentations, getJournalEntries, getJsonValue, getLastSuccessfulEntry, getMigrationById, getMigrationHistory, getMigrationOrder, getObjectProperty, getStatus, getYamlValue, hasMigration, initializeState, listBackups, loadInteractiveMigration, loadMigrations, mergeJson, mergeYaml, readJournal, readJsonFile, readManifest, readState, readYamlDocument, readYamlFile, removeArrayElement, removeImport, removeImportedPresentation, removeObjectProperty, restoreBackup, run, run$1 as runCli, setJsonValue, setObjectProperty, setYamlValue, stateExists, status, transformJson, transformTypeScript, transformYaml, transformYamlDocument, updateCliVersion, validateManifest, wasMigrationSuccessful, writeJournal, writeJsonFile, writeManifest, writeState, writeYamlDocument, writeYamlFile };