kea-typegen 1.3.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.
- package/CHANGELOG.md +6 -0
- package/dist/package.json +14 -14
- package/dist/src/__tests__/e2e/actions.js +4 -4
- package/dist/src/__tests__/e2e/actions.js.map +1 -1
- package/dist/src/__tests__/e2e/connect.js +6 -6
- package/dist/src/__tests__/e2e/connect.js.map +1 -1
- package/dist/src/__tests__/e2e/loaders.js +3 -3
- package/dist/src/__tests__/e2e/loaders.js.map +1 -1
- package/dist/src/__tests__/e2e/reducers.js +4 -4
- package/dist/src/__tests__/e2e/reducers.js.map +1 -1
- package/dist/src/__tests__/e2e/selectors.js +3 -3
- package/dist/src/__tests__/e2e/selectors.js.map +1 -1
- package/dist/src/__tests__/utils.js +7 -7
- package/dist/src/__tests__/utils.js.map +1 -1
- package/dist/src/cli/typegen.js +3 -3
- package/dist/src/cli/typegen.js.map +1 -1
- package/dist/src/print/print.d.ts +4 -4
- package/dist/src/print/print.js +35 -35
- package/dist/src/print/print.js.map +1 -1
- package/dist/src/print/printActionCreators.d.ts +1 -2
- package/dist/src/print/printActionCreators.js +7 -7
- package/dist/src/print/printActionCreators.js.map +1 -1
- package/dist/src/print/printActionKeys.d.ts +1 -2
- package/dist/src/print/printActionKeys.js +4 -4
- package/dist/src/print/printActionKeys.js.map +1 -1
- package/dist/src/print/printActionTypes.d.ts +1 -2
- package/dist/src/print/printActionTypes.js +4 -4
- package/dist/src/print/printActionTypes.js.map +1 -1
- package/dist/src/print/printActions.d.ts +1 -2
- package/dist/src/print/printActions.js +4 -4
- package/dist/src/print/printActions.js.map +1 -1
- package/dist/src/print/printConstants.d.ts +1 -2
- package/dist/src/print/printConstants.js +2 -2
- package/dist/src/print/printConstants.js.map +1 -1
- package/dist/src/print/printDefaults.d.ts +1 -2
- package/dist/src/print/printDefaults.js +3 -3
- package/dist/src/print/printDefaults.js.map +1 -1
- package/dist/src/print/printEvents.d.ts +1 -2
- package/dist/src/print/printEvents.js +3 -3
- package/dist/src/print/printEvents.js.map +1 -1
- package/dist/src/print/printInternalExtraInput.d.ts +1 -2
- package/dist/src/print/printInternalExtraInput.js +8 -8
- package/dist/src/print/printInternalExtraInput.js.map +1 -1
- package/dist/src/print/printInternalReducerActions.d.ts +1 -2
- package/dist/src/print/printInternalReducerActions.js +3 -4
- package/dist/src/print/printInternalReducerActions.js.map +1 -1
- package/dist/src/print/printInternalSelectorTypes.d.ts +1 -2
- package/dist/src/print/printInternalSelectorTypes.js +3 -3
- package/dist/src/print/printInternalSelectorTypes.js.map +1 -1
- package/dist/src/print/printKey.d.ts +1 -2
- package/dist/src/print/printKey.js +2 -2
- package/dist/src/print/printKey.js.map +1 -1
- package/dist/src/print/printListeners.d.ts +1 -2
- package/dist/src/print/printListeners.js +9 -9
- package/dist/src/print/printListeners.js.map +1 -1
- package/dist/src/print/printProps.d.ts +1 -2
- package/dist/src/print/printProps.js +6 -5
- package/dist/src/print/printProps.js.map +1 -1
- package/dist/src/print/printReducer.d.ts +1 -2
- package/dist/src/print/printReducer.js +6 -6
- package/dist/src/print/printReducer.js.map +1 -1
- package/dist/src/print/printReducerOptions.d.ts +1 -2
- package/dist/src/print/printReducerOptions.js +3 -3
- package/dist/src/print/printReducerOptions.js.map +1 -1
- package/dist/src/print/printReducers.d.ts +1 -2
- package/dist/src/print/printReducers.js +7 -7
- package/dist/src/print/printReducers.js.map +1 -1
- package/dist/src/print/printSelector.d.ts +1 -2
- package/dist/src/print/printSelector.js +4 -4
- package/dist/src/print/printSelector.js.map +1 -1
- package/dist/src/print/printSelectors.d.ts +1 -2
- package/dist/src/print/printSelectors.js +6 -6
- package/dist/src/print/printSelectors.js.map +1 -1
- package/dist/src/print/printSharedListeners.d.ts +1 -2
- package/dist/src/print/printSharedListeners.js +11 -11
- package/dist/src/print/printSharedListeners.js.map +1 -1
- package/dist/src/print/printValues.d.ts +1 -2
- package/dist/src/print/printValues.js +3 -3
- package/dist/src/print/printValues.js.map +1 -1
- package/dist/src/typegen.js +2 -2
- package/dist/src/typegen.js.map +1 -1
- package/dist/src/utils.js +15 -15
- package/dist/src/utils.js.map +1 -1
- package/dist/src/visit/__tests__/visit.js +2 -2
- package/dist/src/visit/__tests__/visit.js.map +1 -1
- package/dist/src/visit/visit.js +13 -13
- package/dist/src/visit/visit.js.map +1 -1
- package/dist/src/visit/visitActions.d.ts +2 -2
- package/dist/src/visit/visitActions.js +13 -11
- package/dist/src/visit/visitActions.js.map +1 -1
- package/dist/src/visit/visitConnect.js +4 -4
- package/dist/src/visit/visitConnect.js.map +1 -1
- package/dist/src/visit/visitDefaults.js +1 -1
- package/dist/src/visit/visitDefaults.js.map +1 -1
- package/dist/src/visit/visitKey.js +2 -2
- package/dist/src/visit/visitKey.js.map +1 -1
- package/dist/src/visit/visitListeners.js +5 -5
- package/dist/src/visit/visitListeners.js.map +1 -1
- package/dist/src/visit/visitLoaders.d.ts +2 -2
- package/dist/src/visit/visitLoaders.js +27 -27
- package/dist/src/visit/visitLoaders.js.map +1 -1
- package/dist/src/visit/visitProps.js +1 -1
- package/dist/src/visit/visitProps.js.map +1 -1
- package/dist/src/visit/visitReducers.js +4 -4
- package/dist/src/visit/visitReducers.js.map +1 -1
- package/dist/src/visit/visitSelectors.js +8 -8
- package/dist/src/visit/visitSelectors.js.map +1 -1
- package/dist/src/visit/visitSharedListeners.js +5 -5
- package/dist/src/visit/visitSharedListeners.js.map +1 -1
- package/dist/src/visit/visitWindowValues.js +1 -1
- package/dist/src/visit/visitWindowValues.js.map +1 -1
- package/dist/src/write/write.js +16 -15
- package/dist/src/write/write.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/form-plugin/lib/form-plugin/src/typegen.js +16 -15
- package/form-plugin/lib/src/types.d.ts +4 -1
- package/form-plugin/package.json +1 -1
- package/form-plugin/src/typegen.ts +25 -25
- package/form-plugin/tsconfig.json +0 -1
- package/form-plugin/yarn.lock +10 -10
- package/package.json +14 -14
- package/samples/autoImportLogic.ts +9 -3
- package/samples/autoImportLogicType.ts +1 -1
- package/src/__tests__/utils.ts +5 -5
- package/src/print/print.ts +33 -19
- package/src/print/printActionCreators.ts +12 -15
- package/src/print/printActionKeys.ts +5 -6
- package/src/print/printActionTypes.ts +6 -7
- package/src/print/printActions.ts +6 -13
- package/src/print/printConstants.ts +5 -6
- package/src/print/printDefaults.ts +5 -6
- package/src/print/printEvents.ts +8 -6
- package/src/print/printInternalExtraInput.ts +12 -13
- package/src/print/printInternalReducerActions.ts +5 -12
- package/src/print/printInternalSelectorTypes.ts +7 -8
- package/src/print/printKey.ts +2 -2
- package/src/print/printListeners.ts +16 -17
- package/src/print/printProps.ts +7 -7
- package/src/print/printReducer.ts +14 -15
- package/src/print/printReducerOptions.ts +4 -5
- package/src/print/printReducers.ts +13 -14
- package/src/print/printSelector.ts +8 -9
- package/src/print/printSelectors.ts +12 -13
- package/src/print/printSharedListeners.ts +20 -21
- package/src/print/printValues.ts +5 -6
- package/src/utils.ts +14 -14
- package/src/visit/visit.ts +2 -2
- package/src/visit/visitActions.ts +12 -10
- package/src/visit/visitListeners.ts +8 -8
- package/src/visit/visitLoaders.ts +49 -43
- package/src/visit/visitReducers.ts +1 -1
- package/src/visit/visitSelectors.ts +3 -3
- package/src/visit/visitSharedListeners.ts +8 -10
- package/src/write/write.ts +29 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 1.4.0 - 2021-12-12
|
|
2
|
+
|
|
3
|
+
- Support TypeScript 4.5+.
|
|
4
|
+
- Now adds new type imports with `type`, such as: `import type { logicType } from './logicType`.
|
|
5
|
+
- Refactor internals to create nodes newer `ts.factory` methods.
|
|
6
|
+
|
|
1
7
|
## 1.3.0 - 2021-11-08
|
|
2
8
|
|
|
3
9
|
- Write paths into logics with `--write-paths`. Can be configured in `.kearc` with `writePaths: true`
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kea-typegen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Generate type definitions for kea logic",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "ts-node ./src/cli/typegen.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"samples:write:paths": "ts-node ./src/cli/typegen.ts write -c ./samples/tsconfig.json --write-paths",
|
|
15
15
|
"samples:watch": "ts-node ./src/cli/typegen.ts watch -c ./samples/tsconfig.json",
|
|
16
16
|
"samples:write:posthog": "ts-node ./src/cli/typegen.ts write -c ../../PostHog/posthog/tsconfig.json",
|
|
17
|
-
"form-plugin:build": "cd form-plugin && yarn build && cd ..",
|
|
17
|
+
"form-plugin:build": "cd form-plugin && yarn && yarn build && cd ..",
|
|
18
18
|
"form-plugin:rebuild": "yarn form-plugin:build && rm -rf node_modules && yarn"
|
|
19
19
|
},
|
|
20
20
|
"main": "dist/src/index.js",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@wessberg/ts-clone-node": "0.3.19",
|
|
28
28
|
"diff": "^5.0.0",
|
|
29
|
-
"prettier": "^2.
|
|
29
|
+
"prettier": "^2.5.1",
|
|
30
30
|
"yargs": "^16.2.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@babel/core": "^7.
|
|
34
|
-
"@babel/preset-env": "^7.
|
|
35
|
-
"@babel/preset-typescript": "^7.
|
|
33
|
+
"@babel/core": "^7.16.0",
|
|
34
|
+
"@babel/preset-env": "^7.16.4",
|
|
35
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
36
36
|
"@types/jest": "^26.0.20",
|
|
37
37
|
"@types/node": "^14.14.31",
|
|
38
38
|
"@types/yargs": "^16.0.0",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"form-plugin": "file:./form-plugin",
|
|
42
42
|
"husky": ">=4",
|
|
43
43
|
"jest": "^27.0.5",
|
|
44
|
-
"kea": "^2.
|
|
45
|
-
"lint-staged": ">=
|
|
44
|
+
"kea": "^2.5.6",
|
|
45
|
+
"lint-staged": ">=12.1.2",
|
|
46
46
|
"react": "^16.13.1",
|
|
47
|
-
"react-redux": "^7.2.
|
|
48
|
-
"redux": "^4.1.
|
|
49
|
-
"reselect": "^4.
|
|
47
|
+
"react-redux": "^7.2.6",
|
|
48
|
+
"redux": "^4.1.2",
|
|
49
|
+
"reselect": "^4.1.5",
|
|
50
50
|
"rimraf": "^3.0.2",
|
|
51
51
|
"ts-jest": "^27.0.3",
|
|
52
|
-
"ts-node": "^10.
|
|
53
|
-
"typescript": "^4.3
|
|
52
|
+
"ts-node": "^10.4.0",
|
|
53
|
+
"typescript": "^4.5.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"typescript": "
|
|
56
|
+
"typescript": ">=4.5.3"
|
|
57
57
|
},
|
|
58
58
|
"jest": {
|
|
59
59
|
"testPathIgnorePatterns": [
|
|
@@ -12,7 +12,7 @@ test('actions - with a function', () => {
|
|
|
12
12
|
})
|
|
13
13
|
})
|
|
14
14
|
`;
|
|
15
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
15
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
16
16
|
});
|
|
17
17
|
test('actions - as an object', () => {
|
|
18
18
|
const logicSource = `
|
|
@@ -25,7 +25,7 @@ test('actions - as an object', () => {
|
|
|
25
25
|
}
|
|
26
26
|
})
|
|
27
27
|
`;
|
|
28
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
28
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
29
29
|
});
|
|
30
30
|
test('actions - as a function returning a object', () => {
|
|
31
31
|
const logicSource = `
|
|
@@ -40,7 +40,7 @@ test('actions - as a function returning a object', () => {
|
|
|
40
40
|
}
|
|
41
41
|
})
|
|
42
42
|
`;
|
|
43
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
43
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
44
44
|
});
|
|
45
45
|
test('actions - with random values instead of functions', () => {
|
|
46
46
|
const logicSource = `
|
|
@@ -56,6 +56,6 @@ test('actions - with random values instead of functions', () => {
|
|
|
56
56
|
}
|
|
57
57
|
})
|
|
58
58
|
`;
|
|
59
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
59
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
60
60
|
});
|
|
61
61
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/actions.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;KASnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/actions.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;KASnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;IAChC,MAAM,WAAW,GAAG;;;;;;;;;KASnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACpD,MAAM,WAAW,GAAG;;;;;;;;;;;KAWnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC3D,MAAM,WAAW,GAAG;;;;;;;;;;;;KAYnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -44,7 +44,7 @@ test('connect actions from another logic', () => {
|
|
|
44
44
|
}
|
|
45
45
|
})
|
|
46
46
|
`;
|
|
47
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
47
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
48
48
|
});
|
|
49
49
|
test('connect actions from multiple other logics', () => {
|
|
50
50
|
const logicSource = `
|
|
@@ -91,7 +91,7 @@ test('connect actions from multiple other logics', () => {
|
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
93
|
`;
|
|
94
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
94
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
95
95
|
});
|
|
96
96
|
test('connect actions and rename', () => {
|
|
97
97
|
const logicSource = `
|
|
@@ -138,7 +138,7 @@ test('connect actions and rename', () => {
|
|
|
138
138
|
}
|
|
139
139
|
})
|
|
140
140
|
`;
|
|
141
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
141
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
142
142
|
});
|
|
143
143
|
test('connect values from another logic', () => {
|
|
144
144
|
const logicSource = `
|
|
@@ -187,7 +187,7 @@ test('connect values from another logic', () => {
|
|
|
187
187
|
}
|
|
188
188
|
})
|
|
189
189
|
`;
|
|
190
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
190
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
191
191
|
});
|
|
192
192
|
test('connect props from another logic', () => {
|
|
193
193
|
const logicSource = `
|
|
@@ -236,7 +236,7 @@ test('connect props from another logic', () => {
|
|
|
236
236
|
}
|
|
237
237
|
})
|
|
238
238
|
`;
|
|
239
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
239
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
240
240
|
});
|
|
241
241
|
test('connect values and rename', () => {
|
|
242
242
|
const logicSource = `
|
|
@@ -285,6 +285,6 @@ test('connect values and rename', () => {
|
|
|
285
285
|
}
|
|
286
286
|
})
|
|
287
287
|
`;
|
|
288
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
288
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
289
289
|
});
|
|
290
290
|
//# sourceMappingURL=connect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/connect.ts"],"names":[],"mappings":";;AAAA,uCAAmD;AAEnD,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAC5C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/connect.ts"],"names":[],"mappings":";;AAAA,uCAAmD;AAEnD,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAC5C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCnB,CA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AC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -23,7 +23,7 @@ test('loaders - with a function', () => {
|
|
|
23
23
|
})
|
|
24
24
|
})
|
|
25
25
|
`;
|
|
26
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
26
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
27
27
|
});
|
|
28
28
|
test('loaders - with an array and default', () => {
|
|
29
29
|
const logicSource = `
|
|
@@ -49,7 +49,7 @@ test('loaders - with an array and default', () => {
|
|
|
49
49
|
})
|
|
50
50
|
})
|
|
51
51
|
`;
|
|
52
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
52
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
53
53
|
});
|
|
54
54
|
test('loaders - with no param', () => {
|
|
55
55
|
const logicSource = `
|
|
@@ -68,6 +68,6 @@ test('loaders - with no param', () => {
|
|
|
68
68
|
})
|
|
69
69
|
})
|
|
70
70
|
`;
|
|
71
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
71
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
72
72
|
});
|
|
73
73
|
//# sourceMappingURL=loaders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/loaders.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;KAoBnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/loaders.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;KAoBnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAGF,IAAI,CAAC,qCAAqC,EAAE,GAAG,EAAE;IAC7C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;KAsBnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;KAenB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -30,7 +30,7 @@ test('reducers - with a function', () => {
|
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
`;
|
|
33
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
33
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
34
34
|
});
|
|
35
35
|
test('reducers - as an object', () => {
|
|
36
36
|
const logicSource = `
|
|
@@ -60,7 +60,7 @@ test('reducers - as an object', () => {
|
|
|
60
60
|
}
|
|
61
61
|
})
|
|
62
62
|
`;
|
|
63
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
63
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
64
64
|
});
|
|
65
65
|
test('reducers - as a function returning a object', () => {
|
|
66
66
|
const logicSource = `
|
|
@@ -93,7 +93,7 @@ test('reducers - as a function returning a object', () => {
|
|
|
93
93
|
}
|
|
94
94
|
})
|
|
95
95
|
`;
|
|
96
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
96
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
97
97
|
});
|
|
98
98
|
test('reducers - with bool default', () => {
|
|
99
99
|
const logicSource = `
|
|
@@ -115,6 +115,6 @@ test('reducers - with bool default', () => {
|
|
|
115
115
|
}
|
|
116
116
|
})
|
|
117
117
|
`;
|
|
118
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
118
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
119
119
|
});
|
|
120
120
|
//# sourceMappingURL=reducers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducers.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/reducers.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACpC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"reducers.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/reducers.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACpC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;IACrD,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,8BAA8B,EAAE,GAAG,EAAE;IACtC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;KAkBnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -33,7 +33,7 @@ test('selectors - with a function', () => {
|
|
|
33
33
|
})
|
|
34
34
|
})
|
|
35
35
|
`;
|
|
36
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
36
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
37
37
|
});
|
|
38
38
|
test('selectors - as an object', () => {
|
|
39
39
|
const logicSource = `
|
|
@@ -67,7 +67,7 @@ test('selectors - as an object', () => {
|
|
|
67
67
|
}
|
|
68
68
|
})
|
|
69
69
|
`;
|
|
70
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
70
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
71
71
|
});
|
|
72
72
|
test('selectors - as a function returning a object', () => {
|
|
73
73
|
const logicSource = `
|
|
@@ -103,6 +103,6 @@ test('selectors - as a function returning a object', () => {
|
|
|
103
103
|
}
|
|
104
104
|
})
|
|
105
105
|
`;
|
|
106
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
106
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
107
107
|
});
|
|
108
108
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/selectors.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/selectors.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAClC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;IACtD,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
-
const
|
|
4
|
+
const typescript_1 = require("typescript");
|
|
5
5
|
test('sourceToSourceFile', () => {
|
|
6
6
|
const source = 'var foo = 5;';
|
|
7
|
-
const sourceFile1 = utils_1.sourceToSourceFile(source);
|
|
8
|
-
const sourceFile2 = utils_1.sourceToSourceFile(source, 'otherLogic.ts');
|
|
7
|
+
const sourceFile1 = (0, utils_1.sourceToSourceFile)(source);
|
|
8
|
+
const sourceFile2 = (0, utils_1.sourceToSourceFile)(source, 'otherLogic.ts');
|
|
9
9
|
expect(sourceFile1.text).toEqual(source);
|
|
10
10
|
expect(sourceFile2.text).toEqual(source);
|
|
11
11
|
expect(sourceFile1.fileName).toEqual('logic.ts');
|
|
12
12
|
expect(sourceFile2.fileName).toEqual('otherLogic.ts');
|
|
13
|
-
expect(
|
|
14
|
-
expect(
|
|
13
|
+
expect(typescript_1.SyntaxKind[sourceFile1.kind]).toEqual('SourceFile');
|
|
14
|
+
expect(typescript_1.SyntaxKind[sourceFile2.kind]).toEqual('SourceFile');
|
|
15
15
|
});
|
|
16
16
|
test('programFromSource', () => {
|
|
17
17
|
const source = 'var foo = 5;';
|
|
18
|
-
const program = utils_1.programFromSource(source);
|
|
18
|
+
const program = (0, utils_1.programFromSource)(source);
|
|
19
19
|
expect(program).toBeDefined;
|
|
20
20
|
expect(typeof program.getSourceFile).toBe('function');
|
|
21
21
|
});
|
|
@@ -30,7 +30,7 @@ test('logicSourceToLogicType', () => {
|
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
`;
|
|
33
|
-
const string = utils_1.logicSourceToLogicType(logicSource);
|
|
33
|
+
const string = (0, utils_1.logicSourceToLogicType)(logicSource);
|
|
34
34
|
expect(string).toContain('export interface myRandomLogicType extends Logic {');
|
|
35
35
|
});
|
|
36
36
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/__tests__/utils.ts"],"names":[],"mappings":";;AAAA,oCAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"utils.js","s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IACD,MAAM,MAAM,GAAG,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAA;IAElD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,oDAAoD,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
|
package/dist/src/cli/typegen.js
CHANGED
|
@@ -8,13 +8,13 @@ const fs = require("fs");
|
|
|
8
8
|
const typegen_1 = require("../typegen");
|
|
9
9
|
yargs
|
|
10
10
|
.command('check', '- check what should be done', (yargs) => { }, (argv) => {
|
|
11
|
-
typegen_1.runTypeGen(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: false, watch: false }));
|
|
11
|
+
(0, typegen_1.runTypeGen)(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: false, watch: false }));
|
|
12
12
|
})
|
|
13
13
|
.command('write', '- write logicType.ts files', (yargs) => { }, (argv) => {
|
|
14
|
-
typegen_1.runTypeGen(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: false }));
|
|
14
|
+
(0, typegen_1.runTypeGen)(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: false }));
|
|
15
15
|
})
|
|
16
16
|
.command('watch', '- watch for changes and write logicType.ts files', (yargs) => { }, (argv) => {
|
|
17
|
-
typegen_1.runTypeGen(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: true }));
|
|
17
|
+
(0, typegen_1.runTypeGen)(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: true }));
|
|
18
18
|
})
|
|
19
19
|
.option('config', { alias: 'c', describe: 'Path to tsconfig.json (otherwise auto-detected)', type: 'string' })
|
|
20
20
|
.option('file', { alias: 'f', describe: "Single file to evaluate (can't be used with --config)", type: 'string' })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typegen.js","sourceRoot":"","sources":["../../../src/cli/typegen.ts"],"names":[],"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export declare function runThroughPrettier(sourceText: string, filePath: string): string;
|
|
4
|
-
export declare function printToFiles(program:
|
|
4
|
+
export declare function printToFiles(program: Program, appOptions: AppOptions, parsedLogics: ParsedLogic[]): {
|
|
5
5
|
filesToWrite: number;
|
|
6
6
|
writtenFiles: number;
|
|
7
7
|
filesToModify: number;
|
|
8
8
|
};
|
|
9
|
-
export declare function nodeToString(node:
|
|
9
|
+
export declare function nodeToString(node: Node): string;
|
|
10
10
|
export declare function parsedLogicToTypeString(parsedLogic: ParsedLogic, appOptions?: AppOptions): string;
|
|
11
|
-
export declare function getLogicTypeArguments(parsedLogic: ParsedLogic):
|
|
11
|
+
export declare function getLogicTypeArguments(parsedLogic: ParsedLogic): TypeParameterDeclaration[];
|
|
12
12
|
export declare function printLogicType(parsedLogic: ParsedLogic, appOptions?: AppOptions): void;
|
package/dist/src/print/print.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printLogicType = exports.getLogicTypeArguments = exports.parsedLogicToTypeString = exports.nodeToString = exports.printToFiles = exports.runThroughPrettier = void 0;
|
|
4
|
-
const
|
|
4
|
+
const typescript_1 = require("typescript");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const prettier = require("prettier");
|
|
@@ -118,7 +118,7 @@ function printToFiles(program, appOptions, parsedLogics) {
|
|
|
118
118
|
const logicsNeedingImports = parsedLogics.filter(parsedLogicNeedsTypeImport);
|
|
119
119
|
if (logicsNeedingImports.length > 0) {
|
|
120
120
|
if (appOptions.write && !appOptions.noImport) {
|
|
121
|
-
write_1.writeTypeImports(appOptions, program, fileName, logicsNeedingImports, parsedLogics);
|
|
121
|
+
(0, write_1.writeTypeImports)(appOptions, program, fileName, logicsNeedingImports, parsedLogics);
|
|
122
122
|
filesToModify += logicsNeedingImports.length;
|
|
123
123
|
}
|
|
124
124
|
else {
|
|
@@ -129,7 +129,7 @@ function printToFiles(program, appOptions, parsedLogics) {
|
|
|
129
129
|
const logicsNeedingPaths = parsedLogics.filter(parsedLogicNeedsPath);
|
|
130
130
|
if (logicsNeedingPaths.length > 0) {
|
|
131
131
|
if (appOptions.write && !appOptions.noImport) {
|
|
132
|
-
write_1.writePaths(appOptions, program, fileName, logicsNeedingPaths);
|
|
132
|
+
(0, write_1.writePaths)(appOptions, program, fileName, logicsNeedingPaths);
|
|
133
133
|
filesToModify += logicsNeedingPaths.length;
|
|
134
134
|
}
|
|
135
135
|
else {
|
|
@@ -150,9 +150,9 @@ function printToFiles(program, appOptions, parsedLogics) {
|
|
|
150
150
|
}
|
|
151
151
|
exports.printToFiles = printToFiles;
|
|
152
152
|
function nodeToString(node) {
|
|
153
|
-
const printer =
|
|
154
|
-
const sourceFile =
|
|
155
|
-
return printer.printNode(
|
|
153
|
+
const printer = (0, typescript_1.createPrinter)({ newLine: typescript_1.NewLineKind.LineFeed });
|
|
154
|
+
const sourceFile = (0, typescript_1.createSourceFile)('logic.ts', '', typescript_1.ScriptTarget.Latest, false, typescript_1.ScriptKind.TS);
|
|
155
|
+
return printer.printNode(typescript_1.EmitHint.Unspecified, node, sourceFile);
|
|
156
156
|
}
|
|
157
157
|
exports.nodeToString = nodeToString;
|
|
158
158
|
function parsedLogicToTypeString(parsedLogic, appOptions) {
|
|
@@ -163,48 +163,48 @@ exports.parsedLogicToTypeString = parsedLogicToTypeString;
|
|
|
163
163
|
function getLogicTypeArguments(parsedLogic) {
|
|
164
164
|
return [...parsedLogic.typeReferencesInLogicInput]
|
|
165
165
|
.sort()
|
|
166
|
-
.map((text) =>
|
|
166
|
+
.map((text) => typescript_1.factory.createTypeParameterDeclaration(typescript_1.factory.createIdentifier(text), undefined));
|
|
167
167
|
}
|
|
168
168
|
exports.getLogicTypeArguments = getLogicTypeArguments;
|
|
169
169
|
function printLogicType(parsedLogic, appOptions) {
|
|
170
|
-
const printProperty = (name, typeNode) =>
|
|
170
|
+
const printProperty = (name, typeNode) => typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier(name), undefined, typeNode);
|
|
171
171
|
const addSelectorTypeHelp = parsedLogic.selectors.filter((s) => s.functionTypes.length > 0).length > 0;
|
|
172
172
|
const logicProperties = [
|
|
173
|
-
printProperty('actionCreators', printActionCreators_1.printActionCreators(parsedLogic, appOptions)),
|
|
174
|
-
printProperty('actionKeys', printActionKeys_1.printActionKeys(parsedLogic, appOptions)),
|
|
175
|
-
printProperty('actionTypes', printActionTypes_1.printActionTypes(parsedLogic, appOptions)),
|
|
176
|
-
printProperty('actions', printActions_1.printActions(parsedLogic, appOptions)),
|
|
177
|
-
printProperty('constants', printConstants_1.printConstants(parsedLogic)),
|
|
178
|
-
printProperty('defaults', printDefaults_1.printDefaults(parsedLogic)),
|
|
179
|
-
printProperty('events', printEvents_1.printEvents(parsedLogic)),
|
|
180
|
-
printProperty('key', printKey_1.printKey(parsedLogic)),
|
|
181
|
-
printProperty('listeners', printListeners_1.printListeners(parsedLogic)),
|
|
182
|
-
printProperty('path',
|
|
183
|
-
printProperty('pathString',
|
|
184
|
-
printProperty('props', printProps_1.printProps(parsedLogic)),
|
|
185
|
-
printProperty('reducer', printReducer_1.printReducer(parsedLogic)),
|
|
186
|
-
printProperty('reducerOptions', printReducerOptions_1.printReducerOptions(parsedLogic)),
|
|
187
|
-
printProperty('reducers', printReducers_1.printReducers(parsedLogic)),
|
|
188
|
-
printProperty('selector', printSelector_1.printSelector(parsedLogic)),
|
|
189
|
-
printProperty('selectors', printSelectors_1.printSelectors(parsedLogic)),
|
|
190
|
-
printProperty('sharedListeners', printSharedListeners_1.printSharedListeners(parsedLogic)),
|
|
191
|
-
printProperty('values', printValues_1.printValues(parsedLogic)),
|
|
192
|
-
printProperty('_isKea',
|
|
193
|
-
printProperty('_isKeaWithKey', parsedLogic.keyType ?
|
|
173
|
+
printProperty('actionCreators', (0, printActionCreators_1.printActionCreators)(parsedLogic, appOptions)),
|
|
174
|
+
printProperty('actionKeys', (0, printActionKeys_1.printActionKeys)(parsedLogic, appOptions)),
|
|
175
|
+
printProperty('actionTypes', (0, printActionTypes_1.printActionTypes)(parsedLogic, appOptions)),
|
|
176
|
+
printProperty('actions', (0, printActions_1.printActions)(parsedLogic, appOptions)),
|
|
177
|
+
printProperty('constants', (0, printConstants_1.printConstants)(parsedLogic)),
|
|
178
|
+
printProperty('defaults', (0, printDefaults_1.printDefaults)(parsedLogic)),
|
|
179
|
+
printProperty('events', (0, printEvents_1.printEvents)(parsedLogic)),
|
|
180
|
+
printProperty('key', (0, printKey_1.printKey)(parsedLogic)),
|
|
181
|
+
printProperty('listeners', (0, printListeners_1.printListeners)(parsedLogic)),
|
|
182
|
+
printProperty('path', typescript_1.factory.createTupleTypeNode(parsedLogic.path.map((p) => typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral(p))))),
|
|
183
|
+
printProperty('pathString', typescript_1.factory.createStringLiteral(parsedLogic.pathString)),
|
|
184
|
+
printProperty('props', (0, printProps_1.printProps)(parsedLogic)),
|
|
185
|
+
printProperty('reducer', (0, printReducer_1.printReducer)(parsedLogic)),
|
|
186
|
+
printProperty('reducerOptions', (0, printReducerOptions_1.printReducerOptions)(parsedLogic)),
|
|
187
|
+
printProperty('reducers', (0, printReducers_1.printReducers)(parsedLogic)),
|
|
188
|
+
printProperty('selector', (0, printSelector_1.printSelector)(parsedLogic)),
|
|
189
|
+
printProperty('selectors', (0, printSelectors_1.printSelectors)(parsedLogic)),
|
|
190
|
+
printProperty('sharedListeners', (0, printSharedListeners_1.printSharedListeners)(parsedLogic)),
|
|
191
|
+
printProperty('values', (0, printValues_1.printValues)(parsedLogic)),
|
|
192
|
+
printProperty('_isKea', typescript_1.factory.createTrue()),
|
|
193
|
+
printProperty('_isKeaWithKey', parsedLogic.keyType ? typescript_1.factory.createTrue() : typescript_1.factory.createFalse()),
|
|
194
194
|
addSelectorTypeHelp
|
|
195
|
-
? printProperty('__keaTypeGenInternalSelectorTypes', printInternalSelectorTypes_1.printInternalSelectorTypes(parsedLogic))
|
|
195
|
+
? printProperty('__keaTypeGenInternalSelectorTypes', (0, printInternalSelectorTypes_1.printInternalSelectorTypes)(parsedLogic))
|
|
196
196
|
: null,
|
|
197
197
|
Object.keys(parsedLogic.extraActions).length > 0
|
|
198
|
-
? printProperty('__keaTypeGenInternalReducerActions', printInternalReducerActions_1.printInternalReducerActions(parsedLogic))
|
|
198
|
+
? printProperty('__keaTypeGenInternalReducerActions', (0, printInternalReducerActions_1.printInternalReducerActions)(parsedLogic))
|
|
199
199
|
: null,
|
|
200
200
|
Object.keys(parsedLogic.extraInput).length > 0
|
|
201
|
-
? printProperty('__keaTypeGenInternalExtraInput', printInternalExtraInput_1.printInternalExtraInput(parsedLogic))
|
|
201
|
+
? printProperty('__keaTypeGenInternalExtraInput', (0, printInternalExtraInput_1.printInternalExtraInput)(parsedLogic))
|
|
202
202
|
: null,
|
|
203
203
|
].filter((a) => !!a);
|
|
204
204
|
const logicTypeArguments = getLogicTypeArguments(parsedLogic);
|
|
205
|
-
parsedLogic.interfaceDeclaration =
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
parsedLogic.interfaceDeclaration = typescript_1.factory.createInterfaceDeclaration(undefined, [typescript_1.factory.createModifier(typescript_1.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(`${parsedLogic.logicName}Type`), logicTypeArguments, [
|
|
206
|
+
typescript_1.factory.createHeritageClause(typescript_1.SyntaxKind.ExtendsKeyword, [
|
|
207
|
+
typescript_1.factory.createExpressionWithTypeArguments(typescript_1.factory.createIdentifier('Logic'), undefined),
|
|
208
208
|
]),
|
|
209
209
|
], logicProperties);
|
|
210
210
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../../src/print/print.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../../src/print/print.ts"],"names":[],"mappings":";;;AA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;KACb,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEpB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAA;IAE7D,WAAW,CAAC,oBAAoB,GAAG,oBAAO,CAAC,0BAA0B,CACjE,SAAS,EACT,CAAC,oBAAO,CAAC,cAAc,CAAC,uBAAU,CAAC,aAAa,CAAC,CAAC,EAClD,oBAAO,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAC,SAAS,MAAM,CAAC,EACxD,kBAAkB,EAClB;QACI,oBAAO,CAAC,oBAAoB,CAAC,uBAAU,CAAC,cAAc,EAAE;YACpD,oBAAO,CAAC,iCAAiC,CAAC,oBAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;SAC1F,CAAC;KACL,EACD,eAAe,CAClB,CAAA;AACL,CAAC;AA1DD,wCA0DC;AAGD,IAAI,CAAC,GAAG,CAAC,CAAA;AACT,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
1
|
import { AppOptions, ParsedLogic } from '../types';
|
|
3
|
-
export declare function printActionCreators(parsedLogic: ParsedLogic, appOptions?: AppOptions):
|
|
2
|
+
export declare function printActionCreators(parsedLogic: ParsedLogic, appOptions?: AppOptions): import("typescript").TypeLiteralNode;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printActionCreators = void 0;
|
|
4
|
-
const
|
|
4
|
+
const typescript_1 = require("typescript");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
function printActionCreators(parsedLogic, appOptions) {
|
|
7
|
-
const getActionType = utils_1.getActionTypeCreator(parsedLogic);
|
|
8
|
-
return
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
])))
|
|
7
|
+
const getActionType = (0, utils_1.getActionTypeCreator)(parsedLogic);
|
|
8
|
+
return typescript_1.factory.createTypeLiteralNode(parsedLogic.actions.map(({ name, parameters, returnTypeNode }) => {
|
|
9
|
+
return typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier(name), undefined, typescript_1.factory.createFunctionTypeNode(undefined, parameters, typescript_1.factory.createParenthesizedType(typescript_1.factory.createTypeLiteralNode([
|
|
10
|
+
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('type'), undefined, typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral(getActionType(name)))),
|
|
11
|
+
typescript_1.factory.createPropertySignature(undefined, typescript_1.factory.createIdentifier('payload'), undefined, returnTypeNode),
|
|
12
|
+
]))));
|
|
13
13
|
}));
|
|
14
14
|
}
|
|
15
15
|
exports.printActionCreators = printActionCreators;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printActionCreators.js","sourceRoot":"","sources":["../../../src/print/printActionCreators.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"printActionCreators.js","sourceRoot":"","sources":["../../../src/print/printActionCreators.ts"],"names":[],"mappings":";;;AAAA,2CAAoC;AAEpC,oCAA+C;AAE/C,SAAgB,mBAAmB,CAAC,WAAwB,EAAE,UAAuB;IACjF,MAAM,aAAa,GAAG,IAAA,4BAAoB,EAAC,WAAW,CAAC,CAAA;IAEvD,OAAO,oBAAO,CAAC,qBAAqB,CAChC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,EAAE;QAC7D,OAAO,oBAAO,CAAC,uBAAuB,CAClC,SAAS,EACT,oBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAC9B,SAAS,EACT,oBAAO,CAAC,sBAAsB,CAC1B,SAAS,EACT,UAAU,EACV,oBAAO,CAAC,uBAAuB,CAC3B,oBAAO,CAAC,qBAAqB,CAAC;YAC1B,oBAAO,CAAC,uBAAuB,CAC3B,SAAS,EACT,oBAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAChC,SAAS,EACT,oBAAO,CAAC,qBAAqB,CAAC,oBAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAClF;YACD,oBAAO,CAAC,uBAAuB,CAC3B,SAAS,EACT,oBAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,EACnC,SAAS,EACT,cAAc,CACjB;SACJ,CAAC,CACL,CACJ,CACJ,CAAA;IACL,CAAC,CAAC,CACL,CAAA;AACL,CAAC;AAhCD,kDAgCC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
1
|
import { AppOptions, ParsedLogic } from '../types';
|
|
3
|
-
export declare function printActionKeys(parsedLogic: ParsedLogic, appOptions?: AppOptions):
|
|
2
|
+
export declare function printActionKeys(parsedLogic: ParsedLogic, appOptions?: AppOptions): import("typescript").TypeLiteralNode;
|