@openfairygui/functions 0.2.0-alpha.1 → 0.2.0-alpha.2
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 +2 -34
- package/dist/index.d.cts +2 -25
- package/dist/index.d.ts +2 -25
- package/dist/index.js +2 -34
- package/dist/uam-transaction.cjs +36 -0
- package/dist/uam-transaction.d.cts +27 -0
- package/dist/uam-transaction.d.ts +27 -0
- package/dist/uam-transaction.js +35 -0
- package/package.json +65 -53
- package/src/uam-transaction.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_uam_transaction = require("./uam-transaction.cjs");
|
|
2
3
|
let _openfairygui_core = require("@openfairygui/core");
|
|
3
4
|
//#region src/inspect.ts
|
|
4
5
|
function mapResource(resource) {
|
|
@@ -3910,42 +3911,9 @@ function _computeDependencies(pkg, pkgMap) {
|
|
|
3910
3911
|
}
|
|
3911
3912
|
}
|
|
3912
3913
|
//#endregion
|
|
3913
|
-
//#region src/uam-transaction.ts
|
|
3914
|
-
function mapTransactionErrorStage(error) {
|
|
3915
|
-
switch (error.code) {
|
|
3916
|
-
case "transaction_unsupported": return "preflight";
|
|
3917
|
-
case "invalid_uam": return "preflight";
|
|
3918
|
-
case "execution_failure": return error.opIndex === void 0 && error.issues !== void 0 ? "postflight" : "execution";
|
|
3919
|
-
case "selector_ambiguity": return error.opIndex === void 0 ? "preflight" : "execution";
|
|
3920
|
-
}
|
|
3921
|
-
}
|
|
3922
|
-
function applyUamTransactionApp(input) {
|
|
3923
|
-
try {
|
|
3924
|
-
return {
|
|
3925
|
-
ok: true,
|
|
3926
|
-
project: (0, _openfairygui_core.applyUamTransaction)(input.project, input.operations)
|
|
3927
|
-
};
|
|
3928
|
-
} catch (error) {
|
|
3929
|
-
if (error instanceof _openfairygui_core.UamTransactionError) return {
|
|
3930
|
-
ok: false,
|
|
3931
|
-
error: {
|
|
3932
|
-
code: error.code,
|
|
3933
|
-
stage: mapTransactionErrorStage(error),
|
|
3934
|
-
message: error.message,
|
|
3935
|
-
opIndex: error.opIndex,
|
|
3936
|
-
opId: error.opId,
|
|
3937
|
-
opKind: error.opKind,
|
|
3938
|
-
selector: error.selector,
|
|
3939
|
-
issues: error.issues
|
|
3940
|
-
}
|
|
3941
|
-
};
|
|
3942
|
-
throw error;
|
|
3943
|
-
}
|
|
3944
|
-
}
|
|
3945
|
-
//#endregion
|
|
3946
3914
|
exports.AUTO_GENERATED_CODE_MARK = AUTO_GENERATED_CODE_MARK;
|
|
3947
3915
|
exports.ValidationSeverity = ValidationSeverity;
|
|
3948
|
-
exports.applyUamTransactionApp = applyUamTransactionApp;
|
|
3916
|
+
exports.applyUamTransactionApp = require_uam_transaction.applyUamTransactionApp;
|
|
3949
3917
|
exports.atlas = atlas;
|
|
3950
3918
|
exports.createTransform = createTransform;
|
|
3951
3919
|
exports.inspect = inspect;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp } from "./uam-transaction.cjs";
|
|
2
|
+
import { Document, FileSystem, Package, ProjectSettings, PublishSettings, Transform } from "@openfairygui/core";
|
|
2
3
|
|
|
3
4
|
//#region src/inspect.d.ts
|
|
4
5
|
/**
|
|
@@ -456,30 +457,6 @@ declare function resolvePublishOptions(doc: Document, overrides?: ResolvePublish
|
|
|
456
457
|
*/
|
|
457
458
|
declare function publish(options: PublishOptions): Transform;
|
|
458
459
|
//#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
|
|
483
460
|
//#region src/utils.d.ts
|
|
484
461
|
/**
|
|
485
462
|
* Wraps a transform function, assigning it a name for the transform stack.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp } from "./uam-transaction.js";
|
|
2
|
+
import { Document, FileSystem, Package, ProjectSettings, PublishSettings, Transform } from "@openfairygui/core";
|
|
2
3
|
|
|
3
4
|
//#region src/inspect.d.ts
|
|
4
5
|
/**
|
|
@@ -456,30 +457,6 @@ declare function resolvePublishOptions(doc: Document, overrides?: ResolvePublish
|
|
|
456
457
|
*/
|
|
457
458
|
declare function publish(options: PublishOptions): Transform;
|
|
458
459
|
//#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
|
|
483
460
|
//#region src/utils.d.ts
|
|
484
461
|
/**
|
|
485
462
|
* Wraps a transform function, assigning it a name for the transform stack.
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { applyUamTransactionApp } from "./uam-transaction.js";
|
|
2
|
+
import { BinaryReader, BinaryWriter, GearType, ProjectType, ProjectWriter, TransitionActionType, generateId } from "@openfairygui/core";
|
|
2
3
|
//#region src/inspect.ts
|
|
3
4
|
function mapResource(resource) {
|
|
4
5
|
return {
|
|
@@ -3909,37 +3910,4 @@ function _computeDependencies(pkg, pkgMap) {
|
|
|
3909
3910
|
}
|
|
3910
3911
|
}
|
|
3911
3912
|
//#endregion
|
|
3912
|
-
//#region src/uam-transaction.ts
|
|
3913
|
-
function mapTransactionErrorStage(error) {
|
|
3914
|
-
switch (error.code) {
|
|
3915
|
-
case "transaction_unsupported": return "preflight";
|
|
3916
|
-
case "invalid_uam": return "preflight";
|
|
3917
|
-
case "execution_failure": return error.opIndex === void 0 && error.issues !== void 0 ? "postflight" : "execution";
|
|
3918
|
-
case "selector_ambiguity": return error.opIndex === void 0 ? "preflight" : "execution";
|
|
3919
|
-
}
|
|
3920
|
-
}
|
|
3921
|
-
function applyUamTransactionApp(input) {
|
|
3922
|
-
try {
|
|
3923
|
-
return {
|
|
3924
|
-
ok: true,
|
|
3925
|
-
project: applyUamTransaction(input.project, input.operations)
|
|
3926
|
-
};
|
|
3927
|
-
} catch (error) {
|
|
3928
|
-
if (error instanceof UamTransactionError) return {
|
|
3929
|
-
ok: false,
|
|
3930
|
-
error: {
|
|
3931
|
-
code: error.code,
|
|
3932
|
-
stage: mapTransactionErrorStage(error),
|
|
3933
|
-
message: error.message,
|
|
3934
|
-
opIndex: error.opIndex,
|
|
3935
|
-
opId: error.opId,
|
|
3936
|
-
opKind: error.opKind,
|
|
3937
|
-
selector: error.selector,
|
|
3938
|
-
issues: error.issues
|
|
3939
|
-
}
|
|
3940
|
-
};
|
|
3941
|
-
throw error;
|
|
3942
|
-
}
|
|
3943
|
-
}
|
|
3944
|
-
//#endregion
|
|
3945
3913
|
export { AUTO_GENERATED_CODE_MARK, ValidationSeverity, applyUamTransactionApp, atlas, createTransform, inspect, prune, publish, publishCodeGeneration, rename, resolvePublishOptions, restore, validate };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _openfairygui_core_uam = require("@openfairygui/core/uam");
|
|
3
|
+
//#region src/uam-transaction.ts
|
|
4
|
+
function mapTransactionErrorStage(error) {
|
|
5
|
+
switch (error.code) {
|
|
6
|
+
case "transaction_unsupported": return "preflight";
|
|
7
|
+
case "invalid_uam": return "preflight";
|
|
8
|
+
case "execution_failure": return error.opIndex === void 0 && error.issues !== void 0 ? "postflight" : "execution";
|
|
9
|
+
case "selector_ambiguity": return error.opIndex === void 0 ? "preflight" : "execution";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function applyUamTransactionApp(input) {
|
|
13
|
+
try {
|
|
14
|
+
return {
|
|
15
|
+
ok: true,
|
|
16
|
+
project: (0, _openfairygui_core_uam.applyUamTransaction)(input.project, input.operations)
|
|
17
|
+
};
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error instanceof _openfairygui_core_uam.UamTransactionError) return {
|
|
20
|
+
ok: false,
|
|
21
|
+
error: {
|
|
22
|
+
code: error.code,
|
|
23
|
+
stage: mapTransactionErrorStage(error),
|
|
24
|
+
message: error.message,
|
|
25
|
+
opIndex: error.opIndex,
|
|
26
|
+
opId: error.opId,
|
|
27
|
+
opKind: error.opKind,
|
|
28
|
+
selector: error.selector,
|
|
29
|
+
issues: error.issues
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.applyUamTransactionApp = applyUamTransactionApp;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UamProject, UamTransactionErrorCode, UamTransactionOperation, UamTransactionSupportIssue, UamValidationIssue } from "@openfairygui/core/uam";
|
|
2
|
+
|
|
3
|
+
//#region src/uam-transaction.d.ts
|
|
4
|
+
interface ApplyUamTransactionAppInput {
|
|
5
|
+
project: UamProject;
|
|
6
|
+
operations: UamTransactionOperation[];
|
|
7
|
+
}
|
|
8
|
+
interface ApplyUamTransactionAppError {
|
|
9
|
+
code: UamTransactionErrorCode;
|
|
10
|
+
stage: 'preflight' | 'execution' | 'postflight';
|
|
11
|
+
message: string;
|
|
12
|
+
opIndex?: number;
|
|
13
|
+
opId?: string;
|
|
14
|
+
opKind?: UamTransactionOperation['kind'];
|
|
15
|
+
selector?: Record<string, unknown>;
|
|
16
|
+
issues?: UamValidationIssue[] | UamTransactionSupportIssue[];
|
|
17
|
+
}
|
|
18
|
+
type ApplyUamTransactionAppResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
project: UamProject;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
error: ApplyUamTransactionAppError;
|
|
24
|
+
};
|
|
25
|
+
declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UamProject, UamTransactionErrorCode, UamTransactionOperation, UamTransactionSupportIssue, UamValidationIssue } from "@openfairygui/core/uam";
|
|
2
|
+
|
|
3
|
+
//#region src/uam-transaction.d.ts
|
|
4
|
+
interface ApplyUamTransactionAppInput {
|
|
5
|
+
project: UamProject;
|
|
6
|
+
operations: UamTransactionOperation[];
|
|
7
|
+
}
|
|
8
|
+
interface ApplyUamTransactionAppError {
|
|
9
|
+
code: UamTransactionErrorCode;
|
|
10
|
+
stage: 'preflight' | 'execution' | 'postflight';
|
|
11
|
+
message: string;
|
|
12
|
+
opIndex?: number;
|
|
13
|
+
opId?: string;
|
|
14
|
+
opKind?: UamTransactionOperation['kind'];
|
|
15
|
+
selector?: Record<string, unknown>;
|
|
16
|
+
issues?: UamValidationIssue[] | UamTransactionSupportIssue[];
|
|
17
|
+
}
|
|
18
|
+
type ApplyUamTransactionAppResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
project: UamProject;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
error: ApplyUamTransactionAppError;
|
|
24
|
+
};
|
|
25
|
+
declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UamTransactionError, applyUamTransaction } from "@openfairygui/core/uam";
|
|
2
|
+
//#region src/uam-transaction.ts
|
|
3
|
+
function mapTransactionErrorStage(error) {
|
|
4
|
+
switch (error.code) {
|
|
5
|
+
case "transaction_unsupported": return "preflight";
|
|
6
|
+
case "invalid_uam": return "preflight";
|
|
7
|
+
case "execution_failure": return error.opIndex === void 0 && error.issues !== void 0 ? "postflight" : "execution";
|
|
8
|
+
case "selector_ambiguity": return error.opIndex === void 0 ? "preflight" : "execution";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function applyUamTransactionApp(input) {
|
|
12
|
+
try {
|
|
13
|
+
return {
|
|
14
|
+
ok: true,
|
|
15
|
+
project: applyUamTransaction(input.project, input.operations)
|
|
16
|
+
};
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if (error instanceof UamTransactionError) return {
|
|
19
|
+
ok: false,
|
|
20
|
+
error: {
|
|
21
|
+
code: error.code,
|
|
22
|
+
stage: mapTransactionErrorStage(error),
|
|
23
|
+
message: error.message,
|
|
24
|
+
opIndex: error.opIndex,
|
|
25
|
+
opId: error.opId,
|
|
26
|
+
opKind: error.opKind,
|
|
27
|
+
selector: error.selector,
|
|
28
|
+
issues: error.issues
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { applyUamTransactionApp };
|
package/package.json
CHANGED
|
@@ -1,54 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
2
|
+
"name": "@openfairygui/functions",
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
|
+
"description": "FairyGUI Headless Authoring SDK — composable transform functions.",
|
|
5
|
+
"author": "OpenFairyGUI Contributors",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/OpenFairyGUI/OpenFairyGUI.git",
|
|
10
|
+
"directory": "packages/functions"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/OpenFairyGUI/OpenFairyGUI#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/OpenFairyGUI/OpenFairyGUI/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"main": "./dist/index.cjs",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"require": {
|
|
24
|
+
"types": "./dist/index.d.cts",
|
|
25
|
+
"default": "./dist/index.cjs"
|
|
26
|
+
},
|
|
27
|
+
"default": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./uam": {
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./dist/uam-transaction.d.cts",
|
|
35
|
+
"default": "./dist/uam-transaction.cjs"
|
|
36
|
+
},
|
|
37
|
+
"default": {
|
|
38
|
+
"types": "./dist/uam-transaction.d.ts",
|
|
39
|
+
"default": "./dist/uam-transaction.js"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist/",
|
|
45
|
+
"src/"
|
|
46
|
+
],
|
|
47
|
+
"keywords": [
|
|
48
|
+
"fairygui",
|
|
49
|
+
"ui",
|
|
50
|
+
"headless",
|
|
51
|
+
"authoring",
|
|
52
|
+
"transform",
|
|
53
|
+
"publish"
|
|
54
|
+
],
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@openfairygui/core": "0.2.0-alpha.2"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"ava": "^7.0.0",
|
|
60
|
+
"tsx": "^4.0.0"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsdown src/index.ts src/uam-transaction.ts --format esm,cjs --platform neutral --env.PACKAGE_VERSION=$npm_package_version",
|
|
64
|
+
"build:watch": "tsdown src/index.ts src/uam-transaction.ts --watch --format esm,cjs --platform neutral --env.PACKAGE_VERSION=$npm_package_version"
|
|
65
|
+
}
|
|
66
|
+
}
|
package/src/uam-transaction.ts
CHANGED