@openfairygui/functions 0.2.0-alpha.32 → 0.2.0-alpha.34
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/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/uam-transaction.cjs +29 -14
- package/dist/uam-transaction.d.cts +2 -1
- package/dist/uam-transaction.d.ts +2 -1
- package/dist/uam-transaction.js +30 -16
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/uam-transaction.ts +34 -17
package/dist/index.cjs
CHANGED
|
@@ -323,6 +323,7 @@ function rename(options) {
|
|
|
323
323
|
exports.AUTO_GENERATED_CODE_MARK = require_publish.AUTO_GENERATED_CODE_MARK;
|
|
324
324
|
exports.ValidationSeverity = ValidationSeverity;
|
|
325
325
|
exports.applyUamTransactionApp = require_uam_transaction.applyUamTransactionApp;
|
|
326
|
+
exports.applyUamTransactionAppAsync = require_uam_transaction.applyUamTransactionAppAsync;
|
|
326
327
|
exports.atlas = require_publish.atlas;
|
|
327
328
|
exports.buildCodegenClasses = require_publish.buildCodegenClasses;
|
|
328
329
|
exports.createTransform = require_publish.createTransform;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as AtlasRasterInput, c as AtlasRasterResolvedBuffer, d as PublishSourceFileSystem, i as AtlasRasterCompositeInput, l as PublishFileSystem, n as atlas, o as AtlasRasterMetadata, r as AtlasRasterBackend, s as AtlasRasterPipeline, t as AtlasOptions, u as PublishOutputFileSystem } from "./atlas-CHsu2Y8i.cjs";
|
|
2
2
|
import { A as ExtrasMap, B as ResolvedPublishOptions, C as MaybePromise, D as CliAtlasSettings, E as PluginModule, F as RootProjectSettings, I as publish, L as PublishOptions, M as HasOptionalSrc, N as HasOptionalUrl, O as CliCodeGenerationSettings, P as PublishDependency, R as ResolvePublishOptionsOverrides, S as LoadedPlugin, T as PluginManifest, V as resolvePublishOptions, _ as encodeText, a as RestoreImageExtractor, b as CodeWriter, c as restore, d as CodegenMember, f as CodegenReferencedComponent, g as decodeText, h as buildCodegenClasses, i as RestoreImageExtractInput, j as HasOptionalFont, k as CliPublishSettings, l as AUTO_GENERATED_CODE_MARK, m as ResolvedPackageCodegenPlan, n as RestoreImageCropInput, o as RestoreOptions, p as PublishCodeGenerationOptions, r as RestoreImageCropper, s as RestoreResult, t as RestoreFileSystem, u as CodegenClass, v as publishCodeGeneration, w as Plugin, x as ICodeWriterConfig, y as resolvePackageCodegenPlan, z as ResolvedPublishAtlasOptions } from "./restore-BeWaJNjR.cjs";
|
|
3
|
-
import { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp } from "./uam-transaction.cjs";
|
|
3
|
+
import { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp, applyUamTransactionAppAsync } from "./uam-transaction.cjs";
|
|
4
4
|
import { Document, Transform } from "@openfairygui/core";
|
|
5
5
|
|
|
6
6
|
//#region src/inspect.d.ts
|
|
@@ -174,4 +174,4 @@ declare function rename(options: RenameOptions): Transform;
|
|
|
174
174
|
*/
|
|
175
175
|
declare function createTransform(name: string, fn: Transform): Transform;
|
|
176
176
|
//#endregion
|
|
177
|
-
export { AUTO_GENERATED_CODE_MARK, type ApplyUamTransactionAppDiagnostic, type ApplyUamTransactionAppError, type ApplyUamTransactionAppInput, type ApplyUamTransactionAppResult, type AtlasOptions, type AtlasRasterBackend, type AtlasRasterCompositeInput, type AtlasRasterInput, type AtlasRasterMetadata, type AtlasRasterPipeline, type AtlasRasterResolvedBuffer, type CliAtlasSettings, type CliCodeGenerationSettings, type CliPublishSettings, type CodeWriter, type CodegenClass, type CodegenMember, type CodegenReferencedComponent, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type ICodeWriterConfig, type InspectCategoryReport, type InspectReport, type LoadedPlugin, type MaybePromise, type Plugin, type PluginManifest, type PluginModule, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type PublishOutputFileSystem, type PublishSourceFileSystem, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPackageCodegenPlan, 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, buildCodegenClasses, createTransform, decodeText, encodeText, inspect, prune, publish, publishCodeGeneration, rename, resolvePackageCodegenPlan, resolvePublishOptions, restore, validate };
|
|
177
|
+
export { AUTO_GENERATED_CODE_MARK, type ApplyUamTransactionAppDiagnostic, type ApplyUamTransactionAppError, type ApplyUamTransactionAppInput, type ApplyUamTransactionAppResult, type AtlasOptions, type AtlasRasterBackend, type AtlasRasterCompositeInput, type AtlasRasterInput, type AtlasRasterMetadata, type AtlasRasterPipeline, type AtlasRasterResolvedBuffer, type CliAtlasSettings, type CliCodeGenerationSettings, type CliPublishSettings, type CodeWriter, type CodegenClass, type CodegenMember, type CodegenReferencedComponent, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type ICodeWriterConfig, type InspectCategoryReport, type InspectReport, type LoadedPlugin, type MaybePromise, type Plugin, type PluginManifest, type PluginModule, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type PublishOutputFileSystem, type PublishSourceFileSystem, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPackageCodegenPlan, 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, applyUamTransactionAppAsync, atlas, buildCodegenClasses, createTransform, decodeText, encodeText, inspect, prune, publish, publishCodeGeneration, rename, resolvePackageCodegenPlan, resolvePublishOptions, restore, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as AtlasRasterInput, c as AtlasRasterResolvedBuffer, d as PublishSourceFileSystem, i as AtlasRasterCompositeInput, l as PublishFileSystem, n as atlas, o as AtlasRasterMetadata, r as AtlasRasterBackend, s as AtlasRasterPipeline, t as AtlasOptions, u as PublishOutputFileSystem } from "./atlas-C6tbl7nn.js";
|
|
2
2
|
import { A as ExtrasMap, B as ResolvedPublishOptions, C as MaybePromise, D as CliAtlasSettings, E as PluginModule, F as RootProjectSettings, I as publish, L as PublishOptions, M as HasOptionalSrc, N as HasOptionalUrl, O as CliCodeGenerationSettings, P as PublishDependency, R as ResolvePublishOptionsOverrides, S as LoadedPlugin, T as PluginManifest, V as resolvePublishOptions, _ as encodeText, a as RestoreImageExtractor, b as CodeWriter, c as restore, d as CodegenMember, f as CodegenReferencedComponent, g as decodeText, h as buildCodegenClasses, i as RestoreImageExtractInput, j as HasOptionalFont, k as CliPublishSettings, l as AUTO_GENERATED_CODE_MARK, m as ResolvedPackageCodegenPlan, n as RestoreImageCropInput, o as RestoreOptions, p as PublishCodeGenerationOptions, r as RestoreImageCropper, s as RestoreResult, t as RestoreFileSystem, u as CodegenClass, v as publishCodeGeneration, w as Plugin, x as ICodeWriterConfig, y as resolvePackageCodegenPlan, z as ResolvedPublishAtlasOptions } from "./restore-Dh0-Nvms.js";
|
|
3
|
-
import { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp } from "./uam-transaction.js";
|
|
3
|
+
import { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp, applyUamTransactionAppAsync } from "./uam-transaction.js";
|
|
4
4
|
import { Document, Transform } from "@openfairygui/core";
|
|
5
5
|
|
|
6
6
|
//#region src/inspect.d.ts
|
|
@@ -174,4 +174,4 @@ declare function rename(options: RenameOptions): Transform;
|
|
|
174
174
|
*/
|
|
175
175
|
declare function createTransform(name: string, fn: Transform): Transform;
|
|
176
176
|
//#endregion
|
|
177
|
-
export { AUTO_GENERATED_CODE_MARK, type ApplyUamTransactionAppDiagnostic, type ApplyUamTransactionAppError, type ApplyUamTransactionAppInput, type ApplyUamTransactionAppResult, type AtlasOptions, type AtlasRasterBackend, type AtlasRasterCompositeInput, type AtlasRasterInput, type AtlasRasterMetadata, type AtlasRasterPipeline, type AtlasRasterResolvedBuffer, type CliAtlasSettings, type CliCodeGenerationSettings, type CliPublishSettings, type CodeWriter, type CodegenClass, type CodegenMember, type CodegenReferencedComponent, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type ICodeWriterConfig, type InspectCategoryReport, type InspectReport, type LoadedPlugin, type MaybePromise, type Plugin, type PluginManifest, type PluginModule, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type PublishOutputFileSystem, type PublishSourceFileSystem, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPackageCodegenPlan, 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, buildCodegenClasses, createTransform, decodeText, encodeText, inspect, prune, publish, publishCodeGeneration, rename, resolvePackageCodegenPlan, resolvePublishOptions, restore, validate };
|
|
177
|
+
export { AUTO_GENERATED_CODE_MARK, type ApplyUamTransactionAppDiagnostic, type ApplyUamTransactionAppError, type ApplyUamTransactionAppInput, type ApplyUamTransactionAppResult, type AtlasOptions, type AtlasRasterBackend, type AtlasRasterCompositeInput, type AtlasRasterInput, type AtlasRasterMetadata, type AtlasRasterPipeline, type AtlasRasterResolvedBuffer, type CliAtlasSettings, type CliCodeGenerationSettings, type CliPublishSettings, type CodeWriter, type CodegenClass, type CodegenMember, type CodegenReferencedComponent, type ExtrasMap, type HasOptionalFont, type HasOptionalSrc, type HasOptionalUrl, type ICodeWriterConfig, type InspectCategoryReport, type InspectReport, type LoadedPlugin, type MaybePromise, type Plugin, type PluginManifest, type PluginModule, type PruneOptions, type PublishCodeGenerationOptions, type PublishDependency, type PublishFileSystem, type PublishOptions, type PublishOutputFileSystem, type PublishSourceFileSystem, type RenameOptions, type ResolvePublishOptionsOverrides, type ResolvedPackageCodegenPlan, 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, applyUamTransactionAppAsync, atlas, buildCodegenClasses, createTransform, decodeText, encodeText, inspect, prune, publish, publishCodeGeneration, rename, resolvePackageCodegenPlan, resolvePublishOptions, restore, validate };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as decodeText, c as resolvePackageCodegenPlan, h as createTransform, i as buildCodegenClasses, m as atlas, n as resolvePublishOptions, o as encodeText, r as AUTO_GENERATED_CODE_MARK, s as publishCodeGeneration, t as publish } from "./publish-BJk8UzRP.js";
|
|
2
2
|
import { t as restore } from "./restore-C98ugT2H.js";
|
|
3
|
-
import { applyUamTransactionApp } from "./uam-transaction.js";
|
|
3
|
+
import { applyUamTransactionApp, applyUamTransactionAppAsync } from "./uam-transaction.js";
|
|
4
4
|
//#region src/inspect.ts
|
|
5
5
|
function mapResource(resource) {
|
|
6
6
|
return {
|
|
@@ -319,4 +319,4 @@ function rename(options) {
|
|
|
319
319
|
});
|
|
320
320
|
}
|
|
321
321
|
//#endregion
|
|
322
|
-
export { AUTO_GENERATED_CODE_MARK, ValidationSeverity, applyUamTransactionApp, atlas, buildCodegenClasses, createTransform, decodeText, encodeText, inspect, prune, publish, publishCodeGeneration, rename, resolvePackageCodegenPlan, resolvePublishOptions, restore, validate };
|
|
322
|
+
export { AUTO_GENERATED_CODE_MARK, ValidationSeverity, applyUamTransactionApp, applyUamTransactionAppAsync, atlas, buildCodegenClasses, createTransform, decodeText, encodeText, inspect, prune, publish, publishCodeGeneration, rename, resolvePackageCodegenPlan, resolvePublishOptions, restore, validate };
|
package/dist/uam-transaction.cjs
CHANGED
|
@@ -50,6 +50,23 @@ function mapTransactionDiagnostics(error) {
|
|
|
50
50
|
opId: error.opId
|
|
51
51
|
})];
|
|
52
52
|
}
|
|
53
|
+
function transactionFailure(error) {
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
error: {
|
|
57
|
+
code: error.code,
|
|
58
|
+
stage: mapTransactionErrorStage(error),
|
|
59
|
+
message: error.message,
|
|
60
|
+
opIndex: error.opIndex,
|
|
61
|
+
opId: error.opId,
|
|
62
|
+
opKind: error.opKind,
|
|
63
|
+
operationKind: error.opKind,
|
|
64
|
+
selector: error.selector,
|
|
65
|
+
issues: error.issues,
|
|
66
|
+
diagnostics: mapTransactionDiagnostics(error)
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
53
70
|
function applyUamTransactionApp(input) {
|
|
54
71
|
try {
|
|
55
72
|
return {
|
|
@@ -57,23 +74,21 @@ function applyUamTransactionApp(input) {
|
|
|
57
74
|
project: (0, _openfairygui_core_uam.applyUamTransaction)(input.project, input.operations)
|
|
58
75
|
};
|
|
59
76
|
} catch (error) {
|
|
60
|
-
if (error instanceof _openfairygui_core_uam.UamTransactionError) return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
operationKind: error.opKind,
|
|
70
|
-
selector: error.selector,
|
|
71
|
-
issues: error.issues,
|
|
72
|
-
diagnostics: mapTransactionDiagnostics(error)
|
|
73
|
-
}
|
|
77
|
+
if (error instanceof _openfairygui_core_uam.UamTransactionError) return transactionFailure(error);
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function applyUamTransactionAppAsync(input) {
|
|
82
|
+
try {
|
|
83
|
+
return {
|
|
84
|
+
ok: true,
|
|
85
|
+
project: await (0, _openfairygui_core_uam.applyUamTransactionAsync)(input.project, input.operations)
|
|
74
86
|
};
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (error instanceof _openfairygui_core_uam.UamTransactionError) return transactionFailure(error);
|
|
75
89
|
throw error;
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
92
|
//#endregion
|
|
79
93
|
exports.applyUamTransactionApp = applyUamTransactionApp;
|
|
94
|
+
exports.applyUamTransactionAppAsync = applyUamTransactionAppAsync;
|
|
@@ -38,5 +38,6 @@ interface ApplyUamTransactionAppDiagnostic {
|
|
|
38
38
|
opId?: string;
|
|
39
39
|
}
|
|
40
40
|
declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
|
|
41
|
+
declare function applyUamTransactionAppAsync(input: ApplyUamTransactionAppInput): Promise<ApplyUamTransactionAppResult>;
|
|
41
42
|
//#endregion
|
|
42
|
-
export { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp };
|
|
43
|
+
export { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp, applyUamTransactionAppAsync };
|
|
@@ -38,5 +38,6 @@ interface ApplyUamTransactionAppDiagnostic {
|
|
|
38
38
|
opId?: string;
|
|
39
39
|
}
|
|
40
40
|
declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
|
|
41
|
+
declare function applyUamTransactionAppAsync(input: ApplyUamTransactionAppInput): Promise<ApplyUamTransactionAppResult>;
|
|
41
42
|
//#endregion
|
|
42
|
-
export { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp };
|
|
43
|
+
export { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp, applyUamTransactionAppAsync };
|
package/dist/uam-transaction.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UamTransactionError, applyUamTransaction } from "@openfairygui/core/uam";
|
|
1
|
+
import { UamTransactionError, applyUamTransaction, applyUamTransactionAsync } from "@openfairygui/core/uam";
|
|
2
2
|
//#region src/uam-transaction.ts
|
|
3
3
|
function mapTransactionErrorStage(error) {
|
|
4
4
|
switch (error.code) {
|
|
@@ -49,6 +49,23 @@ function mapTransactionDiagnostics(error) {
|
|
|
49
49
|
opId: error.opId
|
|
50
50
|
})];
|
|
51
51
|
}
|
|
52
|
+
function transactionFailure(error) {
|
|
53
|
+
return {
|
|
54
|
+
ok: false,
|
|
55
|
+
error: {
|
|
56
|
+
code: error.code,
|
|
57
|
+
stage: mapTransactionErrorStage(error),
|
|
58
|
+
message: error.message,
|
|
59
|
+
opIndex: error.opIndex,
|
|
60
|
+
opId: error.opId,
|
|
61
|
+
opKind: error.opKind,
|
|
62
|
+
operationKind: error.opKind,
|
|
63
|
+
selector: error.selector,
|
|
64
|
+
issues: error.issues,
|
|
65
|
+
diagnostics: mapTransactionDiagnostics(error)
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
52
69
|
function applyUamTransactionApp(input) {
|
|
53
70
|
try {
|
|
54
71
|
return {
|
|
@@ -56,23 +73,20 @@ function applyUamTransactionApp(input) {
|
|
|
56
73
|
project: applyUamTransaction(input.project, input.operations)
|
|
57
74
|
};
|
|
58
75
|
} catch (error) {
|
|
59
|
-
if (error instanceof UamTransactionError) return
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
operationKind: error.opKind,
|
|
69
|
-
selector: error.selector,
|
|
70
|
-
issues: error.issues,
|
|
71
|
-
diagnostics: mapTransactionDiagnostics(error)
|
|
72
|
-
}
|
|
76
|
+
if (error instanceof UamTransactionError) return transactionFailure(error);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function applyUamTransactionAppAsync(input) {
|
|
81
|
+
try {
|
|
82
|
+
return {
|
|
83
|
+
ok: true,
|
|
84
|
+
project: await applyUamTransactionAsync(input.project, input.operations)
|
|
73
85
|
};
|
|
86
|
+
} catch (error) {
|
|
87
|
+
if (error instanceof UamTransactionError) return transactionFailure(error);
|
|
74
88
|
throw error;
|
|
75
89
|
}
|
|
76
90
|
}
|
|
77
91
|
//#endregion
|
|
78
|
-
export { applyUamTransactionApp };
|
|
92
|
+
export { applyUamTransactionApp, applyUamTransactionAppAsync };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfairygui/functions",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.34",
|
|
4
4
|
"description": "FairyGUI Headless Authoring SDK — composable transform functions.",
|
|
5
5
|
"author": "OpenFairyGUI Contributors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"jiti": "^2.6.1",
|
|
77
|
-
"@openfairygui/core": "0.2.0-alpha.
|
|
77
|
+
"@openfairygui/core": "0.2.0-alpha.34"
|
|
78
78
|
},
|
|
79
79
|
"optionalDependencies": {
|
|
80
80
|
"sharp": ">=0.33.0"
|
package/src/index.ts
CHANGED
package/src/uam-transaction.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyUamTransaction,
|
|
3
|
+
applyUamTransactionAsync,
|
|
3
4
|
type UamProject,
|
|
4
5
|
UamTransactionError,
|
|
5
6
|
type UamTransactionErrorCode,
|
|
@@ -107,6 +108,24 @@ function mapTransactionDiagnostics(error: UamTransactionError): ApplyUamTransact
|
|
|
107
108
|
];
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
function transactionFailure(error: UamTransactionError): ApplyUamTransactionAppResult {
|
|
112
|
+
return {
|
|
113
|
+
ok: false,
|
|
114
|
+
error: {
|
|
115
|
+
code: error.code,
|
|
116
|
+
stage: mapTransactionErrorStage(error),
|
|
117
|
+
message: error.message,
|
|
118
|
+
opIndex: error.opIndex,
|
|
119
|
+
opId: error.opId,
|
|
120
|
+
opKind: error.opKind,
|
|
121
|
+
operationKind: error.opKind,
|
|
122
|
+
selector: error.selector,
|
|
123
|
+
issues: error.issues,
|
|
124
|
+
diagnostics: mapTransactionDiagnostics(error),
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
110
129
|
export function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult {
|
|
111
130
|
try {
|
|
112
131
|
return {
|
|
@@ -114,23 +133,21 @@ export function applyUamTransactionApp(input: ApplyUamTransactionAppInput): Appl
|
|
|
114
133
|
project: applyUamTransaction(input.project, input.operations),
|
|
115
134
|
};
|
|
116
135
|
} catch (error) {
|
|
117
|
-
if (error instanceof UamTransactionError)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
};
|
|
133
|
-
}
|
|
136
|
+
if (error instanceof UamTransactionError) return transactionFailure(error);
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export async function applyUamTransactionAppAsync(
|
|
142
|
+
input: ApplyUamTransactionAppInput,
|
|
143
|
+
): Promise<ApplyUamTransactionAppResult> {
|
|
144
|
+
try {
|
|
145
|
+
return {
|
|
146
|
+
ok: true,
|
|
147
|
+
project: await applyUamTransactionAsync(input.project, input.operations),
|
|
148
|
+
};
|
|
149
|
+
} catch (error) {
|
|
150
|
+
if (error instanceof UamTransactionError) return transactionFailure(error);
|
|
134
151
|
throw error;
|
|
135
152
|
}
|
|
136
153
|
}
|