@soapjs/cli 1.0.1 → 1.0.2
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/build/commands/add/repository-plan.js +3 -3
- package/build/commands/add/resource-plan.js +4 -4
- package/build/commands/add/socket-plan.js +1 -1
- package/build/commands/create/project-plan.js +16 -11
- package/build/dependencies/dependency-resolver.js +9 -11
- package/docs/plans/KAFKA_1_0_UPDATE.md +30 -0
- package/package.json +1 -1
|
@@ -132,7 +132,7 @@ import {
|
|
|
132
132
|
ReadWriteRepository,
|
|
133
133
|
TransactionScope,
|
|
134
134
|
} from '@soapjs/soap/data';
|
|
135
|
-
import { MongoSource } from '@soapjs/soap-
|
|
135
|
+
import { MongoSource } from '@soapjs/soap-mongo';
|
|
136
136
|
import { ${names.pascalName}Record } from '../application/ports/${names.kebabName}-repository.port';
|
|
137
137
|
import { ${names.camelName}Mapper } from './${names.kebabName}.mapper';
|
|
138
138
|
import { ${names.pascalName}Model } from './${names.kebabName}.model';
|
|
@@ -180,7 +180,7 @@ function createSqlSchemaTs(names, db) {
|
|
|
180
180
|
const tableName = names.pluralName.replace(/-/g, "_");
|
|
181
181
|
const createdAtColumn = db === "mysql" ? "`createdAt`" : "\"createdAt\"";
|
|
182
182
|
const updatedAtColumn = db === "mysql" ? "`updatedAt`" : "\"updatedAt\"";
|
|
183
|
-
return `import { SqlDataSource } from '@soapjs/soap-
|
|
183
|
+
return `import { SqlDataSource } from '@soapjs/soap-sql';
|
|
184
184
|
import { ${names.pascalName}Row } from './${names.kebabName}.row';
|
|
185
185
|
|
|
186
186
|
export const ${names.constantName}_TABLE = '${tableName}';
|
|
@@ -205,7 +205,7 @@ import {
|
|
|
205
205
|
ReadWriteRepository,
|
|
206
206
|
TransactionScope,
|
|
207
207
|
} from '@soapjs/soap/data';
|
|
208
|
-
import { SqlDataSource } from '@soapjs/soap-
|
|
208
|
+
import { SqlDataSource } from '@soapjs/soap-sql';
|
|
209
209
|
import { ${names.pascalName}Record } from '../application/ports/${names.kebabName}-repository.port';
|
|
210
210
|
import { ${names.camelName}Mapper } from './${names.kebabName}.mapper';
|
|
211
211
|
import { ${names.pascalName}Row } from './${names.kebabName}.row';
|
|
@@ -989,7 +989,7 @@ ${updateInput}
|
|
|
989
989
|
function createRegularCrudMongoRepositoryTs(names, fields = []) {
|
|
990
990
|
const documentFields = createInterfaceFields(fields);
|
|
991
991
|
return `import { randomUUID } from 'crypto';
|
|
992
|
-
import { MongoSource } from '@soapjs/soap-
|
|
992
|
+
import { MongoSource } from '@soapjs/soap-mongo';
|
|
993
993
|
import { Document } from 'mongodb';
|
|
994
994
|
import { ${names.pascalName}, ${names.pascalName}Props } from '../domain/${names.kebabName}.entity';
|
|
995
995
|
import { ${names.pascalName}Repository } from '../application/ports/${names.kebabName}-repository.port';
|
|
@@ -1050,7 +1050,7 @@ export class Mongo${names.pascalName}Repository implements ${names.pascalName}Re
|
|
|
1050
1050
|
function createRegularCrudSqlRepositoryTs(names, db, fields = []) {
|
|
1051
1051
|
const sql = createSqlFieldMetadata(fields, db);
|
|
1052
1052
|
return `import { randomUUID } from 'crypto';
|
|
1053
|
-
import { SqlDataSource } from '@soapjs/soap-
|
|
1053
|
+
import { SqlDataSource } from '@soapjs/soap-sql';
|
|
1054
1054
|
import { ${names.pascalName}, ${names.pascalName}Props } from '../domain/${names.kebabName}.entity';
|
|
1055
1055
|
import { ${names.pascalName}Repository } from '../application/ports/${names.kebabName}-repository.port';
|
|
1056
1056
|
|
|
@@ -1715,7 +1715,7 @@ function createMongoRepositoryTs(name, fields = []) {
|
|
|
1715
1715
|
const names = (0, naming_1.createNameVariants)(name);
|
|
1716
1716
|
const documentFields = createInterfaceFields(fields);
|
|
1717
1717
|
return `import { randomUUID } from 'crypto';
|
|
1718
|
-
import { MongoSource } from '@soapjs/soap-
|
|
1718
|
+
import { MongoSource } from '@soapjs/soap-mongo';
|
|
1719
1719
|
import { Document } from 'mongodb';
|
|
1720
1720
|
import { ${names.pascalName}, ${names.pascalName}Props } from '../domain/${names.kebabName}.entity';
|
|
1721
1721
|
import { ${names.pascalName}Repository } from '../application/ports/${names.kebabName}.repository';
|
|
@@ -1777,7 +1777,7 @@ function createSqlRepositoryTs(name, db, fields = []) {
|
|
|
1777
1777
|
const names = (0, naming_1.createNameVariants)(name);
|
|
1778
1778
|
const sql = createSqlFieldMetadata(fields, db);
|
|
1779
1779
|
return `import { randomUUID } from 'crypto';
|
|
1780
|
-
import { SqlDataSource } from '@soapjs/soap-
|
|
1780
|
+
import { SqlDataSource } from '@soapjs/soap-sql';
|
|
1781
1781
|
import { ${names.pascalName}, ${names.pascalName}Props } from '../domain/${names.kebabName}.entity';
|
|
1782
1782
|
import { ${names.pascalName}Repository } from '../application/ports/${names.kebabName}.repository';
|
|
1783
1783
|
|
|
@@ -29,7 +29,7 @@ async function createSocketFiles(root, plan) {
|
|
|
29
29
|
}
|
|
30
30
|
function createSocketTs(className, exportName, eventName, auth) {
|
|
31
31
|
const authComment = auth === "none" ? "" : "\n // TODO: validate socket auth before handling this message.\n";
|
|
32
|
-
return `import { SocketMessage, SocketServer } from '@soapjs/soap-
|
|
32
|
+
return `import { SocketMessage, SocketServer } from '@soapjs/soap-socket';
|
|
33
33
|
import { AppSocketHandler } from '../../../../common/sockets/socket.setup';
|
|
34
34
|
|
|
35
35
|
export class ${className} implements AppSocketHandler {
|
|
@@ -408,11 +408,11 @@ function createDependenciesTs(plan) {
|
|
|
408
408
|
? "import { SoapAuth } from '@soapjs/soap-auth';\nimport { createAuthProvider } from '../features/auth/auth.setup';\n"
|
|
409
409
|
: "";
|
|
410
410
|
const mongoImport = plan.capabilities.databases.includes("mongo")
|
|
411
|
-
? "import { SoapMongo } from '@soapjs/soap-
|
|
411
|
+
? "import { SoapMongo } from '@soapjs/soap-mongo';\nimport { createMongoClient } from '../common/data/mongo/mongo.client';\n"
|
|
412
412
|
: "";
|
|
413
413
|
const sqlDatabases = enabledSqlDatabases(plan.capabilities);
|
|
414
414
|
const sqlImport = sqlDatabases.length > 0
|
|
415
|
-
? `import { SoapSQL } from '@soapjs/soap-
|
|
415
|
+
? `import { SoapSQL } from '@soapjs/soap-sql';
|
|
416
416
|
${sqlDatabases.map((database) => `import { create${(0, naming_1.createNameVariants)(database).pascalName}Client } from '../common/data/${database}/${database}.client';`).join("\n")}
|
|
417
417
|
`
|
|
418
418
|
: "";
|
|
@@ -502,7 +502,7 @@ function createMongoFiles(plan) {
|
|
|
502
502
|
{
|
|
503
503
|
path: "src/config/mongo.config.ts",
|
|
504
504
|
type: "config",
|
|
505
|
-
content: `import { MongoConfig } from '@soapjs/soap-
|
|
505
|
+
content: `import { MongoConfig } from '@soapjs/soap-mongo';
|
|
506
506
|
import { AppConfig } from './config';
|
|
507
507
|
|
|
508
508
|
export function createMongoConfig(config: Pick<AppConfig, 'mongoUri'>): MongoConfig {
|
|
@@ -523,7 +523,7 @@ export function createMongoConfig(config: Pick<AppConfig, 'mongoUri'>): MongoCon
|
|
|
523
523
|
{
|
|
524
524
|
path: "src/common/data/mongo/mongo.client.ts",
|
|
525
525
|
type: "config",
|
|
526
|
-
content: `import { SoapMongo } from '@soapjs/soap-
|
|
526
|
+
content: `import { SoapMongo } from '@soapjs/soap-mongo';
|
|
527
527
|
import { AppConfig } from '../../../config/config';
|
|
528
528
|
import { createMongoConfig } from '../../../config/mongo.config';
|
|
529
529
|
|
|
@@ -535,7 +535,7 @@ export async function createMongoClient(config: AppConfig): Promise<SoapMongo> {
|
|
|
535
535
|
{
|
|
536
536
|
path: "src/common/data/mongo/mongo.source-factory.ts",
|
|
537
537
|
type: "config",
|
|
538
|
-
content: `import { MongoSource, SoapMongo } from '@soapjs/soap-
|
|
538
|
+
content: `import { MongoSource, SoapMongo } from '@soapjs/soap-mongo';
|
|
539
539
|
import { Document } from 'mongodb';
|
|
540
540
|
|
|
541
541
|
export function createMongoSource<T extends Document = Document>(mongo: SoapMongo, collectionName: string): MongoSource<T> {
|
|
@@ -555,7 +555,7 @@ function createSqlFiles(plan) {
|
|
|
555
555
|
{
|
|
556
556
|
path: "src/common/data/sql/sql.source-factory.ts",
|
|
557
557
|
type: "config",
|
|
558
|
-
content: `import { SoapSQL, SqlDataSource } from '@soapjs/soap-
|
|
558
|
+
content: `import { SoapSQL, SqlDataSource } from '@soapjs/soap-sql';
|
|
559
559
|
|
|
560
560
|
export function createSqlSource<T = Record<string, unknown>>(sql: SoapSQL, tableName: string): SqlDataSource<T> {
|
|
561
561
|
return new SqlDataSource<T>(sql, tableName);
|
|
@@ -576,7 +576,7 @@ function createSqlDatabaseFiles(database) {
|
|
|
576
576
|
{
|
|
577
577
|
path: `src/config/${database}.config.ts`,
|
|
578
578
|
type: "config",
|
|
579
|
-
content: `import { SqlDatabaseConfig } from '@soapjs/soap-
|
|
579
|
+
content: `import { SqlDatabaseConfig } from '@soapjs/soap-sql';
|
|
580
580
|
import { AppConfig } from './config';
|
|
581
581
|
|
|
582
582
|
export function create${names.pascalName}Config(config: Pick<AppConfig, '${configProperty}'>): SqlDatabaseConfig {
|
|
@@ -590,7 +590,7 @@ ${createSqlConfigProperties(database, configProperty)}
|
|
|
590
590
|
{
|
|
591
591
|
path: `src/common/data/${database}/${database}.client.ts`,
|
|
592
592
|
type: "config",
|
|
593
|
-
content: `import { SoapSQL } from '@soapjs/soap-
|
|
593
|
+
content: `import { SoapSQL } from '@soapjs/soap-sql';
|
|
594
594
|
import { AppConfig } from '../../../config/config';
|
|
595
595
|
import { create${names.pascalName}Config } from '../../../config/${database}.config';
|
|
596
596
|
|
|
@@ -604,6 +604,11 @@ export async function create${names.pascalName}Client(config: AppConfig): Promis
|
|
|
604
604
|
function createSqlConfigProperties(database, configProperty) {
|
|
605
605
|
if (database === "sqlite") {
|
|
606
606
|
return ` type: 'sqlite',
|
|
607
|
+
host: 'localhost',
|
|
608
|
+
port: 0,
|
|
609
|
+
database: config.${configProperty}.filename,
|
|
610
|
+
username: '',
|
|
611
|
+
password: '',
|
|
607
612
|
filename: config.${configProperty}.filename,`;
|
|
608
613
|
}
|
|
609
614
|
const sqlType = database === "postgres" ? "postgresql" : "mysql";
|
|
@@ -706,7 +711,7 @@ export function createKafkaConfig(config: Pick<AppConfig, 'kafkaBrokers'>) {
|
|
|
706
711
|
}, {
|
|
707
712
|
path: "src/common/events/kafka/kafka.client.ts",
|
|
708
713
|
type: "config",
|
|
709
|
-
content: `import { KafkaEventBus } from '@soapjs/soap-
|
|
714
|
+
content: `import { KafkaEventBus } from '@soapjs/soap-kafka';
|
|
710
715
|
import { AppConfig } from '../../../config/config';
|
|
711
716
|
import { createKafkaConfig } from '../../../config/kafka.config';
|
|
712
717
|
|
|
@@ -717,7 +722,7 @@ export function createKafkaClient(config: AppConfig): KafkaEventBus<Record<strin
|
|
|
717
722
|
}, {
|
|
718
723
|
path: "src/common/events/kafka/kafka-event-bus.ts",
|
|
719
724
|
type: "config",
|
|
720
|
-
content: `import { KafkaDomainEventBus } from '@soapjs/soap-
|
|
725
|
+
content: `import { KafkaDomainEventBus } from '@soapjs/soap-kafka';
|
|
721
726
|
import { Logger } from '@soapjs/soap/common';
|
|
722
727
|
import { AppConfig } from '../../../config/config';
|
|
723
728
|
import { createKafkaClient } from './kafka.client';
|
|
@@ -752,7 +757,7 @@ export const socketHandlers: AppSocketHandler[] = [];
|
|
|
752
757
|
type: "config",
|
|
753
758
|
content: `import { Server } from 'http';
|
|
754
759
|
import { Drainable } from '@soapjs/soap/events';
|
|
755
|
-
import { SocketMessage, SocketServer, WebSocketServerAdapter } from '@soapjs/soap-
|
|
760
|
+
import { SocketMessage, SocketServer, WebSocketServerAdapter } from '@soapjs/soap-socket';
|
|
756
761
|
import { AppConfig } from '../../config/config';
|
|
757
762
|
import { socketHandlers } from '../../config/sockets';
|
|
758
763
|
|
|
@@ -4,7 +4,7 @@ exports.resolveDependencies = resolveDependencies;
|
|
|
4
4
|
function resolveDependencies(capabilities) {
|
|
5
5
|
const dependencies = {
|
|
6
6
|
"@soapjs/soap": "^0.14.0",
|
|
7
|
-
"@soapjs/soap-express": "^0.
|
|
7
|
+
"@soapjs/soap-express": "^1.0.0",
|
|
8
8
|
dotenv: "^16.4.5",
|
|
9
9
|
express: "^4.18.2",
|
|
10
10
|
"reflect-metadata": "^0.2.2",
|
|
@@ -16,11 +16,11 @@ function resolveDependencies(capabilities) {
|
|
|
16
16
|
typescript: "^5.4.0",
|
|
17
17
|
};
|
|
18
18
|
if (capabilities.databases.includes("mongo")) {
|
|
19
|
-
dependencies["@soapjs/soap-
|
|
19
|
+
dependencies["@soapjs/soap-mongo"] = "^1.0.0";
|
|
20
20
|
dependencies.mongodb = "^6.3.0";
|
|
21
21
|
}
|
|
22
22
|
if (capabilities.databases.includes("postgres") || capabilities.databases.includes("mysql") || capabilities.databases.includes("sqlite")) {
|
|
23
|
-
dependencies["@soapjs/soap-
|
|
23
|
+
dependencies["@soapjs/soap-sql"] = "^1.0.0";
|
|
24
24
|
}
|
|
25
25
|
if (capabilities.databases.includes("postgres")) {
|
|
26
26
|
dependencies.pg = "^8.11.3";
|
|
@@ -30,30 +30,28 @@ function resolveDependencies(capabilities) {
|
|
|
30
30
|
dependencies.mysql2 = "^3.11.0";
|
|
31
31
|
}
|
|
32
32
|
if (capabilities.databases.includes("sqlite")) {
|
|
33
|
-
dependencies
|
|
34
|
-
devDependencies["@types/better-sqlite3"] = "^7.6.11";
|
|
33
|
+
dependencies.sqlite3 = "^5.1.7";
|
|
35
34
|
}
|
|
36
35
|
if (capabilities.databases.includes("redis")) {
|
|
37
|
-
dependencies["@soapjs/soap-node-redis"] = "^0.1.1";
|
|
38
36
|
dependencies.redis = "^4.6.13";
|
|
39
37
|
}
|
|
40
38
|
if (capabilities.auth.length > 0) {
|
|
41
39
|
dependencies["@soapjs/soap-auth"] = "^1.0.1";
|
|
42
40
|
}
|
|
43
41
|
if (capabilities.messaging.includes("kafka")) {
|
|
44
|
-
dependencies["@soapjs/soap-
|
|
42
|
+
dependencies["@soapjs/soap-kafka"] = "^1.0.0";
|
|
45
43
|
dependencies.kafkajs = "^2.2.4";
|
|
46
44
|
}
|
|
47
45
|
if (capabilities.realtime.includes("ws")) {
|
|
48
|
-
dependencies["@soapjs/soap-
|
|
49
|
-
dependencies.ws = "^8.
|
|
46
|
+
dependencies["@soapjs/soap-socket"] = "^1.0.0";
|
|
47
|
+
dependencies.ws = "^8.18.0";
|
|
50
48
|
devDependencies["@types/ws"] = "^8.5.10";
|
|
51
49
|
}
|
|
52
50
|
if (capabilities.telemetry.includes("otel-noop")) {
|
|
53
|
-
dependencies["@soapjs/soap-
|
|
51
|
+
dependencies["@soapjs/soap-otel"] = "^1.0.0";
|
|
54
52
|
}
|
|
55
53
|
if (capabilities.docs.includes("openapi")) {
|
|
56
|
-
dependencies["@soapjs/soap-openapi"] = "^0.
|
|
54
|
+
dependencies["@soapjs/soap-openapi"] = "^1.0.0";
|
|
57
55
|
}
|
|
58
56
|
if (capabilities.contracts.includes("zod")) {
|
|
59
57
|
dependencies.zod = "^3.23.8";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Kafka Adapter 1.0 Update
|
|
2
|
+
|
|
3
|
+
This checklist tracks the changes needed in `soap-cli` after the Kafka adapter release as `@soapjs/soap-kafka@1.0.0`.
|
|
4
|
+
|
|
5
|
+
## Required Changes
|
|
6
|
+
|
|
7
|
+
- Replace generated Kafka dependency:
|
|
8
|
+
- from `@soapjs/soap-node-kafka: ^0.1.3`
|
|
9
|
+
- to `@soapjs/soap-kafka: ^1.0.0`
|
|
10
|
+
- file: `src/dependencies/dependency-resolver.ts`
|
|
11
|
+
|
|
12
|
+
- Replace generated Kafka imports:
|
|
13
|
+
- from `@soapjs/soap-node-kafka`
|
|
14
|
+
- to `@soapjs/soap-kafka`
|
|
15
|
+
- file: `src/commands/create/project-plan.ts`
|
|
16
|
+
|
|
17
|
+
- Verify generated project templates still compile when `messaging.kafka` is selected:
|
|
18
|
+
- generated `src/common/events/kafka/kafka.client.ts`
|
|
19
|
+
- generated `src/common/events/kafka/kafka-event-bus.ts`
|
|
20
|
+
- generated `package.json`
|
|
21
|
+
|
|
22
|
+
## Compatibility Notes
|
|
23
|
+
|
|
24
|
+
- `KafkaEventBus` and `KafkaDomainEventBus` are still exported by the new package.
|
|
25
|
+
- The adapter peer dependency is now `@soapjs/soap@^0.14.0`.
|
|
26
|
+
- If CLI templates ever generate `EventProcessor` options with a custom strategy, use `processingStrategy`, not the old `strategy` property.
|
|
27
|
+
|
|
28
|
+
## Out Of Scope
|
|
29
|
+
|
|
30
|
+
- `test-cli/*` fixtures can be ignored for this migration unless they are intentionally refreshed later.
|
package/package.json
CHANGED