@haibun/core 1.13.5 → 1.13.13

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 (173) hide show
  1. package/build/index.d.ts +1 -2
  2. package/build/index.js +1 -27
  3. package/build/index.js.map +1 -1
  4. package/build/lib/ConnectedLogger.d.ts +3 -4
  5. package/build/lib/ConnectedLogger.js +3 -9
  6. package/build/lib/ConnectedLogger.js.map +1 -1
  7. package/build/lib/Logger.d.ts +10 -11
  8. package/build/lib/Logger.js +17 -19
  9. package/build/lib/Logger.js.map +1 -1
  10. package/build/lib/Logger.test.d.ts +0 -1
  11. package/build/lib/Logger.test.js +11 -36
  12. package/build/lib/Logger.test.js.map +1 -1
  13. package/build/lib/TestLogger.d.ts +1 -2
  14. package/build/lib/TestLogger.js +1 -4
  15. package/build/lib/TestLogger.js.map +1 -1
  16. package/build/lib/Timer.d.ts +0 -1
  17. package/build/lib/Timer.js +4 -8
  18. package/build/lib/Timer.js.map +1 -1
  19. package/build/lib/contexts.d.ts +1 -2
  20. package/build/lib/contexts.js +9 -14
  21. package/build/lib/contexts.js.map +1 -1
  22. package/build/lib/{defs/index.d.ts → defs.d.ts} +57 -57
  23. package/build/lib/defs.js +28 -0
  24. package/build/lib/defs.js.map +1 -0
  25. package/build/lib/domain.d.ts +3 -4
  26. package/build/lib/domain.js +14 -23
  27. package/build/lib/domain.js.map +1 -1
  28. package/build/lib/features.d.ts +1 -2
  29. package/build/lib/features.js +15 -27
  30. package/build/lib/features.js.map +1 -1
  31. package/build/lib/features.test.d.ts +0 -1
  32. package/build/lib/features.test.js +31 -59
  33. package/build/lib/features.test.js.map +1 -1
  34. package/build/lib/interfaces/logger.d.ts +9 -10
  35. package/build/lib/interfaces/logger.js +1 -4
  36. package/build/lib/interfaces/logger.js.map +1 -1
  37. package/build/lib/namedVars.d.ts +7 -8
  38. package/build/lib/namedVars.js +12 -20
  39. package/build/lib/namedVars.js.map +1 -1
  40. package/build/lib/namedVars.test.d.ts +0 -1
  41. package/build/lib/namedVars.test.js +33 -38
  42. package/build/lib/namedVars.test.js.map +1 -1
  43. package/build/lib/run-with-options.d.ts +2 -3
  44. package/build/lib/run-with-options.js +13 -19
  45. package/build/lib/run-with-options.js.map +1 -1
  46. package/build/lib/run.d.ts +3 -4
  47. package/build/lib/run.domains.test.d.ts +0 -1
  48. package/build/lib/run.domains.test.js +43 -51
  49. package/build/lib/run.domains.test.js.map +1 -1
  50. package/build/lib/run.js +28 -36
  51. package/build/lib/run.js.map +1 -1
  52. package/build/lib/run.test.d.ts +0 -1
  53. package/build/lib/run.test.js +28 -36
  54. package/build/lib/run.test.js.map +1 -1
  55. package/build/lib/test/TestSteps.d.ts +15 -16
  56. package/build/lib/test/TestSteps.js +39 -44
  57. package/build/lib/test/TestSteps.js.map +1 -1
  58. package/build/lib/test/TestStepsWithDomain.d.ts +7 -8
  59. package/build/lib/test/TestStepsWithDomain.js +12 -17
  60. package/build/lib/test/TestStepsWithDomain.js.map +1 -1
  61. package/build/lib/test/TestStepsWithOptions.d.ts +6 -7
  62. package/build/lib/test/TestStepsWithOptions.js +18 -23
  63. package/build/lib/test/TestStepsWithOptions.js.map +1 -1
  64. package/build/lib/test/lib.d.ts +5 -6
  65. package/build/lib/test/lib.js +38 -72
  66. package/build/lib/test/lib.js.map +1 -1
  67. package/build/lib/util/index.d.ts +5 -7
  68. package/build/lib/util/index.js +48 -127
  69. package/build/lib/util/index.js.map +1 -1
  70. package/build/lib/util/util.test.d.ts +0 -1
  71. package/build/lib/util/util.test.js +36 -68
  72. package/build/lib/util/util.test.js.map +1 -1
  73. package/build/phases/Builder.d.ts +3 -4
  74. package/build/phases/Builder.js +12 -12
  75. package/build/phases/Builder.js.map +1 -1
  76. package/build/phases/Builder.test.d.ts +0 -1
  77. package/build/phases/Builder.test.js +13 -18
  78. package/build/phases/Builder.test.js.map +1 -1
  79. package/build/phases/Executor.d.ts +1 -2
  80. package/build/phases/Executor.js +16 -17
  81. package/build/phases/Executor.js.map +1 -1
  82. package/build/phases/Resolver.d.ts +1 -2
  83. package/build/phases/Resolver.domains.test.d.ts +0 -1
  84. package/build/phases/Resolver.domains.test.js +1 -2
  85. package/build/phases/Resolver.domains.test.js.map +1 -1
  86. package/build/phases/Resolver.js +19 -20
  87. package/build/phases/Resolver.js.map +1 -1
  88. package/build/phases/Resolver.test.d.ts +0 -1
  89. package/build/phases/Resolver.test.js +31 -36
  90. package/build/phases/Resolver.test.js.map +1 -1
  91. package/build/steps/conformance.d.ts +6 -7
  92. package/build/steps/conformance.js +10 -15
  93. package/build/steps/conformance.js.map +1 -1
  94. package/build/steps/credentials.d.ts +7 -8
  95. package/build/steps/credentials.js +25 -32
  96. package/build/steps/credentials.js.map +1 -1
  97. package/build/steps/haibun.d.ts +13 -14
  98. package/build/steps/haibun.js +66 -71
  99. package/build/steps/haibun.js.map +1 -1
  100. package/build/steps/haibun.test.d.ts +0 -1
  101. package/build/steps/haibun.test.js +4 -6
  102. package/build/steps/haibun.test.js.map +1 -1
  103. package/build/steps/vars.d.ts +17 -18
  104. package/build/steps/vars.js +74 -83
  105. package/build/steps/vars.js.map +1 -1
  106. package/build/steps/vars.test.d.ts +0 -1
  107. package/build/steps/vars.test.js +9 -11
  108. package/build/steps/vars.test.js.map +1 -1
  109. package/package.json +19 -14
  110. package/build/index.d.ts.map +0 -1
  111. package/build/lib/ConnectedLogger.d.ts.map +0 -1
  112. package/build/lib/Logger.d.ts.map +0 -1
  113. package/build/lib/Logger.test.d.ts.map +0 -1
  114. package/build/lib/TestLogger.d.ts.map +0 -1
  115. package/build/lib/Timer.d.ts.map +0 -1
  116. package/build/lib/contexts.d.ts.map +0 -1
  117. package/build/lib/defs/index.d.ts.map +0 -1
  118. package/build/lib/defs/index.js +0 -31
  119. package/build/lib/defs/index.js.map +0 -1
  120. package/build/lib/domain.d.ts.map +0 -1
  121. package/build/lib/features.d.ts.map +0 -1
  122. package/build/lib/features.test.d.ts.map +0 -1
  123. package/build/lib/interfaces/logger.d.ts.map +0 -1
  124. package/build/lib/namedVars.d.ts.map +0 -1
  125. package/build/lib/namedVars.test.d.ts.map +0 -1
  126. package/build/lib/run-with-options.d.ts.map +0 -1
  127. package/build/lib/run.d.ts.map +0 -1
  128. package/build/lib/run.domains.test.d.ts.map +0 -1
  129. package/build/lib/run.test.d.ts.map +0 -1
  130. package/build/lib/test/TestSteps.d.ts.map +0 -1
  131. package/build/lib/test/TestStepsWithDomain.d.ts.map +0 -1
  132. package/build/lib/test/TestStepsWithOptions.d.ts.map +0 -1
  133. package/build/lib/test/lib.d.ts.map +0 -1
  134. package/build/lib/util/index.d.ts.map +0 -1
  135. package/build/lib/util/util.test.d.ts.map +0 -1
  136. package/build/link-packages.d.ts +0 -3
  137. package/build/link-packages.d.ts.map +0 -1
  138. package/build/link-packages.js +0 -24
  139. package/build/link-packages.js.map +0 -1
  140. package/build/phases/Builder.d.ts.map +0 -1
  141. package/build/phases/Builder.test.d.ts.map +0 -1
  142. package/build/phases/Executor.d.ts.map +0 -1
  143. package/build/phases/Resolver.d.ts.map +0 -1
  144. package/build/phases/Resolver.domains.test.d.ts.map +0 -1
  145. package/build/phases/Resolver.test.d.ts.map +0 -1
  146. package/build/scaffold/index.d.ts +0 -3
  147. package/build/scaffold/index.d.ts.map +0 -1
  148. package/build/scaffold/index.js +0 -11
  149. package/build/scaffold/index.js.map +0 -1
  150. package/build/scaffold/scaffold.d.ts +0 -11
  151. package/build/scaffold/scaffold.d.ts.map +0 -1
  152. package/build/scaffold/scaffold.js +0 -90
  153. package/build/scaffold/scaffold.js.map +0 -1
  154. package/build/scaffold/scaffold.test.d.ts +0 -2
  155. package/build/scaffold/scaffold.test.d.ts.map +0 -1
  156. package/build/scaffold/scaffold.test.js +0 -34
  157. package/build/scaffold/scaffold.test.js.map +0 -1
  158. package/build/scaffold.d.ts +0 -3
  159. package/build/scaffold.d.ts.map +0 -1
  160. package/build/scaffold.js +0 -78
  161. package/build/scaffold.js.map +0 -1
  162. package/build/steps/conformance.d.ts.map +0 -1
  163. package/build/steps/credentials.d.ts.map +0 -1
  164. package/build/steps/haibun.d.ts.map +0 -1
  165. package/build/steps/haibun.test.d.ts.map +0 -1
  166. package/build/steps/vars.d.ts.map +0 -1
  167. package/build/steps/vars.test.d.ts.map +0 -1
  168. package/scaffold/jest.config.ts.in +0 -11
  169. package/scaffold/src/lib/test.ts.in +0 -10
  170. package/scaffold/src/lib/ts.in +0 -11
  171. package/scaffold/src/stepper.test.ts.in +0 -16
  172. package/scaffold/src/stepper.ts.in +0 -26
  173. package/scaffold/tsconfig.json.in +0 -14
@@ -1,45 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cred = void 0;
4
- const defs_1 = require("../lib/defs");
5
- const cred = (key) => `__cred_${key}`;
6
- exports.cred = cred;
7
- const Credentials = class Credentials extends defs_1.AStepper {
8
- constructor() {
9
- super(...arguments);
10
- this.steps = {
11
- hasRandomUsername: {
12
- match: /^When I have a valid random username <(?<name>.+)>/,
13
- action: async ({ name }) => {
14
- this.generateRandomUsername(name);
15
- return defs_1.OK;
16
- },
17
- },
18
- hasRandomPassword: {
19
- match: /^When I have a valid random password <(?<name>.+)>/,
20
- action: async ({ name }) => {
21
- this.generateRandomPassword(name);
22
- return defs_1.OK;
23
- },
24
- },
25
- };
26
- }
1
+ import { OK, AStepper } from '../lib/defs.js';
2
+ export const cred = (key) => `__cred_${key}`;
3
+ const Credentials = class Credentials extends AStepper {
27
4
  generateRandomUsername(ref) {
28
- this.getWorld().shared.set((0, exports.cred)(ref), ['rnd', Math.floor(Date.now() / 1000).toString(36), Math.floor(Math.random() * 1e8).toString(36)].join('_'));
29
- return this.getWorld().shared.get((0, exports.cred)(ref));
5
+ this.getWorld().shared.set(cred(ref), ['rnd', Math.floor(Date.now() / 1000).toString(36), Math.floor(Math.random() * 1e8).toString(36)].join('_'));
6
+ return this.getWorld().shared.get(cred(ref));
30
7
  }
31
8
  generateRandomPassword(ref) {
32
- this.getWorld().shared.set((0, exports.cred)(ref), [
9
+ this.getWorld().shared.set(cred(ref), [
33
10
  'testpass',
34
11
  Math.floor(Math.random() * 1e8)
35
12
  .toString(36)
36
13
  .toUpperCase(),
37
14
  ].join('_'));
38
- return this.getWorld().shared.get((0, exports.cred)(ref));
15
+ return this.getWorld().shared.get(cred(ref));
39
16
  }
40
17
  getRandom(name) {
41
- return this.getWorld().shared.get((0, exports.cred)(name));
18
+ return this.getWorld().shared.get(cred(name));
42
19
  }
20
+ steps = {
21
+ hasRandomUsername: {
22
+ match: /^When I have a valid random username <(?<name>.+)>/,
23
+ action: async ({ name }) => {
24
+ this.generateRandomUsername(name);
25
+ return OK;
26
+ },
27
+ },
28
+ hasRandomPassword: {
29
+ match: /^When I have a valid random password <(?<name>.+)>/,
30
+ action: async ({ name }) => {
31
+ this.generateRandomPassword(name);
32
+ return OK;
33
+ },
34
+ },
35
+ };
43
36
  };
44
- exports.default = Credentials;
37
+ export default Credentials;
45
38
  //# sourceMappingURL=credentials.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/steps/credentials.ts"],"names":[],"mappings":";;;AAAA,sCAAmD;AAE5C,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC;AAAxC,QAAA,IAAI,QAAoC;AAErD,MAAM,WAAW,GAAG,MAAM,WAAY,SAAQ,eAAQ;IAAlC;;QAmBlB,UAAK,GAAG;YACN,iBAAiB,EAAE;gBACjB,KAAK,EAAE,oDAAoD;gBAC3D,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAU,EAAE,EAAE;oBACjC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;oBAClC,OAAO,SAAE,CAAC;gBACZ,CAAC;aACF;YAED,iBAAiB,EAAE;gBACjB,KAAK,EAAE,oDAAoD;gBAC3D,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAU,EAAE,EAAE;o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QACpB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,GAAG;QACN,iBAAiB,EAAE;YACjB,KAAK,EAAE,oDAAoD;YAC3D,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAU,EAAE,EAAE;gBACjC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;gBAClC,OAAO,EAAE,CAAC;YACZ,CAAC;SACF;QAED,iBAAiB,EAAE;YACjB,KAAK,EAAE,oDAAoD;YAC3D,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAU,EAAE,EAAE;gBACjC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;gBAClC,OAAO,EAAE,CAAC;YACZ,CAAC;SACF;KACF,CAAC;CACH,CAAC;AACF,eAAe,WAAW,CAAC"}
@@ -1,30 +1,30 @@
1
- import { TNamed, AStepper } from '../lib/defs';
1
+ import { TNamed, AStepper } from '../lib/defs.js';
2
2
  declare const Haibun: {
3
3
  new (): {
4
4
  steps: {
5
5
  prose: {
6
6
  gwta: string;
7
- action: () => Promise<import("../lib/defs").TOKActionResult>;
7
+ action: () => Promise<import("../lib/defs.js").TOKActionResult>;
8
8
  };
9
9
  startStepDelay: {
10
10
  gwta: string;
11
- action: ({ ms }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
11
+ action: ({ ms }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
12
12
  };
13
13
  fails: {
14
14
  gwta: string;
15
- action: ({ message }: TNamed) => Promise<import("../lib/defs").TNotOKActionResult>;
15
+ action: ({ message }: TNamed) => Promise<import("../lib/defs.js").TNotOKActionResult>;
16
16
  };
17
17
  stopStepDelay: {
18
18
  gwta: string;
19
- action: () => Promise<import("../lib/defs").TOKActionResult>;
19
+ action: () => Promise<import("../lib/defs.js").TOKActionResult>;
20
20
  };
21
21
  displayEnv: {
22
22
  gwta: string;
23
- action: (a: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
23
+ action: (a: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
24
24
  };
25
25
  showTag: {
26
26
  gwta: string;
27
- action: ({ which }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
27
+ action: ({ which }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
28
28
  };
29
29
  forever: {
30
30
  gwta: string;
@@ -32,20 +32,19 @@ declare const Haibun: {
32
32
  };
33
33
  pauseSeconds: {
34
34
  gwta: string;
35
- action: ({ ms }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
35
+ action: ({ ms }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
36
36
  };
37
37
  comment: {
38
38
  gwta: string;
39
- action: ({ comment }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
39
+ action: ({ comment }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
40
40
  };
41
41
  };
42
- world?: import("../lib/defs").TWorld | undefined;
42
+ world?: import("../lib/defs.js").TWorld;
43
43
  close?(): void;
44
44
  endFeature?(): void;
45
- onFailure?(result: import("../lib/defs").TStepResult): void;
46
- setWorld(world: import("../lib/defs").TWorld, steppers: AStepper[]): void;
47
- getWorld(): import("../lib/defs").TWorld;
45
+ onFailure?(result: import("../lib/defs.js").TStepResult): void;
46
+ setWorld(world: import("../lib/defs.js").TWorld, steppers: AStepper[]): void;
47
+ getWorld(): import("../lib/defs.js").TWorld;
48
48
  };
49
49
  };
50
50
  export default Haibun;
51
- //# sourceMappingURL=haibun.d.ts.map
@@ -1,80 +1,75 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const defs_1 = require("../lib/defs");
4
- const util_1 = require("../lib/util");
5
- const Haibun = class Haibun extends defs_1.AStepper {
6
- constructor() {
7
- super(...arguments);
8
- this.steps = {
9
- prose: {
10
- gwta: '.*[.?!]$',
11
- action: async () => defs_1.OK,
1
+ import { OK, AStepper } from '../lib/defs.js';
2
+ import { actionNotOK, sleep } from '../lib/util/index.js';
3
+ const Haibun = class Haibun extends AStepper {
4
+ steps = {
5
+ prose: {
6
+ gwta: '.*[.?!]$',
7
+ action: async () => OK,
8
+ },
9
+ // sendFeatures: {
10
+ // gwta: 'send features',
11
+ // action: async () => {
12
+ // return actionOK({ features: this.getWorld().shared.values._features });
13
+ // },
14
+ // },
15
+ startStepDelay: {
16
+ gwta: 'start step delay of (?<ms>.+)',
17
+ action: async ({ ms }) => {
18
+ this.getWorld().options.step_delay = parseInt(ms, 10);
19
+ return OK;
12
20
  },
13
- // sendFeatures: {
14
- // gwta: 'send features',
15
- // action: async () => {
16
- // return actionOK({ features: this.getWorld().shared.values._features });
17
- // },
18
- // },
19
- startStepDelay: {
20
- gwta: 'start step delay of (?<ms>.+)',
21
- action: async ({ ms }) => {
22
- this.getWorld().options.step_delay = parseInt(ms, 10);
23
- return defs_1.OK;
24
- },
21
+ },
22
+ fails: {
23
+ gwta: `fails with {message}`,
24
+ action: async ({ message }) => {
25
+ return actionNotOK(`fails: ${message}`);
25
26
  },
26
- fails: {
27
- gwta: `fails with {message}`,
28
- action: async ({ message }) => {
29
- return (0, util_1.actionNotOK)(`fails: ${message}`);
30
- },
27
+ },
28
+ stopStepDelay: {
29
+ gwta: 'stop step delay',
30
+ action: async () => {
31
+ return OK;
31
32
  },
32
- stopStepDelay: {
33
- gwta: 'stop step delay',
34
- action: async () => {
35
- return defs_1.OK;
36
- },
37
- },
38
- displayEnv: {
39
- gwta: 'show the environment',
40
- action: async (a) => {
41
- this.world?.logger.log(`env: ${JSON.stringify(this.world.options.env)}`);
42
- return defs_1.OK;
43
- }
44
- },
45
- showTag: {
46
- gwta: 'show stepper tag {which}',
47
- action: async ({ which }) => {
48
- const what = which ? this.getWorld().tag[which] : this.getWorld().tag;
49
- this.world?.logger.log(`tag ${which}: ${JSON.stringify(what)}`);
50
- return defs_1.OK;
51
- },
33
+ },
34
+ displayEnv: {
35
+ gwta: 'show the environment',
36
+ action: async (a) => {
37
+ this.world?.logger.log(`env: ${JSON.stringify(this.world.options.env)}`);
38
+ return OK;
39
+ }
40
+ },
41
+ showTag: {
42
+ gwta: 'show stepper tag {which}',
43
+ action: async ({ which }) => {
44
+ const what = which ? this.getWorld().tag[which] : this.getWorld().tag;
45
+ this.world?.logger.log(`tag ${which}: ${JSON.stringify(what)}`);
46
+ return OK;
52
47
  },
53
- forever: {
54
- gwta: 'forever',
55
- action: async () => {
56
- while (true) {
57
- await (0, util_1.sleep)(1000);
58
- }
48
+ },
49
+ forever: {
50
+ gwta: 'forever',
51
+ action: async () => {
52
+ while (true) {
53
+ await sleep(1000);
59
54
  }
55
+ }
56
+ },
57
+ pauseSeconds: {
58
+ gwta: 'pause for {ms}s',
59
+ action: async ({ ms }) => {
60
+ const seconds = parseInt(ms, 10) * 1000;
61
+ await sleep(seconds);
62
+ return OK;
60
63
  },
61
- pauseSeconds: {
62
- gwta: 'pause for {ms}s',
63
- action: async ({ ms }) => {
64
- const seconds = parseInt(ms, 10) * 1000;
65
- await (0, util_1.sleep)(seconds);
66
- return defs_1.OK;
67
- },
68
- },
69
- comment: {
70
- gwta: '#{what}',
71
- action: async ({ comment }) => {
72
- this.getWorld().logger.log(`comment: ${comment}`);
73
- return defs_1.OK;
74
- }
64
+ },
65
+ comment: {
66
+ gwta: '#{what}',
67
+ action: async ({ comment }) => {
68
+ this.getWorld().logger.log(`comment: ${comment}`);
69
+ return OK;
75
70
  }
76
- };
77
- }
71
+ }
72
+ };
78
73
  };
79
- exports.default = Haibun;
74
+ export default Haibun;
80
75
  //# sourceMappingURL=haibun.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"haibun.js","sourceRoot":"","sources":["../../src/steps/haibun.ts"],"names":[],"mappings":";;AAAA,sCAAmD;AACnD,sCAAiD;AAEjD,MAAM,MAAM,GAAG,MAAM,MAAO,SAAQ,eAAQ;IAA7B;;QACb,UAAK,GAAG;YACN,KAAK,EAAE;gBACL,IAAI,E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AC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC;gBAC/E,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAC/D,OAAO,EAAE,CAAC;YACZ,CAAC;SACF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,KAAK,IAAI,EAAE;gBACjB,OAAO,IAAI,EAAE;oBACX,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;iBACnB;YACH,CAAC;SACF;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,iBAAiB;YACvB,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAU,EAAE,EAAE;gBAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC;gBACxC,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;gBACrB,OAAO,EAAE,CAAC;YACZ,CAAC;SACF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,KAAK,EAAC,EAAC,OAAO,EAAS,EAAE,EAAE;gBACjC,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;gBAClD,OAAO,EAAE,CAAC;YACZ,CAAC;SACF;KACF,CAAC;CACH,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=haibun.test.d.ts.map
@@ -1,11 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const Executor_1 = require("../phases/Executor");
4
- const lib_1 = require("../lib/test/lib");
1
+ import { FeatureExecutor } from '../phases/Executor.js';
2
+ import { getDefaultWorld, getTestEnv } from '../lib/test/lib.js';
5
3
  describe('haibun', () => {
6
4
  it('finds prose', async () => {
7
- const { world, vstep, steppers } = await (0, lib_1.getTestEnv)(['haibun'], 'A sentence.', (0, lib_1.getDefaultWorld)(0).world);
8
- const res = await Executor_1.FeatureExecutor.doFeatureStep(steppers, vstep, world);
5
+ const { world, vstep, steppers } = await getTestEnv(['haibun'], 'A sentence.', getDefaultWorld(0).world);
6
+ const res = await FeatureExecutor.doFeatureStep(steppers, vstep, world);
9
7
  expect(res.ok).toBe(true);
10
8
  expect(res.actionResults[0].name).toBe('prose');
11
9
  });
@@ -1 +1 @@
1
- {"version":3,"file":"haibun.test.js","sourceRoot":"","sources":["../../src/steps/haibun.test.ts"],"names":[],"mappings":";;AAAA,iDAAqD;AACrD,yCAA8D;AAE9D,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAC3B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,gBAAU,EAAC,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,IAAA,qBAAe,EAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzG,MAAM,GAAG,GAAG,MAAM,0BAAe,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAExE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"haibun.test.js","sourceRoot":"","sources":["../../src/steps/haibun.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjE,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAC3B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzG,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAExE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,8 +1,8 @@
1
- import { Context } from '../lib/contexts';
2
- import { TNamed, TVStep, TWorld, AStepper } from '../lib/defs';
1
+ import { Context } from '../lib/contexts.js';
2
+ import { TNamed, TVStep, TWorld, AStepper } from '../lib/defs.js';
3
3
  declare const vars: {
4
4
  new (): {
5
- set: (named: TNamed, vstep: TVStep) => Promise<import("../lib/defs").TOKActionResult | {
5
+ set: (named: TNamed, vstep: TVStep) => Promise<import("../lib/defs.js").TOKActionResult | {
6
6
  topics: {
7
7
  overwrite: {
8
8
  summary: string;
@@ -10,11 +10,11 @@ declare const vars: {
10
10
  };
11
11
  ok: true;
12
12
  }>;
13
- isSet(what: string, orCond: string): import("../lib/defs").TOKActionResult | import("../lib/defs").TNotOKActionResult;
13
+ isSet(what: string, orCond: string): import("../lib/defs.js").TOKActionResult | import("../lib/defs.js").TNotOKActionResult;
14
14
  steps: {
15
15
  concat: {
16
16
  gwta: string;
17
- action: ({ p1, p2, what }: TNamed, vstep: TVStep) => Promise<import("../lib/defs").TOKActionResult | {
17
+ action: ({ p1, p2, what }: TNamed, vstep: TVStep) => Promise<import("../lib/defs.js").TOKActionResult | {
18
18
  topics: {
19
19
  overwrite: {
20
20
  summary: string;
@@ -25,7 +25,7 @@ declare const vars: {
25
25
  };
26
26
  set: {
27
27
  gwta: string;
28
- action: (n: TNamed, vstep: TVStep) => Promise<import("../lib/defs").TOKActionResult | {
28
+ action: (n: TNamed, vstep: TVStep) => Promise<import("../lib/defs.js").TOKActionResult | {
29
29
  topics: {
30
30
  overwrite: {
31
31
  summary: string;
@@ -33,7 +33,7 @@ declare const vars: {
33
33
  };
34
34
  ok: true;
35
35
  }>;
36
- build: (n: TNamed, vstep: TVStep) => Promise<import("../lib/defs").TOKActionResult | {
36
+ build: (n: TNamed, vstep: TVStep) => Promise<import("../lib/defs.js").TOKActionResult | {
37
37
  topics: {
38
38
  overwrite: {
39
39
  summary: string;
@@ -44,34 +44,34 @@ declare const vars: {
44
44
  };
45
45
  is: {
46
46
  gwta: string;
47
- action: ({ what, value }: TNamed) => Promise<import("../lib/defs").TOKActionResult | import("../lib/defs").TNotOKActionResult>;
47
+ action: ({ what, value }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult | import("../lib/defs.js").TNotOKActionResult>;
48
48
  };
49
49
  isSet: {
50
50
  gwta: string;
51
- action: ({ what }: TNamed, vstep: TVStep) => Promise<import("../lib/defs").TOKActionResult | import("../lib/defs").TNotOKActionResult>;
52
- build: ({ what }: TNamed, vstep: TVStep) => Promise<import("../lib/defs").TOKActionResult | import("../lib/defs").TNotOKActionResult>;
51
+ action: ({ what }: TNamed, vstep: TVStep) => Promise<import("../lib/defs.js").TOKActionResult | import("../lib/defs.js").TNotOKActionResult>;
52
+ build: ({ what }: TNamed, vstep: TVStep) => Promise<import("../lib/defs.js").TOKActionResult | import("../lib/defs.js").TNotOKActionResult>;
53
53
  };
54
54
  background: {
55
55
  match: RegExp;
56
- action: ({ background }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
56
+ action: ({ background }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
57
57
  };
58
58
  feature: {
59
59
  match: RegExp;
60
- action: ({ feature }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
60
+ action: ({ feature }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
61
61
  };
62
62
  scenario: {
63
63
  match: RegExp;
64
- action: ({ scenario }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
64
+ action: ({ scenario }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
65
65
  };
66
66
  display: {
67
67
  gwta: string;
68
- action: ({ what }: TNamed) => Promise<import("../lib/defs").TOKActionResult>;
68
+ action: ({ what }: TNamed) => Promise<import("../lib/defs.js").TOKActionResult>;
69
69
  };
70
70
  };
71
- world?: TWorld | undefined;
71
+ world?: TWorld;
72
72
  close?(): void;
73
73
  endFeature?(): void;
74
- onFailure?(result: import("../lib/defs").TStepResult): void;
74
+ onFailure?(result: import("../lib/defs.js").TStepResult): void;
75
75
  setWorld(world: TWorld, steppers: AStepper[]): void;
76
76
  getWorld(): TWorld;
77
77
  };
@@ -82,7 +82,7 @@ export declare const didNotOverwrite: (what: string, present: string | Context,
82
82
  summary: string;
83
83
  };
84
84
  };
85
- export declare const setShared: ({ what, value }: TNamed, vstep: TVStep, world: TWorld, emptyOnly?: boolean) => import("../lib/defs").TOKActionResult | {
85
+ export declare const setShared: ({ what, value }: TNamed, vstep: TVStep, world: TWorld, emptyOnly?: boolean) => import("../lib/defs.js").TOKActionResult | {
86
86
  topics: {
87
87
  overwrite: {
88
88
  summary: string;
@@ -94,4 +94,3 @@ export declare const onCurrentTypeForDomain: ({ name, type }: {
94
94
  name: string;
95
95
  type: string;
96
96
  }, world: TWorld) => any;
97
- //# sourceMappingURL=vars.d.ts.map
@@ -1,77 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onCurrentTypeForDomain = exports.setShared = exports.didNotOverwrite = void 0;
4
- const contexts_1 = require("../lib/contexts");
5
- const defs_1 = require("../lib/defs");
6
- const domain_1 = require("../lib/domain");
7
- const util_1 = require("../lib/util");
1
+ import { DomainContext } from '../lib/contexts.js';
2
+ import { OK, AStepper } from '../lib/defs.js';
3
+ import { getDomain, getStepShared } from '../lib/domain.js';
4
+ import { actionNotOK } from '../lib/util/index.js';
8
5
  // FIXME see https://github.com/withhaibun/haibun/issues/18
9
6
  const getOrCond = (fr) => fr.replace(/.* is set or /, '');
10
- const vars = class Vars extends defs_1.AStepper {
11
- constructor() {
12
- super(...arguments);
13
- this.set = async (named, vstep) => {
14
- // FIXME see https://github.com/withhaibun/haibun/issues/18
15
- const emptyOnly = !!vstep.in.match(/set empty /);
16
- return (0, exports.setShared)(named, vstep, this.getWorld(), emptyOnly);
17
- };
18
- this.steps = {
19
- concat: {
20
- gwta: 'concat {p1} and {p2} as {what}',
21
- action: async ({ p1, p2, what }, vstep) => await this.set({ what, value: `${p1}${p2}` }, vstep)
22
- },
23
- set: {
24
- gwta: 'set( empty)? {what: string} to {value: string}',
25
- action: async (n, vstep) => {
26
- return await this.set(n, vstep);
27
- },
28
- build: async (n, vstep) => await this.set(n, vstep),
29
- },
30
- is: {
31
- gwta: '{what: string} is "{value}"',
32
- action: async ({ what, value }) => {
33
- const val = this.getWorld().shared.get(what);
34
- return val === value ? defs_1.OK : (0, util_1.actionNotOK)(`${what} is ${val}, not ${value}`);
35
- }
36
- },
37
- isSet: {
38
- gwta: '{what: string} is set( or .*)?',
39
- action: async ({ what }, vstep) => this.isSet(what, getOrCond(vstep.in)),
40
- build: async ({ what }, vstep) => this.isSet(what, getOrCond(vstep.in)),
41
- },
42
- background: {
43
- match: /^Background: ?(?<background>.+)?$/,
44
- action: async ({ background }) => {
45
- this.getWorld().shared.set('background', background);
46
- return defs_1.OK;
47
- },
48
- },
49
- feature: {
50
- match: /^Feature: ?(?<feature>.+)?$/,
51
- action: async ({ feature }) => {
52
- this.getWorld().shared.set('feature', feature);
53
- return defs_1.OK;
54
- },
55
- },
56
- scenario: {
57
- match: /^Scenario: (?<scenario>.+)$/,
58
- action: async ({ scenario }) => {
59
- this.getWorld().shared.set('scenario', scenario);
60
- return defs_1.OK;
61
- },
62
- },
63
- display: {
64
- gwta: 'display {what}',
65
- action: async ({ what }) => {
66
- this.getWorld().logger.log(`is ${JSON.stringify(what)}`);
67
- return defs_1.OK;
68
- },
69
- },
70
- };
71
- }
7
+ const vars = class Vars extends AStepper {
8
+ set = async (named, vstep) => {
9
+ // FIXME see https://github.com/withhaibun/haibun/issues/18
10
+ const emptyOnly = !!vstep.in.match(/set empty /);
11
+ return setShared(named, vstep, this.getWorld(), emptyOnly);
12
+ };
72
13
  isSet(what, orCond) {
73
14
  if (this.getWorld().shared.get(what) !== undefined) {
74
- return defs_1.OK;
15
+ return OK;
75
16
  }
76
17
  const [warning, response] = orCond.split(':').map((t) => t.trim());
77
18
  const topics = {
@@ -80,36 +21,87 @@ const vars = class Vars extends defs_1.AStepper {
80
21
  if (response) {
81
22
  topics.response = { summary: response };
82
23
  }
83
- return (0, util_1.actionNotOK)(`${what} not set${orCond && ': ' + orCond}`, { score: 10, topics });
24
+ return actionNotOK(`${what} not set${orCond && ': ' + orCond}`, { score: 10, topics });
84
25
  }
26
+ steps = {
27
+ concat: {
28
+ gwta: 'concat {p1} and {p2} as {what}',
29
+ action: async ({ p1, p2, what }, vstep) => await this.set({ what, value: `${p1}${p2}` }, vstep)
30
+ },
31
+ set: {
32
+ gwta: 'set( empty)? {what: string} to {value: string}',
33
+ action: async (n, vstep) => {
34
+ return await this.set(n, vstep);
35
+ },
36
+ build: async (n, vstep) => await this.set(n, vstep),
37
+ },
38
+ is: {
39
+ gwta: '{what: string} is "{value}"',
40
+ action: async ({ what, value }) => {
41
+ const val = this.getWorld().shared.get(what);
42
+ return val === value ? OK : actionNotOK(`${what} is ${val}, not ${value}`);
43
+ }
44
+ },
45
+ isSet: {
46
+ gwta: '{what: string} is set( or .*)?',
47
+ action: async ({ what }, vstep) => this.isSet(what, getOrCond(vstep.in)),
48
+ build: async ({ what }, vstep) => this.isSet(what, getOrCond(vstep.in)),
49
+ },
50
+ background: {
51
+ match: /^Background: ?(?<background>.+)?$/,
52
+ action: async ({ background }) => {
53
+ this.getWorld().shared.set('background', background);
54
+ return OK;
55
+ },
56
+ },
57
+ feature: {
58
+ match: /^Feature: ?(?<feature>.+)?$/,
59
+ action: async ({ feature }) => {
60
+ this.getWorld().shared.set('feature', feature);
61
+ return OK;
62
+ },
63
+ },
64
+ scenario: {
65
+ match: /^Scenario: (?<scenario>.+)$/,
66
+ action: async ({ scenario }) => {
67
+ this.getWorld().shared.set('scenario', scenario);
68
+ return OK;
69
+ },
70
+ },
71
+ display: {
72
+ gwta: 'display {what}',
73
+ action: async ({ what }) => {
74
+ this.getWorld().logger.log(`is ${JSON.stringify(what)}`);
75
+ return OK;
76
+ },
77
+ },
78
+ };
85
79
  };
86
- exports.default = vars;
87
- const didNotOverwrite = (what, present, value) => ({ overwrite: { summary: `did not overwrite ${what} value of "${present}" with "${value}"` } });
88
- exports.didNotOverwrite = didNotOverwrite;
89
- const setShared = ({ what, value }, vstep, world, emptyOnly = false) => {
80
+ export default vars;
81
+ export const didNotOverwrite = (what, present, value) => ({ overwrite: { summary: `did not overwrite ${what} value of "${present}" with "${value}"` } });
82
+ export const setShared = ({ what, value }, vstep, world, emptyOnly = false) => {
90
83
  // if on a domain page, set it in that domain's shared
91
84
  const { type, name } = vstep.source;
92
85
  // FIXME this should be in namedVars
93
86
  if (what === '[HERE]') {
94
87
  what = vstep.source.path.replace(world.base, '').replaceAll('/', '_').replace('.feature', '');
95
88
  }
96
- let shared = (0, domain_1.getStepShared)(type, world);
97
- if (shared instanceof contexts_1.DomainContext) {
89
+ let shared = getStepShared(type, world);
90
+ if (shared instanceof DomainContext) {
98
91
  const dc = shared;
99
92
  shared = dc.get(name) || dc.createPath(name);
100
93
  }
101
94
  if (!emptyOnly || shared.get(what) === undefined) {
102
95
  shared.set(what, value);
103
- return defs_1.OK;
96
+ return OK;
104
97
  }
105
- return { ...defs_1.OK, topics: { ...(0, exports.didNotOverwrite)(what, shared.get(what), value) } };
98
+ return { ...OK, topics: { ...didNotOverwrite(what, shared.get(what), value) } };
106
99
  };
107
- exports.setShared = setShared;
108
100
  // sets the current page for the domain in the world context, gets the location for the name
109
- const onCurrentTypeForDomain = ({ name, type }, world) => {
101
+ export const onCurrentTypeForDomain = ({ name, type }, world) => {
110
102
  // verifyDomainObjectExists(what, type);
111
103
  world.shared.setDomainValues(type, name);
112
- const domain = (0, domain_1.getDomain)(type, world);
104
+ const domain = getDomain(type, world);
113
105
  const page = domain?.shared.get(name);
114
106
  if (!page) {
115
107
  console.debug('using locator', domain?.module.domains.map((k) => k.name));
@@ -118,5 +110,4 @@ const onCurrentTypeForDomain = ({ name, type }, world) => {
118
110
  const uri = page.getID();
119
111
  return uri;
120
112
  };
121
- exports.onCurrentTypeForDomain = onCurrentTypeForDomain;
122
113
  //# sourceMappingURL=vars.js.map