@auto-engineer/narrative 0.11.11 → 0.11.12
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +11 -0
- package/dist/src/getFlows.cache.specs.js +18 -18
- package/dist/src/getFlows.cache.specs.js.map +1 -1
- package/dist/src/getNarratives.specs.d.ts +2 -0
- package/dist/src/getNarratives.specs.d.ts.map +1 -0
- package/dist/src/{getFlows.specs.js → getNarratives.specs.js} +22 -22
- package/dist/src/getNarratives.specs.js.map +1 -0
- package/dist/src/id/addAutoIds.specs.js +6 -6
- package/dist/src/id/addAutoIds.specs.js.map +1 -1
- package/dist/src/id/hasAllIds.specs.js +16 -16
- package/dist/src/id/hasAllIds.specs.js.map +1 -1
- package/dist/src/model-to-flow.specs.js +3 -3
- package/dist/src/model-to-flow.specs.js.map +1 -1
- package/dist/src/samples/items.narrative.d.ts +2 -0
- package/dist/src/samples/items.narrative.d.ts.map +1 -0
- package/dist/src/samples/{items.flow.js → items.narrative.js} +1 -1
- package/dist/src/samples/items.narrative.js.map +1 -0
- package/dist/src/samples/mixed-given-types.narrative.d.ts +2 -0
- package/dist/src/samples/mixed-given-types.narrative.d.ts.map +1 -0
- package/dist/src/samples/{mixed-given-types.flow.js → mixed-given-types.narrative.js} +1 -1
- package/dist/src/samples/mixed-given-types.narrative.js.map +1 -0
- package/dist/src/samples/{place-order.flow.d.ts → place-order.narrative.d.ts} +2 -2
- package/dist/src/samples/place-order.narrative.d.ts.map +1 -0
- package/dist/src/samples/{place-order.flow.js → place-order.narrative.js} +1 -1
- package/dist/src/samples/place-order.narrative.js.map +1 -0
- package/dist/src/samples/questionnaires.narrative.d.ts +2 -0
- package/dist/src/samples/questionnaires.narrative.d.ts.map +1 -0
- package/dist/src/samples/{questionnaires.flow.js → questionnaires.narrative.js} +1 -1
- package/dist/src/samples/questionnaires.narrative.js.map +1 -0
- package/dist/src/samples/seasonal-assistant.schema.json +1 -1
- package/dist/src/samples/test-with-ids.narrative.d.ts +2 -0
- package/dist/src/samples/test-with-ids.narrative.d.ts.map +1 -0
- package/dist/src/samples/{test-with-ids.flow.js → test-with-ids.narrative.js} +1 -1
- package/dist/src/samples/test-with-ids.narrative.js.map +1 -0
- package/dist/src/schema.d.ts +2991 -2991
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/getFlows.cache.specs.ts +18 -18
- package/src/{getFlows.specs.ts → getNarratives.specs.ts} +23 -21
- package/src/id/addAutoIds.specs.ts +6 -6
- package/src/id/hasAllIds.specs.ts +16 -16
- package/src/model-to-flow.specs.ts +3 -3
- package/src/samples/{place-order.flow.ts → place-order.narrative.ts} +2 -2
- package/src/samples/seasonal-assistant.schema.json +1 -1
- package/.turbo/turbo-format.log +0 -4
- package/.turbo/turbo-lint.log +0 -4
- package/.turbo/turbo-test.log +0 -14
- package/.turbo/turbo-type-check.log +0 -4
- package/dist/src/data-flow-builders.d.ts +0 -71
- package/dist/src/data-flow-builders.d.ts.map +0 -1
- package/dist/src/data-flow-builders.js +0 -326
- package/dist/src/data-flow-builders.js.map +0 -1
- package/dist/src/flow-context.d.ts +0 -25
- package/dist/src/flow-context.d.ts.map +0 -1
- package/dist/src/flow-context.js +0 -579
- package/dist/src/flow-context.js.map +0 -1
- package/dist/src/flow-context.specs.d.ts +0 -2
- package/dist/src/flow-context.specs.d.ts.map +0 -1
- package/dist/src/flow-context.specs.js +0 -185
- package/dist/src/flow-context.specs.js.map +0 -1
- package/dist/src/flow-registry.d.ts +0 -12
- package/dist/src/flow-registry.d.ts.map +0 -1
- package/dist/src/flow-registry.js +0 -46
- package/dist/src/flow-registry.js.map +0 -1
- package/dist/src/flow.d.ts +0 -49
- package/dist/src/flow.d.ts.map +0 -1
- package/dist/src/flow.js +0 -146
- package/dist/src/flow.js.map +0 -1
- package/dist/src/getFlows.d.ts +0 -21
- package/dist/src/getFlows.d.ts.map +0 -1
- package/dist/src/getFlows.js +0 -119
- package/dist/src/getFlows.js.map +0 -1
- package/dist/src/getFlows.specs.d.ts +0 -2
- package/dist/src/getFlows.specs.d.ts.map +0 -1
- package/dist/src/getFlows.specs.js.map +0 -1
- package/dist/src/samples/items.flow.d.ts +0 -2
- package/dist/src/samples/items.flow.d.ts.map +0 -1
- package/dist/src/samples/items.flow.js.map +0 -1
- package/dist/src/samples/mixed-given-types.flow.d.ts +0 -2
- package/dist/src/samples/mixed-given-types.flow.d.ts.map +0 -1
- package/dist/src/samples/mixed-given-types.flow.js.map +0 -1
- package/dist/src/samples/place-order.flow.d.ts.map +0 -1
- package/dist/src/samples/place-order.flow.js.map +0 -1
- package/dist/src/samples/questionnaires.flow.d.ts +0 -2
- package/dist/src/samples/questionnaires.flow.d.ts.map +0 -1
- package/dist/src/samples/questionnaires.flow.js.map +0 -1
- package/dist/src/samples/test-with-ids.flow.d.ts +0 -2
- package/dist/src/samples/test-with-ids.flow.d.ts.map +0 -1
- package/dist/src/samples/test-with-ids.flow.js.map +0 -1
- package/dist/src/transformers/flow-to-model/assemble.d.ts +0 -3
- package/dist/src/transformers/flow-to-model/assemble.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/assemble.js +0 -9
- package/dist/src/transformers/flow-to-model/assemble.js.map +0 -1
- package/dist/src/transformers/flow-to-model/debug.d.ts +0 -3
- package/dist/src/transformers/flow-to-model/debug.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/debug.js +0 -6
- package/dist/src/transformers/flow-to-model/debug.js.map +0 -1
- package/dist/src/transformers/flow-to-model/example-shapes.d.ts +0 -6
- package/dist/src/transformers/flow-to-model/example-shapes.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/example-shapes.js +0 -60
- package/dist/src/transformers/flow-to-model/example-shapes.js.map +0 -1
- package/dist/src/transformers/flow-to-model/guards.d.ts +0 -15
- package/dist/src/transformers/flow-to-model/guards.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/guards.js +0 -18
- package/dist/src/transformers/flow-to-model/guards.js.map +0 -1
- package/dist/src/transformers/flow-to-model/index.d.ts +0 -4
- package/dist/src/transformers/flow-to-model/index.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/index.js +0 -193
- package/dist/src/transformers/flow-to-model/index.js.map +0 -1
- package/dist/src/transformers/flow-to-model/inlining.d.ts +0 -4
- package/dist/src/transformers/flow-to-model/inlining.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/inlining.js +0 -95
- package/dist/src/transformers/flow-to-model/inlining.js.map +0 -1
- package/dist/src/transformers/flow-to-model/integrations.d.ts +0 -36
- package/dist/src/transformers/flow-to-model/integrations.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/integrations.js +0 -147
- package/dist/src/transformers/flow-to-model/integrations.js.map +0 -1
- package/dist/src/transformers/flow-to-model/messages.d.ts +0 -5
- package/dist/src/transformers/flow-to-model/messages.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/messages.js +0 -88
- package/dist/src/transformers/flow-to-model/messages.js.map +0 -1
- package/dist/src/transformers/flow-to-model/normalize.d.ts +0 -3
- package/dist/src/transformers/flow-to-model/normalize.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/normalize.js +0 -23
- package/dist/src/transformers/flow-to-model/normalize.js.map +0 -1
- package/dist/src/transformers/flow-to-model/spec-processors.d.ts +0 -34
- package/dist/src/transformers/flow-to-model/spec-processors.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/spec-processors.js +0 -395
- package/dist/src/transformers/flow-to-model/spec-processors.js.map +0 -1
- package/dist/src/transformers/flow-to-model/strings.d.ts +0 -2
- package/dist/src/transformers/flow-to-model/strings.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/strings.js +0 -11
- package/dist/src/transformers/flow-to-model/strings.js.map +0 -1
- package/dist/src/transformers/flow-to-model/type-inference.d.ts +0 -3
- package/dist/src/transformers/flow-to-model/type-inference.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/type-inference.js +0 -92
- package/dist/src/transformers/flow-to-model/type-inference.js.map +0 -1
- package/dist/src/transformers/flow-to-model/type-inference.specs.d.ts +0 -2
- package/dist/src/transformers/flow-to-model/type-inference.specs.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/type-inference.specs.js +0 -167
- package/dist/src/transformers/flow-to-model/type-inference.specs.js.map +0 -1
- package/dist/src/transformers/flow-to-model/zod-adapter.d.ts +0 -6
- package/dist/src/transformers/flow-to-model/zod-adapter.d.ts.map +0 -1
- package/dist/src/transformers/flow-to-model/zod-adapter.js +0 -101
- package/dist/src/transformers/flow-to-model/zod-adapter.js.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/extract-flow.d.ts +0 -2
- package/dist/src/transformers/model-to-flow/analysis/extract-flow.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/extract-flow.js +0 -22
- package/dist/src/transformers/model-to-flow/analysis/extract-flow.js.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/lint-helpers.d.ts +0 -18
- package/dist/src/transformers/model-to-flow/analysis/lint-helpers.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/lint-helpers.js +0 -78
- package/dist/src/transformers/model-to-flow/analysis/lint-helpers.js.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/type-decls.d.ts +0 -7
- package/dist/src/transformers/model-to-flow/analysis/type-decls.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/type-decls.js +0 -74
- package/dist/src/transformers/model-to-flow/analysis/type-decls.js.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/usage.d.ts +0 -9
- package/dist/src/transformers/model-to-flow/analysis/usage.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/analysis/usage.js +0 -90
- package/dist/src/transformers/model-to-flow/analysis/usage.js.map +0 -1
- package/dist/src/transformers/model-to-flow/ast/emit-helpers.d.ts +0 -18
- package/dist/src/transformers/model-to-flow/ast/emit-helpers.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/ast/emit-helpers.js +0 -159
- package/dist/src/transformers/model-to-flow/ast/emit-helpers.js.map +0 -1
- package/dist/src/transformers/model-to-flow/formatting/prettier.d.ts +0 -2
- package/dist/src/transformers/model-to-flow/formatting/prettier.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/formatting/prettier.js +0 -26
- package/dist/src/transformers/model-to-flow/formatting/prettier.js.map +0 -1
- package/dist/src/transformers/model-to-flow/formatting/sort-types.d.ts +0 -6
- package/dist/src/transformers/model-to-flow/formatting/sort-types.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/formatting/sort-types.js +0 -17
- package/dist/src/transformers/model-to-flow/formatting/sort-types.js.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/compose.d.ts +0 -6
- package/dist/src/transformers/model-to-flow/generators/compose.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/compose.js +0 -79
- package/dist/src/transformers/model-to-flow/generators/compose.js.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/flow.d.ts +0 -15
- package/dist/src/transformers/model-to-flow/generators/flow.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/flow.js +0 -316
- package/dist/src/transformers/model-to-flow/generators/flow.js.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/gwt.d.ts +0 -57
- package/dist/src/transformers/model-to-flow/generators/gwt.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/gwt.js +0 -186
- package/dist/src/transformers/model-to-flow/generators/gwt.js.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/imports.d.ts +0 -16
- package/dist/src/transformers/model-to-flow/generators/imports.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/imports.js +0 -57
- package/dist/src/transformers/model-to-flow/generators/imports.js.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/types.d.ts +0 -13
- package/dist/src/transformers/model-to-flow/generators/types.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/generators/types.js +0 -22
- package/dist/src/transformers/model-to-flow/generators/types.js.map +0 -1
- package/dist/src/transformers/model-to-flow/index.d.ts +0 -13
- package/dist/src/transformers/model-to-flow/index.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/index.js +0 -25
- package/dist/src/transformers/model-to-flow/index.js.map +0 -1
- package/dist/src/transformers/model-to-flow/utils/integration-extractor.d.ts +0 -12
- package/dist/src/transformers/model-to-flow/utils/integration-extractor.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/utils/integration-extractor.js +0 -64
- package/dist/src/transformers/model-to-flow/utils/integration-extractor.js.map +0 -1
- package/dist/src/transformers/model-to-flow/utils/strings.d.ts +0 -9
- package/dist/src/transformers/model-to-flow/utils/strings.d.ts.map +0 -1
- package/dist/src/transformers/model-to-flow/utils/strings.js +0 -11
- package/dist/src/transformers/model-to-flow/utils/strings.js.map +0 -1
- /package/src/samples/{items.flow.ts → items.narrative.ts} +0 -0
- /package/src/samples/{mixed-given-types.flow.ts → mixed-given-types.narrative.ts} +0 -0
- /package/src/samples/{questionnaires.flow.ts → questionnaires.narrative.ts} +0 -0
- /package/src/samples/{test-with-ids.flow.ts → test-with-ids.narrative.ts} +0 -0
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { flowsToModel } from './index.js';
|
|
3
|
-
describe('Type inference in flow-to-model transformer', () => {
|
|
4
|
-
it('should correctly extract command types from when clauses', () => {
|
|
5
|
-
const flows = [
|
|
6
|
-
{
|
|
7
|
-
name: 'Test Flow',
|
|
8
|
-
id: 'FLOW-001',
|
|
9
|
-
slices: [
|
|
10
|
-
{
|
|
11
|
-
id: 'SLICE-001',
|
|
12
|
-
type: 'command',
|
|
13
|
-
name: 'Submit Answer Command',
|
|
14
|
-
client: { description: 'Submit answer client' },
|
|
15
|
-
server: {
|
|
16
|
-
description: 'Submit answer server',
|
|
17
|
-
specs: {
|
|
18
|
-
name: 'Submit Answer Specs',
|
|
19
|
-
rules: [
|
|
20
|
-
{
|
|
21
|
-
id: 'RULE-001',
|
|
22
|
-
description: 'Should accept answer submission',
|
|
23
|
-
examples: [
|
|
24
|
-
{
|
|
25
|
-
description: 'Valid answer submission',
|
|
26
|
-
when: [
|
|
27
|
-
{
|
|
28
|
-
commandRef: 'AnswerQuestion',
|
|
29
|
-
exampleData: {
|
|
30
|
-
questionnaireId: 'q-001',
|
|
31
|
-
participantId: 'participant-abc',
|
|
32
|
-
questionId: 'q1',
|
|
33
|
-
answer: 'Yes',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
then: [
|
|
38
|
-
{
|
|
39
|
-
eventRef: 'QuestionAnswered',
|
|
40
|
-
exampleData: {
|
|
41
|
-
questionnaireId: 'q-001',
|
|
42
|
-
participantId: 'participant-abc',
|
|
43
|
-
questionId: 'q1',
|
|
44
|
-
answer: 'Yes',
|
|
45
|
-
savedAt: new Date(),
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: 'SLICE-002',
|
|
58
|
-
type: 'command',
|
|
59
|
-
name: 'Submit Questionnaire Command',
|
|
60
|
-
client: { description: 'Submit questionnaire client' },
|
|
61
|
-
server: {
|
|
62
|
-
description: 'Submit questionnaire server',
|
|
63
|
-
specs: {
|
|
64
|
-
name: 'Submit Questionnaire Specs',
|
|
65
|
-
rules: [
|
|
66
|
-
{
|
|
67
|
-
id: 'RULE-002',
|
|
68
|
-
description: 'Should submit questionnaire',
|
|
69
|
-
examples: [
|
|
70
|
-
{
|
|
71
|
-
description: 'Valid questionnaire submission',
|
|
72
|
-
when: [
|
|
73
|
-
{
|
|
74
|
-
commandRef: 'SubmitQuestionnaire',
|
|
75
|
-
exampleData: {
|
|
76
|
-
questionnaireId: 'q-001',
|
|
77
|
-
participantId: 'participant-abc',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
then: [
|
|
82
|
-
{
|
|
83
|
-
eventRef: 'QuestionnaireSubmitted',
|
|
84
|
-
exampleData: {
|
|
85
|
-
questionnaireId: 'q-001',
|
|
86
|
-
participantId: 'participant-abc',
|
|
87
|
-
submittedAt: new Date(),
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
const model = flowsToModel(flows);
|
|
102
|
-
// Should have the correct command messages extracted
|
|
103
|
-
expect(model.messages.some((msg) => msg.name === 'AnswerQuestion')).toBe(true);
|
|
104
|
-
expect(model.messages.some((msg) => msg.name === 'SubmitQuestionnaire')).toBe(true);
|
|
105
|
-
expect(model.messages.some((msg) => msg.name === 'QuestionAnswered')).toBe(true);
|
|
106
|
-
expect(model.messages.some((msg) => msg.name === 'QuestionnaireSubmitted')).toBe(true);
|
|
107
|
-
// Should NOT have InferredType fallback
|
|
108
|
-
expect(model.messages.some((msg) => msg.name === 'InferredType')).toBe(false);
|
|
109
|
-
// Verify the command messages have the correct structure
|
|
110
|
-
const answerQuestionMsg = model.messages.find((msg) => msg.name === 'AnswerQuestion');
|
|
111
|
-
expect(answerQuestionMsg?.type).toBe('command');
|
|
112
|
-
expect(answerQuestionMsg?.fields).toBeDefined();
|
|
113
|
-
const submitQuestionnaireMsg = model.messages.find((msg) => msg.name === 'SubmitQuestionnaire');
|
|
114
|
-
expect(submitQuestionnaireMsg?.type).toBe('command');
|
|
115
|
-
expect(submitQuestionnaireMsg?.fields).toBeDefined();
|
|
116
|
-
});
|
|
117
|
-
it('should handle single object when/then clauses correctly', () => {
|
|
118
|
-
const flows = [
|
|
119
|
-
{
|
|
120
|
-
name: 'Single Object Flow',
|
|
121
|
-
id: 'FLOW-001',
|
|
122
|
-
slices: [
|
|
123
|
-
{
|
|
124
|
-
id: 'SLICE-001',
|
|
125
|
-
type: 'command',
|
|
126
|
-
name: 'Single Object Command',
|
|
127
|
-
client: { description: 'Single object client' },
|
|
128
|
-
server: {
|
|
129
|
-
description: 'Single object server',
|
|
130
|
-
specs: {
|
|
131
|
-
name: 'Single Object Specs',
|
|
132
|
-
rules: [
|
|
133
|
-
{
|
|
134
|
-
id: 'RULE-001',
|
|
135
|
-
description: 'Should handle single object',
|
|
136
|
-
examples: [
|
|
137
|
-
{
|
|
138
|
-
description: 'Single object example',
|
|
139
|
-
// Single object, not array - this is what broke
|
|
140
|
-
when: {
|
|
141
|
-
commandRef: 'TestCommand',
|
|
142
|
-
exampleData: { test: 'value' },
|
|
143
|
-
},
|
|
144
|
-
then: [
|
|
145
|
-
{
|
|
146
|
-
eventRef: 'TestEvent',
|
|
147
|
-
exampleData: { result: 'success' },
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
];
|
|
160
|
-
const model = flowsToModel(flows);
|
|
161
|
-
// Should extract the command and event types from single objects
|
|
162
|
-
expect(model.messages.some((msg) => msg.name === 'TestCommand')).toBe(true);
|
|
163
|
-
expect(model.messages.some((msg) => msg.name === 'TestEvent')).toBe(true);
|
|
164
|
-
expect(model.messages.some((msg) => msg.name === 'InferredType')).toBe(false);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
//# sourceMappingURL=type-inference.specs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-inference.specs.js","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/type-inference.specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,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AI,EAAE,qBAAqB;gCAC3B,KAAK,EAAE;oCACL;wCACE,EAAE,EAAE,UAAU;wCACd,WAAW,EAAE,6BAA6B;wCAC1C,QAAQ,EAAE;4CACR;gDACE,WAAW,EAAE,uBAAuB;gDACpC,gDAAgD;gDAChD,IAAI,EAAE;oDACJ,UAAU,EAAE,aAAa;oDACzB,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;iDAC/B;gDACD,IAAI,EAAE;oDACJ;wDACE,QAAQ,EAAE,WAAW;wDACrB,WAAW,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;qDACnC;iDACF;6CACF;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAC;QAEF,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAElC,iEAAiE;QACjE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5E,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1E,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Message } from '../../index';
|
|
3
|
-
export declare const unwrapZod: (schema: z.ZodTypeAny) => z.ZodTypeAny;
|
|
4
|
-
export declare const extractZodType: (schema: z.ZodTypeAny) => string;
|
|
5
|
-
export declare const zodSchemaToFields: (schema: z.ZodTypeAny) => Message["fields"];
|
|
6
|
-
//# sourceMappingURL=zod-adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod-adapter.d.ts","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/zod-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAMtC,eAAO,MAAM,SAAS,GAAI,QAAQ,CAAC,CAAC,UAAU,KAAG,CAAC,CAAC,UA0BlD,CAAC;AA2BF,eAAO,MAAM,cAAc,GAAI,QAAQ,CAAC,CAAC,UAAU,KAAG,MA0BrD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,CAAC,CAAC,UAAU,KAAG,OAAO,CAAC,QAAQ,CAqBxE,CAAC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
function hasZodDef(obj) {
|
|
2
|
-
return typeof obj === 'object' && obj !== null && '_def' in obj;
|
|
3
|
-
}
|
|
4
|
-
export const unwrapZod = (schema) => {
|
|
5
|
-
let s = schema;
|
|
6
|
-
// Unwrap common wrappers: Optional, Nullable, Default, Effects
|
|
7
|
-
// Keep unwrapping until we hit a non-wrapper
|
|
8
|
-
while (hasZodDef(s)) {
|
|
9
|
-
const def = s._def;
|
|
10
|
-
const typeName = def.typeName;
|
|
11
|
-
if (typeName === 'ZodOptional' ||
|
|
12
|
-
typeName === 'ZodNullable' ||
|
|
13
|
-
typeName === 'ZodDefault' ||
|
|
14
|
-
typeName === 'ZodEffects') {
|
|
15
|
-
if (def.innerType !== undefined) {
|
|
16
|
-
s = def.innerType;
|
|
17
|
-
}
|
|
18
|
-
else if (def.schema !== undefined) {
|
|
19
|
-
s = def.schema;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return s;
|
|
30
|
-
};
|
|
31
|
-
function handleZodLiteral(base) {
|
|
32
|
-
if (!hasZodDef(base))
|
|
33
|
-
return 'unknown';
|
|
34
|
-
const def = base._def;
|
|
35
|
-
const val = def.value;
|
|
36
|
-
return typeof val === 'string' ? JSON.stringify(val) : JSON.stringify(val);
|
|
37
|
-
}
|
|
38
|
-
function handleZodArray(base) {
|
|
39
|
-
const elementType = extractZodType(base._def.type);
|
|
40
|
-
return `Array<${elementType}>`;
|
|
41
|
-
}
|
|
42
|
-
function handleZodObject(base) {
|
|
43
|
-
const shape = base._def.shape();
|
|
44
|
-
const entries = Object.entries(shape)
|
|
45
|
-
.map(([key, val]) => `${key}: ${extractZodType(val)}`)
|
|
46
|
-
.join(', ');
|
|
47
|
-
return `{${entries}}`;
|
|
48
|
-
}
|
|
49
|
-
function handleZodNullable(base) {
|
|
50
|
-
const inner = extractZodType(base._def.innerType);
|
|
51
|
-
return `${inner} | null`;
|
|
52
|
-
}
|
|
53
|
-
export const extractZodType = (schema) => {
|
|
54
|
-
const base = unwrapZod(schema);
|
|
55
|
-
if (!hasZodDef(base))
|
|
56
|
-
return 'unknown';
|
|
57
|
-
const def = base._def;
|
|
58
|
-
const typeName = def.typeName;
|
|
59
|
-
switch (typeName) {
|
|
60
|
-
case 'ZodString':
|
|
61
|
-
return 'string';
|
|
62
|
-
case 'ZodNumber':
|
|
63
|
-
return 'number';
|
|
64
|
-
case 'ZodBoolean':
|
|
65
|
-
return 'boolean';
|
|
66
|
-
case 'ZodDate':
|
|
67
|
-
return 'Date';
|
|
68
|
-
case 'ZodLiteral':
|
|
69
|
-
return handleZodLiteral(base);
|
|
70
|
-
case 'ZodArray':
|
|
71
|
-
return handleZodArray(base);
|
|
72
|
-
case 'ZodObject':
|
|
73
|
-
return handleZodObject(base);
|
|
74
|
-
case 'ZodNullable':
|
|
75
|
-
return handleZodNullable(base);
|
|
76
|
-
default:
|
|
77
|
-
return 'unknown';
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
export const zodSchemaToFields = (schema) => {
|
|
81
|
-
const base = unwrapZod(schema);
|
|
82
|
-
if (!hasZodDef(base))
|
|
83
|
-
return [];
|
|
84
|
-
const def = base._def;
|
|
85
|
-
if (def.typeName !== 'ZodObject')
|
|
86
|
-
return [];
|
|
87
|
-
const shape = base._def.shape();
|
|
88
|
-
return Object.entries(shape).map(([name, field]) => {
|
|
89
|
-
const unwrapped = unwrapZod(field);
|
|
90
|
-
// treat Optional/Nullable/Default as not required
|
|
91
|
-
const fieldWithDef = field;
|
|
92
|
-
const raw = hasZodDef(fieldWithDef) ? fieldWithDef._def.typeName : undefined;
|
|
93
|
-
const required = raw !== 'ZodOptional' && raw !== 'ZodNullable' && raw !== 'ZodDefault';
|
|
94
|
-
return {
|
|
95
|
-
name,
|
|
96
|
-
type: extractZodType(unwrapped),
|
|
97
|
-
required,
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
//# sourceMappingURL=zod-adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod-adapter.js","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/zod-adapter.ts"],"names":[],"mappings":"AAGA,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,MAAM,IAAI,GAAG,CAAC;AAClE,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAoB,EAAgB,EAAE;IAC9D,IAAI,CAAC,GAAG,MAA4C,CAAC;IACrD,+DAA+D;IAC/D,6CAA6C;IAC7C,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,CAAC,CAAC,IAA+B,CAAC;QAC9C,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,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AS,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,IAA+B,CAAC;IACjD,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,EAAE,CAAC;IAE5C,MAAM,KAAK,GAAI,IAAmC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IAEhE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QACjD,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QACnC,kDAAkD;QAClD,MAAM,YAAY,GAAG,KAAK,CAAC;QAC3B,MAAM,GAAG,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAE,YAAY,CAAC,IAAgC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1G,MAAM,QAAQ,GAAG,GAAG,KAAK,aAAa,IAAI,GAAG,KAAK,aAAa,IAAI,GAAG,KAAK,YAAY,CAAC;QAExF,OAAO;YACL,IAAI;YACJ,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC;YAC/B,QAAQ;SACT,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-flow.d.ts","sourceRoot":"","sources":["../../../../../src/transformers/model-to-flow/analysis/extract-flow.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuBpD"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { collectTypeDeclarations } from './type-decls.js';
|
|
2
|
-
export function extractFlowCode(code) {
|
|
3
|
-
const lines = code.split('\n');
|
|
4
|
-
const typeRanges = new Set();
|
|
5
|
-
// Collect all type declarations
|
|
6
|
-
const allTypes = collectTypeDeclarations(lines);
|
|
7
|
-
// Mark all lines in type declarations as excluded
|
|
8
|
-
for (const type of allTypes) {
|
|
9
|
-
for (let i = type.startIdx; i <= type.endIdx; i++) {
|
|
10
|
-
typeRanges.add(i);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
// Extract flow lines (everything that's not a type declaration)
|
|
14
|
-
const flowLines = [];
|
|
15
|
-
for (let i = 0; i < lines.length; i++) {
|
|
16
|
-
if (!typeRanges.has(i)) {
|
|
17
|
-
flowLines.push(lines[i]);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return flowLines.join('\n');
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=extract-flow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-flow.js","sourceRoot":"","sources":["../../../../../src/transformers/model-to-flow/analysis/extract-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,gCAAgC;IAChC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAEhD,kDAAkD;IAClD,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClD,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,gEAAgE;IAChE,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
|
-
export declare function isTypeReferenceMethod(methodName: string): boolean;
|
|
3
|
-
export declare function processTypeMatching(text: string, typeNames: string[], usedTypes: Set<string>): void;
|
|
4
|
-
export declare function checkCallExpressionContext(call: ts.CallExpression): string | null;
|
|
5
|
-
export declare function extractIntegrationNames(code: string): string[];
|
|
6
|
-
export declare function findCodeBoundaries(lines: string[]): {
|
|
7
|
-
lastImportIdx: number;
|
|
8
|
-
};
|
|
9
|
-
export declare function reconstructCode(lines: string[], filteredTypes: Array<{
|
|
10
|
-
name: string;
|
|
11
|
-
startIdx: number;
|
|
12
|
-
endIdx: number;
|
|
13
|
-
}>, allTypes: Array<{
|
|
14
|
-
name: string;
|
|
15
|
-
startIdx: number;
|
|
16
|
-
endIdx: number;
|
|
17
|
-
}>, lastImportIdx: number): string;
|
|
18
|
-
//# sourceMappingURL=lint-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lint-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/transformers/model-to-flow/analysis/lint-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAOnG;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,GAAG,MAAM,GAAG,IAAI,CAOjF;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAa9D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAY7E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,aAAa,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACxE,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACnE,aAAa,EAAE,MAAM,GACpB,MAAM,CAuCR"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
|
-
export function isTypeReferenceMethod(methodName) {
|
|
3
|
-
return ['event', 'state', 'command'].includes(methodName);
|
|
4
|
-
}
|
|
5
|
-
export function processTypeMatching(text, typeNames, usedTypes) {
|
|
6
|
-
for (const typeName of typeNames) {
|
|
7
|
-
if (text === typeName) {
|
|
8
|
-
usedTypes.add(typeName);
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export function checkCallExpressionContext(call) {
|
|
14
|
-
if (call.expression === null || call.expression === undefined || !ts.isPropertyAccessExpression(call.expression)) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const methodName = call.expression.name.text;
|
|
18
|
-
return isTypeReferenceMethod(methodName) ? methodName : null;
|
|
19
|
-
}
|
|
20
|
-
export function extractIntegrationNames(code) {
|
|
21
|
-
const integrationMatch = code.match(/import\s+{[^}]*}\s+from\s+['"][^'"]*integrations['"]/);
|
|
22
|
-
if (integrationMatch) {
|
|
23
|
-
const importMatch = integrationMatch[0].match(/{([^}]*)}/);
|
|
24
|
-
if (importMatch) {
|
|
25
|
-
return importMatch[1]
|
|
26
|
-
.split(',')
|
|
27
|
-
.map((name) => name.replace(/^type\s+/, '').trim())
|
|
28
|
-
.filter((name) => name.length > 0);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
export function findCodeBoundaries(lines) {
|
|
34
|
-
let lastImportIdx = -1;
|
|
35
|
-
for (let i = 0; i < lines.length; i++) {
|
|
36
|
-
if (lines[i].match(/^\s*import\s/)) {
|
|
37
|
-
lastImportIdx = i;
|
|
38
|
-
}
|
|
39
|
-
else if (lines[i].includes('flow(')) {
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return { lastImportIdx };
|
|
44
|
-
}
|
|
45
|
-
export function reconstructCode(lines, filteredTypes, allTypes, lastImportIdx) {
|
|
46
|
-
const result = [];
|
|
47
|
-
// Add imports section
|
|
48
|
-
for (let i = 0; i <= lastImportIdx; i++) {
|
|
49
|
-
result.push(lines[i]);
|
|
50
|
-
}
|
|
51
|
-
// Add blank line before types
|
|
52
|
-
result.push('');
|
|
53
|
-
// Add sorted types
|
|
54
|
-
filteredTypes.forEach((type, index) => {
|
|
55
|
-
for (let i = type.startIdx; i <= type.endIdx; i++) {
|
|
56
|
-
result.push(lines[i]);
|
|
57
|
-
}
|
|
58
|
-
if (index < filteredTypes.length - 1) {
|
|
59
|
-
result.push(''); // Blank line between types
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
// Add blank line after types
|
|
63
|
-
result.push('');
|
|
64
|
-
// Add everything after imports that isn't a type declaration
|
|
65
|
-
const typeRanges = new Set();
|
|
66
|
-
for (const type of allTypes) {
|
|
67
|
-
for (let i = type.startIdx; i <= type.endIdx; i++) {
|
|
68
|
-
typeRanges.add(i);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
for (let i = lastImportIdx + 1; i < lines.length; i++) {
|
|
72
|
-
if (!typeRanges.has(i)) {
|
|
73
|
-
result.push(lines[i]);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return result.join('\n');
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=lint-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lint-helpers.js","sourceRoot":"","sources":["../../../../../src/transformers/model-to-flow/analysis/lint-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,SAAmB,EAAE,SAAsB;IAC3F,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,IAAuB;IAChE,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACjH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7C,OAAO,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAA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B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-decls.d.ts","sourceRoot":"","sources":["../../../../../src/transformers/model-to-flow/analysis/type-decls.ts"],"names":[],"mappings":"AAkEA,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBlH;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGxD"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
function isStringStart(char) {
|
|
2
|
-
return char === '"' || char === "'" || char === '`';
|
|
3
|
-
}
|
|
4
|
-
function updateBracketCounts(char, counts) {
|
|
5
|
-
if (char === '{')
|
|
6
|
-
counts.braceCount++;
|
|
7
|
-
else if (char === '}')
|
|
8
|
-
counts.braceCount--;
|
|
9
|
-
else if (char === '<')
|
|
10
|
-
counts.angleCount++;
|
|
11
|
-
else if (char === '>')
|
|
12
|
-
counts.angleCount--;
|
|
13
|
-
}
|
|
14
|
-
function countBrackets(text) {
|
|
15
|
-
const counts = { braceCount: 0, angleCount: 0 };
|
|
16
|
-
let inString = false;
|
|
17
|
-
let stringChar = '';
|
|
18
|
-
for (const char of text) {
|
|
19
|
-
if (!inString && isStringStart(char)) {
|
|
20
|
-
inString = true;
|
|
21
|
-
stringChar = char;
|
|
22
|
-
}
|
|
23
|
-
else if (inString && char === stringChar) {
|
|
24
|
-
inString = false;
|
|
25
|
-
}
|
|
26
|
-
else if (!inString) {
|
|
27
|
-
updateBracketCounts(char, counts);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return { ...counts, inString, stringChar };
|
|
31
|
-
}
|
|
32
|
-
function findTypeDeclarationEnd(lines, startIdx, initialCounts) {
|
|
33
|
-
let endIdx = startIdx;
|
|
34
|
-
let { braceCount, angleCount } = initialCounts;
|
|
35
|
-
if (braceCount > 0 || angleCount > 0) {
|
|
36
|
-
for (let j = startIdx + 1; j < lines.length; j++) {
|
|
37
|
-
endIdx = j;
|
|
38
|
-
const nextLine = lines[j];
|
|
39
|
-
const counts = countBrackets(nextLine);
|
|
40
|
-
braceCount += counts.braceCount;
|
|
41
|
-
angleCount += counts.angleCount;
|
|
42
|
-
if (braceCount === 0 && angleCount === 0 && nextLine.trim().endsWith(';')) {
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
if (nextLine.match(/^type\s+\w+/)) {
|
|
46
|
-
endIdx = j - 1;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return endIdx;
|
|
52
|
-
}
|
|
53
|
-
export function collectTypeDeclarations(lines) {
|
|
54
|
-
const allTypes = [];
|
|
55
|
-
for (let i = 0; i < lines.length; i++) {
|
|
56
|
-
const line = lines[i];
|
|
57
|
-
if (line.match(/^type\s+\w+/)) {
|
|
58
|
-
const typeName = extractTypeName(line);
|
|
59
|
-
const startIdx = i;
|
|
60
|
-
// Count opening braces/angles on the first line
|
|
61
|
-
const initialCounts = countBrackets(line);
|
|
62
|
-
// Find the end of this type declaration
|
|
63
|
-
const endIdx = findTypeDeclarationEnd(lines, startIdx, initialCounts);
|
|
64
|
-
allTypes.push({ name: typeName, startIdx, endIdx });
|
|
65
|
-
i = endIdx; // Skip to end of this type
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return allTypes;
|
|
69
|
-
}
|
|
70
|
-
export function extractTypeName(typeLine) {
|
|
71
|
-
const match = typeLine.match(/^type\s+(\w+)/);
|
|
72
|
-
return match ? match[1] : '';
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=type-decls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-decls.js","sourceRoot":"","sources":["../../../../../src/transformers/model-to-flow/analysis/type-decls.ts"],"names":[],"mappings":"AA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CAAC,CAAC;YAE1C,wCAAwC;YACxC,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;YAEtE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YACpD,CAAC,GAAG,MAAM,CAAC,CAAC,2BAA2B;QACzC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Analyzes the flow code to find both used types and used integration names
|
|
3
|
-
*/
|
|
4
|
-
export declare function analyzeCodeUsage(code: string, typeNames: string[], _typeIntegrationNames: string[], valueIntegrationNames: string[], flowFunctionNames?: string[]): {
|
|
5
|
-
usedTypes: Set<string>;
|
|
6
|
-
usedIntegrations: Set<string>;
|
|
7
|
-
usedFlowFunctions: Set<string>;
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../../../src/transformers/model-to-flow/analysis/usage.ts"],"names":[],"mappings":"AA2EA;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EAAE,EACnB,qBAAqB,EAAE,MAAM,EAAE,EAC/B,qBAAqB,EAAE,MAAM,EAAE,EAC/B,iBAAiB,GAAE,MAAM,EAAO;;;;EA2BjC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
|
-
import { extractFlowCode } from './extract-flow.js';
|
|
3
|
-
import { checkCallExpressionContext, processTypeMatching } from './lint-helpers.js';
|
|
4
|
-
function checkTypeReference(node, typeNames, usedTypes) {
|
|
5
|
-
if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName)) {
|
|
6
|
-
const typeName = node.typeName.text;
|
|
7
|
-
if (typeNames.includes(typeName)) {
|
|
8
|
-
usedTypes.add(typeName);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function checkIdentifierReference(node, valueIntegrationNames, usedIntegrations) {
|
|
13
|
-
if (ts.isIdentifier(node)) {
|
|
14
|
-
const name = node.text;
|
|
15
|
-
if (valueIntegrationNames.includes(name)) {
|
|
16
|
-
usedIntegrations.add(name);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function checkFlowFunctionReference(node, flowFunctionNames, usedFlowFunctions) {
|
|
21
|
-
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {
|
|
22
|
-
const functionName = node.expression.text;
|
|
23
|
-
if (flowFunctionNames.includes(functionName)) {
|
|
24
|
-
usedFlowFunctions.add(functionName);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function checkCallExpressionTypes(node, typeNames, usedTypes) {
|
|
29
|
-
if (ts.isCallExpression(node) && node.typeArguments) {
|
|
30
|
-
for (const typeArg of node.typeArguments) {
|
|
31
|
-
if (ts.isTypeReferenceNode(typeArg) && ts.isIdentifier(typeArg.typeName)) {
|
|
32
|
-
const typeName = typeArg.typeName.text;
|
|
33
|
-
if (typeNames.includes(typeName)) {
|
|
34
|
-
usedTypes.add(typeName);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function checkAsExpression(node, typeNames, usedTypes) {
|
|
41
|
-
if (ts.isAsExpression(node) && ts.isTypeReferenceNode(node.type) && ts.isIdentifier(node.type.typeName)) {
|
|
42
|
-
const typeName = node.type.typeName.text;
|
|
43
|
-
if (typeNames.includes(typeName)) {
|
|
44
|
-
usedTypes.add(typeName);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function checkStringLiteralReferences(node, typeNames, usedTypes) {
|
|
49
|
-
if (!ts.isStringLiteral(node) || node.parent === null || node.parent === undefined) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const text = node.text;
|
|
53
|
-
const isTypeReference = checkIfStringLiteralIsTypeReference(node.parent);
|
|
54
|
-
if (isTypeReference) {
|
|
55
|
-
processTypeMatching(text, typeNames, usedTypes);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function checkIfStringLiteralIsTypeReference(parent) {
|
|
59
|
-
if (!ts.isCallExpression(parent)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
const contextResult = checkCallExpressionContext(parent);
|
|
63
|
-
return contextResult !== null;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Analyzes the flow code to find both used types and used integration names
|
|
67
|
-
*/
|
|
68
|
-
export function analyzeCodeUsage(code, typeNames, _typeIntegrationNames, valueIntegrationNames, flowFunctionNames = []) {
|
|
69
|
-
const usedTypes = new Set();
|
|
70
|
-
const usedIntegrations = new Set();
|
|
71
|
-
const usedFlowFunctions = new Set();
|
|
72
|
-
// Extract only the flow code (exclude type declarations) for analysis
|
|
73
|
-
const flowCode = extractFlowCode(code);
|
|
74
|
-
// Create a temporary source file for flow code analysis
|
|
75
|
-
const sourceFile = ts.createSourceFile('temp.ts', flowCode, ts.ScriptTarget.Latest, true);
|
|
76
|
-
// Visit all nodes to find type and integration references in the flow code
|
|
77
|
-
function visit(node) {
|
|
78
|
-
// Check for various type references
|
|
79
|
-
checkTypeReference(node, typeNames, usedTypes);
|
|
80
|
-
checkIdentifierReference(node, valueIntegrationNames, usedIntegrations);
|
|
81
|
-
checkFlowFunctionReference(node, flowFunctionNames, usedFlowFunctions);
|
|
82
|
-
checkCallExpressionTypes(node, typeNames, usedTypes);
|
|
83
|
-
checkAsExpression(node, typeNames, usedTypes);
|
|
84
|
-
checkStringLiteralReferences(node, typeNames, usedTypes);
|
|
85
|
-
ts.forEachChild(node, visit);
|
|
86
|
-
}
|
|
87
|
-
visit(sourceFile);
|
|
88
|
-
return { usedTypes, usedIntegrations, usedFlowFunctions };
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=usage.js.map
|