create-auto-app 0.1.4 → 0.1.6
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/dist/index.js +125 -111
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/templates/shopping-app/.context/auto-ia-scheme.json +8 -29
- package/templates/shopping-app/.context/design-system.md +59 -35
- package/templates/shopping-app/.context/figma-variables.json +335 -1024
- package/templates/shopping-app/.context/schema.json +3 -7
- package/templates/shopping-app/.context/shadcn-filter.ts +2 -4
- package/templates/shopping-app/auto.config.ts +2 -2
- package/templates/shopping-app/client/src/gql/fragment-masking.ts +22 -22
- package/templates/shopping-app/client/src/gql/gql.ts +12 -5
- package/templates/shopping-app/client/src/gql/graphql.ts +125 -11
- package/templates/shopping-app/client/src/gql/index.ts +2 -2
- package/templates/shopping-app/client/src/graphql/mutations.ts +9 -9
- package/templates/shopping-app/client/src/graphql/queries.ts +10 -10
- package/templates/shopping-app/flows/shopping-assistant.flow.ts +2 -2
- package/templates/shopping-app/package.json +1 -1
- package/templates/shopping-app/pnpm-workspace.yaml +2 -2
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/commands.ts +2 -2
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/decide.specs.ts +20 -20
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/decide.ts +8 -11
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/events.ts +2 -2
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/evolve.ts +3 -3
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/handle.ts +8 -15
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/mutation.resolver.ts +5 -9
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/register.ts +4 -7
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/creates-a-chat-session-/react.specs.ts +19 -31
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/creates-a-chat-session-/react.ts +6 -12
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/creates-a-chat-session-/register.ts +4 -11
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/commands.ts +2 -2
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/decide.specs.ts +14 -14
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/decide.ts +8 -11
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/events.ts +2 -2
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/evolve.ts +3 -3
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/handle.ts +8 -15
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/mutation.resolver.ts +5 -9
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/register.ts +4 -7
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/commands.ts +2 -2
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/decide.specs.ts +23 -23
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/decide.ts +9 -13
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/events.ts +2 -2
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/evolve.ts +3 -3
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/handle.ts +11 -18
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/mutation.resolver.ts +5 -9
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/register.ts +4 -7
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/views-suggested-items/projection.specs.ts +35 -35
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/views-suggested-items/projection.ts +8 -11
- package/templates/shopping-app/server/src/domain/flows/seasonal-assistant/views-suggested-items/query.resolver.ts +4 -7
- package/templates/shopping-app/server/src/domain/shared/ReadModel.d.ts +7 -7
- package/templates/shopping-app/server/src/domain/shared/ReadModel.js +17 -17
- package/templates/shopping-app/server/src/domain/shared/index.d.ts +1 -1
- package/templates/shopping-app/server/src/domain/shared/index.js +1 -1
- package/templates/shopping-app/server/src/domain/shared/reactorSpecification.d.ts +42 -21
- package/templates/shopping-app/server/src/domain/shared/reactorSpecification.js +148 -140
- package/templates/shopping-app/server/src/domain/shared/sendCommand.d.ts +5 -2
- package/templates/shopping-app/server/src/domain/shared/sendCommand.js +14 -15
- package/templates/shopping-app/server/src/domain/shared/types.d.ts +10 -10
- package/templates/shopping-app/server/src/domain/shared/types.js +37 -36
- package/templates/shopping-app/server/src/integrations/ai-integration.ts +1 -1
- package/templates/shopping-app/server/src/integrations/cart-integration.ts +1 -1
- package/templates/shopping-app/server/src/integrations/index.ts +1 -1
- package/templates/shopping-app/server/src/integrations/product-catalogue-integration.ts +1 -1
- package/templates/shopping-app/server/src/utils/index.d.ts +1 -1
- package/templates/shopping-app/server/src/utils/index.js +1 -1
- package/templates/shopping-app/server/src/utils/loadProjections.d.ts +1 -1
- package/templates/shopping-app/server/src/utils/loadProjections.js +18 -16
- package/templates/shopping-app/server/src/utils/loadRegisterFiles.d.ts +2 -2
- package/templates/shopping-app/server/src/utils/loadRegisterFiles.js +19 -21
- package/templates/shopping-app/server/src/utils/loadResolvers.d.ts +2 -2
- package/templates/shopping-app/server/src/utils/loadResolvers.js +22 -22
- package/templates/shopping-app/server/tsconfig.json +2 -8
- package/templates/shopping-app/tsconfig.json +2 -8
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Command, CommandSender } from '@event-driven-io/emmett';
|
|
2
2
|
import type { MutationResponse } from './types';
|
|
3
|
-
export declare function sendCommand<T extends Command>(
|
|
4
|
-
|
|
3
|
+
export declare function sendCommand<T extends Command>(
|
|
4
|
+
commandSender: CommandSender,
|
|
5
|
+
command: T,
|
|
6
|
+
): Promise<MutationResponse>;
|
|
7
|
+
//# sourceMappingURL=sendCommand.d.ts.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export async function sendCommand(commandSender, command) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
2
|
+
try {
|
|
3
|
+
await commandSender.send(command);
|
|
4
|
+
return { success: true };
|
|
5
|
+
} catch (error) {
|
|
6
|
+
const err = error;
|
|
7
|
+
return {
|
|
8
|
+
success: false,
|
|
9
|
+
error: {
|
|
10
|
+
type: err?.name ?? 'UnknownError',
|
|
11
|
+
message: err?.message ?? 'An unexpected error occurred',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
16
15
|
}
|
|
17
|
-
//# sourceMappingURL=sendCommand.js.map
|
|
16
|
+
//# sourceMappingURL=sendCommand.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { CommandSender, InMemoryEventStore } from '@event-driven-io/emmett';
|
|
2
2
|
export interface ReactorContext {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
eventStore: InMemoryEventStore;
|
|
4
|
+
commandSender: CommandSender;
|
|
5
|
+
[key: string]: unknown;
|
|
6
6
|
}
|
|
7
7
|
export interface GraphQLContext {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
eventStore: InMemoryEventStore;
|
|
9
|
+
messageBus: CommandSender;
|
|
10
10
|
}
|
|
11
11
|
export declare class MutationError {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
type: string;
|
|
13
|
+
message?: string;
|
|
14
14
|
}
|
|
15
15
|
export declare class MutationResponse {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
success: boolean;
|
|
17
|
+
error?: MutationError;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=types.d.ts.map
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
var __decorate =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var __decorate =
|
|
2
|
+
(this && this.__decorate) ||
|
|
3
|
+
function (decorators, target, key, desc) {
|
|
4
|
+
var c = arguments.length,
|
|
5
|
+
r = c < 3 ? target : desc === null ? (desc = Object.getOwnPropertyDescriptor(target, key)) : desc,
|
|
6
|
+
d;
|
|
7
|
+
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
|
8
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else
|
|
10
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
11
|
+
if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
+
return (c > 3 && r && Object.defineProperty(target, key, r), r);
|
|
13
|
+
};
|
|
14
|
+
var __metadata =
|
|
15
|
+
(this && this.__metadata) ||
|
|
16
|
+
function (k, v) {
|
|
17
|
+
if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function') return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
10
19
|
import { Field, ObjectType } from 'type-graphql';
|
|
11
|
-
let MutationError = class MutationError {
|
|
12
|
-
|
|
13
|
-
__decorate(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
], MutationError.prototype, "message", void 0);
|
|
21
|
-
MutationError = __decorate([
|
|
22
|
-
ObjectType()
|
|
23
|
-
], MutationError);
|
|
20
|
+
let MutationError = class MutationError {};
|
|
21
|
+
__decorate([Field(() => String), __metadata('design:type', String)], MutationError.prototype, 'type', void 0);
|
|
22
|
+
__decorate(
|
|
23
|
+
[Field(() => String, { nullable: true }), __metadata('design:type', String)],
|
|
24
|
+
MutationError.prototype,
|
|
25
|
+
'message',
|
|
26
|
+
void 0,
|
|
27
|
+
);
|
|
28
|
+
MutationError = __decorate([ObjectType()], MutationError);
|
|
24
29
|
export { MutationError };
|
|
25
|
-
let MutationResponse = class MutationResponse {
|
|
26
|
-
|
|
27
|
-
__decorate(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
], MutationResponse.prototype, "error", void 0);
|
|
35
|
-
MutationResponse = __decorate([
|
|
36
|
-
ObjectType()
|
|
37
|
-
], MutationResponse);
|
|
30
|
+
let MutationResponse = class MutationResponse {};
|
|
31
|
+
__decorate([Field(() => Boolean), __metadata('design:type', Boolean)], MutationResponse.prototype, 'success', void 0);
|
|
32
|
+
__decorate(
|
|
33
|
+
[Field(() => MutationError, { nullable: true }), __metadata('design:type', MutationError)],
|
|
34
|
+
MutationResponse.prototype,
|
|
35
|
+
'error',
|
|
36
|
+
void 0,
|
|
37
|
+
);
|
|
38
|
+
MutationResponse = __decorate([ObjectType()], MutationResponse);
|
|
38
39
|
export { MutationResponse };
|
|
39
|
-
//# sourceMappingURL=types.js.map
|
|
40
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import fg from 'fast-glob';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
export async function loadProjections(source) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return projectionModule.projection;
|
|
4
|
+
const files = await fg(source, { absolute: true });
|
|
5
|
+
const modules = await Promise.all(
|
|
6
|
+
files.map(async (file) => {
|
|
7
|
+
const mod = await import(pathToFileUrl(file).href);
|
|
8
|
+
if (typeof mod === 'object' && mod !== null && 'projection' in mod) {
|
|
9
|
+
const projectionModule = mod;
|
|
10
|
+
if (projectionModule.projection == null) {
|
|
11
|
+
console.warn(`⚠️ Projection file "${file}" does not export "projection"`);
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
return projectionModule.projection;
|
|
14
|
+
}
|
|
15
|
+
console.warn(`⚠️ Projection file "${file}" does not export "projection"`);
|
|
16
|
+
return undefined;
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
return modules.filter((p) => p != null);
|
|
18
20
|
}
|
|
19
21
|
function pathToFileUrl(filePath) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
const resolved = path.resolve(filePath);
|
|
23
|
+
return new URL(`file://${resolved}`);
|
|
22
24
|
}
|
|
23
|
-
//# sourceMappingURL=loadProjections.js.map
|
|
25
|
+
//# sourceMappingURL=loadProjections.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommandProcessor, EventStore } from '@event-driven-io/emmett';
|
|
2
2
|
export interface SliceRegistration {
|
|
3
|
-
|
|
3
|
+
register: (messageBus: CommandProcessor, eventStore: EventStore) => Promise<unknown> | void;
|
|
4
4
|
}
|
|
5
5
|
export declare function loadRegisterFiles(source: string): Promise<SliceRegistration[]>;
|
|
6
|
-
//# sourceMappingURL=loadRegisterFiles.d.ts.map
|
|
6
|
+
//# sourceMappingURL=loadRegisterFiles.d.ts.map
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import fg from 'fast-glob';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
export async function loadRegisterFiles(source) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
typeof mod.register === 'function') {
|
|
12
|
-
return mod;
|
|
13
|
-
}
|
|
14
|
-
console.warn('⚠️ Skipping invalid register.ts at', file);
|
|
15
|
-
return null;
|
|
4
|
+
const files = await fg(source, { absolute: true });
|
|
5
|
+
const modules = await Promise.all(
|
|
6
|
+
files.map(async (file) => {
|
|
7
|
+
try {
|
|
8
|
+
const mod = await import(pathToFileUrl(file).href);
|
|
9
|
+
if (typeof mod === 'object' && mod !== null && 'register' in mod && typeof mod.register === 'function') {
|
|
10
|
+
return mod;
|
|
16
11
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
console.warn('⚠️ Skipping invalid register.ts at', file);
|
|
13
|
+
return null;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('❌ Failed to import', file, ':', error);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
return modules.filter((m) => m !== null);
|
|
23
21
|
}
|
|
24
22
|
function pathToFileUrl(filePath) {
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const resolved = path.resolve(filePath);
|
|
24
|
+
return new URL(`file://${resolved}`);
|
|
27
25
|
}
|
|
28
|
-
//# sourceMappingURL=loadRegisterFiles.js.map
|
|
26
|
+
//# sourceMappingURL=loadRegisterFiles.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import fg from 'fast-glob';
|
|
2
2
|
export async function loadResolvers(source) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
for (const key of Object.keys(mod)) {
|
|
13
|
-
const exported = mod[key];
|
|
14
|
-
if (typeof exported === 'function') {
|
|
15
|
-
allResolvers.push(exported);
|
|
16
|
-
}
|
|
17
|
-
if (Array.isArray(exported) && exported.every((r) => typeof r === 'function')) {
|
|
18
|
-
allResolvers.push(...exported);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
3
|
+
const files = await fg(source, {
|
|
4
|
+
absolute: true,
|
|
5
|
+
});
|
|
6
|
+
const modules = await Promise.all(files.map((file) => import(file)));
|
|
7
|
+
const allResolvers = [];
|
|
8
|
+
for (const mod of modules) {
|
|
9
|
+
if (typeof mod !== 'object' || mod === null) {
|
|
10
|
+
continue;
|
|
21
11
|
}
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
for (const key of Object.keys(mod)) {
|
|
13
|
+
const exported = mod[key];
|
|
14
|
+
if (typeof exported === 'function') {
|
|
15
|
+
allResolvers.push(exported);
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(exported) && exported.every((r) => typeof r === 'function')) {
|
|
18
|
+
allResolvers.push(...exported);
|
|
19
|
+
}
|
|
24
20
|
}
|
|
25
|
-
|
|
21
|
+
}
|
|
22
|
+
if (allResolvers.length === 0) {
|
|
23
|
+
throw new Error('❌ No resolvers found for any slices.');
|
|
24
|
+
}
|
|
25
|
+
return allResolvers;
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=loadResolvers.js.map
|
|
27
|
+
//# sourceMappingURL=loadResolvers.js.map
|
|
@@ -8,12 +8,6 @@
|
|
|
8
8
|
"emitDecoratorMetadata": true,
|
|
9
9
|
"experimentalDecorators": true
|
|
10
10
|
},
|
|
11
|
-
"include": [
|
|
12
|
-
|
|
13
|
-
"vitest.config.ts"
|
|
14
|
-
],
|
|
15
|
-
"exclude": [
|
|
16
|
-
"dist",
|
|
17
|
-
"node_modules"
|
|
18
|
-
]
|
|
11
|
+
"include": ["src/**/*", "vitest.config.ts"],
|
|
12
|
+
"exclude": ["dist", "node_modules"]
|
|
19
13
|
}
|