definition-generator-framework 1.10.3 → 1.10.5
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/.eslintrc.js +8 -22
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/pre-made-components/events/1-event.js +2 -0
- package/dist/pre-made-components/events/1-event.js.map +1 -1
- package/dist/pre-made-components/events/2-event-test.d.ts +22 -3
- package/dist/pre-made-components/events/2-event-test.js +86 -88
- package/dist/pre-made-components/events/2-event-test.js.map +1 -1
- package/dist/pre-made-components/events/event-setup.d.ts +8 -0
- package/dist/pre-made-components/events/event-setup.js +20 -0
- package/dist/pre-made-components/events/event-setup.js.map +1 -0
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.d.ts +3 -0
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.js +24 -0
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.js.map +1 -0
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.d.ts +1 -0
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.js +39 -0
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.js.map +1 -0
- package/package.json +3 -4
- package/package.json.bak +3 -4
- package/vitest.config.ts +1 -0
package/.eslintrc.js
CHANGED
|
@@ -24,31 +24,10 @@ module.exports = {
|
|
|
24
24
|
node: true,
|
|
25
25
|
jest: true
|
|
26
26
|
},
|
|
27
|
-
plugins: ['@typescript-eslint', '@typescript-eslint/eslint-plugin', 'no-null'
|
|
27
|
+
plugins: ['@typescript-eslint', '@typescript-eslint/eslint-plugin', 'no-null'],
|
|
28
28
|
ignorePatterns: ['**/*.js', 'vite.config.ts', 'out/**/*', 'dist/**/*', 'node_modules/**/*'],
|
|
29
29
|
rules: {
|
|
30
30
|
'no-null/no-null': 2,
|
|
31
|
-
'sort-class-members/sort-class-members': [
|
|
32
|
-
2,
|
|
33
|
-
{
|
|
34
|
-
order: [
|
|
35
|
-
'[static-properties]',
|
|
36
|
-
'[static-private-properties]',
|
|
37
|
-
'[static-methods]',
|
|
38
|
-
'[static-properties]',
|
|
39
|
-
'[static-private-properties]',
|
|
40
|
-
'[getters]',
|
|
41
|
-
'[setters]',
|
|
42
|
-
'[properties]',
|
|
43
|
-
'[conventional-private-properties]',
|
|
44
|
-
'constructor',
|
|
45
|
-
'[methods]',
|
|
46
|
-
'[conventional-private-properties]',
|
|
47
|
-
'[conventional-private-methods]'
|
|
48
|
-
],
|
|
49
|
-
accessorPairPositioning: 'getThenSet'
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
31
|
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
53
32
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
54
33
|
'@typescript-eslint/ban-types': 'error',
|
|
@@ -86,6 +65,13 @@ module.exports = {
|
|
|
86
65
|
selector: 'variable',
|
|
87
66
|
modifiers: ['const'],
|
|
88
67
|
format: ['PascalCase', 'UPPER_CASE']
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
selector: 'variable',
|
|
71
|
+
modifiers: [],
|
|
72
|
+
format: ['camelCase'],
|
|
73
|
+
leadingUnderscore: 'forbid',
|
|
74
|
+
trailingUnderscore: 'forbid'
|
|
89
75
|
}
|
|
90
76
|
],
|
|
91
77
|
'@typescript-eslint/no-array-constructor': 'error',
|
package/dist/index.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export { SpriteGroupComponent } from './pre-made-components/assets/2-sprite-grou
|
|
|
12
12
|
export { FontComponent } from './pre-made-components/assets/3-font';
|
|
13
13
|
export { EventComponent } from './pre-made-components/events/1-event';
|
|
14
14
|
export { EventTestComponent } from './pre-made-components/events/2-event-test';
|
|
15
|
+
export { EventSetup } from './pre-made-components/events/event-setup';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.EventTestComponent = exports.EventComponent = exports.FontComponent = exports.SpriteGroupComponent = exports.SpriteComponent = exports.Validator = exports.JoiCustomValidators = exports.DefinitionStore = exports.DefinitionGeneratorDecorator = exports.DefinitionGenerator = exports.SingleDefinitionComponent = exports.DefinitionComponentDecorator = exports.DefinitionComponent = void 0;
|
|
17
|
+
exports.EventSetup = exports.EventTestComponent = exports.EventComponent = exports.FontComponent = exports.SpriteGroupComponent = exports.SpriteComponent = exports.Validator = exports.JoiCustomValidators = exports.DefinitionStore = exports.DefinitionGeneratorDecorator = exports.DefinitionGenerator = exports.SingleDefinitionComponent = exports.DefinitionComponentDecorator = exports.DefinitionComponent = void 0;
|
|
18
18
|
require('./setup');
|
|
19
19
|
var definition_component_1 = require("./decorators/definition-component");
|
|
20
20
|
Object.defineProperty(exports, "DefinitionComponent", { enumerable: true, get: function () { return definition_component_1.DefinitionComponent; } });
|
|
@@ -41,4 +41,6 @@ var _1_event_1 = require("./pre-made-components/events/1-event");
|
|
|
41
41
|
Object.defineProperty(exports, "EventComponent", { enumerable: true, get: function () { return _1_event_1.EventComponent; } });
|
|
42
42
|
var _2_event_test_1 = require("./pre-made-components/events/2-event-test");
|
|
43
43
|
Object.defineProperty(exports, "EventTestComponent", { enumerable: true, get: function () { return _2_event_test_1.EventTestComponent; } });
|
|
44
|
+
var event_setup_1 = require("./pre-made-components/events/event-setup");
|
|
45
|
+
Object.defineProperty(exports, "EventSetup", { enumerable: true, get: function () { return event_setup_1.EventSetup; } });
|
|
44
46
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,CAAC,SAAS,CAA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sE;AAA7D,yGAAA,UAAU,OAAA"}
|
|
@@ -13,6 +13,7 @@ exports.EventComponent = void 0;
|
|
|
13
13
|
const helpers_lib_1 = require("helpers-lib");
|
|
14
14
|
const joi_1 = __importDefault(require("joi"));
|
|
15
15
|
const definition_component_1 = require("../../decorators/definition-component");
|
|
16
|
+
const quotes_to_tags_helper_1 = require("./helpers/quotes-to-tags.helper");
|
|
16
17
|
// ---- Conditions ----
|
|
17
18
|
const ActionCommandSchema = () => joi_1.default.string().custom(value => ({
|
|
18
19
|
type: 'command',
|
|
@@ -94,6 +95,7 @@ const DialogSchema = joi_1.default.object()
|
|
|
94
95
|
if (typeof text !== 'string') {
|
|
95
96
|
throw new Error('value must be a string');
|
|
96
97
|
}
|
|
98
|
+
text = quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text);
|
|
97
99
|
return { type: 'dialog', value: { text, speaker: key } };
|
|
98
100
|
});
|
|
99
101
|
// ---- Main Schema ----
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1-event.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/1-event.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAyC;AACzC,8CAAsB;AAGtB,gFAA0G;
|
|
1
|
+
{"version":3,"file":"1-event.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/1-event.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAyC;AACzC,8CAAsB;AAGtB,gFAA0G;AAE1G,2EAAqE;AAErE,uBAAuB;AACvB,MAAM,mBAAmB,GAAG,GAAe,EAAE,CAC3C,aAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,KAAK;CACb,CAAC,CAAC,CAAC;AAEN,qBAAqB;AACrB,MAAM,iBAAiB,GAAG,aAAG,CAAC,MAAM,EAAE;KACnC,IAAI,CAAC;IACJ,WAAW,EAAE,aAAG,CAA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 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { DefinitionComponent } from '../../decorators/definition-component';
|
|
2
|
+
import { Output } from '../../framework/interfaces';
|
|
3
|
+
type ActionBeforeTestType = 'command' | 'runEvent';
|
|
4
|
+
interface EventTestActionDefinition {
|
|
5
|
+
readonly type: ActionBeforeTestType;
|
|
6
|
+
readonly value: string;
|
|
7
|
+
}
|
|
8
|
+
interface EventTestCasesDefinition {
|
|
9
|
+
readonly actionsBeforeTesting: readonly EventTestActionDefinition[];
|
|
10
|
+
}
|
|
11
|
+
interface EventTestDefinition {
|
|
12
|
+
readonly event: string;
|
|
13
|
+
readonly cases: readonly EventTestCasesDefinition[];
|
|
14
|
+
}
|
|
15
|
+
export declare class EventTestComponent extends DefinitionComponent<EventTestDefinition> {
|
|
16
|
+
process(definitions: EventTestDefinition[], output: Output): Promise<void>;
|
|
17
|
+
private createEventTestSimulator;
|
|
18
|
+
private runTests;
|
|
19
|
+
private prepareErrorLog;
|
|
20
|
+
private printErrors;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
|
+
var EventTestComponent_1;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.EventTestComponent = void 0;
|
|
13
14
|
const helpers_lib_1 = require("helpers-lib");
|
|
@@ -16,6 +17,7 @@ const story_engine_lib_1 = require("story-engine-lib");
|
|
|
16
17
|
const definition_component_1 = require("../../decorators/definition-component");
|
|
17
18
|
const definition_store_1 = require("../../framework/definition-store");
|
|
18
19
|
const _1_event_1 = require("./1-event");
|
|
20
|
+
const event_setup_1 = require("./event-setup");
|
|
19
21
|
const CommandEventSchema = joi_1.default.string().custom(value => ({
|
|
20
22
|
type: 'command',
|
|
21
23
|
value: value
|
|
@@ -37,101 +39,97 @@ const EventTestActionSchema = () => joi_1.default.array()
|
|
|
37
39
|
then: RunEventSchema
|
|
38
40
|
}))
|
|
39
41
|
.min(1);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
eventTestSimulator.simulateEvent(event, jsEngine, testCase.actionsBeforeTesting);
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
let errorLog = this.prepareErrorLog(e, testDefinition, testCaseIndex, output);
|
|
65
|
-
errorLogs.push(errorLog);
|
|
66
|
-
errorEncountered = true;
|
|
67
|
-
}
|
|
42
|
+
let EventTestComponent = EventTestComponent_1 = class EventTestComponent extends definition_component_1.DefinitionComponent {
|
|
43
|
+
async process(definitions, output) {
|
|
44
|
+
let eventTestSimulator = this.createEventTestSimulator();
|
|
45
|
+
let runtimeErrors = this.runTests(definitions, eventTestSimulator, output);
|
|
46
|
+
this.printErrors(runtimeErrors, eventTestSimulator, output);
|
|
47
|
+
}
|
|
48
|
+
createEventTestSimulator() {
|
|
49
|
+
let allEvents = definition_store_1.DefinitionStore.getDefinitions(_1_event_1.EventComponent);
|
|
50
|
+
return new story_engine_lib_1.EventTestSimulator(allEvents);
|
|
51
|
+
}
|
|
52
|
+
runTests(testDefinitions, eventTestSimulator, output) {
|
|
53
|
+
let errorLogs = [];
|
|
54
|
+
testDefinitions.forEach(testDefinition => {
|
|
55
|
+
let event = definition_store_1.DefinitionStore.getDefinitionOrFail(_1_event_1.EventComponent, testDefinition.event);
|
|
56
|
+
let errorEncountered = false;
|
|
57
|
+
testDefinition.cases.forEach((testCase, testCaseIndex) => {
|
|
58
|
+
if (!errorEncountered) {
|
|
59
|
+
let jsEngine = new helpers_lib_1.JSEngine(new event_setup_1.EventSetup.EventSimulatorFunctionsConstructor(), {});
|
|
60
|
+
try {
|
|
61
|
+
eventTestSimulator.simulateEvent(event, jsEngine, testCase.actionsBeforeTesting);
|
|
68
62
|
}
|
|
69
|
-
|
|
63
|
+
catch (e) {
|
|
64
|
+
let errorLog = this.prepareErrorLog(e, testDefinition, testCaseIndex, output);
|
|
65
|
+
errorLogs.push(errorLog);
|
|
66
|
+
errorEncountered = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
70
69
|
});
|
|
71
|
-
|
|
70
|
+
});
|
|
71
|
+
return errorLogs;
|
|
72
|
+
}
|
|
73
|
+
prepareErrorLog(e, testDefinition, testCaseIndex, output) {
|
|
74
|
+
if (e instanceof story_engine_lib_1.SimulationError) {
|
|
75
|
+
return {
|
|
76
|
+
description: e.message,
|
|
77
|
+
location: definition_store_1.DefinitionStore.getLocationInFileById(_1_event_1.EventComponent, e.location.eventId, e.location.path)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else if (e instanceof story_engine_lib_1.ActionsBeforeTestingError) {
|
|
81
|
+
let executedActionLocation = definition_store_1.DefinitionStore.getLocationInFile(EventTestComponent_1, testDefinition, [
|
|
82
|
+
'cases',
|
|
83
|
+
`${testCaseIndex}`,
|
|
84
|
+
'actionsBeforeTesting',
|
|
85
|
+
`${e.actionIndex}`
|
|
86
|
+
]);
|
|
87
|
+
return {
|
|
88
|
+
description: e.message,
|
|
89
|
+
location: executedActionLocation
|
|
90
|
+
};
|
|
72
91
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'cases',
|
|
83
|
-
`${testCaseIndex}`,
|
|
84
|
-
'actionsBeforeTesting',
|
|
85
|
-
`${e.actionIndex}`
|
|
86
|
-
]);
|
|
87
|
-
return {
|
|
88
|
-
description: e.message,
|
|
89
|
-
location: executedActionLocation
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
else if (e instanceof story_engine_lib_1.BranchingBeforeTestingError) {
|
|
93
|
-
let testLocation = definition_store_1.DefinitionStore.getLocationInFile(EventTest_1, testDefinition, []);
|
|
94
|
-
let executionHistoryAddition = `Running the test: ${output.convertLocationInFileToLink(testLocation)}\n\n`;
|
|
95
|
-
let executionHistoryStart = e.message.indexOf('\n', e.message.indexOf('Execution history')) + 1;
|
|
96
|
-
let fullMessage = e.message.slice(0, executionHistoryStart) + executionHistoryAddition + e.message.slice(executionHistoryStart);
|
|
97
|
-
return {
|
|
98
|
-
description: fullMessage,
|
|
99
|
-
location: definition_store_1.DefinitionStore.getLocationInFileById(_1_event_1.EventComponent, e.location.eventId, e.location.path)
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
throw e;
|
|
104
|
-
}
|
|
92
|
+
else if (e instanceof story_engine_lib_1.BranchingBeforeTestingError) {
|
|
93
|
+
let testLocation = definition_store_1.DefinitionStore.getLocationInFile(EventTestComponent_1, testDefinition, []);
|
|
94
|
+
let executionHistoryAddition = `Running the test: ${output.convertLocationInFileToLink(testLocation)}\n\n`;
|
|
95
|
+
let executionHistoryStart = e.message.indexOf('\n', e.message.indexOf('Execution history')) + 1;
|
|
96
|
+
let fullMessage = e.message.slice(0, executionHistoryStart) + executionHistoryAddition + e.message.slice(executionHistoryStart);
|
|
97
|
+
return {
|
|
98
|
+
description: fullMessage,
|
|
99
|
+
location: definition_store_1.DefinitionStore.getLocationInFileById(_1_event_1.EventComponent, e.location.eventId, e.location.path)
|
|
100
|
+
};
|
|
105
101
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
eventTestSimulator.getUnvisitedBranchLocations().forEach(location => output.addError({
|
|
109
|
-
description: `Event branch is not reaced by any of the combinations during the tests.`,
|
|
110
|
-
location: definition_store_1.DefinitionStore.getLocationInFileById(_1_event_1.EventComponent, location.eventId, location.path)
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
runtimeErrors.forEach(error => output.addError(error));
|
|
102
|
+
else {
|
|
103
|
+
throw e;
|
|
114
104
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
(0
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
105
|
+
}
|
|
106
|
+
printErrors(runtimeErrors, eventTestSimulator, output) {
|
|
107
|
+
if (runtimeErrors.length === 0) {
|
|
108
|
+
eventTestSimulator.getUnvisitedBranchLocations().forEach(location => output.addError({
|
|
109
|
+
description: `Event branch is not reaced by any of the combinations during the tests.`,
|
|
110
|
+
location: definition_store_1.DefinitionStore.getLocationInFileById(_1_event_1.EventComponent, location.eventId, location.path)
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
runtimeErrors.forEach(error => output.addError(error));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
exports.EventTestComponent = EventTestComponent;
|
|
117
|
+
exports.EventTestComponent = EventTestComponent = EventTestComponent_1 = __decorate([
|
|
118
|
+
(0, definition_component_1.DefinitionComponentDecorator)({
|
|
119
|
+
componentName: 'EVENT-TEST',
|
|
120
|
+
keyName: 'id',
|
|
121
|
+
validationSchema: joi_1.default.object()
|
|
122
|
+
.keys({
|
|
123
|
+
event: joi_1.default.string().reference(_1_event_1.EventComponent).required(),
|
|
124
|
+
cases: joi_1.default.array()
|
|
125
|
+
.items(joi_1.default.object()
|
|
121
126
|
.keys({
|
|
122
|
-
|
|
123
|
-
cases: joi_1.default.array()
|
|
124
|
-
.items(joi_1.default.object()
|
|
125
|
-
.keys({
|
|
126
|
-
actionsBeforeTesting: EventTestActionSchema().default([]).optional()
|
|
127
|
-
})
|
|
128
|
-
.required())
|
|
129
|
-
.required()
|
|
127
|
+
actionsBeforeTesting: EventTestActionSchema().default([]).optional()
|
|
130
128
|
})
|
|
129
|
+
.required())
|
|
131
130
|
.required()
|
|
132
131
|
})
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
exports.EventTestComponent = EventTestComponent;
|
|
132
|
+
.required()
|
|
133
|
+
})
|
|
134
|
+
], EventTestComponent);
|
|
137
135
|
//# sourceMappingURL=2-event-test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2-event-test.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/2-event-test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"2-event-test.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/2-event-test.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAAuC;AACvC,8CAAsB;AACtB,uDAM0B;AAE1B,gFAA0G;AAC1G,uEAAmE;AAEnE,wCAA2C;AAC3C,+CAA2C;AAkB3C,MAAM,kBAAkB,GAAG,aAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvD,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,KAAK;CACb,CAAC,CAAC,CAAC;AAEJ,MAAM,cAAc,GAAG,aAAG,CAAC,MAAM,EAAE;KAChC,IAAI,CAAC;IACJ,QAAQ,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,yBAAc,CAAC,CAAC,QAAQ,EAAE;CAC5D,CAAC;KACD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,KAAK,CAAC,QAAQ;CACtB,CAAC,CAAC,CAAC;AAEN,MAAM,qBAAqB,GAAG,GAAoB,EAAE,CAClD,aAAG,CAAC,KAAK,EAAE;KACR,KAAK,CACJ,aAAG,CAAC,YAAY,EAAE;KACf,WAAW,CAAC,aAAG,CAAC,MAAM,EAAE,EAAE;IACzB,IAAI,EAAE,kBAAkB;CACzB,CAAC;KACD,WAAW,CAAC,aAAG,CAAC,MAAM,CAAC,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AG,CAAC,MAAM,EAAE;aAC3B,IAAI,CAAC;YACJ,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,yBAAc,CAAC,CAAC,QAAQ,EAAE;YACxD,KAAK,EAAE,aAAG,CAAC,KAAK,EAAE;iBACf,KAAK,CACJ,aAAG,CAAC,MAAM,EAAE;iBACT,IAAI,CAAC;gBACJ,oBAAoB,EAAE,qBAAqB,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;aACrE,CAAC;iBACD,QAAQ,EAAE,CACd;iBACA,QAAQ,EAAE;SACd,CAAC;aACD,QAAQ,EAAE;KACd,CAAC;GACW,kBAAkB,CA4F9B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StoryEngineSimulatorFunctions } from 'story-engine-lib';
|
|
2
|
+
export declare class EventSetup {
|
|
3
|
+
private static _eventSimulatorFunctionsConstructor;
|
|
4
|
+
private static _richTextTags;
|
|
5
|
+
static get EventSimulatorFunctionsConstructor(): new (...args: any[]) => StoryEngineSimulatorFunctions;
|
|
6
|
+
static get RichTextTags(): Set<string> | undefined;
|
|
7
|
+
static set(eventSimulatorFunctionsConstructor: new (...args: any[]) => StoryEngineSimulatorFunctions, richTextTags: Set<string> | undefined): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventSetup = void 0;
|
|
4
|
+
class EventSetup {
|
|
5
|
+
static get EventSimulatorFunctionsConstructor() {
|
|
6
|
+
if (!this._eventSimulatorFunctionsConstructor) {
|
|
7
|
+
throw new Error('EventSimulatorFunctionsConstructor is not set');
|
|
8
|
+
}
|
|
9
|
+
return this._eventSimulatorFunctionsConstructor;
|
|
10
|
+
}
|
|
11
|
+
static get RichTextTags() {
|
|
12
|
+
return this._richTextTags;
|
|
13
|
+
}
|
|
14
|
+
static set(eventSimulatorFunctionsConstructor, richTextTags) {
|
|
15
|
+
this._eventSimulatorFunctionsConstructor = eventSimulatorFunctionsConstructor;
|
|
16
|
+
this._richTextTags = richTextTags;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.EventSetup = EventSetup;
|
|
20
|
+
//# sourceMappingURL=event-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-setup.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/event-setup.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IAIrB,MAAM,KAAK,kCAAkC;QAC3C,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,IAAI,CAAC,mCAAmC,CAAC;IAClD,CAAC;IAED,MAAM,KAAK,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,GAAG,CACR,kCAAyF,EACzF,YAAqC;QAErC,IAAI,CAAC,mCAAmC,GAAG,kCAAkC,CAAC;QAC9E,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;CACF;AAtBD,gCAsBC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotesToTagsHelper = void 0;
|
|
4
|
+
const story_engine_lib_1 = require("story-engine-lib");
|
|
5
|
+
const event_setup_1 = require("../event-setup");
|
|
6
|
+
class QuotesToTagsHelper {
|
|
7
|
+
static convert(text) {
|
|
8
|
+
let isInsideQuote = false;
|
|
9
|
+
let quoteIndex = text.indexOf('"');
|
|
10
|
+
while (quoteIndex >= 0) {
|
|
11
|
+
let tag = isInsideQuote ? '</b>' : '<b>';
|
|
12
|
+
text = text.substring(0, quoteIndex) + tag + text.substring(quoteIndex + 1);
|
|
13
|
+
isInsideQuote = !isInsideQuote;
|
|
14
|
+
quoteIndex = text.indexOf('"', quoteIndex + 1);
|
|
15
|
+
}
|
|
16
|
+
if (isInsideQuote) {
|
|
17
|
+
throw new Error('Quote is not closed.');
|
|
18
|
+
}
|
|
19
|
+
story_engine_lib_1.RichTextValidator.validate(text, event_setup_1.EventSetup.RichTextTags);
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.QuotesToTagsHelper = QuotesToTagsHelper;
|
|
24
|
+
//# sourceMappingURL=quotes-to-tags.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes-to-tags.helper.js","sourceRoot":"","sources":["../../../../src/pre-made-components/events/helpers/quotes-to-tags.helper.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AACrD,gDAA4C;AAE5C,MAAa,kBAAkB;IAC7B,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,IAAI,aAAa,GAAG,KAAK,CAAC;QAE1B,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,UAAU,IAAI,CAAC,EAAE,CAAC;YACvB,IAAI,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;YACzC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YAC5E,aAAa,GAAG,CAAC,aAAa,CAAC;YAC/B,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QAED,oCAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,wBAAU,CAAC,YAAY,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AApBD,gDAoBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const quotes_to_tags_helper_1 = require("./quotes-to-tags.helper");
|
|
5
|
+
(0, vitest_1.describe)('QuotesToTagsHelper', () => {
|
|
6
|
+
(0, vitest_1.test)('plane text', () => {
|
|
7
|
+
let text = '0123';
|
|
8
|
+
let result = quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text);
|
|
9
|
+
(0, vitest_1.expect)(result).toBe('0123');
|
|
10
|
+
});
|
|
11
|
+
(0, vitest_1.test)('quote in text', () => {
|
|
12
|
+
let text = `"0123"0123`;
|
|
13
|
+
let result = quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text);
|
|
14
|
+
(0, vitest_1.expect)(result).toBe('<b>0123</b>0123');
|
|
15
|
+
});
|
|
16
|
+
(0, vitest_1.test)('multiple quotes in text', () => {
|
|
17
|
+
let text = `"0123"0123"0123"0123`;
|
|
18
|
+
let result = quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text);
|
|
19
|
+
(0, vitest_1.expect)(result).toBe('<b>0123</b>0123<b>0123</b>0123');
|
|
20
|
+
});
|
|
21
|
+
(0, vitest_1.test)('unclosed single quote', () => {
|
|
22
|
+
let text = `"0123`;
|
|
23
|
+
(0, vitest_1.expect)(() => quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text)).toThrow('Quote is not closed.');
|
|
24
|
+
});
|
|
25
|
+
(0, vitest_1.test)('unclosed multiple quotes', () => {
|
|
26
|
+
let text = `"0123"0123"0123`;
|
|
27
|
+
(0, vitest_1.expect)(() => quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text)).toThrow('Quote is not closed.');
|
|
28
|
+
});
|
|
29
|
+
(0, vitest_1.test)('use together with other tags', () => {
|
|
30
|
+
let text = `"0123"<r>0123</r>`;
|
|
31
|
+
let result = quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text);
|
|
32
|
+
(0, vitest_1.expect)(result).toBe('<b>0123</b><r>0123</r>');
|
|
33
|
+
});
|
|
34
|
+
(0, vitest_1.test)('conflict with other tags', () => {
|
|
35
|
+
let text = `"0123<r>01"23</r>`;
|
|
36
|
+
(0, vitest_1.expect)(() => quotes_to_tags_helper_1.QuotesToTagsHelper.convert(text)).toThrow(`Mismatched tags: expected closing tag for 'r', but found 'b' at position 12`);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=quotes-to-tags.helper.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes-to-tags.helper.test.js","sourceRoot":"","sources":["../../../../src/pre-made-components/events/helpers/quotes-to-tags.helper.test.ts"],"names":[],"mappings":";;AAAA,mCAAgD;AAEhD,mEAA6D;AAE7D,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAA,aAAI,EAAC,YAAY,EAAE,GAAG,EAAE;QACtB,IAAI,IAAI,GAAG,MAAM,CAAC;QAClB,IAAI,MAAM,GAAG,0CAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,eAAe,EAAE,GAAG,EAAE;QACzB,IAAI,IAAI,GAAG,YAAY,CAAC;QACxB,IAAI,MAAM,GAAG,0CAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,yBAAyB,EAAE,GAAG,EAAE;QAC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 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "definition-generator-framework",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.5",
|
|
4
4
|
"description": "Definition Generator Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"postpack": "mv package.json.bak package.json"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"helpers-lib": "1.12.
|
|
38
|
+
"helpers-lib": "1.12.3",
|
|
39
39
|
"image-size": "1.1.1",
|
|
40
40
|
"joi": "17.11.0",
|
|
41
41
|
"prettier": "3.3.3",
|
|
42
42
|
"jsonpath-plus": "8.1.0",
|
|
43
|
-
"story-engine-lib": "0.2.
|
|
43
|
+
"story-engine-lib": "0.2.10"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/glob": "8.1.0",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"eslint-config-prettier": "9.1.0",
|
|
53
53
|
"eslint-plugin-import": "2.29.1",
|
|
54
54
|
"eslint-plugin-no-null": "1.0.2",
|
|
55
|
-
"eslint-plugin-sort-class-members": "1.19.0",
|
|
56
55
|
"ts-node": "10.9.2",
|
|
57
56
|
"typescript": "5.3.3",
|
|
58
57
|
"vitest": "1.6.0"
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "definition-generator-framework",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.5",
|
|
4
4
|
"description": "Definition Generator Framework",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"postpack": "mv package.json.bak package.json"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"helpers-lib": "1.12.
|
|
38
|
+
"helpers-lib": "1.12.3",
|
|
39
39
|
"image-size": "1.1.1",
|
|
40
40
|
"joi": "17.11.0",
|
|
41
41
|
"prettier": "3.3.3",
|
|
42
42
|
"jsonpath-plus": "8.1.0",
|
|
43
|
-
"story-engine-lib": "0.2.
|
|
43
|
+
"story-engine-lib": "0.2.10"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/glob": "8.1.0",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"eslint-config-prettier": "9.1.0",
|
|
53
53
|
"eslint-plugin-import": "2.29.1",
|
|
54
54
|
"eslint-plugin-no-null": "1.0.2",
|
|
55
|
-
"eslint-plugin-sort-class-members": "1.19.0",
|
|
56
55
|
"ts-node": "10.9.2",
|
|
57
56
|
"typescript": "5.3.3",
|
|
58
57
|
"vitest": "1.6.0"
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|