@kynesyslabs/demosdk 1.2.0 → 1.4.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.
Files changed (97) hide show
  1. package/build/demoswork/executor/index.d.ts +2 -0
  2. package/build/demoswork/executor/index.js +21 -0
  3. package/build/demoswork/executor/index.js.map +1 -0
  4. package/build/demoswork/executor/stepexecutor.d.ts +18 -0
  5. package/build/demoswork/executor/stepexecutor.js +53 -0
  6. package/build/demoswork/executor/stepexecutor.js.map +1 -0
  7. package/build/demoswork/index.d.ts +8 -0
  8. package/build/demoswork/index.js +27 -0
  9. package/build/demoswork/index.js.map +1 -0
  10. package/build/demoswork/operations/baseoperation.d.ts +9 -0
  11. package/build/demoswork/operations/baseoperation.js +24 -0
  12. package/build/demoswork/operations/baseoperation.js.map +1 -0
  13. package/build/demoswork/operations/conditional/condition.d.ts +27 -0
  14. package/build/demoswork/operations/conditional/condition.js +54 -0
  15. package/build/demoswork/operations/conditional/condition.js.map +1 -0
  16. package/build/demoswork/operations/conditional/index.d.ts +31 -0
  17. package/build/demoswork/operations/conditional/index.js +108 -0
  18. package/build/demoswork/operations/conditional/index.js.map +1 -0
  19. package/build/demoswork/operations/index.d.ts +21 -0
  20. package/build/demoswork/operations/index.js +52 -0
  21. package/build/demoswork/operations/index.js.map +1 -0
  22. package/build/demoswork/utils/createTestWorkScript.d.ts +2 -0
  23. package/build/demoswork/utils/createTestWorkScript.js +55 -0
  24. package/build/demoswork/utils/createTestWorkScript.js.map +1 -0
  25. package/build/demoswork/utils/index.d.ts +21 -0
  26. package/build/demoswork/utils/index.js +61 -0
  27. package/build/demoswork/utils/index.js.map +1 -0
  28. package/build/demoswork/validator/index.d.ts +7 -0
  29. package/build/demoswork/validator/index.js +16 -0
  30. package/build/demoswork/validator/index.js.map +1 -0
  31. package/build/demoswork/validator/steps.validator.d.ts +8 -0
  32. package/build/demoswork/validator/steps.validator.js +77 -0
  33. package/build/demoswork/validator/steps.validator.js.map +1 -0
  34. package/build/demoswork/work.d.ts +14 -0
  35. package/build/demoswork/work.js +81 -0
  36. package/build/demoswork/work.js.map +1 -0
  37. package/build/demoswork/workstep.d.ts +82 -0
  38. package/build/demoswork/workstep.js +133 -0
  39. package/build/demoswork/workstep.js.map +1 -0
  40. package/build/encryption/Cryptography.d.ts +6 -1
  41. package/build/encryption/Cryptography.js +16 -3
  42. package/build/encryption/Cryptography.js.map +1 -1
  43. package/build/index.d.ts +8 -6
  44. package/build/index.js +3 -1
  45. package/build/index.js.map +1 -1
  46. package/build/multichain/core/ibc.js +2 -0
  47. package/build/multichain/core/ibc.js.map +1 -1
  48. package/build/types/blockchain/Transaction.d.ts +9 -22
  49. package/build/types/blockchain/ValidityData.js +2 -6
  50. package/build/types/blockchain/ValidityData.js.map +1 -1
  51. package/build/types/communication/demosWork.d.ts +6 -6
  52. package/build/types/communication/rpc.d.ts +33 -0
  53. package/build/types/communication/rpc.js +11 -0
  54. package/build/types/communication/rpc.js.map +1 -0
  55. package/build/types/demoswork/datatypes.d.ts +6 -0
  56. package/build/types/demoswork/datatypes.js +10 -0
  57. package/build/types/demoswork/datatypes.js.map +1 -0
  58. package/build/types/demoswork/index.d.ts +16 -0
  59. package/build/types/demoswork/index.js +3 -0
  60. package/build/types/demoswork/index.js.map +1 -0
  61. package/build/types/demoswork/operations.d.ts +48 -0
  62. package/build/types/demoswork/operations.js +3 -0
  63. package/build/types/demoswork/operations.js.map +1 -0
  64. package/build/types/demoswork/steps.d.ts +71 -0
  65. package/build/types/demoswork/steps.js +21 -0
  66. package/build/types/demoswork/steps.js.map +1 -0
  67. package/build/types/index.d.ts +24 -21
  68. package/build/types/index.js +8 -1
  69. package/build/types/index.js.map +1 -1
  70. package/build/types/native/index.d.ts +9 -0
  71. package/build/types/native/index.js +3 -0
  72. package/build/types/native/index.js.map +1 -0
  73. package/build/utils/pprint.d.ts +5 -0
  74. package/build/utils/pprint.js +17 -0
  75. package/build/utils/pprint.js.map +1 -0
  76. package/build/wallet/Wallet.d.ts +2 -1
  77. package/build/wallet/Wallet.js +2 -2
  78. package/build/wallet/Wallet.js.map +1 -1
  79. package/build/websdk/DemosTransactions.d.ts +10 -2
  80. package/build/websdk/DemosTransactions.js +25 -26
  81. package/build/websdk/DemosTransactions.js.map +1 -1
  82. package/build/websdk/DemosWebAuth.d.ts +1 -1
  83. package/build/websdk/DemosWebAuth.js.map +1 -1
  84. package/build/websdk/Web2Transactions.d.ts +22 -2
  85. package/build/websdk/Web2Transactions.js +29 -13
  86. package/build/websdk/Web2Transactions.js.map +1 -1
  87. package/build/websdk/XMTransactions.d.ts +2 -1
  88. package/build/websdk/XMTransactions.js +3 -6
  89. package/build/websdk/XMTransactions.js.map +1 -1
  90. package/build/websdk/demos.d.ts +38 -26
  91. package/build/websdk/demos.js +118 -252
  92. package/build/websdk/demos.js.map +1 -1
  93. package/build/websdk/index.js +1 -0
  94. package/build/websdk/index.js.map +1 -1
  95. package/build/websdk/utils/skeletons.js +2 -0
  96. package/build/websdk/utils/skeletons.js.map +1 -1
  97. package/package.json +9 -5
@@ -0,0 +1,2 @@
1
+ import { DemosWork } from "../work";
2
+ export default function (work: DemosWork): Promise<Record<string, any>>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ async function default_1(work) {
5
+ // TODO! Rewrite forEach to for...of
6
+ for (const operationUID of work.script.operationOrder) {
7
+ const operation = work.script.operations[operationUID];
8
+ if (!operation) {
9
+ throw new Error(`Operation with UID ${operationUID} not found in the XMScript`);
10
+ }
11
+ switch (operation.operationType) {
12
+ case "conditional":
13
+ console.log("Executing conditional operation with UID:", operationUID);
14
+ break;
15
+ default:
16
+ throw new Error("Unknown operation type" + operation.operationType);
17
+ }
18
+ }
19
+ return work.results;
20
+ }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/demoswork/executor/index.ts"],"names":[],"mappings":";;AAGA,4BA2BC;AA3Bc,KAAK,oBAAW,IAAe;IAC1C,oCAAoC;IACpC,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QACpD,MAAM,SAAS,GAAoB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;QAEvE,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACX,sBAAsB,YAAY,4BAA4B,CACjE,CAAA;QACL,CAAC;QAED,QAAQ,SAAS,CAAC,aAAa,EAAE,CAAC;YAC9B,KAAK,aAAa;gBACd,OAAO,CAAC,GAAG,CACP,2CAA2C,EAC3C,YAAY,CACf,CAAA;gBACD,MAAK;YAET;gBACI,MAAM,IAAI,KAAK,CACX,wBAAwB,GAAG,SAAS,CAAC,aAAa,CACrD,CAAA;QACT,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAA;AACvB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { DemosWork } from "../work";
2
+ /**
3
+ * Execute a step and write the output to the work instance.
4
+ *
5
+ * @param work The work instance
6
+ * @param stepUID The UID of the step to execute
7
+ * @returns The result of the step
8
+ */
9
+ export declare function executeStep(work: DemosWork, stepUID: string): Promise<any>;
10
+ /**
11
+ * Get the result of a step from the work instance.
12
+ * If not found, execute the step and return the result.
13
+ *
14
+ * @param work The work instance
15
+ * @param stepUID The step UID
16
+ * @returns The result of the step
17
+ */
18
+ export declare function getStepResult(work: DemosWork, stepUID: string): Promise<any>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeStep = executeStep;
4
+ exports.getStepResult = getStepResult;
5
+ /**
6
+ * Execute a step and write the output to the work instance.
7
+ *
8
+ * @param work The work instance
9
+ * @param stepUID The UID of the step to execute
10
+ * @returns The result of the step
11
+ */
12
+ async function executeStep(work, stepUID) {
13
+ // INFO: Execute the step here and write the output to the work instance.
14
+ // Process:
15
+ // 1. Find the step from work.steps map
16
+ // 2. Determine the type of the step
17
+ // 3. Route execution to the appropriate executor function (TODO)
18
+ // 4. Write the output to the work instance
19
+ // REVIEW: Which is better?
20
+ // Pass the work instance to this function and write the output to the work instance from here,
21
+ // OR:
22
+ // Pass the actual step to this function and return the output to the caller?
23
+ console.log("Executing step", stepUID);
24
+ work.results[stepUID] = {
25
+ output: {
26
+ result: "error",
27
+ statusCode: 200,
28
+ payload: {
29
+ message: "Hello, World!",
30
+ },
31
+ },
32
+ };
33
+ // ! Compile the result and return it
34
+ return work.results[stepUID];
35
+ }
36
+ /**
37
+ * Get the result of a step from the work instance.
38
+ * If not found, execute the step and return the result.
39
+ *
40
+ * @param work The work instance
41
+ * @param stepUID The step UID
42
+ * @returns The result of the step
43
+ */
44
+ async function getStepResult(work, stepUID) {
45
+ let result = work.results[stepUID];
46
+ if (result) {
47
+ return result;
48
+ }
49
+ // INFO: If the step result is not found, execute the step
50
+ console.log(`Step with UID ${stepUID} not found in work results. Executing it now.`);
51
+ return await executeStep(work, stepUID);
52
+ }
53
+ //# sourceMappingURL=stepexecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepexecutor.js","sourceRoot":"","sources":["../../../../src/demoswork/executor/stepexecutor.ts"],"names":[],"mappings":";;AASA,kCA0BC;AAUD,sCAYC;AAvDD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAAC,IAAe,EAAE,OAAe;IAC9D,yEAAyE;IACzE,WAAW;IACX,uCAAuC;IACvC,oCAAoC;IACpC,iEAAiE;IACjE,2CAA2C;IAE3C,2BAA2B;IAC3B,+FAA+F;IAC/F,MAAM;IACN,6EAA6E;IAE7E,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IACtC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG;QACpB,MAAM,EAAE;YACJ,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,GAAG;YACf,OAAO,EAAE;gBACL,OAAO,EAAE,eAAe;aAC3B;SACJ;KACJ,CAAA;IACD,qCAAqC;IAErC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,aAAa,CAAC,IAAe,EAAE,OAAe;IAChE,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAElC,IAAI,MAAM,EAAE,CAAC;QACT,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,0DAA0D;IAC1D,OAAO,CAAC,GAAG,CACP,iBAAiB,OAAO,+CAA+C,CAC1E,CAAA;IACD,OAAO,MAAM,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { DemosWorkOperation } from "./operations";
2
+ export { BaseOperation } from "./operations/baseoperation";
3
+ export { ConditionalOperation } from "./operations/conditional";
4
+ export { Condition } from "./operations/conditional/condition";
5
+ export { DemosWork, prepareDemosWorkPayload } from "./work";
6
+ export { NativeWorkStep, Web2WorkStep, WorkStep, XmWorkStep } from "./workstep";
7
+ export { runSanityChecks } from "./validator";
8
+ export { prepareNativeStep, prepareWeb2Step, prepareXMStep } from "./workstep";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareXMStep = exports.prepareWeb2Step = exports.prepareNativeStep = exports.runSanityChecks = exports.XmWorkStep = exports.WorkStep = exports.Web2WorkStep = exports.NativeWorkStep = exports.prepareDemosWorkPayload = exports.DemosWork = exports.Condition = exports.ConditionalOperation = exports.BaseOperation = exports.DemosWorkOperation = void 0;
4
+ var operations_1 = require("./operations");
5
+ Object.defineProperty(exports, "DemosWorkOperation", { enumerable: true, get: function () { return operations_1.DemosWorkOperation; } });
6
+ var baseoperation_1 = require("./operations/baseoperation");
7
+ Object.defineProperty(exports, "BaseOperation", { enumerable: true, get: function () { return baseoperation_1.BaseOperation; } });
8
+ var conditional_1 = require("./operations/conditional");
9
+ Object.defineProperty(exports, "ConditionalOperation", { enumerable: true, get: function () { return conditional_1.ConditionalOperation; } });
10
+ var condition_1 = require("./operations/conditional/condition");
11
+ Object.defineProperty(exports, "Condition", { enumerable: true, get: function () { return condition_1.Condition; } });
12
+ var work_1 = require("./work");
13
+ Object.defineProperty(exports, "DemosWork", { enumerable: true, get: function () { return work_1.DemosWork; } });
14
+ Object.defineProperty(exports, "prepareDemosWorkPayload", { enumerable: true, get: function () { return work_1.prepareDemosWorkPayload; } });
15
+ var workstep_1 = require("./workstep");
16
+ Object.defineProperty(exports, "NativeWorkStep", { enumerable: true, get: function () { return workstep_1.NativeWorkStep; } });
17
+ Object.defineProperty(exports, "Web2WorkStep", { enumerable: true, get: function () { return workstep_1.Web2WorkStep; } });
18
+ Object.defineProperty(exports, "WorkStep", { enumerable: true, get: function () { return workstep_1.WorkStep; } });
19
+ Object.defineProperty(exports, "XmWorkStep", { enumerable: true, get: function () { return workstep_1.XmWorkStep; } });
20
+ // SECTION: Functions
21
+ var validator_1 = require("./validator");
22
+ Object.defineProperty(exports, "runSanityChecks", { enumerable: true, get: function () { return validator_1.runSanityChecks; } });
23
+ var workstep_2 = require("./workstep");
24
+ Object.defineProperty(exports, "prepareNativeStep", { enumerable: true, get: function () { return workstep_2.prepareNativeStep; } });
25
+ Object.defineProperty(exports, "prepareWeb2Step", { enumerable: true, get: function () { return workstep_2.prepareWeb2Step; } });
26
+ Object.defineProperty(exports, "prepareXMStep", { enumerable: true, get: function () { return workstep_2.prepareXMStep; } });
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/demoswork/index.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AAAxC,gHAAA,kBAAkB,OAAA;AAC3B,4DAA0D;AAAjD,8GAAA,aAAa,OAAA;AACtB,wDAA+D;AAAtD,mHAAA,oBAAoB,OAAA;AAC7B,gEAA8D;AAArD,sGAAA,SAAS,OAAA;AAClB,+BAA2D;AAAlD,iGAAA,SAAS,OAAA;AAAE,+GAAA,uBAAuB,OAAA;AAC3C,uCAA+E;AAAtE,0GAAA,cAAc,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,sGAAA,UAAU,OAAA;AAE3D,qBAAqB;AACrB,yCAA6C;AAApC,4GAAA,eAAe,OAAA;AACxB,uCAA8E;AAArE,6GAAA,iBAAiB,OAAA;AAAE,2GAAA,eAAe,OAAA;AAAE,yGAAA,aAAa,OAAA"}
@@ -0,0 +1,9 @@
1
+ import { WorkStep } from "..";
2
+ import { DemosWorkOperation } from ".";
3
+ import { BaseOperationScript, OperationType } from "../../types/demoswork/operations";
4
+ export declare class BaseOperation extends DemosWorkOperation {
5
+ type: OperationType;
6
+ operationScript: BaseOperationScript;
7
+ constructor(...work: Array<WorkStep | DemosWorkOperation>);
8
+ add(...work: Array<WorkStep | DemosWorkOperation>): void;
9
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseOperation = void 0;
4
+ const _1 = require(".");
5
+ class BaseOperation extends _1.DemosWorkOperation {
6
+ constructor(...work) {
7
+ super();
8
+ this.type = "base";
9
+ this.operationScript = {
10
+ id: this.id,
11
+ operationType: "base",
12
+ work: [],
13
+ };
14
+ this.add(...work);
15
+ }
16
+ add(...work) {
17
+ for (const w of work) {
18
+ this.operationScript.work.push(w.id);
19
+ super.addWork(w);
20
+ }
21
+ }
22
+ }
23
+ exports.BaseOperation = BaseOperation;
24
+ //# sourceMappingURL=baseoperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseoperation.js","sourceRoot":"","sources":["../../../../src/demoswork/operations/baseoperation.ts"],"names":[],"mappings":";;;AACA,wBAAsC;AAMtC,MAAa,aAAc,SAAQ,qBAAkB;IAQjD,YAAY,GAAG,IAA0C;QACrD,KAAK,EAAE,CAAA;QARF,SAAI,GAAkB,MAAM,CAAA;QAC5B,oBAAe,GAAwB;YAC5C,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,aAAa,EAAE,MAAM;YACrB,IAAI,EAAE,EAAE;SACX,CAAA;QAIG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;IACrB,CAAC;IAED,GAAG,CAAC,GAAG,IAA0C;QAC7C,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;YACpC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACpB,CAAC;IACL,CAAC;CACJ;AAnBD,sCAmBC"}
@@ -0,0 +1,27 @@
1
+ import { WorkStep } from "../..";
2
+ import { ICondition, operators, DataTypes } from "../../../types";
3
+ import { DemosWorkOutputKey } from "../../../types/demoswork";
4
+ import { Operand } from "../../../types/demoswork/steps";
5
+ import { DemosWorkOperation } from "..";
6
+ import { BinaryConditionParams, UnaryConditionParams } from "../../../types/demoswork/operations";
7
+ export declare class Condition implements ICondition {
8
+ id: string;
9
+ action: WorkStep | DemosWorkOperation;
10
+ value_a: Condition | Operand;
11
+ value_b: Condition | Operand;
12
+ operator: operators;
13
+ work: Map<string, WorkStep | DemosWorkOperation>;
14
+ constructor(params: BinaryConditionParams);
15
+ constructor(params: UnaryConditionParams);
16
+ parseData(data: DemosWorkOutputKey | any): Condition | {
17
+ type: DataTypes.internal;
18
+ workUID: any;
19
+ key: any;
20
+ value?: undefined;
21
+ } | {
22
+ type: DataTypes.static;
23
+ value: any;
24
+ workUID?: undefined;
25
+ key?: undefined;
26
+ };
27
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Condition = void 0;
4
+ const utils_1 = require("../../utils");
5
+ const types_1 = require("../../../types");
6
+ class Condition {
7
+ constructor(params) {
8
+ this.id = "cond_" + (0, utils_1.getNewUID)();
9
+ this.action = null;
10
+ this.value_a = null;
11
+ this.value_b = null;
12
+ this.work = new Map();
13
+ this.action = params.action;
14
+ this.operator = params.operator;
15
+ this.value_a = this.parseData(params.value_a);
16
+ // INFO: If the operator is "not", there should be no operand
17
+ if (params.operator !== "not") {
18
+ this.value_b = this.parseData(params.value_a);
19
+ }
20
+ }
21
+ parseData(data) {
22
+ // INFO: Converts the conditional data to the script format
23
+ if (data instanceof Condition) {
24
+ // INFO: Copy condition work to this condition
25
+ if (data.work) {
26
+ for (const work of data.work.values()) {
27
+ this.work.set(work.id, work);
28
+ }
29
+ }
30
+ return data;
31
+ }
32
+ try {
33
+ // check "type" key in data
34
+ if (data.type && data.type === types_1.DataTypes.work) {
35
+ this.work.set(data.src.self.id, data.src.self);
36
+ return {
37
+ type: types_1.DataTypes.internal,
38
+ workUID: data.src.self.id,
39
+ key: data.src.key,
40
+ };
41
+ }
42
+ }
43
+ catch (error) {
44
+ console.log("Static data:", data);
45
+ }
46
+ // INFO: If the data is not a work output, it is a static value
47
+ return {
48
+ type: types_1.DataTypes.static,
49
+ value: data,
50
+ };
51
+ }
52
+ }
53
+ exports.Condition = Condition;
54
+ //# sourceMappingURL=condition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../../src/demoswork/operations/conditional/condition.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AAC7C,mCAA0D;AAU1D,MAAa,SAAS;IAWlB,YAAY,MAAuB;QAVnC,OAAE,GAAW,OAAO,GAAG,IAAA,iBAAS,GAAE,CAAA;QAClC,WAAM,GAAkC,IAAI,CAAA;QAC5C,YAAO,GAAwB,IAAI,CAAA;QACnC,YAAO,GAAwB,IAAI,CAAA;QAEnC,SAAI,GAA+C,IAAI,GAAG,EAAE,CAAA;QAMxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;QAC3B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,CAAC;QAED,+DAA+D;QAC/D,OAAO;YACH,IAAI,EAAE,iBAAS,CAAC,MAA0B;YAC1C,KAAK,EAAE,IAAI;SACd,CAAA;IACL,CAAC;CACJ;AAzDD,8BAyDC"}
@@ -0,0 +1,31 @@
1
+ import { Condition, WorkStep } from "../..";
2
+ import { OperationType, ConditionalOperationScript, operators, DataTypes } from "../../../types";
3
+ import { DemosWorkOutputKey } from "../../../types/demoswork";
4
+ import { Operand } from "../../../types/demoswork/steps";
5
+ import { DemosWorkOperation } from "..";
6
+ export declare class ConditionalOperation extends DemosWorkOperation {
7
+ type: OperationType;
8
+ tempCondition: Condition;
9
+ operationScript: ConditionalOperationScript;
10
+ constructor(...conditions: Condition[]);
11
+ indexCondition(condition: Condition): {
12
+ type: DataTypes.internal;
13
+ workUID: string;
14
+ key: string;
15
+ };
16
+ parseConditionValue(value: Operand | Condition): Operand;
17
+ appendCondition(condition: Condition): number;
18
+ if(value_a: DemosWorkOutputKey | any, operator: operators, value_b?: DemosWorkOutputKey | any): {
19
+ then: (step: WorkStep | DemosWorkOperation) => {
20
+ elif: (value_a: DemosWorkOutputKey | any, operator: operators, value_b?: DemosWorkOutputKey | any) => any;
21
+ else: (step: WorkStep | DemosWorkOperation) => number;
22
+ };
23
+ };
24
+ then(step: WorkStep | DemosWorkOperation): {
25
+ elif: (value_a: DemosWorkOutputKey | any, operator: operators, value_b?: DemosWorkOutputKey | any) => {
26
+ then: (step: WorkStep | DemosWorkOperation) => any;
27
+ };
28
+ else: (step: WorkStep | DemosWorkOperation) => number;
29
+ };
30
+ else(step: WorkStep | DemosWorkOperation): number;
31
+ }
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConditionalOperation = void 0;
4
+ const demoswork_1 = require("../..");
5
+ const types_1 = require("../../../types");
6
+ const __1 = require("..");
7
+ class ConditionalOperation extends __1.DemosWorkOperation {
8
+ constructor(...conditions) {
9
+ super();
10
+ this.type = "conditional";
11
+ this.tempCondition = null;
12
+ this.operationScript = {
13
+ id: this.id,
14
+ operationType: "conditional",
15
+ conditions: new Map(),
16
+ order: [],
17
+ };
18
+ for (const condition of conditions) {
19
+ this.appendCondition(condition);
20
+ }
21
+ }
22
+ indexCondition(condition) {
23
+ // INFO: copy condition action to the operation
24
+ if (condition.action) {
25
+ this.addWork(condition.action);
26
+ }
27
+ this.operationScript.conditions.set(condition.id, {
28
+ operator: condition.operator,
29
+ value_a: this.parseConditionValue(condition.value_a),
30
+ value_b: this.parseConditionValue(condition.value_b),
31
+ ...(condition.action ? { work: condition.action.id } : {}),
32
+ });
33
+ return {
34
+ type: types_1.DataTypes.internal,
35
+ workUID: condition.id,
36
+ key: "output.result",
37
+ };
38
+ }
39
+ parseConditionValue(value) {
40
+ // converts condition values into the script format
41
+ if (value instanceof demoswork_1.Condition) {
42
+ this.indexCondition(value);
43
+ return {
44
+ type: types_1.DataTypes.internal,
45
+ workUID: value.id,
46
+ key: null,
47
+ };
48
+ }
49
+ return value;
50
+ }
51
+ appendCondition(condition) {
52
+ for (const work of condition.work.values()) {
53
+ this.addWork(work);
54
+ }
55
+ delete condition.work;
56
+ const entry = {
57
+ operator: condition.operator,
58
+ value_a: this.parseConditionValue(condition.value_a),
59
+ value_b: this.parseConditionValue(condition.value_b),
60
+ };
61
+ // if there is an action, the condition comes from the constructor
62
+ // ie. is a fully formed condition.
63
+ this.addWork(condition.action);
64
+ this.operationScript.conditions.set(condition.id, {
65
+ ...entry,
66
+ ...(condition.action ? { work: condition.action.id } : {})
67
+ });
68
+ return this.operationScript.order.push(condition.id);
69
+ }
70
+ // SECTION: CONDITIONAL OPERATION METHODS
71
+ if(value_a, operator, value_b) {
72
+ let conditionEntry = new demoswork_1.Condition({
73
+ action: null,
74
+ value_a: value_a,
75
+ value_b: value_b,
76
+ operator: operator,
77
+ });
78
+ this.tempCondition = conditionEntry;
79
+ return {
80
+ then: this.then.bind(this),
81
+ };
82
+ }
83
+ then(step) {
84
+ // update the last item in the temp conditions
85
+ // and push it to the operation script
86
+ this.tempCondition.action = step;
87
+ this.appendCondition(this.tempCondition);
88
+ this.tempCondition = null;
89
+ return {
90
+ elif: this.if.bind(this),
91
+ else: this.else.bind(this),
92
+ };
93
+ }
94
+ else(step) {
95
+ const condition = new demoswork_1.Condition({
96
+ operator: null,
97
+ value_a: null,
98
+ value_b: null,
99
+ action: step,
100
+ });
101
+ // INFO: Override value formatting
102
+ condition.value_a = null;
103
+ condition.value_b = null;
104
+ return this.appendCondition(condition);
105
+ }
106
+ }
107
+ exports.ConditionalOperation = ConditionalOperation;
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/demoswork/operations/conditional/index.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AACjD,mCAKgB;AAGhB,0BAAuC;AAEvC,MAAa,oBAAqB,SAAQ,sBAAkB;IAWxD,YAAY,GAAG,UAAuB;QAClC,KAAK,EAAE,CAAA;QAXF,SAAI,GAAkB,aAAa,CAAA;QAC5C,kBAAa,GAAc,IAAI,CAAA;QAEtB,oBAAe,GAA+B;YACnD,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,aAAa,EAAE,aAAa;YAC5B,UAAU,EAAE,IAAI,GAAG,EAAE;YACrB,KAAK,EAAE,EAAE;SACZ,CAAA;QAIG,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACjC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;QACnC,CAAC;IACL,CAAC;IAED,cAAc,CAAC,SAAoB;QAC/B,+CAA+C;QAC/C,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAClC,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE;YAC9C,QAAQ,EAAE,SAAS,CAAC,QA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,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;SACf,CAAC,CAAA;QAEF,kCAAkC;QAClC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAA;QACxB,SAAS,CAAC,OAAO,GAAG,IAAI,CAAA;QAExB,OAAO,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;IAC1C,CAAC;CACJ;AA1HD,oDA0HC"}
@@ -0,0 +1,21 @@
1
+ import { OperationScript, OperationType } from "../../types/demoswork/operations";
2
+ import { WorkStep } from "../workstep";
3
+ import { DataTypes } from "../../types/demoswork/datatypes";
4
+ export declare abstract class DemosWorkOperation {
5
+ id: string;
6
+ abstract type: OperationType;
7
+ steps: Record<string, WorkStep>;
8
+ operations: Set<DemosWorkOperation>;
9
+ operationScript: OperationScript;
10
+ output: {
11
+ success: {
12
+ type: DataTypes.work;
13
+ src: {
14
+ self: DemosWorkOperation;
15
+ key: string;
16
+ };
17
+ };
18
+ };
19
+ addWork(work: WorkStep | DemosWorkOperation): void;
20
+ execute(): void;
21
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DemosWorkOperation = void 0;
4
+ const utils_1 = require("../utils");
5
+ const datatypes_1 = require("../../types/demoswork/datatypes");
6
+ class DemosWorkOperation {
7
+ constructor() {
8
+ this.id = "op_" + (0, utils_1.getNewUID)();
9
+ this.steps = {};
10
+ this.operations = new Set();
11
+ this.operationScript = {
12
+ id: this.id,
13
+ operationType: null,
14
+ };
15
+ this.output = {
16
+ success: {
17
+ type: datatypes_1.DataTypes.work,
18
+ src: {
19
+ self: this,
20
+ key: "output.success",
21
+ },
22
+ },
23
+ };
24
+ }
25
+ addWork(work) {
26
+ // INFO: The action can be a step or an operation
27
+ // If it is an operation, copy its steps into this operation
28
+ // if is a step, add it to the steps of this operation
29
+ if (work.id.startsWith("op_")) {
30
+ this.operations.add(work);
31
+ // INFO: Inherit the steps of the operation
32
+ for (const stepUID in work.steps) {
33
+ this.steps[stepUID] = work.steps[stepUID];
34
+ }
35
+ // INFO: Inherit the operations of the operation
36
+ for (const operation of work.operations) {
37
+ this.operations.add(operation);
38
+ }
39
+ return;
40
+ }
41
+ if (work.id.startsWith("step_")) {
42
+ this.steps[work.id] = work;
43
+ return;
44
+ }
45
+ throw new Error("Invalid work unit with id:" + work.id);
46
+ }
47
+ execute() {
48
+ throw new Error("Method not implemented.");
49
+ }
50
+ }
51
+ exports.DemosWorkOperation = DemosWorkOperation;
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/demoswork/operations/index.ts"],"names":[],"mappings":";;;AAMA,oCAAoC;AAEpC,2DAAuD;AAEvD,MAAsB,kBAAkB;IAAxC;QACI,OAAE,GAAW,KAAK,GAAG,IAAA,iBAAS,GAAE,CAAA;QAGhC,UAAK,GAA6B,EAAE,CAAA;QACpC,eAAU,GAA4B,IAAI,GAAG,EAAE,CAAA;QAC/C,oBAAe,GAAoB;YAC/B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,aAAa,EAAE,IAAI;SACtB,CAAA;QACD,WAAM,GAAG;YACL,OAAO,EAAE;gBACL,IAAI,EAAE,qBAAS,CAAC,IAAsB;gBACtC,GAAG,EAAE;oBACD,IAAI,EAAE,IAA0B;oBAChC,GAAG,EAAE,gBAAgB;iBACxB;aACJ;SACJ,CAAA;IAkCL,CAAC;IAhCG,OAAO,CAAC,IAAmC;QACvC,iDAAiD;QACjD,4DAA4D;QAC5D,sDAAsD;QACtD,IAAI,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAA0B,CAAC,CAAA;YAE/C,2CAA2C;YAC3C,KAAK,MAAM,OAAO,IAAK,IAA2B,CAAC,KAAK,EAAE,CAAC;gBACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAI,IAA2B,CAAC,KAAK,CACpD,OAAO,CACV,CAAA;YACL,CAAC;YAED,gDAAgD;YAChD,KAAK,MAAM,SAAS,IAAK,IAA2B,CAAC,UAAU,EAAE,CAAC;gBAC9D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;YAClC,CAAC;YACD,OAAM;QACV,CAAC;QAED,IAAI,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAgB,CAAA;YACtC,OAAM;QACV,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3D,CAAC;IAED,OAAO;QACH,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC9C,CAAC;CACJ;AApDD,gDAoDC"}
@@ -0,0 +1,2 @@
1
+ import { Transaction } from "../../types";
2
+ export default function createTestWorkScript(): Promise<Transaction>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = createTestWorkScript;
7
+ const chainProviders_1 = __importDefault(require("../../tests/multichain/chainProviders"));
8
+ const _1 = require(".");
9
+ const work_1 = require("../work");
10
+ const workstep_1 = require("../workstep");
11
+ const core_1 = require("../../multichain/core");
12
+ const steps_1 = require("../../types/demoswork/steps");
13
+ const websdk_1 = require("../../websdk");
14
+ const conditional_1 = require("../operations/conditional");
15
+ async function createTestWorkScript() {
16
+ const work = new work_1.DemosWork();
17
+ const uid = (0, _1.getNewUID)();
18
+ const evm = await core_1.EVM.create(chainProviders_1.default.eth.sepolia);
19
+ await evm.connectWallet("e0a00e307c21850cde41b18bae307a492c471b463b60ce5b631fdb80503b23f7");
20
+ const payload = await evm.preparePay(evm.getAddress(), "0.0001");
21
+ const sendEth = (0, workstep_1.prepareXMStep)({
22
+ operations: {
23
+ [uid]: {
24
+ chain: "eth",
25
+ is_evm: true,
26
+ rpc: null,
27
+ subchain: "sepolia",
28
+ task: {
29
+ params: null,
30
+ signedPayloads: [payload],
31
+ type: "pay",
32
+ },
33
+ },
34
+ },
35
+ operations_order: [uid],
36
+ });
37
+ sendEth.description = "Send ETH";
38
+ // WEB2 STEP
39
+ const sendHash = (0, workstep_1.prepareWeb2Step)("POST", "https://icanhazip.com", null, null, null, 2);
40
+ sendHash.description = "Send xm hash to HTTP API";
41
+ const operation = new conditional_1.ConditionalOperation();
42
+ operation
43
+ .if(sendEth.output.result, "==", steps_1.XmStepResult.success)
44
+ .then(sendHash)
45
+ .elif(sendEth.output.result, "==", steps_1.XmStepResult.error)
46
+ .then(sendHash);
47
+ work.push(operation);
48
+ const script = work.toJSON();
49
+ console.log(script);
50
+ // INFO: Create private key and return the signed transaction
51
+ const identity = websdk_1.DemosWebAuth.getInstance();
52
+ await identity.create();
53
+ return await (0, work_1.prepareDemosWorkPayload)(work, identity.keypair);
54
+ }
55
+ //# sourceMappingURL=createTestWorkScript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTestWorkScript.js","sourceRoot":"","sources":["../../../../src/demoswork/utils/createTestWorkScript.ts"],"names":[],"mappings":";;;;;AAWA,uCAsDC;AAjED,uFAA8D;AAC9D,wBAA6B;AAC7B,kCAA4D;AAC5D,0CAA4D;AAE5D,4CAAuC;AACvC,mDAAsD;AACtD,qCAAuC;AAEvC,2DAAgE;AAEjD,KAAK,UAAU,oBAAoB;IAC9C,MAAM,IAAI,GAAG,IAAI,gBAAS,EAAE,CAAA;IAE5B,MAAM,GAAG,GAAG,IAAA,YAAS,GAAE,CAAA;IACvB,MAAM,GAAG,GAAG,MAAM,UAAG,CAAC,MAAM,CAAC,wBAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACxD,MAAM,GAAG,CAAC,a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,GAAG,qBAAY,CAAC,WAAW,EAAE,CAAA;IAC3C,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAA;IAEvB,OAAO,MAAM,IAAA,8BAAuB,EAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;AAChE,CAAC"}
@@ -0,0 +1,21 @@
1
+ export declare function getNewUID(): string;
2
+ /**
3
+ * Get the value of a property given a path in an object.
4
+ * The path should be a string of property names separated by dots.
5
+ *
6
+ * @param obj The object to traverse
7
+ * @param path The path of the property to get
8
+ * @returns The value of the property at the path
9
+ *
10
+ * @example getValue(myObject, "nested.property")
11
+ */
12
+ export declare function getValue(obj: Object, path: string): Object;
13
+ /**
14
+ * Compare two values using the specified operator
15
+ *
16
+ * @param a First value
17
+ * @param b Second value
18
+ * @param operator Comparison operator
19
+ * @returns The result of the comparison (boolean)
20
+ */
21
+ export declare function compare(a: any, b: any, operator: string, validate_only?: boolean): boolean;