@auto-engineer/server-generator-apollo-emmett 0.11.10 → 0.11.11
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 +5 -0
- package/.turbo/turbo-format.log +4 -0
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +14 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/CHANGELOG.md +10 -0
- package/dist/src/codegen/extract/commands.d.ts +1 -1
- package/dist/src/codegen/extract/commands.d.ts.map +1 -1
- package/dist/src/codegen/extract/data-sink.d.ts +1 -1
- package/dist/src/codegen/extract/data-sink.d.ts.map +1 -1
- package/dist/src/codegen/extract/events.d.ts +1 -1
- package/dist/src/codegen/extract/events.d.ts.map +1 -1
- package/dist/src/codegen/extract/gwt.d.ts +1 -1
- package/dist/src/codegen/extract/gwt.d.ts.map +1 -1
- package/dist/src/codegen/extract/messages.d.ts +1 -1
- package/dist/src/codegen/extract/messages.d.ts.map +1 -1
- package/dist/src/codegen/extract/projection.d.ts +1 -1
- package/dist/src/codegen/extract/projection.d.ts.map +1 -1
- package/dist/src/codegen/extract/query.d.ts +1 -1
- package/dist/src/codegen/extract/query.d.ts.map +1 -1
- package/dist/src/codegen/extract/states.d.ts +1 -1
- package/dist/src/codegen/extract/states.d.ts.map +1 -1
- package/dist/src/codegen/scaffoldFromSchema.d.ts +3 -3
- package/dist/src/codegen/scaffoldFromSchema.d.ts.map +1 -1
- package/dist/src/codegen/scaffoldFromSchema.js.map +1 -1
- package/dist/src/codegen/templates/command/commands.specs.ts +3 -3
- package/dist/src/codegen/templates/command/decide.specs.specs.ts +7 -7
- package/dist/src/codegen/templates/command/decide.specs.ts +9 -9
- package/dist/src/codegen/templates/command/events.specs.ts +3 -3
- package/dist/src/codegen/templates/command/evolve.specs.ts +3 -3
- package/dist/src/codegen/templates/command/handle.specs.ts +10 -5
- package/dist/src/codegen/templates/command/mutation.resolver.specs.ts +7 -7
- package/dist/src/codegen/templates/command/register.specs.ts +3 -3
- package/dist/src/codegen/templates/command/state.specs.ts +3 -3
- package/dist/src/codegen/templates/query/projection.specs.specs.ts +7 -7
- package/dist/src/codegen/templates/query/projection.specs.ts +5 -5
- package/dist/src/codegen/templates/query/query.resolver.specs.ts +13 -13
- package/dist/src/codegen/templates/query/state.specs.ts +3 -3
- package/dist/src/codegen/templates/react/react.specs.specs.ts +3 -3
- package/dist/src/codegen/templates/react/react.specs.ts +3 -3
- package/dist/src/codegen/templates/react/register.specs.ts +3 -3
- package/dist/src/codegen/test-data/specVariant1.d.ts +1 -1
- package/dist/src/codegen/test-data/specVariant1.d.ts.map +1 -1
- package/dist/src/codegen/test-data/specVariant1.js +1 -1
- package/dist/src/codegen/test-data/specVariant1.js.map +1 -1
- package/dist/src/codegen/types.d.ts +1 -1
- package/dist/src/codegen/types.d.ts.map +1 -1
- package/dist/src/commands/generate-server.d.ts.map +1 -1
- package/dist/src/commands/generate-server.js +11 -8
- package/dist/src/commands/generate-server.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/codegen/extract/commands.ts +1 -1
- package/src/codegen/extract/data-sink.ts +1 -1
- package/src/codegen/extract/events.ts +1 -1
- package/src/codegen/extract/gwt.ts +1 -1
- package/src/codegen/extract/messages.ts +1 -1
- package/src/codegen/extract/projection.ts +1 -1
- package/src/codegen/extract/query.ts +1 -1
- package/src/codegen/extract/states.ts +1 -1
- package/src/codegen/scaffoldFromSchema.ts +10 -10
- package/src/codegen/templates/command/commands.specs.ts +3 -3
- package/src/codegen/templates/command/decide.specs.specs.ts +7 -7
- package/src/codegen/templates/command/decide.specs.ts +9 -9
- package/src/codegen/templates/command/events.specs.ts +3 -3
- package/src/codegen/templates/command/evolve.specs.ts +3 -3
- package/src/codegen/templates/command/handle.specs.ts +10 -5
- package/src/codegen/templates/command/mutation.resolver.specs.ts +7 -7
- package/src/codegen/templates/command/register.specs.ts +3 -3
- package/src/codegen/templates/command/state.specs.ts +3 -3
- package/src/codegen/templates/query/projection.specs.specs.ts +7 -7
- package/src/codegen/templates/query/projection.specs.ts +5 -5
- package/src/codegen/templates/query/query.resolver.specs.ts +13 -13
- package/src/codegen/templates/query/state.specs.ts +3 -3
- package/src/codegen/templates/react/react.specs.specs.ts +3 -3
- package/src/codegen/templates/react/react.specs.ts +3 -3
- package/src/codegen/templates/react/register.specs.ts +3 -3
- package/src/codegen/test-data/specVariant1.ts +2 -2
- package/src/codegen/types.ts +1 -1
- package/src/commands/generate-server.ts +13 -9
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
2
|
import { generateScaffoldFilePlans } from '../../scaffoldFromSchema';
|
|
3
|
-
import { Model as SpecsSchema } from '@auto-engineer/
|
|
3
|
+
import { Model as SpecsSchema } from '@auto-engineer/narrative';
|
|
4
4
|
|
|
5
5
|
describe('query.resolver.ts.ejs', () => {
|
|
6
6
|
it('should generate a valid query resolver from request field', async () => {
|
|
7
7
|
const spec: SpecsSchema = {
|
|
8
8
|
variant: 'specs',
|
|
9
|
-
|
|
9
|
+
narratives: [
|
|
10
10
|
{
|
|
11
11
|
name: 'listing-flow',
|
|
12
12
|
slices: [
|
|
@@ -63,7 +63,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
63
63
|
],
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
66
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
67
67
|
const resolverFile = plans.find((p) => p.outputPath.endsWith('query.resolver.ts'));
|
|
68
68
|
|
|
69
69
|
expect(resolverFile?.contents).toMatchInlineSnapshot(`
|
|
@@ -129,7 +129,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
129
129
|
it('should generate a valid query resolver with array of inline object field', async () => {
|
|
130
130
|
const spec: SpecsSchema = {
|
|
131
131
|
variant: 'specs',
|
|
132
|
-
|
|
132
|
+
narratives: [
|
|
133
133
|
{
|
|
134
134
|
name: 'assistant-flow',
|
|
135
135
|
slices: [
|
|
@@ -187,7 +187,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
187
187
|
],
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
190
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
191
191
|
const resolverFile = plans.find((p) => p.outputPath.endsWith('query.resolver.ts'));
|
|
192
192
|
|
|
193
193
|
expect(resolverFile?.contents).toMatchInlineSnapshot(`
|
|
@@ -254,7 +254,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
254
254
|
it('should generate the query resolver for "views the questionnaire"', async () => {
|
|
255
255
|
const spec: SpecsSchema = {
|
|
256
256
|
variant: 'specs',
|
|
257
|
-
|
|
257
|
+
narratives: [
|
|
258
258
|
{
|
|
259
259
|
name: 'Questionnaires',
|
|
260
260
|
slices: [
|
|
@@ -354,7 +354,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
354
354
|
integrations: [],
|
|
355
355
|
};
|
|
356
356
|
|
|
357
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
357
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
358
358
|
const queryFile = plans.find(
|
|
359
359
|
(p) => p.outputPath.endsWith('query.resolver.ts') && p.contents.includes('ViewsTheQuestionnaireQueryResolver'),
|
|
360
360
|
);
|
|
@@ -429,7 +429,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
429
429
|
it('should import Float when Float fields are used', async () => {
|
|
430
430
|
const spec: SpecsSchema = {
|
|
431
431
|
variant: 'specs',
|
|
432
|
-
|
|
432
|
+
narratives: [
|
|
433
433
|
{
|
|
434
434
|
name: 'product-flow',
|
|
435
435
|
slices: [
|
|
@@ -482,7 +482,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
482
482
|
],
|
|
483
483
|
};
|
|
484
484
|
|
|
485
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
485
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
486
486
|
const resolverFile = plans.find((p) => p.outputPath.endsWith('query.resolver.ts'));
|
|
487
487
|
|
|
488
488
|
expect(resolverFile?.contents).toContain(
|
|
@@ -493,7 +493,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
493
493
|
it('should import Float when array of numbers is used', async () => {
|
|
494
494
|
const spec: SpecsSchema = {
|
|
495
495
|
variant: 'specs',
|
|
496
|
-
|
|
496
|
+
narratives: [
|
|
497
497
|
{
|
|
498
498
|
name: 'stats-flow',
|
|
499
499
|
slices: [
|
|
@@ -544,7 +544,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
544
544
|
],
|
|
545
545
|
};
|
|
546
546
|
|
|
547
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
547
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
548
548
|
const resolverFile = plans.find((p) => p.outputPath.endsWith('query.resolver.ts'));
|
|
549
549
|
|
|
550
550
|
expect(resolverFile?.contents).toContain('Float');
|
|
@@ -553,7 +553,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
553
553
|
it('should import Float when Float query arg is used', async () => {
|
|
554
554
|
const spec: SpecsSchema = {
|
|
555
555
|
variant: 'specs',
|
|
556
|
-
|
|
556
|
+
narratives: [
|
|
557
557
|
{
|
|
558
558
|
name: 'search-flow',
|
|
559
559
|
slices: [
|
|
@@ -604,7 +604,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
604
604
|
],
|
|
605
605
|
};
|
|
606
606
|
|
|
607
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
607
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
608
608
|
const resolverFile = plans.find((p) => p.outputPath.endsWith('query.resolver.ts'));
|
|
609
609
|
|
|
610
610
|
expect(resolverFile?.contents).toContain('Float');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
2
|
import { generateScaffoldFilePlans } from '../../scaffoldFromSchema';
|
|
3
|
-
import { Model as SpecsSchema } from '@auto-engineer/
|
|
3
|
+
import { Model as SpecsSchema } from '@auto-engineer/narrative';
|
|
4
4
|
|
|
5
5
|
describe('state.ts.ejs', () => {
|
|
6
6
|
it('should generate a valid state definition file for a query slice with a state message', async () => {
|
|
7
7
|
const spec: SpecsSchema = {
|
|
8
8
|
variant: 'specs',
|
|
9
|
-
|
|
9
|
+
narratives: [
|
|
10
10
|
{
|
|
11
11
|
name: 'Inventory management',
|
|
12
12
|
slices: [
|
|
@@ -52,7 +52,7 @@ describe('state.ts.ejs', () => {
|
|
|
52
52
|
],
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
55
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
56
56
|
const stateFile = plans.find((p) => p.outputPath.endsWith('state.ts'));
|
|
57
57
|
|
|
58
58
|
expect(stateFile?.contents).toMatchInlineSnapshot(`
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { Model as SpecsSchema } from '@auto-engineer/
|
|
2
|
+
import { Model as SpecsSchema } from '@auto-engineer/narrative';
|
|
3
3
|
import { generateScaffoldFilePlans } from '../../scaffoldFromSchema';
|
|
4
4
|
|
|
5
5
|
describe('react.specs.ts.ejs (react slice)', () => {
|
|
6
6
|
it('should generate correct react.specs.ts', async () => {
|
|
7
7
|
const spec: SpecsSchema = {
|
|
8
8
|
variant: 'specs',
|
|
9
|
-
|
|
9
|
+
narratives: [
|
|
10
10
|
{
|
|
11
11
|
name: 'manage bookings',
|
|
12
12
|
slices: [
|
|
@@ -161,7 +161,7 @@ describe('react.specs.ts.ejs (react slice)', () => {
|
|
|
161
161
|
],
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
164
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
165
165
|
|
|
166
166
|
const specFile = plans.find((p) => p.outputPath.endsWith('react.specs.ts'));
|
|
167
167
|
expect(specFile?.contents).toMatchInlineSnapshot(`
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { Model as SpecsSchema } from '@auto-engineer/
|
|
2
|
+
import { Model as SpecsSchema } from '@auto-engineer/narrative';
|
|
3
3
|
import { generateScaffoldFilePlans } from '../../scaffoldFromSchema';
|
|
4
4
|
|
|
5
5
|
describe('handle.ts.ejs (react slice)', () => {
|
|
6
6
|
it('should generate correct react.ts', async () => {
|
|
7
7
|
const spec: SpecsSchema = {
|
|
8
8
|
variant: 'specs',
|
|
9
|
-
|
|
9
|
+
narratives: [
|
|
10
10
|
{
|
|
11
11
|
name: 'manage bookings',
|
|
12
12
|
slices: [
|
|
@@ -215,7 +215,7 @@ describe('handle.ts.ejs (react slice)', () => {
|
|
|
215
215
|
],
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
218
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
219
219
|
const handleFile = plans.find((p) => p.outputPath.endsWith('react.ts'));
|
|
220
220
|
|
|
221
221
|
expect(handleFile?.contents).toMatchInlineSnapshot(`
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { Model as SpecsSchema } from '@auto-engineer/
|
|
2
|
+
import { Model as SpecsSchema } from '@auto-engineer/narrative';
|
|
3
3
|
import { generateScaffoldFilePlans } from '../../scaffoldFromSchema';
|
|
4
4
|
|
|
5
5
|
describe('register.ts.ejs (react slice)', () => {
|
|
6
6
|
it('should generate correct register.ts', async () => {
|
|
7
7
|
const spec: SpecsSchema = {
|
|
8
8
|
variant: 'specs',
|
|
9
|
-
|
|
9
|
+
narratives: [
|
|
10
10
|
{
|
|
11
11
|
name: 'manage bookings',
|
|
12
12
|
slices: [
|
|
@@ -215,7 +215,7 @@ describe('register.ts.ejs (react slice)', () => {
|
|
|
215
215
|
],
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
-
const plans = await generateScaffoldFilePlans(spec.
|
|
218
|
+
const plans = await generateScaffoldFilePlans(spec.narratives, spec.messages, undefined, 'src/domain/flows');
|
|
219
219
|
const registerFile = plans.find((p) => p.outputPath.endsWith('send-notification-to-host/register.ts'));
|
|
220
220
|
|
|
221
221
|
expect(registerFile?.contents).toMatchInlineSnapshot(`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Model as SpecsSchema } from '@auto-engineer/
|
|
1
|
+
import { Model as SpecsSchema } from '@auto-engineer/narrative';
|
|
2
2
|
|
|
3
3
|
const specVariant1: SpecsSchema = {
|
|
4
4
|
variant: 'specs',
|
|
5
|
-
|
|
5
|
+
narratives: [
|
|
6
6
|
{
|
|
7
7
|
name: 'Add item',
|
|
8
8
|
description: 'Flow to add items to a system',
|
package/src/codegen/types.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { resolve, join } from 'path';
|
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import { generateScaffoldFilePlans, writeScaffoldFilePlans } from '../codegen/scaffoldFromSchema';
|
|
7
7
|
import { ensureDirExists, ensureDirPath, toKebabCase } from '../codegen/utils/path';
|
|
8
|
-
import { Model } from '@auto-engineer/
|
|
8
|
+
import { Model } from '@auto-engineer/narrative';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
10
|
import { dirname } from 'path';
|
|
11
11
|
import { execa } from 'execa';
|
|
@@ -123,7 +123,7 @@ async function readAndParseModel(absModel: string): Promise<Model> {
|
|
|
123
123
|
const spec = JSON.parse(content) as Model;
|
|
124
124
|
|
|
125
125
|
debugModel('Parsed model:');
|
|
126
|
-
debugModel(' Flows: %d', spec.
|
|
126
|
+
debugModel(' Flows: %d', spec.narratives?.length || 0);
|
|
127
127
|
debugModel(' Messages: %d', spec.messages?.length || 0);
|
|
128
128
|
debugModel(' Integrations: %d', spec.integrations?.length ?? 0);
|
|
129
129
|
|
|
@@ -132,12 +132,12 @@ async function readAndParseModel(absModel: string): Promise<Model> {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
function logFlowDetails(spec: Model): void {
|
|
135
|
-
if (spec.
|
|
135
|
+
if (spec.narratives !== undefined && spec.narratives.length > 0) {
|
|
136
136
|
debugModel(
|
|
137
137
|
'Flow names: %o',
|
|
138
|
-
spec.
|
|
138
|
+
spec.narratives.map((f) => f.name),
|
|
139
139
|
);
|
|
140
|
-
spec.
|
|
140
|
+
spec.narratives.forEach((flow) => {
|
|
141
141
|
debugModel(' Flow "%s" has %d slices', flow.name, flow.slices?.length || 0);
|
|
142
142
|
flow.slices?.forEach((slice) => {
|
|
143
143
|
debugModel(' Slice: %s (type: %s)', slice.name, slice.type);
|
|
@@ -177,9 +177,9 @@ async function generateAndWriteScaffold(spec: Model, serverDir: string): Promise
|
|
|
177
177
|
const domainFlowsPath = join(serverDir, 'src', 'domain', 'flows');
|
|
178
178
|
debugScaffold('Generating scaffold file plans');
|
|
179
179
|
debugScaffold(' Domain flows path: %s', domainFlowsPath);
|
|
180
|
-
debugScaffold(' Number of flows: %d', spec.
|
|
180
|
+
debugScaffold(' Number of flows: %d', spec.narratives?.length || 0);
|
|
181
181
|
|
|
182
|
-
const filePlans = await generateScaffoldFilePlans(spec.
|
|
182
|
+
const filePlans = await generateScaffoldFilePlans(spec.narratives, spec.messages, spec.integrations, domainFlowsPath);
|
|
183
183
|
|
|
184
184
|
debugScaffold('Generated %d file plans', filePlans.length);
|
|
185
185
|
if (filePlans.length > 0) {
|
|
@@ -285,6 +285,10 @@ export async function handleGenerateServerCommandInternal(
|
|
|
285
285
|
debug('Server directory: %s', serverDir);
|
|
286
286
|
debug('🔄 Generating server... %s', serverDir);
|
|
287
287
|
|
|
288
|
+
debug('Clearing existing server directory if it exists');
|
|
289
|
+
await fs.remove(serverDir);
|
|
290
|
+
debug('Server directory cleared');
|
|
291
|
+
|
|
288
292
|
await ensureDirExists(serverDir);
|
|
289
293
|
debugFiles('Created server directory: %s', serverDir);
|
|
290
294
|
|
|
@@ -292,8 +296,8 @@ export async function handleGenerateServerCommandInternal(
|
|
|
292
296
|
|
|
293
297
|
await generateAndWriteScaffold(spec, serverDir);
|
|
294
298
|
|
|
295
|
-
if (Array.isArray(spec.
|
|
296
|
-
for (const flow of spec.
|
|
299
|
+
if (Array.isArray(spec.narratives) && spec.narratives.length > 0) {
|
|
300
|
+
for (const flow of spec.narratives) {
|
|
297
301
|
if (Array.isArray(flow.slices) && flow.slices.length > 0) {
|
|
298
302
|
for (const slice of flow.slices) {
|
|
299
303
|
if (slice.type === 'experience') continue; // skip experience slices
|