@openfairygui/functions 0.1.0 → 0.2.0-alpha.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.
- package/README.md +36 -1
- package/dist/index.cjs +859 -11
- package/dist/index.d.cts +69 -2
- package/dist/index.d.ts +69 -2
- package/dist/index.js +859 -13
- package/package.json +26 -26
- package/src/atlas.ts +335 -391
- package/src/index.ts +19 -3
- package/src/inspect.ts +98 -98
- package/src/max-rects-packer-compat.ts +3 -3
- package/src/rename.ts +66 -66
- package/src/restore.ts +1277 -0
- package/src/uam-transaction.ts +68 -0
- package/src/validate.ts +173 -173
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Document, FileSystem, Package, ProjectSettings, PublishSettings, Transform } from "@openfairygui/core";
|
|
1
|
+
import { Document, FileSystem, Package, ProjectSettings, PublishSettings, Transform, UamProject, UamTransactionErrorCode, UamTransactionOperation, UamTransactionSupportIssue, UamValidationIssue } from "@openfairygui/core";
|
|
2
2
|
|
|
3
3
|
//#region src/inspect.d.ts
|
|
4
4
|
/**
|
|
@@ -322,6 +322,49 @@ interface PublishCodeGenerationOptions {
|
|
|
322
322
|
}
|
|
323
323
|
declare function publishCodeGeneration(doc: Document, options: PublishCodeGenerationOptions): Promise<void>;
|
|
324
324
|
//#endregion
|
|
325
|
+
//#region src/restore.d.ts
|
|
326
|
+
interface RestoreImageCropInput {
|
|
327
|
+
sourcePath: string;
|
|
328
|
+
outputPath: string;
|
|
329
|
+
left: number;
|
|
330
|
+
top: number;
|
|
331
|
+
width: number;
|
|
332
|
+
height: number;
|
|
333
|
+
rotated: boolean;
|
|
334
|
+
offsetX: number;
|
|
335
|
+
offsetY: number;
|
|
336
|
+
expectedWidth: number;
|
|
337
|
+
expectedHeight: number;
|
|
338
|
+
}
|
|
339
|
+
type RestoreImageCropper = (input: RestoreImageCropInput) => Promise<void>;
|
|
340
|
+
type RestoreImageExtractInput = Omit<RestoreImageCropInput, 'outputPath'>;
|
|
341
|
+
type RestoreImageExtractor = (input: RestoreImageExtractInput) => Promise<Uint8Array>;
|
|
342
|
+
interface RestoreResult {
|
|
343
|
+
document: Document;
|
|
344
|
+
projectPath: string;
|
|
345
|
+
warnings: string[];
|
|
346
|
+
}
|
|
347
|
+
interface RestoreFileSystem extends Pick<FileSystem, 'readFile' | 'readFileRaw' | 'writeFile' | 'writeFileRaw' | 'mkdir' | 'exists' | 'join' | 'dirname'> {
|
|
348
|
+
readdir(path: string): Promise<string[]>;
|
|
349
|
+
isFile(path: string): Promise<boolean>;
|
|
350
|
+
resolvePath(path: string): string | Promise<string>;
|
|
351
|
+
rm?: (path: string, options?: {
|
|
352
|
+
recursive?: boolean;
|
|
353
|
+
force?: boolean;
|
|
354
|
+
}) => Promise<void>;
|
|
355
|
+
}
|
|
356
|
+
interface RestoreOptions {
|
|
357
|
+
inputDir: string;
|
|
358
|
+
output: string;
|
|
359
|
+
fs: RestoreFileSystem;
|
|
360
|
+
packages?: string[];
|
|
361
|
+
force?: boolean;
|
|
362
|
+
projectType?: number;
|
|
363
|
+
cropImage?: RestoreImageCropper;
|
|
364
|
+
extractImage?: RestoreImageExtractor;
|
|
365
|
+
}
|
|
366
|
+
declare function restore(options: RestoreOptions): Promise<RestoreResult>;
|
|
367
|
+
//#endregion
|
|
325
368
|
//#region src/publish.d.ts
|
|
326
369
|
interface PublishOptions {
|
|
327
370
|
/**
|
|
@@ -413,10 +456,34 @@ declare function resolvePublishOptions(doc: Document, overrides?: ResolvePublish
|
|
|
413
456
|
*/
|
|
414
457
|
declare function publish(options: PublishOptions): Transform;
|
|
415
458
|
//#endregion
|
|
459
|
+
//#region src/uam-transaction.d.ts
|
|
460
|
+
interface ApplyUamTransactionAppInput {
|
|
461
|
+
project: UamProject;
|
|
462
|
+
operations: UamTransactionOperation[];
|
|
463
|
+
}
|
|
464
|
+
interface ApplyUamTransactionAppError {
|
|
465
|
+
code: UamTransactionErrorCode;
|
|
466
|
+
stage: 'preflight' | 'execution' | 'postflight';
|
|
467
|
+
message: string;
|
|
468
|
+
opIndex?: number;
|
|
469
|
+
opId?: string;
|
|
470
|
+
opKind?: UamTransactionOperation['kind'];
|
|
471
|
+
selector?: Record<string, unknown>;
|
|
472
|
+
issues?: UamValidationIssue[] | UamTransactionSupportIssue[];
|
|
473
|
+
}
|
|
474
|
+
type ApplyUamTransactionAppResult = {
|
|
475
|
+
ok: true;
|
|
476
|
+
project: UamProject;
|
|
477
|
+
} | {
|
|
478
|
+
ok: false;
|
|
479
|
+
error: ApplyUamTransactionAppError;
|
|
480
|
+
};
|
|
481
|
+
declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
|
|
482
|
+
//#endregion
|
|
416
483
|
//#region src/utils.d.ts
|
|
417
484
|
/**
|
|
418
485
|
* Wraps a transform function, assigning it a name for the transform stack.
|
|
419
486
|
*/
|
|
420
487
|
declare function createTransform(name: string, fn: Transform): Transform;
|
|
421
488
|
//#endregion
|
|
422
|
-
export { AUTO_GENERATED_CODE_MARK, type AtlasOptions, type CliAtlasSettings, type CliPublishSettings, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type InspectCategoryReport, type InspectReport, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPublishAtlasOptions, type ResolvedPublishOptions, type RootProjectSettings, type ValidateOptions, type ValidationIssue, type ValidationResult, ValidationSeverity, atlas, createTransform, inspect, prune, publish, publishCodeGeneration, rename, resolvePublishOptions, validate };
|
|
489
|
+
export { AUTO_GENERATED_CODE_MARK, type ApplyUamTransactionAppError, type ApplyUamTransactionAppInput, type ApplyUamTransactionAppResult, type AtlasOptions, type CliAtlasSettings, type CliPublishSettings, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type InspectCategoryReport, type InspectReport, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPublishAtlasOptions, type ResolvedPublishOptions, type RestoreFileSystem, type RestoreImageCropInput, type RestoreImageCropper, type RestoreImageExtractInput, type RestoreImageExtractor, type RestoreOptions, type RestoreResult, type RootProjectSettings, type ValidateOptions, type ValidationIssue, type ValidationResult, ValidationSeverity, applyUamTransactionApp, atlas, createTransform, inspect, prune, publish, publishCodeGeneration, rename, resolvePublishOptions, restore, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Document, FileSystem, Package, ProjectSettings, PublishSettings, Transform } from "@openfairygui/core";
|
|
1
|
+
import { Document, FileSystem, Package, ProjectSettings, PublishSettings, Transform, UamProject, UamTransactionErrorCode, UamTransactionOperation, UamTransactionSupportIssue, UamValidationIssue } from "@openfairygui/core";
|
|
2
2
|
|
|
3
3
|
//#region src/inspect.d.ts
|
|
4
4
|
/**
|
|
@@ -322,6 +322,49 @@ interface PublishCodeGenerationOptions {
|
|
|
322
322
|
}
|
|
323
323
|
declare function publishCodeGeneration(doc: Document, options: PublishCodeGenerationOptions): Promise<void>;
|
|
324
324
|
//#endregion
|
|
325
|
+
//#region src/restore.d.ts
|
|
326
|
+
interface RestoreImageCropInput {
|
|
327
|
+
sourcePath: string;
|
|
328
|
+
outputPath: string;
|
|
329
|
+
left: number;
|
|
330
|
+
top: number;
|
|
331
|
+
width: number;
|
|
332
|
+
height: number;
|
|
333
|
+
rotated: boolean;
|
|
334
|
+
offsetX: number;
|
|
335
|
+
offsetY: number;
|
|
336
|
+
expectedWidth: number;
|
|
337
|
+
expectedHeight: number;
|
|
338
|
+
}
|
|
339
|
+
type RestoreImageCropper = (input: RestoreImageCropInput) => Promise<void>;
|
|
340
|
+
type RestoreImageExtractInput = Omit<RestoreImageCropInput, 'outputPath'>;
|
|
341
|
+
type RestoreImageExtractor = (input: RestoreImageExtractInput) => Promise<Uint8Array>;
|
|
342
|
+
interface RestoreResult {
|
|
343
|
+
document: Document;
|
|
344
|
+
projectPath: string;
|
|
345
|
+
warnings: string[];
|
|
346
|
+
}
|
|
347
|
+
interface RestoreFileSystem extends Pick<FileSystem, 'readFile' | 'readFileRaw' | 'writeFile' | 'writeFileRaw' | 'mkdir' | 'exists' | 'join' | 'dirname'> {
|
|
348
|
+
readdir(path: string): Promise<string[]>;
|
|
349
|
+
isFile(path: string): Promise<boolean>;
|
|
350
|
+
resolvePath(path: string): string | Promise<string>;
|
|
351
|
+
rm?: (path: string, options?: {
|
|
352
|
+
recursive?: boolean;
|
|
353
|
+
force?: boolean;
|
|
354
|
+
}) => Promise<void>;
|
|
355
|
+
}
|
|
356
|
+
interface RestoreOptions {
|
|
357
|
+
inputDir: string;
|
|
358
|
+
output: string;
|
|
359
|
+
fs: RestoreFileSystem;
|
|
360
|
+
packages?: string[];
|
|
361
|
+
force?: boolean;
|
|
362
|
+
projectType?: number;
|
|
363
|
+
cropImage?: RestoreImageCropper;
|
|
364
|
+
extractImage?: RestoreImageExtractor;
|
|
365
|
+
}
|
|
366
|
+
declare function restore(options: RestoreOptions): Promise<RestoreResult>;
|
|
367
|
+
//#endregion
|
|
325
368
|
//#region src/publish.d.ts
|
|
326
369
|
interface PublishOptions {
|
|
327
370
|
/**
|
|
@@ -413,10 +456,34 @@ declare function resolvePublishOptions(doc: Document, overrides?: ResolvePublish
|
|
|
413
456
|
*/
|
|
414
457
|
declare function publish(options: PublishOptions): Transform;
|
|
415
458
|
//#endregion
|
|
459
|
+
//#region src/uam-transaction.d.ts
|
|
460
|
+
interface ApplyUamTransactionAppInput {
|
|
461
|
+
project: UamProject;
|
|
462
|
+
operations: UamTransactionOperation[];
|
|
463
|
+
}
|
|
464
|
+
interface ApplyUamTransactionAppError {
|
|
465
|
+
code: UamTransactionErrorCode;
|
|
466
|
+
stage: 'preflight' | 'execution' | 'postflight';
|
|
467
|
+
message: string;
|
|
468
|
+
opIndex?: number;
|
|
469
|
+
opId?: string;
|
|
470
|
+
opKind?: UamTransactionOperation['kind'];
|
|
471
|
+
selector?: Record<string, unknown>;
|
|
472
|
+
issues?: UamValidationIssue[] | UamTransactionSupportIssue[];
|
|
473
|
+
}
|
|
474
|
+
type ApplyUamTransactionAppResult = {
|
|
475
|
+
ok: true;
|
|
476
|
+
project: UamProject;
|
|
477
|
+
} | {
|
|
478
|
+
ok: false;
|
|
479
|
+
error: ApplyUamTransactionAppError;
|
|
480
|
+
};
|
|
481
|
+
declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
|
|
482
|
+
//#endregion
|
|
416
483
|
//#region src/utils.d.ts
|
|
417
484
|
/**
|
|
418
485
|
* Wraps a transform function, assigning it a name for the transform stack.
|
|
419
486
|
*/
|
|
420
487
|
declare function createTransform(name: string, fn: Transform): Transform;
|
|
421
488
|
//#endregion
|
|
422
|
-
export { AUTO_GENERATED_CODE_MARK, type AtlasOptions, type CliAtlasSettings, type CliPublishSettings, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type InspectCategoryReport, type InspectReport, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPublishAtlasOptions, type ResolvedPublishOptions, type RootProjectSettings, type ValidateOptions, type ValidationIssue, type ValidationResult, ValidationSeverity, atlas, createTransform, inspect, prune, publish, publishCodeGeneration, rename, resolvePublishOptions, validate };
|
|
489
|
+
export { AUTO_GENERATED_CODE_MARK, type ApplyUamTransactionAppError, type ApplyUamTransactionAppInput, type ApplyUamTransactionAppResult, type AtlasOptions, type CliAtlasSettings, type CliPublishSettings, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type InspectCategoryReport, type InspectReport, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPublishAtlasOptions, type ResolvedPublishOptions, type RestoreFileSystem, type RestoreImageCropInput, type RestoreImageCropper, type RestoreImageExtractInput, type RestoreImageExtractor, type RestoreOptions, type RestoreResult, type RootProjectSettings, type ValidateOptions, type ValidationIssue, type ValidationResult, ValidationSeverity, applyUamTransactionApp, atlas, createTransform, inspect, prune, publish, publishCodeGeneration, rename, resolvePublishOptions, restore, validate };
|